1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
#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 allocPages(u32int pos, u32int end) {
doCall(PRIF_ALLOCPAGES, pos, end);
}
void freePages(u32int pos, u32int end) {
doCall(PRIF_FREEPAGES, pos, end);
}
u32int getPid() {
return doCall(PRIF_GETPID);
}
u32int getPpid() {
return doCall(PRIF_GETPPID);
}
u32int getUid() {
return doCall(PRIF_GETUID);
}
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
|