File: process.h.html

package info (click to toggle)
rudiments 0.31-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 7,516 kB
  • ctags: 3,248
  • sloc: asm: 23,776; cpp: 22,792; sh: 7,769; ansic: 1,769; makefile: 1,054; xml: 169; perl: 19
file content (158 lines) | stat: -rw-r--r-- 11,924 bytes parent folder | download | duplicates (2)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<html>
<head>
<title>~/src/firstworks/rudiments-0.31/include/rudiments/process.h.html</title>
<meta name="Generator" content="Vim/7.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="#ffffff" text="#000000">
<pre>
<font color="#0000ff">// Copyright (c) 2004 David Muse</font>
<font color="#0000ff">// See the COPYING file for more information.</font>

<font color="#a020f0">#ifndef RUDIMENTS_PROCESS_H</font>
<font color="#a020f0">#define RUDIMENTS_PROCESS_H</font>

<font color="#a020f0">#include </font><font color="#ff00ff">&lt;rudiments/private/processincludes.h&gt;</font>

<font color="#0000ff">// wrap:</font>
<font color="#0000ff">//      unistd.h - nice()</font>
<font color="#0000ff">//                      setsid()</font>
<font color="#0000ff">//                      getgroups()</font>
<font color="#0000ff">//                      fork(),vfork()</font>
<font color="#0000ff">//                      profil()</font>
<font color="#0000ff">//                      acct()</font>
<font color="#0000ff">//                      getdtablesize()</font>
<font color="#0000ff">//                      brk()/sbrk()</font>
<font color="#0000ff">//                      syscall()</font>
<font color="#0000ff">//      sched.h - functions for manipulating the scheduler</font>
<font color="#0000ff">//                      sched_setparam(),sched_getparam()</font>
<font color="#0000ff">//                      sched_setscheduler(),sched_getscheduler()</font>
<font color="#0000ff">//                      sched_yield(),</font>
<font color="#0000ff">//                      sched_get_priority_max(),sched_get_priority_min()</font>
<font color="#0000ff">//                      sched_rr_get_interval()</font>
<font color="#0000ff">//                      sched_setaffinity(),sched_getaffinity()</font>
<font color="#0000ff">//      sys/acct.h - acct() - process accounting on/off</font>
<font color="#0000ff">//      sys/ptrace.h - ptrace()</font>
<font color="#0000ff">//      sys/resource.h - get/set process priority/resource usage</font>
<font color="#0000ff">//                              getrlimit(),setrlimit()</font>
<font color="#0000ff">//                              getrusage()</font>
<font color="#0000ff">//                              getpriority(),setpriority()</font>
<font color="#0000ff">//      sys/stat.h - umask()</font>
<font color="#0000ff">//      sys/times.h - times() - function for getting process times</font>
<font color="#0000ff">//      not in solaris -</font>
<font color="#0000ff">//              unistd.h - daemon()</font>
<font color="#0000ff">//      not in many systems - </font>
<font color="#0000ff">//              unistd.h - group_member()</font>
<font color="#0000ff">//                              getresuid(),getresgid()</font>
<font color="#0000ff">//                              setresuid(),setresgid()</font>
<font color="#0000ff">//              sys/gmon.h and sys/gmon_out.h - monstartup()</font>
<font color="#0000ff">//      linux only - </font>
<font color="#0000ff">//              execinfo.h - backtrace(),backtrace_symbols(),</font>
<font color="#0000ff">//                              backtrace_symbols_fd()</font>
<font color="#0000ff">//              sys/prctl.h - prctl()</font>
<font color="#0000ff">//      not in bsd - </font>
<font color="#0000ff">//              ucontext.h - user-level context switching</font>
<font color="#0000ff">//                      getcontext(),setcontext(),swapcontext(),makecontext()</font>

