1 # SOME DESCRIPTIVE TITLE
2 # Copyright (C) YEAR Free Software Foundation, Inc.
3 # This file is distributed under the same license as the PACKAGE package.
4 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
9 "Project-Id-Version: PACKAGE VERSION\n"
10 "POT-Creation-Date: 2012-03-19 23:50+0900\n"
11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Language-Team: LANGUAGE <LL@li.org>\n"
16 "Content-Type: text/plain; charset=CHARSET\n"
17 "Content-Transfer-Encoding: 8bit\n"
20 #: build/C/man3/CPU_SET.3:25
26 #: build/C/man3/CPU_SET.3:25
32 #: build/C/man3/CPU_SET.3:25 build/C/man2/clone.2:43 build/C/man2/sched_get_priority_max.2:30 build/C/man3/sched_getcpu.3:24 build/C/man2/sched_rr_get_interval.2:30 build/C/man2/sched_setaffinity.2:35 build/C/man2/sched_setparam.2:31 build/C/man2/sched_setscheduler.2:47 build/C/man2/sched_yield.2:30 build/C/man2/setns.2:4 build/C/man2/unshare.2:17
38 #: build/C/man3/CPU_SET.3:25 build/C/man2/clone.2:43 build/C/man2/sched_get_priority_max.2:30 build/C/man3/sched_getcpu.3:24 build/C/man2/sched_rr_get_interval.2:30 build/C/man2/sched_setaffinity.2:35 build/C/man2/sched_setparam.2:31 build/C/man2/sched_setscheduler.2:47 build/C/man2/sched_yield.2:30 build/C/man2/setns.2:4 build/C/man2/unshare.2:17
40 msgid "Linux Programmer's Manual"
44 #: build/C/man3/CPU_SET.3:26 build/C/man2/clone.2:44 build/C/man2/sched_get_priority_max.2:31 build/C/man3/sched_getcpu.3:25 build/C/man2/sched_rr_get_interval.2:31 build/C/man2/sched_setaffinity.2:36 build/C/man2/sched_setparam.2:32 build/C/man2/sched_setscheduler.2:48 build/C/man2/sched_yield.2:31 build/C/man2/setns.2:5 build/C/man2/unshare.2:18
50 #: build/C/man3/CPU_SET.3:33
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"
59 #: build/C/man3/CPU_SET.3:33 build/C/man2/clone.2:46 build/C/man2/sched_get_priority_max.2:33 build/C/man3/sched_getcpu.3:27 build/C/man2/sched_rr_get_interval.2:33 build/C/man2/sched_setaffinity.2:39 build/C/man2/sched_setparam.2:34 build/C/man2/sched_setscheduler.2:51 build/C/man2/sched_yield.2:33 build/C/man2/setns.2:7 build/C/man2/unshare.2:20
64 #. Actually _BSD_SOURCE || _SVID_SOURCE
65 #. See http://sources.redhat.com/bugzilla/show_bug.cgi?id=4749
67 #: build/C/man3/CPU_SET.3:37 build/C/man2/clone.2:52 build/C/man2/sched_setaffinity.2:43 build/C/man2/setns.2:11 build/C/man2/unshare.2:26
70 "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n"
71 "B<#include E<lt>sched.hE<gt>>\n"
75 #: build/C/man3/CPU_SET.3:39
77 msgid "B<void CPU_ZERO(cpu_set_t *>I<set>B<);>\n"
81 #: build/C/man3/CPU_SET.3:43
84 "B<void CPU_SET(int >I<cpu>B<, cpu_set_t *>I<set>B<);>\n"
85 "B<void CPU_CLR(int >I<cpu>B<, cpu_set_t *>I<set>B<);>\n"
86 "B<int CPU_ISSET(int >I<cpu>B<, cpu_set_t *>I<set>B<);>\n"
90 #: build/C/man3/CPU_SET.3:45
92 msgid "B<int CPU_COUNT(cpu_set_t *>I<set>B<);>\n"
96 #: build/C/man3/CPU_SET.3:52
99 "B<void CPU_AND(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_OR(cpu_set_t *>I<destset>B<,>\n"
102 "B< cpu_set_t *>I<srcset1>B<, cpu_set_t *>I<srcset2>B<);>\n"
103 "B<void CPU_XOR(cpu_set_t *>I<destset>B<,>\n"
104 "B< cpu_set_t *>I<srcset1>B<, cpu_set_t *>I<srcset2>B<);>\n"
108 #: build/C/man3/CPU_SET.3:54
110 msgid "B<int CPU_EQUAL(cpu_set_t *>I<set1>B<, cpu_set_t *>I<set2>B<);>\n"
114 #: build/C/man3/CPU_SET.3:58
117 "B<cpu_set_t *CPU_ALLOC(int >I<num_cpus>B<);>\n"
118 "B<void CPU_FREE(cpu_set_t *>I<set>B<);>\n"
119 "B<size_t CPU_ALLOC_SIZE(int >I<num_cpus>B<);>\n"
123 #: build/C/man3/CPU_SET.3:60
125 msgid "B<void CPU_ZERO_S(size_t >I<setsize>B<, cpu_set_t *>I<set>B<);>\n"
129 #: build/C/man3/CPU_SET.3:64
132 "B<void CPU_SET_S(int >I<cpu>B<, size_t >I<setsize>B<, cpu_set_t "
134 "B<void CPU_CLR_S(int >I<cpu>B<, size_t >I<setsize>B<, cpu_set_t "
136 "B<int CPU_ISSET_S(int >I<cpu>B<, size_t >I<setsize>B<, cpu_set_t "
141 #: build/C/man3/CPU_SET.3:66
143 msgid "B<int CPU_COUNT_S(size_t >I<setsize>B<, cpu_set_t *>I<set>B<);>\n"
147 #: build/C/man3/CPU_SET.3:73
150 "B<void CPU_AND_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_OR_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 "B<void CPU_XOR_S(size_t >I<setsize>B<, cpu_set_t *>I<destset>B<,>\n"
155 "B< cpu_set_t *>I<srcset1>B<, cpu_set_t *>I<srcset2>B<);>\n"
159 #: build/C/man3/CPU_SET.3:76
162 "B<int CPU_EQUAL_S(size_t >I<setsize>B<, cpu_set_t *>I<set1>B<, cpu_set_t "
167 #: build/C/man3/CPU_SET.3:77 build/C/man2/clone.2:58 build/C/man2/sched_get_priority_max.2:39 build/C/man3/sched_getcpu.3:35 build/C/man2/sched_rr_get_interval.2:37 build/C/man2/sched_setaffinity.2:50 build/C/man2/sched_setparam.2:48 build/C/man2/sched_setscheduler.2:67 build/C/man2/sched_yield.2:37 build/C/man2/setns.2:14 build/C/man2/unshare.2:29
173 #: build/C/man3/CPU_SET.3:84
175 "The I<cpu_set_t> data structure represents a set of CPUs. CPU sets are used "
176 "by B<sched_setaffinity>(2) and similar interfaces."
180 #: build/C/man3/CPU_SET.3:91
182 "The I<cpu_set_t> data type is implemented as a bitset. However, the data "
183 "structure treated as considered opaque: all manipulation of CPU sets should "
184 "be done via the macros described in this page."
188 #: build/C/man3/CPU_SET.3:94
189 msgid "The following macros are provided to operate on the CPU set I<set>:"
193 #: build/C/man3/CPU_SET.3:94
195 msgid "B<CPU_ZERO>()"
199 #: build/C/man3/CPU_SET.3:99
200 msgid "Clears I<set>, so that it contains no CPUs."
204 #: build/C/man3/CPU_SET.3:99
210 #: build/C/man3/CPU_SET.3:105
211 msgid "Add CPU I<cpu> to I<set>."
215 #: build/C/man3/CPU_SET.3:105
221 #: build/C/man3/CPU_SET.3:111
222 msgid "Remove CPU I<cpu> from I<set>."
226 #: build/C/man3/CPU_SET.3:111
228 msgid "B<CPU_ISSET>()"
232 #: build/C/man3/CPU_SET.3:117
233 msgid "Test to see if CPU I<cpu> is a member of I<set>."
237 #: build/C/man3/CPU_SET.3:117
239 msgid "B<CPU_COUNT>()"
243 #: build/C/man3/CPU_SET.3:121
244 msgid "Return the number of CPUs in I<set>."
248 #: build/C/man3/CPU_SET.3:126
250 "Where a I<cpu> argument is specified, it should not produce side effects, "
251 "since the above macros may evaluate the argument more than once."
255 #: build/C/man3/CPU_SET.3:137
257 "The first available CPU on the system corresponds to a I<cpu> value of 0, "
258 "the next CPU corresponds to a I<cpu> value of 1, and so on. The constant "
259 "B<CPU_SETSIZE> (currently 1024) specifies a value one greater than the "
260 "maximum CPU number that can be stored in I<cpu_set_t>."
264 #: build/C/man3/CPU_SET.3:139
265 msgid "The following macros perform logical operations on CPU sets:"
269 #: build/C/man3/CPU_SET.3:139
275 #: build/C/man3/CPU_SET.3:148
277 "Store the intersection of the sets I<srcset1> and I<srcset2> in I<destset> "
278 "(which may be one of the source sets)."
282 #: build/C/man3/CPU_SET.3:148
288 #: build/C/man3/CPU_SET.3:157
290 "Store the union of the sets I<srcset1> and I<srcset2> in I<destset> (which "
291 "may be one of the source sets)."
295 #: build/C/man3/CPU_SET.3:157
301 #: build/C/man3/CPU_SET.3:171
303 "Store the XOR of the sets I<srcset1> and I<srcset2> in I<destset> (which may "
304 "be one of the source sets). The XOR means the set of CPUs that are in "
305 "either I<srcset1> or I<srcset2>, but not both."
309 #: build/C/man3/CPU_SET.3:171
311 msgid "B<CPU_EQUAL>()"
315 #: build/C/man3/CPU_SET.3:174
316 msgid "Test whether two CPU set contain exactly the same CPUs."
320 #: build/C/man3/CPU_SET.3:174
322 msgid "Dynamically sized CPU sets"
326 #: build/C/man3/CPU_SET.3:180
328 "Because some applications may require the ability to dynamically size CPU "
329 "sets (e.g., to allocate sets larger than that defined by the standard "
330 "I<cpu_set_t> data type), glibc nowadays provides a set of macros to support "
335 #: build/C/man3/CPU_SET.3:182
336 msgid "The following macros are used to allocate and deallocate CPU sets:"
340 #: build/C/man3/CPU_SET.3:182
342 msgid "B<CPU_ALLOC>()"
346 #: build/C/man3/CPU_SET.3:187
348 "Allocate a CPU set large enough to hold CPUs in the range 0 to "
353 #: build/C/man3/CPU_SET.3:187
355 msgid "B<CPU_ALLOC_SIZE>()"
359 #: build/C/man3/CPU_SET.3:197
361 "Return the size in bytes of the CPU set that would be needed to hold CPUs in "
362 "the range 0 to I<num_cpus-1>. This macro provides the value that can be "
363 "used for the I<setsize> argument in the B<CPU_*_S>() macros described "
368 #: build/C/man3/CPU_SET.3:197
370 msgid "B<CPU_FREE>()"
374 #: build/C/man3/CPU_SET.3:201
375 msgid "Free a CPU set previously allocated by B<CPU_ALLOC>()."
379 #: build/C/man3/CPU_SET.3:208
381 "The macros whose names end with \"_S\" are the analogs of the similarly "
382 "named macros without the suffix. These macros perform the same tasks as "
383 "their analogs, but operate on the dynamically allocated CPU set(s) whose "
384 "size is I<setsize> bytes."
388 #: build/C/man3/CPU_SET.3:208 build/C/man2/clone.2:791 build/C/man2/sched_get_priority_max.2:87 build/C/man3/sched_getcpu.3:38 build/C/man2/sched_rr_get_interval.2:72 build/C/man2/sched_setaffinity.2:108 build/C/man2/sched_setparam.2:88 build/C/man2/sched_setscheduler.2:423 build/C/man2/sched_yield.2:42 build/C/man2/setns.2:66 build/C/man2/unshare.2:183
394 #: build/C/man3/CPU_SET.3:217
396 "B<CPU_ISSET>() and B<CPU_ISSET_S>() return nonzero if I<cpu> is in I<set>; "
397 "otherwise, it returns 0."
401 #: build/C/man3/CPU_SET.3:223
402 msgid "B<CPU_COUNT>() and B<CPU_COUNT_S>() return the number of CPUs in I<set>."
406 #: build/C/man3/CPU_SET.3:228
408 "B<CPU_EQUAL>() and B<CPU_EQUAL_S>() return nonzero if the two CPU sets are "
409 "equal; otherwise it returns 0."
413 #: build/C/man3/CPU_SET.3:233
415 "B<CPU_ALLOC>() returns a pointer on success, or NULL on failure. (Errors "
416 "are as for B<malloc>(3).)"
420 #: build/C/man3/CPU_SET.3:237
422 "B<CPU_ALLOC_SIZE>() returns the number of bytes required to store a CPU set "
423 "of the specified cardinality."
427 #: build/C/man3/CPU_SET.3:239
428 msgid "The other functions do not return a value."
432 #: build/C/man3/CPU_SET.3:239 build/C/man2/clone.2:908 build/C/man3/sched_getcpu.3:50 build/C/man2/sched_setaffinity.2:149 build/C/man2/setns.2:93 build/C/man2/unshare.2:200
438 #: build/C/man3/CPU_SET.3:247
440 "The B<CPU_ZERO>(), B<CPU_SET>(), B<CPU_CLR>(), and B<CPU_ISSET>() macros "
441 "were added in glibc 2.3.3."
445 #: build/C/man3/CPU_SET.3:250
446 msgid "B<CPU_COUNT>() first appeared in glibc 2.6."
450 #: build/C/man3/CPU_SET.3:268
452 "B<CPU_AND>(), B<CPU_OR>(), B<CPU_XOR>(), B<CPU_EQUAL>(), B<CPU_ALLOC>(), "
453 "B<CPU_ALLOC_SIZE>(), B<CPU_FREE>(), B<CPU_ZERO_S>(), B<CPU_SET_S>(), "
454 "B<CPU_CLR_S>(), B<CPU_ISSET_S>(), B<CPU_AND_S>(), B<CPU_OR_S>(), "
455 "B<CPU_XOR_S>(), and B<CPU_EQUAL_S>() first appeared in glibc 2.7."
459 #: build/C/man3/CPU_SET.3:268 build/C/man2/clone.2:915 build/C/man2/sched_get_priority_max.2:101 build/C/man3/sched_getcpu.3:52 build/C/man2/sched_rr_get_interval.2:92 build/C/man2/sched_setaffinity.2:160 build/C/man2/sched_setparam.2:111 build/C/man2/sched_setscheduler.2:445 build/C/man2/sched_yield.2:53 build/C/man2/setns.2:97 build/C/man2/unshare.2:204
461 msgid "CONFORMING TO"
465 #: build/C/man3/CPU_SET.3:270
466 msgid "These interfaces are Linux-specific."
470 #: build/C/man3/CPU_SET.3:270 build/C/man2/clone.2:922 build/C/man3/sched_getcpu.3:55 build/C/man2/sched_rr_get_interval.2:94 build/C/man2/sched_setaffinity.2:162 build/C/man2/sched_setscheduler.2:448 build/C/man2/sched_yield.2:55 build/C/man2/setns.2:101 build/C/man2/unshare.2:208
476 #: build/C/man3/CPU_SET.3:273
477 msgid "To duplicate a CPU set, use B<memcpy>(3)."
481 #: build/C/man3/CPU_SET.3:280
483 "Since CPU sets are bitsets allocated in units of long words, the actual "
484 "number of CPUs in a dynamically allocated CPU set will be rounded up to the "
485 "next multiple of I<sizeof(unsigned long)>. An application should consider "
486 "the contents of these extra bits to be undefined."
490 #: build/C/man3/CPU_SET.3:292
492 "Notwithstanding the similarity in the names, note that the constant "
493 "B<CPU_SETSIZE> indicates the number of CPUs in the I<cpu_set_t> data type "
494 "(thus, it is effectively a count of bits in the bitset), while the "
495 "I<setsize> argument of the B<CPU_*_S>() macros is a size in bytes."
499 #: build/C/man3/CPU_SET.3:298
501 "The data types for arguments and return values shown in the SYNOPSIS are "
502 "hints what about is expected in each case. However, since these interfaces "
503 "are implemented as macros, the compiler won't necessarily catch all type "
504 "errors if you violate the suggestions."
508 #: build/C/man3/CPU_SET.3:298
514 #: build/C/man3/CPU_SET.3:301
516 "The following program demonstrates the use of some of the macros used for "
517 "dynamically allocated CPU sets."
521 #: build/C/man3/CPU_SET.3:309
524 "#define _GNU_SOURCE\n"
525 "#include E<lt>sched.hE<gt>\n"
526 "#include E<lt>stdlib.hE<gt>\n"
527 "#include E<lt>unistd.hE<gt>\n"
528 "#include E<lt>stdio.hE<gt>\n"
529 "#include E<lt>assert.hE<gt>\n"
533 #: build/C/man3/CPU_SET.3:316
537 "main(int argc, char *argv[])\n"
539 " cpu_set_t *cpusetp;\n"
541 " int num_cpus, cpu;\n"
545 #: build/C/man3/CPU_SET.3:321
548 " if (argc E<lt> 2) {\n"
549 " fprintf(stderr, \"Usage: %s E<lt>num-cpusE<gt>\\en\", argv[0]);\n"
550 " exit(EXIT_FAILURE);\n"
555 #: build/C/man3/CPU_SET.3:323
557 msgid " num_cpus = atoi(argv[1]);\n"
561 #: build/C/man3/CPU_SET.3:329
564 " cpusetp = CPU_ALLOC(num_cpus);\n"
565 " if (cpusetp == NULL) {\n"
566 " perror(\"CPU_ALLOC\");\n"
567 " exit(EXIT_FAILURE);\n"
572 #: build/C/man3/CPU_SET.3:331
574 msgid " size = CPU_ALLOC_SIZE(num_cpus);\n"
578 #: build/C/man3/CPU_SET.3:335
581 " CPU_ZERO_S(size, cpusetp);\n"
582 " for (cpu = 0; cpu E<lt> num_cpus; cpu += 2)\n"
583 " CPU_SET_S(cpu, size, cpusetp);\n"
587 #: build/C/man3/CPU_SET.3:337
589 msgid " printf(\"CPU_COUNT() of set: %d\\en\", CPU_COUNT_S(size, cpusetp));\n"
593 #: build/C/man3/CPU_SET.3:341
596 " CPU_FREE(cpusetp);\n"
597 " exit(EXIT_SUCCESS);\n"
602 #: build/C/man3/CPU_SET.3:342 build/C/man2/clone.2:969 build/C/man2/sched_setscheduler.2:509 build/C/man2/setns.2:107
607 #. http://sourceware.org/bugzilla/show_bug.cgi?id=7029
609 #: build/C/man3/CPU_SET.3:354
611 "On 32-bit platforms with glibc 2.8 and earlier, B<CPU_ALLOC>() allocates "
612 "twice as much space as is required, and B<CPU_ALLOC_SIZE>() returns a value "
613 "twice as large as it should. This bug should not affect the semantics of a "
614 "program, but does result in wasted memory and less efficient operation of "
615 "the macros that operate on dynamically allocated CPU sets. These bugs are "
616 "fixed in glibc 2.9."
620 #: build/C/man3/CPU_SET.3:354 build/C/man2/clone.2:1011 build/C/man2/sched_get_priority_max.2:103 build/C/man3/sched_getcpu.3:75 build/C/man2/sched_rr_get_interval.2:119 build/C/man2/sched_setaffinity.2:215 build/C/man2/sched_setparam.2:113 build/C/man2/sched_setscheduler.2:517 build/C/man2/sched_yield.2:79 build/C/man2/setns.2:115 build/C/man2/unshare.2:244
626 #: build/C/man3/CPU_SET.3:359
628 "B<sched_setaffinity>(2), B<pthread_attr_setaffinity_np>(3), "
629 "B<pthread_setaffinity_np>(3), B<cpuset>(7)"
633 #: build/C/man3/CPU_SET.3:359 build/C/man2/clone.2:1023 build/C/man2/sched_get_priority_max.2:113 build/C/man3/sched_getcpu.3:77 build/C/man2/sched_rr_get_interval.2:125 build/C/man2/sched_setaffinity.2:231 build/C/man2/sched_setparam.2:127 build/C/man2/sched_setscheduler.2:542 build/C/man2/sched_yield.2:85 build/C/man2/setns.2:121 build/C/man2/unshare.2:249
639 #: build/C/man3/CPU_SET.3:366 build/C/man2/clone.2:1030 build/C/man2/sched_get_priority_max.2:120 build/C/man3/sched_getcpu.3:84 build/C/man2/sched_rr_get_interval.2:132 build/C/man2/sched_setaffinity.2:238 build/C/man2/sched_setparam.2:134 build/C/man2/sched_setscheduler.2:549 build/C/man2/sched_yield.2:92 build/C/man2/setns.2:128 build/C/man2/unshare.2:256
641 "This page is part of release 3.35 of the Linux I<man-pages> project. A "
642 "description of the project, and information about reporting bugs, can be "
643 "found at http://man7.org/linux/man-pages/."
647 #: build/C/man2/clone.2:43
653 #: build/C/man2/clone.2:43
659 #: build/C/man2/clone.2:46
660 msgid "clone, __clone2 - create a child process"
664 #: build/C/man2/clone.2:57
667 "B<int clone(int (*>I<fn>B<)(void *), void *>I<child_stack>B<,>\n"
668 "B< int >I<flags>B<, void *>I<arg>B<, ... >\n"
669 "B< /* pid_t *>I<ptid>B<, struct user_desc *>I<tls>B<, pid_t "
670 "*>I<ctid>B< */ );>\n"
674 #: build/C/man2/clone.2:69
676 "B<clone>() creates a new process, in a manner similar to B<fork>(2). It is "
677 "actually a library function layered on top of the underlying B<clone>() "
678 "system call, hereinafter referred to as B<sys_clone>. A description of "
679 "B<sys_clone> is given toward the end of this page."
683 #: build/C/man2/clone.2:81
685 "Unlike B<fork>(2), these calls allow the child process to share parts of its "
686 "execution context with the calling process, such as the memory space, the "
687 "table of file descriptors, and the table of signal handlers. (Note that on "
688 "this manual page, \"calling process\" normally corresponds to \"parent "
689 "process\". But see the description of B<CLONE_PARENT> below.)"
693 #: build/C/man2/clone.2:86
695 "The main use of B<clone>() is to implement threads: multiple threads of "
696 "control in a program that run concurrently in a shared memory space."
700 #: build/C/man2/clone.2:107
702 "When the child process is created with B<clone>(), it executes the function "
703 "application I<fn>(I<arg>). (This differs from B<fork>(2), where execution "
704 "continues in the child from the point of the B<fork>(2) call.) The I<fn> "
705 "argument is a pointer to a function that is called by the child process at "
706 "the beginning of its execution. The I<arg> argument is passed to the I<fn> "
711 #: build/C/man2/clone.2:117
713 "When the I<fn>(I<arg>) function application returns, the child process "
714 "terminates. The integer returned by I<fn> is the exit code for the child "
715 "process. The child process may also terminate explicitly by calling "
716 "B<exit>(2) or after receiving a fatal signal."
720 #: build/C/man2/clone.2:133
722 "The I<child_stack> argument specifies the location of the stack used by the "
723 "child process. Since the child and calling process may share memory, it is "
724 "not possible for the child process to execute in the same stack as the "
725 "calling process. The calling process must therefore set up memory space for "
726 "the child stack and pass a pointer to this space to B<clone>(). Stacks grow "
727 "downward on all processors that run Linux (except the HP PA processors), so "
728 "I<child_stack> usually points to the topmost address of the memory space set "
729 "up for the child stack."
733 #: build/C/man2/clone.2:149
735 "The low byte of I<flags> contains the number of the I<termination signal> "
736 "sent to the parent when the child dies. If this signal is specified as "
737 "anything other than B<SIGCHLD>, then the parent process must specify the "
738 "B<__WALL> or B<__WCLONE> options when waiting for the child with "
739 "B<wait>(2). If no signal is specified, then the parent process is not "
740 "signaled when the child terminates."
744 #: build/C/man2/clone.2:154
746 "I<flags> may also be bitwise-or'ed with zero or more of the following "
747 "constants, in order to specify what is shared between the calling process "
748 "and the child process:"
752 #: build/C/man2/clone.2:154
754 msgid "B<CLONE_CHILD_CLEARTID> (since Linux 2.5.49)"
758 #: build/C/man2/clone.2:164
760 "Erase child thread ID at location I<ctid> in child memory when the child "
761 "exits, and do a wakeup on the futex at that address. The address involved "
762 "may be changed by the B<set_tid_address>(2) system call. This is used by "
763 "threading libraries."
767 #: build/C/man2/clone.2:164
769 msgid "B<CLONE_CHILD_SETTID> (since Linux 2.5.49)"
773 #: build/C/man2/clone.2:169
774 msgid "Store child thread ID at location I<ctid> in child memory."
778 #: build/C/man2/clone.2:169 build/C/man2/unshare.2:53
780 msgid "B<CLONE_FILES>"
784 #: build/C/man2/clone.2:182
786 "If B<CLONE_FILES> is set, the calling process and the child process share "
787 "the same file descriptor table. Any file descriptor created by the calling "
788 "process or by the child process is also valid in the other process. "
789 "Similarly, if one of the processes closes a file descriptor, or changes its "
790 "associated flags (using the B<fcntl>(2) B<F_SETFD> operation), the other "
791 "process is also affected."
795 #: build/C/man2/clone.2:196
797 "If B<CLONE_FILES> is not set, the child process inherits a copy of all file "
798 "descriptors opened in the calling process at the time of B<clone>(). (The "
799 "duplicated file descriptors in the child refer to the same open file "
800 "descriptions (see B<open>(2)) as the corresponding file descriptors in the "
801 "calling process.) Subsequent operations that open or close file "
802 "descriptors, or change file descriptor flags, performed by either the "
803 "calling process or the child process do not affect the other process."
807 #: build/C/man2/clone.2:196 build/C/man2/unshare.2:61
813 #: build/C/man2/clone.2:211
815 "If B<CLONE_FS> is set, the caller and the child process share the same file "
816 "system information. This includes the root of the file system, the current "
817 "working directory, and the umask. Any call to B<chroot>(2), B<chdir>(2), or "
818 "B<umask>(2) performed by the calling process or the child process also "
819 "affects the other process."
823 #: build/C/man2/clone.2:223
825 "If B<CLONE_FS> is not set, the child process works on a copy of the file "
826 "system information of the calling process at the time of the B<clone>() "
827 "call. Calls to B<chroot>(2), B<chdir>(2), B<umask>(2) performed later by "
828 "one of the processes do not affect the other process."
832 #: build/C/man2/clone.2:223
834 msgid "B<CLONE_IO> (since Linux 2.6.25)"
838 #: build/C/man2/clone.2:232
840 "If B<CLONE_IO> is set, then the new process shares an I/O context with the "
841 "calling process. If this flag is not set, then (as with B<fork>(2)) the "
842 "new process has its own I/O context."
845 #. The following based on text from Jens Axboe
846 #. the anticipatory and CFQ scheduler
849 #: build/C/man2/clone.2:249
851 "The I/O context is the I/O scope of the disk scheduler (i.e, what the I/O "
852 "scheduler uses to model scheduling of a process's I/O). If processes share "
853 "the same I/O context, they are treated as one by the I/O scheduler. As a "
854 "consequence, they get to share disk time. For some I/O schedulers, if two "
855 "processes share an I/O context, they will be allowed to interleave their "
856 "disk access. If several threads are doing I/O on behalf of the same process "
857 "(B<aio_read>(3), for instance), they should employ B<CLONE_IO> to get better "
862 #: build/C/man2/clone.2:253
864 "If the kernel is not configured with the B<CONFIG_BLOCK> option, this flag "
869 #: build/C/man2/clone.2:253 build/C/man2/unshare.2:74
871 msgid "B<CLONE_NEWIPC> (since Linux 2.6.19)"
875 #: build/C/man2/clone.2:263
877 "If B<CLONE_NEWIPC> is set, then create the process in a new IPC namespace. "
878 "If this flag is not set, then (as with B<fork>(2)), the process is created "
879 "in the same IPC namespace as the calling process. This flag is intended for "
880 "the implementation of containers."
884 #: build/C/man2/clone.2:274
886 "An IPC namespace consists of the set of identifiers for System V IPC "
887 "objects. (These objects are created using B<msgctl>(2), B<semctl>(2), and "
888 "B<shmctl>(2)). Objects created in an IPC namespace are visible to all other "
889 "processes that are members of that namespace, but are not visible to "
890 "processes in other IPC namespaces."
894 #: build/C/man2/clone.2:278
896 "When an IPC namespace is destroyed (i.e, when the last process that is a "
897 "member of the namespace terminates), all IPC objects in the namespace are "
898 "automatically destroyed."
902 #: build/C/man2/clone.2:287
904 "Use of this flag requires: a kernel configured with the B<CONFIG_SYSVIPC> "
905 "and B<CONFIG_IPC_NS> options and that the process be privileged "
906 "(B<CAP_SYS_ADMIN>). This flag can't be specified in conjunction with "
911 #: build/C/man2/clone.2:287 build/C/man2/unshare.2:91
913 msgid "B<CLONE_NEWNET> (since Linux 2.6.24)"
917 #: build/C/man2/clone.2:291
919 "(The implementation of this flag was only completed by about kernel version "
924 #: build/C/man2/clone.2:300
926 "If B<CLONE_NEWNET> is set, then create the process in a new network "
927 "namespace. If this flag is not set, then (as with B<fork>(2)), the process "
928 "is created in the same network namespace as the calling process. This flag "
929 "is intended for the implementation of containers."
933 #: build/C/man2/clone.2:314
935 "A network namespace provides an isolated view of the networking stack "
936 "(network device interfaces, IPv4 and IPv6 protocol stacks, IP routing "
937 "tables, firewall rules, the I</proc/net> and I</sys/class/net> directory "
938 "trees, sockets, etc.). A physical network device can live in exactly one "
939 "network namespace. A virtual network device (\"veth\") pair provides a "
940 "pipe-like abstraction that can be used to create tunnels between network "
941 "namespaces, and can be used to create a bridge to a physical network device "
942 "in another namespace."
946 #: build/C/man2/clone.2:319
948 "When a network namespace is freed (i.e., when the last process in the "
949 "namespace terminates), its physical network devices are moved back to the "
950 "initial network namespace (not to the parent of the process)."
954 #: build/C/man2/clone.2:324
956 "Use of this flag requires: a kernel configured with the B<CONFIG_NET_NS> "
957 "option and that the process be privileged (B<CAP_SYS_ADMIN>)."
961 #: build/C/man2/clone.2:324
963 msgid "B<CLONE_NEWNS> (since Linux 2.4.19)"
967 #: build/C/man2/clone.2:327
968 msgid "Start the child in a new mount namespace."
972 #: build/C/man2/clone.2:348
974 "Every process lives in a mount namespace. The I<namespace> of a process is "
975 "the data (the set of mounts) describing the file hierarchy as seen by that "
976 "process. After a B<fork>(2) or B<clone>() where the B<CLONE_NEWNS> flag "
977 "is not set, the child lives in the same mount namespace as the parent. The "
978 "system calls B<mount>(2) and B<umount>(2) change the mount namespace of "
979 "the calling process, and hence affect all processes that live in the same "
980 "namespace, but do not affect processes in a different mount namespace."
984 #: build/C/man2/clone.2:355
986 "After a B<clone>() where the B<CLONE_NEWNS> flag is set, the cloned child "
987 "is started in a new mount namespace, initialized with a copy of the "
988 "namespace of the parent."
992 #: build/C/man2/clone.2:367
994 "Only a privileged process (one having the B<CAP_SYS_ADMIN> capability) may "
995 "specify the B<CLONE_NEWNS> flag. It is not permitted to specify both "
996 "B<CLONE_NEWNS> and B<CLONE_FS> in the same B<clone>() call."
1000 #: build/C/man2/clone.2:367
1002 msgid "B<CLONE_NEWPID> (since Linux 2.6.24)"
1005 #. This explanation draws a lot of details from
1006 #. http://lwn.net/Articles/259217/
1007 #. Authors: Pavel Emelyanov <xemul@openvz.org>
1008 #. and Kir Kolyshkin <kir@openvz.org>
1010 #. The primary kernel commit is 30e49c263e36341b60b735cbef5ca37912549264
1011 #. Author: Pavel Emelyanov <xemul@openvz.org>
1013 #: build/C/man2/clone.2:384
1015 "If B<CLONE_NEWPID> is set, then create the process in a new PID namespace. "
1016 "If this flag is not set, then (as with B<fork>(2)), the process is created "
1017 "in the same PID namespace as the calling process. This flag is intended for "
1018 "the implementation of containers."
1022 #: build/C/man2/clone.2:393
1024 "A PID namespace provides an isolated environment for PIDs: PIDs in a new "
1025 "namespace start at 1, somewhat like a standalone system, and calls to "
1026 "B<fork>(2), B<vfork>(2), or B<clone>() will produce processes with PIDs "
1027 "that are unique within the namespace."
1031 #: build/C/man2/clone.2:405
1033 "The first process created in a new namespace (i.e., the process created "
1034 "using the B<CLONE_NEWPID> flag) has the PID 1, and is the \"init\" process "
1035 "for the namespace. Children that are orphaned within the namespace will be "
1036 "reparented to this process rather than B<init>(8). Unlike the traditional "
1037 "B<init> process, the \"init\" process of a PID namespace can terminate, and "
1038 "if it does, all of the processes in the namespace are terminated."
1042 #: build/C/man2/clone.2:424
1044 "PID namespaces form a hierarchy. When a new PID namespace is created, the "
1045 "processes in that namespace are visible in the PID namespace of the process "
1046 "that created the new namespace; analogously, if the parent PID namespace is "
1047 "itself the child of another PID namespace, then processes in the child and "
1048 "parent PID namespaces will both be visible in the grandparent PID "
1049 "namespace. Conversely, the processes in the \"child\" PID namespace do not "
1050 "see the processes in the parent namespace. The existence of a namespace "
1051 "hierarchy means that each process may now have multiple PIDs: one for each "
1052 "namespace in which it is visible; each of these PIDs is unique within the "
1053 "corresponding namespace. (A call to B<getpid>(2) always returns the PID "
1054 "associated with the namespace in which the process lives.)"
1057 #. mount -t proc proc /proc
1059 #: build/C/man2/clone.2:440
1061 "After creating the new namespace, it is useful for the child to change its "
1062 "root directory and mount a new procfs instance at I</proc> so that tools "
1063 "such as B<ps>(1) work correctly. (If B<CLONE_NEWNS> is also included in "
1064 "I<flags>, then it isn't necessary to change the root directory: a new procfs "
1065 "instance can be mounted directly over I</proc>.)"
1069 #: build/C/man2/clone.2:447
1071 "Use of this flag requires: a kernel configured with the B<CONFIG_PID_NS> "
1072 "option and that the process be privileged (B<CAP_SYS_ADMIN>). This flag "
1073 "can't be specified in conjunction with B<CLONE_THREAD>."
1077 #: build/C/man2/clone.2:447 build/C/man2/unshare.2:140
1079 msgid "B<CLONE_NEWUTS> (since Linux 2.6.19)"
1083 #: build/C/man2/clone.2:459
1085 "If B<CLONE_NEWUTS> is set, then create the process in a new UTS namespace, "
1086 "whose identifiers are initialized by duplicating the identifiers from the "
1087 "UTS namespace of the calling process. If this flag is not set, then (as "
1088 "with B<fork>(2)), the process is created in the same UTS namespace as the "
1089 "calling process. This flag is intended for the implementation of "
1094 #: build/C/man2/clone.2:471
1096 "A UTS namespace is the set of identifiers returned by B<uname>(2); among "
1097 "these, the domain name and the host name can be modified by "
1098 "B<setdomainname>(2) and B<sethostname>(2), respectively. Changes made to "
1099 "the identifiers in a UTS namespace are visible to all other processes in the "
1100 "same namespace, but are not visible to processes in other UTS namespaces."
1104 #: build/C/man2/clone.2:476
1106 "Use of this flag requires: a kernel configured with the B<CONFIG_UTS_NS> "
1107 "option and that the process be privileged (B<CAP_SYS_ADMIN>)."
1111 #: build/C/man2/clone.2:476
1113 msgid "B<CLONE_PARENT> (since Linux 2.3.12)"
1117 #: build/C/man2/clone.2:483
1119 "If B<CLONE_PARENT> is set, then the parent of the new child (as returned by "
1120 "B<getppid>(2)) will be the same as that of the calling process."
1124 #: build/C/man2/clone.2:489
1126 "If B<CLONE_PARENT> is not set, then (as with B<fork>(2)) the child's parent "
1127 "is the calling process."
1131 #: build/C/man2/clone.2:497
1133 "Note that it is the parent process, as returned by B<getppid>(2), which is "
1134 "signaled when the child terminates, so that if B<CLONE_PARENT> is set, then "
1135 "the parent of the calling process, rather than the calling process itself, "
1140 #: build/C/man2/clone.2:497
1142 msgid "B<CLONE_PARENT_SETTID> (since Linux 2.5.49)"
1146 #: build/C/man2/clone.2:505
1148 "Store child thread ID at location I<ptid> in parent and child memory. (In "
1149 "Linux 2.5.32-2.5.48 there was a flag B<CLONE_SETTID> that did this.)"
1153 #: build/C/man2/clone.2:505
1155 msgid "B<CLONE_PID> (obsolete)"
1159 #: build/C/man2/clone.2:516
1161 "If B<CLONE_PID> is set, the child process is created with the same process "
1162 "ID as the calling process. This is good for hacking the system, but "
1163 "otherwise of not much use. Since 2.3.21 this flag can be specified only by "
1164 "the system boot process (PID 0). It disappeared in Linux 2.5.16."
1168 #: build/C/man2/clone.2:516
1170 msgid "B<CLONE_PTRACE>"
1174 #: build/C/man2/clone.2:523
1176 "If B<CLONE_PTRACE> is specified, and the calling process is being traced, "
1177 "then trace the child also (see B<ptrace>(2))."
1181 #: build/C/man2/clone.2:523
1183 msgid "B<CLONE_SETTLS> (since Linux 2.5.32)"
1187 #: build/C/man2/clone.2:530
1189 "The I<newtls> argument is the new TLS (Thread Local Storage) descriptor. "
1190 "(See B<set_thread_area>(2).)"
1194 #: build/C/man2/clone.2:530
1196 msgid "B<CLONE_SIGHAND>"
1200 #: build/C/man2/clone.2:546
1202 "If B<CLONE_SIGHAND> is set, the calling process and the child process share "
1203 "the same table of signal handlers. If the calling process or child process "
1204 "calls B<sigaction>(2) to change the behavior associated with a signal, the "
1205 "behavior is changed in the other process as well. However, the calling "
1206 "process and child processes still have distinct signal masks and sets of "
1207 "pending signals. So, one of them may block or unblock some signals using "
1208 "B<sigprocmask>(2) without affecting the other process."
1212 #: build/C/man2/clone.2:557
1214 "If B<CLONE_SIGHAND> is not set, the child process inherits a copy of the "
1215 "signal handlers of the calling process at the time B<clone>() is called. "
1216 "Calls to B<sigaction>(2) performed later by one of the processes have no "
1217 "effect on the other process."
1221 #: build/C/man2/clone.2:565
1223 "Since Linux 2.6.0-test6, I<flags> must also include B<CLONE_VM> if "
1224 "B<CLONE_SIGHAND> is specified"
1228 #: build/C/man2/clone.2:565
1230 msgid "B<CLONE_STOPPED> (since Linux 2.6.0-test2)"
1234 #: build/C/man2/clone.2:574
1236 "If B<CLONE_STOPPED> is set, then the child is initially stopped (as though "
1237 "it was sent a B<SIGSTOP> signal), and must be resumed by sending it a "
1238 "B<SIGCONT> signal."
1241 #. glibc 2.8 removed this defn from bits/sched.h
1243 #: build/C/man2/clone.2:582
1245 "This flag was I<deprecated> from Linux 2.6.25 onward, and was I<removed> "
1246 "altogether in Linux 2.6.38."
1250 #: build/C/man2/clone.2:582
1252 msgid "B<CLONE_SYSVSEM> (since Linux 2.5.10)"
1256 #: build/C/man2/clone.2:591
1258 "If B<CLONE_SYSVSEM> is set, then the child and the calling process share a "
1259 "single list of System V semaphore undo values (see B<semop>(2)). If this "
1260 "flag is not set, then the child has a separate undo list, which is initially "
1265 #: build/C/man2/clone.2:591
1267 msgid "B<CLONE_THREAD> (since Linux 2.4.0-test8)"
1271 #: build/C/man2/clone.2:600
1273 "If B<CLONE_THREAD> is set, the child is placed in the same thread group as "
1274 "the calling process. To make the remainder of the discussion of "
1275 "B<CLONE_THREAD> more readable, the term \"thread\" is used to refer to the "
1276 "processes within a thread group."
1280 #: build/C/man2/clone.2:608
1282 "Thread groups were a feature added in Linux 2.4 to support the POSIX threads "
1283 "notion of a set of threads that share a single PID. Internally, this shared "
1284 "PID is the so-called thread group identifier (TGID) for the thread group. "
1285 "Since Linux 2.4, calls to B<getpid>(2) return the TGID of the caller."
1289 #: build/C/man2/clone.2:617
1291 "The threads within a group can be distinguished by their (system-wide) "
1292 "unique thread IDs (TID). A new thread's TID is available as the function "
1293 "result returned to the caller of B<clone>(), and a thread can obtain its own "
1294 "TID using B<gettid>(2)."
1298 #: build/C/man2/clone.2:627
1300 "When a call is made to B<clone>() without specifying B<CLONE_THREAD>, then "
1301 "the resulting thread is placed in a new thread group whose TGID is the same "
1302 "as the thread's TID. This thread is the I<leader> of the new thread group."
1306 #: build/C/man2/clone.2:649
1308 "A new thread created with B<CLONE_THREAD> has the same parent process as the "
1309 "caller of B<clone>() (i.e., like B<CLONE_PARENT>), so that calls to "
1310 "B<getppid>(2) return the same value for all of the threads in a thread "
1311 "group. When a B<CLONE_THREAD> thread terminates, the thread that created it "
1312 "using B<clone>() is not sent a B<SIGCHLD> (or other termination) signal; "
1313 "nor can the status of such a thread be obtained using B<wait>(2). (The "
1314 "thread is said to be I<detached>.)"
1318 #: build/C/man2/clone.2:654
1320 "After all of the threads in a thread group terminate the parent process of "
1321 "the thread group is sent a B<SIGCHLD> (or other termination) signal."
1325 #: build/C/man2/clone.2:659
1327 "If any of the threads in a thread group performs an B<execve>(2), then all "
1328 "threads other than the thread group leader are terminated, and the new "
1329 "program is executed in the thread group leader."
1333 #: build/C/man2/clone.2:665
1335 "If one of the threads in a thread group creates a child using B<fork>(2), "
1336 "then any thread in the group can B<wait>(2) for that child."
1340 #: build/C/man2/clone.2:673
1342 "Since Linux 2.5.35, I<flags> must also include B<CLONE_SIGHAND> if "
1343 "B<CLONE_THREAD> is specified."
1347 #: build/C/man2/clone.2:678
1349 "Signals may be sent to a thread group as a whole (i.e., a TGID) using "
1350 "B<kill>(2), or to a specific thread (i.e., TID) using B<tgkill>(2)."
1354 #: build/C/man2/clone.2:683
1356 "Signal dispositions and actions are process-wide: if an unhandled signal is "
1357 "delivered to a thread, then it will affect (terminate, stop, continue, be "
1358 "ignored in) all members of the thread group."
1362 #: build/C/man2/clone.2:696
1364 "Each thread has its own signal mask, as set by B<sigprocmask>(2), but "
1365 "signals can be pending either: for the whole process (i.e., deliverable to "
1366 "any member of the thread group), when sent with B<kill>(2); or for an "
1367 "individual thread, when sent with B<tgkill>(2). A call to B<sigpending>(2) "
1368 "returns a signal set that is the union of the signals pending for the whole "
1369 "process and the signals that are pending for the calling thread."
1373 #: build/C/man2/clone.2:708
1375 "If B<kill>(2) is used to send a signal to a thread group, and the thread "
1376 "group has installed a handler for the signal, then the handler will be "
1377 "invoked in exactly one, arbitrarily selected member of the thread group that "
1378 "has not blocked the signal. If multiple threads in a group are waiting to "
1379 "accept the same signal using B<sigwaitinfo>(2), the kernel will arbitrarily "
1380 "select one of these threads to receive a signal sent using B<kill>(2)."
1384 #: build/C/man2/clone.2:708
1386 msgid "B<CLONE_UNTRACED> (since Linux 2.5.46)"
1390 #: build/C/man2/clone.2:715
1392 "If B<CLONE_UNTRACED> is specified, then a tracing process cannot force "
1393 "B<CLONE_PTRACE> on this child process."
1397 #: build/C/man2/clone.2:715
1399 msgid "B<CLONE_VFORK>"
1403 #: build/C/man2/clone.2:727
1405 "If B<CLONE_VFORK> is set, the execution of the calling process is suspended "
1406 "until the child releases its virtual memory resources via a call to "
1407 "B<execve>(2) or B<_exit>(2) (as with B<vfork>(2))."
1411 #: build/C/man2/clone.2:733
1413 "If B<CLONE_VFORK> is not set then both the calling process and the child are "
1414 "schedulable after the call, and an application should not rely on execution "
1415 "occurring in any particular order."
1419 #: build/C/man2/clone.2:733
1425 #: build/C/man2/clone.2:746
1427 "If B<CLONE_VM> is set, the calling process and the child process run in the "
1428 "same memory space. In particular, memory writes performed by the calling "
1429 "process or by the child process are also visible in the other process. "
1430 "Moreover, any memory mapping or unmapping performed with B<mmap>(2) or "
1431 "B<munmap>(2) by the child or calling process also affects the other "
1436 #: build/C/man2/clone.2:755
1438 "If B<CLONE_VM> is not set, the child process runs in a separate copy of the "
1439 "memory space of the calling process at the time of B<clone>(). Memory "
1440 "writes or file mappings/unmappings performed by one of the processes do not "
1441 "affect the other, as with B<fork>(2)."
1445 #: build/C/man2/clone.2:755
1451 #: build/C/man2/clone.2:772
1453 "The B<sys_clone> system call corresponds more closely to B<fork>(2) in that "
1454 "execution in the child continues from the point of the call. Thus, "
1455 "B<sys_clone> only requires the I<flags> and I<child_stack> arguments, which "
1456 "have the same meaning as for B<clone>(). (Note that the order of these "
1457 "arguments differs from B<clone>().)"
1461 #: build/C/man2/clone.2:783
1463 "Another difference for B<sys_clone> is that the I<child_stack> argument may "
1464 "be zero, in which case copy-on-write semantics ensure that the child gets "
1465 "separate copies of stack pages when either process modifies the stack. In "
1466 "this case, for correct operation, the B<CLONE_VM> option should not be "
1471 #: build/C/man2/clone.2:791
1473 "In Linux 2.4 and earlier, B<clone>() does not take arguments I<ptid>, "
1474 "I<tls>, and I<ctid>."
1477 #. gettid(2) returns current->pid;
1478 #. getpid(2) returns current->tgid;
1480 #: build/C/man2/clone.2:800
1482 "On success, the thread ID of the child process is returned in the caller's "
1483 "thread of execution. On failure, -1 is returned in the caller's context, no "
1484 "child process will be created, and I<errno> will be set appropriately."
1488 #: build/C/man2/clone.2:800 build/C/man2/sched_get_priority_max.2:97 build/C/man3/sched_getcpu.3:45 build/C/man2/sched_rr_get_interval.2:79 build/C/man2/sched_setaffinity.2:117 build/C/man2/sched_setparam.2:97 build/C/man2/sched_setscheduler.2:433 build/C/man2/sched_yield.2:49 build/C/man2/setns.2:73 build/C/man2/unshare.2:188
1494 #: build/C/man2/clone.2:801
1500 #: build/C/man2/clone.2:804
1501 msgid "Too many processes are already running."
1505 #: build/C/man2/clone.2:804 build/C/man2/clone.2:811 build/C/man2/clone.2:826 build/C/man2/clone.2:834 build/C/man2/clone.2:842 build/C/man2/clone.2:850 build/C/man2/clone.2:856 build/C/man2/clone.2:866 build/C/man2/clone.2:874 build/C/man2/clone.2:882 build/C/man2/sched_get_priority_max.2:98 build/C/man2/sched_rr_get_interval.2:83 build/C/man2/sched_setaffinity.2:121 build/C/man2/sched_setaffinity.2:129 build/C/man2/sched_setparam.2:98 build/C/man2/sched_setscheduler.2:434 build/C/man2/setns.2:78 build/C/man2/unshare.2:189
1511 #: build/C/man2/clone.2:811
1513 "B<CLONE_SIGHAND> was specified, but B<CLONE_VM> was not. (Since Linux "
1520 #. .B CLONE_DETACHED
1524 #. (Since Linux 2.6.0-test6.)
1526 #: build/C/man2/clone.2:826
1528 "B<CLONE_THREAD> was specified, but B<CLONE_SIGHAND> was not. (Since Linux "
1533 #: build/C/man2/clone.2:834
1534 msgid "Both B<CLONE_FS> and B<CLONE_NEWNS> were specified in I<flags>."
1538 #: build/C/man2/clone.2:842
1539 msgid "Both B<CLONE_NEWIPC> and B<CLONE_SYSVSEM> were specified in I<flags>."
1543 #: build/C/man2/clone.2:850
1544 msgid "Both B<CLONE_NEWPID> and B<CLONE_THREAD> were specified in I<flags>."
1548 #: build/C/man2/clone.2:856
1549 msgid "Returned by B<clone>() when a zero value is specified for I<child_stack>."
1553 #: build/C/man2/clone.2:866
1555 "B<CLONE_NEWIPC> was specified in I<flags>, but the kernel was not configured "
1556 "with the B<CONFIG_SYSVIPC> and B<CONFIG_IPC_NS> options."
1560 #: build/C/man2/clone.2:874
1562 "B<CLONE_NEWNET> was specified in I<flags>, but the kernel was not configured "
1563 "with the B<CONFIG_NET_NS> option."
1567 #: build/C/man2/clone.2:882
1569 "B<CLONE_NEWPID> was specified in I<flags>, but the kernel was not configured "
1570 "with the B<CONFIG_PID_NS> option."
1574 #: build/C/man2/clone.2:890
1576 "B<CLONE_NEWUTS> was specified in I<flags>, but the kernel was not configured "
1577 "with the B<CONFIG_UTS> option."
1581 #: build/C/man2/clone.2:890 build/C/man2/setns.2:85 build/C/man2/unshare.2:193
1587 #: build/C/man2/clone.2:895
1589 "Cannot allocate sufficient memory to allocate a task structure for the "
1590 "child, or to copy those parts of the caller's context that need to be "
1595 #: build/C/man2/clone.2:895 build/C/man2/clone.2:904 build/C/man2/sched_setaffinity.2:136 build/C/man2/sched_setparam.2:102 build/C/man2/sched_setscheduler.2:439 build/C/man2/setns.2:88 build/C/man2/unshare.2:197
1601 #: build/C/man2/clone.2:904
1603 "B<CLONE_NEWIPC>, B<CLONE_NEWNET>, B<CLONE_NEWNS>, B<CLONE_NEWPID>, or "
1604 "B<CLONE_NEWUTS> was specified by an unprivileged process (process without "
1605 "B<CAP_SYS_ADMIN>)."
1609 #: build/C/man2/clone.2:908
1610 msgid "B<CLONE_PID> was specified by a process other than process 0."
1614 #: build/C/man2/clone.2:915
1616 "There is no entry for B<clone>() in libc5. glibc2 provides B<clone>() as "
1617 "described in this manual page."
1621 #: build/C/man2/clone.2:922
1623 "The B<clone>() and B<sys_clone> calls are Linux-specific and should not be "
1624 "used in programs intended to be portable."
1628 #: build/C/man2/clone.2:932
1630 "In the kernel 2.4.x series, B<CLONE_THREAD> generally does not make the "
1631 "parent of the new thread the same as the parent of the calling process. "
1632 "However, for kernel versions 2.4.7 to 2.4.18 the B<CLONE_THREAD> flag "
1633 "implied the B<CLONE_PARENT> flag (as in kernel 2.6)."
1637 #: build/C/man2/clone.2:942
1639 "For a while there was B<CLONE_DETACHED> (introduced in 2.5.32): parent wants "
1640 "no child-exit signal. In 2.6.2 the need to give this together with "
1641 "B<CLONE_THREAD> disappeared. This flag is still defined, but has no effect."
1645 #: build/C/man2/clone.2:947
1647 "On i386, B<clone>() should not be called through vsyscall, but directly "
1648 "through I<int $0x80>."
1652 #: build/C/man2/clone.2:949
1653 msgid "On ia64, a different system call is used:"
1657 #: build/C/man2/clone.2:956
1660 "B<int __clone2(int (*>I<fn>B<)(void *), >\n"
1661 "B< void *>I<child_stack_base>B<, size_t >I<stack_size>B<,>\n"
1662 "B< int >I<flags>B<, void *>I<arg>B<, ... >\n"
1663 "B< /* pid_t *>I<ptid>B<, struct user_desc *>I<tls>B<, pid_t "
1664 "*>I<ctid>B< */ );>\n"
1668 #: build/C/man2/clone.2:969
1670 "The B<__clone2>() system call operates in the same way as B<clone>(), "
1671 "except that I<child_stack_base> points to the lowest address of the child's "
1672 "stack area, and I<stack_size> specifies the size of the stack pointed to by "
1673 "I<child_stack_base>."
1677 #: build/C/man2/clone.2:1000
1679 "Versions of the GNU C library that include the NPTL threading library "
1680 "contain a wrapper function for B<getpid>(2) that performs caching of PIDs. "
1681 "This caching relies on support in the glibc wrapper for B<clone>(), but as "
1682 "currently implemented, the cache may not be up to date in some "
1683 "circumstances. In particular, if a signal is delivered to the child "
1684 "immediately after the B<clone>() call, then a call to B<getpid>(2) in a "
1685 "handler for the signal may return the PID of the calling process (\"the "
1686 "parent\"), if the clone wrapper has not yet had a chance to update the PID "
1687 "cache in the child. (This discussion ignores the case where the child was "
1688 "created using B<CLONE_THREAD>, when B<getpid>(2) I<should> return the same "
1689 "value in the child and in the process that called B<clone>(), since the "
1690 "caller and the child are in the same thread group. The stale-cache problem "
1691 "also does not occur if the I<flags> argument includes B<CLONE_VM>.) To get "
1692 "the truth, it may be necessary to use code such as the following:"
1696 #: build/C/man2/clone.2:1003
1698 msgid " #include E<lt>syscall.hE<gt>\n"
1702 #: build/C/man2/clone.2:1005
1704 msgid " pid_t mypid;\n"
1708 #: build/C/man2/clone.2:1007
1710 msgid " mypid = syscall(SYS_getpid);\n"
1714 #: build/C/man2/clone.2:1023
1716 "B<fork>(2), B<futex>(2), B<getpid>(2), B<gettid>(2), B<set_thread_area>(2), "
1717 "B<set_tid_address>(2), B<tkill>(2), B<unshare>(2), B<wait>(2), "
1718 "B<capabilities>(7), B<pthreads>(7)"
1722 #: build/C/man2/sched_get_priority_max.2:30
1724 msgid "SCHED_GET_PRIORITY_MAX"
1728 #: build/C/man2/sched_get_priority_max.2:30 build/C/man2/sched_setparam.2:31
1734 #: build/C/man2/sched_get_priority_max.2:33
1735 msgid "sched_get_priority_max, sched_get_priority_min - get static priority range"
1739 #: build/C/man2/sched_get_priority_max.2:35 build/C/man2/sched_rr_get_interval.2:35 build/C/man2/sched_yield.2:35
1740 msgid "B<#include E<lt>sched.hE<gt>>"
1744 #: build/C/man2/sched_get_priority_max.2:37
1745 msgid "B<int sched_get_priority_max(int >I<policy>B<);>"
1749 #: build/C/man2/sched_get_priority_max.2:39
1750 msgid "B<int sched_get_priority_min(int >I<policy>B<);>"
1754 #: build/C/man2/sched_get_priority_max.2:55
1756 "B<sched_get_priority_max>() returns the maximum priority value that can be "
1757 "used with the scheduling algorithm identified by I<policy>. "
1758 "B<sched_get_priority_min>() returns the minimum priority value that can be "
1759 "used with the scheduling algorithm identified by I<policy>. Supported "
1760 "I<policy> values are B<SCHED_FIFO>, B<SCHED_RR>, B<SCHED_OTHER>, and "
1761 "B<SCHED_BATCH>. Further details about these policies can be found in "
1762 "B<sched_setscheduler>(2)."
1766 #: build/C/man2/sched_get_priority_max.2:64
1768 "Processes with numerically higher priority values are scheduled before "
1769 "processes with numerically lower priority values. Thus, the value returned "
1770 "by B<sched_get_priority_max>() will be greater than the value returned by "
1771 "B<sched_get_priority_min>()."
1775 #: build/C/man2/sched_get_priority_max.2:70
1777 "Linux allows the static priority value range 1 to 99 for B<SCHED_FIFO> and "
1778 "B<SCHED_RR> and the priority 0 for B<SCHED_OTHER> and B<SCHED_BATCH>. "
1779 "Scheduling priority ranges for the various policies are not alterable."
1783 #: build/C/man2/sched_get_priority_max.2:79
1785 "The range of scheduling priorities may vary on other POSIX systems, thus it "
1786 "is a good idea for portable applications to use a virtual priority range and "
1787 "map it to the interval given by B<sched_get_priority_max>() and "
1788 "B<sched_get_priority_min>(). POSIX.1-2001 requires a spread of at least 32 "
1789 "between the maximum and the minimum values for B<SCHED_FIFO> and "
1794 #: build/C/man2/sched_get_priority_max.2:87
1796 "POSIX systems on which B<sched_get_priority_max>() and "
1797 "B<sched_get_priority_min>() are available define "
1798 "B<_POSIX_PRIORITY_SCHEDULING> in I<E<lt>unistd.hE<gt>>."
1802 #: build/C/man2/sched_get_priority_max.2:97
1804 "On success, B<sched_get_priority_max>() and B<sched_get_priority_min>() "
1805 "return the maximum/minimum priority value for the named scheduling policy. "
1806 "On error, -1 is returned, and I<errno> is set appropriately."
1810 #: build/C/man2/sched_get_priority_max.2:101
1811 msgid "The argument I<policy> does not identify a defined scheduling policy."
1815 #: build/C/man2/sched_get_priority_max.2:103 build/C/man2/sched_rr_get_interval.2:94 build/C/man2/sched_setparam.2:113 build/C/man2/sched_yield.2:55
1816 msgid "POSIX.1-2001."
1820 #: build/C/man2/sched_get_priority_max.2:110
1822 "B<sched_getaffinity>(2), B<sched_getparam>(2), B<sched_getscheduler>(2), "
1823 "B<sched_setaffinity>(2), B<sched_setparam>(2), B<sched_setscheduler>(2)"
1827 #: build/C/man2/sched_get_priority_max.2:113 build/C/man2/sched_rr_get_interval.2:125 build/C/man2/sched_setparam.2:127 build/C/man2/sched_setscheduler.2:538 build/C/man2/sched_yield.2:85
1829 "I<Programming for the real world - POSIX.4> by Bill O. Gallmeister, O'Reilly "
1830 "& Associates, Inc., ISBN 1-56592-074-0"
1834 #: build/C/man3/sched_getcpu.3:24
1836 msgid "SCHED_GETCPU"
1840 #: build/C/man3/sched_getcpu.3:24
1846 #: build/C/man3/sched_getcpu.3:27
1847 msgid "sched_getcpu - determine CPU on which the calling thread is running"
1850 #. Really:_BSD_SOURCE || _SVID_SOURCE
1852 #: build/C/man3/sched_getcpu.3:32
1855 "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n"
1856 "B<#include E<lt>sched.hE<gt>>\n"
1860 #: build/C/man3/sched_getcpu.3:34
1862 msgid "B<int sched_getcpu(void);>\n"
1866 #: build/C/man3/sched_getcpu.3:38
1868 "B<sched_getcpu>() returns the number of the CPU on which the calling thread "
1869 "is currently executing."
1873 #: build/C/man3/sched_getcpu.3:45
1875 "On success, B<sched_getcpu>() returns a nonnegative CPU number. On error, "
1876 "-1 is returned and I<errno> is set to indicate the error."
1880 #: build/C/man3/sched_getcpu.3:46 build/C/man2/sched_rr_get_interval.2:86
1886 #: build/C/man3/sched_getcpu.3:50
1887 msgid "This kernel does not implement B<getcpu>(2)."
1891 #: build/C/man3/sched_getcpu.3:52
1892 msgid "This function is available since glibc 2.6."
1896 #: build/C/man3/sched_getcpu.3:55
1897 msgid "B<sched_getcpu>() is glibc specific."
1901 #: build/C/man3/sched_getcpu.3:57
1906 #: build/C/man3/sched_getcpu.3:61
1908 msgid "cpu = sched_getcpu();\n"
1912 #: build/C/man3/sched_getcpu.3:67
1913 msgid "is equivalent to the following B<getcpu>(2) call:"
1917 #: build/C/man3/sched_getcpu.3:73
1921 "s = getcpu(&c, NULL, NULL);\n"
1922 "cpu = (s == -1) ? s : c;\n"
1926 #: build/C/man3/sched_getcpu.3:77
1927 msgid "B<getcpu>(2)"
1931 #: build/C/man2/sched_rr_get_interval.2:30
1933 msgid "SCHED_RR_GET_INTERVAL"
1937 #: build/C/man2/sched_rr_get_interval.2:30
1943 #: build/C/man2/sched_rr_get_interval.2:33
1944 msgid "sched_rr_get_interval - get the SCHED_RR interval for the named process"
1948 #: build/C/man2/sched_rr_get_interval.2:37
1949 msgid "B<int sched_rr_get_interval(pid_t >I<pid>B<, struct timespec * >I<tp>B<);>"
1953 #: build/C/man2/sched_rr_get_interval.2:41
1955 "B<sched_rr_get_interval>() writes into the I<timespec> structure pointed to "
1956 "by I<tp> the round-robin time quantum for the process identified by I<pid>."
1960 #: build/C/man2/sched_rr_get_interval.2:43
1961 msgid "The I<timespec> structure has the following form:"
1965 #: build/C/man2/sched_rr_get_interval.2:50
1968 "struct timespec {\n"
1969 " time_t tv_sec; /* seconds */\n"
1970 " long tv_nsec; /* nanoseconds */\n"
1974 #. FIXME . On Linux, sched_rr_get_interval()
1975 #. returns the timeslice for SCHED_OTHER processes -- this timeslice
1976 #. is influenced by the nice value.
1977 #. For SCHED_FIFO processes, this always returns 0.
1979 #. The round-robin time quantum value is not alterable under Linux
1982 #: build/C/man2/sched_rr_get_interval.2:72
1984 "If I<pid> is zero, the time quantum for the calling process is written into "
1985 "I<*tp>. The identified process should be running under the B<SCHED_RR> "
1986 "scheduling policy. POSIX systems on which B<sched_rr_get_interval>() is "
1987 "available define B<_POSIX_PRIORITY_SCHEDULING> in I<E<lt>unistd.hE<gt>>."
1991 #: build/C/man2/sched_rr_get_interval.2:79
1993 "On success, B<sched_rr_get_interval>() returns 0. On error, -1 is "
1994 "returned, and I<errno> is set appropriately."
1998 #: build/C/man2/sched_rr_get_interval.2:80 build/C/man2/sched_setaffinity.2:118
2004 #: build/C/man2/sched_rr_get_interval.2:83
2005 msgid "Problem with copying information to userspace."
2009 #: build/C/man2/sched_rr_get_interval.2:86
2010 msgid "Invalid pid."
2014 #: build/C/man2/sched_rr_get_interval.2:89
2015 msgid "The system call is not yet implemented (only on rather old kernels)."
2019 #: build/C/man2/sched_rr_get_interval.2:89 build/C/man2/sched_setaffinity.2:146 build/C/man2/sched_setparam.2:108 build/C/man2/sched_setscheduler.2:442
2025 #: build/C/man2/sched_rr_get_interval.2:92 build/C/man2/sched_setaffinity.2:149 build/C/man2/sched_setparam.2:111 build/C/man2/sched_setscheduler.2:445
2026 msgid "The process whose ID is I<pid> could not be found."
2030 #: build/C/man2/sched_rr_get_interval.2:95
2036 #. From at least Linux 2.6.9, the following is no longer true
2037 #. for SCHED_RR processes. For RR processes the timeslice is always
2038 #. DEF_TIMESLICE, or 0.1 secs.
2039 #. Was the following really true for older kernels?
2040 #. Must build a 2.6.8 kernel and retest, and rewrite the following text
2043 #. As of Linux 1.3.81
2044 #. .BR sched_rr_get_interval ()
2045 #. returns with error
2046 #. ENOSYS, because SCHED_RR has not yet been fully implemented and tested
2049 #: build/C/man2/sched_rr_get_interval.2:119
2051 "POSIX does not specify any mechanism for controlling the size of the "
2052 "round-robin time quantum. However, Linux provides a (nonportable) method of "
2053 "doing this. The quantum can be controlled by adjusting the process's nice "
2054 "value (see B<setpriority>(2)). Assigning a negative (i.e., high) nice value "
2055 "results in a longer quantum; assigning a positive (i.e., low) nice value "
2056 "results in a shorter quantum. The default quantum is 0.1 seconds; the "
2057 "degree to which changing the nice value affects the quantum has varied "
2058 "somewhat across kernel versions."
2062 #: build/C/man2/sched_rr_get_interval.2:122 build/C/man2/sched_setaffinity.2:178
2063 msgid "B<sched_setscheduler>(2) has a description of the Linux scheduling scheme."
2067 #: build/C/man2/sched_setaffinity.2:35
2069 msgid "SCHED_SETAFFINITY"
2073 #: build/C/man2/sched_setaffinity.2:35
2079 #: build/C/man2/sched_setaffinity.2:39
2081 "sched_setaffinity, sched_getaffinity - set and get a process's CPU affinity "
2086 #: build/C/man2/sched_setaffinity.2:46
2089 "B<int sched_setaffinity(pid_t >I<pid>B<, size_t >I<cpusetsize>B<,>\n"
2090 "B< cpu_set_t *>I<mask>B<);>\n"
2094 #: build/C/man2/sched_setaffinity.2:49
2097 "B<int sched_getaffinity(pid_t >I<pid>B<, size_t >I<cpusetsize>B<,>\n"
2098 "B< cpu_set_t *>I<mask>B<);>\n"
2102 #: build/C/man2/sched_setaffinity.2:64
2104 "A process's CPU affinity mask determines the set of CPUs on which it is "
2105 "eligible to run. On a multiprocessor system, setting the CPU affinity mask "
2106 "can be used to obtain performance benefits. For example, by dedicating one "
2107 "CPU to a particular process (i.e., setting the affinity mask of that process "
2108 "to specify a single CPU, and setting the affinity mask of all other "
2109 "processes to exclude that CPU), it is possible to ensure maximum execution "
2110 "speed for that process. Restricting a process to run on a single CPU also "
2111 "avoids the performance cost caused by the cache invalidation that occurs "
2112 "when a process ceases to execute on one CPU and then recommences execution "
2113 "on a different CPU."
2117 #: build/C/man2/sched_setaffinity.2:71
2119 "A CPU affinity mask is represented by the I<cpu_set_t> structure, a \"CPU "
2120 "set\", pointed to by I<mask>. A set of macros for manipulating CPU sets is "
2121 "described in B<CPU_SET>(3)."
2125 #: build/C/man2/sched_setaffinity.2:86
2127 "B<sched_setaffinity>() sets the CPU affinity mask of the process whose ID "
2128 "is I<pid> to the value specified by I<mask>. If I<pid> is zero, then the "
2129 "calling process is used. The argument I<cpusetsize> is the length (in "
2130 "bytes) of the data pointed to by I<mask>. Normally this argument would be "
2131 "specified as I<sizeof(cpu_set_t)>."
2135 #: build/C/man2/sched_setaffinity.2:93
2137 "If the process specified by I<pid> is not currently running on one of the "
2138 "CPUs specified in I<mask>, then that process is migrated to one of the CPUs "
2139 "specified in I<mask>."
2143 #: build/C/man2/sched_setaffinity.2:108
2145 "B<sched_getaffinity>() writes the affinity mask of the process whose ID is "
2146 "I<pid> into the I<cpu_set_t> structure pointed to by I<mask>. The "
2147 "I<cpusetsize> argument specifies the size (in bytes) of I<mask>. If I<pid> "
2148 "is zero, then the mask of the calling process is returned."
2152 #: build/C/man2/sched_setaffinity.2:117
2154 "On success, B<sched_setaffinity>() and B<sched_getaffinity>() return 0. "
2155 "On error, -1 is returned, and I<errno> is set appropriately."
2159 #: build/C/man2/sched_setaffinity.2:121
2160 msgid "A supplied memory address was invalid."
2164 #: build/C/man2/sched_setaffinity.2:129
2166 "The affinity bit mask I<mask> contains no processors that are currently "
2167 "physically on the system and permitted to the process according to any "
2168 "restrictions that may be imposed by the \"cpuset\" mechanism described in "
2173 #: build/C/man2/sched_setaffinity.2:136
2175 "(B<sched_getaffinity>() and, in kernels before 2.6.9, "
2176 "B<sched_setaffinity>()) I<cpusetsize> is smaller than the size of the "
2177 "affinity mask used by the kernel."
2181 #: build/C/man2/sched_setaffinity.2:146
2183 "(B<sched_setaffinity>()) The calling process does not have appropriate "
2184 "privileges. The caller needs an effective user ID equal to the real user ID "
2185 "or effective user ID of the process identified by I<pid>, or it must possess "
2186 "the B<CAP_SYS_NICE> capability."
2190 #: build/C/man2/sched_setaffinity.2:160
2192 "The CPU affinity system calls were introduced in Linux kernel 2.5.8. The "
2193 "system call wrappers were introduced in glibc 2.3. Initially, the glibc "
2194 "interfaces included a I<cpusetsize> argument, typed as I<unsigned int>. In "
2195 "glibc 2.3.3, the I<cpusetsize> argument was removed, but was then restored "
2196 "in glibc 2.3.4, with type I<size_t>."
2200 #: build/C/man2/sched_setaffinity.2:162
2201 msgid "These system calls are Linux-specific."
2205 #: build/C/man2/sched_setaffinity.2:175
2207 "After a call to B<sched_setaffinity>(), the set of CPUs on which the process "
2208 "will actually run is the intersection of the set specified in the I<mask> "
2209 "argument and the set of CPUs actually present on the system. The system may "
2210 "further restrict the set of CPUs on which the process runs if the \"cpuset\" "
2211 "mechanism described in B<cpuset>(7) is being used. These restrictions on "
2212 "the actual set of CPUs on which the process will run are silently imposed by "
2217 #: build/C/man2/sched_setaffinity.2:195
2219 "The affinity mask is actually a per-thread attribute that can be adjusted "
2220 "independently for each of the threads in a thread group. The value returned "
2221 "from a call to B<gettid>(2) can be passed in the argument I<pid>. "
2222 "Specifying I<pid> as 0 will set the attribute for the calling thread, and "
2223 "passing the value returned from a call to B<getpid>(2) will set the "
2224 "attribute for the main thread of the thread group. (If you are using the "
2225 "POSIX threads API, then use B<pthread_setaffinity_np>(3) instead of "
2226 "B<sched_setaffinity>().)"
2230 #: build/C/man2/sched_setaffinity.2:201
2232 "A child created via B<fork>(2) inherits its parent's CPU affinity mask. "
2233 "The affinity mask is preserved across an B<execve>(2)."
2237 #: build/C/man2/sched_setaffinity.2:215
2239 "This manual page describes the glibc interface for the CPU affinity calls. "
2240 "The actual system call interface is slightly different, with the I<mask> "
2241 "being typed as I<unsigned long *>, reflecting the fact that the underlying "
2242 "implementation of CPU sets is a simple bit mask. On success, the raw "
2243 "B<sched_getaffinity>() system call returns the size (in bytes) of the "
2244 "I<cpumask_t> data type that is used internally by the kernel to represent "
2245 "the CPU set bit mask."
2249 #: build/C/man2/sched_setaffinity.2:231
2251 "B<clone>(2), B<getcpu>(2), B<getpriority>(2), B<gettid>(2), B<nice>(2), "
2252 "B<sched_get_priority_max>(2), B<sched_get_priority_min>(2), "
2253 "B<sched_getscheduler>(2), B<sched_setscheduler>(2), B<setpriority>(2), "
2254 "B<CPU_SET>(3), B<pthread_setaffinity_np>(3), B<sched_getcpu>(3), "
2255 "B<capabilities>(7), B<cpuset>(7)"
2259 #: build/C/man2/sched_setparam.2:31
2261 msgid "SCHED_SETPARAM"
2265 #: build/C/man2/sched_setparam.2:34
2266 msgid "sched_setparam, sched_getparam - set and get scheduling parameters"
2270 #: build/C/man2/sched_setparam.2:37 build/C/man2/sched_setscheduler.2:54
2272 msgid "B<#include E<lt>sched.hE<gt>>\n"
2276 #: build/C/man2/sched_setparam.2:39
2279 "B<int sched_setparam(pid_t >I<pid>B<, const struct sched_param "
2284 #: build/C/man2/sched_setparam.2:41
2286 msgid "B<int sched_getparam(pid_t >I<pid>B<, struct sched_param *>I<param>B<);>\n"
2290 #: build/C/man2/sched_setparam.2:47 build/C/man2/sched_setscheduler.2:66
2293 "B<struct sched_param {\n"
2295 " int >I<sched_priority>B<;\n"
2301 #: build/C/man2/sched_setparam.2:61
2303 "B<sched_setparam>() sets the scheduling parameters associated with the "
2304 "scheduling policy for the process identified by I<pid>. If I<pid> is zero, "
2305 "then the parameters of the calling process are set. The interpretation of "
2306 "the argument I<param> depends on the scheduling policy of the process "
2307 "identified by I<pid>. See B<sched_setscheduler>(2) for a description of "
2308 "the scheduling policies supported under Linux."
2312 #: build/C/man2/sched_setparam.2:67
2314 "B<sched_getparam>() retrieves the scheduling parameters for the process "
2315 "identified by I<pid>. If I<pid> is zero, then the parameters of the calling "
2316 "process are retrieved."
2320 #: build/C/man2/sched_setparam.2:76
2322 "B<sched_setparam>() checks the validity of I<param> for the scheduling "
2323 "policy of the process. The value I<param-E<gt>sched_priority> must lie "
2324 "within the range given by B<sched_get_priority_min>(2) and "
2325 "B<sched_get_priority_max>(2)."
2329 #: build/C/man2/sched_setparam.2:80
2331 "For a discussion of the privileges and resource limits related to scheduling "
2332 "priority and policy, see B<sched_setscheduler>(2)."
2336 #: build/C/man2/sched_setparam.2:88
2338 "POSIX systems on which B<sched_setparam>() and B<sched_getparam>() are "
2339 "available define B<_POSIX_PRIORITY_SCHEDULING> in I<E<lt>unistd.hE<gt>>."
2343 #: build/C/man2/sched_setparam.2:97
2345 "On success, B<sched_setparam>() and B<sched_getparam>() return 0. On "
2346 "error, -1 is returned, and I<errno> is set appropriately."
2350 #: build/C/man2/sched_setparam.2:102
2351 msgid "The argument I<param> does not make sense for the current scheduling policy."
2355 #: build/C/man2/sched_setparam.2:108
2357 "The calling process does not have appropriate privileges (Linux: does not "
2358 "have the B<CAP_SYS_NICE> capability)."
2362 #: build/C/man2/sched_setparam.2:124
2364 "B<getpriority>(2), B<nice>(2), B<sched_get_priority_max>(2), "
2365 "B<sched_get_priority_min>(2), B<sched_getaffinity>(2), "
2366 "B<sched_getscheduler>(2), B<sched_setaffinity>(2), B<sched_setscheduler>(2), "
2367 "B<setpriority>(2), B<capabilities>(7)"
2371 #: build/C/man2/sched_setscheduler.2:47
2373 msgid "SCHED_SETSCHEDULER"
2377 #: build/C/man2/sched_setscheduler.2:47
2383 #: build/C/man2/sched_setscheduler.2:51
2385 "sched_setscheduler, sched_getscheduler - set and get scheduling "
2390 #: build/C/man2/sched_setscheduler.2:56
2392 msgid "B<int sched_setscheduler(pid_t >I<pid>B<, int >I<policy>B<,>\n"
2396 #: build/C/man2/sched_setscheduler.2:58
2398 msgid "B< const struct sched_param *>I<param>B<);>\n"
2402 #: build/C/man2/sched_setscheduler.2:60
2404 msgid "B<int sched_getscheduler(pid_t >I<pid>B<);>\n"
2408 #: build/C/man2/sched_setscheduler.2:77
2410 "B<sched_setscheduler>() sets both the scheduling policy and the associated "
2411 "parameters for the process whose ID is specified in I<pid>. If I<pid> "
2412 "equals zero, the scheduling policy and parameters of the calling process "
2413 "will be set. The interpretation of the argument I<param> depends on the "
2414 "selected policy. Currently, Linux supports the following \"normal\" (i.e., "
2415 "non-real-time) scheduling policies:"
2419 #: build/C/man2/sched_setscheduler.2:77
2421 msgid "B<SCHED_OTHER>"
2424 #. In the 2.6 kernel sources, SCHED_OTHER is actually called
2427 #: build/C/man2/sched_setscheduler.2:82
2428 msgid "the standard round-robin time-sharing policy;"
2432 #: build/C/man2/sched_setscheduler.2:82
2434 msgid "B<SCHED_BATCH>"
2438 #: build/C/man2/sched_setscheduler.2:85
2439 msgid "for \"batch\" style execution of processes; and"
2443 #: build/C/man2/sched_setscheduler.2:85
2445 msgid "B<SCHED_IDLE>"
2449 #: build/C/man2/sched_setscheduler.2:90
2450 msgid "for running I<very> low priority background jobs."
2454 #: build/C/man2/sched_setscheduler.2:94
2456 "The following \"real-time\" policies are also supported, for special "
2457 "time-critical applications that need precise control over the way in which "
2458 "runnable processes are selected for execution:"
2462 #: build/C/man2/sched_setscheduler.2:94
2464 msgid "B<SCHED_FIFO>"
2468 #: build/C/man2/sched_setscheduler.2:97
2469 msgid "a first-in, first-out policy; and"
2473 #: build/C/man2/sched_setscheduler.2:97
2479 #: build/C/man2/sched_setscheduler.2:100
2480 msgid "a round-robin policy."
2484 #: build/C/man2/sched_setscheduler.2:102
2485 msgid "The semantics of each of these policies are detailed below."
2489 #: build/C/man2/sched_setscheduler.2:109
2491 "B<sched_getscheduler>() queries the scheduling policy currently applied to "
2492 "the process identified by I<pid>. If I<pid> equals zero, the policy of the "
2493 "calling process will be retrieved."
2497 #: build/C/man2/sched_setscheduler.2:109
2499 msgid "Scheduling Policies"
2503 #: build/C/man2/sched_setscheduler.2:118
2505 "The scheduler is the kernel component that decides which runnable process "
2506 "will be executed by the CPU next. Each process has an associated scheduling "
2507 "policy and a I<static> scheduling priority, I<sched_priority>; these are the "
2508 "settings that are modified by B<sched_setscheduler>(). The scheduler makes "
2509 "it decisions based on knowledge of the scheduling policy and static priority "
2510 "of all processes on the system."
2514 #: build/C/man2/sched_setscheduler.2:123
2516 "For processes scheduled under one of the normal scheduling policies "
2517 "(B<SCHED_OTHER>, B<SCHED_IDLE>, B<SCHED_BATCH>), I<sched_priority> is not "
2518 "used in scheduling decisions (it must be specified as 0)."
2522 #: build/C/man2/sched_setscheduler.2:137
2524 "Processes scheduled under one of the real-time policies (B<SCHED_FIFO>, "
2525 "B<SCHED_RR>) have a I<sched_priority> value in the range 1 (low) to 99 "
2526 "(high). (As the numbers imply, real-time processes always have higher "
2527 "priority than normal processes.) Note well: POSIX.1-2001 only requires an "
2528 "implementation to support a minimum 32 distinct priority levels for the "
2529 "real-time policies, and some systems supply just this minimum. Portable "
2530 "programs should use B<sched_get_priority_min>(2) and "
2531 "B<sched_get_priority_max>(2) to find the range of priorities supported for "
2532 "a particular policy."
2536 #: build/C/man2/sched_setscheduler.2:143
2538 "Conceptually, the scheduler maintains a list of runnable processes for each "
2539 "possible I<sched_priority> value. In order to determine which process runs "
2540 "next, the scheduler looks for the nonempty list with the highest static "
2541 "priority and selects the process at the head of this list."
2545 #: build/C/man2/sched_setscheduler.2:147
2547 "A process's scheduling policy determines where it will be inserted into the "
2548 "list of processes with equal static priority and how it will move inside "
2553 #: build/C/man2/sched_setscheduler.2:155
2555 "All scheduling is preemptive: if a process with a higher static priority "
2556 "becomes ready to run, the currently running process will be preempted and "
2557 "returned to the wait list for its static priority level. The scheduling "
2558 "policy only determines the ordering within the list of runnable processes "
2559 "with equal static priority."
2563 #: build/C/man2/sched_setscheduler.2:155
2565 msgid "SCHED_FIFO: First In-First Out scheduling"
2569 #: build/C/man2/sched_setscheduler.2:164
2571 "B<SCHED_FIFO> can only be used with static priorities higher than 0, which "
2572 "means that when a B<SCHED_FIFO> processes becomes runnable, it will always "
2573 "immediately preempt any currently running B<SCHED_OTHER>, B<SCHED_BATCH>, or "
2574 "B<SCHED_IDLE> process. B<SCHED_FIFO> is a simple scheduling algorithm "
2575 "without time slicing. For processes scheduled under the B<SCHED_FIFO> "
2576 "policy, the following rules apply:"
2580 #: build/C/man2/sched_setscheduler.2:164 build/C/man2/sched_setscheduler.2:169 build/C/man2/sched_setscheduler.2:172 build/C/man2/sched_setscheduler.2:186 build/C/man2/sched_setscheduler.2:288 build/C/man2/sched_setscheduler.2:296 build/C/man2/sched_setscheduler.2:337 build/C/man2/sched_setscheduler.2:345 build/C/man2/sched_setscheduler.2:350 build/C/man2/sched_setscheduler.2:355
2586 #: build/C/man2/sched_setscheduler.2:169
2588 "A B<SCHED_FIFO> process that has been preempted by another process of higher "
2589 "priority will stay at the head of the list for its priority and will resume "
2590 "execution as soon as all processes of higher priority are blocked again."
2594 #: build/C/man2/sched_setscheduler.2:172
2596 "When a B<SCHED_FIFO> process becomes runnable, it will be inserted at the "
2597 "end of the list for its priority."
2600 #. In 2.2.x and 2.4.x, the process is placed at the front of the queue
2601 #. In 2.0.x, the Right Thing happened: the process went to the back -- MTK
2603 #: build/C/man2/sched_setscheduler.2:186
2605 "A call to B<sched_setscheduler>() or B<sched_setparam>(2) will put the "
2606 "B<SCHED_FIFO> (or B<SCHED_RR>) process identified by I<pid> at the start of "
2607 "the list if it was runnable. As a consequence, it may preempt the currently "
2608 "running process if it has the same priority. (POSIX.1-2001 specifies that "
2609 "the process should go to the end of the list.)"
2613 #: build/C/man2/sched_setscheduler.2:190
2614 msgid "A process calling B<sched_yield>(2) will be put at the end of the list."
2618 #: build/C/man2/sched_setscheduler.2:194
2620 "No other events will move a process scheduled under the B<SCHED_FIFO> policy "
2621 "in the wait list of runnable processes with equal static priority."
2625 #: build/C/man2/sched_setscheduler.2:199
2627 "A B<SCHED_FIFO> process runs until either it is blocked by an I/O request, "
2628 "it is preempted by a higher priority process, or it calls B<sched_yield>(2)."
2632 #: build/C/man2/sched_setscheduler.2:199
2634 msgid "SCHED_RR: Round Robin scheduling"
2637 #. On Linux 2.4, the length of the RR interval is influenced
2638 #. by the process nice value -- MTK
2640 #: build/C/man2/sched_setscheduler.2:218
2642 "B<SCHED_RR> is a simple enhancement of B<SCHED_FIFO>. Everything described "
2643 "above for B<SCHED_FIFO> also applies to B<SCHED_RR>, except that each "
2644 "process is only allowed to run for a maximum time quantum. If a B<SCHED_RR> "
2645 "process has been running for a time period equal to or longer than the time "
2646 "quantum, it will be put at the end of the list for its priority. A "
2647 "B<SCHED_RR> process that has been preempted by a higher priority process and "
2648 "subsequently resumes execution as a running process will complete the "
2649 "unexpired portion of its round robin time quantum. The length of the time "
2650 "quantum can be retrieved using B<sched_rr_get_interval>(2)."
2654 #: build/C/man2/sched_setscheduler.2:218
2656 msgid "SCHED_OTHER: Default Linux time-sharing scheduling"
2660 #: build/C/man2/sched_setscheduler.2:234
2662 "B<SCHED_OTHER> can only be used at static priority 0. B<SCHED_OTHER> is the "
2663 "standard Linux time-sharing scheduler that is intended for all processes "
2664 "that do not require the special real-time mechanisms. The process to run is "
2665 "chosen from the static priority 0 list based on a I<dynamic> priority that "
2666 "is determined only inside this list. The dynamic priority is based on the "
2667 "nice value (set by B<nice>(2) or B<setpriority>(2)) and increased for each "
2668 "time quantum the process is ready to run, but denied to run by the "
2669 "scheduler. This ensures fair progress among all B<SCHED_OTHER> processes."
2673 #: build/C/man2/sched_setscheduler.2:234
2675 msgid "SCHED_BATCH: Scheduling batch processes"
2679 #: build/C/man2/sched_setscheduler.2:246
2681 "(Since Linux 2.6.16.) B<SCHED_BATCH> can only be used at static priority "
2682 "0. This policy is similar to B<SCHED_OTHER> in that it schedules the "
2683 "process according to its dynamic priority (based on the nice value). The "
2684 "difference is that this policy will cause the scheduler to always assume "
2685 "that the process is CPU-intensive. Consequently, the scheduler will apply a "
2686 "small scheduling penalty with respect to wakeup behaviour, so that this "
2687 "process is mildly disfavored in scheduling decisions."
2690 #. The following paragraph is drawn largely from the text that
2691 #. accompanied Ingo Molnar's patch for the implementation of
2694 #: build/C/man2/sched_setscheduler.2:255
2696 "This policy is useful for workloads that are noninteractive, but do not want "
2697 "to lower their nice value, and for workloads that want a deterministic "
2698 "scheduling policy without interactivity causing extra preemptions (between "
2699 "the workload's tasks)."
2703 #: build/C/man2/sched_setscheduler.2:255
2705 msgid "SCHED_IDLE: Scheduling very low priority jobs"
2709 #: build/C/man2/sched_setscheduler.2:259
2711 "(Since Linux 2.6.23.) B<SCHED_IDLE> can only be used at static priority 0; "
2712 "the process nice value has no influence for this policy."
2716 #: build/C/man2/sched_setscheduler.2:267
2718 "This policy is intended for running jobs at extremely low priority (lower "
2719 "even than a +19 nice value with the B<SCHED_OTHER> or B<SCHED_BATCH> "
2724 #: build/C/man2/sched_setscheduler.2:267
2726 msgid "Resetting scheduling policy for child processes"
2730 #: build/C/man2/sched_setscheduler.2:283
2732 "Since Linux 2.6.32, the B<SCHED_RESET_ON_FORK> flag can be ORed in I<policy> "
2733 "when calling B<sched_setscheduler>(). As a result of including this flag, "
2734 "children created by B<fork>(2) do not inherit privileged scheduling "
2735 "policies. This feature is intended for media-playback applications, and can "
2736 "be used to prevent applications evading the B<RLIMIT_RTTIME> resource limit "
2737 "(see B<getrlimit>(2)) by creating multiple child processes."
2741 #: build/C/man2/sched_setscheduler.2:288
2743 "More precisely, if the B<SCHED_RESET_ON_FORK> flag is specified, the "
2744 "following rules apply for subsequently created children:"
2748 #: build/C/man2/sched_setscheduler.2:296
2750 "If the calling process has a scheduling policy of B<SCHED_FIFO> or "
2751 "B<SCHED_RR>, the policy is reset to B<SCHED_OTHER> in child processes."
2755 #: build/C/man2/sched_setscheduler.2:299
2757 "If the calling process has a negative nice value, the nice value is reset to "
2758 "zero in child processes."
2762 #: build/C/man2/sched_setscheduler.2:308
2764 "After the B<SCHED_RESET_ON_FORK> flag has been enabled, it can only be reset "
2765 "if the process has the B<CAP_SYS_NICE> capability. This flag is disabled in "
2766 "child processes created by B<fork>(2)."
2770 #: build/C/man2/sched_setscheduler.2:314
2772 "The B<SCHED_RESET_ON_FORK> flag is visible in the policy value returned by "
2773 "B<sched_getscheduler>()"
2777 #: build/C/man2/sched_setscheduler.2:314
2779 msgid "Privileges and resource limits"
2783 #: build/C/man2/sched_setscheduler.2:327
2785 "In Linux kernels before 2.6.12, only privileged (B<CAP_SYS_NICE>) processes "
2786 "can set a nonzero static priority (i.e., set a real-time scheduling "
2787 "policy). The only change that an unprivileged process can make is to set "
2788 "the B<SCHED_OTHER> policy, and this can only be done if the effective user "
2789 "ID of the caller of B<sched_setscheduler>() matches the real or effective "
2790 "user ID of the target process (i.e., the process specified by I<pid>) whose "
2791 "policy is being changed."
2795 #: build/C/man2/sched_setscheduler.2:337
2797 "Since Linux 2.6.12, the B<RLIMIT_RTPRIO> resource limit defines a ceiling on "
2798 "an unprivileged process's static priority for the B<SCHED_RR> and "
2799 "B<SCHED_FIFO> policies. The rules for changing scheduling policy and "
2800 "priority are as follows:"
2804 #: build/C/man2/sched_setscheduler.2:345
2806 "If an unprivileged process has a nonzero B<RLIMIT_RTPRIO> soft limit, then "
2807 "it can change its scheduling policy and priority, subject to the restriction "
2808 "that the priority cannot be set to a value higher than the maximum of its "
2809 "current priority and its B<RLIMIT_RTPRIO> soft limit."
2813 #: build/C/man2/sched_setscheduler.2:350
2815 "If the B<RLIMIT_RTPRIO> soft limit is 0, then the only permitted changes are "
2816 "to lower the priority, or to switch to a non-real-time policy."
2820 #: build/C/man2/sched_setscheduler.2:355
2822 "Subject to the same rules, another unprivileged process can also make these "
2823 "changes, as long as the effective user ID of the process making the change "
2824 "matches the real or effective user ID of the target process."
2827 #. commit c02aa73b1d18e43cfd79c2f193b225e84ca497c8
2829 #: build/C/man2/sched_setscheduler.2:373
2831 "Special rules apply for the B<SCHED_IDLE>. In Linux kernels before 2.6.39, "
2832 "an unprivileged process operating under this policy cannot change its "
2833 "policy, regardless of the value of its B<RLIMIT_RTPRIO> resource limit. In "
2834 "Linux kernels since 2.6.39, an unprivileged process can switch to either the "
2835 "B<SCHED_BATCH> or the B<SCHED_NORMAL> policy so long as its nice value falls "
2836 "within the range permitted by its B<RLIMIT_NICE> resource limit (see "
2841 #: build/C/man2/sched_setscheduler.2:384
2843 "Privileged (B<CAP_SYS_NICE>) processes ignore the B<RLIMIT_RTPRIO> limit; "
2844 "as with older kernels, they can make arbitrary changes to scheduling policy "
2845 "and priority. See B<getrlimit>(2) for further information on "
2850 #: build/C/man2/sched_setscheduler.2:384
2852 msgid "Response time"
2856 #. .BR request_irq (9).
2858 #: build/C/man2/sched_setscheduler.2:392
2860 "A blocked high priority process waiting for the I/O has a certain response "
2861 "time before it is scheduled again. The device driver writer can greatly "
2862 "reduce this response time by using a \"slow interrupt\" interrupt handler."
2866 #: build/C/man2/sched_setscheduler.2:392
2868 msgid "Miscellaneous"
2872 #: build/C/man2/sched_setscheduler.2:397
2874 "Child processes inherit the scheduling policy and parameters across a "
2875 "B<fork>(2). The scheduling policy and parameters are preserved across "
2880 #: build/C/man2/sched_setscheduler.2:403
2882 "Memory locking is usually needed for real-time processes to avoid paging "
2883 "delays; this can be done with B<mlock>(2) or B<mlockall>(2)."
2887 #: build/C/man2/sched_setscheduler.2:415
2889 "Since a nonblocking infinite loop in a process scheduled under B<SCHED_FIFO> "
2890 "or B<SCHED_RR> will block all processes with lower priority forever, a "
2891 "software developer should always keep available on the console a shell "
2892 "scheduled under a higher static priority than the tested application. This "
2893 "will allow an emergency kill of tested real-time applications that do not "
2894 "block or terminate as expected. See also the description of the "
2895 "B<RLIMIT_RTTIME> resource limit in B<getrlimit>(2)."
2899 #: build/C/man2/sched_setscheduler.2:423
2901 "POSIX systems on which B<sched_setscheduler>() and B<sched_getscheduler>() "
2902 "are available define B<_POSIX_PRIORITY_SCHEDULING> in I<E<lt>unistd.hE<gt>>."
2906 #: build/C/man2/sched_setscheduler.2:433
2908 "On success, B<sched_setscheduler>() returns zero. On success, "
2909 "B<sched_getscheduler>() returns the policy for the process (a nonnegative "
2910 "integer). On error, -1 is returned, and I<errno> is set appropriately."
2914 #: build/C/man2/sched_setscheduler.2:439
2916 "The scheduling I<policy> is not one of the recognized policies, I<param> is "
2917 "NULL, or I<param> does not make sense for the I<policy>."
2921 #: build/C/man2/sched_setscheduler.2:442
2922 msgid "The calling process does not have appropriate privileges."
2926 #: build/C/man2/sched_setscheduler.2:448
2928 "POSIX.1-2001 (but see BUGS below). The B<SCHED_BATCH> and B<SCHED_IDLE> "
2929 "policies are Linux-specific."
2933 #: build/C/man2/sched_setscheduler.2:456
2935 "POSIX.1 does not detail the permissions that an unprivileged process "
2936 "requires in order to call B<sched_setscheduler>(), and details vary across "
2937 "systems. For example, the Solaris 7 manual page says that the real or "
2938 "effective user ID of the calling process must match the real user ID or the "
2939 "save set-user-ID of the target process."
2943 #: build/C/man2/sched_setscheduler.2:466
2945 "Originally, Standard Linux was intended as a general-purpose operating "
2946 "system being able to handle background processes, interactive applications, "
2947 "and less demanding real-time applications (applications that need to usually "
2948 "meet timing deadlines). Although the Linux kernel 2.6 allowed for kernel "
2949 "preemption and the newly introduced O(1) scheduler ensures that the time "
2950 "needed to schedule is fixed and deterministic irrespective of the number of "
2951 "active tasks, true real-time computing was not possible up to kernel version "
2956 #: build/C/man2/sched_setscheduler.2:466
2958 msgid "Real-time features in the mainline Linux kernel"
2961 #. FIXME . Probably this text will need some minor tweaking
2962 #. by about the time of 2.6.30; ask Carsten Emde about this then.
2964 #: build/C/man2/sched_setscheduler.2:480
2966 "From kernel version 2.6.18 onward, however, Linux is gradually becoming "
2967 "equipped with real-time capabilities, most of which are derived from the "
2968 "former I<realtime-preempt> patches developed by Ingo Molnar, Thomas "
2969 "Gleixner, Steven Rostedt, and others. Until the patches have been "
2970 "completely merged into the mainline kernel (this is expected to be around "
2971 "kernel version 2.6.30), they must be installed to achieve the best real-time "
2972 "performance. These patches are named:"
2976 #: build/C/man2/sched_setscheduler.2:484
2978 msgid "patch-I<kernelversion>-rtI<patchversion>\n"
2982 #: build/C/man2/sched_setscheduler.2:489
2984 "and can be downloaded from "
2985 "I<http://www.kernel.org/pub/linux/kernel/projects/rt/>."
2989 #: build/C/man2/sched_setscheduler.2:498
2991 "Without the patches and prior to their full inclusion into the mainline "
2992 "kernel, the kernel configuration offers only the three preemption classes "
2993 "B<CONFIG_PREEMPT_NONE>, B<CONFIG_PREEMPT_VOLUNTARY>, and "
2994 "B<CONFIG_PREEMPT_DESKTOP> which respectively provide no, some, and "
2995 "considerable reduction of the worst-case scheduling latency."
2999 #: build/C/man2/sched_setscheduler.2:509
3001 "With the patches applied or after their full inclusion into the mainline "
3002 "kernel, the additional configuration item B<CONFIG_PREEMPT_RT> becomes "
3003 "available. If this is selected, Linux is transformed into a regular "
3004 "real-time operating system. The FIFO and RR scheduling policies that can be "
3005 "selected using B<sched_setscheduler>() are then used to run a process with "
3006 "true real-time priority and a minimum worst-case scheduling latency."
3010 #: build/C/man2/sched_setscheduler.2:517
3012 "POSIX says that on success, B<sched_setscheduler>() should return the "
3013 "previous scheduling policy. Linux B<sched_setscheduler>() does not conform "
3014 "to this requirement, since it always returns 0 on success."
3018 #: build/C/man2/sched_setscheduler.2:535
3020 "B<getpriority>(2), B<mlock>(2), B<mlockall>(2), B<munlock>(2), "
3021 "B<munlockall>(2), B<nice>(2), B<sched_get_priority_max>(2), "
3022 "B<sched_get_priority_min>(2), B<sched_getaffinity>(2), B<sched_getparam>(2), "
3023 "B<sched_rr_get_interval>(2), B<sched_setaffinity>(2), B<sched_setparam>(2), "
3024 "B<sched_yield>(2), B<setpriority>(2), B<capabilities>(7), B<cpuset>(7)"
3028 #: build/C/man2/sched_setscheduler.2:542
3030 "The kernel source file I<Documentation/scheduler/sched-rt-group.txt> (since "
3035 #: build/C/man2/sched_yield.2:30
3041 #: build/C/man2/sched_yield.2:30
3047 #: build/C/man2/sched_yield.2:33
3048 msgid "sched_yield - yield the processor"
3052 #: build/C/man2/sched_yield.2:37
3053 msgid "B<int sched_yield(void);>"
3057 #: build/C/man2/sched_yield.2:42
3059 "B<sched_yield>() causes the calling thread to relinquish the CPU. The "
3060 "thread is moved to the end of the queue for its static priority and a new "
3061 "thread gets to run."
3065 #: build/C/man2/sched_yield.2:49
3067 "On success, B<sched_yield>() returns 0. On error, -1 is returned, and "
3068 "I<errno> is set appropriately."
3072 #: build/C/man2/sched_yield.2:53
3073 msgid "In the Linux implementation, B<sched_yield>() always succeeds."
3077 #: build/C/man2/sched_yield.2:60
3079 "If the calling thread is the only thread in the highest priority list at "
3080 "that time, it will continue to run after a call to B<sched_yield>()."
3084 #: build/C/man2/sched_yield.2:66
3086 "POSIX systems on which B<sched_yield>() is available define "
3087 "B<_POSIX_PRIORITY_SCHEDULING> in I<E<lt>unistd.hE<gt>>."
3091 #: build/C/man2/sched_yield.2:79
3093 "Strategic calls to B<sched_yield>() can improve performance by giving other "
3094 "threads or processes a chance to run when (heavily) contended resources "
3095 "(e.g., mutexes) have been released by the caller. Avoid calling "
3096 "B<sched_yield>() unnecessarily or inappropriately (e.g., when resources "
3097 "needed by other schedulable threads are still held by the caller), since "
3098 "doing so will result in unnecessary context switches, which will degrade "
3099 "system performance."
3103 #: build/C/man2/sched_yield.2:82
3104 msgid "B<sched_setscheduler>(2) for a description of Linux scheduling."
3108 #: build/C/man2/setns.2:4
3114 #: build/C/man2/setns.2:4
3120 #: build/C/man2/setns.2:7
3121 msgid "setns - reassociate thread with a namespace"
3125 #: build/C/man2/setns.2:13
3127 msgid "B<int setns(int >I<fd>B<, int >I<nstype>B<);>\n"
3131 #: build/C/man2/setns.2:17
3133 "Given a file descriptor referring to a namespace, reassociate the calling "
3134 "thread with that namespace."
3138 #: build/C/man2/setns.2:30
3140 "The I<fd> argument is a file descriptor referring to one of the namespace "
3141 "entries in a I</proc/[pid]/ns/> directory; see B<proc>(5) for further "
3142 "information on I</proc/[pid]/ns/>. The calling thread will be reassociated "
3143 "with the corresponding namespace, subject to any constraints imposed by the "
3144 "I<nstype> argument."
3148 #: build/C/man2/setns.2:36
3150 "The I<nstype> argument specifies which type of namespace the calling thread "
3151 "may be reassociated with. This argument can have one of the following "
3156 #: build/C/man2/setns.2:36
3162 #: build/C/man2/setns.2:39
3163 msgid "Allow any type of namespace to be joined."
3167 #: build/C/man2/setns.2:39
3169 msgid "B<CLONE_NEWIPC>"
3173 #: build/C/man2/setns.2:43
3174 msgid "I<fd> must refer to an IPC namespace."
3178 #: build/C/man2/setns.2:43
3180 msgid "B<CLONE_NEWNET>"
3184 #: build/C/man2/setns.2:47
3185 msgid "I<fd> must refer to a network namespace."
3189 #: build/C/man2/setns.2:47
3191 msgid "B<CLONE_NEWUTS>"
3195 #: build/C/man2/setns.2:51
3196 msgid "I<fd> must refer to a UTS namespace."
3200 #: build/C/man2/setns.2:66
3202 "Specifying I<nstype> as 0 suffices if the caller knows (or does not care) "
3203 "what type of namespace is referred to by I<fd>. Specifying a nonzero value "
3204 "for I<nstype> is useful if the caller does not know what type of namespace "
3205 "is referred to by I<fd> and wants to ensure that the namespace is of a "
3206 "particular type. (The caller might not know the type of the namespace "
3207 "referred to by I<fd> if the file descriptor was opened by another process "
3208 "and, for example, passed to the caller via a UNIX domain socket.)"
3212 #: build/C/man2/setns.2:73
3214 "On success, I<setns>() returns 0. On failure, -1 is returned and I<errno> "
3215 "is set to indicate the error."
3219 #: build/C/man2/setns.2:74
3225 #: build/C/man2/setns.2:78
3226 msgid "I<fd> is not a valid file descriptor."
3230 #: build/C/man2/setns.2:85
3232 "I<fd> refers to a namespace whose type does not match that specified in "
3233 "I<nstype>, or there is problem with reassociating the the thread with the "
3234 "specified namespace."
3238 #: build/C/man2/setns.2:88
3239 msgid "Cannot allocate sufficient memory to change the specified namespace."
3243 #: build/C/man2/setns.2:93
3245 "The calling thread did not have the required privilege (B<CAP_SYS_ADMIN>) "
3246 "for this operation."
3250 #: build/C/man2/setns.2:97
3251 msgid "The B<setns>() system call first appeared in Linux in kernel 3.0"
3255 #: build/C/man2/setns.2:101
3256 msgid "The B<setns>() system call is Linux-specific."
3260 #: build/C/man2/setns.2:107
3262 "Not all of the attributes that can be shared when a new thread is created "
3263 "using B<clone>(2) can be changed using B<setns>()."
3267 #: build/C/man2/setns.2:115
3269 "The PID namespace and the mount namespace are not currently supported. (See "
3270 "the descriptions of B<CLONE_NEWPID> and B<CLONE_NEWNS> in B<clone>(2).)"
3274 #: build/C/man2/setns.2:121
3275 msgid "B<clone>(2), B<fork>(2), B<vfork>(2), B<proc>(5), B<unix>(7)"
3279 #: build/C/man2/unshare.2:17
3285 #: build/C/man2/unshare.2:17
3291 #: build/C/man2/unshare.2:20
3292 msgid "unshare - disassociate parts of the process execution context"
3296 #: build/C/man2/unshare.2:28
3298 msgid "B<int unshare(int >I<flags>B<);>\n"
3302 #: build/C/man2/unshare.2:41
3304 "B<unshare>() allows a process to disassociate parts of its execution "
3305 "context that are currently being shared with other processes. Part of the "
3306 "execution context, such as the mount namespace, is shared implicitly when a "
3307 "new process is created using B<fork>(2) or B<vfork>(2), while other parts, "
3308 "such as virtual memory, may be shared by explicit request when creating a "
3309 "process using B<clone>(2)."
3313 #: build/C/man2/unshare.2:46
3315 "The main use of B<unshare>() is to allow a process to control its shared "
3316 "execution context without creating a new process."
3320 #: build/C/man2/unshare.2:53
3322 "The I<flags> argument is a bit mask that specifies which parts of the "
3323 "execution context should be unshared. This argument is specified by ORing "
3324 "together zero or more of the following constants:"
3328 #: build/C/man2/unshare.2:61
3330 "Reverse the effect of the B<clone>(2) B<CLONE_FILES> flag. Unshare the "
3331 "file descriptor table, so that the calling process no longer shares its file "
3332 "descriptors with any other process."
3336 #: build/C/man2/unshare.2:74
3338 "Reverse the effect of the B<clone>(2) B<CLONE_FS> flag. Unshare file "
3339 "system attributes, so that the calling process no longer shares its root "
3340 "directory, current directory, or umask attributes with any other process. "
3341 "B<chroot>(2), B<chdir>(2), or B<umask>(2)"
3345 #: build/C/man2/unshare.2:91
3347 "This flag has the same effect as the B<clone>(2) B<CLONE_NEWIPC> flag. "
3348 "Unshare the System V IPC namespace, so that the calling process has a "
3349 "private copy of the System V IPC namespace which is not shared with any "
3350 "other process. Specifying this flag automatically implies B<CLONE_SYSVSEM> "
3351 "as well. Use of B<CLONE_NEWIPC> requires the B<CAP_SYS_ADMIN> capability."
3355 #: build/C/man2/unshare.2:105
3357 "This flag has the same effect as the B<clone>(2) B<CLONE_NEWNET> flag. "
3358 "Unshare the network namespace, so that the calling process is moved into a "
3359 "new network namespace which is not shared with any previously existing "
3360 "process. B<CLONE_NEWNET> requires the B<CAP_SYS_ADMIN> capability."
3364 #: build/C/man2/unshare.2:105
3366 msgid "B<CLONE_NEWNS>"
3369 #. These flag name are inconsistent:
3370 #. CLONE_NEWNS does the same thing in clone(), but CLONE_VM,
3371 #. CLONE_FS, and CLONE_FILES reverse the action of the clone()
3372 #. flags of the same name.
3374 #: build/C/man2/unshare.2:126
3376 "This flag has the same effect as the B<clone>(2) B<CLONE_NEWNS> flag. "
3377 "Unshare the mount namespace, so that the calling process has a private copy "
3378 "of its namespace which is not shared with any other process. Specifying "
3379 "this flag automatically implies B<CLONE_FS> as well. Use of B<CLONE_NEWNS> "
3380 "requires the B<CAP_SYS_ADMIN> capability."
3384 #: build/C/man2/unshare.2:126
3386 msgid "B<CLONE_SYSVSEM> (since Linux 2.6.26)"
3390 #: build/C/man2/unshare.2:140
3392 "This flag reverses the effect of the B<clone>(2) B<CLONE_SYSVSEM> flag. "
3393 "Unshare System V semaphore undo values, so that the calling process has a "
3394 "private copy which is not shared with any other process. Use of "
3395 "B<CLONE_SYSVSEM> requires the B<CAP_SYS_ADMIN> capability."
3398 #. As at 2.6.16, the following forced implications also apply,
3399 #. although the relevant flags are not yet implemented.
3400 #. If CLONE_THREAD is set force CLONE_VM.
3401 #. If CLONE_VM is set, force CLONE_SIGHAND.
3402 #. CLONE_NEWNSIf CLONE_SIGHAND is set and signals are also being shared
3403 #. (i.e., current->signal->count > 1), force CLONE_THREAD.
3405 #. FIXME . CLONE_VM is not (yet, as at 2.6.16) implemented.
3408 #. Reverse the effect of the
3413 #. is also implicitly set by
3415 #. and can be reversed using this
3418 #. Unshare virtual memory, so that the calling process no
3419 #. longer shares its virtual address space with any other process.
3421 #: build/C/man2/unshare.2:176
3423 "This flag has the same effect as the B<clone>(2) B<CLONE_NEWUTS> flag. "
3424 "Unshare the UTS IPC namespace, so that the calling process has a private "
3425 "copy of the UTS namespace which is not shared with any other process. Use "
3426 "of B<CLONE_NEWUTS> requires the B<CAP_SYS_ADMIN> capability."
3430 #: build/C/man2/unshare.2:183
3432 "If I<flags> is specified as zero, then B<unshare>() is a no-op; no changes "
3433 "are made to the calling process's execution context."
3437 #: build/C/man2/unshare.2:188
3439 "On success, zero returned. On failure, -1 is returned and I<errno> is set "
3440 "to indicate the error."
3444 #: build/C/man2/unshare.2:193
3445 msgid "An invalid bit was specified in I<flags>."
3449 #: build/C/man2/unshare.2:197
3451 "Cannot allocate sufficient memory to copy parts of caller's context that "
3452 "need to be unshared."
3456 #: build/C/man2/unshare.2:200
3457 msgid "The calling process did not have the required privileges for this operation."
3461 #: build/C/man2/unshare.2:204
3462 msgid "The B<unshare>() system call was added to Linux in kernel 2.6.16."
3466 #: build/C/man2/unshare.2:208
3467 msgid "The B<unshare>() system call is Linux-specific."
3470 #. However, we can do unshare(CLONE_SIGHAND) if CLONE_SIGHAND
3471 #. was not specified when doing clone(); i.e., unsharing
3472 #. signal handlers is permitted if we are not actually
3473 #. sharing signal handlers. mtk
3474 #. FIXME . check future kernel versions (e.g., 2.6.17)
3475 #. to see if CLONE_VM gets implemented.
3476 #. However, as at 2.6.16, we can do unshare(CLONE_VM) if CLONE_VM
3477 #. was not specified when doing clone(); i.e., unsharing
3478 #. virtual memory is permitted if we are not actually
3479 #. sharing virtual memory. mtk
3483 #. The current implementation of unshare does not allow unsharing of
3484 #. signals and signal handlers. Signals are complex to begin with and
3485 #. to unshare signals and/or signal handlers of a currently running
3486 #. process is even more complex. If in the future there is a specific
3487 #. need to allow unsharing of signals and/or signal handlers, it can
3488 #. be incrementally added to unshare without affecting legacy
3489 #. applications using unshare.
3491 #: build/C/man2/unshare.2:244
3493 "Not all of the process attributes that can be shared when a new process is "
3494 "created using B<clone>(2) can be unshared using B<unshare>(). In "
3495 "particular, as at kernel 2.6.16, B<unshare>() does not implement flags that "
3496 "reverse the effects of B<CLONE_SIGHAND>, B<CLONE_SYSVSEM>, B<CLONE_THREAD>, "
3497 "or B<CLONE_VM>. Such functionality may be added in the future, if required."
3501 #: build/C/man2/unshare.2:249
3502 msgid "B<clone>(2), B<fork>(2), B<vfork>(2), Documentation/unshare.txt"