Rudiments
/home/dmuse/src/rudiments/include/rudiments/process.h
00001 // Copyright (c) 2004 David Muse
00002 // See the COPYING file for more information.
00003 
00004 #ifndef RUDIMENTS_PROCESS_H
00005 #define RUDIMENTS_PROCESS_H
00006 
00007 #include <rudiments/private/processincludes.h>
00008 
00009 #ifdef RUDIMENTS_NAMESPACE
00010 namespace rudiments {
00011 #endif
00012 
00013 // wrap:
00014 //      unistd.h - nice()
00015 //                      getgroups()
00016 //                      vfork()
00017 //                      profil()
00018 //                      acct()
00019 //                      getdtablesize()
00020 //                      brk()/sbrk()
00021 //                      syscall()
00022 //      sched.h - functions for manipulating the scheduler
00023 //                      sched_setparam(),sched_getparam()
00024 //                      sched_setscheduler(),sched_getscheduler()
00025 //                      sched_yield(),
00026 //                      sched_get_priority_max(),sched_get_priority_min()
00027 //                      sched_rr_get_interval()
00028 //                      sched_setaffinity(),sched_getaffinity()
00029 //      sys/acct.h - acct() - process accounting on/off
00030 //      sys/ptrace.h - ptrace()
00031 //      sys/resource.h - get/set process priority/resource usage
00032 //                              getrlimit(),setrlimit()
00033 //                              getrusage()
00034 //                              getpriority(),setpriority()
00035 //      sys/times.h - times() - function for getting process times
00036 //      not in many systems - 
00037 //              unistd.h - group_member()
00038 //                              getresuid(),getresgid()
00039 //                              setresuid(),setresgid()
00040 //              sys/gmon.h and sys/gmon_out.h - monstartup()
00041 //      linux only - 
00042 //              execinfo.h - backtrace(),backtrace_symbols(),
00043 //                              backtrace_symbols_fd()
00044 //              sys/prctl.h - prctl()
00045 //      not in bsd - 
00046 //              ucontext.h - user-level context switching
00047 //                      getcontext(),setcontext(),swapcontext(),makecontext()
00048 
00051 class RUDIMENTS_DLLSPEC process {
00052         public:
00053 
00055                 static  pid_t   getProcessId();
00056 
00059                 static  pid_t   getParentProcessId();
00060 
00063                 static  pid_t   getProcessGroupId();
00064 
00067                 static  pid_t   getProcessGroupId(pid_t pid);
00068 
00071                 static  bool    setProcessGroupId();
00072 
00074                 static  bool    setProcessGroupId(pid_t pgid);
00075 
00077                 static  bool    setProcessGroupId(pid_t pid, pid_t pgid);
00078 
00080                 static  pid_t   getSessionId();
00081 
00083                 static  pid_t   getSessionId(pid_t pid);
00084 
00086                 static  uid_t   getRealUserId();
00087 
00089                 static  uid_t   getEffectiveUserId();
00090 
00096                 static bool     setUserId(uid_t uid);
00097 
00102                 static bool     setEffectiveUserId(uid_t uid);
00103 
00111                 static bool     setRealAndEffectiveUserId(uid_t uid,
00112                                                                 uid_t euid);
00113 
00115                 static  gid_t   getRealGroupId();
00116 
00118                 static  gid_t   getEffectiveGroupId();
00119 
00125                 static bool     setGroupId(gid_t gid);
00126 
00131                 static bool     setEffectiveGroupId(gid_t gid);
00132 
00140                 static bool     setRealAndEffectiveGroupId(gid_t gid,
00141                                                                 gid_t egid);
00142 
00145                 static mode_t   setFileCreationMask(mode_t mask);
00146 
00154                 static pid_t    fork();
00155 
00161                 static bool     detach();
00162 
00165                 static void     exit(int32_t status);
00166 
00170                 static void     exitImmediately(int32_t status);
00171 };
00172 
00173 #ifdef RUDIMENTS_NAMESPACE
00174 }
00175 #endif
00176 
00177 #endif