OSDN Git Service

(split) LDP: Update POT and ja.po to LDP v3.65
[linuxjm/LDP_man-pages.git] / po4a / sched / po / sched.pot
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.
5 #
6 #, fuzzy
7 msgid ""
8 msgstr ""
9 "Project-Id-Version: PACKAGE VERSION\n"
10 "POT-Creation-Date: 2014-04-24 00:51+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"
14 "Language: \n"
15 "MIME-Version: 1.0\n"
16 "Content-Type: text/plain; charset=UTF-8\n"
17 "Content-Transfer-Encoding: 8bit\n"
18
19 #. type: TH
20 #: build/C/man3/CPU_SET.3:27
21 #, no-wrap
22 msgid "CPU_SET"
23 msgstr ""
24
25 #. type: TH
26 #: build/C/man3/CPU_SET.3:27
27 #, no-wrap
28 msgid "2012-03-15"
29 msgstr ""
30
31 #. type: TH
32 #: build/C/man3/CPU_SET.3:27 build/C/man2/clone.2:45 build/C/man2/kcmp.2:28 build/C/man2/sched_get_priority_max.2:29 build/C/man3/sched_getcpu.3:26 build/C/man2/sched_rr_get_interval.2:29 build/C/man2/sched_setaffinity.2:34 build/C/man2/sched_setparam.2:30 build/C/man2/sched_setscheduler.2:46 build/C/man2/sched_yield.2:29 build/C/man2/setns.2:8 build/C/man2/unshare.2:20
33 #, no-wrap
34 msgid "Linux"
35 msgstr ""
36
37 #. type: TH
38 #: build/C/man3/CPU_SET.3:27 build/C/man2/clone.2:45 build/C/man2/kcmp.2:28 build/C/man2/sched_get_priority_max.2:29 build/C/man3/sched_getcpu.3:26 build/C/man2/sched_rr_get_interval.2:29 build/C/man2/sched_setaffinity.2:34 build/C/man2/sched_setparam.2:30 build/C/man2/sched_setscheduler.2:46 build/C/man2/sched_yield.2:29 build/C/man2/setns.2:8 build/C/man2/unshare.2:20
39 #, no-wrap
40 msgid "Linux Programmer's Manual"
41 msgstr ""
42
43 #. type: SH
44 #: build/C/man3/CPU_SET.3:28 build/C/man2/clone.2:46 build/C/man2/kcmp.2:29 build/C/man2/sched_get_priority_max.2:30 build/C/man3/sched_getcpu.3:27 build/C/man2/sched_rr_get_interval.2:30 build/C/man2/sched_setaffinity.2:35 build/C/man2/sched_setparam.2:31 build/C/man2/sched_setscheduler.2:47 build/C/man2/sched_yield.2:30 build/C/man2/setns.2:9 build/C/man2/unshare.2:21
45 #, no-wrap
46 msgid "NAME"
47 msgstr ""
48
49 #. type: Plain text
50 #: build/C/man3/CPU_SET.3:35
51 msgid ""
52 "CPU_SET, CPU_CLR, CPU_ISSET, CPU_ZERO, CPU_COUNT, CPU_AND, CPU_OR, CPU_XOR, "
53 "CPU_EQUAL, CPU_ALLOC, CPU_ALLOC_SIZE, CPU_FREE, CPU_SET_S, CPU_CLR_S, "
54 "CPU_ISSET_S, CPU_ZERO_S, CPU_COUNT_S, CPU_AND_S, CPU_OR_S, CPU_XOR_S, "
55 "CPU_EQUAL_S - macros for manipulating CPU sets"
56 msgstr ""
57
58 #. type: SH
59 #: build/C/man3/CPU_SET.3:35 build/C/man2/clone.2:48 build/C/man2/kcmp.2:31 build/C/man2/sched_get_priority_max.2:32 build/C/man3/sched_getcpu.3:29 build/C/man2/sched_rr_get_interval.2:32 build/C/man2/sched_setaffinity.2:38 build/C/man2/sched_setparam.2:33 build/C/man2/sched_setscheduler.2:50 build/C/man2/sched_yield.2:32 build/C/man2/setns.2:11 build/C/man2/unshare.2:23
60 #, no-wrap
61 msgid "SYNOPSIS"
62 msgstr ""
63
64 #. type: Plain text
65 #: build/C/man3/CPU_SET.3:39 build/C/man2/sched_setaffinity.2:42 build/C/man2/setns.2:15
66 #, no-wrap
67 msgid ""
68 "B<#define _GNU_SOURCE>             /* See feature_test_macros(7) */\n"
69 "B<#include E<lt>sched.hE<gt>>\n"
70 msgstr ""
71
72 #. type: Plain text
73 #: build/C/man3/CPU_SET.3:41
74 #, no-wrap
75 msgid "B<void CPU_ZERO(cpu_set_t *>I<set>B<);>\n"
76 msgstr ""
77
78 #. type: Plain text
79 #: build/C/man3/CPU_SET.3:45
80 #, no-wrap
81 msgid ""
82 "B<void CPU_SET(int >I<cpu>B<, cpu_set_t *>I<set>B<);>\n"
83 "B<void CPU_CLR(int >I<cpu>B<, cpu_set_t *>I<set>B<);>\n"
84 "B<int  CPU_ISSET(int >I<cpu>B<, cpu_set_t *>I<set>B<);>\n"
85 msgstr ""
86
87 #. type: Plain text
88 #: build/C/man3/CPU_SET.3:47
89 #, no-wrap
90 msgid "B<int  CPU_COUNT(cpu_set_t *>I<set>B<);>\n"
91 msgstr ""
92
93 #. type: Plain text
94 #: build/C/man3/CPU_SET.3:54
95 #, no-wrap
96 msgid ""
97 "B<void CPU_AND(cpu_set_t *>I<destset>B<,>\n"
98 "B<             cpu_set_t *>I<srcset1>B<, cpu_set_t *>I<srcset2>B<);>\n"
99 "B<void CPU_OR(cpu_set_t *>I<destset>B<,>\n"
100 "B<             cpu_set_t *>I<srcset1>B<, cpu_set_t *>I<srcset2>B<);>\n"
101 "B<void CPU_XOR(cpu_set_t *>I<destset>B<,>\n"
102 "B<             cpu_set_t *>I<srcset1>B<, cpu_set_t *>I<srcset2>B<);>\n"
103 msgstr ""
104
105 #. type: Plain text
106 #: build/C/man3/CPU_SET.3:56
107 #, no-wrap
108 msgid "B<int  CPU_EQUAL(cpu_set_t *>I<set1>B<, cpu_set_t *>I<set2>B<);>\n"
109 msgstr ""
110
111 #. type: Plain text
112 #: build/C/man3/CPU_SET.3:60
113 #, no-wrap
114 msgid ""
115 "B<cpu_set_t *CPU_ALLOC(int >I<num_cpus>B<);>\n"
116 "B<void CPU_FREE(cpu_set_t *>I<set>B<);>\n"
117 "B<size_t CPU_ALLOC_SIZE(int >I<num_cpus>B<);>\n"
118 msgstr ""
119
120 #. type: Plain text
121 #: build/C/man3/CPU_SET.3:62
122 #, no-wrap
123 msgid "B<void CPU_ZERO_S(size_t >I<setsize>B<, cpu_set_t *>I<set>B<);>\n"
124 msgstr ""
125
126 #. type: Plain text
127 #: build/C/man3/CPU_SET.3:66
128 #, no-wrap
129 msgid ""
130 "B<void CPU_SET_S(int >I<cpu>B<, size_t >I<setsize>B<, cpu_set_t "
131 "*>I<set>B<);>\n"
132 "B<void CPU_CLR_S(int >I<cpu>B<, size_t >I<setsize>B<, cpu_set_t "
133 "*>I<set>B<);>\n"
134 "B<int  CPU_ISSET_S(int >I<cpu>B<, size_t >I<setsize>B<, cpu_set_t "
135 "*>I<set>B<);>\n"
136 msgstr ""
137
138 #. type: Plain text
139 #: build/C/man3/CPU_SET.3:68
140 #, no-wrap
141 msgid "B<int  CPU_COUNT_S(size_t >I<setsize>B<, cpu_set_t *>I<set>B<);>\n"
142 msgstr ""
143
144 #. type: Plain text
145 #: build/C/man3/CPU_SET.3:75
146 #, no-wrap
147 msgid ""
148 "B<void CPU_AND_S(size_t >I<setsize>B<, cpu_set_t *>I<destset>B<,>\n"
149 "B<             cpu_set_t *>I<srcset1>B<, cpu_set_t *>I<srcset2>B<);>\n"
150 "B<void CPU_OR_S(size_t >I<setsize>B<, cpu_set_t *>I<destset>B<,>\n"
151 "B<             cpu_set_t *>I<srcset1>B<, cpu_set_t *>I<srcset2>B<);>\n"
152 "B<void CPU_XOR_S(size_t >I<setsize>B<, cpu_set_t *>I<destset>B<,>\n"
153 "B<             cpu_set_t *>I<srcset1>B<, cpu_set_t *>I<srcset2>B<);>\n"
154 msgstr ""
155
156 #. type: Plain text
157 #: build/C/man3/CPU_SET.3:78
158 #, no-wrap
159 msgid ""
160 "B<int  CPU_EQUAL_S(size_t >I<setsize>B<, cpu_set_t *>I<set1>B<, cpu_set_t "
161 "*>I<set2>B<);>\n"
162 msgstr ""
163
164 #. type: SH
165 #: build/C/man3/CPU_SET.3:79 build/C/man2/clone.2:86 build/C/man2/kcmp.2:41 build/C/man2/sched_get_priority_max.2:38 build/C/man3/sched_getcpu.3:55 build/C/man2/sched_rr_get_interval.2:36 build/C/man2/sched_setaffinity.2:49 build/C/man2/sched_setparam.2:47 build/C/man2/sched_setscheduler.2:66 build/C/man2/sched_yield.2:36 build/C/man2/setns.2:18 build/C/man2/unshare.2:50
166 #, no-wrap
167 msgid "DESCRIPTION"
168 msgstr ""
169
170 #. type: Plain text
171 #: build/C/man3/CPU_SET.3:86
172 msgid ""
173 "The I<cpu_set_t> data structure represents a set of CPUs.  CPU sets are used "
174 "by B<sched_setaffinity>(2)  and similar interfaces."
175 msgstr ""
176
177 #. type: Plain text
178 #: build/C/man3/CPU_SET.3:93
179 msgid ""
180 "The I<cpu_set_t> data type is implemented as a bitset.  However, the data "
181 "structure treated as considered opaque: all manipulation of CPU sets should "
182 "be done via the macros described in this page."
183 msgstr ""
184
185 #. type: Plain text
186 #: build/C/man3/CPU_SET.3:96
187 msgid "The following macros are provided to operate on the CPU set I<set>:"
188 msgstr ""
189
190 #. type: TP
191 #: build/C/man3/CPU_SET.3:96
192 #, no-wrap
193 msgid "B<CPU_ZERO>()"
194 msgstr ""
195
196 #. type: Plain text
197 #: build/C/man3/CPU_SET.3:101
198 msgid "Clears I<set>, so that it contains no CPUs."
199 msgstr ""
200
201 #. type: TP
202 #: build/C/man3/CPU_SET.3:101
203 #, no-wrap
204 msgid "B<CPU_SET>()"
205 msgstr ""
206
207 #. type: Plain text
208 #: build/C/man3/CPU_SET.3:107
209 msgid "Add CPU I<cpu> to I<set>."
210 msgstr ""
211
212 #. type: TP
213 #: build/C/man3/CPU_SET.3:107
214 #, no-wrap
215 msgid "B<CPU_CLR>()"
216 msgstr ""
217
218 #. type: Plain text
219 #: build/C/man3/CPU_SET.3:113
220 msgid "Remove CPU I<cpu> from I<set>."
221 msgstr ""
222
223 #. type: TP
224 #: build/C/man3/CPU_SET.3:113
225 #, no-wrap
226 msgid "B<CPU_ISSET>()"
227 msgstr ""
228
229 #. type: Plain text
230 #: build/C/man3/CPU_SET.3:119
231 msgid "Test to see if CPU I<cpu> is a member of I<set>."
232 msgstr ""
233
234 #. type: TP
235 #: build/C/man3/CPU_SET.3:119
236 #, no-wrap
237 msgid "B<CPU_COUNT>()"
238 msgstr ""
239
240 #. type: Plain text
241 #: build/C/man3/CPU_SET.3:123
242 msgid "Return the number of CPUs in I<set>."
243 msgstr ""
244
245 #. type: Plain text
246 #: build/C/man3/CPU_SET.3:128
247 msgid ""
248 "Where a I<cpu> argument is specified, it should not produce side effects, "
249 "since the above macros may evaluate the argument more than once."
250 msgstr ""
251
252 #. type: Plain text
253 #: build/C/man3/CPU_SET.3:139
254 msgid ""
255 "The first available CPU on the system corresponds to a I<cpu> value of 0, "
256 "the next CPU corresponds to a I<cpu> value of 1, and so on.  The constant "
257 "B<CPU_SETSIZE> (currently 1024) specifies a value one greater than the "
258 "maximum CPU number that can be stored in I<cpu_set_t>."
259 msgstr ""
260
261 #. type: Plain text
262 #: build/C/man3/CPU_SET.3:141
263 msgid "The following macros perform logical operations on CPU sets:"
264 msgstr ""
265
266 #. type: TP
267 #: build/C/man3/CPU_SET.3:141
268 #, no-wrap
269 msgid "B<CPU_AND>()"
270 msgstr ""
271
272 #. type: Plain text
273 #: build/C/man3/CPU_SET.3:150
274 msgid ""
275 "Store the intersection of the sets I<srcset1> and I<srcset2> in I<destset> "
276 "(which may be one of the source sets)."
277 msgstr ""
278
279 #. type: TP
280 #: build/C/man3/CPU_SET.3:150
281 #, no-wrap
282 msgid "B<CPU_OR>()"
283 msgstr ""
284
285 #. type: Plain text
286 #: build/C/man3/CPU_SET.3:159
287 msgid ""
288 "Store the union of the sets I<srcset1> and I<srcset2> in I<destset> (which "
289 "may be one of the source sets)."
290 msgstr ""
291
292 #. type: TP
293 #: build/C/man3/CPU_SET.3:159
294 #, no-wrap
295 msgid "B<CPU_XOR>()"
296 msgstr ""
297
298 #. type: Plain text
299 #: build/C/man3/CPU_SET.3:173
300 msgid ""
301 "Store the XOR of the sets I<srcset1> and I<srcset2> in I<destset> (which may "
302 "be one of the source sets).  The XOR means the set of CPUs that are in "
303 "either I<srcset1> or I<srcset2>, but not both."
304 msgstr ""
305
306 #. type: TP
307 #: build/C/man3/CPU_SET.3:173
308 #, no-wrap
309 msgid "B<CPU_EQUAL>()"
310 msgstr ""
311
312 #. type: Plain text
313 #: build/C/man3/CPU_SET.3:176
314 msgid "Test whether two CPU set contain exactly the same CPUs."
315 msgstr ""
316
317 #. type: SS
318 #: build/C/man3/CPU_SET.3:176
319 #, no-wrap
320 msgid "Dynamically sized CPU sets"
321 msgstr ""
322
323 #. type: Plain text
324 #: build/C/man3/CPU_SET.3:182
325 msgid ""
326 "Because some applications may require the ability to dynamically size CPU "
327 "sets (e.g., to allocate sets larger than that defined by the standard "
328 "I<cpu_set_t> data type), glibc nowadays provides a set of macros to support "
329 "this."
330 msgstr ""
331
332 #. type: Plain text
333 #: build/C/man3/CPU_SET.3:184
334 msgid "The following macros are used to allocate and deallocate CPU sets:"
335 msgstr ""
336
337 #. type: TP
338 #: build/C/man3/CPU_SET.3:184
339 #, no-wrap
340 msgid "B<CPU_ALLOC>()"
341 msgstr ""
342
343 #. type: Plain text
344 #: build/C/man3/CPU_SET.3:189
345 msgid ""
346 "Allocate a CPU set large enough to hold CPUs in the range 0 to "
347 "I<num_cpus-1>."
348 msgstr ""
349
350 #. type: TP
351 #: build/C/man3/CPU_SET.3:189
352 #, no-wrap
353 msgid "B<CPU_ALLOC_SIZE>()"
354 msgstr ""
355
356 #. type: Plain text
357 #: build/C/man3/CPU_SET.3:199
358 msgid ""
359 "Return the size in bytes of the CPU set that would be needed to hold CPUs in "
360 "the range 0 to I<num_cpus-1>.  This macro provides the value that can be "
361 "used for the I<setsize> argument in the B<CPU_*_S>()  macros described "
362 "below."
363 msgstr ""
364
365 #. type: TP
366 #: build/C/man3/CPU_SET.3:199
367 #, no-wrap
368 msgid "B<CPU_FREE>()"
369 msgstr ""
370
371 #. type: Plain text
372 #: build/C/man3/CPU_SET.3:203
373 msgid "Free a CPU set previously allocated by B<CPU_ALLOC>()."
374 msgstr ""
375
376 #. type: Plain text
377 #: build/C/man3/CPU_SET.3:210
378 msgid ""
379 "The macros whose names end with \"_S\" are the analogs of the similarly "
380 "named macros without the suffix.  These macros perform the same tasks as "
381 "their analogs, but operate on the dynamically allocated CPU set(s) whose "
382 "size is I<setsize> bytes."
383 msgstr ""
384
385 #. type: SH
386 #: build/C/man3/CPU_SET.3:210 build/C/man2/clone.2:878 build/C/man2/kcmp.2:127 build/C/man2/sched_get_priority_max.2:100 build/C/man3/sched_getcpu.3:58 build/C/man2/sched_rr_get_interval.2:73 build/C/man2/sched_setaffinity.2:107 build/C/man2/sched_setparam.2:87 build/C/man2/sched_setscheduler.2:423 build/C/man2/sched_yield.2:41 build/C/man2/setns.2:70 build/C/man2/unshare.2:207
387 #, no-wrap
388 msgid "RETURN VALUE"
389 msgstr ""
390
391 #. type: Plain text
392 #: build/C/man3/CPU_SET.3:219
393 msgid ""
394 "B<CPU_ISSET>()  and B<CPU_ISSET_S>()  return nonzero if I<cpu> is in I<set>; "
395 "otherwise, it returns 0."
396 msgstr ""
397
398 #. type: Plain text
399 #: build/C/man3/CPU_SET.3:225
400 msgid "B<CPU_COUNT>()  and B<CPU_COUNT_S>()  return the number of CPUs in I<set>."
401 msgstr ""
402
403 #. type: Plain text
404 #: build/C/man3/CPU_SET.3:230
405 msgid ""
406 "B<CPU_EQUAL>()  and B<CPU_EQUAL_S>()  return nonzero if the two CPU sets are "
407 "equal; otherwise it returns 0."
408 msgstr ""
409
410 #. type: Plain text
411 #: build/C/man3/CPU_SET.3:235
412 msgid ""
413 "B<CPU_ALLOC>()  returns a pointer on success, or NULL on failure.  (Errors "
414 "are as for B<malloc>(3).)"
415 msgstr ""
416
417 #. type: Plain text
418 #: build/C/man3/CPU_SET.3:239
419 msgid ""
420 "B<CPU_ALLOC_SIZE>()  returns the number of bytes required to store a CPU set "
421 "of the specified cardinality."
422 msgstr ""
423
424 #. type: Plain text
425 #: build/C/man3/CPU_SET.3:241
426 msgid "The other functions do not return a value."
427 msgstr ""
428
429 #. type: SH
430 #: build/C/man3/CPU_SET.3:241 build/C/man2/clone.2:995 build/C/man2/kcmp.2:198 build/C/man3/sched_getcpu.3:70 build/C/man2/sched_setaffinity.2:148 build/C/man2/setns.2:97 build/C/man2/unshare.2:224
431 #, no-wrap
432 msgid "VERSIONS"
433 msgstr ""
434
435 #. type: Plain text
436 #: build/C/man3/CPU_SET.3:249
437 msgid ""
438 "The B<CPU_ZERO>(), B<CPU_SET>(), B<CPU_CLR>(), and B<CPU_ISSET>()  macros "
439 "were added in glibc 2.3.3."
440 msgstr ""
441
442 #. type: Plain text
443 #: build/C/man3/CPU_SET.3:252
444 msgid "B<CPU_COUNT>()  first appeared in glibc 2.6."
445 msgstr ""
446
447 #. type: Plain text
448 #: build/C/man3/CPU_SET.3:270
449 msgid ""
450 "B<CPU_AND>(), B<CPU_OR>(), B<CPU_XOR>(), B<CPU_EQUAL>(), B<CPU_ALLOC>(), "
451 "B<CPU_ALLOC_SIZE>(), B<CPU_FREE>(), B<CPU_ZERO_S>(), B<CPU_SET_S>(), "
452 "B<CPU_CLR_S>(), B<CPU_ISSET_S>(), B<CPU_AND_S>(), B<CPU_OR_S>(), "
453 "B<CPU_XOR_S>(), and B<CPU_EQUAL_S>()  first appeared in glibc 2.7."
454 msgstr ""
455
456 #. type: SH
457 #: build/C/man3/CPU_SET.3:270 build/C/man2/clone.2:1002 build/C/man2/kcmp.2:202 build/C/man2/sched_get_priority_max.2:116 build/C/man3/sched_getcpu.3:72 build/C/man2/sched_rr_get_interval.2:94 build/C/man2/sched_setaffinity.2:159 build/C/man2/sched_setparam.2:110 build/C/man2/sched_setscheduler.2:445 build/C/man2/sched_yield.2:52 build/C/man2/setns.2:102 build/C/man2/unshare.2:228
458 #, no-wrap
459 msgid "CONFORMING TO"
460 msgstr ""
461
462 #. type: Plain text
463 #: build/C/man3/CPU_SET.3:272
464 msgid "These interfaces are Linux-specific."
465 msgstr ""
466
467 #. type: SH
468 #: build/C/man3/CPU_SET.3:272 build/C/man2/clone.2:1006 build/C/man2/kcmp.2:205 build/C/man3/sched_getcpu.3:75 build/C/man2/sched_rr_get_interval.2:96 build/C/man2/sched_setaffinity.2:161 build/C/man2/sched_setparam.2:112 build/C/man2/sched_setscheduler.2:448 build/C/man2/sched_yield.2:54 build/C/man2/setns.2:106 build/C/man2/unshare.2:232
469 #, no-wrap
470 msgid "NOTES"
471 msgstr ""
472
473 #. type: Plain text
474 #: build/C/man3/CPU_SET.3:275
475 msgid "To duplicate a CPU set, use B<memcpy>(3)."
476 msgstr ""
477
478 #. type: Plain text
479 #: build/C/man3/CPU_SET.3:282
480 msgid ""
481 "Since CPU sets are bitsets allocated in units of long words, the actual "
482 "number of CPUs in a dynamically allocated CPU set will be rounded up to the "
483 "next multiple of I<sizeof(unsigned long)>.  An application should consider "
484 "the contents of these extra bits to be undefined."
485 msgstr ""
486
487 #. type: Plain text
488 #: build/C/man3/CPU_SET.3:294
489 msgid ""
490 "Notwithstanding the similarity in the names, note that the constant "
491 "B<CPU_SETSIZE> indicates the number of CPUs in the I<cpu_set_t> data type "
492 "(thus, it is effectively a count of bits in the bitset), while the "
493 "I<setsize> argument of the B<CPU_*_S>()  macros is a size in bytes."
494 msgstr ""
495
496 #. type: Plain text
497 #: build/C/man3/CPU_SET.3:300
498 msgid ""
499 "The data types for arguments and return values shown in the SYNOPSIS are "
500 "hints what about is expected in each case.  However, since these interfaces "
501 "are implemented as macros, the compiler won't necessarily catch all type "
502 "errors if you violate the suggestions."
503 msgstr ""
504
505 #. type: SH
506 #: build/C/man3/CPU_SET.3:300 build/C/man2/clone.2:1031 build/C/man2/sched_setscheduler.2:531
507 #, no-wrap
508 msgid "BUGS"
509 msgstr ""
510
511 #.  http://sourceware.org/bugzilla/show_bug.cgi?id=7029
512 #. type: Plain text
513 #: build/C/man3/CPU_SET.3:312
514 msgid ""
515 "On 32-bit platforms with glibc 2.8 and earlier, B<CPU_ALLOC>()  allocates "
516 "twice as much space as is required, and B<CPU_ALLOC_SIZE>()  returns a value "
517 "twice as large as it should.  This bug should not affect the semantics of a "
518 "program, but does result in wasted memory and less efficient operation of "
519 "the macros that operate on dynamically allocated CPU sets.  These bugs are "
520 "fixed in glibc 2.9."
521 msgstr ""
522
523 #. type: SH
524 #: build/C/man3/CPU_SET.3:312 build/C/man2/clone.2:1073 build/C/man2/setns.2:112
525 #, no-wrap
526 msgid "EXAMPLE"
527 msgstr ""
528
529 #. type: Plain text
530 #: build/C/man3/CPU_SET.3:315
531 msgid ""
532 "The following program demonstrates the use of some of the macros used for "
533 "dynamically allocated CPU sets."
534 msgstr ""
535
536 #. type: Plain text
537 #: build/C/man3/CPU_SET.3:323
538 #, no-wrap
539 msgid ""
540 "#define _GNU_SOURCE\n"
541 "#include E<lt>sched.hE<gt>\n"
542 "#include E<lt>stdlib.hE<gt>\n"
543 "#include E<lt>unistd.hE<gt>\n"
544 "#include E<lt>stdio.hE<gt>\n"
545 "#include E<lt>assert.hE<gt>\n"
546 msgstr ""
547
548 #. type: Plain text
549 #: build/C/man3/CPU_SET.3:330
550 #, no-wrap
551 msgid ""
552 "int\n"
553 "main(int argc, char *argv[])\n"
554 "{\n"
555 "    cpu_set_t *cpusetp;\n"
556 "    size_t size;\n"
557 "    int num_cpus, cpu;\n"
558 msgstr ""
559
560 #. type: Plain text
561 #: build/C/man3/CPU_SET.3:335
562 #, no-wrap
563 msgid ""
564 "    if (argc E<lt> 2) {\n"
565 "        fprintf(stderr, \"Usage: %s E<lt>num-cpusE<gt>\\en\", argv[0]);\n"
566 "        exit(EXIT_FAILURE);\n"
567 "    }\n"
568 msgstr ""
569
570 #. type: Plain text
571 #: build/C/man3/CPU_SET.3:337
572 #, no-wrap
573 msgid "    num_cpus = atoi(argv[1]);\n"
574 msgstr ""
575
576 #. type: Plain text
577 #: build/C/man3/CPU_SET.3:343
578 #, no-wrap
579 msgid ""
580 "    cpusetp = CPU_ALLOC(num_cpus);\n"
581 "    if (cpusetp == NULL) {\n"
582 "        perror(\"CPU_ALLOC\");\n"
583 "        exit(EXIT_FAILURE);\n"
584 "    }\n"
585 msgstr ""
586
587 #. type: Plain text
588 #: build/C/man3/CPU_SET.3:345
589 #, no-wrap
590 msgid "    size = CPU_ALLOC_SIZE(num_cpus);\n"
591 msgstr ""
592
593 #. type: Plain text
594 #: build/C/man3/CPU_SET.3:349
595 #, no-wrap
596 msgid ""
597 "    CPU_ZERO_S(size, cpusetp);\n"
598 "    for (cpu = 0; cpu E<lt> num_cpus; cpu += 2)\n"
599 "        CPU_SET_S(cpu, size, cpusetp);\n"
600 msgstr ""
601
602 #. type: Plain text
603 #: build/C/man3/CPU_SET.3:351
604 #, no-wrap
605 msgid "    printf(\"CPU_COUNT() of set:    %d\\en\", CPU_COUNT_S(size, cpusetp));\n"
606 msgstr ""
607
608 #. type: Plain text
609 #: build/C/man3/CPU_SET.3:355
610 #, no-wrap
611 msgid ""
612 "    CPU_FREE(cpusetp);\n"
613 "    exit(EXIT_SUCCESS);\n"
614 "}\n"
615 msgstr ""
616
617 #. type: SH
618 #: build/C/man3/CPU_SET.3:356 build/C/man2/clone.2:1170 build/C/man2/kcmp.2:222 build/C/man2/sched_get_priority_max.2:118 build/C/man3/sched_getcpu.3:95 build/C/man2/sched_rr_get_interval.2:132 build/C/man2/sched_setaffinity.2:214 build/C/man2/sched_setparam.2:118 build/C/man2/sched_setscheduler.2:539 build/C/man2/sched_yield.2:79 build/C/man2/setns.2:199 build/C/man2/unshare.2:266
619 #, no-wrap
620 msgid "SEE ALSO"
621 msgstr ""
622
623 #. type: Plain text
624 #: build/C/man3/CPU_SET.3:361
625 msgid ""
626 "B<sched_setaffinity>(2), B<pthread_attr_setaffinity_np>(3), "
627 "B<pthread_setaffinity_np>(3), B<cpuset>(7)"
628 msgstr ""
629
630 #. type: SH
631 #: build/C/man3/CPU_SET.3:361 build/C/man2/clone.2:1184 build/C/man2/kcmp.2:225 build/C/man2/sched_get_priority_max.2:130 build/C/man3/sched_getcpu.3:97 build/C/man2/sched_rr_get_interval.2:138 build/C/man2/sched_setaffinity.2:233 build/C/man2/sched_setparam.2:134 build/C/man2/sched_setscheduler.2:567 build/C/man2/sched_yield.2:85 build/C/man2/setns.2:205 build/C/man2/unshare.2:275
632 #, no-wrap
633 msgid "COLOPHON"
634 msgstr ""
635
636 #. type: Plain text
637 #: build/C/man3/CPU_SET.3:368 build/C/man2/clone.2:1191 build/C/man2/kcmp.2:232 build/C/man2/sched_get_priority_max.2:137 build/C/man3/sched_getcpu.3:104 build/C/man2/sched_rr_get_interval.2:145 build/C/man2/sched_setaffinity.2:240 build/C/man2/sched_setparam.2:141 build/C/man2/sched_setscheduler.2:574 build/C/man2/sched_yield.2:92 build/C/man2/setns.2:212 build/C/man2/unshare.2:282
638 msgid ""
639 "This page is part of release 3.65 of the Linux I<man-pages> project.  A "
640 "description of the project, and information about reporting bugs, can be "
641 "found at \\%http://www.kernel.org/doc/man-pages/."
642 msgstr ""
643
644 #. type: TH
645 #: build/C/man2/clone.2:45
646 #, no-wrap
647 msgid "CLONE"
648 msgstr ""
649
650 #. type: TH
651 #: build/C/man2/clone.2:45
652 #, no-wrap
653 msgid "2014-02-27"
654 msgstr ""
655
656 #. type: Plain text
657 #: build/C/man2/clone.2:48
658 msgid "clone, __clone2 - create a child process"
659 msgstr ""
660
661 #. type: Plain text
662 #: build/C/man2/clone.2:51
663 #, no-wrap
664 msgid "/* Prototype for the glibc wrapper function */\n"
665 msgstr ""
666
667 #. type: Plain text
668 #: build/C/man2/clone.2:53 build/C/man3/sched_getcpu.3:32 build/C/man2/sched_setparam.2:36 build/C/man2/sched_setscheduler.2:53 build/C/man2/unshare.2:26
669 #, no-wrap
670 msgid "B<#include E<lt>sched.hE<gt>>\n"
671 msgstr ""
672
673 #. type: Plain text
674 #: build/C/man2/clone.2:58
675 #, no-wrap
676 msgid ""
677 "B<int clone(int (*>I<fn>B<)(void *), void *>I<child_stack>B<,>\n"
678 "B<          int >I<flags>B<, void *>I<arg>B<, ... >\n"
679 "B<          /* pid_t *>I<ptid>B<, struct user_desc *>I<tls>B<, pid_t "
680 "*>I<ctid>B< */ );>\n"
681 msgstr ""
682
683 #. type: Plain text
684 #: build/C/man2/clone.2:60
685 #, no-wrap
686 msgid "/* Prototype for the raw system call */\n"
687 msgstr ""
688
689 #. type: Plain text
690 #: build/C/man2/clone.2:64
691 #, no-wrap
692 msgid ""
693 "B<long clone(unsigned long >I<flags>B<, void *>I<child_stack>B<,>\n"
694 "B<          void *>I<ptid>B<, void *>I<ctid>B<,>\n"
695 "B<          struct pt_regs *>I<regs>B<);>\n"
696 msgstr ""
697
698 #. type: Plain text
699 #: build/C/man2/clone.2:69
700 msgid ""
701 "Feature Test Macro Requirements for glibc wrapper function (see "
702 "B<feature_test_macros>(7)):"
703 msgstr ""
704
705 #. type: Plain text
706 #: build/C/man2/clone.2:72
707 msgid "B<clone>():"
708 msgstr ""
709
710 #. type: TP
711 #: build/C/man2/clone.2:75 build/C/man3/sched_getcpu.3:45 build/C/man2/unshare.2:39
712 #, no-wrap
713 msgid "Since glibc 2.14:"
714 msgstr ""
715
716 #. type: Plain text
717 #: build/C/man2/clone.2:78 build/C/man3/sched_getcpu.3:48 build/C/man2/unshare.2:42
718 msgid "_GNU_SOURCE"
719 msgstr ""
720
721 #.  See http://sources.redhat.com/bugzilla/show_bug.cgi?id=4749
722 #. type: TP
723 #: build/C/man2/clone.2:78 build/C/man3/sched_getcpu.3:48 build/C/man2/unshare.2:42
724 #, no-wrap
725 msgid "Before glibc 2.14:"
726 msgstr ""
727
728 #. type: Plain text
729 #: build/C/man2/clone.2:83 build/C/man3/sched_getcpu.3:52 build/C/man2/unshare.2:47
730 #, no-wrap
731 msgid ""
732 "_BSD_SOURCE || _SVID_SOURCE\n"
733 "    /* _GNU_SOURCE also suffices */\n"
734 msgstr ""
735
736 #. type: Plain text
737 #: build/C/man2/clone.2:90
738 msgid "B<clone>()  creates a new process, in a manner similar to B<fork>(2)."
739 msgstr ""
740
741 #. type: Plain text
742 #: build/C/man2/clone.2:97
743 msgid ""
744 "This page describes both the glibc B<clone>()  wrapper function and the "
745 "underlying system call on which it is based.  The main text describes the "
746 "wrapper function; the differences for the raw system call are described "
747 "toward the end of this page."
748 msgstr ""
749
750 #. type: Plain text
751 #: build/C/man2/clone.2:109
752 msgid ""
753 "Unlike B<fork>(2), B<clone>()  allows the child process to share parts of "
754 "its execution context with the calling process, such as the memory space, "
755 "the table of file descriptors, and the table of signal handlers.  (Note that "
756 "on this manual page, \"calling process\" normally corresponds to \"parent "
757 "process\".  But see the description of B<CLONE_PARENT> below.)"
758 msgstr ""
759
760 #. type: Plain text
761 #: build/C/man2/clone.2:114
762 msgid ""
763 "The main use of B<clone>()  is to implement threads: multiple threads of "
764 "control in a program that run concurrently in a shared memory space."
765 msgstr ""
766
767 #. type: Plain text
768 #: build/C/man2/clone.2:134
769 msgid ""
770 "When the child process is created with B<clone>(), it executes the function "
771 "I<fn>(I<arg>).  (This differs from B<fork>(2), where execution continues in "
772 "the child from the point of the B<fork>(2)  call.)  The I<fn> argument is a "
773 "pointer to a function that is called by the child process at the beginning "
774 "of its execution.  The I<arg> argument is passed to the I<fn> function."
775 msgstr ""
776
777 #. type: Plain text
778 #: build/C/man2/clone.2:144
779 msgid ""
780 "When the I<fn>(I<arg>)  function application returns, the child process "
781 "terminates.  The integer returned by I<fn> is the exit code for the child "
782 "process.  The child process may also terminate explicitly by calling "
783 "B<exit>(2)  or after receiving a fatal signal."
784 msgstr ""
785
786 #. type: Plain text
787 #: build/C/man2/clone.2:160
788 msgid ""
789 "The I<child_stack> argument specifies the location of the stack used by the "
790 "child process.  Since the child and calling process may share memory, it is "
791 "not possible for the child process to execute in the same stack as the "
792 "calling process.  The calling process must therefore set up memory space for "
793 "the child stack and pass a pointer to this space to B<clone>().  Stacks grow "
794 "downward on all processors that run Linux (except the HP PA processors), so "
795 "I<child_stack> usually points to the topmost address of the memory space set "
796 "up for the child stack."
797 msgstr ""
798
799 #. type: Plain text
800 #: build/C/man2/clone.2:176
801 msgid ""
802 "The low byte of I<flags> contains the number of the I<termination signal> "
803 "sent to the parent when the child dies.  If this signal is specified as "
804 "anything other than B<SIGCHLD>, then the parent process must specify the "
805 "B<__WALL> or B<__WCLONE> options when waiting for the child with "
806 "B<wait>(2).  If no signal is specified, then the parent process is not "
807 "signaled when the child terminates."
808 msgstr ""
809
810 #. type: Plain text
811 #: build/C/man2/clone.2:181
812 msgid ""
813 "I<flags> may also be bitwise-or'ed with zero or more of the following "
814 "constants, in order to specify what is shared between the calling process "
815 "and the child process:"
816 msgstr ""
817
818 #. type: TP
819 #: build/C/man2/clone.2:181
820 #, no-wrap
821 msgid "B<CLONE_CHILD_CLEARTID> (since Linux 2.5.49)"
822 msgstr ""
823
824 #. type: Plain text
825 #: build/C/man2/clone.2:191
826 msgid ""
827 "Erase child thread ID at location I<ctid> in child memory when the child "
828 "exits, and do a wakeup on the futex at that address.  The address involved "
829 "may be changed by the B<set_tid_address>(2)  system call.  This is used by "
830 "threading libraries."
831 msgstr ""
832
833 #. type: TP
834 #: build/C/man2/clone.2:191
835 #, no-wrap
836 msgid "B<CLONE_CHILD_SETTID> (since Linux 2.5.49)"
837 msgstr ""
838
839 #. type: Plain text
840 #: build/C/man2/clone.2:196
841 msgid "Store child thread ID at location I<ctid> in child memory."
842 msgstr ""
843
844 #. type: TP
845 #: build/C/man2/clone.2:196
846 #, no-wrap
847 msgid "B<CLONE_FILES> (since Linux 2.0)"
848 msgstr ""
849
850 #. type: Plain text
851 #: build/C/man2/clone.2:209
852 msgid ""
853 "If B<CLONE_FILES> is set, the calling process and the child process share "
854 "the same file descriptor table.  Any file descriptor created by the calling "
855 "process or by the child process is also valid in the other process.  "
856 "Similarly, if one of the processes closes a file descriptor, or changes its "
857 "associated flags (using the B<fcntl>(2)  B<F_SETFD> operation), the other "
858 "process is also affected."
859 msgstr ""
860
861 #. type: Plain text
862 #: build/C/man2/clone.2:223
863 msgid ""
864 "If B<CLONE_FILES> is not set, the child process inherits a copy of all file "
865 "descriptors opened in the calling process at the time of B<clone>().  (The "
866 "duplicated file descriptors in the child refer to the same open file "
867 "descriptions (see B<open>(2))  as the corresponding file descriptors in the "
868 "calling process.)  Subsequent operations that open or close file "
869 "descriptors, or change file descriptor flags, performed by either the "
870 "calling process or the child process do not affect the other process."
871 msgstr ""
872
873 #. type: TP
874 #: build/C/man2/clone.2:223
875 #, no-wrap
876 msgid "B<CLONE_FS> (since Linux 2.0)"
877 msgstr ""
878
879 #. type: Plain text
880 #: build/C/man2/clone.2:238
881 msgid ""
882 "If B<CLONE_FS> is set, the caller and the child process share the same "
883 "filesystem information.  This includes the root of the filesystem, the "
884 "current working directory, and the umask.  Any call to B<chroot>(2), "
885 "B<chdir>(2), or B<umask>(2)  performed by the calling process or the child "
886 "process also affects the other process."
887 msgstr ""
888
889 #. type: Plain text
890 #: build/C/man2/clone.2:250
891 msgid ""
892 "If B<CLONE_FS> is not set, the child process works on a copy of the "
893 "filesystem information of the calling process at the time of the B<clone>()  "
894 "call.  Calls to B<chroot>(2), B<chdir>(2), B<umask>(2)  performed later by "
895 "one of the processes do not affect the other process."
896 msgstr ""
897
898 #. type: TP
899 #: build/C/man2/clone.2:250
900 #, no-wrap
901 msgid "B<CLONE_IO> (since Linux 2.6.25)"
902 msgstr ""
903
904 #. type: Plain text
905 #: build/C/man2/clone.2:259
906 msgid ""
907 "If B<CLONE_IO> is set, then the new process shares an I/O context with the "
908 "calling process.  If this flag is not set, then (as with B<fork>(2))  the "
909 "new process has its own I/O context."
910 msgstr ""
911
912 #.  The following based on text from Jens Axboe
913 #.  the anticipatory and CFQ scheduler
914 #.  with CFQ and AS.
915 #. type: Plain text
916 #: build/C/man2/clone.2:276
917 msgid ""
918 "The I/O context is the I/O scope of the disk scheduler (i.e, what the I/O "
919 "scheduler uses to model scheduling of a process's I/O).  If processes share "
920 "the same I/O context, they are treated as one by the I/O scheduler.  As a "
921 "consequence, they get to share disk time.  For some I/O schedulers, if two "
922 "processes share an I/O context, they will be allowed to interleave their "
923 "disk access.  If several threads are doing I/O on behalf of the same process "
924 "(B<aio_read>(3), for instance), they should employ B<CLONE_IO> to get better "
925 "I/O performance."
926 msgstr ""
927
928 #. type: Plain text
929 #: build/C/man2/clone.2:280
930 msgid ""
931 "If the kernel is not configured with the B<CONFIG_BLOCK> option, this flag "
932 "is a no-op."
933 msgstr ""
934
935 #. type: TP
936 #: build/C/man2/clone.2:280 build/C/man2/unshare.2:96
937 #, no-wrap
938 msgid "B<CLONE_NEWIPC> (since Linux 2.6.19)"
939 msgstr ""
940
941 #. type: Plain text
942 #: build/C/man2/clone.2:290
943 msgid ""
944 "If B<CLONE_NEWIPC> is set, then create the process in a new IPC namespace.  "
945 "If this flag is not set, then (as with B<fork>(2)), the process is created "
946 "in the same IPC namespace as the calling process.  This flag is intended for "
947 "the implementation of containers."
948 msgstr ""
949
950 #.  commit 7eafd7c74c3f2e67c27621b987b28397110d643f
951 #.  https://lwn.net/Articles/312232/
952 #. type: Plain text
953 #: build/C/man2/clone.2:302
954 msgid ""
955 "An IPC namespace provides an isolated view of System V IPC objects (see "
956 "B<svipc>(7))  and (since Linux 2.6.30)  POSIX message queues (see "
957 "B<mq_overview>(7)).  The common characteristic of these IPC mechanisms is "
958 "that IPC objects are identified by mechanisms other than filesystem "
959 "pathnames."
960 msgstr ""
961
962 #. type: Plain text
963 #: build/C/man2/clone.2:306
964 msgid ""
965 "Objects created in an IPC namespace are visible to all other processes that "
966 "are members of that namespace, but are not visible to processes in other IPC "
967 "namespaces."
968 msgstr ""
969
970 #. type: Plain text
971 #: build/C/man2/clone.2:310
972 msgid ""
973 "When an IPC namespace is destroyed (i.e., when the last process that is a "
974 "member of the namespace terminates), all IPC objects in the namespace are "
975 "automatically destroyed."
976 msgstr ""
977
978 #. type: Plain text
979 #: build/C/man2/clone.2:319
980 msgid ""
981 "Use of this flag requires: a kernel configured with the B<CONFIG_SYSVIPC> "
982 "and B<CONFIG_IPC_NS> options and that the process be privileged "
983 "(B<CAP_SYS_ADMIN>).  This flag can't be specified in conjunction with "
984 "B<CLONE_SYSVSEM>."
985 msgstr ""
986
987 #. type: TP
988 #: build/C/man2/clone.2:319 build/C/man2/unshare.2:113
989 #, no-wrap
990 msgid "B<CLONE_NEWNET> (since Linux 2.6.24)"
991 msgstr ""
992
993 #.  FIXME Check when the implementation was completed
994 #. type: Plain text
995 #: build/C/man2/clone.2:324
996 msgid ""
997 "(The implementation of this flag was completed only by about kernel version "
998 "2.6.29.)"
999 msgstr ""
1000
1001 #. type: Plain text
1002 #: build/C/man2/clone.2:333
1003 msgid ""
1004 "If B<CLONE_NEWNET> is set, then create the process in a new network "
1005 "namespace.  If this flag is not set, then (as with B<fork>(2)), the process "
1006 "is created in the same network namespace as the calling process.  This flag "
1007 "is intended for the implementation of containers."
1008 msgstr ""
1009
1010 #.  FIXME Add pointer to veth(4) page when it is eventually completed
1011 #. type: Plain text
1012 #: build/C/man2/clone.2:348
1013 msgid ""
1014 "A network namespace provides an isolated view of the networking stack "
1015 "(network device interfaces, IPv4 and IPv6 protocol stacks, IP routing "
1016 "tables, firewall rules, the I</proc/net> and I</sys/class/net> directory "
1017 "trees, sockets, etc.).  A physical network device can live in exactly one "
1018 "network namespace.  A virtual network device (\"veth\") pair provides a "
1019 "pipe-like abstraction that can be used to create tunnels between network "
1020 "namespaces, and can be used to create a bridge to a physical network device "
1021 "in another namespace."
1022 msgstr ""
1023
1024 #. type: Plain text
1025 #: build/C/man2/clone.2:353
1026 msgid ""
1027 "When a network namespace is freed (i.e., when the last process in the "
1028 "namespace terminates), its physical network devices are moved back to the "
1029 "initial network namespace (not to the parent of the process)."
1030 msgstr ""
1031
1032 #. type: Plain text
1033 #: build/C/man2/clone.2:358
1034 msgid ""
1035 "Use of this flag requires: a kernel configured with the B<CONFIG_NET_NS> "
1036 "option and that the process be privileged (B<CAP_SYS_ADMIN>)."
1037 msgstr ""
1038
1039 #. type: TP
1040 #: build/C/man2/clone.2:358
1041 #, no-wrap
1042 msgid "B<CLONE_NEWNS> (since Linux 2.4.19)"
1043 msgstr ""
1044
1045 #. type: Plain text
1046 #: build/C/man2/clone.2:361
1047 msgid "Start the child in a new mount namespace."
1048 msgstr ""
1049
1050 #. type: Plain text
1051 #: build/C/man2/clone.2:382
1052 msgid ""
1053 "Every process lives in a mount namespace.  The I<namespace> of a process is "
1054 "the data (the set of mounts) describing the file hierarchy as seen by that "
1055 "process.  After a B<fork>(2)  or B<clone>()  where the B<CLONE_NEWNS> flag "
1056 "is not set, the child lives in the same mount namespace as the parent.  The "
1057 "system calls B<mount>(2)  and B<umount>(2)  change the mount namespace of "
1058 "the calling process, and hence affect all processes that live in the same "
1059 "namespace, but do not affect processes in a different mount namespace."
1060 msgstr ""
1061
1062 #. type: Plain text
1063 #: build/C/man2/clone.2:389
1064 msgid ""
1065 "After a B<clone>()  where the B<CLONE_NEWNS> flag is set, the cloned child "
1066 "is started in a new mount namespace, initialized with a copy of the "
1067 "namespace of the parent."
1068 msgstr ""
1069
1070 #. type: Plain text
1071 #: build/C/man2/clone.2:401
1072 msgid ""
1073 "Only a privileged process (one having the B<CAP_SYS_ADMIN> capability)  may "
1074 "specify the B<CLONE_NEWNS> flag.  It is not permitted to specify both "
1075 "B<CLONE_NEWNS> and B<CLONE_FS> in the same B<clone>()  call."
1076 msgstr ""
1077
1078 #. type: TP
1079 #: build/C/man2/clone.2:401
1080 #, no-wrap
1081 msgid "B<CLONE_NEWPID> (since Linux 2.6.24)"
1082 msgstr ""
1083
1084 #.  This explanation draws a lot of details from
1085 #.  http://lwn.net/Articles/259217/
1086 #.  Authors: Pavel Emelyanov <xemul@openvz.org>
1087 #.  and Kir Kolyshkin <kir@openvz.org>
1088 #
1089 #.  The primary kernel commit is 30e49c263e36341b60b735cbef5ca37912549264
1090 #.  Author: Pavel Emelyanov <xemul@openvz.org>
1091 #. type: Plain text
1092 #: build/C/man2/clone.2:418
1093 msgid ""
1094 "If B<CLONE_NEWPID> is set, then create the process in a new PID namespace.  "
1095 "If this flag is not set, then (as with B<fork>(2)), the process is created "
1096 "in the same PID namespace as the calling process.  This flag is intended for "
1097 "the implementation of containers."
1098 msgstr ""
1099
1100 #. type: Plain text
1101 #: build/C/man2/clone.2:427
1102 msgid ""
1103 "A PID namespace provides an isolated environment for PIDs: PIDs in a new "
1104 "namespace start at 1, somewhat like a standalone system, and calls to "
1105 "B<fork>(2), B<vfork>(2), or B<clone>()  will produce processes with PIDs "
1106 "that are unique within the namespace."
1107 msgstr ""
1108
1109 #. type: Plain text
1110 #: build/C/man2/clone.2:439
1111 msgid ""
1112 "The first process created in a new namespace (i.e., the process created "
1113 "using the B<CLONE_NEWPID> flag) has the PID 1, and is the \"init\" process "
1114 "for the namespace.  Children that are orphaned within the namespace will be "
1115 "reparented to this process rather than B<init>(8).  Unlike the traditional "
1116 "B<init> process, the \"init\" process of a PID namespace can terminate, and "
1117 "if it does, all of the processes in the namespace are terminated."
1118 msgstr ""
1119
1120 #. type: Plain text
1121 #: build/C/man2/clone.2:458
1122 msgid ""
1123 "PID namespaces form a hierarchy.  When a new PID namespace is created, the "
1124 "processes in that namespace are visible in the PID namespace of the process "
1125 "that created the new namespace; analogously, if the parent PID namespace is "
1126 "itself the child of another PID namespace, then processes in the child and "
1127 "parent PID namespaces will both be visible in the grandparent PID "
1128 "namespace.  Conversely, the processes in the \"child\" PID namespace do not "
1129 "see the processes in the parent namespace.  The existence of a namespace "
1130 "hierarchy means that each process may now have multiple PIDs: one for each "
1131 "namespace in which it is visible; each of these PIDs is unique within the "
1132 "corresponding namespace.  (A call to B<getpid>(2)  always returns the PID "
1133 "associated with the namespace in which the process lives.)"
1134 msgstr ""
1135
1136 #.  mount -t proc proc /proc
1137 #. type: Plain text
1138 #: build/C/man2/clone.2:474
1139 msgid ""
1140 "After creating the new namespace, it is useful for the child to change its "
1141 "root directory and mount a new procfs instance at I</proc> so that tools "
1142 "such as B<ps>(1)  work correctly.  (If B<CLONE_NEWNS> is also included in "
1143 "I<flags>, then it isn't necessary to change the root directory: a new procfs "
1144 "instance can be mounted directly over I</proc>.)"
1145 msgstr ""
1146
1147 #. type: Plain text
1148 #: build/C/man2/clone.2:481
1149 msgid ""
1150 "Use of this flag requires: a kernel configured with the B<CONFIG_PID_NS> "
1151 "option and that the process be privileged (B<CAP_SYS_ADMIN>).  This flag "
1152 "can't be specified in conjunction with B<CLONE_THREAD>."
1153 msgstr ""
1154
1155 #. type: TP
1156 #: build/C/man2/clone.2:481 build/C/man2/unshare.2:149
1157 #, no-wrap
1158 msgid "B<CLONE_NEWUTS> (since Linux 2.6.19)"
1159 msgstr ""
1160
1161 #. type: Plain text
1162 #: build/C/man2/clone.2:493
1163 msgid ""
1164 "If B<CLONE_NEWUTS> is set, then create the process in a new UTS namespace, "
1165 "whose identifiers are initialized by duplicating the identifiers from the "
1166 "UTS namespace of the calling process.  If this flag is not set, then (as "
1167 "with B<fork>(2)), the process is created in the same UTS namespace as the "
1168 "calling process.  This flag is intended for the implementation of "
1169 "containers."
1170 msgstr ""
1171
1172 #. type: Plain text
1173 #: build/C/man2/clone.2:504
1174 msgid ""
1175 "A UTS namespace is the set of identifiers returned by B<uname>(2); among "
1176 "these, the domain name and the hostname can be modified by "
1177 "B<setdomainname>(2)  and B<sethostname>(2), respectively.  Changes made to "
1178 "the identifiers in a UTS namespace are visible to all other processes in the "
1179 "same namespace, but are not visible to processes in other UTS namespaces."
1180 msgstr ""
1181
1182 #. type: Plain text
1183 #: build/C/man2/clone.2:509
1184 msgid ""
1185 "Use of this flag requires: a kernel configured with the B<CONFIG_UTS_NS> "
1186 "option and that the process be privileged (B<CAP_SYS_ADMIN>)."
1187 msgstr ""
1188
1189 #. type: TP
1190 #: build/C/man2/clone.2:509
1191 #, no-wrap
1192 msgid "B<CLONE_PARENT> (since Linux 2.3.12)"
1193 msgstr ""
1194
1195 #. type: Plain text
1196 #: build/C/man2/clone.2:516
1197 msgid ""
1198 "If B<CLONE_PARENT> is set, then the parent of the new child (as returned by "
1199 "B<getppid>(2))  will be the same as that of the calling process."
1200 msgstr ""
1201
1202 #. type: Plain text
1203 #: build/C/man2/clone.2:522
1204 msgid ""
1205 "If B<CLONE_PARENT> is not set, then (as with B<fork>(2))  the child's parent "
1206 "is the calling process."
1207 msgstr ""
1208
1209 #. type: Plain text
1210 #: build/C/man2/clone.2:530
1211 msgid ""
1212 "Note that it is the parent process, as returned by B<getppid>(2), which is "
1213 "signaled when the child terminates, so that if B<CLONE_PARENT> is set, then "
1214 "the parent of the calling process, rather than the calling process itself, "
1215 "will be signaled."
1216 msgstr ""
1217
1218 #. type: TP
1219 #: build/C/man2/clone.2:530
1220 #, no-wrap
1221 msgid "B<CLONE_PARENT_SETTID> (since Linux 2.5.49)"
1222 msgstr ""
1223
1224 #. type: Plain text
1225 #: build/C/man2/clone.2:538
1226 msgid ""
1227 "Store child thread ID at location I<ptid> in parent and child memory.  (In "
1228 "Linux 2.5.32-2.5.48 there was a flag B<CLONE_SETTID> that did this.)"
1229 msgstr ""
1230
1231 #. type: TP
1232 #: build/C/man2/clone.2:538
1233 #, no-wrap
1234 msgid "B<CLONE_PID> (obsolete)"
1235 msgstr ""
1236
1237 #. type: Plain text
1238 #: build/C/man2/clone.2:549
1239 msgid ""
1240 "If B<CLONE_PID> is set, the child process is created with the same process "
1241 "ID as the calling process.  This is good for hacking the system, but "
1242 "otherwise of not much use.  Since 2.3.21 this flag can be specified only by "
1243 "the system boot process (PID 0).  It disappeared in Linux 2.5.16."
1244 msgstr ""
1245
1246 #. type: TP
1247 #: build/C/man2/clone.2:549
1248 #, no-wrap
1249 msgid "B<CLONE_PTRACE> (since Linux 2.2)"
1250 msgstr ""
1251
1252 #. type: Plain text
1253 #: build/C/man2/clone.2:556
1254 msgid ""
1255 "If B<CLONE_PTRACE> is specified, and the calling process is being traced, "
1256 "then trace the child also (see B<ptrace>(2))."
1257 msgstr ""
1258
1259 #. type: TP
1260 #: build/C/man2/clone.2:556
1261 #, no-wrap
1262 msgid "B<CLONE_SETTLS> (since Linux 2.5.32)"
1263 msgstr ""
1264
1265 #. type: Plain text
1266 #: build/C/man2/clone.2:563
1267 msgid ""
1268 "The I<newtls> argument is the new TLS (Thread Local Storage) descriptor.  "
1269 "(See B<set_thread_area>(2).)"
1270 msgstr ""
1271
1272 #. type: TP
1273 #: build/C/man2/clone.2:563
1274 #, no-wrap
1275 msgid "B<CLONE_SIGHAND> (since Linux 2.0)"
1276 msgstr ""
1277
1278 #. type: Plain text
1279 #: build/C/man2/clone.2:579
1280 msgid ""
1281 "If B<CLONE_SIGHAND> is set, the calling process and the child process share "
1282 "the same table of signal handlers.  If the calling process or child process "
1283 "calls B<sigaction>(2)  to change the behavior associated with a signal, the "
1284 "behavior is changed in the other process as well.  However, the calling "
1285 "process and child processes still have distinct signal masks and sets of "
1286 "pending signals.  So, one of them may block or unblock some signals using "
1287 "B<sigprocmask>(2)  without affecting the other process."
1288 msgstr ""
1289
1290 #. type: Plain text
1291 #: build/C/man2/clone.2:590
1292 msgid ""
1293 "If B<CLONE_SIGHAND> is not set, the child process inherits a copy of the "
1294 "signal handlers of the calling process at the time B<clone>()  is called.  "
1295 "Calls to B<sigaction>(2)  performed later by one of the processes have no "
1296 "effect on the other process."
1297 msgstr ""
1298
1299 #. type: Plain text
1300 #: build/C/man2/clone.2:598
1301 msgid ""
1302 "Since Linux 2.6.0-test6, I<flags> must also include B<CLONE_VM> if "
1303 "B<CLONE_SIGHAND> is specified"
1304 msgstr ""
1305
1306 #. type: TP
1307 #: build/C/man2/clone.2:598
1308 #, no-wrap
1309 msgid "B<CLONE_STOPPED> (since Linux 2.6.0-test2)"
1310 msgstr ""
1311
1312 #. type: Plain text
1313 #: build/C/man2/clone.2:607
1314 msgid ""
1315 "If B<CLONE_STOPPED> is set, then the child is initially stopped (as though "
1316 "it was sent a B<SIGSTOP> signal), and must be resumed by sending it a "
1317 "B<SIGCONT> signal."
1318 msgstr ""
1319
1320 #.  glibc 2.8 removed this defn from bits/sched.h
1321 #. type: Plain text
1322 #: build/C/man2/clone.2:615
1323 msgid ""
1324 "This flag was I<deprecated> from Linux 2.6.25 onward, and was I<removed> "
1325 "altogether in Linux 2.6.38."
1326 msgstr ""
1327
1328 #. type: TP
1329 #: build/C/man2/clone.2:615
1330 #, no-wrap
1331 msgid "B<CLONE_SYSVSEM> (since Linux 2.5.10)"
1332 msgstr ""
1333
1334 #. type: Plain text
1335 #: build/C/man2/clone.2:624
1336 msgid ""
1337 "If B<CLONE_SYSVSEM> is set, then the child and the calling process share a "
1338 "single list of System V semaphore undo values (see B<semop>(2)).  If this "
1339 "flag is not set, then the child has a separate undo list, which is initially "
1340 "empty."
1341 msgstr ""
1342
1343 #. type: TP
1344 #: build/C/man2/clone.2:624
1345 #, no-wrap
1346 msgid "B<CLONE_THREAD> (since Linux 2.4.0-test8)"
1347 msgstr ""
1348
1349 #. type: Plain text
1350 #: build/C/man2/clone.2:633
1351 msgid ""
1352 "If B<CLONE_THREAD> is set, the child is placed in the same thread group as "
1353 "the calling process.  To make the remainder of the discussion of "
1354 "B<CLONE_THREAD> more readable, the term \"thread\" is used to refer to the "
1355 "processes within a thread group."
1356 msgstr ""
1357
1358 #. type: Plain text
1359 #: build/C/man2/clone.2:641
1360 msgid ""
1361 "Thread groups were a feature added in Linux 2.4 to support the POSIX threads "
1362 "notion of a set of threads that share a single PID.  Internally, this shared "
1363 "PID is the so-called thread group identifier (TGID) for the thread group.  "
1364 "Since Linux 2.4, calls to B<getpid>(2)  return the TGID of the caller."
1365 msgstr ""
1366
1367 #. type: Plain text
1368 #: build/C/man2/clone.2:650
1369 msgid ""
1370 "The threads within a group can be distinguished by their (system-wide)  "
1371 "unique thread IDs (TID).  A new thread's TID is available as the function "
1372 "result returned to the caller of B<clone>(), and a thread can obtain its own "
1373 "TID using B<gettid>(2)."
1374 msgstr ""
1375
1376 #. type: Plain text
1377 #: build/C/man2/clone.2:660
1378 msgid ""
1379 "When a call is made to B<clone>()  without specifying B<CLONE_THREAD>, then "
1380 "the resulting thread is placed in a new thread group whose TGID is the same "
1381 "as the thread's TID.  This thread is the I<leader> of the new thread group."
1382 msgstr ""
1383
1384 #. type: Plain text
1385 #: build/C/man2/clone.2:682
1386 msgid ""
1387 "A new thread created with B<CLONE_THREAD> has the same parent process as the "
1388 "caller of B<clone>()  (i.e., like B<CLONE_PARENT>), so that calls to "
1389 "B<getppid>(2)  return the same value for all of the threads in a thread "
1390 "group.  When a B<CLONE_THREAD> thread terminates, the thread that created it "
1391 "using B<clone>()  is not sent a B<SIGCHLD> (or other termination) signal; "
1392 "nor can the status of such a thread be obtained using B<wait>(2).  (The "
1393 "thread is said to be I<detached>.)"
1394 msgstr ""
1395
1396 #. type: Plain text
1397 #: build/C/man2/clone.2:687
1398 msgid ""
1399 "After all of the threads in a thread group terminate the parent process of "
1400 "the thread group is sent a B<SIGCHLD> (or other termination) signal."
1401 msgstr ""
1402
1403 #. type: Plain text
1404 #: build/C/man2/clone.2:692
1405 msgid ""
1406 "If any of the threads in a thread group performs an B<execve>(2), then all "
1407 "threads other than the thread group leader are terminated, and the new "
1408 "program is executed in the thread group leader."
1409 msgstr ""
1410
1411 #. type: Plain text
1412 #: build/C/man2/clone.2:698
1413 msgid ""
1414 "If one of the threads in a thread group creates a child using B<fork>(2), "
1415 "then any thread in the group can B<wait>(2)  for that child."
1416 msgstr ""
1417
1418 #. type: Plain text
1419 #: build/C/man2/clone.2:711
1420 msgid ""
1421 "Since Linux 2.5.35, I<flags> must also include B<CLONE_SIGHAND> if "
1422 "B<CLONE_THREAD> is specified (and note that, since Linux 2.6.0-test6, "
1423 "B<CLONE_SIGHAND> also requires B<CLONE_VM> to be included)."
1424 msgstr ""
1425
1426 #. type: Plain text
1427 #: build/C/man2/clone.2:716
1428 msgid ""
1429 "Signals may be sent to a thread group as a whole (i.e., a TGID) using "
1430 "B<kill>(2), or to a specific thread (i.e., TID) using B<tgkill>(2)."
1431 msgstr ""
1432
1433 #. type: Plain text
1434 #: build/C/man2/clone.2:721
1435 msgid ""
1436 "Signal dispositions and actions are process-wide: if an unhandled signal is "
1437 "delivered to a thread, then it will affect (terminate, stop, continue, be "
1438 "ignored in)  all members of the thread group."
1439 msgstr ""
1440
1441 #. type: Plain text
1442 #: build/C/man2/clone.2:734
1443 msgid ""
1444 "Each thread has its own signal mask, as set by B<sigprocmask>(2), but "
1445 "signals can be pending either: for the whole process (i.e., deliverable to "
1446 "any member of the thread group), when sent with B<kill>(2); or for an "
1447 "individual thread, when sent with B<tgkill>(2).  A call to B<sigpending>(2)  "
1448 "returns a signal set that is the union of the signals pending for the whole "
1449 "process and the signals that are pending for the calling thread."
1450 msgstr ""
1451
1452 #. type: Plain text
1453 #: build/C/man2/clone.2:746
1454 msgid ""
1455 "If B<kill>(2)  is used to send a signal to a thread group, and the thread "
1456 "group has installed a handler for the signal, then the handler will be "
1457 "invoked in exactly one, arbitrarily selected member of the thread group that "
1458 "has not blocked the signal.  If multiple threads in a group are waiting to "
1459 "accept the same signal using B<sigwaitinfo>(2), the kernel will arbitrarily "
1460 "select one of these threads to receive a signal sent using B<kill>(2)."
1461 msgstr ""
1462
1463 #. type: TP
1464 #: build/C/man2/clone.2:746
1465 #, no-wrap
1466 msgid "B<CLONE_UNTRACED> (since Linux 2.5.46)"
1467 msgstr ""
1468
1469 #. type: Plain text
1470 #: build/C/man2/clone.2:753
1471 msgid ""
1472 "If B<CLONE_UNTRACED> is specified, then a tracing process cannot force "
1473 "B<CLONE_PTRACE> on this child process."
1474 msgstr ""
1475
1476 #. type: TP
1477 #: build/C/man2/clone.2:753
1478 #, no-wrap
1479 msgid "B<CLONE_VFORK> (since Linux 2.2)"
1480 msgstr ""
1481
1482 #. type: Plain text
1483 #: build/C/man2/clone.2:765
1484 msgid ""
1485 "If B<CLONE_VFORK> is set, the execution of the calling process is suspended "
1486 "until the child releases its virtual memory resources via a call to "
1487 "B<execve>(2)  or B<_exit>(2)  (as with B<vfork>(2))."
1488 msgstr ""
1489
1490 #. type: Plain text
1491 #: build/C/man2/clone.2:771
1492 msgid ""
1493 "If B<CLONE_VFORK> is not set, then both the calling process and the child "
1494 "are schedulable after the call, and an application should not rely on "
1495 "execution occurring in any particular order."
1496 msgstr ""
1497
1498 #. type: TP
1499 #: build/C/man2/clone.2:771
1500 #, no-wrap
1501 msgid "B<CLONE_VM> (since Linux 2.0)"
1502 msgstr ""
1503
1504 #. type: Plain text
1505 #: build/C/man2/clone.2:784
1506 msgid ""
1507 "If B<CLONE_VM> is set, the calling process and the child process run in the "
1508 "same memory space.  In particular, memory writes performed by the calling "
1509 "process or by the child process are also visible in the other process.  "
1510 "Moreover, any memory mapping or unmapping performed with B<mmap>(2)  or "
1511 "B<munmap>(2)  by the child or calling process also affects the other "
1512 "process."
1513 msgstr ""
1514
1515 #. type: Plain text
1516 #: build/C/man2/clone.2:793
1517 msgid ""
1518 "If B<CLONE_VM> is not set, the child process runs in a separate copy of the "
1519 "memory space of the calling process at the time of B<clone>().  Memory "
1520 "writes or file mappings/unmappings performed by one of the processes do not "
1521 "affect the other, as with B<fork>(2)."
1522 msgstr ""
1523
1524 #. type: SS
1525 #: build/C/man2/clone.2:793
1526 #, no-wrap
1527 msgid "The raw system call interface"
1528 msgstr ""
1529
1530 #. type: Plain text
1531 #: build/C/man2/clone.2:809
1532 msgid ""
1533 "The raw B<clone>()  system call corresponds more closely to B<fork>(2)  in "
1534 "that execution in the child continues from the point of the call.  As such, "
1535 "the I<fn> and I<arg> arguments of the B<clone>()  wrapper function are "
1536 "omitted.  Furthermore, the argument order changes.  The raw system call "
1537 "interface on x86 and many other architectures is roughly:"
1538 msgstr ""
1539
1540 #. type: Plain text
1541 #: build/C/man2/clone.2:815
1542 #, no-wrap
1543 msgid ""
1544 "B<long clone(unsigned long >I<flags>B<, void *>I<child_stack>B<,>\n"
1545 "B<           void *>I<ptid>B<, void *>I<ctid>B<,>\n"
1546 "B<           struct pt_regs *>I<regs>B<);>\n"
1547 msgstr ""
1548
1549 #. type: Plain text
1550 #: build/C/man2/clone.2:826
1551 msgid ""
1552 "Another difference for the raw system call is that the I<child_stack> "
1553 "argument may be zero, in which case copy-on-write semantics ensure that the "
1554 "child gets separate copies of stack pages when either process modifies the "
1555 "stack.  In this case, for correct operation, the B<CLONE_VM> option should "
1556 "not be specified."
1557 msgstr ""
1558
1559 #. type: Plain text
1560 #: build/C/man2/clone.2:834
1561 msgid ""
1562 "For some architectures, the order of the arguments for the system call "
1563 "differs from that shown above.  On the score, microblaze, ARM, ARM 64, "
1564 "PA-RISC, arc, Power PC, xtensa, and MIPS architectures, the order of the "
1565 "fourth and fifth arguments is reversed.  On the cris and s390 architectures, "
1566 "the order of the first and second arguments is reversed."
1567 msgstr ""
1568
1569 #. type: SS
1570 #: build/C/man2/clone.2:834
1571 #, no-wrap
1572 msgid "blackfin, m68k, and sparc"
1573 msgstr ""
1574
1575 #. type: Plain text
1576 #: build/C/man2/clone.2:838
1577 msgid ""
1578 "The argument-passing conventions on blackfin, m68k, and sparc are different "
1579 "from descriptions above.  For details, see the kernel (and glibc) source."
1580 msgstr ""
1581
1582 #. type: SS
1583 #: build/C/man2/clone.2:838
1584 #, no-wrap
1585 msgid "ia64"
1586 msgstr ""
1587
1588 #. type: Plain text
1589 #: build/C/man2/clone.2:840
1590 msgid "On ia64, a different interface is used:"
1591 msgstr ""
1592
1593 #. type: Plain text
1594 #: build/C/man2/clone.2:847
1595 #, no-wrap
1596 msgid ""
1597 "B<int __clone2(int (*>I<fn>B<)(void *), >\n"
1598 "B<             void *>I<child_stack_base>B<, size_t >I<stack_size>B<,>\n"
1599 "B<             int >I<flags>B<, void *>I<arg>B<, ... >\n"
1600 "B<          /* pid_t *>I<ptid>B<, struct user_desc *>I<tls>B<, pid_t "
1601 "*>I<ctid>B< */ );>\n"
1602 msgstr ""
1603
1604 #. type: Plain text
1605 #: build/C/man2/clone.2:859
1606 msgid ""
1607 "The prototype shown above is for the glibc wrapper function; the raw system "
1608 "call interface has no I<fn> or I<arg> argument, and changes the order of the "
1609 "arguments so that I<flags> is the first argument, and I<tls> is the last "
1610 "argument."
1611 msgstr ""
1612
1613 #. type: Plain text
1614 #: build/C/man2/clone.2:870
1615 msgid ""
1616 "B<__clone2>()  operates in the same way as B<clone>(), except that "
1617 "I<child_stack_base> points to the lowest address of the child's stack area, "
1618 "and I<stack_size> specifies the size of the stack pointed to by "
1619 "I<child_stack_base>."
1620 msgstr ""
1621
1622 #. type: SS
1623 #: build/C/man2/clone.2:870
1624 #, no-wrap
1625 msgid "Linux 2.4 and earlier"
1626 msgstr ""
1627
1628 #. type: Plain text
1629 #: build/C/man2/clone.2:878
1630 msgid ""
1631 "In Linux 2.4 and earlier, B<clone>()  does not take arguments I<ptid>, "
1632 "I<tls>, and I<ctid>."
1633 msgstr ""
1634
1635 #.  gettid(2) returns current->pid;
1636 #.  getpid(2) returns current->tgid;
1637 #. type: Plain text
1638 #: build/C/man2/clone.2:887
1639 msgid ""
1640 "On success, the thread ID of the child process is returned in the caller's "
1641 "thread of execution.  On failure, -1 is returned in the caller's context, no "
1642 "child process will be created, and I<errno> will be set appropriately."
1643 msgstr ""
1644
1645 #. type: SH
1646 #: build/C/man2/clone.2:887 build/C/man2/kcmp.2:170 build/C/man2/sched_get_priority_max.2:110 build/C/man3/sched_getcpu.3:65 build/C/man2/sched_rr_get_interval.2:80 build/C/man2/sched_setaffinity.2:116 build/C/man2/sched_setparam.2:96 build/C/man2/sched_setscheduler.2:433 build/C/man2/sched_yield.2:48 build/C/man2/setns.2:77 build/C/man2/unshare.2:212
1647 #, no-wrap
1648 msgid "ERRORS"
1649 msgstr ""
1650
1651 #. type: TP
1652 #: build/C/man2/clone.2:888
1653 #, no-wrap
1654 msgid "B<EAGAIN>"
1655 msgstr ""
1656
1657 #. type: Plain text
1658 #: build/C/man2/clone.2:891
1659 msgid "Too many processes are already running."
1660 msgstr ""
1661
1662 #. type: TP
1663 #: build/C/man2/clone.2:891 build/C/man2/clone.2:898 build/C/man2/clone.2:913 build/C/man2/clone.2:921 build/C/man2/clone.2:929 build/C/man2/clone.2:937 build/C/man2/clone.2:943 build/C/man2/clone.2:953 build/C/man2/clone.2:961 build/C/man2/clone.2:969 build/C/man2/kcmp.2:181 build/C/man2/sched_get_priority_max.2:111 build/C/man2/sched_rr_get_interval.2:84 build/C/man2/sched_setaffinity.2:120 build/C/man2/sched_setaffinity.2:128 build/C/man2/sched_setparam.2:97 build/C/man2/sched_setscheduler.2:434 build/C/man2/setns.2:82 build/C/man2/unshare.2:213
1664 #, no-wrap
1665 msgid "B<EINVAL>"
1666 msgstr ""
1667
1668 #. type: Plain text
1669 #: build/C/man2/clone.2:898
1670 msgid ""
1671 "B<CLONE_SIGHAND> was specified, but B<CLONE_VM> was not.  (Since Linux "
1672 "2.6.0-test6.)"
1673 msgstr ""
1674
1675 #.  .TP
1676 #.  .B EINVAL
1677 #.  Precisely one of
1678 #.  .B CLONE_DETACHED
1679 #.  and
1680 #.  .B CLONE_THREAD
1681 #.  was specified.
1682 #.  (Since Linux 2.6.0-test6.)
1683 #. type: Plain text
1684 #: build/C/man2/clone.2:913
1685 msgid ""
1686 "B<CLONE_THREAD> was specified, but B<CLONE_SIGHAND> was not.  (Since Linux "
1687 "2.5.35.)"
1688 msgstr ""
1689
1690 #. type: Plain text
1691 #: build/C/man2/clone.2:921
1692 msgid "Both B<CLONE_FS> and B<CLONE_NEWNS> were specified in I<flags>."
1693 msgstr ""
1694
1695 #. type: Plain text
1696 #: build/C/man2/clone.2:929
1697 msgid "Both B<CLONE_NEWIPC> and B<CLONE_SYSVSEM> were specified in I<flags>."
1698 msgstr ""
1699
1700 #. type: Plain text
1701 #: build/C/man2/clone.2:937
1702 msgid "Both B<CLONE_NEWPID> and B<CLONE_THREAD> were specified in I<flags>."
1703 msgstr ""
1704
1705 #. type: Plain text
1706 #: build/C/man2/clone.2:943
1707 msgid "Returned by B<clone>()  when a zero value is specified for I<child_stack>."
1708 msgstr ""
1709
1710 #. type: Plain text
1711 #: build/C/man2/clone.2:953
1712 msgid ""
1713 "B<CLONE_NEWIPC> was specified in I<flags>, but the kernel was not configured "
1714 "with the B<CONFIG_SYSVIPC> and B<CONFIG_IPC_NS> options."
1715 msgstr ""
1716
1717 #. type: Plain text
1718 #: build/C/man2/clone.2:961
1719 msgid ""
1720 "B<CLONE_NEWNET> was specified in I<flags>, but the kernel was not configured "
1721 "with the B<CONFIG_NET_NS> option."
1722 msgstr ""
1723
1724 #. type: Plain text
1725 #: build/C/man2/clone.2:969
1726 msgid ""
1727 "B<CLONE_NEWPID> was specified in I<flags>, but the kernel was not configured "
1728 "with the B<CONFIG_PID_NS> option."
1729 msgstr ""
1730
1731 #. type: Plain text
1732 #: build/C/man2/clone.2:977
1733 msgid ""
1734 "B<CLONE_NEWUTS> was specified in I<flags>, but the kernel was not configured "
1735 "with the B<CONFIG_UTS> option."
1736 msgstr ""
1737
1738 #. type: TP
1739 #: build/C/man2/clone.2:977 build/C/man2/setns.2:89 build/C/man2/unshare.2:217
1740 #, no-wrap
1741 msgid "B<ENOMEM>"
1742 msgstr ""
1743
1744 #. type: Plain text
1745 #: build/C/man2/clone.2:982
1746 msgid ""
1747 "Cannot allocate sufficient memory to allocate a task structure for the "
1748 "child, or to copy those parts of the caller's context that need to be "
1749 "copied."
1750 msgstr ""
1751
1752 #. type: TP
1753 #: build/C/man2/clone.2:982 build/C/man2/clone.2:991 build/C/man2/kcmp.2:185 build/C/man2/sched_setaffinity.2:135 build/C/man2/sched_setparam.2:101 build/C/man2/sched_setscheduler.2:439 build/C/man2/setns.2:92 build/C/man2/unshare.2:221
1754 #, no-wrap
1755 msgid "B<EPERM>"
1756 msgstr ""
1757
1758 #. type: Plain text
1759 #: build/C/man2/clone.2:991
1760 msgid ""
1761 "B<CLONE_NEWIPC>, B<CLONE_NEWNET>, B<CLONE_NEWNS>, B<CLONE_NEWPID>, or "
1762 "B<CLONE_NEWUTS> was specified by an unprivileged process (process without "
1763 "B<CAP_SYS_ADMIN>)."
1764 msgstr ""
1765
1766 #. type: Plain text
1767 #: build/C/man2/clone.2:995
1768 msgid "B<CLONE_PID> was specified by a process other than process 0."
1769 msgstr ""
1770
1771 #. type: Plain text
1772 #: build/C/man2/clone.2:1002
1773 msgid ""
1774 "There is no entry for B<clone>()  in libc5.  glibc2 provides B<clone>()  as "
1775 "described in this manual page."
1776 msgstr ""
1777
1778 #. type: Plain text
1779 #: build/C/man2/clone.2:1006
1780 msgid ""
1781 "B<clone>()  is Linux-specific and should not be used in programs intended to "
1782 "be portable."
1783 msgstr ""
1784
1785 #. type: Plain text
1786 #: build/C/man2/clone.2:1016
1787 msgid ""
1788 "In the kernel 2.4.x series, B<CLONE_THREAD> generally does not make the "
1789 "parent of the new thread the same as the parent of the calling process.  "
1790 "However, for kernel versions 2.4.7 to 2.4.18 the B<CLONE_THREAD> flag "
1791 "implied the B<CLONE_PARENT> flag (as in kernel 2.6)."
1792 msgstr ""
1793
1794 #. type: Plain text
1795 #: build/C/man2/clone.2:1026
1796 msgid ""
1797 "For a while there was B<CLONE_DETACHED> (introduced in 2.5.32): parent wants "
1798 "no child-exit signal.  In 2.6.2 the need to give this together with "
1799 "B<CLONE_THREAD> disappeared.  This flag is still defined, but has no effect."
1800 msgstr ""
1801
1802 #. type: Plain text
1803 #: build/C/man2/clone.2:1031
1804 msgid ""
1805 "On i386, B<clone>()  should not be called through vsyscall, but directly "
1806 "through I<int $0x80>."
1807 msgstr ""
1808
1809 #. type: Plain text
1810 #: build/C/man2/clone.2:1062
1811 msgid ""
1812 "Versions of the GNU C library that include the NPTL threading library "
1813 "contain a wrapper function for B<getpid>(2)  that performs caching of PIDs.  "
1814 "This caching relies on support in the glibc wrapper for B<clone>(), but as "
1815 "currently implemented, the cache may not be up to date in some "
1816 "circumstances.  In particular, if a signal is delivered to the child "
1817 "immediately after the B<clone>()  call, then a call to B<getpid>(2)  in a "
1818 "handler for the signal may return the PID of the calling process (\"the "
1819 "parent\"), if the clone wrapper has not yet had a chance to update the PID "
1820 "cache in the child.  (This discussion ignores the case where the child was "
1821 "created using B<CLONE_THREAD>, when B<getpid>(2)  I<should> return the same "
1822 "value in the child and in the process that called B<clone>(), since the "
1823 "caller and the child are in the same thread group.  The stale-cache problem "
1824 "also does not occur if the I<flags> argument includes B<CLONE_VM>.)  To get "
1825 "the truth, it may be necessary to use code such as the following:"
1826 msgstr ""
1827
1828 #. type: Plain text
1829 #: build/C/man2/clone.2:1065
1830 #, no-wrap
1831 msgid "    #include E<lt>syscall.hE<gt>\n"
1832 msgstr ""
1833
1834 #. type: Plain text
1835 #: build/C/man2/clone.2:1067
1836 #, no-wrap
1837 msgid "    pid_t mypid;\n"
1838 msgstr ""
1839
1840 #. type: Plain text
1841 #: build/C/man2/clone.2:1069
1842 #, no-wrap
1843 msgid "    mypid = syscall(SYS_getpid);\n"
1844 msgstr ""
1845
1846 #. type: Plain text
1847 #: build/C/man2/clone.2:1083
1848 msgid ""
1849 "The following program demonstrates the use of B<clone>()  to create a child "
1850 "process that executes in a separate UTS namespace.  The child changes the "
1851 "hostname in its UTS namespace.  Both parent and child then display the "
1852 "system hostname, making it possible to see that the hostname differs in the "
1853 "UTS namespaces of the parent and child.  For an example of the use of this "
1854 "program, see B<setns>(2)."
1855 msgstr ""
1856
1857 #. type: SS
1858 #: build/C/man2/clone.2:1083 build/C/man2/setns.2:166
1859 #, no-wrap
1860 msgid "Program source"
1861 msgstr ""
1862
1863 #. type: Plain text
1864 #: build/C/man2/clone.2:1093
1865 #, no-wrap
1866 msgid ""
1867 "#define _GNU_SOURCE\n"
1868 "#include E<lt>sys/wait.hE<gt>\n"
1869 "#include E<lt>sys/utsname.hE<gt>\n"
1870 "#include E<lt>sched.hE<gt>\n"
1871 "#include E<lt>string.hE<gt>\n"
1872 "#include E<lt>stdio.hE<gt>\n"
1873 "#include E<lt>stdlib.hE<gt>\n"
1874 "#include E<lt>unistd.hE<gt>\n"
1875 msgstr ""
1876
1877 #. type: Plain text
1878 #: build/C/man2/clone.2:1096 build/C/man2/setns.2:177
1879 #, no-wrap
1880 msgid ""
1881 "#define errExit(msg)    do { perror(msg); exit(EXIT_FAILURE); \\e\n"
1882 "                        } while (0)\n"
1883 msgstr ""
1884
1885 #. type: Plain text
1886 #: build/C/man2/clone.2:1101
1887 #, no-wrap
1888 msgid ""
1889 "static int              /* Start function for cloned child */\n"
1890 "childFunc(void *arg)\n"
1891 "{\n"
1892 "    struct utsname uts;\n"
1893 msgstr ""
1894
1895 #. type: Plain text
1896 #: build/C/man2/clone.2:1103
1897 #, no-wrap
1898 msgid "    /* Change hostname in UTS namespace of child */\n"
1899 msgstr ""
1900
1901 #. type: Plain text
1902 #: build/C/man2/clone.2:1106
1903 #, no-wrap
1904 msgid ""
1905 "    if (sethostname(arg, strlen(arg)) == -1)\n"
1906 "        errExit(\"sethostname\");\n"
1907 msgstr ""
1908
1909 #. type: Plain text
1910 #: build/C/man2/clone.2:1108
1911 #, no-wrap
1912 msgid "    /* Retrieve and display hostname */\n"
1913 msgstr ""
1914
1915 #. type: Plain text
1916 #: build/C/man2/clone.2:1112
1917 #, no-wrap
1918 msgid ""
1919 "    if (uname(&uts) == -1)\n"
1920 "        errExit(\"uname\");\n"
1921 "    printf(\"uts.nodename in child:  %s\\en\", uts.nodename);\n"
1922 msgstr ""
1923
1924 #. type: Plain text
1925 #: build/C/man2/clone.2:1116
1926 #, no-wrap
1927 msgid ""
1928 "    /* Keep the namespace open for a while, by sleeping.\n"
1929 "       This allows some experimentation--for example, another\n"
1930 "       process might join the namespace. */\n"
1931 msgstr ""
1932
1933 #. type: Plain text
1934 #: build/C/man2/clone.2:1118
1935 #, no-wrap
1936 msgid "    sleep(200);\n"
1937 msgstr ""
1938
1939 #. type: Plain text
1940 #: build/C/man2/clone.2:1121
1941 #, no-wrap
1942 msgid ""
1943 "    return 0;           /* Child terminates now */\n"
1944 "}\n"
1945 msgstr ""
1946
1947 #. type: Plain text
1948 #: build/C/man2/clone.2:1123
1949 #, no-wrap
1950 msgid "#define STACK_SIZE (1024 * 1024)    /* Stack size for cloned child */\n"
1951 msgstr ""
1952
1953 #. type: Plain text
1954 #: build/C/man2/clone.2:1131
1955 #, no-wrap
1956 msgid ""
1957 "int\n"
1958 "main(int argc, char *argv[])\n"
1959 "{\n"
1960 "    char *stack;                    /* Start of stack buffer */\n"
1961 "    char *stackTop;                 /* End of stack buffer */\n"
1962 "    pid_t pid;\n"
1963 "    struct utsname uts;\n"
1964 msgstr ""
1965
1966 #. type: Plain text
1967 #: build/C/man2/clone.2:1136
1968 #, no-wrap
1969 msgid ""
1970 "    if (argc E<lt> 2) {\n"
1971 "        fprintf(stderr, \"Usage: %s E<lt>child-hostnameE<gt>\\en\", "
1972 "argv[0]);\n"
1973 "        exit(EXIT_SUCCESS);\n"
1974 "    }\n"
1975 msgstr ""
1976
1977 #. type: Plain text
1978 #: build/C/man2/clone.2:1138
1979 #, no-wrap
1980 msgid "    /* Allocate stack for child */\n"
1981 msgstr ""
1982
1983 #. type: Plain text
1984 #: build/C/man2/clone.2:1143
1985 #, no-wrap
1986 msgid ""
1987 "    stack = malloc(STACK_SIZE);\n"
1988 "    if (stack == NULL)\n"
1989 "        errExit(\"malloc\");\n"
1990 "    stackTop = stack + STACK_SIZE;  /* Assume stack grows downward */\n"
1991 msgstr ""
1992
1993 #. type: Plain text
1994 #: build/C/man2/clone.2:1146
1995 #, no-wrap
1996 msgid ""
1997 "    /* Create child that has its own UTS namespace;\n"
1998 "       child commences execution in childFunc() */\n"
1999 msgstr ""
2000
2001 #. type: Plain text
2002 #: build/C/man2/clone.2:1151
2003 #, no-wrap
2004 msgid ""
2005 "    pid = clone(childFunc, stackTop, CLONE_NEWUTS | SIGCHLD, argv[1]);\n"
2006 "    if (pid == -1)\n"
2007 "        errExit(\"clone\");\n"
2008 "    printf(\"clone() returned %ld\\en\", (long) pid);\n"
2009 msgstr ""
2010
2011 #. type: Plain text
2012 #: build/C/man2/clone.2:1153
2013 #, no-wrap
2014 msgid "    /* Parent falls through to here */\n"
2015 msgstr ""
2016
2017 #. type: Plain text
2018 #: build/C/man2/clone.2:1155
2019 #, no-wrap
2020 msgid "    sleep(1);           /* Give child time to change its hostname */\n"
2021 msgstr ""
2022
2023 #. type: Plain text
2024 #: build/C/man2/clone.2:1158
2025 #, no-wrap
2026 msgid ""
2027 "    /* Display hostname in parent\\(aqs UTS namespace. This will be\n"
2028 "       different from hostname in child\\(aqs UTS namespace. */\n"
2029 msgstr ""
2030
2031 #. type: Plain text
2032 #: build/C/man2/clone.2:1162
2033 #, no-wrap
2034 msgid ""
2035 "    if (uname(&uts) == -1)\n"
2036 "        errExit(\"uname\");\n"
2037 "    printf(\"uts.nodename in parent: %s\\en\", uts.nodename);\n"
2038 msgstr ""
2039
2040 #. type: Plain text
2041 #: build/C/man2/clone.2:1166
2042 #, no-wrap
2043 msgid ""
2044 "    if (waitpid(pid, NULL, 0) == -1)    /* Wait for child */\n"
2045 "        errExit(\"waitpid\");\n"
2046 "    printf(\"child has terminated\\en\");\n"
2047 msgstr ""
2048
2049 #. type: Plain text
2050 #: build/C/man2/clone.2:1169
2051 #, no-wrap
2052 msgid ""
2053 "    exit(EXIT_SUCCESS);\n"
2054 "}\n"
2055 msgstr ""
2056
2057 #. type: Plain text
2058 #: build/C/man2/clone.2:1184
2059 msgid ""
2060 "B<fork>(2), B<futex>(2), B<getpid>(2), B<gettid>(2), B<kcmp>(2), "
2061 "B<set_thread_area>(2), B<set_tid_address>(2), B<setns>(2), B<tkill>(2), "
2062 "B<unshare>(2), B<wait>(2), B<capabilities>(7), B<pthreads>(7)"
2063 msgstr ""
2064
2065 #. type: TH
2066 #: build/C/man2/kcmp.2:28
2067 #, no-wrap
2068 msgid "KCMP"
2069 msgstr ""
2070
2071 #. type: TH
2072 #: build/C/man2/kcmp.2:28
2073 #, no-wrap
2074 msgid "2013-12-08"
2075 msgstr ""
2076
2077 #. type: Plain text
2078 #: build/C/man2/kcmp.2:31
2079 msgid "kcmp - compare two processes to determine if they share a kernel resource"
2080 msgstr ""
2081
2082 #. type: Plain text
2083 #: build/C/man2/kcmp.2:34
2084 #, no-wrap
2085 msgid "B<#include E<lt>linux/kcmp.hE<gt>>\n"
2086 msgstr ""
2087
2088 #. type: Plain text
2089 #: build/C/man2/kcmp.2:37
2090 #, no-wrap
2091 msgid ""
2092 "B<int kcmp(pid_t >I<pid1>B<, pid_t >I<pid2>B<, int >I<type>B<,>\n"
2093 "B<         unsigned long >I<idx1>B<, unsigned long >I<idx2>B<);>\n"
2094 msgstr ""
2095
2096 #. type: Plain text
2097 #: build/C/man2/kcmp.2:41
2098 msgid "I<Note>: There is no glibc wrapper for this system call; see NOTES."
2099 msgstr ""
2100
2101 #. type: Plain text
2102 #: build/C/man2/kcmp.2:50
2103 msgid ""
2104 "The B<kcmp>()  system call can be used to check whether the two processes "
2105 "identified by I<pid1> and I<pid2> share a kernel resource such as virtual "
2106 "memory, file descriptors, and so on."
2107 msgstr ""
2108
2109 #. type: Plain text
2110 #: build/C/man2/kcmp.2:55
2111 msgid ""
2112 "The I<type> argument specifies which resource is to be compared in the two "
2113 "processes.  It has one of the following values:"
2114 msgstr ""
2115
2116 #. type: TP
2117 #: build/C/man2/kcmp.2:55
2118 #, no-wrap
2119 msgid "B<KCMP_FILE>"
2120 msgstr ""
2121
2122 #. type: Plain text
2123 #: build/C/man2/kcmp.2:67
2124 msgid ""
2125 "Check whether a file descriptor I<idx1> in the process I<pid1> refers to the "
2126 "same open file description (see B<open>(2))  as file descriptor I<idx2> in "
2127 "the process I<pid2>."
2128 msgstr ""
2129
2130 #. type: TP
2131 #: build/C/man2/kcmp.2:67
2132 #, no-wrap
2133 msgid "B<KCMP_FILES>"
2134 msgstr ""
2135
2136 #. type: Plain text
2137 #: build/C/man2/kcmp.2:75
2138 msgid ""
2139 "Check whether the process share the same set of open file descriptors.  The "
2140 "arguments I<idx1> and I<idx2> are ignored."
2141 msgstr ""
2142
2143 #. type: TP
2144 #: build/C/man2/kcmp.2:75
2145 #, no-wrap
2146 msgid "B<KCMP_FS>"
2147 msgstr ""
2148
2149 #. type: Plain text
2150 #: build/C/man2/kcmp.2:84
2151 msgid ""
2152 "Check whether the processes share the same filesystem information (i.e., "
2153 "file mode creation mask, working directory, and filesystem root).  The "
2154 "arguments I<idx1> and I<idx2> are ignored."
2155 msgstr ""
2156
2157 #. type: TP
2158 #: build/C/man2/kcmp.2:84
2159 #, no-wrap
2160 msgid "B<KCMP_IO>"
2161 msgstr ""
2162
2163 #. type: Plain text
2164 #: build/C/man2/kcmp.2:92
2165 msgid ""
2166 "Check whether the processes share I/O context.  The arguments I<idx1> and "
2167 "I<idx2> are ignored."
2168 msgstr ""
2169
2170 #. type: TP
2171 #: build/C/man2/kcmp.2:92
2172 #, no-wrap
2173 msgid "B<KCMP_SIGHAND>"
2174 msgstr ""
2175
2176 #. type: Plain text
2177 #: build/C/man2/kcmp.2:100
2178 msgid ""
2179 "Check whether the processes share the same table of signal dispositions.  "
2180 "The arguments I<idx1> and I<idx2> are ignored."
2181 msgstr ""
2182
2183 #. type: TP
2184 #: build/C/man2/kcmp.2:100
2185 #, no-wrap
2186 msgid "B<KCMP_SYSVSEM>"
2187 msgstr ""
2188
2189 #. type: Plain text
2190 #: build/C/man2/kcmp.2:109
2191 msgid ""
2192 "Check whether the processes share the same list of System V semaphore undo "
2193 "operations.  The arguments I<idx1> and I<idx2> are ignored."
2194 msgstr ""
2195
2196 #. type: TP
2197 #: build/C/man2/kcmp.2:109
2198 #, no-wrap
2199 msgid "B<KCMP_VM>"
2200 msgstr ""
2201
2202 #. type: Plain text
2203 #: build/C/man2/kcmp.2:117
2204 msgid ""
2205 "Check whether the processes share the same address space.  The arguments "
2206 "I<idx1> and I<idx2> are ignored."
2207 msgstr ""
2208
2209 #. type: Plain text
2210 #: build/C/man2/kcmp.2:127
2211 msgid ""
2212 "Note the B<kcmp>()  is not protected against false positives which may occur "
2213 "if tasks are running.  One should stop tasks by sending B<SIGSTOP> (see "
2214 "B<signal>(7))  prior to inspection with this system call to obtain "
2215 "meaningful results."
2216 msgstr ""
2217
2218 #. type: Plain text
2219 #: build/C/man2/kcmp.2:133
2220 msgid ""
2221 "The return value of a successful call to B<kcmp>()  is simply the result of "
2222 "arithmetic comparison of kernel pointers (when the kernel compares "
2223 "resources, it uses their memory addresses)."
2224 msgstr ""
2225
2226 #. type: Plain text
2227 #: build/C/man2/kcmp.2:141
2228 msgid ""
2229 "The easiest way to explain is to consider an example.  Suppose that I<v1> "
2230 "and I<v2> are the addresses of appropriate resources, then the return value "
2231 "is one of the following:"
2232 msgstr ""
2233
2234 #. type: IP
2235 #: build/C/man2/kcmp.2:142
2236 #, no-wrap
2237 msgid "0"
2238 msgstr ""
2239
2240 #. type: Plain text
2241 #: build/C/man2/kcmp.2:147
2242 msgid ""
2243 "I<v1> is equal to I<v2>; in other words, the two processes share the "
2244 "resource."
2245 msgstr ""
2246
2247 #. type: IP
2248 #: build/C/man2/kcmp.2:147
2249 #, no-wrap
2250 msgid "1"
2251 msgstr ""
2252
2253 #. type: Plain text
2254 #: build/C/man2/kcmp.2:151
2255 msgid "I<v1> is less than I<v2>."
2256 msgstr ""
2257
2258 #. type: IP
2259 #: build/C/man2/kcmp.2:151
2260 #, no-wrap
2261 msgid "2"
2262 msgstr ""
2263
2264 #. type: Plain text
2265 #: build/C/man2/kcmp.2:155
2266 msgid "I<v1> is greater than I<v2>."
2267 msgstr ""
2268
2269 #. type: IP
2270 #: build/C/man2/kcmp.2:155
2271 #, no-wrap
2272 msgid "3"
2273 msgstr ""
2274
2275 #. type: Plain text
2276 #: build/C/man2/kcmp.2:160
2277 msgid "I<v1> is not equal to I<v2>, but ordering information is unavailable."
2278 msgstr ""
2279
2280 #. type: Plain text
2281 #: build/C/man2/kcmp.2:165
2282 msgid "On error, -1 is returned, and I<errno> is set appropriately."
2283 msgstr ""
2284
2285 #. type: Plain text
2286 #: build/C/man2/kcmp.2:170
2287 msgid ""
2288 "B<kcmp>()  was designed to return values suitable for sorting.  This is "
2289 "particularly handy if one needs to compare a large number of file "
2290 "descriptors."
2291 msgstr ""
2292
2293 #. type: TP
2294 #: build/C/man2/kcmp.2:171 build/C/man2/setns.2:78
2295 #, no-wrap
2296 msgid "B<EBADF>"
2297 msgstr ""
2298
2299 #. type: Plain text
2300 #: build/C/man2/kcmp.2:181
2301 msgid "I<type> is B<KCMP_FILE> and I<fd1> or I<fd2> is not an open file descriptor."
2302 msgstr ""
2303
2304 #. type: Plain text
2305 #: build/C/man2/kcmp.2:185
2306 msgid "I<type> is invalid."
2307 msgstr ""
2308
2309 #. type: Plain text
2310 #: build/C/man2/kcmp.2:191
2311 msgid ""
2312 "Insufficient permission to inspect process resources.  The B<CAP_SYS_PTRACE> "
2313 "capability is required to inspect processes that you do not own."
2314 msgstr ""
2315
2316 #. type: TP
2317 #: build/C/man2/kcmp.2:191 build/C/man2/sched_rr_get_interval.2:90 build/C/man2/sched_setaffinity.2:145 build/C/man2/sched_setparam.2:107 build/C/man2/sched_setscheduler.2:442
2318 #, no-wrap
2319 msgid "B<ESRCH>"
2320 msgstr ""
2321
2322 #. type: Plain text
2323 #: build/C/man2/kcmp.2:198
2324 msgid "Process I<pid1> or I<pid2> does not exist."
2325 msgstr ""
2326
2327 #. type: Plain text
2328 #: build/C/man2/kcmp.2:202
2329 msgid "The B<kcmp>()  system call first appeared in Linux 3.5."
2330 msgstr ""
2331
2332 #. type: Plain text
2333 #: build/C/man2/kcmp.2:205
2334 msgid ""
2335 "B<kcmp>()  is Linux-specific and should not be used in programs intended to "
2336 "be portable."
2337 msgstr ""
2338
2339 #. type: Plain text
2340 #: build/C/man2/kcmp.2:208
2341 msgid ""
2342 "Glibc does not provide a wrapper for this system call; call it using "
2343 "B<syscall>(2)."
2344 msgstr ""
2345
2346 #. type: Plain text
2347 #: build/C/man2/kcmp.2:217
2348 msgid ""
2349 "This system call is available only if the kernel was configured with "
2350 "B<CONFIG_CHECKPOINT_RESTORE>.  The main use of the system call is for the "
2351 "checkpoint/restore in user space (CRIU) feature.  The alternative to this "
2352 "system call would have been to expose suitable process information via the "
2353 "B<proc>(5)  filesystem; this was deemed to be unsuitable for security "
2354 "reasons."
2355 msgstr ""
2356
2357 #. type: Plain text
2358 #: build/C/man2/kcmp.2:222
2359 msgid ""
2360 "See B<clone>(2)  for some background information on the shared resources "
2361 "referred to on this page."
2362 msgstr ""
2363
2364 #. type: Plain text
2365 #: build/C/man2/kcmp.2:225
2366 msgid "B<clone>(2), B<unshare>(2)"
2367 msgstr ""
2368
2369 #. type: TH
2370 #: build/C/man2/sched_get_priority_max.2:29
2371 #, no-wrap
2372 msgid "SCHED_GET_PRIORITY_MAX"
2373 msgstr ""
2374
2375 #. type: TH
2376 #: build/C/man2/sched_get_priority_max.2:29
2377 #, no-wrap
2378 msgid "2013-09-23"
2379 msgstr ""
2380
2381 #. type: Plain text
2382 #: build/C/man2/sched_get_priority_max.2:32
2383 msgid "sched_get_priority_max, sched_get_priority_min - get static priority range"
2384 msgstr ""
2385
2386 #. type: Plain text
2387 #: build/C/man2/sched_get_priority_max.2:34 build/C/man2/sched_rr_get_interval.2:34 build/C/man2/sched_yield.2:34
2388 msgid "B<#include E<lt>sched.hE<gt>>"
2389 msgstr ""
2390
2391 #. type: Plain text
2392 #: build/C/man2/sched_get_priority_max.2:36
2393 msgid "B<int sched_get_priority_max(int >I<policy>B<);>"
2394 msgstr ""
2395
2396 #. type: Plain text
2397 #: build/C/man2/sched_get_priority_max.2:38
2398 msgid "B<int sched_get_priority_min(int >I<policy>B<);>"
2399 msgstr ""
2400
2401 #. type: Plain text
2402 #: build/C/man2/sched_get_priority_max.2:58
2403 msgid ""
2404 "B<sched_get_priority_max>()  returns the maximum priority value that can be "
2405 "used with the scheduling algorithm identified by I<policy>.  "
2406 "B<sched_get_priority_min>()  returns the minimum priority value that can be "
2407 "used with the scheduling algorithm identified by I<policy>.  Supported "
2408 "I<policy> values are B<SCHED_FIFO>, B<SCHED_RR>, B<SCHED_OTHER>, "
2409 "B<SCHED_BATCH>, and B<SCHED_IDLE>.  Further details about these policies can "
2410 "be found in B<sched_setscheduler>(2)."
2411 msgstr ""
2412
2413 #. type: Plain text
2414 #: build/C/man2/sched_get_priority_max.2:67
2415 msgid ""
2416 "Processes with numerically higher priority values are scheduled before "
2417 "processes with numerically lower priority values.  Thus, the value returned "
2418 "by B<sched_get_priority_max>()  will be greater than the value returned by "
2419 "B<sched_get_priority_min>()."
2420 msgstr ""
2421
2422 #. type: Plain text
2423 #: build/C/man2/sched_get_priority_max.2:79
2424 msgid ""
2425 "Linux allows the static priority value range 1 to 99 for B<SCHED_FIFO> and "
2426 "B<SCHED_RR> and the priority 0 for B<SCHED_OTHER>, B<SCHED_BATCH>, and "
2427 "B<SCHED_IDLE>.  Scheduling priority ranges for the various policies are not "
2428 "alterable."
2429 msgstr ""
2430
2431 #. type: Plain text
2432 #: build/C/man2/sched_get_priority_max.2:91
2433 msgid ""
2434 "The range of scheduling priorities may vary on other POSIX systems, thus it "
2435 "is a good idea for portable applications to use a virtual priority range and "
2436 "map it to the interval given by B<sched_get_priority_max>()  and "
2437 "B<sched_get_priority_min>().  POSIX.1-2001 requires a spread of at least 32 "
2438 "between the maximum and the minimum values for B<SCHED_FIFO> and "
2439 "B<SCHED_RR>."
2440 msgstr ""
2441
2442 #. type: Plain text
2443 #: build/C/man2/sched_get_priority_max.2:100
2444 msgid ""
2445 "POSIX systems on which B<sched_get_priority_max>()  and "
2446 "B<sched_get_priority_min>()  are available define "
2447 "B<_POSIX_PRIORITY_SCHEDULING> in I<E<lt>unistd.hE<gt>>."
2448 msgstr ""
2449
2450 #. type: Plain text
2451 #: build/C/man2/sched_get_priority_max.2:110
2452 msgid ""
2453 "On success, B<sched_get_priority_max>()  and B<sched_get_priority_min>()  "
2454 "return the maximum/minimum priority value for the named scheduling policy.  "
2455 "On error, -1 is returned, and I<errno> is set appropriately."
2456 msgstr ""
2457
2458 #. type: Plain text
2459 #: build/C/man2/sched_get_priority_max.2:116
2460 msgid "The argument I<policy> does not identify a defined scheduling policy."
2461 msgstr ""
2462
2463 #. type: Plain text
2464 #: build/C/man2/sched_get_priority_max.2:118 build/C/man2/sched_rr_get_interval.2:96 build/C/man2/sched_setparam.2:112 build/C/man2/sched_yield.2:54
2465 msgid "POSIX.1-2001."
2466 msgstr ""
2467
2468 #. type: Plain text
2469 #: build/C/man2/sched_get_priority_max.2:127
2470 msgid ""
2471 "B<sched_getaffinity>(2), B<sched_getparam>(2), B<sched_getscheduler>(2), "
2472 "B<sched_setaffinity>(2), B<sched_setparam>(2), B<sched_setscheduler>(2)"
2473 msgstr ""
2474
2475 #. type: Plain text
2476 #: build/C/man2/sched_get_priority_max.2:130 build/C/man2/sched_rr_get_interval.2:138 build/C/man2/sched_setparam.2:134 build/C/man2/sched_setscheduler.2:564 build/C/man2/sched_yield.2:85
2477 msgid ""
2478 "I<Programming for the real world - POSIX.4> by Bill O. Gallmeister, O'Reilly "
2479 "& Associates, Inc., ISBN 1-56592-074-0."
2480 msgstr ""
2481
2482 #. type: TH
2483 #: build/C/man3/sched_getcpu.3:26
2484 #, no-wrap
2485 msgid "SCHED_GETCPU"
2486 msgstr ""
2487
2488 #. type: TH
2489 #: build/C/man3/sched_getcpu.3:26 build/C/man2/unshare.2:20
2490 #, no-wrap
2491 msgid "2013-04-17"
2492 msgstr ""
2493
2494 #. type: Plain text
2495 #: build/C/man3/sched_getcpu.3:29
2496 msgid "sched_getcpu - determine CPU on which the calling thread is running"
2497 msgstr ""
2498
2499 #. type: Plain text
2500 #: build/C/man3/sched_getcpu.3:34
2501 #, no-wrap
2502 msgid "B<int sched_getcpu(void);>\n"
2503 msgstr ""
2504
2505 #. type: Plain text
2506 #: build/C/man3/sched_getcpu.3:39 build/C/man2/unshare.2:33
2507 msgid "Feature Test Macro Requirements for glibc (see B<feature_test_macros>(7)):"
2508 msgstr ""
2509
2510 #. type: Plain text
2511 #: build/C/man3/sched_getcpu.3:42
2512 msgid "B<sched_getcpu>():"
2513 msgstr ""
2514
2515 #. type: Plain text
2516 #: build/C/man3/sched_getcpu.3:58
2517 msgid ""
2518 "B<sched_getcpu>()  returns the number of the CPU on which the calling thread "
2519 "is currently executing."
2520 msgstr ""
2521
2522 #. type: Plain text
2523 #: build/C/man3/sched_getcpu.3:65
2524 msgid ""
2525 "On success, B<sched_getcpu>()  returns a nonnegative CPU number.  On error, "
2526 "-1 is returned and I<errno> is set to indicate the error."
2527 msgstr ""
2528
2529 #. type: TP
2530 #: build/C/man3/sched_getcpu.3:66 build/C/man2/sched_rr_get_interval.2:87
2531 #, no-wrap
2532 msgid "B<ENOSYS>"
2533 msgstr ""
2534
2535 #. type: Plain text
2536 #: build/C/man3/sched_getcpu.3:70
2537 msgid "This kernel does not implement B<getcpu>(2)."
2538 msgstr ""
2539
2540 #. type: Plain text
2541 #: build/C/man3/sched_getcpu.3:72
2542 msgid "This function is available since glibc 2.6."
2543 msgstr ""
2544
2545 #. type: Plain text
2546 #: build/C/man3/sched_getcpu.3:75
2547 msgid "B<sched_getcpu>()  is glibc-specific."
2548 msgstr ""
2549
2550 #. type: Plain text
2551 #: build/C/man3/sched_getcpu.3:77
2552 msgid "The call"
2553 msgstr ""
2554
2555 #. type: Plain text
2556 #: build/C/man3/sched_getcpu.3:81
2557 #, no-wrap
2558 msgid "cpu = sched_getcpu();\n"
2559 msgstr ""
2560
2561 #. type: Plain text
2562 #: build/C/man3/sched_getcpu.3:87
2563 msgid "is equivalent to the following B<getcpu>(2)  call:"
2564 msgstr ""
2565
2566 #. type: Plain text
2567 #: build/C/man3/sched_getcpu.3:93
2568 #, no-wrap
2569 msgid ""
2570 "int c, s;\n"
2571 "s = getcpu(&c, NULL, NULL);\n"
2572 "cpu = (s == -1) ? s : c;\n"
2573 msgstr ""
2574
2575 #. type: Plain text
2576 #: build/C/man3/sched_getcpu.3:97
2577 msgid "B<getcpu>(2)"
2578 msgstr ""
2579
2580 #. type: TH
2581 #: build/C/man2/sched_rr_get_interval.2:29
2582 #, no-wrap
2583 msgid "SCHED_RR_GET_INTERVAL"
2584 msgstr ""
2585
2586 #. type: TH
2587 #: build/C/man2/sched_rr_get_interval.2:29
2588 #, no-wrap
2589 msgid "2013-03-18"
2590 msgstr ""
2591
2592 #. type: Plain text
2593 #: build/C/man2/sched_rr_get_interval.2:32
2594 msgid "sched_rr_get_interval - get the SCHED_RR interval for the named process"
2595 msgstr ""
2596
2597 #. type: Plain text
2598 #: build/C/man2/sched_rr_get_interval.2:36
2599 msgid "B<int sched_rr_get_interval(pid_t >I<pid>B<, struct timespec * >I<tp>B<);>"
2600 msgstr ""
2601
2602 #. type: Plain text
2603 #: build/C/man2/sched_rr_get_interval.2:47
2604 msgid ""
2605 "B<sched_rr_get_interval>()  writes into the I<timespec> structure pointed to "
2606 "by I<tp> the round-robin time quantum for the process identified by I<pid>.  "
2607 "The specified process should be running under the B<SCHED_RR> scheduling "
2608 "policy."
2609 msgstr ""
2610
2611 #. type: Plain text
2612 #: build/C/man2/sched_rr_get_interval.2:51
2613 msgid "The I<timespec> structure has the following form:"
2614 msgstr ""
2615
2616 #. type: Plain text
2617 #: build/C/man2/sched_rr_get_interval.2:58
2618 #, no-wrap
2619 msgid ""
2620 "struct timespec {\n"
2621 "    time_t tv_sec;    /* seconds */\n"
2622 "    long   tv_nsec;   /* nanoseconds */\n"
2623 "};\n"
2624 msgstr ""
2625
2626 #.  FIXME . On Linux, sched_rr_get_interval()
2627 #.  returns the timeslice for SCHED_OTHER processes -- this timeslice
2628 #.  is influenced by the nice value.
2629 #.  For SCHED_FIFO processes, this always returns 0.
2630 #
2631 #.  The round-robin time quantum value is not alterable under Linux
2632 #.  1.3.81.
2633 #. type: Plain text
2634 #: build/C/man2/sched_rr_get_interval.2:73
2635 msgid ""
2636 "If I<pid> is zero, the time quantum for the calling process is written into "
2637 "I<*tp>."
2638 msgstr ""
2639
2640 #. type: Plain text
2641 #: build/C/man2/sched_rr_get_interval.2:80
2642 msgid ""
2643 "On success, B<sched_rr_get_interval>()  returns 0.  On error, -1 is "
2644 "returned, and I<errno> is set appropriately."
2645 msgstr ""
2646
2647 #. type: TP
2648 #: build/C/man2/sched_rr_get_interval.2:81 build/C/man2/sched_setaffinity.2:117
2649 #, no-wrap
2650 msgid "B<EFAULT>"
2651 msgstr ""
2652
2653 #. type: Plain text
2654 #: build/C/man2/sched_rr_get_interval.2:84
2655 msgid "Problem with copying information to user space."
2656 msgstr ""
2657
2658 #. type: Plain text
2659 #: build/C/man2/sched_rr_get_interval.2:87
2660 msgid "Invalid pid."
2661 msgstr ""
2662
2663 #. type: Plain text
2664 #: build/C/man2/sched_rr_get_interval.2:90
2665 msgid "The system call is not yet implemented (only on rather old kernels)."
2666 msgstr ""
2667
2668 #. type: Plain text
2669 #: build/C/man2/sched_rr_get_interval.2:94
2670 msgid "Could not find a process with the ID I<pid>."
2671 msgstr ""
2672
2673 #. type: Plain text
2674 #: build/C/man2/sched_rr_get_interval.2:103
2675 msgid ""
2676 "POSIX systems on which B<sched_rr_get_interval>()  is available define "
2677 "B<_POSIX_PRIORITY_SCHEDULING> in I<E<lt>unistd.hE<gt>>."
2678 msgstr ""
2679
2680 #. type: SS
2681 #: build/C/man2/sched_rr_get_interval.2:103
2682 #, no-wrap
2683 msgid "Linux notes"
2684 msgstr ""
2685
2686 #.  commit a4ec24b48ddef1e93f7578be53270f0b95ad666c
2687 #. type: Plain text
2688 #: build/C/man2/sched_rr_get_interval.2:117
2689 msgid ""
2690 "POSIX does not specify any mechanism for controlling the size of the "
2691 "round-robin time quantum.  Older Linux kernels provide a (nonportable) "
2692 "method of doing this.  The quantum can be controlled by adjusting the "
2693 "process's nice value (see B<setpriority>(2)).  Assigning a negative (i.e., "
2694 "high) nice value results in a longer quantum; assigning a positive (i.e., "
2695 "low) nice value results in a shorter quantum.  The default quantum is 0.1 "
2696 "seconds; the degree to which changing the nice value affects the quantum has "
2697 "varied somewhat across kernel versions.  This method of adjusting the "
2698 "quantum was removed starting with Linux 2.6.24."
2699 msgstr ""
2700
2701 #.  commit ce0dbbbb30aee6a835511d5be446462388ba9eee
2702 #.  .SH BUGS
2703 #.  As of Linux 1.3.81
2704 #.  .BR sched_rr_get_interval ()
2705 #.  returns with error
2706 #.  ENOSYS, because SCHED_RR has not yet been fully implemented and tested
2707 #.  properly.
2708 #. type: Plain text
2709 #: build/C/man2/sched_rr_get_interval.2:132
2710 msgid ""
2711 "Linux 3.9 added a new mechanism for adjusting (and viewing) the B<SCHED_RR> "
2712 "quantum: the I</proc/sys/kernel/sched_rr_timeslice_ms> file exposes the "
2713 "quantum as a millisecond value, whose default is 100.  Writing 0 to this "
2714 "file resets the quantum to the default value."
2715 msgstr ""
2716
2717 #. type: Plain text
2718 #: build/C/man2/sched_rr_get_interval.2:135 build/C/man2/sched_setaffinity.2:177
2719 msgid "B<sched_setscheduler>(2)  has a description of the Linux scheduling scheme."
2720 msgstr ""
2721
2722 #. type: TH
2723 #: build/C/man2/sched_setaffinity.2:34
2724 #, no-wrap
2725 msgid "SCHED_SETAFFINITY"
2726 msgstr ""
2727
2728 #. type: TH
2729 #: build/C/man2/sched_setaffinity.2:34 build/C/man2/sched_setparam.2:30 build/C/man2/sched_setscheduler.2:46
2730 #, no-wrap
2731 msgid "2013-09-17"
2732 msgstr ""
2733
2734 #. type: Plain text
2735 #: build/C/man2/sched_setaffinity.2:38
2736 msgid ""
2737 "sched_setaffinity, sched_getaffinity - set and get a thread's CPU affinity "
2738 "mask"
2739 msgstr ""
2740
2741 #. type: Plain text
2742 #: build/C/man2/sched_setaffinity.2:45
2743 #, no-wrap
2744 msgid ""
2745 "B<int sched_setaffinity(pid_t >I<pid>B<, size_t >I<cpusetsize>B<,>\n"
2746 "B<                      cpu_set_t *>I<mask>B<);>\n"
2747 msgstr ""
2748
2749 #. type: Plain text
2750 #: build/C/man2/sched_setaffinity.2:48
2751 #, no-wrap
2752 msgid ""
2753 "B<int sched_getaffinity(pid_t >I<pid>B<, size_t >I<cpusetsize>B<,>\n"
2754 "B<                      cpu_set_t *>I<mask>B<);>\n"
2755 msgstr ""
2756
2757 #. type: Plain text
2758 #: build/C/man2/sched_setaffinity.2:63
2759 msgid ""
2760 "A thread's CPU affinity mask determines the set of CPUs on which it is "
2761 "eligible to run.  On a multiprocessor system, setting the CPU affinity mask "
2762 "can be used to obtain performance benefits.  For example, by dedicating one "
2763 "CPU to a particular thread (i.e., setting the affinity mask of that thread "
2764 "to specify a single CPU, and setting the affinity mask of all other threads "
2765 "to exclude that CPU), it is possible to ensure maximum execution speed for "
2766 "that thread.  Restricting a thread to run on a single CPU also avoids the "
2767 "performance cost caused by the cache invalidation that occurs when a thread "
2768 "ceases to execute on one CPU and then recommences execution on a different "
2769 "CPU."
2770 msgstr ""
2771
2772 #. type: Plain text
2773 #: build/C/man2/sched_setaffinity.2:70
2774 msgid ""
2775 "A CPU affinity mask is represented by the I<cpu_set_t> structure, a \"CPU "
2776 "set\", pointed to by I<mask>.  A set of macros for manipulating CPU sets is "
2777 "described in B<CPU_SET>(3)."
2778 msgstr ""
2779
2780 #. type: Plain text
2781 #: build/C/man2/sched_setaffinity.2:85
2782 msgid ""
2783 "B<sched_setaffinity>()  sets the CPU affinity mask of the thread whose ID is "
2784 "I<pid> to the value specified by I<mask>.  If I<pid> is zero, then the "
2785 "calling thread is used.  The argument I<cpusetsize> is the length (in bytes) "
2786 "of the data pointed to by I<mask>.  Normally this argument would be "
2787 "specified as I<sizeof(cpu_set_t)>."
2788 msgstr ""
2789
2790 #. type: Plain text
2791 #: build/C/man2/sched_setaffinity.2:92
2792 msgid ""
2793 "If the thread specified by I<pid> is not currently running on one of the "
2794 "CPUs specified in I<mask>, then that thread is migrated to one of the CPUs "
2795 "specified in I<mask>."
2796 msgstr ""
2797
2798 #. type: Plain text
2799 #: build/C/man2/sched_setaffinity.2:107
2800 msgid ""
2801 "B<sched_getaffinity>()  writes the affinity mask of the thread whose ID is "
2802 "I<pid> into the I<cpu_set_t> structure pointed to by I<mask>.  The "
2803 "I<cpusetsize> argument specifies the size (in bytes) of I<mask>.  If I<pid> "
2804 "is zero, then the mask of the calling thread is returned."
2805 msgstr ""
2806
2807 #. type: Plain text
2808 #: build/C/man2/sched_setaffinity.2:116
2809 msgid ""
2810 "On success, B<sched_setaffinity>()  and B<sched_getaffinity>()  return 0.  "
2811 "On error, -1 is returned, and I<errno> is set appropriately."
2812 msgstr ""
2813
2814 #. type: Plain text
2815 #: build/C/man2/sched_setaffinity.2:120
2816 msgid "A supplied memory address was invalid."
2817 msgstr ""
2818
2819 #. type: Plain text
2820 #: build/C/man2/sched_setaffinity.2:128
2821 msgid ""
2822 "The affinity bit mask I<mask> contains no processors that are currently "
2823 "physically on the system and permitted to the thread according to any "
2824 "restrictions that may be imposed by the \"cpuset\" mechanism described in "
2825 "B<cpuset>(7)."
2826 msgstr ""
2827
2828 #. type: Plain text
2829 #: build/C/man2/sched_setaffinity.2:135
2830 msgid ""
2831 "(B<sched_getaffinity>()  and, in kernels before 2.6.9, "
2832 "B<sched_setaffinity>())  I<cpusetsize> is smaller than the size of the "
2833 "affinity mask used by the kernel."
2834 msgstr ""
2835
2836 #. type: Plain text
2837 #: build/C/man2/sched_setaffinity.2:145
2838 msgid ""
2839 "(B<sched_setaffinity>())  The calling thread does not have appropriate "
2840 "privileges.  The caller needs an effective user ID equal to the real user ID "
2841 "or effective user ID of the thread identified by I<pid>, or it must possess "
2842 "the B<CAP_SYS_NICE> capability."
2843 msgstr ""
2844
2845 #. type: Plain text
2846 #: build/C/man2/sched_setaffinity.2:148 build/C/man2/sched_setscheduler.2:445
2847 msgid "The thread whose ID is I<pid> could not be found."
2848 msgstr ""
2849
2850 #. type: Plain text
2851 #: build/C/man2/sched_setaffinity.2:159
2852 msgid ""
2853 "The CPU affinity system calls were introduced in Linux kernel 2.5.8.  The "
2854 "system call wrappers were introduced in glibc 2.3.  Initially, the glibc "
2855 "interfaces included a I<cpusetsize> argument, typed as I<unsigned int>.  In "
2856 "glibc 2.3.3, the I<cpusetsize> argument was removed, but was then restored "
2857 "in glibc 2.3.4, with type I<size_t>."
2858 msgstr ""
2859
2860 #. type: Plain text
2861 #: build/C/man2/sched_setaffinity.2:161
2862 msgid "These system calls are Linux-specific."
2863 msgstr ""
2864
2865 #. type: Plain text
2866 #: build/C/man2/sched_setaffinity.2:174
2867 msgid ""
2868 "After a call to B<sched_setaffinity>(), the set of CPUs on which the thread "
2869 "will actually run is the intersection of the set specified in the I<mask> "
2870 "argument and the set of CPUs actually present on the system.  The system may "
2871 "further restrict the set of CPUs on which the thread runs if the \"cpuset\" "
2872 "mechanism described in B<cpuset>(7)  is being used.  These restrictions on "
2873 "the actual set of CPUs on which the thread will run are silently imposed by "
2874 "the kernel."
2875 msgstr ""
2876
2877 #. type: Plain text
2878 #: build/C/man2/sched_setaffinity.2:194
2879 msgid ""
2880 "The affinity mask is a per-thread attribute that can be adjusted "
2881 "independently for each of the threads in a thread group.  The value returned "
2882 "from a call to B<gettid>(2)  can be passed in the argument I<pid>.  "
2883 "Specifying I<pid> as 0 will set the attribute for the calling thread, and "
2884 "passing the value returned from a call to B<getpid>(2)  will set the "
2885 "attribute for the main thread of the thread group.  (If you are using the "
2886 "POSIX threads API, then use B<pthread_setaffinity_np>(3)  instead of "
2887 "B<sched_setaffinity>().)"
2888 msgstr ""
2889
2890 #. type: Plain text
2891 #: build/C/man2/sched_setaffinity.2:200
2892 msgid ""
2893 "A child created via B<fork>(2)  inherits its parent's CPU affinity mask.  "
2894 "The affinity mask is preserved across an B<execve>(2)."
2895 msgstr ""
2896
2897 #. type: Plain text
2898 #: build/C/man2/sched_setaffinity.2:214
2899 msgid ""
2900 "This manual page describes the glibc interface for the CPU affinity calls.  "
2901 "The actual system call interface is slightly different, with the I<mask> "
2902 "being typed as I<unsigned long\\ *>, reflecting the fact that the underlying "
2903 "implementation of CPU sets is a simple bit mask.  On success, the raw "
2904 "B<sched_getaffinity>()  system call returns the size (in bytes) of the "
2905 "I<cpumask_t> data type that is used internally by the kernel to represent "
2906 "the CPU set bit mask."
2907 msgstr ""
2908
2909 #. type: Plain text
2910 #: build/C/man2/sched_setaffinity.2:233
2911 msgid ""
2912 "B<taskset>(1), B<clone>(2), B<getcpu>(2), B<getpriority>(2), B<gettid>(2), "
2913 "B<nice>(2), B<sched_get_priority_max>(2), B<sched_get_priority_min>(2), "
2914 "B<sched_getscheduler>(2), B<sched_setscheduler>(2), B<setpriority>(2), "
2915 "B<CPU_SET>(3), B<pthread_setaffinity_np>(3), B<sched_getcpu>(3), "
2916 "B<capabilities>(7), B<cpuset>(7)"
2917 msgstr ""
2918
2919 #. type: TH
2920 #: build/C/man2/sched_setparam.2:30
2921 #, no-wrap
2922 msgid "SCHED_SETPARAM"
2923 msgstr ""
2924
2925 #. type: Plain text
2926 #: build/C/man2/sched_setparam.2:33
2927 msgid "sched_setparam, sched_getparam - set and get scheduling parameters"
2928 msgstr ""
2929
2930 #. type: Plain text
2931 #: build/C/man2/sched_setparam.2:38
2932 #, no-wrap
2933 msgid ""
2934 "B<int sched_setparam(pid_t >I<pid>B<, const struct sched_param "
2935 "*>I<param>B<);>\n"
2936 msgstr ""
2937
2938 #. type: Plain text
2939 #: build/C/man2/sched_setparam.2:40
2940 #, no-wrap
2941 msgid "B<int sched_getparam(pid_t >I<pid>B<, struct sched_param *>I<param>B<);>\n"
2942 msgstr ""
2943
2944 #. type: Plain text
2945 #: build/C/man2/sched_setparam.2:46 build/C/man2/sched_setscheduler.2:65
2946 #, no-wrap
2947 msgid ""
2948 "B<struct sched_param {\n"
2949 "    ...\n"
2950 "    int >I<sched_priority>B<;\n"
2951 "    ...\n"
2952 "};>\n"
2953 msgstr ""
2954
2955 #. type: Plain text
2956 #: build/C/man2/sched_setparam.2:60
2957 msgid ""
2958 "B<sched_setparam>()  sets the scheduling parameters associated with the "
2959 "scheduling policy for the process identified by I<pid>.  If I<pid> is zero, "
2960 "then the parameters of the calling process are set.  The interpretation of "
2961 "the argument I<param> depends on the scheduling policy of the process "
2962 "identified by I<pid>.  See B<sched_setscheduler>(2)  for a description of "
2963 "the scheduling policies supported under Linux."
2964 msgstr ""
2965
2966 #. type: Plain text
2967 #: build/C/man2/sched_setparam.2:66
2968 msgid ""
2969 "B<sched_getparam>()  retrieves the scheduling parameters for the process "
2970 "identified by I<pid>.  If I<pid> is zero, then the parameters of the calling "
2971 "process are retrieved."
2972 msgstr ""
2973
2974 #. type: Plain text
2975 #: build/C/man2/sched_setparam.2:75
2976 msgid ""
2977 "B<sched_setparam>()  checks the validity of I<param> for the scheduling "
2978 "policy of the thread.  The value I<param-E<gt>sched_priority> must lie "
2979 "within the range given by B<sched_get_priority_min>(2)  and "
2980 "B<sched_get_priority_max>(2)."
2981 msgstr ""
2982
2983 #. type: Plain text
2984 #: build/C/man2/sched_setparam.2:79
2985 msgid ""
2986 "For a discussion of the privileges and resource limits related to scheduling "
2987 "priority and policy, see B<sched_setscheduler>(2)."
2988 msgstr ""
2989
2990 #. type: Plain text
2991 #: build/C/man2/sched_setparam.2:87
2992 msgid ""
2993 "POSIX systems on which B<sched_setparam>()  and B<sched_getparam>()  are "
2994 "available define B<_POSIX_PRIORITY_SCHEDULING> in I<E<lt>unistd.hE<gt>>."
2995 msgstr ""
2996
2997 #. type: Plain text
2998 #: build/C/man2/sched_setparam.2:96
2999 msgid ""
3000 "On success, B<sched_setparam>()  and B<sched_getparam>()  return 0.  On "
3001 "error, -1 is returned, and I<errno> is set appropriately."
3002 msgstr ""
3003
3004 #. type: Plain text
3005 #: build/C/man2/sched_setparam.2:101
3006 msgid "The argument I<param> does not make sense for the current scheduling policy."
3007 msgstr ""
3008
3009 #. type: Plain text
3010 #: build/C/man2/sched_setparam.2:107
3011 msgid ""
3012 "The calling process does not have appropriate privileges (Linux: does not "
3013 "have the B<CAP_SYS_NICE> capability)."
3014 msgstr ""
3015
3016 #. type: Plain text
3017 #: build/C/man2/sched_setparam.2:110
3018 msgid "The process whose ID is I<pid> could not be found."
3019 msgstr ""
3020
3021 #. type: Plain text
3022 #: build/C/man2/sched_setparam.2:118
3023 msgid ""
3024 "Scheduling parameters are in fact per-thread attributes on Linux; see "
3025 "B<sched_setscheduler>(2)."
3026 msgstr ""
3027
3028 #. type: Plain text
3029 #: build/C/man2/sched_setparam.2:131
3030 msgid ""
3031 "B<getpriority>(2), B<nice>(2), B<sched_get_priority_max>(2), "
3032 "B<sched_get_priority_min>(2), B<sched_getaffinity>(2), "
3033 "B<sched_getscheduler>(2), B<sched_setaffinity>(2), B<sched_setscheduler>(2), "
3034 "B<setpriority>(2), B<capabilities>(7)"
3035 msgstr ""
3036
3037 #. type: TH
3038 #: build/C/man2/sched_setscheduler.2:46
3039 #, no-wrap
3040 msgid "SCHED_SETSCHEDULER"
3041 msgstr ""
3042
3043 #. type: Plain text
3044 #: build/C/man2/sched_setscheduler.2:50
3045 msgid ""
3046 "sched_setscheduler, sched_getscheduler - set and get scheduling "
3047 "policy/parameters"
3048 msgstr ""
3049
3050 #. type: Plain text
3051 #: build/C/man2/sched_setscheduler.2:55
3052 #, no-wrap
3053 msgid "B<int sched_setscheduler(pid_t >I<pid>B<, int >I<policy>B<,>\n"
3054 msgstr ""
3055
3056 #. type: Plain text
3057 #: build/C/man2/sched_setscheduler.2:57
3058 #, no-wrap
3059 msgid "B<                       const struct sched_param *>I<param>B<);>\n"
3060 msgstr ""
3061
3062 #. type: Plain text
3063 #: build/C/man2/sched_setscheduler.2:59
3064 #, no-wrap
3065 msgid "B<int sched_getscheduler(pid_t >I<pid>B<);>\n"
3066 msgstr ""
3067
3068 #. type: Plain text
3069 #: build/C/man2/sched_setscheduler.2:76
3070 msgid ""
3071 "B<sched_setscheduler>()  sets both the scheduling policy and the associated "
3072 "parameters for the thread whose ID is specified in I<pid>.  If I<pid> equals "
3073 "zero, the scheduling policy and parameters of the calling thread will be "
3074 "set.  The interpretation of the argument I<param> depends on the selected "
3075 "policy.  Currently, Linux supports the following \"normal\" (i.e., "
3076 "non-real-time) scheduling policies:"
3077 msgstr ""
3078
3079 #. type: TP
3080 #: build/C/man2/sched_setscheduler.2:76
3081 #, no-wrap
3082 msgid "B<SCHED_OTHER>"
3083 msgstr ""
3084
3085 #.  In the 2.6 kernel sources, SCHED_OTHER is actually called
3086 #.  SCHED_NORMAL.
3087 #. type: Plain text
3088 #: build/C/man2/sched_setscheduler.2:81
3089 msgid "the standard round-robin time-sharing policy;"
3090 msgstr ""
3091
3092 #. type: TP
3093 #: build/C/man2/sched_setscheduler.2:81
3094 #, no-wrap
3095 msgid "B<SCHED_BATCH>"
3096 msgstr ""
3097
3098 #. type: Plain text
3099 #: build/C/man2/sched_setscheduler.2:84
3100 msgid "for \"batch\" style execution of processes; and"
3101 msgstr ""
3102
3103 #. type: TP
3104 #: build/C/man2/sched_setscheduler.2:84
3105 #, no-wrap
3106 msgid "B<SCHED_IDLE>"
3107 msgstr ""
3108
3109 #. type: Plain text
3110 #: build/C/man2/sched_setscheduler.2:89
3111 msgid "for running I<very> low priority background jobs."
3112 msgstr ""
3113
3114 #. type: Plain text
3115 #: build/C/man2/sched_setscheduler.2:93
3116 msgid ""
3117 "The following \"real-time\" policies are also supported, for special "
3118 "time-critical applications that need precise control over the way in which "
3119 "runnable threads are selected for execution:"
3120 msgstr ""
3121
3122 #. type: TP
3123 #: build/C/man2/sched_setscheduler.2:93
3124 #, no-wrap
3125 msgid "B<SCHED_FIFO>"
3126 msgstr ""
3127
3128 #. type: Plain text
3129 #: build/C/man2/sched_setscheduler.2:96
3130 msgid "a first-in, first-out policy; and"
3131 msgstr ""
3132
3133 #. type: TP
3134 #: build/C/man2/sched_setscheduler.2:96
3135 #, no-wrap
3136 msgid "B<SCHED_RR>"
3137 msgstr ""
3138
3139 #. type: Plain text
3140 #: build/C/man2/sched_setscheduler.2:99
3141 msgid "a round-robin policy."
3142 msgstr ""
3143
3144 #. type: Plain text
3145 #: build/C/man2/sched_setscheduler.2:101
3146 msgid "The semantics of each of these policies are detailed below."
3147 msgstr ""
3148
3149 #. type: Plain text
3150 #: build/C/man2/sched_setscheduler.2:108
3151 msgid ""
3152 "B<sched_getscheduler>()  queries the scheduling policy currently applied to "
3153 "the thread identified by I<pid>.  If I<pid> equals zero, the policy of the "
3154 "calling thread will be retrieved."
3155 msgstr ""
3156
3157 #. type: SS
3158 #: build/C/man2/sched_setscheduler.2:108
3159 #, no-wrap
3160 msgid "Scheduling policies"
3161 msgstr ""
3162
3163 #. type: Plain text
3164 #: build/C/man2/sched_setscheduler.2:117
3165 msgid ""
3166 "The scheduler is the kernel component that decides which runnable thread "
3167 "will be executed by the CPU next.  Each thread has an associated scheduling "
3168 "policy and a I<static> scheduling priority, I<sched_priority>; these are the "
3169 "settings that are modified by B<sched_setscheduler>().  The scheduler makes "
3170 "it decisions based on knowledge of the scheduling policy and static priority "
3171 "of all threads on the system."
3172 msgstr ""
3173
3174 #. type: Plain text
3175 #: build/C/man2/sched_setscheduler.2:122
3176 msgid ""
3177 "For threads scheduled under one of the normal scheduling policies "
3178 "(B<SCHED_OTHER>, B<SCHED_IDLE>, B<SCHED_BATCH>), I<sched_priority> is not "
3179 "used in scheduling decisions (it must be specified as 0)."
3180 msgstr ""
3181
3182 #. type: Plain text
3183 #: build/C/man2/sched_setscheduler.2:136
3184 msgid ""
3185 "Processes scheduled under one of the real-time policies (B<SCHED_FIFO>, "
3186 "B<SCHED_RR>) have a I<sched_priority> value in the range 1 (low) to 99 "
3187 "(high).  (As the numbers imply, real-time threads always have higher "
3188 "priority than normal threads.)  Note well: POSIX.1-2001 requires an "
3189 "implementation to support only a minimum 32 distinct priority levels for the "
3190 "real-time policies, and some systems supply just this minimum.  Portable "
3191 "programs should use B<sched_get_priority_min>(2)  and "
3192 "B<sched_get_priority_max>(2)  to find the range of priorities supported for "
3193 "a particular policy."
3194 msgstr ""
3195
3196 #. type: Plain text
3197 #: build/C/man2/sched_setscheduler.2:142
3198 msgid ""
3199 "Conceptually, the scheduler maintains a list of runnable threads for each "
3200 "possible I<sched_priority> value.  In order to determine which thread runs "
3201 "next, the scheduler looks for the nonempty list with the highest static "
3202 "priority and selects the thread at the head of this list."
3203 msgstr ""
3204
3205 #. type: Plain text
3206 #: build/C/man2/sched_setscheduler.2:146
3207 msgid ""
3208 "A thread's scheduling policy determines where it will be inserted into the "
3209 "list of threads with equal static priority and how it will move inside this "
3210 "list."
3211 msgstr ""
3212
3213 #. type: Plain text
3214 #: build/C/man2/sched_setscheduler.2:154
3215 msgid ""
3216 "All scheduling is preemptive: if a thread with a higher static priority "
3217 "becomes ready to run, the currently running thread will be preempted and "
3218 "returned to the wait list for its static priority level.  The scheduling "
3219 "policy determines the ordering only within the list of runnable threads with "
3220 "equal static priority."
3221 msgstr ""
3222
3223 #. type: SS
3224 #: build/C/man2/sched_setscheduler.2:154
3225 #, no-wrap
3226 msgid "SCHED_FIFO: First in-first out scheduling"
3227 msgstr ""
3228
3229 #. type: Plain text
3230 #: build/C/man2/sched_setscheduler.2:163
3231 msgid ""
3232 "B<SCHED_FIFO> can be used only with static priorities higher than 0, which "
3233 "means that when a B<SCHED_FIFO> threads becomes runnable, it will always "
3234 "immediately preempt any currently running B<SCHED_OTHER>, B<SCHED_BATCH>, or "
3235 "B<SCHED_IDLE> thread.  B<SCHED_FIFO> is a simple scheduling algorithm "
3236 "without time slicing.  For threads scheduled under the B<SCHED_FIFO> policy, "
3237 "the following rules apply:"
3238 msgstr ""
3239
3240 #. type: IP
3241 #: build/C/man2/sched_setscheduler.2:163 build/C/man2/sched_setscheduler.2:168 build/C/man2/sched_setscheduler.2:171 build/C/man2/sched_setscheduler.2:185 build/C/man2/sched_setscheduler.2:288 build/C/man2/sched_setscheduler.2:296 build/C/man2/sched_setscheduler.2:337 build/C/man2/sched_setscheduler.2:345 build/C/man2/sched_setscheduler.2:350 build/C/man2/sched_setscheduler.2:355
3242 #, no-wrap
3243 msgid "*"
3244 msgstr ""
3245
3246 #. type: Plain text
3247 #: build/C/man2/sched_setscheduler.2:168
3248 msgid ""
3249 "A B<SCHED_FIFO> thread that has been preempted by another thread of higher "
3250 "priority will stay at the head of the list for its priority and will resume "
3251 "execution as soon as all threads of higher priority are blocked again."
3252 msgstr ""
3253
3254 #. type: Plain text
3255 #: build/C/man2/sched_setscheduler.2:171
3256 msgid ""
3257 "When a B<SCHED_FIFO> thread becomes runnable, it will be inserted at the end "
3258 "of the list for its priority."
3259 msgstr ""
3260
3261 #.  In 2.2.x and 2.4.x, the thread is placed at the front of the queue
3262 #.  In 2.0.x, the Right Thing happened: the thread went to the back -- MTK
3263 #. type: Plain text
3264 #: build/C/man2/sched_setscheduler.2:185
3265 msgid ""
3266 "A call to B<sched_setscheduler>()  or B<sched_setparam>(2)  will put the "
3267 "B<SCHED_FIFO> (or B<SCHED_RR>) thread identified by I<pid> at the start of "
3268 "the list if it was runnable.  As a consequence, it may preempt the currently "
3269 "running thread if it has the same priority.  (POSIX.1-2001 specifies that "
3270 "the thread should go to the end of the list.)"
3271 msgstr ""
3272
3273 #. type: Plain text
3274 #: build/C/man2/sched_setscheduler.2:189
3275 msgid "A thread calling B<sched_yield>(2)  will be put at the end of the list."
3276 msgstr ""
3277
3278 #. type: Plain text
3279 #: build/C/man2/sched_setscheduler.2:193
3280 msgid ""
3281 "No other events will move a thread scheduled under the B<SCHED_FIFO> policy "
3282 "in the wait list of runnable threads with equal static priority."
3283 msgstr ""
3284
3285 #. type: Plain text
3286 #: build/C/man2/sched_setscheduler.2:198
3287 msgid ""
3288 "A B<SCHED_FIFO> thread runs until either it is blocked by an I/O request, it "
3289 "is preempted by a higher priority thread, or it calls B<sched_yield>(2)."
3290 msgstr ""
3291
3292 #. type: SS
3293 #: build/C/man2/sched_setscheduler.2:198
3294 #, no-wrap
3295 msgid "SCHED_RR: Round-robin scheduling"
3296 msgstr ""
3297
3298 #.  On Linux 2.4, the length of the RR interval is influenced
3299 #.  by the process nice value -- MTK
3300 #. type: Plain text
3301 #: build/C/man2/sched_setscheduler.2:217
3302 msgid ""
3303 "B<SCHED_RR> is a simple enhancement of B<SCHED_FIFO>.  Everything described "
3304 "above for B<SCHED_FIFO> also applies to B<SCHED_RR>, except that each thread "
3305 "is allowed to run only for a maximum time quantum.  If a B<SCHED_RR> thread "
3306 "has been running for a time period equal to or longer than the time quantum, "
3307 "it will be put at the end of the list for its priority.  A B<SCHED_RR> "
3308 "thread that has been preempted by a higher priority thread and subsequently "
3309 "resumes execution as a running thread will complete the unexpired portion of "
3310 "its round-robin time quantum.  The length of the time quantum can be "
3311 "retrieved using B<sched_rr_get_interval>(2)."
3312 msgstr ""
3313
3314 #. type: SS
3315 #: build/C/man2/sched_setscheduler.2:217
3316 #, no-wrap
3317 msgid "SCHED_OTHER: Default Linux time-sharing scheduling"
3318 msgstr ""
3319
3320 #. type: Plain text
3321 #: build/C/man2/sched_setscheduler.2:233
3322 msgid ""
3323 "B<SCHED_OTHER> can be used at only static priority 0.  B<SCHED_OTHER> is the "
3324 "standard Linux time-sharing scheduler that is intended for all threads that "
3325 "do not require the special real-time mechanisms.  The thread to run is "
3326 "chosen from the static priority 0 list based on a I<dynamic> priority that "
3327 "is determined only inside this list.  The dynamic priority is based on the "
3328 "nice value (set by B<nice>(2)  or B<setpriority>(2))  and increased for each "
3329 "time quantum the thread is ready to run, but denied to run by the "
3330 "scheduler.  This ensures fair progress among all B<SCHED_OTHER> threads."
3331 msgstr ""
3332
3333 #. type: SS
3334 #: build/C/man2/sched_setscheduler.2:233
3335 #, no-wrap
3336 msgid "SCHED_BATCH: Scheduling batch processes"
3337 msgstr ""
3338
3339 #. type: Plain text
3340 #: build/C/man2/sched_setscheduler.2:245
3341 msgid ""
3342 "(Since Linux 2.6.16.)  B<SCHED_BATCH> can be used only at static priority "
3343 "0.  This policy is similar to B<SCHED_OTHER> in that it schedules the thread "
3344 "according to its dynamic priority (based on the nice value).  The difference "
3345 "is that this policy will cause the scheduler to always assume that the "
3346 "thread is CPU-intensive.  Consequently, the scheduler will apply a small "
3347 "scheduling penalty with respect to wakeup behaviour, so that this thread is "
3348 "mildly disfavored in scheduling decisions."
3349 msgstr ""
3350
3351 #.  The following paragraph is drawn largely from the text that
3352 #.  accompanied Ingo Molnar's patch for the implementation of
3353 #.  SCHED_BATCH.
3354 #.  commit b0a9499c3dd50d333e2aedb7e894873c58da3785
3355 #. type: Plain text
3356 #: build/C/man2/sched_setscheduler.2:255
3357 msgid ""
3358 "This policy is useful for workloads that are noninteractive, but do not want "
3359 "to lower their nice value, and for workloads that want a deterministic "
3360 "scheduling policy without interactivity causing extra preemptions (between "
3361 "the workload's tasks)."
3362 msgstr ""
3363
3364 #. type: SS
3365 #: build/C/man2/sched_setscheduler.2:255
3366 #, no-wrap
3367 msgid "SCHED_IDLE: Scheduling very low priority jobs"
3368 msgstr ""
3369
3370 #. type: Plain text
3371 #: build/C/man2/sched_setscheduler.2:259
3372 msgid ""
3373 "(Since Linux 2.6.23.)  B<SCHED_IDLE> can be used only at static priority 0; "
3374 "the process nice value has no influence for this policy."
3375 msgstr ""
3376
3377 #. type: Plain text
3378 #: build/C/man2/sched_setscheduler.2:267
3379 msgid ""
3380 "This policy is intended for running jobs at extremely low priority (lower "
3381 "even than a +19 nice value with the B<SCHED_OTHER> or B<SCHED_BATCH> "
3382 "policies)."
3383 msgstr ""
3384
3385 #. type: SS
3386 #: build/C/man2/sched_setscheduler.2:267
3387 #, no-wrap
3388 msgid "Resetting scheduling policy for child processes"
3389 msgstr ""
3390
3391 #. type: Plain text
3392 #: build/C/man2/sched_setscheduler.2:283
3393 msgid ""
3394 "Since Linux 2.6.32, the B<SCHED_RESET_ON_FORK> flag can be ORed in I<policy> "
3395 "when calling B<sched_setscheduler>().  As a result of including this flag, "
3396 "children created by B<fork>(2)  do not inherit privileged scheduling "
3397 "policies.  This feature is intended for media-playback applications, and can "
3398 "be used to prevent applications evading the B<RLIMIT_RTTIME> resource limit "
3399 "(see B<getrlimit>(2))  by creating multiple child processes."
3400 msgstr ""
3401
3402 #. type: Plain text
3403 #: build/C/man2/sched_setscheduler.2:288
3404 msgid ""
3405 "More precisely, if the B<SCHED_RESET_ON_FORK> flag is specified, the "
3406 "following rules apply for subsequently created children:"
3407 msgstr ""
3408
3409 #. type: Plain text
3410 #: build/C/man2/sched_setscheduler.2:296
3411 msgid ""
3412 "If the calling thread has a scheduling policy of B<SCHED_FIFO> or "
3413 "B<SCHED_RR>, the policy is reset to B<SCHED_OTHER> in child processes."
3414 msgstr ""
3415
3416 #. type: Plain text
3417 #: build/C/man2/sched_setscheduler.2:299
3418 msgid ""
3419 "If the calling process has a negative nice value, the nice value is reset to "
3420 "zero in child processes."
3421 msgstr ""
3422
3423 #. type: Plain text
3424 #: build/C/man2/sched_setscheduler.2:308
3425 msgid ""
3426 "After the B<SCHED_RESET_ON_FORK> flag has been enabled, it can be reset only "
3427 "if the thread has the B<CAP_SYS_NICE> capability.  This flag is disabled in "
3428 "child processes created by B<fork>(2)."
3429 msgstr ""
3430
3431 #. type: Plain text
3432 #: build/C/man2/sched_setscheduler.2:314
3433 msgid ""
3434 "The B<SCHED_RESET_ON_FORK> flag is visible in the policy value returned by "
3435 "B<sched_getscheduler>()"
3436 msgstr ""
3437
3438 #. type: SS
3439 #: build/C/man2/sched_setscheduler.2:314
3440 #, no-wrap
3441 msgid "Privileges and resource limits"
3442 msgstr ""
3443
3444 #. type: Plain text
3445 #: build/C/man2/sched_setscheduler.2:327
3446 msgid ""
3447 "In Linux kernels before 2.6.12, only privileged (B<CAP_SYS_NICE>)  threads "
3448 "can set a nonzero static priority (i.e., set a real-time scheduling "
3449 "policy).  The only change that an unprivileged thread can make is to set the "
3450 "B<SCHED_OTHER> policy, and this can be done only if the effective user ID of "
3451 "the caller of B<sched_setscheduler>()  matches the real or effective user ID "
3452 "of the target thread (i.e., the thread specified by I<pid>)  whose policy is "
3453 "being changed."
3454 msgstr ""
3455
3456 #. type: Plain text
3457 #: build/C/man2/sched_setscheduler.2:337
3458 msgid ""
3459 "Since Linux 2.6.12, the B<RLIMIT_RTPRIO> resource limit defines a ceiling on "
3460 "an unprivileged thread's static priority for the B<SCHED_RR> and "
3461 "B<SCHED_FIFO> policies.  The rules for changing scheduling policy and "
3462 "priority are as follows:"
3463 msgstr ""
3464
3465 #. type: Plain text
3466 #: build/C/man2/sched_setscheduler.2:345
3467 msgid ""
3468 "If an unprivileged thread has a nonzero B<RLIMIT_RTPRIO> soft limit, then it "
3469 "can change its scheduling policy and priority, subject to the restriction "
3470 "that the priority cannot be set to a value higher than the maximum of its "
3471 "current priority and its B<RLIMIT_RTPRIO> soft limit."
3472 msgstr ""
3473
3474 #. type: Plain text
3475 #: build/C/man2/sched_setscheduler.2:350
3476 msgid ""
3477 "If the B<RLIMIT_RTPRIO> soft limit is 0, then the only permitted changes are "
3478 "to lower the priority, or to switch to a non-real-time policy."
3479 msgstr ""
3480
3481 #. type: Plain text
3482 #: build/C/man2/sched_setscheduler.2:355
3483 msgid ""
3484 "Subject to the same rules, another unprivileged thread can also make these "
3485 "changes, as long as the effective user ID of the thread making the change "
3486 "matches the real or effective user ID of the target thread."
3487 msgstr ""
3488
3489 #.  commit c02aa73b1d18e43cfd79c2f193b225e84ca497c8
3490 #. type: Plain text
3491 #: build/C/man2/sched_setscheduler.2:373
3492 msgid ""
3493 "Special rules apply for the B<SCHED_IDLE>.  In Linux kernels before 2.6.39, "
3494 "an unprivileged thread operating under this policy cannot change its policy, "
3495 "regardless of the value of its B<RLIMIT_RTPRIO> resource limit.  In Linux "
3496 "kernels since 2.6.39, an unprivileged thread can switch to either the "
3497 "B<SCHED_BATCH> or the B<SCHED_NORMAL> policy so long as its nice value falls "
3498 "within the range permitted by its B<RLIMIT_NICE> resource limit (see "
3499 "B<getrlimit>(2))."
3500 msgstr ""
3501
3502 #. type: Plain text
3503 #: build/C/man2/sched_setscheduler.2:384
3504 msgid ""
3505 "Privileged (B<CAP_SYS_NICE>)  threads ignore the B<RLIMIT_RTPRIO> limit; as "
3506 "with older kernels, they can make arbitrary changes to scheduling policy and "
3507 "priority.  See B<getrlimit>(2)  for further information on B<RLIMIT_RTPRIO>."
3508 msgstr ""
3509
3510 #. type: SS
3511 #: build/C/man2/sched_setscheduler.2:384
3512 #, no-wrap
3513 msgid "Response time"
3514 msgstr ""
3515
3516 #.  as described in
3517 #.  .BR request_irq (9).
3518 #. type: Plain text
3519 #: build/C/man2/sched_setscheduler.2:392
3520 msgid ""
3521 "A blocked high priority thread waiting for the I/O has a certain response "
3522 "time before it is scheduled again.  The device driver writer can greatly "
3523 "reduce this response time by using a \"slow interrupt\" interrupt handler."
3524 msgstr ""
3525
3526 #. type: SS
3527 #: build/C/man2/sched_setscheduler.2:392
3528 #, no-wrap
3529 msgid "Miscellaneous"
3530 msgstr ""
3531
3532 #. type: Plain text
3533 #: build/C/man2/sched_setscheduler.2:397
3534 msgid ""
3535 "Child processes inherit the scheduling policy and parameters across a "
3536 "B<fork>(2).  The scheduling policy and parameters are preserved across "
3537 "B<execve>(2)."
3538 msgstr ""
3539
3540 #. type: Plain text
3541 #: build/C/man2/sched_setscheduler.2:403
3542 msgid ""
3543 "Memory locking is usually needed for real-time processes to avoid paging "
3544 "delays; this can be done with B<mlock>(2)  or B<mlockall>(2)."
3545 msgstr ""
3546
3547 #. type: Plain text
3548 #: build/C/man2/sched_setscheduler.2:415
3549 msgid ""
3550 "Since a nonblocking infinite loop in a thread scheduled under B<SCHED_FIFO> "
3551 "or B<SCHED_RR> will block all threads with lower priority forever, a "
3552 "software developer should always keep available on the console a shell "
3553 "scheduled under a higher static priority than the tested application.  This "
3554 "will allow an emergency kill of tested real-time applications that do not "
3555 "block or terminate as expected.  See also the description of the "
3556 "B<RLIMIT_RTTIME> resource limit in B<getrlimit>(2)."
3557 msgstr ""
3558
3559 #. type: Plain text
3560 #: build/C/man2/sched_setscheduler.2:423
3561 msgid ""
3562 "POSIX systems on which B<sched_setscheduler>()  and B<sched_getscheduler>()  "
3563 "are available define B<_POSIX_PRIORITY_SCHEDULING> in I<E<lt>unistd.hE<gt>>."
3564 msgstr ""
3565
3566 #. type: Plain text
3567 #: build/C/man2/sched_setscheduler.2:433
3568 msgid ""
3569 "On success, B<sched_setscheduler>()  returns zero.  On success, "
3570 "B<sched_getscheduler>()  returns the policy for the thread (a nonnegative "
3571 "integer).  On error, -1 is returned, and I<errno> is set appropriately."
3572 msgstr ""
3573
3574 #. type: Plain text
3575 #: build/C/man2/sched_setscheduler.2:439
3576 msgid ""
3577 "The scheduling I<policy> is not one of the recognized policies, I<param> is "
3578 "NULL, or I<param> does not make sense for the I<policy>."
3579 msgstr ""
3580
3581 #. type: Plain text
3582 #: build/C/man2/sched_setscheduler.2:442
3583 msgid "The calling thread does not have appropriate privileges."
3584 msgstr ""
3585
3586 #. type: Plain text
3587 #: build/C/man2/sched_setscheduler.2:448
3588 msgid ""
3589 "POSIX.1-2001 (but see BUGS below).  The B<SCHED_BATCH> and B<SCHED_IDLE> "
3590 "policies are Linux-specific."
3591 msgstr ""
3592
3593 #. type: Plain text
3594 #: build/C/man2/sched_setscheduler.2:456
3595 msgid ""
3596 "POSIX.1 does not detail the permissions that an unprivileged thread requires "
3597 "in order to call B<sched_setscheduler>(), and details vary across systems.  "
3598 "For example, the Solaris 7 manual page says that the real or effective user "
3599 "ID of the caller must match the real user ID or the save set-user-ID of the "
3600 "target."
3601 msgstr ""
3602
3603 #. type: Plain text
3604 #: build/C/man2/sched_setscheduler.2:477
3605 msgid ""
3606 "The scheduling policy and parameters are in fact per-thread attributes on "
3607 "Linux.  The value returned from a call to B<gettid>(2)  can be passed in the "
3608 "argument I<pid>.  Specifying I<pid> as 0 will operate on the attribute for "
3609 "the calling thread, and passing the value returned from a call to "
3610 "B<getpid>(2)  will operate on the attribute for the main thread of the "
3611 "thread group.  (If you are using the POSIX threads API, then use "
3612 "B<pthread_setschedparam>(3), B<pthread_getschedparam>(3), and "
3613 "B<pthread_setschedprio>(3), instead of the B<sched_*>(2)  system calls.)"
3614 msgstr ""
3615
3616 #. type: Plain text
3617 #: build/C/man2/sched_setscheduler.2:487
3618 msgid ""
3619 "Originally, Standard Linux was intended as a general-purpose operating "
3620 "system being able to handle background processes, interactive applications, "
3621 "and less demanding real-time applications (applications that need to usually "
3622 "meet timing deadlines).  Although the Linux kernel 2.6 allowed for kernel "
3623 "preemption and the newly introduced O(1) scheduler ensures that the time "
3624 "needed to schedule is fixed and deterministic irrespective of the number of "
3625 "active tasks, true real-time computing was not possible up to kernel version "
3626 "2.6.17."
3627 msgstr ""
3628
3629 #. type: SS
3630 #: build/C/man2/sched_setscheduler.2:487
3631 #, no-wrap
3632 msgid "Real-time features in the mainline Linux kernel"
3633 msgstr ""
3634
3635 #.  FIXME . Probably this text will need some minor tweaking
3636 #.  by about the time of 2.6.30; ask Carsten Emde about this then.
3637 #. type: Plain text
3638 #: build/C/man2/sched_setscheduler.2:501
3639 msgid ""
3640 "From kernel version 2.6.18 onward, however, Linux is gradually becoming "
3641 "equipped with real-time capabilities, most of which are derived from the "
3642 "former I<realtime-preempt> patches developed by Ingo Molnar, Thomas "
3643 "Gleixner, Steven Rostedt, and others.  Until the patches have been "
3644 "completely merged into the mainline kernel (this is expected to be around "
3645 "kernel version 2.6.30), they must be installed to achieve the best real-time "
3646 "performance.  These patches are named:"
3647 msgstr ""
3648
3649 #. type: Plain text
3650 #: build/C/man2/sched_setscheduler.2:505
3651 #, no-wrap
3652 msgid "patch-I<kernelversion>-rtI<patchversion>\n"
3653 msgstr ""
3654
3655 #. type: Plain text
3656 #: build/C/man2/sched_setscheduler.2:511
3657 msgid ""
3658 "and can be downloaded from E<.UR "
3659 "http://www.kernel.org\\:/pub\\:/linux\\:/kernel\\:/projects\\:/rt/> E<.UE .>"
3660 msgstr ""
3661
3662 #. type: Plain text
3663 #: build/C/man2/sched_setscheduler.2:520
3664 msgid ""
3665 "Without the patches and prior to their full inclusion into the mainline "
3666 "kernel, the kernel configuration offers only the three preemption classes "
3667 "B<CONFIG_PREEMPT_NONE>, B<CONFIG_PREEMPT_VOLUNTARY>, and "
3668 "B<CONFIG_PREEMPT_DESKTOP> which respectively provide no, some, and "
3669 "considerable reduction of the worst-case scheduling latency."
3670 msgstr ""
3671
3672 #. type: Plain text
3673 #: build/C/man2/sched_setscheduler.2:531
3674 msgid ""
3675 "With the patches applied or after their full inclusion into the mainline "
3676 "kernel, the additional configuration item B<CONFIG_PREEMPT_RT> becomes "
3677 "available.  If this is selected, Linux is transformed into a regular "
3678 "real-time operating system.  The FIFO and RR scheduling policies that can be "
3679 "selected using B<sched_setscheduler>()  are then used to run a thread with "
3680 "true real-time priority and a minimum worst-case scheduling latency."
3681 msgstr ""
3682
3683 #. type: Plain text
3684 #: build/C/man2/sched_setscheduler.2:539
3685 msgid ""
3686 "POSIX says that on success, B<sched_setscheduler>()  should return the "
3687 "previous scheduling policy.  Linux B<sched_setscheduler>()  does not conform "
3688 "to this requirement, since it always returns 0 on success."
3689 msgstr ""
3690
3691 #. type: Plain text
3692 #: build/C/man2/sched_setscheduler.2:560
3693 msgid ""
3694 "B<chrt>(1), B<getpriority>(2), B<mlock>(2), B<mlockall>(2), B<munlock>(2), "
3695 "B<munlockall>(2), B<nice>(2), B<sched_get_priority_max>(2), "
3696 "B<sched_get_priority_min>(2), B<sched_getaffinity>(2), B<sched_getparam>(2), "
3697 "B<sched_rr_get_interval>(2), B<sched_setaffinity>(2), B<sched_setparam>(2), "
3698 "B<sched_yield>(2), B<setpriority>(2), B<capabilities>(7), B<cpuset>(7)"
3699 msgstr ""
3700
3701 #. type: Plain text
3702 #: build/C/man2/sched_setscheduler.2:567
3703 msgid "The Linux kernel source file I<Documentation/scheduler/sched-rt-group.txt>"
3704 msgstr ""
3705
3706 #. type: TH
3707 #: build/C/man2/sched_yield.2:29
3708 #, no-wrap
3709 msgid "SCHED_YIELD"
3710 msgstr ""
3711
3712 #. type: TH
3713 #: build/C/man2/sched_yield.2:29
3714 #, no-wrap
3715 msgid "2008-10-18"
3716 msgstr ""
3717
3718 #. type: Plain text
3719 #: build/C/man2/sched_yield.2:32
3720 msgid "sched_yield - yield the processor"
3721 msgstr ""
3722
3723 #. type: Plain text
3724 #: build/C/man2/sched_yield.2:36
3725 msgid "B<int sched_yield(void);>"
3726 msgstr ""
3727
3728 #. type: Plain text
3729 #: build/C/man2/sched_yield.2:41
3730 msgid ""
3731 "B<sched_yield>()  causes the calling thread to relinquish the CPU.  The "
3732 "thread is moved to the end of the queue for its static priority and a new "
3733 "thread gets to run."
3734 msgstr ""
3735
3736 #. type: Plain text
3737 #: build/C/man2/sched_yield.2:48
3738 msgid ""
3739 "On success, B<sched_yield>()  returns 0.  On error, -1 is returned, and "
3740 "I<errno> is set appropriately."
3741 msgstr ""
3742
3743 #. type: Plain text
3744 #: build/C/man2/sched_yield.2:52
3745 msgid "In the Linux implementation, B<sched_yield>()  always succeeds."
3746 msgstr ""
3747
3748 #. type: Plain text
3749 #: build/C/man2/sched_yield.2:59
3750 msgid ""
3751 "If the calling thread is the only thread in the highest priority list at "
3752 "that time, it will continue to run after a call to B<sched_yield>()."
3753 msgstr ""
3754
3755 #. type: Plain text
3756 #: build/C/man2/sched_yield.2:66
3757 msgid ""
3758 "POSIX systems on which B<sched_yield>()  is available define "
3759 "B<_POSIX_PRIORITY_SCHEDULING> in I<E<lt>unistd.hE<gt>>."
3760 msgstr ""
3761
3762 #. type: Plain text
3763 #: build/C/man2/sched_yield.2:79
3764 msgid ""
3765 "Strategic calls to B<sched_yield>()  can improve performance by giving other "
3766 "threads or processes a chance to run when (heavily) contended resources "
3767 "(e.g., mutexes)  have been released by the caller.  Avoid calling "
3768 "B<sched_yield>()  unnecessarily or inappropriately (e.g., when resources "
3769 "needed by other schedulable threads are still held by the caller), since "
3770 "doing so will result in unnecessary context switches, which will degrade "
3771 "system performance."
3772 msgstr ""
3773
3774 #. type: Plain text
3775 #: build/C/man2/sched_yield.2:82
3776 msgid "B<sched_setscheduler>(2)  for a description of Linux scheduling"
3777 msgstr ""
3778
3779 #. type: TH
3780 #: build/C/man2/setns.2:8
3781 #, no-wrap
3782 msgid "SETNS"
3783 msgstr ""
3784
3785 #. type: TH
3786 #: build/C/man2/setns.2:8
3787 #, no-wrap
3788 msgid "2013-01-01"
3789 msgstr ""
3790
3791 #. type: Plain text
3792 #: build/C/man2/setns.2:11
3793 msgid "setns - reassociate thread with a namespace"
3794 msgstr ""
3795
3796 #. type: Plain text
3797 #: build/C/man2/setns.2:17
3798 #, no-wrap
3799 msgid "B<int setns(int >I<fd>B<, int >I<nstype>B<);>\n"
3800 msgstr ""
3801
3802 #. type: Plain text
3803 #: build/C/man2/setns.2:21
3804 msgid ""
3805 "Given a file descriptor referring to a namespace, reassociate the calling "
3806 "thread with that namespace."
3807 msgstr ""
3808
3809 #. type: Plain text
3810 #: build/C/man2/setns.2:34
3811 msgid ""
3812 "The I<fd> argument is a file descriptor referring to one of the namespace "
3813 "entries in a I</proc/[pid]/ns/> directory; see B<proc>(5)  for further "
3814 "information on I</proc/[pid]/ns/>.  The calling thread will be reassociated "
3815 "with the corresponding namespace, subject to any constraints imposed by the "
3816 "I<nstype> argument."
3817 msgstr ""
3818
3819 #. type: Plain text
3820 #: build/C/man2/setns.2:40
3821 msgid ""
3822 "The I<nstype> argument specifies which type of namespace the calling thread "
3823 "may be reassociated with.  This argument can have one of the following "
3824 "values:"
3825 msgstr ""
3826
3827 #. type: TP
3828 #: build/C/man2/setns.2:40
3829 #, no-wrap
3830 msgid "B<0>"
3831 msgstr ""
3832
3833 #. type: Plain text
3834 #: build/C/man2/setns.2:43
3835 msgid "Allow any type of namespace to be joined."
3836 msgstr ""
3837
3838 #. type: TP
3839 #: build/C/man2/setns.2:43
3840 #, no-wrap
3841 msgid "B<CLONE_NEWIPC>"
3842 msgstr ""
3843
3844 #. type: Plain text
3845 #: build/C/man2/setns.2:47
3846 msgid "I<fd> must refer to an IPC namespace."
3847 msgstr ""
3848
3849 #. type: TP
3850 #: build/C/man2/setns.2:47
3851 #, no-wrap
3852 msgid "B<CLONE_NEWNET>"
3853 msgstr ""
3854
3855 #. type: Plain text
3856 #: build/C/man2/setns.2:51
3857 msgid "I<fd> must refer to a network namespace."
3858 msgstr ""
3859
3860 #. type: TP
3861 #: build/C/man2/setns.2:51
3862 #, no-wrap
3863 msgid "B<CLONE_NEWUTS>"
3864 msgstr ""
3865
3866 #. type: Plain text
3867 #: build/C/man2/setns.2:55
3868 msgid "I<fd> must refer to a UTS namespace."
3869 msgstr ""
3870
3871 #. type: Plain text
3872 #: build/C/man2/setns.2:70
3873 msgid ""
3874 "Specifying I<nstype> as 0 suffices if the caller knows (or does not care)  "
3875 "what type of namespace is referred to by I<fd>.  Specifying a nonzero value "
3876 "for I<nstype> is useful if the caller does not know what type of namespace "
3877 "is referred to by I<fd> and wants to ensure that the namespace is of a "
3878 "particular type.  (The caller might not know the type of the namespace "
3879 "referred to by I<fd> if the file descriptor was opened by another process "
3880 "and, for example, passed to the caller via a UNIX domain socket.)"
3881 msgstr ""
3882
3883 #. type: Plain text
3884 #: build/C/man2/setns.2:77
3885 msgid ""
3886 "On success, I<setns>()  returns 0.  On failure, -1 is returned and I<errno> "
3887 "is set to indicate the error."
3888 msgstr ""
3889
3890 #. type: Plain text
3891 #: build/C/man2/setns.2:82
3892 msgid "I<fd> is not a valid file descriptor."
3893 msgstr ""
3894
3895 #. type: Plain text
3896 #: build/C/man2/setns.2:89
3897 msgid ""
3898 "I<fd> refers to a namespace whose type does not match that specified in "
3899 "I<nstype>, or there is problem with reassociating the the thread with the "
3900 "specified namespace."
3901 msgstr ""
3902
3903 #. type: Plain text
3904 #: build/C/man2/setns.2:92
3905 msgid "Cannot allocate sufficient memory to change the specified namespace."
3906 msgstr ""
3907
3908 #. type: Plain text
3909 #: build/C/man2/setns.2:97
3910 msgid ""
3911 "The calling thread did not have the required privilege (B<CAP_SYS_ADMIN>)  "
3912 "for this operation."
3913 msgstr ""
3914
3915 #. type: Plain text
3916 #: build/C/man2/setns.2:102
3917 msgid ""
3918 "The B<setns>()  system call first appeared in Linux in kernel 3.0; library "
3919 "support was added to glibc in version 2.14."
3920 msgstr ""
3921
3922 #. type: Plain text
3923 #: build/C/man2/setns.2:106
3924 msgid "The B<setns>()  system call is Linux-specific."
3925 msgstr ""
3926
3927 #. type: Plain text
3928 #: build/C/man2/setns.2:112
3929 msgid ""
3930 "Not all of the attributes that can be shared when a new thread is created "
3931 "using B<clone>(2)  can be changed using B<setns>()."
3932 msgstr ""
3933
3934 #. type: Plain text
3935 #: build/C/man2/setns.2:121
3936 msgid ""
3937 "The program below takes two or more arguments.  The first argument specifies "
3938 "the pathname of a namespace file in an existing I</proc/[pid]/ns/> "
3939 "directory.  The remaining arguments specify a command and its arguments.  "
3940 "The program opens the namespace file, joins that namespace using B<setns>(), "
3941 "and executes the specified command inside that namespace."
3942 msgstr ""
3943
3944 #. type: Plain text
3945 #: build/C/man2/setns.2:131
3946 msgid ""
3947 "The following shell session demonstrates the use of this program (compiled "
3948 "as a binary named I<ns_exec>)  in conjunction with the B<CLONE_NEWUTS> "
3949 "example program in the B<clone>(2)  man page (complied as a binary named "
3950 "I<newuts>)."
3951 msgstr ""
3952
3953 #. type: Plain text
3954 #: build/C/man2/setns.2:139
3955 msgid ""
3956 "We begin by executing the example program in B<clone>(2)  in the "
3957 "background.  That program creates a child in a separate UTS namespace.  The "
3958 "child changes the hostname in its namespace, and then both processes display "
3959 "the hostnames in their UTS namespaces, so that we can see that they are "
3960 "different."
3961 msgstr ""
3962
3963 #. type: Plain text
3964 #: build/C/man2/setns.2:151
3965 #, no-wrap
3966 msgid ""
3967 "$ B<su>                   # Need privilege for namespace operations\n"
3968 "Password:\n"
3969 "# B<./newuts bizarro &>\n"
3970 "[1] 3549\n"
3971 "clone() returned 3550\n"
3972 "uts.nodename in child:  bizarro\n"
3973 "uts.nodename in parent: antero\n"
3974 "# B<uname -n>             # Verify hostname in the shell\n"
3975 "antero\n"
3976 msgstr ""
3977
3978 #. type: Plain text
3979 #: build/C/man2/setns.2:158
3980 msgid ""
3981 "We then run the program shown below, using it to execute a shell.  Inside "
3982 "that shell, we verify that the hostname is the one set by the child created "
3983 "by the first program:"
3984 msgstr ""
3985
3986 #. type: Plain text
3987 #: build/C/man2/setns.2:164
3988 #, no-wrap
3989 msgid ""
3990 "# B<./ns_exec /proc/3550/ns/uts /bin/bash>\n"
3991 "# B<uname -n>             # Executed in shell started by ns_exec\n"
3992 "bizarro\n"
3993 msgstr ""
3994
3995 #. type: Plain text
3996 #: build/C/man2/setns.2:174
3997 #, no-wrap
3998 msgid ""
3999 "#define _GNU_SOURCE\n"
4000 "#include E<lt>fcntl.hE<gt>\n"
4001 "#include E<lt>sched.hE<gt>\n"
4002 "#include E<lt>unistd.hE<gt>\n"
4003 "#include E<lt>stdlib.hE<gt>\n"
4004 "#include E<lt>stdio.hE<gt>\n"
4005 msgstr ""
4006
4007 #. type: Plain text
4008 #: build/C/man2/setns.2:182
4009 #, no-wrap
4010 msgid ""
4011 "int\n"
4012 "main(int argc, char *argv[])\n"
4013 "{\n"
4014 "    int fd;\n"
4015 msgstr ""
4016
4017 #. type: Plain text
4018 #: build/C/man2/setns.2:187
4019 #, no-wrap
4020 msgid ""
4021 "    if (argc E<lt> 3) {\n"
4022 "        fprintf(stderr, \"%s /proc/PID/ns/FILE cmd args...\\en\", "
4023 "argv[0]);\n"
4024 "        exit(EXIT_FAILURE);\n"
4025 "    }\n"
4026 msgstr ""
4027
4028 #. type: Plain text
4029 #: build/C/man2/setns.2:191
4030 #, no-wrap
4031 msgid ""
4032 "    fd = open(argv[1], O_RDONLY);   /* Get descriptor for namespace */\n"
4033 "    if (fd == -1)\n"
4034 "        errExit(\"open\");\n"
4035 msgstr ""
4036
4037 #. type: Plain text
4038 #: build/C/man2/setns.2:194
4039 #, no-wrap
4040 msgid ""
4041 "    if (setns(fd, 0) == -1)         /* Join that namespace */\n"
4042 "        errExit(\"setns\");\n"
4043 msgstr ""
4044
4045 #. type: Plain text
4046 #: build/C/man2/setns.2:198
4047 #, no-wrap
4048 msgid ""
4049 "    execvp(argv[2], &argv[2]);      /* Execute a command in namespace */\n"
4050 "    errExit(\"execvp\");\n"
4051 "}\n"
4052 msgstr ""
4053
4054 #. type: Plain text
4055 #: build/C/man2/setns.2:205
4056 msgid "B<clone>(2), B<fork>(2), B<vfork>(2), B<proc>(5), B<unix>(7)"
4057 msgstr ""
4058
4059 #. type: TH
4060 #: build/C/man2/unshare.2:20
4061 #, no-wrap
4062 msgid "UNSHARE"
4063 msgstr ""
4064
4065 #. type: Plain text
4066 #: build/C/man2/unshare.2:23
4067 msgid "unshare - disassociate parts of the process execution context"
4068 msgstr ""
4069
4070 #. type: Plain text
4071 #: build/C/man2/unshare.2:28
4072 #, no-wrap
4073 msgid "B<int unshare(int >I<flags>B<);>\n"
4074 msgstr ""
4075
4076 #. type: Plain text
4077 #: build/C/man2/unshare.2:36
4078 msgid "B<unshare>():"
4079 msgstr ""
4080
4081 #. type: Plain text
4082 #: build/C/man2/unshare.2:62
4083 msgid ""
4084 "B<unshare>()  allows a process to disassociate parts of its execution "
4085 "context that are currently being shared with other processes.  Part of the "
4086 "execution context, such as the mount namespace, is shared implicitly when a "
4087 "new process is created using B<fork>(2)  or B<vfork>(2), while other parts, "
4088 "such as virtual memory, may be shared by explicit request when creating a "
4089 "process using B<clone>(2)."
4090 msgstr ""
4091
4092 #. type: Plain text
4093 #: build/C/man2/unshare.2:67
4094 msgid ""
4095 "The main use of B<unshare>()  is to allow a process to control its shared "
4096 "execution context without creating a new process."
4097 msgstr ""
4098
4099 #. type: Plain text
4100 #: build/C/man2/unshare.2:74
4101 msgid ""
4102 "The I<flags> argument is a bit mask that specifies which parts of the "
4103 "execution context should be unshared.  This argument is specified by ORing "
4104 "together zero or more of the following constants:"
4105 msgstr ""
4106
4107 #. type: TP
4108 #: build/C/man2/unshare.2:74
4109 #, no-wrap
4110 msgid "B<CLONE_FILES>"
4111 msgstr ""
4112
4113 #. type: Plain text
4114 #: build/C/man2/unshare.2:82
4115 msgid ""
4116 "Reverse the effect of the B<clone>(2)  B<CLONE_FILES> flag.  Unshare the "
4117 "file descriptor table, so that the calling process no longer shares its file "
4118 "descriptors with any other process."
4119 msgstr ""
4120
4121 #. type: TP
4122 #: build/C/man2/unshare.2:82
4123 #, no-wrap
4124 msgid "B<CLONE_FS>"
4125 msgstr ""
4126
4127 #. type: Plain text
4128 #: build/C/man2/unshare.2:96
4129 msgid ""
4130 "Reverse the effect of the B<clone>(2)  B<CLONE_FS> flag.  Unshare filesystem "
4131 "attributes, so that the calling process no longer shares its root directory "
4132 "(B<chroot>(2)), current directory (B<chdir>(2)), or umask (B<umask>(2))  "
4133 "attributes with any other process."
4134 msgstr ""
4135
4136 #. type: Plain text
4137 #: build/C/man2/unshare.2:113
4138 msgid ""
4139 "This flag has the same effect as the B<clone>(2)  B<CLONE_NEWIPC> flag.  "
4140 "Unshare the System V IPC namespace, so that the calling process has a "
4141 "private copy of the System V IPC namespace which is not shared with any "
4142 "other process.  Specifying this flag automatically implies B<CLONE_SYSVSEM> "
4143 "as well.  Use of B<CLONE_NEWIPC> requires the B<CAP_SYS_ADMIN> capability."
4144 msgstr ""
4145
4146 #. type: Plain text
4147 #: build/C/man2/unshare.2:128
4148 msgid ""
4149 "This flag has the same effect as the B<clone>(2)  B<CLONE_NEWNET> flag.  "
4150 "Unshare the network namespace, so that the calling process is moved into a "
4151 "new network namespace which is not shared with any previously existing "
4152 "process.  Use of B<CLONE_NEWNET> requires the B<CAP_SYS_ADMIN> capability."
4153 msgstr ""
4154
4155 #. type: TP
4156 #: build/C/man2/unshare.2:128
4157 #, no-wrap
4158 msgid "B<CLONE_NEWNS>"
4159 msgstr ""
4160
4161 #.  These flag name are inconsistent:
4162 #.  CLONE_NEWNS does the same thing in clone(), but CLONE_VM,
4163 #.  CLONE_FS, and CLONE_FILES reverse the action of the clone()
4164 #.  flags of the same name.
4165 #. type: Plain text
4166 #: build/C/man2/unshare.2:149
4167 msgid ""
4168 "This flag has the same effect as the B<clone>(2)  B<CLONE_NEWNS> flag.  "
4169 "Unshare the mount namespace, so that the calling process has a private copy "
4170 "of its namespace which is not shared with any other process.  Specifying "
4171 "this flag automatically implies B<CLONE_FS> as well.  Use of B<CLONE_NEWNS> "
4172 "requires the B<CAP_SYS_ADMIN> capability."
4173 msgstr ""
4174
4175 #. type: Plain text
4176 #: build/C/man2/unshare.2:163
4177 msgid ""
4178 "This flag has the same effect as the B<clone>(2)  B<CLONE_NEWUTS> flag.  "
4179 "Unshare the UTS IPC namespace, so that the calling process has a private "
4180 "copy of the UTS namespace which is not shared with any other process.  Use "
4181 "of B<CLONE_NEWUTS> requires the B<CAP_SYS_ADMIN> capability."
4182 msgstr ""
4183
4184 #. type: TP
4185 #: build/C/man2/unshare.2:163
4186 #, no-wrap
4187 msgid "B<CLONE_SYSVSEM> (since Linux 2.6.26)"
4188 msgstr ""
4189
4190 #.  commit 9edff4ab1f8d82675277a04e359d0ed8bf14a7b7
4191 #.  As at 2.6.16, the following forced implications also apply,
4192 #.  although the relevant flags are not yet implemented.
4193 #.  If CLONE_THREAD is set force CLONE_VM.
4194 #.  If CLONE_VM is set, force CLONE_SIGHAND.
4195 #.  CLONE_NEWNSIf CLONE_SIGHAND is set and signals are also being shared
4196 #.  (i.e., current->signal->count > 1), force CLONE_THREAD.
4197 #
4198 #.  FIXME . CLONE_VM is not (yet, as at 2.6.16) implemented.
4199 #.  .TP
4200 #.  .B CLONE_VM
4201 #.  Reverse the effect of the
4202 #.  .BR clone (2)
4203 #.  .B CLONE_VM
4204 #.  flag.
4205 #.  .RB ( CLONE_VM
4206 #.  is also implicitly set by
4207 #.  .BR vfork (2),
4208 #.  and can be reversed using this
4209 #.  .BR unshare ()
4210 #.  flag.)
4211 #.  Unshare virtual memory, so that the calling process no
4212 #.  longer shares its virtual address space with any other process.
4213 #. type: Plain text
4214 #: build/C/man2/unshare.2:200
4215 msgid ""
4216 "This flag reverses the effect of the B<clone>(2)  B<CLONE_SYSVSEM> flag.  "
4217 "Unshare System V semaphore undo values, so that the calling process has a "
4218 "private copy which is not shared with any other process.  Use of "
4219 "B<CLONE_SYSVSEM> requires the B<CAP_SYS_ADMIN> capability."
4220 msgstr ""
4221
4222 #. type: Plain text
4223 #: build/C/man2/unshare.2:207
4224 msgid ""
4225 "If I<flags> is specified as zero, then B<unshare>()  is a no-op; no changes "
4226 "are made to the calling process's execution context."
4227 msgstr ""
4228
4229 #. type: Plain text
4230 #: build/C/man2/unshare.2:212
4231 msgid ""
4232 "On success, zero returned.  On failure, -1 is returned and I<errno> is set "
4233 "to indicate the error."
4234 msgstr ""
4235
4236 #. type: Plain text
4237 #: build/C/man2/unshare.2:217
4238 msgid "An invalid bit was specified in I<flags>."
4239 msgstr ""
4240
4241 #. type: Plain text
4242 #: build/C/man2/unshare.2:221
4243 msgid ""
4244 "Cannot allocate sufficient memory to copy parts of caller's context that "
4245 "need to be unshared."
4246 msgstr ""
4247
4248 #. type: Plain text
4249 #: build/C/man2/unshare.2:224
4250 msgid "The calling process did not have the required privileges for this operation."
4251 msgstr ""
4252
4253 #. type: Plain text
4254 #: build/C/man2/unshare.2:228
4255 msgid "The B<unshare>()  system call was added to Linux in kernel 2.6.16."
4256 msgstr ""
4257
4258 #. type: Plain text
4259 #: build/C/man2/unshare.2:232
4260 msgid "The B<unshare>()  system call is Linux-specific."
4261 msgstr ""
4262
4263 #.  FIXME all of the following needs to be reviewed for the current kernel
4264 #.  However, we can do unshare(CLONE_SIGHAND) if CLONE_SIGHAND
4265 #.  was not specified when doing clone(); i.e., unsharing
4266 #.  signal handlers is permitted if we are not actually
4267 #.  sharing signal handlers.   mtk
4268 #.  However, we can do unshare(CLONE_VM) if CLONE_VM
4269 #.  was not specified when doing clone(); i.e., unsharing
4270 #.  virtual memory is permitted if we are not actually
4271 #.  sharing virtual memory.   mtk
4272 #
4273 #. 9) Future Work
4274 #. --------------
4275 #. The current implementation of unshare does not allow unsharing of
4276 #. signals and signal handlers. Signals are complex to begin with and
4277 #. to unshare signals and/or signal handlers of a currently running
4278 #. process is even more complex. If in the future there is a specific
4279 #. need to allow unsharing of signals and/or signal handlers, it can
4280 #. be incrementally added to unshare without affecting legacy
4281 #. applications using unshare.
4282 #. type: Plain text
4283 #: build/C/man2/unshare.2:266
4284 msgid ""
4285 "Not all of the process attributes that can be shared when a new process is "
4286 "created using B<clone>(2)  can be unshared using B<unshare>().  In "
4287 "particular, as at kernel 3.8, B<unshare>()  does not implement flags that "
4288 "reverse the effects of B<CLONE_SIGHAND>, B<CLONE_THREAD>, or B<CLONE_VM>.  "
4289 "Such functionality may be added in the future, if required."
4290 msgstr ""
4291
4292 #. type: Plain text
4293 #: build/C/man2/unshare.2:272
4294 msgid "B<clone>(2), B<fork>(2), B<kcmp>(2), B<setns>(2), B<vfork>(2)"
4295 msgstr ""
4296
4297 #. type: Plain text
4298 #: build/C/man2/unshare.2:275
4299 msgid "I<Documentation/unshare.txt> in the Linux kernel source tree"
4300 msgstr ""