OSDN Git Service

LDP: Update POT and ja.po to LDP v3.79
[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: 2015-02-04 23:33+0900\n"
11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Language-Team: LANGUAGE <LL@li.org>\n"
14 "Language: \n"
15 "MIME-Version: 1.0\n"
16 "Content-Type: text/plain; charset=UTF-8\n"
17 "Content-Transfer-Encoding: 8bit\n"
18
19 #. type: TH
20 #: build/C/man3/CPU_SET.3:27
21 #, no-wrap
22 msgid "CPU_SET"
23 msgstr ""
24
25 #. type: TH
26 #: build/C/man3/CPU_SET.3:27
27 #, no-wrap
28 msgid "2012-03-15"
29 msgstr ""
30
31 #. type: TH
32 #: build/C/man3/CPU_SET.3:27 build/C/man2/clone.2:42 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_setattr.2:26 build/C/man2/sched_setparam.2:30 build/C/man2/sched_setscheduler.2:26 build/C/man2/sched_yield.2:29 build/C/man7/sched.7:32 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:42 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_setattr.2:26 build/C/man2/sched_setparam.2:30 build/C/man2/sched_setscheduler.2:26 build/C/man2/sched_yield.2:29 build/C/man7/sched.7:32 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:43 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_setattr.2:27 build/C/man2/sched_setparam.2:31 build/C/man2/sched_setscheduler.2:27 build/C/man2/sched_yield.2:30 build/C/man7/sched.7:33 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:45 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_setattr.2:30 build/C/man2/sched_setparam.2:33 build/C/man2/sched_setscheduler.2:30 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:83 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_setattr.2:41 build/C/man2/sched_setparam.2:47 build/C/man2/sched_setscheduler.2:41 build/C/man2/sched_yield.2:36 build/C/man7/sched.7:35 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 bit set.  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:873 build/C/man2/kcmp.2:127 build/C/man2/sched_get_priority_max.2:97 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_setattr.2:262 build/C/man2/sched_setparam.2:87 build/C/man2/sched_setscheduler.2:135 build/C/man2/sched_yield.2:41 build/C/man2/setns.2:138 build/C/man2/unshare.2:277
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:1031 build/C/man2/kcmp.2:198 build/C/man3/sched_getcpu.3:70 build/C/man2/sched_setaffinity.2:148 build/C/man2/sched_setattr.2:348 build/C/man2/setns.2:186 build/C/man2/unshare.2:330
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:1038 build/C/man2/kcmp.2:202 build/C/man2/sched_get_priority_max.2:113 build/C/man3/sched_getcpu.3:77 build/C/man2/sched_rr_get_interval.2:94 build/C/man2/sched_setaffinity.2:159 build/C/man2/sched_setattr.2:351 build/C/man2/sched_setparam.2:119 build/C/man2/sched_setscheduler.2:170 build/C/man2/sched_yield.2:52 build/C/man2/setns.2:191 build/C/man2/unshare.2:334
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:1042 build/C/man2/kcmp.2:205 build/C/man3/sched_getcpu.3:80 build/C/man2/sched_rr_get_interval.2:96 build/C/man2/sched_setaffinity.2:161 build/C/man2/sched_setattr.2:353 build/C/man2/sched_setparam.2:121 build/C/man2/sched_setscheduler.2:173 build/C/man2/sched_yield.2:54 build/C/man7/sched.7:611 build/C/man2/setns.2:195 build/C/man2/unshare.2:338
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 bit sets 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 bit set), 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:1067 build/C/man2/sched_setattr.2:369 build/C/man2/sched_setscheduler.2:214
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:1109 build/C/man2/setns.2:201 build/C/man2/unshare.2:372
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:1206 build/C/man2/kcmp.2:222 build/C/man2/sched_get_priority_max.2:115 build/C/man3/sched_getcpu.3:100 build/C/man2/sched_rr_get_interval.2:132 build/C/man2/sched_setaffinity.2:226 build/C/man2/sched_setattr.2:385 build/C/man2/sched_setparam.2:127 build/C/man2/sched_setscheduler.2:222 build/C/man2/sched_yield.2:79 build/C/man7/sched.7:664 build/C/man2/setns.2:288 build/C/man2/unshare.2:459
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:1221 build/C/man2/kcmp.2:225 build/C/man2/sched_get_priority_max.2:125 build/C/man3/sched_getcpu.3:103 build/C/man2/sched_rr_get_interval.2:134 build/C/man2/sched_setaffinity.2:248 build/C/man2/sched_setattr.2:408 build/C/man2/sched_setparam.2:142 build/C/man2/sched_setscheduler.2:242 build/C/man2/sched_yield.2:81 build/C/man7/sched.7:702 build/C/man2/setns.2:295 build/C/man2/unshare.2:470
632 #, no-wrap
633 msgid "COLOPHON"
634 msgstr ""
635
636 #. type: Plain text
637 #: build/C/man3/CPU_SET.3:369 build/C/man2/clone.2:1229 build/C/man2/kcmp.2:233 build/C/man2/sched_get_priority_max.2:133 build/C/man3/sched_getcpu.3:111 build/C/man2/sched_rr_get_interval.2:142 build/C/man2/sched_setaffinity.2:256 build/C/man2/sched_setattr.2:416 build/C/man2/sched_setparam.2:150 build/C/man2/sched_setscheduler.2:250 build/C/man2/sched_yield.2:89 build/C/man7/sched.7:710 build/C/man2/setns.2:303 build/C/man2/unshare.2:478
638 msgid ""
639 "This page is part of release 3.79 of the Linux I<man-pages> project.  A "
640 "description of the project, information about reporting bugs, and the latest "
641 "version of this page, can be found at "
642 "\\%http://www.kernel.org/doc/man-pages/."
643 msgstr ""
644
645 #. type: TH
646 #: build/C/man2/clone.2:42
647 #, no-wrap
648 msgid "CLONE"
649 msgstr ""
650
651 #. type: TH
652 #: build/C/man2/clone.2:42 build/C/man2/unshare.2:20
653 #, no-wrap
654 msgid "2014-09-21"
655 msgstr ""
656
657 #. type: Plain text
658 #: build/C/man2/clone.2:45
659 msgid "clone, __clone2 - create a child process"
660 msgstr ""
661
662 #. type: Plain text
663 #: build/C/man2/clone.2:48
664 #, no-wrap
665 msgid "/* Prototype for the glibc wrapper function */\n"
666 msgstr ""
667
668 #. type: Plain text
669 #: build/C/man2/clone.2:50 build/C/man3/sched_getcpu.3:32 build/C/man2/sched_setattr.2:33 build/C/man2/sched_setparam.2:36 build/C/man2/sched_setscheduler.2:33 build/C/man2/unshare.2:26
670 #, no-wrap
671 msgid "B<#include E<lt>sched.hE<gt>>\n"
672 msgstr ""
673
674 #. type: Plain text
675 #: build/C/man2/clone.2:55
676 #, no-wrap
677 msgid ""
678 "B<int clone(int (*>I<fn>B<)(void *), void *>I<child_stack>B<,>\n"
679 "B<          int >I<flags>B<, void *>I<arg>B<, ... >\n"
680 "B<          /* pid_t *>I<ptid>B<, struct user_desc *>I<tls>B<, pid_t "
681 "*>I<ctid>B< */ );>\n"
682 msgstr ""
683
684 #. type: Plain text
685 #: build/C/man2/clone.2:57
686 #, no-wrap
687 msgid "/* Prototype for the raw system call */\n"
688 msgstr ""
689
690 #. type: Plain text
691 #: build/C/man2/clone.2:61
692 #, no-wrap
693 msgid ""
694 "B<long clone(unsigned long >I<flags>B<, void *>I<child_stack>B<,>\n"
695 "B<          void *>I<ptid>B<, void *>I<ctid>B<,>\n"
696 "B<          struct pt_regs *>I<regs>B<);>\n"
697 msgstr ""
698
699 #. type: Plain text
700 #: build/C/man2/clone.2:66
701 msgid ""
702 "Feature Test Macro Requirements for glibc wrapper function (see "
703 "B<feature_test_macros>(7)):"
704 msgstr ""
705
706 #. type: Plain text
707 #: build/C/man2/clone.2:69
708 msgid "B<clone>():"
709 msgstr ""
710
711 #. type: TP
712 #: build/C/man2/clone.2:72 build/C/man3/sched_getcpu.3:45 build/C/man2/unshare.2:39
713 #, no-wrap
714 msgid "Since glibc 2.14:"
715 msgstr ""
716
717 #. type: Plain text
718 #: build/C/man2/clone.2:75 build/C/man3/sched_getcpu.3:48 build/C/man2/unshare.2:42
719 msgid "_GNU_SOURCE"
720 msgstr ""
721
722 #.  See http://sources.redhat.com/bugzilla/show_bug.cgi?id=4749
723 #. type: TP
724 #: build/C/man2/clone.2:75 build/C/man3/sched_getcpu.3:48 build/C/man2/unshare.2:42
725 #, no-wrap
726 msgid "Before glibc 2.14:"
727 msgstr ""
728
729 #. type: Plain text
730 #: build/C/man2/clone.2:80 build/C/man3/sched_getcpu.3:52 build/C/man2/unshare.2:47
731 #, no-wrap
732 msgid ""
733 "_BSD_SOURCE || _SVID_SOURCE\n"
734 "    /* _GNU_SOURCE also suffices */\n"
735 msgstr ""
736
737 #. type: Plain text
738 #: build/C/man2/clone.2:87
739 msgid "B<clone>()  creates a new process, in a manner similar to B<fork>(2)."
740 msgstr ""
741
742 #. type: Plain text
743 #: build/C/man2/clone.2:94
744 msgid ""
745 "This page describes both the glibc B<clone>()  wrapper function and the "
746 "underlying system call on which it is based.  The main text describes the "
747 "wrapper function; the differences for the raw system call are described "
748 "toward the end of this page."
749 msgstr ""
750
751 #. type: Plain text
752 #: build/C/man2/clone.2:106
753 msgid ""
754 "Unlike B<fork>(2), B<clone>()  allows the child process to share parts of "
755 "its execution context with the calling process, such as the memory space, "
756 "the table of file descriptors, and the table of signal handlers.  (Note that "
757 "on this manual page, \"calling process\" normally corresponds to \"parent "
758 "process\".  But see the description of B<CLONE_PARENT> below.)"
759 msgstr ""
760
761 #. type: Plain text
762 #: build/C/man2/clone.2:111
763 msgid ""
764 "The main use of B<clone>()  is to implement threads: multiple threads of "
765 "control in a program that run concurrently in a shared memory space."
766 msgstr ""
767
768 #. type: Plain text
769 #: build/C/man2/clone.2:131
770 msgid ""
771 "When the child process is created with B<clone>(), it executes the function "
772 "I<fn>(I<arg>).  (This differs from B<fork>(2), where execution continues in "
773 "the child from the point of the B<fork>(2)  call.)  The I<fn> argument is a "
774 "pointer to a function that is called by the child process at the beginning "
775 "of its execution.  The I<arg> argument is passed to the I<fn> function."
776 msgstr ""
777
778 #. type: Plain text
779 #: build/C/man2/clone.2:141
780 msgid ""
781 "When the I<fn>(I<arg>)  function application returns, the child process "
782 "terminates.  The integer returned by I<fn> is the exit code for the child "
783 "process.  The child process may also terminate explicitly by calling "
784 "B<exit>(2)  or after receiving a fatal signal."
785 msgstr ""
786
787 #. type: Plain text
788 #: build/C/man2/clone.2:157
789 msgid ""
790 "The I<child_stack> argument specifies the location of the stack used by the "
791 "child process.  Since the child and calling process may share memory, it is "
792 "not possible for the child process to execute in the same stack as the "
793 "calling process.  The calling process must therefore set up memory space for "
794 "the child stack and pass a pointer to this space to B<clone>().  Stacks grow "
795 "downward on all processors that run Linux (except the HP PA processors), so "
796 "I<child_stack> usually points to the topmost address of the memory space set "
797 "up for the child stack."
798 msgstr ""
799
800 #. type: Plain text
801 #: build/C/man2/clone.2:173
802 msgid ""
803 "The low byte of I<flags> contains the number of the I<termination signal> "
804 "sent to the parent when the child dies.  If this signal is specified as "
805 "anything other than B<SIGCHLD>, then the parent process must specify the "
806 "B<__WALL> or B<__WCLONE> options when waiting for the child with "
807 "B<wait>(2).  If no signal is specified, then the parent process is not "
808 "signaled when the child terminates."
809 msgstr ""
810
811 #. type: Plain text
812 #: build/C/man2/clone.2:178
813 msgid ""
814 "I<flags> may also be bitwise-or'ed with zero or more of the following "
815 "constants, in order to specify what is shared between the calling process "
816 "and the child process:"
817 msgstr ""
818
819 #. type: TP
820 #: build/C/man2/clone.2:178
821 #, no-wrap
822 msgid "B<CLONE_CHILD_CLEARTID> (since Linux 2.5.49)"
823 msgstr ""
824
825 #. type: Plain text
826 #: build/C/man2/clone.2:188
827 msgid ""
828 "Erase child thread ID at location I<ctid> in child memory when the child "
829 "exits, and do a wakeup on the futex at that address.  The address involved "
830 "may be changed by the B<set_tid_address>(2)  system call.  This is used by "
831 "threading libraries."
832 msgstr ""
833
834 #. type: TP
835 #: build/C/man2/clone.2:188
836 #, no-wrap
837 msgid "B<CLONE_CHILD_SETTID> (since Linux 2.5.49)"
838 msgstr ""
839
840 #. type: Plain text
841 #: build/C/man2/clone.2:193
842 msgid "Store child thread ID at location I<ctid> in child memory."
843 msgstr ""
844
845 #. type: TP
846 #: build/C/man2/clone.2:193
847 #, no-wrap
848 msgid "B<CLONE_FILES> (since Linux 2.0)"
849 msgstr ""
850
851 #. type: Plain text
852 #: build/C/man2/clone.2:206
853 msgid ""
854 "If B<CLONE_FILES> is set, the calling process and the child process share "
855 "the same file descriptor table.  Any file descriptor created by the calling "
856 "process or by the child process is also valid in the other process.  "
857 "Similarly, if one of the processes closes a file descriptor, or changes its "
858 "associated flags (using the B<fcntl>(2)  B<F_SETFD> operation), the other "
859 "process is also affected."
860 msgstr ""
861
862 #. type: Plain text
863 #: build/C/man2/clone.2:220
864 msgid ""
865 "If B<CLONE_FILES> is not set, the child process inherits a copy of all file "
866 "descriptors opened in the calling process at the time of B<clone>().  (The "
867 "duplicated file descriptors in the child refer to the same open file "
868 "descriptions (see B<open>(2))  as the corresponding file descriptors in the "
869 "calling process.)  Subsequent operations that open or close file "
870 "descriptors, or change file descriptor flags, performed by either the "
871 "calling process or the child process do not affect the other process."
872 msgstr ""
873
874 #. type: TP
875 #: build/C/man2/clone.2:220
876 #, no-wrap
877 msgid "B<CLONE_FS> (since Linux 2.0)"
878 msgstr ""
879
880 #. type: Plain text
881 #: build/C/man2/clone.2:235
882 msgid ""
883 "If B<CLONE_FS> is set, the caller and the child process share the same "
884 "filesystem information.  This includes the root of the filesystem, the "
885 "current working directory, and the umask.  Any call to B<chroot>(2), "
886 "B<chdir>(2), or B<umask>(2)  performed by the calling process or the child "
887 "process also affects the other process."
888 msgstr ""
889
890 #. type: Plain text
891 #: build/C/man2/clone.2:247
892 msgid ""
893 "If B<CLONE_FS> is not set, the child process works on a copy of the "
894 "filesystem information of the calling process at the time of the B<clone>()  "
895 "call.  Calls to B<chroot>(2), B<chdir>(2), B<umask>(2)  performed later by "
896 "one of the processes do not affect the other process."
897 msgstr ""
898
899 #. type: TP
900 #: build/C/man2/clone.2:247
901 #, no-wrap
902 msgid "B<CLONE_IO> (since Linux 2.6.25)"
903 msgstr ""
904
905 #. type: Plain text
906 #: build/C/man2/clone.2:256
907 msgid ""
908 "If B<CLONE_IO> is set, then the new process shares an I/O context with the "
909 "calling process.  If this flag is not set, then (as with B<fork>(2))  the "
910 "new process has its own I/O context."
911 msgstr ""
912
913 #.  The following based on text from Jens Axboe
914 #.  the anticipatory and CFQ scheduler
915 #.  with CFQ and AS.
916 #. type: Plain text
917 #: build/C/man2/clone.2:273
918 msgid ""
919 "The I/O context is the I/O scope of the disk scheduler (i.e, what the I/O "
920 "scheduler uses to model scheduling of a process's I/O).  If processes share "
921 "the same I/O context, they are treated as one by the I/O scheduler.  As a "
922 "consequence, they get to share disk time.  For some I/O schedulers, if two "
923 "processes share an I/O context, they will be allowed to interleave their "
924 "disk access.  If several threads are doing I/O on behalf of the same process "
925 "(B<aio_read>(3), for instance), they should employ B<CLONE_IO> to get better "
926 "I/O performance."
927 msgstr ""
928
929 #. type: Plain text
930 #: build/C/man2/clone.2:277
931 msgid ""
932 "If the kernel is not configured with the B<CONFIG_BLOCK> option, this flag "
933 "is a no-op."
934 msgstr ""
935
936 #. type: TP
937 #: build/C/man2/clone.2:277 build/C/man2/unshare.2:96
938 #, no-wrap
939 msgid "B<CLONE_NEWIPC> (since Linux 2.6.19)"
940 msgstr ""
941
942 #. type: Plain text
943 #: build/C/man2/clone.2:287
944 msgid ""
945 "If B<CLONE_NEWIPC> is set, then create the process in a new IPC namespace.  "
946 "If this flag is not set, then (as with B<fork>(2)), the process is created "
947 "in the same IPC namespace as the calling process.  This flag is intended for "
948 "the implementation of containers."
949 msgstr ""
950
951 #.  commit 7eafd7c74c3f2e67c27621b987b28397110d643f
952 #.  https://lwn.net/Articles/312232/
953 #. type: Plain text
954 #: build/C/man2/clone.2:299
955 msgid ""
956 "An IPC namespace provides an isolated view of System\\ V IPC objects (see "
957 "B<svipc>(7))  and (since Linux 2.6.30)  POSIX message queues (see "
958 "B<mq_overview>(7)).  The common characteristic of these IPC mechanisms is "
959 "that IPC objects are identified by mechanisms other than filesystem "
960 "pathnames."
961 msgstr ""
962
963 #. type: Plain text
964 #: build/C/man2/clone.2:303
965 msgid ""
966 "Objects created in an IPC namespace are visible to all other processes that "
967 "are members of that namespace, but are not visible to processes in other IPC "
968 "namespaces."
969 msgstr ""
970
971 #. type: Plain text
972 #: build/C/man2/clone.2:307
973 msgid ""
974 "When an IPC namespace is destroyed (i.e., when the last process that is a "
975 "member of the namespace terminates), all IPC objects in the namespace are "
976 "automatically destroyed."
977 msgstr ""
978
979 #. type: Plain text
980 #: build/C/man2/clone.2:314
981 msgid ""
982 "Only a privileged process (B<CAP_SYS_ADMIN>)  can employ B<CLONE_NEWIPC>.  "
983 "This flag can't be specified in conjunction with B<CLONE_SYSVSEM>."
984 msgstr ""
985
986 #. type: Plain text
987 #: build/C/man2/clone.2:317
988 msgid "For further information on IPC namespaces, see B<namespaces>(7)."
989 msgstr ""
990
991 #. type: TP
992 #: build/C/man2/clone.2:317 build/C/man2/unshare.2:113
993 #, no-wrap
994 msgid "B<CLONE_NEWNET> (since Linux 2.6.24)"
995 msgstr ""
996
997 #. type: Plain text
998 #: build/C/man2/clone.2:321
999 msgid ""
1000 "(The implementation of this flag was completed only by about kernel version "
1001 "2.6.29.)"
1002 msgstr ""
1003
1004 #. type: Plain text
1005 #: build/C/man2/clone.2:330
1006 msgid ""
1007 "If B<CLONE_NEWNET> is set, then create the process in a new network "
1008 "namespace.  If this flag is not set, then (as with B<fork>(2))  the process "
1009 "is created in the same network namespace as the calling process.  This flag "
1010 "is intended for the implementation of containers."
1011 msgstr ""
1012
1013 #.  FIXME . Add pointer to veth(4) page when it is eventually completed
1014 #. type: Plain text
1015 #: build/C/man2/clone.2:345
1016 msgid ""
1017 "A network namespace provides an isolated view of the networking stack "
1018 "(network device interfaces, IPv4 and IPv6 protocol stacks, IP routing "
1019 "tables, firewall rules, the I</proc/net> and I</sys/class/net> directory "
1020 "trees, sockets, etc.).  A physical network device can live in exactly one "
1021 "network namespace.  A virtual network device (\"veth\") pair provides a "
1022 "pipe-like abstraction that can be used to create tunnels between network "
1023 "namespaces, and can be used to create a bridge to a physical network device "
1024 "in another namespace."
1025 msgstr ""
1026
1027 #. type: Plain text
1028 #: build/C/man2/clone.2:352
1029 msgid ""
1030 "When a network namespace is freed (i.e., when the last process in the "
1031 "namespace terminates), its physical network devices are moved back to the "
1032 "initial network namespace (not to the parent of the process).  For further "
1033 "information on network namespaces, see B<namespaces>(7)."
1034 msgstr ""
1035
1036 #. type: Plain text
1037 #: build/C/man2/clone.2:357
1038 msgid "Only a privileged process (B<CAP_SYS_ADMIN>)  can employ B<CLONE_NEWNET>."
1039 msgstr ""
1040
1041 #. type: TP
1042 #: build/C/man2/clone.2:357
1043 #, no-wrap
1044 msgid "B<CLONE_NEWNS> (since Linux 2.4.19)"
1045 msgstr ""
1046
1047 #. type: Plain text
1048 #: build/C/man2/clone.2:367
1049 msgid ""
1050 "If B<CLONE_NEWNS> is set, the cloned child is started in a new mount "
1051 "namespace, initialized with a copy of the namespace of the parent.  If "
1052 "B<CLONE_NEWNS> is not set, the child lives in the same mount namespace as "
1053 "the parent."
1054 msgstr ""
1055
1056 #. type: Plain text
1057 #: build/C/man2/clone.2:370
1058 msgid "For further information on mount namespaces, see B<namespaces>(7)."
1059 msgstr ""
1060
1061 #.  See https://lwn.net/Articles/543273/
1062 #. type: Plain text
1063 #: build/C/man2/clone.2:383
1064 msgid ""
1065 "Only a privileged process (B<CAP_SYS_ADMIN>)  can employ B<CLONE_NEWNS>.  It "
1066 "is not permitted to specify both B<CLONE_NEWNS> and B<CLONE_FS> in the same "
1067 "B<clone>()  call."
1068 msgstr ""
1069
1070 #. type: TP
1071 #: build/C/man2/clone.2:383
1072 #, no-wrap
1073 msgid "B<CLONE_NEWPID> (since Linux 2.6.24)"
1074 msgstr ""
1075
1076 #.  This explanation draws a lot of details from
1077 #.  http://lwn.net/Articles/259217/
1078 #.  Authors: Pavel Emelyanov <xemul@openvz.org>
1079 #.  and Kir Kolyshkin <kir@openvz.org>
1080 #
1081 #.  The primary kernel commit is 30e49c263e36341b60b735cbef5ca37912549264
1082 #.  Author: Pavel Emelyanov <xemul@openvz.org>
1083 #. type: Plain text
1084 #: build/C/man2/clone.2:400
1085 msgid ""
1086 "If B<CLONE_NEWPID> is set, then create the process in a new PID namespace.  "
1087 "If this flag is not set, then (as with B<fork>(2))  the process is created "
1088 "in the same PID namespace as the calling process.  This flag is intended for "
1089 "the implementation of containers."
1090 msgstr ""
1091
1092 #. type: Plain text
1093 #: build/C/man2/clone.2:405
1094 msgid ""
1095 "For further information on PID namespaces, see B<namespaces>(7)  and "
1096 "B<pid_namespaces>(7)"
1097 msgstr ""
1098
1099 #. type: Plain text
1100 #: build/C/man2/clone.2:414
1101 msgid ""
1102 "Only a privileged process (B<CAP_SYS_ADMIN>)  can employ B<CLONE_NEWPID>.  "
1103 "This flag can't be specified in conjunction with B<CLONE_THREAD> or "
1104 "B<CLONE_PARENT>."
1105 msgstr ""
1106
1107 #. type: TP
1108 #: build/C/man2/clone.2:414
1109 #, no-wrap
1110 msgid "B<CLONE_NEWUSER>"
1111 msgstr ""
1112
1113 #. type: Plain text
1114 #: build/C/man2/clone.2:424
1115 msgid ""
1116 "(This flag first became meaningful for B<clone>()  in Linux 2.6.23, the "
1117 "current B<clone>()  semantics were merged in Linux 3.5, and the final pieces "
1118 "to make the user namespaces completely usable were merged in Linux 3.8.)"
1119 msgstr ""
1120
1121 #. type: Plain text
1122 #: build/C/man2/clone.2:431
1123 msgid ""
1124 "If B<CLONE_NEWUSER> is set, then create the process in a new user "
1125 "namespace.  If this flag is not set, then (as with B<fork>(2))  the process "
1126 "is created in the same user namespace as the calling process."
1127 msgstr ""
1128
1129 #. type: Plain text
1130 #: build/C/man2/clone.2:436
1131 msgid ""
1132 "For further information on user namespaces, see B<namespaces>(7)  and "
1133 "B<user_namespaces>(7)"
1134 msgstr ""
1135
1136 #.  Before Linux 2.6.29, it appears that only CAP_SYS_ADMIN was needed
1137 #. type: Plain text
1138 #: build/C/man2/clone.2:447
1139 msgid ""
1140 "Before Linux 3.8, use of B<CLONE_NEWUSER> required that the caller have "
1141 "three capabilities: B<CAP_SYS_ADMIN>, B<CAP_SETUID>, and B<CAP_SETGID>.  "
1142 "Starting with Linux 3.8, no privileges are needed to create a user "
1143 "namespace."
1144 msgstr ""
1145
1146 #.  commit e66eded8309ebf679d3d3c1f5820d1f2ca332c71
1147 #.  https://lwn.net/Articles/543273/
1148 #.  The fix actually went into 3.9 and into 3.8.3. However, user namespaces
1149 #.  were, for practical purposes, unusable in earlier 3.8.x because of the
1150 #.  various filesystems that didn't support userns.
1151 #. type: Plain text
1152 #: build/C/man2/clone.2:461
1153 msgid ""
1154 "This flag can't be specified in conjunction with B<CLONE_THREAD> or "
1155 "B<CLONE_PARENT>.  For security reasons, B<CLONE_NEWUSER> cannot be specified "
1156 "in conjunction with B<CLONE_FS>."
1157 msgstr ""
1158
1159 #. type: Plain text
1160 #: build/C/man2/clone.2:464 build/C/man2/unshare.2:209
1161 msgid "For further information on user namespaces, see B<user_namespaces>(7)."
1162 msgstr ""
1163
1164 #. type: TP
1165 #: build/C/man2/clone.2:464 build/C/man2/unshare.2:209
1166 #, no-wrap
1167 msgid "B<CLONE_NEWUTS> (since Linux 2.6.19)"
1168 msgstr ""
1169
1170 #. type: Plain text
1171 #: build/C/man2/clone.2:476
1172 msgid ""
1173 "If B<CLONE_NEWUTS> is set, then create the process in a new UTS namespace, "
1174 "whose identifiers are initialized by duplicating the identifiers from the "
1175 "UTS namespace of the calling process.  If this flag is not set, then (as "
1176 "with B<fork>(2))  the process is created in the same UTS namespace as the "
1177 "calling process.  This flag is intended for the implementation of "
1178 "containers."
1179 msgstr ""
1180
1181 #. type: Plain text
1182 #: build/C/man2/clone.2:487
1183 msgid ""
1184 "A UTS namespace is the set of identifiers returned by B<uname>(2); among "
1185 "these, the domain name and the hostname can be modified by "
1186 "B<setdomainname>(2)  and B<sethostname>(2), respectively.  Changes made to "
1187 "the identifiers in a UTS namespace are visible to all other processes in the "
1188 "same namespace, but are not visible to processes in other UTS namespaces."
1189 msgstr ""
1190
1191 #. type: Plain text
1192 #: build/C/man2/clone.2:492
1193 msgid "Only a privileged process (B<CAP_SYS_ADMIN>)  can employ B<CLONE_NEWUTS>."
1194 msgstr ""
1195
1196 #. type: Plain text
1197 #: build/C/man2/clone.2:495
1198 msgid "For further information on UTS namespaces, see B<namespaces>(7)."
1199 msgstr ""
1200
1201 #. type: TP
1202 #: build/C/man2/clone.2:495
1203 #, no-wrap
1204 msgid "B<CLONE_PARENT> (since Linux 2.3.12)"
1205 msgstr ""
1206
1207 #. type: Plain text
1208 #: build/C/man2/clone.2:502
1209 msgid ""
1210 "If B<CLONE_PARENT> is set, then the parent of the new child (as returned by "
1211 "B<getppid>(2))  will be the same as that of the calling process."
1212 msgstr ""
1213
1214 #. type: Plain text
1215 #: build/C/man2/clone.2:508
1216 msgid ""
1217 "If B<CLONE_PARENT> is not set, then (as with B<fork>(2))  the child's parent "
1218 "is the calling process."
1219 msgstr ""
1220
1221 #. type: Plain text
1222 #: build/C/man2/clone.2:516
1223 msgid ""
1224 "Note that it is the parent process, as returned by B<getppid>(2), which is "
1225 "signaled when the child terminates, so that if B<CLONE_PARENT> is set, then "
1226 "the parent of the calling process, rather than the calling process itself, "
1227 "will be signaled."
1228 msgstr ""
1229
1230 #. type: TP
1231 #: build/C/man2/clone.2:516
1232 #, no-wrap
1233 msgid "B<CLONE_PARENT_SETTID> (since Linux 2.5.49)"
1234 msgstr ""
1235
1236 #. type: Plain text
1237 #: build/C/man2/clone.2:524
1238 msgid ""
1239 "Store child thread ID at location I<ptid> in parent and child memory.  (In "
1240 "Linux 2.5.32-2.5.48 there was a flag B<CLONE_SETTID> that did this.)"
1241 msgstr ""
1242
1243 #. type: TP
1244 #: build/C/man2/clone.2:524
1245 #, no-wrap
1246 msgid "B<CLONE_PID> (obsolete)"
1247 msgstr ""
1248
1249 #. type: Plain text
1250 #: build/C/man2/clone.2:535
1251 msgid ""
1252 "If B<CLONE_PID> is set, the child process is created with the same process "
1253 "ID as the calling process.  This is good for hacking the system, but "
1254 "otherwise of not much use.  Since 2.3.21 this flag can be specified only by "
1255 "the system boot process (PID 0).  It disappeared in Linux 2.5.16."
1256 msgstr ""
1257
1258 #. type: TP
1259 #: build/C/man2/clone.2:535
1260 #, no-wrap
1261 msgid "B<CLONE_PTRACE> (since Linux 2.2)"
1262 msgstr ""
1263
1264 #. type: Plain text
1265 #: build/C/man2/clone.2:542
1266 msgid ""
1267 "If B<CLONE_PTRACE> is specified, and the calling process is being traced, "
1268 "then trace the child also (see B<ptrace>(2))."
1269 msgstr ""
1270
1271 #. type: TP
1272 #: build/C/man2/clone.2:542
1273 #, no-wrap
1274 msgid "B<CLONE_SETTLS> (since Linux 2.5.32)"
1275 msgstr ""
1276
1277 #. type: Plain text
1278 #: build/C/man2/clone.2:549
1279 msgid ""
1280 "The I<newtls> argument is the new TLS (Thread Local Storage) descriptor.  "
1281 "(See B<set_thread_area>(2).)"
1282 msgstr ""
1283
1284 #. type: TP
1285 #: build/C/man2/clone.2:549
1286 #, no-wrap
1287 msgid "B<CLONE_SIGHAND> (since Linux 2.0)"
1288 msgstr ""
1289
1290 #. type: Plain text
1291 #: build/C/man2/clone.2:565
1292 msgid ""
1293 "If B<CLONE_SIGHAND> is set, the calling process and the child process share "
1294 "the same table of signal handlers.  If the calling process or child process "
1295 "calls B<sigaction>(2)  to change the behavior associated with a signal, the "
1296 "behavior is changed in the other process as well.  However, the calling "
1297 "process and child processes still have distinct signal masks and sets of "
1298 "pending signals.  So, one of them may block or unblock some signals using "
1299 "B<sigprocmask>(2)  without affecting the other process."
1300 msgstr ""
1301
1302 #. type: Plain text
1303 #: build/C/man2/clone.2:576
1304 msgid ""
1305 "If B<CLONE_SIGHAND> is not set, the child process inherits a copy of the "
1306 "signal handlers of the calling process at the time B<clone>()  is called.  "
1307 "Calls to B<sigaction>(2)  performed later by one of the processes have no "
1308 "effect on the other process."
1309 msgstr ""
1310
1311 #. type: Plain text
1312 #: build/C/man2/clone.2:584
1313 msgid ""
1314 "Since Linux 2.6.0-test6, I<flags> must also include B<CLONE_VM> if "
1315 "B<CLONE_SIGHAND> is specified"
1316 msgstr ""
1317
1318 #. type: TP
1319 #: build/C/man2/clone.2:584
1320 #, no-wrap
1321 msgid "B<CLONE_STOPPED> (since Linux 2.6.0-test2)"
1322 msgstr ""
1323
1324 #. type: Plain text
1325 #: build/C/man2/clone.2:593
1326 msgid ""
1327 "If B<CLONE_STOPPED> is set, then the child is initially stopped (as though "
1328 "it was sent a B<SIGSTOP> signal), and must be resumed by sending it a "
1329 "B<SIGCONT> signal."
1330 msgstr ""
1331
1332 #.  glibc 2.8 removed this defn from bits/sched.h
1333 #. type: Plain text
1334 #: build/C/man2/clone.2:601
1335 msgid ""
1336 "This flag was I<deprecated> from Linux 2.6.25 onward, and was I<removed> "
1337 "altogether in Linux 2.6.38."
1338 msgstr ""
1339
1340 #. type: TP
1341 #: build/C/man2/clone.2:601
1342 #, no-wrap
1343 msgid "B<CLONE_SYSVSEM> (since Linux 2.5.10)"
1344 msgstr ""
1345
1346 #. type: Plain text
1347 #: build/C/man2/clone.2:619
1348 msgid ""
1349 "If B<CLONE_SYSVSEM> is set, then the child and the calling process share a "
1350 "single list of System V semaphore adjustment (I<semadj>)  values (see "
1351 "B<semop>(2)).  In this case, the shared list accumulates I<semadj> values "
1352 "across all processes sharing the list, and semaphore adjustments are "
1353 "performed only when the last process that is sharing the list terminates (or "
1354 "ceases sharing the list using B<unshare>(2)).  If this flag is not set, then "
1355 "the child has a separate I<semadj> list that is initially empty."
1356 msgstr ""
1357
1358 #. type: TP
1359 #: build/C/man2/clone.2:619
1360 #, no-wrap
1361 msgid "B<CLONE_THREAD> (since Linux 2.4.0-test8)"
1362 msgstr ""
1363
1364 #. type: Plain text
1365 #: build/C/man2/clone.2:628
1366 msgid ""
1367 "If B<CLONE_THREAD> is set, the child is placed in the same thread group as "
1368 "the calling process.  To make the remainder of the discussion of "
1369 "B<CLONE_THREAD> more readable, the term \"thread\" is used to refer to the "
1370 "processes within a thread group."
1371 msgstr ""
1372
1373 #. type: Plain text
1374 #: build/C/man2/clone.2:636
1375 msgid ""
1376 "Thread groups were a feature added in Linux 2.4 to support the POSIX threads "
1377 "notion of a set of threads that share a single PID.  Internally, this shared "
1378 "PID is the so-called thread group identifier (TGID) for the thread group.  "
1379 "Since Linux 2.4, calls to B<getpid>(2)  return the TGID of the caller."
1380 msgstr ""
1381
1382 #. type: Plain text
1383 #: build/C/man2/clone.2:645
1384 msgid ""
1385 "The threads within a group can be distinguished by their (system-wide)  "
1386 "unique thread IDs (TID).  A new thread's TID is available as the function "
1387 "result returned to the caller of B<clone>(), and a thread can obtain its own "
1388 "TID using B<gettid>(2)."
1389 msgstr ""
1390
1391 #. type: Plain text
1392 #: build/C/man2/clone.2:655
1393 msgid ""
1394 "When a call is made to B<clone>()  without specifying B<CLONE_THREAD>, then "
1395 "the resulting thread is placed in a new thread group whose TGID is the same "
1396 "as the thread's TID.  This thread is the I<leader> of the new thread group."
1397 msgstr ""
1398
1399 #. type: Plain text
1400 #: build/C/man2/clone.2:677
1401 msgid ""
1402 "A new thread created with B<CLONE_THREAD> has the same parent process as the "
1403 "caller of B<clone>()  (i.e., like B<CLONE_PARENT>), so that calls to "
1404 "B<getppid>(2)  return the same value for all of the threads in a thread "
1405 "group.  When a B<CLONE_THREAD> thread terminates, the thread that created it "
1406 "using B<clone>()  is not sent a B<SIGCHLD> (or other termination) signal; "
1407 "nor can the status of such a thread be obtained using B<wait>(2).  (The "
1408 "thread is said to be I<detached>.)"
1409 msgstr ""
1410
1411 #. type: Plain text
1412 #: build/C/man2/clone.2:682
1413 msgid ""
1414 "After all of the threads in a thread group terminate the parent process of "
1415 "the thread group is sent a B<SIGCHLD> (or other termination) signal."
1416 msgstr ""
1417
1418 #. type: Plain text
1419 #: build/C/man2/clone.2:687
1420 msgid ""
1421 "If any of the threads in a thread group performs an B<execve>(2), then all "
1422 "threads other than the thread group leader are terminated, and the new "
1423 "program is executed in the thread group leader."
1424 msgstr ""
1425
1426 #. type: Plain text
1427 #: build/C/man2/clone.2:693
1428 msgid ""
1429 "If one of the threads in a thread group creates a child using B<fork>(2), "
1430 "then any thread in the group can B<wait>(2)  for that child."
1431 msgstr ""
1432
1433 #. type: Plain text
1434 #: build/C/man2/clone.2:706
1435 msgid ""
1436 "Since Linux 2.5.35, I<flags> must also include B<CLONE_SIGHAND> if "
1437 "B<CLONE_THREAD> is specified (and note that, since Linux 2.6.0-test6, "
1438 "B<CLONE_SIGHAND> also requires B<CLONE_VM> to be included)."
1439 msgstr ""
1440
1441 #. type: Plain text
1442 #: build/C/man2/clone.2:711
1443 msgid ""
1444 "Signals may be sent to a thread group as a whole (i.e., a TGID) using "
1445 "B<kill>(2), or to a specific thread (i.e., TID) using B<tgkill>(2)."
1446 msgstr ""
1447
1448 #. type: Plain text
1449 #: build/C/man2/clone.2:716
1450 msgid ""
1451 "Signal dispositions and actions are process-wide: if an unhandled signal is "
1452 "delivered to a thread, then it will affect (terminate, stop, continue, be "
1453 "ignored in)  all members of the thread group."
1454 msgstr ""
1455
1456 #. type: Plain text
1457 #: build/C/man2/clone.2:729
1458 msgid ""
1459 "Each thread has its own signal mask, as set by B<sigprocmask>(2), but "
1460 "signals can be pending either: for the whole process (i.e., deliverable to "
1461 "any member of the thread group), when sent with B<kill>(2); or for an "
1462 "individual thread, when sent with B<tgkill>(2).  A call to B<sigpending>(2)  "
1463 "returns a signal set that is the union of the signals pending for the whole "
1464 "process and the signals that are pending for the calling thread."
1465 msgstr ""
1466
1467 #. type: Plain text
1468 #: build/C/man2/clone.2:741
1469 msgid ""
1470 "If B<kill>(2)  is used to send a signal to a thread group, and the thread "
1471 "group has installed a handler for the signal, then the handler will be "
1472 "invoked in exactly one, arbitrarily selected member of the thread group that "
1473 "has not blocked the signal.  If multiple threads in a group are waiting to "
1474 "accept the same signal using B<sigwaitinfo>(2), the kernel will arbitrarily "
1475 "select one of these threads to receive a signal sent using B<kill>(2)."
1476 msgstr ""
1477
1478 #. type: TP
1479 #: build/C/man2/clone.2:741
1480 #, no-wrap
1481 msgid "B<CLONE_UNTRACED> (since Linux 2.5.46)"
1482 msgstr ""
1483
1484 #. type: Plain text
1485 #: build/C/man2/clone.2:748
1486 msgid ""
1487 "If B<CLONE_UNTRACED> is specified, then a tracing process cannot force "
1488 "B<CLONE_PTRACE> on this child process."
1489 msgstr ""
1490
1491 #. type: TP
1492 #: build/C/man2/clone.2:748
1493 #, no-wrap
1494 msgid "B<CLONE_VFORK> (since Linux 2.2)"
1495 msgstr ""
1496
1497 #. type: Plain text
1498 #: build/C/man2/clone.2:760
1499 msgid ""
1500 "If B<CLONE_VFORK> is set, the execution of the calling process is suspended "
1501 "until the child releases its virtual memory resources via a call to "
1502 "B<execve>(2)  or B<_exit>(2)  (as with B<vfork>(2))."
1503 msgstr ""
1504
1505 #. type: Plain text
1506 #: build/C/man2/clone.2:766
1507 msgid ""
1508 "If B<CLONE_VFORK> is not set, then both the calling process and the child "
1509 "are schedulable after the call, and an application should not rely on "
1510 "execution occurring in any particular order."
1511 msgstr ""
1512
1513 #. type: TP
1514 #: build/C/man2/clone.2:766
1515 #, no-wrap
1516 msgid "B<CLONE_VM> (since Linux 2.0)"
1517 msgstr ""
1518
1519 #. type: Plain text
1520 #: build/C/man2/clone.2:779
1521 msgid ""
1522 "If B<CLONE_VM> is set, the calling process and the child process run in the "
1523 "same memory space.  In particular, memory writes performed by the calling "
1524 "process or by the child process are also visible in the other process.  "
1525 "Moreover, any memory mapping or unmapping performed with B<mmap>(2)  or "
1526 "B<munmap>(2)  by the child or calling process also affects the other "
1527 "process."
1528 msgstr ""
1529
1530 #. type: Plain text
1531 #: build/C/man2/clone.2:788
1532 msgid ""
1533 "If B<CLONE_VM> is not set, the child process runs in a separate copy of the "
1534 "memory space of the calling process at the time of B<clone>().  Memory "
1535 "writes or file mappings/unmappings performed by one of the processes do not "
1536 "affect the other, as with B<fork>(2)."
1537 msgstr ""
1538
1539 #. type: SS
1540 #: build/C/man2/clone.2:788 build/C/man2/sched_setaffinity.2:212
1541 #, no-wrap
1542 msgid "C library/kernel ABI differences"
1543 msgstr ""
1544
1545 #. type: Plain text
1546 #: build/C/man2/clone.2:804
1547 msgid ""
1548 "The raw B<clone>()  system call corresponds more closely to B<fork>(2)  in "
1549 "that execution in the child continues from the point of the call.  As such, "
1550 "the I<fn> and I<arg> arguments of the B<clone>()  wrapper function are "
1551 "omitted.  Furthermore, the argument order changes.  The raw system call "
1552 "interface on x86 and many other architectures is roughly:"
1553 msgstr ""
1554
1555 #. type: Plain text
1556 #: build/C/man2/clone.2:810
1557 #, no-wrap
1558 msgid ""
1559 "B<long clone(unsigned long >I<flags>B<, void *>I<child_stack>B<,>\n"
1560 "B<           void *>I<ptid>B<, void *>I<ctid>B<,>\n"
1561 "B<           struct pt_regs *>I<regs>B<);>\n"
1562 msgstr ""
1563
1564 #. type: Plain text
1565 #: build/C/man2/clone.2:821
1566 msgid ""
1567 "Another difference for the raw system call is that the I<child_stack> "
1568 "argument may be zero, in which case copy-on-write semantics ensure that the "
1569 "child gets separate copies of stack pages when either process modifies the "
1570 "stack.  In this case, for correct operation, the B<CLONE_VM> option should "
1571 "not be specified."
1572 msgstr ""
1573
1574 #. type: Plain text
1575 #: build/C/man2/clone.2:829
1576 msgid ""
1577 "For some architectures, the order of the arguments for the system call "
1578 "differs from that shown above.  On the score, microblaze, ARM, ARM 64, "
1579 "PA-RISC, arc, Power PC, xtensa, and MIPS architectures, the order of the "
1580 "fourth and fifth arguments is reversed.  On the cris and s390 architectures, "
1581 "the order of the first and second arguments is reversed."
1582 msgstr ""
1583
1584 #. type: SS
1585 #: build/C/man2/clone.2:829
1586 #, no-wrap
1587 msgid "blackfin, m68k, and sparc"
1588 msgstr ""
1589
1590 #. type: Plain text
1591 #: build/C/man2/clone.2:833
1592 msgid ""
1593 "The argument-passing conventions on blackfin, m68k, and sparc are different "
1594 "from the descriptions above.  For details, see the kernel (and glibc) "
1595 "source."
1596 msgstr ""
1597
1598 #. type: SS
1599 #: build/C/man2/clone.2:833
1600 #, no-wrap
1601 msgid "ia64"
1602 msgstr ""
1603
1604 #. type: Plain text
1605 #: build/C/man2/clone.2:835
1606 msgid "On ia64, a different interface is used:"
1607 msgstr ""
1608
1609 #. type: Plain text
1610 #: build/C/man2/clone.2:842
1611 #, no-wrap
1612 msgid ""
1613 "B<int __clone2(int (*>I<fn>B<)(void *), >\n"
1614 "B<             void *>I<child_stack_base>B<, size_t >I<stack_size>B<,>\n"
1615 "B<             int >I<flags>B<, void *>I<arg>B<, ... >\n"
1616 "B<          /* pid_t *>I<ptid>B<, struct user_desc *>I<tls>B<, pid_t "
1617 "*>I<ctid>B< */ );>\n"
1618 msgstr ""
1619
1620 #. type: Plain text
1621 #: build/C/man2/clone.2:854
1622 msgid ""
1623 "The prototype shown above is for the glibc wrapper function; the raw system "
1624 "call interface has no I<fn> or I<arg> argument, and changes the order of the "
1625 "arguments so that I<flags> is the first argument, and I<tls> is the last "
1626 "argument."
1627 msgstr ""
1628
1629 #. type: Plain text
1630 #: build/C/man2/clone.2:865
1631 msgid ""
1632 "B<__clone2>()  operates in the same way as B<clone>(), except that "
1633 "I<child_stack_base> points to the lowest address of the child's stack area, "
1634 "and I<stack_size> specifies the size of the stack pointed to by "
1635 "I<child_stack_base>."
1636 msgstr ""
1637
1638 #. type: SS
1639 #: build/C/man2/clone.2:865
1640 #, no-wrap
1641 msgid "Linux 2.4 and earlier"
1642 msgstr ""
1643
1644 #. type: Plain text
1645 #: build/C/man2/clone.2:873
1646 msgid ""
1647 "In Linux 2.4 and earlier, B<clone>()  does not take arguments I<ptid>, "
1648 "I<tls>, and I<ctid>."
1649 msgstr ""
1650
1651 #.  gettid(2) returns current->pid;
1652 #.  getpid(2) returns current->tgid;
1653 #. type: Plain text
1654 #: build/C/man2/clone.2:882
1655 msgid ""
1656 "On success, the thread ID of the child process is returned in the caller's "
1657 "thread of execution.  On failure, -1 is returned in the caller's context, no "
1658 "child process will be created, and I<errno> will be set appropriately."
1659 msgstr ""
1660
1661 #. type: SH
1662 #: build/C/man2/clone.2:882 build/C/man2/kcmp.2:170 build/C/man2/sched_get_priority_max.2:107 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_setattr.2:271 build/C/man2/sched_setparam.2:96 build/C/man2/sched_setscheduler.2:145 build/C/man2/sched_yield.2:48 build/C/man2/setns.2:145 build/C/man2/unshare.2:282
1663 #, no-wrap
1664 msgid "ERRORS"
1665 msgstr ""
1666
1667 #. type: TP
1668 #: build/C/man2/clone.2:883
1669 #, no-wrap
1670 msgid "B<EAGAIN>"
1671 msgstr ""
1672
1673 #. type: Plain text
1674 #: build/C/man2/clone.2:887
1675 msgid "Too many processes are already running; see B<fork>(2)."
1676 msgstr ""
1677
1678 #. type: TP
1679 #: build/C/man2/clone.2:887 build/C/man2/clone.2:894 build/C/man2/clone.2:909 build/C/man2/clone.2:926 build/C/man2/clone.2:934 build/C/man2/clone.2:946 build/C/man2/clone.2:952 build/C/man2/clone.2:962 build/C/man2/clone.2:970 build/C/man2/clone.2:978 build/C/man2/kcmp.2:181 build/C/man2/sched_get_priority_max.2:108 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_setattr.2:276 build/C/man2/sched_setattr.2:300 build/C/man2/sched_setattr.2:323 build/C/man2/sched_setparam.2:97 build/C/man2/sched_setparam.2:104 build/C/man2/sched_setscheduler.2:146 build/C/man2/sched_setscheduler.2:153 build/C/man2/sched_setscheduler.2:158 build/C/man2/setns.2:150 build/C/man2/setns.2:155 build/C/man2/setns.2:159 build/C/man2/setns.2:164 build/C/man2/setns.2:168 build/C/man2/setns.2:175 build/C/man2/unshare.2:283 build/C/man2/unshare.2:287
1680 #, no-wrap
1681 msgid "B<EINVAL>"
1682 msgstr ""
1683
1684 #. type: Plain text
1685 #: build/C/man2/clone.2:894
1686 msgid ""
1687 "B<CLONE_SIGHAND> was specified, but B<CLONE_VM> was not.  (Since Linux "
1688 "2.6.0-test6.)"
1689 msgstr ""
1690
1691 #.  .TP
1692 #.  .B EINVAL
1693 #.  Precisely one of
1694 #.  .B CLONE_DETACHED
1695 #.  and
1696 #.  .B CLONE_THREAD
1697 #.  was specified.
1698 #.  (Since Linux 2.6.0-test6.)
1699 #. type: Plain text
1700 #: build/C/man2/clone.2:909
1701 msgid ""
1702 "B<CLONE_THREAD> was specified, but B<CLONE_SIGHAND> was not.  (Since Linux "
1703 "2.5.35.)"
1704 msgstr ""
1705
1706 #.  commit e66eded8309ebf679d3d3c1f5820d1f2ca332c71
1707 #. type: Plain text
1708 #: build/C/man2/clone.2:918
1709 msgid "Both B<CLONE_FS> and B<CLONE_NEWNS> were specified in I<flags>."
1710 msgstr ""
1711
1712 #. type: TP
1713 #: build/C/man2/clone.2:918
1714 #, no-wrap
1715 msgid "B<EINVAL> (since Linux 3.9)"
1716 msgstr ""
1717
1718 #. type: Plain text
1719 #: build/C/man2/clone.2:926
1720 msgid "Both B<CLONE_NEWUSER> and B<CLONE_FS> were specified in I<flags>."
1721 msgstr ""
1722
1723 #. type: Plain text
1724 #: build/C/man2/clone.2:934
1725 msgid "Both B<CLONE_NEWIPC> and B<CLONE_SYSVSEM> were specified in I<flags>."
1726 msgstr ""
1727
1728 #. type: Plain text
1729 #: build/C/man2/clone.2:946
1730 msgid ""
1731 "One (or both) of B<CLONE_NEWPID> or B<CLONE_NEWUSER> and one (or both) of "
1732 "B<CLONE_THREAD> or B<CLONE_PARENT> were specified in I<flags>."
1733 msgstr ""
1734
1735 #. type: Plain text
1736 #: build/C/man2/clone.2:952
1737 msgid "Returned by B<clone>()  when a zero value is specified for I<child_stack>."
1738 msgstr ""
1739
1740 #. type: Plain text
1741 #: build/C/man2/clone.2:962
1742 msgid ""
1743 "B<CLONE_NEWIPC> was specified in I<flags>, but the kernel was not configured "
1744 "with the B<CONFIG_SYSVIPC> and B<CONFIG_IPC_NS> options."
1745 msgstr ""
1746
1747 #. type: Plain text
1748 #: build/C/man2/clone.2:970
1749 msgid ""
1750 "B<CLONE_NEWNET> was specified in I<flags>, but the kernel was not configured "
1751 "with the B<CONFIG_NET_NS> option."
1752 msgstr ""
1753
1754 #. type: Plain text
1755 #: build/C/man2/clone.2:978
1756 msgid ""
1757 "B<CLONE_NEWPID> was specified in I<flags>, but the kernel was not configured "
1758 "with the B<CONFIG_PID_NS> option."
1759 msgstr ""
1760
1761 #. type: Plain text
1762 #: build/C/man2/clone.2:986
1763 msgid ""
1764 "B<CLONE_NEWUTS> was specified in I<flags>, but the kernel was not configured "
1765 "with the B<CONFIG_UTS> option."
1766 msgstr ""
1767
1768 #. type: TP
1769 #: build/C/man2/clone.2:986 build/C/man2/setns.2:179 build/C/man2/unshare.2:296
1770 #, no-wrap
1771 msgid "B<ENOMEM>"
1772 msgstr ""
1773
1774 #. type: Plain text
1775 #: build/C/man2/clone.2:991
1776 msgid ""
1777 "Cannot allocate sufficient memory to allocate a task structure for the "
1778 "child, or to copy those parts of the caller's context that need to be "
1779 "copied."
1780 msgstr ""
1781
1782 #. type: TP
1783 #: build/C/man2/clone.2:991 build/C/man2/clone.2:1000 build/C/man2/clone.2:1004 build/C/man2/kcmp.2:185 build/C/man2/sched_setaffinity.2:135 build/C/man2/sched_setattr.2:339 build/C/man2/sched_setattr.2:342 build/C/man2/sched_setparam.2:109 build/C/man2/sched_setscheduler.2:164 build/C/man2/setns.2:182 build/C/man2/unshare.2:300 build/C/man2/unshare.2:303
1784 #, no-wrap
1785 msgid "B<EPERM>"
1786 msgstr ""
1787
1788 #. type: Plain text
1789 #: build/C/man2/clone.2:1000
1790 msgid ""
1791 "B<CLONE_NEWIPC>, B<CLONE_NEWNET>, B<CLONE_NEWNS>, B<CLONE_NEWPID>, or "
1792 "B<CLONE_NEWUTS> was specified by an unprivileged process (process without "
1793 "B<CAP_SYS_ADMIN>)."
1794 msgstr ""
1795
1796 #. type: Plain text
1797 #: build/C/man2/clone.2:1004
1798 msgid "B<CLONE_PID> was specified by a process other than process 0."
1799 msgstr ""
1800
1801 #. type: Plain text
1802 #: build/C/man2/clone.2:1012 build/C/man2/unshare.2:311
1803 msgid ""
1804 "B<CLONE_NEWUSER> was specified in I<flags>, but either the effective user ID "
1805 "or the effective group ID of the caller does not have a mapping in the "
1806 "parent namespace (see B<user_namespaces>(7))."
1807 msgstr ""
1808
1809 #. type: TP
1810 #: build/C/man2/clone.2:1012 build/C/man2/unshare.2:311
1811 #, no-wrap
1812 msgid "B<EPERM> (since Linux 3.9)"
1813 msgstr ""
1814
1815 #.  commit 3151527ee007b73a0ebd296010f1c0454a919c7d
1816 #.  FIXME What is the rationale for this restriction?
1817 #. type: Plain text
1818 #: build/C/man2/clone.2:1022 build/C/man2/unshare.2:321
1819 msgid ""
1820 "B<CLONE_NEWUSER> was specified in I<flags> and the caller is in a chroot "
1821 "environment (i.e., the caller's root directory does not match the root "
1822 "directory of the mount namespace in which it resides)."
1823 msgstr ""
1824
1825 #. type: TP
1826 #: build/C/man2/clone.2:1022 build/C/man2/unshare.2:321
1827 #, no-wrap
1828 msgid "B<EUSERS> (since Linux 3.11)"
1829 msgstr ""
1830
1831 #. type: Plain text
1832 #: build/C/man2/clone.2:1031 build/C/man2/unshare.2:330
1833 msgid ""
1834 "B<CLONE_NEWUSER> was specified in I<flags>, and the call would cause the "
1835 "limit on the number of nested user namespaces to be exceeded.  See "
1836 "B<user_namespaces>(7)."
1837 msgstr ""
1838
1839 #. type: Plain text
1840 #: build/C/man2/clone.2:1038
1841 msgid ""
1842 "There is no entry for B<clone>()  in libc5.  glibc2 provides B<clone>()  as "
1843 "described in this manual page."
1844 msgstr ""
1845
1846 #. type: Plain text
1847 #: build/C/man2/clone.2:1042
1848 msgid ""
1849 "B<clone>()  is Linux-specific and should not be used in programs intended to "
1850 "be portable."
1851 msgstr ""
1852
1853 #. type: Plain text
1854 #: build/C/man2/clone.2:1052
1855 msgid ""
1856 "In the kernel 2.4.x series, B<CLONE_THREAD> generally does not make the "
1857 "parent of the new thread the same as the parent of the calling process.  "
1858 "However, for kernel versions 2.4.7 to 2.4.18 the B<CLONE_THREAD> flag "
1859 "implied the B<CLONE_PARENT> flag (as in kernel 2.6)."
1860 msgstr ""
1861
1862 #. type: Plain text
1863 #: build/C/man2/clone.2:1062
1864 msgid ""
1865 "For a while there was B<CLONE_DETACHED> (introduced in 2.5.32): parent wants "
1866 "no child-exit signal.  In 2.6.2 the need to give this together with "
1867 "B<CLONE_THREAD> disappeared.  This flag is still defined, but has no effect."
1868 msgstr ""
1869
1870 #. type: Plain text
1871 #: build/C/man2/clone.2:1067
1872 msgid ""
1873 "On i386, B<clone>()  should not be called through vsyscall, but directly "
1874 "through I<int $0x80>."
1875 msgstr ""
1876
1877 #. type: Plain text
1878 #: build/C/man2/clone.2:1098
1879 msgid ""
1880 "Versions of the GNU C library that include the NPTL threading library "
1881 "contain a wrapper function for B<getpid>(2)  that performs caching of PIDs.  "
1882 "This caching relies on support in the glibc wrapper for B<clone>(), but as "
1883 "currently implemented, the cache may not be up to date in some "
1884 "circumstances.  In particular, if a signal is delivered to the child "
1885 "immediately after the B<clone>()  call, then a call to B<getpid>(2)  in a "
1886 "handler for the signal may return the PID of the calling process (\"the "
1887 "parent\"), if the clone wrapper has not yet had a chance to update the PID "
1888 "cache in the child.  (This discussion ignores the case where the child was "
1889 "created using B<CLONE_THREAD>, when B<getpid>(2)  I<should> return the same "
1890 "value in the child and in the process that called B<clone>(), since the "
1891 "caller and the child are in the same thread group.  The stale-cache problem "
1892 "also does not occur if the I<flags> argument includes B<CLONE_VM>.)  To get "
1893 "the truth, it may be necessary to use code such as the following:"
1894 msgstr ""
1895
1896 #. type: Plain text
1897 #: build/C/man2/clone.2:1101
1898 #, no-wrap
1899 msgid "    #include E<lt>syscall.hE<gt>\n"
1900 msgstr ""
1901
1902 #. type: Plain text
1903 #: build/C/man2/clone.2:1103
1904 #, no-wrap
1905 msgid "    pid_t mypid;\n"
1906 msgstr ""
1907
1908 #. type: Plain text
1909 #: build/C/man2/clone.2:1105
1910 #, no-wrap
1911 msgid "    mypid = syscall(SYS_getpid);\n"
1912 msgstr ""
1913
1914 #. type: Plain text
1915 #: build/C/man2/clone.2:1119
1916 msgid ""
1917 "The following program demonstrates the use of B<clone>()  to create a child "
1918 "process that executes in a separate UTS namespace.  The child changes the "
1919 "hostname in its UTS namespace.  Both parent and child then display the "
1920 "system hostname, making it possible to see that the hostname differs in the "
1921 "UTS namespaces of the parent and child.  For an example of the use of this "
1922 "program, see B<setns>(2)."
1923 msgstr ""
1924
1925 #. type: SS
1926 #: build/C/man2/clone.2:1119 build/C/man2/setns.2:255 build/C/man2/unshare.2:396
1927 #, no-wrap
1928 msgid "Program source"
1929 msgstr ""
1930
1931 #. type: Plain text
1932 #: build/C/man2/clone.2:1129
1933 #, no-wrap
1934 msgid ""
1935 "#define _GNU_SOURCE\n"
1936 "#include E<lt>sys/wait.hE<gt>\n"
1937 "#include E<lt>sys/utsname.hE<gt>\n"
1938 "#include E<lt>sched.hE<gt>\n"
1939 "#include E<lt>string.hE<gt>\n"
1940 "#include E<lt>stdio.hE<gt>\n"
1941 "#include E<lt>stdlib.hE<gt>\n"
1942 "#include E<lt>unistd.hE<gt>\n"
1943 msgstr ""
1944
1945 #. type: Plain text
1946 #: build/C/man2/clone.2:1132 build/C/man2/setns.2:266 build/C/man2/unshare.2:415
1947 #, no-wrap
1948 msgid ""
1949 "#define errExit(msg)    do { perror(msg); exit(EXIT_FAILURE); \\e\n"
1950 "                        } while (0)\n"
1951 msgstr ""
1952
1953 #. type: Plain text
1954 #: build/C/man2/clone.2:1137
1955 #, no-wrap
1956 msgid ""
1957 "static int              /* Start function for cloned child */\n"
1958 "childFunc(void *arg)\n"
1959 "{\n"
1960 "    struct utsname uts;\n"
1961 msgstr ""
1962
1963 #. type: Plain text
1964 #: build/C/man2/clone.2:1139
1965 #, no-wrap
1966 msgid "    /* Change hostname in UTS namespace of child */\n"
1967 msgstr ""
1968
1969 #. type: Plain text
1970 #: build/C/man2/clone.2:1142
1971 #, no-wrap
1972 msgid ""
1973 "    if (sethostname(arg, strlen(arg)) == -1)\n"
1974 "        errExit(\"sethostname\");\n"
1975 msgstr ""
1976
1977 #. type: Plain text
1978 #: build/C/man2/clone.2:1144
1979 #, no-wrap
1980 msgid "    /* Retrieve and display hostname */\n"
1981 msgstr ""
1982
1983 #. type: Plain text
1984 #: build/C/man2/clone.2:1148
1985 #, no-wrap
1986 msgid ""
1987 "    if (uname(&uts) == -1)\n"
1988 "        errExit(\"uname\");\n"
1989 "    printf(\"uts.nodename in child:  %s\\en\", uts.nodename);\n"
1990 msgstr ""
1991
1992 #. type: Plain text
1993 #: build/C/man2/clone.2:1152
1994 #, no-wrap
1995 msgid ""
1996 "    /* Keep the namespace open for a while, by sleeping.\n"
1997 "       This allows some experimentation--for example, another\n"
1998 "       process might join the namespace. */\n"
1999 msgstr ""
2000
2001 #. type: Plain text
2002 #: build/C/man2/clone.2:1154
2003 #, no-wrap
2004 msgid "    sleep(200);\n"
2005 msgstr ""
2006
2007 #. type: Plain text
2008 #: build/C/man2/clone.2:1157
2009 #, no-wrap
2010 msgid ""
2011 "    return 0;           /* Child terminates now */\n"
2012 "}\n"
2013 msgstr ""
2014
2015 #. type: Plain text
2016 #: build/C/man2/clone.2:1159
2017 #, no-wrap
2018 msgid "#define STACK_SIZE (1024 * 1024)    /* Stack size for cloned child */\n"
2019 msgstr ""
2020
2021 #. type: Plain text
2022 #: build/C/man2/clone.2:1167
2023 #, no-wrap
2024 msgid ""
2025 "int\n"
2026 "main(int argc, char *argv[])\n"
2027 "{\n"
2028 "    char *stack;                    /* Start of stack buffer */\n"
2029 "    char *stackTop;                 /* End of stack buffer */\n"
2030 "    pid_t pid;\n"
2031 "    struct utsname uts;\n"
2032 msgstr ""
2033
2034 #. type: Plain text
2035 #: build/C/man2/clone.2:1172
2036 #, no-wrap
2037 msgid ""
2038 "    if (argc E<lt> 2) {\n"
2039 "        fprintf(stderr, \"Usage: %s E<lt>child-hostnameE<gt>\\en\", "
2040 "argv[0]);\n"
2041 "        exit(EXIT_SUCCESS);\n"
2042 "    }\n"
2043 msgstr ""
2044
2045 #. type: Plain text
2046 #: build/C/man2/clone.2:1174
2047 #, no-wrap
2048 msgid "    /* Allocate stack for child */\n"
2049 msgstr ""
2050
2051 #. type: Plain text
2052 #: build/C/man2/clone.2:1179
2053 #, no-wrap
2054 msgid ""
2055 "    stack = malloc(STACK_SIZE);\n"
2056 "    if (stack == NULL)\n"
2057 "        errExit(\"malloc\");\n"
2058 "    stackTop = stack + STACK_SIZE;  /* Assume stack grows downward */\n"
2059 msgstr ""
2060
2061 #. type: Plain text
2062 #: build/C/man2/clone.2:1182
2063 #, no-wrap
2064 msgid ""
2065 "    /* Create child that has its own UTS namespace;\n"
2066 "       child commences execution in childFunc() */\n"
2067 msgstr ""
2068
2069 #. type: Plain text
2070 #: build/C/man2/clone.2:1187
2071 #, no-wrap
2072 msgid ""
2073 "    pid = clone(childFunc, stackTop, CLONE_NEWUTS | SIGCHLD, argv[1]);\n"
2074 "    if (pid == -1)\n"
2075 "        errExit(\"clone\");\n"
2076 "    printf(\"clone() returned %ld\\en\", (long) pid);\n"
2077 msgstr ""
2078
2079 #. type: Plain text
2080 #: build/C/man2/clone.2:1189
2081 #, no-wrap
2082 msgid "    /* Parent falls through to here */\n"
2083 msgstr ""
2084
2085 #. type: Plain text
2086 #: build/C/man2/clone.2:1191
2087 #, no-wrap
2088 msgid "    sleep(1);           /* Give child time to change its hostname */\n"
2089 msgstr ""
2090
2091 #. type: Plain text
2092 #: build/C/man2/clone.2:1194
2093 #, no-wrap
2094 msgid ""
2095 "    /* Display hostname in parent\\(aqs UTS namespace. This will be\n"
2096 "       different from hostname in child\\(aqs UTS namespace. */\n"
2097 msgstr ""
2098
2099 #. type: Plain text
2100 #: build/C/man2/clone.2:1198
2101 #, no-wrap
2102 msgid ""
2103 "    if (uname(&uts) == -1)\n"
2104 "        errExit(\"uname\");\n"
2105 "    printf(\"uts.nodename in parent: %s\\en\", uts.nodename);\n"
2106 msgstr ""
2107
2108 #. type: Plain text
2109 #: build/C/man2/clone.2:1202
2110 #, no-wrap
2111 msgid ""
2112 "    if (waitpid(pid, NULL, 0) == -1)    /* Wait for child */\n"
2113 "        errExit(\"waitpid\");\n"
2114 "    printf(\"child has terminated\\en\");\n"
2115 msgstr ""
2116
2117 #. type: Plain text
2118 #: build/C/man2/clone.2:1205
2119 #, no-wrap
2120 msgid ""
2121 "    exit(EXIT_SUCCESS);\n"
2122 "}\n"
2123 msgstr ""
2124
2125 #. type: Plain text
2126 #: build/C/man2/clone.2:1221
2127 msgid ""
2128 "B<fork>(2), B<futex>(2), B<getpid>(2), B<gettid>(2), B<kcmp>(2), "
2129 "B<set_thread_area>(2), B<set_tid_address>(2), B<setns>(2), B<tkill>(2), "
2130 "B<unshare>(2), B<wait>(2), B<capabilities>(7), B<namespaces>(7), "
2131 "B<pthreads>(7)"
2132 msgstr ""
2133
2134 #. type: TH
2135 #: build/C/man2/kcmp.2:28
2136 #, no-wrap
2137 msgid "KCMP"
2138 msgstr ""
2139
2140 #. type: TH
2141 #: build/C/man2/kcmp.2:28
2142 #, no-wrap
2143 msgid "2013-12-08"
2144 msgstr ""
2145
2146 #. type: Plain text
2147 #: build/C/man2/kcmp.2:31
2148 msgid "kcmp - compare two processes to determine if they share a kernel resource"
2149 msgstr ""
2150
2151 #. type: Plain text
2152 #: build/C/man2/kcmp.2:34
2153 #, no-wrap
2154 msgid "B<#include E<lt>linux/kcmp.hE<gt>>\n"
2155 msgstr ""
2156
2157 #. type: Plain text
2158 #: build/C/man2/kcmp.2:37
2159 #, no-wrap
2160 msgid ""
2161 "B<int kcmp(pid_t >I<pid1>B<, pid_t >I<pid2>B<, int >I<type>B<,>\n"
2162 "B<         unsigned long >I<idx1>B<, unsigned long >I<idx2>B<);>\n"
2163 msgstr ""
2164
2165 #. type: Plain text
2166 #: build/C/man2/kcmp.2:41
2167 msgid "I<Note>: There is no glibc wrapper for this system call; see NOTES."
2168 msgstr ""
2169
2170 #. type: Plain text
2171 #: build/C/man2/kcmp.2:50
2172 msgid ""
2173 "The B<kcmp>()  system call can be used to check whether the two processes "
2174 "identified by I<pid1> and I<pid2> share a kernel resource such as virtual "
2175 "memory, file descriptors, and so on."
2176 msgstr ""
2177
2178 #. type: Plain text
2179 #: build/C/man2/kcmp.2:55
2180 msgid ""
2181 "The I<type> argument specifies which resource is to be compared in the two "
2182 "processes.  It has one of the following values:"
2183 msgstr ""
2184
2185 #. type: TP
2186 #: build/C/man2/kcmp.2:55
2187 #, no-wrap
2188 msgid "B<KCMP_FILE>"
2189 msgstr ""
2190
2191 #. type: Plain text
2192 #: build/C/man2/kcmp.2:67
2193 msgid ""
2194 "Check whether a file descriptor I<idx1> in the process I<pid1> refers to the "
2195 "same open file description (see B<open>(2))  as file descriptor I<idx2> in "
2196 "the process I<pid2>."
2197 msgstr ""
2198
2199 #. type: TP
2200 #: build/C/man2/kcmp.2:67
2201 #, no-wrap
2202 msgid "B<KCMP_FILES>"
2203 msgstr ""
2204
2205 #. type: Plain text
2206 #: build/C/man2/kcmp.2:75
2207 msgid ""
2208 "Check whether the process share the same set of open file descriptors.  The "
2209 "arguments I<idx1> and I<idx2> are ignored."
2210 msgstr ""
2211
2212 #. type: TP
2213 #: build/C/man2/kcmp.2:75
2214 #, no-wrap
2215 msgid "B<KCMP_FS>"
2216 msgstr ""
2217
2218 #. type: Plain text
2219 #: build/C/man2/kcmp.2:84
2220 msgid ""
2221 "Check whether the processes share the same filesystem information (i.e., "
2222 "file mode creation mask, working directory, and filesystem root).  The "
2223 "arguments I<idx1> and I<idx2> are ignored."
2224 msgstr ""
2225
2226 #. type: TP
2227 #: build/C/man2/kcmp.2:84
2228 #, no-wrap
2229 msgid "B<KCMP_IO>"
2230 msgstr ""
2231
2232 #. type: Plain text
2233 #: build/C/man2/kcmp.2:92
2234 msgid ""
2235 "Check whether the processes share I/O context.  The arguments I<idx1> and "
2236 "I<idx2> are ignored."
2237 msgstr ""
2238
2239 #. type: TP
2240 #: build/C/man2/kcmp.2:92
2241 #, no-wrap
2242 msgid "B<KCMP_SIGHAND>"
2243 msgstr ""
2244
2245 #. type: Plain text
2246 #: build/C/man2/kcmp.2:100
2247 msgid ""
2248 "Check whether the processes share the same table of signal dispositions.  "
2249 "The arguments I<idx1> and I<idx2> are ignored."
2250 msgstr ""
2251
2252 #. type: TP
2253 #: build/C/man2/kcmp.2:100
2254 #, no-wrap
2255 msgid "B<KCMP_SYSVSEM>"
2256 msgstr ""
2257
2258 #. type: Plain text
2259 #: build/C/man2/kcmp.2:109
2260 msgid ""
2261 "Check whether the processes share the same list of System\\ V semaphore undo "
2262 "operations.  The arguments I<idx1> and I<idx2> are ignored."
2263 msgstr ""
2264
2265 #. type: TP
2266 #: build/C/man2/kcmp.2:109
2267 #, no-wrap
2268 msgid "B<KCMP_VM>"
2269 msgstr ""
2270
2271 #. type: Plain text
2272 #: build/C/man2/kcmp.2:117
2273 msgid ""
2274 "Check whether the processes share the same address space.  The arguments "
2275 "I<idx1> and I<idx2> are ignored."
2276 msgstr ""
2277
2278 #. type: Plain text
2279 #: build/C/man2/kcmp.2:127
2280 msgid ""
2281 "Note the B<kcmp>()  is not protected against false positives which may occur "
2282 "if tasks are running.  One should stop tasks by sending B<SIGSTOP> (see "
2283 "B<signal>(7))  prior to inspection with this system call to obtain "
2284 "meaningful results."
2285 msgstr ""
2286
2287 #. type: Plain text
2288 #: build/C/man2/kcmp.2:133
2289 msgid ""
2290 "The return value of a successful call to B<kcmp>()  is simply the result of "
2291 "arithmetic comparison of kernel pointers (when the kernel compares "
2292 "resources, it uses their memory addresses)."
2293 msgstr ""
2294
2295 #. type: Plain text
2296 #: build/C/man2/kcmp.2:141
2297 msgid ""
2298 "The easiest way to explain is to consider an example.  Suppose that I<v1> "
2299 "and I<v2> are the addresses of appropriate resources, then the return value "
2300 "is one of the following:"
2301 msgstr ""
2302
2303 #. type: IP
2304 #: build/C/man2/kcmp.2:142
2305 #, no-wrap
2306 msgid "0"
2307 msgstr ""
2308
2309 #. type: Plain text
2310 #: build/C/man2/kcmp.2:147
2311 msgid ""
2312 "I<v1> is equal to I<v2>; in other words, the two processes share the "
2313 "resource."
2314 msgstr ""
2315
2316 #. type: IP
2317 #: build/C/man2/kcmp.2:147
2318 #, no-wrap
2319 msgid "1"
2320 msgstr ""
2321
2322 #. type: Plain text
2323 #: build/C/man2/kcmp.2:151
2324 msgid "I<v1> is less than I<v2>."
2325 msgstr ""
2326
2327 #. type: IP
2328 #: build/C/man2/kcmp.2:151
2329 #, no-wrap
2330 msgid "2"
2331 msgstr ""
2332
2333 #. type: Plain text
2334 #: build/C/man2/kcmp.2:155
2335 msgid "I<v1> is greater than I<v2>."
2336 msgstr ""
2337
2338 #. type: IP
2339 #: build/C/man2/kcmp.2:155
2340 #, no-wrap
2341 msgid "3"
2342 msgstr ""
2343
2344 #. type: Plain text
2345 #: build/C/man2/kcmp.2:160
2346 msgid "I<v1> is not equal to I<v2>, but ordering information is unavailable."
2347 msgstr ""
2348
2349 #. type: Plain text
2350 #: build/C/man2/kcmp.2:165
2351 msgid "On error, -1 is returned, and I<errno> is set appropriately."
2352 msgstr ""
2353
2354 #. type: Plain text
2355 #: build/C/man2/kcmp.2:170
2356 msgid ""
2357 "B<kcmp>()  was designed to return values suitable for sorting.  This is "
2358 "particularly handy if one needs to compare a large number of file "
2359 "descriptors."
2360 msgstr ""
2361
2362 #. type: TP
2363 #: build/C/man2/kcmp.2:171 build/C/man2/setns.2:146
2364 #, no-wrap
2365 msgid "B<EBADF>"
2366 msgstr ""
2367
2368 #. type: Plain text
2369 #: build/C/man2/kcmp.2:181
2370 msgid "I<type> is B<KCMP_FILE> and I<fd1> or I<fd2> is not an open file descriptor."
2371 msgstr ""
2372
2373 #. type: Plain text
2374 #: build/C/man2/kcmp.2:185
2375 msgid "I<type> is invalid."
2376 msgstr ""
2377
2378 #. type: Plain text
2379 #: build/C/man2/kcmp.2:191
2380 msgid ""
2381 "Insufficient permission to inspect process resources.  The B<CAP_SYS_PTRACE> "
2382 "capability is required to inspect processes that you do not own."
2383 msgstr ""
2384
2385 #. type: TP
2386 #: build/C/man2/kcmp.2:191 build/C/man2/sched_rr_get_interval.2:90 build/C/man2/sched_setaffinity.2:145 build/C/man2/sched_setattr.2:284 build/C/man2/sched_setparam.2:116 build/C/man2/sched_setscheduler.2:167
2387 #, no-wrap
2388 msgid "B<ESRCH>"
2389 msgstr ""
2390
2391 #. type: Plain text
2392 #: build/C/man2/kcmp.2:198
2393 msgid "Process I<pid1> or I<pid2> does not exist."
2394 msgstr ""
2395
2396 #. type: Plain text
2397 #: build/C/man2/kcmp.2:202
2398 msgid "The B<kcmp>()  system call first appeared in Linux 3.5."
2399 msgstr ""
2400
2401 #. type: Plain text
2402 #: build/C/man2/kcmp.2:205
2403 msgid ""
2404 "B<kcmp>()  is Linux-specific and should not be used in programs intended to "
2405 "be portable."
2406 msgstr ""
2407
2408 #. type: Plain text
2409 #: build/C/man2/kcmp.2:208
2410 msgid ""
2411 "Glibc does not provide a wrapper for this system call; call it using "
2412 "B<syscall>(2)."
2413 msgstr ""
2414
2415 #. type: Plain text
2416 #: build/C/man2/kcmp.2:217
2417 msgid ""
2418 "This system call is available only if the kernel was configured with "
2419 "B<CONFIG_CHECKPOINT_RESTORE>.  The main use of the system call is for the "
2420 "checkpoint/restore in user space (CRIU) feature.  The alternative to this "
2421 "system call would have been to expose suitable process information via the "
2422 "B<proc>(5)  filesystem; this was deemed to be unsuitable for security "
2423 "reasons."
2424 msgstr ""
2425
2426 #. type: Plain text
2427 #: build/C/man2/kcmp.2:222
2428 msgid ""
2429 "See B<clone>(2)  for some background information on the shared resources "
2430 "referred to on this page."
2431 msgstr ""
2432
2433 #. type: Plain text
2434 #: build/C/man2/kcmp.2:225
2435 msgid "B<clone>(2), B<unshare>(2)"
2436 msgstr ""
2437
2438 #. type: TH
2439 #: build/C/man2/sched_get_priority_max.2:29
2440 #, no-wrap
2441 msgid "SCHED_GET_PRIORITY_MAX"
2442 msgstr ""
2443
2444 #. type: TH
2445 #: build/C/man2/sched_get_priority_max.2:29
2446 #, no-wrap
2447 msgid "2014-05-12"
2448 msgstr ""
2449
2450 #. type: Plain text
2451 #: build/C/man2/sched_get_priority_max.2:32
2452 msgid "sched_get_priority_max, sched_get_priority_min - get static priority range"
2453 msgstr ""
2454
2455 #. type: Plain text
2456 #: 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
2457 msgid "B<#include E<lt>sched.hE<gt>>"
2458 msgstr ""
2459
2460 #. type: Plain text
2461 #: build/C/man2/sched_get_priority_max.2:36
2462 msgid "B<int sched_get_priority_max(int >I<policy>B<);>"
2463 msgstr ""
2464
2465 #. type: Plain text
2466 #: build/C/man2/sched_get_priority_max.2:38
2467 msgid "B<int sched_get_priority_min(int >I<policy>B<);>"
2468 msgstr ""
2469
2470 #. type: Plain text
2471 #: build/C/man2/sched_get_priority_max.2:59
2472 msgid ""
2473 "B<sched_get_priority_max>()  returns the maximum priority value that can be "
2474 "used with the scheduling algorithm identified by I<policy>.  "
2475 "B<sched_get_priority_min>()  returns the minimum priority value that can be "
2476 "used with the scheduling algorithm identified by I<policy>.  Supported "
2477 "I<policy> values are B<SCHED_FIFO>, B<SCHED_RR>, B<SCHED_OTHER>, "
2478 "B<SCHED_BATCH>, B<SCHED_IDLE>, and B<SCHED_DEADLINE>.  Further details about "
2479 "these policies can be found in B<sched>(7)."
2480 msgstr ""
2481
2482 #. type: Plain text
2483 #: build/C/man2/sched_get_priority_max.2:68
2484 msgid ""
2485 "Processes with numerically higher priority values are scheduled before "
2486 "processes with numerically lower priority values.  Thus, the value returned "
2487 "by B<sched_get_priority_max>()  will be greater than the value returned by "
2488 "B<sched_get_priority_min>()."
2489 msgstr ""
2490
2491 #. type: Plain text
2492 #: build/C/man2/sched_get_priority_max.2:76
2493 msgid ""
2494 "Linux allows the static priority range 1 to 99 for the B<SCHED_FIFO> and "
2495 "B<SCHED_RR> policies, and the priority 0 for the remaining policies.  "
2496 "Scheduling priority ranges for the various policies are not alterable."
2497 msgstr ""
2498
2499 #. type: Plain text
2500 #: build/C/man2/sched_get_priority_max.2:88
2501 msgid ""
2502 "The range of scheduling priorities may vary on other POSIX systems, thus it "
2503 "is a good idea for portable applications to use a virtual priority range and "
2504 "map it to the interval given by B<sched_get_priority_max>()  and "
2505 "B<sched_get_priority_min>().  POSIX.1-2001 requires a spread of at least 32 "
2506 "between the maximum and the minimum values for B<SCHED_FIFO> and "
2507 "B<SCHED_RR>."
2508 msgstr ""
2509
2510 #. type: Plain text
2511 #: build/C/man2/sched_get_priority_max.2:97
2512 msgid ""
2513 "POSIX systems on which B<sched_get_priority_max>()  and "
2514 "B<sched_get_priority_min>()  are available define "
2515 "B<_POSIX_PRIORITY_SCHEDULING> in I<E<lt>unistd.hE<gt>>."
2516 msgstr ""
2517
2518 #. type: Plain text
2519 #: build/C/man2/sched_get_priority_max.2:107
2520 msgid ""
2521 "On success, B<sched_get_priority_max>()  and B<sched_get_priority_min>()  "
2522 "return the maximum/minimum priority value for the named scheduling policy.  "
2523 "On error, -1 is returned, and I<errno> is set appropriately."
2524 msgstr ""
2525
2526 #. type: Plain text
2527 #: build/C/man2/sched_get_priority_max.2:113
2528 msgid "The argument I<policy> does not identify a defined scheduling policy."
2529 msgstr ""
2530
2531 #. type: Plain text
2532 #: build/C/man2/sched_get_priority_max.2:115 build/C/man2/sched_rr_get_interval.2:96 build/C/man2/sched_setparam.2:121 build/C/man2/sched_yield.2:54
2533 msgid "POSIX.1-2001."
2534 msgstr ""
2535
2536 #. type: Plain text
2537 #: build/C/man2/sched_get_priority_max.2:125
2538 msgid ""
2539 "B<sched_getaffinity>(2), B<sched_getparam>(2), B<sched_getscheduler>(2), "
2540 "B<sched_setaffinity>(2), B<sched_setparam>(2), B<sched_setscheduler>(2), "
2541 "B<sched>(7)"
2542 msgstr ""
2543
2544 #. type: TH
2545 #: build/C/man3/sched_getcpu.3:26
2546 #, no-wrap
2547 msgid "SCHED_GETCPU"
2548 msgstr ""
2549
2550 #. type: TH
2551 #: build/C/man3/sched_getcpu.3:26
2552 #, no-wrap
2553 msgid "2014-05-10"
2554 msgstr ""
2555
2556 #. type: Plain text
2557 #: build/C/man3/sched_getcpu.3:29
2558 msgid "sched_getcpu - determine CPU on which the calling thread is running"
2559 msgstr ""
2560
2561 #. type: Plain text
2562 #: build/C/man3/sched_getcpu.3:34
2563 #, no-wrap
2564 msgid "B<int sched_getcpu(void);>\n"
2565 msgstr ""
2566
2567 #. type: Plain text
2568 #: build/C/man3/sched_getcpu.3:39 build/C/man2/unshare.2:33
2569 msgid "Feature Test Macro Requirements for glibc (see B<feature_test_macros>(7)):"
2570 msgstr ""
2571
2572 #. type: Plain text
2573 #: build/C/man3/sched_getcpu.3:42
2574 msgid "B<sched_getcpu>():"
2575 msgstr ""
2576
2577 #. type: Plain text
2578 #: build/C/man3/sched_getcpu.3:58
2579 msgid ""
2580 "B<sched_getcpu>()  returns the number of the CPU on which the calling thread "
2581 "is currently executing."
2582 msgstr ""
2583
2584 #. type: Plain text
2585 #: build/C/man3/sched_getcpu.3:65
2586 msgid ""
2587 "On success, B<sched_getcpu>()  returns a nonnegative CPU number.  On error, "
2588 "-1 is returned and I<errno> is set to indicate the error."
2589 msgstr ""
2590
2591 #. type: TP
2592 #: build/C/man3/sched_getcpu.3:66 build/C/man2/sched_rr_get_interval.2:87
2593 #, no-wrap
2594 msgid "B<ENOSYS>"
2595 msgstr ""
2596
2597 #. type: Plain text
2598 #: build/C/man3/sched_getcpu.3:70
2599 msgid "This kernel does not implement B<getcpu>(2)."
2600 msgstr ""
2601
2602 #. type: Plain text
2603 #: build/C/man3/sched_getcpu.3:72
2604 msgid "This function is available since glibc 2.6."
2605 msgstr ""
2606
2607 #. type: SH
2608 #: build/C/man3/sched_getcpu.3:72
2609 #, no-wrap
2610 msgid "ATTRIBUTES"
2611 msgstr ""
2612
2613 #. type: SS
2614 #: build/C/man3/sched_getcpu.3:73
2615 #, no-wrap
2616 msgid "Multithreading (see pthreads(7))"
2617 msgstr ""
2618
2619 #. type: Plain text
2620 #: build/C/man3/sched_getcpu.3:77
2621 msgid "The B<sched_getcpu>()  function is thread-safe."
2622 msgstr ""
2623
2624 #. type: Plain text
2625 #: build/C/man3/sched_getcpu.3:80
2626 msgid "B<sched_getcpu>()  is glibc-specific."
2627 msgstr ""
2628
2629 #. type: Plain text
2630 #: build/C/man3/sched_getcpu.3:82
2631 msgid "The call"
2632 msgstr ""
2633
2634 #. type: Plain text
2635 #: build/C/man3/sched_getcpu.3:86
2636 #, no-wrap
2637 msgid "cpu = sched_getcpu();\n"
2638 msgstr ""
2639
2640 #. type: Plain text
2641 #: build/C/man3/sched_getcpu.3:92
2642 msgid "is equivalent to the following B<getcpu>(2)  call:"
2643 msgstr ""
2644
2645 #. type: Plain text
2646 #: build/C/man3/sched_getcpu.3:98
2647 #, no-wrap
2648 msgid ""
2649 "int c, s;\n"
2650 "s = getcpu(&c, NULL, NULL);\n"
2651 "cpu = (s == -1) ? s : c;\n"
2652 msgstr ""
2653
2654 #. type: Plain text
2655 #: build/C/man3/sched_getcpu.3:103
2656 msgid "B<getcpu>(2), B<sched>(7)"
2657 msgstr ""
2658
2659 #. type: TH
2660 #: build/C/man2/sched_rr_get_interval.2:29
2661 #, no-wrap
2662 msgid "SCHED_RR_GET_INTERVAL"
2663 msgstr ""
2664
2665 #. type: TH
2666 #: build/C/man2/sched_rr_get_interval.2:29 build/C/man2/sched_yield.2:29
2667 #, no-wrap
2668 msgid "2014-04-28"
2669 msgstr ""
2670
2671 #. type: Plain text
2672 #: build/C/man2/sched_rr_get_interval.2:32
2673 msgid "sched_rr_get_interval - get the SCHED_RR interval for the named process"
2674 msgstr ""
2675
2676 #. type: Plain text
2677 #: build/C/man2/sched_rr_get_interval.2:36
2678 msgid "B<int sched_rr_get_interval(pid_t >I<pid>B<, struct timespec * >I<tp>B<);>"
2679 msgstr ""
2680
2681 #. type: Plain text
2682 #: build/C/man2/sched_rr_get_interval.2:47
2683 msgid ""
2684 "B<sched_rr_get_interval>()  writes into the I<timespec> structure pointed to "
2685 "by I<tp> the round-robin time quantum for the process identified by I<pid>.  "
2686 "The specified process should be running under the B<SCHED_RR> scheduling "
2687 "policy."
2688 msgstr ""
2689
2690 #. type: Plain text
2691 #: build/C/man2/sched_rr_get_interval.2:51
2692 msgid "The I<timespec> structure has the following form:"
2693 msgstr ""
2694
2695 #. type: Plain text
2696 #: build/C/man2/sched_rr_get_interval.2:58
2697 #, no-wrap
2698 msgid ""
2699 "struct timespec {\n"
2700 "    time_t tv_sec;    /* seconds */\n"
2701 "    long   tv_nsec;   /* nanoseconds */\n"
2702 "};\n"
2703 msgstr ""
2704
2705 #.  FIXME . On Linux, sched_rr_get_interval()
2706 #.  returns the timeslice for SCHED_OTHER processes -- this timeslice
2707 #.  is influenced by the nice value.
2708 #.  For SCHED_FIFO processes, this always returns 0.
2709 #
2710 #.  The round-robin time quantum value is not alterable under Linux
2711 #.  1.3.81.
2712 #. type: Plain text
2713 #: build/C/man2/sched_rr_get_interval.2:73
2714 msgid ""
2715 "If I<pid> is zero, the time quantum for the calling process is written into "
2716 "I<*tp>."
2717 msgstr ""
2718
2719 #. type: Plain text
2720 #: build/C/man2/sched_rr_get_interval.2:80
2721 msgid ""
2722 "On success, B<sched_rr_get_interval>()  returns 0.  On error, -1 is "
2723 "returned, and I<errno> is set appropriately."
2724 msgstr ""
2725
2726 #. type: TP
2727 #: build/C/man2/sched_rr_get_interval.2:81 build/C/man2/sched_setaffinity.2:117
2728 #, no-wrap
2729 msgid "B<EFAULT>"
2730 msgstr ""
2731
2732 #. type: Plain text
2733 #: build/C/man2/sched_rr_get_interval.2:84
2734 msgid "Problem with copying information to user space."
2735 msgstr ""
2736
2737 #. type: Plain text
2738 #: build/C/man2/sched_rr_get_interval.2:87
2739 msgid "Invalid pid."
2740 msgstr ""
2741
2742 #. type: Plain text
2743 #: build/C/man2/sched_rr_get_interval.2:90
2744 msgid "The system call is not yet implemented (only on rather old kernels)."
2745 msgstr ""
2746
2747 #. type: Plain text
2748 #: build/C/man2/sched_rr_get_interval.2:94
2749 msgid "Could not find a process with the ID I<pid>."
2750 msgstr ""
2751
2752 #. type: Plain text
2753 #: build/C/man2/sched_rr_get_interval.2:103
2754 msgid ""
2755 "POSIX systems on which B<sched_rr_get_interval>()  is available define "
2756 "B<_POSIX_PRIORITY_SCHEDULING> in I<E<lt>unistd.hE<gt>>."
2757 msgstr ""
2758
2759 #. type: SS
2760 #: build/C/man2/sched_rr_get_interval.2:103
2761 #, no-wrap
2762 msgid "Linux notes"
2763 msgstr ""
2764
2765 #.  commit a4ec24b48ddef1e93f7578be53270f0b95ad666c
2766 #. type: Plain text
2767 #: build/C/man2/sched_rr_get_interval.2:117
2768 msgid ""
2769 "POSIX does not specify any mechanism for controlling the size of the "
2770 "round-robin time quantum.  Older Linux kernels provide a (nonportable) "
2771 "method of doing this.  The quantum can be controlled by adjusting the "
2772 "process's nice value (see B<setpriority>(2)).  Assigning a negative (i.e., "
2773 "high) nice value results in a longer quantum; assigning a positive (i.e., "
2774 "low) nice value results in a shorter quantum.  The default quantum is 0.1 "
2775 "seconds; the degree to which changing the nice value affects the quantum has "
2776 "varied somewhat across kernel versions.  This method of adjusting the "
2777 "quantum was removed starting with Linux 2.6.24."
2778 msgstr ""
2779
2780 #.  commit ce0dbbbb30aee6a835511d5be446462388ba9eee
2781 #.  .SH BUGS
2782 #.  As of Linux 1.3.81
2783 #.  .BR sched_rr_get_interval ()
2784 #.  returns with error
2785 #.  ENOSYS, because SCHED_RR has not yet been fully implemented and tested
2786 #.  properly.
2787 #. type: Plain text
2788 #: build/C/man2/sched_rr_get_interval.2:132
2789 msgid ""
2790 "Linux 3.9 added a new mechanism for adjusting (and viewing) the B<SCHED_RR> "
2791 "quantum: the I</proc/sys/kernel/sched_rr_timeslice_ms> file exposes the "
2792 "quantum as a millisecond value, whose default is 100.  Writing 0 to this "
2793 "file resets the quantum to the default value."
2794 msgstr ""
2795
2796 #. type: Plain text
2797 #: build/C/man2/sched_rr_get_interval.2:134 build/C/man2/sched_yield.2:81
2798 msgid "B<sched>(7)"
2799 msgstr ""
2800
2801 #. type: TH
2802 #: build/C/man2/sched_setaffinity.2:34
2803 #, no-wrap
2804 msgid "SCHED_SETAFFINITY"
2805 msgstr ""
2806
2807 #. type: TH
2808 #: build/C/man2/sched_setaffinity.2:34
2809 #, no-wrap
2810 msgid "2014-12-31"
2811 msgstr ""
2812
2813 #. type: Plain text
2814 #: build/C/man2/sched_setaffinity.2:38
2815 msgid ""
2816 "sched_setaffinity, sched_getaffinity - set and get a thread's CPU affinity "
2817 "mask"
2818 msgstr ""
2819
2820 #. type: Plain text
2821 #: build/C/man2/sched_setaffinity.2:45
2822 #, no-wrap
2823 msgid ""
2824 "B<int sched_setaffinity(pid_t >I<pid>B<, size_t >I<cpusetsize>B<,>\n"
2825 "B<                      const cpu_set_t *>I<mask>B<);>\n"
2826 msgstr ""
2827
2828 #. type: Plain text
2829 #: build/C/man2/sched_setaffinity.2:48
2830 #, no-wrap
2831 msgid ""
2832 "B<int sched_getaffinity(pid_t >I<pid>B<, size_t >I<cpusetsize>B<,>\n"
2833 "B<                      cpu_set_t *>I<mask>B<);>\n"
2834 msgstr ""
2835
2836 #. type: Plain text
2837 #: build/C/man2/sched_setaffinity.2:63
2838 msgid ""
2839 "A thread's CPU affinity mask determines the set of CPUs on which it is "
2840 "eligible to run.  On a multiprocessor system, setting the CPU affinity mask "
2841 "can be used to obtain performance benefits.  For example, by dedicating one "
2842 "CPU to a particular thread (i.e., setting the affinity mask of that thread "
2843 "to specify a single CPU, and setting the affinity mask of all other threads "
2844 "to exclude that CPU), it is possible to ensure maximum execution speed for "
2845 "that thread.  Restricting a thread to run on a single CPU also avoids the "
2846 "performance cost caused by the cache invalidation that occurs when a thread "
2847 "ceases to execute on one CPU and then recommences execution on a different "
2848 "CPU."
2849 msgstr ""
2850
2851 #. type: Plain text
2852 #: build/C/man2/sched_setaffinity.2:70
2853 msgid ""
2854 "A CPU affinity mask is represented by the I<cpu_set_t> structure, a \"CPU "
2855 "set\", pointed to by I<mask>.  A set of macros for manipulating CPU sets is "
2856 "described in B<CPU_SET>(3)."
2857 msgstr ""
2858
2859 #. type: Plain text
2860 #: build/C/man2/sched_setaffinity.2:85
2861 msgid ""
2862 "B<sched_setaffinity>()  sets the CPU affinity mask of the thread whose ID is "
2863 "I<pid> to the value specified by I<mask>.  If I<pid> is zero, then the "
2864 "calling thread is used.  The argument I<cpusetsize> is the length (in bytes) "
2865 "of the data pointed to by I<mask>.  Normally this argument would be "
2866 "specified as I<sizeof(cpu_set_t)>."
2867 msgstr ""
2868
2869 #. type: Plain text
2870 #: build/C/man2/sched_setaffinity.2:92
2871 msgid ""
2872 "If the thread specified by I<pid> is not currently running on one of the "
2873 "CPUs specified in I<mask>, then that thread is migrated to one of the CPUs "
2874 "specified in I<mask>."
2875 msgstr ""
2876
2877 #. type: Plain text
2878 #: build/C/man2/sched_setaffinity.2:107
2879 msgid ""
2880 "B<sched_getaffinity>()  writes the affinity mask of the thread whose ID is "
2881 "I<pid> into the I<cpu_set_t> structure pointed to by I<mask>.  The "
2882 "I<cpusetsize> argument specifies the size (in bytes) of I<mask>.  If I<pid> "
2883 "is zero, then the mask of the calling thread is returned."
2884 msgstr ""
2885
2886 #. type: Plain text
2887 #: build/C/man2/sched_setaffinity.2:116
2888 msgid ""
2889 "On success, B<sched_setaffinity>()  and B<sched_getaffinity>()  return 0.  "
2890 "On error, -1 is returned, and I<errno> is set appropriately."
2891 msgstr ""
2892
2893 #. type: Plain text
2894 #: build/C/man2/sched_setaffinity.2:120
2895 msgid "A supplied memory address was invalid."
2896 msgstr ""
2897
2898 #. type: Plain text
2899 #: build/C/man2/sched_setaffinity.2:128
2900 msgid ""
2901 "The affinity bit mask I<mask> contains no processors that are currently "
2902 "physically on the system and permitted to the thread according to any "
2903 "restrictions that may be imposed by the \"cpuset\" mechanism described in "
2904 "B<cpuset>(7)."
2905 msgstr ""
2906
2907 #. type: Plain text
2908 #: build/C/man2/sched_setaffinity.2:135
2909 msgid ""
2910 "(B<sched_getaffinity>()  and, in kernels before 2.6.9, "
2911 "B<sched_setaffinity>())  I<cpusetsize> is smaller than the size of the "
2912 "affinity mask used by the kernel."
2913 msgstr ""
2914
2915 #. type: Plain text
2916 #: build/C/man2/sched_setaffinity.2:145
2917 msgid ""
2918 "(B<sched_setaffinity>())  The calling thread does not have appropriate "
2919 "privileges.  The caller needs an effective user ID equal to the real user ID "
2920 "or effective user ID of the thread identified by I<pid>, or it must possess "
2921 "the B<CAP_SYS_NICE> capability."
2922 msgstr ""
2923
2924 #. type: Plain text
2925 #: build/C/man2/sched_setaffinity.2:148 build/C/man2/sched_setattr.2:289 build/C/man2/sched_setscheduler.2:170
2926 msgid "The thread whose ID is I<pid> could not be found."
2927 msgstr ""
2928
2929 #. type: Plain text
2930 #: build/C/man2/sched_setaffinity.2:159
2931 msgid ""
2932 "The CPU affinity system calls were introduced in Linux kernel 2.5.8.  The "
2933 "system call wrappers were introduced in glibc 2.3.  Initially, the glibc "
2934 "interfaces included a I<cpusetsize> argument, typed as I<unsigned int>.  In "
2935 "glibc 2.3.3, the I<cpusetsize> argument was removed, but was then restored "
2936 "in glibc 2.3.4, with type I<size_t>."
2937 msgstr ""
2938
2939 #. type: Plain text
2940 #: build/C/man2/sched_setaffinity.2:161
2941 msgid "These system calls are Linux-specific."
2942 msgstr ""
2943
2944 #. type: Plain text
2945 #: build/C/man2/sched_setaffinity.2:174
2946 msgid ""
2947 "After a call to B<sched_setaffinity>(), the set of CPUs on which the thread "
2948 "will actually run is the intersection of the set specified in the I<mask> "
2949 "argument and the set of CPUs actually present on the system.  The system may "
2950 "further restrict the set of CPUs on which the thread runs if the \"cpuset\" "
2951 "mechanism described in B<cpuset>(7)  is being used.  These restrictions on "
2952 "the actual set of CPUs on which the thread will run are silently imposed by "
2953 "the kernel."
2954 msgstr ""
2955
2956 #. type: Plain text
2957 #: build/C/man2/sched_setaffinity.2:186
2958 msgid ""
2959 "There are various ways of determining the number of CPUs available on the "
2960 "system, including: inspecting the contents of I</proc/cpuinfo>; using "
2961 "B<syconf>(3)  to obtain the values of the B<_SC_NPROCESSORS_CONF> and "
2962 "B<_SC_NPROCESSORS_ONLN> parameters; and inspecting the list CPU directories "
2963 "under I</sys/devices/system/cpu/>."
2964 msgstr ""
2965
2966 #. type: Plain text
2967 #: build/C/man2/sched_setaffinity.2:189
2968 msgid "B<sched>(7)  has a description of the Linux scheduling scheme."
2969 msgstr ""
2970
2971 #. type: Plain text
2972 #: build/C/man2/sched_setaffinity.2:206
2973 msgid ""
2974 "The affinity mask is a per-thread attribute that can be adjusted "
2975 "independently for each of the threads in a thread group.  The value returned "
2976 "from a call to B<gettid>(2)  can be passed in the argument I<pid>.  "
2977 "Specifying I<pid> as 0 will set the attribute for the calling thread, and "
2978 "passing the value returned from a call to B<getpid>(2)  will set the "
2979 "attribute for the main thread of the thread group.  (If you are using the "
2980 "POSIX threads API, then use B<pthread_setaffinity_np>(3)  instead of "
2981 "B<sched_setaffinity>().)"
2982 msgstr ""
2983
2984 #. type: Plain text
2985 #: build/C/man2/sched_setaffinity.2:212
2986 msgid ""
2987 "A child created via B<fork>(2)  inherits its parent's CPU affinity mask.  "
2988 "The affinity mask is preserved across an B<execve>(2)."
2989 msgstr ""
2990
2991 #. type: Plain text
2992 #: build/C/man2/sched_setaffinity.2:226
2993 msgid ""
2994 "This manual page describes the glibc interface for the CPU affinity calls.  "
2995 "The actual system call interface is slightly different, with the I<mask> "
2996 "being typed as I<unsigned long\\ *>, reflecting the fact that the underlying "
2997 "implementation of CPU sets is a simple bit mask.  On success, the raw "
2998 "B<sched_getaffinity>()  system call returns the size (in bytes) of the "
2999 "I<cpumask_t> data type that is used internally by the kernel to represent "
3000 "the CPU set bit mask."
3001 msgstr ""
3002
3003 #. type: Plain text
3004 #: build/C/man2/sched_setaffinity.2:248
3005 msgid ""
3006 "B<lscpu>(1), B<nproc>(1), B<taskset>(1), B<clone>(2), B<getcpu>(2), "
3007 "B<getpriority>(2), B<gettid>(2), B<nice>(2), B<sched_get_priority_max>(2), "
3008 "B<sched_get_priority_min>(2), B<sched_getscheduler>(2), "
3009 "B<sched_setscheduler>(2), B<setpriority>(2), B<CPU_SET>(3), "
3010 "B<pthread_setaffinity_np>(3), B<sched_getcpu>(3), B<capabilities>(7), "
3011 "B<cpuset>(7), B<sched>(7)"
3012 msgstr ""
3013
3014 #. type: TH
3015 #: build/C/man2/sched_setattr.2:26
3016 #, no-wrap
3017 msgid "SCHED_SETATTR"
3018 msgstr ""
3019
3020 #. type: TH
3021 #: build/C/man2/sched_setattr.2:26 build/C/man2/sched_setscheduler.2:26 build/C/man7/sched.7:32
3022 #, no-wrap
3023 msgid "2014-10-02"
3024 msgstr ""
3025
3026 #. type: Plain text
3027 #: build/C/man2/sched_setattr.2:30
3028 msgid "sched_setattr, sched_getattr - set and get scheduling policy and attributes"
3029 msgstr ""
3030
3031 #. type: Plain text
3032 #: build/C/man2/sched_setattr.2:36
3033 #, no-wrap
3034 msgid ""
3035 "B<int sched_setattr(pid_t >I<pid>B<, const struct sched_attr *>I<attr>B<,>\n"
3036 "B<                  unsigned int >I<flags>B<);>\n"
3037 msgstr ""
3038
3039 #. type: Plain text
3040 #: build/C/man2/sched_setattr.2:39
3041 #, no-wrap
3042 msgid ""
3043 "B<int sched_getattr(pid_t >I<pid>B<, const struct sched_attr *>I<attr>B<,>\n"
3044 "B<                  unsigned int >I<size>B<, unsigned int >I<flags>B<);>\n"
3045 msgstr ""
3046
3047 #. type: SS
3048 #: build/C/man2/sched_setattr.2:42
3049 #, no-wrap
3050 msgid "sched_setattr()"
3051 msgstr ""
3052
3053 #. type: Plain text
3054 #: build/C/man2/sched_setattr.2:52
3055 msgid ""
3056 "The B<sched_setattr>()  system call sets the scheduling policy and "
3057 "associated attributes for the thread whose ID is specified in I<pid>.  If "
3058 "I<pid> equals zero, the scheduling policy and attributes of the calling "
3059 "thread will be set."
3060 msgstr ""
3061
3062 #. type: Plain text
3063 #: build/C/man2/sched_setattr.2:56 build/C/man2/sched_setscheduler.2:73
3064 msgid ""
3065 "Currently, Linux supports the following \"normal\" (i.e., non-real-time) "
3066 "scheduling policies as values that may be specified in I<policy>:"
3067 msgstr ""
3068
3069 #. type: TP
3070 #: build/C/man2/sched_setattr.2:56 build/C/man2/sched_setscheduler.2:73
3071 #, no-wrap
3072 msgid "B<SCHED_OTHER>"
3073 msgstr ""
3074
3075 #.  In the 2.6 kernel sources, SCHED_OTHER is actually called
3076 #.  SCHED_NORMAL.
3077 #. type: Plain text
3078 #: build/C/man2/sched_setattr.2:61 build/C/man2/sched_setscheduler.2:78
3079 msgid "the standard round-robin time-sharing policy;"
3080 msgstr ""
3081
3082 #. type: TP
3083 #: build/C/man2/sched_setattr.2:61 build/C/man2/sched_setscheduler.2:78
3084 #, no-wrap
3085 msgid "B<SCHED_BATCH>"
3086 msgstr ""
3087
3088 #. type: Plain text
3089 #: build/C/man2/sched_setattr.2:64 build/C/man2/sched_setscheduler.2:81
3090 msgid "for \"batch\" style execution of processes; and"
3091 msgstr ""
3092
3093 #. type: TP
3094 #: build/C/man2/sched_setattr.2:64 build/C/man2/sched_setscheduler.2:81
3095 #, no-wrap
3096 msgid "B<SCHED_IDLE>"
3097 msgstr ""
3098
3099 #. type: Plain text
3100 #: build/C/man2/sched_setattr.2:69 build/C/man2/sched_setscheduler.2:86
3101 msgid "for running I<very> low priority background jobs."
3102 msgstr ""
3103
3104 #. type: Plain text
3105 #: build/C/man2/sched_setattr.2:78 build/C/man2/sched_setscheduler.2:99
3106 msgid ""
3107 "Various \"real-time\" policies are also supported, for special time-critical "
3108 "applications that need precise control over the way in which runnable "
3109 "threads are selected for execution.  For the rules governing when a process "
3110 "may use these policies, see B<sched>(7).  The real-time policies that may be "
3111 "specified in I<policy> are:"
3112 msgstr ""
3113
3114 #. type: TP
3115 #: build/C/man2/sched_setattr.2:78 build/C/man2/sched_setscheduler.2:99
3116 #, no-wrap
3117 msgid "B<SCHED_FIFO>"
3118 msgstr ""
3119
3120 #. type: Plain text
3121 #: build/C/man2/sched_setattr.2:81 build/C/man2/sched_setscheduler.2:102
3122 msgid "a first-in, first-out policy; and"
3123 msgstr ""
3124
3125 #. type: TP
3126 #: build/C/man2/sched_setattr.2:81 build/C/man2/sched_setscheduler.2:102
3127 #, no-wrap
3128 msgid "B<SCHED_RR>"
3129 msgstr ""
3130
3131 #. type: Plain text
3132 #: build/C/man2/sched_setattr.2:84 build/C/man2/sched_setscheduler.2:105
3133 msgid "a round-robin policy."
3134 msgstr ""
3135
3136 #. type: Plain text
3137 #: build/C/man2/sched_setattr.2:86
3138 msgid "Linux also provides the following policy:"
3139 msgstr ""
3140
3141 #. type: TP
3142 #: build/C/man2/sched_setattr.2:86
3143 #, no-wrap
3144 msgid "B<SCHED_DEADLINE>"
3145 msgstr ""
3146
3147 #. type: Plain text
3148 #: build/C/man2/sched_setattr.2:91
3149 msgid "a deadline scheduling policy; see B<sched>(7)  for details."
3150 msgstr ""
3151
3152 #. type: Plain text
3153 #: build/C/man2/sched_setattr.2:97
3154 msgid ""
3155 "The I<attr> argument is a pointer to a structure that defines the new "
3156 "scheduling policy and attributes for the specified thread.  This structure "
3157 "has the following form:"
3158 msgstr ""
3159
3160 #. type: Plain text
3161 #: build/C/man2/sched_setattr.2:113
3162 #, no-wrap
3163 msgid ""
3164 "struct sched_attr {\n"
3165 "    u32 size;              /* Size of this structure */\n"
3166 "    u32 sched_policy;      /* Policy (SCHED_*) */\n"
3167 "    u64 sched_flags;       /* Flags */\n"
3168 "    s32 sched_nice;        /* Nice value (SCHED_OTHER,\n"
3169 "                              SCHED_BATCH) */\n"
3170 "    u32 sched_priority;    /* Static priority (SCHED_FIFO,\n"
3171 "                              SCHED_RR) */\n"
3172 "    /* Remaining fields are for SCHED_DEADLINE */\n"
3173 "    u64 sched_runtime;\n"
3174 "    u64 sched_deadline;\n"
3175 "    u64 sched_period;\n"
3176 "};\n"
3177 msgstr ""
3178
3179 #. type: Plain text
3180 #: build/C/man2/sched_setattr.2:117
3181 msgid "The fields of this structure are as follows:"
3182 msgstr ""
3183
3184 #. type: TP
3185 #: build/C/man2/sched_setattr.2:117
3186 #, no-wrap
3187 msgid "B<size>"
3188 msgstr ""
3189
3190 #. type: Plain text
3191 #: build/C/man2/sched_setattr.2:132
3192 msgid ""
3193 "This field should be set to the size of the structure in bytes, as in "
3194 "I<sizeof(struct sched_attr)>.  If the provided structure is smaller than the "
3195 "kernel structure, any additional fields are assumed to be '0'.  If the "
3196 "provided structure is larger than the kernel structure, the kernel verifies "
3197 "that all additional fields are 0; if they are not, B<sched_setattr>()  fails "
3198 "with the error B<E2BIG> and updates I<size> to contain the size of the "
3199 "kernel structure."
3200 msgstr ""
3201
3202 #. type: Plain text
3203 #: build/C/man2/sched_setattr.2:146
3204 msgid ""
3205 "The above behavior when the size of the user-space I<sched_attr> structure "
3206 "does not match the size of the kernel structure allows for future "
3207 "extensibility of the interface.  Malformed applications that pass oversize "
3208 "structures won't break in the future if the size of the kernel I<sched_attr> "
3209 "structure is increased.  In the future, it could also allow applications "
3210 "that know about a larger user-space I<sched_attr> structure to determine "
3211 "whether they are running on an older kernel that does not support the larger "
3212 "structure."
3213 msgstr ""
3214
3215 #. type: TP
3216 #: build/C/man2/sched_setattr.2:146
3217 #, no-wrap
3218 msgid "I<sched_policy>"
3219 msgstr ""
3220
3221 #. type: Plain text
3222 #: build/C/man2/sched_setattr.2:151
3223 msgid ""
3224 "This field specifies the scheduling policy, as one of the B<SCHED_*> values "
3225 "listed above."
3226 msgstr ""
3227
3228 #. type: TP
3229 #: build/C/man2/sched_setattr.2:151
3230 #, no-wrap
3231 msgid "I<sched_flags>"
3232 msgstr ""
3233
3234 #. type: Plain text
3235 #: build/C/man2/sched_setattr.2:162
3236 msgid ""
3237 "This field contains flags controlling scheduling behavior.  Only one such "
3238 "flag is currently defined: B<SCHED_FLAG_RESET_ON_FORK>.  As a result of "
3239 "including this flag, children created by B<fork>(2)  do not inherit "
3240 "privileged scheduling policies.  See B<sched>(7)  for details."
3241 msgstr ""
3242
3243 #. type: TP
3244 #: build/C/man2/sched_setattr.2:162
3245 #, no-wrap
3246 msgid "I<sched_nice>"
3247 msgstr ""
3248
3249 #. type: Plain text
3250 #: build/C/man2/sched_setattr.2:173
3251 msgid ""
3252 "This field specifies the nice value to be set when specifying "
3253 "I<sched_policy> as B<SCHED_OTHER> or B<SCHED_BATCH>.  The nice value is a "
3254 "number in the range -20 (high priority)  to +19 (low priority); see "
3255 "B<setpriority>(2)."
3256 msgstr ""
3257
3258 #. type: TP
3259 #: build/C/man2/sched_setattr.2:173
3260 #, no-wrap
3261 msgid "I<sched_priority>"
3262 msgstr ""
3263
3264 #. type: Plain text
3265 #: build/C/man2/sched_setattr.2:186
3266 msgid ""
3267 "This field specifies the static priority to be set when specifying "
3268 "I<sched_policy> as B<SCHED_FIFO> or B<SCHED_RR>.  The allowed range of "
3269 "priorities for these policies can be determined using "
3270 "B<sched_get_priority_min>(2)  and B<sched_get_priority_max>(2).  For other "
3271 "policies, this field must be specified as 0."
3272 msgstr ""
3273
3274 #. type: TP
3275 #: build/C/man2/sched_setattr.2:186
3276 #, no-wrap
3277 msgid "I<sched_runtime>"
3278 msgstr ""
3279
3280 #. type: Plain text
3281 #: build/C/man2/sched_setattr.2:195
3282 msgid ""
3283 "This field specifies the \"Runtime\" parameter for deadline scheduling.  The "
3284 "value is expressed in nanoseconds.  This field, and the next two fields, are "
3285 "used only for B<SCHED_DEADLINE> scheduling; for further details, see "
3286 "B<sched>(7)."
3287 msgstr ""
3288
3289 #. type: TP
3290 #: build/C/man2/sched_setattr.2:195
3291 #, no-wrap
3292 msgid "I<sched_deadline>"
3293 msgstr ""
3294
3295 #. type: Plain text
3296 #: build/C/man2/sched_setattr.2:199
3297 msgid ""
3298 "This field specifies the \"Deadline\" parameter for deadline scheduling.  "
3299 "The value is expressed in nanoseconds."
3300 msgstr ""
3301
3302 #. type: TP
3303 #: build/C/man2/sched_setattr.2:199
3304 #, no-wrap
3305 msgid "I<sched_period>"
3306 msgstr ""
3307
3308 #. type: Plain text
3309 #: build/C/man2/sched_setattr.2:203
3310 msgid ""
3311 "This field specifies the \"Period\" parameter for deadline scheduling.  The "
3312 "value is expressed in nanoseconds."
3313 msgstr ""
3314
3315 #. type: Plain text
3316 #: build/C/man2/sched_setattr.2:210 build/C/man2/sched_setattr.2:262
3317 msgid ""
3318 "The I<flags> argument is provided to allow for future extensions to the "
3319 "interface; in the current implementation it must be specified as 0."
3320 msgstr ""
3321
3322 #. type: SS
3323 #: build/C/man2/sched_setattr.2:210
3324 #, no-wrap
3325 msgid "sched_getattr()"
3326 msgstr ""
3327
3328 #. type: Plain text
3329 #: build/C/man2/sched_setattr.2:221
3330 msgid ""
3331 "The B<sched_getattr>()  system call fetches the scheduling policy and the "
3332 "associated attributes for the thread whose ID is specified in I<pid>.  If "
3333 "I<pid> equals zero, the scheduling policy and attributes of the calling "
3334 "thread will be retrieved."
3335 msgstr ""
3336
3337 #. type: Plain text
3338 #: build/C/man2/sched_setattr.2:231
3339 msgid ""
3340 "The I<size> argument should be set to the size of the I<sched_attr> "
3341 "structure as known to user space.  The value must be at least as large as "
3342 "the size of the initially published I<sched_attr> structure, or the call "
3343 "fails with the error B<EINVAL>."
3344 msgstr ""
3345
3346 #. type: Plain text
3347 #: build/C/man2/sched_setattr.2:241
3348 msgid ""
3349 "The retrieved scheduling attributes are placed in the fields of the "
3350 "I<sched_attr> structure pointed to by I<attr>.  The kernel sets I<attr.size> "
3351 "to the size of its I<sched_attr> structure."
3352 msgstr ""
3353
3354 #. type: Plain text
3355 #: build/C/man2/sched_setattr.2:257
3356 msgid ""
3357 "If the caller-provided I<attr> buffer is larger than the kernel's "
3358 "I<sched_attr> structure, the additional bytes in the user-space structure "
3359 "are not touched.  If the caller-provided structure is smaller than the "
3360 "kernel I<sched_attr> structure and the kernel needs to return values outside "
3361 "the provided space, B<sched_getattr>()  fails with the error B<E2BIG>.  As "
3362 "with B<sched_setattr>(), these semantics allow for future extensibility of "
3363 "the interface."
3364 msgstr ""
3365
3366 #. type: Plain text
3367 #: build/C/man2/sched_setattr.2:271
3368 msgid ""
3369 "On success, B<sched_setattr>()  and B<sched_getattr>()  return 0.  On error, "
3370 "-1 is returned, and I<errno> is set to indicate the cause of the error."
3371 msgstr ""
3372
3373 #. type: Plain text
3374 #: build/C/man2/sched_setattr.2:276
3375 msgid ""
3376 "B<sched_getattr>()  and B<sched_setattr>()  can both fail for the following "
3377 "reasons:"
3378 msgstr ""
3379
3380 #. type: Plain text
3381 #: build/C/man2/sched_setattr.2:284
3382 msgid "I<attr> is NULL; or I<pid> is negative; or I<flags> is not zero."
3383 msgstr ""
3384
3385 #. type: Plain text
3386 #: build/C/man2/sched_setattr.2:293
3387 msgid "In addition, B<sched_getattr>()  can fail for the following reasons:"
3388 msgstr ""
3389
3390 #. type: TP
3391 #: build/C/man2/sched_setattr.2:293 build/C/man2/sched_setattr.2:310
3392 #, no-wrap
3393 msgid "B<E2BIG>"
3394 msgstr ""
3395
3396 #. type: Plain text
3397 #: build/C/man2/sched_setattr.2:300
3398 msgid "The buffer specified by I<size> and I<attr> is too small."
3399 msgstr ""
3400
3401 #. type: Plain text
3402 #: build/C/man2/sched_setattr.2:306
3403 msgid ""
3404 "I<size> is invalid; that is, it is smaller than the initial version of the "
3405 "I<sched_attr> structure (48 bytes) or larger than the system page size."
3406 msgstr ""
3407
3408 #. type: Plain text
3409 #: build/C/man2/sched_setattr.2:310
3410 msgid "In addition, B<sched_setattr>()  can fail for the following reasons:"
3411 msgstr ""
3412
3413 #. type: Plain text
3414 #: build/C/man2/sched_setattr.2:318
3415 msgid ""
3416 "The buffer specified by I<size> and I<attr> is larger than the kernel "
3417 "structure, and one or more of the excess bytes is nonzero."
3418 msgstr ""
3419
3420 #. type: TP
3421 #: build/C/man2/sched_setattr.2:318
3422 #, no-wrap
3423 msgid "B<EBUSY>"
3424 msgstr ""
3425
3426 #. type: Plain text
3427 #: build/C/man2/sched_setattr.2:323
3428 msgid "B<SCHED_DEADLINE> admission control failure, see B<sched>(7)."
3429 msgstr ""
3430
3431 #. type: Plain text
3432 #: build/C/man2/sched_setattr.2:339
3433 msgid ""
3434 "I<attr.sched_policy> is not one of the recognized policies; "
3435 "I<attr.sched_flags> contains a flag other than B<SCHED_FLAG_RESET_ON_FORK>; "
3436 "or I<attr.sched_priority> is invalid; or I<attr.sched_policy> is "
3437 "B<SCHED_DEADLINE> and the deadline scheduling parameters in I<attr> are "
3438 "invalid."
3439 msgstr ""
3440
3441 #. type: Plain text
3442 #: build/C/man2/sched_setattr.2:342
3443 msgid "The caller does not have appropriate privileges."
3444 msgstr ""
3445
3446 #. type: Plain text
3447 #: build/C/man2/sched_setattr.2:348
3448 msgid ""
3449 "The caller's CPU affinity mask does not include all CPUs in the system (see "
3450 "B<sched_setaffinity>(2))."
3451 msgstr ""
3452
3453 #.  FIXME . Add glibc version
3454 #. type: Plain text
3455 #: build/C/man2/sched_setattr.2:351
3456 msgid "These system calls first appeared in Linux 3.14."
3457 msgstr ""
3458
3459 #. type: Plain text
3460 #: build/C/man2/sched_setattr.2:353
3461 msgid "These system calls are nonstandard Linux extensions."
3462 msgstr ""
3463
3464 #. type: Plain text
3465 #: build/C/man2/sched_setattr.2:369
3466 msgid ""
3467 "B<sched_setattr>()  provides a superset of the functionality of "
3468 "B<sched_setscheduler>(2), B<sched_setparam>(2), B<nice>(2), and (other than "
3469 "the ability to set the priority of all processes belonging to a specified "
3470 "user or all processes in a specified group)  B<setpriority>(2).  "
3471 "Analogously, B<sched_getattr>()  provides a superset of the functionality of "
3472 "B<sched_getscheduler>(2), B<sched_getparam>(2), and (partially)  "
3473 "B<getpriority>(2)."
3474 msgstr ""
3475
3476 #.  FIXME . patch sent to Peter Zijlstra
3477 #.  In Linux versions up to up 3.15,
3478 #.  FIXME . patch from Peter Zijlstra pending
3479 #.  .BR sched_setattr ()
3480 #.  allowed a negative
3481 #.  .I attr.sched_policy
3482 #.  value.
3483 #. type: Plain text
3484 #: build/C/man2/sched_setattr.2:385
3485 msgid ""
3486 "In Linux versions up to 3.15, B<sched_settattr>()  failed with the error "
3487 "B<EFAULT> instead of B<E2BIG> for the case described in ERRORS."
3488 msgstr ""
3489
3490 #. type: Plain text
3491 #: build/C/man2/sched_setattr.2:407
3492 msgid ""
3493 "B<chrt>(1), B<nice>(2), B<sched_get_priority_max>(2), "
3494 "B<sched_get_priority_min>(2), B<sched_getaffinity>(2), "
3495 "B<sched_getscheduler>(2), B<sched_getparam>(2), B<sched_rr_get_interval>(2), "
3496 "B<sched_setaffinity>(2), B<sched_setscheduler>(2), B<sched_setparam>(2), "
3497 "B<sched_yield>(2), B<setpriority>(2), B<pthread_getschedparam>(3), "
3498 "B<pthread_setschedparam>(3), B<pthread_setschedprio>(3), B<capabilities>(7), "
3499 "B<cpuset>(7), B<sched>(7)"
3500 msgstr ""
3501
3502 #. type: TH
3503 #: build/C/man2/sched_setparam.2:30
3504 #, no-wrap
3505 msgid "SCHED_SETPARAM"
3506 msgstr ""
3507
3508 #. type: TH
3509 #: build/C/man2/sched_setparam.2:30
3510 #, no-wrap
3511 msgid "2014-05-11"
3512 msgstr ""
3513
3514 #. type: Plain text
3515 #: build/C/man2/sched_setparam.2:33
3516 msgid "sched_setparam, sched_getparam - set and get scheduling parameters"
3517 msgstr ""
3518
3519 #. type: Plain text
3520 #: build/C/man2/sched_setparam.2:38
3521 #, no-wrap
3522 msgid ""
3523 "B<int sched_setparam(pid_t >I<pid>B<, const struct sched_param "
3524 "*>I<param>B<);>\n"
3525 msgstr ""
3526
3527 #. type: Plain text
3528 #: build/C/man2/sched_setparam.2:40
3529 #, no-wrap
3530 msgid "B<int sched_getparam(pid_t >I<pid>B<, struct sched_param *>I<param>B<);>\n"
3531 msgstr ""
3532
3533 #. type: Plain text
3534 #: build/C/man2/sched_setparam.2:46
3535 #, no-wrap
3536 msgid ""
3537 "B<struct sched_param {\n"
3538 "    ...\n"
3539 "    int >I<sched_priority>B<;\n"
3540 "    ...\n"
3541 "};>\n"
3542 msgstr ""
3543
3544 #. type: Plain text
3545 #: build/C/man2/sched_setparam.2:60
3546 msgid ""
3547 "B<sched_setparam>()  sets the scheduling parameters associated with the "
3548 "scheduling policy for the process identified by I<pid>.  If I<pid> is zero, "
3549 "then the parameters of the calling process are set.  The interpretation of "
3550 "the argument I<param> depends on the scheduling policy of the process "
3551 "identified by I<pid>.  See B<sched>(7)  for a description of the scheduling "
3552 "policies supported under Linux."
3553 msgstr ""
3554
3555 #. type: Plain text
3556 #: build/C/man2/sched_setparam.2:66
3557 msgid ""
3558 "B<sched_getparam>()  retrieves the scheduling parameters for the process "
3559 "identified by I<pid>.  If I<pid> is zero, then the parameters of the calling "
3560 "process are retrieved."
3561 msgstr ""
3562
3563 #. type: Plain text
3564 #: build/C/man2/sched_setparam.2:75
3565 msgid ""
3566 "B<sched_setparam>()  checks the validity of I<param> for the scheduling "
3567 "policy of the thread.  The value I<param-E<gt>sched_priority> must lie "
3568 "within the range given by B<sched_get_priority_min>(2)  and "
3569 "B<sched_get_priority_max>(2)."
3570 msgstr ""
3571
3572 #. type: Plain text
3573 #: build/C/man2/sched_setparam.2:79
3574 msgid ""
3575 "For a discussion of the privileges and resource limits related to scheduling "
3576 "priority and policy, see B<sched>(7)."
3577 msgstr ""
3578
3579 #. type: Plain text
3580 #: build/C/man2/sched_setparam.2:87
3581 msgid ""
3582 "POSIX systems on which B<sched_setparam>()  and B<sched_getparam>()  are "
3583 "available define B<_POSIX_PRIORITY_SCHEDULING> in I<E<lt>unistd.hE<gt>>."
3584 msgstr ""
3585
3586 #. type: Plain text
3587 #: build/C/man2/sched_setparam.2:96
3588 msgid ""
3589 "On success, B<sched_setparam>()  and B<sched_getparam>()  return 0.  On "
3590 "error, -1 is returned, and I<errno> is set appropriately."
3591 msgstr ""
3592
3593 #. type: Plain text
3594 #: build/C/man2/sched_setparam.2:104
3595 msgid "Invalid arguments: I<param> is NULL or I<pid> is negative"
3596 msgstr ""
3597
3598 #. type: Plain text
3599 #: build/C/man2/sched_setparam.2:109
3600 msgid ""
3601 "(B<sched_setparam>())  The argument I<param> does not make sense for the "
3602 "current scheduling policy."
3603 msgstr ""
3604
3605 #. type: Plain text
3606 #: build/C/man2/sched_setparam.2:116
3607 msgid ""
3608 "(B<sched_setparam>())  The calling process does not have appropriate "
3609 "privileges (Linux: does not have the B<CAP_SYS_NICE> capability)."
3610 msgstr ""
3611
3612 #. type: Plain text
3613 #: build/C/man2/sched_setparam.2:119
3614 msgid "The process whose ID is I<pid> could not be found."
3615 msgstr ""
3616
3617 #. type: Plain text
3618 #: build/C/man2/sched_setparam.2:127
3619 msgid ""
3620 "Scheduling parameters are in fact per-thread attributes on Linux; see "
3621 "B<sched>(7)."
3622 msgstr ""
3623
3624 #. type: Plain text
3625 #: build/C/man2/sched_setparam.2:142
3626 msgid ""
3627 "B<getpriority>(2), B<nice>(2), B<sched_get_priority_max>(2), "
3628 "B<sched_get_priority_min>(2), B<sched_getaffinity>(2), "
3629 "B<sched_getscheduler>(2), B<sched_setaffinity>(2), B<sched_setscheduler>(2), "
3630 "B<sched_setattr>(2), B<setpriority>(2), B<capabilities>(7), B<sched>(7)"
3631 msgstr ""
3632
3633 #. type: TH
3634 #: build/C/man2/sched_setscheduler.2:26
3635 #, no-wrap
3636 msgid "SCHED_SETSCHEDULER"
3637 msgstr ""
3638
3639 #. type: Plain text
3640 #: build/C/man2/sched_setscheduler.2:30
3641 msgid ""
3642 "sched_setscheduler, sched_getscheduler - set and get scheduling "
3643 "policy/parameters"
3644 msgstr ""
3645
3646 #. type: Plain text
3647 #: build/C/man2/sched_setscheduler.2:35
3648 #, no-wrap
3649 msgid "B<int sched_setscheduler(pid_t >I<pid>B<, int >I<policy>B<,>\n"
3650 msgstr ""
3651
3652 #. type: Plain text
3653 #: build/C/man2/sched_setscheduler.2:37
3654 #, no-wrap
3655 msgid "B<                       const struct sched_param *>I<param>B<);>\n"
3656 msgstr ""
3657
3658 #. type: Plain text
3659 #: build/C/man2/sched_setscheduler.2:39
3660 #, no-wrap
3661 msgid "B<int sched_getscheduler(pid_t >I<pid>B<);>\n"
3662 msgstr ""
3663
3664 #. type: Plain text
3665 #: build/C/man2/sched_setscheduler.2:49
3666 msgid ""
3667 "The B<sched_setscheduler>()  system call sets both the scheduling policy and "
3668 "parameters for the thread whose ID is specified in I<pid>.  If I<pid> equals "
3669 "zero, the scheduling policy and parameters of the calling thread will be "
3670 "set."
3671 msgstr ""
3672
3673 #. type: Plain text
3674 #: build/C/man2/sched_setscheduler.2:53
3675 msgid ""
3676 "The scheduling parameters are specified in the I<param> argument, which is a "
3677 "pointer to a structure of the following form:"
3678 msgstr ""
3679
3680 #. type: Plain text
3681 #: build/C/man2/sched_setscheduler.2:61
3682 #, no-wrap
3683 msgid ""
3684 "struct sched_param {\n"
3685 "    ...\n"
3686 "    int sched_priority;\n"
3687 "    ...\n"
3688 "};\n"
3689 msgstr ""
3690
3691 #. type: Plain text
3692 #: build/C/man2/sched_setscheduler.2:69
3693 msgid ""
3694 "In the current implementation, the structure contains only one field, "
3695 "I<sched_priority>.  The interpretation of I<param> depends on the selected "
3696 "policy."
3697 msgstr ""
3698
3699 #. type: Plain text
3700 #: build/C/man2/sched_setscheduler.2:90
3701 msgid "For each of the above policies, I<param-E<gt>sched_priority> must be 0."
3702 msgstr ""
3703
3704 #. type: Plain text
3705 #: build/C/man2/sched_setscheduler.2:116
3706 msgid ""
3707 "For each of the above policies, I<param-E<gt>sched_priority> specifies a "
3708 "scheduling priority for the thread.  This is a number in the range returned "
3709 "by calling B<sched_get_priority_min>(2)  and B<sched_get_priority_max>(2)  "
3710 "with the specified I<policy>.  On Linux, these system calls return, "
3711 "respectively, 1 and 99."
3712 msgstr ""
3713
3714 #. type: Plain text
3715 #: build/C/man2/sched_setscheduler.2:129
3716 msgid ""
3717 "Since Linux 2.6.32, the B<SCHED_RESET_ON_FORK> flag can be ORed in I<policy> "
3718 "when calling B<sched_setscheduler>().  As a result of including this flag, "
3719 "children created by B<fork>(2)  do not inherit privileged scheduling "
3720 "policies.  See B<sched>(7)  for details."
3721 msgstr ""
3722
3723 #. type: Plain text
3724 #: build/C/man2/sched_setscheduler.2:135
3725 msgid ""
3726 "B<sched_getscheduler>()  returns the current scheduling policy of the thread "
3727 "identified by I<pid>.  If I<pid> equals zero, the policy of the calling "
3728 "thread will be retrieved."
3729 msgstr ""
3730
3731 #. type: Plain text
3732 #: build/C/man2/sched_setscheduler.2:145
3733 msgid ""
3734 "On success, B<sched_setscheduler>()  returns zero.  On success, "
3735 "B<sched_getscheduler>()  returns the policy for the thread (a nonnegative "
3736 "integer).  On error, both calls return -1, and I<errno> is set "
3737 "appropriately."
3738 msgstr ""
3739
3740 #. type: Plain text
3741 #: build/C/man2/sched_setscheduler.2:153
3742 msgid "Invalid arguments: I<pid> is negative or I<param> is NULL."
3743 msgstr ""
3744
3745 #. type: Plain text
3746 #: build/C/man2/sched_setscheduler.2:158
3747 msgid "(B<sched_setscheduler>())  I<policy> is not one of the recognized policies."
3748 msgstr ""
3749
3750 #. type: Plain text
3751 #: build/C/man2/sched_setscheduler.2:164
3752 msgid ""
3753 "(B<sched_setscheduler>())  I<param> does not make sense for the specified "
3754 "I<policy>."
3755 msgstr ""
3756
3757 #. type: Plain text
3758 #: build/C/man2/sched_setscheduler.2:167
3759 msgid "The calling thread does not have appropriate privileges."
3760 msgstr ""
3761
3762 #. type: Plain text
3763 #: build/C/man2/sched_setscheduler.2:173
3764 msgid ""
3765 "POSIX.1-2001 (but see BUGS below).  The B<SCHED_BATCH> and B<SCHED_IDLE> "
3766 "policies are Linux-specific."
3767 msgstr ""
3768
3769 #. type: Plain text
3770 #: build/C/man2/sched_setscheduler.2:177
3771 msgid ""
3772 "Further details of the semantics of all of the above \"normal\" and "
3773 "\"real-time\" scheduling policies can be found in B<sched>(7)."
3774 msgstr ""
3775
3776 #. type: Plain text
3777 #: build/C/man2/sched_setscheduler.2:185
3778 msgid ""
3779 "POSIX systems on which B<sched_setscheduler>()  and B<sched_getscheduler>()  "
3780 "are available define B<_POSIX_PRIORITY_SCHEDULING> in I<E<lt>unistd.hE<gt>>."
3781 msgstr ""
3782
3783 #. type: Plain text
3784 #: build/C/man2/sched_setscheduler.2:193
3785 msgid ""
3786 "POSIX.1 does not detail the permissions that an unprivileged thread requires "
3787 "in order to call B<sched_setscheduler>(), and details vary across systems.  "
3788 "For example, the Solaris 7 manual page says that the real or effective user "
3789 "ID of the caller must match the real user ID or the save set-user-ID of the "
3790 "target."
3791 msgstr ""
3792
3793 #. type: Plain text
3794 #: build/C/man2/sched_setscheduler.2:214
3795 msgid ""
3796 "The scheduling policy and parameters are in fact per-thread attributes on "
3797 "Linux.  The value returned from a call to B<gettid>(2)  can be passed in the "
3798 "argument I<pid>.  Specifying I<pid> as 0 will operate on the attributes of "
3799 "the calling thread, and passing the value returned from a call to "
3800 "B<getpid>(2)  will operate on the attributes of the main thread of the "
3801 "thread group.  (If you are using the POSIX threads API, then use "
3802 "B<pthread_setschedparam>(3), B<pthread_getschedparam>(3), and "
3803 "B<pthread_setschedprio>(3), instead of the B<sched_*>(2)  system calls.)"
3804 msgstr ""
3805
3806 #. type: Plain text
3807 #: build/C/man2/sched_setscheduler.2:222
3808 msgid ""
3809 "POSIX says that on success, B<sched_setscheduler>()  should return the "
3810 "previous scheduling policy.  Linux B<sched_setscheduler>()  does not conform "
3811 "to this requirement, since it always returns 0 on success."
3812 msgstr ""
3813
3814 #. type: Plain text
3815 #: build/C/man2/sched_setscheduler.2:241
3816 msgid ""
3817 "B<chrt>(1), B<nice>(2), B<sched_get_priority_max>(2), "
3818 "B<sched_get_priority_min>(2), B<sched_getaffinity>(2), B<sched_getattr>(2), "
3819 "B<sched_getparam>(2), B<sched_rr_get_interval>(2), B<sched_setaffinity>(2), "
3820 "B<sched_setattr>(2), B<sched_setparam>(2), B<sched_yield>(2), "
3821 "B<setpriority>(2), B<capabilities>(7), B<cpuset>(7), B<sched>(7)"
3822 msgstr ""
3823
3824 #. type: TH
3825 #: build/C/man2/sched_yield.2:29
3826 #, no-wrap
3827 msgid "SCHED_YIELD"
3828 msgstr ""
3829
3830 #. type: Plain text
3831 #: build/C/man2/sched_yield.2:32
3832 msgid "sched_yield - yield the processor"
3833 msgstr ""
3834
3835 #. type: Plain text
3836 #: build/C/man2/sched_yield.2:36
3837 msgid "B<int sched_yield(void);>"
3838 msgstr ""
3839
3840 #. type: Plain text
3841 #: build/C/man2/sched_yield.2:41
3842 msgid ""
3843 "B<sched_yield>()  causes the calling thread to relinquish the CPU.  The "
3844 "thread is moved to the end of the queue for its static priority and a new "
3845 "thread gets to run."
3846 msgstr ""
3847
3848 #. type: Plain text
3849 #: build/C/man2/sched_yield.2:48
3850 msgid ""
3851 "On success, B<sched_yield>()  returns 0.  On error, -1 is returned, and "
3852 "I<errno> is set appropriately."
3853 msgstr ""
3854
3855 #. type: Plain text
3856 #: build/C/man2/sched_yield.2:52
3857 msgid "In the Linux implementation, B<sched_yield>()  always succeeds."
3858 msgstr ""
3859
3860 #. type: Plain text
3861 #: build/C/man2/sched_yield.2:59
3862 msgid ""
3863 "If the calling thread is the only thread in the highest priority list at "
3864 "that time, it will continue to run after a call to B<sched_yield>()."
3865 msgstr ""
3866
3867 #. type: Plain text
3868 #: build/C/man2/sched_yield.2:66
3869 msgid ""
3870 "POSIX systems on which B<sched_yield>()  is available define "
3871 "B<_POSIX_PRIORITY_SCHEDULING> in I<E<lt>unistd.hE<gt>>."
3872 msgstr ""
3873
3874 #. type: Plain text
3875 #: build/C/man2/sched_yield.2:79
3876 msgid ""
3877 "Strategic calls to B<sched_yield>()  can improve performance by giving other "
3878 "threads or processes a chance to run when (heavily) contended resources "
3879 "(e.g., mutexes)  have been released by the caller.  Avoid calling "
3880 "B<sched_yield>()  unnecessarily or inappropriately (e.g., when resources "
3881 "needed by other schedulable threads are still held by the caller), since "
3882 "doing so will result in unnecessary context switches, which will degrade "
3883 "system performance."
3884 msgstr ""
3885
3886 #. type: TH
3887 #: build/C/man7/sched.7:32
3888 #, no-wrap
3889 msgid "SCHED"
3890 msgstr ""
3891
3892 #. type: Plain text
3893 #: build/C/man7/sched.7:35
3894 msgid "sched - overview of scheduling APIs"
3895 msgstr ""
3896
3897 #. type: SS
3898 #: build/C/man7/sched.7:36
3899 #, no-wrap
3900 msgid "API summary"
3901 msgstr ""
3902
3903 #. type: Plain text
3904 #: build/C/man7/sched.7:38
3905 msgid "The Linux scheduling APIs are as follows:"
3906 msgstr ""
3907
3908 #. type: TP
3909 #: build/C/man7/sched.7:38
3910 #, no-wrap
3911 msgid "B<sched_setscheduler>(2)"
3912 msgstr ""
3913
3914 #. type: Plain text
3915 #: build/C/man7/sched.7:41
3916 msgid "Set the scheduling policy and parameters of a specified thread."
3917 msgstr ""
3918
3919 #. type: TP
3920 #: build/C/man7/sched.7:41
3921 #, no-wrap
3922 msgid "B<sched_getscheduler>(2)"
3923 msgstr ""
3924
3925 #. type: Plain text
3926 #: build/C/man7/sched.7:44
3927 msgid "Return the scheduling policy of a specified thread."
3928 msgstr ""
3929
3930 #. type: TP
3931 #: build/C/man7/sched.7:44
3932 #, no-wrap
3933 msgid "B<sched_setparam>(2)"
3934 msgstr ""
3935
3936 #. type: Plain text
3937 #: build/C/man7/sched.7:47
3938 msgid "Set the scheduling parameters of a specified thread."
3939 msgstr ""
3940
3941 #. type: TP
3942 #: build/C/man7/sched.7:47
3943 #, no-wrap
3944 msgid "B<sched_getparam>(2)"
3945 msgstr ""
3946
3947 #. type: Plain text
3948 #: build/C/man7/sched.7:50
3949 msgid "Fetch the scheduling parameters of a specified thread."
3950 msgstr ""
3951
3952 #. type: TP
3953 #: build/C/man7/sched.7:50
3954 #, no-wrap
3955 msgid "B<sched_get_priority_max>(2)"
3956 msgstr ""
3957
3958 #. type: Plain text
3959 #: build/C/man7/sched.7:53
3960 msgid "Return the minimum priority available in a specified scheduling policy."
3961 msgstr ""
3962
3963 #. type: TP
3964 #: build/C/man7/sched.7:53
3965 #, no-wrap
3966 msgid "B<sched_get_priority_min>(2)"
3967 msgstr ""
3968
3969 #. type: Plain text
3970 #: build/C/man7/sched.7:56
3971 msgid "Return the maximum priority available in a specified scheduling policy."
3972 msgstr ""
3973
3974 #. type: TP
3975 #: build/C/man7/sched.7:56
3976 #, no-wrap
3977 msgid "B<sched_rr_get_interval>(2)"
3978 msgstr ""
3979
3980 #. type: Plain text
3981 #: build/C/man7/sched.7:60
3982 msgid ""
3983 "Fetch the quantum used for threads that are scheduled under the "
3984 "\"round-robin\" scheduling policy."
3985 msgstr ""
3986
3987 #. type: TP
3988 #: build/C/man7/sched.7:60
3989 #, no-wrap
3990 msgid "B<sched_yield>(2)"
3991 msgstr ""
3992
3993 #. type: Plain text
3994 #: build/C/man7/sched.7:64
3995 msgid ""
3996 "Cause the caller to relinquish the CPU, so that some other thread be "
3997 "executed."
3998 msgstr ""
3999
4000 #. type: TP
4001 #: build/C/man7/sched.7:64
4002 #, no-wrap
4003 msgid "B<sched_setaffinity>(2)"
4004 msgstr ""
4005
4006 #. type: Plain text
4007 #: build/C/man7/sched.7:68
4008 msgid "(Linux-specific)  Set the CPU affinity of a specified thread."
4009 msgstr ""
4010
4011 #. type: TP
4012 #: build/C/man7/sched.7:68
4013 #, no-wrap
4014 msgid "B<sched_getaffinity>(2)"
4015 msgstr ""
4016
4017 #. type: Plain text
4018 #: build/C/man7/sched.7:72
4019 msgid "(Linux-specific)  Get the CPU affinity of a specified thread."
4020 msgstr ""
4021
4022 #. type: TP
4023 #: build/C/man7/sched.7:72
4024 #, no-wrap
4025 msgid "B<sched_setattr>(2)"
4026 msgstr ""
4027
4028 #. type: Plain text
4029 #: build/C/man7/sched.7:79
4030 msgid ""
4031 "Set the scheduling policy and parameters of a specified thread.  This "
4032 "(Linux-specific) system call provides a superset of the functionality of "
4033 "B<sched_setscheduler>(2)  and B<sched_setparam>(2)."
4034 msgstr ""
4035
4036 #. type: TP
4037 #: build/C/man7/sched.7:79
4038 #, no-wrap
4039 msgid "B<sched_getattr>(2)"
4040 msgstr ""
4041
4042 #. type: Plain text
4043 #: build/C/man7/sched.7:87
4044 msgid ""
4045 "Fetch the scheduling policy and parameters of a specified thread.  This "
4046 "(Linux-specific) system call provides a superset of the functionality of "
4047 "B<sched_getscheduler>(2)  and B<sched_getparam>(2)."
4048 msgstr ""
4049
4050 #. type: SS
4051 #: build/C/man7/sched.7:87
4052 #, no-wrap
4053 msgid "Scheduling policies"
4054 msgstr ""
4055
4056 #. type: Plain text
4057 #: build/C/man7/sched.7:95
4058 msgid ""
4059 "The scheduler is the kernel component that decides which runnable thread "
4060 "will be executed by the CPU next.  Each thread has an associated scheduling "
4061 "policy and a I<static> scheduling priority, I<sched_priority>.  The "
4062 "scheduler makes its decisions based on knowledge of the scheduling policy "
4063 "and static priority of all threads on the system."
4064 msgstr ""
4065
4066 #. type: Plain text
4067 #: build/C/man7/sched.7:100
4068 msgid ""
4069 "For threads scheduled under one of the normal scheduling policies "
4070 "(B<SCHED_OTHER>, B<SCHED_IDLE>, B<SCHED_BATCH>), I<sched_priority> is not "
4071 "used in scheduling decisions (it must be specified as 0)."
4072 msgstr ""
4073
4074 #. type: Plain text
4075 #: build/C/man7/sched.7:114
4076 msgid ""
4077 "Processes scheduled under one of the real-time policies (B<SCHED_FIFO>, "
4078 "B<SCHED_RR>) have a I<sched_priority> value in the range 1 (low) to 99 "
4079 "(high).  (As the numbers imply, real-time threads always have higher "
4080 "priority than normal threads.)  Note well: POSIX.1-2001 requires an "
4081 "implementation to support only a minimum 32 distinct priority levels for the "
4082 "real-time policies, and some systems supply just this minimum.  Portable "
4083 "programs should use B<sched_get_priority_min>(2)  and "
4084 "B<sched_get_priority_max>(2)  to find the range of priorities supported for "
4085 "a particular policy."
4086 msgstr ""
4087
4088 #. type: Plain text
4089 #: build/C/man7/sched.7:120
4090 msgid ""
4091 "Conceptually, the scheduler maintains a list of runnable threads for each "
4092 "possible I<sched_priority> value.  In order to determine which thread runs "
4093 "next, the scheduler looks for the nonempty list with the highest static "
4094 "priority and selects the thread at the head of this list."
4095 msgstr ""
4096
4097 #. type: Plain text
4098 #: build/C/man7/sched.7:124
4099 msgid ""
4100 "A thread's scheduling policy determines where it will be inserted into the "
4101 "list of threads with equal static priority and how it will move inside this "
4102 "list."
4103 msgstr ""
4104
4105 #. type: Plain text
4106 #: build/C/man7/sched.7:132
4107 msgid ""
4108 "All scheduling is preemptive: if a thread with a higher static priority "
4109 "becomes ready to run, the currently running thread will be preempted and "
4110 "returned to the wait list for its static priority level.  The scheduling "
4111 "policy determines the ordering only within the list of runnable threads with "
4112 "equal static priority."
4113 msgstr ""
4114
4115 #. type: SS
4116 #: build/C/man7/sched.7:132
4117 #, no-wrap
4118 msgid "SCHED_FIFO: First in-first out scheduling"
4119 msgstr ""
4120
4121 #. type: Plain text
4122 #: build/C/man7/sched.7:141
4123 msgid ""
4124 "B<SCHED_FIFO> can be used only with static priorities higher than 0, which "
4125 "means that when a B<SCHED_FIFO> threads becomes runnable, it will always "
4126 "immediately preempt any currently running B<SCHED_OTHER>, B<SCHED_BATCH>, or "
4127 "B<SCHED_IDLE> thread.  B<SCHED_FIFO> is a simple scheduling algorithm "
4128 "without time slicing.  For threads scheduled under the B<SCHED_FIFO> policy, "
4129 "the following rules apply:"
4130 msgstr ""
4131
4132 #. type: IP
4133 #: build/C/man7/sched.7:141 build/C/man7/sched.7:146 build/C/man7/sched.7:149 build/C/man7/sched.7:164 build/C/man7/sched.7:412 build/C/man7/sched.7:421 build/C/man7/sched.7:444 build/C/man7/sched.7:452 build/C/man7/sched.7:491 build/C/man7/sched.7:499 build/C/man7/sched.7:504 build/C/man7/sched.7:509
4134 #, no-wrap
4135 msgid "*"
4136 msgstr ""
4137
4138 #. type: Plain text
4139 #: build/C/man7/sched.7:146
4140 msgid ""
4141 "A B<SCHED_FIFO> thread that has been preempted by another thread of higher "
4142 "priority will stay at the head of the list for its priority and will resume "
4143 "execution as soon as all threads of higher priority are blocked again."
4144 msgstr ""
4145
4146 #. type: Plain text
4147 #: build/C/man7/sched.7:149
4148 msgid ""
4149 "When a B<SCHED_FIFO> thread becomes runnable, it will be inserted at the end "
4150 "of the list for its priority."
4151 msgstr ""
4152
4153 #.  In 2.2.x and 2.4.x, the thread is placed at the front of the queue
4154 #.  In 2.0.x, the Right Thing happened: the thread went to the back -- MTK
4155 #. type: Plain text
4156 #: build/C/man7/sched.7:164
4157 msgid ""
4158 "A call to B<sched_setscheduler>(2), B<sched_setparam>(2), or "
4159 "B<sched_setattr>(2)  will put the B<SCHED_FIFO> (or B<SCHED_RR>) thread "
4160 "identified by I<pid> at the start of the list if it was runnable.  As a "
4161 "consequence, it may preempt the currently running thread if it has the same "
4162 "priority.  (POSIX.1-2001 specifies that the thread should go to the end of "
4163 "the list.)"
4164 msgstr ""
4165
4166 #. type: Plain text
4167 #: build/C/man7/sched.7:168
4168 msgid "A thread calling B<sched_yield>(2)  will be put at the end of the list."
4169 msgstr ""
4170
4171 #. type: Plain text
4172 #: build/C/man7/sched.7:172
4173 msgid ""
4174 "No other events will move a thread scheduled under the B<SCHED_FIFO> policy "
4175 "in the wait list of runnable threads with equal static priority."
4176 msgstr ""
4177
4178 #. type: Plain text
4179 #: build/C/man7/sched.7:177
4180 msgid ""
4181 "A B<SCHED_FIFO> thread runs until either it is blocked by an I/O request, it "
4182 "is preempted by a higher priority thread, or it calls B<sched_yield>(2)."
4183 msgstr ""
4184
4185 #. type: SS
4186 #: build/C/man7/sched.7:177
4187 #, no-wrap
4188 msgid "SCHED_RR: Round-robin scheduling"
4189 msgstr ""
4190
4191 #.  On Linux 2.4, the length of the RR interval is influenced
4192 #.  by the process nice value -- MTK
4193 #. type: Plain text
4194 #: build/C/man7/sched.7:196
4195 msgid ""
4196 "B<SCHED_RR> is a simple enhancement of B<SCHED_FIFO>.  Everything described "
4197 "above for B<SCHED_FIFO> also applies to B<SCHED_RR>, except that each thread "
4198 "is allowed to run only for a maximum time quantum.  If a B<SCHED_RR> thread "
4199 "has been running for a time period equal to or longer than the time quantum, "
4200 "it will be put at the end of the list for its priority.  A B<SCHED_RR> "
4201 "thread that has been preempted by a higher priority thread and subsequently "
4202 "resumes execution as a running thread will complete the unexpired portion of "
4203 "its round-robin time quantum.  The length of the time quantum can be "
4204 "retrieved using B<sched_rr_get_interval>(2)."
4205 msgstr ""
4206
4207 #. type: SS
4208 #: build/C/man7/sched.7:196
4209 #, no-wrap
4210 msgid "SCHED_DEADLINE: Sporadic task model deadline scheduling"
4211 msgstr ""
4212
4213 #. type: Plain text
4214 #: build/C/man7/sched.7:208
4215 msgid ""
4216 "Since version 3.14, Linux provides a deadline scheduling policy "
4217 "(B<SCHED_DEADLINE>).  This policy is currently implemented using GEDF "
4218 "(Global Earliest Deadline First)  in conjunction with CBS (Constant "
4219 "Bandwidth Server).  To set and fetch this policy and associated attributes, "
4220 "one must use the Linux-specific B<sched_setattr>(2)  and B<sched_getattr>(2)  "
4221 "system calls."
4222 msgstr ""
4223
4224 #. type: Plain text
4225 #: build/C/man7/sched.7:226
4226 msgid ""
4227 "A sporadic task is one that has a sequence of jobs, where each job is "
4228 "activated at most once per period.  Each job also has a I<relative "
4229 "deadline>, before which it should finish execution, and a I<computation "
4230 "time>, which is the CPU time necessary for executing the job.  The moment "
4231 "when a task wakes up because a new job has to be executed is called the "
4232 "I<arrival time> (also referred to as the request time or release time).  The "
4233 "I<start time> is the time at which a task starts its execution.  The "
4234 "I<absolute deadline> is thus obtained by adding the relative deadline to the "
4235 "arrival time."
4236 msgstr ""
4237
4238 #. type: Plain text
4239 #: build/C/man7/sched.7:228
4240 msgid "The following diagram clarifies these terms:"
4241 msgstr ""
4242
4243 #. type: Plain text
4244 #: build/C/man7/sched.7:239
4245 #, no-wrap
4246 msgid ""
4247 "arrival/wakeup                    absolute deadline\n"
4248 "     |    start time                    |\n"
4249 "     |        |                         |\n"
4250 "     v        v                         v\n"
4251 "-----x--------xooooooooooooooooo--------x--------x---\n"
4252 "              |E<lt>- comp. time -E<gt>|\n"
4253 "     |E<lt>------- relative deadline ------E<gt>|\n"
4254 "     |E<lt>-------------- period -------------------E<gt>|\n"
4255 msgstr ""
4256
4257 #. type: Plain text
4258 #: build/C/man7/sched.7:258
4259 msgid ""
4260 "When setting a B<SCHED_DEADLINE> policy for a thread using "
4261 "B<sched_setattr>(2), one can specify three parameters: I<Runtime>, "
4262 "I<Deadline>, and I<Period>.  These parameters do not necessarily correspond "
4263 "to the aforementioned terms: usual practice is to set Runtime to something "
4264 "bigger than the average computation time (or worst-case execution time for "
4265 "hard real-time tasks), Deadline to the relative deadline, and Period to the "
4266 "period of the task.  Thus, for B<SCHED_DEADLINE> scheduling, we have:"
4267 msgstr ""
4268
4269 #. type: Plain text
4270 #: build/C/man7/sched.7:269
4271 #, no-wrap
4272 msgid ""
4273 "arrival/wakeup                    absolute deadline\n"
4274 "     |    start time                    |\n"
4275 "     |        |                         |\n"
4276 "     v        v                         v\n"
4277 "-----x--------xooooooooooooooooo--------x--------x---\n"
4278 "              |E<lt>-- Runtime -------E<gt>|\n"
4279 "     |E<lt>----------- Deadline -----------E<gt>|\n"
4280 "     |E<lt>-------------- Period -------------------E<gt>|\n"
4281 msgstr ""
4282
4283 #.  FIXME It looks as though specifying sched_period as 0 means
4284 #.        "make sched_period the same as sched_deadline".
4285 #.        This needs to be documented.
4286 #. type: Plain text
4287 #: build/C/man7/sched.7:289
4288 msgid ""
4289 "The three deadline-scheduling parameters correspond to the I<sched_runtime>, "
4290 "I<sched_deadline>, and I<sched_period> fields of the I<sched_attr> "
4291 "structure; see B<sched_setattr>(2).  These fields express value in "
4292 "nanoseconds.  If I<sched_period> is specified as 0, then it is made the same "
4293 "as I<sched_deadline>."
4294 msgstr ""
4295
4296 #. type: Plain text
4297 #: build/C/man7/sched.7:291
4298 msgid "The kernel requires that:"
4299 msgstr ""
4300
4301 #. type: Plain text
4302 #: build/C/man7/sched.7:293
4303 #, no-wrap
4304 msgid "    sched_runtime E<lt>= sched_deadline E<lt>= sched_period\n"
4305 msgstr ""
4306
4307 #.  See __checkparam_dl in kernel/sched/core.c
4308 #. type: Plain text
4309 #: build/C/man7/sched.7:303
4310 msgid ""
4311 "In addition, under the current implementation, all of the parameter values "
4312 "must be at least 1024 (i.e., just over one microsecond, which is the "
4313 "resolution of the implementation), and less than 2^63.  If any of these "
4314 "checks fails, B<sched_setattr>(2)  fails with the error B<EINVAL>."
4315 msgstr ""
4316
4317 #. type: Plain text
4318 #: build/C/man7/sched.7:306
4319 msgid ""
4320 "The CBS guarantees non-interference between tasks, by throttling threads "
4321 "that attempt to over-run their specified Runtime."
4322 msgstr ""
4323
4324 #. type: Plain text
4325 #: build/C/man7/sched.7:319
4326 msgid ""
4327 "To ensure deadline scheduling guarantees, the kernel must prevent situations "
4328 "where the set of B<SCHED_DEADLINE> threads is not feasible (schedulable) "
4329 "within the given constraints.  The kernel thus performs an admittance test "
4330 "when setting or changing B<SCHED_DEADLINE> policy and attributes.  This "
4331 "admission test calculates whether the change is feasible; if it is not "
4332 "B<sched_setattr>(2)  fails with the error B<EBUSY>."
4333 msgstr ""
4334
4335 #. type: Plain text
4336 #: build/C/man7/sched.7:325
4337 msgid ""
4338 "For example, it is required (but not necessarily sufficient) for the total "
4339 "utilization to be less than or equal to the total number of CPUs available, "
4340 "where, since each thread can maximally run for Runtime per Period, that "
4341 "thread's utilization is its Runtime divided by its Period."
4342 msgstr ""
4343
4344 #. type: Plain text
4345 #: build/C/man7/sched.7:336
4346 msgid ""
4347 "In order to fulfil the guarantees that are made when a thread is admitted to "
4348 "the B<SCHED_DEADLINE> policy, B<SCHED_DEADLINE> threads are the highest "
4349 "priority (user controllable) threads in the system; if any B<SCHED_DEADLINE> "
4350 "thread is runnable, it will preempt any thread scheduled under one of the "
4351 "other policies."
4352 msgstr ""
4353
4354 #. type: Plain text
4355 #: build/C/man7/sched.7:344
4356 msgid ""
4357 "A call to B<fork>(2)  by a thread scheduled under the B<SCHED_DEADLINE> "
4358 "policy will fail with the error B<EAGAIN>, unless the thread has its "
4359 "reset-on-fork flag set (see below)."
4360 msgstr ""
4361
4362 #
4363 #.  FIXME Calling sched_getparam() on a SCHED_DEADLINE thread
4364 #.        fails with EINVAL, but sched_getscheduler() succeeds.
4365 #.        Is that intended? (Why?)
4366 #. type: Plain text
4367 #: build/C/man7/sched.7:355
4368 msgid ""
4369 "A B<SCHED_DEADLINE> thread that calls B<sched_yield>(2)  will yield the "
4370 "current job and wait for a new period to begin."
4371 msgstr ""
4372
4373 #. type: SS
4374 #: build/C/man7/sched.7:355
4375 #, no-wrap
4376 msgid "SCHED_OTHER: Default Linux time-sharing scheduling"
4377 msgstr ""
4378
4379 #. type: Plain text
4380 #: build/C/man7/sched.7:372
4381 msgid ""
4382 "B<SCHED_OTHER> can be used at only static priority 0.  B<SCHED_OTHER> is the "
4383 "standard Linux time-sharing scheduler that is intended for all threads that "
4384 "do not require the special real-time mechanisms.  The thread to run is "
4385 "chosen from the static priority 0 list based on a I<dynamic> priority that "
4386 "is determined only inside this list.  The dynamic priority is based on the "
4387 "nice value (set by B<nice>(2), B<setpriority>(2), or B<sched_setattr>(2))  "
4388 "and increased for each time quantum the thread is ready to run, but denied "
4389 "to run by the scheduler.  This ensures fair progress among all "
4390 "B<SCHED_OTHER> threads."
4391 msgstr ""
4392
4393 #. type: SS
4394 #: build/C/man7/sched.7:372
4395 #, no-wrap
4396 msgid "SCHED_BATCH: Scheduling batch processes"
4397 msgstr ""
4398
4399 #. type: Plain text
4400 #: build/C/man7/sched.7:384
4401 msgid ""
4402 "(Since Linux 2.6.16.)  B<SCHED_BATCH> can be used only at static priority "
4403 "0.  This policy is similar to B<SCHED_OTHER> in that it schedules the thread "
4404 "according to its dynamic priority (based on the nice value).  The difference "
4405 "is that this policy will cause the scheduler to always assume that the "
4406 "thread is CPU-intensive.  Consequently, the scheduler will apply a small "
4407 "scheduling penalty with respect to wakeup behavior, so that this thread is "
4408 "mildly disfavored in scheduling decisions."
4409 msgstr ""
4410
4411 #.  The following paragraph is drawn largely from the text that
4412 #.  accompanied Ingo Molnar's patch for the implementation of
4413 #.  SCHED_BATCH.
4414 #.  commit b0a9499c3dd50d333e2aedb7e894873c58da3785
4415 #. type: Plain text
4416 #: build/C/man7/sched.7:394
4417 msgid ""
4418 "This policy is useful for workloads that are noninteractive, but do not want "
4419 "to lower their nice value, and for workloads that want a deterministic "
4420 "scheduling policy without interactivity causing extra preemptions (between "
4421 "the workload's tasks)."
4422 msgstr ""
4423
4424 #. type: SS
4425 #: build/C/man7/sched.7:394
4426 #, no-wrap
4427 msgid "SCHED_IDLE: Scheduling very low priority jobs"
4428 msgstr ""
4429
4430 #. type: Plain text
4431 #: build/C/man7/sched.7:398
4432 msgid ""
4433 "(Since Linux 2.6.23.)  B<SCHED_IDLE> can be used only at static priority 0; "
4434 "the process nice value has no influence for this policy."
4435 msgstr ""
4436
4437 #. type: Plain text
4438 #: build/C/man7/sched.7:406
4439 msgid ""
4440 "This policy is intended for running jobs at extremely low priority (lower "
4441 "even than a +19 nice value with the B<SCHED_OTHER> or B<SCHED_BATCH> "
4442 "policies)."
4443 msgstr ""
4444
4445 #. type: SS
4446 #: build/C/man7/sched.7:406
4447 #, no-wrap
4448 msgid "Resetting scheduling policy for child processes"
4449 msgstr ""
4450
4451 #. type: Plain text
4452 #: build/C/man7/sched.7:412
4453 msgid ""
4454 "Each thread has a reset-on-fork scheduling flag.  When this flag is set, "
4455 "children created by B<fork>(2)  do not inherit privileged scheduling "
4456 "policies.  The reset-on-fork flag can be set by either:"
4457 msgstr ""
4458
4459 #. type: Plain text
4460 #: build/C/man7/sched.7:421
4461 msgid ""
4462 "ORing the B<SCHED_RESET_ON_FORK> flag into the I<policy> argument when "
4463 "calling B<sched_setscheduler>(2)  (since Linux 2.6.32); or"
4464 msgstr ""
4465
4466 #. type: Plain text
4467 #: build/C/man7/sched.7:428
4468 msgid ""
4469 "specifying the B<SCHED_FLAG_RESET_ON_FORK> flag in I<attr.sched_flags> when "
4470 "calling B<sched_setattr>(2)."
4471 msgstr ""
4472
4473 #. type: Plain text
4474 #: build/C/man7/sched.7:434
4475 msgid ""
4476 "Note that the constants used with these two APIs have different names.  The "
4477 "state of the reset-on-fork flag can analogously be retrieved using "
4478 "B<sched_getscheduler>(2)  and B<sched_getattr>(2)."
4479 msgstr ""
4480
4481 #. type: Plain text
4482 #: build/C/man7/sched.7:441
4483 msgid ""
4484 "The reset-on-fork feature is intended for media-playback applications, and "
4485 "can be used to prevent applications evading the B<RLIMIT_RTTIME> resource "
4486 "limit (see B<getrlimit>(2))  by creating multiple child processes."
4487 msgstr ""
4488
4489 #. type: Plain text
4490 #: build/C/man7/sched.7:444
4491 msgid ""
4492 "More precisely, if the reset-on-fork flag is set, the following rules apply "
4493 "for subsequently created children:"
4494 msgstr ""
4495
4496 #. type: Plain text
4497 #: build/C/man7/sched.7:452
4498 msgid ""
4499 "If the calling thread has a scheduling policy of B<SCHED_FIFO> or "
4500 "B<SCHED_RR>, the policy is reset to B<SCHED_OTHER> in child processes."
4501 msgstr ""
4502
4503 #. type: Plain text
4504 #: build/C/man7/sched.7:455
4505 msgid ""
4506 "If the calling process has a negative nice value, the nice value is reset to "
4507 "zero in child processes."
4508 msgstr ""
4509
4510 #. type: Plain text
4511 #: build/C/man7/sched.7:463
4512 msgid ""
4513 "After the reset-on-fork flag has been enabled, it can be reset only if the "
4514 "thread has the B<CAP_SYS_NICE> capability.  This flag is disabled in child "
4515 "processes created by B<fork>(2)."
4516 msgstr ""
4517
4518 #. type: SS
4519 #: build/C/man7/sched.7:463
4520 #, no-wrap
4521 msgid "Privileges and resource limits"
4522 msgstr ""
4523
4524 #. type: Plain text
4525 #: build/C/man7/sched.7:475
4526 msgid ""
4527 "In Linux kernels before 2.6.12, only privileged (B<CAP_SYS_NICE>)  threads "
4528 "can set a nonzero static priority (i.e., set a real-time scheduling "
4529 "policy).  The only change that an unprivileged thread can make is to set the "
4530 "B<SCHED_OTHER> policy, and this can be done only if the effective user ID of "
4531 "the caller matches the real or effective user ID of the target thread (i.e., "
4532 "the thread specified by I<pid>)  whose policy is being changed."
4533 msgstr ""
4534
4535 #. type: Plain text
4536 #: build/C/man7/sched.7:481
4537 msgid ""
4538 "A thread must be privileged (B<CAP_SYS_NICE>)  in order to set or modify a "
4539 "B<SCHED_DEADLINE> policy."
4540 msgstr ""
4541
4542 #. type: Plain text
4543 #: build/C/man7/sched.7:491
4544 msgid ""
4545 "Since Linux 2.6.12, the B<RLIMIT_RTPRIO> resource limit defines a ceiling on "
4546 "an unprivileged thread's static priority for the B<SCHED_RR> and "
4547 "B<SCHED_FIFO> policies.  The rules for changing scheduling policy and "
4548 "priority are as follows:"
4549 msgstr ""
4550
4551 #. type: Plain text
4552 #: build/C/man7/sched.7:499
4553 msgid ""
4554 "If an unprivileged thread has a nonzero B<RLIMIT_RTPRIO> soft limit, then it "
4555 "can change its scheduling policy and priority, subject to the restriction "
4556 "that the priority cannot be set to a value higher than the maximum of its "
4557 "current priority and its B<RLIMIT_RTPRIO> soft limit."
4558 msgstr ""
4559
4560 #. type: Plain text
4561 #: build/C/man7/sched.7:504
4562 msgid ""
4563 "If the B<RLIMIT_RTPRIO> soft limit is 0, then the only permitted changes are "
4564 "to lower the priority, or to switch to a non-real-time policy."
4565 msgstr ""
4566
4567 #. type: Plain text
4568 #: build/C/man7/sched.7:509
4569 msgid ""
4570 "Subject to the same rules, another unprivileged thread can also make these "
4571 "changes, as long as the effective user ID of the thread making the change "
4572 "matches the real or effective user ID of the target thread."
4573 msgstr ""
4574
4575 #.  commit c02aa73b1d18e43cfd79c2f193b225e84ca497c8
4576 #. type: Plain text
4577 #: build/C/man7/sched.7:528
4578 msgid ""
4579 "Special rules apply for the B<SCHED_IDLE> policy.  In Linux kernels before "
4580 "2.6.39, an unprivileged thread operating under this policy cannot change its "
4581 "policy, regardless of the value of its B<RLIMIT_RTPRIO> resource limit.  In "
4582 "Linux kernels since 2.6.39, an unprivileged thread can switch to either the "
4583 "B<SCHED_BATCH> or the B<SCHED_NORMAL> policy so long as its nice value falls "
4584 "within the range permitted by its B<RLIMIT_NICE> resource limit (see "
4585 "B<getrlimit>(2))."
4586 msgstr ""
4587
4588 #. type: Plain text
4589 #: build/C/man7/sched.7:539
4590 msgid ""
4591 "Privileged (B<CAP_SYS_NICE>)  threads ignore the B<RLIMIT_RTPRIO> limit; as "
4592 "with older kernels, they can make arbitrary changes to scheduling policy and "
4593 "priority.  See B<getrlimit>(2)  for further information on B<RLIMIT_RTPRIO>."
4594 msgstr ""
4595
4596 #. type: SS
4597 #: build/C/man7/sched.7:539
4598 #, no-wrap
4599 msgid "Limiting the CPU usage of real-time and deadline processes"
4600 msgstr ""
4601
4602 #. type: Plain text
4603 #: build/C/man7/sched.7:552
4604 msgid ""
4605 "A nonblocking infinite loop in a thread scheduled under the B<SCHED_FIFO>, "
4606 "B<SCHED_RR>, or B<SCHED_DEADLINE> policy will block all threads with lower "
4607 "priority forever.  Prior to Linux 2.6.25, the only way of preventing a "
4608 "runaway real-time process from freezing the system was to run (at the "
4609 "console)  a shell scheduled under a higher static priority than the tested "
4610 "application.  This allows an emergency kill of tested real-time applications "
4611 "that do not block or terminate as expected."
4612 msgstr ""
4613
4614 #. type: Plain text
4615 #: build/C/man7/sched.7:562
4616 msgid ""
4617 "Since Linux 2.6.25, there are other techniques for dealing with runaway "
4618 "real-time and deadline processes.  One of these is to use the "
4619 "B<RLIMIT_RTTIME> resource limit to set a ceiling on the CPU time that a "
4620 "real-time process may consume.  See B<getrlimit>(2)  for details."
4621 msgstr ""
4622
4623 #. type: Plain text
4624 #: build/C/man7/sched.7:570
4625 msgid ""
4626 "Since version 2.6.25, Linux also provides two I</proc> files that can be "
4627 "used to reserve a certain amount of CPU time to be used by non-real-time "
4628 "processes.  Reserving some CPU time in this fashion allows some CPU time to "
4629 "be allocated to (say) a root shell that can be used to kill a runaway "
4630 "process.  Both of these files specify time values in microseconds:"
4631 msgstr ""
4632
4633 #. type: TP
4634 #: build/C/man7/sched.7:570
4635 #, no-wrap
4636 msgid "I</proc/sys/kernel/sched_rt_period_us>"
4637 msgstr ""
4638
4639 #. type: Plain text
4640 #: build/C/man7/sched.7:578
4641 msgid ""
4642 "This file specifies a scheduling period that is equivalent to 100% CPU "
4643 "bandwidth.  The value in this file can range from 1 to B<INT_MAX>, giving an "
4644 "operating range of 1 microsecond to around 35 minutes.  The default value in "
4645 "this file is 1,000,000 (1 second)."
4646 msgstr ""
4647
4648 #. type: TP
4649 #: build/C/man7/sched.7:578
4650 #, no-wrap
4651 msgid "I</proc/sys/kernel/sched_rt_runtime_us>"
4652 msgstr ""
4653
4654 #. type: Plain text
4655 #: build/C/man7/sched.7:591
4656 msgid ""
4657 "The value in this file specifies how much of the \"period\" time can be used "
4658 "by all real-time and deadline scheduled processes on the system.  The value "
4659 "in this file can range from -1 to B<INT_MAX>-1.  Specifying -1 makes the "
4660 "runtime the same as the period; that is, no CPU time is set aside for "
4661 "non-real-time processes (which was the Linux behavior before kernel "
4662 "2.6.25).  The default value in this file is 950,000 (0.95 seconds), meaning "
4663 "that 5% of the CPU time is reserved for processes that don't run under a "
4664 "real-time or deadline scheduling policy."
4665 msgstr ""
4666
4667 #. type: SS
4668 #: build/C/man7/sched.7:592
4669 #, no-wrap
4670 msgid "Response time"
4671 msgstr ""
4672
4673 #.  as described in
4674 #.  .BR request_irq (9).
4675 #. type: Plain text
4676 #: build/C/man7/sched.7:600
4677 msgid ""
4678 "A blocked high priority thread waiting for I/O has a certain response time "
4679 "before it is scheduled again.  The device driver writer can greatly reduce "
4680 "this response time by using a \"slow interrupt\" interrupt handler."
4681 msgstr ""
4682
4683 #. type: SS
4684 #: build/C/man7/sched.7:600
4685 #, no-wrap
4686 msgid "Miscellaneous"
4687 msgstr ""
4688
4689 #. type: Plain text
4690 #: build/C/man7/sched.7:605
4691 msgid ""
4692 "Child processes inherit the scheduling policy and parameters across a "
4693 "B<fork>(2).  The scheduling policy and parameters are preserved across "
4694 "B<execve>(2)."
4695 msgstr ""
4696
4697 #. type: Plain text
4698 #: build/C/man7/sched.7:611
4699 msgid ""
4700 "Memory locking is usually needed for real-time processes to avoid paging "
4701 "delays; this can be done with B<mlock>(2)  or B<mlockall>(2)."
4702 msgstr ""
4703
4704 #. type: Plain text
4705 #: build/C/man7/sched.7:622
4706 msgid ""
4707 "Originally, Standard Linux was intended as a general-purpose operating "
4708 "system being able to handle background processes, interactive applications, "
4709 "and less demanding real-time applications (applications that need to usually "
4710 "meet timing deadlines).  Although the Linux kernel 2.6 allowed for kernel "
4711 "preemption and the newly introduced O(1) scheduler ensures that the time "
4712 "needed to schedule is fixed and deterministic irrespective of the number of "
4713 "active tasks, true real-time computing was not possible up to kernel version "
4714 "2.6.17."
4715 msgstr ""
4716
4717 #. type: SS
4718 #: build/C/man7/sched.7:622
4719 #, no-wrap
4720 msgid "Real-time features in the mainline Linux kernel"
4721 msgstr ""
4722
4723 #.  FIXME . Probably this text will need some minor tweaking
4724 #.  by about the time of 2.6.30; ask Carsten Emde about this then.
4725 #. type: Plain text
4726 #: build/C/man7/sched.7:636
4727 msgid ""
4728 "From kernel version 2.6.18 onward, however, Linux is gradually becoming "
4729 "equipped with real-time capabilities, most of which are derived from the "
4730 "former I<realtime-preempt> patches developed by Ingo Molnar, Thomas "
4731 "Gleixner, Steven Rostedt, and others.  Until the patches have been "
4732 "completely merged into the mainline kernel (this is expected to be around "
4733 "kernel version 2.6.30), they must be installed to achieve the best real-time "
4734 "performance.  These patches are named:"
4735 msgstr ""
4736
4737 #. type: Plain text
4738 #: build/C/man7/sched.7:640
4739 #, no-wrap
4740 msgid "patch-I<kernelversion>-rtI<patchversion>\n"
4741 msgstr ""
4742
4743 #. type: Plain text
4744 #: build/C/man7/sched.7:646
4745 msgid ""
4746 "and can be downloaded from E<.UR "
4747 "http://www.kernel.org\\:/pub\\:/linux\\:/kernel\\:/projects\\:/rt/> E<.UE .>"
4748 msgstr ""
4749
4750 #. type: Plain text
4751 #: build/C/man7/sched.7:655
4752 msgid ""
4753 "Without the patches and prior to their full inclusion into the mainline "
4754 "kernel, the kernel configuration offers only the three preemption classes "
4755 "B<CONFIG_PREEMPT_NONE>, B<CONFIG_PREEMPT_VOLUNTARY>, and "
4756 "B<CONFIG_PREEMPT_DESKTOP> which respectively provide no, some, and "
4757 "considerable reduction of the worst-case scheduling latency."
4758 msgstr ""
4759
4760 #. type: Plain text
4761 #: build/C/man7/sched.7:664
4762 msgid ""
4763 "With the patches applied or after their full inclusion into the mainline "
4764 "kernel, the additional configuration item B<CONFIG_PREEMPT_RT> becomes "
4765 "available.  If this is selected, Linux is transformed into a regular "
4766 "real-time operating system.  The FIFO and RR scheduling policies are then "
4767 "used to run a thread with true real-time priority and a minimum worst-case "
4768 "scheduling latency."
4769 msgstr ""
4770
4771 #. type: Plain text
4772 #: build/C/man7/sched.7:691
4773 msgid ""
4774 "B<chrt>(1), B<taskset>(1), B<getpriority>(2), B<mlock>(2), B<mlockall>(2), "
4775 "B<munlock>(2), B<munlockall>(2), B<nice>(2), B<sched_get_priority_max>(2), "
4776 "B<sched_get_priority_min>(2), B<sched_getscheduler>(2), "
4777 "B<sched_getaffinity>(2), B<sched_getparam>(2), B<sched_rr_get_interval>(2), "
4778 "B<sched_setaffinity>(2), B<sched_setscheduler>(2), B<sched_setparam>(2), "
4779 "B<sched_yield>(2), B<setpriority>(2), B<pthread_getaffinity_np>(3), "
4780 "B<pthread_setaffinity_np>(3), B<sched_getcpu>(3), B<capabilities>(7), "
4781 "B<cpuset>(7)"
4782 msgstr ""
4783
4784 #. type: Plain text
4785 #: build/C/man7/sched.7:695
4786 msgid ""
4787 "I<Programming for the real world - POSIX.4> by Bill O. Gallmeister, O'Reilly "
4788 "& Associates, Inc., ISBN 1-56592-074-0."
4789 msgstr ""
4790
4791 #. type: Plain text
4792 #: build/C/man7/sched.7:702
4793 msgid ""
4794 "The Linux kernel source files I<Documentation/scheduler/sched-deadline.txt>, "
4795 "I<Documentation/scheduler/sched-rt-group.txt>, "
4796 "I<Documentation/scheduler/sched-design-CFS.txt>, and "
4797 "I<Documentation/scheduler/sched-nice-design.txt>"
4798 msgstr ""
4799
4800 #. type: TH
4801 #: build/C/man2/setns.2:8
4802 #, no-wrap
4803 msgid "SETNS"
4804 msgstr ""
4805
4806 #. type: TH
4807 #: build/C/man2/setns.2:8
4808 #, no-wrap
4809 msgid "2015-01-10"
4810 msgstr ""
4811
4812 #. type: Plain text
4813 #: build/C/man2/setns.2:11
4814 msgid "setns - reassociate thread with a namespace"
4815 msgstr ""
4816
4817 #. type: Plain text
4818 #: build/C/man2/setns.2:17
4819 #, no-wrap
4820 msgid "B<int setns(int >I<fd>B<, int >I<nstype>B<);>\n"
4821 msgstr ""
4822
4823 #. type: Plain text
4824 #: build/C/man2/setns.2:21
4825 msgid ""
4826 "Given a file descriptor referring to a namespace, reassociate the calling "
4827 "thread with that namespace."
4828 msgstr ""
4829
4830 #. type: Plain text
4831 #: build/C/man2/setns.2:34
4832 msgid ""
4833 "The I<fd> argument is a file descriptor referring to one of the namespace "
4834 "entries in a I</proc/[pid]/ns/> directory; see B<namespaces>(7)  for further "
4835 "information on I</proc/[pid]/ns/>.  The calling thread will be reassociated "
4836 "with the corresponding namespace, subject to any constraints imposed by the "
4837 "I<nstype> argument."
4838 msgstr ""
4839
4840 #. type: Plain text
4841 #: build/C/man2/setns.2:40
4842 msgid ""
4843 "The I<nstype> argument specifies which type of namespace the calling thread "
4844 "may be reassociated with.  This argument can have one of the following "
4845 "values:"
4846 msgstr ""
4847
4848 #. type: TP
4849 #: build/C/man2/setns.2:40
4850 #, no-wrap
4851 msgid "B<0>"
4852 msgstr ""
4853
4854 #. type: Plain text
4855 #: build/C/man2/setns.2:43
4856 msgid "Allow any type of namespace to be joined."
4857 msgstr ""
4858
4859 #. type: TP
4860 #: build/C/man2/setns.2:43
4861 #, no-wrap
4862 msgid "B<CLONE_NEWIPC> (since Linux 3.0)"
4863 msgstr ""
4864
4865 #. type: Plain text
4866 #: build/C/man2/setns.2:47
4867 msgid "I<fd> must refer to an IPC namespace."
4868 msgstr ""
4869
4870 #. type: TP
4871 #: build/C/man2/setns.2:47
4872 #, no-wrap
4873 msgid "B<CLONE_NEWNET> (since Linux 3.0)"
4874 msgstr ""
4875
4876 #. type: Plain text
4877 #: build/C/man2/setns.2:51
4878 msgid "I<fd> must refer to a network namespace."
4879 msgstr ""
4880
4881 #. type: TP
4882 #: build/C/man2/setns.2:51
4883 #, no-wrap
4884 msgid "B<CLONE_NEWNS> (since Linux 3.8)"
4885 msgstr ""
4886
4887 #. type: Plain text
4888 #: build/C/man2/setns.2:55
4889 msgid "I<fd> must refer to a mount namespace."
4890 msgstr ""
4891
4892 #. type: TP
4893 #: build/C/man2/setns.2:55 build/C/man2/unshare.2:149
4894 #, no-wrap
4895 msgid "B<CLONE_NEWPID> (since Linux 3.8)"
4896 msgstr ""
4897
4898 #. type: Plain text
4899 #: build/C/man2/setns.2:59
4900 msgid "I<fd> must refer to a descendant PID namespace."
4901 msgstr ""
4902
4903 #. type: TP
4904 #: build/C/man2/setns.2:59 build/C/man2/unshare.2:176
4905 #, no-wrap
4906 msgid "B<CLONE_NEWUSER> (since Linux 3.8)"
4907 msgstr ""
4908
4909 #. type: Plain text
4910 #: build/C/man2/setns.2:63
4911 msgid "I<fd> must refer to a user namespace."
4912 msgstr ""
4913
4914 #. type: TP
4915 #: build/C/man2/setns.2:63
4916 #, no-wrap
4917 msgid "B<CLONE_NEWUTS> (since Linux 3.0)"
4918 msgstr ""
4919
4920 #. type: Plain text
4921 #: build/C/man2/setns.2:67
4922 msgid "I<fd> must refer to a UTS namespace."
4923 msgstr ""
4924
4925 #. type: Plain text
4926 #: build/C/man2/setns.2:82
4927 msgid ""
4928 "Specifying I<nstype> as 0 suffices if the caller knows (or does not care)  "
4929 "what type of namespace is referred to by I<fd>.  Specifying a nonzero value "
4930 "for I<nstype> is useful if the caller does not know what type of namespace "
4931 "is referred to by I<fd> and wants to ensure that the namespace is of a "
4932 "particular type.  (The caller might not know the type of the namespace "
4933 "referred to by I<fd> if the file descriptor was opened by another process "
4934 "and, for example, passed to the caller via a UNIX domain socket.)"
4935 msgstr ""
4936
4937 #. type: Plain text
4938 #: build/C/man2/setns.2:97
4939 msgid ""
4940 "B<CLONE_NEWPID> behaves somewhat differently from the other I<nstype> "
4941 "values: reassociating the calling thread with a PID namespace changes only "
4942 "the PID namespace that child processes of the caller will be created in; it "
4943 "does not change the PID namespace of the caller itself.  Reassociating with "
4944 "a PID namespace is allowed only if the PID namespace specified by I<fd> is a "
4945 "descendant (child, grandchild, etc.)  of the PID namespace of the caller.  "
4946 "For further details on PID namespaces, see B<pid_namespaces>(7)."
4947 msgstr ""
4948
4949 #.  See kernel/user_namespace.c:userns_install() [3.8 source]
4950 #.  commit e66eded8309ebf679d3d3c1f5820d1f2ca332c71
4951 #.  https://lwn.net/Articles/543273/
4952 #. type: Plain text
4953 #: build/C/man2/setns.2:124
4954 msgid ""
4955 "A process reassociating itself with a user namespace must have the "
4956 "B<CAP_SYS_ADMIN> capability in the target user namespace.  Upon successfully "
4957 "joining a user namespace, a process is granted all capabilities in that "
4958 "namespace, regardless of its user and group IDs.  A multithreaded process "
4959 "may not change user namespace with B<setns>().  It is not permitted to use "
4960 "B<setns>()  to reenter the caller's current user namespace.  This prevents a "
4961 "caller that has dropped capabilities from regaining those capabilities via a "
4962 "call to B<setns>().  For security reasons, a process can't join a new user "
4963 "namespace if it is sharing filesystem-related attributes (the attributes "
4964 "whose sharing is controlled by the B<clone>(2)  B<CLONE_FS> flag) with "
4965 "another process.  For further details on user namespaces, see "
4966 "B<user_namespaces>(7)."
4967 msgstr ""
4968
4969 #.  Above check is in fs/namespace.c:mntns_install() [3.8 source]
4970 #. type: Plain text
4971 #: build/C/man2/setns.2:138
4972 msgid ""
4973 "A process may not be reassociated with a new mount namespace if it is "
4974 "multithreaded.  Changing the mount namespace requires that the caller "
4975 "possess both B<CAP_SYS_CHROOT> and B<CAP_SYS_ADMIN> capabilities in its own "
4976 "user namespace and B<CAP_SYS_ADMIN> in the target mount namespace.  See "
4977 "B<user_namespaces>(7)  for details on the interaction of user namespaces and "
4978 "mount namespaces."
4979 msgstr ""
4980
4981 #. type: Plain text
4982 #: build/C/man2/setns.2:145
4983 msgid ""
4984 "On success, B<setns>()  returns 0.  On failure, -1 is returned and I<errno> "
4985 "is set to indicate the error."
4986 msgstr ""
4987
4988 #. type: Plain text
4989 #: build/C/man2/setns.2:150
4990 msgid "I<fd> is not a valid file descriptor."
4991 msgstr ""
4992
4993 #. type: Plain text
4994 #: build/C/man2/setns.2:155
4995 msgid ""
4996 "I<fd> refers to a namespace whose type does not match that specified in "
4997 "I<nstype>."
4998 msgstr ""
4999
5000 #. type: Plain text
5001 #: build/C/man2/setns.2:159
5002 msgid "There is problem with reassociating the thread with the specified namespace."
5003 msgstr ""
5004
5005 #. type: Plain text
5006 #: build/C/man2/setns.2:164
5007 msgid ""
5008 "The caller tried to join an ancestor (parent, grandparent, etc...)  pid "
5009 "namespace."
5010 msgstr ""
5011
5012 #. type: Plain text
5013 #: build/C/man2/setns.2:168
5014 msgid ""
5015 "The caller attempted to join the user namespace in which it is already a "
5016 "member."
5017 msgstr ""
5018
5019 #.  commit e66eded8309ebf679d3d3c1f5820d1f2ca332c71
5020 #. type: Plain text
5021 #: build/C/man2/setns.2:175
5022 msgid ""
5023 "The caller shares filesystem (B<CLONE_FS>)  state (in particular, the root "
5024 "directory)  with other processes and tried to join a new user namespace."
5025 msgstr ""
5026
5027 #.  See kernel/user_namespace.c::userns_install() [kernel 3.15 sources]
5028 #. type: Plain text
5029 #: build/C/man2/setns.2:179
5030 msgid "The caller is multithreaded and tried to join a new user namespace."
5031 msgstr ""
5032
5033 #. type: Plain text
5034 #: build/C/man2/setns.2:182
5035 msgid "Cannot allocate sufficient memory to change the specified namespace."
5036 msgstr ""
5037
5038 #. type: Plain text
5039 #: build/C/man2/setns.2:186
5040 msgid "The calling thread did not have the required capability for this operation."
5041 msgstr ""
5042
5043 #. type: Plain text
5044 #: build/C/man2/setns.2:191
5045 msgid ""
5046 "The B<setns>()  system call first appeared in Linux in kernel 3.0; library "
5047 "support was added to glibc in version 2.14."
5048 msgstr ""
5049
5050 #. type: Plain text
5051 #: build/C/man2/setns.2:195
5052 msgid "The B<setns>()  system call is Linux-specific."
5053 msgstr ""
5054
5055 #. type: Plain text
5056 #: build/C/man2/setns.2:201
5057 msgid ""
5058 "Not all of the attributes that can be shared when a new thread is created "
5059 "using B<clone>(2)  can be changed using B<setns>()."
5060 msgstr ""
5061
5062 #. type: Plain text
5063 #: build/C/man2/setns.2:210
5064 msgid ""
5065 "The program below takes two or more arguments.  The first argument specifies "
5066 "the pathname of a namespace file in an existing I</proc/[pid]/ns/> "
5067 "directory.  The remaining arguments specify a command and its arguments.  "
5068 "The program opens the namespace file, joins that namespace using B<setns>(), "
5069 "and executes the specified command inside that namespace."
5070 msgstr ""
5071
5072 #. type: Plain text
5073 #: build/C/man2/setns.2:220
5074 msgid ""
5075 "The following shell session demonstrates the use of this program (compiled "
5076 "as a binary named I<ns_exec>)  in conjunction with the B<CLONE_NEWUTS> "
5077 "example program in the B<clone>(2)  man page (complied as a binary named "
5078 "I<newuts>)."
5079 msgstr ""
5080
5081 #. type: Plain text
5082 #: build/C/man2/setns.2:228
5083 msgid ""
5084 "We begin by executing the example program in B<clone>(2)  in the "
5085 "background.  That program creates a child in a separate UTS namespace.  The "
5086 "child changes the hostname in its namespace, and then both processes display "
5087 "the hostnames in their UTS namespaces, so that we can see that they are "
5088 "different."
5089 msgstr ""
5090
5091 #. type: Plain text
5092 #: build/C/man2/setns.2:240
5093 #, no-wrap
5094 msgid ""
5095 "$ B<su>                   # Need privilege for namespace operations\n"
5096 "Password:\n"
5097 "# B<./newuts bizarro &>\n"
5098 "[1] 3549\n"
5099 "clone() returned 3550\n"
5100 "uts.nodename in child:  bizarro\n"
5101 "uts.nodename in parent: antero\n"
5102 "# B<uname -n>             # Verify hostname in the shell\n"
5103 "antero\n"
5104 msgstr ""
5105
5106 #. type: Plain text
5107 #: build/C/man2/setns.2:247
5108 msgid ""
5109 "We then run the program shown below, using it to execute a shell.  Inside "
5110 "that shell, we verify that the hostname is the one set by the child created "
5111 "by the first program:"
5112 msgstr ""
5113
5114 #. type: Plain text
5115 #: build/C/man2/setns.2:253
5116 #, no-wrap
5117 msgid ""
5118 "# B<./ns_exec /proc/3550/ns/uts /bin/bash>\n"
5119 "# B<uname -n>             # Executed in shell started by ns_exec\n"
5120 "bizarro\n"
5121 msgstr ""
5122
5123 #. type: Plain text
5124 #: build/C/man2/setns.2:263
5125 #, no-wrap
5126 msgid ""
5127 "#define _GNU_SOURCE\n"
5128 "#include E<lt>fcntl.hE<gt>\n"
5129 "#include E<lt>sched.hE<gt>\n"
5130 "#include E<lt>unistd.hE<gt>\n"
5131 "#include E<lt>stdlib.hE<gt>\n"
5132 "#include E<lt>stdio.hE<gt>\n"
5133 msgstr ""
5134
5135 #. type: Plain text
5136 #: build/C/man2/setns.2:271
5137 #, no-wrap
5138 msgid ""
5139 "int\n"
5140 "main(int argc, char *argv[])\n"
5141 "{\n"
5142 "    int fd;\n"
5143 msgstr ""
5144
5145 #. type: Plain text
5146 #: build/C/man2/setns.2:276
5147 #, no-wrap
5148 msgid ""
5149 "    if (argc E<lt> 3) {\n"
5150 "        fprintf(stderr, \"%s /proc/PID/ns/FILE cmd args...\\en\", "
5151 "argv[0]);\n"
5152 "        exit(EXIT_FAILURE);\n"
5153 "    }\n"
5154 msgstr ""
5155
5156 #. type: Plain text
5157 #: build/C/man2/setns.2:280
5158 #, no-wrap
5159 msgid ""
5160 "    fd = open(argv[1], O_RDONLY);  /* Get descriptor for namespace */\n"
5161 "    if (fd == -1)\n"
5162 "        errExit(\"open\");\n"
5163 msgstr ""
5164
5165 #. type: Plain text
5166 #: build/C/man2/setns.2:283
5167 #, no-wrap
5168 msgid ""
5169 "    if (setns(fd, 0) == -1)        /* Join that namespace */\n"
5170 "        errExit(\"setns\");\n"
5171 msgstr ""
5172
5173 #. type: Plain text
5174 #: build/C/man2/setns.2:287
5175 #, no-wrap
5176 msgid ""
5177 "    execvp(argv[2], &argv[2]);     /* Execute a command in namespace */\n"
5178 "    errExit(\"execvp\");\n"
5179 "}\n"
5180 msgstr ""
5181
5182 #. type: Plain text
5183 #: build/C/man2/setns.2:295
5184 msgid ""
5185 "B<clone>(2), B<fork>(2), B<unshare>(2), B<vfork>(2), B<namespaces>(7), "
5186 "B<unix>(7)"
5187 msgstr ""
5188
5189 #. type: TH
5190 #: build/C/man2/unshare.2:20
5191 #, no-wrap
5192 msgid "UNSHARE"
5193 msgstr ""
5194
5195 #. type: Plain text
5196 #: build/C/man2/unshare.2:23
5197 msgid "unshare - disassociate parts of the process execution context"
5198 msgstr ""
5199
5200 #. type: Plain text
5201 #: build/C/man2/unshare.2:28
5202 #, no-wrap
5203 msgid "B<int unshare(int >I<flags>B<);>\n"
5204 msgstr ""
5205
5206 #. type: Plain text
5207 #: build/C/man2/unshare.2:36
5208 msgid "B<unshare>():"
5209 msgstr ""
5210
5211 #. type: Plain text
5212 #: build/C/man2/unshare.2:62
5213 msgid ""
5214 "B<unshare>()  allows a process to disassociate parts of its execution "
5215 "context that are currently being shared with other processes.  Part of the "
5216 "execution context, such as the mount namespace, is shared implicitly when a "
5217 "new process is created using B<fork>(2)  or B<vfork>(2), while other parts, "
5218 "such as virtual memory, may be shared by explicit request when creating a "
5219 "process using B<clone>(2)."
5220 msgstr ""
5221
5222 #. type: Plain text
5223 #: build/C/man2/unshare.2:67
5224 msgid ""
5225 "The main use of B<unshare>()  is to allow a process to control its shared "
5226 "execution context without creating a new process."
5227 msgstr ""
5228
5229 #. type: Plain text
5230 #: build/C/man2/unshare.2:74
5231 msgid ""
5232 "The I<flags> argument is a bit mask that specifies which parts of the "
5233 "execution context should be unshared.  This argument is specified by ORing "
5234 "together zero or more of the following constants:"
5235 msgstr ""
5236
5237 #. type: TP
5238 #: build/C/man2/unshare.2:74
5239 #, no-wrap
5240 msgid "B<CLONE_FILES>"
5241 msgstr ""
5242
5243 #. type: Plain text
5244 #: build/C/man2/unshare.2:82
5245 msgid ""
5246 "Reverse the effect of the B<clone>(2)  B<CLONE_FILES> flag.  Unshare the "
5247 "file descriptor table, so that the calling process no longer shares its file "
5248 "descriptors with any other process."
5249 msgstr ""
5250
5251 #. type: TP
5252 #: build/C/man2/unshare.2:82
5253 #, no-wrap
5254 msgid "B<CLONE_FS>"
5255 msgstr ""
5256
5257 #. type: Plain text
5258 #: build/C/man2/unshare.2:96
5259 msgid ""
5260 "Reverse the effect of the B<clone>(2)  B<CLONE_FS> flag.  Unshare filesystem "
5261 "attributes, so that the calling process no longer shares its root directory "
5262 "(B<chroot>(2)), current directory (B<chdir>(2)), or umask (B<umask>(2))  "
5263 "attributes with any other process."
5264 msgstr ""
5265
5266 #. type: Plain text
5267 #: build/C/man2/unshare.2:113
5268 msgid ""
5269 "This flag has the same effect as the B<clone>(2)  B<CLONE_NEWIPC> flag.  "
5270 "Unshare the System\\ V IPC namespace, so that the calling process has a "
5271 "private copy of the System\\ V IPC namespace which is not shared with any "
5272 "other process.  Specifying this flag automatically implies B<CLONE_SYSVSEM> "
5273 "as well.  Use of B<CLONE_NEWIPC> requires the B<CAP_SYS_ADMIN> capability."
5274 msgstr ""
5275
5276 #. type: Plain text
5277 #: build/C/man2/unshare.2:128
5278 msgid ""
5279 "This flag has the same effect as the B<clone>(2)  B<CLONE_NEWNET> flag.  "
5280 "Unshare the network namespace, so that the calling process is moved into a "
5281 "new network namespace which is not shared with any previously existing "
5282 "process.  Use of B<CLONE_NEWNET> requires the B<CAP_SYS_ADMIN> capability."
5283 msgstr ""
5284
5285 #. type: TP
5286 #: build/C/man2/unshare.2:128
5287 #, no-wrap
5288 msgid "B<CLONE_NEWNS>"
5289 msgstr ""
5290
5291 #.  These flag name are inconsistent:
5292 #.  CLONE_NEWNS does the same thing in clone(), but CLONE_VM,
5293 #.  CLONE_FS, and CLONE_FILES reverse the action of the clone()
5294 #.  flags of the same name.
5295 #. type: Plain text
5296 #: build/C/man2/unshare.2:149
5297 msgid ""
5298 "This flag has the same effect as the B<clone>(2)  B<CLONE_NEWNS> flag.  "
5299 "Unshare the mount namespace, so that the calling process has a private copy "
5300 "of its namespace which is not shared with any other process.  Specifying "
5301 "this flag automatically implies B<CLONE_FS> as well.  Use of B<CLONE_NEWNS> "
5302 "requires the B<CAP_SYS_ADMIN> capability."
5303 msgstr ""
5304
5305 #. type: Plain text
5306 #: build/C/man2/unshare.2:176
5307 msgid ""
5308 "This flag has the same effect as the B<clone>(2)  B<CLONE_NEWPID> flag.  "
5309 "Unshare the PID namespace, so that the calling process has a new PID "
5310 "namespace for its children which is not shared with any previously existing "
5311 "process.  The calling process is I<not> moved into the new namespace.  The "
5312 "first child created by the calling process will have the process ID 1 and "
5313 "will assume the role of B<init>(1)  in the new namespace.  B<CLONE_NEWPID> "
5314 "automatically implies B<CLONE_THREAD> as well.  Use of B<CLONE_NEWPID> "
5315 "requires the B<CAP_SYS_ADMIN> capability.  For further information, see "
5316 "B<pid_namespaces>(7)."
5317 msgstr ""
5318
5319 #. type: Plain text
5320 #: build/C/man2/unshare.2:190
5321 msgid ""
5322 "This flag has the same effect as the B<clone>(2)  B<CLONE_NEWUSER> flag.  "
5323 "Unshare the user namespace, so that the calling process is moved into a new "
5324 "user namespace which is not shared with any previously existing process.  As "
5325 "with the child process created by B<clone>(2)  with the B<CLONE_NEWUSER> "
5326 "flag, the caller obtains a full set of capabilities in the new namespace."
5327 msgstr ""
5328
5329 #.  commit e66eded8309ebf679d3d3c1f5820d1f2ca332c71
5330 #.  https://lwn.net/Articles/543273/
5331 #. type: Plain text
5332 #: build/C/man2/unshare.2:206
5333 msgid ""
5334 "B<CLONE_NEWUSER> requires that the calling process is not threaded; "
5335 "specifying B<CLONE_NEWUSER> automatically implies B<CLONE_THREAD>.  Since "
5336 "Linux 3.9, B<CLONE_NEWUSER> also automatically implies B<CLONE_FS>.  "
5337 "B<CLONE_NEWUSER> requires that the user ID and group ID of the calling "
5338 "process are mapped to user IDs and group IDs in the user namespace of the "
5339 "calling process at the time of the call."
5340 msgstr ""
5341
5342 #. type: Plain text
5343 #: build/C/man2/unshare.2:223
5344 msgid ""
5345 "This flag has the same effect as the B<clone>(2)  B<CLONE_NEWUTS> flag.  "
5346 "Unshare the UTS IPC namespace, so that the calling process has a private "
5347 "copy of the UTS namespace which is not shared with any other process.  Use "
5348 "of B<CLONE_NEWUTS> requires the B<CAP_SYS_ADMIN> capability."
5349 msgstr ""
5350
5351 #. type: TP
5352 #: build/C/man2/unshare.2:223
5353 #, no-wrap
5354 msgid "B<CLONE_SYSVSEM> (since Linux 2.6.26)"
5355 msgstr ""
5356
5357 #.  commit 9edff4ab1f8d82675277a04e359d0ed8bf14a7b7
5358 #.  CLONE_NEWNS If CLONE_SIGHAND is set and signals are also being shared
5359 #.  (i.e., current->signal->count > 1), force CLONE_THREAD.
5360 #. type: Plain text
5361 #: build/C/man2/unshare.2:243
5362 msgid ""
5363 "This flag reverses the effect of the B<clone>(2)  B<CLONE_SYSVSEM> flag.  "
5364 "Unshare System\\ V semaphore adjustment (I<semadj>)  values, so that the "
5365 "calling process has a new empty I<semadj> list that is not shared with any "
5366 "other process.  If this is the last process that has a reference to the "
5367 "process's current I<semadj> list, then the adjustments in that list are "
5368 "applied to the corresponding semaphores, as described in B<semop>(2)."
5369 msgstr ""
5370
5371 #.  As at 3.9, the following forced implications also apply,
5372 #.  although the relevant flags are not yet implemented.
5373 #.  If CLONE_THREAD is set force CLONE_VM.
5374 #.  If CLONE_VM is set, force CLONE_SIGHAND.
5375 #
5376 #.  See kernel/fork.c::check_unshare_flags()
5377 #. type: Plain text
5378 #: build/C/man2/unshare.2:270
5379 msgid ""
5380 "In addition, B<CLONE_THREAD>, B<CLONE_SIGHAND>, and B<CLONE_VM> can be "
5381 "specified in I<flags> if the caller is single threaded (i.e., it is not "
5382 "sharing its address space with another process or thread).  In this case, "
5383 "these flags have no effect.  (Note also that specifying B<CLONE_THREAD> "
5384 "automatically implies B<CLONE_VM>, and specifying B<CLONE_VM> automatically "
5385 "implies B<CLONE_SIGHAND>.)  If the process is multithreaded, then the use of "
5386 "these flags results in an error."
5387 msgstr ""
5388
5389 #. type: Plain text
5390 #: build/C/man2/unshare.2:277
5391 msgid ""
5392 "If I<flags> is specified as zero, then B<unshare>()  is a no-op; no changes "
5393 "are made to the calling process's execution context."
5394 msgstr ""
5395
5396 #. type: Plain text
5397 #: build/C/man2/unshare.2:282
5398 msgid ""
5399 "On success, zero returned.  On failure, -1 is returned and I<errno> is set "
5400 "to indicate the error."
5401 msgstr ""
5402
5403 #. type: Plain text
5404 #: build/C/man2/unshare.2:287
5405 msgid "An invalid bit was specified in I<flags>."
5406 msgstr ""
5407
5408 #. type: Plain text
5409 #: build/C/man2/unshare.2:296
5410 msgid ""
5411 "B<CLONE_THREAD>, B<CLONE_SIGHAND>, or B<CLONE_VM> was specified in I<flags>, "
5412 "and the caller is multithreaded."
5413 msgstr ""
5414
5415 #. type: Plain text
5416 #: build/C/man2/unshare.2:300
5417 msgid ""
5418 "Cannot allocate sufficient memory to copy parts of caller's context that "
5419 "need to be unshared."
5420 msgstr ""
5421
5422 #. type: Plain text
5423 #: build/C/man2/unshare.2:303
5424 msgid "The calling process did not have the required privileges for this operation."
5425 msgstr ""
5426
5427 #. type: Plain text
5428 #: build/C/man2/unshare.2:334
5429 msgid "The B<unshare>()  system call was added to Linux in kernel 2.6.16."
5430 msgstr ""
5431
5432 #. type: Plain text
5433 #: build/C/man2/unshare.2:338
5434 msgid "The B<unshare>()  system call is Linux-specific."
5435 msgstr ""
5436
5437 #.  FIXME all of the following needs to be reviewed for the current kernel
5438 #.  However, we can do unshare(CLONE_SIGHAND) if CLONE_SIGHAND
5439 #.  was not specified when doing clone(); i.e., unsharing
5440 #.  signal handlers is permitted if we are not actually
5441 #.  sharing signal handlers.   mtk
5442 #.  However, we can do unshare(CLONE_VM) if CLONE_VM
5443 #.  was not specified when doing clone(); i.e., unsharing
5444 #.  virtual memory is permitted if we are not actually
5445 #.  sharing virtual memory.   mtk
5446 #
5447 #. 9) Future Work
5448 #. --------------
5449 #. The current implementation of unshare does not allow unsharing of
5450 #. signals and signal handlers. Signals are complex to begin with and
5451 #. to unshare signals and/or signal handlers of a currently running
5452 #. process is even more complex. If in the future there is a specific
5453 #. need to allow unsharing of signals and/or signal handlers, it can
5454 #. be incrementally added to unshare without affecting legacy
5455 #. applications using unshare.
5456 #. type: Plain text
5457 #: build/C/man2/unshare.2:372
5458 msgid ""
5459 "Not all of the process attributes that can be shared when a new process is "
5460 "created using B<clone>(2)  can be unshared using B<unshare>().  In "
5461 "particular, as at kernel 3.8, B<unshare>()  does not implement flags that "
5462 "reverse the effects of B<CLONE_SIGHAND>, B<CLONE_THREAD>, or B<CLONE_VM>.  "
5463 "Such functionality may be added in the future, if required."
5464 msgstr ""
5465
5466 #. type: Plain text
5467 #: build/C/man2/unshare.2:381
5468 msgid ""
5469 "The program below provides a simple implementation of the B<unshare>(1)  "
5470 "command, which unshares one or more namespaces and executes the command "
5471 "supplied in its command-line arguments.  Here's an example of the use of "
5472 "this program, running a shell in a new mount namespace, and verifying that "
5473 "the original shell and the new shell are in separate mount namespaces:"
5474 msgstr ""
5475
5476 #. type: Plain text
5477 #: build/C/man2/unshare.2:390
5478 #, no-wrap
5479 msgid ""
5480 "$ B<readlink /proc/$$/ns/mnt>\n"
5481 "mnt:[4026531840]\n"
5482 "$ B<sudo ./unshare -m /bin/bash>\n"
5483 "[sudo] password for cecilia:\n"
5484 "# B<readlink /proc/$$/ns/mnt>\n"
5485 "mnt:[4026532325]\n"
5486 msgstr ""
5487
5488 #. type: Plain text
5489 #: build/C/man2/unshare.2:396
5490 msgid ""
5491 "The differing output of the two B<readlink>(1)  commands shows that the two "
5492 "shells are in different mount namespaces."
5493 msgstr ""
5494
5495 #. type: Plain text
5496 #: build/C/man2/unshare.2:400
5497 #, no-wrap
5498 msgid "/* unshare.c\n"
5499 msgstr ""
5500
5501 #. type: Plain text
5502 #: build/C/man2/unshare.2:409
5503 #, no-wrap
5504 msgid ""
5505 "   A simple implementation of the unshare(1) command: unshare\n"
5506 "   namespaces and execute a command.\n"
5507 "*/\n"
5508 "#define _GNU_SOURCE\n"
5509 "#include E<lt>sched.hE<gt>\n"
5510 "#include E<lt>unistd.hE<gt>\n"
5511 "#include E<lt>stdlib.hE<gt>\n"
5512 "#include E<lt>stdio.hE<gt>\n"
5513 msgstr ""
5514
5515 #. type: Plain text
5516 #: build/C/man2/unshare.2:412
5517 #, no-wrap
5518 msgid ""
5519 "/* A simple error-handling function: print an error message based\n"
5520 "   on the value in \\(aqerrno\\(aq and terminate the calling process */\n"
5521 msgstr ""
5522
5523 #. type: Plain text
5524 #: build/C/man2/unshare.2:429
5525 #, no-wrap
5526 msgid ""
5527 "static void\n"
5528 "usage(char *pname)\n"
5529 "{\n"
5530 "    fprintf(stderr, \"Usage: %s [options] program [arg...]\\en\", pname);\n"
5531 "    fprintf(stderr, \"Options can be:\\en\");\n"
5532 "    fprintf(stderr, \"    -i   unshare IPC namespace\\en\");\n"
5533 "    fprintf(stderr, \"    -m   unshare mount namespace\\en\");\n"
5534 "    fprintf(stderr, \"    -n   unshare network namespace\\en\");\n"
5535 "    fprintf(stderr, \"    -p   unshare PID namespace\\en\");\n"
5536 "    fprintf(stderr, \"    -u   unshare UTS namespace\\en\");\n"
5537 "    fprintf(stderr, \"    -U   unshare user namespace\\en\");\n"
5538 "    exit(EXIT_FAILURE);\n"
5539 "}\n"
5540 msgstr ""
5541
5542 #. type: Plain text
5543 #: build/C/man2/unshare.2:434
5544 #, no-wrap
5545 msgid ""
5546 "int\n"
5547 "main(int argc, char *argv[])\n"
5548 "{\n"
5549 "    int flags, opt;\n"
5550 msgstr ""
5551
5552 #. type: Plain text
5553 #: build/C/man2/unshare.2:436
5554 #, no-wrap
5555 msgid "    flags = 0;\n"
5556 msgstr ""
5557
5558 #. type: Plain text
5559 #: build/C/man2/unshare.2:448
5560 #, no-wrap
5561 msgid ""
5562 "    while ((opt = getopt(argc, argv, \"imnpuU\")) != -1) {\n"
5563 "        switch (opt) {\n"
5564 "        case \\(aqi\\(aq: flags |= CLONE_NEWIPC;        break;\n"
5565 "        case \\(aqm\\(aq: flags |= CLONE_NEWNS;         break;\n"
5566 "        case \\(aqn\\(aq: flags |= CLONE_NEWNET;        break;\n"
5567 "        case \\(aqp\\(aq: flags |= CLONE_NEWPID;        break;\n"
5568 "        case \\(aqu\\(aq: flags |= CLONE_NEWUTS;        break;\n"
5569 "        case \\(aqU\\(aq: flags |= CLONE_NEWUSER;       break;\n"
5570 "        default:  usage(argv[0]);\n"
5571 "        }\n"
5572 "    }\n"
5573 msgstr ""
5574
5575 #. type: Plain text
5576 #: build/C/man2/unshare.2:451
5577 #, no-wrap
5578 msgid ""
5579 "    if (optind E<gt>= argc)\n"
5580 "        usage(argv[0]);\n"
5581 msgstr ""
5582
5583 #. type: Plain text
5584 #: build/C/man2/unshare.2:454
5585 #, no-wrap
5586 msgid ""
5587 "    if (unshare(flags) == -1)\n"
5588 "        errExit(\"unshare\");\n"
5589 msgstr ""
5590
5591 #. type: Plain text
5592 #: build/C/man2/unshare.2:458
5593 #, no-wrap
5594 msgid ""
5595 "    execvp(argv[optind], &argv[optind]);\n"
5596 "    errExit(\"execvp\");\n"
5597 "}\n"
5598 msgstr ""
5599
5600 #. type: Plain text
5601 #: build/C/man2/unshare.2:467
5602 msgid ""
5603 "B<unshare>(1), B<clone>(2), B<fork>(2), B<kcmp>(2), B<setns>(2), "
5604 "B<vfork>(2), B<namespaces>(7)"
5605 msgstr ""
5606
5607 #. type: Plain text
5608 #: build/C/man2/unshare.2:470
5609 msgid "I<Documentation/unshare.txt> in the Linux kernel source tree"
5610 msgstr ""