Rudiments: /home/dmuse/src/rudiments/include/rudiments/process.h Source File

Rudiments

- Main Page
- Classes

process.h
1 // Copyright (c) 1999-2013 David Muse
2 // See the COPYING file for more information.
3
4 #ifndef RUDIMENTS_PROCESS_H
5 #define RUDIMENTS_PROCESS_H
6
7 #include <rudiments/private/processincludes.h>
8
9 enum childstatechange {
10 EXIT_CHILDSTATECHANGE=0,
11 TERMINATED_CHILDSTATECHANGE,
12 STOPPED_CHILDSTATECHANGE,
13 CONTINUED_CHILDSTATECHANGE
14 };
15
19 class RUDIMENTS_DLLSPEC process {
20 public:
21
23 static pid_t getProcessId();
24
27 static pid_t getParentProcessId();
28
31 static pid_t getProcessGroupId();
32
35 static pid_t getProcessGroupId(pid_t pid);
36
39 static bool setProcessGroupId();
40
42 static bool setProcessGroupId(pid_t pgid);
43
45 static bool setProcessGroupId(pid_t pid, pid_t pgid);
46
48 static pid_t getSessionId();
49
51 static pid_t getSessionId(pid_t pid);
52
57 static pid_t newSession();
58
60 static uid_t getUserId();
61
63 static uid_t getEffectiveUserId();
64
70 static bool setUserId(uid_t uid);
71
77 static bool setUser(const char *username);
78
83 static bool setEffectiveUserId(uid_t uid);
84
90 static bool setEffectiveUser(const char *username);
91
99 static bool setRealAndEffectiveUserId(uid_t uid,
100 uid_t euid);
101
103 static gid_t getGroupId();
104
106 static gid_t getEffectiveGroupId();
107
113 static bool setGroupId(gid_t gid);
114
120 static bool setGroup(const char *groupname);
121
126 static bool setEffectiveGroupId(gid_t gid);
127
133 static bool setEffectiveGroup(const char *groupname);
134
142 static bool setRealAndEffectiveGroupId(gid_t gid,
143 gid_t egid);
144
147 static mode_t setFileCreationMask(mode_t mask);
148
156 static pid_t fork();
157
160 static bool supportsFork();
161
170 static bool exec(const char *command,
171 const char * const *args);
172
183 static pid_t spawn(const char *command,
184 const char * const *args,
185 bool detached);
186
192 static bool detach();
193
196 static void exit(int32_t status);
197
201 static void exitImmediately(int32_t status);
202
206 static bool atExit(void (*function)(void));
207
210 static void exitOnCrashOrShutDown();
211
215 static int64_t checkForPidFile(const char *filename);
216
224 static bool createPidFile(const char *filename,
225 mode_t permissions);
226
232 static void exitOnShutDown();
233
237 static void handleShutDown(
238 void (*shutdownfunction)(int32_t));
239
246 static void exitOnCrash();
247
252 static void handleCrash(void (*crashfunction)(int32_t));
253
257 static void waitForChildren();
258
265 static void dontWaitForChildren();
266
310 static pid_t getChildStateChange(pid_t pid,
311 bool wait,
312 bool ignorestop,
313 bool ignorecontinue,
314 childstatechange *newstate,
315 int32_t *exitstatus,
316 int32_t *signum,
317 bool *coredump);
318
321 static bool supportsGetChildStateChange();
322
328 void retryFailedFork();
329
334 void dontRetryFailedFork();
335
338 bool getRetryFailedFork();
339
340 #include <rudiments/private/process.h>
341 };
342
343 #endif
permissions
Definition: permissions.h:28
process
Definition: process.h:19