1 # SOME DESCRIPTIVE TITLE
2 # Copyright (C) YEAR Free Software Foundation, Inc.
3 # This file is distributed under the same license as the PACKAGE package.
4 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
9 "Project-Id-Version: PACKAGE VERSION\n"
10 "POT-Creation-Date: 2015-02-04 23:33+0900\n"
11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Language-Team: LANGUAGE <LL@li.org>\n"
16 "Content-Type: text/plain; charset=UTF-8\n"
17 "Content-Transfer-Encoding: 8bit\n"
20 #: build/C/man2/acct.2:31 build/C/man5/acct.5:25
26 #: build/C/man2/acct.2:31
32 #: build/C/man2/acct.2:31 build/C/man5/acct.5:25 build/C/man7/capabilities.7:48 build/C/man2/capget.2:15 build/C/man7/cpuset.7:25 build/C/man7/credentials.7:27 build/C/man2/getgid.2:25 build/C/man2/getgroups.2:31 build/C/man2/getpid.2:25 build/C/man2/getpriority.2:45 build/C/man2/getresuid.2:28 build/C/man2/getrlimit.2:64 build/C/man2/getrusage.2:39 build/C/man2/getsid.2:26 build/C/man2/getuid.2:26 build/C/man2/iopl.2:33 build/C/man2/ioprio_set.2:24 build/C/man2/ipc.2:25 build/C/man7/namespaces.7:27 build/C/man7/pid_namespaces.7:27 build/C/man2/seteuid.2:29 build/C/man2/setfsgid.2:31 build/C/man2/setfsuid.2:31 build/C/man2/setgid.2:29 build/C/man2/setpgid.2:48 build/C/man2/setresuid.2:26 build/C/man2/setreuid.2:45 build/C/man2/setsid.2:31 build/C/man2/setuid.2:30 build/C/man7/svipc.7:40 build/C/man3/ulimit.3:27 build/C/man7/user_namespaces.7:27 build/C/man2/seccomp.2:27
38 #: build/C/man2/acct.2:31 build/C/man5/acct.5:25 build/C/man7/capabilities.7:48 build/C/man2/capget.2:15 build/C/man7/cpuset.7:25 build/C/man7/credentials.7:27 build/C/man2/getgid.2:25 build/C/man2/getgroups.2:31 build/C/man2/getpid.2:25 build/C/man2/getpriority.2:45 build/C/man2/getresuid.2:28 build/C/man2/getrlimit.2:64 build/C/man2/getrusage.2:39 build/C/man2/getsid.2:26 build/C/man2/getuid.2:26 build/C/man3/group_member.3:25 build/C/man2/iopl.2:33 build/C/man2/ioprio_set.2:24 build/C/man2/ipc.2:25 build/C/man7/namespaces.7:27 build/C/man7/pid_namespaces.7:27 build/C/man2/seteuid.2:29 build/C/man2/setfsgid.2:31 build/C/man2/setfsuid.2:31 build/C/man2/setgid.2:29 build/C/man2/setpgid.2:48 build/C/man2/setresuid.2:26 build/C/man2/setreuid.2:45 build/C/man2/setsid.2:31 build/C/man2/setuid.2:30 build/C/man7/svipc.7:40 build/C/man3/ulimit.3:27 build/C/man7/user_namespaces.7:27 build/C/man2/seccomp.2:27
40 msgid "Linux Programmer's Manual"
44 #: build/C/man2/acct.2:32 build/C/man5/acct.5:26 build/C/man7/capabilities.7:49 build/C/man2/capget.2:16 build/C/man7/cpuset.7:26 build/C/man7/credentials.7:28 build/C/man2/getgid.2:26 build/C/man2/getgroups.2:32 build/C/man2/getpid.2:26 build/C/man2/getpriority.2:46 build/C/man2/getresuid.2:29 build/C/man2/getrlimit.2:65 build/C/man2/getrusage.2:40 build/C/man2/getsid.2:27 build/C/man2/getuid.2:27 build/C/man3/group_member.3:26 build/C/man2/iopl.2:34 build/C/man2/ioprio_set.2:25 build/C/man2/ipc.2:26 build/C/man7/namespaces.7:28 build/C/man7/pid_namespaces.7:28 build/C/man2/seteuid.2:30 build/C/man2/setfsgid.2:32 build/C/man2/setfsuid.2:32 build/C/man2/setgid.2:30 build/C/man2/setpgid.2:49 build/C/man2/setresuid.2:27 build/C/man2/setreuid.2:46 build/C/man2/setsid.2:32 build/C/man2/setuid.2:31 build/C/man7/svipc.7:41 build/C/man3/ulimit.3:28 build/C/man7/user_namespaces.7:28 build/C/man2/seccomp.2:28
50 #: build/C/man2/acct.2:34
51 msgid "acct - switch process accounting on or off"
55 #: build/C/man2/acct.2:34 build/C/man5/acct.5:28 build/C/man2/capget.2:18 build/C/man2/getgid.2:28 build/C/man2/getgroups.2:34 build/C/man2/getpid.2:28 build/C/man2/getpriority.2:48 build/C/man2/getresuid.2:31 build/C/man2/getrlimit.2:67 build/C/man2/getrusage.2:42 build/C/man2/getsid.2:29 build/C/man2/getuid.2:29 build/C/man3/group_member.3:28 build/C/man2/iopl.2:36 build/C/man2/ioprio_set.2:27 build/C/man2/ipc.2:28 build/C/man2/seteuid.2:32 build/C/man2/setfsgid.2:34 build/C/man2/setfsuid.2:34 build/C/man2/setgid.2:32 build/C/man2/setpgid.2:51 build/C/man2/setresuid.2:29 build/C/man2/setreuid.2:48 build/C/man2/setsid.2:34 build/C/man2/setuid.2:33 build/C/man7/svipc.7:43 build/C/man3/ulimit.3:30 build/C/man2/seccomp.2:30
61 #: build/C/man2/acct.2:38
63 msgid "B<#include E<lt>unistd.hE<gt>>\n"
67 #: build/C/man2/acct.2:40
69 msgid "B<int acct(const char *>I<filename>B<);>\n"
73 #: build/C/man2/acct.2:46 build/C/man2/getgroups.2:48 build/C/man2/getrlimit.2:84 build/C/man2/getsid.2:37 build/C/man3/group_member.3:36 build/C/man2/seteuid.2:44 build/C/man2/setpgid.2:71 build/C/man2/setreuid.2:60
74 msgid "Feature Test Macro Requirements for glibc (see B<feature_test_macros>(7)):"
78 #: build/C/man2/acct.2:50
79 msgid "B<acct>(): _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE\\ E<lt>\\ 500)"
83 #: build/C/man2/acct.2:50 build/C/man5/acct.5:30 build/C/man7/capabilities.7:51 build/C/man2/capget.2:24 build/C/man7/cpuset.7:28 build/C/man7/credentials.7:30 build/C/man2/getgid.2:36 build/C/man2/getgroups.2:52 build/C/man2/getpid.2:36 build/C/man2/getpriority.2:56 build/C/man2/getresuid.2:39 build/C/man2/getrlimit.2:88 build/C/man2/getrusage.2:48 build/C/man2/getsid.2:50 build/C/man2/getuid.2:37 build/C/man3/group_member.3:40 build/C/man2/iopl.2:40 build/C/man2/ioprio_set.2:35 build/C/man2/ipc.2:34 build/C/man7/namespaces.7:30 build/C/man7/pid_namespaces.7:30 build/C/man2/seteuid.2:53 build/C/man2/setfsgid.2:38 build/C/man2/setfsuid.2:38 build/C/man2/setgid.2:38 build/C/man2/setpgid.2:100 build/C/man2/setresuid.2:37 build/C/man2/setreuid.2:70 build/C/man2/setsid.2:41 build/C/man2/setuid.2:39 build/C/man7/svipc.7:49 build/C/man3/ulimit.3:34 build/C/man7/user_namespaces.7:30 build/C/man2/seccomp.2:43
89 #: build/C/man2/acct.2:60
91 "The B<acct>() system call enables or disables process accounting. If "
92 "called with the name of an existing file as its argument, accounting is "
93 "turned on, and records for each terminating process are appended to "
94 "I<filename> as it terminates. An argument of NULL causes accounting to be "
99 #: build/C/man2/acct.2:60 build/C/man2/capget.2:160 build/C/man2/getgroups.2:92 build/C/man2/getpriority.2:104 build/C/man2/getresuid.2:50 build/C/man2/getrlimit.2:461 build/C/man2/getrusage.2:188 build/C/man2/getsid.2:58 build/C/man3/group_member.3:48 build/C/man2/iopl.2:66 build/C/man2/ioprio_set.2:149 build/C/man2/seteuid.2:67 build/C/man2/setfsgid.2:68 build/C/man2/setfsuid.2:68 build/C/man2/setgid.2:53 build/C/man2/setpgid.2:195 build/C/man2/setresuid.2:64 build/C/man2/setreuid.2:93 build/C/man2/setsid.2:54 build/C/man2/setuid.2:70 build/C/man3/ulimit.3:67 build/C/man2/seccomp.2:342
105 #: build/C/man2/acct.2:65 build/C/man2/capget.2:165 build/C/man2/getresuid.2:55 build/C/man2/getrusage.2:193 build/C/man2/iopl.2:71 build/C/man2/seteuid.2:72 build/C/man2/setgid.2:58 build/C/man2/setresuid.2:69 build/C/man2/setreuid.2:98 build/C/man2/setuid.2:75
107 "On success, zero is returned. On error, -1 is returned, and I<errno> is set "
112 #: build/C/man2/acct.2:65 build/C/man2/capget.2:179 build/C/man7/cpuset.7:1100 build/C/man2/getgid.2:42 build/C/man2/getgroups.2:106 build/C/man2/getpid.2:44 build/C/man2/getpriority.2:117 build/C/man2/getresuid.2:55 build/C/man2/getrlimit.2:466 build/C/man2/getrusage.2:193 build/C/man2/getsid.2:63 build/C/man2/getuid.2:43 build/C/man2/iopl.2:71 build/C/man2/ioprio_set.2:169 build/C/man2/seteuid.2:79 build/C/man2/setgid.2:58 build/C/man2/setpgid.2:216 build/C/man2/setresuid.2:76 build/C/man2/setreuid.2:105 build/C/man2/setsid.2:61 build/C/man2/setuid.2:82 build/C/man3/ulimit.3:74 build/C/man2/seccomp.2:358
118 #: build/C/man2/acct.2:66 build/C/man7/cpuset.7:1116 build/C/man7/cpuset.7:1123 build/C/man7/cpuset.7:1129 build/C/man7/cpuset.7:1137 build/C/man7/cpuset.7:1144 build/C/man2/getpriority.2:137 build/C/man2/setpgid.2:217
124 #: build/C/man2/acct.2:77
126 "Write permission is denied for the specified file, or search permission is "
127 "denied for one of the directories in the path prefix of I<filename> (see "
128 "also B<path_resolution>(7)), or I<filename> is not a regular file."
132 #: build/C/man2/acct.2:77 build/C/man2/capget.2:180 build/C/man7/cpuset.7:1172 build/C/man2/getgroups.2:107 build/C/man2/getresuid.2:56 build/C/man2/getrlimit.2:467 build/C/man2/getrusage.2:194 build/C/man2/seccomp.2:369
138 #: build/C/man2/acct.2:81
139 msgid "I<filename> points outside your accessible address space."
143 #: build/C/man2/acct.2:81 build/C/man7/cpuset.7:1238 build/C/man7/cpuset.7:1246
149 #: build/C/man2/acct.2:85
150 msgid "Error writing to the file I<filename>."
154 #: build/C/man2/acct.2:85
160 #: build/C/man2/acct.2:89
161 msgid "I<filename> is a directory."
165 #: build/C/man2/acct.2:89
171 #: build/C/man2/acct.2:93
172 msgid "Too many symbolic links were encountered in resolving I<filename>."
176 #: build/C/man2/acct.2:93 build/C/man7/cpuset.7:1251 build/C/man7/cpuset.7:1258 build/C/man7/cpuset.7:1263
178 msgid "B<ENAMETOOLONG>"
182 #: build/C/man2/acct.2:97
183 msgid "I<filename> was too long."
187 #: build/C/man2/acct.2:97
193 #: build/C/man2/acct.2:100
194 msgid "The system limit on the total number of open files has been reached."
198 #: build/C/man2/acct.2:100 build/C/man7/cpuset.7:1275 build/C/man7/cpuset.7:1280
204 #: build/C/man2/acct.2:103
205 msgid "The specified filename does not exist."
209 #: build/C/man2/acct.2:103 build/C/man7/cpuset.7:1287 build/C/man2/getgroups.2:127 build/C/man2/seccomp.2:413 build/C/man2/seccomp.2:416
215 #: build/C/man2/acct.2:106 build/C/man2/getgroups.2:130 build/C/man2/seccomp.2:416
216 msgid "Out of memory."
220 #: build/C/man2/acct.2:106 build/C/man2/iopl.2:76
226 #: build/C/man2/acct.2:112
228 "BSD process accounting has not been enabled when the operating system kernel "
229 "was compiled. The kernel configuration parameter controlling this feature "
230 "is B<CONFIG_BSD_PROCESS_ACCT>."
234 #: build/C/man2/acct.2:112 build/C/man7/cpuset.7:1314
240 #: build/C/man2/acct.2:117
241 msgid "A component used as a directory in I<filename> is not in fact a directory."
245 #: build/C/man2/acct.2:117 build/C/man2/capget.2:191 build/C/man2/capget.2:196 build/C/man7/cpuset.7:1319 build/C/man2/getgroups.2:130 build/C/man2/getpriority.2:149 build/C/man2/getrlimit.2:483 build/C/man2/getrlimit.2:488 build/C/man2/getrlimit.2:496 build/C/man2/getsid.2:64 build/C/man2/iopl.2:79 build/C/man2/ioprio_set.2:179 build/C/man2/seteuid.2:83 build/C/man2/setgid.2:64 build/C/man2/setpgid.2:231 build/C/man2/setresuid.2:103 build/C/man2/setreuid.2:132 build/C/man2/setsid.2:62 build/C/man2/setuid.2:110 build/C/man3/ulimit.3:75
251 #: build/C/man2/acct.2:123
253 "The calling process has insufficient privilege to enable process "
254 "accounting. On Linux the B<CAP_SYS_PACCT> capability is required."
258 #: build/C/man2/acct.2:123
264 #: build/C/man2/acct.2:127
265 msgid "I<filename> refers to a file on a read-only filesystem."
269 #: build/C/man2/acct.2:127
275 #: build/C/man2/acct.2:130
276 msgid "There are no more free file structures or we ran out of memory."
280 #: build/C/man2/acct.2:130 build/C/man5/acct.5:153 build/C/man7/capabilities.7:1120 build/C/man2/capget.2:218 build/C/man7/credentials.7:287 build/C/man2/getgid.2:44 build/C/man2/getgroups.2:133 build/C/man2/getpid.2:46 build/C/man2/getpriority.2:157 build/C/man2/getresuid.2:67 build/C/man2/getrlimit.2:511 build/C/man2/getrusage.2:202 build/C/man2/getsid.2:79 build/C/man2/getuid.2:45 build/C/man3/group_member.3:55 build/C/man2/iopl.2:87 build/C/man2/ioprio_set.2:196 build/C/man2/ipc.2:45 build/C/man7/namespaces.7:359 build/C/man7/pid_namespaces.7:351 build/C/man2/seteuid.2:99 build/C/man2/setfsgid.2:75 build/C/man2/setfsuid.2:75 build/C/man2/setgid.2:71 build/C/man2/setpgid.2:250 build/C/man2/setresuid.2:109 build/C/man2/setreuid.2:148 build/C/man2/setsid.2:68 build/C/man2/setuid.2:117 build/C/man3/ulimit.3:78 build/C/man7/user_namespaces.7:645 build/C/man2/seccomp.2:435
282 msgid "CONFORMING TO"
285 #. SVr4 documents an EBUSY error condition, but no EISDIR or ENOSYS.
286 #. Also AIX and HP-UX document EBUSY (attempt is made
287 #. to enable accounting when it is already enabled), as does Solaris
288 #. (attempt is made to enable accounting using the same file that is
289 #. currently being used).
291 #: build/C/man2/acct.2:137
292 msgid "SVr4, 4.3BSD (but not POSIX)."
296 #: build/C/man2/acct.2:137 build/C/man5/acct.5:157 build/C/man7/capabilities.7:1126 build/C/man2/capget.2:220 build/C/man7/cpuset.7:1341 build/C/man7/credentials.7:293 build/C/man2/getgid.2:46 build/C/man2/getgroups.2:141 build/C/man2/getpid.2:48 build/C/man2/getpriority.2:160 build/C/man2/getresuid.2:70 build/C/man2/getrlimit.2:534 build/C/man2/getrusage.2:213 build/C/man2/getsid.2:81 build/C/man2/getuid.2:47 build/C/man2/iopl.2:91 build/C/man2/ioprio_set.2:198 build/C/man2/ipc.2:49 build/C/man2/seteuid.2:101 build/C/man2/setfsgid.2:79 build/C/man2/setfsuid.2:79 build/C/man2/setgid.2:73 build/C/man2/setpgid.2:272 build/C/man2/setresuid.2:112 build/C/man2/setreuid.2:154 build/C/man2/setsid.2:70 build/C/man2/setuid.2:122 build/C/man7/user_namespaces.7:648 build/C/man2/seccomp.2:439
302 #: build/C/man2/acct.2:140
304 "No accounting is produced for programs running when a system crash occurs. "
305 "In particular, nonterminating processes are never accounted for."
309 #: build/C/man2/acct.2:143
311 "The structure of the records written to the accounting file is described in "
316 #: build/C/man2/acct.2:143 build/C/man5/acct.5:174 build/C/man7/capabilities.7:1183 build/C/man2/capget.2:228 build/C/man7/cpuset.7:1488 build/C/man7/credentials.7:304 build/C/man2/getgid.2:62 build/C/man2/getgroups.2:178 build/C/man2/getpid.2:100 build/C/man2/getpriority.2:232 build/C/man2/getresuid.2:86 build/C/man2/getrlimit.2:766 build/C/man2/getrusage.2:253 build/C/man2/getsid.2:84 build/C/man2/getuid.2:73 build/C/man3/group_member.3:57 build/C/man2/iopl.2:100 build/C/man2/ioprio_set.2:346 build/C/man2/ipc.2:57 build/C/man7/namespaces.7:364 build/C/man7/pid_namespaces.7:356 build/C/man2/seteuid.2:141 build/C/man2/setfsgid.2:123 build/C/man2/setfsuid.2:131 build/C/man2/setgid.2:83 build/C/man2/setpgid.2:340 build/C/man2/setresuid.2:132 build/C/man2/setreuid.2:194 build/C/man2/setsid.2:93 build/C/man2/setuid.2:145 build/C/man7/svipc.7:335 build/C/man3/ulimit.3:83 build/C/man7/user_namespaces.7:1011 build/C/man2/seccomp.2:662
322 #: build/C/man2/acct.2:145
327 #: build/C/man2/acct.2:145 build/C/man5/acct.5:179 build/C/man7/capabilities.7:1205 build/C/man2/capget.2:232 build/C/man7/cpuset.7:1506 build/C/man7/credentials.7:340 build/C/man2/getgid.2:67 build/C/man2/getgroups.2:186 build/C/man2/getpid.2:111 build/C/man2/getpriority.2:241 build/C/man2/getresuid.2:92 build/C/man2/getrlimit.2:784 build/C/man2/getrusage.2:260 build/C/man2/getsid.2:88 build/C/man2/getuid.2:78 build/C/man3/group_member.3:62 build/C/man2/iopl.2:104 build/C/man2/ioprio_set.2:354 build/C/man2/ipc.2:70 build/C/man7/namespaces.7:377 build/C/man7/pid_namespaces.7:365 build/C/man2/seteuid.2:149 build/C/man2/setfsgid.2:128 build/C/man2/setfsuid.2:136 build/C/man2/setgid.2:90 build/C/man2/setpgid.2:347 build/C/man2/setresuid.2:142 build/C/man2/setreuid.2:203 build/C/man2/setsid.2:100 build/C/man2/setuid.2:153 build/C/man7/svipc.7:353 build/C/man3/ulimit.3:88 build/C/man7/user_namespaces.7:1027 build/C/man2/seccomp.2:679
333 #: build/C/man2/acct.2:153 build/C/man5/acct.5:187 build/C/man7/capabilities.7:1213 build/C/man2/capget.2:240 build/C/man7/cpuset.7:1514 build/C/man7/credentials.7:348 build/C/man2/getgid.2:75 build/C/man2/getgroups.2:194 build/C/man2/getpid.2:119 build/C/man2/getpriority.2:249 build/C/man2/getresuid.2:100 build/C/man2/getrlimit.2:792 build/C/man2/getrusage.2:268 build/C/man2/getsid.2:96 build/C/man2/getuid.2:86 build/C/man3/group_member.3:70 build/C/man2/iopl.2:112 build/C/man2/ioprio_set.2:362 build/C/man2/ipc.2:78 build/C/man7/namespaces.7:385 build/C/man7/pid_namespaces.7:373 build/C/man2/seteuid.2:157 build/C/man2/setfsgid.2:136 build/C/man2/setfsuid.2:144 build/C/man2/setgid.2:98 build/C/man2/setpgid.2:355 build/C/man2/setresuid.2:150 build/C/man2/setreuid.2:211 build/C/man2/setsid.2:108 build/C/man2/setuid.2:161 build/C/man7/svipc.7:361 build/C/man3/ulimit.3:96 build/C/man7/user_namespaces.7:1035 build/C/man2/seccomp.2:687
335 "This page is part of release 3.79 of the Linux I<man-pages> project. A "
336 "description of the project, information about reporting bugs, and the latest "
337 "version of this page, can be found at "
338 "\\%http://www.kernel.org/doc/man-pages/."
342 #: build/C/man5/acct.5:25
348 #: build/C/man5/acct.5:28
349 msgid "acct - process accounting file"
353 #: build/C/man5/acct.5:30
354 msgid "B<#include E<lt>sys/acct.hE<gt>>"
358 #: build/C/man5/acct.5:36
360 "If the kernel is built with the process accounting option enabled "
361 "(B<CONFIG_BSD_PROCESS_ACCT>), then calling B<acct>(2) starts process "
362 "accounting, for example:"
366 #: build/C/man5/acct.5:39
367 msgid "acct(\"/var/log/pacct\");"
371 #: build/C/man5/acct.5:47
373 "When process accounting is enabled, the kernel writes a record to the "
374 "accounting file as each process on the system terminates. This record "
375 "contains information about the terminated process, and is defined in "
376 "I<E<lt>sys/acct.hE<gt>> as follows:"
380 #: build/C/man5/acct.5:51
382 msgid "#define ACCT_COMM 16\n"
386 #: build/C/man5/acct.5:53
388 msgid "typedef u_int16_t comp_t;\n"
392 #: build/C/man5/acct.5:77
396 " char ac_flag; /* Accounting flags */\n"
397 " u_int16_t ac_uid; /* Accounting user ID */\n"
398 " u_int16_t ac_gid; /* Accounting group ID */\n"
399 " u_int16_t ac_tty; /* Controlling terminal */\n"
400 " u_int32_t ac_btime; /* Process creation time\n"
401 " (seconds since the Epoch) */\n"
402 " comp_t ac_utime; /* User CPU time */\n"
403 " comp_t ac_stime; /* System CPU time */\n"
404 " comp_t ac_etime; /* Elapsed time */\n"
405 " comp_t ac_mem; /* Average memory usage (kB) */\n"
406 " comp_t ac_io; /* Characters transferred (unused) */\n"
407 " comp_t ac_rw; /* Blocks read or written (unused) */\n"
408 " comp_t ac_minflt; /* Minor page faults */\n"
409 " comp_t ac_majflt; /* Major page faults */\n"
410 " comp_t ac_swaps; /* Number of swaps (unused) */\n"
411 " u_int32_t ac_exitcode; /* Process termination status\n"
412 " (see wait(2)) */\n"
413 " char ac_comm[ACCT_COMM+1];\n"
414 " /* Command name (basename of last\n"
415 " executed command; null-terminated) */\n"
416 " char ac_pad[I<X>]; /* padding bytes */\n"
421 #: build/C/man5/acct.5:84
424 "enum { /* Bits that may be set in ac_flag field */\n"
425 " AFORK = 0x01, /* Has executed fork, but no exec */\n"
426 " ASU = 0x02, /* Used superuser privileges */\n"
427 " ACORE = 0x08, /* Dumped core */\n"
428 " AXSIG = 0x10 /* Killed by a signal */\n"
433 #: build/C/man5/acct.5:94
435 "The I<comp_t> data type is a floating-point value consisting of a 3-bit, "
436 "base-8 exponent, and a 13-bit mantissa. A value, I<c>, of this type can be "
437 "converted to a (long) integer as follows:"
441 #: build/C/man5/acct.5:97
443 msgid " v = (c & 0x1fff) E<lt>E<lt> (((c E<gt>E<gt> 13) & 0x7) * 3);\n"
447 #: build/C/man5/acct.5:107
449 "The I<ac_utime>, I<ac_stime>, and I<ac_etime> fields measure time in \"clock "
450 "ticks\"; divide these values by I<sysconf(_SC_CLK_TCK)> to convert them to "
455 #: build/C/man5/acct.5:107
457 msgid "Version 3 accounting file format"
461 #: build/C/man5/acct.5:122
463 "Since kernel 2.6.8, an optional alternative version of the accounting file "
464 "can be produced if the B<CONFIG_BSD_PROCESS_ACCT_V3> option is set when "
465 "building the kernel. With this option is set, the records written to the "
466 "accounting file contain additional fields, and the width of I<c_uid> and "
467 "I<ac_gid> fields is widened from 16 to 32 bits (in line with the increased "
468 "size of UID and GIDs in Linux 2.4 and later). The records are defined as "
473 #: build/C/man5/acct.5:147
477 " char ac_flag; /* Flags */\n"
478 " char ac_version; /* Always set to ACCT_VERSION (3) */\n"
479 " u_int16_t ac_tty; /* Controlling terminal */\n"
480 " u_int32_t ac_exitcode; /* Process termination status */\n"
481 " u_int32_t ac_uid; /* Real user ID */\n"
482 " u_int32_t ac_gid; /* Real group ID */\n"
483 " u_int32_t ac_pid; /* Process ID */\n"
484 " u_int32_t ac_ppid; /* Parent process ID */\n"
485 " u_int32_t ac_btime; /* Process creation time */\n"
486 " float ac_etime; /* Elapsed time */\n"
487 " comp_t ac_utime; /* User CPU time */\n"
488 " comp_t ac_stime; /* System time */\n"
489 " comp_t ac_mem; /* Average memory usage (kB) */\n"
490 " comp_t ac_io; /* Characters transferred (unused) */\n"
491 " comp_t ac_rw; /* Blocks read or written\n"
493 " comp_t ac_minflt; /* Minor page faults */\n"
494 " comp_t ac_majflt; /* Major page faults */\n"
495 " comp_t ac_swaps; /* Number of swaps (unused) */\n"
496 " char ac_comm[ACCT_COMM]; /* Command name */\n"
501 #: build/C/man5/acct.5:149 build/C/man7/cpuset.7:1338 build/C/man2/getresuid.2:60 build/C/man2/getrlimit.2:506 build/C/man2/getsid.2:75 build/C/man2/ioprio_set.2:193 build/C/man2/setfsgid.2:71 build/C/man2/setfsuid.2:71 build/C/man2/setresuid.2:107 build/C/man2/seccomp.2:430
507 #: build/C/man5/acct.5:153
508 msgid "The I<acct_v3> structure is defined in glibc since version 2.6."
512 #: build/C/man5/acct.5:157
514 "Process accounting originated on BSD. Although it is present on most "
515 "systems, it is not standardized, and the details vary somewhat between "
520 #: build/C/man5/acct.5:160
522 "Records in the accounting file are ordered by termination time of the "
527 #: build/C/man5/acct.5:167
529 "In kernels up to and including 2.6.9, a separate accounting record is "
530 "written for each thread created using the NPTL threading library; since "
531 "Linux 2.6.10, a single accounting record is written for the entire process "
532 "on termination of the last thread in the process."
536 #: build/C/man5/acct.5:174
538 "The I<proc/sys/kernel/acct> file, described in B<proc>(5), defines settings "
539 "that control the behavior of process accounting when disk space runs low."
543 #: build/C/man5/acct.5:179
544 msgid "B<lastcomm>(1), B<acct>(2), B<accton>(8), B<sa>(8)"
548 #: build/C/man7/capabilities.7:48
554 #: build/C/man7/capabilities.7:48
560 #: build/C/man7/capabilities.7:51
561 msgid "capabilities - overview of Linux capabilities"
565 #: build/C/man7/capabilities.7:63
567 "For the purpose of performing permission checks, traditional UNIX "
568 "implementations distinguish two categories of processes: I<privileged> "
569 "processes (whose effective user ID is 0, referred to as superuser or root), "
570 "and I<unprivileged> processes (whose effective UID is nonzero). Privileged "
571 "processes bypass all kernel permission checks, while unprivileged processes "
572 "are subject to full permission checking based on the process's credentials "
573 "(usually: effective UID, effective GID, and supplementary group list)."
577 #: build/C/man7/capabilities.7:70
579 "Starting with kernel 2.2, Linux divides the privileges traditionally "
580 "associated with superuser into distinct units, known as I<capabilities>, "
581 "which can be independently enabled and disabled. Capabilities are a "
582 "per-thread attribute."
586 #: build/C/man7/capabilities.7:70
588 msgid "Capabilities list"
592 #: build/C/man7/capabilities.7:73
594 "The following list shows the capabilities implemented on Linux, and the "
595 "operations or behaviors that each capability permits:"
599 #: build/C/man7/capabilities.7:73
601 msgid "B<CAP_AUDIT_CONTROL> (since Linux 2.6.11)"
605 #: build/C/man7/capabilities.7:77
607 "Enable and disable kernel auditing; change auditing filter rules; retrieve "
608 "auditing status and filtering rules."
612 #: build/C/man7/capabilities.7:77
614 msgid "B<CAP_AUDIT_READ> (since Linux 3.16)"
617 #. commit a29b694aa1739f9d76538e34ae25524f9c549d59
618 #. commit 3a101b8de0d39403b2c7e5c23fd0b005668acf48
620 #: build/C/man7/capabilities.7:82
621 msgid "Allow reading the audit log via a multicast netlink socket."
625 #: build/C/man7/capabilities.7:82
627 msgid "B<CAP_AUDIT_WRITE> (since Linux 2.6.11)"
631 #: build/C/man7/capabilities.7:85
632 msgid "Write records to kernel auditing log."
636 #: build/C/man7/capabilities.7:85
638 msgid "B<CAP_BLOCK_SUSPEND> (since Linux 3.5)"
642 #: build/C/man7/capabilities.7:91
644 "Employ features that can block system suspend (B<epoll>(7) B<EPOLLWAKEUP>, "
645 "I</proc/sys/wake_lock>)."
649 #: build/C/man7/capabilities.7:91
655 #: build/C/man7/capabilities.7:95
656 msgid "Make arbitrary changes to file UIDs and GIDs (see B<chown>(2))."
660 #: build/C/man7/capabilities.7:95
662 msgid "B<CAP_DAC_OVERRIDE>"
666 #: build/C/man7/capabilities.7:99
668 "Bypass file read, write, and execute permission checks. (DAC is an "
669 "abbreviation of \"discretionary access control\".)"
673 #: build/C/man7/capabilities.7:99
675 msgid "B<CAP_DAC_READ_SEARCH>"
679 #: build/C/man7/capabilities.7:103 build/C/man7/capabilities.7:106 build/C/man7/capabilities.7:116 build/C/man7/capabilities.7:126 build/C/man7/capabilities.7:130 build/C/man7/capabilities.7:132 build/C/man7/capabilities.7:134 build/C/man7/capabilities.7:204 build/C/man7/capabilities.7:206 build/C/man7/capabilities.7:208 build/C/man7/capabilities.7:210 build/C/man7/capabilities.7:212 build/C/man7/capabilities.7:214 build/C/man7/capabilities.7:216 build/C/man7/capabilities.7:218 build/C/man7/capabilities.7:220 build/C/man7/capabilities.7:244 build/C/man7/capabilities.7:246 build/C/man7/capabilities.7:296 build/C/man7/capabilities.7:306 build/C/man7/capabilities.7:312 build/C/man7/capabilities.7:317 build/C/man7/capabilities.7:323 build/C/man7/capabilities.7:327 build/C/man7/capabilities.7:334 build/C/man7/capabilities.7:337 build/C/man7/capabilities.7:345 build/C/man7/capabilities.7:347 build/C/man7/capabilities.7:356 build/C/man7/capabilities.7:365 build/C/man7/capabilities.7:368 build/C/man7/capabilities.7:372 build/C/man7/capabilities.7:380 build/C/man7/capabilities.7:383 build/C/man7/capabilities.7:390 build/C/man7/capabilities.7:395 build/C/man7/capabilities.7:401 build/C/man7/capabilities.7:405 build/C/man7/capabilities.7:409 build/C/man7/capabilities.7:413 build/C/man7/capabilities.7:417 build/C/man7/capabilities.7:444 build/C/man7/capabilities.7:449 build/C/man7/capabilities.7:455 build/C/man7/capabilities.7:458 build/C/man7/capabilities.7:461 build/C/man7/capabilities.7:471 build/C/man7/capabilities.7:475 build/C/man7/capabilities.7:492 build/C/man7/capabilities.7:495 build/C/man7/capabilities.7:499 build/C/man7/capabilities.7:504 build/C/man7/capabilities.7:513 build/C/man7/capabilities.7:518 build/C/man7/capabilities.7:521 build/C/man7/capabilities.7:526 build/C/man7/capabilities.7:529 build/C/man7/capabilities.7:532 build/C/man7/capabilities.7:535 build/C/man7/capabilities.7:538 build/C/man7/capabilities.7:543 build/C/man7/capabilities.7:545 build/C/man7/capabilities.7:551 build/C/man7/capabilities.7:559 build/C/man7/capabilities.7:561 build/C/man7/capabilities.7:565 build/C/man7/capabilities.7:567 build/C/man7/capabilities.7:570 build/C/man7/capabilities.7:574 build/C/man7/capabilities.7:576 build/C/man7/capabilities.7:578 build/C/man7/capabilities.7:580 build/C/man7/capabilities.7:589 build/C/man7/capabilities.7:596 build/C/man7/capabilities.7:601 build/C/man7/capabilities.7:606 build/C/man7/capabilities.7:611 build/C/man7/capabilities.7:636 build/C/man7/capabilities.7:643 build/C/man7/capabilities.7:844 build/C/man7/capabilities.7:852 build/C/man7/capabilities.7:1172 build/C/man7/capabilities.7:1177 build/C/man7/cpuset.7:540 build/C/man7/cpuset.7:545 build/C/man7/cpuset.7:550 build/C/man7/cpuset.7:726 build/C/man7/cpuset.7:730 build/C/man7/cpuset.7:927 build/C/man7/cpuset.7:930 build/C/man7/cpuset.7:934 build/C/man7/cpuset.7:938 build/C/man7/cpuset.7:942 build/C/man7/credentials.7:177 build/C/man7/credentials.7:183 build/C/man7/credentials.7:195 build/C/man7/credentials.7:217 build/C/man7/credentials.7:234 build/C/man7/credentials.7:266 build/C/man7/credentials.7:269 build/C/man7/credentials.7:280 build/C/man7/credentials.7:283 build/C/man2/getrlimit.2:690 build/C/man2/getrlimit.2:693 build/C/man7/namespaces.7:212 build/C/man7/namespaces.7:215 build/C/man7/namespaces.7:228 build/C/man7/pid_namespaces.7:233 build/C/man7/pid_namespaces.7:241 build/C/man7/pid_namespaces.7:252 build/C/man7/user_namespaces.7:261 build/C/man7/user_namespaces.7:266 build/C/man7/user_namespaces.7:272 build/C/man7/user_namespaces.7:285 build/C/man7/user_namespaces.7:306 build/C/man7/user_namespaces.7:474 build/C/man7/user_namespaces.7:477 build/C/man7/user_namespaces.7:479 build/C/man7/user_namespaces.7:492 build/C/man7/user_namespaces.7:505 build/C/man7/user_namespaces.7:532 build/C/man7/user_namespaces.7:541 build/C/man2/seccomp.2:265 build/C/man2/seccomp.2:269 build/C/man2/seccomp.2:272 build/C/man2/seccomp.2:277 build/C/man2/seccomp.2:281 build/C/man2/seccomp.2:455 build/C/man2/seccomp.2:463 build/C/man2/seccomp.2:469
685 #: build/C/man7/capabilities.7:106
687 "Bypass file read permission checks and directory read and execute permission "
692 #: build/C/man7/capabilities.7:109
693 msgid "Invoke B<open_by_handle_at>(2)."
697 #: build/C/man7/capabilities.7:112
699 msgid "B<CAP_FOWNER>"
703 #: build/C/man7/capabilities.7:126
705 "Bypass permission checks on operations that normally require the filesystem "
706 "UID of the process to match the UID of the file (e.g., B<chmod>(2), "
707 "B<utime>(2)), excluding those operations covered by B<CAP_DAC_OVERRIDE> and "
708 "B<CAP_DAC_READ_SEARCH>;"
712 #: build/C/man7/capabilities.7:130
713 msgid "set extended file attributes (see B<chattr>(1)) on arbitrary files;"
717 #: build/C/man7/capabilities.7:132
718 msgid "set Access Control Lists (ACLs) on arbitrary files;"
722 #: build/C/man7/capabilities.7:134
723 msgid "ignore directory sticky bit on file deletion;"
727 #: build/C/man7/capabilities.7:141
728 msgid "specify B<O_NOATIME> for arbitrary files in B<open>(2) and B<fcntl>(2)."
732 #: build/C/man7/capabilities.7:143
734 msgid "B<CAP_FSETID>"
738 #: build/C/man7/capabilities.7:149
740 "Don't clear set-user-ID and set-group-ID permission bits when a file is "
741 "modified; set the set-group-ID bit for a file whose GID does not match the "
742 "filesystem or any of the supplementary GIDs of the calling process."
746 #: build/C/man7/capabilities.7:149
748 msgid "B<CAP_IPC_LOCK>"
751 #. FIXME . As at Linux 3.2, there are some strange uses of this capability
752 #. in other places; they probably should be replaced with something else.
754 #: build/C/man7/capabilities.7:158
755 msgid "Lock memory (B<mlock>(2), B<mlockall>(2), B<mmap>(2), B<shmctl>(2))."
759 #: build/C/man7/capabilities.7:158
761 msgid "B<CAP_IPC_OWNER>"
765 #: build/C/man7/capabilities.7:161
766 msgid "Bypass permission checks for operations on System V IPC objects."
770 #: build/C/man7/capabilities.7:161
775 #. FIXME . CAP_KILL also has an effect for threads + setting child
776 #. termination signal to other than SIGCHLD: without this
777 #. capability, the termination signal reverts to SIGCHLD
778 #. if the child does an exec(). What is the rationale
781 #: build/C/man7/capabilities.7:174
783 "Bypass permission checks for sending signals (see B<kill>(2)). This "
784 "includes use of the B<ioctl>(2) B<KDSIGACCEPT> operation."
788 #: build/C/man7/capabilities.7:174
790 msgid "B<CAP_LEASE> (since Linux 2.4)"
794 #: build/C/man7/capabilities.7:178
795 msgid "Establish leases on arbitrary files (see B<fcntl>(2))."
799 #: build/C/man7/capabilities.7:178
801 msgid "B<CAP_LINUX_IMMUTABLE>"
804 #. These attributes are now available on ext2, ext3, Reiserfs, XFS, JFS
806 #: build/C/man7/capabilities.7:187
808 "Set the B<FS_APPEND_FL> and B<FS_IMMUTABLE_FL> inode flags (see "
813 #: build/C/man7/capabilities.7:187
815 msgid "B<CAP_MAC_ADMIN> (since Linux 2.6.25)"
819 #: build/C/man7/capabilities.7:191
821 "Override Mandatory Access Control (MAC). Implemented for the Smack Linux "
822 "Security Module (LSM)."
826 #: build/C/man7/capabilities.7:191
828 msgid "B<CAP_MAC_OVERRIDE> (since Linux 2.6.25)"
832 #: build/C/man7/capabilities.7:195
833 msgid "Allow MAC configuration or state changes. Implemented for the Smack LSM."
837 #: build/C/man7/capabilities.7:195
839 msgid "B<CAP_MKNOD> (since Linux 2.4)"
843 #: build/C/man7/capabilities.7:199
844 msgid "Create special files using B<mknod>(2)."
848 #: build/C/man7/capabilities.7:199
850 msgid "B<CAP_NET_ADMIN>"
854 #: build/C/man7/capabilities.7:202
855 msgid "Perform various network-related operations:"
859 #: build/C/man7/capabilities.7:206
860 msgid "interface configuration;"
864 #: build/C/man7/capabilities.7:208
865 msgid "administration of IP firewall, masquerading, and accounting;"
869 #: build/C/man7/capabilities.7:210
870 msgid "modify routing tables;"
874 #: build/C/man7/capabilities.7:212
875 msgid "bind to any address for transparent proxying;"
879 #: build/C/man7/capabilities.7:214
880 msgid "set type-of-service (TOS)"
884 #: build/C/man7/capabilities.7:216
885 msgid "clear driver statistics;"
889 #: build/C/man7/capabilities.7:218
890 msgid "set promiscuous mode;"
894 #: build/C/man7/capabilities.7:220
895 msgid "enabling multicasting;"
899 #: build/C/man7/capabilities.7:231
901 "use B<setsockopt>(2) to set the following socket options: B<SO_DEBUG>, "
902 "B<SO_MARK>, B<SO_PRIORITY> (for a priority outside the range 0 to 6), "
903 "B<SO_RCVBUFFORCE>, and B<SO_SNDBUFFORCE>."
907 #: build/C/man7/capabilities.7:233
909 msgid "B<CAP_NET_BIND_SERVICE>"
913 #: build/C/man7/capabilities.7:237
915 "Bind a socket to Internet domain privileged ports (port numbers less than "
920 #: build/C/man7/capabilities.7:237
922 msgid "B<CAP_NET_BROADCAST>"
926 #: build/C/man7/capabilities.7:240
927 msgid "(Unused) Make socket broadcasts, and listen to multicasts."
931 #: build/C/man7/capabilities.7:240
933 msgid "B<CAP_NET_RAW>"
937 #: build/C/man7/capabilities.7:246
938 msgid "use RAW and PACKET sockets;"
942 #: build/C/man7/capabilities.7:248
943 msgid "bind to any address for transparent proxying."
947 #: build/C/man7/capabilities.7:251
949 msgid "B<CAP_SETGID>"
953 #: build/C/man7/capabilities.7:257
955 "Make arbitrary manipulations of process GIDs and supplementary GID list; "
956 "forge GID when passing socket credentials via UNIX domain sockets; write a "
957 "group ID mapping in a user namespace (see B<user_namespaces>(7))."
961 #: build/C/man7/capabilities.7:257
963 msgid "B<CAP_SETFCAP> (since Linux 2.6.24)"
967 #: build/C/man7/capabilities.7:260
968 msgid "Set file capabilities."
972 #: build/C/man7/capabilities.7:260
974 msgid "B<CAP_SETPCAP>"
978 #: build/C/man7/capabilities.7:271
980 "If file capabilities are not supported: grant or remove any capability in "
981 "the caller's permitted capability set to or from any other process. (This "
982 "property of B<CAP_SETPCAP> is not available when the kernel is configured to "
983 "support file capabilities, since B<CAP_SETPCAP> has entirely different "
984 "semantics for such kernels.)"
988 #: build/C/man7/capabilities.7:281
990 "If file capabilities are supported: add any capability from the calling "
991 "thread's bounding set to its inheritable set; drop capabilities from the "
992 "bounding set (via B<prctl>(2) B<PR_CAPBSET_DROP>); make changes to the "
993 "I<securebits> flags."
997 #: build/C/man7/capabilities.7:281
999 msgid "B<CAP_SETUID>"
1002 #. FIXME CAP_SETUID also an effect in exec(); document this.
1004 #: build/C/man7/capabilities.7:292
1006 "Make arbitrary manipulations of process UIDs (B<setuid>(2), B<setreuid>(2), "
1007 "B<setresuid>(2), B<setfsuid>(2)); forge UID when passing socket credentials "
1008 "via UNIX domain sockets; write a user ID mapping in a user namespace (see "
1009 "B<user_namespaces>(7))."
1013 #: build/C/man7/capabilities.7:292
1015 msgid "B<CAP_SYS_ADMIN>"
1019 #: build/C/man7/capabilities.7:306
1021 "Perform a range of system administration operations including: "
1022 "B<quotactl>(2), B<mount>(2), B<umount>(2), B<swapon>(2), B<swapoff>(2), "
1023 "B<sethostname>(2), and B<setdomainname>(2);"
1027 #: build/C/man7/capabilities.7:312
1029 "perform privileged B<syslog>(2) operations (since Linux 2.6.37, "
1030 "B<CAP_SYSLOG> should be used to permit such operations);"
1034 #: build/C/man7/capabilities.7:317
1035 msgid "perform B<VM86_REQUEST_IRQ> B<vm86>(2) command;"
1039 #: build/C/man7/capabilities.7:323
1041 "perform B<IPC_SET> and B<IPC_RMID> operations on arbitrary System V IPC "
1046 #: build/C/man7/capabilities.7:327 build/C/man7/capabilities.7:574
1047 msgid "override B<RLIMIT_NPROC> resource limit;"
1051 #: build/C/man7/capabilities.7:334
1053 "perform operations on I<trusted> and I<security> Extended Attributes (see "
1058 #: build/C/man7/capabilities.7:337
1059 msgid "use B<lookup_dcookie>(2);"
1063 #: build/C/man7/capabilities.7:345
1065 "use B<ioprio_set>(2) to assign B<IOPRIO_CLASS_RT> and (before Linux 2.6.25) "
1066 "B<IOPRIO_CLASS_IDLE> I/O scheduling classes;"
1070 #: build/C/man7/capabilities.7:347
1071 msgid "forge PID when passing socket credentials via UNIX domain sockets;"
1075 #: build/C/man7/capabilities.7:356
1077 "exceed I</proc/sys/fs/file-max>, the system-wide limit on the number of open "
1078 "files, in system calls that open files (e.g., B<accept>(2), B<execve>(2), "
1079 "B<open>(2), B<pipe>(2));"
1083 #: build/C/man7/capabilities.7:365
1085 "employ B<CLONE_*> flags that create new namespaces with B<clone>(2) and "
1086 "B<unshare>(2) (but, since Linux 3.8, creating user namespaces does not "
1087 "require any capability);"
1091 #: build/C/man7/capabilities.7:368
1092 msgid "call B<perf_event_open>(2);"
1096 #: build/C/man7/capabilities.7:372
1097 msgid "access privileged I<perf> event information;"
1101 #: build/C/man7/capabilities.7:380
1102 msgid "call B<setns>(2) (requires B<CAP_SYS_ADMIN> in the I<target> namespace);"
1106 #: build/C/man7/capabilities.7:383
1107 msgid "call B<fanotify_init>(2);"
1111 #: build/C/man7/capabilities.7:390
1112 msgid "perform B<KEYCTL_CHOWN> and B<KEYCTL_SETPERM> B<keyctl>(2) operations;"
1116 #: build/C/man7/capabilities.7:395
1117 msgid "perform B<madvise>(2) B<MADV_HWPOISON> operation;"
1121 #: build/C/man7/capabilities.7:401
1123 "employ the B<TIOCSTI> B<ioctl>(2) to insert characters into the input queue "
1124 "of a terminal other than the caller's controlling terminal;"
1128 #: build/C/man7/capabilities.7:405
1129 msgid "employ the obsolete B<nfsservctl>(2) system call;"
1133 #: build/C/man7/capabilities.7:409
1134 msgid "employ the obsolete B<bdflush>(2) system call;"
1138 #: build/C/man7/capabilities.7:413
1139 msgid "perform various privileged block-device B<ioctl>(2) operations;"
1143 #: build/C/man7/capabilities.7:417
1144 msgid "perform various privileged filesystem B<ioctl>(2) operations;"
1148 #: build/C/man7/capabilities.7:419
1149 msgid "perform administrative operations on many device drivers."
1153 #: build/C/man7/capabilities.7:421
1155 msgid "B<CAP_SYS_BOOT>"
1159 #: build/C/man7/capabilities.7:427
1160 msgid "Use B<reboot>(2) and B<kexec_load>(2)."
1164 #: build/C/man7/capabilities.7:427
1166 msgid "B<CAP_SYS_CHROOT>"
1170 #: build/C/man7/capabilities.7:431
1171 msgid "Use B<chroot>(2)."
1175 #: build/C/man7/capabilities.7:431
1177 msgid "B<CAP_SYS_MODULE>"
1181 #: build/C/man7/capabilities.7:440
1183 "Load and unload kernel modules (see B<init_module>(2) and "
1184 "B<delete_module>(2)); in kernels before 2.6.25: drop capabilities from the "
1185 "system-wide capability bounding set."
1189 #: build/C/man7/capabilities.7:440
1191 msgid "B<CAP_SYS_NICE>"
1195 #: build/C/man7/capabilities.7:449
1197 "Raise process nice value (B<nice>(2), B<setpriority>(2)) and change the "
1198 "nice value for arbitrary processes;"
1202 #: build/C/man7/capabilities.7:455
1204 "set real-time scheduling policies for calling process, and set scheduling "
1205 "policies and priorities for arbitrary processes (B<sched_setscheduler>(2), "
1206 "B<sched_setparam>(2), B<shed_setattr>(2));"
1210 #: build/C/man7/capabilities.7:458
1211 msgid "set CPU affinity for arbitrary processes (B<sched_setaffinity>(2));"
1215 #: build/C/man7/capabilities.7:461
1217 "set I/O scheduling class and priority for arbitrary processes "
1218 "(B<ioprio_set>(2));"
1221 #. FIXME CAP_SYS_NICE also has the following effect for
1222 #. migrate_pages(2):
1223 #. do_migrate_pages(mm, &old, &new,
1224 #. capable(CAP_SYS_NICE) ? MPOL_MF_MOVE_ALL : MPOL_MF_MOVE);
1227 #: build/C/man7/capabilities.7:471
1229 "apply B<migrate_pages>(2) to arbitrary processes and allow processes to be "
1230 "migrated to arbitrary nodes;"
1234 #: build/C/man7/capabilities.7:475
1235 msgid "apply B<move_pages>(2) to arbitrary processes;"
1239 #: build/C/man7/capabilities.7:482
1240 msgid "use the B<MPOL_MF_MOVE_ALL> flag with B<mbind>(2) and B<move_pages>(2)."
1244 #: build/C/man7/capabilities.7:484
1246 msgid "B<CAP_SYS_PACCT>"
1250 #: build/C/man7/capabilities.7:488
1251 msgid "Use B<acct>(2)."
1255 #: build/C/man7/capabilities.7:488
1257 msgid "B<CAP_SYS_PTRACE>"
1261 #: build/C/man7/capabilities.7:495
1262 msgid "Trace arbitrary processes using B<ptrace>(2);"
1266 #: build/C/man7/capabilities.7:499
1267 msgid "apply B<get_robust_list>(2) to arbitrary processes;"
1271 #: build/C/man7/capabilities.7:504
1273 "transfer data to or from the memory of arbitrary processes using "
1274 "B<process_vm_readv>(2) and B<process_vm_writev>(2)."
1278 #: build/C/man7/capabilities.7:507
1279 msgid "inspect processes using B<kcmp>(2)."
1283 #: build/C/man7/capabilities.7:509
1285 msgid "B<CAP_SYS_RAWIO>"
1289 #: build/C/man7/capabilities.7:518
1290 msgid "Perform I/O port operations (B<iopl>(2) and B<ioperm>(2));"
1294 #: build/C/man7/capabilities.7:521
1295 msgid "access I</proc/kcore>;"
1299 #: build/C/man7/capabilities.7:526
1300 msgid "employ the B<FIBMAP> B<ioctl>(2) operation;"
1304 #: build/C/man7/capabilities.7:529
1306 "open devices for accessing x86 model-specific registers (MSRs, see "
1311 #: build/C/man7/capabilities.7:532
1312 msgid "update I</proc/sys/vm/mmap_min_addr>;"
1316 #: build/C/man7/capabilities.7:535
1318 "create memory mappings at addresses below the value specified by "
1319 "I</proc/sys/vm/mmap_min_addr>;"
1323 #: build/C/man7/capabilities.7:538
1324 msgid "map files in I</proc/bus/pci>;"
1328 #: build/C/man7/capabilities.7:543
1329 msgid "open I</dev/mem> and I</dev/kmem>;"
1333 #: build/C/man7/capabilities.7:545
1334 msgid "perform various SCSI device commands;"
1338 #: build/C/man7/capabilities.7:551
1339 msgid "perform certain operations on B<hpsa>(4) and B<cciss>(4) devices;"
1343 #: build/C/man7/capabilities.7:553
1344 msgid "perform a range of device-specific operations on other devices."
1348 #: build/C/man7/capabilities.7:555
1350 msgid "B<CAP_SYS_RESOURCE>"
1354 #: build/C/man7/capabilities.7:561
1355 msgid "Use reserved space on ext2 filesystems;"
1359 #: build/C/man7/capabilities.7:565
1360 msgid "make B<ioctl>(2) calls controlling ext3 journaling;"
1364 #: build/C/man7/capabilities.7:567
1365 msgid "override disk quota limits;"
1369 #: build/C/man7/capabilities.7:570
1370 msgid "increase resource limits (see B<setrlimit>(2));"
1374 #: build/C/man7/capabilities.7:576
1375 msgid "override maximum number of consoles on console allocation;"
1379 #: build/C/man7/capabilities.7:578
1380 msgid "override maximum number of keymaps;"
1384 #: build/C/man7/capabilities.7:580
1385 msgid "allow more than 64hz interrupts from the real-time clock;"
1389 #: build/C/man7/capabilities.7:589
1391 "raise I<msg_qbytes> limit for a System V message queue above the limit in "
1392 "I</proc/sys/kernel/msgmnb> (see B<msgop>(2) and B<msgctl>(2));"
1396 #: build/C/man7/capabilities.7:596
1398 "override the I</proc/sys/fs/pipe-size-max> limit when setting the capacity "
1399 "of a pipe using the B<F_SETPIPE_SZ> B<fcntl>(2) command."
1403 #: build/C/man7/capabilities.7:601
1405 "use B<F_SETPIPE_SZ> to increase the capacity of a pipe above the limit "
1406 "specified by I</proc/sys/fs/pipe-max-size>;"
1410 #: build/C/man7/capabilities.7:606
1412 "override I</proc/sys/fs/mqueue/queues_max> limit when creating POSIX message "
1413 "queues (see B<mq_overview>(7));"
1417 #: build/C/man7/capabilities.7:611
1418 msgid "employ B<prctl>(2) B<PR_SET_MM> operation;"
1422 #: build/C/man7/capabilities.7:616
1424 "set I</proc/PID/oom_score_adj> to a value lower than the value last set by a "
1425 "process with B<CAP_SYS_RESOURCE>."
1429 #: build/C/man7/capabilities.7:618
1431 msgid "B<CAP_SYS_TIME>"
1435 #: build/C/man7/capabilities.7:625
1437 "Set system clock (B<settimeofday>(2), B<stime>(2), B<adjtimex>(2)); set "
1438 "real-time (hardware) clock."
1442 #: build/C/man7/capabilities.7:625
1444 msgid "B<CAP_SYS_TTY_CONFIG>"
1448 #: build/C/man7/capabilities.7:632
1450 "Use B<vhangup>(2); employ various privileged B<ioctl>(2) operations on "
1451 "virtual terminals."
1455 #: build/C/man7/capabilities.7:632
1457 msgid "B<CAP_SYSLOG> (since Linux 2.6.37)"
1461 #: build/C/man7/capabilities.7:643
1463 "Perform privileged B<syslog>(2) operations. See B<syslog>(2) for "
1464 "information on which operations require privilege."
1468 #: build/C/man7/capabilities.7:653
1470 "View kernel addresses exposed via I</proc> and other interfaces when "
1471 "I</proc/sys/kernel/kptr_restrict> has the value 1. (See the discussion of "
1472 "the I<kptr_restrict> in B<proc>(5).)"
1476 #: build/C/man7/capabilities.7:655
1478 msgid "B<CAP_WAKE_ALARM> (since Linux 3.0)"
1482 #: build/C/man7/capabilities.7:663
1484 "Trigger something that will wake up the system (set B<CLOCK_REALTIME_ALARM> "
1485 "and B<CLOCK_BOOTTIME_ALARM> timers)."
1489 #: build/C/man7/capabilities.7:663
1491 msgid "Past and current implementation"
1495 #: build/C/man7/capabilities.7:665
1496 msgid "A full implementation of capabilities requires that:"
1500 #: build/C/man7/capabilities.7:665 build/C/man7/capabilities.7:816 build/C/man7/capabilities.7:963 build/C/man7/capabilities.7:1016 build/C/man7/user_namespaces.7:173 build/C/man7/user_namespaces.7:515
1506 #: build/C/man7/capabilities.7:669
1508 "For all privileged operations, the kernel must check whether the thread has "
1509 "the required capability in its effective set."
1513 #: build/C/man7/capabilities.7:669 build/C/man7/capabilities.7:821 build/C/man7/capabilities.7:969 build/C/man7/capabilities.7:1022 build/C/man7/user_namespaces.7:189 build/C/man7/user_namespaces.7:521
1519 #: build/C/man7/capabilities.7:672
1521 "The kernel must provide system calls allowing a thread's capability sets to "
1522 "be changed and retrieved."
1526 #: build/C/man7/capabilities.7:672 build/C/man7/capabilities.7:972 build/C/man7/capabilities.7:1026 build/C/man7/user_namespaces.7:193 build/C/man7/user_namespaces.7:526
1532 #: build/C/man7/capabilities.7:675
1534 "The filesystem must support attaching capabilities to an executable file, so "
1535 "that a process gains those capabilities when the file is executed."
1539 #: build/C/man7/capabilities.7:679
1541 "Before kernel 2.6.24, only the first two of these requirements are met; "
1542 "since kernel 2.6.24, all three requirements are met."
1546 #: build/C/man7/capabilities.7:679
1548 msgid "Thread capability sets"
1552 #: build/C/man7/capabilities.7:682
1554 "Each thread has three capability sets containing zero or more of the above "
1559 #: build/C/man7/capabilities.7:682
1561 msgid "I<Permitted>:"
1565 #: build/C/man7/capabilities.7:690
1567 "This is a limiting superset for the effective capabilities that the thread "
1568 "may assume. It is also a limiting superset for the capabilities that may be "
1569 "added to the inheritable set by a thread that does not have the "
1570 "B<CAP_SETPCAP> capability in its effective set."
1574 #: build/C/man7/capabilities.7:696
1576 "If a thread drops a capability from its permitted set, it can never "
1577 "reacquire that capability (unless it B<execve>(2)s either a set-user-ID-root "
1578 "program, or a program whose associated file capabilities grant that "
1583 #: build/C/man7/capabilities.7:696
1585 msgid "I<Inheritable>:"
1589 #: build/C/man7/capabilities.7:703
1591 "This is a set of capabilities preserved across an B<execve>(2). It provides "
1592 "a mechanism for a process to assign capabilities to the permitted set of the "
1593 "new program during an B<execve>(2)."
1597 #: build/C/man7/capabilities.7:703 build/C/man7/capabilities.7:753
1599 msgid "I<Effective>:"
1603 #: build/C/man7/capabilities.7:707
1605 "This is the set of capabilities used by the kernel to perform permission "
1606 "checks for the thread."
1610 #: build/C/man7/capabilities.7:713
1612 "A child created via B<fork>(2) inherits copies of its parent's capability "
1613 "sets. See below for a discussion of the treatment of capabilities during "
1618 #: build/C/man7/capabilities.7:717
1620 "Using B<capset>(2), a thread may manipulate its own capability sets (see "
1624 #. commit 73efc0394e148d0e15583e13712637831f926720
1626 #: build/C/man7/capabilities.7:726
1628 "Since Linux 3.2, the file I</proc/sys/kernel/cap_last_cap> exposes the "
1629 "numerical value of the highest capability supported by the running kernel; "
1630 "this can be used to determine the highest bit that may be set in a "
1635 #: build/C/man7/capabilities.7:726
1637 msgid "File capabilities"
1641 #: build/C/man7/capabilities.7:741
1643 "Since kernel 2.6.24, the kernel supports associating capability sets with an "
1644 "executable file using B<setcap>(8). The file capability sets are stored in "
1645 "an extended attribute (see B<setxattr>(2)) named I<security.capability>. "
1646 "Writing to this extended attribute requires the B<CAP_SETFCAP> capability. "
1647 "The file capability sets, in conjunction with the capability sets of the "
1648 "thread, determine the capabilities of a thread after an B<execve>(2)."
1652 #: build/C/man7/capabilities.7:743
1653 msgid "The three file capability sets are:"
1657 #: build/C/man7/capabilities.7:743
1659 msgid "I<Permitted> (formerly known as I<forced>):"
1663 #: build/C/man7/capabilities.7:747
1665 "These capabilities are automatically permitted to the thread, regardless of "
1666 "the thread's inheritable capabilities."
1670 #: build/C/man7/capabilities.7:747
1672 msgid "I<Inheritable> (formerly known as I<allowed>):"
1676 #: build/C/man7/capabilities.7:753
1678 "This set is ANDed with the thread's inheritable set to determine which "
1679 "inheritable capabilities are enabled in the permitted set of the thread "
1680 "after the B<execve>(2)."
1684 #: build/C/man7/capabilities.7:763
1686 "This is not a set, but rather just a single bit. If this bit is set, then "
1687 "during an B<execve>(2) all of the new permitted capabilities for the thread "
1688 "are also raised in the effective set. If this bit is not set, then after an "
1689 "B<execve>(2), none of the new permitted capabilities is in the new effective "
1694 #: build/C/man7/capabilities.7:779
1696 "Enabling the file effective capability bit implies that any file permitted "
1697 "or inheritable capability that causes a thread to acquire the corresponding "
1698 "permitted capability during an B<execve>(2) (see the transformation rules "
1699 "described below) will also acquire that capability in its effective set. "
1700 "Therefore, when assigning capabilities to a file (B<setcap>(8), "
1701 "B<cap_set_file>(3), B<cap_set_fd>(3)), if we specify the effective flag as "
1702 "being enabled for any capability, then the effective flag must also be "
1703 "specified as enabled for all other capabilities for which the corresponding "
1704 "permitted or inheritable flags is enabled."
1708 #: build/C/man7/capabilities.7:779
1710 msgid "Transformation of capabilities during execve()"
1714 #: build/C/man7/capabilities.7:785
1716 "During an B<execve>(2), the kernel calculates the new capabilities of the "
1717 "process using the following algorithm:"
1721 #: build/C/man7/capabilities.7:790
1724 "P'(permitted) = (P(inheritable) & F(inheritable)) |\n"
1725 " (F(permitted) & cap_bset)\n"
1729 #: build/C/man7/capabilities.7:792
1731 msgid "P'(effective) = F(effective) ? P'(permitted) : 0\n"
1735 #: build/C/man7/capabilities.7:794
1737 msgid "P'(inheritable) = P(inheritable) [i.e., unchanged]\n"
1741 #: build/C/man7/capabilities.7:798
1746 #: build/C/man7/capabilities.7:799
1752 #: build/C/man7/capabilities.7:802
1753 msgid "denotes the value of a thread capability set before the B<execve>(2)"
1757 #: build/C/man7/capabilities.7:802
1763 #: build/C/man7/capabilities.7:805
1764 msgid "denotes the value of a capability set after the B<execve>(2)"
1768 #: build/C/man7/capabilities.7:805
1774 #: build/C/man7/capabilities.7:807
1775 msgid "denotes a file capability set"
1779 #: build/C/man7/capabilities.7:807
1785 #: build/C/man7/capabilities.7:809
1786 msgid "is the value of the capability bounding set (described below)."
1790 #: build/C/man7/capabilities.7:811
1792 msgid "Capabilities and execution of programs by root"
1796 #: build/C/man7/capabilities.7:816
1798 "In order to provide an all-powerful I<root> using capability sets, during an "
1803 #: build/C/man7/capabilities.7:821
1805 "If a set-user-ID-root program is being executed, or the real user ID of the "
1806 "process is 0 (root) then the file inheritable and permitted sets are "
1807 "defined to be all ones (i.e., all capabilities enabled)."
1811 #: build/C/man7/capabilities.7:824
1813 "If a set-user-ID-root program is being executed, then the file effective bit "
1814 "is defined to be one (enabled)."
1817 #. If a process with real UID 0, and nonzero effective UID does an
1818 #. exec(), then it gets all capabilities in its
1819 #. permitted set, and no effective capabilities
1821 #: build/C/man7/capabilities.7:839
1823 "The upshot of the above rules, combined with the capabilities "
1824 "transformations described above, is that when a process B<execve>(2)s a "
1825 "set-user-ID-root program, or when a process with an effective UID of 0 "
1826 "B<execve>(2)s a program, it gains all capabilities in its permitted and "
1827 "effective capability sets, except those masked out by the capability "
1828 "bounding set. This provides semantics that are the same as those provided "
1829 "by traditional UNIX systems."
1833 #: build/C/man7/capabilities.7:839
1835 msgid "Capability bounding set"
1839 #: build/C/man7/capabilities.7:844
1841 "The capability bounding set is a security mechanism that can be used to "
1842 "limit the capabilities that can be gained during an B<execve>(2). The "
1843 "bounding set is used in the following ways:"
1847 #: build/C/man7/capabilities.7:852
1849 "During an B<execve>(2), the capability bounding set is ANDed with the file "
1850 "permitted capability set, and the result of this operation is assigned to "
1851 "the thread's permitted capability set. The capability bounding set thus "
1852 "places a limit on the permitted capabilities that may be granted by an "
1857 #: build/C/man7/capabilities.7:864
1859 "(Since Linux 2.6.25) The capability bounding set acts as a limiting "
1860 "superset for the capabilities that a thread can add to its inheritable set "
1861 "using B<capset>(2). This means that if a capability is not in the bounding "
1862 "set, then a thread can't add this capability to its inheritable set, even if "
1863 "it was in its permitted capabilities, and thereby cannot have this "
1864 "capability preserved in its permitted set when it B<execve>(2)s a file that "
1865 "has the capability in its inheritable set."
1869 #: build/C/man7/capabilities.7:871
1871 "Note that the bounding set masks the file permitted capabilities, but not "
1872 "the inherited capabilities. If a thread maintains a capability in its "
1873 "inherited set that is not in its bounding set, then it can still gain that "
1874 "capability in its permitted set by executing a file that has the capability "
1875 "in its inherited set."
1879 #: build/C/man7/capabilities.7:874
1881 "Depending on the kernel version, the capability bounding set is either a "
1882 "system-wide attribute, or a per-process attribute."
1886 #: build/C/man7/capabilities.7:876
1887 msgid "B<Capability bounding set prior to Linux 2.6.25>"
1891 #: build/C/man7/capabilities.7:884
1893 "In kernels before 2.6.25, the capability bounding set is a system-wide "
1894 "attribute that affects all threads on the system. The bounding set is "
1895 "accessible via the file I</proc/sys/kernel/cap-bound>. (Confusingly, this "
1896 "bit mask parameter is expressed as a signed decimal number in "
1897 "I</proc/sys/kernel/cap-bound>.)"
1901 #: build/C/man7/capabilities.7:891
1903 "Only the B<init> process may set capabilities in the capability bounding "
1904 "set; other than that, the superuser (more precisely: programs with the "
1905 "B<CAP_SYS_MODULE> capability) may only clear capabilities from this set."
1909 #: build/C/man7/capabilities.7:900
1911 "On a standard system the capability bounding set always masks out the "
1912 "B<CAP_SETPCAP> capability. To remove this restriction (dangerous!), modify "
1913 "the definition of B<CAP_INIT_EFF_SET> in I<include/linux/capability.h> and "
1914 "rebuild the kernel."
1918 #: build/C/man7/capabilities.7:904
1920 "The system-wide capability bounding set feature was added to Linux starting "
1921 "with kernel version 2.2.11."
1925 #: build/C/man7/capabilities.7:906
1926 msgid "B<Capability bounding set from Linux 2.6.25 onward>"
1930 #: build/C/man7/capabilities.7:911
1932 "From Linux 2.6.25, the I<capability bounding set> is a per-thread "
1933 "attribute. (There is no longer a system-wide capability bounding set.)"
1937 #: build/C/man7/capabilities.7:916
1939 "The bounding set is inherited at B<fork>(2) from the thread's parent, and "
1940 "is preserved across an B<execve>(2)."
1944 #: build/C/man7/capabilities.7:929
1946 "A thread may remove capabilities from its capability bounding set using the "
1947 "B<prctl>(2) B<PR_CAPBSET_DROP> operation, provided it has the "
1948 "B<CAP_SETPCAP> capability. Once a capability has been dropped from the "
1949 "bounding set, it cannot be restored to that set. A thread can determine if "
1950 "a capability is in its bounding set using the B<prctl>(2) "
1951 "B<PR_CAPBSET_READ> operation."
1955 #: build/C/man7/capabilities.7:947
1957 "Removing capabilities from the bounding set is supported only if file "
1958 "capabilities are compiled into the kernel. In kernels before Linux 2.6.33, "
1959 "file capabilities were an optional feature configurable via the "
1960 "B<CONFIG_SECURITY_FILE_CAPABILITIES> option. Since Linux 2.6.33, the "
1961 "configuration option has been removed and file capabilities are always part "
1962 "of the kernel. When file capabilities are compiled into the kernel, the "
1963 "B<init> process (the ancestor of all processes) begins with a full bounding "
1964 "set. If file capabilities are not compiled into the kernel, then B<init> "
1965 "begins with a full bounding set minus B<CAP_SETPCAP>, because this "
1966 "capability has a different meaning when there are no file capabilities."
1970 #: build/C/man7/capabilities.7:954
1972 "Removing a capability from the bounding set does not remove it from the "
1973 "thread's inherited set. However it does prevent the capability from being "
1974 "added back into the thread's inherited set in the future."
1978 #: build/C/man7/capabilities.7:954
1980 msgid "Effect of user ID changes on capabilities"
1984 #: build/C/man7/capabilities.7:963
1986 "To preserve the traditional semantics for transitions between 0 and nonzero "
1987 "user IDs, the kernel makes the following changes to a thread's capability "
1988 "sets on changes to the thread's real, effective, saved set, and filesystem "
1989 "user IDs (using B<setuid>(2), B<setresuid>(2), or similar):"
1993 #: build/C/man7/capabilities.7:969
1995 "If one or more of the real, effective or saved set user IDs was previously "
1996 "0, and as a result of the UID changes all of these IDs have a nonzero value, "
1997 "then all capabilities are cleared from the permitted and effective "
2002 #: build/C/man7/capabilities.7:972
2004 "If the effective user ID is changed from 0 to nonzero, then all capabilities "
2005 "are cleared from the effective set."
2009 #: build/C/man7/capabilities.7:975
2011 "If the effective user ID is changed from nonzero to 0, then the permitted "
2012 "set is copied to the effective set."
2016 #: build/C/man7/capabilities.7:975 build/C/man7/capabilities.7:1030 build/C/man7/user_namespaces.7:529
2022 #: build/C/man7/capabilities.7:993
2024 "If the filesystem user ID is changed from 0 to nonzero (see B<setfsuid>(2)), "
2025 "then the following capabilities are cleared from the effective set: "
2026 "B<CAP_CHOWN>, B<CAP_DAC_OVERRIDE>, B<CAP_DAC_READ_SEARCH>, B<CAP_FOWNER>, "
2027 "B<CAP_FSETID>, B<CAP_LINUX_IMMUTABLE> (since Linux 2.6.30), "
2028 "B<CAP_MAC_OVERRIDE>, and B<CAP_MKNOD> (since Linux 2.6.30). If the "
2029 "filesystem UID is changed from nonzero to 0, then any of these capabilities "
2030 "that are enabled in the permitted set are enabled in the effective set."
2034 #: build/C/man7/capabilities.7:1001
2036 "If a thread that has a 0 value for one or more of its user IDs wants to "
2037 "prevent its permitted capability set being cleared when it resets all of its "
2038 "user IDs to nonzero values, it can do so using the B<prctl>(2) "
2039 "B<PR_SET_KEEPCAPS> operation."
2043 #: build/C/man7/capabilities.7:1001
2045 msgid "Programmatically adjusting capability sets"
2049 #: build/C/man7/capabilities.7:1016
2051 "A thread can retrieve and change its capability sets using the B<capget>(2) "
2052 "and B<capset>(2) system calls. However, the use of B<cap_get_proc>(3) and "
2053 "B<cap_set_proc>(3), both provided in the I<libcap> package, is preferred for "
2054 "this purpose. The following rules govern changes to the thread capability "
2059 #: build/C/man7/capabilities.7:1022
2061 "If the caller does not have the B<CAP_SETPCAP> capability, the new "
2062 "inheritable set must be a subset of the combination of the existing "
2063 "inheritable and permitted sets."
2067 #: build/C/man7/capabilities.7:1026
2069 "(Since Linux 2.6.25) The new inheritable set must be a subset of the "
2070 "combination of the existing inheritable set and the capability bounding set."
2074 #: build/C/man7/capabilities.7:1030
2076 "The new permitted set must be a subset of the existing permitted set (i.e., "
2077 "it is not possible to acquire permitted capabilities that the thread does "
2078 "not currently have)."
2082 #: build/C/man7/capabilities.7:1032
2083 msgid "The new effective set must be a subset of the new permitted set."
2087 #: build/C/man7/capabilities.7:1032
2089 msgid "The securebits flags: establishing a capabilities-only environment"
2092 #. For some background:
2093 #. see http://lwn.net/Articles/280279/ and
2094 #. http://article.gmane.org/gmane.linux.kernel.lsm/5476/
2096 #: build/C/man7/capabilities.7:1043
2098 "Starting with kernel 2.6.26, and with a kernel in which file capabilities "
2099 "are enabled, Linux implements a set of per-thread I<securebits> flags that "
2100 "can be used to disable special handling of capabilities for UID 0 "
2101 "(I<root>). These flags are as follows:"
2105 #: build/C/man7/capabilities.7:1043
2107 msgid "B<SECBIT_KEEP_CAPS>"
2111 #: build/C/man7/capabilities.7:1055
2113 "Setting this flag allows a thread that has one or more 0 UIDs to retain its "
2114 "capabilities when it switches all of its UIDs to a nonzero value. If this "
2115 "flag is not set, then such a UID switch causes the thread to lose all "
2116 "capabilities. This flag is always cleared on an B<execve>(2). (This flag "
2117 "provides the same functionality as the older B<prctl>(2) B<PR_SET_KEEPCAPS> "
2122 #: build/C/man7/capabilities.7:1055
2124 msgid "B<SECBIT_NO_SETUID_FIXUP>"
2128 #: build/C/man7/capabilities.7:1062
2130 "Setting this flag stops the kernel from adjusting capability sets when the "
2131 "threads's effective and filesystem UIDs are switched between zero and "
2132 "nonzero values. (See the subsection I<Effect of User ID Changes on "
2137 #: build/C/man7/capabilities.7:1062
2139 msgid "B<SECBIT_NOROOT>"
2143 #: build/C/man7/capabilities.7:1070
2145 "If this bit is set, then the kernel does not grant capabilities when a "
2146 "set-user-ID-root program is executed, or when a process with an effective or "
2147 "real UID of 0 calls B<execve>(2). (See the subsection I<Capabilities and "
2148 "execution of programs by root>.)"
2152 #: build/C/man7/capabilities.7:1080
2154 "Each of the above \"base\" flags has a companion \"locked\" flag. Setting "
2155 "any of the \"locked\" flags is irreversible, and has the effect of "
2156 "preventing further changes to the corresponding \"base\" flag. The locked "
2157 "flags are: B<SECBIT_KEEP_CAPS_LOCKED>, B<SECBIT_NO_SETUID_FIXUP_LOCKED>, and "
2158 "B<SECBIT_NOROOT_LOCKED>."
2162 #: build/C/man7/capabilities.7:1092
2164 "The I<securebits> flags can be modified and retrieved using the B<prctl>(2) "
2165 "B<PR_SET_SECUREBITS> and B<PR_GET_SECUREBITS> operations. The "
2166 "B<CAP_SETPCAP> capability is required to modify the flags."
2170 #: build/C/man7/capabilities.7:1101
2172 "The I<securebits> flags are inherited by child processes. During an "
2173 "B<execve>(2), all of the flags are preserved, except B<SECBIT_KEEP_CAPS> "
2174 "which is always cleared."
2178 #: build/C/man7/capabilities.7:1106
2180 "An application can use the following call to lock itself, and all of its "
2181 "descendants, into an environment where the only way of gaining capabilities "
2182 "is by executing a program with associated file capabilities:"
2186 #: build/C/man7/capabilities.7:1115
2189 "prctl(PR_SET_SECUREBITS,\n"
2190 " SECBIT_KEEP_CAPS_LOCKED |\n"
2191 " SECBIT_NO_SETUID_FIXUP |\n"
2192 " SECBIT_NO_SETUID_FIXUP_LOCKED |\n"
2193 " SECBIT_NOROOT |\n"
2194 " SECBIT_NOROOT_LOCKED);\n"
2198 #: build/C/man7/capabilities.7:1117
2200 msgid "Interaction with user namespaces"
2204 #: build/C/man7/capabilities.7:1120
2206 "For a discussion of the interaction of capabilities and user namespaces, see "
2207 "B<user_namespaces>(7)."
2211 #: build/C/man7/capabilities.7:1126
2213 "No standards govern capabilities, but the Linux capability implementation is "
2214 "based on the withdrawn POSIX.1e draft standard; see E<.UR "
2215 "http://wt.tuxomania.net\\:/publications\\:/posix.1e/> E<.UE .>"
2219 #: build/C/man7/capabilities.7:1131
2221 "Since kernel 2.5.27, capabilities are an optional kernel component, and can "
2222 "be enabled/disabled via the B<CONFIG_SECURITY_CAPABILITIES> kernel "
2223 "configuration option."
2226 #. 7b9a7ec565505699f503b4fcf61500dceb36e744
2228 #: build/C/man7/capabilities.7:1145
2230 "The I</proc/PID/task/TID/status> file can be used to view the capability "
2231 "sets of a thread. The I</proc/PID/status> file shows the capability sets of "
2232 "a process's main thread. Before Linux 3.8, nonexistent capabilities were "
2233 "shown as being enabled (1) in these sets. Since Linux 3.8, all nonexistent "
2234 "capabilities (above B<CAP_LAST_CAP>) are shown as disabled (0)."
2238 #: build/C/man7/capabilities.7:1160
2240 "The I<libcap> package provides a suite of routines for setting and getting "
2241 "capabilities that is more comfortable and less likely to change than the "
2242 "interface provided by B<capset>(2) and B<capget>(2). This package also "
2243 "provides the B<setcap>(8) and B<getcap>(8) programs. It can be found at"
2247 #: build/C/man7/capabilities.7:1163
2250 "http://www.kernel.org\\:/pub\\:/linux\\:/libs\\:/security\\:/linux-privs> "
2255 #: build/C/man7/capabilities.7:1172
2257 "Before kernel 2.6.24, and since kernel 2.6.24 if file capabilities are not "
2258 "enabled, a thread with the B<CAP_SETPCAP> capability can manipulate the "
2259 "capabilities of threads other than itself. However, this is only "
2260 "theoretically possible, since no thread ever has B<CAP_SETPCAP> in either of "
2265 #: build/C/man7/capabilities.7:1177
2267 "In the pre-2.6.25 implementation the system-wide capability bounding set, "
2268 "I</proc/sys/kernel/cap-bound>, always masks out this capability, and this "
2269 "can not be changed without modifying the kernel source and rebuilding."
2273 #: build/C/man7/capabilities.7:1183
2275 "If file capabilities are disabled in the current implementation, then "
2276 "B<init> starts out with this capability removed from its per-process "
2277 "bounding set, and that bounding set is inherited by all other processes "
2278 "created on the system."
2282 #: build/C/man7/capabilities.7:1202
2284 "B<capsh>(1), B<setpriv>(2), B<prctl>(2), B<setfsuid>(2), B<cap_clear>(3), "
2285 "B<cap_copy_ext>(3), B<cap_from_text>(3), B<cap_get_file>(3), "
2286 "B<cap_get_proc>(3), B<cap_init>(3), B<capgetp>(3), B<capsetp>(3), "
2287 "B<libcap>(3), B<credentials>(7), B<user_namespaces>(7), B<pthreads>(7), "
2288 "B<getcap>(8), B<setcap>(8)"
2292 #: build/C/man7/capabilities.7:1205
2293 msgid "I<include/linux/capability.h> in the Linux kernel source tree"
2297 #: build/C/man2/capget.2:15
2303 #: build/C/man2/capget.2:15
2309 #: build/C/man2/capget.2:18
2310 msgid "capget, capset - set/get capabilities of thread(s)"
2314 #: build/C/man2/capget.2:20
2315 msgid "B<#include E<lt>sys/capability.hE<gt>>"
2319 #: build/C/man2/capget.2:22
2320 msgid "B<int capget(cap_user_header_t >I<hdrp>B<, cap_user_data_t >I<datap>B<);>"
2324 #: build/C/man2/capget.2:24
2326 "B<int capset(cap_user_header_t >I<hdrp>B<, const cap_user_data_t "
2331 #: build/C/man2/capget.2:35
2333 "As of Linux 2.2, the power of the superuser (root) has been partitioned into "
2334 "a set of discrete capabilities. Each thread has a set of effective "
2335 "capabilities identifying which capabilities (if any) it may currently "
2336 "exercise. Each thread also has a set of inheritable capabilities that may "
2337 "be passed through an B<execve>(2) call, and a set of permitted capabilities "
2338 "that it can make effective or inheritable."
2342 #: build/C/man2/capget.2:44
2344 "These two system calls are the raw kernel interface for getting and setting "
2345 "thread capabilities. Not only are these system calls specific to Linux, but "
2346 "the kernel API is likely to change and use of these system calls (in "
2347 "particular the format of the I<cap_user_*_t> types) is subject to extension "
2348 "with each kernel revision, but old programs will keep working."
2352 #: build/C/man2/capget.2:55
2354 "The portable interfaces are B<cap_set_proc>(3) and B<cap_get_proc>(3); if "
2355 "possible, you should use those interfaces in applications. If you wish to "
2356 "use the Linux extensions in applications, you should use the easier-to-use "
2357 "interfaces B<capsetp>(3) and B<capgetp>(3)."
2361 #: build/C/man2/capget.2:55
2363 msgid "Current details"
2367 #: build/C/man2/capget.2:58
2369 "Now that you have been warned, some current kernel details. The structures "
2370 "are defined as follows."
2374 #: build/C/man2/capget.2:63
2377 "#define _LINUX_CAPABILITY_VERSION_1 0x19980330\n"
2378 "#define _LINUX_CAPABILITY_U32S_1 1\n"
2382 #: build/C/man2/capget.2:66
2385 "#define _LINUX_CAPABILITY_VERSION_2 0x20071026\n"
2386 "#define _LINUX_CAPABILITY_U32S_2 2\n"
2390 #: build/C/man2/capget.2:71
2393 "typedef struct __user_cap_header_struct {\n"
2396 "} *cap_user_header_t;\n"
2400 #: build/C/man2/capget.2:77
2403 "typedef struct __user_cap_data_struct {\n"
2404 " __u32 effective;\n"
2405 " __u32 permitted;\n"
2406 " __u32 inheritable;\n"
2407 "} *cap_user_data_t;\n"
2411 #: build/C/man2/capget.2:96
2413 "The I<effective>, I<permitted>, and I<inheritable> fields are bit masks of "
2414 "the capabilities defined in B<capabilities>(7). Note the B<CAP_*> values "
2415 "are bit indexes and need to be bit-shifted before ORing into the bit "
2416 "fields. To define the structures for passing to the system call you have to "
2417 "use the I<struct __user_cap_header_struct> and I<struct "
2418 "__user_cap_data_struct> names because the typedefs are only pointers."
2422 #: build/C/man2/capget.2:108
2424 "Kernels prior to 2.6.25 prefer 32-bit capabilities with version "
2425 "B<_LINUX_CAPABILITY_VERSION_1>, and kernels 2.6.25+ prefer 64-bit "
2426 "capabilities with version B<_LINUX_CAPABILITY_VERSION_2>. Note, 64-bit "
2427 "capabilities use I<datap>[0] and I<datap>[1], whereas 32-bit capabilities "
2428 "use only I<datap>[0]."
2432 #: build/C/man2/capget.2:112
2434 "Another change affecting the behavior of these system calls is kernel "
2435 "support for file capabilities (VFS capability support). This support is "
2436 "currently a compile time option (added in kernel 2.6.24)."
2440 #: build/C/man2/capget.2:119
2442 "For B<capget>() calls, one can probe the capabilities of any process by "
2443 "specifying its process ID with the I<hdrp-E<gt>pid> field value."
2447 #: build/C/man2/capget.2:119
2449 msgid "With VFS capability support"
2453 #: build/C/man2/capget.2:131
2455 "VFS Capability support creates a file-attribute method for adding "
2456 "capabilities to privileged executables. This privilege model obsoletes "
2457 "kernel support for one process asynchronously setting the capabilities of "
2458 "another. That is, with VFS support, for B<capset>() calls the only "
2459 "permitted values for I<hdrp-E<gt>pid> are 0 or B<getpid>(2), which are "
2464 #: build/C/man2/capget.2:131
2466 msgid "Without VFS capability support"
2470 #: build/C/man2/capget.2:157
2472 "When the kernel does not support VFS capabilities, B<capset>() calls can "
2473 "operate on the capabilities of the thread specified by the I<pid> field of "
2474 "I<hdrp> when that is nonzero, or on the capabilities of the calling thread "
2475 "if I<pid> is 0. If I<pid> refers to a single-threaded process, then I<pid> "
2476 "can be specified as a traditional process ID; operating on a thread of a "
2477 "multithreaded process requires a thread ID of the type returned by "
2478 "B<gettid>(2). For B<capset>(), I<pid> can also be: -1, meaning perform the "
2479 "change on all threads except the caller and B<init>(1); or a value less than "
2480 "-1, in which case the change is applied to all members of the process group "
2481 "whose ID is -I<pid>."
2485 #: build/C/man2/capget.2:160
2486 msgid "For details on the data, see B<capabilities>(7)."
2490 #: build/C/man2/capget.2:179
2492 "The calls will fail with the error B<EINVAL>, and set the I<version> field "
2493 "of I<hdrp> to the kernel preferred value of B<_LINUX_CAPABILITY_VERSION_?> "
2494 "when an unsupported I<version> value is specified. In this way, one can "
2495 "probe what the current preferred capability revision is."
2499 #: build/C/man2/capget.2:188
2501 "Bad memory address. I<hdrp> must not be NULL. I<datap> may be NULL only "
2502 "when the user is trying to determine the preferred capability version format "
2503 "supported by the kernel."
2507 #: build/C/man2/capget.2:188 build/C/man7/cpuset.7:1180 build/C/man7/cpuset.7:1189 build/C/man7/cpuset.7:1198 build/C/man7/cpuset.7:1208 build/C/man7/cpuset.7:1217 build/C/man7/cpuset.7:1224 build/C/man7/cpuset.7:1231 build/C/man2/getgroups.2:114 build/C/man2/getgroups.2:121 build/C/man2/getpriority.2:118 build/C/man2/getrlimit.2:471 build/C/man2/getrusage.2:198 build/C/man2/iopl.2:72 build/C/man2/ioprio_set.2:170 build/C/man2/seteuid.2:80 build/C/man2/setgid.2:59 build/C/man2/setpgid.2:225 build/C/man2/setresuid.2:99 build/C/man2/setreuid.2:128 build/C/man2/setuid.2:105 build/C/man2/seccomp.2:373 build/C/man2/seccomp.2:380 build/C/man2/seccomp.2:387 build/C/man2/seccomp.2:393 build/C/man2/seccomp.2:402
2513 #: build/C/man2/capget.2:191
2514 msgid "One of the arguments was invalid."
2518 #: build/C/man2/capget.2:196
2520 "An attempt was made to add a capability to the Permitted set, or to set a "
2521 "capability in the Effective or Inheritable sets that is not in the Permitted "
2526 #: build/C/man2/capget.2:215
2528 "The caller attempted to use B<capset>() to modify the capabilities of a "
2529 "thread other than itself, but lacked sufficient privilege. For kernels "
2530 "supporting VFS capabilities, this is never permitted. For kernels lacking "
2531 "VFS support, the B<CAP_SETPCAP> capability is required. (A bug in kernels "
2532 "before 2.6.11 meant that this error could also occur if a thread without "
2533 "this capability tried to change its own capabilities by specifying the "
2534 "I<pid> field as a nonzero value (i.e., the value returned by B<getpid>(2)) "
2539 #: build/C/man2/capget.2:215 build/C/man7/cpuset.7:1330 build/C/man2/getpriority.2:126 build/C/man2/getrlimit.2:502 build/C/man2/getsid.2:70 build/C/man2/ioprio_set.2:187 build/C/man2/setpgid.2:240 build/C/man2/seccomp.2:426
2545 #: build/C/man2/capget.2:218
2546 msgid "No such thread."
2550 #: build/C/man2/capget.2:220 build/C/man2/ioprio_set.2:198
2551 msgid "These system calls are Linux-specific."
2555 #: build/C/man2/capget.2:225
2557 "The portable interface to the capability querying and setting functions is "
2558 "provided by the I<libcap> library and is available here:"
2562 #: build/C/man2/capget.2:228
2565 "http://git.kernel.org/cgit\\:/linux\\:/kernel\\:/git\\:/morgan\\:\\:/libcap.git> "
2570 #: build/C/man2/capget.2:232
2571 msgid "B<clone>(2), B<gettid>(2), B<capabilities>(7)"
2575 #: build/C/man7/cpuset.7:25
2581 #: build/C/man7/cpuset.7:25
2587 #: build/C/man7/cpuset.7:28
2588 msgid "cpuset - confine processes to processor and memory node subsets"
2592 #: build/C/man7/cpuset.7:35
2594 "The cpuset filesystem is a pseudo-filesystem interface to the kernel cpuset "
2595 "mechanism, which is used to control the processor placement and memory "
2596 "placement of processes. It is commonly mounted at I</dev/cpuset>."
2600 #: build/C/man7/cpuset.7:52
2602 "On systems with kernels compiled with built in support for cpusets, all "
2603 "processes are attached to a cpuset, and cpusets are always present. If a "
2604 "system supports cpusets, then it will have the entry B<nodev cpuset> in the "
2605 "file I</proc/filesystems>. By mounting the cpuset filesystem (see the "
2606 "B<EXAMPLE> section below), the administrator can configure the cpusets on a "
2607 "system to control the processor and memory placement of processes on that "
2608 "system. By default, if the cpuset configuration on a system is not modified "
2609 "or if the cpuset filesystem is not even mounted, then the cpuset mechanism, "
2610 "though present, has no affect on the system's behavior."
2614 #: build/C/man7/cpuset.7:54
2615 msgid "A cpuset defines a list of CPUs and memory nodes."
2619 #: build/C/man7/cpuset.7:63
2621 "The CPUs of a system include all the logical processing units on which a "
2622 "process can execute, including, if present, multiple processor cores within "
2623 "a package and Hyper-Threads within a processor core. Memory nodes include "
2624 "all distinct banks of main memory; small and SMP systems typically have just "
2625 "one memory node that contains all the system's main memory, while NUMA "
2626 "(non-uniform memory access) systems have multiple memory nodes."
2630 #: build/C/man7/cpuset.7:73
2632 "Cpusets are represented as directories in a hierarchical pseudo-filesystem, "
2633 "where the top directory in the hierarchy (I</dev/cpuset>) represents the "
2634 "entire system (all online CPUs and memory nodes) and any cpuset that is the "
2635 "child (descendant) of another parent cpuset contains a subset of that "
2636 "parent's CPUs and memory nodes. The directories and files representing "
2637 "cpusets have normal filesystem permissions."
2641 #: build/C/man7/cpuset.7:84
2643 "Every process in the system belongs to exactly one cpuset. A process is "
2644 "confined to run only on the CPUs in the cpuset it belongs to, and to "
2645 "allocate memory only on the memory nodes in that cpuset. When a process "
2646 "B<fork>(2)s, the child process is placed in the same cpuset as its parent. "
2647 "With sufficient privilege, a process may be moved from one cpuset to another "
2648 "and the allowed CPUs and memory nodes of an existing cpuset may be changed."
2652 #: build/C/man7/cpuset.7:92
2654 "When the system begins booting, a single cpuset is defined that includes all "
2655 "CPUs and memory nodes on the system, and all processes are in that cpuset. "
2656 "During the boot process, or later during normal system operation, other "
2657 "cpusets may be created, as subdirectories of this top cpuset, under the "
2658 "control of the system administrator, and processes may be placed in these "
2663 #: build/C/man7/cpuset.7:114
2665 "Cpusets are integrated with the B<sched_setaffinity>(2) scheduling affinity "
2666 "mechanism and the B<mbind>(2) and B<set_mempolicy>(2) memory-placement "
2667 "mechanisms in the kernel. Neither of these mechanisms let a process make "
2668 "use of a CPU or memory node that is not allowed by that process's cpuset. "
2669 "If changes to a process's cpuset placement conflict with these other "
2670 "mechanisms, then cpuset placement is enforced even if it means overriding "
2671 "these other mechanisms. The kernel accomplishes this overriding by silently "
2672 "restricting the CPUs and memory nodes requested by these other mechanisms to "
2673 "those allowed by the invoking process's cpuset. This can result in these "
2674 "other calls returning an error, if for example, such a call ends up "
2675 "requesting an empty set of CPUs or memory nodes, after that request is "
2676 "restricted to the invoking process's cpuset."
2680 #: build/C/man7/cpuset.7:120
2682 "Typically, a cpuset is used to manage the CPU and memory-node confinement "
2683 "for a set of cooperating processes such as a batch scheduler job, and these "
2684 "other mechanisms are used to manage the placement of individual processes or "
2685 "memory regions within that set or job."
2689 #: build/C/man7/cpuset.7:120
2695 #: build/C/man7/cpuset.7:125
2697 "Each directory below I</dev/cpuset> represents a cpuset and contains a fixed "
2698 "set of pseudo-files describing the state of that cpuset."
2702 #: build/C/man7/cpuset.7:135
2704 "New cpusets are created using the B<mkdir>(2) system call or the "
2705 "B<mkdir>(1) command. The properties of a cpuset, such as its flags, "
2706 "allowed CPUs and memory nodes, and attached processes, are queried and "
2707 "modified by reading or writing to the appropriate file in that cpuset's "
2708 "directory, as listed below."
2712 #: build/C/man7/cpuset.7:141
2714 "The pseudo-files in each cpuset directory are automatically created when the "
2715 "cpuset is created, as a result of the B<mkdir>(2) invocation. It is not "
2716 "possible to directly add or remove these pseudo-files."
2720 #: build/C/man7/cpuset.7:149
2722 "A cpuset directory that contains no child cpuset directories, and has no "
2723 "attached processes, can be removed using B<rmdir>(2) or B<rmdir>(1). It is "
2724 "not necessary, or possible, to remove the pseudo-files inside the directory "
2725 "before removing it."
2729 #: build/C/man7/cpuset.7:163
2731 "The pseudo-files in each cpuset directory are small text files that may be "
2732 "read and written using traditional shell utilities such as B<cat>(1), and "
2733 "B<echo>(1), or from a program by using file I/O library functions or system "
2734 "calls, such as B<open>(2), B<read>(2), B<write>(2), and B<close>(2)."
2737 #. ====================== tasks ======================
2739 #: build/C/man7/cpuset.7:168
2741 "The pseudo-files in a cpuset directory represent internal kernel state and "
2742 "do not have any persistent image on disk. Each of these per-cpuset files is "
2743 "listed and described below."
2747 #: build/C/man7/cpuset.7:168
2753 #: build/C/man7/cpuset.7:178
2755 "List of the process IDs (PIDs) of the processes in that cpuset. The list is "
2756 "formatted as a series of ASCII decimal numbers, each followed by a newline. "
2757 "A process may be added to a cpuset (automatically removing it from the "
2758 "cpuset that previously contained it) by writing its PID to that cpuset's "
2759 "I<tasks> file (with or without a trailing newline)."
2762 #. =================== notify_on_release ===================
2764 #: build/C/man7/cpuset.7:186
2766 "B<Warning:> only one PID may be written to the I<tasks> file at a time. If "
2767 "a string is written that contains more than one PID, only the first one will "
2772 #: build/C/man7/cpuset.7:186
2774 msgid "I<notify_on_release>"
2777 #. ====================== cpus ======================
2779 #: build/C/man7/cpuset.7:195
2781 "Flag (0 or 1). If set (1), that cpuset will receive special handling after "
2782 "it is released, that is, after all processes cease using it (i.e., terminate "
2783 "or are moved to a different cpuset) and all child cpuset directories have "
2784 "been removed. See the B<Notify On Release> section, below."
2788 #: build/C/man7/cpuset.7:195
2790 msgid "I<cpuset.cpus>"
2794 #: build/C/man7/cpuset.7:202
2796 "List of the physical numbers of the CPUs on which processes in that cpuset "
2797 "are allowed to execute. See B<List Format> below for a description of the "
2798 "format of I<cpus>."
2801 #. ==================== cpu_exclusive ====================
2803 #: build/C/man7/cpuset.7:208
2805 "The CPUs allowed to a cpuset may be changed by writing a new list to its "
2810 #: build/C/man7/cpuset.7:208
2812 msgid "I<cpuset.cpu_exclusive>"
2816 #: build/C/man7/cpuset.7:215
2818 "Flag (0 or 1). If set (1), the cpuset has exclusive use of its CPUs (no "
2819 "sibling or cousin cpuset may overlap CPUs). By default this is off (0). "
2820 "Newly created cpusets also initially default this to off (0)."
2823 #. ====================== mems ======================
2825 #: build/C/man7/cpuset.7:237
2827 "Two cpusets are I<sibling> cpusets if they share the same parent cpuset in "
2828 "the I</dev/cpuset> hierarchy. Two cpusets are I<cousin> cpusets if neither "
2829 "is the ancestor of the other. Regardless of the I<cpu_exclusive> setting, "
2830 "if one cpuset is the ancestor of another, and if both of these cpusets have "
2831 "nonempty I<cpus>, then their I<cpus> must overlap, because the I<cpus> of "
2832 "any cpuset are always a subset of the I<cpus> of its parent cpuset."
2836 #: build/C/man7/cpuset.7:237
2838 msgid "I<cpuset.mems>"
2841 #. ==================== mem_exclusive ====================
2843 #: build/C/man7/cpuset.7:245
2845 "List of memory nodes on which processes in this cpuset are allowed to "
2846 "allocate memory. See B<List Format> below for a description of the format "
2851 #: build/C/man7/cpuset.7:245
2853 msgid "I<cpuset.mem_exclusive>"
2857 #: build/C/man7/cpuset.7:253
2859 "Flag (0 or 1). If set (1), the cpuset has exclusive use of its memory nodes "
2860 "(no sibling or cousin may overlap). Also if set (1), the cpuset is a "
2861 "B<Hardwall> cpuset (see below). By default this is off (0). Newly created "
2862 "cpusets also initially default this to off (0)."
2865 #. ==================== mem_hardwall ====================
2867 #: build/C/man7/cpuset.7:261
2869 "Regardless of the I<mem_exclusive> setting, if one cpuset is the ancestor of "
2870 "another, then their memory nodes must overlap, because the memory nodes of "
2871 "any cpuset are always a subset of the memory nodes of that cpuset's parent "
2876 #: build/C/man7/cpuset.7:261
2878 msgid "I<cpuset.mem_hardwall> (since Linux 2.6.26)"
2881 #. ==================== memory_migrate ====================
2883 #: build/C/man7/cpuset.7:272
2885 "Flag (0 or 1). If set (1), the cpuset is a B<Hardwall> cpuset (see below). "
2886 "Unlike B<mem_exclusive>, there is no constraint on whether cpusets marked "
2887 "B<mem_hardwall> may have overlapping memory nodes with sibling or cousin "
2888 "cpusets. By default this is off (0). Newly created cpusets also initially "
2889 "default this to off (0)."
2893 #: build/C/man7/cpuset.7:272
2895 msgid "I<cpuset.memory_migrate> (since Linux 2.6.16)"
2898 #. ==================== memory_pressure ====================
2900 #: build/C/man7/cpuset.7:279
2902 "Flag (0 or 1). If set (1), then memory migration is enabled. By default "
2903 "this is off (0). See the B<Memory Migration> section, below."
2907 #: build/C/man7/cpuset.7:279
2909 msgid "I<cpuset.memory_pressure> (since Linux 2.6.16)"
2912 #. ================= memory_pressure_enabled =================
2914 #: build/C/man7/cpuset.7:292
2916 "A measure of how much memory pressure the processes in this cpuset are "
2917 "causing. See the B<Memory Pressure> section, below. Unless "
2918 "I<memory_pressure_enabled> is enabled, always has value zero (0). This file "
2919 "is read-only. See the B<WARNINGS> section, below."
2923 #: build/C/man7/cpuset.7:292
2925 msgid "I<cpuset.memory_pressure_enabled> (since Linux 2.6.16)"
2928 #. ================== memory_spread_page ==================
2930 #: build/C/man7/cpuset.7:304
2932 "Flag (0 or 1). This file is present only in the root cpuset, normally "
2933 "I</dev/cpuset>. If set (1), the I<memory_pressure> calculations are enabled "
2934 "for all cpusets in the system. By default this is off (0). See the "
2935 "B<Memory Pressure> section, below."
2939 #: build/C/man7/cpuset.7:304
2941 msgid "I<cpuset.memory_spread_page> (since Linux 2.6.17)"
2944 #. ================== memory_spread_slab ==================
2946 #: build/C/man7/cpuset.7:314
2948 "Flag (0 or 1). If set (1), pages in the kernel page cache (filesystem "
2949 "buffers) are uniformly spread across the cpuset. By default this is off (0) "
2950 "in the top cpuset, and inherited from the parent cpuset in newly created "
2951 "cpusets. See the B<Memory Spread> section, below."
2955 #: build/C/man7/cpuset.7:314
2957 msgid "I<cpuset.memory_spread_slab> (since Linux 2.6.17)"
2960 #. ================== sched_load_balance ==================
2962 #: build/C/man7/cpuset.7:325
2964 "Flag (0 or 1). If set (1), the kernel slab caches for file I/O (directory "
2965 "and inode structures) are uniformly spread across the cpuset. By default "
2966 "this is off (0) in the top cpuset, and inherited from the parent cpuset in "
2967 "newly created cpusets. See the B<Memory Spread> section, below."
2971 #: build/C/man7/cpuset.7:325
2973 msgid "I<cpuset.sched_load_balance> (since Linux 2.6.24)"
2976 #. ================== sched_relax_domain_level ==================
2978 #: build/C/man7/cpuset.7:339
2980 "Flag (0 or 1). If set (1, the default) the kernel will automatically load "
2981 "balance processes in that cpuset over the allowed CPUs in that cpuset. If "
2982 "cleared (0) the kernel will avoid load balancing processes in this cpuset, "
2983 "I<unless> some other cpuset with overlapping CPUs has its "
2984 "I<sched_load_balance> flag set. See B<Scheduler Load Balancing>, below, for "
2989 #: build/C/man7/cpuset.7:339
2991 msgid "I<cpuset.sched_relax_domain_level> (since Linux 2.6.26)"
2994 #. ================== proc cpuset ==================
2996 #: build/C/man7/cpuset.7:359
2998 "Integer, between -1 and a small positive value. The "
2999 "I<sched_relax_domain_level> controls the width of the range of CPUs over "
3000 "which the kernel scheduler performs immediate rebalancing of runnable tasks "
3001 "across CPUs. If I<sched_load_balance> is disabled, then the setting of "
3002 "I<sched_relax_domain_level> does not matter, as no such load balancing is "
3003 "done. If I<sched_load_balance> is enabled, then the higher the value of the "
3004 "I<sched_relax_domain_level>, the wider the range of CPUs over which "
3005 "immediate load balancing is attempted. See B<Scheduler Relax Domain Level>, "
3006 "below, for further details."
3009 #. ================== proc status ==================
3011 #: build/C/man7/cpuset.7:367
3013 "In addition to the above pseudo-files in each directory below "
3014 "I</dev/cpuset>, each process has a pseudo-file, "
3015 "I</proc/E<lt>pidE<gt>/cpuset>, that displays the path of the process's "
3016 "cpuset directory relative to the root of the cpuset filesystem."
3020 #: build/C/man7/cpuset.7:378
3022 "Also the I</proc/E<lt>pidE<gt>/status> file for each process has four added "
3023 "lines, displaying the process's I<Cpus_allowed> (on which CPUs it may be "
3024 "scheduled) and I<Mems_allowed> (on which memory nodes it may obtain memory), "
3025 "in the two formats B<Mask Format> and B<List Format> (see below) as shown "
3026 "in the following example:"
3030 #: build/C/man7/cpuset.7:385
3033 "Cpus_allowed: ffffffff,ffffffff,ffffffff,ffffffff\n"
3034 "Cpus_allowed_list: 0-127\n"
3035 "Mems_allowed: ffffffff,ffffffff\n"
3036 "Mems_allowed_list: 0-63\n"
3039 #. ================== EXTENDED CAPABILITIES ==================
3041 #: build/C/man7/cpuset.7:391
3043 "The \"allowed\" fields were added in Linux 2.6.24; the \"allowed_list\" "
3044 "fields were added in Linux 2.6.26."
3048 #: build/C/man7/cpuset.7:391
3050 msgid "EXTENDED CAPABILITIES"
3053 #. ================== Exclusive Cpusets ==================
3055 #: build/C/man7/cpuset.7:399
3057 "In addition to controlling which I<cpus> and I<mems> a process is allowed to "
3058 "use, cpusets provide the following extended capabilities."
3062 #: build/C/man7/cpuset.7:399
3064 msgid "Exclusive cpusets"
3068 #: build/C/man7/cpuset.7:406
3070 "If a cpuset is marked I<cpu_exclusive> or I<mem_exclusive>, no other cpuset, "
3071 "other than a direct ancestor or descendant, may share any of the same CPUs "
3075 #. ================== Hardwall ==================
3077 #: build/C/man7/cpuset.7:432
3079 "A cpuset that is I<mem_exclusive> restricts kernel allocations for buffer "
3080 "cache pages and other internal kernel data pages commonly shared by the "
3081 "kernel across multiple users. All cpusets, whether I<mem_exclusive> or not, "
3082 "restrict allocations of memory for user space. This enables configuring a "
3083 "system so that several independent jobs can share common kernel data, while "
3084 "isolating each job's user allocation in its own cpuset. To do this, "
3085 "construct a large I<mem_exclusive> cpuset to hold all the jobs, and "
3086 "construct child, non-I<mem_exclusive> cpusets for each individual job. Only "
3087 "a small amount of kernel memory, such as requests from interrupt handlers, "
3088 "is allowed to be placed on memory nodes outside even a I<mem_exclusive> "
3093 #: build/C/man7/cpuset.7:432
3099 #: build/C/man7/cpuset.7:447
3101 "A cpuset that has I<mem_exclusive> or I<mem_hardwall> set is a I<hardwall> "
3102 "cpuset. A I<hardwall> cpuset restricts kernel allocations for page, buffer, "
3103 "and other data commonly shared by the kernel across multiple users. All "
3104 "cpusets, whether I<hardwall> or not, restrict allocations of memory for user "
3109 #: build/C/man7/cpuset.7:458
3111 "This enables configuring a system so that several independent jobs can share "
3112 "common kernel data, such as filesystem pages, while isolating each job's "
3113 "user allocation in its own cpuset. To do this, construct a large "
3114 "I<hardwall> cpuset to hold all the jobs, and construct child cpusets for "
3115 "each individual job which are not I<hardwall> cpusets."
3118 #. ================== Notify On Release ==================
3120 #: build/C/man7/cpuset.7:464
3122 "Only a small amount of kernel memory, such as requests from interrupt "
3123 "handlers, is allowed to be taken outside even a I<hardwall> cpuset."
3127 #: build/C/man7/cpuset.7:464
3129 msgid "Notify on release"
3133 #: build/C/man7/cpuset.7:476
3135 "If the I<notify_on_release> flag is enabled (1) in a cpuset, then whenever "
3136 "the last process in the cpuset leaves (exits or attaches to some other "
3137 "cpuset) and the last child cpuset of that cpuset is removed, the kernel "
3138 "will run the command I</sbin/cpuset_release_agent>, supplying the pathname "
3139 "(relative to the mount point of the cpuset filesystem) of the abandoned "
3140 "cpuset. This enables automatic removal of abandoned cpusets."
3144 #: build/C/man7/cpuset.7:484
3146 "The default value of I<notify_on_release> in the root cpuset at system boot "
3147 "is disabled (0). The default value of other cpusets at creation is the "
3148 "current value of their parent's I<notify_on_release> setting."
3152 #: build/C/man7/cpuset.7:492
3154 "The command I</sbin/cpuset_release_agent> is invoked, with the name "
3155 "(I</dev/cpuset> relative path) of the to-be-released cpuset in I<argv[1]>."
3159 #: build/C/man7/cpuset.7:496
3161 "The usual contents of the command I</sbin/cpuset_release_agent> is simply "
3166 #: build/C/man7/cpuset.7:501
3170 "rmdir /dev/cpuset/$1\n"
3173 #. ================== Memory Pressure ==================
3175 #: build/C/man7/cpuset.7:509
3177 "As with other flag values below, this flag can be changed by writing an "
3178 "ASCII number 0 or 1 (with optional trailing newline) into the file, to "
3179 "clear or set the flag, respectively."
3183 #: build/C/man7/cpuset.7:509
3185 msgid "Memory pressure"
3189 #: build/C/man7/cpuset.7:515
3191 "The I<memory_pressure> of a cpuset provides a simple per-cpuset running "
3192 "average of the rate that the processes in a cpuset are attempting to free up "
3193 "in-use memory on the nodes of the cpuset to satisfy additional memory "
3198 #: build/C/man7/cpuset.7:519
3200 "This enables batch managers that are monitoring jobs running in dedicated "
3201 "cpusets to efficiently detect what level of memory pressure that job is "
3206 #: build/C/man7/cpuset.7:526
3208 "This is useful both on tightly managed systems running a wide mix of "
3209 "submitted jobs, which may choose to terminate or reprioritize jobs that are "
3210 "trying to use more memory than allowed on the nodes assigned them, and with "
3211 "tightly coupled, long-running, massively parallel scientific computing jobs "
3212 "that will dramatically fail to meet required performance goals if they start "
3213 "to use more memory than allowed to them."
3217 #: build/C/man7/cpuset.7:531
3219 "This mechanism provides a very economical way for the batch manager to "
3220 "monitor a cpuset for signs of memory pressure. It's up to the batch manager "
3221 "or other user code to decide what action to take if it detects signs of "
3226 #: build/C/man7/cpuset.7:538
3228 "Unless memory pressure calculation is enabled by setting the pseudo-file "
3229 "I</dev/cpuset/cpuset.memory_pressure_enabled>, it is not computed for any "
3230 "cpuset, and reads from any I<memory_pressure> always return zero, as "
3231 "represented by the ASCII string \"0\\en\". See the B<WARNINGS> section, "
3236 #: build/C/man7/cpuset.7:540
3237 msgid "A per-cpuset, running average is employed for the following reasons:"
3241 #: build/C/man7/cpuset.7:545
3243 "Because this meter is per-cpuset rather than per-process or per virtual "
3244 "memory region, the system load imposed by a batch scheduler monitoring this "
3245 "metric is sharply reduced on large systems, because a scan of the tasklist "
3246 "can be avoided on each set of queries."
3250 #: build/C/man7/cpuset.7:550
3252 "Because this meter is a running average rather than an accumulating counter, "
3253 "a batch scheduler can detect memory pressure with a single read, instead of "
3254 "having to read and accumulate results for a period of time."
3258 #: build/C/man7/cpuset.7:556
3260 "Because this meter is per-cpuset rather than per-process, the batch "
3261 "scheduler can obtain the key information\\(emmemory pressure in a "
3262 "cpuset\\(emwith a single read, rather than having to query and accumulate "
3263 "results over all the (dynamically changing) set of processes in the cpuset."
3267 #: build/C/man7/cpuset.7:564
3269 "The I<memory_pressure> of a cpuset is calculated using a per-cpuset simple "
3270 "digital filter that is kept within the kernel. For each cpuset, this filter "
3271 "tracks the recent rate at which processes attached to that cpuset enter the "
3272 "kernel direct reclaim code."
3276 #: build/C/man7/cpuset.7:573
3278 "The kernel direct reclaim code is entered whenever a process has to satisfy "
3279 "a memory page request by first finding some other page to repurpose, due to "
3280 "lack of any readily available already free pages. Dirty filesystem pages "
3281 "are repurposed by first writing them to disk. Unmodified filesystem buffer "
3282 "pages are repurposed by simply dropping them, though if that page is needed "
3283 "again, it will have to be reread from disk."
3286 #. ================== Memory Spread ==================
3288 #: build/C/man7/cpuset.7:581
3290 "The I<cpuset.memory_pressure> file provides an integer number representing "
3291 "the recent (half-life of 10 seconds) rate of entries to the direct reclaim "
3292 "code caused by any process in the cpuset, in units of reclaims attempted per "
3293 "second, times 1000."
3297 #: build/C/man7/cpuset.7:581
3299 msgid "Memory spread"
3303 #: build/C/man7/cpuset.7:589
3305 "There are two Boolean flag files per cpuset that control where the kernel "
3306 "allocates pages for the filesystem buffers and related in-kernel data "
3307 "structures. They are called I<cpuset.memory_spread_page> and "
3308 "I<cpuset.memory_spread_slab>."
3312 #: build/C/man7/cpuset.7:596
3314 "If the per-cpuset Boolean flag file I<cpuset.memory_spread_page> is set, "
3315 "then the kernel will spread the filesystem buffers (page cache) evenly over "
3316 "all the nodes that the faulting process is allowed to use, instead of "
3317 "preferring to put those pages on the node where the process is running."
3321 #: build/C/man7/cpuset.7:604
3323 "If the per-cpuset Boolean flag file I<cpuset.memory_spread_slab> is set, "
3324 "then the kernel will spread some filesystem-related slab caches, such as "
3325 "those for inodes and directory entries, evenly over all the nodes that the "
3326 "faulting process is allowed to use, instead of preferring to put those pages "
3327 "on the node where the process is running."
3331 #: build/C/man7/cpuset.7:609
3333 "The setting of these flags does not affect the data segment (see B<brk>(2)) "
3334 "or stack segment pages of a process."
3338 #: build/C/man7/cpuset.7:617
3340 "By default, both kinds of memory spreading are off and the kernel prefers to "
3341 "allocate memory pages on the node local to where the requesting process is "
3342 "running. If that node is not allowed by the process's NUMA memory policy or "
3343 "cpuset configuration or if there are insufficient free memory pages on that "
3344 "node, then the kernel looks for the nearest node that is allowed and has "
3345 "sufficient free memory."
3349 #: build/C/man7/cpuset.7:620
3351 "When new cpusets are created, they inherit the memory spread settings of "
3356 #: build/C/man7/cpuset.7:635
3358 "Setting memory spreading causes allocations for the affected page or slab "
3359 "caches to ignore the process's NUMA memory policy and be spread instead. "
3360 "However, the effect of these changes in memory placement caused by "
3361 "cpuset-specified memory spreading is hidden from the B<mbind>(2) or "
3362 "B<set_mempolicy>(2) calls. These two NUMA memory policy calls always "
3363 "appear to behave as if no cpuset-specified memory spreading is in effect, "
3364 "even if it is. If cpuset memory spreading is subsequently turned off, the "
3365 "NUMA memory policy most recently specified by these calls is automatically "
3370 #: build/C/man7/cpuset.7:644
3372 "Both I<cpuset.memory_spread_page> and I<cpuset.memory_spread_slab> are "
3373 "Boolean flag files. By default they contain \"0\", meaning that the feature "
3374 "is off for that cpuset. If a \"1\" is written to that file, that turns the "
3379 #: build/C/man7/cpuset.7:647
3381 "Cpuset-specified memory spreading behaves similarly to what is known (in "
3382 "other contexts) as round-robin or interleave memory placement."
3386 #: build/C/man7/cpuset.7:650
3388 "Cpuset-specified memory spreading can provide substantial performance "
3389 "improvements for jobs that:"
3393 #: build/C/man7/cpuset.7:650 build/C/man7/user_namespaces.7:384
3399 #: build/C/man7/cpuset.7:654
3401 "need to place thread-local data on memory nodes close to the CPUs which are "
3402 "running the threads that most frequently access that data; but also"
3406 #: build/C/man7/cpuset.7:654 build/C/man7/user_namespaces.7:389
3412 #: build/C/man7/cpuset.7:657
3414 "need to access large filesystem data sets that must to be spread across the "
3415 "several nodes in the job's cpuset in order to fit."
3418 #. ================== Memory Migration ==================
3420 #: build/C/man7/cpuset.7:664
3422 "Without this policy, the memory allocation across the nodes in the job's "
3423 "cpuset can become very uneven, especially for jobs that might have just a "
3424 "single thread initializing or reading in the data set."
3428 #: build/C/man7/cpuset.7:664
3430 msgid "Memory migration"
3434 #: build/C/man7/cpuset.7:673
3436 "Normally, under the default setting (disabled) of I<cpuset.memory_migrate>, "
3437 "once a page is allocated (given a physical page of main memory), then that "
3438 "page stays on whatever node it was allocated, so long as it remains "
3439 "allocated, even if the cpuset's memory-placement policy I<mems> subsequently "
3444 #: build/C/man7/cpuset.7:679
3446 "When memory migration is enabled in a cpuset, if the I<mems> setting of the "
3447 "cpuset is changed, then any memory page in use by any process in the cpuset "
3448 "that is on a memory node that is no longer allowed will be migrated to a "
3449 "memory node that is allowed."
3453 #: build/C/man7/cpuset.7:685
3455 "Furthermore, if a process is moved into a cpuset with I<memory_migrate> "
3456 "enabled, any memory pages it uses that were on memory nodes allowed in its "
3457 "previous cpuset, but which are not allowed in its new cpuset, will be "
3458 "migrated to a memory node allowed in the new cpuset."
3461 #. ================== Scheduler Load Balancing ==================
3463 #: build/C/man7/cpuset.7:693
3465 "The relative placement of a migrated page within the cpuset is preserved "
3466 "during these migration operations if possible. For example, if the page was "
3467 "on the second valid node of the prior cpuset, then the page will be placed "
3468 "on the second valid node of the new cpuset, if possible."
3472 #: build/C/man7/cpuset.7:693
3474 msgid "Scheduler load balancing"
3478 #: build/C/man7/cpuset.7:700
3480 "The kernel scheduler automatically load balances processes. If one CPU is "
3481 "underutilized, the kernel will look for processes on other more overloaded "
3482 "CPUs and move those processes to the underutilized CPU, within the "
3483 "constraints of such placement mechanisms as cpusets and "
3484 "B<sched_setaffinity>(2)."
3488 #: build/C/man7/cpuset.7:713
3490 "The algorithmic cost of load balancing and its impact on key shared kernel "
3491 "data structures such as the process list increases more than linearly with "
3492 "the number of CPUs being balanced. For example, it costs more to load "
3493 "balance across one large set of CPUs than it does to balance across two "
3494 "smaller sets of CPUs, each of half the size of the larger set. (The precise "
3495 "relationship between the number of CPUs being balanced and the cost of load "
3496 "balancing depends on implementation details of the kernel process scheduler, "
3497 "which is subject to change over time, as improved kernel scheduler "
3498 "algorithms are implemented.)"
3502 #: build/C/man7/cpuset.7:719
3504 "The per-cpuset flag I<sched_load_balance> provides a mechanism to suppress "
3505 "this automatic scheduler load balancing in cases where it is not needed and "
3506 "suppressing it would have worthwhile performance benefits."
3510 #: build/C/man7/cpuset.7:723
3512 "By default, load balancing is done across all CPUs, except those marked "
3513 "isolated using the kernel boot time \"isolcpus=\" argument. (See "
3514 "B<Scheduler Relax Domain Level>, below, to change this default.)"
3518 #: build/C/man7/cpuset.7:726
3520 "This default load balancing across all CPUs is not well suited to the "
3521 "following two situations:"
3525 #: build/C/man7/cpuset.7:730
3527 "On large systems, load balancing across many CPUs is expensive. If the "
3528 "system is managed using cpusets to place independent jobs on separate sets "
3529 "of CPUs, full load balancing is unnecessary."
3533 #: build/C/man7/cpuset.7:734
3535 "Systems supporting real-time on some CPUs need to minimize system overhead "
3536 "on those CPUs, including avoiding process load balancing if that is not "
3541 #: build/C/man7/cpuset.7:744
3543 "When the per-cpuset flag I<sched_load_balance> is enabled (the default "
3544 "setting), it requests load balancing across all the CPUs in that cpuset's "
3545 "allowed CPUs, ensuring that load balancing can move a process (not otherwise "
3546 "pinned, as by B<sched_setaffinity>(2)) from any CPU in that cpuset to any "
3551 #: build/C/man7/cpuset.7:753
3553 "When the per-cpuset flag I<sched_load_balance> is disabled, then the "
3554 "scheduler will avoid load balancing across the CPUs in that cpuset, "
3555 "I<except> in so far as is necessary because some overlapping cpuset has "
3556 "I<sched_load_balance> enabled."
3560 #: build/C/man7/cpuset.7:761
3562 "So, for example, if the top cpuset has the flag I<sched_load_balance> "
3563 "enabled, then the scheduler will load balance across all CPUs, and the "
3564 "setting of the I<sched_load_balance> flag in other cpusets has no effect, as "
3565 "we're already fully load balancing."
3569 #: build/C/man7/cpuset.7:766
3571 "Therefore in the above two situations, the flag I<sched_load_balance> should "
3572 "be disabled in the top cpuset, and only some of the smaller, child cpusets "
3573 "would have this flag enabled."
3577 #: build/C/man7/cpuset.7:774
3579 "When doing this, you don't usually want to leave any unpinned processes in "
3580 "the top cpuset that might use nontrivial amounts of CPU, as such processes "
3581 "may be artificially constrained to some subset of CPUs, depending on the "
3582 "particulars of this flag setting in descendant cpusets. Even if such a "
3583 "process could use spare CPU cycles in some other CPUs, the kernel scheduler "
3584 "might not consider the possibility of load balancing that process to the "
3588 #. ================== Scheduler Relax Domain Level ==================
3590 #: build/C/man7/cpuset.7:780
3592 "Of course, processes pinned to a particular CPU can be left in a cpuset that "
3593 "disables I<sched_load_balance> as those processes aren't going anywhere else "
3598 #: build/C/man7/cpuset.7:780
3600 msgid "Scheduler relax domain level"
3604 #: build/C/man7/cpuset.7:801
3606 "The kernel scheduler performs immediate load balancing whenever a CPU "
3607 "becomes free or another task becomes runnable. This load balancing works to "
3608 "ensure that as many CPUs as possible are usefully employed running tasks. "
3609 "The kernel also performs periodic load balancing off the software clock "
3610 "described in B<time>(7). The setting of I<sched_relax_domain_level> applies "
3611 "only to immediate load balancing. Regardless of the "
3612 "I<sched_relax_domain_level> setting, periodic load balancing is attempted "
3613 "over all CPUs (unless disabled by turning off I<sched_load_balance>.) In "
3614 "any case, of course, tasks will be scheduled to run only on CPUs allowed by "
3615 "their cpuset, as modified by B<sched_setaffinity>(2) system calls."
3619 #: build/C/man7/cpuset.7:809
3621 "On small systems, such as those with just a few CPUs, immediate load "
3622 "balancing is useful to improve system interactivity and to minimize wasteful "
3623 "idle CPU cycles. But on large systems, attempting immediate load balancing "
3624 "across a large number of CPUs can be more costly than it is worth, depending "
3625 "on the particular performance characteristics of the job mix and the "
3630 #: build/C/man7/cpuset.7:817
3632 "The exact meaning of the small integer values of I<sched_relax_domain_level> "
3633 "will depend on internal implementation details of the kernel scheduler code "
3634 "and on the non-uniform architecture of the hardware. Both of these will "
3635 "evolve over time and vary by system architecture and kernel version."
3639 #: build/C/man7/cpuset.7:822
3641 "As of this writing, when this capability was introduced in Linux 2.6.26, on "
3642 "certain popular architectures, the positive values of "
3643 "I<sched_relax_domain_level> have the following meanings."
3647 #: build/C/man7/cpuset.7:824
3653 #: build/C/man7/cpuset.7:827
3655 "Perform immediate load balancing across Hyper-Thread siblings on the same "
3660 #: build/C/man7/cpuset.7:827
3666 #: build/C/man7/cpuset.7:829
3667 msgid "Perform immediate load balancing across other cores in the same package."
3671 #: build/C/man7/cpuset.7:829
3677 #: build/C/man7/cpuset.7:832
3679 "Perform immediate load balancing across other CPUs on the same node or "
3684 #: build/C/man7/cpuset.7:832
3690 #: build/C/man7/cpuset.7:835
3692 "Perform immediate load balancing across over several (implementation detail) "
3693 "nodes [On NUMA systems]."
3697 #: build/C/man7/cpuset.7:835
3703 #: build/C/man7/cpuset.7:838
3705 "Perform immediate load balancing across over all CPUs in system [On NUMA "
3710 #: build/C/man7/cpuset.7:847
3712 "The I<sched_relax_domain_level> value of zero (0) always means don't perform "
3713 "immediate load balancing, hence that load balancing is done only "
3714 "periodically, not immediately when a CPU becomes available or another task "
3719 #: build/C/man7/cpuset.7:855
3721 "The I<sched_relax_domain_level> value of minus one (-1) always means use "
3722 "the system default value. The system default value can vary by architecture "
3723 "and kernel version. This system default value can be changed by kernel "
3724 "boot-time \"relax_domain_level=\" argument."
3728 #: build/C/man7/cpuset.7:863
3730 "In the case of multiple overlapping cpusets which have conflicting "
3731 "I<sched_relax_domain_level> values, then the highest such value applies to "
3732 "all CPUs in any of the overlapping cpusets. In such cases, the value "
3733 "B<minus one (-1)> is the lowest value, overridden by any other value, and "
3734 "the value B<zero (0)> is the next lowest value."
3738 #: build/C/man7/cpuset.7:863
3743 #. ================== Mask Format ==================
3745 #: build/C/man7/cpuset.7:867
3746 msgid "The following formats are used to represent sets of CPUs and memory nodes."
3750 #: build/C/man7/cpuset.7:867
3756 #: build/C/man7/cpuset.7:872
3758 "The B<Mask Format> is used to represent CPU and memory-node bit masks in the "
3759 "I</proc/E<lt>pidE<gt>/status> file."
3763 #: build/C/man7/cpuset.7:880
3765 "This format displays each 32-bit word in hexadecimal (using ASCII characters "
3766 "\"0\" - \"9\" and \"a\" - \"f\"); words are filled with leading zeros, if "
3767 "required. For masks longer than one word, a comma separator is used between "
3768 "words. Words are displayed in big-endian order, which has the most "
3769 "significant bit first. The hex digits within a word are also in big-endian "
3774 #: build/C/man7/cpuset.7:883
3776 "The number of 32-bit words displayed is the minimum number needed to display "
3777 "all bits of the bit mask, based on the size of the bit mask."
3781 #: build/C/man7/cpuset.7:885
3782 msgid "Examples of the B<Mask Format>:"
3786 #: build/C/man7/cpuset.7:893
3789 "00000001 # just bit 0 set\n"
3790 "40000000,00000000,00000000 # just bit 94 set\n"
3791 "00000001,00000000,00000000 # just bit 64 set\n"
3792 "000000ff,00000000 # bits 32-39 set\n"
3793 "00000000,000e3862 # 1,5,6,11-13,17-19 set\n"
3797 #: build/C/man7/cpuset.7:897
3798 msgid "A mask with bits 0, 1, 2, 4, 8, 16, 32, and 64 set displays as:"
3802 #: build/C/man7/cpuset.7:901
3804 msgid "00000001,00000001,00010117\n"
3807 #. ================== List Format ==================
3809 #: build/C/man7/cpuset.7:908
3811 "The first \"1\" is for bit 64, the second for bit 32, the third for bit 16, "
3812 "the fourth for bit 8, the fifth for bit 4, and the \"7\" is for bits 2, 1, "
3817 #: build/C/man7/cpuset.7:908
3823 #: build/C/man7/cpuset.7:915
3825 "The B<List Format> for I<cpus> and I<mems> is a comma-separated list of CPU "
3826 "or memory-node numbers and ranges of numbers, in ASCII decimal."
3830 #: build/C/man7/cpuset.7:917
3831 msgid "Examples of the B<List Format>:"
3835 #: build/C/man7/cpuset.7:922
3838 "0-4,9 # bits 0, 1, 2, 3, 4, and 9 set\n"
3839 "0-2,7,12-14 # bits 0, 1, 2, 7, 12, 13, and 14 set\n"
3842 #. ================== RULES ==================
3844 #: build/C/man7/cpuset.7:925
3850 #: build/C/man7/cpuset.7:927
3851 msgid "The following rules apply to each cpuset:"
3855 #: build/C/man7/cpuset.7:930
3857 "Its CPUs and memory nodes must be a (possibly equal) subset of its "
3862 #: build/C/man7/cpuset.7:934
3863 msgid "It can be marked I<cpu_exclusive> only if its parent is."
3867 #: build/C/man7/cpuset.7:938
3868 msgid "It can be marked I<mem_exclusive> only if its parent is."
3872 #: build/C/man7/cpuset.7:942
3873 msgid "If it is I<cpu_exclusive>, its CPUs may not overlap any sibling."
3876 #. ================== PERMISSIONS ==================
3878 #: build/C/man7/cpuset.7:947
3879 msgid "If it is I<memory_exclusive>, its memory nodes may not overlap any sibling."
3883 #: build/C/man7/cpuset.7:947
3889 #: build/C/man7/cpuset.7:952
3891 "The permissions of a cpuset are determined by the permissions of the "
3892 "directories and pseudo-files in the cpuset filesystem, normally mounted at "
3897 #: build/C/man7/cpuset.7:961
3899 "For instance, a process can put itself in some other cpuset (than its "
3900 "current one) if it can write the I<tasks> file for that cpuset. This "
3901 "requires execute permission on the encompassing directories and write "
3902 "permission on the I<tasks> file."
3906 #: build/C/man7/cpuset.7:968
3908 "An additional constraint is applied to requests to place some other process "
3909 "in a cpuset. One process may not attach another to a cpuset unless it would "
3910 "have permission to send that process a signal (see B<kill>(2))."
3914 #: build/C/man7/cpuset.7:979
3916 "A process may create a child cpuset if it can access and write the parent "
3917 "cpuset directory. It can modify the CPUs or memory nodes in a cpuset if it "
3918 "can access that cpuset's directory (execute permissions on the each of the "
3919 "parent directories) and write the corresponding I<cpus> or I<mems> file."
3923 #: build/C/man7/cpuset.7:1000
3925 "There is one minor difference between the manner in which these permissions "
3926 "are evaluated and the manner in which normal filesystem operation "
3927 "permissions are evaluated. The kernel interprets relative pathnames "
3928 "starting at a process's current working directory. Even if one is operating "
3929 "on a cpuset file, relative pathnames are interpreted relative to the "
3930 "process's current working directory, not relative to the process's current "
3931 "cpuset. The only ways that cpuset paths relative to a process's current "
3932 "cpuset can be used are if either the process's current working directory is "
3933 "its cpuset (it first did a B<cd> or B<chdir>(2) to its cpuset directory "
3934 "beneath I</dev/cpuset>, which is a bit unusual) or if some user code "
3935 "converts the relative cpuset path to a full filesystem path."
3938 #. ================== WARNINGS ==================
3940 #: build/C/man7/cpuset.7:1015
3942 "In theory, this means that user code should specify cpusets using absolute "
3943 "pathnames, which requires knowing the mount point of the cpuset filesystem "
3944 "(usually, but not necessarily, I</dev/cpuset>). In practice, all user level "
3945 "code that this author is aware of simply assumes that if the cpuset "
3946 "filesystem is mounted, then it is mounted at I</dev/cpuset>. Furthermore, "
3947 "it is common practice for carefully written user code to verify the presence "
3948 "of the pseudo-file I</dev/cpuset/tasks> in order to verify that the cpuset "
3949 "pseudo-filesystem is currently mounted."
3953 #: build/C/man7/cpuset.7:1015
3959 #: build/C/man7/cpuset.7:1016
3961 msgid "Enabling memory_pressure"
3965 #: build/C/man7/cpuset.7:1025
3967 "By default, the per-cpuset file I<cpuset.memory_pressure> always contains "
3968 "zero (0). Unless this feature is enabled by writing \"1\" to the "
3969 "pseudo-file I</dev/cpuset/cpuset.memory_pressure_enabled>, the kernel does "
3970 "not compute per-cpuset I<memory_pressure>."
3974 #: build/C/man7/cpuset.7:1025
3976 msgid "Using the echo command"
3979 #. Gack! csh(1)'s echo does this
3981 #: build/C/man7/cpuset.7:1036
3983 "When using the B<echo> command at the shell prompt to change the values of "
3984 "cpuset files, beware that the built-in B<echo> command in some shells does "
3985 "not display an error message if the B<write>(2) system call fails. For "
3986 "example, if the command:"
3990 #: build/C/man7/cpuset.7:1040
3992 msgid "echo 19 E<gt> cpuset.mems\n"
3996 #: build/C/man7/cpuset.7:1053
3998 "failed because memory node 19 was not allowed (perhaps the current system "
3999 "does not have a memory node 19), then the B<echo> command might not display "
4000 "any error. It is better to use the B</bin/echo> external command to change "
4001 "cpuset file settings, as this command will display B<write>(2) errors, as "
4006 #: build/C/man7/cpuset.7:1058
4009 "/bin/echo 19 E<gt> cpuset.mems\n"
4010 "/bin/echo: write error: Invalid argument\n"
4013 #. ================== EXCEPTIONS ==================
4015 #: build/C/man7/cpuset.7:1061
4021 #: build/C/man7/cpuset.7:1062
4023 msgid "Memory placement"
4027 #: build/C/man7/cpuset.7:1065
4029 "Not all allocations of system memory are constrained by cpusets, for the "
4030 "following reasons."
4034 #: build/C/man7/cpuset.7:1080
4036 "If hot-plug functionality is used to remove all the CPUs that are currently "
4037 "assigned to a cpuset, then the kernel will automatically update the "
4038 "I<cpus_allowed> of all processes attached to CPUs in that cpuset to allow "
4039 "all CPUs. When memory hot-plug functionality for removing memory nodes is "
4040 "available, a similar exception is expected to apply there as well. In "
4041 "general, the kernel prefers to violate cpuset placement, rather than "
4042 "starving a process that has had all its allowed CPUs or memory nodes taken "
4043 "offline. User code should reconfigure cpusets to refer only to online CPUs "
4044 "and memory nodes when using hot-plug to add or remove such resources."
4048 #: build/C/man7/cpuset.7:1088
4050 "A few kernel-critical, internal memory-allocation requests, marked "
4051 "GFP_ATOMIC, must be satisfied immediately. The kernel may drop some request "
4052 "or malfunction if one of these allocations fail. If such a request cannot "
4053 "be satisfied within the current process's cpuset, then we relax the cpuset, "
4054 "and look for memory anywhere we can find it. It's better to violate the "
4055 "cpuset than stress the kernel."
4059 #: build/C/man7/cpuset.7:1092
4061 "Allocations of memory requested by kernel drivers while processing an "
4062 "interrupt lack any relevant process context, and are not confined by "
4067 #: build/C/man7/cpuset.7:1092
4069 msgid "Renaming cpusets"
4072 #. ================== ERRORS ==================
4074 #: build/C/man7/cpuset.7:1100
4076 "You can use the B<rename>(2) system call to rename cpusets. Only simple "
4077 "renaming is supported; that is, changing the name of a cpuset directory is "
4078 "permitted, but moving a directory into a different directory is not "
4083 #: build/C/man7/cpuset.7:1104
4085 "The Linux kernel implementation of cpusets sets I<errno> to specify the "
4086 "reason for a failed system call affecting cpusets."
4090 #: build/C/man7/cpuset.7:1109
4092 "The possible I<errno> settings and their meaning when set on a failed cpuset "
4093 "call are as listed below."
4097 #: build/C/man7/cpuset.7:1109
4103 #: build/C/man7/cpuset.7:1116
4105 "Attempted a B<write>(2) on a special cpuset file with a length larger than "
4106 "some kernel-determined upper limit on the length of such writes."
4110 #: build/C/man7/cpuset.7:1123
4112 "Attempted to B<write>(2) the process ID (PID) of a process to a cpuset "
4113 "I<tasks> file when one lacks permission to move that process."
4117 #: build/C/man7/cpuset.7:1129
4119 "Attempted to add, using B<write>(2), a CPU or memory node to a cpuset, when "
4120 "that CPU or memory node was not already in its parent."
4124 #: build/C/man7/cpuset.7:1137
4126 "Attempted to set, using B<write>(2), I<cpuset.cpu_exclusive> or "
4127 "I<cpuset.mem_exclusive> on a cpuset whose parent lacks the same setting."
4131 #: build/C/man7/cpuset.7:1144
4132 msgid "Attempted to B<write>(2) a I<cpuset.memory_pressure> file."
4136 #: build/C/man7/cpuset.7:1147
4137 msgid "Attempted to create a file in a cpuset directory."
4141 #: build/C/man7/cpuset.7:1147 build/C/man7/cpuset.7:1152 build/C/man7/cpuset.7:1157
4147 #: build/C/man7/cpuset.7:1152
4148 msgid "Attempted to remove, using B<rmdir>(2), a cpuset with attached processes."
4152 #: build/C/man7/cpuset.7:1157
4153 msgid "Attempted to remove, using B<rmdir>(2), a cpuset with child cpusets."
4157 #: build/C/man7/cpuset.7:1162
4159 "Attempted to remove a CPU or memory node from a cpuset that is also in a "
4160 "child of that cpuset."
4164 #: build/C/man7/cpuset.7:1162 build/C/man7/cpuset.7:1167
4170 #: build/C/man7/cpuset.7:1167
4171 msgid "Attempted to create, using B<mkdir>(2), a cpuset that already exists."
4175 #: build/C/man7/cpuset.7:1172
4176 msgid "Attempted to B<rename>(2) a cpuset to a name that already exists."
4180 #: build/C/man7/cpuset.7:1180
4182 "Attempted to B<read>(2) or B<write>(2) a cpuset file using a buffer that "
4183 "is outside the writing processes accessible address space."
4187 #: build/C/man7/cpuset.7:1189
4189 "Attempted to change a cpuset, using B<write>(2), in a way that would violate "
4190 "a I<cpu_exclusive> or I<mem_exclusive> attribute of that cpuset or any of "
4195 #: build/C/man7/cpuset.7:1198
4197 "Attempted to B<write>(2) an empty I<cpuset.cpus> or I<cpuset.mems> list to "
4198 "a cpuset which has attached processes or child cpusets."
4202 #: build/C/man7/cpuset.7:1208
4204 "Attempted to B<write>(2) a I<cpuset.cpus> or I<cpuset.mems> list which "
4205 "included a range with the second number smaller than the first number."
4209 #: build/C/man7/cpuset.7:1217
4211 "Attempted to B<write>(2) a I<cpuset.cpus> or I<cpuset.mems> list which "
4212 "included an invalid character in the string."
4216 #: build/C/man7/cpuset.7:1224
4218 "Attempted to B<write>(2) a list to a I<cpuset.cpus> file that did not "
4219 "include any online CPUs."
4223 #: build/C/man7/cpuset.7:1231
4225 "Attempted to B<write>(2) a list to a I<cpuset.mems> file that did not "
4226 "include any online memory nodes."
4230 #: build/C/man7/cpuset.7:1238
4232 "Attempted to B<write>(2) a list to a I<cpuset.mems> file that included a "
4233 "node that held no memory."
4237 #: build/C/man7/cpuset.7:1246
4239 "Attempted to B<write>(2) a string to a cpuset I<tasks> file that does not "
4240 "begin with an ASCII decimal integer."
4244 #: build/C/man7/cpuset.7:1251
4245 msgid "Attempted to B<rename>(2) a cpuset into a different directory."
4249 #: build/C/man7/cpuset.7:1258
4251 "Attempted to B<read>(2) a I</proc/E<lt>pidE<gt>/cpuset> file for a cpuset "
4252 "path that is longer than the kernel page size."
4256 #: build/C/man7/cpuset.7:1263
4258 "Attempted to create, using B<mkdir>(2), a cpuset whose base directory name "
4259 "is longer than 255 characters."
4263 #: build/C/man7/cpuset.7:1270
4265 "Attempted to create, using B<mkdir>(2), a cpuset whose full pathname, "
4266 "including the mount point (typically \"/dev/cpuset/\") prefix, is longer "
4267 "than 4095 characters."
4271 #: build/C/man7/cpuset.7:1270
4277 #: build/C/man7/cpuset.7:1275
4279 "The cpuset was removed by another process at the same time as a B<write>(2) "
4280 "was attempted on one of the pseudo-files in the cpuset directory."
4284 #: build/C/man7/cpuset.7:1280
4286 "Attempted to create, using B<mkdir>(2), a cpuset in a parent cpuset that "
4291 #: build/C/man7/cpuset.7:1287
4293 "Attempted to B<access>(2) or B<open>(2) a nonexistent file in a cpuset "
4298 #: build/C/man7/cpuset.7:1292
4300 "Insufficient memory is available within the kernel; can occur on a variety "
4301 "of system calls affecting cpusets, but only if the system is extremely short "
4306 #: build/C/man7/cpuset.7:1292 build/C/man7/cpuset.7:1304
4312 #: build/C/man7/cpuset.7:1304
4314 "Attempted to B<write>(2) the process ID (PID) of a process to a cpuset "
4315 "I<tasks> file when the cpuset had an empty I<cpuset.cpus> or empty "
4316 "I<cpuset.mems> setting."
4320 #: build/C/man7/cpuset.7:1314
4322 "Attempted to B<write>(2) an empty I<cpuset.cpus> or I<cpuset.mems> setting "
4323 "to a cpuset that has tasks attached."
4327 #: build/C/man7/cpuset.7:1319
4328 msgid "Attempted to B<rename>(2) a nonexistent cpuset."
4332 #: build/C/man7/cpuset.7:1322
4333 msgid "Attempted to remove a file from a cpuset directory."
4337 #: build/C/man7/cpuset.7:1322
4343 #: build/C/man7/cpuset.7:1330
4345 "Specified a I<cpuset.cpus> or I<cpuset.mems> list to the kernel which "
4346 "included a number too large for the kernel to set in its bit masks."
4349 #. ================== VERSIONS ==================
4351 #: build/C/man7/cpuset.7:1338
4353 "Attempted to B<write>(2) the process ID (PID) of a nonexistent process to a "
4354 "cpuset I<tasks> file."
4357 #. ================== NOTES ==================
4359 #: build/C/man7/cpuset.7:1341
4360 msgid "Cpusets appeared in version 2.6.12 of the Linux kernel."
4363 #. ================== BUGS ==================
4365 #: build/C/man7/cpuset.7:1352
4367 "Despite its name, the I<pid> parameter is actually a thread ID, and each "
4368 "thread in a threaded group can be attached to a different cpuset. The value "
4369 "returned from a call to B<gettid>(2) can be passed in the argument I<pid>."
4373 #: build/C/man7/cpuset.7:1352 build/C/man2/getpriority.2:225 build/C/man2/getrlimit.2:577 build/C/man2/ioprio_set.2:337 build/C/man2/setfsgid.2:106 build/C/man2/setfsuid.2:114
4378 #. ================== EXAMPLE ==================
4380 #: build/C/man7/cpuset.7:1365
4382 "I<cpuset.memory_pressure> cpuset files can be opened for writing, creation, "
4383 "or truncation, but then the B<write>(2) fails with I<errno> set to "
4384 "B<EACCES>, and the creation and truncation options on B<open>(2) have no "
4389 #: build/C/man7/cpuset.7:1365 build/C/man2/getrlimit.2:710 build/C/man7/namespaces.7:361 build/C/man7/pid_namespaces.7:353 build/C/man7/user_namespaces.7:677 build/C/man2/seccomp.2:476
4395 #: build/C/man7/cpuset.7:1368
4397 "The following examples demonstrate querying and setting cpuset options using "
4402 #: build/C/man7/cpuset.7:1368
4404 msgid "Creating and attaching to a cpuset."
4408 #: build/C/man7/cpuset.7:1371
4410 "To create a new cpuset and attach the current command shell to it, the steps "
4415 #: build/C/man7/cpuset.7:1373 build/C/man7/cpuset.7:1412
4421 #: build/C/man7/cpuset.7:1375
4422 msgid "mkdir /dev/cpuset (if not already done)"
4426 #: build/C/man7/cpuset.7:1375 build/C/man7/cpuset.7:1418
4432 #: build/C/man7/cpuset.7:1377
4433 msgid "mount -t cpuset none /dev/cpuset (if not already done)"
4437 #: build/C/man7/cpuset.7:1377 build/C/man7/cpuset.7:1421
4443 #: build/C/man7/cpuset.7:1380
4444 msgid "Create the new cpuset using B<mkdir>(1)."
4448 #: build/C/man7/cpuset.7:1380 build/C/man7/cpuset.7:1424
4454 #: build/C/man7/cpuset.7:1382
4455 msgid "Assign CPUs and memory nodes to the new cpuset."
4459 #: build/C/man7/cpuset.7:1382 build/C/man7/cpuset.7:1429
4465 #: build/C/man7/cpuset.7:1384
4466 msgid "Attach the shell to the new cpuset."
4470 #: build/C/man7/cpuset.7:1389
4472 "For example, the following sequence of commands will set up a cpuset named "
4473 "\"Charlie\", containing just CPUs 2 and 3, and memory node 1, and then "
4474 "attach the current shell to that cpuset."
4478 #: build/C/man7/cpuset.7:1403
4481 "$B< mkdir /dev/cpuset>\n"
4482 "$B< mount -t cpuset cpuset /dev/cpuset>\n"
4483 "$B< cd /dev/cpuset>\n"
4484 "$B< mkdir Charlie>\n"
4486 "$B< /bin/echo 2-3 E<gt> cpuset.cpus>\n"
4487 "$B< /bin/echo 1 E<gt> cpuset.mems>\n"
4488 "$B< /bin/echo $$ E<gt> tasks>\n"
4489 "# The current shell is now running in cpuset Charlie\n"
4490 "# The next line should display '/Charlie'\n"
4491 "$B< cat /proc/self/cpuset>\n"
4495 #: build/C/man7/cpuset.7:1405
4497 msgid "Migrating a job to different memory nodes."
4501 #: build/C/man7/cpuset.7:1410
4503 "To migrate a job (the set of processes attached to a cpuset) to different "
4504 "CPUs and memory nodes in the system, including moving the memory pages "
4505 "currently allocated to that job, perform the following steps."
4509 #: build/C/man7/cpuset.7:1418
4511 "Let's say we want to move the job in cpuset I<alpha> (CPUs 4-7 and memory "
4512 "nodes 2-3) to a new cpuset I<beta> (CPUs 16-19 and memory nodes 8-9)."
4516 #: build/C/man7/cpuset.7:1421
4517 msgid "First create the new cpuset I<beta>."
4521 #: build/C/man7/cpuset.7:1424
4522 msgid "Then allow CPUs 16-19 and memory nodes 8-9 in I<beta>."
4526 #: build/C/man7/cpuset.7:1429
4527 msgid "Then enable I<memory_migration> in I<beta>."
4531 #: build/C/man7/cpuset.7:1434
4532 msgid "Then move each process from I<alpha> to I<beta>."
4536 #: build/C/man7/cpuset.7:1437
4537 msgid "The following sequence of commands accomplishes this."
4541 #: build/C/man7/cpuset.7:1447
4544 "$B< cd /dev/cpuset>\n"
4547 "$B< /bin/echo 16-19 E<gt> cpuset.cpus>\n"
4548 "$B< /bin/echo 8-9 E<gt> cpuset.mems>\n"
4549 "$B< /bin/echo 1 E<gt> cpuset.memory_migrate>\n"
4550 "$B< while read i; do /bin/echo $i; done E<lt> ../alpha/tasks E<gt> tasks>\n"
4554 #: build/C/man7/cpuset.7:1456
4556 "The above should move any processes in I<alpha> to I<beta>, and any memory "
4557 "held by these processes on memory nodes 2-3 to memory nodes 8-9, "
4562 #: build/C/man7/cpuset.7:1458
4563 msgid "Notice that the last step of the above sequence did not do:"
4567 #: build/C/man7/cpuset.7:1462
4569 msgid "$B< cp ../alpha/tasks tasks>\n"
4573 #: build/C/man7/cpuset.7:1473
4575 "The I<while> loop, rather than the seemingly easier use of the B<cp>(1) "
4576 "command, was necessary because only one process PID at a time may be written "
4577 "to the I<tasks> file."
4581 #: build/C/man7/cpuset.7:1481
4583 "The same effect (writing one PID at a time) as the I<while> loop can be "
4584 "accomplished more efficiently, in fewer keystrokes and in syntax that works "
4585 "on any shell, but alas more obscurely, by using the B<-u> (unbuffered) "
4586 "option of B<sed>(1):"
4590 #: build/C/man7/cpuset.7:1485
4592 msgid "$B< sed -un p E<lt> ../alpha/tasks E<gt> tasks>\n"
4596 #: build/C/man7/cpuset.7:1503
4598 "B<taskset>(1), B<get_mempolicy>(2), B<getcpu>(2), B<mbind>(2), "
4599 "B<sched_getaffinity>(2), B<sched_setaffinity>(2), B<sched_setscheduler>(2), "
4600 "B<set_mempolicy>(2), B<CPU_SET>(3), B<proc>(5), B<numa>(7), B<sched>(7), "
4601 "B<migratepages>(8), B<numactl>(8)"
4605 #: build/C/man7/cpuset.7:1506
4606 msgid "I<Documentation/cpusets.txt> in the Linux kernel source tree"
4610 #: build/C/man7/credentials.7:27
4616 #: build/C/man7/credentials.7:27 build/C/man2/setsid.2:31
4622 #: build/C/man7/credentials.7:30
4623 msgid "credentials - process identifiers"
4627 #: build/C/man7/credentials.7:31
4629 msgid "Process ID (PID)"
4633 #: build/C/man7/credentials.7:41
4635 "Each process has a unique nonnegative integer identifier that is assigned "
4636 "when the process is created using B<fork>(2). A process can obtain its PID "
4637 "using B<getpid>(2). A PID is represented using the type I<pid_t> (defined "
4638 "in I<E<lt>sys/types.hE<gt>>)."
4641 #. .BR sched_rr_get_interval (2),
4642 #. .BR sched_getaffinity (2),
4643 #. .BR sched_setaffinity (2),
4644 #. .BR sched_getparam (2),
4645 #. .BR sched_setparam (2),
4646 #. .BR sched_setscheduler (2),
4647 #. .BR sched_getscheduler (2),
4652 #: build/C/man7/credentials.7:62
4654 "PIDs are used in a range of system calls to identify the process affected by "
4655 "the call, for example: B<kill>(2), B<ptrace>(2), B<setpriority>(2) "
4656 "B<setpgid>(2), B<setsid>(2), B<sigqueue>(3), and B<waitpid>(2)."
4660 #: build/C/man7/credentials.7:65
4661 msgid "A process's PID is preserved across an B<execve>(2)."
4665 #: build/C/man7/credentials.7:65
4667 msgid "Parent process ID (PPID)"
4671 #: build/C/man7/credentials.7:73
4673 "A process's parent process ID identifies the process that created this "
4674 "process using B<fork>(2). A process can obtain its PPID using "
4675 "B<getppid>(2). A PPID is represented using the type I<pid_t>."
4679 #: build/C/man7/credentials.7:76
4680 msgid "A process's PPID is preserved across an B<execve>(2)."
4684 #: build/C/man7/credentials.7:76
4686 msgid "Process group ID and session ID"
4690 #: build/C/man7/credentials.7:84
4692 "Each process has a session ID and a process group ID, both represented using "
4693 "the type I<pid_t>. A process can obtain its session ID using B<getsid>(2), "
4694 "and its process group ID using B<getpgrp>(2)."
4698 #: build/C/man7/credentials.7:90
4700 "A child created by B<fork>(2) inherits its parent's session ID and process "
4701 "group ID. A process's session ID and process group ID are preserved across "
4706 #: build/C/man7/credentials.7:103
4708 "Sessions and process groups are abstractions devised to support shell job "
4709 "control. A process group (sometimes called a \"job\") is a collection of "
4710 "processes that share the same process group ID; the shell creates a new "
4711 "process group for the process(es) used to execute single command or pipeline "
4712 "(e.g., the two processes created to execute the command \"ls\\ |\\ wc\" are "
4713 "placed in the same process group). A process's group membership can be set "
4714 "using B<setpgid>(2). The process whose process ID is the same as its "
4715 "process group ID is the I<process group leader> for that group."
4719 #: build/C/man7/credentials.7:115
4721 "A session is a collection of processes that share the same session ID. All "
4722 "of the members of a process group also have the same session ID (i.e., all "
4723 "of the members of a process group always belong to the same session, so that "
4724 "sessions and process groups form a strict two-level hierarchy of processes.) "
4725 "A new session is created when a process calls B<setsid>(2), which creates a "
4726 "new session whose session ID is the same as the PID of the process that "
4727 "called B<setsid>(2). The creator of the session is called the I<session "
4732 #: build/C/man7/credentials.7:124
4734 "All of the processes in a session share a I<controlling terminal>. The "
4735 "controlling terminal is established when the session leader first opens a "
4736 "terminal (unless the B<O_NOCTTY> flag is specified when calling "
4737 "B<open>(2)). A terminal may be the controlling terminal of at most one "
4742 #: build/C/man7/credentials.7:146
4744 "At most one of the jobs in a session may be the I<foreground job>; other "
4745 "jobs in the session are I<background jobs>. Only the foreground job may "
4746 "read from the terminal; when a process in the background attempts to read "
4747 "from the terminal, its process group is sent a B<SIGTTIN> signal, which "
4748 "suspends the job. If the B<TOSTOP> flag has been set for the terminal (see "
4749 "B<termios>(3)), then only the foreground job may write to the terminal; "
4750 "writes from background job cause a B<SIGTTOU> signal to be generated, which "
4751 "suspends the job. When terminal keys that generate a signal (such as the "
4752 "I<interrupt> key, normally control-C) are pressed, the signal is sent to "
4753 "the processes in the foreground job."
4757 #: build/C/man7/credentials.7:167
4759 "Various system calls and library functions may operate on all members of a "
4760 "process group, including B<kill>(2), B<killpg>(2), B<getpriority>(2), "
4761 "B<setpriority>(2), B<ioprio_get>(2), B<ioprio_set>(2), B<waitid>(2), and "
4762 "B<waitpid>(2). See also the discussion of the B<F_GETOWN>, B<F_GETOWN_EX>, "
4763 "B<F_SETOWN>, and B<F_SETOWN_EX> operations in B<fcntl>(2)."
4767 #: build/C/man7/credentials.7:167
4769 msgid "User and group identifiers"
4773 #: build/C/man7/credentials.7:175
4775 "Each process has various associated user and groups IDs. These IDs are "
4776 "integers, respectively represented using the types I<uid_t> and I<gid_t> "
4777 "(defined in I<E<lt>sys/types.hE<gt>>)."
4781 #: build/C/man7/credentials.7:177
4782 msgid "On Linux, each process has the following user and group identifiers:"
4786 #: build/C/man7/credentials.7:183
4788 "Real user ID and real group ID. These IDs determine who owns the process. "
4789 "A process can obtain its real user (group) ID using B<getuid>(2) "
4794 #: build/C/man7/credentials.7:195
4796 "Effective user ID and effective group ID. These IDs are used by the kernel "
4797 "to determine the permissions that the process will have when accessing "
4798 "shared resources such as message queues, shared memory, and semaphores. On "
4799 "most UNIX systems, these IDs also determine the permissions when accessing "
4800 "files. However, Linux uses the filesystem IDs described below for this "
4801 "task. A process can obtain its effective user (group) ID using "
4802 "B<geteuid>(2) (B<getegid>(2))."
4806 #: build/C/man7/credentials.7:217
4808 "Saved set-user-ID and saved set-group-ID. These IDs are used in set-user-ID "
4809 "and set-group-ID programs to save a copy of the corresponding effective IDs "
4810 "that were set when the program was executed (see B<execve>(2)). A "
4811 "set-user-ID program can assume and drop privileges by switching its "
4812 "effective user ID back and forth between the values in its real user ID and "
4813 "saved set-user-ID. This switching is done via calls to B<seteuid>(2), "
4814 "B<setreuid>(2), or B<setresuid>(2). A set-group-ID program performs the "
4815 "analogous tasks using B<setegid>(2), B<setregid>(2), or B<setresgid>(2). A "
4816 "process can obtain its saved set-user-ID (set-group-ID) using "
4817 "B<getresuid>(2) (B<getresgid>(2))."
4821 #: build/C/man7/credentials.7:234
4823 "Filesystem user ID and filesystem group ID (Linux-specific). These IDs, in "
4824 "conjunction with the supplementary group IDs described below, are used to "
4825 "determine permissions for accessing files; see B<path_resolution>(7) for "
4826 "details. Whenever a process's effective user (group) ID is changed, the "
4827 "kernel also automatically changes the filesystem user (group) ID to the same "
4828 "value. Consequently, the filesystem IDs normally have the same values as "
4829 "the corresponding effective ID, and the semantics for file-permission checks "
4830 "are thus the same on Linux as on other UNIX systems. The filesystem IDs can "
4831 "be made to differ from the effective IDs by calling B<setfsuid>(2) and "
4835 #. Since kernel 2.6.4, the limit is visible via the read-only file
4836 #. /proc/sys/kernel/ngroups_max.
4837 #. As at 2.6.22-rc2, this file is still read-only.
4839 #: build/C/man7/credentials.7:253
4841 "Supplementary group IDs. This is a set of additional group IDs that are "
4842 "used for permission checks when accessing files and other shared resources. "
4843 "On Linux kernels before 2.6.4, a process can be a member of up to 32 "
4844 "supplementary groups; since kernel 2.6.4, a process can be a member of up to "
4845 "65536 supplementary groups. The call I<sysconf(_SC_NGROUPS_MAX)> can be "
4846 "used to determine the number of supplementary groups of which a process may "
4847 "be a member. A process can obtain its set of supplementary group IDs using "
4848 "B<getgroups>(2), and can modify the set using B<setgroups>(2)."
4852 #: build/C/man7/credentials.7:263
4854 "A child process created by B<fork>(2) inherits copies of its parent's user "
4855 "and groups IDs. During an B<execve>(2), a process's real user and group ID "
4856 "and supplementary group IDs are preserved; the effective and saved set IDs "
4857 "may be changed, as described in B<execve>(2)."
4861 #: build/C/man7/credentials.7:266
4863 "Aside from the purposes noted above, a process's user IDs are also employed "
4864 "in a number of other contexts:"
4868 #: build/C/man7/credentials.7:269
4869 msgid "when determining the permissions for sending signals (see B<kill>(2));"
4873 #: build/C/man7/credentials.7:280
4875 "when determining the permissions for setting process-scheduling parameters "
4876 "(nice value, real time scheduling policy and priority, CPU affinity, I/O "
4877 "priority) using B<setpriority>(2), B<sched_setaffinity>(2), "
4878 "B<sched_setscheduler>(2), B<sched_setparam>(2), B<sched_setattr>(2), and "
4883 #: build/C/man7/credentials.7:283
4884 msgid "when checking resource limits (see B<getrlimit>(2));"
4888 #: build/C/man7/credentials.7:287
4890 "when checking the limit on the number of inotify instances that the process "
4891 "may create (see B<inotify>(7))."
4895 #: build/C/man7/credentials.7:293
4897 "Process IDs, parent process IDs, process group IDs, and session IDs are "
4898 "specified in POSIX.1-2001. The real, effective, and saved set user and "
4899 "groups IDs, and the supplementary group IDs, are specified in POSIX.1-2001. "
4900 "The filesystem user and group IDs are a Linux extension."
4904 #: build/C/man7/credentials.7:304
4906 "The POSIX threads specification requires that credentials are shared by all "
4907 "of the threads in a process. However, at the kernel level, Linux maintains "
4908 "separate user and group credentials for each thread. The NPTL threading "
4909 "implementation does some work to ensure that any change to user or group "
4910 "credentials (e.g., calls to B<setuid>(2), B<setresuid>(2)) is carried "
4911 "through to all of the POSIX threads in a process."
4915 #: build/C/man7/credentials.7:340
4917 "B<bash>(1), B<csh>(1), B<ps>(1), B<access>(2), B<execve>(2), "
4918 "B<faccessat>(2), B<fork>(2), B<getgroups>(2), B<getpgrp>(2), B<getpid>(2), "
4919 "B<getppid>(2), B<getsid>(2), B<kill>(2), B<killpg>(2), B<setegid>(2), "
4920 "B<seteuid>(2), B<setfsgid>(2), B<setfsuid>(2), B<setgid>(2), "
4921 "B<setgroups>(2), B<setresgid>(2), B<setresuid>(2), B<setuid>(2), "
4922 "B<waitpid>(2), B<euidaccess>(3), B<initgroups>(3), B<tcgetpgrp>(3), "
4923 "B<tcsetpgrp>(3), B<capabilities>(7), B<namespaces>(7), "
4924 "B<path_resolution>(7), B<pid_namespaces>(7), B<signal>(7), "
4925 "B<user_namespaces>(7), B<unix>(7)"
4929 #: build/C/man2/getgid.2:25
4935 #: build/C/man2/getgid.2:25 build/C/man2/getresuid.2:28 build/C/man2/getuid.2:26
4941 #: build/C/man2/getgid.2:28
4942 msgid "getgid, getegid - get group identity"
4946 #: build/C/man2/getgid.2:30 build/C/man2/getgroups.2:38 build/C/man2/getpid.2:32 build/C/man2/getresuid.2:35 build/C/man2/getsid.2:31 build/C/man2/getuid.2:31 build/C/man3/group_member.3:30 build/C/man2/seteuid.2:36 build/C/man2/setgid.2:36 build/C/man2/setpgid.2:53 build/C/man2/setresuid.2:33 build/C/man2/setreuid.2:52 build/C/man2/setsid.2:37 build/C/man2/setuid.2:37
4947 msgid "B<#include E<lt>unistd.hE<gt>>"
4951 #: build/C/man2/getgid.2:32 build/C/man2/getgroups.2:36 build/C/man2/getpid.2:30 build/C/man2/getuid.2:33 build/C/man2/seteuid.2:34 build/C/man2/setgid.2:34 build/C/man2/setreuid.2:50 build/C/man2/setuid.2:35
4952 msgid "B<#include E<lt>sys/types.hE<gt>>"
4956 #: build/C/man2/getgid.2:34
4957 msgid "B<gid_t getgid(void);>"
4961 #: build/C/man2/getgid.2:36
4962 msgid "B<gid_t getegid(void);>"
4966 #: build/C/man2/getgid.2:39
4967 msgid "B<getgid>() returns the real group ID of the calling process."
4971 #: build/C/man2/getgid.2:42
4972 msgid "B<getegid>() returns the effective group ID of the calling process."
4976 #: build/C/man2/getgid.2:44 build/C/man2/getpid.2:46 build/C/man2/getuid.2:45
4977 msgid "These functions are always successful."
4981 #: build/C/man2/getgid.2:46 build/C/man2/getuid.2:47
4982 msgid "POSIX.1-2001, 4.3BSD."
4986 #: build/C/man2/getgid.2:62
4988 "The original Linux B<getgid>() and B<getegid>() system calls supported "
4989 "only 16-bit group IDs. Subsequently, Linux 2.4 added B<getgid32>() and "
4990 "B<getegid32>(), supporting 32-bit IDs. The glibc B<getgid>() and "
4991 "B<getegid>() wrapper functions transparently deal with the variations "
4992 "across kernel versions."
4996 #: build/C/man2/getgid.2:67
4997 msgid "B<getresgid>(2), B<setgid>(2), B<setregid>(2), B<credentials>(7)"
5001 #: build/C/man2/getgroups.2:31
5007 #: build/C/man2/getgroups.2:31 build/C/man2/getpriority.2:45
5013 #: build/C/man2/getgroups.2:34
5014 msgid "getgroups, setgroups - get/set list of supplementary group IDs"
5018 #: build/C/man2/getgroups.2:40
5019 msgid "B<int getgroups(int >I<size>B<, gid_t >I<list>B<[]);>"
5023 #: build/C/man2/getgroups.2:42
5024 msgid "B<#include E<lt>grp.hE<gt>>"
5028 #: build/C/man2/getgroups.2:44
5029 msgid "B<int setgroups(size_t >I<size>B<, const gid_t *>I<list>B<);>"
5033 #: build/C/man2/getgroups.2:52
5034 msgid "B<setgroups>(): _BSD_SOURCE"
5038 #: build/C/man2/getgroups.2:70
5040 "B<getgroups>() returns the supplementary group IDs of the calling process "
5041 "in I<list>. The argument I<size> should be set to the maximum number of "
5042 "items that can be stored in the buffer pointed to by I<list>. If the "
5043 "calling process is a member of more than I<size> supplementary groups, then "
5044 "an error results. It is unspecified whether the effective group ID of the "
5045 "calling process is included in the returned list. (Thus, an application "
5046 "should also call B<getegid>(2) and add or remove the resulting value.)"
5050 #: build/C/man2/getgroups.2:81
5052 "If I<size> is zero, I<list> is not modified, but the total number of "
5053 "supplementary group IDs for the process is returned. This allows the caller "
5054 "to determine the size of a dynamically allocated I<list> to be used in a "
5055 "further call to B<getgroups>()."
5059 #: build/C/man2/getgroups.2:92
5061 "B<setgroups>() sets the supplementary group IDs for the calling process. "
5062 "Appropriate privileges (Linux: the B<CAP_SETGID> capability) are required. "
5063 "The I<size> argument specifies the number of supplementary group IDs in the "
5064 "buffer pointed to by I<list>."
5068 #: build/C/man2/getgroups.2:99
5070 "On success, B<getgroups>() returns the number of supplementary group IDs. "
5071 "On error, -1 is returned, and I<errno> is set appropriately."
5075 #: build/C/man2/getgroups.2:106
5077 "On success, B<setgroups>() returns 0. On error, -1 is returned, and "
5078 "I<errno> is set appropriately."
5082 #: build/C/man2/getgroups.2:111
5083 msgid "I<list> has an invalid address."
5087 #: build/C/man2/getgroups.2:114
5088 msgid "B<getgroups>() can additionally fail with the following error:"
5092 #: build/C/man2/getgroups.2:118
5093 msgid "I<size> is less than the number of supplementary group IDs, but is not zero."
5097 #: build/C/man2/getgroups.2:121
5098 msgid "B<setgroups>() can additionally fail with the following errors:"
5102 #: build/C/man2/getgroups.2:127
5104 "I<size> is greater than B<NGROUPS_MAX> (32 before Linux 2.6.4; 65536 since "
5109 #: build/C/man2/getgroups.2:133
5110 msgid "The calling process has insufficient privilege."
5114 #: build/C/man2/getgroups.2:141
5116 "SVr4, 4.3BSD. The B<getgroups>() function is in POSIX.1-2001. Since "
5117 "B<setgroups>() requires privilege, it is not covered by POSIX.1-2001."
5121 #: build/C/man2/getgroups.2:153
5123 "A process can have up to B<NGROUPS_MAX> supplementary group IDs in addition "
5124 "to the effective group ID. The constant B<NGROUPS_MAX> is defined in "
5125 "I<E<lt>limits.hE<gt>>. The set of supplementary group IDs is inherited from "
5126 "the parent process, and preserved across an B<execve>(2)."
5130 #: build/C/man2/getgroups.2:156
5132 "The maximum number of supplementary group IDs can be found at run time using "
5137 #: build/C/man2/getgroups.2:160
5140 " long ngroups_max;\n"
5141 " ngroups_max = sysconf(_SC_NGROUPS_MAX);\n"
5145 #: build/C/man2/getgroups.2:168
5147 "The maximum return value of B<getgroups>() cannot be larger than one more "
5148 "than this value. Since Linux 2.6.4, the maximum number of supplementary "
5149 "group IDs is also exposed via the Linux-specific read-only file, "
5150 "I</proc/sys/kernel/ngroups_max>."
5154 #: build/C/man2/getgroups.2:178
5156 "The original Linux B<getgroups>() system call supported only 16-bit group "
5157 "IDs. Subsequently, Linux 2.4 added B<getgroups32>(), supporting 32-bit "
5158 "IDs. The glibc B<getgroups>() wrapper function transparently deals with "
5159 "the variation across kernel versions."
5163 #: build/C/man2/getgroups.2:186
5165 "B<getgid>(2), B<setgid>(2), B<getgrouplist>(3), B<group_member>(3), "
5166 "B<initgroups>(3), B<capabilities>(7), B<credentials>(7)"
5170 #: build/C/man2/getpid.2:25
5176 #: build/C/man2/getpid.2:25 build/C/man7/namespaces.7:27 build/C/man2/seteuid.2:29 build/C/man2/setgid.2:29 build/C/man2/setresuid.2:26 build/C/man2/setreuid.2:45 build/C/man2/setuid.2:30 build/C/man7/svipc.7:40 build/C/man7/user_namespaces.7:27
5182 #: build/C/man2/getpid.2:28
5183 msgid "getpid, getppid - get process identification"
5187 #: build/C/man2/getpid.2:34
5188 msgid "B<pid_t getpid(void);>"
5192 #: build/C/man2/getpid.2:36
5193 msgid "B<pid_t getppid(void);>"
5197 #: build/C/man2/getpid.2:41
5199 "B<getpid>() returns the process ID of the calling process. (This is often "
5200 "used by routines that generate unique temporary filenames.)"
5204 #: build/C/man2/getpid.2:44
5205 msgid "B<getppid>() returns the process ID of the parent of the calling process."
5209 #: build/C/man2/getpid.2:48
5210 msgid "POSIX.1-2001, 4.3BSD, SVr4."
5213 #. The following program demonstrates this "feature":
5215 #. #define _GNU_SOURCE
5216 #. #include <sys/syscall.h>
5217 #. #include <sys/wait.h>
5218 #. #include <stdio.h>
5219 #. #include <stdlib.h>
5220 #. #include <unistd.h>
5223 #. main(int argc, char *argv[])
5225 #. /* The following statement fills the getpid() cache */
5227 #. printf("parent PID = %ld
5228 #. ", (long) getpid());
5230 #. if (syscall(SYS_fork) == 0) {
5231 #. if (getpid() != syscall(SYS_getpid))
5232 #. printf("child getpid() mismatch: getpid()=%ld; "
5233 #. "syscall(SYS_getpid)=%ld
5235 #. (long) getpid(), (long) syscall(SYS_getpid));
5236 #. exit(EXIT_SUCCESS);
5241 #: build/C/man2/getpid.2:100
5243 "Since glibc version 2.3.4, the glibc wrapper function for B<getpid>() "
5244 "caches PIDs, so as to avoid additional system calls when a process calls "
5245 "B<getpid>() repeatedly. Normally this caching is invisible, but its "
5246 "correct operation relies on support in the wrapper functions for B<fork>(2), "
5247 "B<vfork>(2), and B<clone>(2): if an application bypasses the glibc wrappers "
5248 "for these system calls by using B<syscall>(2), then a call to B<getpid>() "
5249 "in the child will return the wrong value (to be precise: it will return the "
5250 "PID of the parent process). See also B<clone>(2) for discussion of a case "
5251 "where B<getpid>() may return the wrong value even when invoking B<clone>(2) "
5252 "via the glibc wrapper function."
5256 #: build/C/man2/getpid.2:111
5258 "B<clone>(2), B<fork>(2), B<kill>(2), B<exec>(3), B<mkstemp>(3), "
5259 "B<tempnam>(3), B<tmpfile>(3), B<tmpnam>(3), B<credentials>(7), "
5260 "B<pid_namespaces>(7)"
5264 #: build/C/man2/getpriority.2:45
5270 #: build/C/man2/getpriority.2:48
5271 msgid "getpriority, setpriority - get/set program scheduling priority"
5275 #: build/C/man2/getpriority.2:50 build/C/man2/getrlimit.2:69 build/C/man2/getrusage.2:44
5276 msgid "B<#include E<lt>sys/time.hE<gt>>"
5280 #: build/C/man2/getpriority.2:52 build/C/man2/getrlimit.2:71 build/C/man2/getrusage.2:46
5281 msgid "B<#include E<lt>sys/resource.hE<gt>>"
5285 #: build/C/man2/getpriority.2:54
5286 msgid "B<int getpriority(int >I<which>B<, id_t >I<who>B<);>"
5290 #: build/C/man2/getpriority.2:56
5291 msgid "B<int setpriority(int >I<which>B<, id_t >I<who>B<, int >I<prio>B<);>"
5295 #: build/C/man2/getpriority.2:67
5297 "The scheduling priority of the process, process group, or user, as indicated "
5298 "by I<which> and I<who> is obtained with the B<getpriority>() call and set "
5299 "with the B<setpriority>() call."
5303 #: build/C/man2/getpriority.2:94
5305 "The value I<which> is one of B<PRIO_PROCESS>, B<PRIO_PGRP>, or B<PRIO_USER>, "
5306 "and I<who> is interpreted relative to I<which> (a process identifier for "
5307 "B<PRIO_PROCESS>, process group identifier for B<PRIO_PGRP>, and a user ID "
5308 "for B<PRIO_USER>). A zero value for I<who> denotes (respectively) the "
5309 "calling process, the process group of the calling process, or the real user "
5310 "ID of the calling process. I<Prio> is a value in the range -20 to 19 (but "
5311 "see the Notes below). The default priority is 0; lower priorities cause "
5312 "more favorable scheduling."
5316 #: build/C/man2/getpriority.2:104
5318 "The B<getpriority>() call returns the highest priority (lowest numerical "
5319 "value) enjoyed by any of the specified processes. The B<setpriority>() "
5320 "call sets the priorities of all of the specified processes to the specified "
5321 "value. Only the superuser may lower priorities."
5325 #: build/C/man2/getpriority.2:117
5327 "Since B<getpriority>() can legitimately return the value -1, it is "
5328 "necessary to clear the external variable I<errno> prior to the call, then "
5329 "check it afterward to determine if -1 is an error or a legitimate value. "
5330 "The B<setpriority>() call returns 0 if there is no error, or -1 if there "
5335 #: build/C/man2/getpriority.2:126
5336 msgid "I<which> was not one of B<PRIO_PROCESS>, B<PRIO_PGRP>, or B<PRIO_USER>."
5340 #: build/C/man2/getpriority.2:133
5341 msgid "No process was located using the I<which> and I<who> values specified."
5345 #: build/C/man2/getpriority.2:137
5346 msgid "In addition to the errors indicated above, B<setpriority>() may fail if:"
5350 #: build/C/man2/getpriority.2:149
5352 "The caller attempted to lower a process priority, but did not have the "
5353 "required privilege (on Linux: did not have the B<CAP_SYS_NICE> capability). "
5354 "Since Linux 2.6.12, this error occurs only if the caller attempts to set a "
5355 "process priority outside the range of the B<RLIMIT_NICE> soft resource limit "
5356 "of the target process; see B<getrlimit>(2) for details."
5360 #: build/C/man2/getpriority.2:157
5362 "A process was located, but its effective user ID did not match either the "
5363 "effective or the real user ID of the caller, and was not privileged (on "
5364 "Linux: did not have the B<CAP_SYS_NICE> capability). But see NOTES below."
5368 #: build/C/man2/getpriority.2:160
5369 msgid "SVr4, 4.4BSD (these function calls first appeared in 4.2BSD), POSIX.1-2001."
5373 #: build/C/man2/getpriority.2:166
5375 "A child created by B<fork>(2) inherits its parent's nice value. The nice "
5376 "value is preserved across B<execve>(2)."
5380 #: build/C/man2/getpriority.2:177
5382 "The degree to which their relative nice value affects the scheduling of "
5383 "processes varies across UNIX systems, and, on Linux, across kernel "
5384 "versions. Starting with kernel 2.6.23, Linux adopted an algorithm that "
5385 "causes relative differences in nice values to have a much stronger effect. "
5386 "This causes very low nice values (+19) to truly provide little CPU to a "
5387 "process whenever there is any other higher priority load on the system, and "
5388 "makes high nice values (-20) deliver most of the CPU to applications that "
5389 "require it (e.g., some audio applications)."
5393 #: build/C/man2/getpriority.2:192
5395 "The details on the condition for B<EPERM> depend on the system. The above "
5396 "description is what POSIX.1-2001 says, and seems to be followed on all "
5397 "System\\ V-like systems. Linux kernels before 2.6.12 required the real or "
5398 "effective user ID of the caller to match the real user of the process I<who> "
5399 "(instead of its effective user ID). Linux 2.6.12 and later require the "
5400 "effective user ID of the caller to match the real or effective user ID of "
5401 "the process I<who>. All BSD-like systems (SunOS 4.1.3, Ultrix 4.2, 4.3BSD, "
5402 "FreeBSD 4.3, OpenBSD-2.5, ...) behave in the same manner as Linux 2.6.12 and "
5407 #: build/C/man2/getpriority.2:197
5409 "The actual priority range varies between kernel versions. Linux before "
5410 "1.3.36 had -infinity..15. Since kernel 1.3.43, Linux has the range "
5411 "-20..19. On some other systems, the range of nice values is -20..20."
5415 #: build/C/man2/getpriority.2:210
5417 "Including I<E<lt>sys/time.hE<gt>> is not required these days, but increases "
5418 "portability. (Indeed, I<E<lt>sys/resource.hE<gt>> defines the I<rusage> "
5419 "structure with fields of type I<struct timeval> defined in "
5420 "I<E<lt>sys/time.hE<gt>>.)"
5424 #: build/C/man2/getpriority.2:210 build/C/man2/seteuid.2:132
5426 msgid "C library/kernel ABI differences"
5430 #: build/C/man2/getpriority.2:225
5432 "Within the kernel, nice values are actually represented using the range "
5433 "40..1 (since negative numbers are error codes) and these are the values "
5434 "employed by the B<setpriority>() and B<getpriority>() system calls. The "
5435 "glibc wrapper functions for these system calls handle the translations "
5436 "between the user-land and kernel representations of the nice value according "
5437 "to the formula I<unice\\ =\\ 20\\ -\\ knice>. (Thus, the kernels 40..1 "
5438 "range corresponds to the range -20..19 as seen by user space.)"
5442 #: build/C/man2/getpriority.2:232
5444 "According to POSIX, the nice value is a per-process setting. However, under "
5445 "the current Linux/NPTL implementation of POSIX threads, the nice value is a "
5446 "per-thread attribute: different threads in the same process can have "
5447 "different nice values. Portable applications should avoid relying on the "
5448 "Linux behavior, which may be made standards conformant in the future."
5452 #: build/C/man2/getpriority.2:238
5453 msgid "B<nice>(1), B<renice>(1), B<fork>(2), B<capabilities>(7), B<sched>(7)"
5457 #: build/C/man2/getpriority.2:241
5459 "I<Documentation/scheduler/sched-nice-design.txt> in the Linux kernel source "
5460 "tree (since Linux 2.6.23)"
5464 #: build/C/man2/getresuid.2:28
5470 #: build/C/man2/getresuid.2:31
5471 msgid "getresuid, getresgid - get real, effective and saved user/group IDs"
5475 #: build/C/man2/getresuid.2:33 build/C/man2/setresuid.2:31
5476 msgid "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */"
5480 #: build/C/man2/getresuid.2:37
5481 msgid "B<int getresuid(uid_t *>I<ruid>B<, uid_t *>I<euid>B<, uid_t *>I<suid>B<);>"
5485 #: build/C/man2/getresuid.2:39
5486 msgid "B<int getresgid(gid_t *>I<rgid>B<, gid_t *>I<egid>B<, gid_t *>I<sgid>B<);>"
5490 #: build/C/man2/getresuid.2:50
5492 "B<getresuid>() returns the real UID, the effective UID, and the saved "
5493 "set-user-ID of the calling process, in the arguments I<ruid>, I<euid>, and "
5494 "I<suid>, respectively. B<getresgid>() performs the analogous task for the "
5495 "process's group IDs."
5499 #: build/C/man2/getresuid.2:60
5501 "One of the arguments specified an address outside the calling program's "
5506 #: build/C/man2/getresuid.2:62
5507 msgid "These system calls appeared on Linux starting with kernel 2.1.44."
5511 #: build/C/man2/getresuid.2:67
5513 "The prototypes are given by glibc since version 2.3.2, provided "
5514 "B<_GNU_SOURCE> is defined."
5518 #: build/C/man2/getresuid.2:70 build/C/man2/setresuid.2:112
5519 msgid "These calls are nonstandard; they also appear on HP-UX and some of the BSDs."
5523 #: build/C/man2/getresuid.2:86
5525 "The original Linux B<getresuid>() and B<getresgid>() system calls "
5526 "supported only 16-bit user and group IDs. Subsequently, Linux 2.4 added "
5527 "B<getresuid32>() and B<getresgid32>(), supporting 32-bit IDs. The glibc "
5528 "B<getresuid>() and B<getresgid>() wrapper functions transparently deal "
5529 "with the variations across kernel versions."
5533 #: build/C/man2/getresuid.2:92
5535 "B<getuid>(2), B<setresuid>(2), B<setreuid>(2), B<setuid>(2), "
5540 #: build/C/man2/getrlimit.2:64
5546 #: build/C/man2/getrlimit.2:64
5552 #: build/C/man2/getrlimit.2:67
5553 msgid "getrlimit, setrlimit, prlimit - get/set resource limits"
5557 #: build/C/man2/getrlimit.2:73
5558 msgid "B<int getrlimit(int >I<resource>B<, struct rlimit *>I<rlim>B<);>"
5562 #: build/C/man2/getrlimit.2:75
5563 msgid "B<int setrlimit(int >I<resource>B<, const struct rlimit *>I<rlim>B<);>"
5567 #: build/C/man2/getrlimit.2:78
5569 "B<int prlimit(pid_t >I<pid>B<, int >I<resource>B<, const struct rlimit "
5570 "*>I<new_limit>B<,>"
5574 #: build/C/man2/getrlimit.2:80
5575 msgid "B< struct rlimit *>I<old_limit>B<);>"
5579 #: build/C/man2/getrlimit.2:88
5580 msgid "B<prlimit>(): _GNU_SOURCE && _FILE_OFFSET_BITS == 64"
5584 #: build/C/man2/getrlimit.2:97
5586 "The B<getrlimit>() and B<setrlimit>() system calls get and set resource "
5587 "limits respectively. Each resource has an associated soft and hard limit, "
5588 "as defined by the I<rlimit> structure:"
5592 #: build/C/man2/getrlimit.2:104
5596 " rlim_t rlim_cur; /* Soft limit */\n"
5597 " rlim_t rlim_max; /* Hard limit (ceiling for rlim_cur) */\n"
5602 #: build/C/man2/getrlimit.2:115
5604 "The soft limit is the value that the kernel enforces for the corresponding "
5605 "resource. The hard limit acts as a ceiling for the soft limit: an "
5606 "unprivileged process may set only its soft limit to a value in the range "
5607 "from 0 up to the hard limit, and (irreversibly) lower its hard limit. A "
5608 "privileged process (under Linux: one with the B<CAP_SYS_RESOURCE> "
5609 "capability) may make arbitrary changes to either limit value."
5613 #: build/C/man2/getrlimit.2:122
5615 "The value B<RLIM_INFINITY> denotes no limit on a resource (both in the "
5616 "structure returned by B<getrlimit>() and in the structure passed to "
5621 #: build/C/man2/getrlimit.2:126
5622 msgid "The I<resource> argument must be one of:"
5626 #: build/C/man2/getrlimit.2:126
5628 msgid "B<RLIMIT_AS>"
5631 #. since 2.0.27 / 2.1.12
5633 #: build/C/man2/getrlimit.2:146
5635 "The maximum size of the process's virtual memory (address space) in bytes. "
5636 "This limit affects calls to B<brk>(2), B<mmap>(2), and B<mremap>(2), which "
5637 "fail with the error B<ENOMEM> upon exceeding this limit. Also automatic "
5638 "stack expansion will fail (and generate a B<SIGSEGV> that kills the process "
5639 "if no alternate stack has been made available via B<sigaltstack>(2)). Since "
5640 "the value is a I<long>, on machines with a 32-bit I<long> either this limit "
5641 "is at most 2 GiB, or this resource is unlimited."
5645 #: build/C/man2/getrlimit.2:146
5647 msgid "B<RLIMIT_CORE>"
5651 #: build/C/man2/getrlimit.2:154
5653 "Maximum size of a I<core> file (see B<core>(5)). When 0 no core dump files "
5654 "are created. When nonzero, larger dumps are truncated to this size."
5658 #: build/C/man2/getrlimit.2:154
5660 msgid "B<RLIMIT_CPU>"
5664 #: build/C/man2/getrlimit.2:174
5666 "CPU time limit in seconds. When the process reaches the soft limit, it is "
5667 "sent a B<SIGXCPU> signal. The default action for this signal is to "
5668 "terminate the process. However, the signal can be caught, and the handler "
5669 "can return control to the main program. If the process continues to consume "
5670 "CPU time, it will be sent B<SIGXCPU> once per second until the hard limit is "
5671 "reached, at which time it is sent B<SIGKILL>. (This latter point describes "
5672 "Linux behavior. Implementations vary in how they treat processes which "
5673 "continue to consume CPU time after reaching the soft limit. Portable "
5674 "applications that need to catch this signal should perform an orderly "
5675 "termination upon first receipt of B<SIGXCPU>.)"
5679 #: build/C/man2/getrlimit.2:174
5681 msgid "B<RLIMIT_DATA>"
5685 #: build/C/man2/getrlimit.2:185
5687 "The maximum size of the process's data segment (initialized data, "
5688 "uninitialized data, and heap). This limit affects calls to B<brk>(2) and "
5689 "B<sbrk>(2), which fail with the error B<ENOMEM> upon encountering the soft "
5690 "limit of this resource."
5694 #: build/C/man2/getrlimit.2:185
5696 msgid "B<RLIMIT_FSIZE>"
5700 #: build/C/man2/getrlimit.2:197
5702 "The maximum size of files that the process may create. Attempts to extend a "
5703 "file beyond this limit result in delivery of a B<SIGXFSZ> signal. By "
5704 "default, this signal terminates a process, but a process can catch this "
5705 "signal instead, in which case the relevant system call (e.g., B<write>(2), "
5706 "B<truncate>(2)) fails with the error B<EFBIG>."
5710 #: build/C/man2/getrlimit.2:197
5712 msgid "B<RLIMIT_LOCKS> (Early Linux 2.4 only)"
5715 #. to be precise: Linux 2.4.0-test9; no longer in 2.4.25 / 2.5.65
5717 #: build/C/man2/getrlimit.2:205
5719 "A limit on the combined number of B<flock>(2) locks and B<fcntl>(2) leases "
5720 "that this process may establish."
5724 #: build/C/man2/getrlimit.2:205
5726 msgid "B<RLIMIT_MEMLOCK>"
5730 #: build/C/man2/getrlimit.2:243
5732 "The maximum number of bytes of memory that may be locked into RAM. In "
5733 "effect this limit is rounded down to the nearest multiple of the system page "
5734 "size. This limit affects B<mlock>(2) and B<mlockall>(2) and the "
5735 "B<mmap>(2) B<MAP_LOCKED> operation. Since Linux 2.6.9 it also affects the "
5736 "B<shmctl>(2) B<SHM_LOCK> operation, where it sets a maximum on the total "
5737 "bytes in shared memory segments (see B<shmget>(2)) that may be locked by "
5738 "the real user ID of the calling process. The B<shmctl>(2) B<SHM_LOCK> "
5739 "locks are accounted for separately from the per-process memory locks "
5740 "established by B<mlock>(2), B<mlockall>(2), and B<mmap>(2) B<MAP_LOCKED>; a "
5741 "process can lock bytes up to this limit in each of these two categories. In "
5742 "Linux kernels before 2.6.9, this limit controlled the amount of memory that "
5743 "could be locked by a privileged process. Since Linux 2.6.9, no limits are "
5744 "placed on the amount of memory that a privileged process may lock, and this "
5745 "limit instead governs the amount of memory that an unprivileged process may "
5750 #: build/C/man2/getrlimit.2:243
5752 msgid "B<RLIMIT_MSGQUEUE> (since Linux 2.6.8)"
5756 #: build/C/man2/getrlimit.2:251
5758 "Specifies the limit on the number of bytes that can be allocated for POSIX "
5759 "message queues for the real user ID of the calling process. This limit is "
5760 "enforced for B<mq_open>(3). Each message queue that the user creates counts "
5761 "(until it is removed) against this limit according to the formula:"
5765 #: build/C/man2/getrlimit.2:260
5768 " Since Linux 3.5:\n"
5769 " bytes = attr.mq_maxmsg * sizeof(struct msg_msg) +\n"
5770 " min(attr.mq_maxmsg, MQ_PRIO_MAX) *\n"
5771 " sizeof(struct posix_msg_tree_node)+\n"
5772 " /* For overhead */\n"
5773 " attr.mq_maxmsg * attr.mq_msgsize;\n"
5774 " /* For message data */\n"
5778 #: build/C/man2/getrlimit.2:266
5781 " Linux 3.4 and earlier:\n"
5782 " bytes = attr.mq_maxmsg * sizeof(struct msg_msg *) +\n"
5783 " /* For overhead */\n"
5784 " attr.mq_maxmsg * attr.mq_msgsize;\n"
5785 " /* For message data */\n"
5789 #: build/C/man2/getrlimit.2:279
5791 "where I<attr> is the I<mq_attr> structure specified as the fourth argument "
5792 "to B<mq_open>(3), and the I<msg_msg> and I<posix_msg_tree_node> structures "
5793 "are kernel-internal structures."
5797 #: build/C/man2/getrlimit.2:285
5799 "The \"overhead\" addend in the formula accounts for overhead bytes required "
5800 "by the implementation and ensures that the user cannot create an unlimited "
5801 "number of zero-length messages (such messages nevertheless each consume some "
5802 "system memory for bookkeeping overhead)."
5806 #: build/C/man2/getrlimit.2:285
5808 msgid "B<RLIMIT_NICE> (since Linux 2.6.12, but see BUGS below)"
5812 #: build/C/man2/getrlimit.2:298
5814 "Specifies a ceiling to which the process's nice value can be raised using "
5815 "B<setpriority>(2) or B<nice>(2). The actual ceiling for the nice value is "
5816 "calculated as I<20\\ -\\ rlim_cur>. (This strangeness occurs because "
5817 "negative numbers cannot be specified as resource limit values, since they "
5818 "typically have special meanings. For example, B<RLIM_INFINITY> typically is "
5823 #: build/C/man2/getrlimit.2:298
5825 msgid "B<RLIMIT_NOFILE>"
5829 #: build/C/man2/getrlimit.2:312
5831 "Specifies a value one greater than the maximum file descriptor number that "
5832 "can be opened by this process. Attempts (B<open>(2), B<pipe>(2), B<dup>(2), "
5833 "etc.) to exceed this limit yield the error B<EMFILE>. (Historically, this "
5834 "limit was named B<RLIMIT_OFILE> on BSD.)"
5838 #: build/C/man2/getrlimit.2:312
5840 msgid "B<RLIMIT_NPROC>"
5844 #: build/C/man2/getrlimit.2:325
5846 "The maximum number of processes (or, more precisely on Linux, threads) that "
5847 "can be created for the real user ID of the calling process. Upon "
5848 "encountering this limit, B<fork>(2) fails with the error B<EAGAIN>. This "
5849 "limit is not enforced for processes that have either the B<CAP_SYS_ADMIN> or "
5850 "the B<CAP_SYS_RESOURCE> capability."
5854 #: build/C/man2/getrlimit.2:325
5856 msgid "B<RLIMIT_RSS>"
5859 #. As at kernel 2.6.12, this limit still does nothing in 2.6 though
5860 #. talk of making it do something has surfaced from time to time in LKML
5863 #: build/C/man2/getrlimit.2:337
5865 "Specifies the limit (in pages) of the process's resident set (the number of "
5866 "virtual pages resident in RAM). This limit has effect only in Linux 2.4.x, "
5867 "x E<lt> 30, and there affects only calls to B<madvise>(2) specifying "
5872 #: build/C/man2/getrlimit.2:337
5874 msgid "B<RLIMIT_RTPRIO> (since Linux 2.6.12, but see BUGS)"
5878 #: build/C/man2/getrlimit.2:344
5880 "Specifies a ceiling on the real-time priority that may be set for this "
5881 "process using B<sched_setscheduler>(2) and B<sched_setparam>(2)."
5885 #: build/C/man2/getrlimit.2:344
5887 msgid "B<RLIMIT_RTTIME> (since Linux 2.6.25)"
5891 #: build/C/man2/getrlimit.2:356
5893 "Specifies a limit (in microseconds) on the amount of CPU time that a "
5894 "process scheduled under a real-time scheduling policy may consume without "
5895 "making a blocking system call. For the purpose of this limit, each time a "
5896 "process makes a blocking system call, the count of its consumed CPU time is "
5897 "reset to zero. The CPU time count is not reset if the process continues "
5898 "trying to use the CPU but is preempted, its time slice expires, or it calls "
5899 "B<sched_yield>(2)."
5903 #: build/C/man2/getrlimit.2:367
5905 "Upon reaching the soft limit, the process is sent a B<SIGXCPU> signal. If "
5906 "the process catches or ignores this signal and continues consuming CPU time, "
5907 "then B<SIGXCPU> will be generated once each second until the hard limit is "
5908 "reached, at which point the process is sent a B<SIGKILL> signal."
5912 #: build/C/man2/getrlimit.2:370
5914 "The intended use of this limit is to stop a runaway real-time process from "
5915 "locking up the system."
5919 #: build/C/man2/getrlimit.2:370
5921 msgid "B<RLIMIT_SIGPENDING> (since Linux 2.6.8)"
5924 #. This replaces the /proc/sys/kernel/rtsig-max system-wide limit
5925 #. that was present in kernels <= 2.6.7. MTK Dec 04
5927 #: build/C/man2/getrlimit.2:384
5929 "Specifies the limit on the number of signals that may be queued for the real "
5930 "user ID of the calling process. Both standard and real-time signals are "
5931 "counted for the purpose of checking this limit. However, the limit is "
5932 "enforced only for B<sigqueue>(3); it is always possible to use B<kill>(2) "
5933 "to queue one instance of any of the signals that are not already queued to "
5938 #: build/C/man2/getrlimit.2:384
5940 msgid "B<RLIMIT_STACK>"
5944 #: build/C/man2/getrlimit.2:392
5946 "The maximum size of the process stack, in bytes. Upon reaching this limit, "
5947 "a B<SIGSEGV> signal is generated. To handle this signal, a process must "
5948 "employ an alternate signal stack (B<sigaltstack>(2))."
5952 #: build/C/man2/getrlimit.2:397
5954 "Since Linux 2.6.23, this limit also determines the amount of space used for "
5955 "the process's command-line arguments and environment variables; for details, "
5960 #: build/C/man2/getrlimit.2:397
5965 #. commit c022a0acad534fd5f5d5f17280f6d4d135e74e81
5966 #. Author: Jiri Slaby <jslaby@suse.cz>
5967 #. Date: Tue May 4 18:03:50 2010 +0200
5969 #. rlimits: implement prlimit64 syscall
5971 #. commit 6a1d5e2c85d06da35cdfd93f1a27675bfdc3ad8c
5972 #. Author: Jiri Slaby <jslaby@suse.cz>
5973 #. Date: Wed Mar 24 17:06:58 2010 +0100
5975 #. rlimits: add rlimit64 structure
5977 #: build/C/man2/getrlimit.2:417
5979 "The Linux-specific B<prlimit>() system call combines and extends the "
5980 "functionality of B<setrlimit>() and B<getrlimit>(). It can be used to both "
5981 "set and get the resource limits of an arbitrary process."
5985 #: build/C/man2/getrlimit.2:424
5987 "The I<resource> argument has the same meaning as for B<setrlimit>() and "
5992 #: build/C/man2/getrlimit.2:442
5994 "If the I<new_limit> argument is a not NULL, then the I<rlimit> structure to "
5995 "which it points is used to set new values for the soft and hard limits for "
5996 "I<resource>. If the I<old_limit> argument is a not NULL, then a successful "
5997 "call to B<prlimit>() places the previous soft and hard limits for "
5998 "I<resource> in the I<rlimit> structure pointed to by I<old_limit>."
6001 #. FIXME . this permission check is strange
6002 #. Asked about this on LKML, 7 Nov 2010
6003 #. "Inconsistent credential checking in prlimit() syscall"
6005 #: build/C/man2/getrlimit.2:461
6007 "The I<pid> argument specifies the ID of the process on which the call is to "
6008 "operate. If I<pid> is 0, then the call applies to the calling process. To "
6009 "set or get the resources of a process other than itself, the caller must "
6010 "have the B<CAP_SYS_RESOURCE> capability, or the real, effective, and saved "
6011 "set user IDs of the target process must match the real user ID of the caller "
6012 "I<and> the real, effective, and saved set group IDs of the target process "
6013 "must match the real group ID of the caller."
6017 #: build/C/man2/getrlimit.2:466
6019 "On success, these system calls return 0. On error, -1 is returned, and "
6020 "I<errno> is set appropriately."
6024 #: build/C/man2/getrlimit.2:471
6026 "A pointer argument points to a location outside the accessible address "
6031 #: build/C/man2/getrlimit.2:483
6033 "The value specified in I<resource> is not valid; or, for B<setrlimit>() or "
6034 "B<prlimit>(): I<rlim-E<gt>rlim_cur> was greater than I<rlim-E<gt>rlim_max>."
6038 #: build/C/man2/getrlimit.2:488
6040 "An unprivileged process tried to raise the hard limit; the "
6041 "B<CAP_SYS_RESOURCE> capability is required to do this."
6045 #: build/C/man2/getrlimit.2:496
6047 "The caller tried to increase the hard B<RLIMIT_NOFILE> limit above the "
6048 "maximum defined by I</proc/sys/fs/nr_open> (see B<proc>(5))"
6052 #: build/C/man2/getrlimit.2:502
6054 "(B<prlimit>()) The calling process did not have permission to set limits "
6055 "for the process specified by I<pid>."
6059 #: build/C/man2/getrlimit.2:506
6060 msgid "Could not find a process with the ID specified in I<pid>."
6064 #: build/C/man2/getrlimit.2:511
6066 "The B<prlimit>() system call is available since Linux 2.6.36. Library "
6067 "support is available since glibc 2.13."
6071 #: build/C/man2/getrlimit.2:515
6072 msgid "B<getrlimit>(), B<setrlimit>(): SVr4, 4.3BSD, POSIX.1-2001."
6076 #: build/C/man2/getrlimit.2:518
6077 msgid "B<prlimit>(): Linux-specific."
6081 #: build/C/man2/getrlimit.2:534
6083 "B<RLIMIT_MEMLOCK> and B<RLIMIT_NPROC> derive from BSD and are not specified "
6084 "in POSIX.1-2001; they are present on the BSDs and Linux, but on few other "
6085 "implementations. B<RLIMIT_RSS> derives from BSD and is not specified in "
6086 "POSIX.1-2001; it is nevertheless present on most implementations. "
6087 "B<RLIMIT_MSGQUEUE>, B<RLIMIT_NICE>, B<RLIMIT_RTPRIO>, B<RLIMIT_RTTIME>, and "
6088 "B<RLIMIT_SIGPENDING> are Linux-specific."
6092 #: build/C/man2/getrlimit.2:540
6094 "A child process created via B<fork>(2) inherits its parent's resource "
6095 "limits. Resource limits are preserved across B<execve>(2)."
6099 #: build/C/man2/getrlimit.2:545
6101 "Lowering the soft limit for a resource below the process's current "
6102 "consumption of that resource will succeed (but will prevent the process from "
6103 "further increasing its consumption of the resource)."
6107 #: build/C/man2/getrlimit.2:554
6109 "One can set the resource limits of the shell using the built-in I<ulimit> "
6110 "command (I<limit> in B<csh>(1)). The shell's resource limits are inherited "
6111 "by the processes that it creates to execute commands."
6115 #: build/C/man2/getrlimit.2:559
6117 "Since Linux 2.6.24, the resource limits of any process can be inspected via "
6118 "I</proc/[pid]/limits>; see B<proc>(5)."
6122 #: build/C/man2/getrlimit.2:568
6124 "Ancient systems provided a B<vlimit>() function with a similar purpose to "
6125 "B<setrlimit>(). For backward compatibility, glibc also provides "
6126 "B<vlimit>(). All new applications should be written using B<setrlimit>()."
6130 #: build/C/man2/getrlimit.2:568
6132 msgid "C library/ kernel ABI differences"
6136 #: build/C/man2/getrlimit.2:577
6138 "Since version 2.13, the glibc B<getrlimit>() and B<setrlimit>() wrapper "
6139 "functions no longer invoke the corresponding system calls, but instead "
6140 "employ B<prlimit>(), for the reasons described in BUGS."
6144 #: build/C/man2/getrlimit.2:586
6146 "In older Linux kernels, the B<SIGXCPU> and B<SIGKILL> signals delivered when "
6147 "a process encountered the soft and hard B<RLIMIT_CPU> limits were delivered "
6148 "one (CPU) second later than they should have been. This was fixed in kernel "
6152 #. see http://marc.theaimsgroup.com/?l=linux-kernel&m=114008066530167&w=2
6154 #: build/C/man2/getrlimit.2:594
6156 "In 2.6.x kernels before 2.6.17, a B<RLIMIT_CPU> limit of 0 is wrongly "
6157 "treated as \"no limit\" (like B<RLIM_INFINITY>). Since Linux 2.6.17, "
6158 "setting a limit of 0 does have an effect, but is actually treated as a limit "
6162 #. See https://lwn.net/Articles/145008/
6164 #: build/C/man2/getrlimit.2:599
6166 "A kernel bug means that B<RLIMIT_RTPRIO> does not work in kernel 2.6.12; the "
6167 "problem is fixed in kernel 2.6.13."
6170 #. see http://marc.theaimsgroup.com/?l=linux-kernel&m=112256338703880&w=2
6172 #: build/C/man2/getrlimit.2:610
6174 "In kernel 2.6.12, there was an off-by-one mismatch between the priority "
6175 "ranges returned by B<getpriority>(2) and B<RLIMIT_NICE>. This had the "
6176 "effect that the actual ceiling for the nice value was calculated as I<19\\ "
6177 "-\\ rlim_cur>. This was fixed in kernel 2.6.13."
6180 #. The relevant patch, sent to LKML, seems to be
6181 #. http://thread.gmane.org/gmane.linux.kernel/273462
6182 #. From: Roland McGrath <roland <at> redhat.com>
6183 #. Subject: [PATCH 7/7] make RLIMIT_CPU/SIGXCPU per-process
6184 #. Date: 2005-01-23 23:27:46 GMT
6185 #. Tested Solaris 10, FreeBSD 9, OpenBSD 5.0
6186 #. FIXME . https://bugzilla.kernel.org/show_bug.cgi?id=50951
6188 #: build/C/man2/getrlimit.2:637
6190 "Since Linux 2.6.12, if a process reaches its soft B<RLIMIT_CPU> limit and "
6191 "has a handler installed for B<SIGXCPU>, then, in addition to invoking the "
6192 "signal handler, the kernel increases the soft limit by one second. This "
6193 "behavior repeats if the process continues to consume CPU time, until the "
6194 "hard limit is reached, at which point the process is killed. Other "
6195 "implementations do not change the B<RLIMIT_CPU> soft limit in this manner, "
6196 "and the Linux behavior is probably not standards conformant; portable "
6197 "applications should avoid relying on this Linux-specific behavior. The "
6198 "Linux-specific B<RLIMIT_RTTIME> limit exhibits the same behavior when the "
6199 "soft limit is encountered."
6203 #: build/C/man2/getrlimit.2:647
6205 "Kernels before 2.4.22 did not diagnose the error B<EINVAL> for "
6206 "B<setrlimit>() when I<rlim-E<gt>rlim_cur> was greater than "
6207 "I<rlim-E<gt>rlim_max>."
6211 #: build/C/man2/getrlimit.2:647
6213 msgid "Representation of \"large\" resource limit values on 32-bit platforms"
6216 #. https://bugzilla.kernel.org/show_bug.cgi?id=5042
6217 #. http://sources.redhat.com/bugzilla/show_bug.cgi?id=12201
6219 #: build/C/man2/getrlimit.2:678
6221 "The glibc B<getrlimit>() and B<setrlimit>() wrapper functions use a 64-bit "
6222 "I<rlim_t> data type, even on 32-bit platforms. However, the I<rlim_t> data "
6223 "type used in the B<getrlimit>() and B<setrlimit>() system calls is a "
6224 "(32-bit) I<unsigned long>. Furthermore, in Linux versions before 2.6.36, "
6225 "the kernel represents resource limits on 32-bit platforms as I<unsigned "
6226 "long>. However, a 32-bit data type is not wide enough. The most pertinent "
6227 "limit here is B<RLIMIT_FSIZE>, which specifies the maximum size to which a "
6228 "file can grow: to be useful, this limit must be represented using a type "
6229 "that is as wide as the type used to represent file offsets\\(emthat is, as "
6230 "wide as a 64-bit B<off_t> (assuming a program compiled with "
6231 "I<_FILE_OFFSET_BITS=64>)."
6235 #: build/C/man2/getrlimit.2:688
6237 "To work around this kernel limitation, if a program tried to set a resource "
6238 "limit to a value larger than can be represented in a 32-bit I<unsigned "
6239 "long>, then the glibc B<setrlimit>() wrapper function silently converted "
6240 "the limit value to B<RLIM_INFINITY>. In other words, the requested resource "
6241 "limit setting was silently ignored."
6245 #: build/C/man2/getrlimit.2:690
6246 msgid "This problem was addressed in Linux 2.6.36 with two principal changes:"
6250 #: build/C/man2/getrlimit.2:693
6252 "the addition of a new kernel representation of resource limits that uses 64 "
6253 "bits, even on 32-bit platforms;"
6257 #: build/C/man2/getrlimit.2:697
6259 "the addition of the B<prlimit>() system call, which employs 64-bit values "
6260 "for its resource limit arguments."
6263 #. https://www.sourceware.org/bugzilla/show_bug.cgi?id=12201
6265 #: build/C/man2/getrlimit.2:710
6267 "Since version 2.13, glibc works around the limitations of the B<getrlimit>() "
6268 "and B<setrlimit>() system calls by implementing B<setrlimit>() and "
6269 "B<getrlimit>() as wrapper functions that call B<prlimit>()."
6273 #: build/C/man2/getrlimit.2:713
6274 msgid "The program below demonstrates the use of B<prlimit>()."
6278 #: build/C/man2/getrlimit.2:722
6281 "#define _GNU_SOURCE\n"
6282 "#define _FILE_OFFSET_BITS 64\n"
6283 "#include E<lt>stdio.hE<gt>\n"
6284 "#include E<lt>time.hE<gt>\n"
6285 "#include E<lt>stdlib.hE<gt>\n"
6286 "#include E<lt>unistd.hE<gt>\n"
6287 "#include E<lt>sys/resource.hE<gt>\n"
6291 #: build/C/man2/getrlimit.2:725
6294 "#define errExit(msg) \tdo { perror(msg); exit(EXIT_FAILURE); \\e\n"
6299 #: build/C/man2/getrlimit.2:732
6303 "main(int argc, char *argv[])\n"
6305 " struct rlimit old, new;\n"
6306 " struct rlimit *newp;\n"
6311 #: build/C/man2/getrlimit.2:738
6314 " if (!(argc == 2 || argc == 4)) {\n"
6315 " fprintf(stderr, \"Usage: %s E<lt>pidE<gt> [E<lt>new-soft-limitE<gt> "
6317 " \"E<lt>new-hard-limitE<gt>]\\en\", argv[0]);\n"
6318 " exit(EXIT_FAILURE);\n"
6323 #: build/C/man2/getrlimit.2:740
6325 msgid " pid = atoi(argv[1]); /* PID of target process */\n"
6329 #: build/C/man2/getrlimit.2:747
6333 " if (argc == 4) {\n"
6334 " new.rlim_cur = atoi(argv[2]);\n"
6335 " new.rlim_max = atoi(argv[3]);\n"
6341 #: build/C/man2/getrlimit.2:750
6344 " /* Set CPU time limit of target process; retrieve and display\n"
6345 " previous limit */\n"
6349 #: build/C/man2/getrlimit.2:755
6352 " if (prlimit(pid, RLIMIT_CPU, newp, &old) == -1)\n"
6353 " errExit(\"prlimit-1\");\n"
6354 " printf(\"Previous limits: soft=%lld; hard=%lld\\en\",\n"
6355 " (long long) old.rlim_cur, (long long) old.rlim_max);\n"
6359 #: build/C/man2/getrlimit.2:757
6361 msgid " /* Retrieve and display new CPU time limit */\n"
6365 #: build/C/man2/getrlimit.2:762
6368 " if (prlimit(pid, RLIMIT_CPU, NULL, &old) == -1)\n"
6369 " errExit(\"prlimit-2\");\n"
6370 " printf(\"New limits: soft=%lld; hard=%lld\\en\",\n"
6371 " (long long) old.rlim_cur, (long long) old.rlim_max);\n"
6375 #: build/C/man2/getrlimit.2:765 build/C/man7/user_namespaces.7:829
6378 " exit(EXIT_FAILURE);\n"
6383 #: build/C/man2/getrlimit.2:784
6385 "B<prlimit>(1), B<dup>(2), B<fcntl>(2), B<fork>(2), B<getrusage>(2), "
6386 "B<mlock>(2), B<mmap>(2), B<open>(2), B<quotactl>(2), B<sbrk>(2), "
6387 "B<shmctl>(2), B<malloc>(3), B<sigqueue>(3), B<ulimit>(3), B<core>(5), "
6388 "B<capabilities>(7), B<signal>(7)"
6392 #: build/C/man2/getrusage.2:39
6398 #: build/C/man2/getrusage.2:39
6404 #: build/C/man2/getrusage.2:42
6405 msgid "getrusage - get resource usage"
6409 #: build/C/man2/getrusage.2:48
6410 msgid "B<int getrusage(int >I<who>B<, struct rusage *>I<usage>B<);>"
6414 #: build/C/man2/getrusage.2:54
6416 "B<getrusage>() returns resource usage measures for I<who>, which can be one "
6421 #: build/C/man2/getrusage.2:54
6423 msgid "B<RUSAGE_SELF>"
6427 #: build/C/man2/getrusage.2:58
6429 "Return resource usage statistics for the calling process, which is the sum "
6430 "of resources used by all threads in the process."
6434 #: build/C/man2/getrusage.2:58
6436 msgid "B<RUSAGE_CHILDREN>"
6440 #: build/C/man2/getrusage.2:65
6442 "Return resource usage statistics for all children of the calling process "
6443 "that have terminated and been waited for. These statistics will include the "
6444 "resources used by grandchildren, and further removed descendants, if all of "
6445 "the intervening descendants waited on their terminated children."
6449 #: build/C/man2/getrusage.2:65
6451 msgid "B<RUSAGE_THREAD> (since Linux 2.6.26)"
6455 #: build/C/man2/getrusage.2:75
6457 "Return resource usage statistics for the calling thread. The B<_GNU_SOURCE> "
6458 "feature test macro must be defined (before including I<any> header file) in "
6459 "order to obtain the definition of this constant from "
6460 "I<E<lt>sys/resource.hE<gt>>."
6464 #: build/C/man2/getrusage.2:79
6466 "The resource usages are returned in the structure pointed to by I<usage>, "
6467 "which has the following form:"
6471 #: build/C/man2/getrusage.2:100
6475 " struct timeval ru_utime; /* user CPU time used */\n"
6476 " struct timeval ru_stime; /* system CPU time used */\n"
6477 " long ru_maxrss; /* maximum resident set size */\n"
6478 " long ru_ixrss; /* integral shared memory size */\n"
6479 " long ru_idrss; /* integral unshared data size */\n"
6480 " long ru_isrss; /* integral unshared stack size */\n"
6481 " long ru_minflt; /* page reclaims (soft page faults) */\n"
6482 " long ru_majflt; /* page faults (hard page faults) */\n"
6483 " long ru_nswap; /* swaps */\n"
6484 " long ru_inblock; /* block input operations */\n"
6485 " long ru_oublock; /* block output operations */\n"
6486 " long ru_msgsnd; /* IPC messages sent */\n"
6487 " long ru_msgrcv; /* IPC messages received */\n"
6488 " long ru_nsignals; /* signals received */\n"
6489 " long ru_nvcsw; /* voluntary context switches */\n"
6490 " long ru_nivcsw; /* involuntary context switches */\n"
6495 #: build/C/man2/getrusage.2:108
6497 "Not all fields are completed; unmaintained fields are set to zero by the "
6498 "kernel. (The unmaintained fields are provided for compatibility with other "
6499 "systems, and because they may one day be supported on Linux.) The fields "
6500 "are interpreted as follows:"
6504 #: build/C/man2/getrusage.2:108
6510 #: build/C/man2/getrusage.2:114
6512 "This is the total amount of time spent executing in user mode, expressed in "
6513 "a I<timeval> structure (seconds plus microseconds)."
6517 #: build/C/man2/getrusage.2:114
6523 #: build/C/man2/getrusage.2:120
6525 "This is the total amount of time spent executing in kernel mode, expressed "
6526 "in a I<timeval> structure (seconds plus microseconds)."
6530 #: build/C/man2/getrusage.2:120
6532 msgid "I<ru_maxrss> (since Linux 2.6.32)"
6536 #: build/C/man2/getrusage.2:127
6538 "This is the maximum resident set size used (in kilobytes). For "
6539 "B<RUSAGE_CHILDREN>, this is the resident set size of the largest child, not "
6540 "the maximum resident set size of the process tree."
6544 #: build/C/man2/getrusage.2:127
6546 msgid "I<ru_ixrss> (unmaintained)"
6549 #. On some systems, this field records the number of signals received.
6551 #: build/C/man2/getrusage.2:133 build/C/man2/getrusage.2:138 build/C/man2/getrusage.2:143 build/C/man2/getrusage.2:155 build/C/man2/getrusage.2:167 build/C/man2/getrusage.2:173 build/C/man2/getrusage.2:177
6552 msgid "This field is currently unused on Linux."
6556 #: build/C/man2/getrusage.2:133
6558 msgid "I<ru_idrss> (unmaintained)"
6562 #: build/C/man2/getrusage.2:138
6564 msgid "I<ru_isrss> (unmaintained)"
6568 #: build/C/man2/getrusage.2:143
6570 msgid "I<ru_minflt>"
6574 #: build/C/man2/getrusage.2:148
6576 "The number of page faults serviced without any I/O activity; here I/O "
6577 "activity is avoided by ``reclaiming'' a page frame from the list of pages "
6578 "awaiting reallocation."
6582 #: build/C/man2/getrusage.2:148
6584 msgid "I<ru_majflt>"
6588 #: build/C/man2/getrusage.2:151
6589 msgid "The number of page faults serviced that required I/O activity."
6593 #: build/C/man2/getrusage.2:151
6595 msgid "I<ru_nswap> (unmaintained)"
6599 #: build/C/man2/getrusage.2:155
6601 msgid "I<ru_inblock> (since Linux 2.6.22)"
6605 #: build/C/man2/getrusage.2:158
6606 msgid "The number of times the filesystem had to perform input."
6610 #: build/C/man2/getrusage.2:158
6612 msgid "I<ru_oublock> (since Linux 2.6.22)"
6616 #: build/C/man2/getrusage.2:161
6617 msgid "The number of times the filesystem had to perform output."
6621 #: build/C/man2/getrusage.2:161
6623 msgid "I<ru_msgsnd> (unmaintained)"
6627 #: build/C/man2/getrusage.2:167
6629 msgid "I<ru_msgrcv> (unmaintained)"
6633 #: build/C/man2/getrusage.2:173
6635 msgid "I<ru_nsignals> (unmaintained)"
6639 #: build/C/man2/getrusage.2:177
6641 msgid "I<ru_nvcsw> (since Linux 2.6)"
6645 #: build/C/man2/getrusage.2:182
6647 "The number of times a context switch resulted due to a process voluntarily "
6648 "giving up the processor before its time slice was completed (usually to "
6649 "await availability of a resource)."
6653 #: build/C/man2/getrusage.2:182
6655 msgid "I<ru_nivcsw> (since Linux 2.6)"
6659 #: build/C/man2/getrusage.2:187
6661 "The number of times a context switch resulted due to a higher priority "
6662 "process becoming runnable or because the current process exceeded its time "
6667 #: build/C/man2/getrusage.2:198
6668 msgid "I<usage> points outside the accessible address space."
6672 #: build/C/man2/getrusage.2:202
6673 msgid "I<who> is invalid."
6677 #: build/C/man2/getrusage.2:210
6679 "SVr4, 4.3BSD. POSIX.1-2001 specifies B<getrusage>(), but specifies only the "
6680 "fields I<ru_utime> and I<ru_stime>."
6684 #: build/C/man2/getrusage.2:213
6685 msgid "B<RUSAGE_THREAD> is Linux-specific."
6689 #: build/C/man2/getrusage.2:216
6690 msgid "Resource usage metrics are preserved across an B<execve>(2)."
6694 #: build/C/man2/getrusage.2:224
6696 "Including I<E<lt>sys/time.hE<gt>> is not required these days, but increases "
6697 "portability. (Indeed, I<struct timeval> is defined in "
6698 "I<E<lt>sys/time.hE<gt>>.)"
6701 #. See the description of getrusage() in XSH.
6702 #. A similar statement was also in SUSv2.
6704 #: build/C/man2/getrusage.2:236
6706 "In Linux kernel versions before 2.6.9, if the disposition of B<SIGCHLD> is "
6707 "set to B<SIG_IGN> then the resource usages of child processes are "
6708 "automatically included in the value returned by B<RUSAGE_CHILDREN>, although "
6709 "POSIX.1-2001 explicitly prohibits this. This nonconformance is rectified in "
6710 "Linux 2.6.9 and later."
6714 #: build/C/man2/getrusage.2:239
6716 "The structure definition shown at the start of this page was taken from "
6721 #: build/C/man2/getrusage.2:248
6723 "Ancient systems provided a B<vtimes>() function with a similar purpose to "
6724 "B<getrusage>(). For backward compatibility, glibc also provides "
6725 "B<vtimes>(). All new applications should be written using B<getrusage>()."
6729 #: build/C/man2/getrusage.2:253
6730 msgid "See also the description of I</proc/PID/stat> in B<proc>(5)."
6734 #: build/C/man2/getrusage.2:260
6736 "B<clock_gettime>(2), B<getrlimit>(2), B<times>(2), B<wait>(2), B<wait4>(2), "
6741 #: build/C/man2/getsid.2:26
6747 #: build/C/man2/getsid.2:26
6753 #: build/C/man2/getsid.2:29
6754 msgid "getsid - get session ID"
6758 #: build/C/man2/getsid.2:33
6759 msgid "B<pid_t getsid(pid_t>I< pid>B<);>"
6763 #: build/C/man2/getsid.2:42
6764 msgid "B<getsid>():"
6768 #: build/C/man2/getsid.2:45 build/C/man2/setpgid.2:79
6769 msgid "_XOPEN_SOURCE\\ E<gt>=\\ 500 || _XOPEN_SOURCE\\ &&\\ _XOPEN_SOURCE_EXTENDED"
6773 #: build/C/man2/getsid.2:47 build/C/man2/setpgid.2:81
6774 msgid "|| /* Since glibc 2.12: */ _POSIX_C_SOURCE\\ E<gt>=\\ 200809L"
6778 #: build/C/man2/getsid.2:58
6780 "I<getsid(0)> returns the session ID of the calling process. I<getsid(p)> "
6781 "returns the session ID of the process with process ID I<p>. (The session ID "
6782 "of a process is the process group ID of the session leader.)"
6786 #: build/C/man2/getsid.2:63
6788 "On success, a session ID is returned. On error, I<(pid_t)\\ -1> will be "
6789 "returned, and I<errno> is set appropriately."
6793 #: build/C/man2/getsid.2:70
6795 "A process with process ID I<p> exists, but it is not in the same session as "
6796 "the calling process, and the implementation considers this an error."
6800 #: build/C/man2/getsid.2:75
6801 msgid "No process with process ID I<p> was found."
6804 #. Linux has this system call since Linux 1.3.44.
6805 #. There is libc support since libc 5.2.19.
6807 #: build/C/man2/getsid.2:79
6808 msgid "This system call is available on Linux since version 2.0."
6812 #: build/C/man2/getsid.2:81 build/C/man2/setgid.2:73 build/C/man2/setsid.2:70
6813 msgid "SVr4, POSIX.1-2001."
6817 #: build/C/man2/getsid.2:84
6818 msgid "Linux does not return B<EPERM>."
6822 #: build/C/man2/getsid.2:88
6823 msgid "B<getpgid>(2), B<setsid>(2), B<credentials>(7)"
6827 #: build/C/man2/getuid.2:26
6833 #: build/C/man2/getuid.2:29
6834 msgid "getuid, geteuid - get user identity"
6838 #: build/C/man2/getuid.2:35
6839 msgid "B<uid_t getuid(void);>"
6843 #: build/C/man2/getuid.2:37
6844 msgid "B<uid_t geteuid(void);>"
6848 #: build/C/man2/getuid.2:40
6849 msgid "B<getuid>() returns the real user ID of the calling process."
6853 #: build/C/man2/getuid.2:43
6854 msgid "B<geteuid>() returns the effective user ID of the calling process."
6858 #: build/C/man2/getuid.2:48
6864 #: build/C/man2/getuid.2:57
6866 "In UNIX\\ V6 the B<getuid>() call returned I<(euid E<lt>E<lt> 8) + uid>. "
6867 "UNIX\\ V7 introduced separate calls B<getuid>() and B<geteuid>()."
6871 #: build/C/man2/getuid.2:73
6873 "The original Linux B<getuid>() and B<geteuid>() system calls supported "
6874 "only 16-bit user IDs. Subsequently, Linux 2.4 added B<getuid32>() and "
6875 "B<geteuid32>(), supporting 32-bit IDs. The glibc B<getuid>() and "
6876 "B<geteuid>() wrapper functions transparently deal with the variations "
6877 "across kernel versions."
6881 #: build/C/man2/getuid.2:78
6882 msgid "B<getresuid>(2), B<setreuid>(2), B<setuid>(2), B<credentials>(7)"
6886 #: build/C/man3/group_member.3:25
6888 msgid "GROUP_MEMBER"
6892 #: build/C/man3/group_member.3:25
6898 #: build/C/man3/group_member.3:25
6904 #: build/C/man3/group_member.3:28
6905 msgid "group_member - test whether a process is in a group"
6909 #: build/C/man3/group_member.3:32
6910 msgid "B<int group_member(gid_t >I<gid>B<);>"
6914 #: build/C/man3/group_member.3:40
6915 msgid "B<group_member>(): _GNU_SOURCE"
6919 #: build/C/man3/group_member.3:48
6921 "The B<group_member>() function tests whether any of the caller's "
6922 "supplementary group IDs (as returned by B<getgroups>(2)) matches I<gid>."
6926 #: build/C/man3/group_member.3:55
6928 "The B<group_member>() function returns nonzero if any of the caller's "
6929 "supplementary group IDs matches I<gid>, and zero otherwise."
6933 #: build/C/man3/group_member.3:57
6934 msgid "This function is a nonstandard GNU extension."
6938 #: build/C/man3/group_member.3:62
6939 msgid "B<getgid>(2), B<getgroups>(2), B<getgrouplist>(3), B<group>(5)"
6943 #: build/C/man2/iopl.2:33
6949 #: build/C/man2/iopl.2:33
6955 #: build/C/man2/iopl.2:36
6956 msgid "iopl - change I/O privilege level"
6960 #: build/C/man2/iopl.2:38
6961 msgid "B<#include E<lt>sys/io.hE<gt>>"
6965 #: build/C/man2/iopl.2:40
6966 msgid "B<int iopl(int >I<level>B<);>"
6970 #: build/C/man2/iopl.2:45
6972 "B<iopl>() changes the I/O privilege level of the calling process, as "
6973 "specified by the two least significant bits in I<level>."
6977 #: build/C/man2/iopl.2:51
6979 "This call is necessary to allow 8514-compatible X servers to run under "
6980 "Linux. Since these X servers require access to all 65536 I/O ports, the "
6981 "B<ioperm>(2) call is not sufficient."
6985 #: build/C/man2/iopl.2:55
6987 "In addition to granting unrestricted I/O port access, running at a higher "
6988 "I/O privilege level also allows the process to disable interrupts. This "
6989 "will probably crash the system, and is not recommended."
6993 #: build/C/man2/iopl.2:60
6994 msgid "Permissions are inherited by B<fork>(2) and B<execve>(2)."
6998 #: build/C/man2/iopl.2:62
6999 msgid "The I/O privilege level for a normal process is 0."
7003 #: build/C/man2/iopl.2:66
7005 "This call is mostly for the i386 architecture. On many other architectures "
7006 "it does not exist or will always return an error."
7010 #: build/C/man2/iopl.2:76
7011 msgid "I<level> is greater than 3."
7015 #: build/C/man2/iopl.2:79
7016 msgid "This call is unimplemented."
7020 #: build/C/man2/iopl.2:87
7022 "The calling process has insufficient privilege to call B<iopl>(); the "
7023 "B<CAP_SYS_RAWIO> capability is required to raise the I/O privilege level "
7024 "above its current value."
7028 #: build/C/man2/iopl.2:91
7030 "B<iopl>() is Linux-specific and should not be used in programs that are "
7031 "intended to be portable."
7035 #: build/C/man2/iopl.2:100
7037 "Libc5 treats it as a system call and has a prototype in "
7038 "I<E<lt>unistd.hE<gt>>. Glibc1 does not have a prototype. Glibc2 has a "
7039 "prototype both in I<E<lt>sys/io.hE<gt>> and in I<E<lt>sys/perm.hE<gt>>. "
7040 "Avoid the latter, it is available on i386 only."
7044 #: build/C/man2/iopl.2:104
7045 msgid "B<ioperm>(2), B<outb>(2), B<capabilities>(7)"
7049 #: build/C/man2/ioprio_set.2:24
7055 #: build/C/man2/ioprio_set.2:24
7061 #: build/C/man2/ioprio_set.2:27
7062 msgid "ioprio_get, ioprio_set - get/set I/O scheduling class and priority"
7066 #: build/C/man2/ioprio_set.2:31
7069 "B<int ioprio_get(int >I<which>B<, int >I<who>B<);>\n"
7070 "B<int ioprio_set(int >I<which>B<, int >I<who>B<, int >I<ioprio>B<);>\n"
7074 #: build/C/man2/ioprio_set.2:35
7075 msgid "I<Note>: There are no glibc wrappers for these system calls; see NOTES."
7079 #: build/C/man2/ioprio_set.2:42
7081 "The B<ioprio_get>() and B<ioprio_set>() system calls respectively get and "
7082 "set the I/O scheduling class and priority of one or more threads."
7086 #: build/C/man2/ioprio_set.2:54
7088 "The I<which> and I<who> arguments identify the thread(s) on which the system "
7089 "calls operate. The I<which> argument determines how I<who> is interpreted, "
7090 "and has one of the following values:"
7094 #: build/C/man2/ioprio_set.2:54
7096 msgid "B<IOPRIO_WHO_PROCESS>"
7100 #: build/C/man2/ioprio_set.2:61
7102 "I<who> is a process ID or thread ID identifying a single process or thread. "
7103 "If I<who> is 0, then operate on the calling thread."
7107 #: build/C/man2/ioprio_set.2:61
7109 msgid "B<IOPRIO_WHO_PGRP>"
7113 #: build/C/man2/ioprio_set.2:68
7115 "I<who> is a process group ID identifying all the members of a process "
7116 "group. If I<who> is 0, then operate on the process group of which the "
7117 "caller is a member."
7121 #: build/C/man2/ioprio_set.2:68
7123 msgid "B<IOPRIO_WHO_USER>"
7126 #. FIXME . Need to document the behavior when 'who" is specified as 0
7127 #. See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=652443
7129 #: build/C/man2/ioprio_set.2:75
7131 "I<who> is a user ID identifying all of the processes that have a matching "
7136 #: build/C/man2/ioprio_set.2:98
7138 "If I<which> is specified as B<IOPRIO_WHO_PGRP> or B<IOPRIO_WHO_USER> when "
7139 "calling B<ioprio_get>(), and more than one process matches I<who>, then the "
7140 "returned priority will be the highest one found among all of the matching "
7141 "processes. One priority is said to be higher than another one if it belongs "
7142 "to a higher priority class (B<IOPRIO_CLASS_RT> is the highest priority "
7143 "class; B<IOPRIO_CLASS_IDLE> is the lowest) or if it belongs to the same "
7144 "priority class as the other process but has a higher priority level (a lower "
7145 "priority number means a higher priority level)."
7149 #: build/C/man2/ioprio_set.2:108
7151 "The I<ioprio> argument given to B<ioprio_set>() is a bit mask that "
7152 "specifies both the scheduling class and the priority to be assigned to the "
7153 "target process(es). The following macros are used for assembling and "
7154 "dissecting I<ioprio> values:"
7158 #: build/C/man2/ioprio_set.2:108
7160 msgid "B<IOPRIO_PRIO_VALUE(>I<class>B<, >I<data>B<)>"
7164 #: build/C/man2/ioprio_set.2:117
7166 "Given a scheduling I<class> and priority (I<data>), this macro combines the "
7167 "two values to produce an I<ioprio> value, which is returned as the result of "
7172 #: build/C/man2/ioprio_set.2:117
7174 msgid "B<IOPRIO_PRIO_CLASS(>I<mask>B<)>"
7178 #: build/C/man2/ioprio_set.2:129
7180 "Given I<mask> (an I<ioprio> value), this macro returns its I/O class "
7181 "component, that is, one of the values B<IOPRIO_CLASS_RT>, "
7182 "B<IOPRIO_CLASS_BE>, or B<IOPRIO_CLASS_IDLE>."
7186 #: build/C/man2/ioprio_set.2:129
7188 msgid "B<IOPRIO_PRIO_DATA(>I<mask>B<)>"
7192 #: build/C/man2/ioprio_set.2:138
7194 "Given I<mask> (an I<ioprio> value), this macro returns its priority "
7195 "(I<data>) component."
7199 #: build/C/man2/ioprio_set.2:141
7201 "See the NOTES section for more information on scheduling classes and "
7206 #: build/C/man2/ioprio_set.2:149
7208 "I/O priorities are supported for reads and for synchronous (B<O_DIRECT>, "
7209 "B<O_SYNC>) writes. I/O priorities are not supported for asynchronous "
7210 "writes because they are issued outside the context of the program dirtying "
7211 "the memory, and thus program-specific priorities do not apply."
7215 #: build/C/man2/ioprio_set.2:162
7217 "On success, B<ioprio_get>() returns the I<ioprio> value of the process with "
7218 "highest I/O priority of any of the processes that match the criteria "
7219 "specified in I<which> and I<who>. On error, -1 is returned, and I<errno> is "
7220 "set to indicate the error."
7224 #: build/C/man2/ioprio_set.2:169
7226 "On success, B<ioprio_set>() returns 0. On error, -1 is returned, and "
7227 "I<errno> is set to indicate the error."
7231 #: build/C/man2/ioprio_set.2:179
7233 "Invalid value for I<which> or I<ioprio>. Refer to the NOTES section for "
7234 "available scheduler classes and priority levels for I<ioprio>."
7238 #: build/C/man2/ioprio_set.2:187
7240 "The calling process does not have the privilege needed to assign this "
7241 "I<ioprio> to the specified process(es). See the NOTES section for more "
7242 "information on required privileges for B<ioprio_set>()."
7246 #: build/C/man2/ioprio_set.2:193
7248 "No process(es) could be found that matched the specification in I<which> and "
7253 #: build/C/man2/ioprio_set.2:196
7254 msgid "These system calls have been available on Linux since kernel 2.6.13."
7258 #: build/C/man2/ioprio_set.2:201
7260 "Glibc does not provide a wrapper for these system calls; call them using "
7265 #: build/C/man2/ioprio_set.2:220
7267 "Two or more processes or threads can share an I/O context. This will be the "
7268 "case when B<clone>(2) was called with the B<CLONE_IO> flag. However, by "
7269 "default, the distinct threads of a process will B<not> share the same I/O "
7270 "context. This means that if you want to change the I/O priority of all "
7271 "threads in a process, you may need to call B<ioprio_set>() on each of the "
7272 "threads. The thread ID that you would need for this operation is the one "
7273 "that is returned by B<gettid>(2) or B<clone>(2)."
7277 #: build/C/man2/ioprio_set.2:225
7279 "These system calls have an effect only when used in conjunction with an I/O "
7280 "scheduler that supports I/O priorities. As at kernel 2.6.17 the only such "
7281 "scheduler is the Completely Fair Queuing (CFQ) I/O scheduler."
7285 #: build/C/man2/ioprio_set.2:225
7287 msgid "Selecting an I/O scheduler"
7291 #: build/C/man2/ioprio_set.2:229
7293 "I/O Schedulers are selected on a per-device basis via the special file "
7294 "I</sys/block/E<lt>deviceE<gt>/queue/scheduler>."
7298 #: build/C/man2/ioprio_set.2:235
7300 "One can view the current I/O scheduler via the I</sys> filesystem. For "
7301 "example, the following command displays a list of all schedulers currently "
7302 "loaded in the kernel:"
7306 #: build/C/man2/ioprio_set.2:240
7309 "$B< cat /sys/block/hda/queue/scheduler>\n"
7310 "noop anticipatory deadline [cfq]\n"
7314 #: build/C/man2/ioprio_set.2:254
7316 "The scheduler surrounded by brackets is the one actually in use for the "
7317 "device (I<hda> in the example). Setting another scheduler is done by "
7318 "writing the name of the new scheduler to this file. For example, the "
7319 "following command will set the scheduler for the I<hda> device to I<cfq>:"
7323 #: build/C/man2/ioprio_set.2:260
7328 "#B< echo cfq E<gt> /sys/block/hda/queue/scheduler>\n"
7332 #: build/C/man2/ioprio_set.2:262
7334 msgid "The Completely Fair Queuing (CFQ) I/O scheduler"
7338 #: build/C/man2/ioprio_set.2:268
7340 "Since v3 (aka CFQ Time Sliced) CFQ implements I/O nice levels similar to "
7341 "those of CPU scheduling. These nice levels are grouped in three scheduling "
7342 "classes each one containing one or more priority levels:"
7346 #: build/C/man2/ioprio_set.2:268
7348 msgid "B<IOPRIO_CLASS_RT> (1)"
7352 #: build/C/man2/ioprio_set.2:283
7354 "This is the real-time I/O class. This scheduling class is given higher "
7355 "priority than any other class: processes from this class are given first "
7356 "access to the disk every time. Thus this I/O class needs to be used with "
7357 "some care: one I/O real-time process can starve the entire system. Within "
7358 "the real-time class, there are 8 levels of class data (priority) that "
7359 "determine exactly how much time this process needs the disk for on each "
7360 "service. The highest real-time priority level is 0; the lowest is 7. In "
7361 "the future this might change to be more directly mappable to performance, by "
7362 "passing in a desired data rate instead."
7366 #: build/C/man2/ioprio_set.2:283
7368 msgid "B<IOPRIO_CLASS_BE> (2)"
7372 #: build/C/man2/ioprio_set.2:296
7374 "This is the best-effort scheduling class, which is the default for any "
7375 "process that hasn't set a specific I/O priority. The class data (priority) "
7376 "determines how much I/O bandwidth the process will get. Best-effort "
7377 "priority levels are analogous to CPU nice values (see B<getpriority>(2)). "
7378 "The priority level determines a priority relative to other processes in the "
7379 "best-effort scheduling class. Priority levels range from 0 (highest) to 7 "
7384 #: build/C/man2/ioprio_set.2:296
7386 msgid "B<IOPRIO_CLASS_IDLE> (3)"
7390 #: build/C/man2/ioprio_set.2:305
7392 "This is the idle scheduling class. Processes running at this level get I/O "
7393 "time only when no-one else needs the disk. The idle class has no class "
7394 "data. Attention is required when assigning this priority class to a "
7395 "process, since it may become starved if higher priority processes are "
7396 "constantly accessing the disk."
7400 #: build/C/man2/ioprio_set.2:309
7402 "Refer to I<Documentation/block/ioprio.txt> for more information on the CFQ "
7403 "I/O Scheduler and an example program."
7407 #: build/C/man2/ioprio_set.2:309
7409 msgid "Required permissions to set I/O priorities"
7413 #: build/C/man2/ioprio_set.2:312
7415 "Permission to change a process's priority is granted or denied based on two "
7420 #: build/C/man2/ioprio_set.2:312
7422 msgid "B<Process ownership>"
7426 #: build/C/man2/ioprio_set.2:320
7428 "An unprivileged process may set only the I/O priority of a process whose "
7429 "real UID matches the real or effective UID of the calling process. A "
7430 "process which has the B<CAP_SYS_NICE> capability can change the priority of "
7435 #: build/C/man2/ioprio_set.2:320
7437 msgid "B<What is the desired priority>"
7441 #: build/C/man2/ioprio_set.2:332
7443 "Attempts to set very high priorities (B<IOPRIO_CLASS_RT>) require the "
7444 "B<CAP_SYS_ADMIN> capability. Kernel versions up to 2.6.24 also required "
7445 "B<CAP_SYS_ADMIN> to set a very low priority (B<IOPRIO_CLASS_IDLE>), but "
7446 "since Linux 2.6.25, this is no longer required."
7450 #: build/C/man2/ioprio_set.2:337
7452 "A call to B<ioprio_set>() must follow both rules, or the call will fail "
7453 "with the error B<EPERM>."
7456 #. 6 May 07: Bug report raised:
7457 #. http://sources.redhat.com/bugzilla/show_bug.cgi?id=4464
7458 #. Ulrich Drepper replied that he wasn't going to add these
7461 #: build/C/man2/ioprio_set.2:346
7463 "Glibc does not yet provide a suitable header file defining the function "
7464 "prototypes and macros described on this page. Suitable definitions can be "
7465 "found in I<linux/ioprio.h>."
7469 #: build/C/man2/ioprio_set.2:351
7470 msgid "B<ionice>(1), B<getpriority>(2), B<open>(2), B<capabilities>(7)"
7474 #: build/C/man2/ioprio_set.2:354
7475 msgid "I<Documentation/block/ioprio.txt> in the Linux kernel source tree"
7479 #: build/C/man2/ipc.2:25
7485 #: build/C/man2/ipc.2:25
7491 #: build/C/man2/ipc.2:28
7492 msgid "ipc - System V IPC system calls"
7496 #: build/C/man2/ipc.2:33
7499 "B<int ipc(unsigned int >I<call>B<, int >I<first>B<, int >I<second>B<, int "
7501 "B< void *>I<ptr>B<, long >I<fifth>B<);>\n"
7505 #: build/C/man2/ipc.2:41
7507 "B<ipc>() is a common kernel entry point for the System\\ V IPC calls for "
7508 "messages, semaphores, and shared memory. I<call> determines which IPC "
7509 "function to invoke; the other arguments are passed through to the "
7514 #: build/C/man2/ipc.2:45
7516 "User programs should call the appropriate functions by their usual names. "
7517 "Only standard library implementors and kernel hackers need to know about "
7522 #: build/C/man2/ipc.2:49
7524 "B<ipc>() is Linux-specific, and should not be used in programs intended to "
7529 #: build/C/man2/ipc.2:57
7531 "On some architectures\\(emfor example x86-64 and ARM\\(emthere is no "
7532 "B<ipc>() system call; instead B<msgctl>(2), B<semctl>(2), B<shmctl>(2), and "
7533 "so on really are implemented as separate system calls."
7537 #: build/C/man2/ipc.2:70
7539 "B<msgctl>(2), B<msgget>(2), B<msgrcv>(2), B<msgsnd>(2), B<semctl>(2), "
7540 "B<semget>(2), B<semop>(2), B<semtimedop>(2), B<shmat>(2), B<shmctl>(2), "
7541 "B<shmdt>(2), B<shmget>(2)"
7545 #: build/C/man7/namespaces.7:27
7551 #: build/C/man7/namespaces.7:30
7552 msgid "namespaces - overview of Linux namespaces"
7556 #: build/C/man7/namespaces.7:37
7558 "A namespace wraps a global system resource in an abstraction that makes it "
7559 "appear to the processes within the namespace that they have their own "
7560 "isolated instance of the global resource. Changes to the global resource "
7561 "are visible to other processes that are members of the namespace, but are "
7562 "invisible to other processes. One use of namespaces is to implement "
7567 #: build/C/man7/namespaces.7:39
7568 msgid "Linux provides the following namespaces:"
7572 #: build/C/man7/namespaces.7:42
7574 msgid "Namespace\tConstant\tIsolates\n"
7578 #: build/C/man7/namespaces.7:43
7580 msgid "IPC\tCLONE_NEWIPC\tSystem V IPC, POSIX message queues\n"
7584 #: build/C/man7/namespaces.7:44
7586 msgid "Network\tCLONE_NEWNET\tNetwork devices, stacks, ports, etc.\n"
7590 #: build/C/man7/namespaces.7:45
7592 msgid "Mount\tCLONE_NEWNS\tMount points\n"
7596 #: build/C/man7/namespaces.7:46
7598 msgid "PID\tCLONE_NEWPID\tProcess IDs\n"
7602 #: build/C/man7/namespaces.7:47
7604 msgid "User\tCLONE_NEWUSER\tUser and group IDs\n"
7608 #: build/C/man7/namespaces.7:48
7610 msgid "UTS\tCLONE_NEWUTS\tHostname and NIS domain name\n"
7614 #. ==================== The namespaces API ====================
7616 #: build/C/man7/namespaces.7:57
7618 "This page describes the various namespaces and the associated I</proc> "
7619 "files, and summarizes the APIs for working with namespaces."
7623 #: build/C/man7/namespaces.7:57
7625 msgid "The namespaces API"
7629 #: build/C/man7/namespaces.7:62
7631 "As well as various I</proc> files described below, the namespaces API "
7632 "includes the following system calls:"
7636 #: build/C/man7/namespaces.7:62
7642 #: build/C/man7/namespaces.7:75
7644 "The B<clone>(2) system call creates a new process. If the I<flags> "
7645 "argument of the call specifies one or more of the B<CLONE_NEW*> flags listed "
7646 "below, then new namespaces are created for each flag, and the child process "
7647 "is made a member of those namespaces. (This system call also implements a "
7648 "number of features unrelated to namespaces.)"
7652 #: build/C/man7/namespaces.7:75
7658 #: build/C/man7/namespaces.7:84
7660 "The B<setns>(2) system call allows the calling process to join an existing "
7661 "namespace. The namespace to join is specified via a file descriptor that "
7662 "refers to one of the I</proc/[pid]/ns> files described below."
7666 #: build/C/man7/namespaces.7:84
7668 msgid "B<unshare>(2)"
7672 #: build/C/man7/namespaces.7:97
7674 "The B<unshare>(2) system call moves the calling process to a new "
7675 "namespace. If the I<flags> argument of the call specifies one or more of "
7676 "the B<CLONE_NEW*> flags listed below, then new namespaces are created for "
7677 "each flag, and the calling process is made a member of those namespaces. "
7678 "(This system call also implements a number of features unrelated to "
7683 #. ==================== The /proc/[pid]/ns/ directory ====================
7685 #: build/C/man7/namespaces.7:110
7687 "Creation of new namespaces using B<clone>(2) and B<unshare>(2) in most "
7688 "cases requires the B<CAP_SYS_ADMIN> capability. User namespaces are the "
7689 "exception: since Linux 3.8, no privilege is required to create a user "
7694 #: build/C/man7/namespaces.7:110
7696 msgid "The /proc/[pid]/ns/ directory"
7699 #. See commit 6b4e306aa3dc94a0545eb9279475b1ab6209a31f
7701 #: build/C/man7/namespaces.7:117
7703 "Each process has a I</proc/[pid]/ns/> subdirectory containing one entry for "
7704 "each namespace that supports being manipulated by B<setns>(2):"
7708 #: build/C/man7/namespaces.7:128
7711 "$ B<ls -l /proc/$$/ns>\n"
7713 "lrwxrwxrwx. 1 mtk mtk 0 Jan 14 01:20 ipc -E<gt> ipc:[4026531839]\n"
7714 "lrwxrwxrwx. 1 mtk mtk 0 Jan 14 01:20 mnt -E<gt> mnt:[4026531840]\n"
7715 "lrwxrwxrwx. 1 mtk mtk 0 Jan 14 01:20 net -E<gt> net:[4026531956]\n"
7716 "lrwxrwxrwx. 1 mtk mtk 0 Jan 14 01:20 pid -E<gt> pid:[4026531836]\n"
7717 "lrwxrwxrwx. 1 mtk mtk 0 Jan 14 01:20 user -E<gt> user:[4026531837]\n"
7718 "lrwxrwxrwx. 1 mtk mtk 0 Jan 14 01:20 uts -E<gt> uts:[4026531838]\n"
7722 #: build/C/man7/namespaces.7:138
7724 "Bind mounting (see B<mount>(2)) one of the files in this directory to "
7725 "somewhere else in the filesystem keeps the corresponding namespace of the "
7726 "process specified by I<pid> alive even if all processes currently in the "
7727 "namespace terminate."
7731 #: build/C/man7/namespaces.7:149
7733 "Opening one of the files in this directory (or a file that is bind mounted "
7734 "to one of these files) returns a file handle for the corresponding "
7735 "namespace of the process specified by I<pid>. As long as this file "
7736 "descriptor remains open, the namespace will remain alive, even if all "
7737 "processes in the namespace terminate. The file descriptor can be passed to "
7742 #: build/C/man7/namespaces.7:160
7744 "In Linux 3.7 and earlier, these files were visible as hard links. Since "
7745 "Linux 3.8, they appear as symbolic links. If two processes are in the same "
7746 "namespace, then the inode numbers of their I</proc/[pid]/ns/xxx> symbolic "
7747 "links will be the same; an application can check this using the "
7748 "I<stat.st_ino> field returned by B<stat>(2). The content of this symbolic "
7749 "link is a string containing the namespace type and inode number as in the "
7750 "following example:"
7754 #: build/C/man7/namespaces.7:165
7757 "$ B<readlink /proc/$$/ns/uts>\n"
7758 "uts:[4026531838]\n"
7762 #: build/C/man7/namespaces.7:169
7763 msgid "The files in this subdirectory are as follows:"
7767 #: build/C/man7/namespaces.7:169
7769 msgid "I</proc/[pid]/ns/ipc> (since Linux 3.0)"
7773 #: build/C/man7/namespaces.7:172
7774 msgid "This file is a handle for the IPC namespace of the process."
7778 #: build/C/man7/namespaces.7:172
7780 msgid "I</proc/[pid]/ns/mnt> (since Linux 3.8)"
7784 #: build/C/man7/namespaces.7:175
7785 msgid "This file is a handle for the mount namespace of the process."
7789 #: build/C/man7/namespaces.7:175
7791 msgid "I</proc/[pid]/ns/net> (since Linux 3.0)"
7795 #: build/C/man7/namespaces.7:178
7796 msgid "This file is a handle for the network namespace of the process."
7800 #: build/C/man7/namespaces.7:178
7802 msgid "I</proc/[pid]/ns/pid> (since Linux 3.8)"
7806 #: build/C/man7/namespaces.7:181
7807 msgid "This file is a handle for the PID namespace of the process."
7811 #: build/C/man7/namespaces.7:181
7813 msgid "I</proc/[pid]/ns/user> (since Linux 3.8)"
7817 #: build/C/man7/namespaces.7:184
7818 msgid "This file is a handle for the user namespace of the process."
7822 #: build/C/man7/namespaces.7:184
7824 msgid "I</proc/[pid]/ns/uts> (since Linux 3.0)"
7828 #. ==================== IPC namespaces ====================
7830 #: build/C/man7/namespaces.7:190
7831 msgid "This file is a handle for the UTS namespace of the process."
7835 #: build/C/man7/namespaces.7:190
7837 msgid "IPC namespaces (CLONE_NEWIPC)"
7840 #. commit 7eafd7c74c3f2e67c27621b987b28397110d643f
7841 #. https://lwn.net/Articles/312232/
7843 #: build/C/man7/namespaces.7:202
7845 "IPC namespaces isolate certain IPC resources, namely, System V IPC objects "
7846 "(see B<svipc>(7)) and (since Linux 2.6.30) POSIX message queues (see "
7847 "B<mq_overview>(7)). The common characteristic of these IPC mechanisms is "
7848 "that IPC objects are identified by mechanisms other than filesystem "
7853 #: build/C/man7/namespaces.7:208
7855 "Each IPC namespace has its own set of System V IPC identifiers and its own "
7856 "POSIX message queue filesystem. Objects created in an IPC namespace are "
7857 "visible to all other processes that are members of that namespace, but are "
7858 "not visible to processes in other IPC namespaces."
7862 #: build/C/man7/namespaces.7:212
7863 msgid "The following I</proc> interfaces are distinct in each IPC namespace:"
7867 #: build/C/man7/namespaces.7:215
7868 msgid "The POSIX message queue interfaces in I</proc/sys/fs/mqueue>."
7872 #: build/C/man7/namespaces.7:228
7874 "The System V IPC interfaces in I</proc/sys/kernel>, namely: I<msgmax>, "
7875 "I<msgmnb>, I<msgmni>, I<sem>, I<shmall>, I<shmmax>, I<shmmni>, and "
7876 "I<shm_rmid_forced>."
7880 #: build/C/man7/namespaces.7:231
7881 msgid "The System V IPC interfaces in I</proc/sysvipc>."
7885 #: build/C/man7/namespaces.7:235
7887 "When an IPC namespace is destroyed (i.e., when the last process that is a "
7888 "member of the namespace terminates), all IPC objects in the namespace are "
7889 "automatically destroyed."
7893 #. ==================== Network namespaces ====================
7895 #: build/C/man7/namespaces.7:242
7897 "Use of IPC namespaces requires a kernel that is configured with the "
7898 "B<CONFIG_IPC_NS> option."
7902 #: build/C/man7/namespaces.7:242
7904 msgid "Network namespaces (CLONE_NEWNET)"
7907 #. FIXME Add pointer to veth(4) page when it is eventually completed
7909 #: build/C/man7/namespaces.7:257
7911 "Network namespaces provide isolation of the system resources associated with "
7912 "networking: network devices, IPv4 and IPv6 protocol stacks, IP routing "
7913 "tables, firewalls, the I</proc/net> directory, the I</sys/class/net> "
7914 "directory, port numbers (sockets), and so on. A physical network device can "
7915 "live in exactly one network namespace. A virtual network device (\"veth\") "
7916 "pair provides a pipe-like abstraction that can be used to create tunnels "
7917 "between network namespaces, and can be used to create a bridge to a physical "
7918 "network device in another namespace."
7922 #: build/C/man7/namespaces.7:262
7924 "When a network namespace is freed (i.e., when the last process in the "
7925 "namespace terminates), its physical network devices are moved back to the "
7926 "initial network namespace (not to the parent of the process)."
7930 #. ==================== Mount namespaces ====================
7932 #: build/C/man7/namespaces.7:269
7934 "Use of network namespaces requires a kernel that is configured with the "
7935 "B<CONFIG_NET_NS> option."
7939 #: build/C/man7/namespaces.7:269
7941 msgid "Mount namespaces (CLONE_NEWNS)"
7945 #: build/C/man7/namespaces.7:277
7947 "Mount namespaces isolate the set of filesystem mount points, meaning that "
7948 "processes in different mount namespaces can have different views of the "
7949 "filesystem hierarchy. The set of mounts in a mount namespace is modified "
7950 "using B<mount>(2) and B<umount>(2)."
7954 #: build/C/man7/namespaces.7:294
7956 "The I</proc/[pid]/mounts> file (present since Linux 2.4.19) lists all the "
7957 "filesystems currently mounted in the process's mount namespace. The format "
7958 "of this file is documented in B<fstab>(5). Since kernel version 2.6.15, "
7959 "this file is pollable: after opening the file for reading, a change in this "
7960 "file (i.e., a filesystem mount or unmount) causes B<select>(2) to mark the "
7961 "file descriptor as readable, and B<poll>(2) and B<epoll_wait>(2) mark the "
7962 "file as having an error condition."
7966 #: build/C/man7/namespaces.7:302
7968 "The I</proc/[pid]/mountstats> file (present since Linux 2.6.17) exports "
7969 "information (statistics, configuration information) about the mount points "
7970 "in the process's mount namespace. This file is readable only by the owner "
7971 "of the process. Lines in this file have the form:"
7975 #: build/C/man7/namespaces.7:308
7978 "device /dev/sda7 mounted on /home with fstype ext3 [statistics]\n"
7979 "( 1 ) ( 2 ) (3 ) (4)\n"
7983 #: build/C/man7/namespaces.7:312
7984 msgid "The fields in each line are:"
7988 #: build/C/man7/namespaces.7:312 build/C/man7/user_namespaces.7:371
7994 #: build/C/man7/namespaces.7:316
7996 "The name of the mounted device (or \"nodevice\" if there is no corresponding "
8001 #: build/C/man7/namespaces.7:316 build/C/man7/user_namespaces.7:375
8007 #: build/C/man7/namespaces.7:319
8008 msgid "The mount point within the filesystem tree."
8012 #: build/C/man7/namespaces.7:319 build/C/man7/user_namespaces.7:401
8018 #: build/C/man7/namespaces.7:322
8019 msgid "The filesystem type."
8023 #: build/C/man7/namespaces.7:322
8029 #: build/C/man7/namespaces.7:327
8031 "Optional statistics and configuration information. Currently (as at Linux "
8032 "2.6.26), only NFS filesystems export information via this field."
8036 #. ==================== PID namespaces ====================
8038 #: build/C/man7/namespaces.7:331
8040 msgid "PID namespaces (CLONE_NEWPID)"
8044 #. ==================== User namespaces ====================
8046 #: build/C/man7/namespaces.7:337
8047 msgid "See B<pid_namespaces>(7)."
8051 #: build/C/man7/namespaces.7:337
8053 msgid "User namespaces (CLONE_NEWUSER)"
8057 #: build/C/man7/namespaces.7:343 build/C/man7/namespaces.7:364 build/C/man7/pid_namespaces.7:356
8058 msgid "See B<user_namespaces>(7)."
8062 #: build/C/man7/namespaces.7:343
8064 msgid "UTS namespaces (CLONE_NEWUTS)"
8068 #: build/C/man7/namespaces.7:355
8070 "UTS namespaces provide isolation of two system identifiers: the hostname and "
8071 "the NIS domain name. These identifiers are set using B<sethostname>(2) and "
8072 "B<setdomainname>(2), and can be retrieved using B<uname>(2), "
8073 "B<gethostname>(2), and B<getdomainname>(2)."
8077 #: build/C/man7/namespaces.7:359
8079 "Use of UTS namespaces requires a kernel that is configured with the "
8080 "B<CONFIG_UTS_NS> option."
8084 #: build/C/man7/namespaces.7:361 build/C/man7/pid_namespaces.7:353 build/C/man7/user_namespaces.7:648
8085 msgid "Namespaces are a Linux-specific feature."
8089 #: build/C/man7/namespaces.7:377
8091 "B<nsenter>(1), B<readlink>(1), B<unshare>(1), B<clone>(2), B<setns>(2), "
8092 "B<unshare>(2), B<proc>(5), B<credentials>(7), B<capabilities>(7), "
8093 "B<pid_namespaces>(7), B<user_namespaces>(7), B<switch_root>(8)"
8097 #: build/C/man7/pid_namespaces.7:27
8099 msgid "PID_NAMESPACES"
8103 #: build/C/man7/pid_namespaces.7:27 build/C/man2/seccomp.2:27
8109 #: build/C/man7/pid_namespaces.7:30
8110 msgid "pid_namespaces - overview of Linux PID namespaces"
8114 #: build/C/man7/pid_namespaces.7:33 build/C/man7/user_namespaces.7:33
8115 msgid "For an overview of namespaces, see B<namespaces>(7)."
8119 #: build/C/man7/pid_namespaces.7:40
8121 "PID namespaces isolate the process ID number space, meaning that processes "
8122 "in different PID namespaces can have the same PID. PID namespaces allow "
8123 "containers to provide functionality such as suspending/resuming the set of "
8124 "processes in the container and migrating the container to a new host while "
8125 "the processes inside the container maintain the same PIDs."
8129 #: build/C/man7/pid_namespaces.7:48
8131 "PIDs in a new PID namespace start at 1, somewhat like a standalone system, "
8132 "and calls to B<fork>(2), B<vfork>(2), or B<clone>(2) will produce processes "
8133 "with PIDs that are unique within the namespace."
8137 #. ============================================================
8139 #: build/C/man7/pid_namespaces.7:55
8141 "Use of PID namespaces requires a kernel that is configured with the "
8142 "B<CONFIG_PID_NS> option."
8146 #: build/C/man7/pid_namespaces.7:55
8148 msgid "The namespace init process"
8152 #: build/C/man7/pid_namespaces.7:75
8154 "The first process created in a new namespace (i.e., the process created "
8155 "using B<clone>(2) with the B<CLONE_NEWPID> flag, or the first child created "
8156 "by a process after a call to B<unshare>(2) using the B<CLONE_NEWPID> flag) "
8157 "has the PID 1, and is the \"init\" process for the namespace (see "
8158 "B<init>(1)). A child process that is orphaned within the namespace will be "
8159 "reparented to this process rather than B<init>(1) (unless one of the "
8160 "ancestors of the child in the same PID namespace employed the B<prctl>(2) "
8161 "B<PR_SET_CHILD_SUBREAPER> command to mark itself as the reaper of orphaned "
8162 "descendant processes)."
8166 #: build/C/man7/pid_namespaces.7:102
8168 "If the \"init\" process of a PID namespace terminates, the kernel terminates "
8169 "all of the processes in the namespace via a B<SIGKILL> signal. This "
8170 "behavior reflects the fact that the \"init\" process is essential for the "
8171 "correct operation of a PID namespace. In this case, a subsequent B<fork>(2) "
8172 "into this PID namespace will fail with the error B<ENOMEM>; it is not "
8173 "possible to create a new processes in a PID namespace whose \"init\" process "
8174 "has terminated. Such scenarios can occur when, for example, a process uses "
8175 "an open file descriptor for a I</proc/[pid]/ns/pid> file corresponding to a "
8176 "process that was in a namespace to B<setns>(2) into that namespace after "
8177 "the \"init\" process has terminated. Another possible scenario can occur "
8178 "after a call to B<unshare>(2): if the first child subsequently created by a "
8179 "B<fork>(2) terminates, then subsequent calls to B<fork>(2) will fail with "
8184 #: build/C/man7/pid_namespaces.7:108
8186 "Only signals for which the \"init\" process has established a signal handler "
8187 "can be sent to the \"init\" process by other members of the PID namespace. "
8188 "This restriction applies even to privileged processes, and prevents other "
8189 "members of the PID namespace from accidentally killing the \"init\" process."
8193 #: build/C/man7/pid_namespaces.7:128
8195 "Likewise, a process in an ancestor namespace can\\(emsubject to the usual "
8196 "permission checks described in B<kill>(2)\\(emsend signals to the \"init\" "
8197 "process of a child PID namespace only if the \"init\" process has "
8198 "established a handler for that signal. (Within the handler, the "
8199 "I<siginfo_t> I<si_pid> field described in B<sigaction>(2) will be zero.) "
8200 "B<SIGKILL> or B<SIGSTOP> are treated exceptionally: these signals are "
8201 "forcibly delivered when sent from an ancestor PID namespace. Neither of "
8202 "these signals can be caught by the \"init\" process, and so will result in "
8203 "the usual actions associated with those signals (respectively, terminating "
8204 "and stopping the process)."
8208 #. ============================================================
8210 #: build/C/man7/pid_namespaces.7:138
8212 "Starting with Linux 3.4, the B<reboot>(2) system call causes a signal to be "
8213 "sent to the namespace \"init\" process. See B<reboot>(2) for more details."
8217 #: build/C/man7/pid_namespaces.7:138
8219 msgid "Nesting PID namespaces"
8223 #: build/C/man7/pid_namespaces.7:149
8225 "PID namespaces can be nested: each PID namespace has a parent, except for "
8226 "the initial (\"root\") PID namespace. The parent of a PID namespace is the "
8227 "PID namespace of the process that created the namespace using B<clone>(2) "
8228 "or B<unshare>(2). PID namespaces thus form a tree, with all namespaces "
8229 "ultimately tracing their ancestry to the root namespace."
8233 #: build/C/man7/pid_namespaces.7:164
8235 "A process is visible to other processes in its PID namespace, and to the "
8236 "processes in each direct ancestor PID namespace going back to the root PID "
8237 "namespace. In this context, \"visible\" means that one process can be the "
8238 "target of operations by another process using system calls that specify a "
8239 "process ID. Conversely, the processes in a child PID namespace can't see "
8240 "processes in the parent and further removed ancestor namespaces. More "
8241 "succinctly: a process can see (e.g., send signals with B<kill>(2), set nice "
8242 "values with B<setpriority>(2), etc.) only processes contained in its own PID "
8243 "namespace and in descendants of that namespace."
8247 #: build/C/man7/pid_namespaces.7:176
8249 "A process has one process ID in each of the layers of the PID namespace "
8250 "hierarchy in which is visible, and walking back though each direct ancestor "
8251 "namespace through to the root PID namespace. System calls that operate on "
8252 "process IDs always operate using the process ID that is visible in the PID "
8253 "namespace of the caller. A call to B<getpid>(2) always returns the PID "
8254 "associated with the namespace in which the process was created."
8258 #: build/C/man7/pid_namespaces.7:191
8260 "Some processes in a PID namespace may have parents that are outside of the "
8261 "namespace. For example, the parent of the initial process in the namespace "
8262 "(i.e., the B<init>(1) process with PID 1) is necessarily in another "
8263 "namespace. Likewise, the direct children of a process that uses B<setns>(2) "
8264 "to cause its children to join a PID namespace are in a different PID "
8265 "namespace from the caller of B<setns>(2). Calls to B<getppid>(2) for such "
8266 "processes return 0."
8270 #. ============================================================
8272 #: build/C/man7/pid_namespaces.7:204
8274 "While processes may freely descend into child PID namespaces (e.g., using "
8275 "B<setns>(2) with B<CLONE_NEWPID>), they may not move in the other "
8276 "direction. That is to say, processes may not enter any ancestor namespaces "
8277 "(parent, grandparent, etc.). Changing PID namespaces is a one way "
8282 #: build/C/man7/pid_namespaces.7:204
8284 msgid "setns(2) and unshare(2) semantics"
8288 #: build/C/man7/pid_namespaces.7:220
8290 "Calls to B<setns>(2) that specify a PID namespace file descriptor and calls "
8291 "to B<unshare>(2) with the B<CLONE_NEWPID> flag cause children subsequently "
8292 "created by the caller to be placed in a different PID namespace from the "
8293 "caller. These calls do not, however, change the PID namespace of the "
8294 "calling process, because doing so would change the caller's idea of its own "
8295 "PID (as reported by B<getpid>()), which would break many applications and "
8300 #: build/C/man7/pid_namespaces.7:228
8302 "To put things another way: a process's PID namespace membership is "
8303 "determined when the process is created and cannot be changed thereafter. "
8304 "Among other things, this means that the parental relationship between "
8305 "processes mirrors the parental relationship between PID namespaces: the "
8306 "parent of a process is either in the same namespace or resides in the "
8307 "immediate parent PID namespace."
8311 #: build/C/man7/pid_namespaces.7:228
8313 msgid "Compatibility of CLONE_NEWPID with other CLONE_* flags"
8317 #: build/C/man7/pid_namespaces.7:233
8318 msgid "B<CLONE_NEWPID> can't be combined with some other B<CLONE_*> flags:"
8322 #: build/C/man7/pid_namespaces.7:241
8324 "B<CLONE_THREAD> requires being in the same PID namespace in order that the "
8325 "threads in a process can send signals to each other. Similarly, it must be "
8326 "possible to see all of the threads of a processes in the B<proc>(5) "
8331 #: build/C/man7/pid_namespaces.7:252
8333 "B<CLONE_SIGHAND> requires being in the same PID namespace; otherwise the "
8334 "process ID of the process sending a signal could not be meaningfully encoded "
8335 "when a signal is sent (see the description of the I<siginfo_t> type in "
8336 "B<sigaction>(2)). A signal queue shared by processes in multiple PID "
8337 "namespaces will defeat that."
8341 #: build/C/man7/pid_namespaces.7:262
8343 "B<CLONE_VM> requires all of the threads to be in the same PID namespace, "
8344 "because, from the point of view of a core dump, if two processes share the "
8345 "same address space then they are threads and will be core dumped together. "
8346 "When a core dump is written, the PID of each thread is written into the core "
8347 "dump. Writing the process IDs could not meaningfully succeed if some of the "
8348 "process IDs were in a parent PID namespace."
8352 #: build/C/man7/pid_namespaces.7:280
8354 "To summarize: there is a technical requirement for each of B<CLONE_THREAD>, "
8355 "B<CLONE_SIGHAND>, and B<CLONE_VM> to share a PID namespace. (Note "
8356 "furthermore that in B<clone>(2) requires B<CLONE_VM> to be specified if "
8357 "B<CLONE_THREAD> or B<CLONE_SIGHAND> is specified.) Thus, call sequences "
8358 "such as the following will fail (with the error B<EINVAL>):"
8362 #: build/C/man7/pid_namespaces.7:284
8365 " unshare(CLONE_NEWPID);\n"
8366 " clone(..., CLONE_VM, ...); /* Fails */\n"
8370 #: build/C/man7/pid_namespaces.7:287
8373 " setns(fd, CLONE_NEWPID);\n"
8374 " clone(..., CLONE_VM, ...); /* Fails */\n"
8378 #: build/C/man7/pid_namespaces.7:290
8381 " clone(..., CLONE_VM, ...);\n"
8382 " setns(fd, CLONE_NEWPID); /* Fails */\n"
8386 #: build/C/man7/pid_namespaces.7:293
8389 " clone(..., CLONE_VM, ...);\n"
8390 " unshare(CLONE_NEWPID); /* Fails */\n"
8394 #. ============================================================
8396 #: build/C/man7/pid_namespaces.7:297
8398 msgid "/proc and PID namespaces"
8402 #: build/C/man7/pid_namespaces.7:306
8404 "A I</proc> filesystem shows (in the I</proc/PID> directories) only processes "
8405 "visible in the PID namespace of the process that performed the mount, even "
8406 "if the I</proc> filesystem is viewed from processes in other namespaces."
8410 #: build/C/man7/pid_namespaces.7:325
8412 "After creating a new PID namespace, it is useful for the child to change its "
8413 "root directory and mount a new procfs instance at I</proc> so that tools "
8414 "such as B<ps>(1) work correctly. If a new mount namespace is "
8415 "simultaneously created by including B<CLONE_NEWNS> in the I<flags> argument "
8416 "of B<clone>(2) or B<unshare>(2), then it isn't necessary to change the root "
8417 "directory: a new procfs instance can be mounted directly over I</proc>."
8421 #: build/C/man7/pid_namespaces.7:329
8422 msgid "From a shell, the command to mount I</proc> is:"
8426 #: build/C/man7/pid_namespaces.7:331
8428 msgid " $ mount -t proc proc /proc\n"
8432 #. ============================================================
8434 #: build/C/man7/pid_namespaces.7:343
8436 "Calling B<readlink>(2) on the path I</proc/self> yields the process ID of "
8437 "the caller in the PID namespace of the procfs mount (i.e., the PID namespace "
8438 "of the process that mounted the procfs). This can be useful for "
8439 "introspection purposes, when a process wants to discover its PID in other "
8444 #: build/C/man7/pid_namespaces.7:343 build/C/man7/user_namespaces.7:635
8446 msgid "Miscellaneous"
8450 #: build/C/man7/pid_namespaces.7:351
8452 "When a process ID is passed over a UNIX domain socket to a process in a "
8453 "different PID namespace (see the description of B<SCM_CREDENTIALS> in "
8454 "B<unix>(7)), it is translated into the corresponding PID value in the "
8455 "receiving process's PID namespace."
8459 #: build/C/man7/pid_namespaces.7:365
8461 "B<clone>(2), B<setns>(2), B<unshare>(2), B<proc>(5), B<credentials>(7), "
8462 "B<capabilities>(7), B<user_namespaces>(7), B<switch_root>(8)"
8466 #: build/C/man2/seteuid.2:29
8472 #: build/C/man2/seteuid.2:32
8473 msgid "seteuid, setegid - set effective user or group ID"
8477 #: build/C/man2/seteuid.2:38
8478 msgid "B<int seteuid(uid_t >I<euid>B<);>"
8482 #: build/C/man2/seteuid.2:40
8483 msgid "B<int setegid(gid_t >I<egid>B<);>"
8487 #: build/C/man2/seteuid.2:49
8488 msgid "B<seteuid>(), B<setegid>():"
8492 #: build/C/man2/seteuid.2:51
8494 "_BSD_SOURCE || _POSIX_C_SOURCE\\ E<gt>=\\ 200112L || _XOPEN_SOURCE\\ "
8499 #: build/C/man2/seteuid.2:58
8501 "B<seteuid>() sets the effective user ID of the calling process. "
8502 "Unprivileged user processes may only set the effective user ID to the real "
8503 "user ID, the effective user ID or the saved set-user-ID."
8508 #. equals \-1, nothing is changed.
8509 #. (This is an artifact of the implementation in glibc of seteuid()
8510 #. using setresuid(2).)
8512 #: build/C/man2/seteuid.2:67
8514 "Precisely the same holds for B<setegid>() with \"group\" instead of "
8519 #: build/C/man2/seteuid.2:79
8521 "I<Note>: there are cases where B<seteuid>() can fail even when the caller "
8522 "is UID 0; it is a grave security error to omit checking for a failure return "
8523 "from B<seteuid>()."
8527 #: build/C/man2/seteuid.2:83
8528 msgid "The target user or group ID is not valid in this user namespace."
8532 #: build/C/man2/seteuid.2:99
8534 "The calling process is not privileged (Linux: does not have the "
8535 "B<CAP_SETUID> capability in the case of B<seteuid>(), or the B<CAP_SETGID> "
8536 "capability in the case of B<setegid>()) and I<euid> (respectively, I<egid>) "
8537 "is not the real user (group) ID, the effective user (group) ID, or the saved "
8538 "set-user-ID (saved set-group-ID)."
8542 #: build/C/man2/seteuid.2:101
8543 msgid "4.3BSD, POSIX.1-2001."
8547 #: build/C/man2/seteuid.2:107
8549 "Setting the effective user (group) ID to the saved set-user-ID (saved "
8550 "set-group-ID) is possible since Linux 1.1.37 (1.1.38). On an arbitrary "
8551 "system one should check B<_POSIX_SAVED_IDS>."
8555 #: build/C/man2/seteuid.2:123
8557 "Under glibc 2.0 B<seteuid(>I<euid>B<)> is equivalent to B<setreuid(-1,>I< "
8558 "euid>B<)> and hence may change the saved set-user-ID. Under glibc 2.1 and "
8559 "later it is equivalent to B<setresuid(-1,>I< euid>B<, -1)> and hence does "
8560 "not change the saved set-user-ID. Analogous remarks hold for B<setegid>(), "
8561 "with the difference that the change in implementation from B<setregid(-1,>I< "
8562 "egid>B<)> to B<setresgid(-1,>I< egid>B<, -1)> occurred in glibc 2.2 or 2.3 "
8563 "(depending on the hardware architecture)."
8567 #: build/C/man2/seteuid.2:132
8569 "According to POSIX.1, B<seteuid>() (B<setegid>()) need not permit I<euid> "
8570 "(I<egid>) to be the same value as the current effective user (group) ID, "
8571 "and some implementations do not permit this."
8575 #: build/C/man2/seteuid.2:141
8577 "On Linux, B<seteuid>() and B<setegid>() are implemented as library "
8578 "functions that call, respectively, B<setreuid>(2) and B<setresgid>(2)."
8582 #: build/C/man2/seteuid.2:149
8584 "B<geteuid>(2), B<setresuid>(2), B<setreuid>(2), B<setuid>(2), "
8585 "B<capabilities>(7), B<credentials>(7), B<user_namespaces>(7)"
8589 #: build/C/man2/setfsgid.2:31
8595 #: build/C/man2/setfsgid.2:31 build/C/man2/setfsuid.2:31
8601 #: build/C/man2/setfsgid.2:34
8602 msgid "setfsgid - set group identity used for filesystem checks"
8606 #: build/C/man2/setfsgid.2:36 build/C/man2/setfsuid.2:36
8607 msgid "B<#include E<lt>sys/fsuid.hE<gt>>"
8611 #: build/C/man2/setfsgid.2:38
8612 msgid "B<int setfsgid(uid_t >I<fsgid>B<);>"
8616 #: build/C/man2/setfsgid.2:51
8618 "The system call B<setfsgid>() changes the value of the caller's filesystem "
8619 "group ID\\(emthe group ID that the Linux kernel uses to check for all "
8620 "accesses to the filesystem. Normally, the value of the filesystem group ID "
8621 "will shadow the value of the effective group ID. In fact, whenever the "
8622 "effective group ID is changed, the filesystem group ID will also be changed "
8623 "to the new value of the effective group ID."
8627 #: build/C/man2/setfsgid.2:62
8629 "Explicit calls to B<setfsuid>(2) and B<setfsgid>() are usually used only "
8630 "by programs such as the Linux NFS server that need to change what user and "
8631 "group ID is used for file access without a corresponding change in the real "
8632 "and effective user and group IDs. A change in the normal user IDs for a "
8633 "program such as the NFS server is a security hole that can expose it to "
8634 "unwanted signals. (But see below.)"
8638 #: build/C/man2/setfsgid.2:68
8640 "B<setfsgid>() will succeed only if the caller is the superuser or if "
8641 "I<fsgid> matches either the caller's real group ID, effective group ID, "
8642 "saved set-group-ID, or current the filesystem user ID."
8646 #: build/C/man2/setfsgid.2:71
8648 "On both success and failure, this call returns the previous filesystem group "
8652 #. This system call is present since Linux 1.1.44
8653 #. and in libc since libc 4.7.6.
8655 #: build/C/man2/setfsgid.2:75 build/C/man2/setfsuid.2:75
8656 msgid "This system call is present in Linux since version 1.2."
8660 #: build/C/man2/setfsgid.2:79
8662 "B<setfsgid>() is Linux-specific and should not be used in programs intended "
8667 #: build/C/man2/setfsgid.2:85
8669 "When glibc determines that the argument is not a valid group ID, it will "
8670 "return -1 and set I<errno> to B<EINVAL> without attempting the system call."
8674 #: build/C/man2/setfsgid.2:96
8676 "Note that at the time this system call was introduced, a process could send "
8677 "a signal to a process with the same effective user ID. Today signal "
8678 "permission handling is slightly different. See B<setfsuid>(2) for a "
8679 "discussion of why the use of both B<setfsuid>(2) and B<setfsgid>() is "
8680 "nowadays unneeded."
8684 #: build/C/man2/setfsgid.2:106
8686 "The original Linux B<setfsgid>() system call supported only 16-bit group "
8687 "IDs. Subsequently, Linux 2.4 added B<setfsgid32>() supporting 32-bit IDs. "
8688 "The glibc B<setfsgid>() wrapper function transparently deals with the "
8689 "variation across kernel versions."
8693 #: build/C/man2/setfsgid.2:123
8695 "No error indications of any kind are returned to the caller, and the fact "
8696 "that both successful and unsuccessful calls return the same value makes it "
8697 "impossible to directly determine whether the call succeeded or failed. "
8698 "Instead, the caller must resort to looking at the return value from a "
8699 "further call such as I<setfsgid(-1)> (which will always fail), in order to "
8700 "determine if a preceding call to B<setfsgid>() changed the filesystem group "
8701 "ID. At the very least, B<EPERM> should be returned when the call fails "
8702 "(because the caller lacks the B<CAP_SETGID> capability)."
8706 #: build/C/man2/setfsgid.2:128
8707 msgid "B<kill>(2), B<setfsuid>(2), B<capabilities>(7), B<credentials>(7)"
8711 #: build/C/man2/setfsuid.2:31
8717 #: build/C/man2/setfsuid.2:34
8718 msgid "setfsuid - set user identity used for filesystem checks"
8722 #: build/C/man2/setfsuid.2:38
8723 msgid "B<int setfsuid(uid_t >I<fsuid>B<);>"
8727 #: build/C/man2/setfsuid.2:51
8729 "The system call B<setfsuid>() changes the value of the caller's filesystem "
8730 "user ID\\(emthe user ID that the Linux kernel uses to check for all accesses "
8731 "to the filesystem. Normally, the value of the filesystem user ID will "
8732 "shadow the value of the effective user ID. In fact, whenever the effective "
8733 "user ID is changed, the filesystem user ID will also be changed to the new "
8734 "value of the effective user ID."
8738 #: build/C/man2/setfsuid.2:62
8740 "Explicit calls to B<setfsuid>() and B<setfsgid>(2) are usually used only "
8741 "by programs such as the Linux NFS server that need to change what user and "
8742 "group ID is used for file access without a corresponding change in the real "
8743 "and effective user and group IDs. A change in the normal user IDs for a "
8744 "program such as the NFS server is a security hole that can expose it to "
8745 "unwanted signals. (But see below.)"
8749 #: build/C/man2/setfsuid.2:68
8751 "B<setfsuid>() will succeed only if the caller is the superuser or if "
8752 "I<fsuid> matches either the caller's real user ID, effective user ID, saved "
8753 "set-user-ID, or current filesystem user ID."
8757 #: build/C/man2/setfsuid.2:71
8759 "On both success and failure, this call returns the previous filesystem user "
8764 #: build/C/man2/setfsuid.2:79
8766 "B<setfsuid>() is Linux-specific and should not be used in programs intended "
8771 #: build/C/man2/setfsuid.2:85
8773 "When glibc determines that the argument is not a valid user ID, it will "
8774 "return -1 and set I<errno> to B<EINVAL> without attempting the system call."
8778 #: build/C/man2/setfsuid.2:104
8780 "At the time when this system call was introduced, one process could send a "
8781 "signal to another process with the same effective user ID. This meant that "
8782 "if a privileged process changed its effective user ID for the purpose of "
8783 "file permission checking, then it could become vulnerable to receiving "
8784 "signals sent by another (unprivileged) process with the same user ID. The "
8785 "filesystem user ID attribute was thus added to allow a process to change its "
8786 "user ID for the purposes of file permission checking without at the same "
8787 "time becoming vulnerable to receiving unwanted signals. Since Linux 2.0, "
8788 "signal permission handling is different (see B<kill>(2)), with the result "
8789 "that a process change can change its effective user ID without being "
8790 "vulnerable to receiving signals from unwanted processes. Thus, "
8791 "B<setfsuid>() is nowadays unneeded and should be avoided in new "
8792 "applications (likewise for B<setfsgid>(2))."
8796 #: build/C/man2/setfsuid.2:114
8798 "The original Linux B<setfsuid>() system call supported only 16-bit user "
8799 "IDs. Subsequently, Linux 2.4 added B<setfsuid32>() supporting 32-bit IDs. "
8800 "The glibc B<setfsuid>() wrapper function transparently deals with the "
8801 "variation across kernel versions."
8805 #: build/C/man2/setfsuid.2:131
8807 "No error indications of any kind are returned to the caller, and the fact "
8808 "that both successful and unsuccessful calls return the same value makes it "
8809 "impossible to directly determine whether the call succeeded or failed. "
8810 "Instead, the caller must resort to looking at the return value from a "
8811 "further call such as I<setfsuid(-1)> (which will always fail), in order to "
8812 "determine if a preceding call to B<setfsuid>() changed the filesystem user "
8813 "ID. At the very least, B<EPERM> should be returned when the call fails "
8814 "(because the caller lacks the B<CAP_SETUID> capability)."
8818 #: build/C/man2/setfsuid.2:136
8819 msgid "B<kill>(2), B<setfsgid>(2), B<capabilities>(7), B<credentials>(7)"
8823 #: build/C/man2/setgid.2:29
8829 #: build/C/man2/setgid.2:32
8830 msgid "setgid - set group identity"
8834 #: build/C/man2/setgid.2:38
8835 msgid "B<int setgid(gid_t >I<gid>B<);>"
8839 #: build/C/man2/setgid.2:43
8841 "B<setgid>() sets the effective group ID of the calling process. If the "
8842 "caller is the superuser, the real GID and saved set-group-ID are also set."
8846 #: build/C/man2/setgid.2:53
8848 "Under Linux, B<setgid>() is implemented like the POSIX version with the "
8849 "B<_POSIX_SAVED_IDS> feature. This allows a set-group-ID program that is not "
8850 "set-user-ID-root to drop all of its group privileges, do some un-privileged "
8851 "work, and then reengage the original effective group ID in a secure manner."
8855 #: build/C/man2/setgid.2:64
8856 msgid "The group ID specified in I<gid> is not valid in this user namespace."
8860 #: build/C/man2/setgid.2:71
8862 "The calling process is not privileged (does not have the B<CAP_SETGID> "
8863 "capability), and I<gid> does not match the real group ID or saved "
8864 "set-group-ID of the calling process."
8868 #: build/C/man2/setgid.2:83
8870 "The original Linux B<setgid>() system call supported only 16-bit group "
8871 "IDs. Subsequently, Linux 2.4 added B<setgid32>() supporting 32-bit IDs. "
8872 "The glibc B<setgid>() wrapper function transparently deals with the "
8873 "variation across kernel versions."
8877 #: build/C/man2/setgid.2:90
8879 "B<getgid>(2), B<setegid>(2), B<setregid>(2), B<capabilities>(7), "
8880 "B<credentials>(7), B<user_namespaces>(7)"
8884 #: build/C/man2/setpgid.2:48
8890 #: build/C/man2/setpgid.2:48
8896 #: build/C/man2/setpgid.2:51
8897 msgid "setpgid, getpgid, setpgrp, getpgrp - set/get process group"
8901 #: build/C/man2/setpgid.2:55
8902 msgid "B<int setpgid(pid_t >I<pid>B<, pid_t >I<pgid>B<);>"
8906 #: build/C/man2/setpgid.2:57
8907 msgid "B<pid_t getpgid(pid_t >I<pid>B<);>"
8911 #: build/C/man2/setpgid.2:59
8912 msgid "B<pid_t getpgrp(void);> /* POSIX.1 version */"
8916 #: build/C/man2/setpgid.2:62
8918 "B<pid_t getpgrp(pid_t >I<pid>B<);\\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ > /* BSD "
8923 #: build/C/man2/setpgid.2:64
8924 msgid "B<int setpgrp(void);> /* System V version */"
8928 #: build/C/man2/setpgid.2:67
8929 msgid "B<int setpgrp(pid_t >I<pid>B<, pid_t >I<pgid>B<);\\ > /* BSD version */"
8933 #: build/C/man2/setpgid.2:76
8934 msgid "B<getpgid>():"
8938 #: build/C/man2/setpgid.2:84
8939 msgid "B<setpgrp>() (POSIX.1):"
8943 #: build/C/man2/setpgid.2:87
8946 " _SVID_SOURCE || _XOPEN_SOURCE\\ E<gt>=\\ 500 ||\n"
8947 " _XOPEN_SOURCE\\ &&\\ _XOPEN_SOURCE_EXTENDED\n"
8951 #: build/C/man2/setpgid.2:89
8953 msgid " || /* Since glibc 2.19: */ _BSD_SOURCE\n"
8957 #: build/C/man2/setpgid.2:93
8958 msgid "B<setpgrp>()\\ (BSD), B<getpgrp>()\\ (BSD) [before glibc 2.19]:"
8962 #: build/C/man2/setpgid.2:97
8966 " !\\ (_POSIX_SOURCE || _POSIX_C_SOURCE || _XOPEN_SOURCE ||\n"
8967 " _XOPEN_SOURCE_EXTENDED || _GNU_SOURCE || _SVID_SOURCE)\n"
8971 #: build/C/man2/setpgid.2:109
8973 "All of these interfaces are available on Linux, and are used for getting and "
8974 "setting the process group ID (PGID) of a process. The preferred, "
8975 "POSIX.1-specified ways of doing this are: B<getpgrp>(void), for retrieving "
8976 "the calling process's PGID; and B<setpgid>(), for setting a process's PGID."
8980 #: build/C/man2/setpgid.2:134
8982 "B<setpgid>() sets the PGID of the process specified by I<pid> to I<pgid>. "
8983 "If I<pid> is zero, then the process ID of the calling process is used. If "
8984 "I<pgid> is zero, then the PGID of the process specified by I<pid> is made "
8985 "the same as its process ID. If B<setpgid>() is used to move a process from "
8986 "one process group to another (as is done by some shells when creating "
8987 "pipelines), both process groups must be part of the same session (see "
8988 "B<setsid>(2) and B<credentials>(7)). In this case, the I<pgid> specifies "
8989 "an existing process group to be joined and the session ID of that group must "
8990 "match the session ID of the joining process."
8994 #: build/C/man2/setpgid.2:139
8996 "The POSIX.1 version of B<getpgrp>(), which takes no arguments, returns the "
8997 "PGID of the calling process."
9001 #: build/C/man2/setpgid.2:150
9003 "B<getpgid>() returns the PGID of the process specified by I<pid>. If "
9004 "I<pid> is zero, the process ID of the calling process is used. (Retrieving "
9005 "the PGID of a process other than the caller is rarely necessary, and the "
9006 "POSIX.1 B<getpgrp>() is preferred for that task.)"
9010 #: build/C/man2/setpgid.2:155
9012 "The System\\ V-style B<setpgrp>(), which takes no arguments, is equivalent "
9013 "to I<setpgid(0,\\ 0)>."
9017 #: build/C/man2/setpgid.2:163
9019 "The BSD-specific B<setpgrp>() call, which takes arguments I<pid> and "
9020 "I<pgid>, is is a wrapper function that calls"
9024 #: build/C/man2/setpgid.2:165
9026 msgid " setpgid(pid, pgid)\n"
9029 #. The true BSD setpgrp() system call differs in allowing the PGID
9030 #. to be set to arbitrary values, rather than being restricted to
9031 #. PGIDs in the same session.
9033 #: build/C/man2/setpgid.2:176
9035 "Since glibc 2.19, the BSD-specific B<setpgrp>() function is no longer "
9036 "exposed by I<E<lt>unistd.hE<gt>>; calls should be replaced with the "
9037 "B<setpgid>() call shown above."
9041 #: build/C/man2/setpgid.2:182
9043 "The BSD-specific B<getpgrp>() call, which takes a single I<pid> argument, "
9044 "is a wrapper function that calls"
9048 #: build/C/man2/setpgid.2:184
9050 msgid " getpgid(pid)\n"
9054 #: build/C/man2/setpgid.2:195
9056 "Since glibc 2.19, the BSD-specific B<getpgrp>() function is no longer "
9057 "exposed by I<E<lt>unistd.hE<gt>>; calls should be replaced with calls to the "
9058 "POSIX.1 B<getpgrp>() which takes no arguments (if the intent is to obtain "
9059 "the caller's PGID), or with the B<getpgid>() call shown above."
9063 #: build/C/man2/setpgid.2:204
9065 "On success, B<setpgid>() and B<setpgrp>() return zero. On error, -1 is "
9066 "returned, and I<errno> is set appropriately."
9070 #: build/C/man2/setpgid.2:208
9071 msgid "The POSIX.1 B<getpgrp>() always returns the PGID of the caller."
9075 #: build/C/man2/setpgid.2:216
9077 "B<getpgid>(), and the BSD-specific B<getpgrp>() return a process group on "
9078 "success. On error, -1 is returned, and I<errno> is set appropriately."
9082 #: build/C/man2/setpgid.2:225
9084 "An attempt was made to change the process group ID of one of the children of "
9085 "the calling process and the child had already performed an B<execve>(2) "
9086 "(B<setpgid>(), B<setpgrp>())."
9090 #: build/C/man2/setpgid.2:231
9091 msgid "I<pgid> is less than 0 (B<setpgid>(), B<setpgrp>())."
9095 #: build/C/man2/setpgid.2:240
9097 "An attempt was made to move a process into a process group in a different "
9098 "session, or to change the process group ID of one of the children of the "
9099 "calling process and the child was in a different session, or to change the "
9100 "process group ID of a session leader (B<setpgid>(), B<setpgrp>())."
9104 #: build/C/man2/setpgid.2:250
9106 "For B<getpgid>(): I<pid> does not match any process. For B<setpgid>(): "
9107 "I<pid> is not the calling process and not a child of the calling process."
9111 #: build/C/man2/setpgid.2:256
9113 "B<setpgid>() and the version of B<getpgrp>() with no arguments conform to "
9118 #: build/C/man2/setpgid.2:265
9120 "POSIX.1-2001 also specifies B<getpgid>() and the version of B<setpgrp>() "
9121 "that takes no arguments. (POSIX.1-2008 marks this B<setpgrp>() "
9122 "specification as obsolete.)"
9126 #: build/C/man2/setpgid.2:272
9128 "The version of B<getpgrp>() with one argument and the version of "
9129 "B<setpgrp>() that takes two arguments derive from 4.2BSD, and are not "
9130 "specified by POSIX.1."
9134 #: build/C/man2/setpgid.2:278
9136 "A child created via B<fork>(2) inherits its parent's process group ID. The "
9137 "PGID is preserved across an B<execve>(2)."
9141 #: build/C/man2/setpgid.2:281
9143 "Each process group is a member of a session and each process is a member of "
9144 "the session of which its process group is a member."
9148 #: build/C/man2/setpgid.2:308
9150 "A session can have a controlling terminal. At any time, one (and only one) "
9151 "of the process groups in the session can be the foreground process group for "
9152 "the terminal; the remaining process groups are in the background. If a "
9153 "signal is generated from the terminal (e.g., typing the interrupt key to "
9154 "generate B<SIGINT>), that signal is sent to the foreground process group. "
9155 "(See B<termios>(3) for a description of the characters that generate "
9156 "signals.) Only the foreground process group may B<read>(2) from the "
9157 "terminal; if a background process group tries to B<read>(2) from the "
9158 "terminal, then the group is sent a B<SIGTTIN> signal, which suspends it. "
9159 "The B<tcgetpgrp>(3) and B<tcsetpgrp>(3) functions are used to get/set the "
9160 "foreground process group of the controlling terminal."
9164 #: build/C/man2/setpgid.2:316
9166 "The B<setpgid>() and B<getpgrp>() calls are used by programs such as "
9167 "B<bash>(1) to create process groups in order to implement shell job "
9172 #: build/C/man2/setpgid.2:326
9174 "If a session has a controlling terminal, and the B<CLOCAL> flag for that "
9175 "terminal is not set, and a terminal hangup occurs, then the session leader "
9176 "is sent a B<SIGHUP>. If the session leader exits, then a B<SIGHUP> signal "
9177 "will also be sent to each process in the foreground process group of the "
9178 "controlling terminal."
9181 #. exit.3 refers to the following text:
9183 #: build/C/man2/setpgid.2:340
9185 "If the exit of the process causes a process group to become orphaned, and if "
9186 "any member of the newly orphaned process group is stopped, then a B<SIGHUP> "
9187 "signal followed by a B<SIGCONT> signal will be sent to each process in the "
9188 "newly orphaned process group. An orphaned process group is one in which the "
9189 "parent of every member of process group is either itself also a member of "
9190 "the process group or is a member of a process group in a different session "
9191 "(see also B<credentials>(7))."
9195 #: build/C/man2/setpgid.2:347
9197 "B<getuid>(2), B<setsid>(2), B<tcgetpgrp>(3), B<tcsetpgrp>(3), B<termios>(3), "
9202 #: build/C/man2/setresuid.2:26
9208 #: build/C/man2/setresuid.2:29
9209 msgid "setresuid, setresgid - set real, effective and saved user or group ID"
9213 #: build/C/man2/setresuid.2:35
9214 msgid "B<int setresuid(uid_t >I<ruid>B<, uid_t >I<euid>B<, uid_t >I<suid>B<);>"
9218 #: build/C/man2/setresuid.2:37
9219 msgid "B<int setresgid(gid_t >I<rgid>B<, gid_t >I<egid>B<, gid_t >I<sgid>B<);>"
9223 #: build/C/man2/setresuid.2:41
9225 "B<setresuid>() sets the real user ID, the effective user ID, and the saved "
9226 "set-user-ID of the calling process."
9230 #: build/C/man2/setresuid.2:47
9232 "Unprivileged user processes may change the real UID, effective UID, and "
9233 "saved set-user-ID, each to one of: the current real UID, the current "
9234 "effective UID or the current saved set-user-ID."
9238 #: build/C/man2/setresuid.2:51
9240 "Privileged processes (on Linux, those having the B<CAP_SETUID> capability) "
9241 "may set the real UID, effective UID, and saved set-user-ID to arbitrary "
9246 #: build/C/man2/setresuid.2:53
9247 msgid "If one of the arguments equals -1, the corresponding value is not changed."
9251 #: build/C/man2/setresuid.2:57
9253 "Regardless of what changes are made to the real UID, effective UID, and "
9254 "saved set-user-ID, the filesystem UID is always set to the same value as the "
9255 "(possibly new) effective UID."
9259 #: build/C/man2/setresuid.2:64
9261 "Completely analogously, B<setresgid>() sets the real GID, effective GID, "
9262 "and saved set-group-ID of the calling process (and always modifies the "
9263 "filesystem GID to be the same as the effective GID), with the same "
9264 "restrictions for unprivileged processes."
9268 #: build/C/man2/setresuid.2:76
9270 "I<Note>: there are cases where B<setresuid>() can fail even when the caller "
9271 "is UID 0; it is a grave security error to omit checking for a failure return "
9272 "from B<setresuid>()."
9276 #: build/C/man2/setresuid.2:77 build/C/man2/setresuid.2:84 build/C/man2/setreuid.2:106 build/C/man2/setreuid.2:113 build/C/man2/setuid.2:83 build/C/man2/setuid.2:90
9282 #: build/C/man2/setresuid.2:84 build/C/man2/setreuid.2:113
9284 "The call would change the caller's real UID (i.e., I<ruid> does not match "
9285 "the caller's real UID), but there was a temporary failure allocating the "
9286 "necessary kernel data structures."
9290 #: build/C/man2/setresuid.2:99 build/C/man2/setreuid.2:128
9292 "I<ruid> does not match the caller's real UID and this call would bring the "
9293 "number of processes belonging to the real user ID I<ruid> over the caller's "
9294 "B<RLIMIT_NPROC> resource limit. Since Linux 3.1, this error case no longer "
9295 "occurs (but robust applications should check for this error); see the "
9296 "description of B<EAGAIN> in B<execve>(2)."
9300 #: build/C/man2/setresuid.2:103 build/C/man2/setreuid.2:132
9302 "One or more of the target user or group IDs is not valid in this user "
9307 #: build/C/man2/setresuid.2:107
9309 "The calling process is not privileged (did not have the B<CAP_SETUID> "
9310 "capability) and tried to change the IDs to values that are not permitted."
9314 #: build/C/man2/setresuid.2:109
9315 msgid "These calls are available under Linux since Linux 2.1.44."
9319 #: build/C/man2/setresuid.2:116
9321 "Under HP-UX and FreeBSD, the prototype is found in I<E<lt>unistd.hE<gt>>. "
9322 "Under Linux, the prototype is provided by glibc since version 2.3.2."
9326 #: build/C/man2/setresuid.2:132
9328 "The original Linux B<setresuid>() and B<setresgid>() system calls "
9329 "supported only 16-bit user and group IDs. Subsequently, Linux 2.4 added "
9330 "B<setresuid32>() and B<setresgid32>(), supporting 32-bit IDs. The glibc "
9331 "B<setresuid>() and B<setresgid>() wrapper functions transparently deal "
9332 "with the variations across kernel versions."
9336 #: build/C/man2/setresuid.2:142
9338 "B<getresuid>(2), B<getuid>(2), B<setfsgid>(2), B<setfsuid>(2), "
9339 "B<setreuid>(2), B<setuid>(2), B<capabilities>(7), B<credentials>(7), "
9340 "B<user_namespaces>(7)"
9344 #: build/C/man2/setreuid.2:45
9350 #: build/C/man2/setreuid.2:48
9351 msgid "setreuid, setregid - set real and/or effective user or group ID"
9355 #: build/C/man2/setreuid.2:54
9356 msgid "B<int setreuid(uid_t >I<ruid>B<, uid_t >I<euid>B<);>"
9360 #: build/C/man2/setreuid.2:56
9361 msgid "B<int setregid(gid_t >I<rgid>B<, gid_t >I<egid>B<);>"
9365 #: build/C/man2/setreuid.2:64
9366 msgid "B<setreuid>(), B<setregid>():"
9370 #: build/C/man2/setreuid.2:68
9372 "_BSD_SOURCE || _XOPEN_SOURCE\\ E<gt>=\\ 500 || _XOPEN_SOURCE\\ &&\\ "
9373 "_XOPEN_SOURCE_EXTENDED"
9377 #: build/C/man2/setreuid.2:73
9378 msgid "B<setreuid>() sets real and effective user IDs of the calling process."
9382 #: build/C/man2/setreuid.2:76
9384 "Supplying a value of -1 for either the real or effective user ID forces the "
9385 "system to leave that ID unchanged."
9389 #: build/C/man2/setreuid.2:79
9391 "Unprivileged processes may only set the effective user ID to the real user "
9392 "ID, the effective user ID, or the saved set-user-ID."
9396 #: build/C/man2/setreuid.2:82
9398 "Unprivileged users may only set the real user ID to the real user ID or the "
9399 "effective user ID."
9403 #: build/C/man2/setreuid.2:88
9405 "If the real user ID is set (i.e., I<ruid> is not -1) or the effective user "
9406 "ID is set to a value not equal to the previous real user ID, the saved "
9407 "set-user-ID will be set to the new effective user ID."
9411 #: build/C/man2/setreuid.2:93
9413 "Completely analogously, B<setregid>() sets real and effective group ID's of "
9414 "the calling process, and all of the above holds with \"group\" instead of "
9419 #: build/C/man2/setreuid.2:105
9421 "I<Note>: there are cases where B<setreuid>() can fail even when the caller "
9422 "is UID 0; it is a grave security error to omit checking for a failure return "
9423 "from B<setreuid>()."
9427 #: build/C/man2/setreuid.2:148
9429 "The calling process is not privileged (Linux: does not have the "
9430 "B<CAP_SETUID> capability in the case of B<setreuid>(), or the B<CAP_SETGID> "
9431 "capability in the case of B<setregid>()) and a change other than (i) "
9432 "swapping the effective user (group) ID with the real user (group) ID, or "
9433 "(ii) setting one to the value of the other or (iii) setting the effective "
9434 "user (group) ID to the value of the saved set-user-ID (saved set-group-ID) "
9439 #: build/C/man2/setreuid.2:154
9441 "POSIX.1-2001, 4.3BSD (the B<setreuid>() and B<setregid>() function calls "
9442 "first appeared in 4.2BSD)."
9446 #: build/C/man2/setreuid.2:158
9448 "Setting the effective user (group) ID to the saved set-user-ID (saved "
9449 "set-group-ID) is possible since Linux 1.1.37 (1.1.38)."
9453 #: build/C/man2/setreuid.2:175
9455 "POSIX.1 does not specify all of possible ID changes that are permitted on "
9456 "Linux for an unprivileged process. For B<setreuid>(), the effective user ID "
9457 "can be made the same as the real user ID or the save set-user-ID, and it is "
9458 "unspecified whether unprivileged processes may set the real user ID to the "
9459 "real user ID, the effective user ID, or the saved set-user-ID. For "
9460 "B<setregid>(), the real group ID can be changed to the value of the saved "
9461 "set-group-ID, and the effective group ID can be changed to the value of the "
9462 "real group ID or the saved set-group-ID. The precise details of what ID "
9463 "changes are permitted vary across implementations."
9467 #: build/C/man2/setreuid.2:178
9469 "POSIX.1 makes no specification about the effect of these calls on the saved "
9470 "set-user-ID and saved set-group-ID."
9474 #: build/C/man2/setreuid.2:194
9476 "The original Linux B<setreuid>() and B<setregid>() system calls supported "
9477 "only 16-bit user and group IDs. Subsequently, Linux 2.4 added "
9478 "B<setreuid32>() and B<setregid32>(), supporting 32-bit IDs. The glibc "
9479 "B<setreuid>() and B<setregid>() wrapper functions transparently deal with "
9480 "the variations across kernel versions."
9484 #: build/C/man2/setreuid.2:203
9486 "B<getgid>(2), B<getuid>(2), B<seteuid>(2), B<setgid>(2), B<setresuid>(2), "
9487 "B<setuid>(2), B<capabilities>(7), B<user_namespaces>(7)"
9491 #: build/C/man2/setsid.2:31
9497 #: build/C/man2/setsid.2:34
9498 msgid "setsid - creates a session and sets the process group ID"
9502 #: build/C/man2/setsid.2:39
9503 msgid "B<pid_t setsid(void);>"
9507 #: build/C/man2/setsid.2:50
9509 "B<setsid>() creates a new session if the calling process is not a process "
9510 "group leader. The calling process is the leader of the new session (i.e., "
9511 "its session ID is made the same as it process ID). The calling process also "
9512 "becomes the process group leader of a new process group in the session "
9513 "(i.e., its process group ID is made the same as it process ID)."
9517 #: build/C/man2/setsid.2:54
9519 "The calling process will be the only process in the new process group and in "
9520 "the new session. The new session has no controlling terminal."
9524 #: build/C/man2/setsid.2:61
9526 "On success, the (new) session ID of the calling process is returned. On "
9527 "error, I<(pid_t)\\ -1> is returned, and I<errno> is set to indicate the "
9532 #: build/C/man2/setsid.2:68
9534 "The process group ID of any process equals the PID of the calling process. "
9535 "Thus, in particular, B<setsid>() fails if the calling process is already a "
9536 "process group leader."
9540 #: build/C/man2/setsid.2:76
9542 "A child created via B<fork>(2) inherits its parent's session ID. The "
9543 "session ID is preserved across an B<execve>(2)."
9547 #: build/C/man2/setsid.2:93
9549 "A process group leader is a process whose process group ID equals its PID. "
9550 "Disallowing a process group leader from calling B<setsid>() prevents the "
9551 "possibility that a process group leader places itself in a new session while "
9552 "other processes in the process group remain in the original session; such a "
9553 "scenario would break the strict two-level hierarchy of sessions and process "
9554 "groups. In order to be sure that B<setsid>() will succeed, B<fork>(2) and "
9555 "B<_exit>(2), and have the child do B<setsid>()."
9559 #: build/C/man2/setsid.2:100
9561 "B<setsid>(1), B<getsid>(2), B<setpgid>(2), B<setpgrp>(2), B<tcgetsid>(3), "
9566 #: build/C/man2/setuid.2:30
9572 #: build/C/man2/setuid.2:33
9573 msgid "setuid - set user identity"
9577 #: build/C/man2/setuid.2:39
9578 msgid "B<int setuid(uid_t >I<uid>B<);>"
9582 #: build/C/man2/setuid.2:44
9584 "B<setuid>() sets the effective user ID of the calling process. If the "
9585 "effective UID of the caller is root, the real UID and saved set-user-ID are "
9590 #: build/C/man2/setuid.2:53
9592 "Under Linux, B<setuid>() is implemented like the POSIX version with the "
9593 "B<_POSIX_SAVED_IDS> feature. This allows a set-user-ID (other than root) "
9594 "program to drop all of its user privileges, do some un-privileged work, and "
9595 "then reengage the original effective user ID in a secure manner."
9599 #: build/C/man2/setuid.2:63
9601 "If the user is root or the program is set-user-ID-root, special care must be "
9602 "taken. The B<setuid>() function checks the effective user ID of the caller "
9603 "and if it is the superuser, all process-related user ID's are set to "
9604 "I<uid>. After this has occurred, it is impossible for the program to regain "
9609 #: build/C/man2/setuid.2:70
9611 "Thus, a set-user-ID-root program wishing to temporarily drop root "
9612 "privileges, assume the identity of an unprivileged user, and then regain "
9613 "root privileges afterward cannot use B<setuid>(). You can accomplish this "
9614 "with B<seteuid>(2)."
9618 #: build/C/man2/setuid.2:82
9620 "I<Note>: there are cases where B<setuid>() can fail even when the caller is "
9621 "UID 0; it is a grave security error to omit checking for a failure return "
9626 #: build/C/man2/setuid.2:90
9628 "The call would change the caller's real UID (i.e., I<uid> does not match the "
9629 "caller's real UID), but there was a temporary failure allocating the "
9630 "necessary kernel data structures."
9634 #: build/C/man2/setuid.2:105
9636 "I<uid> does not match the real user ID of the caller and this call would "
9637 "bring the number of processes belonging to the real user ID I<uid> over the "
9638 "caller's B<RLIMIT_NPROC> resource limit. Since Linux 3.1, this error case "
9639 "no longer occurs (but robust applications should check for this error); see "
9640 "the description of B<EAGAIN> in B<execve>(2)."
9644 #: build/C/man2/setuid.2:110
9645 msgid "The user ID specified in I<uid> is not valid in this user namespace."
9649 #: build/C/man2/setuid.2:117
9651 "The user is not privileged (Linux: does not have the B<CAP_SETUID> "
9652 "capability) and I<uid> does not match the real UID or saved set-user-ID of "
9653 "the calling process."
9656 #. SVr4 documents an additional EINVAL error condition.
9658 #: build/C/man2/setuid.2:122
9660 "SVr4, POSIX.1-2001. Not quite compatible with the 4.4BSD call, which sets "
9661 "all of the real, saved, and effective user IDs."
9665 #: build/C/man2/setuid.2:130
9667 "Linux has the concept of the filesystem user ID, normally equal to the "
9668 "effective user ID. The B<setuid>() call also sets the filesystem user ID "
9669 "of the calling process. See B<setfsuid>(2)."
9673 #: build/C/man2/setuid.2:135
9675 "If I<uid> is different from the old effective UID, the process will be "
9676 "forbidden from leaving core dumps."
9680 #: build/C/man2/setuid.2:145
9682 "The original Linux B<setuid>() system call supported only 16-bit user IDs. "
9683 "Subsequently, Linux 2.4 added B<setuid32>() supporting 32-bit IDs. The "
9684 "glibc B<setuid>() wrapper function transparently deals with the variation "
9685 "across kernel versions."
9689 #: build/C/man2/setuid.2:153
9691 "B<getuid>(2), B<seteuid>(2), B<setfsuid>(2), B<setreuid>(2), "
9692 "B<capabilities>(7), B<credentials>(7), B<user_namespaces>(7)"
9696 #: build/C/man7/svipc.7:40
9702 #: build/C/man7/svipc.7:43
9703 msgid "svipc - System V interprocess communication mechanisms"
9707 #: build/C/man7/svipc.7:48
9710 "B<#include E<lt>sys/msg.hE<gt>>\n"
9711 "B<#include E<lt>sys/sem.hE<gt>>\n"
9712 "B<#include E<lt>sys/shm.hE<gt>>\n"
9716 #: build/C/man7/svipc.7:56
9718 "This manual page refers to the Linux implementation of the System V "
9719 "interprocess communication (IPC) mechanisms: message queues, semaphore sets, "
9720 "and shared memory segments. In the following, the word I<resource> means an "
9721 "instantiation of one among such mechanisms."
9725 #: build/C/man7/svipc.7:56
9727 msgid "Resource access permissions"
9731 #: build/C/man7/svipc.7:64
9733 "For each resource, the system uses a common structure of type I<struct "
9734 "ipc_perm> to store information needed in determining permissions to perform "
9735 "an IPC operation. The I<ipc_perm> structure includes the following members:"
9739 #: build/C/man7/svipc.7:74
9742 "struct ipc_perm {\n"
9743 " uid_t cuid; /* creator user ID */\n"
9744 " gid_t cgid; /* creator group ID */\n"
9745 " uid_t uid; /* owner user ID */\n"
9746 " gid_t gid; /* owner group ID */\n"
9747 " unsigned short mode; /* r/w permissions */\n"
9752 #: build/C/man7/svipc.7:84
9754 "The I<mode> member of the I<ipc_perm> structure defines, with its lower 9 "
9755 "bits, the access permissions to the resource for a process executing an IPC "
9756 "system call. The permissions are interpreted as follows:"
9760 #: build/C/man7/svipc.7:88
9763 " 0400 Read by user.\n"
9764 " 0200 Write by user.\n"
9768 #: build/C/man7/svipc.7:91
9771 " 0040 Read by group.\n"
9772 " 0020 Write by group.\n"
9776 #: build/C/man7/svipc.7:94
9779 " 0004 Read by others.\n"
9780 " 0002 Write by others.\n"
9784 #: build/C/man7/svipc.7:102
9786 "Bits 0100, 0010, and 0001 (the execute bits) are unused by the system. "
9787 "Furthermore, \"write\" effectively means \"alter\" for a semaphore set."
9791 #: build/C/man7/svipc.7:105
9792 msgid "The same system header file also defines the following symbolic constants:"
9796 #: build/C/man7/svipc.7:105
9798 msgid "B<IPC_CREAT>"
9802 #: build/C/man7/svipc.7:108
9803 msgid "Create entry if key doesn't exist."
9807 #: build/C/man7/svipc.7:108
9813 #: build/C/man7/svipc.7:111
9814 msgid "Fail if key exists."
9818 #: build/C/man7/svipc.7:111
9820 msgid "B<IPC_NOWAIT>"
9824 #: build/C/man7/svipc.7:114
9825 msgid "Error if request must wait."
9829 #: build/C/man7/svipc.7:114
9831 msgid "B<IPC_PRIVATE>"
9835 #: build/C/man7/svipc.7:117
9836 msgid "Private key."
9840 #: build/C/man7/svipc.7:117
9846 #: build/C/man7/svipc.7:120
9847 msgid "Remove resource."
9851 #: build/C/man7/svipc.7:120
9857 #: build/C/man7/svipc.7:123
9858 msgid "Set resource options."
9862 #: build/C/man7/svipc.7:123
9868 #: build/C/man7/svipc.7:126
9869 msgid "Get resource options."
9873 #: build/C/man7/svipc.7:135
9875 "Note that B<IPC_PRIVATE> is a I<key_t> type, while all the other symbolic "
9876 "constants are flag fields and can be OR'ed into an I<int> type variable."
9880 #: build/C/man7/svipc.7:135
9882 msgid "Message queues"
9886 #: build/C/man7/svipc.7:143
9888 "A message queue is uniquely identified by a positive integer (its I<msqid>) "
9889 "and has an associated data structure of type I<struct msqid_ds>, defined in "
9890 "I<E<lt>sys/msg.hE<gt>>, containing the following members:"
9894 #: build/C/man7/svipc.7:156
9897 "struct msqid_ds {\n"
9898 " struct ipc_perm msg_perm;\n"
9899 " msgqnum_t msg_qnum; /* no of messages on queue */\n"
9900 " msglen_t msg_qbytes; /* bytes max on a queue */\n"
9901 " pid_t msg_lspid; /* PID of last msgsnd(2) call */\n"
9902 " pid_t msg_lrpid; /* PID of last msgrcv(2) call */\n"
9903 " time_t msg_stime; /* last msgsnd(2) time */\n"
9904 " time_t msg_rtime; /* last msgrcv(2) time */\n"
9905 " time_t msg_ctime; /* last change time */\n"
9910 #: build/C/man7/svipc.7:158
9916 #: build/C/man7/svipc.7:163
9918 "I<ipc_perm> structure that specifies the access permissions on the message "
9923 #: build/C/man7/svipc.7:163
9929 #: build/C/man7/svipc.7:166
9930 msgid "Number of messages currently on the message queue."
9934 #: build/C/man7/svipc.7:166
9936 msgid "I<msg_qbytes>"
9940 #: build/C/man7/svipc.7:170
9941 msgid "Maximum number of bytes of message text allowed on the message queue."
9945 #: build/C/man7/svipc.7:170
9947 msgid "I<msg_lspid>"
9951 #: build/C/man7/svipc.7:175
9952 msgid "ID of the process that performed the last B<msgsnd>(2) system call."
9956 #: build/C/man7/svipc.7:175
9958 msgid "I<msg_lrpid>"
9962 #: build/C/man7/svipc.7:180
9963 msgid "ID of the process that performed the last B<msgrcv>(2) system call."
9967 #: build/C/man7/svipc.7:180
9969 msgid "I<msg_stime>"
9973 #: build/C/man7/svipc.7:185
9974 msgid "Time of the last B<msgsnd>(2) system call."
9978 #: build/C/man7/svipc.7:185
9980 msgid "I<msg_rtime>"
9984 #: build/C/man7/svipc.7:190
9985 msgid "Time of the last B<msgrcv>(2) system call."
9989 #: build/C/man7/svipc.7:190
9991 msgid "I<msg_ctime>"
9995 #: build/C/man7/svipc.7:196
9997 "Time of the last system call that changed a member of the I<msqid_ds> "
10002 #: build/C/man7/svipc.7:196
10004 msgid "Semaphore sets"
10007 #. type: Plain text
10008 #: build/C/man7/svipc.7:204
10010 "A semaphore set is uniquely identified by a positive integer (its I<semid>) "
10011 "and has an associated data structure of type I<struct semid_ds>, defined in "
10012 "I<E<lt>sys/sem.hE<gt>>, containing the following members:"
10015 #. type: Plain text
10016 #: build/C/man7/svipc.7:213
10019 "struct semid_ds {\n"
10020 " struct ipc_perm sem_perm;\n"
10021 " time_t sem_otime; /* last operation time */\n"
10022 " time_t sem_ctime; /* last change time */\n"
10023 " unsigned long sem_nsems; /* count of sems in set */\n"
10028 #: build/C/man7/svipc.7:215
10030 msgid "I<sem_perm>"
10033 #. type: Plain text
10034 #: build/C/man7/svipc.7:220
10036 "I<ipc_perm> structure that specifies the access permissions on the semaphore "
10041 #: build/C/man7/svipc.7:220
10043 msgid "I<sem_otime>"
10046 #. type: Plain text
10047 #: build/C/man7/svipc.7:225
10048 msgid "Time of last B<semop>(2) system call."
10052 #: build/C/man7/svipc.7:225
10054 msgid "I<sem_ctime>"
10057 #. type: Plain text
10058 #: build/C/man7/svipc.7:231
10060 "Time of last B<semctl>(2) system call that changed a member of the above "
10061 "structure or of one semaphore belonging to the set."
10065 #: build/C/man7/svipc.7:231
10067 msgid "I<sem_nsems>"
10070 #. type: Plain text
10071 #: build/C/man7/svipc.7:239
10073 "Number of semaphores in the set. Each semaphore of the set is referenced by "
10074 "a nonnegative integer ranging from B<0> to I<sem_nsems-1>."
10077 #. type: Plain text
10078 #: build/C/man7/svipc.7:243
10080 "A semaphore is a data structure of type I<struct sem> containing the "
10081 "following members:"
10084 #. unsigned short semncnt; /* nr awaiting semval to increase */
10085 #. unsigned short semzcnt; /* nr awaiting semval = 0 */
10086 #. type: Plain text
10087 #: build/C/man7/svipc.7:252
10091 " int semval; /* semaphore value */\n"
10092 " int sempid; /* PID for last operation */\n"
10097 #: build/C/man7/svipc.7:254
10102 #. type: Plain text
10103 #: build/C/man7/svipc.7:257
10104 msgid "Semaphore value: a nonnegative integer."
10108 #: build/C/man7/svipc.7:257
10115 #. Number of processes suspended awaiting for
10120 #. Number of processes suspended awaiting for
10123 #. type: Plain text
10124 #: build/C/man7/svipc.7:271
10126 "ID of the last process that performed a semaphore operation on this "
10131 #: build/C/man7/svipc.7:271
10133 msgid "Shared memory segments"
10136 #. type: Plain text
10137 #: build/C/man7/svipc.7:279
10139 "A shared memory segment is uniquely identified by a positive integer (its "
10140 "I<shmid>) and has an associated data structure of type I<struct shmid_ds>, "
10141 "defined in I<E<lt>sys/shm.hE<gt>>, containing the following members:"
10144 #. type: Plain text
10145 #: build/C/man7/svipc.7:292
10148 "struct shmid_ds {\n"
10149 " struct ipc_perm shm_perm;\n"
10150 " size_t shm_segsz; /* size of segment */\n"
10151 " pid_t shm_cpid; /* PID of creator */\n"
10152 " pid_t shm_lpid; /* PID, last operation */\n"
10153 " shmatt_t shm_nattch; /* no. of current attaches */\n"
10154 " time_t shm_atime; /* time of last attach */\n"
10155 " time_t shm_dtime; /* time of last detach */\n"
10156 " time_t shm_ctime; /* time of last change */\n"
10161 #: build/C/man7/svipc.7:294
10163 msgid "I<shm_perm>"
10166 #. type: Plain text
10167 #: build/C/man7/svipc.7:299
10169 "I<ipc_perm> structure that specifies the access permissions on the shared "
10174 #: build/C/man7/svipc.7:299
10176 msgid "I<shm_segsz>"
10179 #. type: Plain text
10180 #: build/C/man7/svipc.7:302
10181 msgid "Size in bytes of the shared memory segment."
10185 #: build/C/man7/svipc.7:302
10187 msgid "I<shm_cpid>"
10190 #. type: Plain text
10191 #: build/C/man7/svipc.7:305
10192 msgid "ID of the process that created the shared memory segment."
10196 #: build/C/man7/svipc.7:305
10198 msgid "I<shm_lpid>"
10201 #. type: Plain text
10202 #: build/C/man7/svipc.7:312
10204 "ID of the last process that executed a B<shmat>(2) or B<shmdt>(2) system "
10209 #: build/C/man7/svipc.7:312
10211 msgid "I<shm_nattch>"
10214 #. type: Plain text
10215 #: build/C/man7/svipc.7:315
10216 msgid "Number of current alive attaches for this shared memory segment."
10220 #: build/C/man7/svipc.7:315
10222 msgid "I<shm_atime>"
10225 #. type: Plain text
10226 #: build/C/man7/svipc.7:320
10227 msgid "Time of the last B<shmat>(2) system call."
10231 #: build/C/man7/svipc.7:320
10233 msgid "I<shm_dtime>"
10236 #. type: Plain text
10237 #: build/C/man7/svipc.7:325
10238 msgid "Time of the last B<shmdt>(2) system call."
10242 #: build/C/man7/svipc.7:325
10244 msgid "I<shm_ctime>"
10247 #. type: Plain text
10248 #: build/C/man7/svipc.7:331
10249 msgid "Time of the last B<shmctl>(2) system call that changed I<shmid_ds>."
10253 #: build/C/man7/svipc.7:331
10255 msgid "IPC namespaces"
10258 #. type: Plain text
10259 #: build/C/man7/svipc.7:335
10261 "For a discussion of the interaction of System V IPC objects and IPC "
10262 "namespaces, see B<namespaces>(7)."
10265 #. type: Plain text
10266 #: build/C/man7/svipc.7:353
10268 "B<ipcmk>(1), B<ipcrm>(1), B<ipcs>(1), B<ipc>(2), B<msgctl>(2), B<msgget>(2), "
10269 "B<msgrcv>(2), B<msgsnd>(2), B<semctl>(2), B<semget>(2), B<semop>(2), "
10270 "B<shmat>(2), B<shmctl>(2), B<shmdt>(2), B<shmget>(2), B<ftok>(3), "
10275 #: build/C/man3/ulimit.3:27
10281 #: build/C/man3/ulimit.3:27
10286 #. type: Plain text
10287 #: build/C/man3/ulimit.3:30
10288 msgid "ulimit - get and set user limits"
10291 #. type: Plain text
10292 #: build/C/man3/ulimit.3:32
10293 msgid "B<#include E<lt>ulimit.hE<gt>>"
10296 #. type: Plain text
10297 #: build/C/man3/ulimit.3:34
10298 msgid "B<long ulimit(int >I<cmd>B<, long >I<newlimit>B<);>"
10301 #. type: Plain text
10302 #: build/C/man3/ulimit.3:46
10304 "Warning: This routine is obsolete. Use B<getrlimit>(2), B<setrlimit>(2), "
10305 "and B<sysconf>(3) instead. For the shell command B<ulimit>(), see "
10309 #. type: Plain text
10310 #: build/C/man3/ulimit.3:53
10312 "The B<ulimit>() call will get or set some limit for the calling process. "
10313 "The I<cmd> argument can have one of the following values."
10317 #: build/C/man3/ulimit.3:53
10319 msgid "B<UL_GETFSIZE>"
10322 #. type: Plain text
10323 #: build/C/man3/ulimit.3:56
10324 msgid "Return the limit on the size of a file, in units of 512 bytes."
10328 #: build/C/man3/ulimit.3:56
10330 msgid "B<UL_SETFSIZE>"
10333 #. type: Plain text
10334 #: build/C/man3/ulimit.3:59
10335 msgid "Set the limit on the size of a file."
10339 #: build/C/man3/ulimit.3:59
10344 #. type: Plain text
10345 #: build/C/man3/ulimit.3:63
10347 "(Not implemented for Linux.) Return the maximum possible address of the "
10352 #: build/C/man3/ulimit.3:63
10357 #. type: Plain text
10358 #: build/C/man3/ulimit.3:67
10360 "(Implemented but no symbolic constant provided.) Return the maximum number "
10361 "of files that the calling process can open."
10364 #. type: Plain text
10365 #: build/C/man3/ulimit.3:74
10367 "On success, B<ulimit>() returns a nonnegative value. On error, -1 is "
10368 "returned, and I<errno> is set appropriately."
10371 #. type: Plain text
10372 #: build/C/man3/ulimit.3:78
10373 msgid "A unprivileged process tried to increase a limit."
10376 #. type: Plain text
10377 #: build/C/man3/ulimit.3:83
10378 msgid "SVr4, POSIX.1-2001. POSIX.1-2008 marks B<ulimit>() as obsolete."
10381 #. type: Plain text
10382 #: build/C/man3/ulimit.3:88
10383 msgid "B<bash>(1), B<getrlimit>(2), B<setrlimit>(2), B<sysconf>(3)"
10387 #: build/C/man7/user_namespaces.7:27
10389 msgid "USER_NAMESPACES"
10392 #. type: Plain text
10393 #: build/C/man7/user_namespaces.7:30
10394 msgid "user_namespaces - overview of Linux user namespaces"
10397 #. FIXME: This page says very little about the interaction
10398 #. of user namespaces and keys. Add something on this topic.
10400 #. ============================================================
10401 #. type: Plain text
10402 #: build/C/man7/user_namespaces.7:56
10404 "User namespaces isolate security-related identifiers and attributes, in "
10405 "particular, user IDs and group IDs (see B<credentials>(7)), the root "
10406 "directory, keys (see B<keyctl>(2)), and capabilities (see "
10407 "B<capabilities>(7)). A process's user and group IDs can be different inside "
10408 "and outside a user namespace. In particular, a process can have a normal "
10409 "unprivileged user ID outside a user namespace while at the same time having "
10410 "a user ID of 0 inside the namespace; in other words, the process has full "
10411 "privileges for operations inside the user namespace, but is unprivileged for "
10412 "operations outside the namespace."
10416 #: build/C/man7/user_namespaces.7:56
10418 msgid "Nested namespaces, namespace membership"
10421 #. type: Plain text
10422 #: build/C/man7/user_namespaces.7:69
10424 "User namespaces can be nested; that is, each user namespace\\(emexcept the "
10425 "initial (\"root\") namespace\\(emhas a parent user namespace, and can have "
10426 "zero or more child user namespaces. The parent user namespace is the user "
10427 "namespace of the process that creates the user namespace via a call to "
10428 "B<unshare>(2) or B<clone>(2) with the B<CLONE_NEWUSER> flag."
10431 #. commit 8742f229b635bf1c1c84a3dfe5e47c814c20b5c8
10432 #. FIXME Explain the rationale for this limit. (What is the rationale?)
10433 #. type: Plain text
10434 #: build/C/man7/user_namespaces.7:80
10436 "The kernel imposes (since version 3.11) a limit of 32 nested levels of user "
10437 "namespaces. Calls to B<unshare>(2) or B<clone>(2) that would cause this "
10438 "limit to be exceeded fail with the error B<EUSERS>."
10441 #. type: Plain text
10442 #: build/C/man7/user_namespaces.7:95
10444 "Each process is a member of exactly one user namespace. A process created "
10445 "via B<fork>(2) or B<clone>(2) without the B<CLONE_NEWUSER> flag is a "
10446 "member of the same user namespace as its parent. A single-threaded process "
10447 "can join another user namespace with B<setns>(2) if it has the "
10448 "B<CAP_SYS_ADMIN> in that namespace; upon doing so, it gains a full set of "
10449 "capabilities in that namespace."
10453 #. ============================================================
10454 #. type: Plain text
10455 #: build/C/man7/user_namespaces.7:110
10457 "A call to B<clone>(2) or B<unshare>(2) with the B<CLONE_NEWUSER> flag "
10458 "makes the new child process (for B<clone>(2)) or the caller (for "
10459 "B<unshare>(2)) a member of the new user namespace created by the call."
10463 #: build/C/man7/user_namespaces.7:110
10465 msgid "Capabilities"
10468 #. type: Plain text
10469 #: build/C/man7/user_namespaces.7:132
10471 "The child process created by B<clone>(2) with the B<CLONE_NEWUSER> flag "
10472 "starts out with a complete set of capabilities in the new user namespace. "
10473 "Likewise, a process that creates a new user namespace using B<unshare>(2) "
10474 "or joins an existing user namespace using B<setns>(2) gains a full set of "
10475 "capabilities in that namespace. On the other hand, that process has no "
10476 "capabilities in the parent (in the case of B<clone>(2)) or previous (in the "
10477 "case of B<unshare>(2) and B<setns>(2)) user namespace, even if the new "
10478 "namespace is created or joined by the root user (i.e., a process with user "
10479 "ID 0 in the root namespace)."
10482 #. type: Plain text
10483 #: build/C/man7/user_namespaces.7:142
10485 "Note that a call to B<execve>(2) will cause a process's capabilities to be "
10486 "recalculated in the usual way (see B<capabilities>(7)), so that usually, "
10487 "unless it has a user ID of 0 within the namespace or the executable file has "
10488 "a nonempty inheritable capabilities mask, it will lose all capabilities. "
10489 "See the discussion of user and group ID mappings, below."
10492 #. type: Plain text
10493 #: build/C/man7/user_namespaces.7:167
10495 "A call to B<clone>(2), B<unshare>(2), or B<setns>(2) using the "
10496 "B<CLONE_NEWUSER> flag sets the \"securebits\" flags (see B<capabilities>(7)) "
10497 "to their default values (all flags disabled) in the child (for B<clone>(2)) "
10498 "or caller (for B<unshare>(2), or B<setns>(2)). Note that because the caller "
10499 "no longer has capabilities in its original user namespace after a call to "
10500 "B<setns>(2), it is not possible for a process to reset its \"securebits\" "
10501 "flags while retaining its user namespace membership by using a pair of "
10502 "B<setns>(2) calls to move to another user namespace and then return to its "
10503 "original user namespace."
10506 #. type: Plain text
10507 #: build/C/man7/user_namespaces.7:173
10509 "Having a capability inside a user namespace permits a process to perform "
10510 "operations (that require privilege) only on resources governed by that "
10511 "namespace. The rules for determining whether or not a process has a "
10512 "capability in a particular user namespace are as follows:"
10515 #. In the 3.8 sources, see security/commoncap.c::cap_capable():
10516 #. type: Plain text
10517 #: build/C/man7/user_namespaces.7:189
10519 "A process has a capability inside a user namespace if it is a member of that "
10520 "namespace and it has the capability in its effective capability set. A "
10521 "process can gain capabilities in its effective capability set in various "
10522 "ways. For example, it may execute a set-user-ID program or an executable "
10523 "with associated file capabilities. In addition, a process may gain "
10524 "capabilities via the effect of B<clone>(2), B<unshare>(2), or B<setns>(2), "
10525 "as already described."
10528 #. type: Plain text
10529 #: build/C/man7/user_namespaces.7:193
10531 "If a process has a capability in a user namespace, then it has that "
10532 "capability in all child (and further removed descendant) namespaces as "
10536 #. * The owner of the user namespace in the parent of the
10537 #. * user namespace has all caps.
10538 #. (and likewise associates the effective group ID of the creating process
10539 #. with the namespace).
10540 #. See kernel commit 520d9eabce18edfef76a60b7b839d54facafe1f9 for a fix
10542 #. This includes the case where the process executes a set-user-ID
10543 #. program that confers the effective UID of the creator of the namespace.
10545 #. ============================================================
10546 #. type: Plain text
10547 #: build/C/man7/user_namespaces.7:214
10549 "When a user namespace is created, the kernel records the effective user ID "
10550 "of the creating process as being the \"owner\" of the namespace. A process "
10551 "that resides in the parent of the user namespace and whose effective user ID "
10552 "matches the owner of the namespace has all capabilities in the namespace. "
10553 "By virtue of the previous rule, this means that the process has all "
10554 "capabilities in all further removed descendant user namespaces as well."
10558 #: build/C/man7/user_namespaces.7:214
10560 msgid "Interaction of user namespaces and other types of namespaces"
10563 #. type: Plain text
10564 #: build/C/man7/user_namespaces.7:219
10566 "Starting in Linux 3.8, unprivileged processes can create user namespaces, "
10567 "and mount, PID, IPC, network, and UTS namespaces can be created with just "
10568 "the B<CAP_SYS_ADMIN> capability in the caller's user namespace."
10571 #. type: Plain text
10572 #: build/C/man7/user_namespaces.7:225
10574 "When a non-user-namespace is created, it is owned by the user namespace in "
10575 "which the creating process was a member at the time of the creation of the "
10576 "namespace. Actions on the non-user-namespace require capabilities in the "
10577 "corresponding user namespace."
10580 #. type: Plain text
10581 #: build/C/man7/user_namespaces.7:242
10583 "If B<CLONE_NEWUSER> is specified along with other B<CLONE_NEW*> flags in a "
10584 "single B<clone>(2) or B<unshare>(2) call, the user namespace is guaranteed "
10585 "to be created first, giving the child (B<clone>(2)) or caller "
10586 "(B<unshare>(2)) privileges over the remaining namespaces created by the "
10587 "call. Thus, it is possible for an unprivileged caller to specify this "
10588 "combination of flags."
10592 #. ============================================================
10593 #. type: Plain text
10594 #: build/C/man7/user_namespaces.7:258
10596 "When a new IPC, mount, network, PID, or UTS namespace is created via "
10597 "B<clone>(2) or B<unshare>(2), the kernel records the user namespace of the "
10598 "creating process against the new namespace. (This association can't be "
10599 "changed.) When a process in the new namespace subsequently performs "
10600 "privileged operations that operate on global resources isolated by the "
10601 "namespace, the permission checks are performed according to the process's "
10602 "capabilities in the user namespace that the kernel associated with the new "
10607 #: build/C/man7/user_namespaces.7:258
10609 msgid "Restrictions on mount namespaces"
10612 #. type: Plain text
10613 #: build/C/man7/user_namespaces.7:261
10614 msgid "Note the following points with respect to mount namespaces:"
10617 #. type: Plain text
10618 #: build/C/man7/user_namespaces.7:266
10620 "A mount namespace has an owner user namespace. A mount namespace whose "
10621 "owner user namespace is different from the owner user namespace of its "
10622 "parent mount namespace is considered a less privileged mount namespace."
10625 #. type: Plain text
10626 #: build/C/man7/user_namespaces.7:272
10628 "When creating a less privileged mount namespace, shared mounts are reduced "
10629 "to slave mounts. This ensures that mappings performed in less privileged "
10630 "mount namespaces will not propagate to more privileged mount namespaces."
10634 #. What does "come as a single unit from more privileged mount" mean?
10635 #. type: Plain text
10636 #: build/C/man7/user_namespaces.7:285
10638 "Mounts that come as a single unit from more privileged mount are locked "
10639 "together and may not be separated in a less privileged mount namespace. "
10640 "(The B<unshare>(2) B<CLONE_NEWNS> operation brings across all of the mounts "
10641 "from the original mount namespace as a single unit, and recursive mounts "
10642 "that propagate between mount namespaces propagate as a single unit.)"
10645 #. commit 9566d6742852c527bf5af38af5cbb878dad75705
10646 #. Author: Eric W. Biederman <ebiederm@xmission.com>
10647 #. Date: Mon Jul 28 17:26:07 2014 -0700
10649 #. mnt: Correct permission checks in do_remount
10650 #. type: Plain text
10651 #: build/C/man7/user_namespaces.7:306
10653 "The B<mount>(2) flags B<MS_RDONLY>, B<MS_NOSUID>, B<MS_NOEXEC>, and the "
10654 "\"atime\" flags (B<MS_NOATIME>, B<MS_NODIRATIME>, B<MS_RELATIME>) settings "
10655 "become locked when propagated from a more privileged to a less privileged "
10656 "mount namespace, and may not be changed in the less privileged mount "
10660 #. (As of 3.18-rc1 (in Al Viro's 2014-08-30 vfs.git#for-next tree))
10661 #. type: Plain text
10662 #: build/C/man7/user_namespaces.7:313
10664 "A file or directory that is a mount point in one namespace that is not a "
10665 "mount point in another namespace, may be renamed, unlinked, or removed "
10666 "(B<rmdir>(2)) in the mount namespace in which it is not a mount point "
10667 "(subject to the usual permission checks)."
10671 #. ============================================================
10672 #. type: Plain text
10673 #: build/C/man7/user_namespaces.7:324
10675 "Previously, attempting to unlink, rename, or remove a file or directory that "
10676 "was a mount point in another mount namespace would result in the error "
10677 "B<EBUSY>. That behavior had technical problems of enforcement (e.g., for "
10678 "NFS) and permitted denial-of-service attacks against more privileged "
10679 "users. (i.e., preventing individual files from being updated by bind "
10680 "mounting on top of them)."
10684 #: build/C/man7/user_namespaces.7:324
10686 msgid "User and group ID mappings: uid_map and gid_map"
10689 #. commit 22d917d80e842829d0ca0a561967d728eb1d6303
10690 #. type: Plain text
10691 #: build/C/man7/user_namespaces.7:339
10693 "When a user namespace is created, it starts out without a mapping of user "
10694 "IDs (group IDs) to the parent user namespace. The I</proc/[pid]/uid_map> "
10695 "and I</proc/[pid]/gid_map> files (available since Linux 3.5) expose the "
10696 "mappings for user and group IDs inside the user namespace for the process "
10697 "I<pid>. These files can be read to view the mappings in a user namespace "
10698 "and written to (once) to define the mappings."
10701 #. type: Plain text
10702 #: build/C/man7/user_namespaces.7:345
10704 "The description in the following paragraphs explains the details for "
10705 "I<uid_map>; I<gid_map> is exactly the same, but each instance of \"user ID\" "
10706 "is replaced by \"group ID\"."
10709 #. type: Plain text
10710 #: build/C/man7/user_namespaces.7:359
10712 "The I<uid_map> file exposes the mapping of user IDs from the user namespace "
10713 "of the process I<pid> to the user namespace of the process that opened "
10714 "I<uid_map> (but see a qualification to this point below). In other words, "
10715 "processes that are in different user namespaces will potentially see "
10716 "different values when reading from a particular I<uid_map> file, depending "
10717 "on the user ID mappings for the user namespaces of the reading processes."
10720 #. type: Plain text
10721 #: build/C/man7/user_namespaces.7:371
10723 "Each line in the I<uid_map> file specifies a 1-to-1 mapping of a range of "
10724 "contiguous user IDs between two user namespaces. (When a user namespace is "
10725 "first created, this file is empty.) The specification in each line takes "
10726 "the form of three numbers delimited by white space. The first two numbers "
10727 "specify the starting user ID in each of the two user namespaces. The third "
10728 "number specifies the length of the mapped range. In detail, the fields are "
10729 "interpreted as follows:"
10732 #. type: Plain text
10733 #: build/C/man7/user_namespaces.7:375
10735 "The start of the range of user IDs in the user namespace of the process "
10739 #. type: Plain text
10740 #: build/C/man7/user_namespaces.7:383
10742 "The start of the range of user IDs to which the user IDs specified by field "
10743 "one map. How field two is interpreted depends on whether the process that "
10744 "opened I<uid_map> and the process I<pid> are in the same user namespace, as "
10748 #. type: Plain text
10749 #: build/C/man7/user_namespaces.7:389
10751 "If the two processes are in different user namespaces: field two is the "
10752 "start of a range of user IDs in the user namespace of the process that "
10753 "opened I<uid_map>."
10756 #. type: Plain text
10757 #: build/C/man7/user_namespaces.7:400
10759 "If the two processes are in the same user namespace: field two is the start "
10760 "of the range of user IDs in the parent user namespace of the process "
10761 "I<pid>. This case enables the opener of I<uid_map> (the common case here is "
10762 "opening I</proc/self/uid_map>) to see the mapping of user IDs into the user "
10763 "namespace of the process that created this user namespace."
10766 #. type: Plain text
10767 #: build/C/man7/user_namespaces.7:404
10769 "The length of the range of user IDs that is mapped between the two user "
10773 #. type: Plain text
10774 #: build/C/man7/user_namespaces.7:411
10776 "System calls that return user IDs (group IDs)\\(emfor example, B<getuid>(2), "
10777 "B<getgid>(2), and the credential fields in the structure returned by "
10778 "B<stat>(2)\\(emreturn the user ID (group ID) mapped into the caller's user "
10782 #. type: Plain text
10783 #: build/C/man7/user_namespaces.7:419
10785 "When a process accesses a file, its user and group IDs are mapped into the "
10786 "initial user namespace for the purpose of permission checking and assigning "
10787 "IDs when creating a file. When a process retrieves file user and group IDs "
10788 "via B<stat>(2), the IDs are mapped in the opposite direction, to produce "
10789 "values relative to the process user and group ID mappings."
10792 #. type: Plain text
10793 #: build/C/man7/user_namespaces.7:428
10795 "The initial user namespace has no parent namespace, but, for consistency, "
10796 "the kernel provides dummy user and group ID mapping files for this "
10797 "namespace. Looking at the I<uid_map> file (I<gid_map> is the same) from a "
10798 "shell in the initial namespace shows:"
10801 #. type: Plain text
10802 #: build/C/man7/user_namespaces.7:433
10805 "$ B<cat /proc/$$/uid_map>\n"
10806 " 0 0 4294967295\n"
10810 #. ============================================================
10811 #. type: Plain text
10812 #: build/C/man7/user_namespaces.7:453
10814 "This mapping tells us that the range starting at user ID 0 in this namespace "
10815 "maps to a range starting at 0 in the (nonexistent) parent namespace, and the "
10816 "length of the range is the largest 32-bit unsigned integer. (This "
10817 "deliberately leaves 4294967295 (the 32-bit signed -1 value) unmapped. This "
10818 "is deliberate: I<(uid_t)\\ -\\1> is used in several interfaces (e.g., "
10819 "B<setreuid>(2)) as a way to specify \"no user ID\". Leaving I<(uid_t)\\ "
10820 "-\\1> unmapped and unusable guarantees that there will be no confusion when "
10821 "using these interfaces."
10825 #: build/C/man7/user_namespaces.7:453
10827 msgid "Defining user and group ID mappings: writing to uid_map and gid_map"
10830 #. type: Plain text
10831 #: build/C/man7/user_namespaces.7:469
10833 "After the creation of a new user namespace, the I<uid_map> file of I<one> of "
10834 "the processes in the namespace may be written to I<once> to define the "
10835 "mapping of user IDs in the new user namespace. An attempt to write more "
10836 "than once to a I<uid_map> file in a user namespace fails with the error "
10837 "B<EPERM>. Similar rules apply for I<gid_map> files."
10840 #. type: Plain text
10841 #: build/C/man7/user_namespaces.7:474
10843 "The lines written to I<uid_map> (I<gid_map>) must conform to the following "
10847 #. type: Plain text
10848 #: build/C/man7/user_namespaces.7:477
10850 "The three fields must be valid numbers, and the last field must be greater "
10854 #. type: Plain text
10855 #: build/C/man7/user_namespaces.7:479
10856 msgid "Lines are terminated by newline characters."
10859 #. FIXME(Eric): the restriction "less than" rather than "less than or equal"
10860 #. seems strangely arbitrary. Furthermore, the comment does not agree
10861 #. with the code in kernel/user_namespace.c. Which is correct?
10862 #. type: Plain text
10863 #: build/C/man7/user_namespaces.7:492
10865 "There is an (arbitrary) limit on the number of lines in the file. As at "
10866 "Linux 3.8, the limit is five lines. In addition, the number of bytes "
10867 "written to the file must be less than the system page size, and the write "
10868 "must be performed at the start of the file (i.e., B<lseek>(2) and "
10869 "B<pwrite>(2) can't be used to write to nonzero offsets in the file)."
10872 #. commit 0bd14b4fd72afd5df41e9fd59f356740f22fceba
10873 #. type: Plain text
10874 #: build/C/man7/user_namespaces.7:505
10876 "The range of user IDs (group IDs) specified in each line cannot overlap "
10877 "with the ranges in any other lines. In the initial implementation (Linux "
10878 "3.8), this requirement was satisfied by a simplistic implementation that "
10879 "imposed the further requirement that the values in both field 1 and field 2 "
10880 "of successive lines must be in ascending numerical order, which prevented "
10881 "some otherwise valid maps from being created. Linux 3.9 and later fix this "
10882 "limitation, allowing any valid set of nonoverlapping maps."
10885 #. type: Plain text
10886 #: build/C/man7/user_namespaces.7:507
10887 msgid "At least one line must be written to the file."
10890 #. type: Plain text
10891 #: build/C/man7/user_namespaces.7:510
10892 msgid "Writes that violate the above rules fail with the error B<EINVAL>."
10895 #. type: Plain text
10896 #: build/C/man7/user_namespaces.7:515
10898 "In order for a process to write to the I</proc/[pid]/uid_map> "
10899 "(I</proc/[pid]/gid_map>) file, all of the following requirements must be "
10903 #. type: Plain text
10904 #: build/C/man7/user_namespaces.7:521
10906 "The writing process must have the B<CAP_SETUID> (B<CAP_SETGID>) capability "
10907 "in the user namespace of the process I<pid>."
10910 #. type: Plain text
10911 #: build/C/man7/user_namespaces.7:526
10913 "The writing process must be in either the user namespace of the process "
10914 "I<pid> or inside the parent user namespace of the process I<pid>."
10917 #. type: Plain text
10918 #: build/C/man7/user_namespaces.7:529
10920 "The mapped user IDs (group IDs) must in turn have a mapping in the parent "
10924 #. type: Plain text
10925 #: build/C/man7/user_namespaces.7:531
10926 msgid "One of the following is true:"
10929 #. type: Plain text
10930 #: build/C/man7/user_namespaces.7:541
10932 "The data written to I<uid_map> (I<gid_map>) consists of a single line that "
10933 "maps the writing process's filesystem user ID (group ID) in the parent user "
10934 "namespace to a user ID (group ID) in the user namespace. The usual case "
10935 "here is that this single line provides a mapping for user ID of the process "
10936 "that created the namespace."
10939 #. type: Plain text
10940 #: build/C/man7/user_namespaces.7:548
10942 "The opening process has the B<CAP_SETUID> (B<CAP_SETGID>) capability in the "
10943 "parent user namespace. Thus, a privileged process can make mappings to "
10944 "arbitrary user IDs (group IDs) in the parent user namespace."
10948 #. ============================================================
10949 #. type: Plain text
10950 #: build/C/man7/user_namespaces.7:555
10951 msgid "Writes that violate the above rules fail with the error B<EPERM>."
10955 #: build/C/man7/user_namespaces.7:555
10957 msgid "Unmapped user and group IDs"
10960 #. from_kuid_munged(), from_kgid_munged()
10961 #. type: Plain text
10962 #: build/C/man7/user_namespaces.7:572
10964 "There are various places where an unmapped user ID (group ID) may be "
10965 "exposed to user space. For example, the first process in a new user "
10966 "namespace may call B<getuid>() before a user ID mapping has been defined "
10967 "for the namespace. In most such cases, an unmapped user ID is converted to "
10968 "the overflow user ID (group ID); the default value for the overflow user ID "
10969 "(group ID) is 65534. See the descriptions of "
10970 "I</proc/sys/kernel/overflowuid> and I</proc/sys/kernel/overflowgid> in "
10974 #. also SO_PEERCRED
10975 #. type: Plain text
10976 #: build/C/man7/user_namespaces.7:600
10978 "The cases where unmapped IDs are mapped in this fashion include system calls "
10979 "that return user IDs (B<getuid>(2), B<getgid>(2), and similar), credentials "
10980 "passed over a UNIX domain socket, credentials returned by B<stat>(2), "
10981 "B<waitid>(2), and the System V IPC \"ctl\" B<IPC_STAT> operations, "
10982 "credentials exposed by I</proc/PID/status> and the files in "
10983 "I</proc/sysvipc/*>, credentials returned via the I<si_uid> field in the "
10984 "I<siginfo_t> received with a signal (see B<sigaction>(2)), credentials "
10985 "written to the process accounting file (see B<acct>(5)), and credentials "
10986 "returned with POSIX message queue notifications (see B<mq_notify>(3))."
10989 #. from_kuid(), from_kgid()
10990 #. Also F_GETOWNER_UIDS is an exception
10992 #. ============================================================
10993 #. type: Plain text
10994 #: build/C/man7/user_namespaces.7:615
10996 "There is one notable case where unmapped user and group IDs are I<not> "
10997 "converted to the corresponding overflow ID value. When viewing a I<uid_map> "
10998 "or I<gid_map> file in which there is no mapping for the second field, that "
10999 "field is displayed as 4294967295 (-1 as an unsigned integer);"
11003 #: build/C/man7/user_namespaces.7:615
11005 msgid "Set-user-ID and set-group-ID programs"
11009 #. ============================================================
11010 #. type: Plain text
11011 #: build/C/man7/user_namespaces.7:635
11013 "When a process inside a user namespace executes a set-user-ID (set-group-ID) "
11014 "program, the process's effective user (group) ID inside the namespace is "
11015 "changed to whatever value is mapped for the user (group) ID of the file. "
11016 "However, if either the user I<or> the group ID of the file has no mapping "
11017 "inside the namespace, the set-user-ID (set-group-ID) bit is silently "
11018 "ignored: the new program is executed, but the process's effective user "
11019 "(group) ID is left unchanged. (This mirrors the semantics of executing a "
11020 "set-user-ID or set-group-ID program that resides on a filesystem that was "
11021 "mounted with the B<MS_NOSUID> flag, as described in B<mount>(2).)"
11024 #. type: Plain text
11025 #: build/C/man7/user_namespaces.7:645
11027 "When a process's user and group IDs are passed over a UNIX domain socket to "
11028 "a process in a different user namespace (see the description of "
11029 "B<SCM_CREDENTIALS> in B<unix>(7)), they are translated into the "
11030 "corresponding values as per the receiving process's user and group ID "
11035 #. ============================================================
11036 #. type: Plain text
11037 #: build/C/man7/user_namespaces.7:658
11039 "Over the years, there have been a lot of features that have been added to "
11040 "the Linux kernel that have been made available only to privileged users "
11041 "because of their potential to confuse set-user-ID-root applications. In "
11042 "general, it becomes safe to allow the root user in a user namespace to use "
11043 "those features because it is impossible, while in a user namespace, to gain "
11044 "more privilege than the root user of a user namespace has."
11048 #: build/C/man7/user_namespaces.7:658
11050 msgid "Availability"
11053 #. type: Plain text
11054 #: build/C/man7/user_namespaces.7:666
11056 "Use of user namespaces requires a kernel that is configured with the "
11057 "B<CONFIG_USER_NS> option. User namespaces require support in a range of "
11058 "subsystems across the kernel. When an unsupported subsystem is configured "
11059 "into the kernel, it is not possible to configure user namespaces support."
11062 #. commit d6970d4b726cea6d7a9bc4120814f95c09571fc3
11063 #. type: Plain text
11064 #: build/C/man7/user_namespaces.7:677
11066 "As at Linux 3.8, most relevant subsystems supported user namespaces, but a "
11067 "number of filesystems did not have the infrastructure needed to map user and "
11068 "group IDs between user namespaces. Linux 3.9 added the required "
11069 "infrastructure support for many of the remaining unsupported filesystems "
11070 "(Plan 9 (9P), Andrew File System (AFS), Ceph, CIFS, CODA, NFS, and OCFS2). "
11071 "Linux 3.11 added support the last of the unsupported major filesystems, XFS."
11074 #. type: Plain text
11075 #: build/C/man7/user_namespaces.7:686
11077 "The program below is designed to allow experimenting with user namespaces, "
11078 "as well as other types of namespaces. It creates namespaces as specified by "
11079 "command-line options and then executes a command inside those namespaces. "
11080 "The comments and I<usage()> function inside the program provide a full "
11081 "explanation of the program. The following shell session demonstrates its "
11085 #. type: Plain text
11086 #: build/C/man7/user_namespaces.7:688
11087 msgid "First, we look at the run-time environment:"
11090 #. type: Plain text
11091 #: build/C/man7/user_namespaces.7:697
11094 "$ B<uname -rs> # Need Linux 3.8 or later\n"
11096 "$ B<id -u> # Running as unprivileged user\n"
11102 #. type: Plain text
11103 #: build/C/man7/user_namespaces.7:711
11105 "Now start a new shell in new user (I<-U>), mount (I<-m>), and PID (I<-p>) "
11106 "namespaces, with user ID (I<-M>) and group ID (I<-G>) 1000 mapped to 0 "
11107 "inside the user namespace:"
11110 #. type: Plain text
11111 #: build/C/man7/user_namespaces.7:715
11113 msgid "$ B<./userns_child_exec -p -m -U -M '0 1000 1' -G '0 1000 1' bash>\n"
11116 #. type: Plain text
11117 #: build/C/man7/user_namespaces.7:720
11119 "The shell has PID 1, because it is the first process in the new PID "
11123 #. type: Plain text
11124 #: build/C/man7/user_namespaces.7:725
11127 "bash$ B<echo $$>\n"
11131 #. type: Plain text
11132 #: build/C/man7/user_namespaces.7:730
11134 "Inside the user namespace, the shell has user and group ID 0, and a full set "
11135 "of permitted and effective capabilities:"
11138 #. type: Plain text
11139 #: build/C/man7/user_namespaces.7:740
11142 "bash$ B<cat /proc/$$/status | egrep '^[UG]id'>\n"
11143 "Uid:\t0\t0\t0\t0\n"
11144 "Gid:\t0\t0\t0\t0\n"
11145 "bash$ B<cat /proc/$$/status | egrep '^Cap(Prm|Inh|Eff)'>\n"
11146 "CapInh:\t0000000000000000\n"
11147 "CapPrm:\t0000001fffffffff\n"
11148 "CapEff:\t0000001fffffffff\n"
11151 #. type: Plain text
11152 #: build/C/man7/user_namespaces.7:748
11154 "Mounting a new I</proc> filesystem and listing all of the processes visible "
11155 "in the new PID namespace shows that the shell can't see any processes "
11156 "outside the PID namespace:"
11159 #. type: Plain text
11160 #: build/C/man7/user_namespaces.7:756
11163 "bash$ B<mount -t proc proc /proc>\n"
11165 " PID TTY STAT TIME COMMAND\n"
11166 " 1 pts/3 S 0:00 bash\n"
11167 " 22 pts/3 R+ 0:00 ps ax\n"
11171 #: build/C/man7/user_namespaces.7:758 build/C/man2/seccomp.2:574
11173 msgid "Program source"
11176 #. type: Plain text
11177 #: build/C/man7/user_namespaces.7:762
11179 msgid "/* userns_child_exec.c\n"
11182 #. type: Plain text
11183 #: build/C/man7/user_namespaces.7:764
11185 msgid " Licensed under GNU General Public License v2 or later\n"
11188 #. type: Plain text
11189 #: build/C/man7/user_namespaces.7:780
11192 " Create a child process that executes a shell command in new\n"
11193 " namespace(s); allow UID and GID mappings to be specified when\n"
11194 " creating a user namespace.\n"
11196 "#define _GNU_SOURCE\n"
11197 "#include E<lt>sched.hE<gt>\n"
11198 "#include E<lt>unistd.hE<gt>\n"
11199 "#include E<lt>stdlib.hE<gt>\n"
11200 "#include E<lt>sys/wait.hE<gt>\n"
11201 "#include E<lt>signal.hE<gt>\n"
11202 "#include E<lt>fcntl.hE<gt>\n"
11203 "#include E<lt>stdio.hE<gt>\n"
11204 "#include E<lt>string.hE<gt>\n"
11205 "#include E<lt>limits.hE<gt>\n"
11206 "#include E<lt>errno.hE<gt>\n"
11209 #. type: Plain text
11210 #: build/C/man7/user_namespaces.7:783
11213 "/* A simple error-handling function: print an error message based\n"
11214 " on the value in \\(aqerrno\\(aq and terminate the calling process */\n"
11217 #. type: Plain text
11218 #: build/C/man7/user_namespaces.7:786
11221 "#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \\e\n"
11225 #. type: Plain text
11226 #: build/C/man7/user_namespaces.7:791
11229 "struct child_args {\n"
11230 " char **argv; /* Command to be executed by child, with args */\n"
11231 " int pipe_fd[2]; /* Pipe used to synchronize parent and child */\n"
11235 #. type: Plain text
11236 #: build/C/man7/user_namespaces.7:793
11238 msgid "static int verbose;\n"
11241 #. type: Plain text
11242 #: build/C/man7/user_namespaces.7:826
11246 "usage(char *pname)\n"
11248 " fprintf(stderr, \"Usage: %s [options] cmd [arg...]\\en\\en\", pname);\n"
11249 " fprintf(stderr, \"Create a child process that executes a shell \"\n"
11250 " \"command in a new user namespace,\\en\"\n"
11251 " \"and possibly also other new namespace(s).\\en\\en\");\n"
11252 " fprintf(stderr, \"Options can be:\\en\\en\");\n"
11253 "#define fpe(str) fprintf(stderr, \" %s\", str);\n"
11254 " fpe(\"-i New IPC namespace\\en\");\n"
11255 " fpe(\"-m New mount namespace\\en\");\n"
11256 " fpe(\"-n New network namespace\\en\");\n"
11257 " fpe(\"-p New PID namespace\\en\");\n"
11258 " fpe(\"-u New UTS namespace\\en\");\n"
11259 " fpe(\"-U New user namespace\\en\");\n"
11260 " fpe(\"-M uid_map Specify UID map for user namespace\\en\");\n"
11261 " fpe(\"-G gid_map Specify GID map for user namespace\\en\");\n"
11262 " fpe(\"-z Map user\\(aqs UID and GID to 0 in user "
11263 "namespace\\en\");\n"
11264 " fpe(\" (equivalent to: -M \\(aq0 E<lt>uidE<gt> 1\\(aq -G "
11265 "\\(aq0 E<lt>gidE<gt> 1\\(aq)\\en\");\n"
11266 " fpe(\"-v Display verbose messages\\en\");\n"
11267 " fpe(\"\\en\");\n"
11268 " fpe(\"If -z, -M, or -G is specified, -U is required.\\en\");\n"
11269 " fpe(\"It is not permitted to specify both -z and either -M or "
11271 " fpe(\"\\en\");\n"
11272 " fpe(\"Map strings for -M and -G consist of records of the "
11274 " fpe(\"\\en\");\n"
11275 " fpe(\" ID-inside-ns ID-outside-ns len\\en\");\n"
11276 " fpe(\"\\en\");\n"
11277 " fpe(\"A map string can contain multiple records, separated\"\n"
11278 " \" by commas;\\en\");\n"
11279 " fpe(\"the commas are replaced by newlines before writing\"\n"
11280 " \" to map files.\\en\");\n"
11283 #. type: Plain text
11284 #: build/C/man7/user_namespaces.7:834
11287 "/* Update the mapping file \\(aqmap_file\\(aq, with the value provided in\n"
11288 " \\(aqmapping\\(aq, a string that defines a UID or GID mapping. A UID or\n"
11289 " GID mapping consists of one or more newline-delimited records\n"
11293 #. type: Plain text
11294 #: build/C/man7/user_namespaces.7:836
11296 msgid " ID_inside-ns ID-outside-ns length\n"
11299 #. type: Plain text
11300 #: build/C/man7/user_namespaces.7:841
11303 " Requiring the user to supply a string that contains newlines is\n"
11304 " of course inconvenient for command-line use. Thus, we permit the\n"
11305 " use of commas to delimit records in this string, and replace them\n"
11306 " with newlines before writing the string to the file. */\n"
11309 #. type: Plain text
11310 #: build/C/man7/user_namespaces.7:847
11314 "update_map(char *mapping, char *map_file)\n"
11317 " size_t map_len; /* Length of \\(aqmapping\\(aq */\n"
11320 #. type: Plain text
11321 #: build/C/man7/user_namespaces.7:849
11323 msgid " /* Replace commas in mapping string with newlines */\n"
11326 #. type: Plain text
11327 #: build/C/man7/user_namespaces.7:854
11330 " map_len = strlen(mapping);\n"
11331 " for (j = 0; j E<lt> map_len; j++)\n"
11332 " if (mapping[j] == \\(aq,\\(aq)\n"
11333 " mapping[j] = \\(aq\\en\\(aq;\n"
11336 #. type: Plain text
11337 #: build/C/man7/user_namespaces.7:861
11340 " fd = open(map_file, O_RDWR);\n"
11341 " if (fd == -1) {\n"
11342 " fprintf(stderr, \"ERROR: open %s: %s\\en\", map_file,\n"
11343 " strerror(errno));\n"
11344 " exit(EXIT_FAILURE);\n"
11348 #. type: Plain text
11349 #: build/C/man7/user_namespaces.7:867
11352 " if (write(fd, mapping, map_len) != map_len) {\n"
11353 " fprintf(stderr, \"ERROR: write %s: %s\\en\", map_file,\n"
11354 " strerror(errno));\n"
11355 " exit(EXIT_FAILURE);\n"
11359 #. type: Plain text
11360 #: build/C/man7/user_namespaces.7:870
11367 #. type: Plain text
11368 #: build/C/man7/user_namespaces.7:876
11371 "static int /* Start function for cloned child */\n"
11372 "childFunc(void *arg)\n"
11374 " struct child_args *args = (struct child_args *) arg;\n"
11378 #. type: Plain text
11379 #: build/C/man7/user_namespaces.7:881
11382 " /* Wait until the parent has updated the UID and GID mappings.\n"
11383 " See the comment in main(). We wait for end of file on a\n"
11384 " pipe that will be closed by the parent process once it has\n"
11385 " updated the mappings. */\n"
11388 #. type: Plain text
11389 #: build/C/man7/user_namespaces.7:890
11392 " close(args-E<gt>pipe_fd[1]); /* Close our descriptor for the write\n"
11393 " end of the pipe so that we see EOF\n"
11394 " when parent closes its descriptor */\n"
11395 " if (read(args-E<gt>pipe_fd[0], &ch, 1) != 0) {\n"
11396 " fprintf(stderr,\n"
11397 " \"Failure in child: read from pipe returned != 0\\en\");\n"
11398 " exit(EXIT_FAILURE);\n"
11402 #. type: Plain text
11403 #: build/C/man7/user_namespaces.7:892
11405 msgid " /* Execute a shell command */\n"
11408 #. type: Plain text
11409 #: build/C/man7/user_namespaces.7:897
11412 " printf(\"About to exec %s\\en\", args-E<gt>argv[0]);\n"
11413 " execvp(args-E<gt>argv[0], args-E<gt>argv);\n"
11414 " errExit(\"execvp\");\n"
11418 #. type: Plain text
11419 #: build/C/man7/user_namespaces.7:899
11421 msgid "#define STACK_SIZE (1024 * 1024)\n"
11424 #. type: Plain text
11425 #: build/C/man7/user_namespaces.7:901
11427 msgid "static char child_stack[STACK_SIZE]; /* Space for child\\(aqs stack */\n"
11430 #. type: Plain text
11431 #: build/C/man7/user_namespaces.7:912
11435 "main(int argc, char *argv[])\n"
11437 " int flags, opt, map_zero;\n"
11438 " pid_t child_pid;\n"
11439 " struct child_args args;\n"
11440 " char *uid_map, *gid_map;\n"
11441 " const int MAP_BUF_SIZE = 100;\n"
11442 " char map_buf[MAP_BUF_SIZE];\n"
11443 " char map_path[PATH_MAX];\n"
11446 #. type: Plain text
11447 #: build/C/man7/user_namespaces.7:919
11450 " /* Parse command-line options. The initial \\(aq+\\(aq character in\n"
11451 " the final getopt() argument prevents GNU-style permutation\n"
11452 " of command-line options. That\\(aqs useful, since sometimes\n"
11453 " the \\(aqcommand\\(aq to be executed by this program itself\n"
11454 " has command-line options. We don\\(aqt want getopt() to treat\n"
11455 " those as options to this program. */\n"
11458 #. type: Plain text
11459 #: build/C/man7/user_namespaces.7:940
11464 " gid_map = NULL;\n"
11465 " uid_map = NULL;\n"
11467 " while ((opt = getopt(argc, argv, \"+imnpuUM:G:zv\")) != -1) {\n"
11468 " switch (opt) {\n"
11469 " case \\(aqi\\(aq: flags |= CLONE_NEWIPC; break;\n"
11470 " case \\(aqm\\(aq: flags |= CLONE_NEWNS; break;\n"
11471 " case \\(aqn\\(aq: flags |= CLONE_NEWNET; break;\n"
11472 " case \\(aqp\\(aq: flags |= CLONE_NEWPID; break;\n"
11473 " case \\(aqu\\(aq: flags |= CLONE_NEWUTS; break;\n"
11474 " case \\(aqv\\(aq: verbose = 1; break;\n"
11475 " case \\(aqz\\(aq: map_zero = 1; break;\n"
11476 " case \\(aqM\\(aq: uid_map = optarg; break;\n"
11477 " case \\(aqG\\(aq: gid_map = optarg; break;\n"
11478 " case \\(aqU\\(aq: flags |= CLONE_NEWUSER; break;\n"
11479 " default: usage(argv[0]);\n"
11484 #. type: Plain text
11485 #: build/C/man7/user_namespaces.7:942
11487 msgid " /* -M or -G without -U is nonsensical */\n"
11490 #. type: Plain text
11491 #: build/C/man7/user_namespaces.7:947
11494 " if (((uid_map != NULL || gid_map != NULL || map_zero) &&\n"
11495 " !(flags & CLONE_NEWUSER)) ||\n"
11496 " (map_zero && (uid_map != NULL || gid_map != NULL)))\n"
11497 " usage(argv[0]);\n"
11500 #. type: Plain text
11501 #: build/C/man7/user_namespaces.7:949
11503 msgid " args.argv = &argv[optind];\n"
11506 #. type: Plain text
11507 #: build/C/man7/user_namespaces.7:959
11510 " /* We use a pipe to synchronize the parent and child, in order to\n"
11511 " ensure that the parent sets the UID and GID maps before the child\n"
11512 " calls execve(). This ensures that the child maintains its\n"
11513 " capabilities during the execve() in the common case where we\n"
11514 " want to map the child\\(aqs effective user ID to 0 in the new user\n"
11515 " namespace. Without this synchronization, the child would lose\n"
11516 " its capabilities if it performed an execve() with nonzero\n"
11517 " user IDs (see the capabilities(7) man page for details of the\n"
11518 " transformation of a process\\(aqs capabilities during execve()). */\n"
11521 #. type: Plain text
11522 #: build/C/man7/user_namespaces.7:962
11525 " if (pipe(args.pipe_fd) == -1)\n"
11526 " errExit(\"pipe\");\n"
11529 #. type: Plain text
11530 #: build/C/man7/user_namespaces.7:964
11532 msgid " /* Create the child in new namespace(s) */\n"
11535 #. type: Plain text
11536 #: build/C/man7/user_namespaces.7:969
11539 " child_pid = clone(childFunc, child_stack + STACK_SIZE,\n"
11540 " flags | SIGCHLD, &args);\n"
11541 " if (child_pid == -1)\n"
11542 " errExit(\"clone\");\n"
11545 #. type: Plain text
11546 #: build/C/man7/user_namespaces.7:971
11548 msgid " /* Parent falls through to here */\n"
11551 #. type: Plain text
11552 #: build/C/man7/user_namespaces.7:975
11556 " printf(\"%s: PID of child created by clone() is %ld\\en\",\n"
11557 " argv[0], (long) child_pid);\n"
11560 #. type: Plain text
11561 #: build/C/man7/user_namespaces.7:977
11563 msgid " /* Update the UID and GID maps in the child */\n"
11566 #. type: Plain text
11567 #: build/C/man7/user_namespaces.7:996
11570 " if (uid_map != NULL || map_zero) {\n"
11571 " snprintf(map_path, PATH_MAX, \"/proc/%ld/uid_map\",\n"
11572 " (long) child_pid);\n"
11573 " if (map_zero) {\n"
11574 " snprintf(map_buf, MAP_BUF_SIZE, \"0 %ld 1\", (long) getuid());\n"
11575 " uid_map = map_buf;\n"
11577 " update_map(uid_map, map_path);\n"
11579 " if (gid_map != NULL || map_zero) {\n"
11580 " snprintf(map_path, PATH_MAX, \"/proc/%ld/gid_map\",\n"
11581 " (long) child_pid);\n"
11582 " if (map_zero) {\n"
11583 " snprintf(map_buf, MAP_BUF_SIZE, \"0 %ld 1\", (long) getgid());\n"
11584 " gid_map = map_buf;\n"
11586 " update_map(gid_map, map_path);\n"
11590 #. type: Plain text
11591 #: build/C/man7/user_namespaces.7:999
11594 " /* Close the write end of the pipe, to signal to the child that we\n"
11595 " have updated the UID and GID maps */\n"
11598 #. type: Plain text
11599 #: build/C/man7/user_namespaces.7:1001
11601 msgid " close(args.pipe_fd[1]);\n"
11604 #. type: Plain text
11605 #: build/C/man7/user_namespaces.7:1004
11608 " if (waitpid(child_pid, NULL, 0) == -1) /* Wait for child */\n"
11609 " errExit(\"waitpid\");\n"
11612 #. type: Plain text
11613 #: build/C/man7/user_namespaces.7:1007
11617 " printf(\"%s: terminating\\en\", argv[0]);\n"
11620 #. type: Plain text
11621 #: build/C/man7/user_namespaces.7:1010
11624 " exit(EXIT_SUCCESS);\n"
11628 #. From the shadow package
11629 #. From the shadow package
11630 #. From the shadow package
11631 #. From the shadow package
11632 #. type: Plain text
11633 #: build/C/man7/user_namespaces.7:1024
11635 "B<newgidmap>(1), B<newuidmap>(1), B<clone>(2), B<setns>(2), B<unshare>(2), "
11636 "B<proc>(5), B<subgid>(5), B<subuid>(5), B<credentials>(7), "
11637 "B<capabilities>(7), B<namespaces>(7), B<pid_namespaces>(7)"
11640 #. type: Plain text
11641 #: build/C/man7/user_namespaces.7:1027
11642 msgid "The kernel source file I<Documentation/namespaces/resource-control.txt>."
11646 #: build/C/man2/seccomp.2:27
11651 #. type: Plain text
11652 #: build/C/man2/seccomp.2:30
11653 msgid "seccomp - operate on Secure Computing state of the process"
11656 #. Kees Cook noted: Anything that uses SECCOMP_RET_TRACE returns will
11657 #. need <sys/ptrace.h>
11658 #. type: Plain text
11659 #: build/C/man2/seccomp.2:39
11662 "B<#include E<lt>linux/seccomp.hE<gt>>\n"
11663 "B<#include E<lt>linux/filter.hE<gt>>\n"
11664 "B<#include E<lt>linux/audit.hE<gt>>\n"
11665 "B<#include E<lt>linux/signal.hE<gt>>\n"
11666 "B<#include E<lt>sys/ptrace.hE<gt>>\n"
11669 #. type: Plain text
11670 #: build/C/man2/seccomp.2:42
11673 "B<int seccomp(unsigned int >I<operation>B<, unsigned int >I<flags>B<, void "
11677 #. type: Plain text
11678 #: build/C/man2/seccomp.2:48
11680 "The B<seccomp>() system call operates on the Secure Computing (seccomp) "
11681 "state of the calling process."
11684 #. type: Plain text
11685 #: build/C/man2/seccomp.2:52
11686 msgid "Currently, Linux supports the following I<operation> values:"
11690 #: build/C/man2/seccomp.2:52
11692 msgid "B<SECCOMP_SET_MODE_STRICT>"
11695 #. type: Plain text
11696 #: build/C/man2/seccomp.2:66
11698 "The only system calls that the calling thread is permitted to make are "
11699 "B<read>(2), B<write>(2), B<_exit>(2), and B<sigreturn>(2). Other system "
11700 "calls result in the delivery of a B<SIGKILL> signal. Strict secure "
11701 "computing mode is useful for number-crunching applications that may need to "
11702 "execute untrusted byte code, perhaps obtained by reading from a pipe or "
11706 #. type: Plain text
11707 #: build/C/man2/seccomp.2:70
11709 "This operation is available only if the kernel is configured with "
11710 "B<CONFIG_SECCOMP> enabled."
11713 #. type: Plain text
11714 #: build/C/man2/seccomp.2:76
11715 msgid "The value of I<flags> must be 0, and I<args> must be NULL."
11718 #. type: Plain text
11719 #: build/C/man2/seccomp.2:78
11720 msgid "This operation is functionally identical to the call:"
11723 #. type: Plain text
11724 #: build/C/man2/seccomp.2:80
11726 msgid " prctl(PR_SET_SECCOMP, SECCOMP_MODE_STRICT);\n"
11730 #: build/C/man2/seccomp.2:80
11732 msgid "B<SECCOMP_SET_MODE_FILTER>"
11735 #. type: Plain text
11736 #: build/C/man2/seccomp.2:95
11738 "The system calls allowed are defined by a pointer to a Berkeley Packet "
11739 "Filter (BPF) passed via I<args>. This argument is a pointer to a I<struct\\ "
11740 "sock_fprog>; it can be designed to filter arbitrary system calls and system "
11741 "call arguments. If the filter is invalid, B<seccomp>() fails, returning "
11742 "B<EINVAL> in I<errno>."
11745 #. type: Plain text
11746 #: build/C/man2/seccomp.2:107
11748 "If B<fork>(2) or B<clone>(2) is allowed by the filter, any child processes "
11749 "will be constrained to the same system call filters as the parent. If "
11750 "B<execve>(2) is allowed, the existing filters will be preserved across a "
11751 "call to B<execve>(2)."
11754 #. type: Plain text
11755 #: build/C/man2/seccomp.2:117
11757 "In order to use the B<SECCOMP_SET_MODE_FILTER> operation, either the caller "
11758 "must have the B<CAP_SYS_ADMIN> capability, or the thread must already have "
11759 "the I<no_new_privs> bit set. If that bit was not already set by an ancestor "
11760 "of this thread, the thread must make the following call:"
11763 #. type: Plain text
11764 #: build/C/man2/seccomp.2:119
11766 msgid " prctl(PR_SET_NO_NEW_PRIVS, 1);\n"
11769 #. type: Plain text
11770 #: build/C/man2/seccomp.2:138
11772 "Otherwise, the B<SECCOMP_SET_MODE_FILTER> operation will fail and return "
11773 "B<EACCES> in I<errno>. This requirement ensures that an unprivileged "
11774 "process cannot apply a malicious filter and then invoke a set-user-ID or "
11775 "other privileged program using B<execve>(2), thus potentially compromising "
11776 "that program. (Such a malicious filter might, for example, cause an attempt "
11777 "to use B<setuid>(2) to set the caller's user IDs to non-zero values to "
11778 "instead return 0 without actually making the system call. Thus, the program "
11779 "might be tricked into retaining superuser privileges in circumstances where "
11780 "it is possible to influence it to do dangerous things because it did not "
11781 "actually drop privileges.)"
11784 #. type: Plain text
11785 #: build/C/man2/seccomp.2:146
11787 "If B<prctl>(2) or B<seccomp>(2) is allowed by the attached filter, further "
11788 "filters may be added. This will increase evaluation time, but allows for "
11789 "further reduction of the attack surface during execution of a thread."
11792 #. type: Plain text
11793 #: build/C/man2/seccomp.2:152
11795 "The B<SECCOMP_SET_MODE_FILTER> operation is available only if the kernel is "
11796 "configured with B<CONFIG_SECCOMP_FILTER> enabled."
11799 #. type: Plain text
11800 #: build/C/man2/seccomp.2:156
11801 msgid "When I<flags> is 0, this operation is functionally identical to the call:"
11804 #. type: Plain text
11805 #: build/C/man2/seccomp.2:158
11807 msgid " prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, args);\n"
11810 #. type: Plain text
11811 #: build/C/man2/seccomp.2:162
11812 msgid "The recognized I<flags> are:"
11816 #: build/C/man2/seccomp.2:163
11818 msgid "B<SECCOMP_FILTER_FLAG_TSYNC>"
11821 #. type: Plain text
11822 #: build/C/man2/seccomp.2:171
11824 "When adding a new filter, synchronize all other threads of the calling "
11825 "process to the same seccomp filter tree. A \"filter tree\" is the ordered "
11826 "list of filters attached to a thread. (Attaching identical filters in "
11827 "separate B<seccomp>() calls results in different filters from this "
11831 #. type: Plain text
11832 #: build/C/man2/seccomp.2:179
11834 "If any thread cannot synchronize to the same filter tree, the call will not "
11835 "attach the new seccomp filter, and will fail, returning the first thread ID "
11836 "found that cannot synchronize. Synchronization will fail if another thread "
11837 "in the same process is in B<SECCOMP_MODE_STRICT> or if it has attached new "
11838 "seccomp filters to itself, diverging from the calling thread's filter tree."
11842 #: build/C/man2/seccomp.2:180
11847 #. type: Plain text
11848 #: build/C/man2/seccomp.2:185
11850 "When adding filters via B<SECCOMP_SET_MODE_FILTER>, I<args> points to a "
11854 #. type: Plain text
11855 #: build/C/man2/seccomp.2:193
11858 "struct sock_fprog {\n"
11859 " unsigned short len; /* Number of BPF instructions */\n"
11860 " struct sock_filter *filter; /* Pointer to array of\n"
11861 " BPF instructions */\n"
11865 #. type: Plain text
11866 #: build/C/man2/seccomp.2:197
11867 msgid "Each program must contain one or more BPF instructions:"
11870 #. type: Plain text
11871 #: build/C/man2/seccomp.2:206
11874 "struct sock_filter { /* Filter block */\n"
11875 " __u16 code; /* Actual filter code */\n"
11876 " __u8 jt; /* Jump true */\n"
11877 " __u8 jf; /* Jump false */\n"
11878 " __u32 k; /* Generic multiuse field */\n"
11882 #. type: Plain text
11883 #: build/C/man2/seccomp.2:213
11885 "When executing the instructions, the BPF program operates on the system call "
11886 "information made available (i.e., use the B<BPF_ABS> addressing mode) as a "
11887 "buffer of the following form:"
11890 #. type: Plain text
11891 #: build/C/man2/seccomp.2:223
11894 "struct seccomp_data {\n"
11895 " int nr; /* System call number */\n"
11896 " __u32 arch; /* AUDIT_ARCH_* value\n"
11897 " (see E<lt>linux/audit.hE<gt>) */\n"
11898 " __u64 instruction_pointer; /* CPU instruction pointer */\n"
11899 " __u64 args[6]; /* Up to 6 system call arguments */\n"
11903 #. type: Plain text
11904 #: build/C/man2/seccomp.2:234
11906 "A seccomp filter returns a 32-bit value consisting of two parts: the most "
11907 "significant 16 bits (corresponding to the mask defined by the constant "
11908 "B<SECCOMP_RET_ACTION>) contain one of the \"action\" values listed below; "
11909 "the least significant 16-bits (defined by the constant B<SECCOMP_RET_DATA>) "
11910 "are \"data\" to be associated with this return value."
11913 #. type: Plain text
11914 #: build/C/man2/seccomp.2:242
11916 "If multiple filters exist, they are all executed, in reverse order of their "
11917 "addition to the filter tree (i.e., the most recently installed filter is "
11918 "executed first). The return value for the evaluation of a given system call "
11919 "is the first-seen B<SECCOMP_RET_ACTION> value of highest precedence (along "
11920 "with its accompanying data) returned by execution of all of the filters."
11923 #. type: Plain text
11924 #: build/C/man2/seccomp.2:245
11926 "In decreasing order of precedence, the values that may be returned by a "
11927 "seccomp filter are:"
11931 #: build/C/man2/seccomp.2:245
11933 msgid "B<SECCOMP_RET_KILL>"
11936 #. type: Plain text
11937 #: build/C/man2/seccomp.2:254
11939 "This value results in the process exiting immediately without executing the "
11940 "system call. The process terminates as though killed by a B<SIGSYS> signal "
11941 "(I<not> B<SIGKILL>)."
11945 #: build/C/man2/seccomp.2:254
11947 msgid "B<SECCOMP_RET_TRAP>"
11950 #. type: Plain text
11951 #: build/C/man2/seccomp.2:264
11953 "This value results in the kernel sending a B<SIGSYS> signal to the "
11954 "triggering process without executing the system call. Various fields will "
11955 "be set in the I<siginfo_t> structure (see B<sigaction>(2)) associated with "
11959 #. type: Plain text
11960 #: build/C/man2/seccomp.2:269
11961 msgid "I<si_signo> will contain B<SIGSYS>."
11964 #. type: Plain text
11965 #: build/C/man2/seccomp.2:272
11966 msgid "I<si_call_addr> will show the address of the system call instruction."
11969 #. type: Plain text
11970 #: build/C/man2/seccomp.2:277
11971 msgid "I<si_syscall> and I<si_arch> will indicate which system call was attempted."
11974 #. type: Plain text
11975 #: build/C/man2/seccomp.2:281
11976 msgid "I<si_code> will contain B<SYS_SECCOMP>."
11979 #. type: Plain text
11980 #: build/C/man2/seccomp.2:286
11982 "I<si_errno> will contain the B<SECCOMP_RET_DATA> portion of the filter "
11986 #. type: Plain text
11987 #: build/C/man2/seccomp.2:295
11989 "The program counter will be as though the system call happened (i.e., it "
11990 "will not point to the system call instruction). The return value register "
11991 "will contain an architecture-dependent value; if resuming execution, set it "
11992 "to something appropriate for the system call. (The architecture dependency "
11993 "is because replacing it with B<ENOSYS> could overwrite some useful "
11998 #: build/C/man2/seccomp.2:295
12000 msgid "B<SECCOMP_RET_ERRNO>"
12003 #. type: Plain text
12004 #: build/C/man2/seccomp.2:302
12006 "This value results in the B<SECCOMP_RET_DATA> portion of the filter's return "
12007 "value being passed to user space as the I<errno> value without executing the "
12012 #: build/C/man2/seccomp.2:302
12014 msgid "B<SECCOMP_RET_TRACE>"
12017 #. type: Plain text
12018 #: build/C/man2/seccomp.2:312
12020 "When returned, this value will cause the kernel to attempt to notify a "
12021 "B<ptrace>(2)-based tracer prior to executing the system call. If there is "
12022 "no tracer present, the system call is not executed and returns a failure "
12023 "status with I<errno> set to B<ENOSYS>."
12026 #. type: Plain text
12027 #: build/C/man2/seccomp.2:323
12029 "A tracer will be notified if it requests B<PTRACE_O_TRACESECCOMP> using "
12030 "I<ptrace(PTRACE_SETOPTIONS)>. The tracer will be notified of a "
12031 "B<PTRACE_EVENT_SECCOMP> and the B<SECCOMP_RET_DATA> portion of the filter's "
12032 "return value will be available to the tracer via B<PTRACE_GETEVENTMSG>."
12035 #. type: Plain text
12036 #: build/C/man2/seccomp.2:330
12038 "The tracer can skip the system call by changing the system call number to "
12039 "-1. Alternatively, the tracer can change the system call requested by "
12040 "changing the system call to a valid system call number. If the tracer asks "
12041 "to skip the system call, then the system call will appear to return the "
12042 "value that the tracer puts in the return value register."
12045 #. type: Plain text
12046 #: build/C/man2/seccomp.2:339
12048 "The seccomp check will not be run again after the tracer is notified. (This "
12049 "means that seccomp-based sandboxes B<must not> allow use of "
12050 "B<ptrace>(2)\\(emeven of other sandboxed processes\\(emwithout extreme care; "
12051 "ptracers can use this mechanism to escape from the seccomp sandbox.)"
12055 #: build/C/man2/seccomp.2:339
12057 msgid "B<SECCOMP_RET_ALLOW>"
12060 #. type: Plain text
12061 #: build/C/man2/seccomp.2:342
12062 msgid "This value results in the system call being executed."
12065 #. type: Plain text
12066 #: build/C/man2/seccomp.2:358
12068 "On success, B<seccomp>() returns 0. On error, if "
12069 "B<SECCOMP_FILTER_FLAG_TSYNC> was used, the return value is the ID of the "
12070 "thread that caused the synchronization failure. (This ID is a kernel thread "
12071 "ID of the type returned by B<clone>(2) and B<gettid>(2).) On other errors, "
12072 "-1 is returned, and I<errno> is set to indicate the cause of the error."
12075 #. type: Plain text
12076 #: build/C/man2/seccomp.2:361
12077 msgid "B<seccomp>() can fail for the following reasons:"
12081 #: build/C/man2/seccomp.2:361
12086 #. type: Plain text
12087 #: build/C/man2/seccomp.2:369
12089 "The caller did not have the B<CAP_SYS_ADMIN> capability, or had not set "
12090 "I<no_new_privs> before using B<SECCOMP_SET_MODE_FILTER>."
12093 #. type: Plain text
12094 #: build/C/man2/seccomp.2:373
12095 msgid "I<args> was not a valid address."
12098 #. type: Plain text
12099 #: build/C/man2/seccomp.2:380
12100 msgid "I<operation> is unknown; or I<flags> are invalid for the given I<operation>."
12103 #. type: Plain text
12104 #: build/C/man2/seccomp.2:387
12106 "I<operation> included B<BPF_ABS>, but the specified offset was not aligned "
12107 "to a 32-bit boundary or exceeded I<sizeof(struct\\ seccomp_data)>."
12110 #. See kernel/seccomp.c::seccomp_may_assign_mode() in 3.18 sources
12111 #. type: Plain text
12112 #: build/C/man2/seccomp.2:393
12114 "A secure computing mode has already been set, and I<operation> differs from "
12115 "the existing setting."
12118 #. See stub kernel/seccomp.c::seccomp_set_mode_filter() in 3.18 sources
12119 #. type: Plain text
12120 #: build/C/man2/seccomp.2:402
12122 "I<operation> specified B<SECCOMP_SET_MODE_FILTER>, but the kernel was not "
12123 "built with B<CONFIG_SECCOMP_FILTER> enabled."
12126 #. type: Plain text
12127 #: build/C/man2/seccomp.2:413
12129 "I<operation> specified B<SECCOMP_SET_MODE_FILTER>, but the filter program "
12130 "pointed to by I<args> was not valid or the length of the filter program was "
12131 "zero or exceeded B<BPF_MAXINSNS> (4096) instructions. B<EINVAL>"
12134 #. ENOMEM in kernel/seccomp.c::seccomp_attach_filter() in 3.18 sources
12135 #. type: Plain text
12136 #: build/C/man2/seccomp.2:426
12138 "The total length of all filter programs attached to the calling thread would "
12139 "exceed B<MAX_INSNS_PER_PATH> (32768) instructions. Note that for the "
12140 "purposes of calculating this limit, each already existing filter program "
12141 "incurs an overhead penalty of 4 instructions."
12144 #. type: Plain text
12145 #: build/C/man2/seccomp.2:430
12147 "Another thread caused a failure during thread sync, but its ID could not be "
12151 #. FIXME . Add glibc version
12152 #. type: Plain text
12153 #: build/C/man2/seccomp.2:435
12154 msgid "The B<seccomp>() system call first appeared in Linux 3.17."
12157 #. type: Plain text
12158 #: build/C/man2/seccomp.2:439
12159 msgid "The B<seccomp>() system call is a nonstandard Linux extension."
12162 #. type: Plain text
12163 #: build/C/man2/seccomp.2:446
12165 "The I<Seccomp> field of the I</proc/[pid]/status> file provides a method of "
12166 "viewing the seccomp mode of a process; see B<proc>(5)."
12169 #. type: Plain text
12170 #: build/C/man2/seccomp.2:453
12172 "B<seccomp>() provides a superset of the functionality provided by the "
12173 "B<prctl>(2) B<PR_SET_SECCOMP> operation (which does not support I<flags>)."
12177 #: build/C/man2/seccomp.2:453
12179 msgid "Seccomp-specific BPF details"
12182 #. type: Plain text
12183 #: build/C/man2/seccomp.2:455
12184 msgid "Note the following BPF details specific to seccomp filters:"
12187 #. type: Plain text
12188 #: build/C/man2/seccomp.2:463
12190 "The B<BPF_H> and B<BPF_B> size modifiers are not supported: all operations "
12191 "must load and store (4-byte) words (B<BPF_W>)."
12194 #. type: Plain text
12195 #: build/C/man2/seccomp.2:469
12197 "To access the contents of the I<seccomp_data> buffer, use the B<BPF_ABS> "
12198 "addressing mode modifier."
12201 #. type: Plain text
12202 #: build/C/man2/seccomp.2:476
12204 "The B<BPF_LEN> addressing mode modifier yields an immediate mode operand "
12205 "whose value is the size of the I<seccomp_data> buffer."
12208 #. type: Plain text
12209 #: build/C/man2/seccomp.2:482
12211 "The program below accepts four or more arguments. The first three arguments "
12212 "are a system call number, a numeric architecture identifier, and an error "
12213 "number. The program uses these values to construct a BPF filter that is "
12214 "used at run time to perform the following checks:"
12218 #: build/C/man2/seccomp.2:482
12223 #. type: Plain text
12224 #: build/C/man2/seccomp.2:486
12226 "If the program is not running on the specified architecture, the BPF filter "
12227 "causes system calls to fail with the error B<ENOSYS>."
12231 #: build/C/man2/seccomp.2:486
12236 #. type: Plain text
12237 #: build/C/man2/seccomp.2:491
12239 "If the program attempts to execute the system call with the specified "
12240 "number, the BPF filter causes the system call to fail, with I<errno> being "
12241 "set to the specified error number."
12244 #. type: Plain text
12245 #: build/C/man2/seccomp.2:500
12247 "The remaining command-line arguments specify the pathname and additional "
12248 "arguments of a program that the example program should attempt to execute "
12249 "using B<execve>(3) (a library function that employs the B<execve>(2) "
12250 "system call). Some example runs of the program are shown below."
12253 #. type: Plain text
12254 #: build/C/man2/seccomp.2:504
12256 "First, we display the architecture that we are running on (x86-64) and then "
12257 "construct a shell function that looks up system call numbers on this "
12261 #. type: Plain text
12262 #: build/C/man2/seccomp.2:513
12267 "$ B<syscall_nr() {\n"
12268 " cat /usr/src/linux/arch/x86/syscalls/syscall_64.tbl | \\e\n"
12269 " awk '$2 != \"x32\" && $3 == \"'$1'\" { print $1 }'\n"
12273 #. type: Plain text
12274 #: build/C/man2/seccomp.2:520
12276 "When the BPF filter rejects a system call (case [2] above), it causes the "
12277 "system call to fail with the error number specified on the command line. In "
12278 "the experiments shown here, we'll use error number 99:"
12281 #. type: Plain text
12282 #: build/C/man2/seccomp.2:525
12286 "EADDRNOTAVAIL 99 Cannot assign requested address\n"
12289 #. type: Plain text
12290 #: build/C/man2/seccomp.2:533
12292 "In the following example, we attempt to run the command B<whoami>(1), but "
12293 "the BPF filter rejects the B<execve>(2) system call, so that the command is "
12294 "not even executed:"
12297 #. type: Plain text
12298 #: build/C/man2/seccomp.2:544
12301 "$ B<syscall_nr execve>\n"
12304 "Usage: ./a.out E<lt>syscall_nrE<gt> E<lt>archE<gt> E<lt>errnoE<gt> "
12305 "E<lt>progE<gt> [E<lt>argsE<gt>]\n"
12306 "Hint for E<lt>archE<gt>: AUDIT_ARCH_I386: 0x40000003\n"
12307 " AUDIT_ARCH_X86_64: 0xC000003E\n"
12308 "$ B<./a.out 59 0xC000003E 99 /bin/whoami>\n"
12309 "execv: Cannot assign requested address\n"
12312 #. type: Plain text
12313 #: build/C/man2/seccomp.2:552
12315 "In the next example, the BPF filter rejects the B<write>(2) system call, so "
12316 "that, although it is successfully started, the B<whoami>(1) command is not "
12317 "able to write output:"
12320 #. type: Plain text
12321 #: build/C/man2/seccomp.2:558
12324 "$ B<syscall_nr write>\n"
12326 "$ B<./a.out 1 0xC000003E 99 /bin/whoami>\n"
12329 #. type: Plain text
12330 #: build/C/man2/seccomp.2:565
12332 "In the final example, the BPF filter rejects a system call that is not used "
12333 "by the B<whoami>(1) command, so it is able to successfully execute and "
12337 #. type: Plain text
12338 #: build/C/man2/seccomp.2:572
12341 "$ B<syscall_nr preadv>\n"
12343 "$ B<./a.out 295 0xC000003E 99 /bin/whoami>\n"
12347 #. type: Plain text
12348 #: build/C/man2/seccomp.2:586
12351 "#include E<lt>errno.hE<gt>\n"
12352 "#include E<lt>stddef.hE<gt>\n"
12353 "#include E<lt>stdio.hE<gt>\n"
12354 "#include E<lt>stdlib.hE<gt>\n"
12355 "#include E<lt>unistd.hE<gt>\n"
12356 "#include E<lt>linux/audit.hE<gt>\n"
12357 "#include E<lt>linux/filter.hE<gt>\n"
12358 "#include E<lt>linux/seccomp.hE<gt>\n"
12359 "#include E<lt>sys/prctl.hE<gt>\n"
12362 #. type: Plain text
12363 #: build/C/man2/seccomp.2:595
12367 "install_filter(int syscall_nr, int t_arch, int f_errno)\n"
12369 " struct sock_filter filter[] = {\n"
12370 " /* [0] Load architecture from 'seccomp_data' buffer into\n"
12371 " accumulator */\n"
12372 " BPF_STMT(BPF_LD | BPF_W | BPF_ABS,\n"
12373 " (offsetof(struct seccomp_data, arch))),\n"
12376 #. type: Plain text
12377 #: build/C/man2/seccomp.2:599
12380 " /* [1] Jump forward 4 instructions if architecture does not\n"
12381 " match 't_arch' */\n"
12382 " BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, t_arch, 0, 4),\n"
12385 #. type: Plain text
12386 #: build/C/man2/seccomp.2:604
12389 " /* [2] Load system call number from 'seccomp_data' buffer into\n"
12390 " accumulator */\n"
12391 " BPF_STMT(BPF_LD | BPF_W | BPF_ABS,\n"
12392 " (offsetof(struct seccomp_data, nr))),\n"
12395 #. type: Plain text
12396 #: build/C/man2/seccomp.2:608
12399 " /* [3] Jump forward 1 instruction if system call number\n"
12400 " does not match 'syscall_nr' */\n"
12401 " BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, syscall_nr, 0, 1),\n"
12404 #. type: Plain text
12405 #: build/C/man2/seccomp.2:613
12408 " /* [4] Matching architecture and system call: don't execute\n"
12409 "\t the system call, and return 'f_errno' in 'errno' */\n"
12410 " BPF_STMT(BPF_RET | BPF_K,\n"
12411 " SECCOMP_RET_ERRNO | (f_errno & SECCOMP_RET_DATA)),\n"
12414 #. type: Plain text
12415 #: build/C/man2/seccomp.2:617
12418 " /* [5] Destination of system call number mismatch: allow other\n"
12419 " system calls */\n"
12420 " BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ALLOW),\n"
12423 #. type: Plain text
12424 #: build/C/man2/seccomp.2:621
12427 " /* [6] Destination of architecture mismatch: kill process */\n"
12428 " BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_KILL),\n"
12432 #. type: Plain text
12433 #: build/C/man2/seccomp.2:626
12436 " struct sock_fprog prog = {\n"
12437 " .len = (unsigned short) (sizeof(filter) / sizeof(filter[0])),\n"
12438 " .filter = filter,\n"
12442 #. type: Plain text
12443 #: build/C/man2/seccomp.2:631
12446 " if (seccomp(SECCOMP_SET_MODE_FILTER, 0, &prog)) {\n"
12447 " perror(\"seccomp\");\n"
12452 #. type: Plain text
12453 #: build/C/man2/seccomp.2:634
12460 #. type: Plain text
12461 #: build/C/man2/seccomp.2:646
12465 "main(int argc, char **argv)\n"
12467 " if (argc E<lt> 5) {\n"
12468 " fprintf(stderr, \"Usage: \"\n"
12469 " \"%s E<lt>syscall_nrE<gt> E<lt>archE<gt> E<lt>errnoE<gt> "
12470 "E<lt>progE<gt> [E<lt>argsE<gt>]\\en\"\n"
12471 " \"Hint for E<lt>archE<gt>: AUDIT_ARCH_I386: 0x%X\\en\"\n"
12472 " \" AUDIT_ARCH_X86_64: 0x%X\\en\"\n"
12473 " \"\\en\", argv[0], AUDIT_ARCH_I386, AUDIT_ARCH_X86_64);\n"
12474 " exit(EXIT_FAILURE);\n"
12478 #. type: Plain text
12479 #: build/C/man2/seccomp.2:651
12482 " if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)) {\n"
12483 " perror(\"prctl\");\n"
12484 " exit(EXIT_FAILURE);\n"
12488 #. type: Plain text
12489 #: build/C/man2/seccomp.2:656
12492 " if (install_filter(strtol(argv[1], NULL, 0),\n"
12493 " strtol(argv[2], NULL, 0),\n"
12494 " strtol(argv[3], NULL, 0)))\n"
12495 " exit(EXIT_FAILURE);\n"
12498 #. type: Plain text
12499 #: build/C/man2/seccomp.2:661
12502 " execv(argv[4], &argv[4]);\n"
12503 " perror(\"execv\");\n"
12504 " exit(EXIT_FAILURE);\n"
12508 #. type: Plain text
12509 #: build/C/man2/seccomp.2:668
12510 msgid "B<prctl>(2), B<ptrace>(2), B<sigaction>(2), B<signal>(7), B<socket>(7)"
12513 #. type: Plain text
12514 #: build/C/man2/seccomp.2:673
12516 "The kernel source files I<Documentation/networking/filter.txt> and "
12517 "I<Documentation/prctl/seccomp_filter.txt>."
12520 #. type: Plain text
12521 #: build/C/man2/seccomp.2:679
12523 "McCanne, S. and Jacobson, V. (1992) I<The BSD Packet Filter: A New "
12524 "Architecture for User-level Packet Capture>, Proceedings of the USENIX "
12525 "Winter 1993 Conference E<.UR http://www.tcpdump.org/papers/bpf-usenix93.pdf> "