blob: 948d67044f23c8ccbdf803dcdfc4d940753e669f (
plain) (
tree)
|
|
#ifndef DEF_PROCESS_CLASS_H
#define DEF_PROCESS_CLASS_H
#include <Syscall/RessourceCaller.class.h>
#include <Binding/VirtualTerminal.class.h>
#include <Process.iface.h>
#include <String.class.h>
class Process : public RessourceCaller {
public:
static Process get() {
u32int id = RessourceCaller::sCall(PRIF_OBJTYPE, PRIF_SGETCPR);
return Process(id);
}
static Process run(const String& app) {
return Process(sCall(PRIF_OBJTYPE, PRIF_SRUN, (u32int)&app));
}
Process(u32int id) : RessourceCaller(id, PRIF_OBJTYPE) {}
void exit() {
doCall(PRIF_EXIT);
}
void allocPage(u32int pos) {
doCall(PRIF_ALLOCPAGE, pos);
}
void freePage(u32int pos) {
doCall(PRIF_FREEPAGE, pos);
}
u32int getPid() {
return doCall(PRIF_GETPID);
}
u32int getPpid() {
return doCall(PRIF_GETPPID);
}
u32int argc() {
return doCall(PRIF_ARGC);
}
String argv(u32int idx) {
return String::unserialize(doCall(PRIF_ARGV, idx));
}
void start() {
doCall(PRIF_START);
}
s32int wait() {
return sCall(PRIF_OBJTYPE, PRIF_SWAIT, resId());
}
void autoDelete(bool ad = true) {
doCall(PRIF_AUTODELETE, (ad ? 1 : 0));
}
void pushArg(const String& arg) {
doCall(PRIF_PUSHARG, (u32int)&arg);
}
void setInVT(VirtualTerminal vt) {
doCall(PRIF_SETINVT, vt.resId());
}
void setOutVT(VirtualTerminal vt) {
doCall(PRIF_SETOUTVT, vt.resId());
}
bool authenticatePW(String user, String pw) {
return (doCall(PRIF_AUTHPW, (u32int)&user, (u32int)&pw) == 1);
}
bool authenticateNoPW(String user) {
return (doCall(PRIF_AUTHNOPW, (u32int)&user) == 1);
}
};
#endif
|