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-04-25 05:59+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 build/C/man3/get_nprocs_conf.3:24
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 build/C/man3/get_nprocs_conf.3:25
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 build/C/man3/get_nprocs_conf.3:27
64 #. Actually _BSD_SOURCE || _SVID_SOURCE
65 #. FIXME 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 build/C/man3/get_nprocs_conf.3:33
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:792 build/C/man2/sched_get_priority_max.2:87 build/C/man3/sched_getcpu.3:38 build/C/man2/sched_rr_get_interval.2:74 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 build/C/man3/get_nprocs_conf.3:44
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:909 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:916 build/C/man2/sched_get_priority_max.2:101 build/C/man3/sched_getcpu.3:52 build/C/man2/sched_rr_get_interval.2:95 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 build/C/man3/get_nprocs_conf.3:46
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:923 build/C/man3/sched_getcpu.3:55 build/C/man2/sched_rr_get_interval.2:97 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 build/C/man3/get_nprocs_conf.3:48
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 build/C/man2/clone.2:970 build/C/man2/sched_setscheduler.2:509 build/C/man2/setns.2:107
513 #. http://sourceware.org/bugzilla/show_bug.cgi?id=7029
515 #: build/C/man3/CPU_SET.3:310
517 "On 32-bit platforms with glibc 2.8 and earlier, B<CPU_ALLOC>() allocates "
518 "twice as much space as is required, and B<CPU_ALLOC_SIZE>() returns a value "
519 "twice as large as it should. This bug should not affect the semantics of a "
520 "program, but does result in wasted memory and less efficient operation of "
521 "the macros that operate on dynamically allocated CPU sets. These bugs are "
522 "fixed in glibc 2.9."
526 #: build/C/man3/CPU_SET.3:310 build/C/man3/get_nprocs_conf.3:65
532 #: build/C/man3/CPU_SET.3:313
534 "The following program demonstrates the use of some of the macros used for "
535 "dynamically allocated CPU sets."
539 #: build/C/man3/CPU_SET.3:321
542 "#define _GNU_SOURCE\n"
543 "#include E<lt>sched.hE<gt>\n"
544 "#include E<lt>stdlib.hE<gt>\n"
545 "#include E<lt>unistd.hE<gt>\n"
546 "#include E<lt>stdio.hE<gt>\n"
547 "#include E<lt>assert.hE<gt>\n"
551 #: build/C/man3/CPU_SET.3:328
555 "main(int argc, char *argv[])\n"
557 " cpu_set_t *cpusetp;\n"
559 " int num_cpus, cpu;\n"
563 #: build/C/man3/CPU_SET.3:333
566 " if (argc E<lt> 2) {\n"
567 " fprintf(stderr, \"Usage: %s E<lt>num-cpusE<gt>\\en\", argv[0]);\n"
568 " exit(EXIT_FAILURE);\n"
573 #: build/C/man3/CPU_SET.3:335
575 msgid " num_cpus = atoi(argv[1]);\n"
579 #: build/C/man3/CPU_SET.3:341
582 " cpusetp = CPU_ALLOC(num_cpus);\n"
583 " if (cpusetp == NULL) {\n"
584 " perror(\"CPU_ALLOC\");\n"
585 " exit(EXIT_FAILURE);\n"
590 #: build/C/man3/CPU_SET.3:343
592 msgid " size = CPU_ALLOC_SIZE(num_cpus);\n"
596 #: build/C/man3/CPU_SET.3:347
599 " CPU_ZERO_S(size, cpusetp);\n"
600 " for (cpu = 0; cpu E<lt> num_cpus; cpu += 2)\n"
601 " CPU_SET_S(cpu, size, cpusetp);\n"
605 #: build/C/man3/CPU_SET.3:349
607 msgid " printf(\"CPU_COUNT() of set: %d\\en\", CPU_COUNT_S(size, cpusetp));\n"
611 #: build/C/man3/CPU_SET.3:353
614 " CPU_FREE(cpusetp);\n"
615 " exit(EXIT_SUCCESS);\n"
620 #: build/C/man3/CPU_SET.3:354 build/C/man2/clone.2:1012 build/C/man2/sched_get_priority_max.2:103 build/C/man3/sched_getcpu.3:75 build/C/man2/sched_rr_get_interval.2:126 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:358
628 "B<sched_setaffinity>(2), B<pthread_attr_setaffinity_np>(3), "
629 "B<pthread_setaffinity_np>(3), B<cpuset>(7)"
633 #: build/C/man2/clone.2:43
639 #: build/C/man2/clone.2:43
645 #: build/C/man2/clone.2:46
646 msgid "clone, __clone2 - create a child process"
650 #: build/C/man2/clone.2:57
653 "B<int clone(int (*>I<fn>B<)(void *), void *>I<child_stack>B<,>\n"
654 "B< int >I<flags>B<, void *>I<arg>B<, ... >\n"
655 "B< /* pid_t *>I<ptid>B<, struct user_desc *>I<tls>B<, pid_t "
656 "*>I<ctid>B< */ );>\n"
660 #: build/C/man2/clone.2:69
662 "B<clone>() creates a new process, in a manner similar to B<fork>(2). It is "
663 "actually a library function layered on top of the underlying B<clone>() "
664 "system call, hereinafter referred to as B<sys_clone>. A description of "
665 "B<sys_clone> is given toward the end of this page."
669 #: build/C/man2/clone.2:81
671 "Unlike B<fork>(2), these calls allow the child process to share parts of its "
672 "execution context with the calling process, such as the memory space, the "
673 "table of file descriptors, and the table of signal handlers. (Note that on "
674 "this manual page, \"calling process\" normally corresponds to \"parent "
675 "process\". But see the description of B<CLONE_PARENT> below.)"
679 #: build/C/man2/clone.2:86
681 "The main use of B<clone>() is to implement threads: multiple threads of "
682 "control in a program that run concurrently in a shared memory space."
686 #: build/C/man2/clone.2:107
688 "When the child process is created with B<clone>(), it executes the function "
689 "application I<fn>(I<arg>). (This differs from B<fork>(2), where execution "
690 "continues in the child from the point of the B<fork>(2) call.) The I<fn> "
691 "argument is a pointer to a function that is called by the child process at "
692 "the beginning of its execution. The I<arg> argument is passed to the I<fn> "
697 #: build/C/man2/clone.2:117
699 "When the I<fn>(I<arg>) function application returns, the child process "
700 "terminates. The integer returned by I<fn> is the exit code for the child "
701 "process. The child process may also terminate explicitly by calling "
702 "B<exit>(2) or after receiving a fatal signal."
706 #: build/C/man2/clone.2:133
708 "The I<child_stack> argument specifies the location of the stack used by the "
709 "child process. Since the child and calling process may share memory, it is "
710 "not possible for the child process to execute in the same stack as the "
711 "calling process. The calling process must therefore set up memory space for "
712 "the child stack and pass a pointer to this space to B<clone>(). Stacks grow "
713 "downward on all processors that run Linux (except the HP PA processors), so "
714 "I<child_stack> usually points to the topmost address of the memory space set "
715 "up for the child stack."
719 #: build/C/man2/clone.2:149
721 "The low byte of I<flags> contains the number of the I<termination signal> "
722 "sent to the parent when the child dies. If this signal is specified as "
723 "anything other than B<SIGCHLD>, then the parent process must specify the "
724 "B<__WALL> or B<__WCLONE> options when waiting for the child with "
725 "B<wait>(2). If no signal is specified, then the parent process is not "
726 "signaled when the child terminates."
730 #: build/C/man2/clone.2:154
732 "I<flags> may also be bitwise-or'ed with zero or more of the following "
733 "constants, in order to specify what is shared between the calling process "
734 "and the child process:"
738 #: build/C/man2/clone.2:154
740 msgid "B<CLONE_CHILD_CLEARTID> (since Linux 2.5.49)"
744 #: build/C/man2/clone.2:164
746 "Erase child thread ID at location I<ctid> in child memory when the child "
747 "exits, and do a wakeup on the futex at that address. The address involved "
748 "may be changed by the B<set_tid_address>(2) system call. This is used by "
749 "threading libraries."
753 #: build/C/man2/clone.2:164
755 msgid "B<CLONE_CHILD_SETTID> (since Linux 2.5.49)"
759 #: build/C/man2/clone.2:169
760 msgid "Store child thread ID at location I<ctid> in child memory."
764 #: build/C/man2/clone.2:169 build/C/man2/unshare.2:53
766 msgid "B<CLONE_FILES>"
770 #: build/C/man2/clone.2:182
772 "If B<CLONE_FILES> is set, the calling process and the child process share "
773 "the same file descriptor table. Any file descriptor created by the calling "
774 "process or by the child process is also valid in the other process. "
775 "Similarly, if one of the processes closes a file descriptor, or changes its "
776 "associated flags (using the B<fcntl>(2) B<F_SETFD> operation), the other "
777 "process is also affected."
781 #: build/C/man2/clone.2:196
783 "If B<CLONE_FILES> is not set, the child process inherits a copy of all file "
784 "descriptors opened in the calling process at the time of B<clone>(). (The "
785 "duplicated file descriptors in the child refer to the same open file "
786 "descriptions (see B<open>(2)) as the corresponding file descriptors in the "
787 "calling process.) Subsequent operations that open or close file "
788 "descriptors, or change file descriptor flags, performed by either the "
789 "calling process or the child process do not affect the other process."
793 #: build/C/man2/clone.2:196 build/C/man2/unshare.2:61
799 #: build/C/man2/clone.2:211
801 "If B<CLONE_FS> is set, the caller and the child process share the same file "
802 "system information. This includes the root of the file system, the current "
803 "working directory, and the umask. Any call to B<chroot>(2), B<chdir>(2), or "
804 "B<umask>(2) performed by the calling process or the child process also "
805 "affects the other process."
809 #: build/C/man2/clone.2:223
811 "If B<CLONE_FS> is not set, the child process works on a copy of the file "
812 "system information of the calling process at the time of the B<clone>() "
813 "call. Calls to B<chroot>(2), B<chdir>(2), B<umask>(2) performed later by "
814 "one of the processes do not affect the other process."
818 #: build/C/man2/clone.2:223
820 msgid "B<CLONE_IO> (since Linux 2.6.25)"
824 #: build/C/man2/clone.2:232
826 "If B<CLONE_IO> is set, then the new process shares an I/O context with the "
827 "calling process. If this flag is not set, then (as with B<fork>(2)) the "
828 "new process has its own I/O context."
831 #. The following based on text from Jens Axboe
832 #. the anticipatory and CFQ scheduler
835 #: build/C/man2/clone.2:249
837 "The I/O context is the I/O scope of the disk scheduler (i.e, what the I/O "
838 "scheduler uses to model scheduling of a process's I/O). If processes share "
839 "the same I/O context, they are treated as one by the I/O scheduler. As a "
840 "consequence, they get to share disk time. For some I/O schedulers, if two "
841 "processes share an I/O context, they will be allowed to interleave their "
842 "disk access. If several threads are doing I/O on behalf of the same process "
843 "(B<aio_read>(3), for instance), they should employ B<CLONE_IO> to get better "
848 #: build/C/man2/clone.2:253
850 "If the kernel is not configured with the B<CONFIG_BLOCK> option, this flag "
855 #: build/C/man2/clone.2:253 build/C/man2/unshare.2:74
857 msgid "B<CLONE_NEWIPC> (since Linux 2.6.19)"
861 #: build/C/man2/clone.2:263
863 "If B<CLONE_NEWIPC> is set, then create the process in a new IPC namespace. "
864 "If this flag is not set, then (as with B<fork>(2)), the process is created "
865 "in the same IPC namespace as the calling process. This flag is intended for "
866 "the implementation of containers."
870 #: build/C/man2/clone.2:274
872 "An IPC namespace consists of the set of identifiers for System V IPC "
873 "objects. (These objects are created using B<msgctl>(2), B<semctl>(2), and "
874 "B<shmctl>(2)). Objects created in an IPC namespace are visible to all other "
875 "processes that are members of that namespace, but are not visible to "
876 "processes in other IPC namespaces."
880 #: build/C/man2/clone.2:278
882 "When an IPC namespace is destroyed (i.e, when the last process that is a "
883 "member of the namespace terminates), all IPC objects in the namespace are "
884 "automatically destroyed."
888 #: build/C/man2/clone.2:287
890 "Use of this flag requires: a kernel configured with the B<CONFIG_SYSVIPC> "
891 "and B<CONFIG_IPC_NS> options and that the process be privileged "
892 "(B<CAP_SYS_ADMIN>). This flag can't be specified in conjunction with "
897 #: build/C/man2/clone.2:287 build/C/man2/unshare.2:91
899 msgid "B<CLONE_NEWNET> (since Linux 2.6.24)"
902 #. FIXME Check when the implementation was completed
904 #: build/C/man2/clone.2:292
906 "(The implementation of this flag was only completed by about kernel version "
911 #: build/C/man2/clone.2:301
913 "If B<CLONE_NEWNET> is set, then create the process in a new network "
914 "namespace. If this flag is not set, then (as with B<fork>(2)), the process "
915 "is created in the same network namespace as the calling process. This flag "
916 "is intended for the implementation of containers."
920 #: build/C/man2/clone.2:315
922 "A network namespace provides an isolated view of the networking stack "
923 "(network device interfaces, IPv4 and IPv6 protocol stacks, IP routing "
924 "tables, firewall rules, the I</proc/net> and I</sys/class/net> directory "
925 "trees, sockets, etc.). A physical network device can live in exactly one "
926 "network namespace. A virtual network device (\"veth\") pair provides a "
927 "pipe-like abstraction that can be used to create tunnels between network "
928 "namespaces, and can be used to create a bridge to a physical network device "
929 "in another namespace."
933 #: build/C/man2/clone.2:320
935 "When a network namespace is freed (i.e., when the last process in the "
936 "namespace terminates), its physical network devices are moved back to the "
937 "initial network namespace (not to the parent of the process)."
941 #: build/C/man2/clone.2:325
943 "Use of this flag requires: a kernel configured with the B<CONFIG_NET_NS> "
944 "option and that the process be privileged (B<CAP_SYS_ADMIN>)."
948 #: build/C/man2/clone.2:325
950 msgid "B<CLONE_NEWNS> (since Linux 2.4.19)"
954 #: build/C/man2/clone.2:328
955 msgid "Start the child in a new mount namespace."
959 #: build/C/man2/clone.2:349
961 "Every process lives in a mount namespace. The I<namespace> of a process is "
962 "the data (the set of mounts) describing the file hierarchy as seen by that "
963 "process. After a B<fork>(2) or B<clone>() where the B<CLONE_NEWNS> flag "
964 "is not set, the child lives in the same mount namespace as the parent. The "
965 "system calls B<mount>(2) and B<umount>(2) change the mount namespace of "
966 "the calling process, and hence affect all processes that live in the same "
967 "namespace, but do not affect processes in a different mount namespace."
971 #: build/C/man2/clone.2:356
973 "After a B<clone>() where the B<CLONE_NEWNS> flag is set, the cloned child "
974 "is started in a new mount namespace, initialized with a copy of the "
975 "namespace of the parent."
979 #: build/C/man2/clone.2:368
981 "Only a privileged process (one having the B<CAP_SYS_ADMIN> capability) may "
982 "specify the B<CLONE_NEWNS> flag. It is not permitted to specify both "
983 "B<CLONE_NEWNS> and B<CLONE_FS> in the same B<clone>() call."
987 #: build/C/man2/clone.2:368
989 msgid "B<CLONE_NEWPID> (since Linux 2.6.24)"
992 #. This explanation draws a lot of details from
993 #. http://lwn.net/Articles/259217/
994 #. Authors: Pavel Emelyanov <xemul@openvz.org>
995 #. and Kir Kolyshkin <kir@openvz.org>
997 #. The primary kernel commit is 30e49c263e36341b60b735cbef5ca37912549264
998 #. Author: Pavel Emelyanov <xemul@openvz.org>
1000 #: build/C/man2/clone.2:385
1002 "If B<CLONE_NEWPID> is set, then create the process in a new PID namespace. "
1003 "If this flag is not set, then (as with B<fork>(2)), the process is created "
1004 "in the same PID namespace as the calling process. This flag is intended for "
1005 "the implementation of containers."
1009 #: build/C/man2/clone.2:394
1011 "A PID namespace provides an isolated environment for PIDs: PIDs in a new "
1012 "namespace start at 1, somewhat like a standalone system, and calls to "
1013 "B<fork>(2), B<vfork>(2), or B<clone>() will produce processes with PIDs "
1014 "that are unique within the namespace."
1018 #: build/C/man2/clone.2:406
1020 "The first process created in a new namespace (i.e., the process created "
1021 "using the B<CLONE_NEWPID> flag) has the PID 1, and is the \"init\" process "
1022 "for the namespace. Children that are orphaned within the namespace will be "
1023 "reparented to this process rather than B<init>(8). Unlike the traditional "
1024 "B<init> process, the \"init\" process of a PID namespace can terminate, and "
1025 "if it does, all of the processes in the namespace are terminated."
1029 #: build/C/man2/clone.2:425
1031 "PID namespaces form a hierarchy. When a new PID namespace is created, the "
1032 "processes in that namespace are visible in the PID namespace of the process "
1033 "that created the new namespace; analogously, if the parent PID namespace is "
1034 "itself the child of another PID namespace, then processes in the child and "
1035 "parent PID namespaces will both be visible in the grandparent PID "
1036 "namespace. Conversely, the processes in the \"child\" PID namespace do not "
1037 "see the processes in the parent namespace. The existence of a namespace "
1038 "hierarchy means that each process may now have multiple PIDs: one for each "
1039 "namespace in which it is visible; each of these PIDs is unique within the "
1040 "corresponding namespace. (A call to B<getpid>(2) always returns the PID "
1041 "associated with the namespace in which the process lives.)"
1044 #. mount -t proc proc /proc
1046 #: build/C/man2/clone.2:441
1048 "After creating the new namespace, it is useful for the child to change its "
1049 "root directory and mount a new procfs instance at I</proc> so that tools "
1050 "such as B<ps>(1) work correctly. (If B<CLONE_NEWNS> is also included in "
1051 "I<flags>, then it isn't necessary to change the root directory: a new procfs "
1052 "instance can be mounted directly over I</proc>.)"
1056 #: build/C/man2/clone.2:448
1058 "Use of this flag requires: a kernel configured with the B<CONFIG_PID_NS> "
1059 "option and that the process be privileged (B<CAP_SYS_ADMIN>). This flag "
1060 "can't be specified in conjunction with B<CLONE_THREAD>."
1064 #: build/C/man2/clone.2:448 build/C/man2/unshare.2:140
1066 msgid "B<CLONE_NEWUTS> (since Linux 2.6.19)"
1070 #: build/C/man2/clone.2:460
1072 "If B<CLONE_NEWUTS> is set, then create the process in a new UTS namespace, "
1073 "whose identifiers are initialized by duplicating the identifiers from the "
1074 "UTS namespace of the calling process. If this flag is not set, then (as "
1075 "with B<fork>(2)), the process is created in the same UTS namespace as the "
1076 "calling process. This flag is intended for the implementation of "
1081 #: build/C/man2/clone.2:472
1083 "A UTS namespace is the set of identifiers returned by B<uname>(2); among "
1084 "these, the domain name and the host name can be modified by "
1085 "B<setdomainname>(2) and B<sethostname>(2), respectively. Changes made to "
1086 "the identifiers in a UTS namespace are visible to all other processes in the "
1087 "same namespace, but are not visible to processes in other UTS namespaces."
1091 #: build/C/man2/clone.2:477
1093 "Use of this flag requires: a kernel configured with the B<CONFIG_UTS_NS> "
1094 "option and that the process be privileged (B<CAP_SYS_ADMIN>)."
1098 #: build/C/man2/clone.2:477
1100 msgid "B<CLONE_PARENT> (since Linux 2.3.12)"
1104 #: build/C/man2/clone.2:484
1106 "If B<CLONE_PARENT> is set, then the parent of the new child (as returned by "
1107 "B<getppid>(2)) will be the same as that of the calling process."
1111 #: build/C/man2/clone.2:490
1113 "If B<CLONE_PARENT> is not set, then (as with B<fork>(2)) the child's parent "
1114 "is the calling process."
1118 #: build/C/man2/clone.2:498
1120 "Note that it is the parent process, as returned by B<getppid>(2), which is "
1121 "signaled when the child terminates, so that if B<CLONE_PARENT> is set, then "
1122 "the parent of the calling process, rather than the calling process itself, "
1127 #: build/C/man2/clone.2:498
1129 msgid "B<CLONE_PARENT_SETTID> (since Linux 2.5.49)"
1133 #: build/C/man2/clone.2:506
1135 "Store child thread ID at location I<ptid> in parent and child memory. (In "
1136 "Linux 2.5.32-2.5.48 there was a flag B<CLONE_SETTID> that did this.)"
1140 #: build/C/man2/clone.2:506
1142 msgid "B<CLONE_PID> (obsolete)"
1146 #: build/C/man2/clone.2:517
1148 "If B<CLONE_PID> is set, the child process is created with the same process "
1149 "ID as the calling process. This is good for hacking the system, but "
1150 "otherwise of not much use. Since 2.3.21 this flag can be specified only by "
1151 "the system boot process (PID 0). It disappeared in Linux 2.5.16."
1155 #: build/C/man2/clone.2:517
1157 msgid "B<CLONE_PTRACE>"
1161 #: build/C/man2/clone.2:524
1163 "If B<CLONE_PTRACE> is specified, and the calling process is being traced, "
1164 "then trace the child also (see B<ptrace>(2))."
1168 #: build/C/man2/clone.2:524
1170 msgid "B<CLONE_SETTLS> (since Linux 2.5.32)"
1174 #: build/C/man2/clone.2:531
1176 "The I<newtls> argument is the new TLS (Thread Local Storage) descriptor. "
1177 "(See B<set_thread_area>(2).)"
1181 #: build/C/man2/clone.2:531
1183 msgid "B<CLONE_SIGHAND>"
1187 #: build/C/man2/clone.2:547
1189 "If B<CLONE_SIGHAND> is set, the calling process and the child process share "
1190 "the same table of signal handlers. If the calling process or child process "
1191 "calls B<sigaction>(2) to change the behavior associated with a signal, the "
1192 "behavior is changed in the other process as well. However, the calling "
1193 "process and child processes still have distinct signal masks and sets of "
1194 "pending signals. So, one of them may block or unblock some signals using "
1195 "B<sigprocmask>(2) without affecting the other process."
1199 #: build/C/man2/clone.2:558
1201 "If B<CLONE_SIGHAND> is not set, the child process inherits a copy of the "
1202 "signal handlers of the calling process at the time B<clone>() is called. "
1203 "Calls to B<sigaction>(2) performed later by one of the processes have no "
1204 "effect on the other process."
1208 #: build/C/man2/clone.2:566
1210 "Since Linux 2.6.0-test6, I<flags> must also include B<CLONE_VM> if "
1211 "B<CLONE_SIGHAND> is specified"
1215 #: build/C/man2/clone.2:566
1217 msgid "B<CLONE_STOPPED> (since Linux 2.6.0-test2)"
1221 #: build/C/man2/clone.2:575
1223 "If B<CLONE_STOPPED> is set, then the child is initially stopped (as though "
1224 "it was sent a B<SIGSTOP> signal), and must be resumed by sending it a "
1225 "B<SIGCONT> signal."
1228 #. glibc 2.8 removed this defn from bits/sched.h
1230 #: build/C/man2/clone.2:583
1232 "This flag was I<deprecated> from Linux 2.6.25 onward, and was I<removed> "
1233 "altogether in Linux 2.6.38."
1237 #: build/C/man2/clone.2:583
1239 msgid "B<CLONE_SYSVSEM> (since Linux 2.5.10)"
1243 #: build/C/man2/clone.2:592
1245 "If B<CLONE_SYSVSEM> is set, then the child and the calling process share a "
1246 "single list of System V semaphore undo values (see B<semop>(2)). If this "
1247 "flag is not set, then the child has a separate undo list, which is initially "
1252 #: build/C/man2/clone.2:592
1254 msgid "B<CLONE_THREAD> (since Linux 2.4.0-test8)"
1258 #: build/C/man2/clone.2:601
1260 "If B<CLONE_THREAD> is set, the child is placed in the same thread group as "
1261 "the calling process. To make the remainder of the discussion of "
1262 "B<CLONE_THREAD> more readable, the term \"thread\" is used to refer to the "
1263 "processes within a thread group."
1267 #: build/C/man2/clone.2:609
1269 "Thread groups were a feature added in Linux 2.4 to support the POSIX threads "
1270 "notion of a set of threads that share a single PID. Internally, this shared "
1271 "PID is the so-called thread group identifier (TGID) for the thread group. "
1272 "Since Linux 2.4, calls to B<getpid>(2) return the TGID of the caller."
1276 #: build/C/man2/clone.2:618
1278 "The threads within a group can be distinguished by their (system-wide) "
1279 "unique thread IDs (TID). A new thread's TID is available as the function "
1280 "result returned to the caller of B<clone>(), and a thread can obtain its own "
1281 "TID using B<gettid>(2)."
1285 #: build/C/man2/clone.2:628
1287 "When a call is made to B<clone>() without specifying B<CLONE_THREAD>, then "
1288 "the resulting thread is placed in a new thread group whose TGID is the same "
1289 "as the thread's TID. This thread is the I<leader> of the new thread group."
1293 #: build/C/man2/clone.2:650
1295 "A new thread created with B<CLONE_THREAD> has the same parent process as the "
1296 "caller of B<clone>() (i.e., like B<CLONE_PARENT>), so that calls to "
1297 "B<getppid>(2) return the same value for all of the threads in a thread "
1298 "group. When a B<CLONE_THREAD> thread terminates, the thread that created it "
1299 "using B<clone>() is not sent a B<SIGCHLD> (or other termination) signal; "
1300 "nor can the status of such a thread be obtained using B<wait>(2). (The "
1301 "thread is said to be I<detached>.)"
1305 #: build/C/man2/clone.2:655
1307 "After all of the threads in a thread group terminate the parent process of "
1308 "the thread group is sent a B<SIGCHLD> (or other termination) signal."
1312 #: build/C/man2/clone.2:660
1314 "If any of the threads in a thread group performs an B<execve>(2), then all "
1315 "threads other than the thread group leader are terminated, and the new "
1316 "program is executed in the thread group leader."
1320 #: build/C/man2/clone.2:666
1322 "If one of the threads in a thread group creates a child using B<fork>(2), "
1323 "then any thread in the group can B<wait>(2) for that child."
1327 #: build/C/man2/clone.2:674
1329 "Since Linux 2.5.35, I<flags> must also include B<CLONE_SIGHAND> if "
1330 "B<CLONE_THREAD> is specified."
1334 #: build/C/man2/clone.2:679
1336 "Signals may be sent to a thread group as a whole (i.e., a TGID) using "
1337 "B<kill>(2), or to a specific thread (i.e., TID) using B<tgkill>(2)."
1341 #: build/C/man2/clone.2:684
1343 "Signal dispositions and actions are process-wide: if an unhandled signal is "
1344 "delivered to a thread, then it will affect (terminate, stop, continue, be "
1345 "ignored in) all members of the thread group."
1349 #: build/C/man2/clone.2:697
1351 "Each thread has its own signal mask, as set by B<sigprocmask>(2), but "
1352 "signals can be pending either: for the whole process (i.e., deliverable to "
1353 "any member of the thread group), when sent with B<kill>(2); or for an "
1354 "individual thread, when sent with B<tgkill>(2). A call to B<sigpending>(2) "
1355 "returns a signal set that is the union of the signals pending for the whole "
1356 "process and the signals that are pending for the calling thread."
1360 #: build/C/man2/clone.2:709
1362 "If B<kill>(2) is used to send a signal to a thread group, and the thread "
1363 "group has installed a handler for the signal, then the handler will be "
1364 "invoked in exactly one, arbitrarily selected member of the thread group that "
1365 "has not blocked the signal. If multiple threads in a group are waiting to "
1366 "accept the same signal using B<sigwaitinfo>(2), the kernel will arbitrarily "
1367 "select one of these threads to receive a signal sent using B<kill>(2)."
1371 #: build/C/man2/clone.2:709
1373 msgid "B<CLONE_UNTRACED> (since Linux 2.5.46)"
1377 #: build/C/man2/clone.2:716
1379 "If B<CLONE_UNTRACED> is specified, then a tracing process cannot force "
1380 "B<CLONE_PTRACE> on this child process."
1384 #: build/C/man2/clone.2:716
1386 msgid "B<CLONE_VFORK>"
1390 #: build/C/man2/clone.2:728
1392 "If B<CLONE_VFORK> is set, the execution of the calling process is suspended "
1393 "until the child releases its virtual memory resources via a call to "
1394 "B<execve>(2) or B<_exit>(2) (as with B<vfork>(2))."
1398 #: build/C/man2/clone.2:734
1400 "If B<CLONE_VFORK> is not set then both the calling process and the child are "
1401 "schedulable after the call, and an application should not rely on execution "
1402 "occurring in any particular order."
1406 #: build/C/man2/clone.2:734
1412 #: build/C/man2/clone.2:747
1414 "If B<CLONE_VM> is set, the calling process and the child process run in the "
1415 "same memory space. In particular, memory writes performed by the calling "
1416 "process or by the child process are also visible in the other process. "
1417 "Moreover, any memory mapping or unmapping performed with B<mmap>(2) or "
1418 "B<munmap>(2) by the child or calling process also affects the other "
1423 #: build/C/man2/clone.2:756
1425 "If B<CLONE_VM> is not set, the child process runs in a separate copy of the "
1426 "memory space of the calling process at the time of B<clone>(). Memory "
1427 "writes or file mappings/unmappings performed by one of the processes do not "
1428 "affect the other, as with B<fork>(2)."
1432 #: build/C/man2/clone.2:756
1438 #: build/C/man2/clone.2:773
1440 "The B<sys_clone> system call corresponds more closely to B<fork>(2) in that "
1441 "execution in the child continues from the point of the call. Thus, "
1442 "B<sys_clone> only requires the I<flags> and I<child_stack> arguments, which "
1443 "have the same meaning as for B<clone>(). (Note that the order of these "
1444 "arguments differs from B<clone>().)"
1448 #: build/C/man2/clone.2:784
1450 "Another difference for B<sys_clone> is that the I<child_stack> argument may "
1451 "be zero, in which case copy-on-write semantics ensure that the child gets "
1452 "separate copies of stack pages when either process modifies the stack. In "
1453 "this case, for correct operation, the B<CLONE_VM> option should not be "
1458 #: build/C/man2/clone.2:792
1460 "In Linux 2.4 and earlier, B<clone>() does not take arguments I<ptid>, "
1461 "I<tls>, and I<ctid>."
1464 #. gettid(2) returns current->pid;
1465 #. getpid(2) returns current->tgid;
1467 #: build/C/man2/clone.2:801
1469 "On success, the thread ID of the child process is returned in the caller's "
1470 "thread of execution. On failure, -1 is returned in the caller's context, no "
1471 "child process will be created, and I<errno> will be set appropriately."
1475 #: build/C/man2/clone.2:801 build/C/man2/sched_get_priority_max.2:97 build/C/man3/sched_getcpu.3:45 build/C/man2/sched_rr_get_interval.2:81 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
1481 #: build/C/man2/clone.2:802
1487 #: build/C/man2/clone.2:805
1488 msgid "Too many processes are already running."
1492 #: build/C/man2/clone.2:805 build/C/man2/clone.2:812 build/C/man2/clone.2:827 build/C/man2/clone.2:835 build/C/man2/clone.2:843 build/C/man2/clone.2:851 build/C/man2/clone.2:857 build/C/man2/clone.2:867 build/C/man2/clone.2:875 build/C/man2/clone.2:883 build/C/man2/sched_get_priority_max.2:98 build/C/man2/sched_rr_get_interval.2:85 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
1498 #: build/C/man2/clone.2:812
1500 "B<CLONE_SIGHAND> was specified, but B<CLONE_VM> was not. (Since Linux "
1507 #. .B CLONE_DETACHED
1511 #. (Since Linux 2.6.0-test6.)
1513 #: build/C/man2/clone.2:827
1515 "B<CLONE_THREAD> was specified, but B<CLONE_SIGHAND> was not. (Since Linux "
1520 #: build/C/man2/clone.2:835
1521 msgid "Both B<CLONE_FS> and B<CLONE_NEWNS> were specified in I<flags>."
1525 #: build/C/man2/clone.2:843
1526 msgid "Both B<CLONE_NEWIPC> and B<CLONE_SYSVSEM> were specified in I<flags>."
1530 #: build/C/man2/clone.2:851
1531 msgid "Both B<CLONE_NEWPID> and B<CLONE_THREAD> were specified in I<flags>."
1535 #: build/C/man2/clone.2:857
1536 msgid "Returned by B<clone>() when a zero value is specified for I<child_stack>."
1540 #: build/C/man2/clone.2:867
1542 "B<CLONE_NEWIPC> was specified in I<flags>, but the kernel was not configured "
1543 "with the B<CONFIG_SYSVIPC> and B<CONFIG_IPC_NS> options."
1547 #: build/C/man2/clone.2:875
1549 "B<CLONE_NEWNET> was specified in I<flags>, but the kernel was not configured "
1550 "with the B<CONFIG_NET_NS> option."
1554 #: build/C/man2/clone.2:883
1556 "B<CLONE_NEWPID> was specified in I<flags>, but the kernel was not configured "
1557 "with the B<CONFIG_PID_NS> option."
1561 #: build/C/man2/clone.2:891
1563 "B<CLONE_NEWUTS> was specified in I<flags>, but the kernel was not configured "
1564 "with the B<CONFIG_UTS> option."
1568 #: build/C/man2/clone.2:891 build/C/man2/setns.2:85 build/C/man2/unshare.2:193
1574 #: build/C/man2/clone.2:896
1576 "Cannot allocate sufficient memory to allocate a task structure for the "
1577 "child, or to copy those parts of the caller's context that need to be "
1582 #: build/C/man2/clone.2:896 build/C/man2/clone.2:905 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
1588 #: build/C/man2/clone.2:905
1590 "B<CLONE_NEWIPC>, B<CLONE_NEWNET>, B<CLONE_NEWNS>, B<CLONE_NEWPID>, or "
1591 "B<CLONE_NEWUTS> was specified by an unprivileged process (process without "
1592 "B<CAP_SYS_ADMIN>)."
1596 #: build/C/man2/clone.2:909
1597 msgid "B<CLONE_PID> was specified by a process other than process 0."
1601 #: build/C/man2/clone.2:916
1603 "There is no entry for B<clone>() in libc5. glibc2 provides B<clone>() as "
1604 "described in this manual page."
1608 #: build/C/man2/clone.2:923
1610 "The B<clone>() and B<sys_clone> calls are Linux-specific and should not be "
1611 "used in programs intended to be portable."
1615 #: build/C/man2/clone.2:933
1617 "In the kernel 2.4.x series, B<CLONE_THREAD> generally does not make the "
1618 "parent of the new thread the same as the parent of the calling process. "
1619 "However, for kernel versions 2.4.7 to 2.4.18 the B<CLONE_THREAD> flag "
1620 "implied the B<CLONE_PARENT> flag (as in kernel 2.6)."
1624 #: build/C/man2/clone.2:943
1626 "For a while there was B<CLONE_DETACHED> (introduced in 2.5.32): parent wants "
1627 "no child-exit signal. In 2.6.2 the need to give this together with "
1628 "B<CLONE_THREAD> disappeared. This flag is still defined, but has no effect."
1632 #: build/C/man2/clone.2:948
1634 "On i386, B<clone>() should not be called through vsyscall, but directly "
1635 "through I<int $0x80>."
1639 #: build/C/man2/clone.2:950
1640 msgid "On ia64, a different system call is used:"
1644 #: build/C/man2/clone.2:957
1647 "B<int __clone2(int (*>I<fn>B<)(void *), >\n"
1648 "B< void *>I<child_stack_base>B<, size_t >I<stack_size>B<,>\n"
1649 "B< int >I<flags>B<, void *>I<arg>B<, ... >\n"
1650 "B< /* pid_t *>I<ptid>B<, struct user_desc *>I<tls>B<, pid_t "
1651 "*>I<ctid>B< */ );>\n"
1655 #: build/C/man2/clone.2:970
1657 "The B<__clone2>() system call operates in the same way as B<clone>(), "
1658 "except that I<child_stack_base> points to the lowest address of the child's "
1659 "stack area, and I<stack_size> specifies the size of the stack pointed to by "
1660 "I<child_stack_base>."
1664 #: build/C/man2/clone.2:1001
1666 "Versions of the GNU C library that include the NPTL threading library "
1667 "contain a wrapper function for B<getpid>(2) that performs caching of PIDs. "
1668 "This caching relies on support in the glibc wrapper for B<clone>(), but as "
1669 "currently implemented, the cache may not be up to date in some "
1670 "circumstances. In particular, if a signal is delivered to the child "
1671 "immediately after the B<clone>() call, then a call to B<getpid>(2) in a "
1672 "handler for the signal may return the PID of the calling process (\"the "
1673 "parent\"), if the clone wrapper has not yet had a chance to update the PID "
1674 "cache in the child. (This discussion ignores the case where the child was "
1675 "created using B<CLONE_THREAD>, when B<getpid>(2) I<should> return the same "
1676 "value in the child and in the process that called B<clone>(), since the "
1677 "caller and the child are in the same thread group. The stale-cache problem "
1678 "also does not occur if the I<flags> argument includes B<CLONE_VM>.) To get "
1679 "the truth, it may be necessary to use code such as the following:"
1683 #: build/C/man2/clone.2:1004
1685 msgid " #include E<lt>syscall.hE<gt>\n"
1689 #: build/C/man2/clone.2:1006
1691 msgid " pid_t mypid;\n"
1695 #: build/C/man2/clone.2:1008
1697 msgid " mypid = syscall(SYS_getpid);\n"
1701 #: build/C/man2/clone.2:1023
1703 "B<fork>(2), B<futex>(2), B<getpid>(2), B<gettid>(2), B<set_thread_area>(2), "
1704 "B<set_tid_address>(2), B<tkill>(2), B<unshare>(2), B<wait>(2), "
1705 "B<capabilities>(7), B<pthreads>(7)"
1709 #: build/C/man2/sched_get_priority_max.2:30
1711 msgid "SCHED_GET_PRIORITY_MAX"
1715 #: build/C/man2/sched_get_priority_max.2:30 build/C/man2/sched_setparam.2:31
1721 #: build/C/man2/sched_get_priority_max.2:33
1722 msgid "sched_get_priority_max, sched_get_priority_min - get static priority range"
1726 #: 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
1727 msgid "B<#include E<lt>sched.hE<gt>>"
1731 #: build/C/man2/sched_get_priority_max.2:37
1732 msgid "B<int sched_get_priority_max(int >I<policy>B<);>"
1736 #: build/C/man2/sched_get_priority_max.2:39
1737 msgid "B<int sched_get_priority_min(int >I<policy>B<);>"
1741 #: build/C/man2/sched_get_priority_max.2:55
1743 "B<sched_get_priority_max>() returns the maximum priority value that can be "
1744 "used with the scheduling algorithm identified by I<policy>. "
1745 "B<sched_get_priority_min>() returns the minimum priority value that can be "
1746 "used with the scheduling algorithm identified by I<policy>. Supported "
1747 "I<policy> values are B<SCHED_FIFO>, B<SCHED_RR>, B<SCHED_OTHER>, and "
1748 "B<SCHED_BATCH>. Further details about these policies can be found in "
1749 "B<sched_setscheduler>(2)."
1753 #: build/C/man2/sched_get_priority_max.2:64
1755 "Processes with numerically higher priority values are scheduled before "
1756 "processes with numerically lower priority values. Thus, the value returned "
1757 "by B<sched_get_priority_max>() will be greater than the value returned by "
1758 "B<sched_get_priority_min>()."
1762 #: build/C/man2/sched_get_priority_max.2:70
1764 "Linux allows the static priority value range 1 to 99 for B<SCHED_FIFO> and "
1765 "B<SCHED_RR> and the priority 0 for B<SCHED_OTHER> and B<SCHED_BATCH>. "
1766 "Scheduling priority ranges for the various policies are not alterable."
1770 #: build/C/man2/sched_get_priority_max.2:79
1772 "The range of scheduling priorities may vary on other POSIX systems, thus it "
1773 "is a good idea for portable applications to use a virtual priority range and "
1774 "map it to the interval given by B<sched_get_priority_max>() and "
1775 "B<sched_get_priority_min>(). POSIX.1-2001 requires a spread of at least 32 "
1776 "between the maximum and the minimum values for B<SCHED_FIFO> and "
1781 #: build/C/man2/sched_get_priority_max.2:87
1783 "POSIX systems on which B<sched_get_priority_max>() and "
1784 "B<sched_get_priority_min>() are available define "
1785 "B<_POSIX_PRIORITY_SCHEDULING> in I<E<lt>unistd.hE<gt>>."
1789 #: build/C/man2/sched_get_priority_max.2:97
1791 "On success, B<sched_get_priority_max>() and B<sched_get_priority_min>() "
1792 "return the maximum/minimum priority value for the named scheduling policy. "
1793 "On error, -1 is returned, and I<errno> is set appropriately."
1797 #: build/C/man2/sched_get_priority_max.2:101
1798 msgid "The argument I<policy> does not identify a defined scheduling policy."
1802 #: build/C/man2/sched_get_priority_max.2:103 build/C/man2/sched_rr_get_interval.2:97 build/C/man2/sched_setparam.2:113 build/C/man2/sched_yield.2:55
1803 msgid "POSIX.1-2001."
1807 #: build/C/man2/sched_get_priority_max.2:110
1809 "B<sched_getaffinity>(2), B<sched_getparam>(2), B<sched_getscheduler>(2), "
1810 "B<sched_setaffinity>(2), B<sched_setparam>(2), B<sched_setscheduler>(2)"
1814 #: build/C/man2/sched_get_priority_max.2:112 build/C/man2/sched_rr_get_interval.2:131 build/C/man2/sched_setparam.2:126 build/C/man2/sched_setscheduler.2:538 build/C/man2/sched_yield.2:84
1816 "I<Programming for the real world - POSIX.4> by Bill O. Gallmeister, O'Reilly "
1817 "& Associates, Inc., ISBN 1-56592-074-0"
1821 #: build/C/man3/sched_getcpu.3:24
1823 msgid "SCHED_GETCPU"
1827 #: build/C/man3/sched_getcpu.3:24
1833 #: build/C/man3/sched_getcpu.3:27
1834 msgid "sched_getcpu - determine CPU on which the calling thread is running"
1837 #. Really:_BSD_SOURCE || _SVID_SOURCE
1839 #: build/C/man3/sched_getcpu.3:32
1842 "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n"
1843 "B<#include E<lt>sched.hE<gt>>\n"
1847 #: build/C/man3/sched_getcpu.3:34
1849 msgid "B<int sched_getcpu(void);>\n"
1853 #: build/C/man3/sched_getcpu.3:38
1855 "B<sched_getcpu>() returns the number of the CPU on which the calling thread "
1856 "is currently executing."
1860 #: build/C/man3/sched_getcpu.3:45
1862 "On success, B<sched_getcpu>() returns a nonnegative CPU number. On error, "
1863 "-1 is returned and I<errno> is set to indicate the error."
1867 #: build/C/man3/sched_getcpu.3:46 build/C/man2/sched_rr_get_interval.2:88
1873 #: build/C/man3/sched_getcpu.3:50
1874 msgid "This kernel does not implement B<getcpu>(2)."
1878 #: build/C/man3/sched_getcpu.3:52
1879 msgid "This function is available since glibc 2.6."
1883 #: build/C/man3/sched_getcpu.3:55
1884 msgid "B<sched_getcpu>() is glibc specific."
1888 #: build/C/man3/sched_getcpu.3:57
1893 #: build/C/man3/sched_getcpu.3:61
1895 msgid "cpu = sched_getcpu();\n"
1899 #: build/C/man3/sched_getcpu.3:67
1900 msgid "is equivalent to the following B<getcpu>(2) call:"
1904 #: build/C/man3/sched_getcpu.3:73
1908 "s = getcpu(&c, NULL, NULL);\n"
1909 "cpu = (s == -1) ? s : c;\n"
1913 #: build/C/man3/sched_getcpu.3:76
1914 msgid "B<getcpu>(2)"
1918 #: build/C/man2/sched_rr_get_interval.2:30
1920 msgid "SCHED_RR_GET_INTERVAL"
1924 #: build/C/man2/sched_rr_get_interval.2:30
1930 #: build/C/man2/sched_rr_get_interval.2:33
1931 msgid "sched_rr_get_interval - get the SCHED_RR interval for the named process"
1935 #: build/C/man2/sched_rr_get_interval.2:37
1936 msgid "B<int sched_rr_get_interval(pid_t >I<pid>B<, struct timespec * >I<tp>B<);>"
1940 #: build/C/man2/sched_rr_get_interval.2:48
1942 "B<sched_rr_get_interval>() writes into the I<timespec> structure pointed to "
1943 "by I<tp> the round-robin time quantum for the process identified by I<pid>. "
1944 "The specified process should be running under the B<SCHED_RR> scheduling "
1949 #: build/C/man2/sched_rr_get_interval.2:52
1950 msgid "The I<timespec> structure has the following form:"
1954 #: build/C/man2/sched_rr_get_interval.2:59
1957 "struct timespec {\n"
1958 " time_t tv_sec; /* seconds */\n"
1959 " long tv_nsec; /* nanoseconds */\n"
1963 #. FIXME . On Linux, sched_rr_get_interval()
1964 #. returns the timeslice for SCHED_OTHER processes -- this timeslice
1965 #. is influenced by the nice value.
1966 #. For SCHED_FIFO processes, this always returns 0.
1968 #. The round-robin time quantum value is not alterable under Linux
1971 #: build/C/man2/sched_rr_get_interval.2:74
1973 "If I<pid> is zero, the time quantum for the calling process is written into "
1978 #: build/C/man2/sched_rr_get_interval.2:81
1980 "On success, B<sched_rr_get_interval>() returns 0. On error, -1 is "
1981 "returned, and I<errno> is set appropriately."
1985 #: build/C/man2/sched_rr_get_interval.2:82 build/C/man2/sched_setaffinity.2:118
1991 #: build/C/man2/sched_rr_get_interval.2:85
1992 msgid "Problem with copying information to userspace."
1996 #: build/C/man2/sched_rr_get_interval.2:88
1997 msgid "Invalid pid."
2001 #: build/C/man2/sched_rr_get_interval.2:91
2002 msgid "The system call is not yet implemented (only on rather old kernels)."
2006 #: build/C/man2/sched_rr_get_interval.2:91 build/C/man2/sched_setaffinity.2:146 build/C/man2/sched_setparam.2:108 build/C/man2/sched_setscheduler.2:442
2012 #: build/C/man2/sched_rr_get_interval.2:95
2013 msgid "Could not find a process with the ID I<pid>."
2017 #: build/C/man2/sched_rr_get_interval.2:104
2019 "POSIX systems on which B<sched_rr_get_interval>() is available define "
2020 "B<_POSIX_PRIORITY_SCHEDULING> in I<E<lt>unistd.hE<gt>>."
2024 #: build/C/man2/sched_rr_get_interval.2:104
2029 #. commit a4ec24b48ddef1e93f7578be53270f0b95ad666c
2031 #. As of Linux 1.3.81
2032 #. .BR sched_rr_get_interval ()
2033 #. returns with error
2034 #. ENOSYS, because SCHED_RR has not yet been fully implemented and tested
2037 #: build/C/man2/sched_rr_get_interval.2:126
2039 "POSIX does not specify any mechanism for controlling the size of the "
2040 "round-robin time quantum. Older Linux kernels provide a (nonportable) "
2041 "method of doing this. The quantum can be controlled by adjusting the "
2042 "process's nice value (see B<setpriority>(2)). Assigning a negative (i.e., "
2043 "high) nice value results in a longer quantum; assigning a positive (i.e., "
2044 "low) nice value results in a shorter quantum. The default quantum is 0.1 "
2045 "seconds; the degree to which changing the nice value affects the quantum has "
2046 "varied somewhat across kernel versions. Since Linux 2.6.24, the B<SCHED_RR> "
2047 "quantum cannot be modified."
2051 #: build/C/man2/sched_rr_get_interval.2:129 build/C/man2/sched_setaffinity.2:178
2052 msgid "B<sched_setscheduler>(2) has a description of the Linux scheduling scheme."
2056 #: build/C/man2/sched_setaffinity.2:35
2058 msgid "SCHED_SETAFFINITY"
2062 #: build/C/man2/sched_setaffinity.2:35
2068 #: build/C/man2/sched_setaffinity.2:39
2070 "sched_setaffinity, sched_getaffinity - set and get a process's CPU affinity "
2075 #: build/C/man2/sched_setaffinity.2:46
2078 "B<int sched_setaffinity(pid_t >I<pid>B<, size_t >I<cpusetsize>B<,>\n"
2079 "B< cpu_set_t *>I<mask>B<);>\n"
2083 #: build/C/man2/sched_setaffinity.2:49
2086 "B<int sched_getaffinity(pid_t >I<pid>B<, size_t >I<cpusetsize>B<,>\n"
2087 "B< cpu_set_t *>I<mask>B<);>\n"
2091 #: build/C/man2/sched_setaffinity.2:64
2093 "A process's CPU affinity mask determines the set of CPUs on which it is "
2094 "eligible to run. On a multiprocessor system, setting the CPU affinity mask "
2095 "can be used to obtain performance benefits. For example, by dedicating one "
2096 "CPU to a particular process (i.e., setting the affinity mask of that process "
2097 "to specify a single CPU, and setting the affinity mask of all other "
2098 "processes to exclude that CPU), it is possible to ensure maximum execution "
2099 "speed for that process. Restricting a process to run on a single CPU also "
2100 "avoids the performance cost caused by the cache invalidation that occurs "
2101 "when a process ceases to execute on one CPU and then recommences execution "
2102 "on a different CPU."
2106 #: build/C/man2/sched_setaffinity.2:71
2108 "A CPU affinity mask is represented by the I<cpu_set_t> structure, a \"CPU "
2109 "set\", pointed to by I<mask>. A set of macros for manipulating CPU sets is "
2110 "described in B<CPU_SET>(3)."
2114 #: build/C/man2/sched_setaffinity.2:86
2116 "B<sched_setaffinity>() sets the CPU affinity mask of the process whose ID "
2117 "is I<pid> to the value specified by I<mask>. If I<pid> is zero, then the "
2118 "calling process is used. The argument I<cpusetsize> is the length (in "
2119 "bytes) of the data pointed to by I<mask>. Normally this argument would be "
2120 "specified as I<sizeof(cpu_set_t)>."
2124 #: build/C/man2/sched_setaffinity.2:93
2126 "If the process specified by I<pid> is not currently running on one of the "
2127 "CPUs specified in I<mask>, then that process is migrated to one of the CPUs "
2128 "specified in I<mask>."
2132 #: build/C/man2/sched_setaffinity.2:108
2134 "B<sched_getaffinity>() writes the affinity mask of the process whose ID is "
2135 "I<pid> into the I<cpu_set_t> structure pointed to by I<mask>. The "
2136 "I<cpusetsize> argument specifies the size (in bytes) of I<mask>. If I<pid> "
2137 "is zero, then the mask of the calling process is returned."
2141 #: build/C/man2/sched_setaffinity.2:117
2143 "On success, B<sched_setaffinity>() and B<sched_getaffinity>() return 0. "
2144 "On error, -1 is returned, and I<errno> is set appropriately."
2148 #: build/C/man2/sched_setaffinity.2:121
2149 msgid "A supplied memory address was invalid."
2153 #: build/C/man2/sched_setaffinity.2:129
2155 "The affinity bit mask I<mask> contains no processors that are currently "
2156 "physically on the system and permitted to the process according to any "
2157 "restrictions that may be imposed by the \"cpuset\" mechanism described in "
2162 #: build/C/man2/sched_setaffinity.2:136
2164 "(B<sched_getaffinity>() and, in kernels before 2.6.9, "
2165 "B<sched_setaffinity>()) I<cpusetsize> is smaller than the size of the "
2166 "affinity mask used by the kernel."
2170 #: build/C/man2/sched_setaffinity.2:146
2172 "(B<sched_setaffinity>()) The calling process does not have appropriate "
2173 "privileges. The caller needs an effective user ID equal to the real user ID "
2174 "or effective user ID of the process identified by I<pid>, or it must possess "
2175 "the B<CAP_SYS_NICE> capability."
2179 #: build/C/man2/sched_setaffinity.2:149 build/C/man2/sched_setparam.2:111 build/C/man2/sched_setscheduler.2:445
2180 msgid "The process whose ID is I<pid> could not be found."
2184 #: build/C/man2/sched_setaffinity.2:160
2186 "The CPU affinity system calls were introduced in Linux kernel 2.5.8. The "
2187 "system call wrappers were introduced in glibc 2.3. Initially, the glibc "
2188 "interfaces included a I<cpusetsize> argument, typed as I<unsigned int>. In "
2189 "glibc 2.3.3, the I<cpusetsize> argument was removed, but was then restored "
2190 "in glibc 2.3.4, with type I<size_t>."
2194 #: build/C/man2/sched_setaffinity.2:162
2195 msgid "These system calls are Linux-specific."
2199 #: build/C/man2/sched_setaffinity.2:175
2201 "After a call to B<sched_setaffinity>(), the set of CPUs on which the process "
2202 "will actually run is the intersection of the set specified in the I<mask> "
2203 "argument and the set of CPUs actually present on the system. The system may "
2204 "further restrict the set of CPUs on which the process runs if the \"cpuset\" "
2205 "mechanism described in B<cpuset>(7) is being used. These restrictions on "
2206 "the actual set of CPUs on which the process will run are silently imposed by "
2211 #: build/C/man2/sched_setaffinity.2:195
2213 "The affinity mask is actually a per-thread attribute that can be adjusted "
2214 "independently for each of the threads in a thread group. The value returned "
2215 "from a call to B<gettid>(2) can be passed in the argument I<pid>. "
2216 "Specifying I<pid> as 0 will set the attribute for the calling thread, and "
2217 "passing the value returned from a call to B<getpid>(2) will set the "
2218 "attribute for the main thread of the thread group. (If you are using the "
2219 "POSIX threads API, then use B<pthread_setaffinity_np>(3) instead of "
2220 "B<sched_setaffinity>().)"
2224 #: build/C/man2/sched_setaffinity.2:201
2226 "A child created via B<fork>(2) inherits its parent's CPU affinity mask. "
2227 "The affinity mask is preserved across an B<execve>(2)."
2231 #: build/C/man2/sched_setaffinity.2:215
2233 "This manual page describes the glibc interface for the CPU affinity calls. "
2234 "The actual system call interface is slightly different, with the I<mask> "
2235 "being typed as I<unsigned long *>, reflecting the fact that the underlying "
2236 "implementation of CPU sets is a simple bit mask. On success, the raw "
2237 "B<sched_getaffinity>() system call returns the size (in bytes) of the "
2238 "I<cpumask_t> data type that is used internally by the kernel to represent "
2239 "the CPU set bit mask."
2243 #: build/C/man2/sched_setaffinity.2:230
2245 "B<clone>(2), B<getcpu>(2), B<getpriority>(2), B<gettid>(2), B<nice>(2), "
2246 "B<sched_get_priority_max>(2), B<sched_get_priority_min>(2), "
2247 "B<sched_getscheduler>(2), B<sched_setscheduler>(2), B<setpriority>(2), "
2248 "B<CPU_SET>(3), B<pthread_setaffinity_np>(3), B<sched_getcpu>(3), "
2249 "B<capabilities>(7), B<cpuset>(7)"
2253 #: build/C/man2/sched_setparam.2:31
2255 msgid "SCHED_SETPARAM"
2259 #: build/C/man2/sched_setparam.2:34
2260 msgid "sched_setparam, sched_getparam - set and get scheduling parameters"
2264 #: build/C/man2/sched_setparam.2:37 build/C/man2/sched_setscheduler.2:54
2266 msgid "B<#include E<lt>sched.hE<gt>>\n"
2270 #: build/C/man2/sched_setparam.2:39
2273 "B<int sched_setparam(pid_t >I<pid>B<, const struct sched_param "
2278 #: build/C/man2/sched_setparam.2:41
2280 msgid "B<int sched_getparam(pid_t >I<pid>B<, struct sched_param *>I<param>B<);>\n"
2284 #: build/C/man2/sched_setparam.2:47 build/C/man2/sched_setscheduler.2:66
2287 "B<struct sched_param {\n"
2289 " int >I<sched_priority>B<;\n"
2295 #: build/C/man2/sched_setparam.2:61
2297 "B<sched_setparam>() sets the scheduling parameters associated with the "
2298 "scheduling policy for the process identified by I<pid>. If I<pid> is zero, "
2299 "then the parameters of the calling process are set. The interpretation of "
2300 "the argument I<param> depends on the scheduling policy of the process "
2301 "identified by I<pid>. See B<sched_setscheduler>(2) for a description of "
2302 "the scheduling policies supported under Linux."
2306 #: build/C/man2/sched_setparam.2:67
2308 "B<sched_getparam>() retrieves the scheduling parameters for the process "
2309 "identified by I<pid>. If I<pid> is zero, then the parameters of the calling "
2310 "process are retrieved."
2314 #: build/C/man2/sched_setparam.2:76
2316 "B<sched_setparam>() checks the validity of I<param> for the scheduling "
2317 "policy of the process. The value I<param-E<gt>sched_priority> must lie "
2318 "within the range given by B<sched_get_priority_min>(2) and "
2319 "B<sched_get_priority_max>(2)."
2323 #: build/C/man2/sched_setparam.2:80
2325 "For a discussion of the privileges and resource limits related to scheduling "
2326 "priority and policy, see B<sched_setscheduler>(2)."
2330 #: build/C/man2/sched_setparam.2:88
2332 "POSIX systems on which B<sched_setparam>() and B<sched_getparam>() are "
2333 "available define B<_POSIX_PRIORITY_SCHEDULING> in I<E<lt>unistd.hE<gt>>."
2337 #: build/C/man2/sched_setparam.2:97
2339 "On success, B<sched_setparam>() and B<sched_getparam>() return 0. On "
2340 "error, -1 is returned, and I<errno> is set appropriately."
2344 #: build/C/man2/sched_setparam.2:102
2345 msgid "The argument I<param> does not make sense for the current scheduling policy."
2349 #: build/C/man2/sched_setparam.2:108
2351 "The calling process does not have appropriate privileges (Linux: does not "
2352 "have the B<CAP_SYS_NICE> capability)."
2356 #: build/C/man2/sched_setparam.2:124
2358 "B<getpriority>(2), B<nice>(2), B<sched_get_priority_max>(2), "
2359 "B<sched_get_priority_min>(2), B<sched_getaffinity>(2), "
2360 "B<sched_getscheduler>(2), B<sched_setaffinity>(2), B<sched_setscheduler>(2), "
2361 "B<setpriority>(2), B<capabilities>(7)"
2365 #: build/C/man2/sched_setscheduler.2:47
2367 msgid "SCHED_SETSCHEDULER"
2371 #: build/C/man2/sched_setscheduler.2:47
2377 #: build/C/man2/sched_setscheduler.2:51
2379 "sched_setscheduler, sched_getscheduler - set and get scheduling "
2384 #: build/C/man2/sched_setscheduler.2:56
2386 msgid "B<int sched_setscheduler(pid_t >I<pid>B<, int >I<policy>B<,>\n"
2390 #: build/C/man2/sched_setscheduler.2:58
2392 msgid "B< const struct sched_param *>I<param>B<);>\n"
2396 #: build/C/man2/sched_setscheduler.2:60
2398 msgid "B<int sched_getscheduler(pid_t >I<pid>B<);>\n"
2402 #: build/C/man2/sched_setscheduler.2:77
2404 "B<sched_setscheduler>() sets both the scheduling policy and the associated "
2405 "parameters for the process whose ID is specified in I<pid>. If I<pid> "
2406 "equals zero, the scheduling policy and parameters of the calling process "
2407 "will be set. The interpretation of the argument I<param> depends on the "
2408 "selected policy. Currently, Linux supports the following \"normal\" (i.e., "
2409 "non-real-time) scheduling policies:"
2413 #: build/C/man2/sched_setscheduler.2:77
2415 msgid "B<SCHED_OTHER>"
2418 #. In the 2.6 kernel sources, SCHED_OTHER is actually called
2421 #: build/C/man2/sched_setscheduler.2:82
2422 msgid "the standard round-robin time-sharing policy;"
2426 #: build/C/man2/sched_setscheduler.2:82
2428 msgid "B<SCHED_BATCH>"
2432 #: build/C/man2/sched_setscheduler.2:85
2433 msgid "for \"batch\" style execution of processes; and"
2437 #: build/C/man2/sched_setscheduler.2:85
2439 msgid "B<SCHED_IDLE>"
2443 #: build/C/man2/sched_setscheduler.2:90
2444 msgid "for running I<very> low priority background jobs."
2448 #: build/C/man2/sched_setscheduler.2:94
2450 "The following \"real-time\" policies are also supported, for special "
2451 "time-critical applications that need precise control over the way in which "
2452 "runnable processes are selected for execution:"
2456 #: build/C/man2/sched_setscheduler.2:94
2458 msgid "B<SCHED_FIFO>"
2462 #: build/C/man2/sched_setscheduler.2:97
2463 msgid "a first-in, first-out policy; and"
2467 #: build/C/man2/sched_setscheduler.2:97
2473 #: build/C/man2/sched_setscheduler.2:100
2474 msgid "a round-robin policy."
2478 #: build/C/man2/sched_setscheduler.2:102
2479 msgid "The semantics of each of these policies are detailed below."
2483 #: build/C/man2/sched_setscheduler.2:109
2485 "B<sched_getscheduler>() queries the scheduling policy currently applied to "
2486 "the process identified by I<pid>. If I<pid> equals zero, the policy of the "
2487 "calling process will be retrieved."
2491 #: build/C/man2/sched_setscheduler.2:109
2493 msgid "Scheduling Policies"
2497 #: build/C/man2/sched_setscheduler.2:118
2499 "The scheduler is the kernel component that decides which runnable process "
2500 "will be executed by the CPU next. Each process has an associated scheduling "
2501 "policy and a I<static> scheduling priority, I<sched_priority>; these are the "
2502 "settings that are modified by B<sched_setscheduler>(). The scheduler makes "
2503 "it decisions based on knowledge of the scheduling policy and static priority "
2504 "of all processes on the system."
2508 #: build/C/man2/sched_setscheduler.2:123
2510 "For processes scheduled under one of the normal scheduling policies "
2511 "(B<SCHED_OTHER>, B<SCHED_IDLE>, B<SCHED_BATCH>), I<sched_priority> is not "
2512 "used in scheduling decisions (it must be specified as 0)."
2516 #: build/C/man2/sched_setscheduler.2:137
2518 "Processes scheduled under one of the real-time policies (B<SCHED_FIFO>, "
2519 "B<SCHED_RR>) have a I<sched_priority> value in the range 1 (low) to 99 "
2520 "(high). (As the numbers imply, real-time processes always have higher "
2521 "priority than normal processes.) Note well: POSIX.1-2001 only requires an "
2522 "implementation to support a minimum 32 distinct priority levels for the "
2523 "real-time policies, and some systems supply just this minimum. Portable "
2524 "programs should use B<sched_get_priority_min>(2) and "
2525 "B<sched_get_priority_max>(2) to find the range of priorities supported for "
2526 "a particular policy."
2530 #: build/C/man2/sched_setscheduler.2:143
2532 "Conceptually, the scheduler maintains a list of runnable processes for each "
2533 "possible I<sched_priority> value. In order to determine which process runs "
2534 "next, the scheduler looks for the nonempty list with the highest static "
2535 "priority and selects the process at the head of this list."
2539 #: build/C/man2/sched_setscheduler.2:147
2541 "A process's scheduling policy determines where it will be inserted into the "
2542 "list of processes with equal static priority and how it will move inside "
2547 #: build/C/man2/sched_setscheduler.2:155
2549 "All scheduling is preemptive: if a process with a higher static priority "
2550 "becomes ready to run, the currently running process will be preempted and "
2551 "returned to the wait list for its static priority level. The scheduling "
2552 "policy only determines the ordering within the list of runnable processes "
2553 "with equal static priority."
2557 #: build/C/man2/sched_setscheduler.2:155
2559 msgid "SCHED_FIFO: First In-First Out scheduling"
2563 #: build/C/man2/sched_setscheduler.2:164
2565 "B<SCHED_FIFO> can only be used with static priorities higher than 0, which "
2566 "means that when a B<SCHED_FIFO> processes becomes runnable, it will always "
2567 "immediately preempt any currently running B<SCHED_OTHER>, B<SCHED_BATCH>, or "
2568 "B<SCHED_IDLE> process. B<SCHED_FIFO> is a simple scheduling algorithm "
2569 "without time slicing. For processes scheduled under the B<SCHED_FIFO> "
2570 "policy, the following rules apply:"
2574 #: 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
2580 #: build/C/man2/sched_setscheduler.2:169
2582 "A B<SCHED_FIFO> process that has been preempted by another process of higher "
2583 "priority will stay at the head of the list for its priority and will resume "
2584 "execution as soon as all processes of higher priority are blocked again."
2588 #: build/C/man2/sched_setscheduler.2:172
2590 "When a B<SCHED_FIFO> process becomes runnable, it will be inserted at the "
2591 "end of the list for its priority."
2594 #. In 2.2.x and 2.4.x, the process is placed at the front of the queue
2595 #. In 2.0.x, the Right Thing happened: the process went to the back -- MTK
2597 #: build/C/man2/sched_setscheduler.2:186
2599 "A call to B<sched_setscheduler>() or B<sched_setparam>(2) will put the "
2600 "B<SCHED_FIFO> (or B<SCHED_RR>) process identified by I<pid> at the start of "
2601 "the list if it was runnable. As a consequence, it may preempt the currently "
2602 "running process if it has the same priority. (POSIX.1-2001 specifies that "
2603 "the process should go to the end of the list.)"
2607 #: build/C/man2/sched_setscheduler.2:190
2608 msgid "A process calling B<sched_yield>(2) will be put at the end of the list."
2612 #: build/C/man2/sched_setscheduler.2:194
2614 "No other events will move a process scheduled under the B<SCHED_FIFO> policy "
2615 "in the wait list of runnable processes with equal static priority."
2619 #: build/C/man2/sched_setscheduler.2:199
2621 "A B<SCHED_FIFO> process runs until either it is blocked by an I/O request, "
2622 "it is preempted by a higher priority process, or it calls B<sched_yield>(2)."
2626 #: build/C/man2/sched_setscheduler.2:199
2628 msgid "SCHED_RR: Round Robin scheduling"
2631 #. On Linux 2.4, the length of the RR interval is influenced
2632 #. by the process nice value -- MTK
2634 #: build/C/man2/sched_setscheduler.2:218
2636 "B<SCHED_RR> is a simple enhancement of B<SCHED_FIFO>. Everything described "
2637 "above for B<SCHED_FIFO> also applies to B<SCHED_RR>, except that each "
2638 "process is only allowed to run for a maximum time quantum. If a B<SCHED_RR> "
2639 "process has been running for a time period equal to or longer than the time "
2640 "quantum, it will be put at the end of the list for its priority. A "
2641 "B<SCHED_RR> process that has been preempted by a higher priority process and "
2642 "subsequently resumes execution as a running process will complete the "
2643 "unexpired portion of its round robin time quantum. The length of the time "
2644 "quantum can be retrieved using B<sched_rr_get_interval>(2)."
2648 #: build/C/man2/sched_setscheduler.2:218
2650 msgid "SCHED_OTHER: Default Linux time-sharing scheduling"
2654 #: build/C/man2/sched_setscheduler.2:234
2656 "B<SCHED_OTHER> can only be used at static priority 0. B<SCHED_OTHER> is the "
2657 "standard Linux time-sharing scheduler that is intended for all processes "
2658 "that do not require the special real-time mechanisms. The process to run is "
2659 "chosen from the static priority 0 list based on a I<dynamic> priority that "
2660 "is determined only inside this list. The dynamic priority is based on the "
2661 "nice value (set by B<nice>(2) or B<setpriority>(2)) and increased for each "
2662 "time quantum the process is ready to run, but denied to run by the "
2663 "scheduler. This ensures fair progress among all B<SCHED_OTHER> processes."
2667 #: build/C/man2/sched_setscheduler.2:234
2669 msgid "SCHED_BATCH: Scheduling batch processes"
2673 #: build/C/man2/sched_setscheduler.2:246
2675 "(Since Linux 2.6.16.) B<SCHED_BATCH> can only be used at static priority "
2676 "0. This policy is similar to B<SCHED_OTHER> in that it schedules the "
2677 "process according to its dynamic priority (based on the nice value). The "
2678 "difference is that this policy will cause the scheduler to always assume "
2679 "that the process is CPU-intensive. Consequently, the scheduler will apply a "
2680 "small scheduling penalty with respect to wakeup behaviour, so that this "
2681 "process is mildly disfavored in scheduling decisions."
2684 #. The following paragraph is drawn largely from the text that
2685 #. accompanied Ingo Molnar's patch for the implementation of
2688 #: build/C/man2/sched_setscheduler.2:255
2690 "This policy is useful for workloads that are noninteractive, but do not want "
2691 "to lower their nice value, and for workloads that want a deterministic "
2692 "scheduling policy without interactivity causing extra preemptions (between "
2693 "the workload's tasks)."
2697 #: build/C/man2/sched_setscheduler.2:255
2699 msgid "SCHED_IDLE: Scheduling very low priority jobs"
2703 #: build/C/man2/sched_setscheduler.2:259
2705 "(Since Linux 2.6.23.) B<SCHED_IDLE> can only be used at static priority 0; "
2706 "the process nice value has no influence for this policy."
2710 #: build/C/man2/sched_setscheduler.2:267
2712 "This policy is intended for running jobs at extremely low priority (lower "
2713 "even than a +19 nice value with the B<SCHED_OTHER> or B<SCHED_BATCH> "
2718 #: build/C/man2/sched_setscheduler.2:267
2720 msgid "Resetting scheduling policy for child processes"
2724 #: build/C/man2/sched_setscheduler.2:283
2726 "Since Linux 2.6.32, the B<SCHED_RESET_ON_FORK> flag can be ORed in I<policy> "
2727 "when calling B<sched_setscheduler>(). As a result of including this flag, "
2728 "children created by B<fork>(2) do not inherit privileged scheduling "
2729 "policies. This feature is intended for media-playback applications, and can "
2730 "be used to prevent applications evading the B<RLIMIT_RTTIME> resource limit "
2731 "(see B<getrlimit>(2)) by creating multiple child processes."
2735 #: build/C/man2/sched_setscheduler.2:288
2737 "More precisely, if the B<SCHED_RESET_ON_FORK> flag is specified, the "
2738 "following rules apply for subsequently created children:"
2742 #: build/C/man2/sched_setscheduler.2:296
2744 "If the calling process has a scheduling policy of B<SCHED_FIFO> or "
2745 "B<SCHED_RR>, the policy is reset to B<SCHED_OTHER> in child processes."
2749 #: build/C/man2/sched_setscheduler.2:299
2751 "If the calling process has a negative nice value, the nice value is reset to "
2752 "zero in child processes."
2756 #: build/C/man2/sched_setscheduler.2:308
2758 "After the B<SCHED_RESET_ON_FORK> flag has been enabled, it can only be reset "
2759 "if the process has the B<CAP_SYS_NICE> capability. This flag is disabled in "
2760 "child processes created by B<fork>(2)."
2764 #: build/C/man2/sched_setscheduler.2:314
2766 "The B<SCHED_RESET_ON_FORK> flag is visible in the policy value returned by "
2767 "B<sched_getscheduler>()"
2771 #: build/C/man2/sched_setscheduler.2:314
2773 msgid "Privileges and resource limits"
2777 #: build/C/man2/sched_setscheduler.2:327
2779 "In Linux kernels before 2.6.12, only privileged (B<CAP_SYS_NICE>) processes "
2780 "can set a nonzero static priority (i.e., set a real-time scheduling "
2781 "policy). The only change that an unprivileged process can make is to set "
2782 "the B<SCHED_OTHER> policy, and this can only be done if the effective user "
2783 "ID of the caller of B<sched_setscheduler>() matches the real or effective "
2784 "user ID of the target process (i.e., the process specified by I<pid>) whose "
2785 "policy is being changed."
2789 #: build/C/man2/sched_setscheduler.2:337
2791 "Since Linux 2.6.12, the B<RLIMIT_RTPRIO> resource limit defines a ceiling on "
2792 "an unprivileged process's static priority for the B<SCHED_RR> and "
2793 "B<SCHED_FIFO> policies. The rules for changing scheduling policy and "
2794 "priority are as follows:"
2798 #: build/C/man2/sched_setscheduler.2:345
2800 "If an unprivileged process has a nonzero B<RLIMIT_RTPRIO> soft limit, then "
2801 "it can change its scheduling policy and priority, subject to the restriction "
2802 "that the priority cannot be set to a value higher than the maximum of its "
2803 "current priority and its B<RLIMIT_RTPRIO> soft limit."
2807 #: build/C/man2/sched_setscheduler.2:350
2809 "If the B<RLIMIT_RTPRIO> soft limit is 0, then the only permitted changes are "
2810 "to lower the priority, or to switch to a non-real-time policy."
2814 #: build/C/man2/sched_setscheduler.2:355
2816 "Subject to the same rules, another unprivileged process can also make these "
2817 "changes, as long as the effective user ID of the process making the change "
2818 "matches the real or effective user ID of the target process."
2821 #. commit c02aa73b1d18e43cfd79c2f193b225e84ca497c8
2823 #: build/C/man2/sched_setscheduler.2:373
2825 "Special rules apply for the B<SCHED_IDLE>. In Linux kernels before 2.6.39, "
2826 "an unprivileged process operating under this policy cannot change its "
2827 "policy, regardless of the value of its B<RLIMIT_RTPRIO> resource limit. In "
2828 "Linux kernels since 2.6.39, an unprivileged process can switch to either the "
2829 "B<SCHED_BATCH> or the B<SCHED_NORMAL> policy so long as its nice value falls "
2830 "within the range permitted by its B<RLIMIT_NICE> resource limit (see "
2835 #: build/C/man2/sched_setscheduler.2:384
2837 "Privileged (B<CAP_SYS_NICE>) processes ignore the B<RLIMIT_RTPRIO> limit; "
2838 "as with older kernels, they can make arbitrary changes to scheduling policy "
2839 "and priority. See B<getrlimit>(2) for further information on "
2844 #: build/C/man2/sched_setscheduler.2:384
2846 msgid "Response time"
2850 #. .BR request_irq (9).
2852 #: build/C/man2/sched_setscheduler.2:392
2854 "A blocked high priority process waiting for the I/O has a certain response "
2855 "time before it is scheduled again. The device driver writer can greatly "
2856 "reduce this response time by using a \"slow interrupt\" interrupt handler."
2860 #: build/C/man2/sched_setscheduler.2:392
2862 msgid "Miscellaneous"
2866 #: build/C/man2/sched_setscheduler.2:397
2868 "Child processes inherit the scheduling policy and parameters across a "
2869 "B<fork>(2). The scheduling policy and parameters are preserved across "
2874 #: build/C/man2/sched_setscheduler.2:403
2876 "Memory locking is usually needed for real-time processes to avoid paging "
2877 "delays; this can be done with B<mlock>(2) or B<mlockall>(2)."
2881 #: build/C/man2/sched_setscheduler.2:415
2883 "Since a nonblocking infinite loop in a process scheduled under B<SCHED_FIFO> "
2884 "or B<SCHED_RR> will block all processes with lower priority forever, a "
2885 "software developer should always keep available on the console a shell "
2886 "scheduled under a higher static priority than the tested application. This "
2887 "will allow an emergency kill of tested real-time applications that do not "
2888 "block or terminate as expected. See also the description of the "
2889 "B<RLIMIT_RTTIME> resource limit in B<getrlimit>(2)."
2893 #: build/C/man2/sched_setscheduler.2:423
2895 "POSIX systems on which B<sched_setscheduler>() and B<sched_getscheduler>() "
2896 "are available define B<_POSIX_PRIORITY_SCHEDULING> in I<E<lt>unistd.hE<gt>>."
2900 #: build/C/man2/sched_setscheduler.2:433
2902 "On success, B<sched_setscheduler>() returns zero. On success, "
2903 "B<sched_getscheduler>() returns the policy for the process (a nonnegative "
2904 "integer). On error, -1 is returned, and I<errno> is set appropriately."
2908 #: build/C/man2/sched_setscheduler.2:439
2910 "The scheduling I<policy> is not one of the recognized policies, I<param> is "
2911 "NULL, or I<param> does not make sense for the I<policy>."
2915 #: build/C/man2/sched_setscheduler.2:442
2916 msgid "The calling process does not have appropriate privileges."
2920 #: build/C/man2/sched_setscheduler.2:448
2922 "POSIX.1-2001 (but see BUGS below). The B<SCHED_BATCH> and B<SCHED_IDLE> "
2923 "policies are Linux-specific."
2927 #: build/C/man2/sched_setscheduler.2:456
2929 "POSIX.1 does not detail the permissions that an unprivileged process "
2930 "requires in order to call B<sched_setscheduler>(), and details vary across "
2931 "systems. For example, the Solaris 7 manual page says that the real or "
2932 "effective user ID of the calling process must match the real user ID or the "
2933 "save set-user-ID of the target process."
2937 #: build/C/man2/sched_setscheduler.2:466
2939 "Originally, Standard Linux was intended as a general-purpose operating "
2940 "system being able to handle background processes, interactive applications, "
2941 "and less demanding real-time applications (applications that need to usually "
2942 "meet timing deadlines). Although the Linux kernel 2.6 allowed for kernel "
2943 "preemption and the newly introduced O(1) scheduler ensures that the time "
2944 "needed to schedule is fixed and deterministic irrespective of the number of "
2945 "active tasks, true real-time computing was not possible up to kernel version "
2950 #: build/C/man2/sched_setscheduler.2:466
2952 msgid "Real-time features in the mainline Linux kernel"
2955 #. FIXME . Probably this text will need some minor tweaking
2956 #. by about the time of 2.6.30; ask Carsten Emde about this then.
2958 #: build/C/man2/sched_setscheduler.2:480
2960 "From kernel version 2.6.18 onward, however, Linux is gradually becoming "
2961 "equipped with real-time capabilities, most of which are derived from the "
2962 "former I<realtime-preempt> patches developed by Ingo Molnar, Thomas "
2963 "Gleixner, Steven Rostedt, and others. Until the patches have been "
2964 "completely merged into the mainline kernel (this is expected to be around "
2965 "kernel version 2.6.30), they must be installed to achieve the best real-time "
2966 "performance. These patches are named:"
2970 #: build/C/man2/sched_setscheduler.2:484
2972 msgid "patch-I<kernelversion>-rtI<patchversion>\n"
2976 #: build/C/man2/sched_setscheduler.2:489
2978 "and can be downloaded from "
2979 "I<http://www.kernel.org/pub/linux/kernel/projects/rt/>."
2983 #: build/C/man2/sched_setscheduler.2:498
2985 "Without the patches and prior to their full inclusion into the mainline "
2986 "kernel, the kernel configuration offers only the three preemption classes "
2987 "B<CONFIG_PREEMPT_NONE>, B<CONFIG_PREEMPT_VOLUNTARY>, and "
2988 "B<CONFIG_PREEMPT_DESKTOP> which respectively provide no, some, and "
2989 "considerable reduction of the worst-case scheduling latency."
2993 #: build/C/man2/sched_setscheduler.2:509
2995 "With the patches applied or after their full inclusion into the mainline "
2996 "kernel, the additional configuration item B<CONFIG_PREEMPT_RT> becomes "
2997 "available. If this is selected, Linux is transformed into a regular "
2998 "real-time operating system. The FIFO and RR scheduling policies that can be "
2999 "selected using B<sched_setscheduler>() are then used to run a process with "
3000 "true real-time priority and a minimum worst-case scheduling latency."
3004 #: build/C/man2/sched_setscheduler.2:517
3006 "POSIX says that on success, B<sched_setscheduler>() should return the "
3007 "previous scheduling policy. Linux B<sched_setscheduler>() does not conform "
3008 "to this requirement, since it always returns 0 on success."
3012 #: build/C/man2/sched_setscheduler.2:535
3014 "B<getpriority>(2), B<mlock>(2), B<mlockall>(2), B<munlock>(2), "
3015 "B<munlockall>(2), B<nice>(2), B<sched_get_priority_max>(2), "
3016 "B<sched_get_priority_min>(2), B<sched_getaffinity>(2), B<sched_getparam>(2), "
3017 "B<sched_rr_get_interval>(2), B<sched_setaffinity>(2), B<sched_setparam>(2), "
3018 "B<sched_yield>(2), B<setpriority>(2), B<capabilities>(7), B<cpuset>(7)"
3022 #: build/C/man2/sched_setscheduler.2:541
3024 "The kernel source file I<Documentation/scheduler/sched-rt-group.txt> (since "
3029 #: build/C/man2/sched_yield.2:30
3035 #: build/C/man2/sched_yield.2:30
3041 #: build/C/man2/sched_yield.2:33
3042 msgid "sched_yield - yield the processor"
3046 #: build/C/man2/sched_yield.2:37
3047 msgid "B<int sched_yield(void);>"
3051 #: build/C/man2/sched_yield.2:42
3053 "B<sched_yield>() causes the calling thread to relinquish the CPU. The "
3054 "thread is moved to the end of the queue for its static priority and a new "
3055 "thread gets to run."
3059 #: build/C/man2/sched_yield.2:49
3061 "On success, B<sched_yield>() returns 0. On error, -1 is returned, and "
3062 "I<errno> is set appropriately."
3066 #: build/C/man2/sched_yield.2:53
3067 msgid "In the Linux implementation, B<sched_yield>() always succeeds."
3071 #: build/C/man2/sched_yield.2:60
3073 "If the calling thread is the only thread in the highest priority list at "
3074 "that time, it will continue to run after a call to B<sched_yield>()."
3078 #: build/C/man2/sched_yield.2:66
3080 "POSIX systems on which B<sched_yield>() is available define "
3081 "B<_POSIX_PRIORITY_SCHEDULING> in I<E<lt>unistd.hE<gt>>."
3085 #: build/C/man2/sched_yield.2:79
3087 "Strategic calls to B<sched_yield>() can improve performance by giving other "
3088 "threads or processes a chance to run when (heavily) contended resources "
3089 "(e.g., mutexes) have been released by the caller. Avoid calling "
3090 "B<sched_yield>() unnecessarily or inappropriately (e.g., when resources "
3091 "needed by other schedulable threads are still held by the caller), since "
3092 "doing so will result in unnecessary context switches, which will degrade "
3093 "system performance."
3097 #: build/C/man2/sched_yield.2:82
3098 msgid "B<sched_setscheduler>(2) for a description of Linux scheduling."
3102 #: build/C/man2/setns.2:4
3108 #: build/C/man2/setns.2:4
3114 #: build/C/man2/setns.2:7
3115 msgid "setns - reassociate thread with a namespace"
3119 #: build/C/man2/setns.2:13
3121 msgid "B<int setns(int >I<fd>B<, int >I<nstype>B<);>\n"
3125 #: build/C/man2/setns.2:17
3127 "Given a file descriptor referring to a namespace, reassociate the calling "
3128 "thread with that namespace."
3132 #: build/C/man2/setns.2:30
3134 "The I<fd> argument is a file descriptor referring to one of the namespace "
3135 "entries in a I</proc/[pid]/ns/> directory; see B<proc>(5) for further "
3136 "information on I</proc/[pid]/ns/>. The calling thread will be reassociated "
3137 "with the corresponding namespace, subject to any constraints imposed by the "
3138 "I<nstype> argument."
3142 #: build/C/man2/setns.2:36
3144 "The I<nstype> argument specifies which type of namespace the calling thread "
3145 "may be reassociated with. This argument can have one of the following "
3150 #: build/C/man2/setns.2:36
3156 #: build/C/man2/setns.2:39
3157 msgid "Allow any type of namespace to be joined."
3161 #: build/C/man2/setns.2:39
3163 msgid "B<CLONE_NEWIPC>"
3167 #: build/C/man2/setns.2:43
3168 msgid "I<fd> must refer to an IPC namespace."
3172 #: build/C/man2/setns.2:43
3174 msgid "B<CLONE_NEWNET>"
3178 #: build/C/man2/setns.2:47
3179 msgid "I<fd> must refer to a network namespace."
3183 #: build/C/man2/setns.2:47
3185 msgid "B<CLONE_NEWUTS>"
3189 #: build/C/man2/setns.2:51
3190 msgid "I<fd> must refer to a UTS namespace."
3194 #: build/C/man2/setns.2:66
3196 "Specifying I<nstype> as 0 suffices if the caller knows (or does not care) "
3197 "what type of namespace is referred to by I<fd>. Specifying a nonzero value "
3198 "for I<nstype> is useful if the caller does not know what type of namespace "
3199 "is referred to by I<fd> and wants to ensure that the namespace is of a "
3200 "particular type. (The caller might not know the type of the namespace "
3201 "referred to by I<fd> if the file descriptor was opened by another process "
3202 "and, for example, passed to the caller via a UNIX domain socket.)"
3206 #: build/C/man2/setns.2:73
3208 "On success, I<setns>() returns 0. On failure, -1 is returned and I<errno> "
3209 "is set to indicate the error."
3213 #: build/C/man2/setns.2:74
3219 #: build/C/man2/setns.2:78
3220 msgid "I<fd> is not a valid file descriptor."
3224 #: build/C/man2/setns.2:85
3226 "I<fd> refers to a namespace whose type does not match that specified in "
3227 "I<nstype>, or there is problem with reassociating the the thread with the "
3228 "specified namespace."
3232 #: build/C/man2/setns.2:88
3233 msgid "Cannot allocate sufficient memory to change the specified namespace."
3237 #: build/C/man2/setns.2:93
3239 "The calling thread did not have the required privilege (B<CAP_SYS_ADMIN>) "
3240 "for this operation."
3244 #: build/C/man2/setns.2:97
3245 msgid "The B<setns>() system call first appeared in Linux in kernel 3.0"
3249 #: build/C/man2/setns.2:101
3250 msgid "The B<setns>() system call is Linux-specific."
3254 #: build/C/man2/setns.2:107
3256 "Not all of the attributes that can be shared when a new thread is created "
3257 "using B<clone>(2) can be changed using B<setns>()."
3261 #: build/C/man2/setns.2:115
3263 "The PID namespace and the mount namespace are not currently supported. (See "
3264 "the descriptions of B<CLONE_NEWPID> and B<CLONE_NEWNS> in B<clone>(2).)"
3268 #: build/C/man2/setns.2:120
3269 msgid "B<clone>(2), B<fork>(2), B<vfork>(2), B<proc>(5), B<unix>(7)"
3273 #: build/C/man2/unshare.2:17
3279 #: build/C/man2/unshare.2:17
3285 #: build/C/man2/unshare.2:20
3286 msgid "unshare - disassociate parts of the process execution context"
3290 #: build/C/man2/unshare.2:28
3292 msgid "B<int unshare(int >I<flags>B<);>\n"
3296 #: build/C/man2/unshare.2:41
3298 "B<unshare>() allows a process to disassociate parts of its execution "
3299 "context that are currently being shared with other processes. Part of the "
3300 "execution context, such as the mount namespace, is shared implicitly when a "
3301 "new process is created using B<fork>(2) or B<vfork>(2), while other parts, "
3302 "such as virtual memory, may be shared by explicit request when creating a "
3303 "process using B<clone>(2)."
3307 #: build/C/man2/unshare.2:46
3309 "The main use of B<unshare>() is to allow a process to control its shared "
3310 "execution context without creating a new process."
3314 #: build/C/man2/unshare.2:53
3316 "The I<flags> argument is a bit mask that specifies which parts of the "
3317 "execution context should be unshared. This argument is specified by ORing "
3318 "together zero or more of the following constants:"
3322 #: build/C/man2/unshare.2:61
3324 "Reverse the effect of the B<clone>(2) B<CLONE_FILES> flag. Unshare the "
3325 "file descriptor table, so that the calling process no longer shares its file "
3326 "descriptors with any other process."
3330 #: build/C/man2/unshare.2:74
3332 "Reverse the effect of the B<clone>(2) B<CLONE_FS> flag. Unshare file "
3333 "system attributes, so that the calling process no longer shares its root "
3334 "directory, current directory, or umask attributes with any other process. "
3335 "B<chroot>(2), B<chdir>(2), or B<umask>(2)"
3339 #: build/C/man2/unshare.2:91
3341 "This flag has the same effect as the B<clone>(2) B<CLONE_NEWIPC> flag. "
3342 "Unshare the System V IPC namespace, so that the calling process has a "
3343 "private copy of the System V IPC namespace which is not shared with any "
3344 "other process. Specifying this flag automatically implies B<CLONE_SYSVSEM> "
3345 "as well. Use of B<CLONE_NEWIPC> requires the B<CAP_SYS_ADMIN> capability."
3349 #: build/C/man2/unshare.2:105
3351 "This flag has the same effect as the B<clone>(2) B<CLONE_NEWNET> flag. "
3352 "Unshare the network namespace, so that the calling process is moved into a "
3353 "new network namespace which is not shared with any previously existing "
3354 "process. B<CLONE_NEWNET> requires the B<CAP_SYS_ADMIN> capability."
3358 #: build/C/man2/unshare.2:105
3360 msgid "B<CLONE_NEWNS>"
3363 #. These flag name are inconsistent:
3364 #. CLONE_NEWNS does the same thing in clone(), but CLONE_VM,
3365 #. CLONE_FS, and CLONE_FILES reverse the action of the clone()
3366 #. flags of the same name.
3368 #: build/C/man2/unshare.2:126
3370 "This flag has the same effect as the B<clone>(2) B<CLONE_NEWNS> flag. "
3371 "Unshare the mount namespace, so that the calling process has a private copy "
3372 "of its namespace which is not shared with any other process. Specifying "
3373 "this flag automatically implies B<CLONE_FS> as well. Use of B<CLONE_NEWNS> "
3374 "requires the B<CAP_SYS_ADMIN> capability."
3378 #: build/C/man2/unshare.2:126
3380 msgid "B<CLONE_SYSVSEM> (since Linux 2.6.26)"
3384 #: build/C/man2/unshare.2:140
3386 "This flag reverses the effect of the B<clone>(2) B<CLONE_SYSVSEM> flag. "
3387 "Unshare System V semaphore undo values, so that the calling process has a "
3388 "private copy which is not shared with any other process. Use of "
3389 "B<CLONE_SYSVSEM> requires the B<CAP_SYS_ADMIN> capability."
3392 #. As at 2.6.16, the following forced implications also apply,
3393 #. although the relevant flags are not yet implemented.
3394 #. If CLONE_THREAD is set force CLONE_VM.
3395 #. If CLONE_VM is set, force CLONE_SIGHAND.
3396 #. CLONE_NEWNSIf CLONE_SIGHAND is set and signals are also being shared
3397 #. (i.e., current->signal->count > 1), force CLONE_THREAD.
3399 #. FIXME . CLONE_VM is not (yet, as at 2.6.16) implemented.
3402 #. Reverse the effect of the
3407 #. is also implicitly set by
3409 #. and can be reversed using this
3412 #. Unshare virtual memory, so that the calling process no
3413 #. longer shares its virtual address space with any other process.
3415 #: build/C/man2/unshare.2:176
3417 "This flag has the same effect as the B<clone>(2) B<CLONE_NEWUTS> flag. "
3418 "Unshare the UTS IPC namespace, so that the calling process has a private "
3419 "copy of the UTS namespace which is not shared with any other process. Use "
3420 "of B<CLONE_NEWUTS> requires the B<CAP_SYS_ADMIN> capability."
3424 #: build/C/man2/unshare.2:183
3426 "If I<flags> is specified as zero, then B<unshare>() is a no-op; no changes "
3427 "are made to the calling process's execution context."
3431 #: build/C/man2/unshare.2:188
3433 "On success, zero returned. On failure, -1 is returned and I<errno> is set "
3434 "to indicate the error."
3438 #: build/C/man2/unshare.2:193
3439 msgid "An invalid bit was specified in I<flags>."
3443 #: build/C/man2/unshare.2:197
3445 "Cannot allocate sufficient memory to copy parts of caller's context that "
3446 "need to be unshared."
3450 #: build/C/man2/unshare.2:200
3451 msgid "The calling process did not have the required privileges for this operation."
3455 #: build/C/man2/unshare.2:204
3456 msgid "The B<unshare>() system call was added to Linux in kernel 2.6.16."
3460 #: build/C/man2/unshare.2:208
3461 msgid "The B<unshare>() system call is Linux-specific."
3464 #. However, we can do unshare(CLONE_SIGHAND) if CLONE_SIGHAND
3465 #. was not specified when doing clone(); i.e., unsharing
3466 #. signal handlers is permitted if we are not actually
3467 #. sharing signal handlers. mtk
3468 #. FIXME . check future kernel versions (e.g., 2.6.17)
3469 #. to see if CLONE_VM gets implemented.
3470 #. However, as at 2.6.16, we can do unshare(CLONE_VM) if CLONE_VM
3471 #. was not specified when doing clone(); i.e., unsharing
3472 #. virtual memory is permitted if we are not actually
3473 #. sharing virtual memory. mtk
3477 #. The current implementation of unshare does not allow unsharing of
3478 #. signals and signal handlers. Signals are complex to begin with and
3479 #. to unshare signals and/or signal handlers of a currently running
3480 #. process is even more complex. If in the future there is a specific
3481 #. need to allow unsharing of signals and/or signal handlers, it can
3482 #. be incrementally added to unshare without affecting legacy
3483 #. applications using unshare.
3485 #: build/C/man2/unshare.2:244
3487 "Not all of the process attributes that can be shared when a new process is "
3488 "created using B<clone>(2) can be unshared using B<unshare>(). In "
3489 "particular, as at kernel 2.6.16, B<unshare>() does not implement flags that "
3490 "reverse the effects of B<CLONE_SIGHAND>, B<CLONE_SYSVSEM>, B<CLONE_THREAD>, "
3491 "or B<CLONE_VM>. Such functionality may be added in the future, if required."
3495 #: build/C/man2/unshare.2:248
3496 msgid "B<clone>(2), B<fork>(2), B<vfork>(2), Documentation/unshare.txt"
3500 #: build/C/man3/get_nprocs_conf.3:24
3506 #: build/C/man3/get_nprocs_conf.3:24
3512 #: build/C/man3/get_nprocs_conf.3:24
3518 #: build/C/man3/get_nprocs_conf.3:27
3519 msgid "get_nprocs, get_nprocs_conf - get number of processors"
3523 #: build/C/man3/get_nprocs_conf.3:29
3524 msgid "B<#include E<lt>sys/sysinfo.hE<gt>>"
3528 #: build/C/man3/get_nprocs_conf.3:31
3529 msgid "B<int get_nprocs(void);>"
3533 #: build/C/man3/get_nprocs_conf.3:33
3534 msgid "B<int get_nprocs_conf(void);>"
3538 #: build/C/man3/get_nprocs_conf.3:37
3540 "The function B<get_nprocs_conf>() returns the number of processors "
3541 "configured by the operating system."
3545 #: build/C/man3/get_nprocs_conf.3:44
3547 "The function B<get_nprocs>() returns the number of processors currently "
3548 "available in the system. This may be less than the number returned by "
3549 "B<get_nprocs_conf>() because processors may be offline (e.g., on "
3550 "hotpluggable systems)."
3554 #: build/C/man3/get_nprocs_conf.3:46
3555 msgid "As given in DESCRIPTION."
3559 #: build/C/man3/get_nprocs_conf.3:48
3560 msgid "These functions are GNU extensions."
3565 #: build/C/man3/get_nprocs_conf.3:55
3567 "The current implementation of these functions is rather expensive, since "
3568 "they open and parse files in the I</sys> file system each time they are "
3573 #: build/C/man3/get_nprocs_conf.3:60
3575 "The following B<sysconf>(3) calls make use of the functions documented on "
3576 "this page to return the same information."
3580 #: build/C/man3/get_nprocs_conf.3:64
3583 " np = sysconf(_SC_NPROCESSORS_CONF); /* processors configured */\n"
3584 " np = sysconf(_SC_NPROCESSORS_ONLN); /* processors available */\n"
3588 #: build/C/man3/get_nprocs_conf.3:71
3590 "The following example shows how B<get_nprocs>() and B<get_nprocs_conf>() "
3595 #: build/C/man3/get_nprocs_conf.3:75
3598 "#include E<lt>stdio.hE<gt>\n"
3599 "#include E<lt>sys/sysinfo.hE<gt>\n"
3603 #: build/C/man3/get_nprocs_conf.3:84
3607 "main(int argc, char *argv[])\n"
3609 " printf(\"This system has %d processors configured and \"\n"
3610 " \"%d processors available.\\en\",\n"
3611 " get_nprocs_conf(), get_nprocs());\n"