<font color="#a020f0">#ifdef RUDIMENTS_NAMESPACE</font>
<font color="#2e8b57"><b>namespace</b></font> rudiments {
<font color="#a020f0">#endif</font>

<font color="#2e8b57"><b>class</b></font> process {
        <font color="#a52a2a"><b>public</b></font>:

                <font color="#2e8b57"><b>static</b></font>        pid_t   getProcessId();
                                <font color="#0000ff">// returns the process id of the current process</font>
                <font color="#2e8b57"><b>static</b></font>        pid_t   getParentProcessId();
                                <font color="#0000ff">// returns the process id of the parent process</font>
                                <font color="#0000ff">// of the current process</font>

                <font color="#2e8b57"><b>static</b></font>        pid_t   getProcessGroupId();
                                <font color="#0000ff">// returns the process group id of the</font>
                                <font color="#0000ff">// current process</font>
                <font color="#2e8b57"><b>static</b></font>        pid_t   getProcessGroupId(pid_t pid);
                                <font color="#0000ff">// returns the process group id of the</font>
                                <font color="#0000ff">// process pid</font>

                <font color="#2e8b57"><b>static</b></font>        <font color="#2e8b57"><b>bool</b></font>   setProcessGroupId();
                                <font color="#0000ff">// sets the process group id of the current</font>
                                <font color="#0000ff">// process to the current process id</font>
                <font color="#2e8b57"><b>static</b></font>        <font color="#2e8b57"><b>bool</b></font>   setProcessGroupId(pid_t pgid);
                                <font color="#0000ff">// sets the process group id of the current</font>
                                <font color="#0000ff">// process to pgid</font>
                <font color="#2e8b57"><b>static</b></font>        <font color="#2e8b57"><b>bool</b></font>   setProcessGroupId(pid_t pid, pid_t pgid);
                                <font color="#0000ff">// sets the process group id of the process</font>
                                <font color="#0000ff">// pid to pgid</font>

                <font color="#2e8b57"><b>static</b></font>        pid_t   getSessionId();
                                <font color="#0000ff">// returns the session id of the current process</font>
                <font color="#2e8b57"><b>static</b></font>        pid_t   getSessionId(pid_t pid);
                                <font color="#0000ff">// returns the session id of the process pid</font>

                <font color="#2e8b57"><b>static</b></font>        gid_t   getRealUserId();
                                <font color="#0000ff">// returns the real user id of the</font>
                                <font color="#0000ff">// current process</font>
                <font color="#2e8b57"><b>static</b></font>        gid_t   getEffectiveUserId();
                                <font color="#0000ff">// returns the effective user id of the</font>
                                <font color="#0000ff">// current process</font>

                <font color="#2e8b57"><b>static</b></font> <font color="#2e8b57"><b>bool</b></font>   setUserId(uid_t uid);
                                <font color="#0000ff">// Sets the effective user id of the current</font>
                                <font color="#0000ff">// process to uid.  If the effective user id</font>
                                <font color="#0000ff">// is root, the real and saved user id's are</font>
                                <font color="#0000ff">// also set.</font>
                                <font color="#0000ff">// Returns true on success and false on failure.</font>
                <font color="#2e8b57"><b>static</b></font> <font color="#2e8b57"><b>bool</b></font>   setEffectiveUserId(uid_t uid);
                                <font color="#0000ff">// Sets the effective user id of the current</font>
                                <font color="#0000ff">// process to uid.  Does not set the real</font>
                                <font color="#0000ff">// or saved user id's.</font>
                                <font color="#0000ff">// Returns true on success and false on failure.</font>
                <font color="#2e8b57"><b>static</b></font> <font color="#2e8b57"><b>bool</b></font>   setRealAndEffectiveUserId(uid_t uid,
                                                                uid_t euid);
                                <font color="#0000ff">// Sets the real user id of the current process</font>
                                <font color="#0000ff">// to uid and the effective user id of</font>
                                <font color="#0000ff">// the current process to euid.</font>
                                <font color="#0000ff">// If the real user id is set or the effective</font>
                                <font color="#0000ff">// user id is set to a value not equal to the</font>
                                <font color="#0000ff">// previous real user id, the saved user id is</font>
                                <font color="#0000ff">// set to the new effective user id.</font>
                                <font color="#0000ff">// Returns true on success and false on failure.</font>

                <font color="#2e8b57"><b>static</b></font>        gid_t   getRealGroupId();
                                <font color="#0000ff">// returns the real group id of the</font>
                                <font color="#0000ff">// current process</font>
                <font color="#2e8b57"><b>static</b></font>        gid_t   getEffectiveGroupId();
                                <font color="#0000ff">// returns the effective group id of the</font>
                                <font color="#0000ff">// current process</font>

                <font color="#2e8b57"><b>static</b></font> <font color="#2e8b57"><b>bool</b></font>   setGroupId(gid_t gid);
                                <font color="#0000ff">// Sets the effective group id of the current</font>
                                <font color="#0000ff">// process to gid.  If the effective group id</font>
                                <font color="#0000ff">// is root, the real and saved group id's are</font>
                                <font color="#0000ff">// also set.</font>
                                <font color="#0000ff">// Returns true on success and false on failure.</font>
                <font color="#2e8b57"><b>static</b></font> <font color="#2e8b57"><b>bool</b></font>   setEffectiveGroupId(gid_t gid);
                                <font color="#0000ff">// Sets the effective group id of the current</font>
                                <font color="#0000ff">// process to gid.  Does not set the real</font>
                                <font color="#0000ff">// or saved group id's.</font>
                                <font color="#0000ff">// Returns true on success and false on failure.</font>
                <font color="#2e8b57"><b>static</b></font> <font color="#2e8b57"><b>bool</b></font>   setRealAndEffectiveGroupId(gid_t gid,
                                                                gid_t egid);
                                <font color="#0000ff">// Sets the real group id of the current process</font>
                                <font color="#0000ff">// to gid and the effective group id of</font>
                                <font color="#0000ff">// the current process to egid.</font>
                                <font color="#0000ff">// If the real group id is set or the effective</font>
                                <font color="#0000ff">// group id is set to a value not equal to the</font>
                                <font color="#0000ff">// previous real group id, the saved group id is</font>
                                <font color="#0000ff">// set to the new effective group id.</font>
                                <font color="#0000ff">// Returns true on success and false on failure.</font>
};

<font color="#a020f0">#ifdef RUDIMENTS_NAMESPACE</font>
}
<font color="#a020f0">#endif</font>

<font color="#a020f0">#endif</font>
</pre>
</body>
</html>