OSDN Git Service

(split) LDP: Update POT and ja.po to LDP v3.54
[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: 2013-09-28 04:06+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=CHARSET\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:874 build/C/man2/kcmp.2:124 build/C/man2/sched_get_priority_max.2:98 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:422 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:991 build/C/man2/kcmp.2:195 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:998 build/C/man2/kcmp.2:199 build/C/man2/sched_get_priority_max.2:114 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:444 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:1002 build/C/man2/kcmp.2:202 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:447 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:1027 build/C/man2/sched_setscheduler.2:530
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:1069 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:1167 build/C/man2/kcmp.2:219 build/C/man2/sched_get_priority_max.2:116 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:538 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:1181 build/C/man2/kcmp.2:222 build/C/man2/sched_get_priority_max.2:128 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:566 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:1188 build/C/man2/kcmp.2:229 build/C/man2/sched_get_priority_max.2:135 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:573 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.54 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 "2013-04-16"
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 #.  FIXME 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:505
1174 msgid ""
1175 "A UTS namespace is the set of identifiers returned by B<uname>(2); among "
1176 "these, the domain name and the host name 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:510
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:510
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:517
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:523
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:531
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:531
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:539
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:539
1233 #, no-wrap
1234 msgid "B<CLONE_PID> (obsolete)"
1235 msgstr ""
1236
1237 #. type: Plain text
1238 #: build/C/man2/clone.2:550
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:550
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:557
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:557
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:564
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:564
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:580
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:591
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:599
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:599
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:608
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:616
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:616
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:625
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:625
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:634
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:642
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:651
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:661
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:683
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:688
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:693
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:699
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:707
1420 msgid ""
1421 "Since Linux 2.5.35, I<flags> must also include B<CLONE_SIGHAND> if "
1422 "B<CLONE_THREAD> is specified."
1423 msgstr ""
1424
1425 #. type: Plain text
1426 #: build/C/man2/clone.2:712
1427 msgid ""
1428 "Signals may be sent to a thread group as a whole (i.e., a TGID) using "
1429 "B<kill>(2), or to a specific thread (i.e., TID) using B<tgkill>(2)."
1430 msgstr ""
1431
1432 #. type: Plain text
1433 #: build/C/man2/clone.2:717
1434 msgid ""
1435 "Signal dispositions and actions are process-wide: if an unhandled signal is "
1436 "delivered to a thread, then it will affect (terminate, stop, continue, be "
1437 "ignored in)  all members of the thread group."
1438 msgstr ""
1439
1440 #. type: Plain text
1441 #: build/C/man2/clone.2:730
1442 msgid ""
1443 "Each thread has its own signal mask, as set by B<sigprocmask>(2), but "
1444 "signals can be pending either: for the whole process (i.e., deliverable to "
1445 "any member of the thread group), when sent with B<kill>(2); or for an "
1446 "individual thread, when sent with B<tgkill>(2).  A call to B<sigpending>(2)  "
1447 "returns a signal set that is the union of the signals pending for the whole "
1448 "process and the signals that are pending for the calling thread."
1449 msgstr ""
1450
1451 #. type: Plain text
1452 #: build/C/man2/clone.2:742
1453 msgid ""
1454 "If B<kill>(2)  is used to send a signal to a thread group, and the thread "
1455 "group has installed a handler for the signal, then the handler will be "
1456 "invoked in exactly one, arbitrarily selected member of the thread group that "
1457 "has not blocked the signal.  If multiple threads in a group are waiting to "
1458 "accept the same signal using B<sigwaitinfo>(2), the kernel will arbitrarily "
1459 "select one of these threads to receive a signal sent using B<kill>(2)."
1460 msgstr ""
1461
1462 #. type: TP
1463 #: build/C/man2/clone.2:742
1464 #, no-wrap
1465 msgid "B<CLONE_UNTRACED> (since Linux 2.5.46)"
1466 msgstr ""
1467
1468 #. type: Plain text
1469 #: build/C/man2/clone.2:749
1470 msgid ""
1471 "If B<CLONE_UNTRACED> is specified, then a tracing process cannot force "
1472 "B<CLONE_PTRACE> on this child process."
1473 msgstr ""
1474
1475 #. type: TP
1476 #: build/C/man2/clone.2:749
1477 #, no-wrap
1478 msgid "B<CLONE_VFORK> (since Linux 2.2)"
1479 msgstr ""
1480
1481 #. type: Plain text
1482 #: build/C/man2/clone.2:761
1483 msgid ""
1484 "If B<CLONE_VFORK> is set, the execution of the calling process is suspended "
1485 "until the child releases its virtual memory resources via a call to "
1486 "B<execve>(2)  or B<_exit>(2)  (as with B<vfork>(2))."
1487 msgstr ""
1488
1489 #. type: Plain text
1490 #: build/C/man2/clone.2:767
1491 msgid ""
1492 "If B<CLONE_VFORK> is not set then both the calling process and the child are "
1493 "schedulable after the call, and an application should not rely on execution "
1494 "occurring in any particular order."
1495 msgstr ""
1496
1497 #. type: TP
1498 #: build/C/man2/clone.2:767
1499 #, no-wrap
1500 msgid "B<CLONE_VM> (since Linux 2.0)"
1501 msgstr ""
1502
1503 #. type: Plain text
1504 #: build/C/man2/clone.2:780
1505 msgid ""
1506 "If B<CLONE_VM> is set, the calling process and the child process run in the "
1507 "same memory space.  In particular, memory writes performed by the calling "
1508 "process or by the child process are also visible in the other process.  "
1509 "Moreover, any memory mapping or unmapping performed with B<mmap>(2)  or "
1510 "B<munmap>(2)  by the child or calling process also affects the other "
1511 "process."
1512 msgstr ""
1513
1514 #. type: Plain text
1515 #: build/C/man2/clone.2:789
1516 msgid ""
1517 "If B<CLONE_VM> is not set, the child process runs in a separate copy of the "
1518 "memory space of the calling process at the time of B<clone>().  Memory "
1519 "writes or file mappings/unmappings performed by one of the processes do not "
1520 "affect the other, as with B<fork>(2)."
1521 msgstr ""
1522
1523 #. type: SS
1524 #: build/C/man2/clone.2:789
1525 #, no-wrap
1526 msgid "The raw system call interface"
1527 msgstr ""
1528
1529 #. type: Plain text
1530 #: build/C/man2/clone.2:805
1531 msgid ""
1532 "The raw B<clone>()  system call corresponds more closely to B<fork>(2)  in "
1533 "that execution in the child continues from the point of the call.  As such, "
1534 "the I<fn> and I<arg> arguments of the B<clone>()  wrapper function are "
1535 "omitted.  Furthermore, the argument order changes.  The raw system call "
1536 "interface on x86 and many other architectures is roughly:"
1537 msgstr ""
1538
1539 #. type: Plain text
1540 #: build/C/man2/clone.2:811
1541 #, no-wrap
1542 msgid ""
1543 "B<long clone(unsigned long >I<flags>B<, void *>I<child_stack>B<,>\n"
1544 "B<           void *>I<ptid>B<, void *>I<ctid>B<,>\n"
1545 "B<           struct pt_regs *>I<regs>B<);>\n"
1546 msgstr ""
1547
1548 #. type: Plain text
1549 #: build/C/man2/clone.2:822
1550 msgid ""
1551 "Another difference for the raw system call is that the I<child_stack> "
1552 "argument may be zero, in which case copy-on-write semantics ensure that the "
1553 "child gets separate copies of stack pages when either process modifies the "
1554 "stack.  In this case, for correct operation, the B<CLONE_VM> option should "
1555 "not be specified."
1556 msgstr ""
1557
1558 #. type: Plain text
1559 #: build/C/man2/clone.2:830
1560 msgid ""
1561 "For some architectures, the order of the arguments for the system call "
1562 "differs from that shown above.  On the score, microblaze, ARM, ARM 64, "
1563 "PA-RISC, arc, Power PC, xtensa, and MIPS architectures, the order of the "
1564 "fourth and fifth arguments is reversed.  On the cris and s390 architectures, "
1565 "the order of the first and second arguments is reversed."
1566 msgstr ""
1567
1568 #. type: SS
1569 #: build/C/man2/clone.2:830
1570 #, no-wrap
1571 msgid "blackfin, m68k, and sparc"
1572 msgstr ""
1573
1574 #. type: Plain text
1575 #: build/C/man2/clone.2:834
1576 msgid ""
1577 "The argument-passing conventions on blackfin, m68k, and sparc are different "
1578 "from descriptions above.  For details, see the kernel (and glibc) source."
1579 msgstr ""
1580
1581 #. type: SS
1582 #: build/C/man2/clone.2:834
1583 #, no-wrap
1584 msgid "ia64"
1585 msgstr ""
1586
1587 #. type: Plain text
1588 #: build/C/man2/clone.2:836
1589 msgid "On ia64, a different interface is used:"
1590 msgstr ""
1591
1592 #. type: Plain text
1593 #: build/C/man2/clone.2:843
1594 #, no-wrap
1595 msgid ""
1596 "B<int __clone2(int (*>I<fn>B<)(void *), >\n"
1597 "B<             void *>I<child_stack_base>B<, size_t >I<stack_size>B<,>\n"
1598 "B<             int >I<flags>B<, void *>I<arg>B<, ... >\n"
1599 "B<          /* pid_t *>I<ptid>B<, struct user_desc *>I<tls>B<, pid_t "
1600 "*>I<ctid>B< */ );>\n"
1601 msgstr ""
1602
1603 #. type: Plain text
1604 #: build/C/man2/clone.2:855
1605 msgid ""
1606 "The prototype shown above is for the glibc wrapper function; the raw system "
1607 "call interface has no I<fn> or I<arg> argument, and changes the order of the "
1608 "arguments so that I<flags> is the first argument, and I<tls> is the last "
1609 "argument."
1610 msgstr ""
1611
1612 #. type: Plain text
1613 #: build/C/man2/clone.2:866
1614 msgid ""
1615 "B<__clone2>()  operates in the same way as B<clone>(), except that "
1616 "I<child_stack_base> points to the lowest address of the child's stack area, "
1617 "and I<stack_size> specifies the size of the stack pointed to by "
1618 "I<child_stack_base>."
1619 msgstr ""
1620
1621 #. type: SS
1622 #: build/C/man2/clone.2:866
1623 #, no-wrap
1624 msgid "Linux 2.4 and earlier"
1625 msgstr ""
1626
1627 #. type: Plain text
1628 #: build/C/man2/clone.2:874
1629 msgid ""
1630 "In Linux 2.4 and earlier, B<clone>()  does not take arguments I<ptid>, "
1631 "I<tls>, and I<ctid>."
1632 msgstr ""
1633
1634 #.  gettid(2) returns current->pid;
1635 #.  getpid(2) returns current->tgid;
1636 #. type: Plain text
1637 #: build/C/man2/clone.2:883
1638 msgid ""
1639 "On success, the thread ID of the child process is returned in the caller's "
1640 "thread of execution.  On failure, -1 is returned in the caller's context, no "
1641 "child process will be created, and I<errno> will be set appropriately."
1642 msgstr ""
1643
1644 #. type: SH
1645 #: build/C/man2/clone.2:883 build/C/man2/kcmp.2:167 build/C/man2/sched_get_priority_max.2:108 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:432 build/C/man2/sched_yield.2:48 build/C/man2/setns.2:77 build/C/man2/unshare.2:212
1646 #, no-wrap
1647 msgid "ERRORS"
1648 msgstr ""
1649
1650 #. type: TP
1651 #: build/C/man2/clone.2:884
1652 #, no-wrap
1653 msgid "B<EAGAIN>"
1654 msgstr ""
1655
1656 #. type: Plain text
1657 #: build/C/man2/clone.2:887
1658 msgid "Too many processes are already running."
1659 msgstr ""
1660
1661 #. type: TP
1662 #: build/C/man2/clone.2:887 build/C/man2/clone.2:894 build/C/man2/clone.2:909 build/C/man2/clone.2:917 build/C/man2/clone.2:925 build/C/man2/clone.2:933 build/C/man2/clone.2:939 build/C/man2/clone.2:949 build/C/man2/clone.2:957 build/C/man2/clone.2:965 build/C/man2/kcmp.2:178 build/C/man2/sched_get_priority_max.2:109 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:433 build/C/man2/setns.2:82 build/C/man2/unshare.2:213
1663 #, no-wrap
1664 msgid "B<EINVAL>"
1665 msgstr ""
1666
1667 #. type: Plain text
1668 #: build/C/man2/clone.2:894
1669 msgid ""
1670 "B<CLONE_SIGHAND> was specified, but B<CLONE_VM> was not.  (Since Linux "
1671 "2.6.0-test6.)"
1672 msgstr ""
1673
1674 #.  .TP
1675 #.  .B EINVAL
1676 #.  Precisely one of
1677 #.  .B CLONE_DETACHED
1678 #.  and
1679 #.  .B CLONE_THREAD
1680 #.  was specified.
1681 #.  (Since Linux 2.6.0-test6.)
1682 #. type: Plain text
1683 #: build/C/man2/clone.2:909
1684 msgid ""
1685 "B<CLONE_THREAD> was specified, but B<CLONE_SIGHAND> was not.  (Since Linux "
1686 "2.5.35.)"
1687 msgstr ""
1688
1689 #. type: Plain text
1690 #: build/C/man2/clone.2:917
1691 msgid "Both B<CLONE_FS> and B<CLONE_NEWNS> were specified in I<flags>."
1692 msgstr ""
1693
1694 #. type: Plain text
1695 #: build/C/man2/clone.2:925
1696 msgid "Both B<CLONE_NEWIPC> and B<CLONE_SYSVSEM> were specified in I<flags>."
1697 msgstr ""
1698
1699 #. type: Plain text
1700 #: build/C/man2/clone.2:933
1701 msgid "Both B<CLONE_NEWPID> and B<CLONE_THREAD> were specified in I<flags>."
1702 msgstr ""
1703
1704 #. type: Plain text
1705 #: build/C/man2/clone.2:939
1706 msgid "Returned by B<clone>()  when a zero value is specified for I<child_stack>."
1707 msgstr ""
1708
1709 #. type: Plain text
1710 #: build/C/man2/clone.2:949
1711 msgid ""
1712 "B<CLONE_NEWIPC> was specified in I<flags>, but the kernel was not configured "
1713 "with the B<CONFIG_SYSVIPC> and B<CONFIG_IPC_NS> options."
1714 msgstr ""
1715
1716 #. type: Plain text
1717 #: build/C/man2/clone.2:957
1718 msgid ""
1719 "B<CLONE_NEWNET> was specified in I<flags>, but the kernel was not configured "
1720 "with the B<CONFIG_NET_NS> option."
1721 msgstr ""
1722
1723 #. type: Plain text
1724 #: build/C/man2/clone.2:965
1725 msgid ""
1726 "B<CLONE_NEWPID> was specified in I<flags>, but the kernel was not configured "
1727 "with the B<CONFIG_PID_NS> option."
1728 msgstr ""
1729
1730 #. type: Plain text
1731 #: build/C/man2/clone.2:973
1732 msgid ""
1733 "B<CLONE_NEWUTS> was specified in I<flags>, but the kernel was not configured "
1734 "with the B<CONFIG_UTS> option."
1735 msgstr ""
1736
1737 #. type: TP
1738 #: build/C/man2/clone.2:973 build/C/man2/setns.2:89 build/C/man2/unshare.2:217
1739 #, no-wrap
1740 msgid "B<ENOMEM>"
1741 msgstr ""
1742
1743 #. type: Plain text
1744 #: build/C/man2/clone.2:978
1745 msgid ""
1746 "Cannot allocate sufficient memory to allocate a task structure for the "
1747 "child, or to copy those parts of the caller's context that need to be "
1748 "copied."
1749 msgstr ""
1750
1751 #. type: TP
1752 #: build/C/man2/clone.2:978 build/C/man2/clone.2:987 build/C/man2/kcmp.2:182 build/C/man2/sched_setaffinity.2:135 build/C/man2/sched_setparam.2:101 build/C/man2/sched_setscheduler.2:438 build/C/man2/setns.2:92 build/C/man2/unshare.2:221
1753 #, no-wrap
1754 msgid "B<EPERM>"
1755 msgstr ""
1756
1757 #. type: Plain text
1758 #: build/C/man2/clone.2:987
1759 msgid ""
1760 "B<CLONE_NEWIPC>, B<CLONE_NEWNET>, B<CLONE_NEWNS>, B<CLONE_NEWPID>, or "
1761 "B<CLONE_NEWUTS> was specified by an unprivileged process (process without "
1762 "B<CAP_SYS_ADMIN>)."
1763 msgstr ""
1764
1765 #. type: Plain text
1766 #: build/C/man2/clone.2:991
1767 msgid "B<CLONE_PID> was specified by a process other than process 0."
1768 msgstr ""
1769
1770 #. type: Plain text
1771 #: build/C/man2/clone.2:998
1772 msgid ""
1773 "There is no entry for B<clone>()  in libc5.  glibc2 provides B<clone>()  as "
1774 "described in this manual page."
1775 msgstr ""
1776
1777 #. type: Plain text
1778 #: build/C/man2/clone.2:1002
1779 msgid ""
1780 "B<clone>()  is Linux-specific and should not be used in programs intended to "
1781 "be portable."
1782 msgstr ""
1783
1784 #. type: Plain text
1785 #: build/C/man2/clone.2:1012
1786 msgid ""
1787 "In the kernel 2.4.x series, B<CLONE_THREAD> generally does not make the "
1788 "parent of the new thread the same as the parent of the calling process.  "
1789 "However, for kernel versions 2.4.7 to 2.4.18 the B<CLONE_THREAD> flag "
1790 "implied the B<CLONE_PARENT> flag (as in kernel 2.6)."
1791 msgstr ""
1792
1793 #. type: Plain text
1794 #: build/C/man2/clone.2:1022
1795 msgid ""
1796 "For a while there was B<CLONE_DETACHED> (introduced in 2.5.32): parent wants "
1797 "no child-exit signal.  In 2.6.2 the need to give this together with "
1798 "B<CLONE_THREAD> disappeared.  This flag is still defined, but has no effect."
1799 msgstr ""
1800
1801 #. type: Plain text
1802 #: build/C/man2/clone.2:1027
1803 msgid ""
1804 "On i386, B<clone>()  should not be called through vsyscall, but directly "
1805 "through I<int $0x80>."
1806 msgstr ""
1807
1808 #. type: Plain text
1809 #: build/C/man2/clone.2:1058
1810 msgid ""
1811 "Versions of the GNU C library that include the NPTL threading library "
1812 "contain a wrapper function for B<getpid>(2)  that performs caching of PIDs.  "
1813 "This caching relies on support in the glibc wrapper for B<clone>(), but as "
1814 "currently implemented, the cache may not be up to date in some "
1815 "circumstances.  In particular, if a signal is delivered to the child "
1816 "immediately after the B<clone>()  call, then a call to B<getpid>(2)  in a "
1817 "handler for the signal may return the PID of the calling process (\"the "
1818 "parent\"), if the clone wrapper has not yet had a chance to update the PID "
1819 "cache in the child.  (This discussion ignores the case where the child was "
1820 "created using B<CLONE_THREAD>, when B<getpid>(2)  I<should> return the same "
1821 "value in the child and in the process that called B<clone>(), since the "
1822 "caller and the child are in the same thread group.  The stale-cache problem "
1823 "also does not occur if the I<flags> argument includes B<CLONE_VM>.)  To get "
1824 "the truth, it may be necessary to use code such as the following:"
1825 msgstr ""
1826
1827 #. type: Plain text
1828 #: build/C/man2/clone.2:1061
1829 #, no-wrap
1830 msgid "    #include E<lt>syscall.hE<gt>\n"
1831 msgstr ""
1832
1833 #. type: Plain text
1834 #: build/C/man2/clone.2:1063
1835 #, no-wrap
1836 msgid "    pid_t mypid;\n"
1837 msgstr ""
1838
1839 #. type: Plain text
1840 #: build/C/man2/clone.2:1065
1841 #, no-wrap
1842 msgid "    mypid = syscall(SYS_getpid);\n"
1843 msgstr ""
1844
1845 #. type: SS
1846 #: build/C/man2/clone.2:1070
1847 #, no-wrap
1848 msgid "Create a child that executes in a separate UTS namespace"
1849 msgstr ""
1850
1851 #. type: Plain text
1852 #: build/C/man2/clone.2:1080
1853 msgid ""
1854 "The following program demonstrates the use of B<clone>()  to create a child "
1855 "process that executes in a separate UTS namespace.  The child changes the "
1856 "hostname in its UTS namespace.  Both parent and child then display the "
1857 "system hostname, making it possible to see that the hostname differs in the "
1858 "UTS namespaces of the parent and child.  For an example of the use of this "
1859 "program, see B<setns>(2)."
1860 msgstr ""
1861
1862 #. type: Plain text
1863 #: build/C/man2/clone.2:1090
1864 #, no-wrap
1865 msgid ""
1866 "#define _GNU_SOURCE\n"
1867 "#include E<lt>sys/wait.hE<gt>\n"
1868 "#include E<lt>sys/utsname.hE<gt>\n"
1869 "#include E<lt>sched.hE<gt>\n"
1870 "#include E<lt>string.hE<gt>\n"
1871 "#include E<lt>stdio.hE<gt>\n"
1872 "#include E<lt>stdlib.hE<gt>\n"
1873 "#include E<lt>unistd.hE<gt>\n"
1874 msgstr ""
1875
1876 #. type: Plain text
1877 #: build/C/man2/clone.2:1093 build/C/man2/setns.2:177
1878 #, no-wrap
1879 msgid ""
1880 "#define errExit(msg)    do { perror(msg); exit(EXIT_FAILURE); \\e\n"
1881 "                        } while (0)\n"
1882 msgstr ""
1883
1884 #. type: Plain text
1885 #: build/C/man2/clone.2:1098
1886 #, no-wrap
1887 msgid ""
1888 "static int              /* Start function for cloned child */\n"
1889 "childFunc(void *arg)\n"
1890 "{\n"
1891 "    struct utsname uts;\n"
1892 msgstr ""
1893
1894 #. type: Plain text
1895 #: build/C/man2/clone.2:1100
1896 #, no-wrap
1897 msgid "    /* Change hostname in UTS namespace of child */\n"
1898 msgstr ""
1899
1900 #. type: Plain text
1901 #: build/C/man2/clone.2:1103
1902 #, no-wrap
1903 msgid ""
1904 "    if (sethostname(arg, strlen(arg)) == -1)\n"
1905 "        errExit(\"sethostname\");\n"
1906 msgstr ""
1907
1908 #. type: Plain text
1909 #: build/C/man2/clone.2:1105
1910 #, no-wrap
1911 msgid "    /* Retrieve and display hostname */\n"
1912 msgstr ""
1913
1914 #. type: Plain text
1915 #: build/C/man2/clone.2:1109
1916 #, no-wrap
1917 msgid ""
1918 "    if (uname(&uts) == -1)\n"
1919 "        errExit(\"uname\");\n"
1920 "    printf(\"uts.nodename in child:  %s\\en\", uts.nodename);\n"
1921 msgstr ""
1922
1923 #. type: Plain text
1924 #: build/C/man2/clone.2:1113
1925 #, no-wrap
1926 msgid ""
1927 "    /* Keep the namespace open for a while, by sleeping.\n"
1928 "       This allows some experimentation--for example, another\n"
1929 "       process might join the namespace. */\n"
1930 msgstr ""
1931
1932 #. type: Plain text
1933 #: build/C/man2/clone.2:1115
1934 #, no-wrap
1935 msgid "    sleep(200);\n"
1936 msgstr ""
1937
1938 #. type: Plain text
1939 #: build/C/man2/clone.2:1118
1940 #, no-wrap
1941 msgid ""
1942 "    return 0;           /* Child terminates now */\n"
1943 "}\n"
1944 msgstr ""
1945
1946 #. type: Plain text
1947 #: build/C/man2/clone.2:1120
1948 #, no-wrap
1949 msgid "#define STACK_SIZE (1024 * 1024)    /* Stack size for cloned child */\n"
1950 msgstr ""
1951
1952 #. type: Plain text
1953 #: build/C/man2/clone.2:1128
1954 #, no-wrap
1955 msgid ""
1956 "int\n"
1957 "main(int argc, char *argv[])\n"
1958 "{\n"
1959 "    char *stack;                    /* Start of stack buffer */\n"
1960 "    char *stackTop;                 /* End of stack buffer */\n"
1961 "    pid_t pid;\n"
1962 "    struct utsname uts;\n"
1963 msgstr ""
1964
1965 #. type: Plain text
1966 #: build/C/man2/clone.2:1133
1967 #, no-wrap
1968 msgid ""
1969 "    if (argc E<lt> 2) {\n"
1970 "        fprintf(stderr, \"Usage: %s E<lt>child-hostnameE<gt>\\en\", "
1971 "argv[0]);\n"
1972 "        exit(EXIT_SUCCESS);\n"
1973 "    }\n"
1974 msgstr ""
1975
1976 #. type: Plain text
1977 #: build/C/man2/clone.2:1135
1978 #, no-wrap
1979 msgid "    /* Allocate stack for child */\n"
1980 msgstr ""
1981
1982 #. type: Plain text
1983 #: build/C/man2/clone.2:1140
1984 #, no-wrap
1985 msgid ""
1986 "    stack = malloc(STACK_SIZE);\n"
1987 "    if (stack == NULL)\n"
1988 "        errExit(\"malloc\");\n"
1989 "    stackTop = stack + STACK_SIZE;  /* Assume stack grows downward */\n"
1990 msgstr ""
1991
1992 #. type: Plain text
1993 #: build/C/man2/clone.2:1143
1994 #, no-wrap
1995 msgid ""
1996 "    /* Create child that has its own UTS namespace;\n"
1997 "       child commences execution in childFunc() */\n"
1998 msgstr ""
1999
2000 #. type: Plain text
2001 #: build/C/man2/clone.2:1148
2002 #, no-wrap
2003 msgid ""
2004 "    pid = clone(childFunc, stackTop, CLONE_NEWUTS | SIGCHLD, argv[1]);\n"
2005 "    if (pid == -1)\n"
2006 "        errExit(\"clone\");\n"
2007 "    printf(\"clone() returned %ld\\en\", (long) pid);\n"
2008 msgstr ""
2009
2010 #. type: Plain text
2011 #: build/C/man2/clone.2:1150
2012 #, no-wrap
2013 msgid "    /* Parent falls through to here */\n"
2014 msgstr ""
2015
2016 #. type: Plain text
2017 #: build/C/man2/clone.2:1152
2018 #, no-wrap
2019 msgid "    sleep(1);           /* Give child time to change its hostname */\n"
2020 msgstr ""
2021
2022 #. type: Plain text
2023 #: build/C/man2/clone.2:1155
2024 #, no-wrap
2025 msgid ""
2026 "    /* Display hostname in parent\\(aqs UTS namespace. This will be\n"
2027 "       different from hostname in child\\(aqs UTS namespace. */\n"
2028 msgstr ""
2029
2030 #. type: Plain text
2031 #: build/C/man2/clone.2:1159
2032 #, no-wrap
2033 msgid ""
2034 "    if (uname(&uts) == -1)\n"
2035 "        errExit(\"uname\");\n"
2036 "    printf(\"uts.nodename in parent: %s\\en\", uts.nodename);\n"
2037 msgstr ""
2038
2039 #. type: Plain text
2040 #: build/C/man2/clone.2:1163
2041 #, no-wrap
2042 msgid ""
2043 "    if (waitpid(pid, NULL, 0) == -1)    /* Wait for child */\n"
2044 "        errExit(\"waitpid\");\n"
2045 "    printf(\"child has terminated\\en\");\n"
2046 msgstr ""
2047
2048 #. type: Plain text
2049 #: build/C/man2/clone.2:1166
2050 #, no-wrap
2051 msgid ""
2052 "    exit(EXIT_SUCCESS);\n"
2053 "}\n"
2054 msgstr ""
2055
2056 #. type: Plain text
2057 #: build/C/man2/clone.2:1181
2058 msgid ""
2059 "B<fork>(2), B<futex>(2), B<getpid>(2), B<gettid>(2), B<kcmp>(2), "
2060 "B<set_thread_area>(2), B<set_tid_address>(2), B<setns>(2), B<tkill>(2), "
2061 "B<unshare>(2), B<wait>(2), B<capabilities>(7), B<pthreads>(7)"
2062 msgstr ""
2063
2064 #. type: TH
2065 #: build/C/man2/kcmp.2:28
2066 #, no-wrap
2067 msgid "KCMP"
2068 msgstr ""
2069
2070 #. type: TH
2071 #: build/C/man2/kcmp.2:28
2072 #, no-wrap
2073 msgid "2013-01-27"
2074 msgstr ""
2075
2076 #. type: Plain text
2077 #: build/C/man2/kcmp.2:31
2078 msgid "kcmp - compare two processes to determine if they share a kernel resource"
2079 msgstr ""
2080
2081 #. type: Plain text
2082 #: build/C/man2/kcmp.2:34
2083 #, no-wrap
2084 msgid "B<#include E<lt>linux/kcmp.hE<gt>>\n"
2085 msgstr ""
2086
2087 #. type: Plain text
2088 #: build/C/man2/kcmp.2:37
2089 #, no-wrap
2090 msgid ""
2091 "B<int kcmp(pid_t >I<pid1>B<, pid_t >I<pid2>B<, int >I<type>B<,>\n"
2092 "B<         unsigned long >I<idx1>B<, unsigned long >I<idx2>B<);>\n"
2093 msgstr ""
2094
2095 #. type: Plain text
2096 #: build/C/man2/kcmp.2:41
2097 msgid "I<Note>: There is no glibc wrapper for this system call; see NOTES."
2098 msgstr ""
2099
2100 #. type: Plain text
2101 #: build/C/man2/kcmp.2:50
2102 msgid ""
2103 "The B<kcmp>()  system call can be used to check whether the two processes "
2104 "identified by I<pid1> and I<pid2> share a kernel resource such as virtual "
2105 "memory, file descriptors, and so on."
2106 msgstr ""
2107
2108 #. type: Plain text
2109 #: build/C/man2/kcmp.2:55
2110 msgid ""
2111 "The I<type> argument specifies which resource is to be compared in the two "
2112 "processes.  It has one of the following values:"
2113 msgstr ""
2114
2115 #. type: TP
2116 #: build/C/man2/kcmp.2:55
2117 #, no-wrap
2118 msgid "B<KCMP_FILE>"
2119 msgstr ""
2120
2121 #. type: Plain text
2122 #: build/C/man2/kcmp.2:67
2123 msgid ""
2124 "Check whether a file descriptor I<idx1> in the process I<pid1> refers to the "
2125 "same open file description (see B<open>(2))  as file descriptor I<idx2> in "
2126 "the process I<pid2>."
2127 msgstr ""
2128
2129 #. type: TP
2130 #: build/C/man2/kcmp.2:67
2131 #, no-wrap
2132 msgid "B<KCMP_FILES>"
2133 msgstr ""
2134
2135 #. type: Plain text
2136 #: build/C/man2/kcmp.2:75
2137 msgid ""
2138 "Check whether the process share the same set of open file descriptors.  The "
2139 "arguments I<idx1> and I<idx2> are ignored."
2140 msgstr ""
2141
2142 #. type: TP
2143 #: build/C/man2/kcmp.2:75
2144 #, no-wrap
2145 msgid "B<KCMP_FS>"
2146 msgstr ""
2147
2148 #. type: Plain text
2149 #: build/C/man2/kcmp.2:84
2150 msgid ""
2151 "Check whether the processes share the same filesystem information (i.e., "
2152 "file mode creation mask, working directory, and filesystem root).  The "
2153 "arguments I<idx1> and I<idx2> are ignored."
2154 msgstr ""
2155
2156 #. type: TP
2157 #: build/C/man2/kcmp.2:84
2158 #, no-wrap
2159 msgid "B<KCMP_IO>"
2160 msgstr ""
2161
2162 #. type: Plain text
2163 #: build/C/man2/kcmp.2:92
2164 msgid ""
2165 "Check whether the processes share I/O context.  The arguments I<idx1> and "
2166 "I<idx2> are ignored."
2167 msgstr ""
2168
2169 #. type: TP
2170 #: build/C/man2/kcmp.2:92
2171 #, no-wrap
2172 msgid "B<KCMP_SIGHAND>"
2173 msgstr ""
2174
2175 #. type: Plain text
2176 #: build/C/man2/kcmp.2:100
2177 msgid ""
2178 "Check whether the processes share the same table of signal dispositions.  "
2179 "The arguments I<idx1> and I<idx2> are ignored."
2180 msgstr ""
2181
2182 #. type: TP
2183 #: build/C/man2/kcmp.2:100
2184 #, no-wrap
2185 msgid "B<KCMP_SYSVSEM>"
2186 msgstr ""
2187
2188 #. type: Plain text
2189 #: build/C/man2/kcmp.2:109
2190 msgid ""
2191 "Check whether the processes share the same list of System V semaphore undo "
2192 "operations.  The arguments I<idx1> and I<idx2> are ignored."
2193 msgstr ""
2194
2195 #. type: TP
2196 #: build/C/man2/kcmp.2:109
2197 #, no-wrap
2198 msgid "B<KCMP_VM>"
2199 msgstr ""
2200
2201 #. type: Plain text
2202 #: build/C/man2/kcmp.2:117
2203 msgid ""
2204 "Check whether the processes share the same address space.  The arguments "
2205 "I<idx1> and I<idx2> are ignored."
2206 msgstr ""
2207
2208 #. type: Plain text
2209 #: build/C/man2/kcmp.2:124
2210 msgid ""
2211 "Note the B<kcmp>()  is not protected against false positives which may have "
2212 "place if tasks are running.  Which means one should stop tasks being "
2213 "inspected with this syscall to obtain meaningful results."
2214 msgstr ""
2215
2216 #. type: Plain text
2217 #: build/C/man2/kcmp.2:130
2218 msgid ""
2219 "The return value of a successful call to B<kcmp>()  is simply the result of "
2220 "arithmetic comparison of kernel pointers (when the kernel compares "
2221 "resources, it uses their memory addresses)."
2222 msgstr ""
2223
2224 #. type: Plain text
2225 #: build/C/man2/kcmp.2:138
2226 msgid ""
2227 "The easiest way to explain is to consider an example.  Suppose that I<v1> "
2228 "and I<v2> are the addresses of appropriate resources, then the return value "
2229 "is one of the following:"
2230 msgstr ""
2231
2232 #. type: IP
2233 #: build/C/man2/kcmp.2:139
2234 #, no-wrap
2235 msgid "0"
2236 msgstr ""
2237
2238 #. type: Plain text
2239 #: build/C/man2/kcmp.2:144
2240 msgid ""
2241 "I<v1> is equal to I<v2>; in other words, the two processes share the "
2242 "resource."
2243 msgstr ""
2244
2245 #. type: IP
2246 #: build/C/man2/kcmp.2:144
2247 #, no-wrap
2248 msgid "1"
2249 msgstr ""
2250
2251 #. type: Plain text
2252 #: build/C/man2/kcmp.2:148
2253 msgid "I<v1> is less than I<v2>."
2254 msgstr ""
2255
2256 #. type: IP
2257 #: build/C/man2/kcmp.2:148
2258 #, no-wrap
2259 msgid "2"
2260 msgstr ""
2261
2262 #. type: Plain text
2263 #: build/C/man2/kcmp.2:152
2264 msgid "I<v1> is greater than I<v2>."
2265 msgstr ""
2266
2267 #. type: IP
2268 #: build/C/man2/kcmp.2:152
2269 #, no-wrap
2270 msgid "3"
2271 msgstr ""
2272
2273 #. type: Plain text
2274 #: build/C/man2/kcmp.2:157
2275 msgid "I<v1> is not equal to I<v2>, but ordering information is unavailable."
2276 msgstr ""
2277
2278 #. type: Plain text
2279 #: build/C/man2/kcmp.2:162
2280 msgid "On error, -1 is returned, and I<errno> is set appropriately."
2281 msgstr ""
2282
2283 #. type: Plain text
2284 #: build/C/man2/kcmp.2:167
2285 msgid ""
2286 "B<kcmp ()> was designed to return values suitable for sorting.  This is "
2287 "particularly handy if one needs to compare a large number of file "
2288 "descriptors."
2289 msgstr ""
2290
2291 #. type: TP
2292 #: build/C/man2/kcmp.2:168 build/C/man2/setns.2:78
2293 #, no-wrap
2294 msgid "B<EBADF>"
2295 msgstr ""
2296
2297 #. type: Plain text
2298 #: build/C/man2/kcmp.2:178
2299 msgid "I<type> is B<KCMP_FILE> and I<fd1> or I<fd2> is not an open file descriptor."
2300 msgstr ""
2301
2302 #. type: Plain text
2303 #: build/C/man2/kcmp.2:182
2304 msgid "I<type> is invalid."
2305 msgstr ""
2306
2307 #. type: Plain text
2308 #: build/C/man2/kcmp.2:188
2309 msgid ""
2310 "Insufficient permission to inspect process resources.  The B<CAP_SYS_PTRACE> "
2311 "capability is required to inspect processes that you do not own."
2312 msgstr ""
2313
2314 #. type: TP
2315 #: build/C/man2/kcmp.2:188 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:441
2316 #, no-wrap
2317 msgid "B<ESRCH>"
2318 msgstr ""
2319
2320 #. type: Plain text
2321 #: build/C/man2/kcmp.2:195
2322 msgid "Process I<pid1> or I<pid2> does not exist."
2323 msgstr ""
2324
2325 #. type: Plain text
2326 #: build/C/man2/kcmp.2:199
2327 msgid "The B<kcmp>()  system call first appeared in Linux 3.5."
2328 msgstr ""
2329
2330 #. type: Plain text
2331 #: build/C/man2/kcmp.2:202
2332 msgid ""
2333 "B<kcmp>()  is Linux specific and should not be used in programs intended to "
2334 "be portable."
2335 msgstr ""
2336
2337 #. type: Plain text
2338 #: build/C/man2/kcmp.2:205
2339 msgid ""
2340 "Glibc does not provide a wrapper for this system call; call it using "
2341 "B<syscall>(2)."
2342 msgstr ""
2343
2344 #. type: Plain text
2345 #: build/C/man2/kcmp.2:214
2346 msgid ""
2347 "This system call is available only if the kernel was configured with "
2348 "B<CONFIG_CHECKPOINT_RESTORE>.  The main use of the system call is for the "
2349 "checkpoint/restore in user space (CRIU) feature.  The alternative to this "
2350 "system call would have been to expose suitable process information via the "
2351 "B<proc>(5)  filesystem; this was deemed to be unsuitable for security "
2352 "reasons."
2353 msgstr ""
2354
2355 #. type: Plain text
2356 #: build/C/man2/kcmp.2:219
2357 msgid ""
2358 "See B<clone>(2)  for some background information on the shared resources "
2359 "referred to on this page."
2360 msgstr ""
2361
2362 #. type: Plain text
2363 #: build/C/man2/kcmp.2:222
2364 msgid "B<clone>(2), B<unshare>(2)"
2365 msgstr ""
2366
2367 #. type: TH
2368 #: build/C/man2/sched_get_priority_max.2:29
2369 #, no-wrap
2370 msgid "SCHED_GET_PRIORITY_MAX"
2371 msgstr ""
2372
2373 #. type: TH
2374 #: build/C/man2/sched_get_priority_max.2:29
2375 #, no-wrap
2376 msgid "2006-03-23"
2377 msgstr ""
2378
2379 #. type: Plain text
2380 #: build/C/man2/sched_get_priority_max.2:32
2381 msgid "sched_get_priority_max, sched_get_priority_min - get static priority range"
2382 msgstr ""
2383
2384 #. type: Plain text
2385 #: 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
2386 msgid "B<#include E<lt>sched.hE<gt>>"
2387 msgstr ""
2388
2389 #. type: Plain text
2390 #: build/C/man2/sched_get_priority_max.2:36
2391 msgid "B<int sched_get_priority_max(int >I<policy>B<);>"
2392 msgstr ""
2393
2394 #. type: Plain text
2395 #: build/C/man2/sched_get_priority_max.2:38
2396 msgid "B<int sched_get_priority_min(int >I<policy>B<);>"
2397 msgstr ""
2398
2399 #. type: Plain text
2400 #: build/C/man2/sched_get_priority_max.2:57
2401 msgid ""
2402 "B<sched_get_priority_max>()  returns the maximum priority value that can be "
2403 "used with the scheduling algorithm identified by I<policy>.  "
2404 "B<sched_get_priority_min>()  returns the minimum priority value that can be "
2405 "used with the scheduling algorithm identified by I<policy>.  Supported "
2406 "I<policy> values are B<SCHED_FIFO>, B<SCHED_RR>, B<SCHED_OTHER>, and "
2407 "B<SCHED_BATCH>.  Further details about these policies can be found in "
2408 "B<sched_setscheduler>(2)."
2409 msgstr ""
2410
2411 #. type: Plain text
2412 #: build/C/man2/sched_get_priority_max.2:66
2413 msgid ""
2414 "Processes with numerically higher priority values are scheduled before "
2415 "processes with numerically lower priority values.  Thus, the value returned "
2416 "by B<sched_get_priority_max>()  will be greater than the value returned by "
2417 "B<sched_get_priority_min>()."
2418 msgstr ""
2419
2420 #. type: Plain text
2421 #: build/C/man2/sched_get_priority_max.2:77
2422 msgid ""
2423 "Linux allows the static priority value range 1 to 99 for B<SCHED_FIFO> and "
2424 "B<SCHED_RR> and the priority 0 for B<SCHED_OTHER> and B<SCHED_BATCH>.  "
2425 "Scheduling priority ranges for the various policies are not alterable."
2426 msgstr ""
2427
2428 #. type: Plain text
2429 #: build/C/man2/sched_get_priority_max.2:89
2430 msgid ""
2431 "The range of scheduling priorities may vary on other POSIX systems, thus it "
2432 "is a good idea for portable applications to use a virtual priority range and "
2433 "map it to the interval given by B<sched_get_priority_max>()  and "
2434 "B<sched_get_priority_min>().  POSIX.1-2001 requires a spread of at least 32 "
2435 "between the maximum and the minimum values for B<SCHED_FIFO> and "
2436 "B<SCHED_RR>."
2437 msgstr ""
2438
2439 #. type: Plain text
2440 #: build/C/man2/sched_get_priority_max.2:98
2441 msgid ""
2442 "POSIX systems on which B<sched_get_priority_max>()  and "
2443 "B<sched_get_priority_min>()  are available define "
2444 "B<_POSIX_PRIORITY_SCHEDULING> in I<E<lt>unistd.hE<gt>>."
2445 msgstr ""
2446
2447 #. type: Plain text
2448 #: build/C/man2/sched_get_priority_max.2:108
2449 msgid ""
2450 "On success, B<sched_get_priority_max>()  and B<sched_get_priority_min>()  "
2451 "return the maximum/minimum priority value for the named scheduling policy.  "
2452 "On error, -1 is returned, and I<errno> is set appropriately."
2453 msgstr ""
2454
2455 #. type: Plain text
2456 #: build/C/man2/sched_get_priority_max.2:114
2457 msgid "The argument I<policy> does not identify a defined scheduling policy."
2458 msgstr ""
2459
2460 #. type: Plain text
2461 #: build/C/man2/sched_get_priority_max.2:116 build/C/man2/sched_rr_get_interval.2:96 build/C/man2/sched_setparam.2:112 build/C/man2/sched_yield.2:54
2462 msgid "POSIX.1-2001."
2463 msgstr ""
2464
2465 #. type: Plain text
2466 #: build/C/man2/sched_get_priority_max.2:125
2467 msgid ""
2468 "B<sched_getaffinity>(2), B<sched_getparam>(2), B<sched_getscheduler>(2), "
2469 "B<sched_setaffinity>(2), B<sched_setparam>(2), B<sched_setscheduler>(2)"
2470 msgstr ""
2471
2472 #. type: Plain text
2473 #: build/C/man2/sched_get_priority_max.2:128 build/C/man2/sched_rr_get_interval.2:138 build/C/man2/sched_setparam.2:134 build/C/man2/sched_setscheduler.2:563 build/C/man2/sched_yield.2:85
2474 msgid ""
2475 "I<Programming for the real world - POSIX.4> by Bill O. Gallmeister, O'Reilly "
2476 "& Associates, Inc., ISBN 1-56592-074-0."
2477 msgstr ""
2478
2479 #. type: TH
2480 #: build/C/man3/sched_getcpu.3:26
2481 #, no-wrap
2482 msgid "SCHED_GETCPU"
2483 msgstr ""
2484
2485 #. type: TH
2486 #: build/C/man3/sched_getcpu.3:26 build/C/man2/unshare.2:20
2487 #, no-wrap
2488 msgid "2013-04-17"
2489 msgstr ""
2490
2491 #. type: Plain text
2492 #: build/C/man3/sched_getcpu.3:29
2493 msgid "sched_getcpu - determine CPU on which the calling thread is running"
2494 msgstr ""
2495
2496 #. type: Plain text
2497 #: build/C/man3/sched_getcpu.3:34
2498 #, no-wrap
2499 msgid "B<int sched_getcpu(void);>\n"
2500 msgstr ""
2501
2502 #. type: Plain text
2503 #: build/C/man3/sched_getcpu.3:39 build/C/man2/unshare.2:33
2504 msgid "Feature Test Macro Requirements for glibc (see B<feature_test_macros>(7)):"
2505 msgstr ""
2506
2507 #. type: Plain text
2508 #: build/C/man3/sched_getcpu.3:42
2509 msgid "B<sched_getcpu>():"
2510 msgstr ""
2511
2512 #. type: Plain text
2513 #: build/C/man3/sched_getcpu.3:58
2514 msgid ""
2515 "B<sched_getcpu>()  returns the number of the CPU on which the calling thread "
2516 "is currently executing."
2517 msgstr ""
2518
2519 #. type: Plain text
2520 #: build/C/man3/sched_getcpu.3:65
2521 msgid ""
2522 "On success, B<sched_getcpu>()  returns a nonnegative CPU number.  On error, "
2523 "-1 is returned and I<errno> is set to indicate the error."
2524 msgstr ""
2525
2526 #. type: TP
2527 #: build/C/man3/sched_getcpu.3:66 build/C/man2/sched_rr_get_interval.2:87
2528 #, no-wrap
2529 msgid "B<ENOSYS>"
2530 msgstr ""
2531
2532 #. type: Plain text
2533 #: build/C/man3/sched_getcpu.3:70
2534 msgid "This kernel does not implement B<getcpu>(2)."
2535 msgstr ""
2536
2537 #. type: Plain text
2538 #: build/C/man3/sched_getcpu.3:72
2539 msgid "This function is available since glibc 2.6."
2540 msgstr ""
2541
2542 #. type: Plain text
2543 #: build/C/man3/sched_getcpu.3:75
2544 msgid "B<sched_getcpu>()  is glibc specific."
2545 msgstr ""
2546
2547 #. type: Plain text
2548 #: build/C/man3/sched_getcpu.3:77
2549 msgid "The call"
2550 msgstr ""
2551
2552 #. type: Plain text
2553 #: build/C/man3/sched_getcpu.3:81
2554 #, no-wrap
2555 msgid "cpu = sched_getcpu();\n"
2556 msgstr ""
2557
2558 #. type: Plain text
2559 #: build/C/man3/sched_getcpu.3:87
2560 msgid "is equivalent to the following B<getcpu>(2)  call:"
2561 msgstr ""
2562
2563 #. type: Plain text
2564 #: build/C/man3/sched_getcpu.3:93
2565 #, no-wrap
2566 msgid ""
2567 "int c, s;\n"
2568 "s = getcpu(&c, NULL, NULL);\n"
2569 "cpu = (s == -1) ? s : c;\n"
2570 msgstr ""
2571
2572 #. type: Plain text
2573 #: build/C/man3/sched_getcpu.3:97
2574 msgid "B<getcpu>(2)"
2575 msgstr ""
2576
2577 #. type: TH
2578 #: build/C/man2/sched_rr_get_interval.2:29
2579 #, no-wrap
2580 msgid "SCHED_RR_GET_INTERVAL"
2581 msgstr ""
2582
2583 #. type: TH
2584 #: build/C/man2/sched_rr_get_interval.2:29
2585 #, no-wrap
2586 msgid "2013-03-18"
2587 msgstr ""
2588
2589 #. type: Plain text
2590 #: build/C/man2/sched_rr_get_interval.2:32
2591 msgid "sched_rr_get_interval - get the SCHED_RR interval for the named process"
2592 msgstr ""
2593
2594 #. type: Plain text
2595 #: build/C/man2/sched_rr_get_interval.2:36
2596 msgid "B<int sched_rr_get_interval(pid_t >I<pid>B<, struct timespec * >I<tp>B<);>"
2597 msgstr ""
2598
2599 #. type: Plain text
2600 #: build/C/man2/sched_rr_get_interval.2:47
2601 msgid ""
2602 "B<sched_rr_get_interval>()  writes into the I<timespec> structure pointed to "
2603 "by I<tp> the round-robin time quantum for the process identified by I<pid>.  "
2604 "The specified process should be running under the B<SCHED_RR> scheduling "
2605 "policy."
2606 msgstr ""
2607
2608 #. type: Plain text
2609 #: build/C/man2/sched_rr_get_interval.2:51
2610 msgid "The I<timespec> structure has the following form:"
2611 msgstr ""
2612
2613 #. type: Plain text
2614 #: build/C/man2/sched_rr_get_interval.2:58
2615 #, no-wrap
2616 msgid ""
2617 "struct timespec {\n"
2618 "    time_t tv_sec;    /* seconds */\n"
2619 "    long   tv_nsec;   /* nanoseconds */\n"
2620 "};\n"
2621 msgstr ""
2622
2623 #.  FIXME . On Linux, sched_rr_get_interval()
2624 #.  returns the timeslice for SCHED_OTHER processes -- this timeslice
2625 #.  is influenced by the nice value.
2626 #.  For SCHED_FIFO processes, this always returns 0.
2627 #
2628 #.  The round-robin time quantum value is not alterable under Linux
2629 #.  1.3.81.
2630 #. type: Plain text
2631 #: build/C/man2/sched_rr_get_interval.2:73
2632 msgid ""
2633 "If I<pid> is zero, the time quantum for the calling process is written into "
2634 "I<*tp>."
2635 msgstr ""
2636
2637 #. type: Plain text
2638 #: build/C/man2/sched_rr_get_interval.2:80
2639 msgid ""
2640 "On success, B<sched_rr_get_interval>()  returns 0.  On error, -1 is "
2641 "returned, and I<errno> is set appropriately."
2642 msgstr ""
2643
2644 #. type: TP
2645 #: build/C/man2/sched_rr_get_interval.2:81 build/C/man2/sched_setaffinity.2:117
2646 #, no-wrap
2647 msgid "B<EFAULT>"
2648 msgstr ""
2649
2650 #. type: Plain text
2651 #: build/C/man2/sched_rr_get_interval.2:84
2652 msgid "Problem with copying information to user space."
2653 msgstr ""
2654
2655 #. type: Plain text
2656 #: build/C/man2/sched_rr_get_interval.2:87
2657 msgid "Invalid pid."
2658 msgstr ""
2659
2660 #. type: Plain text
2661 #: build/C/man2/sched_rr_get_interval.2:90
2662 msgid "The system call is not yet implemented (only on rather old kernels)."
2663 msgstr ""
2664
2665 #. type: Plain text
2666 #: build/C/man2/sched_rr_get_interval.2:94
2667 msgid "Could not find a process with the ID I<pid>."
2668 msgstr ""
2669
2670 #. type: Plain text
2671 #: build/C/man2/sched_rr_get_interval.2:103
2672 msgid ""
2673 "POSIX systems on which B<sched_rr_get_interval>()  is available define "
2674 "B<_POSIX_PRIORITY_SCHEDULING> in I<E<lt>unistd.hE<gt>>."
2675 msgstr ""
2676
2677 #. type: SS
2678 #: build/C/man2/sched_rr_get_interval.2:103
2679 #, no-wrap
2680 msgid "Linux notes"
2681 msgstr ""
2682
2683 #.  commit a4ec24b48ddef1e93f7578be53270f0b95ad666c
2684 #. type: Plain text
2685 #: build/C/man2/sched_rr_get_interval.2:117
2686 msgid ""
2687 "POSIX does not specify any mechanism for controlling the size of the "
2688 "round-robin time quantum.  Older Linux kernels provide a (nonportable) "
2689 "method of doing this.  The quantum can be controlled by adjusting the "
2690 "process's nice value (see B<setpriority>(2)).  Assigning a negative (i.e., "
2691 "high) nice value results in a longer quantum; assigning a positive (i.e., "
2692 "low) nice value results in a shorter quantum.  The default quantum is 0.1 "
2693 "seconds; the degree to which changing the nice value affects the quantum has "
2694 "varied somewhat across kernel versions.  This method of adjusting the "
2695 "quantum was removed starting with Linux 2.6.24."
2696 msgstr ""
2697
2698 #.  commit ce0dbbbb30aee6a835511d5be446462388ba9eee
2699 #.  .SH BUGS
2700 #.  As of Linux 1.3.81
2701 #.  .BR sched_rr_get_interval ()
2702 #.  returns with error
2703 #.  ENOSYS, because SCHED_RR has not yet been fully implemented and tested
2704 #.  properly.
2705 #. type: Plain text
2706 #: build/C/man2/sched_rr_get_interval.2:132
2707 msgid ""
2708 "Linux 3.9 added a new mechanism for adjusting (and viewing) the B<SCHED_RR> "
2709 "quantum: the I</proc/sys/kernel/sched_rr_timeslice_ms> file exposes the "
2710 "quantum as a millisecond value, whose default is 100.  Writing 0 to this "
2711 "file resets the quantum to the default value."
2712 msgstr ""
2713
2714 #. type: Plain text
2715 #: build/C/man2/sched_rr_get_interval.2:135 build/C/man2/sched_setaffinity.2:177
2716 msgid "B<sched_setscheduler>(2)  has a description of the Linux scheduling scheme."
2717 msgstr ""
2718
2719 #. type: TH
2720 #: build/C/man2/sched_setaffinity.2:34
2721 #, no-wrap
2722 msgid "SCHED_SETAFFINITY"
2723 msgstr ""
2724
2725 #. type: TH
2726 #: build/C/man2/sched_setaffinity.2:34 build/C/man2/sched_setparam.2:30 build/C/man2/sched_setscheduler.2:46
2727 #, no-wrap
2728 msgid "2013-09-17"
2729 msgstr ""
2730
2731 #. type: Plain text
2732 #: build/C/man2/sched_setaffinity.2:38
2733 msgid ""
2734 "sched_setaffinity, sched_getaffinity - set and get a thread's CPU affinity "
2735 "mask"
2736 msgstr ""
2737
2738 #. type: Plain text
2739 #: build/C/man2/sched_setaffinity.2:45
2740 #, no-wrap
2741 msgid ""
2742 "B<int sched_setaffinity(pid_t >I<pid>B<, size_t >I<cpusetsize>B<,>\n"
2743 "B<                      cpu_set_t *>I<mask>B<);>\n"
2744 msgstr ""
2745
2746 #. type: Plain text
2747 #: build/C/man2/sched_setaffinity.2:48
2748 #, no-wrap
2749 msgid ""
2750 "B<int sched_getaffinity(pid_t >I<pid>B<, size_t >I<cpusetsize>B<,>\n"
2751 "B<                      cpu_set_t *>I<mask>B<);>\n"
2752 msgstr ""
2753
2754 #. type: Plain text
2755 #: build/C/man2/sched_setaffinity.2:63
2756 msgid ""
2757 "A thread's CPU affinity mask determines the set of CPUs on which it is "
2758 "eligible to run.  On a multiprocessor system, setting the CPU affinity mask "
2759 "can be used to obtain performance benefits.  For example, by dedicating one "
2760 "CPU to a particular thread (i.e., setting the affinity mask of that thread "
2761 "to specify a single CPU, and setting the affinity mask of all other threads "
2762 "to exclude that CPU), it is possible to ensure maximum execution speed for "
2763 "that thread.  Restricting a thread to run on a single CPU also avoids the "
2764 "performance cost caused by the cache invalidation that occurs when a thread "
2765 "ceases to execute on one CPU and then recommences execution on a different "
2766 "CPU."
2767 msgstr ""
2768
2769 #. type: Plain text
2770 #: build/C/man2/sched_setaffinity.2:70
2771 msgid ""
2772 "A CPU affinity mask is represented by the I<cpu_set_t> structure, a \"CPU "
2773 "set\", pointed to by I<mask>.  A set of macros for manipulating CPU sets is "
2774 "described in B<CPU_SET>(3)."
2775 msgstr ""
2776
2777 #. type: Plain text
2778 #: build/C/man2/sched_setaffinity.2:85
2779 msgid ""
2780 "B<sched_setaffinity>()  sets the CPU affinity mask of the thread whose ID is "
2781 "I<pid> to the value specified by I<mask>.  If I<pid> is zero, then the "
2782 "calling thread is used.  The argument I<cpusetsize> is the length (in bytes) "
2783 "of the data pointed to by I<mask>.  Normally this argument would be "
2784 "specified as I<sizeof(cpu_set_t)>."
2785 msgstr ""
2786
2787 #. type: Plain text
2788 #: build/C/man2/sched_setaffinity.2:92
2789 msgid ""
2790 "If the thread specified by I<pid> is not currently running on one of the "
2791 "CPUs specified in I<mask>, then that thread is migrated to one of the CPUs "
2792 "specified in I<mask>."
2793 msgstr ""
2794
2795 #. type: Plain text
2796 #: build/C/man2/sched_setaffinity.2:107
2797 msgid ""
2798 "B<sched_getaffinity>()  writes the affinity mask of the thread whose ID is "
2799 "I<pid> into the I<cpu_set_t> structure pointed to by I<mask>.  The "
2800 "I<cpusetsize> argument specifies the size (in bytes) of I<mask>.  If I<pid> "
2801 "is zero, then the mask of the calling thread is returned."
2802 msgstr ""
2803
2804 #. type: Plain text
2805 #: build/C/man2/sched_setaffinity.2:116
2806 msgid ""
2807 "On success, B<sched_setaffinity>()  and B<sched_getaffinity>()  return 0.  "
2808 "On error, -1 is returned, and I<errno> is set appropriately."
2809 msgstr ""
2810
2811 #. type: Plain text
2812 #: build/C/man2/sched_setaffinity.2:120
2813 msgid "A supplied memory address was invalid."
2814 msgstr ""
2815
2816 #. type: Plain text
2817 #: build/C/man2/sched_setaffinity.2:128
2818 msgid ""
2819 "The affinity bit mask I<mask> contains no processors that are currently "
2820 "physically on the system and permitted to the thread according to any "
2821 "restrictions that may be imposed by the \"cpuset\" mechanism described in "
2822 "B<cpuset>(7)."
2823 msgstr ""
2824
2825 #. type: Plain text
2826 #: build/C/man2/sched_setaffinity.2:135
2827 msgid ""
2828 "(B<sched_getaffinity>()  and, in kernels before 2.6.9, "
2829 "B<sched_setaffinity>())  I<cpusetsize> is smaller than the size of the "
2830 "affinity mask used by the kernel."
2831 msgstr ""
2832
2833 #. type: Plain text
2834 #: build/C/man2/sched_setaffinity.2:145
2835 msgid ""
2836 "(B<sched_setaffinity>())  The calling thread does not have appropriate "
2837 "privileges.  The caller needs an effective user ID equal to the real user ID "
2838 "or effective user ID of the thread identified by I<pid>, or it must possess "
2839 "the B<CAP_SYS_NICE> capability."
2840 msgstr ""
2841
2842 #. type: Plain text
2843 #: build/C/man2/sched_setaffinity.2:148 build/C/man2/sched_setscheduler.2:444
2844 msgid "The thread whose ID is I<pid> could not be found."
2845 msgstr ""
2846
2847 #. type: Plain text
2848 #: build/C/man2/sched_setaffinity.2:159
2849 msgid ""
2850 "The CPU affinity system calls were introduced in Linux kernel 2.5.8.  The "
2851 "system call wrappers were introduced in glibc 2.3.  Initially, the glibc "
2852 "interfaces included a I<cpusetsize> argument, typed as I<unsigned int>.  In "
2853 "glibc 2.3.3, the I<cpusetsize> argument was removed, but was then restored "
2854 "in glibc 2.3.4, with type I<size_t>."
2855 msgstr ""
2856
2857 #. type: Plain text
2858 #: build/C/man2/sched_setaffinity.2:161
2859 msgid "These system calls are Linux-specific."
2860 msgstr ""
2861
2862 #. type: Plain text
2863 #: build/C/man2/sched_setaffinity.2:174
2864 msgid ""
2865 "After a call to B<sched_setaffinity>(), the set of CPUs on which the thread "
2866 "will actually run is the intersection of the set specified in the I<mask> "
2867 "argument and the set of CPUs actually present on the system.  The system may "
2868 "further restrict the set of CPUs on which the thread runs if the \"cpuset\" "
2869 "mechanism described in B<cpuset>(7)  is being used.  These restrictions on "
2870 "the actual set of CPUs on which the thread will run are silently imposed by "
2871 "the kernel."
2872 msgstr ""
2873
2874 #. type: Plain text
2875 #: build/C/man2/sched_setaffinity.2:194
2876 msgid ""
2877 "The affinity mask is a per-thread attribute that can be adjusted "
2878 "independently for each of the threads in a thread group.  The value returned "
2879 "from a call to B<gettid>(2)  can be passed in the argument I<pid>.  "
2880 "Specifying I<pid> as 0 will set the attribute for the calling thread, and "
2881 "passing the value returned from a call to B<getpid>(2)  will set the "
2882 "attribute for the main thread of the thread group.  (If you are using the "
2883 "POSIX threads API, then use B<pthread_setaffinity_np>(3)  instead of "
2884 "B<sched_setaffinity>().)"
2885 msgstr ""
2886
2887 #. type: Plain text
2888 #: build/C/man2/sched_setaffinity.2:200
2889 msgid ""
2890 "A child created via B<fork>(2)  inherits its parent's CPU affinity mask.  "
2891 "The affinity mask is preserved across an B<execve>(2)."
2892 msgstr ""
2893
2894 #. type: Plain text
2895 #: build/C/man2/sched_setaffinity.2:214
2896 msgid ""
2897 "This manual page describes the glibc interface for the CPU affinity calls.  "
2898 "The actual system call interface is slightly different, with the I<mask> "
2899 "being typed as I<unsigned long\\ *>, reflecting the fact that the underlying "
2900 "implementation of CPU sets is a simple bit mask.  On success, the raw "
2901 "B<sched_getaffinity>()  system call returns the size (in bytes) of the "
2902 "I<cpumask_t> data type that is used internally by the kernel to represent "
2903 "the CPU set bit mask."
2904 msgstr ""
2905
2906 #. type: Plain text
2907 #: build/C/man2/sched_setaffinity.2:233
2908 msgid ""
2909 "B<taskset>(1), B<clone>(2), B<getcpu>(2), B<getpriority>(2), B<gettid>(2), "
2910 "B<nice>(2), B<sched_get_priority_max>(2), B<sched_get_priority_min>(2), "
2911 "B<sched_getscheduler>(2), B<sched_setscheduler>(2), B<setpriority>(2), "
2912 "B<CPU_SET>(3), B<pthread_setaffinity_np>(3), B<sched_getcpu>(3), "
2913 "B<capabilities>(7), B<cpuset>(7)"
2914 msgstr ""
2915
2916 #. type: TH
2917 #: build/C/man2/sched_setparam.2:30
2918 #, no-wrap
2919 msgid "SCHED_SETPARAM"
2920 msgstr ""
2921
2922 #. type: Plain text
2923 #: build/C/man2/sched_setparam.2:33
2924 msgid "sched_setparam, sched_getparam - set and get scheduling parameters"
2925 msgstr ""
2926
2927 #. type: Plain text
2928 #: build/C/man2/sched_setparam.2:38
2929 #, no-wrap
2930 msgid ""
2931 "B<int sched_setparam(pid_t >I<pid>B<, const struct sched_param "
2932 "*>I<param>B<);>\n"
2933 msgstr ""
2934
2935 #. type: Plain text
2936 #: build/C/man2/sched_setparam.2:40
2937 #, no-wrap
2938 msgid "B<int sched_getparam(pid_t >I<pid>B<, struct sched_param *>I<param>B<);>\n"
2939 msgstr ""
2940
2941 #. type: Plain text
2942 #: build/C/man2/sched_setparam.2:46 build/C/man2/sched_setscheduler.2:65
2943 #, no-wrap
2944 msgid ""
2945 "B<struct sched_param {\n"
2946 "    ...\n"
2947 "    int >I<sched_priority>B<;\n"
2948 "    ...\n"
2949 "};>\n"
2950 msgstr ""
2951
2952 #. type: Plain text
2953 #: build/C/man2/sched_setparam.2:60
2954 msgid ""
2955 "B<sched_setparam>()  sets the scheduling parameters associated with the "
2956 "scheduling policy for the process identified by I<pid>.  If I<pid> is zero, "
2957 "then the parameters of the calling process are set.  The interpretation of "
2958 "the argument I<param> depends on the scheduling policy of the process "
2959 "identified by I<pid>.  See B<sched_setscheduler>(2)  for a description of "
2960 "the scheduling policies supported under Linux."
2961 msgstr ""
2962
2963 #. type: Plain text
2964 #: build/C/man2/sched_setparam.2:66
2965 msgid ""
2966 "B<sched_getparam>()  retrieves the scheduling parameters for the process "
2967 "identified by I<pid>.  If I<pid> is zero, then the parameters of the calling "
2968 "process are retrieved."
2969 msgstr ""
2970
2971 #. type: Plain text
2972 #: build/C/man2/sched_setparam.2:75
2973 msgid ""
2974 "B<sched_setparam>()  checks the validity of I<param> for the scheduling "
2975 "policy of the thread.  The value I<param-E<gt>sched_priority> must lie "
2976 "within the range given by B<sched_get_priority_min>(2)  and "
2977 "B<sched_get_priority_max>(2)."
2978 msgstr ""
2979
2980 #. type: Plain text
2981 #: build/C/man2/sched_setparam.2:79
2982 msgid ""
2983 "For a discussion of the privileges and resource limits related to scheduling "
2984 "priority and policy, see B<sched_setscheduler>(2)."
2985 msgstr ""
2986
2987 #. type: Plain text
2988 #: build/C/man2/sched_setparam.2:87
2989 msgid ""
2990 "POSIX systems on which B<sched_setparam>()  and B<sched_getparam>()  are "
2991 "available define B<_POSIX_PRIORITY_SCHEDULING> in I<E<lt>unistd.hE<gt>>."
2992 msgstr ""
2993
2994 #. type: Plain text
2995 #: build/C/man2/sched_setparam.2:96
2996 msgid ""
2997 "On success, B<sched_setparam>()  and B<sched_getparam>()  return 0.  On "
2998 "error, -1 is returned, and I<errno> is set appropriately."
2999 msgstr ""
3000
3001 #. type: Plain text
3002 #: build/C/man2/sched_setparam.2:101
3003 msgid "The argument I<param> does not make sense for the current scheduling policy."
3004 msgstr ""
3005
3006 #. type: Plain text
3007 #: build/C/man2/sched_setparam.2:107
3008 msgid ""
3009 "The calling process does not have appropriate privileges (Linux: does not "
3010 "have the B<CAP_SYS_NICE> capability)."
3011 msgstr ""
3012
3013 #. type: Plain text
3014 #: build/C/man2/sched_setparam.2:110
3015 msgid "The process whose ID is I<pid> could not be found."
3016 msgstr ""
3017
3018 #. type: Plain text
3019 #: build/C/man2/sched_setparam.2:118
3020 msgid ""
3021 "Scheduling parameters are in fact per-thread attributes on Linux; see "
3022 "B<sched_setscheduler>(2)."
3023 msgstr ""
3024
3025 #. type: Plain text
3026 #: build/C/man2/sched_setparam.2:131
3027 msgid ""
3028 "B<getpriority>(2), B<nice>(2), B<sched_get_priority_max>(2), "
3029 "B<sched_get_priority_min>(2), B<sched_getaffinity>(2), "
3030 "B<sched_getscheduler>(2), B<sched_setaffinity>(2), B<sched_setscheduler>(2), "
3031 "B<setpriority>(2), B<capabilities>(7)"
3032 msgstr ""
3033
3034 #. type: TH
3035 #: build/C/man2/sched_setscheduler.2:46
3036 #, no-wrap
3037 msgid "SCHED_SETSCHEDULER"
3038 msgstr ""
3039
3040 #. type: Plain text
3041 #: build/C/man2/sched_setscheduler.2:50
3042 msgid ""
3043 "sched_setscheduler, sched_getscheduler - set and get scheduling "
3044 "policy/parameters"
3045 msgstr ""
3046
3047 #. type: Plain text
3048 #: build/C/man2/sched_setscheduler.2:55
3049 #, no-wrap
3050 msgid "B<int sched_setscheduler(pid_t >I<pid>B<, int >I<policy>B<,>\n"
3051 msgstr ""
3052
3053 #. type: Plain text
3054 #: build/C/man2/sched_setscheduler.2:57
3055 #, no-wrap
3056 msgid "B<                       const struct sched_param *>I<param>B<);>\n"
3057 msgstr ""
3058
3059 #. type: Plain text
3060 #: build/C/man2/sched_setscheduler.2:59
3061 #, no-wrap
3062 msgid "B<int sched_getscheduler(pid_t >I<pid>B<);>\n"
3063 msgstr ""
3064
3065 #. type: Plain text
3066 #: build/C/man2/sched_setscheduler.2:76
3067 msgid ""
3068 "B<sched_setscheduler>()  sets both the scheduling policy and the associated "
3069 "parameters for the thread whose ID is specified in I<pid>.  If I<pid> equals "
3070 "zero, the scheduling policy and parameters of the calling thread will be "
3071 "set.  The interpretation of the argument I<param> depends on the selected "
3072 "policy.  Currently, Linux supports the following \"normal\" (i.e., "
3073 "non-real-time) scheduling policies:"
3074 msgstr ""
3075
3076 #. type: TP
3077 #: build/C/man2/sched_setscheduler.2:76
3078 #, no-wrap
3079 msgid "B<SCHED_OTHER>"
3080 msgstr ""
3081
3082 #.  In the 2.6 kernel sources, SCHED_OTHER is actually called
3083 #.  SCHED_NORMAL.
3084 #. type: Plain text
3085 #: build/C/man2/sched_setscheduler.2:81
3086 msgid "the standard round-robin time-sharing policy;"
3087 msgstr ""
3088
3089 #. type: TP
3090 #: build/C/man2/sched_setscheduler.2:81
3091 #, no-wrap
3092 msgid "B<SCHED_BATCH>"
3093 msgstr ""
3094
3095 #. type: Plain text
3096 #: build/C/man2/sched_setscheduler.2:84
3097 msgid "for \"batch\" style execution of processes; and"
3098 msgstr ""
3099
3100 #. type: TP
3101 #: build/C/man2/sched_setscheduler.2:84
3102 #, no-wrap
3103 msgid "B<SCHED_IDLE>"
3104 msgstr ""
3105
3106 #. type: Plain text
3107 #: build/C/man2/sched_setscheduler.2:89
3108 msgid "for running I<very> low priority background jobs."
3109 msgstr ""
3110
3111 #. type: Plain text
3112 #: build/C/man2/sched_setscheduler.2:93
3113 msgid ""
3114 "The following \"real-time\" policies are also supported, for special "
3115 "time-critical applications that need precise control over the way in which "
3116 "runnable threads are selected for execution:"
3117 msgstr ""
3118
3119 #. type: TP
3120 #: build/C/man2/sched_setscheduler.2:93
3121 #, no-wrap
3122 msgid "B<SCHED_FIFO>"
3123 msgstr ""
3124
3125 #. type: Plain text
3126 #: build/C/man2/sched_setscheduler.2:96
3127 msgid "a first-in, first-out policy; and"
3128 msgstr ""
3129
3130 #. type: TP
3131 #: build/C/man2/sched_setscheduler.2:96
3132 #, no-wrap
3133 msgid "B<SCHED_RR>"
3134 msgstr ""
3135
3136 #. type: Plain text
3137 #: build/C/man2/sched_setscheduler.2:99
3138 msgid "a round-robin policy."
3139 msgstr ""
3140
3141 #. type: Plain text
3142 #: build/C/man2/sched_setscheduler.2:101
3143 msgid "The semantics of each of these policies are detailed below."
3144 msgstr ""
3145
3146 #. type: Plain text
3147 #: build/C/man2/sched_setscheduler.2:108
3148 msgid ""
3149 "B<sched_getscheduler>()  queries the scheduling policy currently applied to "
3150 "the thread identified by I<pid>.  If I<pid> equals zero, the policy of the "
3151 "calling thread will be retrieved."
3152 msgstr ""
3153
3154 #. type: SS
3155 #: build/C/man2/sched_setscheduler.2:108
3156 #, no-wrap
3157 msgid "Scheduling policies"
3158 msgstr ""
3159
3160 #. type: Plain text
3161 #: build/C/man2/sched_setscheduler.2:117
3162 msgid ""
3163 "The scheduler is the kernel component that decides which runnable thread "
3164 "will be executed by the CPU next.  Each thread has an associated scheduling "
3165 "policy and a I<static> scheduling priority, I<sched_priority>; these are the "
3166 "settings that are modified by B<sched_setscheduler>().  The scheduler makes "
3167 "it decisions based on knowledge of the scheduling policy and static priority "
3168 "of all threads on the system."
3169 msgstr ""
3170
3171 #. type: Plain text
3172 #: build/C/man2/sched_setscheduler.2:122
3173 msgid ""
3174 "For threads scheduled under one of the normal scheduling policies "
3175 "(B<SCHED_OTHER>, B<SCHED_IDLE>, B<SCHED_BATCH>), I<sched_priority> is not "
3176 "used in scheduling decisions (it must be specified as 0)."
3177 msgstr ""
3178
3179 #. type: Plain text
3180 #: build/C/man2/sched_setscheduler.2:136
3181 msgid ""
3182 "Processes scheduled under one of the real-time policies (B<SCHED_FIFO>, "
3183 "B<SCHED_RR>) have a I<sched_priority> value in the range 1 (low) to 99 "
3184 "(high).  (As the numbers imply, real-time threads always have higher "
3185 "priority than normal threads.)  Note well: POSIX.1-2001 requires an "
3186 "implementation to support only a minimum 32 distinct priority levels for the "
3187 "real-time policies, and some systems supply just this minimum.  Portable "
3188 "programs should use B<sched_get_priority_min>(2)  and "
3189 "B<sched_get_priority_max>(2)  to find the range of priorities supported for "
3190 "a particular policy."
3191 msgstr ""
3192
3193 #. type: Plain text
3194 #: build/C/man2/sched_setscheduler.2:142
3195 msgid ""
3196 "Conceptually, the scheduler maintains a list of runnable threads for each "
3197 "possible I<sched_priority> value.  In order to determine which thread runs "
3198 "next, the scheduler looks for the nonempty list with the highest static "
3199 "priority and selects the thread at the head of this list."
3200 msgstr ""
3201
3202 #. type: Plain text
3203 #: build/C/man2/sched_setscheduler.2:146
3204 msgid ""
3205 "A thread's scheduling policy determines where it will be inserted into the "
3206 "list of threads with equal static priority and how it will move inside this "
3207 "list."
3208 msgstr ""
3209
3210 #. type: Plain text
3211 #: build/C/man2/sched_setscheduler.2:154
3212 msgid ""
3213 "All scheduling is preemptive: if a thread with a higher static priority "
3214 "becomes ready to run, the currently running thread will be preempted and "
3215 "returned to the wait list for its static priority level.  The scheduling "
3216 "policy determines the ordering only within the list of runnable threads with "
3217 "equal static priority."
3218 msgstr ""
3219
3220 #. type: SS
3221 #: build/C/man2/sched_setscheduler.2:154
3222 #, no-wrap
3223 msgid "SCHED_FIFO: First in-first out scheduling"
3224 msgstr ""
3225
3226 #. type: Plain text
3227 #: build/C/man2/sched_setscheduler.2:163
3228 msgid ""
3229 "B<SCHED_FIFO> can be used only with static priorities higher than 0, which "
3230 "means that when a B<SCHED_FIFO> threads becomes runnable, it will always "
3231 "immediately preempt any currently running B<SCHED_OTHER>, B<SCHED_BATCH>, or "
3232 "B<SCHED_IDLE> thread.  B<SCHED_FIFO> is a simple scheduling algorithm "
3233 "without time slicing.  For threads scheduled under the B<SCHED_FIFO> policy, "
3234 "the following rules apply:"
3235 msgstr ""
3236
3237 #. type: IP
3238 #: 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:287 build/C/man2/sched_setscheduler.2:295 build/C/man2/sched_setscheduler.2:336 build/C/man2/sched_setscheduler.2:344 build/C/man2/sched_setscheduler.2:349 build/C/man2/sched_setscheduler.2:354
3239 #, no-wrap
3240 msgid "*"
3241 msgstr ""
3242
3243 #. type: Plain text
3244 #: build/C/man2/sched_setscheduler.2:168
3245 msgid ""
3246 "A B<SCHED_FIFO> thread that has been preempted by another thread of higher "
3247 "priority will stay at the head of the list for its priority and will resume "
3248 "execution as soon as all threads of higher priority are blocked again."
3249 msgstr ""
3250
3251 #. type: Plain text
3252 #: build/C/man2/sched_setscheduler.2:171
3253 msgid ""
3254 "When a B<SCHED_FIFO> thread becomes runnable, it will be inserted at the end "
3255 "of the list for its priority."
3256 msgstr ""
3257
3258 #.  In 2.2.x and 2.4.x, the thread is placed at the front of the queue
3259 #.  In 2.0.x, the Right Thing happened: the thread went to the back -- MTK
3260 #. type: Plain text
3261 #: build/C/man2/sched_setscheduler.2:185
3262 msgid ""
3263 "A call to B<sched_setscheduler>()  or B<sched_setparam>(2)  will put the "
3264 "B<SCHED_FIFO> (or B<SCHED_RR>) thread identified by I<pid> at the start of "
3265 "the list if it was runnable.  As a consequence, it may preempt the currently "
3266 "running thread if it has the same priority.  (POSIX.1-2001 specifies that "
3267 "the thread should go to the end of the list.)"
3268 msgstr ""
3269
3270 #. type: Plain text
3271 #: build/C/man2/sched_setscheduler.2:189
3272 msgid "A thread calling B<sched_yield>(2)  will be put at the end of the list."
3273 msgstr ""
3274
3275 #. type: Plain text
3276 #: build/C/man2/sched_setscheduler.2:193
3277 msgid ""
3278 "No other events will move a thread scheduled under the B<SCHED_FIFO> policy "
3279 "in the wait list of runnable threads with equal static priority."
3280 msgstr ""
3281
3282 #. type: Plain text
3283 #: build/C/man2/sched_setscheduler.2:198
3284 msgid ""
3285 "A B<SCHED_FIFO> thread runs until either it is blocked by an I/O request, it "
3286 "is preempted by a higher priority thread, or it calls B<sched_yield>(2)."
3287 msgstr ""
3288
3289 #. type: SS
3290 #: build/C/man2/sched_setscheduler.2:198
3291 #, no-wrap
3292 msgid "SCHED_RR: Round-robin scheduling"
3293 msgstr ""
3294
3295 #.  On Linux 2.4, the length of the RR interval is influenced
3296 #.  by the process nice value -- MTK
3297 #. type: Plain text
3298 #: build/C/man2/sched_setscheduler.2:217
3299 msgid ""
3300 "B<SCHED_RR> is a simple enhancement of B<SCHED_FIFO>.  Everything described "
3301 "above for B<SCHED_FIFO> also applies to B<SCHED_RR>, except that each thread "
3302 "is allowed to run only for a maximum time quantum.  If a B<SCHED_RR> thread "
3303 "has been running for a time period equal to or longer than the time quantum, "
3304 "it will be put at the end of the list for its priority.  A B<SCHED_RR> "
3305 "thread that has been preempted by a higher priority thread and subsequently "
3306 "resumes execution as a running thread will complete the unexpired portion of "
3307 "its round-robin time quantum.  The length of the time quantum can be "
3308 "retrieved using B<sched_rr_get_interval>(2)."
3309 msgstr ""
3310
3311 #. type: SS
3312 #: build/C/man2/sched_setscheduler.2:217
3313 #, no-wrap
3314 msgid "SCHED_OTHER: Default Linux time-sharing scheduling"
3315 msgstr ""
3316
3317 #. type: Plain text
3318 #: build/C/man2/sched_setscheduler.2:233
3319 msgid ""
3320 "B<SCHED_OTHER> can be used at only static priority 0.  B<SCHED_OTHER> is the "
3321 "standard Linux time-sharing scheduler that is intended for all threads that "
3322 "do not require the special real-time mechanisms.  The thread to run is "
3323 "chosen from the static priority 0 list based on a I<dynamic> priority that "
3324 "is determined only inside this list.  The dynamic priority is based on the "
3325 "nice value (set by B<nice>(2)  or B<setpriority>(2))  and increased for each "
3326 "time quantum the thread is ready to run, but denied to run by the "
3327 "scheduler.  This ensures fair progress among all B<SCHED_OTHER> threads."
3328 msgstr ""
3329
3330 #. type: SS
3331 #: build/C/man2/sched_setscheduler.2:233
3332 #, no-wrap
3333 msgid "SCHED_BATCH: Scheduling batch processes"
3334 msgstr ""
3335
3336 #. type: Plain text
3337 #: build/C/man2/sched_setscheduler.2:245
3338 msgid ""
3339 "(Since Linux 2.6.16.)  B<SCHED_BATCH> can be used only at static priority "
3340 "0.  This policy is similar to B<SCHED_OTHER> in that it schedules the thread "
3341 "according to its dynamic priority (based on the nice value).  The difference "
3342 "is that this policy will cause the scheduler to always assume that the "
3343 "thread is CPU-intensive.  Consequently, the scheduler will apply a small "
3344 "scheduling penalty with respect to wakeup behaviour, so that this thread is "
3345 "mildly disfavored in scheduling decisions."
3346 msgstr ""
3347
3348 #.  The following paragraph is drawn largely from the text that
3349 #.  accompanied Ingo Molnar's patch for the implementation of
3350 #.  SCHED_BATCH.
3351 #. type: Plain text
3352 #: build/C/man2/sched_setscheduler.2:254
3353 msgid ""
3354 "This policy is useful for workloads that are noninteractive, but do not want "
3355 "to lower their nice value, and for workloads that want a deterministic "
3356 "scheduling policy without interactivity causing extra preemptions (between "
3357 "the workload's tasks)."
3358 msgstr ""
3359
3360 #. type: SS
3361 #: build/C/man2/sched_setscheduler.2:254
3362 #, no-wrap
3363 msgid "SCHED_IDLE: Scheduling very low priority jobs"
3364 msgstr ""
3365
3366 #. type: Plain text
3367 #: build/C/man2/sched_setscheduler.2:258
3368 msgid ""
3369 "(Since Linux 2.6.23.)  B<SCHED_IDLE> can be used only at static priority 0; "
3370 "the process nice value has no influence for this policy."
3371 msgstr ""
3372
3373 #. type: Plain text
3374 #: build/C/man2/sched_setscheduler.2:266
3375 msgid ""
3376 "This policy is intended for running jobs at extremely low priority (lower "
3377 "even than a +19 nice value with the B<SCHED_OTHER> or B<SCHED_BATCH> "
3378 "policies)."
3379 msgstr ""
3380
3381 #. type: SS
3382 #: build/C/man2/sched_setscheduler.2:266
3383 #, no-wrap
3384 msgid "Resetting scheduling policy for child processes"
3385 msgstr ""
3386
3387 #. type: Plain text
3388 #: build/C/man2/sched_setscheduler.2:282
3389 msgid ""
3390 "Since Linux 2.6.32, the B<SCHED_RESET_ON_FORK> flag can be ORed in I<policy> "
3391 "when calling B<sched_setscheduler>().  As a result of including this flag, "
3392 "children created by B<fork>(2)  do not inherit privileged scheduling "
3393 "policies.  This feature is intended for media-playback applications, and can "
3394 "be used to prevent applications evading the B<RLIMIT_RTTIME> resource limit "
3395 "(see B<getrlimit>(2))  by creating multiple child processes."
3396 msgstr ""
3397
3398 #. type: Plain text
3399 #: build/C/man2/sched_setscheduler.2:287
3400 msgid ""
3401 "More precisely, if the B<SCHED_RESET_ON_FORK> flag is specified, the "
3402 "following rules apply for subsequently created children:"
3403 msgstr ""
3404
3405 #. type: Plain text
3406 #: build/C/man2/sched_setscheduler.2:295
3407 msgid ""
3408 "If the calling thread has a scheduling policy of B<SCHED_FIFO> or "
3409 "B<SCHED_RR>, the policy is reset to B<SCHED_OTHER> in child processes."
3410 msgstr ""
3411
3412 #. type: Plain text
3413 #: build/C/man2/sched_setscheduler.2:298
3414 msgid ""
3415 "If the calling process has a negative nice value, the nice value is reset to "
3416 "zero in child processes."
3417 msgstr ""
3418
3419 #. type: Plain text
3420 #: build/C/man2/sched_setscheduler.2:307
3421 msgid ""
3422 "After the B<SCHED_RESET_ON_FORK> flag has been enabled, it can be reset only "
3423 "if the thread has the B<CAP_SYS_NICE> capability.  This flag is disabled in "
3424 "child processes created by B<fork>(2)."
3425 msgstr ""
3426
3427 #. type: Plain text
3428 #: build/C/man2/sched_setscheduler.2:313
3429 msgid ""
3430 "The B<SCHED_RESET_ON_FORK> flag is visible in the policy value returned by "
3431 "B<sched_getscheduler>()"
3432 msgstr ""
3433
3434 #. type: SS
3435 #: build/C/man2/sched_setscheduler.2:313
3436 #, no-wrap
3437 msgid "Privileges and resource limits"
3438 msgstr ""
3439
3440 #. type: Plain text
3441 #: build/C/man2/sched_setscheduler.2:326
3442 msgid ""
3443 "In Linux kernels before 2.6.12, only privileged (B<CAP_SYS_NICE>)  threads "
3444 "can set a nonzero static priority (i.e., set a real-time scheduling "
3445 "policy).  The only change that an unprivileged thread can make is to set the "
3446 "B<SCHED_OTHER> policy, and this can be done only if the effective user ID of "
3447 "the caller of B<sched_setscheduler>()  matches the real or effective user ID "
3448 "of the target thread (i.e., the thread specified by I<pid>)  whose policy is "
3449 "being changed."
3450 msgstr ""
3451
3452 #. type: Plain text
3453 #: build/C/man2/sched_setscheduler.2:336
3454 msgid ""
3455 "Since Linux 2.6.12, the B<RLIMIT_RTPRIO> resource limit defines a ceiling on "
3456 "an unprivileged thread's static priority for the B<SCHED_RR> and "
3457 "B<SCHED_FIFO> policies.  The rules for changing scheduling policy and "
3458 "priority are as follows:"
3459 msgstr ""
3460
3461 #. type: Plain text
3462 #: build/C/man2/sched_setscheduler.2:344
3463 msgid ""
3464 "If an unprivileged thread has a nonzero B<RLIMIT_RTPRIO> soft limit, then it "
3465 "can change its scheduling policy and priority, subject to the restriction "
3466 "that the priority cannot be set to a value higher than the maximum of its "
3467 "current priority and its B<RLIMIT_RTPRIO> soft limit."
3468 msgstr ""
3469
3470 #. type: Plain text
3471 #: build/C/man2/sched_setscheduler.2:349
3472 msgid ""
3473 "If the B<RLIMIT_RTPRIO> soft limit is 0, then the only permitted changes are "
3474 "to lower the priority, or to switch to a non-real-time policy."
3475 msgstr ""
3476
3477 #. type: Plain text
3478 #: build/C/man2/sched_setscheduler.2:354
3479 msgid ""
3480 "Subject to the same rules, another unprivileged thread can also make these "
3481 "changes, as long as the effective user ID of the thread making the change "
3482 "matches the real or effective user ID of the target thread."
3483 msgstr ""
3484
3485 #.  commit c02aa73b1d18e43cfd79c2f193b225e84ca497c8
3486 #. type: Plain text
3487 #: build/C/man2/sched_setscheduler.2:372
3488 msgid ""
3489 "Special rules apply for the B<SCHED_IDLE>.  In Linux kernels before 2.6.39, "
3490 "an unprivileged thread operating under this policy cannot change its policy, "
3491 "regardless of the value of its B<RLIMIT_RTPRIO> resource limit.  In Linux "
3492 "kernels since 2.6.39, an unprivileged thread can switch to either the "
3493 "B<SCHED_BATCH> or the B<SCHED_NORMAL> policy so long as its nice value falls "
3494 "within the range permitted by its B<RLIMIT_NICE> resource limit (see "
3495 "B<getrlimit>(2))."
3496 msgstr ""
3497
3498 #. type: Plain text
3499 #: build/C/man2/sched_setscheduler.2:383
3500 msgid ""
3501 "Privileged (B<CAP_SYS_NICE>)  threads ignore the B<RLIMIT_RTPRIO> limit; as "
3502 "with older kernels, they can make arbitrary changes to scheduling policy and "
3503 "priority.  See B<getrlimit>(2)  for further information on B<RLIMIT_RTPRIO>."
3504 msgstr ""
3505
3506 #. type: SS
3507 #: build/C/man2/sched_setscheduler.2:383
3508 #, no-wrap
3509 msgid "Response time"
3510 msgstr ""
3511
3512 #.  as described in
3513 #.  .BR request_irq (9).
3514 #. type: Plain text
3515 #: build/C/man2/sched_setscheduler.2:391
3516 msgid ""
3517 "A blocked high priority thread waiting for the I/O has a certain response "
3518 "time before it is scheduled again.  The device driver writer can greatly "
3519 "reduce this response time by using a \"slow interrupt\" interrupt handler."
3520 msgstr ""
3521
3522 #. type: SS
3523 #: build/C/man2/sched_setscheduler.2:391
3524 #, no-wrap
3525 msgid "Miscellaneous"
3526 msgstr ""
3527
3528 #. type: Plain text
3529 #: build/C/man2/sched_setscheduler.2:396
3530 msgid ""
3531 "Child processes inherit the scheduling policy and parameters across a "
3532 "B<fork>(2).  The scheduling policy and parameters are preserved across "
3533 "B<execve>(2)."
3534 msgstr ""
3535
3536 #. type: Plain text
3537 #: build/C/man2/sched_setscheduler.2:402
3538 msgid ""
3539 "Memory locking is usually needed for real-time processes to avoid paging "
3540 "delays; this can be done with B<mlock>(2)  or B<mlockall>(2)."
3541 msgstr ""
3542
3543 #. type: Plain text
3544 #: build/C/man2/sched_setscheduler.2:414
3545 msgid ""
3546 "Since a nonblocking infinite loop in a thread scheduled under B<SCHED_FIFO> "
3547 "or B<SCHED_RR> will block all threads with lower priority forever, a "
3548 "software developer should always keep available on the console a shell "
3549 "scheduled under a higher static priority than the tested application.  This "
3550 "will allow an emergency kill of tested real-time applications that do not "
3551 "block or terminate as expected.  See also the description of the "
3552 "B<RLIMIT_RTTIME> resource limit in B<getrlimit>(2)."
3553 msgstr ""
3554
3555 #. type: Plain text
3556 #: build/C/man2/sched_setscheduler.2:422
3557 msgid ""
3558 "POSIX systems on which B<sched_setscheduler>()  and B<sched_getscheduler>()  "
3559 "are available define B<_POSIX_PRIORITY_SCHEDULING> in I<E<lt>unistd.hE<gt>>."
3560 msgstr ""
3561
3562 #. type: Plain text
3563 #: build/C/man2/sched_setscheduler.2:432
3564 msgid ""
3565 "On success, B<sched_setscheduler>()  returns zero.  On success, "
3566 "B<sched_getscheduler>()  returns the policy for the thread (a nonnegative "
3567 "integer).  On error, -1 is returned, and I<errno> is set appropriately."
3568 msgstr ""
3569
3570 #. type: Plain text
3571 #: build/C/man2/sched_setscheduler.2:438
3572 msgid ""
3573 "The scheduling I<policy> is not one of the recognized policies, I<param> is "
3574 "NULL, or I<param> does not make sense for the I<policy>."
3575 msgstr ""
3576
3577 #. type: Plain text
3578 #: build/C/man2/sched_setscheduler.2:441
3579 msgid "The calling thread does not have appropriate privileges."
3580 msgstr ""
3581
3582 #. type: Plain text
3583 #: build/C/man2/sched_setscheduler.2:447
3584 msgid ""
3585 "POSIX.1-2001 (but see BUGS below).  The B<SCHED_BATCH> and B<SCHED_IDLE> "
3586 "policies are Linux-specific."
3587 msgstr ""
3588
3589 #. type: Plain text
3590 #: build/C/man2/sched_setscheduler.2:455
3591 msgid ""
3592 "POSIX.1 does not detail the permissions that an unprivileged thread requires "
3593 "in order to call B<sched_setscheduler>(), and details vary across systems.  "
3594 "For example, the Solaris 7 manual page says that the real or effective user "
3595 "ID of the caller must match the real user ID or the save set-user-ID of the "
3596 "target."
3597 msgstr ""
3598
3599 #. type: Plain text
3600 #: build/C/man2/sched_setscheduler.2:476
3601 msgid ""
3602 "The scheduling policy and parameters are in fact per-thread attributes on "
3603 "Linux.  The value returned from a call to B<gettid>(2)  can be passed in the "
3604 "argument I<pid>.  Specifying I<pid> as 0 will operate on the attribute for "
3605 "the calling thread, and passing the value returned from a call to "
3606 "B<getpid>(2)  will operate on the attribute for the main thread of the "
3607 "thread group.  (If you are using the POSIX threads API, then use "
3608 "B<pthread_setschedparam>(3), B<pthread_getschedparam>(3), and "
3609 "B<pthread_setschedprio>(3), instead of the B<sched_*>(2)  system calls.)"
3610 msgstr ""
3611
3612 #. type: Plain text
3613 #: build/C/man2/sched_setscheduler.2:486
3614 msgid ""
3615 "Originally, Standard Linux was intended as a general-purpose operating "
3616 "system being able to handle background processes, interactive applications, "
3617 "and less demanding real-time applications (applications that need to usually "
3618 "meet timing deadlines).  Although the Linux kernel 2.6 allowed for kernel "
3619 "preemption and the newly introduced O(1) scheduler ensures that the time "
3620 "needed to schedule is fixed and deterministic irrespective of the number of "
3621 "active tasks, true real-time computing was not possible up to kernel version "
3622 "2.6.17."
3623 msgstr ""
3624
3625 #. type: SS
3626 #: build/C/man2/sched_setscheduler.2:486
3627 #, no-wrap
3628 msgid "Real-time features in the mainline Linux kernel"
3629 msgstr ""
3630
3631 #.  FIXME . Probably this text will need some minor tweaking
3632 #.  by about the time of 2.6.30; ask Carsten Emde about this then.
3633 #. type: Plain text
3634 #: build/C/man2/sched_setscheduler.2:500
3635 msgid ""
3636 "From kernel version 2.6.18 onward, however, Linux is gradually becoming "
3637 "equipped with real-time capabilities, most of which are derived from the "
3638 "former I<realtime-preempt> patches developed by Ingo Molnar, Thomas "
3639 "Gleixner, Steven Rostedt, and others.  Until the patches have been "
3640 "completely merged into the mainline kernel (this is expected to be around "
3641 "kernel version 2.6.30), they must be installed to achieve the best real-time "
3642 "performance.  These patches are named:"
3643 msgstr ""
3644
3645 #. type: Plain text
3646 #: build/C/man2/sched_setscheduler.2:504
3647 #, no-wrap
3648 msgid "patch-I<kernelversion>-rtI<patchversion>\n"
3649 msgstr ""
3650
3651 #. type: Plain text
3652 #: build/C/man2/sched_setscheduler.2:510
3653 msgid ""
3654 "and can be downloaded from E<.UR "
3655 "http://www.kernel.org\\:/pub\\:/linux\\:/kernel\\:/projects\\:/rt/> E<.UE .>"
3656 msgstr ""
3657
3658 #. type: Plain text
3659 #: build/C/man2/sched_setscheduler.2:519
3660 msgid ""
3661 "Without the patches and prior to their full inclusion into the mainline "
3662 "kernel, the kernel configuration offers only the three preemption classes "
3663 "B<CONFIG_PREEMPT_NONE>, B<CONFIG_PREEMPT_VOLUNTARY>, and "
3664 "B<CONFIG_PREEMPT_DESKTOP> which respectively provide no, some, and "
3665 "considerable reduction of the worst-case scheduling latency."
3666 msgstr ""
3667
3668 #. type: Plain text
3669 #: build/C/man2/sched_setscheduler.2:530
3670 msgid ""
3671 "With the patches applied or after their full inclusion into the mainline "
3672 "kernel, the additional configuration item B<CONFIG_PREEMPT_RT> becomes "
3673 "available.  If this is selected, Linux is transformed into a regular "
3674 "real-time operating system.  The FIFO and RR scheduling policies that can be "
3675 "selected using B<sched_setscheduler>()  are then used to run a thread with "
3676 "true real-time priority and a minimum worst-case scheduling latency."
3677 msgstr ""
3678
3679 #. type: Plain text
3680 #: build/C/man2/sched_setscheduler.2:538
3681 msgid ""
3682 "POSIX says that on success, B<sched_setscheduler>()  should return the "
3683 "previous scheduling policy.  Linux B<sched_setscheduler>()  does not conform "
3684 "to this requirement, since it always returns 0 on success."
3685 msgstr ""
3686
3687 #. type: Plain text
3688 #: build/C/man2/sched_setscheduler.2:559
3689 msgid ""
3690 "B<chrt>(1), B<getpriority>(2), B<mlock>(2), B<mlockall>(2), B<munlock>(2), "
3691 "B<munlockall>(2), B<nice>(2), B<sched_get_priority_max>(2), "
3692 "B<sched_get_priority_min>(2), B<sched_getaffinity>(2), B<sched_getparam>(2), "
3693 "B<sched_rr_get_interval>(2), B<sched_setaffinity>(2), B<sched_setparam>(2), "
3694 "B<sched_yield>(2), B<setpriority>(2), B<capabilities>(7), B<cpuset>(7)"
3695 msgstr ""
3696
3697 #. type: Plain text
3698 #: build/C/man2/sched_setscheduler.2:566
3699 msgid "The Linux kernel source file I<Documentation/scheduler/sched-rt-group.txt>"
3700 msgstr ""
3701
3702 #. type: TH
3703 #: build/C/man2/sched_yield.2:29
3704 #, no-wrap
3705 msgid "SCHED_YIELD"
3706 msgstr ""
3707
3708 #. type: TH
3709 #: build/C/man2/sched_yield.2:29
3710 #, no-wrap
3711 msgid "2008-10-18"
3712 msgstr ""
3713
3714 #. type: Plain text
3715 #: build/C/man2/sched_yield.2:32
3716 msgid "sched_yield - yield the processor"
3717 msgstr ""
3718
3719 #. type: Plain text
3720 #: build/C/man2/sched_yield.2:36
3721 msgid "B<int sched_yield(void);>"
3722 msgstr ""
3723
3724 #. type: Plain text
3725 #: build/C/man2/sched_yield.2:41
3726 msgid ""
3727 "B<sched_yield>()  causes the calling thread to relinquish the CPU.  The "
3728 "thread is moved to the end of the queue for its static priority and a new "
3729 "thread gets to run."
3730 msgstr ""
3731
3732 #. type: Plain text
3733 #: build/C/man2/sched_yield.2:48
3734 msgid ""
3735 "On success, B<sched_yield>()  returns 0.  On error, -1 is returned, and "
3736 "I<errno> is set appropriately."
3737 msgstr ""
3738
3739 #. type: Plain text
3740 #: build/C/man2/sched_yield.2:52
3741 msgid "In the Linux implementation, B<sched_yield>()  always succeeds."
3742 msgstr ""
3743
3744 #. type: Plain text
3745 #: build/C/man2/sched_yield.2:59
3746 msgid ""
3747 "If the calling thread is the only thread in the highest priority list at "
3748 "that time, it will continue to run after a call to B<sched_yield>()."
3749 msgstr ""
3750
3751 #. type: Plain text
3752 #: build/C/man2/sched_yield.2:66
3753 msgid ""
3754 "POSIX systems on which B<sched_yield>()  is available define "
3755 "B<_POSIX_PRIORITY_SCHEDULING> in I<E<lt>unistd.hE<gt>>."
3756 msgstr ""
3757
3758 #. type: Plain text
3759 #: build/C/man2/sched_yield.2:79
3760 msgid ""
3761 "Strategic calls to B<sched_yield>()  can improve performance by giving other "
3762 "threads or processes a chance to run when (heavily) contended resources "
3763 "(e.g., mutexes)  have been released by the caller.  Avoid calling "
3764 "B<sched_yield>()  unnecessarily or inappropriately (e.g., when resources "
3765 "needed by other schedulable threads are still held by the caller), since "
3766 "doing so will result in unnecessary context switches, which will degrade "
3767 "system performance."
3768 msgstr ""
3769
3770 #. type: Plain text
3771 #: build/C/man2/sched_yield.2:82
3772 msgid "B<sched_setscheduler>(2)  for a description of Linux scheduling"
3773 msgstr ""
3774
3775 #. type: TH
3776 #: build/C/man2/setns.2:8
3777 #, no-wrap
3778 msgid "SETNS"
3779 msgstr ""
3780
3781 #. type: TH
3782 #: build/C/man2/setns.2:8
3783 #, no-wrap
3784 msgid "2013-01-01"
3785 msgstr ""
3786
3787 #. type: Plain text
3788 #: build/C/man2/setns.2:11
3789 msgid "setns - reassociate thread with a namespace"
3790 msgstr ""
3791
3792 #. type: Plain text
3793 #: build/C/man2/setns.2:17
3794 #, no-wrap
3795 msgid "B<int setns(int >I<fd>B<, int >I<nstype>B<);>\n"
3796 msgstr ""
3797
3798 #. type: Plain text
3799 #: build/C/man2/setns.2:21
3800 msgid ""
3801 "Given a file descriptor referring to a namespace, reassociate the calling "
3802 "thread with that namespace."
3803 msgstr ""
3804
3805 #. type: Plain text
3806 #: build/C/man2/setns.2:34
3807 msgid ""
3808 "The I<fd> argument is a file descriptor referring to one of the namespace "
3809 "entries in a I</proc/[pid]/ns/> directory; see B<proc>(5)  for further "
3810 "information on I</proc/[pid]/ns/>.  The calling thread will be reassociated "
3811 "with the corresponding namespace, subject to any constraints imposed by the "
3812 "I<nstype> argument."
3813 msgstr ""
3814
3815 #. type: Plain text
3816 #: build/C/man2/setns.2:40
3817 msgid ""
3818 "The I<nstype> argument specifies which type of namespace the calling thread "
3819 "may be reassociated with.  This argument can have one of the following "
3820 "values:"
3821 msgstr ""
3822
3823 #. type: TP
3824 #: build/C/man2/setns.2:40
3825 #, no-wrap
3826 msgid "B<0>"
3827 msgstr ""
3828
3829 #. type: Plain text
3830 #: build/C/man2/setns.2:43
3831 msgid "Allow any type of namespace to be joined."
3832 msgstr ""
3833
3834 #. type: TP
3835 #: build/C/man2/setns.2:43
3836 #, no-wrap
3837 msgid "B<CLONE_NEWIPC>"
3838 msgstr ""
3839
3840 #. type: Plain text
3841 #: build/C/man2/setns.2:47
3842 msgid "I<fd> must refer to an IPC namespace."
3843 msgstr ""
3844
3845 #. type: TP
3846 #: build/C/man2/setns.2:47
3847 #, no-wrap
3848 msgid "B<CLONE_NEWNET>"
3849 msgstr ""
3850
3851 #. type: Plain text
3852 #: build/C/man2/setns.2:51
3853 msgid "I<fd> must refer to a network namespace."
3854 msgstr ""
3855
3856 #. type: TP
3857 #: build/C/man2/setns.2:51
3858 #, no-wrap
3859 msgid "B<CLONE_NEWUTS>"
3860 msgstr ""
3861
3862 #. type: Plain text
3863 #: build/C/man2/setns.2:55
3864 msgid "I<fd> must refer to a UTS namespace."
3865 msgstr ""
3866
3867 #. type: Plain text
3868 #: build/C/man2/setns.2:70
3869 msgid ""
3870 "Specifying I<nstype> as 0 suffices if the caller knows (or does not care)  "
3871 "what type of namespace is referred to by I<fd>.  Specifying a nonzero value "
3872 "for I<nstype> is useful if the caller does not know what type of namespace "
3873 "is referred to by I<fd> and wants to ensure that the namespace is of a "
3874 "particular type.  (The caller might not know the type of the namespace "
3875 "referred to by I<fd> if the file descriptor was opened by another process "
3876 "and, for example, passed to the caller via a UNIX domain socket.)"
3877 msgstr ""
3878
3879 #. type: Plain text
3880 #: build/C/man2/setns.2:77
3881 msgid ""
3882 "On success, I<setns>()  returns 0.  On failure, -1 is returned and I<errno> "
3883 "is set to indicate the error."
3884 msgstr ""
3885
3886 #. type: Plain text
3887 #: build/C/man2/setns.2:82
3888 msgid "I<fd> is not a valid file descriptor."
3889 msgstr ""
3890
3891 #. type: Plain text
3892 #: build/C/man2/setns.2:89
3893 msgid ""
3894 "I<fd> refers to a namespace whose type does not match that specified in "
3895 "I<nstype>, or there is problem with reassociating the the thread with the "
3896 "specified namespace."
3897 msgstr ""
3898
3899 #. type: Plain text
3900 #: build/C/man2/setns.2:92
3901 msgid "Cannot allocate sufficient memory to change the specified namespace."
3902 msgstr ""
3903
3904 #. type: Plain text
3905 #: build/C/man2/setns.2:97
3906 msgid ""
3907 "The calling thread did not have the required privilege (B<CAP_SYS_ADMIN>)  "
3908 "for this operation."
3909 msgstr ""
3910
3911 #. type: Plain text
3912 #: build/C/man2/setns.2:102
3913 msgid ""
3914 "The B<setns>()  system call first appeared in Linux in kernel 3.0; library "
3915 "support was added to glibc in version 2.14."
3916 msgstr ""
3917
3918 #. type: Plain text
3919 #: build/C/man2/setns.2:106
3920 msgid "The B<setns>()  system call is Linux-specific."
3921 msgstr ""
3922
3923 #. type: Plain text
3924 #: build/C/man2/setns.2:112
3925 msgid ""
3926 "Not all of the attributes that can be shared when a new thread is created "
3927 "using B<clone>(2)  can be changed using B<setns>()."
3928 msgstr ""
3929
3930 #. type: Plain text
3931 #: build/C/man2/setns.2:121
3932 msgid ""
3933 "The program below takes two or more arguments.  The first argument specifies "
3934 "the pathname of a namespace file in an existing I</proc/[pid]/ns/> "
3935 "directory.  The remaining arguments specify a command and its arguments.  "
3936 "The program opens the namespace file, joins that namespace using B<setns>(), "
3937 "and executes the specified command inside that namespace."
3938 msgstr ""
3939
3940 #. type: Plain text
3941 #: build/C/man2/setns.2:131
3942 msgid ""
3943 "The following shell session demonstrates the use of this program (compiled "
3944 "as a binary named I<ns_exec>)  in conjunction with the B<CLONE_NEWUTS> "
3945 "example program in the B<clone>(2)  man page (complied as a binary named "
3946 "I<newuts>)."
3947 msgstr ""
3948
3949 #. type: Plain text
3950 #: build/C/man2/setns.2:139
3951 msgid ""
3952 "We begin by executing the example program in B<clone>(2)  in the "
3953 "background.  That program creates a child in a separate UTS namespace.  The "
3954 "child changes the hostname in its namespace, and then both processes display "
3955 "the hostnames in their UTS namespaces, so that we can see that they are "
3956 "different."
3957 msgstr ""
3958
3959 #. type: Plain text
3960 #: build/C/man2/setns.2:151
3961 #, no-wrap
3962 msgid ""
3963 "$ B<su>                   # Need privilege for namespace operations\n"
3964 "Password:\n"
3965 "# B<./newuts bizarro &>\n"
3966 "[1] 3549\n"
3967 "clone() returned 3550\n"
3968 "uts.nodename in child:  bizarro\n"
3969 "uts.nodename in parent: antero\n"
3970 "# B<uname -n>             # Verify hostname in the shell\n"
3971 "antero\n"
3972 msgstr ""
3973
3974 #. type: Plain text
3975 #: build/C/man2/setns.2:158
3976 msgid ""
3977 "We then run the program shown below, using it to execute a shell.  Inside "
3978 "that shell, we verify that the hostname is the one set by the child created "
3979 "by the first program:"
3980 msgstr ""
3981
3982 #. type: Plain text
3983 #: build/C/man2/setns.2:164
3984 #, no-wrap
3985 msgid ""
3986 "# B<./ns_exec /proc/3550/ns/uts /bin/bash>\n"
3987 "# B<uname -n>             # Executed in shell started by ns_exec\n"
3988 "bizarro\n"
3989 msgstr ""
3990
3991 #. type: SS
3992 #: build/C/man2/setns.2:166
3993 #, no-wrap
3994 msgid "Program source"
3995 msgstr ""
3996
3997 #. type: Plain text
3998 #: build/C/man2/setns.2:174
3999 #, no-wrap
4000 msgid ""
4001 "#define _GNU_SOURCE\n"
4002 "#include E<lt>fcntl.hE<gt>\n"
4003 "#include E<lt>sched.hE<gt>\n"
4004 "#include E<lt>unistd.hE<gt>\n"
4005 "#include E<lt>stdlib.hE<gt>\n"
4006 "#include E<lt>stdio.hE<gt>\n"
4007 msgstr ""
4008
4009 #. type: Plain text
4010 #: build/C/man2/setns.2:182
4011 #, no-wrap
4012 msgid ""
4013 "int\n"
4014 "main(int argc, char *argv[])\n"
4015 "{\n"
4016 "    int fd;\n"
4017 msgstr ""
4018
4019 #. type: Plain text
4020 #: build/C/man2/setns.2:187
4021 #, no-wrap
4022 msgid ""
4023 "    if (argc E<lt> 3) {\n"
4024 "        fprintf(stderr, \"%s /proc/PID/ns/FILE cmd args...\\en\", "
4025 "argv[0]);\n"
4026 "        exit(EXIT_FAILURE);\n"
4027 "    }\n"
4028 msgstr ""
4029
4030 #. type: Plain text
4031 #: build/C/man2/setns.2:191
4032 #, no-wrap
4033 msgid ""
4034 "    fd = open(argv[1], O_RDONLY);   /* Get descriptor for namespace */\n"
4035 "    if (fd == -1)\n"
4036 "        errExit(\"open\");\n"
4037 msgstr ""
4038
4039 #. type: Plain text
4040 #: build/C/man2/setns.2:194
4041 #, no-wrap
4042 msgid ""
4043 "    if (setns(fd, 0) == -1)         /* Join that namespace */\n"
4044 "        errExit(\"setns\");\n"
4045 msgstr ""
4046
4047 #. type: Plain text
4048 #: build/C/man2/setns.2:198
4049 #, no-wrap
4050 msgid ""
4051 "    execvp(argv[2], &argv[2]);      /* Execute a command in namespace */\n"
4052 "    errExit(\"execvp\");\n"
4053 "}\n"
4054 msgstr ""
4055
4056 #. type: Plain text
4057 #: build/C/man2/setns.2:205
4058 msgid "B<clone>(2), B<fork>(2), B<vfork>(2), B<proc>(5), B<unix>(7)"
4059 msgstr ""
4060
4061 #. type: TH
4062 #: build/C/man2/unshare.2:20
4063 #, no-wrap
4064 msgid "UNSHARE"
4065 msgstr ""
4066
4067 #. type: Plain text
4068 #: build/C/man2/unshare.2:23
4069 msgid "unshare - disassociate parts of the process execution context"
4070 msgstr ""
4071
4072 #. type: Plain text
4073 #: build/C/man2/unshare.2:28
4074 #, no-wrap
4075 msgid "B<int unshare(int >I<flags>B<);>\n"
4076 msgstr ""
4077
4078 #. type: Plain text
4079 #: build/C/man2/unshare.2:36
4080 msgid "B<unshare>():"
4081 msgstr ""
4082
4083 #. type: Plain text
4084 #: build/C/man2/unshare.2:62
4085 msgid ""
4086 "B<unshare>()  allows a process to disassociate parts of its execution "
4087 "context that are currently being shared with other processes.  Part of the "
4088 "execution context, such as the mount namespace, is shared implicitly when a "
4089 "new process is created using B<fork>(2)  or B<vfork>(2), while other parts, "
4090 "such as virtual memory, may be shared by explicit request when creating a "
4091 "process using B<clone>(2)."
4092 msgstr ""
4093
4094 #. type: Plain text
4095 #: build/C/man2/unshare.2:67
4096 msgid ""
4097 "The main use of B<unshare>()  is to allow a process to control its shared "
4098 "execution context without creating a new process."
4099 msgstr ""
4100
4101 #. type: Plain text
4102 #: build/C/man2/unshare.2:74
4103 msgid ""
4104 "The I<flags> argument is a bit mask that specifies which parts of the "
4105 "execution context should be unshared.  This argument is specified by ORing "
4106 "together zero or more of the following constants:"
4107 msgstr ""
4108
4109 #. type: TP
4110 #: build/C/man2/unshare.2:74
4111 #, no-wrap
4112 msgid "B<CLONE_FILES>"
4113 msgstr ""
4114
4115 #. type: Plain text
4116 #: build/C/man2/unshare.2:82
4117 msgid ""
4118 "Reverse the effect of the B<clone>(2)  B<CLONE_FILES> flag.  Unshare the "
4119 "file descriptor table, so that the calling process no longer shares its file "
4120 "descriptors with any other process."
4121 msgstr ""
4122
4123 #. type: TP
4124 #: build/C/man2/unshare.2:82
4125 #, no-wrap
4126 msgid "B<CLONE_FS>"
4127 msgstr ""
4128
4129 #. type: Plain text
4130 #: build/C/man2/unshare.2:96
4131 msgid ""
4132 "Reverse the effect of the B<clone>(2)  B<CLONE_FS> flag.  Unshare filesystem "
4133 "attributes, so that the calling process no longer shares its root directory "
4134 "(B<chroot>(2)), current directory (B<chdir>(2)), or umask (B<umask>(2))  "
4135 "attributes with any other process."
4136 msgstr ""
4137
4138 #. type: Plain text
4139 #: build/C/man2/unshare.2:113
4140 msgid ""
4141 "This flag has the same effect as the B<clone>(2)  B<CLONE_NEWIPC> flag.  "
4142 "Unshare the System V IPC namespace, so that the calling process has a "
4143 "private copy of the System V IPC namespace which is not shared with any "
4144 "other process.  Specifying this flag automatically implies B<CLONE_SYSVSEM> "
4145 "as well.  Use of B<CLONE_NEWIPC> requires the B<CAP_SYS_ADMIN> capability."
4146 msgstr ""
4147
4148 #. type: Plain text
4149 #: build/C/man2/unshare.2:128
4150 msgid ""
4151 "This flag has the same effect as the B<clone>(2)  B<CLONE_NEWNET> flag.  "
4152 "Unshare the network namespace, so that the calling process is moved into a "
4153 "new network namespace which is not shared with any previously existing "
4154 "process.  Use of B<CLONE_NEWNET> requires the B<CAP_SYS_ADMIN> capability."
4155 msgstr ""
4156
4157 #. type: TP
4158 #: build/C/man2/unshare.2:128
4159 #, no-wrap
4160 msgid "B<CLONE_NEWNS>"
4161 msgstr ""
4162
4163 #.  These flag name are inconsistent:
4164 #.  CLONE_NEWNS does the same thing in clone(), but CLONE_VM,
4165 #.  CLONE_FS, and CLONE_FILES reverse the action of the clone()
4166 #.  flags of the same name.
4167 #. type: Plain text
4168 #: build/C/man2/unshare.2:149
4169 msgid ""
4170 "This flag has the same effect as the B<clone>(2)  B<CLONE_NEWNS> flag.  "
4171 "Unshare the mount namespace, so that the calling process has a private copy "
4172 "of its namespace which is not shared with any other process.  Specifying "
4173 "this flag automatically implies B<CLONE_FS> as well.  Use of B<CLONE_NEWNS> "
4174 "requires the B<CAP_SYS_ADMIN> capability."
4175 msgstr ""
4176
4177 #. type: Plain text
4178 #: build/C/man2/unshare.2:163
4179 msgid ""
4180 "This flag has the same effect as the B<clone>(2)  B<CLONE_NEWUTS> flag.  "
4181 "Unshare the UTS IPC namespace, so that the calling process has a private "
4182 "copy of the UTS namespace which is not shared with any other process.  Use "
4183 "of B<CLONE_NEWUTS> requires the B<CAP_SYS_ADMIN> capability."
4184 msgstr ""
4185
4186 #. type: TP
4187 #: build/C/man2/unshare.2:163
4188 #, no-wrap
4189 msgid "B<CLONE_SYSVSEM> (since Linux 2.6.26)"
4190 msgstr ""
4191
4192 #.  commit 9edff4ab1f8d82675277a04e359d0ed8bf14a7b7
4193 #.  As at 2.6.16, the following forced implications also apply,
4194 #.  although the relevant flags are not yet implemented.
4195 #.  If CLONE_THREAD is set force CLONE_VM.
4196 #.  If CLONE_VM is set, force CLONE_SIGHAND.
4197 #.  CLONE_NEWNSIf CLONE_SIGHAND is set and signals are also being shared
4198 #.  (i.e., current->signal->count > 1), force CLONE_THREAD.
4199 #
4200 #.  FIXME . CLONE_VM is not (yet, as at 2.6.16) implemented.
4201 #.  .TP
4202 #.  .B CLONE_VM
4203 #.  Reverse the effect of the
4204 #.  .BR clone (2)
4205 #.  .B CLONE_VM
4206 #.  flag.
4207 #.  .RB ( CLONE_VM
4208 #.  is also implicitly set by
4209 #.  .BR vfork (2),
4210 #.  and can be reversed using this
4211 #.  .BR unshare ()
4212 #.  flag.)
4213 #.  Unshare virtual memory, so that the calling process no
4214 #.  longer shares its virtual address space with any other process.
4215 #. type: Plain text
4216 #: build/C/man2/unshare.2:200
4217 msgid ""
4218 "This flag reverses the effect of the B<clone>(2)  B<CLONE_SYSVSEM> flag.  "
4219 "Unshare System V semaphore undo values, so that the calling process has a "
4220 "private copy which is not shared with any other process.  Use of "
4221 "B<CLONE_SYSVSEM> requires the B<CAP_SYS_ADMIN> capability."
4222 msgstr ""
4223
4224 #. type: Plain text
4225 #: build/C/man2/unshare.2:207
4226 msgid ""
4227 "If I<flags> is specified as zero, then B<unshare>()  is a no-op; no changes "
4228 "are made to the calling process's execution context."
4229 msgstr ""
4230
4231 #. type: Plain text
4232 #: build/C/man2/unshare.2:212
4233 msgid ""
4234 "On success, zero returned.  On failure, -1 is returned and I<errno> is set "
4235 "to indicate the error."
4236 msgstr ""
4237
4238 #. type: Plain text
4239 #: build/C/man2/unshare.2:217
4240 msgid "An invalid bit was specified in I<flags>."
4241 msgstr ""
4242
4243 #. type: Plain text
4244 #: build/C/man2/unshare.2:221
4245 msgid ""
4246 "Cannot allocate sufficient memory to copy parts of caller's context that "
4247 "need to be unshared."
4248 msgstr ""
4249
4250 #. type: Plain text
4251 #: build/C/man2/unshare.2:224
4252 msgid "The calling process did not have the required privileges for this operation."
4253 msgstr ""
4254
4255 #. type: Plain text
4256 #: build/C/man2/unshare.2:228
4257 msgid "The B<unshare>()  system call was added to Linux in kernel 2.6.16."
4258 msgstr ""
4259
4260 #. type: Plain text
4261 #: build/C/man2/unshare.2:232
4262 msgid "The B<unshare>()  system call is Linux-specific."
4263 msgstr ""
4264
4265 #.  FIXME all of the following needs to be reviewed for the current kernel
4266 #.  However, we can do unshare(CLONE_SIGHAND) if CLONE_SIGHAND
4267 #.  was not specified when doing clone(); i.e., unsharing
4268 #.  signal handlers is permitted if we are not actually
4269 #.  sharing signal handlers.   mtk
4270 #.  However, we can do unshare(CLONE_VM) if CLONE_VM
4271 #.  was not specified when doing clone(); i.e., unsharing
4272 #.  virtual memory is permitted if we are not actually
4273 #.  sharing virtual memory.   mtk
4274 #
4275 #. 9) Future Work
4276 #. --------------
4277 #. The current implementation of unshare does not allow unsharing of
4278 #. signals and signal handlers. Signals are complex to begin with and
4279 #. to unshare signals and/or signal handlers of a currently running
4280 #. process is even more complex. If in the future there is a specific
4281 #. need to allow unsharing of signals and/or signal handlers, it can
4282 #. be incrementally added to unshare without affecting legacy
4283 #. applications using unshare.
4284 #. type: Plain text
4285 #: build/C/man2/unshare.2:266
4286 msgid ""
4287 "Not all of the process attributes that can be shared when a new process is "
4288 "created using B<clone>(2)  can be unshared using B<unshare>().  In "
4289 "particular, as at kernel 3.8, B<unshare>()  does not implement flags that "
4290 "reverse the effects of B<CLONE_SIGHAND>, B<CLONE_THREAD>, or B<CLONE_VM>.  "
4291 "Such functionality may be added in the future, if required."
4292 msgstr ""
4293
4294 #. type: Plain text
4295 #: build/C/man2/unshare.2:272
4296 msgid "B<clone>(2), B<fork>(2), B<kcmp>(2), B<setns>(2), B<vfork>(2)"
4297 msgstr ""
4298
4299 #. type: Plain text
4300 #: build/C/man2/unshare.2:275
4301 msgid "I<Documentation/unshare.txt> in the Linux kernel source tree"
4302 msgstr ""