1 # SOME DESCRIPTIVE TITLE
2 # Copyright (C) YEAR Free Software Foundation, Inc.
3 # This file is distributed under the same license as the PACKAGE package.
4 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
9 "Project-Id-Version: PACKAGE VERSION\n"
10 "POT-Creation-Date: 2012-03-22 04:25+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/man2/arch_prctl.2:24
26 #: build/C/man2/arch_prctl.2:24
32 #: build/C/man2/arch_prctl.2:24 build/C/man2/futex.2:17 build/C/man2/kexec_load.2:25 build/C/man2/lookup_dcookie.2:27 build/C/man2/modify_ldt.2:25 build/C/man2/nfsservctl.2:8 build/C/man2/outb.2:28 build/C/man2/pciconfig_read.2:5 build/C/man2/personality.2:30 build/C/man2/pivot_root.2:7 build/C/man2/ptrace.2:48 build/C/man2/quotactl.2:25 build/C/man2/sendfile.2:15 build/C/man2/set_tid_address.2:23 build/C/man2/splice.2:26 build/C/man2/tee.2:26 build/C/man2/vm86.2:26 build/C/man2/vmsplice.2:26
38 #: build/C/man2/arch_prctl.2:24 build/C/man2/futex.2:17 build/C/man2/kexec_load.2:25 build/C/man2/lookup_dcookie.2:27 build/C/man2/modify_ldt.2:25 build/C/man2/nfsservctl.2:8 build/C/man2/outb.2:28 build/C/man2/pciconfig_read.2:5 build/C/man2/personality.2:30 build/C/man2/pivot_root.2:7 build/C/man2/ptrace.2:48 build/C/man2/quotactl.2:25 build/C/man2/sendfile.2:15 build/C/man2/set_tid_address.2:23 build/C/man2/splice.2:26 build/C/man2/tee.2:26 build/C/man2/vm86.2:26 build/C/man2/vmsplice.2:26
40 msgid "Linux Programmer's Manual"
44 #: build/C/man2/arch_prctl.2:25 build/C/man2/futex.2:18 build/C/man2/kexec_load.2:26 build/C/man2/lookup_dcookie.2:28 build/C/man2/modify_ldt.2:26 build/C/man2/nfsservctl.2:9 build/C/man2/outb.2:29 build/C/man2/pciconfig_read.2:6 build/C/man2/personality.2:31 build/C/man2/pivot_root.2:8 build/C/man2/ptrace.2:49 build/C/man2/quotactl.2:26 build/C/man2/sendfile.2:16 build/C/man2/set_tid_address.2:24 build/C/man2/splice.2:27 build/C/man2/tee.2:27 build/C/man2/vm86.2:27 build/C/man2/vmsplice.2:27
50 #: build/C/man2/arch_prctl.2:27
51 msgid "arch_prctl - set architecture-specific thread state"
55 #: build/C/man2/arch_prctl.2:27 build/C/man2/futex.2:20 build/C/man2/kexec_load.2:28 build/C/man2/lookup_dcookie.2:30 build/C/man2/modify_ldt.2:28 build/C/man2/nfsservctl.2:11 build/C/man2/pciconfig_read.2:8 build/C/man2/personality.2:33 build/C/man2/pivot_root.2:10 build/C/man2/ptrace.2:51 build/C/man2/quotactl.2:28 build/C/man2/sendfile.2:18 build/C/man2/set_tid_address.2:26 build/C/man2/splice.2:29 build/C/man2/tee.2:29 build/C/man2/vm86.2:29 build/C/man2/vmsplice.2:29
61 #: build/C/man2/arch_prctl.2:30
63 msgid "B<#include E<lt>asm/prctl.hE<gt>>\n"
67 #: build/C/man2/arch_prctl.2:32
69 msgid "B<#include E<lt>sys/prctl.hE<gt>>\n"
73 #: build/C/man2/arch_prctl.2:35
76 "B<int arch_prctl(int >I<code>B<, unsigned long >I<addr>B<);>\n"
77 "B<int arch_prctl(int >I<code>B<, unsigned long *>I<addr>B<);>\n"
80 #. Return type was long before glibc 2.7
82 #: build/C/man2/arch_prctl.2:36 build/C/man2/futex.2:32 build/C/man2/kexec_load.2:35 build/C/man2/lookup_dcookie.2:32 build/C/man2/modify_ldt.2:34 build/C/man2/nfsservctl.2:18 build/C/man2/outb.2:33 build/C/man2/pciconfig_read.2:19 build/C/man2/personality.2:37 build/C/man2/pivot_root.2:12 build/C/man2/ptrace.2:58 build/C/man2/quotactl.2:36 build/C/man2/sendfile.2:43 build/C/man2/set_tid_address.2:32 build/C/man2/splice.2:39 build/C/man2/tee.2:38 build/C/man2/vm86.2:35 build/C/man2/vmsplice.2:39
88 #: build/C/man2/arch_prctl.2:51
90 "The B<arch_prctl>() function sets architecture-specific process or thread "
91 "state. I<code> selects a subfunction and passes argument I<addr> to it; "
92 "I<addr> is interpreted as either an I<unsigned long> for the \"set\" "
93 "operations, or as an I<unsigned long *>, for the \"get\" operations."
97 #: build/C/man2/arch_prctl.2:53
98 msgid "Sub functions for x86-64 are:"
102 #: build/C/man2/arch_prctl.2:53
104 msgid "B<ARCH_SET_FS>"
108 #: build/C/man2/arch_prctl.2:59
109 msgid "Set the 64-bit base for the I<FS> register to I<addr>."
113 #: build/C/man2/arch_prctl.2:59
115 msgid "B<ARCH_GET_FS>"
119 #: build/C/man2/arch_prctl.2:67
121 "Return the 64-bit base value for the I<FS> register of the current thread in "
122 "the I<unsigned long> pointed to by I<addr>."
126 #: build/C/man2/arch_prctl.2:67
128 msgid "B<ARCH_SET_GS>"
132 #: build/C/man2/arch_prctl.2:73
133 msgid "Set the 64-bit base for the I<GS> register to I<addr>."
137 #: build/C/man2/arch_prctl.2:73
139 msgid "B<ARCH_GET_GS>"
143 #: build/C/man2/arch_prctl.2:81
145 "Return the 64-bit base value for the I<GS> register of the current thread in "
146 "the I<unsigned long> pointed to by I<addr>."
150 #: build/C/man2/arch_prctl.2:81 build/C/man2/futex.2:173 build/C/man2/kexec_load.2:110 build/C/man2/lookup_dcookie.2:43 build/C/man2/modify_ldt.2:96 build/C/man2/nfsservctl.2:51 build/C/man2/pciconfig_read.2:47 build/C/man2/personality.2:55 build/C/man2/pivot_root.2:95 build/C/man2/ptrace.2:1566 build/C/man2/sendfile.2:104 build/C/man2/set_tid_address.2:80 build/C/man2/splice.2:127 build/C/man2/tee.2:85 build/C/man2/vm86.2:52 build/C/man2/vmsplice.2:113
156 #: build/C/man2/arch_prctl.2:87
158 "On success, B<arch_prctl>() returns 0; on error, -1 is returned, and "
159 "I<errno> is set to indicate the error."
163 #: build/C/man2/arch_prctl.2:87 build/C/man2/futex.2:210 build/C/man2/kexec_load.2:117 build/C/man2/lookup_dcookie.2:50 build/C/man2/modify_ldt.2:106 build/C/man2/pciconfig_read.2:74 build/C/man2/personality.2:62 build/C/man2/pivot_root.2:99 build/C/man2/ptrace.2:1580 build/C/man2/quotactl.2:425 build/C/man2/sendfile.2:111 build/C/man2/set_tid_address.2:83 build/C/man2/splice.2:142 build/C/man2/tee.2:100 build/C/man2/vm86.2:57 build/C/man2/vmsplice.2:122
169 #: build/C/man2/arch_prctl.2:88 build/C/man2/futex.2:222 build/C/man2/lookup_dcookie.2:51 build/C/man2/modify_ldt.2:107 build/C/man2/ptrace.2:1584 build/C/man2/quotactl.2:426 build/C/man2/sendfile.2:121 build/C/man2/vm86.2:58
175 #: build/C/man2/arch_prctl.2:92
177 "I<addr> points to an unmapped address or is outside the process address "
182 #: build/C/man2/arch_prctl.2:92 build/C/man2/futex.2:227 build/C/man2/kexec_load.2:122 build/C/man2/lookup_dcookie.2:54 build/C/man2/modify_ldt.2:111 build/C/man2/pciconfig_read.2:75 build/C/man2/personality.2:63 build/C/man2/pivot_root.2:108 build/C/man2/ptrace.2:1595 build/C/man2/quotactl.2:432 build/C/man2/quotactl.2:499 build/C/man2/sendfile.2:124 build/C/man2/splice.2:147 build/C/man2/tee.2:101 build/C/man2/vmsplice.2:127
188 #: build/C/man2/arch_prctl.2:96
189 msgid "I<code> is not a valid subcommand."
193 #: build/C/man2/arch_prctl.2:96 build/C/man2/kexec_load.2:129 build/C/man2/lookup_dcookie.2:65 build/C/man2/pciconfig_read.2:102 build/C/man2/pivot_root.2:114 build/C/man2/ptrace.2:1605 build/C/man2/quotactl.2:454 build/C/man2/vm86.2:66
199 #. Man page written by Andi Kleen.
201 #: build/C/man2/arch_prctl.2:102
202 msgid "I<addr> is outside the process address space."
206 #: build/C/man2/arch_prctl.2:102 build/C/man2/futex.2:247 build/C/man2/kexec_load.2:138 build/C/man2/lookup_dcookie.2:78 build/C/man2/modify_ldt.2:128 build/C/man2/nfsservctl.2:56 build/C/man2/outb.2:58 build/C/man2/pciconfig_read.2:107 build/C/man2/personality.2:66 build/C/man2/pivot_root.2:122 build/C/man2/ptrace.2:1623 build/C/man2/sendfile.2:144 build/C/man2/set_tid_address.2:89 build/C/man2/splice.2:169 build/C/man2/tee.2:118 build/C/man2/vm86.2:71 build/C/man2/vmsplice.2:142
208 msgid "CONFORMING TO"
212 #: build/C/man2/arch_prctl.2:106
214 "B<arch_prctl>() is a Linux/x86-64 extension and should not be used in "
215 "programs intended to be portable."
219 #: build/C/man2/arch_prctl.2:106 build/C/man2/futex.2:249 build/C/man2/kexec_load.2:140 build/C/man2/lookup_dcookie.2:81 build/C/man2/modify_ldt.2:131 build/C/man2/pivot_root.2:125 build/C/man2/ptrace.2:1625 build/C/man2/sendfile.2:151 build/C/man2/splice.2:171 build/C/man2/tee.2:120 build/C/man2/vmsplice.2:144
225 #: build/C/man2/arch_prctl.2:109
227 "B<arch_prctl>() is only supported on Linux/x86-64 for 64-bit programs "
232 #: build/C/man2/arch_prctl.2:111
233 msgid "The 64-bit base changes when a new 32-bit segment selector is loaded."
237 #: build/C/man2/arch_prctl.2:114
238 msgid "B<ARCH_SET_GS> is disabled in some kernels."
242 #: build/C/man2/arch_prctl.2:129
244 "Context switches for 64-bit segment bases are rather expensive. It may be a "
245 "faster alternative to set a 32-bit base using a segment selector by setting "
246 "up an LDT with B<modify_ldt>(2) or using the B<set_thread_area>(2) system "
247 "call in kernel 2.5 or later. B<arch_prctl>() is only needed when you want "
248 "to set bases that are larger than 4GB. Memory in the first 2GB of address "
249 "space can be allocated by using B<mmap>(2) with the B<MAP_32BIT> flag."
253 #: build/C/man2/arch_prctl.2:134
255 "As of version 2.7, glibc provides no prototype for B<arch_prctl>(). You "
256 "have to declare it yourself for now. This may be fixed in future glibc "
261 #: build/C/man2/arch_prctl.2:137
262 msgid "I<FS> may be already used by the threading library."
266 #: build/C/man2/arch_prctl.2:137 build/C/man2/futex.2:263 build/C/man2/kexec_load.2:155 build/C/man2/modify_ldt.2:134 build/C/man2/outb.2:67 build/C/man2/pciconfig_read.2:109 build/C/man2/pivot_root.2:137 build/C/man2/ptrace.2:1716 build/C/man2/quotactl.2:505 build/C/man2/sendfile.2:193 build/C/man2/set_tid_address.2:91 build/C/man2/splice.2:225 build/C/man2/tee.2:196 build/C/man2/vmsplice.2:153
272 #: build/C/man2/arch_prctl.2:142
273 msgid "B<mmap>(2), B<modify_ldt>(2), B<prctl>(2), B<set_thread_area>(2)"
277 #: build/C/man2/arch_prctl.2:144
278 msgid "AMD X86-64 Programmer's manual"
282 #: build/C/man2/arch_prctl.2:144 build/C/man2/futex.2:274 build/C/man2/kexec_load.2:158 build/C/man2/lookup_dcookie.2:88 build/C/man2/modify_ldt.2:136 build/C/man2/nfsservctl.2:58 build/C/man2/outb.2:70 build/C/man2/pciconfig_read.2:111 build/C/man2/personality.2:70 build/C/man2/pivot_root.2:143 build/C/man2/ptrace.2:1730 build/C/man2/quotactl.2:510 build/C/man2/sendfile.2:199 build/C/man2/set_tid_address.2:94 build/C/man2/splice.2:229 build/C/man2/tee.2:199 build/C/man2/vm86.2:74 build/C/man2/vmsplice.2:156
288 #: build/C/man2/arch_prctl.2:151 build/C/man2/futex.2:281 build/C/man2/kexec_load.2:165 build/C/man2/lookup_dcookie.2:95 build/C/man2/modify_ldt.2:143 build/C/man2/nfsservctl.2:65 build/C/man2/outb.2:77 build/C/man2/pciconfig_read.2:118 build/C/man2/personality.2:77 build/C/man2/pivot_root.2:150 build/C/man2/ptrace.2:1737 build/C/man2/quotactl.2:517 build/C/man2/sendfile.2:206 build/C/man2/set_tid_address.2:101 build/C/man2/splice.2:236 build/C/man2/tee.2:206 build/C/man2/vm86.2:81 build/C/man2/vmsplice.2:163
290 "This page is part of release 3.37 of the Linux I<man-pages> project. A "
291 "description of the project, and information about reporting bugs, can be "
292 "found at http://www.kernel.org/doc/man-pages/."
296 #: build/C/man2/futex.2:17
302 #: build/C/man2/futex.2:17
308 #: build/C/man2/futex.2:20
309 msgid "futex - Fast Userspace Locking system call"
313 #: build/C/man2/futex.2:25
316 "B<#include E<lt>linux/futex.hE<gt>>\n"
317 "B<#include E<lt>sys/time.hE<gt>>\n"
321 #: build/C/man2/futex.2:28
324 "B<int futex(int *>I<uaddr>B<, int >I<op>B<, int >I<val>B<, const struct "
325 "timespec *>I<timeout>B<,>\n"
328 #. int *? void *? u32 *?
330 #: build/C/man2/futex.2:31
332 msgid "B< int *>I<uaddr2>B<, int >I<val3>B<);>\n"
336 #: build/C/man2/futex.2:48
338 "The B<futex>() system call provides a method for a program to wait for a "
339 "value at a given address to change, and a method to wake up anyone waiting "
340 "on a particular address (while the addresses for the same memory in separate "
341 "processes may not be equal, the kernel maps them internally so the same "
342 "memory mapped in different locations will correspond for B<futex>() "
343 "calls). This system call is typically used to implement the contended case "
344 "of a lock in shared memory, as described in B<futex>(7)."
348 #: build/C/man2/futex.2:55
350 "When a B<futex>(7) operation did not finish uncontended in userspace, a "
351 "call needs to be made to the kernel to arbitrate. Arbitration can either "
352 "mean putting the calling process to sleep or, conversely, waking a waiting "
357 #: build/C/man2/futex.2:62
359 "Callers of this function are expected to adhere to the semantics as set out "
360 "in B<futex>(7). As these semantics involve writing nonportable assembly "
361 "instructions, this in turn probably means that most users will in fact be "
362 "library authors and not general application developers."
366 #: build/C/man2/futex.2:70
368 "The I<uaddr> argument needs to point to an aligned integer which stores the "
369 "counter. The operation to execute is passed via the I<op> argument, along "
370 "with a value I<val>."
374 #: build/C/man2/futex.2:72
375 msgid "Five operations are currently defined:"
379 #: build/C/man2/futex.2:72 build/C/man2/futex.2:177
381 msgid "B<FUTEX_WAIT>"
385 #: build/C/man2/futex.2:90
387 "This operation atomically verifies that the futex address I<uaddr> still "
388 "contains the value I<val>, and sleeps awaiting B<FUTEX_WAKE> on this futex "
389 "address. If the I<timeout> argument is non-NULL, its contents describe the "
390 "maximum duration of the wait, which is infinite otherwise. The arguments "
391 "I<uaddr2> and I<val3> are ignored."
395 #: build/C/man2/futex.2:98
397 "For B<futex>(7), this call is executed if decrementing the count gave a "
398 "negative value (indicating contention), and will sleep until another process "
399 "releases the futex and executes the B<FUTEX_WAKE> operation."
403 #: build/C/man2/futex.2:98 build/C/man2/futex.2:194
405 msgid "B<FUTEX_WAKE>"
409 #: build/C/man2/futex.2:109
411 "This operation wakes at most I<val> processes waiting on this futex address "
412 "(i.e., inside B<FUTEX_WAIT>). The arguments I<timeout>, I<uaddr2> and "
413 "I<val3> are ignored."
417 #: build/C/man2/futex.2:115
419 "For B<futex>(7), this is executed if incrementing the count showed that "
420 "there were waiters, once the futex value has been set to 1 (indicating that "
425 #: build/C/man2/futex.2:115
427 msgid "B<FUTEX_FD> (present up to and including Linux 2.6.25)"
430 #. , suitable for .BR poll (2).
432 #: build/C/man2/futex.2:131
434 "To support asynchronous wakeups, this operation associates a file descriptor "
435 "with a futex. If another process executes a B<FUTEX_WAKE>, the process will "
436 "receive the signal number that was passed in I<val>. The calling process "
437 "must close the returned file descriptor after use. The arguments "
438 "I<timeout>, I<uaddr2> and I<val3> are ignored."
442 #: build/C/man2/futex.2:136
444 "To prevent race conditions, the caller should test if the futex has been "
445 "upped after B<FUTEX_FD> returns."
449 #: build/C/man2/futex.2:140
451 "Because it was inherently racy, B<FUTEX_FD> has been removed from Linux "
456 #: build/C/man2/futex.2:140
458 msgid "B<FUTEX_REQUEUE> (since Linux 2.5.70)"
462 #: build/C/man2/futex.2:155
464 "This operation was introduced in order to avoid a \"thundering herd\" effect "
465 "when B<FUTEX_WAKE> is used and all processes woken up need to acquire "
466 "another futex. This call wakes up I<val> processes, and requeues all other "
467 "waiters on the futex at address I<uaddr2>. The arguments I<timeout> and "
468 "I<val3> are ignored."
472 #: build/C/man2/futex.2:155
474 msgid "B<FUTEX_CMP_REQUEUE> (since Linux 2.6.7)"
478 #: build/C/man2/futex.2:173
480 "There was a race in the intended use of B<FUTEX_REQUEUE>, so "
481 "B<FUTEX_CMP_REQUEUE> was introduced. This is similar to B<FUTEX_REQUEUE>, "
482 "but first checks whether the location I<uaddr> still contains the value "
483 "I<val3>. If not, the operation fails with the error B<EAGAIN>. The "
484 "argument I<timeout> is ignored."
488 #: build/C/man2/futex.2:177
490 "Depending on which operation was executed, the returned value for a "
491 "successful call can have differing meanings."
495 #: build/C/man2/futex.2:194
497 "Returns 0 if the process was woken by a B<FUTEX_WAKE> call. In case of "
498 "timeout, the operation fails with the error B<ETIMEDOUT>. If the futex was "
499 "not equal to the expected value, the operation fails with the error "
500 "B<EWOULDBLOCK>. Signals (see B<signal>(7)) or other spurious wakeups cause "
501 "B<FUTEX_WAIT> to fail with the error B<EINTR>."
505 #: build/C/man2/futex.2:197 build/C/man2/futex.2:203 build/C/man2/futex.2:206
506 msgid "Returns the number of processes woken up."
510 #: build/C/man2/futex.2:197
516 #: build/C/man2/futex.2:200
517 msgid "Returns the new file descriptor associated with the futex."
521 #: build/C/man2/futex.2:200
523 msgid "B<FUTEX_REQUEUE>"
527 #: build/C/man2/futex.2:203
529 msgid "B<FUTEX_CMP_REQUEUE>"
533 #: build/C/man2/futex.2:210
535 "In the event of an error, all operations return -1, and set I<errno> to "
536 "indicate the error."
540 #: build/C/man2/futex.2:211 build/C/man2/quotactl.2:484
546 #: build/C/man2/futex.2:214
547 msgid "No read access to futex memory."
551 #: build/C/man2/futex.2:214 build/C/man2/sendfile.2:112
557 #: build/C/man2/futex.2:222
559 "B<FUTEX_CMP_REQUEUE> found an unexpected futex value. (This probably "
560 "indicates a race; use the safe B<FUTEX_WAKE> now.)"
564 #: build/C/man2/futex.2:227
565 msgid "Error in getting I<timeout> information from userspace."
569 #: build/C/man2/futex.2:230
570 msgid "An operation was not defined or error in page alignment."
574 #: build/C/man2/futex.2:230
580 #: build/C/man2/futex.2:233
581 msgid "The system limit on the total number of open files has been reached."
585 #: build/C/man2/futex.2:233 build/C/man2/modify_ldt.2:124 build/C/man2/pciconfig_read.2:90 build/C/man2/quotactl.2:445 build/C/man2/vm86.2:62
591 #: build/C/man2/futex.2:237
592 msgid "Invalid operation specified in I<op>."
596 #: build/C/man2/futex.2:237 build/C/man2/kexec_load.2:134 build/C/man2/lookup_dcookie.2:73 build/C/man2/pivot_root.2:119 build/C/man2/sendfile.2:138 build/C/man2/set_tid_address.2:86 build/C/man2/splice.2:165 build/C/man2/tee.2:114 build/C/man2/vmsplice.2:138
602 #: build/C/man2/futex.2:247
604 "Initial futex support was merged in Linux 2.5.7 but with different semantics "
605 "from what was described above. A 4-argument system call with the semantics "
606 "described in this page was introduced in Linux 2.5.40. In Linux 2.5.70 one "
607 "argument was added. In Linux 2.6.7 a sixth argument was added\\(emmessy, "
608 "especially on the s390 architecture."
612 #: build/C/man2/futex.2:249 build/C/man2/kexec_load.2:140 build/C/man2/set_tid_address.2:91 build/C/man2/splice.2:171 build/C/man2/tee.2:120 build/C/man2/vmsplice.2:144
613 msgid "This system call is Linux-specific."
618 #. Futexes were designed and worked on by
619 #. Hubertus Franke (IBM Thomas J. Watson Research Center),
620 #. Matthew Kirkwood, Ingo Molnar (Red Hat)
621 #. and Rusty Russell (IBM Linux Technology Center).
622 #. This page written by bert hubert.
624 #: build/C/man2/futex.2:263
626 "To reiterate, bare futexes are not intended as an easy-to-use abstraction "
627 "for end-users. (There is no wrapper function for this system call in "
628 "glibc.) Implementors are expected to be assembly literate and to have read "
629 "the sources of the futex userspace library referenced below."
633 #: build/C/man2/futex.2:265
638 #: build/C/man2/futex.2:268
640 "I<Fuss, Futexes and Furwocks: Fast Userlevel Locking in Linux> (proceedings "
641 "of the Ottawa Linux Symposium 2002), online at"
645 #: build/C/man2/futex.2:270
646 msgid "http://kernel.org/doc/ols/2002/ols2002-pages-479-495.pdf"
650 #: build/C/man2/futex.2:272
651 msgid "Futex example library, futex-*.tar.bz2 at"
655 #: build/C/man2/futex.2:274
656 msgid "ftp://ftp.nl.kernel.org/pub/linux/kernel/people/rusty/."
660 #: build/C/man2/kexec_load.2:25
666 #: build/C/man2/kexec_load.2:25
672 #: build/C/man2/kexec_load.2:28
673 msgid "kexec_load - load a new kernel for later execution"
677 #: build/C/man2/kexec_load.2:30
678 msgid "B<#include E<lt>linux/kexec.hE<gt>>"
682 #: build/C/man2/kexec_load.2:32
684 "B<long kexec_load(unsigned long >I<entry>B<, unsigned long "
685 ">I<nr_segments>B<,>"
689 #: build/C/man2/kexec_load.2:35
690 msgid "B< struct kexec_segment *>I<segments>B<, unsigned long >I<flags>B<);>"
694 #: build/C/man2/kexec_load.2:40
696 "The B<kexec_load>() system call loads a new kernel that can be executed "
697 "later by B<reboot>(2)."
701 #: build/C/man2/kexec_load.2:46
703 "The I<flags> argument is a mask whose high-order bits control the operation "
704 "of the call. The following values can be specified in I<flags>:"
708 #: build/C/man2/kexec_load.2:46
710 msgid "B<KEXEC_ON_CRASH> (since Linux 2.6.13)"
713 #. FIXME figure out how this is really used
715 #: build/C/man2/kexec_load.2:50
716 msgid "Execute the new kernel automatically on a system crash."
720 #: build/C/man2/kexec_load.2:50
722 msgid "B<KEXEC_PRESERVE_CONTEXT> (since Linux 2.7.27)"
726 #: build/C/man2/kexec_load.2:60
728 "Preserve the system hardware and software states before executing the new "
729 "kernel. This could be used for system suspend. This flag is only available "
730 "if the kernel was configured with B<CONFIG_KEXEC_JUMP>, and is only "
731 "effective if I<nr_segments> is greater than 0."
735 #: build/C/man2/kexec_load.2:80
737 "The low-order bits of I<flags> contain the architecture of the "
738 "to-be-executed kernel. Specify (OR) the constant B<KEXEC_ARCH_DEFAULT> to "
739 "use the current architecture, or one of the following architecture constants "
740 "B<KEXEC_ARCH_386>, B<KEXEC_ARCH_X86_64>, B<KEXEC_ARCH_PPC>, "
741 "B<KEXEC_ARCH_PPC64>, B<KEXEC_ARCH_IA_64>, B<KEXEC_ARCH_ARM>, "
742 "B<KEXEC_ARCH_S390>, B<KEXEC_ARCH_SH>, B<KEXEC_ARCH_MIPS>, and "
743 "B<KEXEC_ARCH_MIPS_LE>. The architecture must be executable on the CPU of "
748 #: build/C/man2/kexec_load.2:94
750 "The I<entry> argument is the physical entry address in the kernel image. "
751 "The I<nr_segments> argument is the number of segments pointed to by the "
752 "I<segments> pointer. The I<segments> argument is an array of "
753 "I<kexec_segment> structures which define the kernel layout:"
757 #: build/C/man2/kexec_load.2:103
760 "struct kexec_segment {\n"
761 " void *buf; /* Buffer in user space */\n"
762 " size_t bufsz; /* Buffer length in user space */\n"
763 " void *mem; /* Physical address of kernel */\n"
764 " size_t memsz; /* Physical address length */\n"
768 #. FIXME elaborate on the following:
770 #: build/C/man2/kexec_load.2:110
772 "The kernel image defined by I<segments> is copied from the calling process "
773 "into previously reserved memory."
777 #: build/C/man2/kexec_load.2:117
779 "On success, B<kexec_load>() returns 0. On error, -1 is returned and "
780 "I<errno> is set to indicate the error."
784 #: build/C/man2/kexec_load.2:118 build/C/man2/pivot_root.2:104 build/C/man2/ptrace.2:1581 build/C/man2/quotactl.2:493
790 #: build/C/man2/kexec_load.2:122
792 "Another crash kernel is already being loaded or a crash kernel is already in "
796 #. KEXEC_SEGMENT_MAX == 16
798 #: build/C/man2/kexec_load.2:129
799 msgid "I<flags> is invalid; or I<nr_segments> is too large"
803 #: build/C/man2/kexec_load.2:134
804 msgid "The caller does not have the B<CAP_SYS_BOOT> capability."
808 #: build/C/man2/kexec_load.2:138
809 msgid "The B<kexec_load>() system call first appeared in Linux 2.6.13."
813 #: build/C/man2/kexec_load.2:145
815 "Currently, there is no glibc support for B<kexec_load>(). Call it using "
819 #. FIXME Andi submitted a patch for this.
820 #. Check if it got accepted later.
822 #: build/C/man2/kexec_load.2:152
824 "The required constants are in the kernel source file I<linux/kexec.h>, which "
825 "is not currently exported to glibc. Therefore, these constants must be "
830 #: build/C/man2/kexec_load.2:155
832 "This system call is only available if the kernel was configured with "
837 #: build/C/man2/kexec_load.2:158
838 msgid "B<reboot>(2), B<syscall>(2)"
842 #: build/C/man2/lookup_dcookie.2:27
844 msgid "LOOKUP_DCOOKIE"
848 #: build/C/man2/lookup_dcookie.2:27
854 #: build/C/man2/lookup_dcookie.2:30
855 msgid "lookup_dcookie - return a directory entry's path"
859 #: build/C/man2/lookup_dcookie.2:32
861 "B<int lookup_dcookie(u64 >I<cookie>B<, char *>I<buffer>B<, size_t "
866 #: build/C/man2/lookup_dcookie.2:38
868 "Look up the full path of the directory entry specified by the value "
869 "I<cookie>. The cookie is an opaque identifier uniquely identifying a "
870 "particular directory entry. The buffer given is filled in with the full "
871 "path of the directory entry."
875 #: build/C/man2/lookup_dcookie.2:43
877 "For B<lookup_dcookie>() to return successfully, the kernel must still hold "
878 "a cookie reference to the directory entry."
882 #: build/C/man2/lookup_dcookie.2:50
884 "On success, B<lookup_dcookie>() returns the length of the path string "
885 "copied into the buffer. On error, -1 is returned, and I<errno> is set "
890 #: build/C/man2/lookup_dcookie.2:54
891 msgid "The buffer was not valid."
895 #: build/C/man2/lookup_dcookie.2:58
897 "The kernel has no registered cookie/directory entry mappings at the time of "
898 "lookup, or the cookie does not refer to a valid directory entry."
902 #: build/C/man2/lookup_dcookie.2:58
904 msgid "B<ENAMETOOLONG>"
908 #: build/C/man2/lookup_dcookie.2:61
909 msgid "The name could not fit in the buffer."
913 #: build/C/man2/lookup_dcookie.2:61 build/C/man2/sendfile.2:134 build/C/man2/splice.2:155 build/C/man2/tee.2:111 build/C/man2/vmsplice.2:135
919 #: build/C/man2/lookup_dcookie.2:65
921 "The kernel could not allocate memory for the temporary buffer holding the "
926 #: build/C/man2/lookup_dcookie.2:70
928 "The process does not have the capability B<CAP_SYS_ADMIN> required to look "
933 #: build/C/man2/lookup_dcookie.2:70 build/C/man2/quotactl.2:472
939 #: build/C/man2/lookup_dcookie.2:73
940 msgid "The buffer was not large enough to hold the path of the directory entry."
944 #: build/C/man2/lookup_dcookie.2:78
946 "Available since Linux 2.5.43. The B<ENAMETOOLONG> error return was added in "
951 #: build/C/man2/lookup_dcookie.2:81
952 msgid "B<lookup_dcookie>() is Linux-specific."
956 #: build/C/man2/lookup_dcookie.2:85
958 "B<lookup_dcookie>() is a special-purpose system call, currently used only "
959 "by the oprofile profiler. It relies on a kernel driver to register cookies "
960 "for directory entries."
964 #: build/C/man2/lookup_dcookie.2:88
966 "The path returned may be suffixed by the string \" (deleted)\" if the "
967 "directory entry has been removed."
971 #: build/C/man2/modify_ldt.2:25
977 #: build/C/man2/modify_ldt.2:25 build/C/man2/pivot_root.2:7
983 #: build/C/man2/modify_ldt.2:28
984 msgid "modify_ldt - get or set ldt"
988 #: build/C/man2/modify_ldt.2:31
990 msgid "B<#include E<lt>sys/types.hE<gt>>\n"
994 #: build/C/man2/modify_ldt.2:33
997 "B<int modify_ldt(int >I<func>B<, void *>I<ptr>B<, unsigned long "
998 ">I<bytecount>B<);>\n"
1002 #: build/C/man2/modify_ldt.2:39
1004 "B<modify_ldt>() reads or writes the local descriptor table (ldt) for a "
1005 "process. The ldt is a per-process memory management table used by the i386 "
1006 "processor. For more information on this table, see an Intel 386 processor "
1011 #: build/C/man2/modify_ldt.2:49
1013 "When I<func> is 0, B<modify_ldt>() reads the ldt into the memory pointed to "
1014 "by I<ptr>. The number of bytes read is the smaller of I<bytecount> and the "
1015 "actual size of the ldt."
1019 #. FIXME ? say something about func == 2 and func == 0x11?
1020 #. In Linux 2.4, func == 2 returned "the default ldt"
1021 #. In Linux 2.6, func == 2 is a nop, returning a zeroed out structure.
1022 #. Linux 2.4 and 2.6 implement an operation for func == 0x11
1024 #: build/C/man2/modify_ldt.2:67
1026 "When I<func> is 1, B<modify_ldt>() modifies one ldt entry. I<ptr> points "
1027 "to a I<user_desc> structure and I<bytecount> must equal the size of this "
1032 #: build/C/man2/modify_ldt.2:71
1033 msgid "The I<user_desc> structure is defined in I<E<lt>asm/ldt.hE<gt>> as:"
1037 #: build/C/man2/modify_ldt.2:85
1040 "struct user_desc {\n"
1041 " unsigned int entry_number;\n"
1042 " unsigned long base_addr;\n"
1043 " unsigned int limit;\n"
1044 " unsigned int seg_32bit:1;\n"
1045 " unsigned int contents:2;\n"
1046 " unsigned int read_exec_only:1;\n"
1047 " unsigned int limit_in_pages:1;\n"
1048 " unsigned int seg_not_present:1;\n"
1049 " unsigned int useable:1;\n"
1054 #. The ldt is specific for the calling process. Any attempts to change
1055 #. the ldt to include the address space of another process or the kernel
1056 #. will result in a segmentation violation when trying to access the memory
1057 #. outside of the process address space. The memory protection is enforced
1058 #. at the paging layer.
1060 #: build/C/man2/modify_ldt.2:96
1061 msgid "In Linux 2.4 and earlier, this structure was named I<modify_ldt_ldt_s>."
1065 #: build/C/man2/modify_ldt.2:106
1067 "On success, B<modify_ldt>() returns either the actual number of bytes read "
1068 "(for reading) or 0 (for writing). On failure, B<modify_ldt>() returns -1 "
1069 "and sets I<errno> to indicate the error."
1073 #: build/C/man2/modify_ldt.2:111
1074 msgid "I<ptr> points outside the address space."
1078 #: build/C/man2/modify_ldt.2:124
1080 "I<ptr> is 0, or I<func> is 1 and I<bytecount> is not equal to the size of "
1081 "the structure I<modify_ldt_ldt_s>, or I<func> is 1 and the new ldt entry has "
1086 #: build/C/man2/modify_ldt.2:128
1087 msgid "I<func> is neither 0 nor 1."
1091 #: build/C/man2/modify_ldt.2:131
1093 "This call is Linux-specific and should not be used in programs intended to "
1098 #: build/C/man2/modify_ldt.2:134 build/C/man2/pivot_root.2:128
1100 "Glibc does not provide a wrapper for this system call; call it using "
1105 #: build/C/man2/modify_ldt.2:136
1110 #: build/C/man2/nfsservctl.2:8
1116 #: build/C/man2/nfsservctl.2:8
1122 #: build/C/man2/nfsservctl.2:11
1123 msgid "nfsservctl - syscall interface to kernel nfs daemon"
1127 #: build/C/man2/nfsservctl.2:14
1129 msgid "B<#include E<lt>linux/nfsd/syscall.hE<gt>>\n"
1133 #: build/C/man2/nfsservctl.2:17
1136 "B<long nfsservctl(int >I<cmd>B<, struct nfsctl_arg *>I<argp>B<,>\n"
1137 "B< union nfsctl_res *>I<resp>B<);>\n"
1141 #: build/C/man2/nfsservctl.2:21
1142 msgid "I<Note>: Since Linux 3.1, this system call no longer exists."
1146 #: build/C/man2/nfsservctl.2:33
1150 " * These are the commands understood by nfsctl().\n"
1152 "#define NFSCTL_SVC 0 /* This is a server process. */\n"
1153 "#define NFSCTL_ADDCLIENT 1 /* Add an NFS client. */\n"
1154 "#define NFSCTL_DELCLIENT 2 /* Remove an NFS client. */\n"
1155 "#define NFSCTL_EXPORT 3 /* export a file system. */\n"
1156 "#define NFSCTL_UNEXPORT 4 /* unexport a file system. */\n"
1157 "#define NFSCTL_UGIDUPDATE 5 /* update a client's UID/GID map. */\n"
1158 "#define NFSCTL_GETFH 6 /* get an fh (used by mountd) */\n"
1162 #: build/C/man2/nfsservctl.2:45
1165 "struct nfsctl_arg {\n"
1166 " int ca_version; /* safeguard */\n"
1168 " struct nfsctl_svc u_svc;\n"
1169 " struct nfsctl_client u_client;\n"
1170 " struct nfsctl_export u_export;\n"
1171 " struct nfsctl_uidmap u_umap;\n"
1172 " struct nfsctl_fhparm u_getfh;\n"
1173 " unsigned int u_debug;\n"
1179 #: build/C/man2/nfsservctl.2:50
1182 "union nfsctl_res {\n"
1183 " struct knfs_fh cr_getfh;\n"
1184 " unsigned int cr_debug;\n"
1189 #: build/C/man2/nfsservctl.2:56 build/C/man2/pivot_root.2:99 build/C/man2/vm86.2:57
1191 "On success, zero is returned. On error, -1 is returned, and I<errno> is set "
1196 #: build/C/man2/nfsservctl.2:58
1197 msgid "This call is Linux-specific."
1201 #: build/C/man2/outb.2:28
1207 #: build/C/man2/outb.2:28
1213 #: build/C/man2/outb.2:33
1215 "outb, outw, outl, outsb, outsw, outsl, inb, inw, inl, insb, insw, insl, "
1216 "outb_p, outw_p, outl_p, inb_p, inw_p, inl_p - port I/O"
1220 #: build/C/man2/outb.2:38
1222 "This family of functions is used to do low-level port input and output. The "
1223 "out* functions do port output, the in* functions do port input; the b-suffix "
1224 "functions are byte-width and the w-suffix functions word-width; the "
1225 "_p-suffix functions pause until the I/O completes."
1228 #. , given the following information
1229 #. in addition to that given in
1232 #: build/C/man2/outb.2:44
1234 "They are primarily designed for internal kernel use, but can be used from "
1239 #: build/C/man2/outb.2:49
1241 "You compile with B<-O> or B<-O2> or similar. The functions are defined as "
1242 "inline macros, and will not be substituted in without optimization enabled, "
1243 "causing unresolved references at link time."
1247 #: build/C/man2/outb.2:58
1249 "You use B<ioperm>(2) or alternatively B<iopl>(2) to tell the kernel to "
1250 "allow the user space application to access the I/O ports in question. "
1251 "Failure to do this will cause the application to receive a segmentation "
1256 #: build/C/man2/outb.2:67
1258 "B<outb>() and friends are hardware-specific. The I<value> argument is "
1259 "passed first and the I<port> argument is passed second, which is the "
1260 "opposite order from most DOS implementations."
1264 #: build/C/man2/outb.2:70
1265 msgid "B<ioperm>(2), B<iopl>(2)"
1269 #: build/C/man2/pciconfig_read.2:5
1271 msgid "PCICONFIG_READ"
1275 #: build/C/man2/pciconfig_read.2:5
1281 #: build/C/man2/pciconfig_read.2:8
1283 "pciconfig_read, pciconfig_write, pciconfig_iobase - pci device information "
1288 #: build/C/man2/pciconfig_read.2:11
1290 msgid "B<#include E<lt>pci.hE<gt>>\n"
1294 #: build/C/man2/pciconfig_read.2:18
1297 "B<int pciconfig_read(unsigned long >I<bus>B<, unsigned long >I<dfn>B<,>\n"
1298 "B< unsigned long >I<off>B<, unsigned long >I<len>B<, void "
1300 "B<int pciconfig_write(unsigned long >I<bus>B<, unsigned long >I<dfn>B<,>\n"
1301 "B< unsigned long >I<off>B<, unsigned long >I<len>B<, void "
1303 "B<int pciconfig_iobase(long >I<which>B<, unsigned long >I<bus>B<,>\n"
1304 "B< unsigned long >I<devfn>B<);>\n"
1308 #: build/C/man2/pciconfig_read.2:24
1310 "Most of the interaction with PCI devices is already handled by the kernel "
1311 "PCI layer, and thus these calls should not normally need to be accessed from "
1316 #: build/C/man2/pciconfig_read.2:24 build/C/man2/pciconfig_read.2:48
1318 msgid "B<pciconfig_read>()"
1322 #: build/C/man2/pciconfig_read.2:33
1323 msgid "Reads to I<buf> from device I<dev> at offset I<off> value."
1327 #: build/C/man2/pciconfig_read.2:33 build/C/man2/pciconfig_read.2:54
1329 msgid "B<pciconfig_write>()"
1333 #: build/C/man2/pciconfig_read.2:42
1334 msgid "Writes from I<buf> to device I<dev> at offset I<off> value."
1338 #: build/C/man2/pciconfig_read.2:42 build/C/man2/pciconfig_read.2:60
1340 msgid "B<pciconfig_iobase>()"
1344 #: build/C/man2/pciconfig_read.2:47
1346 "You pass it a bus/devfn pair and get a physical address for either the "
1347 "memory offset (for things like prep, this is 0xc0000000), the IO base for "
1348 "PIO cycles, or the ISA holes if any."
1352 #: build/C/man2/pciconfig_read.2:54 build/C/man2/pciconfig_read.2:60
1354 "On success zero is returned. On error, -1 is returned and I<errno> is set "
1359 #: build/C/man2/pciconfig_read.2:74
1361 "Returns information on locations of various I/O regions in physical memory "
1362 "according to the I<which> value. Values for I<which> are: "
1363 "B<IOBASE_BRIDGE_NUMBER>, B<IOBASE_MEMORY>, B<IOBASE_IO>, B<IOBASE_ISA_IO>, "
1364 "B<IOBASE_ISA_MEM>."
1368 #: build/C/man2/pciconfig_read.2:81
1369 msgid "I<len> value is invalid. This does not apply to B<pciconfig_iobase>()."
1373 #: build/C/man2/pciconfig_read.2:81 build/C/man2/ptrace.2:1598 build/C/man2/sendfile.2:130
1379 #: build/C/man2/pciconfig_read.2:84
1384 #: build/C/man2/pciconfig_read.2:84
1390 #: build/C/man2/pciconfig_read.2:90
1392 "For B<pciconfig_iobase>(), \"hose\" value is NULL. For the other calls, "
1393 "could not find a slot."
1397 #: build/C/man2/pciconfig_read.2:95
1398 msgid "The system has not implemented these calls (B<CONFIG_PCI> not defined)."
1402 #: build/C/man2/pciconfig_read.2:95
1404 msgid "B<EOPNOTSUPP>"
1408 #: build/C/man2/pciconfig_read.2:102
1410 "This return value is only valid for B<pciconfig_iobase>(). It is returned "
1411 "if the value for I<which> is invalid."
1415 #: build/C/man2/pciconfig_read.2:107
1417 "User does not have the B<CAP_SYS_ADMIN> capability. This does not apply to "
1418 "B<pciconfig_iobase>()."
1422 #: build/C/man2/pciconfig_read.2:109
1423 msgid "These calls are Linux-specific, available since Linux 2.0.26/2.1.11."
1427 #: build/C/man2/pciconfig_read.2:111
1428 msgid "B<capabilities>(7)"
1432 #: build/C/man2/personality.2:30
1438 #: build/C/man2/personality.2:30
1444 #: build/C/man2/personality.2:33
1445 msgid "personality - set the process execution domain"
1449 #: build/C/man2/personality.2:35
1450 msgid "B<#include E<lt>sys/personality.hE<gt>>"
1454 #: build/C/man2/personality.2:37
1455 msgid "B<int personality(unsigned long >I<persona>B<);>"
1459 #: build/C/man2/personality.2:45
1461 "Linux supports different execution domains, or personalities, for each "
1462 "process. Among other things, execution domains tell Linux how to map signal "
1463 "numbers into signal actions. The execution domain system allows Linux to "
1464 "provide limited support for binaries compiled under other UNIX-like "
1465 "operating systems."
1469 #: build/C/man2/personality.2:55
1471 "This function will return the current B<personality>() when I<persona> "
1472 "equals 0xffffffff. Otherwise, it will make the execution domain referenced "
1473 "by I<persona> the new execution domain of the calling process."
1477 #: build/C/man2/personality.2:62
1479 "On success, the previous I<persona> is returned. On error, -1 is returned, "
1480 "and I<errno> is set appropriately."
1484 #: build/C/man2/personality.2:66
1485 msgid "The kernel was unable to change the personality."
1489 #: build/C/man2/personality.2:70
1491 "B<personality>() is Linux-specific and should not be used in programs "
1492 "intended to be portable."
1496 #: build/C/man2/pivot_root.2:7
1502 #: build/C/man2/pivot_root.2:10
1503 msgid "pivot_root - change the root file system"
1507 #: build/C/man2/pivot_root.2:12
1508 msgid "B<int pivot_root(const char *>I<new_root>B<, const char *>I<put_old>B<);>"
1514 #. capability is required.
1516 #: build/C/man2/pivot_root.2:21
1518 "B<pivot_root>() moves the root file system of the calling process to the "
1519 "directory I<put_old> and makes I<new_root> the new root file system of the "
1524 #: build/C/man2/pivot_root.2:28
1526 "The typical use of B<pivot_root>() is during system startup, when the "
1527 "system mounts a temporary root file system (e.g., an B<initrd>), then mounts "
1528 "the real root file system, and eventually turns the latter into the current "
1529 "root of all relevant processes or threads."
1533 #: build/C/man2/pivot_root.2:40
1535 "B<pivot_root>() may or may not change the current root and the current "
1536 "working directory of any processes or threads which use the old root "
1537 "directory. The caller of B<pivot_root>() must ensure that processes with "
1538 "root or current working directory at the old root operate correctly in "
1539 "either case. An easy way to ensure this is to change their root and current "
1540 "working directory to I<new_root> before invoking B<pivot_root>()."
1544 #: build/C/man2/pivot_root.2:58
1546 "The paragraph above is intentionally vague because the implementation of "
1547 "B<pivot_root>() may change in the future. At the time of writing, "
1548 "B<pivot_root>() changes root and current working directory of each process "
1549 "or thread to I<new_root> if they point to the old root directory. This is "
1550 "necessary in order to prevent kernel threads from keeping the old root "
1551 "directory busy with their root and current working directory, even if they "
1552 "never access the file system in any way. In the future, there may be a "
1553 "mechanism for kernel threads to explicitly relinquish any access to the file "
1554 "system, such that this fairly intrusive mechanism can be removed from "
1559 #: build/C/man2/pivot_root.2:66
1561 "Note that this also applies to the calling process: B<pivot_root>() may or "
1562 "may not affect its current working directory. It is therefore recommended "
1563 "to call B<chdir(\"/\")> immediately after B<pivot_root>()."
1567 #: build/C/man2/pivot_root.2:68
1568 msgid "The following restrictions apply to I<new_root> and I<put_old>:"
1572 #: build/C/man2/pivot_root.2:68 build/C/man2/pivot_root.2:70 build/C/man2/pivot_root.2:73 build/C/man2/pivot_root.2:77
1578 #: build/C/man2/pivot_root.2:70
1579 msgid "They must be directories."
1583 #: build/C/man2/pivot_root.2:73
1585 "I<new_root> and I<put_old> must not be on the same file system as the "
1590 #: build/C/man2/pivot_root.2:77
1592 "I<put_old> must be underneath I<new_root>, that is, adding a nonzero number "
1593 "of I</..> to the string pointed to by I<put_old> must yield the same "
1594 "directory as I<new_root>."
1598 #: build/C/man2/pivot_root.2:79
1599 msgid "No other file system may be mounted on I<put_old>."
1603 #: build/C/man2/pivot_root.2:83
1604 msgid "See also B<pivot_root>(8) for additional usage examples."
1608 #: build/C/man2/pivot_root.2:90
1610 "If the current root is not a mount point (e.g., after B<chroot>(2) or "
1611 "B<pivot_root>(), see also below), not the old root directory, but the mount "
1612 "point of that file system is mounted on I<put_old>."
1616 #: build/C/man2/pivot_root.2:95
1618 "I<new_root> does not have to be a mount point. In this case, "
1619 "I</proc/mounts> will show the mount point of the file system containing "
1620 "I<new_root> as root (I</>)."
1624 #: build/C/man2/pivot_root.2:104
1626 "B<pivot_root>() may return (in I<errno>) any of the errors returned by "
1627 "B<stat>(2). Additionally, it may return:"
1631 #: build/C/man2/pivot_root.2:108
1633 "I<new_root> or I<put_old> are on the current root file system, or a file "
1634 "system is already mounted on I<put_old>."
1638 #: build/C/man2/pivot_root.2:111
1639 msgid "I<put_old> is not underneath I<new_root>."
1643 #: build/C/man2/pivot_root.2:111
1649 #: build/C/man2/pivot_root.2:114
1650 msgid "I<new_root> or I<put_old> is not a directory."
1654 #: build/C/man2/pivot_root.2:119
1655 msgid "The calling process does not have the B<CAP_SYS_ADMIN> capability."
1659 #: build/C/man2/pivot_root.2:122
1660 msgid "B<pivot_root>() was introduced in Linux 2.3.41."
1664 #: build/C/man2/pivot_root.2:125
1665 msgid "B<pivot_root>() is Linux-specific and hence is not portable."
1669 #: build/C/man2/pivot_root.2:128 build/C/man2/ptrace.2:1661
1675 #: build/C/man2/pivot_root.2:132
1677 "B<pivot_root>() should not have to change root and current working "
1678 "directory of all other processes in the system."
1682 #: build/C/man2/pivot_root.2:137
1684 "Some of the more obscure uses of B<pivot_root>() may quickly lead to "
1689 #: build/C/man2/pivot_root.2:143
1690 msgid "B<chdir>(2), B<chroot>(2), B<stat>(2), B<initrd>(4), B<pivot_root>(8)"
1694 #: build/C/man2/ptrace.2:48
1700 #: build/C/man2/ptrace.2:48
1706 #: build/C/man2/ptrace.2:51
1707 msgid "ptrace - process trace"
1711 #: build/C/man2/ptrace.2:54
1713 msgid "B<#include E<lt>sys/ptrace.hE<gt>>\n"
1717 #: build/C/man2/ptrace.2:57
1720 "B<long ptrace(enum __ptrace_request >I<request>B<, pid_t >I<pid>B<, >\n"
1721 "B< void *>I<addr>B<, void *>I<data>B<);>\n"
1725 #: build/C/man2/ptrace.2:66
1727 "The B<ptrace>() system call provides a means by which one process (the "
1728 "\"tracer\") may observe and control the execution of another process (the "
1729 "\"tracee\"), and examine and change the tracee's memory and registers. It "
1730 "is primarily used to implement breakpoint debugging and system call tracing."
1734 #: build/C/man2/ptrace.2:77
1736 "A tracee first needs to be attached to the tracer. Attachment and "
1737 "subsequent commands are per thread: in a multithreaded process, every thread "
1738 "can be individually attached to a (potentially different) tracer, or left "
1739 "not attached and thus not debugged. Therefore, \"tracee\" always means "
1740 "\"(one) thread\", never \"a (possibly multithreaded) process\". Ptrace "
1741 "commands are always sent to a specific tracee using a call of the form"
1745 #: build/C/man2/ptrace.2:79
1747 msgid " ptrace(PTRACE_foo, pid, ...)\n"
1751 #: build/C/man2/ptrace.2:83
1752 msgid "where I<pid> is the thread ID of the corresponding Linux thread."
1756 #: build/C/man2/ptrace.2:89
1758 "(Note that in this page, a \"multithreaded process\" means a thread group "
1759 "consisting of threads created using the B<clone>(2) B<CLONE_THREAD> flag.)"
1763 #: build/C/man2/ptrace.2:98
1765 "A process can initiate a trace by calling B<fork>(2) and having the "
1766 "resulting child do a B<PTRACE_TRACEME>, followed (typically) by an "
1767 "B<execve>(2). Alternatively, one process may commence tracing another "
1768 "process using B<PTRACE_ATTACH>."
1772 #: build/C/man2/ptrace.2:115
1774 "While being traced, the tracee will stop each time a signal is delivered, "
1775 "even if the signal is being ignored. (An exception is B<SIGKILL>, which has "
1776 "its usual effect.) The tracer will be notified at its next call to "
1777 "B<waitpid>(2) (or one of the related \"wait\" system calls); that call will "
1778 "return a I<status> value containing information that indicates the cause of "
1779 "the stop in the tracee. While the tracee is stopped, the tracer can use "
1780 "various ptrace requests to inspect and modify the tracee. The tracer then "
1781 "causes the tracee to continue, optionally ignoring the delivered signal (or "
1782 "even delivering a different signal instead)."
1786 #: build/C/man2/ptrace.2:119
1788 "When the tracer is finished tracing, it can cause the tracee to continue "
1789 "executing in a normal, untraced mode via B<PTRACE_DETACH>."
1793 #: build/C/man2/ptrace.2:123
1794 msgid "The value of I<request> determines the action to be performed:"
1798 #: build/C/man2/ptrace.2:123
1800 msgid "B<PTRACE_TRACEME>"
1804 #: build/C/man2/ptrace.2:145
1806 "Indicate that this process is to be traced by its parent. Any signal "
1807 "(except B<SIGKILL>) delivered to this process will cause it to stop and its "
1808 "parent to be notified via B<waitpid>(2). In addition, all subsequent calls "
1809 "to B<execve>(2) by the traced process will cause a B<SIGTRAP> to be sent to "
1810 "it, giving the parent a chance to gain control before the new program begins "
1811 "execution. A process probably shouldn't make this request if its parent "
1812 "isn't expecting to trace it. (I<pid>, I<addr>, and I<data> are ignored.)"
1816 #: build/C/man2/ptrace.2:156
1818 "The B<PTRACE_TRACEME> request is used only by the tracee; the remaining "
1819 "requests are used only by the tracer. In the following requests, I<pid> "
1820 "specifies the thread ID of the tracee to be acted on. For requests other "
1821 "than B<PTRACE_KILL>, the tracee must be stopped."
1825 #: build/C/man2/ptrace.2:156
1827 msgid "B<PTRACE_PEEKTEXT>, B<PTRACE_PEEKDATA>"
1831 #: build/C/man2/ptrace.2:167
1833 "Read a word at the address I<addr> in the tracee's memory, returning the "
1834 "word as the result of the B<ptrace>() call. Linux does not have separate "
1835 "text and data address spaces, so these two requests are currently "
1836 "equivalent. (I<data> is ignored.)"
1840 #: build/C/man2/ptrace.2:167
1842 msgid "B<PTRACE_PEEKUSER>"
1845 #. PTRACE_PEEKUSR in kernel source, but glibc uses PTRACE_PEEKUSER,
1846 #. and that is the name that seems common on other systems.
1848 #: build/C/man2/ptrace.2:185
1850 "Read a word at offset I<addr> in the tracee's USER area, which holds the "
1851 "registers and other information about the process (see "
1852 "I<E<lt>sys/user.hE<gt>>). The word is returned as the result of the "
1853 "B<ptrace>() call. Typically, the offset must be word-aligned, though this "
1854 "might vary by architecture. See NOTES. (I<data> is ignored.)"
1858 #: build/C/man2/ptrace.2:185
1860 msgid "B<PTRACE_POKETEXT>, B<PTRACE_POKEDATA>"
1864 #: build/C/man2/ptrace.2:197
1866 "Copy the word I<data> to the address I<addr> in the tracee's memory. As for "
1867 "B<PTRACE_PEEKTEXT> and B<PTRACE_PEEKDATA>, these two requests are currently "
1872 #: build/C/man2/ptrace.2:197
1874 msgid "B<PTRACE_POKEUSER>"
1877 #. PTRACE_POKEUSR in kernel source, but glibc uses PTRACE_POKEUSER,
1878 #. and that is the name that seems common on other systems.
1879 #. FIXME In the preceding sentence, which modifications are disallowed,
1880 #. and when they are disallowed, how does userspace discover that fact?
1882 #: build/C/man2/ptrace.2:213
1884 "Copy the word I<data> to offset I<addr> in the tracee's USER area. As for "
1885 "B<PTRACE_PEEKUSER>, the offset must typically be word-aligned. In order to "
1886 "maintain the integrity of the kernel, some modifications to the USER area "
1891 #: build/C/man2/ptrace.2:213
1893 msgid "B<PTRACE_GETREGS>, B<PTRACE_GETFPREGS>"
1897 #: build/C/man2/ptrace.2:224
1899 "Copy the tracee's general-purpose or floating-point registers, respectively, "
1900 "to the address I<data> in the tracer. See I<E<lt>sys/user.hE<gt>> for "
1901 "information on the format of this data. (I<addr> is ignored.)"
1905 #: build/C/man2/ptrace.2:224
1907 msgid "B<PTRACE_GETSIGINFO> (since Linux 2.3.99-pre6)"
1911 #: build/C/man2/ptrace.2:236
1913 "Retrieve information about the signal that caused the stop. Copy a "
1914 "I<siginfo_t> structure (see B<sigaction>(2)) from the tracee to the address "
1915 "I<data> in the tracer. (I<addr> is ignored.)"
1919 #: build/C/man2/ptrace.2:236
1921 msgid "B<PTRACE_SETREGS>, B<PTRACE_SETFPREGS>"
1924 #. FIXME In the preceding sentence, which modifications are disallowed,
1925 #. and when they are disallowed, how does userspace discover that fact?
1927 #: build/C/man2/ptrace.2:249
1929 "Copy the tracee's general-purpose or floating-point registers, respectively, "
1930 "from the address I<data> in the tracer. As for B<PTRACE_POKEUSER>, some "
1931 "general-purpose register modifications may be disallowed. (I<addr> is "
1936 #: build/C/man2/ptrace.2:249
1938 msgid "B<PTRACE_SETSIGINFO> (since Linux 2.3.99-pre6)"
1942 #: build/C/man2/ptrace.2:265
1944 "Set signal information: copy a I<siginfo_t> structure from the address "
1945 "I<data> in the tracer to the tracee. This will affect only signals that "
1946 "would normally be delivered to the tracee and were caught by the tracer. It "
1947 "may be difficult to tell these normal signals from synthetic signals "
1948 "generated by B<ptrace>() itself. (I<addr> is ignored.)"
1952 #: build/C/man2/ptrace.2:265
1954 msgid "B<PTRACE_SETOPTIONS> (since Linux 2.4.6; see BUGS for caveats)"
1958 #: build/C/man2/ptrace.2:274
1960 "Set ptrace options from I<data>. (I<addr> is ignored.) I<data> is "
1961 "interpreted as a bit mask of options, which are specified by the following "
1966 #: build/C/man2/ptrace.2:275
1968 msgid "B<PTRACE_O_TRACESYSGOOD> (since Linux 2.4.6)"
1972 #: build/C/man2/ptrace.2:284
1974 "When delivering system call traps, set bit 7 in the signal number (i.e., "
1975 "deliver I<SIGTRAP|0x80>). This makes it easy for the tracer to distinguish "
1976 "normal traps from those caused by a system call. (B<PTRACE_O_TRACESYSGOOD> "
1977 "may not work on all architectures.)"
1981 #: build/C/man2/ptrace.2:284
1983 msgid "B<PTRACE_O_TRACEFORK> (since Linux 2.5.46)"
1987 #: build/C/man2/ptrace.2:296
1989 "Stop the tracee at the next B<fork>(2) and automatically start tracing the "
1990 "newly forked process, which will start with a B<SIGSTOP>. A B<waitpid>(2) "
1991 "by the tracer will return a I<status> value such that"
1995 #: build/C/man2/ptrace.2:299
1997 msgid " statusE<gt>E<gt>8 == (SIGTRAP | (PTRACE_EVENT_FORKE<lt>E<lt>8))\n"
2001 #: build/C/man2/ptrace.2:303 build/C/man2/ptrace.2:322 build/C/man2/ptrace.2:341
2002 msgid "The PID of the new process can be retrieved with B<PTRACE_GETEVENTMSG>."
2006 #: build/C/man2/ptrace.2:303
2008 msgid "B<PTRACE_O_TRACEVFORK> (since Linux 2.5.46)"
2012 #: build/C/man2/ptrace.2:315
2014 "Stop the tracee at the next B<vfork>(2) and automatically start tracing the "
2015 "newly vforked process, which will start with a B<SIGSTOP>. A B<waitpid>(2) "
2016 "by the tracer will return a I<status> value such that"
2020 #: build/C/man2/ptrace.2:318
2022 msgid " statusE<gt>E<gt>8 == (SIGTRAP | (PTRACE_EVENT_VFORKE<lt>E<lt>8))\n"
2026 #: build/C/man2/ptrace.2:322
2028 msgid "B<PTRACE_O_TRACECLONE> (since Linux 2.5.46)"
2032 #: build/C/man2/ptrace.2:334
2034 "Stop the tracee at the next B<clone>(2) and automatically start tracing the "
2035 "newly cloned process, which will start with a B<SIGSTOP>. A B<waitpid>(2) "
2036 "by the tracer will return a I<status> value such that"
2040 #: build/C/man2/ptrace.2:337
2042 msgid " statusE<gt>E<gt>8 == (SIGTRAP | (PTRACE_EVENT_CLONEE<lt>E<lt>8))\n"
2046 #: build/C/man2/ptrace.2:362
2048 "This option may not catch B<clone>(2) calls in all cases. If the tracee "
2049 "calls B<clone>(2) with the B<CLONE_VFORK> flag, B<PTRACE_EVENT_VFORK> will "
2050 "be delivered instead if B<PTRACE_O_TRACEVFORK> is set; otherwise if the "
2051 "tracee calls B<clone>(2) with the exit signal set to B<SIGCHLD>, "
2052 "B<PTRACE_EVENT_FORK> will be delivered if B<PTRACE_O_TRACEFORK> is set."
2056 #: build/C/man2/ptrace.2:362
2058 msgid "B<PTRACE_O_TRACEEXEC> (since Linux 2.5.46)"
2062 #: build/C/man2/ptrace.2:371
2064 "Stop the tracee at the next B<execve>(2). A B<waitpid>(2) by the tracer "
2065 "will return a I<status> value such that"
2069 #: build/C/man2/ptrace.2:374
2071 msgid " statusE<gt>E<gt>8 == (SIGTRAP | (PTRACE_EVENT_EXECE<lt>E<lt>8))\n"
2075 #: build/C/man2/ptrace.2:376
2077 msgid "B<PTRACE_O_TRACEVFORKDONE> (since Linux 2.5.60)"
2081 #: build/C/man2/ptrace.2:385
2083 "Stop the tracee at the completion of the next B<vfork>(2). A B<waitpid>(2) "
2084 "by the tracer will return a I<status> value such that"
2088 #: build/C/man2/ptrace.2:388
2090 msgid " statusE<gt>E<gt>8 == (SIGTRAP | (PTRACE_EVENT_VFORK_DONEE<lt>E<lt>8))\n"
2094 #: build/C/man2/ptrace.2:392
2096 "The PID of the new process can (since Linux 2.6.18) be retrieved with "
2097 "B<PTRACE_GETEVENTMSG>."
2101 #: build/C/man2/ptrace.2:392
2103 msgid "B<PTRACE_O_TRACEEXIT> (since Linux 2.5.60)"
2107 #: build/C/man2/ptrace.2:400
2109 "Stop the tracee at exit. A B<waitpid>(2) by the tracer will return a "
2110 "I<status> value such that"
2114 #: build/C/man2/ptrace.2:403
2116 msgid " statusE<gt>E<gt>8 == (SIGTRAP | (PTRACE_EVENT_EXITE<lt>E<lt>8))\n"
2120 #: build/C/man2/ptrace.2:407
2121 msgid "The tracee's exit status can be retrieved with B<PTRACE_GETEVENTMSG>."
2125 #: build/C/man2/ptrace.2:415
2127 "The tracee is stopped early during process exit, when registers are still "
2128 "available, allowing the tracer to see where the exit occurred, whereas the "
2129 "normal exit notification is done after the process is finished exiting. "
2130 "Even though context is available, the tracer cannot prevent the exit from "
2131 "happening at this point."
2135 #: build/C/man2/ptrace.2:416
2137 msgid "B<PTRACE_GETEVENTMSG> (since Linux 2.5.46)"
2141 #: build/C/man2/ptrace.2:436
2143 "Retrieve a message (as an I<unsigned long>) about the ptrace event that "
2144 "just happened, placing it at the address I<data> in the tracer. For "
2145 "B<PTRACE_EVENT_EXIT>, this is the tracee's exit status. For "
2146 "B<PTRACE_EVENT_FORK>, B<PTRACE_EVENT_VFORK>, B<PTRACE_EVENT_VFORK_DONE>, and "
2147 "B<PTRACE_EVENT_CLONE>, this is the PID of the new process. (I<addr> is "
2152 #: build/C/man2/ptrace.2:436
2154 msgid "B<PTRACE_CONT>"
2158 #: build/C/man2/ptrace.2:448
2160 "Restart the stopped tracee process. If I<data> is nonzero, it is "
2161 "interpreted as the number of a signal to be delivered to the tracee; "
2162 "otherwise, no signal is delivered. Thus, for example, the tracer can "
2163 "control whether a signal sent to the tracee is delivered or not. (I<addr> "
2168 #: build/C/man2/ptrace.2:448
2170 msgid "B<PTRACE_SYSCALL>, B<PTRACE_SINGLESTEP>"
2174 #: build/C/man2/ptrace.2:472
2176 "Restart the stopped tracee as for B<PTRACE_CONT>, but arrange for the tracee "
2177 "to be stopped at the next entry to or exit from a system call, or after "
2178 "execution of a single instruction, respectively. (The tracee will also, as "
2179 "usual, be stopped upon receipt of a signal.) From the tracer's perspective, "
2180 "the tracee will appear to have been stopped by receipt of a B<SIGTRAP>. So, "
2181 "for B<PTRACE_SYSCALL>, for example, the idea is to inspect the arguments to "
2182 "the system call at the first stop, then do another B<PTRACE_SYSCALL> and "
2183 "inspect the return value of the system call at the second stop. The I<data> "
2184 "argument is treated as for B<PTRACE_CONT>. (addr is ignored.)"
2188 #: build/C/man2/ptrace.2:472
2190 msgid "B<PTRACE_SYSEMU>, B<PTRACE_SYSEMU_SINGLESTEP> (since Linux 2.6.14)"
2194 #: build/C/man2/ptrace.2:490
2196 "For B<PTRACE_SYSEMU>, continue and stop on entry to the next system call, "
2197 "which will not be executed. For B<PTRACE_SYSEMU_SINGLESTEP>, do the same "
2198 "but also singlestep if not a system call. This call is used by programs "
2199 "like User Mode Linux that want to emulate all the tracee's system calls. "
2200 "The I<data> argument is treated as for B<PTRACE_CONT>. (I<addr> is ignored; "
2201 "not supported on all architectures.)"
2205 #: build/C/man2/ptrace.2:490
2207 msgid "B<PTRACE_KILL>"
2211 #: build/C/man2/ptrace.2:499
2213 "Send the tracee a B<SIGKILL> to terminate it. (I<addr> and I<data> are "
2217 #. [Note from Denys Vlasenko:
2218 #. deprecation suggested by Oleg Nesterov. He prefers to deprecate it
2219 #. instead of describing (and needing to support) PTRACE_KILL's quirks.]
2221 #: build/C/man2/ptrace.2:518
2223 "I<This operation is deprecated; do not use it!> Instead, send a B<SIGKILL> "
2224 "directly using B<kill>(2) or B<tgkill>(2). The problem with B<PTRACE_KILL> "
2225 "is that it requires the tracee to be in signal-delivery-stop, otherwise it "
2226 "may not work (i.e., may complete successfully but won't kill the tracee). "
2227 "By contrast, sending a B<SIGKILL> directly has no such limitation."
2231 #: build/C/man2/ptrace.2:518
2233 msgid "B<PTRACE_ATTACH>"
2236 #. No longer true (removed by Denys Vlasenko, 2011, who remarks:
2237 #. "I think it isn't true in non-ancient 2.4 and in 2.6/3.x.
2238 #. Basically, it's not true for any Linux in practical use.
2239 #. ; the behavior of the tracee is as if it had done a
2240 #. .BR PTRACE_TRACEME .
2241 #. The calling process actually becomes the parent of the tracee
2242 #. process for most purposes (e.g., it will receive
2243 #. notification of tracee events and appears in
2245 #. output as the tracee's parent), but a
2247 #. by the tracee will still return the PID of the original parent.
2249 #: build/C/man2/ptrace.2:546
2251 "Attach to the process specified in I<pid>, making it a tracee of the calling "
2252 "process. The tracee is sent a B<SIGSTOP>, but will not necessarily have "
2253 "stopped by the completion of this call; use B<waitpid>(2) to wait for the "
2254 "tracee to stop. See the \"Attaching and detaching\" subsection for "
2255 "additional information. (I<addr> and I<data> are ignored.)"
2259 #: build/C/man2/ptrace.2:546
2261 msgid "B<PTRACE_DETACH>"
2265 #. In the text below, we decided to avoid prettifying the text with markup:
2266 #. it would make the source nearly impossible to edit, and we _do_ intend
2267 #. to edit it often, in order to keep it updated:
2268 #. ptrace API is full of quirks, no need to compound this situation by
2269 #. making it excruciatingly painful to document them!
2271 #: build/C/man2/ptrace.2:562
2273 "Restart the stopped tracee as for B<PTRACE_CONT>, but first detach from it. "
2274 "Under Linux, a tracee can be detached in this way regardless of which method "
2275 "was used to initiate tracing. (I<addr> is ignored.)"
2279 #: build/C/man2/ptrace.2:562
2281 msgid "Death under ptrace"
2285 #: build/C/man2/ptrace.2:571
2287 "When a (possibly multithreaded) process receives a killing signal (one whose "
2288 "disposition is set to B<SIG_DFL> and whose default action is to kill the "
2289 "process), all threads exit. Tracees report their death to their tracer(s). "
2290 "Notification of this event is delivered via B<waitpid>(2)."
2294 #: build/C/man2/ptrace.2:580
2296 "Note that the killing signal will first cause signal-delivery-stop (on one "
2297 "tracee only), and only after it is injected by the tracer (or after it was "
2298 "dispatched to a thread which isn't traced), will death from the signal "
2299 "happen on I<all> tracees within a multithreaded process. (The term "
2300 "\"signal-delivery-stop\" is explained below.)"
2304 #: build/C/man2/ptrace.2:594
2306 "B<SIGKILL> operates similarly, with exceptions. No signal-delivery-stop is "
2307 "generated for B<SIGKILL> and therefore the tracer can't suppress it. "
2308 "B<SIGKILL> kills even within system calls (syscall-exit-stop is not "
2309 "generated prior to death by B<SIGKILL>). The net effect is that B<SIGKILL> "
2310 "always kills the process (all its threads), even if some threads of the "
2311 "process are ptraced."
2315 #: build/C/man2/ptrace.2:599
2317 "When the tracee calls B<_exit>(2), it reports its death to its tracer. "
2318 "Other threads are not affected."
2322 #: build/C/man2/ptrace.2:603
2324 "When any thread executes B<exit_group>(2), every tracee in its thread group "
2325 "reports its death to its tracer."
2329 #: build/C/man2/ptrace.2:617
2331 "If the B<PTRACE_O_TRACEEXIT> option is on, B<PTRACE_EVENT_EXIT> will happen "
2332 "before actual death. This applies to exits via B<exit>(2), "
2333 "B<exit_group>(2), and signal deaths (except B<SIGKILL>), and when threads "
2334 "are torn down on B<execve>(2) in a multithreaded process."
2338 #: build/C/man2/ptrace.2:642
2340 "The tracer cannot assume that the ptrace-stopped tracee exists. There are "
2341 "many scenarios when the tracee may die while stopped (such as B<SIGKILL>). "
2342 "Therefore, the tracer must be prepared to handle an B<ESRCH> error on any "
2343 "ptrace operation. Unfortunately, the same error is returned if the tracee "
2344 "exists but is not ptrace-stopped (for commands which require a stopped "
2345 "tracee), or if it is not traced by the process which issued the ptrace "
2346 "call. The tracer needs to keep track of the stopped/running state of the "
2347 "tracee, and interpret B<ESRCH> as \"tracee died unexpectedly\" only if it "
2348 "knows that the tracee has been observed to enter ptrace-stop. Note that "
2349 "there is no guarantee that I<waitpid(WNOHANG)> will reliably report the "
2350 "tracee's death status if a ptrace operation returned B<ESRCH>. "
2351 "I<waitpid(WNOHANG)> may return 0 instead. In other words, the tracee may be "
2352 "\"not yet fully dead\", but already refusing ptrace requests."
2356 #: build/C/man2/ptrace.2:656
2358 "The tracer can't assume that the tracee I<always> ends its life by reporting "
2359 "I<WIFEXITED(status)> or I<WIFSIGNALED(status)>; there are cases where this "
2360 "does not occur. For example, if a thread other than thread group leader "
2361 "does an B<execve>(2), it disappears; its PID will never be seen again, and "
2362 "any subsequent ptrace stops will be reported under the thread group leader's "
2367 #: build/C/man2/ptrace.2:656
2369 msgid "Stopped states"
2373 #: build/C/man2/ptrace.2:658
2374 msgid "A tracee can be in two states: running or stopped."
2378 #: build/C/man2/ptrace.2:662
2380 "There are many kinds of states when the tracee is stopped, and in ptrace "
2381 "discussions they are often conflated. Therefore, it is important to use "
2386 #: build/C/man2/ptrace.2:673
2388 "In this manual page, any stopped state in which the tracee is ready to "
2389 "accept ptrace commands from the tracer is called I<ptrace-stop>. "
2390 "Ptrace-stops can be further subdivided into I<signal-delivery-stop>, "
2391 "I<group-stop>, I<syscall-stop>, and so on. These stopped states are "
2392 "described in detail below."
2396 #: build/C/man2/ptrace.2:678
2398 "When the running tracee enters ptrace-stop, it notifies its tracer using "
2399 "B<waitpid>(2) (or one of the other \"wait\" system calls). Most of this "
2400 "manual page assumes that the tracer waits with:"
2404 #: build/C/man2/ptrace.2:680
2406 msgid " pid = waitpid(pid_or_minus_1, &status, __WALL);\n"
2410 #. Do we require __WALL usage, or will just using 0 be ok? (With 0,
2411 #. I am not 100% sure there aren't ugly corner cases.) Are the
2412 #. rules different if user wants to use waitid? Will waitid require
2415 #: build/C/man2/ptrace.2:692
2417 "Ptrace-stopped tracees are reported as returns with I<pid> greater than 0 "
2418 "and I<WIFSTOPPED(status)> true."
2422 #: build/C/man2/ptrace.2:700
2424 "The B<__WALL> flag does not include the B<WSTOPPED> and B<WEXITED> flags, "
2425 "but implies their functionality."
2429 #: build/C/man2/ptrace.2:707
2431 "Setting the B<WCONTINUED> flag when calling B<waitpid>(2) is not "
2432 "recommended: the \"continued\" state is per-process and consuming it can "
2433 "confuse the real parent of the tracee."
2437 #: build/C/man2/ptrace.2:715
2439 "Use of the B<WNOHANG> flag may cause B<waitpid>(2) to return 0 (\"no wait "
2440 "results available yet\") even if the tracer knows there should be a "
2441 "notification. Example:"
2445 #: build/C/man2/ptrace.2:719
2448 " kill(tracee, SIGKILL);\n"
2449 " waitpid(tracee, &status, __WALL | WNOHANG);\n"
2453 #: build/C/man2/ptrace.2:744
2455 "The following kinds of ptrace-stops exist: signal-delivery-stops, "
2456 "group-stop, PTRACE_EVENT stops, syscall-stops B<PTRACE_SINGLESTEP>, "
2457 "B<PTRACE_SYSEMU>, and B<PTRACE_SYSEMU_SINGLESTEP>. They all are reported by "
2458 "B<waitpid>(2) with I<WIFSTOPPED(status)> true. They may be differentiated "
2459 "by examining the value I<statusE<gt>E<gt>8>, and if there is ambiguity in "
2460 "that value, by querying B<PTRACE_GETSIGINFO>. (Note: the "
2461 "I<WSTOPSIG(status)> macro can't be used to perform this examination, because "
2462 "it returns the value (I<status\\E<gt>E<gt>8)\\ >B<&\\ 0xff>B<.)>"
2466 #: build/C/man2/ptrace.2:744
2468 msgid "Signal-delivery-stop"
2472 #: build/C/man2/ptrace.2:764
2474 "When a (possibly multithreaded) process receives any signal except "
2475 "B<SIGKILL>, the kernel selects an arbitrary thread which handles the "
2476 "signal. (If the signal is generated with B<tgkill>(2), the target thread "
2477 "can be explicitly selected by the caller.) If the selected thread is "
2478 "traced, it enters signal-delivery-stop. At this point, the signal is not "
2479 "yet delivered to the process, and can be suppressed by the tracer. If the "
2480 "tracer doesn't suppress the signal, it passes the signal to the tracee in "
2481 "the next ptrace restart request. This second step of signal delivery is "
2482 "called I<signal injection> in this manual page. Note that if the signal is "
2483 "blocked, signal-delivery-stop doesn't happen until the signal is unblocked, "
2484 "with the usual exception that B<SIGSTOP> can't be blocked."
2488 #: build/C/man2/ptrace.2:778
2490 "Signal-delivery-stop is observed by the tracer as B<waitpid>(2) returning "
2491 "with I<WIFSTOPPED(status)> true, with the stopping signal returned by "
2492 "I<WSTOPSIG(status)>. If the stopping signal is B<SIGTRAP>, this may be a "
2493 "different kind of ptrace-stop; see the \"Syscall-stops\" and \"execve\" "
2494 "sections below for details. If I<WSTOPSIG(status)> returns a stopping "
2495 "signal, this may be a group-stop; see below."
2499 #: build/C/man2/ptrace.2:778
2501 msgid "Signal injection and suppression"
2505 #: build/C/man2/ptrace.2:781
2507 "After signal-delivery-stop is observed by the tracer, the tracer should "
2508 "restart the tracee with the call"
2512 #: build/C/man2/ptrace.2:783
2514 msgid " ptrace(PTRACE_restart, pid, 0, sig)\n"
2518 #: build/C/man2/ptrace.2:796
2520 "where B<PTRACE_restart> is one of the restarting ptrace requests. If I<sig> "
2521 "is 0, then a signal is not delivered. Otherwise, the signal I<sig> is "
2522 "delivered. This operation is called I<signal injection> in this manual "
2523 "page, to distinguish it from signal-delivery-stop."
2527 #: build/C/man2/ptrace.2:802
2529 "The I<sig> value may be different from the I<WSTOPSIG(status)> value: the "
2530 "tracer can cause a different signal to be injected."
2534 #: build/C/man2/ptrace.2:813
2536 "Note that a suppressed signal still causes system calls to return "
2537 "prematurely. Restartable system calls will be restarted (the tracer will "
2538 "observe the tracee to execute B<restart_syscall(2)> if the tracer uses "
2539 "B<PTRACE_SYSCALL>); non-restartable system calls may fail with B<EINTR> even "
2540 "though no observable signal is injected to the tracee."
2544 #: build/C/man2/ptrace.2:824
2546 "Restarting ptrace commands issued in ptrace-stops other than "
2547 "signal-delivery-stop are not guaranteed to inject a signal, even if I<sig> "
2548 "is nonzero. No error is reported; a nonzero I<sig> may simply be ignored. "
2549 "Ptrace users should not try to \"create a new signal\" this way: use "
2550 "B<tgkill>(2) instead."
2554 #: build/C/man2/ptrace.2:831
2556 "The fact that signal injection requests may be ignored when restarting the "
2557 "tracee after ptrace stops that are not signal-delivery-stops is a cause of "
2558 "confusion among ptrace users. One typical scenario is that the tracer "
2559 "observes group-stop, mistakes it for signal-delivery-stop, restarts the "
2564 #: build/C/man2/ptrace.2:833
2566 msgid " ptrace(PTRACE_rest, pid, 0, stopsig)\n"
2570 #: build/C/man2/ptrace.2:839
2572 "with the intention of injecting I<stopsig>, but I<stopsig> gets ignored and "
2573 "the tracee continues to run."
2577 #: build/C/man2/ptrace.2:859
2579 "The B<SIGCONT> signal has a side effect of waking up (all threads of) a "
2580 "group-stopped process. This side effect happens before "
2581 "signal-delivery-stop. The tracer can't suppress this side-effect (it can "
2582 "only suppress signal injection, which only causes the B<SIGCONT> handler to "
2583 "not be executed in the tracee, if such a handler is installed). In fact, "
2584 "waking up from group-stop may be followed by signal-delivery-stop for "
2585 "signal(s) I<other than> B<SIGCONT>, if they were pending when B<SIGCONT> "
2586 "was delivered. In other words, B<SIGCONT> may be not the first signal "
2587 "observed by the tracee after it was sent."
2591 #: build/C/man2/ptrace.2:863
2593 "Stopping signals cause (all threads of) a process to enter group-stop. This "
2594 "side effect happens after signal injection, and therefore can be suppressed "
2598 #. In the Linux 2.4 sources, in arch/i386/kernel/signal.c::do_signal(),
2601 #. /* The debugger continued. Ignore SIGSTOP. */
2602 #. if (signr == SIGSTOP)
2605 #: build/C/man2/ptrace.2:873
2606 msgid "In Linux 2.4 and earlier, the B<SIGSTOP> signal can't be injected."
2610 #: build/C/man2/ptrace.2:890
2612 "B<PTRACE_GETSIGINFO> can be used to retrieve a I<siginfo_t> structure which "
2613 "corresponds to the delivered signal. B<PTRACE_SETSIGINFO> may be used to "
2614 "modify it. If B<PTRACE_SETSIGINFO> has been used to alter I<siginfo_t>, the "
2615 "I<si_signo> field and the I<sig> parameter in the restarting command must "
2616 "match, otherwise the result is undefined."
2620 #: build/C/man2/ptrace.2:890
2626 #: build/C/man2/ptrace.2:902
2628 "When a (possibly multithreaded) process receives a stopping signal, all "
2629 "threads stop. If some threads are traced, they enter a group-stop. Note "
2630 "that the stopping signal will first cause signal-delivery-stop (on one "
2631 "tracee only), and only after it is injected by the tracer (or after it was "
2632 "dispatched to a thread which isn't traced), will group-stop be initiated on "
2633 "I<all> tracees within the multithreaded process. As usual, every tracee "
2634 "reports its group-stop separately to the corresponding tracer."
2638 #: build/C/man2/ptrace.2:911
2640 "Group-stop is observed by the tracer as B<waitpid>(2) returning with "
2641 "I<WIFSTOPPED(status)> true, with the stopping signal available via "
2642 "I<WSTOPSIG(status)>. The same result is returned by some other classes of "
2643 "ptrace-stops, therefore the recommended practice is to perform the call"
2647 #: build/C/man2/ptrace.2:913
2649 msgid " ptrace(PTRACE_GETSIGINFO, pid, 0, &siginfo)\n"
2653 #: build/C/man2/ptrace.2:934
2655 "The call can be avoided if the signal is not B<SIGSTOP>, B<SIGTSTP>, "
2656 "B<SIGTTIN>, or B<SIGTTOU>; only these four signals are stopping signals. If "
2657 "the tracer sees something else, it can't be a group-stop. Otherwise, the "
2658 "tracer needs to call B<PTRACE_GETSIGINFO>. If B<PTRACE_GETSIGINFO> fails "
2659 "with B<EINVAL>, then it is definitely a group-stop. (Other failure codes "
2660 "are possible, such as B<ESRCH> (\"no such process\") if a B<SIGKILL> killed "
2665 #: build/C/man2/ptrace.2:943
2667 "As of kernel 2.6.38, after the tracer sees the tracee ptrace-stop and until "
2668 "it restarts or kills it, the tracee will not run, and will not send "
2669 "notifications (except B<SIGKILL> death) to the tracer, even if the tracer "
2670 "enters into another B<waitpid>(2) call."
2674 #: build/C/man2/ptrace.2:957
2676 "The kernel behavior described in the previous paragraph causes a problem "
2677 "with transparent handling of stopping signals. If the tracer restarts the "
2678 "tracee after group-stop, the stopping signal is effectively ignored\\(emthe "
2679 "tracee doesn't remain stopped, it runs. If the tracer doesn't restart the "
2680 "tracee before entering into the next B<waitpid>(2), future B<SIGCONT> "
2681 "signals will not be reported to the tracer; this would cause the B<SIGCONT> "
2682 "signals to have no effect on the tracee."
2686 #: build/C/man2/ptrace.2:957
2688 msgid "PTRACE_EVENT stops"
2692 #: build/C/man2/ptrace.2:963
2694 "If the tracer sets B<PTRACE_O_TRACE_*> options, the tracee will enter "
2695 "ptrace-stops called B<PTRACE_EVENT> stops."
2699 #: build/C/man2/ptrace.2:977
2701 "B<PTRACE_EVENT> stops are observed by the tracer as B<waitpid>(2) returning "
2702 "with I<WIFSTOPPED(status)>, and I<WSTOPSIG(status)> returns B<SIGTRAP>. An "
2703 "additional bit is set in the higher byte of the status word: the value "
2704 "I<statusE<gt>E<gt>8> will be"
2708 #: build/C/man2/ptrace.2:979
2710 msgid " (SIGTRAP | PTRACE_EVENT_foo E<lt>E<lt> 8).\n"
2714 #: build/C/man2/ptrace.2:981
2715 msgid "The following events exist:"
2719 #: build/C/man2/ptrace.2:981
2721 msgid "B<PTRACE_EVENT_VFORK>"
2725 #: build/C/man2/ptrace.2:994
2727 "Stop before return from B<vfork>(2) or B<clone>(2) with the B<CLONE_VFORK> "
2728 "flag. When the tracee is continued after this stop, it will wait for child "
2729 "to exit/exec before continuing its execution (in other words, the usual "
2730 "behavior on B<vfork>(2))."
2734 #: build/C/man2/ptrace.2:994
2736 msgid "B<PTRACE_EVENT_FORK>"
2740 #: build/C/man2/ptrace.2:1002
2742 "Stop before return from B<fork>(2) or B<clone>(2) with the exit signal set "
2747 #: build/C/man2/ptrace.2:1002
2749 msgid "B<PTRACE_EVENT_CLONE>"
2753 #: build/C/man2/ptrace.2:1006
2754 msgid "Stop before return from B<clone>(2)"
2758 #: build/C/man2/ptrace.2:1006
2760 msgid "B<PTRACE_EVENT_VFORK_DONE>"
2764 #: build/C/man2/ptrace.2:1016
2766 "Stop before return from B<vfork>(2) or B<clone>(2) with the B<CLONE_VFORK> "
2767 "flag, but after the child unblocked this tracee by exiting or execing."
2771 #: build/C/man2/ptrace.2:1022
2773 "For all four stops described above, the stop occurs in the parent (i.e., the "
2774 "tracee), not in the newly created thread. B<PTRACE_GETEVENTMSG> can be used "
2775 "to retrieve the new thread's ID."
2779 #: build/C/man2/ptrace.2:1022
2781 msgid "B<PTRACE_EVENT_EXEC>"
2785 #: build/C/man2/ptrace.2:1026
2786 msgid "Stop before return from B<execve>(2)."
2790 #: build/C/man2/ptrace.2:1026
2792 msgid "B<PTRACE_EVENT_EXIT>"
2796 #: build/C/man2/ptrace.2:1042
2798 "Stop before exit (including death from B<exit_group>(2)), signal death, or "
2799 "exit caused by B<execve>(2) in a multithreaded process. "
2800 "B<PTRACE_GETEVENTMSG> returns the exit status. Registers can be examined "
2801 "(unlike when \"real\" exit happens). The tracee is still alive; it needs to "
2802 "be B<PTRACE_CONT>ed or B<PTRACE_DETACH>ed to finish exiting."
2806 #: build/C/man2/ptrace.2:1053
2808 "B<PTRACE_GETSIGINFO> on B<PTRACE_EVENT> stops returns B<SIGTRAP in> "
2809 "I<si_signo>, with I<si_code> set to I<(eventE<lt>E<lt>8)\\ |\\ SIGTRAP>."
2813 #: build/C/man2/ptrace.2:1053
2815 msgid "Syscall-stops"
2819 #: build/C/man2/ptrace.2:1066
2821 "If the tracee was restarted by B<PTRACE_SYSCALL>, the tracee enters "
2822 "syscall-enter-stop just prior to entering any system call. If the tracer "
2823 "restarts the tracee with B<PTRACE_SYSCALL>, the tracee enters "
2824 "syscall-exit-stop when the system call is finished, or if it is interrupted "
2825 "by a signal. (That is, signal-delivery-stop never happens between "
2826 "syscall-enter-stop and syscall-exit-stop; it happens I<after> "
2827 "syscall-exit-stop.)"
2831 #: build/C/man2/ptrace.2:1080
2833 "Other possibilities are that the tracee may stop in a B<PTRACE_EVENT> stop, "
2834 "exit (if it entered B<_exit>(2) or B<exit_group>(2)), be killed by "
2835 "B<SIGKILL>, or die silently (if it is a thread group leader, the "
2836 "B<execve>(2) happened in another thread, and that thread is not traced by "
2837 "the same tracer; this situation is discussed later)."
2841 #: build/C/man2/ptrace.2:1095
2843 "Syscall-enter-stop and syscall-exit-stop are observed by the tracer as "
2844 "B<waitpid>(2) returning with I<WIFSTOPPED(status)> true, and "
2845 "I<WSTOPSIG(status)> giving B<SIGTRAP>. If the B<PTRACE_O_TRACESYSGOOD> "
2846 "option was set by the tracer, then I<WSTOPSIG(status)> will give the value "
2847 "I<(SIGTRAP\\ |\\ 0x80)>."
2851 #: build/C/man2/ptrace.2:1101
2853 "Syscall-stops can be distinguished from signal-delivery-stop with B<SIGTRAP> "
2854 "by querying B<PTRACE_GETSIGINFO> for the following cases:"
2858 #: build/C/man2/ptrace.2:1101
2860 msgid "I<si_code> E<lt>= 0"
2864 #: build/C/man2/ptrace.2:1113
2866 "B<SIGTRAP> was delivered as a result of a userspace action, for example, a "
2867 "system call (B<tgkill>(2), B<kill>(2), B<sigqueue>(3), etc.), expiration of "
2868 "a POSIX timer, change of state on a POSIX message queue, or completion of an "
2869 "asynchronous I/O request."
2873 #: build/C/man2/ptrace.2:1113
2875 msgid "I<si_code> == SI_KERNEL (0x80)"
2879 #: build/C/man2/ptrace.2:1117
2880 msgid "B<SIGTRAP> was sent by the kernel."
2884 #: build/C/man2/ptrace.2:1117
2886 msgid "I<si_code> == SIGTRAP or I<si_code> == (SIGTRAP|0x80)"
2890 #: build/C/man2/ptrace.2:1120
2891 msgid "This is a syscall-stop."
2895 #: build/C/man2/ptrace.2:1125
2897 "However, syscall-stops happen very often (twice per system call), and "
2898 "performing B<PTRACE_GETSIGINFO> for every syscall-stop may be somewhat "
2903 #: build/C/man2/ptrace.2:1148
2905 "Some architectures allow the cases to be distinguished by examining "
2906 "registers. For example, on x86, I<rax> == -B<ENOSYS> in "
2907 "syscall-enter-stop. Since B<SIGTRAP> (like any other signal) always happens "
2908 "I<after> syscall-exit-stop, and at this point I<rax> almost never contains "
2909 "-B<ENOSYS>, the B<SIGTRAP> looks like \"syscall-stop which is not "
2910 "syscall-enter-stop\"; in other words, it looks like a \"stray "
2911 "syscall-exit-stop\" and can be detected this way. But such detection is "
2912 "fragile and is best avoided."
2916 #: build/C/man2/ptrace.2:1154
2918 "Using the B<PTRACE_O_TRACESYSGOOD> option is the recommended method to "
2919 "distinquish syscall-stops from other kinds of ptrace-stops, since it is "
2920 "reliable and does not incur a performance penalty."
2924 #: build/C/man2/ptrace.2:1165
2926 "Syscall-enter-stop and syscall-exit-stop are indistinguishable from each "
2927 "other by the tracer. The tracer needs to keep track of the sequence of "
2928 "ptrace-stops in order to not misinterpret syscall-enter-stop as "
2929 "syscall-exit-stop or vice versa. The rule is that syscall-enter-stop is "
2930 "always followed by syscall-exit-stop, B<PTRACE_EVENT> stop or the tracee's "
2931 "death; no other kinds of ptrace-stop can occur in between."
2935 #: build/C/man2/ptrace.2:1170
2937 "If after syscall-enter-stop, the tracer uses a restarting command other than "
2938 "B<PTRACE_SYSCALL>, syscall-exit-stop is not generated."
2942 #: build/C/man2/ptrace.2:1182
2944 "B<PTRACE_GETSIGINFO> on syscall-stops returns B<SIGTRAP> in I<si_signo>, "
2945 "with I<si_code> set to B<SIGTRAP> or I<(SIGTRAP|0x80)>."
2949 #: build/C/man2/ptrace.2:1182
2951 msgid "PTRACE_SINGLESTEP, PTRACE_SYSEMU, PTRACE_SYSEMU_SINGLESTEP stops"
2956 #. document stops occurring with PTRACE_SINGLESTEP, PTRACE_SYSEMU,
2957 #. PTRACE_SYSEMU_SINGLESTEP
2959 #: build/C/man2/ptrace.2:1188
2960 msgid "[Details of these kinds of stops are yet to be documented.]"
2964 #: build/C/man2/ptrace.2:1188
2966 msgid "Informational and restarting ptrace commands"
2970 #: build/C/man2/ptrace.2:1196
2972 "Most ptrace commands (all except B<PTRACE_ATTACH>, B<PTRACE_TRACEME>, and "
2973 "B<PTRACE_KILL>) require the tracee to be in a ptrace-stop, otherwise they "
2974 "fail with B<ESRCH>."
2978 #: build/C/man2/ptrace.2:1201
2980 "When the tracee is in ptrace-stop, the tracer can read and write data to the "
2981 "tracee using informational commands. These commands leave the tracee in "
2982 "ptrace-stopped state:"
2986 #: build/C/man2/ptrace.2:1211
2989 " ptrace(PTRACE_PEEKTEXT/PEEKDATA/PEEKUSER, pid, addr, 0);\n"
2990 " ptrace(PTRACE_POKETEXT/POKEDATA/POKEUSER, pid, addr, long_val);\n"
2991 " ptrace(PTRACE_GETREGS/GETFPREGS, pid, 0, &struct);\n"
2992 " ptrace(PTRACE_SETREGS/SETFPREGS, pid, 0, &struct);\n"
2993 " ptrace(PTRACE_GETSIGINFO, pid, 0, &siginfo);\n"
2994 " ptrace(PTRACE_SETSIGINFO, pid, 0, &siginfo);\n"
2995 " ptrace(PTRACE_GETEVENTMSG, pid, 0, &long_var);\n"
2996 " ptrace(PTRACE_SETOPTIONS, pid, 0, PTRACE_O_flags);\n"
3000 #: build/C/man2/ptrace.2:1223
3002 "Note that some errors are not reported. For example, setting signal "
3003 "information (I<siginfo>) may have no effect in some ptrace-stops, yet the "
3004 "call may succeed (return 0 and not set I<errno>); querying "
3005 "B<PTRACE_GETEVENTMSG> may succeed and return some random value if current "
3006 "ptrace-stop is not documented as returning a meaningful event message."
3010 #: build/C/man2/ptrace.2:1225
3015 #: build/C/man2/ptrace.2:1227
3017 msgid " ptrace(PTRACE_SETOPTIONS, pid, 0, PTRACE_O_flags);\n"
3021 #: build/C/man2/ptrace.2:1236
3023 "affects one tracee. The tracee's current flags are replaced. Flags are "
3024 "inherited by new tracees created and \"auto-attached\" via active "
3025 "B<PTRACE_O_TRACEFORK>, B<PTRACE_O_TRACEVFORK>, or B<PTRACE_O_TRACECLONE> "
3030 #: build/C/man2/ptrace.2:1239
3032 "Another group of commands makes the ptrace-stopped tracee run. They have "
3037 #: build/C/man2/ptrace.2:1241
3039 msgid " ptrace(cmd, pid, 0, sig);\n"
3043 #: build/C/man2/ptrace.2:1261
3045 "where I<cmd> is B<PTRACE_CONT>, B<PTRACE_DETACH>, B<PTRACE_SYSCALL>, "
3046 "B<PTRACE_SINGLESTEP>, B<PTRACE_SYSEMU>, or B<PTRACE_SYSEMU_SINGLESTEP.> If "
3047 "the tracee is in signal-delivery-stop, I<sig> is the signal to be injected "
3048 "(if it is nonzero). Otherwise, I<sig> may be ignored. (When restarting a "
3049 "tracee from a ptrace-stop other than signal-delivery-stop, recommended "
3050 "practice is to always pass 0 in I<sig .)>"
3054 #: build/C/man2/ptrace.2:1261
3056 msgid "Attaching and detaching"
3060 #: build/C/man2/ptrace.2:1263
3061 msgid "A thread can be attached to the tracer using the call"
3065 #: build/C/man2/ptrace.2:1265
3067 msgid " ptrace(PTRACE_ATTACH, pid, 0, 0);\n"
3071 #. FIXME: Describe how to attach to a thread which is already
3074 #: build/C/man2/ptrace.2:1289
3076 "This also sends B<SIGSTOP> to this thread. If the tracer wants this "
3077 "B<SIGSTOP> to have no effect, it needs to suppress it. Note that if other "
3078 "signals are concurrently sent to this thread during attach, the tracer may "
3079 "see the tracee enter signal-delivery-stop with other signal(s) first! The "
3080 "usual practice is to reinject these signals until B<SIGSTOP> is seen, then "
3081 "suppress B<SIGSTOP> injection. The design bug here is that a ptrace attach "
3082 "and a concurrently delivered B<SIGSTOP> may race and the concurrent "
3083 "B<SIGSTOP> may be lost."
3087 #: build/C/man2/ptrace.2:1296
3089 "Since attaching sends B<SIGSTOP> and the tracer usually suppresses it, this "
3090 "may cause a stray I<EINTR> return from the currently executing system call "
3091 "in the tracee, as described in the \"signal injection and suppression\" "
3096 #: build/C/man2/ptrace.2:1298
3101 #: build/C/man2/ptrace.2:1300
3103 msgid " ptrace(PTRACE_TRACEME, 0, 0, 0);\n"
3107 #: build/C/man2/ptrace.2:1306
3109 "turns the calling thread into a tracee. The thread continues to run "
3110 "(doesn't enter ptrace-stop). A common practice is to follow the "
3111 "B<PTRACE_TRACEME> with"
3115 #: build/C/man2/ptrace.2:1308
3117 msgid " raise(SIGSTOP);\n"
3121 #: build/C/man2/ptrace.2:1311
3123 "and allow the parent (which is our tracer now) to observe our "
3124 "signal-delivery-stop."
3128 #: build/C/man2/ptrace.2:1335
3130 "If the B<PTRACE_O_TRACEFORK>, B<PTRACE_O_TRACEVFORK>, or "
3131 "B<PTRACE_O_TRACECLONE> options are in effect, then children created by, "
3132 "respectively, B<vfork>(2) or B<clone>(2) with the B<CLONE_VFORK> flag, "
3133 "B<fork>(2) or B<clone>(2) with the exit signal set to B<SIGCHLD>, and "
3134 "other kinds of B<clone>(2), are automatically attached to the same tracer "
3135 "which traced their parent. B<SIGSTOP> is delivered to the children, causing "
3136 "them to enter signal-delivery-stop after they exit the system call which "
3141 #: build/C/man2/ptrace.2:1337
3142 msgid "Detaching of the tracee is performed by:"
3146 #: build/C/man2/ptrace.2:1339
3148 msgid " ptrace(PTRACE_DETACH, pid, 0, sig);\n"
3152 #: build/C/man2/ptrace.2:1347
3154 "B<PTRACE_DETACH> is a restarting operation; therefore it requires the tracee "
3155 "to be in ptrace-stop. If the tracee is in signal-delivery-stop, a signal "
3156 "can be injected. Otherwise, the I<sig> parameter may be silently ignored."
3159 #. FIXME: Describe how to detach from a group-stopped tracee so that it
3160 #. doesn't run, but continues to wait for SIGCONT.
3162 #: build/C/man2/ptrace.2:1371
3164 "If the tracee is running when the tracer wants to detach it, the usual "
3165 "solution is to send B<SIGSTOP> (using B<tgkill>(2), to make sure it goes to "
3166 "the correct thread), wait for the tracee to stop in signal-delivery-stop for "
3167 "B<SIGSTOP> and then detach it (suppressing B<SIGSTOP> injection). A design "
3168 "bug is that this can race with concurrent B<SIGSTOP>s. Another complication "
3169 "is that the tracee may enter other ptrace-stops and needs to be restarted "
3170 "and waited for again, until B<SIGSTOP> is seen. Yet another complication is "
3171 "to be sure that the tracee is not already ptrace-stopped, because no signal "
3172 "delivery happens while it is\\(emnot even B<SIGSTOP>."
3176 #: build/C/man2/ptrace.2:1379
3178 "If the tracer dies, all tracees are automatically detached and restarted, "
3179 "unless they were in group-stop. Handling of restart from group-stop is "
3180 "currently buggy, but the \"as planned\" behavior is to leave tracee stopped "
3181 "and waiting for B<SIGCONT>. If the tracee is restarted from "
3182 "signal-delivery-stop, the pending signal is injected."
3186 #: build/C/man2/ptrace.2:1379
3188 msgid "execve(2) under ptrace"
3191 #. clone(2) THREAD_CLONE says:
3192 #. If any of the threads in a thread group performs an execve(2),
3193 #. then all threads other than the thread group leader are terminated,
3194 #. and the new program is executed in the thread group leader.
3196 #. In kernel 3.1 sources, see fs/exec.c::de_thread()
3198 #: build/C/man2/ptrace.2:1398
3200 "When one thread in a multithreaded process calls B<execve>(2), the kernel "
3201 "destroys all other threads in the process, and resets the thread ID of the "
3202 "execing thread to the thread group ID (process ID). (Or, to put things "
3203 "another way, when a multithreaded process does an B<execve>(2), at "
3204 "completion of the call, it appears as though the B<execve>(2) occurred in "
3205 "the thread group leader, regardless of which thread did the B<execve>(2).) "
3206 "This resetting of the thread ID looks very confusing to tracers:"
3210 #: build/C/man2/ptrace.2:1398 build/C/man2/ptrace.2:1408 build/C/man2/ptrace.2:1414 build/C/man2/ptrace.2:1422 build/C/man2/ptrace.2:1558
3216 #: build/C/man2/ptrace.2:1408
3218 "All other threads stop in B<PTRACE_EVENT_EXIT> stop, if the "
3219 "B<PTRACE_O_TRACEEXIT> option was turned on. Then all other threads except "
3220 "the thread group leader report death as if they exited via B<_exit>(2) with "
3225 #: build/C/man2/ptrace.2:1414
3227 "Then a B<PTRACE_EVENT_EXEC> stop happens, if the B<PTRACE_O_TRACEEXEC> "
3228 "option was turned on."
3232 #: build/C/man2/ptrace.2:1422
3234 "The execing tracee changes its thread ID while it is in the B<execve>(2). "
3235 "(Remember, under ptrace, the \"pid\" returned from B<waitpid>(2), or fed "
3236 "into ptrace calls, is the tracee's thread ID.) That is, the tracee's thread "
3237 "ID is reset to be the same as its process ID, which is the same as the "
3238 "thread group leader's thread ID."
3242 #: build/C/man2/ptrace.2:1436
3244 "If the thread group leader has reported its death by this time, it appears "
3245 "to the tracer that the dead thread leader \"reappears from nowhere\". If "
3246 "the thread group leader was still alive, for the tracer this may look as if "
3247 "thread group leader returns from a different system call than it entered, or "
3248 "even \"returned from a system call even though it was not in any system "
3249 "call\". If the thread group leader was not traced (or was traced by a "
3250 "different tracer), then during B<execve>(2) it will appear as if it has "
3251 "become a tracee of the tracer of the execing tracee."
3255 #: build/C/man2/ptrace.2:1439
3257 "All of the above effects are the artifacts of the thread ID change in the "
3262 #: build/C/man2/ptrace.2:1463
3264 "The B<PTRACE_O_TRACEEXEC> option is the recommended tool for dealing with "
3265 "this situation. It enables B<PTRACE_EVENT_EXEC> stop, which occurs before "
3266 "B<execve>(2) returns. First, it enables B<PTRACE_EVENT_EXEC>-stop, which "
3267 "occurs before B<execve(2)> returns. In this stop, the tracer can use "
3268 "B<PTRACE_GETEVENTMSG> to retrieve the tracee's former thread ID. (This "
3269 "feature was introduced in Linux 3.0). Second, the B<PTRACE_O_TRACEEXEC> "
3270 "option disables legacy B<SIGTRAP> generation on B<execve>(2)."
3274 #: build/C/man2/ptrace.2:1469
3276 "When the tracer receives B<PTRACE_EVENT_EXEC> stop notification, it is "
3277 "guaranteed that except this tracee and the thread group leader, no other "
3278 "threads from the process are alive."
3282 #: build/C/man2/ptrace.2:1477
3284 "On receiving the B<PTRACE_EVENT_EXEC> stop notification, the tracer should "
3285 "clean up all its internal data structures describing the threads of this "
3286 "process, and retain only one data structure\\(emone which describes the "
3287 "single still running tracee, with"
3291 #: build/C/man2/ptrace.2:1479
3293 msgid " thread ID == thread group ID == process id.\n"
3297 #: build/C/man2/ptrace.2:1485
3299 "Currently, there is no way to retrieve the former thread ID of the execing "
3300 "tracee. If the tracer doesn't keep track of its tracees' thread group "
3301 "relations, it may be unable to know which tracee execed and therefore no "
3302 "longer exists under the old thread ID due to a thread ID change."
3306 #: build/C/man2/ptrace.2:1489
3307 msgid "Example: two threads call B<execve>(2) at the same time:"
3311 #: build/C/man2/ptrace.2:1500
3314 "*** we get syscall-entry-stop in thread 1: **\n"
3315 "PID1 execve(\"/bin/foo\", \"foo\" E<lt>unfinished ...E<gt>\n"
3316 "*** we issue PTRACE_SYSCALL for thread 1 **\n"
3317 "*** we get syscall-entry-stop in thread 2: **\n"
3318 "PID2 execve(\"/bin/bar\", \"bar\" E<lt>unfinished ...E<gt>\n"
3319 "*** we issue PTRACE_SYSCALL for thread 2 **\n"
3320 "*** we get PTRACE_EVENT_EXEC for PID0, we issue PTRACE_SYSCALL **\n"
3321 "*** we get syscall-exit-stop for PID0: **\n"
3322 "PID0 E<lt>... execve resumedE<gt> ) = 0\n"
3326 #: build/C/man2/ptrace.2:1505
3327 msgid "In this situation, there is no way to know which B<execve>(2) succeeded."
3331 #: build/C/man2/ptrace.2:1527
3333 "If the B<PTRACE_O_TRACEEXEC> option is I<not> in effect for the execing "
3334 "tracee, the kernel delivers an extra B<SIGTRAP> to the tracee after "
3335 "B<execve>(2) returns. This is an ordinary signal (similar to one which can "
3336 "be generated by I<kill -TRAP>), not a special kind of ptrace-stop. "
3337 "Employing B<PTRACE_GETSIGINFO> for this signal returns I<si_code> set to 0 "
3338 "(I<SI_USER>). This signal may be blocked by signal mask, and thus may be "
3339 "delivered (much) later."
3343 #: build/C/man2/ptrace.2:1546
3345 "Usually, the tracer (for example, B<strace>(1)) would not want to show this "
3346 "extra post-execve B<SIGTRAP> signal to the user, and would suppress its "
3347 "delivery to the tracee (if B<SIGTRAP> is set to B<SIG_DFL>, it is a killing "
3348 "signal). However, determining I<which> B<SIGTRAP> to suppress is not easy. "
3349 "Setting the B<PTRACE_O_TRACEEXEC> option and thus suppressing this extra "
3350 "B<SIGTRAP> is the recommended approach."
3354 #: build/C/man2/ptrace.2:1546
3360 #: build/C/man2/ptrace.2:1553
3362 "The ptrace API (ab)uses the standard UNIX parent/child signaling over "
3363 "B<waitpid>(2). This used to cause the real parent of the process to stop "
3364 "receiving several kinds of B<waitpid>(2) notifications when the child "
3365 "process is traced by some other process."
3369 #: build/C/man2/ptrace.2:1556
3371 "Many of these bugs have been fixed, but as of Linux 2.6.38 several still "
3372 "exist; see BUGS below."
3376 #: build/C/man2/ptrace.2:1558
3377 msgid "As of Linux 2.6.38, the following is believed to work correctly:"
3381 #: build/C/man2/ptrace.2:1566
3383 "exit/death by signal is reported first to the tracer, then, when the tracer "
3384 "consumes the B<waitpid>(2) result, to the real parent (to the real parent "
3385 "only when the whole multithreaded process exits). If the tracer and the "
3386 "real parent are the same process, the report is sent only once."
3390 #: build/C/man2/ptrace.2:1580
3392 "On success, B<PTRACE_PEEK*> requests return the requested data, while other "
3393 "requests return zero. On error, all requests return -1, and I<errno> is set "
3394 "appropriately. Since the value returned by a successful B<PTRACE_PEEK*> "
3395 "request may be -1, the caller must clear I<errno> before the call, and then "
3396 "check it afterward to determine whether or not an error occurred."
3400 #: build/C/man2/ptrace.2:1584
3401 msgid "(i386 only) There was an error with allocating or freeing a debug register."
3405 #: build/C/man2/ptrace.2:1595
3407 "There was an attempt to read from or write to an invalid area in the "
3408 "tracer's or the tracee's memory, probably because the area wasn't mapped or "
3409 "accessible. Unfortunately, under Linux, different variations of this fault "
3410 "will return B<EIO> or B<EFAULT> more or less arbitrarily."
3414 #: build/C/man2/ptrace.2:1598
3415 msgid "An attempt was made to set an invalid option."
3419 #: build/C/man2/ptrace.2:1605
3421 "I<request> is invalid, or an attempt was made to read from or write to an "
3422 "invalid area in the tracer's or the tracee's memory, or there was a "
3423 "word-alignment violation, or an invalid signal was specified during a "
3428 #: build/C/man2/ptrace.2:1618
3430 "The specified process cannot be traced. This could be because the tracer "
3431 "has insufficient privileges (the required capability is B<CAP_SYS_PTRACE>); "
3432 "unprivileged processes cannot trace processes that they cannot send signals "
3433 "to or those running set-user-ID/set-group-ID programs, for obvious reasons. "
3434 "Alternatively, the process may already be being traced, or (on kernels "
3435 "before 2.6.26) be B<init>(8) (PID 1)."
3439 #: build/C/man2/ptrace.2:1618 build/C/man2/quotactl.2:459 build/C/man2/quotactl.2:502
3445 #: build/C/man2/ptrace.2:1623
3447 "The specified process does not exist, or is not currently being traced by "
3448 "the caller, or is not stopped (for requests that require a stopped tracee)."
3452 #: build/C/man2/ptrace.2:1625
3453 msgid "SVr4, 4.3BSD."
3457 #: build/C/man2/ptrace.2:1638
3459 "Although arguments to B<ptrace>() are interpreted according to the "
3460 "prototype given, glibc currently declares B<ptrace>() as a variadic "
3461 "function with only the I<request> argument fixed. This means that unneeded "
3462 "trailing arguments may be omitted, though doing so makes use of undocumented "
3463 "B<gcc>(1) behavior."
3466 #. See commit 00cd5c37afd5f431ac186dd131705048c0a11fdb
3468 #: build/C/man2/ptrace.2:1643
3470 "In Linux kernels before 2.6.26, B<init>(8), the process with PID 1, may not "
3474 #. See http://lkml.org/lkml/2008/5/8/375
3476 #: build/C/man2/ptrace.2:1650
3478 "The layout of the contents of memory and the USER area are quite "
3479 "operating-system- and architecture-specific. The offset supplied, and the "
3480 "data returned, might not entirely match with the definition of I<struct "
3485 #: build/C/man2/ptrace.2:1653
3487 "The size of a \"word\" is determined by the operating-system variant (e.g., "
3488 "for 32-bit Linux it is 32 bits, etc.)."
3492 #: build/C/man2/ptrace.2:1661
3494 "This page documents the way the B<ptrace>() call works currently in Linux. "
3495 "Its behavior differs noticeably on other flavors of UNIX. In any case, use "
3496 "of B<ptrace>() is highly specific to the operating system and architecture."
3500 #: build/C/man2/ptrace.2:1672
3502 "On hosts with 2.6 kernel headers, B<PTRACE_SETOPTIONS> is declared with a "
3503 "different value than the one for 2.4. This leads to applications compiled "
3504 "with 2.6 kernel headers failing when run on 2.4 kernels. This can be worked "
3505 "around by redefining B<PTRACE_SETOPTIONS> to B<PTRACE_OLDSETOPTIONS>, if "
3510 #: build/C/man2/ptrace.2:1675
3512 "Group-stop notifications are sent to the tracer, but not to real parent. "
3513 "Last confirmed on 2.6.38.6."
3516 #. Note from Denys Vlasenko:
3517 #. Here "exits" means any kind of death - _exit, exit_group,
3518 #. signal death. Signal death and exit_group cases are trivial,
3519 #. though: since signal death and exit_group kill all other threads
3520 #. too, "until all other threads exit" thing happens rather soon
3521 #. in these cases. Therefore, only _exit presents observably
3522 #. puzzling behavior to ptrace users: thread leader _exit's,
3523 #. but WIFEXITED isn't reported! We are trying to explain here
3525 #. FIXME: ^^^ need to test/verify this scenario
3527 #: build/C/man2/ptrace.2:1706
3529 "If a thread group leader is traced and exits by calling B<_exit>(2), a "
3530 "B<PTRACE_EVENT_EXIT> stop will happen for it (if requested), but the "
3531 "subsequent B<WIFEXITED> notification will not be delivered until all other "
3532 "threads exit. As explained above, if one of other threads calls "
3533 "B<execve>(2), the death of the thread group leader will I<never> be "
3534 "reported. If the execed thread is not traced by this tracer, the tracer "
3535 "will never know that B<execve>(2) happened. One possible workaround is to "
3536 "B<PTRACE_DETACH> the thread group leader instead of restarting it in this "
3537 "case. Last confirmed on 2.6.38.6."
3541 #: build/C/man2/ptrace.2:1716
3543 "A B<SIGKILL> signal may still cause a B<PTRACE_EVENT_EXIT> stop before "
3544 "actual signal death. This may be changed in the future; B<SIGKILL> is meant "
3545 "to always immediately kill tasks even under ptrace. Last confirmed on "
3550 #: build/C/man2/ptrace.2:1730
3552 "B<gdb>(1), B<strace>(1), B<clone>(2), B<execve>(2), B<fork>(2), "
3553 "B<gettid>(2), B<sigaction>(2), B<tgkill>(2), B<vfork>(2), B<waitpid>(2), "
3554 "B<exec>(3), B<capabilities>(7), B<signal>(7)"
3558 #: build/C/man2/quotactl.2:25
3564 #: build/C/man2/quotactl.2:25
3570 #: build/C/man2/quotactl.2:28
3571 msgid "quotactl - manipulate disk quotas"
3575 #: build/C/man2/quotactl.2:32
3578 "B<#include E<lt>sys/quota.hE<gt>>\n"
3579 "B<#include E<lt>xfs/xqm.hE<gt>>\n"
3583 #: build/C/man2/quotactl.2:35
3586 "B<int quotactl(int >I<cmd>B<, const char *>I<special>B<, int >I<id>B<, "
3587 "caddr_t >I<addr>B<);>\n"
3591 #: build/C/man2/quotactl.2:47
3593 "The quota system can be used to set per-user and per-group limits on the "
3594 "amount of disk space used on a file system. For each user and/or group, a "
3595 "soft limit and a hard limit can be set for each file system. The hard limit "
3596 "can't be exceeded. The soft limit can be exceeded, but warnings will "
3597 "ensue. Moreover, the user can't exceed the soft limit for more than one "
3598 "week (by default) at a time; after this time, the soft limit counts as a "
3603 #: build/C/man2/quotactl.2:72
3605 "The B<quotactl>() call manipulates disk quotas. The I<cmd> argument "
3606 "indicates a command to be applied to the user or group ID specified in "
3607 "I<id>. To initialize the I<cmd> argument, use the I<QCMD(subcmd, type)> "
3608 "macro. The I<type> value is either B<USRQUOTA>, for user quotas, or "
3609 "B<GRPQUOTA>, for group quotas. The I<subcmd> value is described below."
3613 #: build/C/man2/quotactl.2:77
3615 "The I<special> argument is a pointer to a null-terminated string containing "
3616 "the pathname of the (mounted) block special device for the file system being "
3621 #: build/C/man2/quotactl.2:85
3623 "The I<addr> argument is the address of an optional, command-specific, data "
3624 "structure that is copied in or out of the system. The interpretation of "
3625 "I<addr> is given with each command below."
3629 #: build/C/man2/quotactl.2:89
3630 msgid "The I<subcmd> value is one of the following:"
3634 #: build/C/man2/quotactl.2:89
3636 msgid "B<Q_QUOTAON>"
3640 #: build/C/man2/quotactl.2:96
3642 "Turn on quotas for a file system. The I<id> argument is the identification "
3643 "number of the quota format to be used. Currently, there are three supported "
3648 #: build/C/man2/quotactl.2:97
3650 msgid "B<QFMT_VFS_OLD>"
3654 #: build/C/man2/quotactl.2:100
3655 msgid "The original quota format."
3659 #: build/C/man2/quotactl.2:100
3661 msgid "B<QFMT_VFS_V0>"
3665 #: build/C/man2/quotactl.2:104
3667 "The standard VFS v0 quota format, which can handle 32-bit UIDs and GIDs and "
3668 "quota limits up to 2^42 bytes and 2^32 inodes."
3672 #: build/C/man2/quotactl.2:104
3674 msgid "B<QFMT_VFS_V1>"
3678 #: build/C/man2/quotactl.2:108
3680 "A quota format that can handle 32-bit UIDs and GIDs and quota limits of 2^64 "
3681 "bytes and 2^64 inodes."
3685 #: build/C/man2/quotactl.2:119
3687 "The I<addr> argument points to the pathname of a file containing the quotas "
3688 "for the file system. The quota file must exist; it is normally created with "
3689 "the B<quotacheck>(8) program. This operation requires privilege "
3690 "(B<CAP_SYS_ADMIN>)."
3694 #: build/C/man2/quotactl.2:119
3696 msgid "B<Q_QUOTAOFF>"
3700 #: build/C/man2/quotactl.2:129
3702 "Turn off quotas for a file system. The I<addr> and I<id> arguments are "
3703 "ignored. This operation requires privilege (B<CAP_SYS_ADMIN>)."
3707 #: build/C/man2/quotactl.2:129
3709 msgid "B<Q_GETQUOTA>"
3713 #: build/C/man2/quotactl.2:140
3715 "Get disk quota limits and current usage for user or group I<id>. The "
3716 "I<addr> argument is a pointer to a I<dqblk> structure defined in "
3717 "I<E<lt>sys/quota.hE<gt>> as follows:"
3721 #: build/C/man2/quotactl.2:145 build/C/man2/quotactl.2:232
3724 "/* uint64_t is an unsigned 64-bit integer;\n"
3725 " uint32_t is an unsigned 32-bit integer */\n"
3729 #: build/C/man2/quotactl.2:165
3732 "struct dqblk { /* Definition since Linux 2.4.22 */\n"
3733 " uint64_t dqb_bhardlimit; /* absolute limit on disk\n"
3734 " quota blocks alloc */\n"
3735 " uint64_t dqb_bsoftlimit; /* preferred limit on\n"
3736 " disk quota blocks */\n"
3737 " uint64_t dqb_curspace; /* current quota block\n"
3739 " uint64_t dqb_ihardlimit; /* maximum number of\n"
3740 " allocated inodes */\n"
3741 " uint64_t dqb_isoftlimit; /* preferred inode limit */\n"
3742 " uint64_t dqb_curinodes; /* current number of\n"
3743 " allocated inodes */\n"
3744 " uint64_t dqb_btime; /* time limit for excessive\n"
3746 " uint64_t dqb_itime; /* time limit for excessive\n"
3748 " uint32_t dqb_valid; /* bit mask of QIF_*\n"
3754 #: build/C/man2/quotactl.2:168
3757 "/* Flags in dqb_valid that indicate which fields in\n"
3758 " dqblk structure are valid. */\n"
3762 #: build/C/man2/quotactl.2:179
3765 "#define QIF_BLIMITS 1\n"
3766 "#define QIF_SPACE 2\n"
3767 "#define QIF_ILIMITS 4\n"
3768 "#define QIF_INODES 8\n"
3769 "#define QIF_BTIME 16\n"
3770 "#define QIF_ITIME 32\n"
3771 "#define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS)\n"
3772 "#define QIF_USAGE (QIF_SPACE | QIF_INODES)\n"
3773 "#define QIF_TIMES (QIF_BTIME | QIF_ITIME)\n"
3774 "#define QIF_ALL (QIF_LIMITS | QIF_USAGE | QIF_TIMES)\n"
3778 #: build/C/man2/quotactl.2:196
3780 "The I<dqb_valid> field is a bit mask that is set to indicate the entries in "
3781 "the I<dqblk> structure that are valid. Currently, the kernel fills in all "
3782 "entries of the I<dqblk> structure and marks them as valid in the "
3783 "I<dqb_valid> field. Unprivileged users may retrieve only their own quotas; "
3784 "a privileged user (B<CAP_SYS_ADMIN>) can retrieve the quotas of any user."
3788 #: build/C/man2/quotactl.2:196
3790 msgid "B<Q_SETQUOTA>"
3794 #: build/C/man2/quotactl.2:216
3796 "Set quota information for user or group I<id>, using the information "
3797 "supplied in the I<dqblk> structure pointed to by I<addr>. The I<dqb_valid> "
3798 "field of the I<dqblk> structure indicates which entries in the structure "
3799 "have been set by the caller. This operation supersedes the B<Q_SETQLIM> and "
3800 "B<Q_SETUSE> operations in the previous quota interfaces. This operation "
3801 "requires privilege (B<CAP_SYS_ADMIN>)."
3805 #: build/C/man2/quotactl.2:216
3807 msgid "B<Q_GETINFO>"
3811 #: build/C/man2/quotactl.2:227
3813 "Get information (like grace times) about quotafile. The I<addr> argument "
3814 "should be a pointer to a I<dqinfo> structure. This structure is defined in "
3815 "I<E<lt>sys/quota.hE<gt>> as follows:"
3819 #: build/C/man2/quotactl.2:236
3822 "struct dqinfo { /* Defined since kernel 2.4.22 */\n"
3823 " uint64_t dqi_bgrace; /* Time before block soft limit\n"
3824 " becomes hard limit */\n"
3828 #: build/C/man2/quotactl.2:243
3831 " uint64_t dqi_igrace; /* Time before inode soft limit\n"
3832 " becomes hard limit */\n"
3833 " uint32_t dqi_flags; /* Flags for quotafile\n"
3835 " uint32_t dqi_valid;\n"
3840 #: build/C/man2/quotactl.2:245
3842 msgid "/* Bits for dqi_flags */\n"
3846 #: build/C/man2/quotactl.2:247
3848 msgid "/* Quota format QFMT_VFS_OLD */\n"
3852 #: build/C/man2/quotactl.2:249
3854 msgid "#define V1_DQF_RSQUASH\t1 /* Root squash enabled */\n"
3858 #: build/C/man2/quotactl.2:251
3860 msgid "/* Other quota formats have no dqi_flags bits defined */\n"
3864 #: build/C/man2/quotactl.2:254
3867 "/* Flags in dqi_valid that indicate which fields in\n"
3868 " dqinfo structure are valid. */\n"
3872 #: build/C/man2/quotactl.2:259
3875 "# define IIF_BGRACE\t1\n"
3876 "# define IIF_IGRACE\t2\n"
3877 "# define IIF_FLAGS\t4\n"
3878 "# define IIF_ALL\t(IIF_BGRACE | IIF_IGRACE | IIF_FLAGS)\n"
3882 #: build/C/man2/quotactl.2:275
3884 "The I<dqi_valid> field in the I<dqinfo> structure indicates the entries in "
3885 "the structure that are valid. Currently, the kernel fills in all entries of "
3886 "the I<dqinfo> structure and marks them all as valid in the I<dqi_valid> "
3887 "field. The I<id> argument is ignored."
3891 #: build/C/man2/quotactl.2:275
3893 msgid "B<Q_SETINFO>"
3897 #: build/C/man2/quotactl.2:299
3899 "Set information about quotafile. The I<addr> argument should be a pointer "
3900 "to a I<dqinfo> structure. The I<dqi_valid> field of the I<dqinfo> structure "
3901 "indicates the entries in the structure that have been set by the caller. "
3902 "This operation supersedes the B<Q_SETGRACE> and B<Q_SETFLAGS> operations in "
3903 "the previous quota interfaces. The I<id> argument is ignored. This "
3904 "operation requires privilege (B<CAP_SYS_ADMIN>)."
3908 #: build/C/man2/quotactl.2:299
3914 #: build/C/man2/quotactl.2:306
3916 "Get quota format used on the specified file system. The I<addr> argument "
3917 "should be a pointer to a 4-byte buffer where the format number will be "
3922 #: build/C/man2/quotactl.2:306
3928 #: build/C/man2/quotactl.2:317
3930 "Update the on-disk copy of quota usages for a file system. If I<special> is "
3931 "NULL, then all file systems with active quotas are sync'ed. The I<addr> and "
3932 "I<id> arguments are ignored."
3936 #: build/C/man2/quotactl.2:317
3938 msgid "B<Q_GETSTATS>"
3941 #. Q_GETSTATS was removed in kernel 2.4.22.
3943 #: build/C/man2/quotactl.2:337
3945 "Get statistics and other generic information about the quota subsystem. The "
3946 "I<addr> argument should be a pointer to a I<dqstats> structure in which data "
3947 "should be stored. This structure is defined in I<E<lt>sys/quota.hE<gt>.> "
3948 "The I<special> and I<id> arguments are ignored. This operation is obsolete "
3949 "and not supported by recent kernels. Files in I</proc/sys/fs/quota/> carry "
3950 "the information instead."
3954 #: build/C/man2/quotactl.2:340
3956 "For XFS file systems making use of the XFS Quota Manager (XQM), the above "
3957 "commands are bypassed and the following commands are used:"
3961 #: build/C/man2/quotactl.2:340
3963 msgid "B<Q_XQUOTAON>"
3967 #: build/C/man2/quotactl.2:361
3969 "Turn on quotas for an XFS file system. XFS provides the ability to turn "
3970 "on/off quota limit enforcement with quota accounting. Therefore, XFS "
3971 "expects I<addr> to be a pointer to an I<unsigned int> that contains either "
3972 "the flags B<XFS_QUOTA_UDQ_ACCT> and/or B<XFS_QUOTA_UDQ_ENFD> (for user "
3973 "quota), or B<XFS_QUOTA_GDQ_ACCT> and/or B<XFS_QUOTA_GDQ_ENFD> (for group "
3974 "quota), as defined in I<E<lt>xfs/xqm.hE<gt>>. This operation requires "
3975 "privilege (B<CAP_SYS_ADMIN>)."
3979 #: build/C/man2/quotactl.2:361
3981 msgid "B<Q_XQUOTAOFF>"
3985 #: build/C/man2/quotactl.2:372
3987 "Turn off quotas for an XFS file system. As with B<Q_QUOTAON>, XFS file "
3988 "systems expect a pointer to an I<unsigned int> that specifies whether quota "
3989 "accounting and/or limit enforcement need to be turned off. This operation "
3990 "requires privilege (B<CAP_SYS_ADMIN>)."
3994 #: build/C/man2/quotactl.2:372
3996 msgid "B<Q_XGETQUOTA>"
4000 #: build/C/man2/quotactl.2:386
4002 "Get disk quota limits and current usage for user I<id>. The I<addr> "
4003 "argument is a pointer to an I<fs_disk_quota> structure (defined in "
4004 "I<E<lt>xfs/xqm.hE<gt>>). Unprivileged users may retrieve only their own "
4005 "quotas; a privileged user (B<CAP_SYS_ADMIN>) may retrieve the quotas of any "
4010 #: build/C/man2/quotactl.2:386
4012 msgid "B<Q_XSETQLIM>"
4016 #: build/C/man2/quotactl.2:398
4018 "Set disk quota limits for user I<id>. The I<addr> argument is a pointer to "
4019 "an I<fs_disk_quota> structure (defined in I<E<lt>xfs/xqm.hE<gt>>). This "
4020 "operation requires privilege (B<CAP_SYS_ADMIN>)."
4024 #: build/C/man2/quotactl.2:398
4026 msgid "B<Q_XGETQSTAT>"
4030 #: build/C/man2/quotactl.2:406
4032 "Returns an I<fs_quota_stat> structure containing XFS file system specific "
4033 "quota information. This is useful for finding out how much space is used to "
4034 "store quota information, and also to get quotaon/off status of a given local "
4039 #: build/C/man2/quotactl.2:406
4041 msgid "B<Q_XQUOTARM>"
4045 #: build/C/man2/quotactl.2:410
4047 "Free the disk space taken by disk quotas. Quotas must have already been "
4052 #: build/C/man2/quotactl.2:417
4054 "There is no command equivalent to B<Q_SYNC> for XFS since B<sync>(1) writes "
4055 "quota information to disk (in addition to the other file system metadata "
4056 "that it writes out)."
4060 #: build/C/man2/quotactl.2:417
4062 msgid "RETURN VALUES"
4066 #: build/C/man2/quotactl.2:425
4068 "On success, B<quotactl>() returns 0; on error -1 is returned, and I<errno> "
4069 "is set to indicate the error."
4073 #: build/C/man2/quotactl.2:432
4074 msgid "I<addr> or I<special> is invalid."
4078 #: build/C/man2/quotactl.2:438
4079 msgid "I<cmd> or I<type> is invalid."
4083 #: build/C/man2/quotactl.2:438
4089 #: build/C/man2/quotactl.2:445
4090 msgid "The file specified by I<special> or I<addr> does not exist."
4094 #: build/C/man2/quotactl.2:450
4095 msgid "The kernel has not been compiled with the B<CONFIG_QUOTA> option."
4099 #: build/C/man2/quotactl.2:450
4105 #: build/C/man2/quotactl.2:454
4106 msgid "I<special> is not a block device."
4110 #: build/C/man2/quotactl.2:459
4112 "The caller lacked the required privilege (B<CAP_SYS_ADMIN>) for the "
4113 "specified operation."
4117 #: build/C/man2/quotactl.2:463
4119 "No disk quota is found for the indicated user. Quotas have not been turned "
4120 "on for this file system."
4124 #: build/C/man2/quotactl.2:472
4125 msgid "If I<cmd> is B<Q_SETQUOTA>, B<quotactl>() may also set I<errno> to:"
4129 #: build/C/man2/quotactl.2:475
4130 msgid "Specified limits are out of range allowed by quota format."
4134 #: build/C/man2/quotactl.2:484
4135 msgid "If I<cmd> is B<Q_QUOTAON>, B<quotactl>() may also set I<errno> to:"
4139 #: build/C/man2/quotactl.2:493
4141 "The quota file pointed to by I<addr> exists, but is not a regular file; or, "
4142 "the quota file pointed to by I<addr> exists, but is not on the file system "
4143 "pointed to by I<special>."
4147 #: build/C/man2/quotactl.2:499
4148 msgid "B<Q_QUOTAON> attempted, but another B<Q_QUOTAON> had already been performed."
4152 #: build/C/man2/quotactl.2:502
4153 msgid "The quota file is corrupted."
4157 #: build/C/man2/quotactl.2:505
4158 msgid "Specified quota format was not found."
4162 #: build/C/man2/quotactl.2:510
4163 msgid "B<quota>(1), B<getrlimit>(2), B<quotacheck>(8), B<quotaon>(8)"
4167 #: build/C/man2/sendfile.2:15
4173 #: build/C/man2/sendfile.2:15
4179 #: build/C/man2/sendfile.2:18
4180 msgid "sendfile - transfer data between file descriptors"
4184 #: build/C/man2/sendfile.2:20
4185 msgid "B<#include E<lt>sys/sendfile.hE<gt>>"
4188 #. The below is too ugly. Comments about glibc versions belong
4189 #. in the notes, not in the header.
4191 #. .B #include <features.h>
4193 #. .B #if (__GLIBC__==2 && __GLIBC_MINOR__>=1) || __GLIBC__>2
4195 #. .B #include <sys/sendfile.h>
4199 #. .B #include <sys/types.h>
4201 #. .B /* No system prototype before glibc 2.1. */
4203 #. .BI "ssize_t sendfile(int" " out_fd" ", int" " in_fd" ", off_t *" \
4204 #. offset ", size_t" " count" )
4208 #: build/C/man2/sendfile.2:43
4210 "B<ssize_t sendfile(int>I< out_fd>B<, int>I< in_fd>B<, off_t *>I<offset>B<, "
4211 "size_t>I< count>B<);>"
4215 #: build/C/man2/sendfile.2:53
4217 "B<sendfile>() copies data between one file descriptor and another. Because "
4218 "this copying is done within the kernel, B<sendfile>() is more efficient "
4219 "than the combination of B<read>(2) and B<write>(2), which would require "
4220 "transferring data to and from user space."
4224 #: build/C/man2/sendfile.2:58
4226 "I<in_fd> should be a file descriptor opened for reading and I<out_fd> should "
4227 "be a descriptor opened for writing."
4231 #: build/C/man2/sendfile.2:79
4233 "If I<offset> is not NULL, then it points to a variable holding the file "
4234 "offset from which B<sendfile>() will start reading data from I<in_fd>. "
4235 "When B<sendfile>() returns, this variable will be set to the offset of the "
4236 "byte following the last byte that was read. If I<offset> is not NULL, then "
4237 "B<sendfile>() does not modify the current file offset of I<in_fd>; "
4238 "otherwise the current file offset is adjusted to reflect the number of bytes "
4239 "read from I<in_fd>."
4243 #: build/C/man2/sendfile.2:86
4245 "If I<offset> is NULL, then data will be read from I<in_fd> starting at the "
4246 "current file offset, and the file offset will be updated by the call."
4250 #: build/C/man2/sendfile.2:89
4251 msgid "I<count> is the number of bytes to copy between the file descriptors."
4255 #: build/C/man2/sendfile.2:96
4257 "The I<in_fd> argument must correspond to a file which supports "
4258 "B<mmap>(2)-like operations (i.e., it cannot be a socket)."
4262 #: build/C/man2/sendfile.2:104
4264 "In Linux kernels before 2.6.33, I<out_fd> must refer to a socket. Since "
4265 "Linux 2.6.33 it can be any file. If it is a regular file, then "
4266 "B<sendfile>() changes the file offset appropriately."
4270 #: build/C/man2/sendfile.2:111
4272 "If the transfer was successful, the number of bytes written to I<out_fd> is "
4273 "returned. On error, -1 is returned, and I<errno> is set appropriately."
4277 #: build/C/man2/sendfile.2:117
4279 "Nonblocking I/O has been selected using B<O_NONBLOCK> and the write would "
4284 #: build/C/man2/sendfile.2:117 build/C/man2/splice.2:143 build/C/man2/vmsplice.2:123
4290 #: build/C/man2/sendfile.2:121
4292 "The input file was not opened for reading or the output file was not opened "
4297 #: build/C/man2/sendfile.2:124
4298 msgid "Bad address."
4302 #: build/C/man2/sendfile.2:130
4304 "Descriptor is not valid or locked, or an B<mmap>(2)-like operation is not "
4305 "available for I<in_fd>."
4309 #: build/C/man2/sendfile.2:134
4310 msgid "Unspecified error while reading from I<in_fd>."
4314 #: build/C/man2/sendfile.2:138
4315 msgid "Insufficient memory to read from I<in_fd>."
4319 #: build/C/man2/sendfile.2:144
4321 "B<sendfile>() is a new feature in Linux 2.2. The include file "
4322 "I<E<lt>sys/sendfile.hE<gt>> is present since glibc 2.1."
4326 #: build/C/man2/sendfile.2:146
4327 msgid "Not specified in POSIX.1-2001, or other standards."
4331 #: build/C/man2/sendfile.2:151
4333 "Other UNIX systems implement B<sendfile>() with different semantics and "
4334 "prototypes. It should not be used in portable programs."
4338 #: build/C/man2/sendfile.2:161
4340 "If you plan to use B<sendfile>() for sending files to a TCP socket, but "
4341 "need to send some header data in front of the file contents, you will find "
4342 "it useful to employ the B<TCP_CORK> option, described in B<tcp>(7), to "
4343 "minimize the number of packets and to tune performance."
4347 #: build/C/man2/sendfile.2:167
4349 "In Linux 2.4 and earlier, I<out_fd> could also refer to a regular file, and "
4350 "B<sendfile>() changed the current offset of that file."
4354 #: build/C/man2/sendfile.2:179
4356 "The original Linux B<sendfile>() system call was not designed to handle "
4357 "large file offsets. Consequently, Linux 2.4 added B<sendfile64>(), with a "
4358 "wider type for the I<offset> argument. The glibc B<sendfile>() wrapper "
4359 "function transparently deals with the kernel differences."
4363 #: build/C/man2/sendfile.2:188
4365 "Applications may wish to fall back to B<read>(2)/B<write>(2) in the case "
4366 "where B<sendfile>() fails with B<EINVAL> or B<ENOSYS>."
4370 #: build/C/man2/sendfile.2:193
4372 "The Linux-specific B<splice>(2) call supports transferring data between "
4373 "arbitrary files (e.g., a pair of sockets)."
4377 #: build/C/man2/sendfile.2:198
4378 msgid "B<mmap>(2), B<open>(2), B<socket>(2), B<splice>(2)"
4382 #: build/C/man2/set_tid_address.2:23
4384 msgid "SET_TID_ADDRESS"
4388 #: build/C/man2/set_tid_address.2:23
4394 #: build/C/man2/set_tid_address.2:26
4395 msgid "set_tid_address - set pointer to thread ID"
4399 #: build/C/man2/set_tid_address.2:29
4401 msgid "B<#include E<lt>linux/unistd.hE<gt>>\n"
4405 #: build/C/man2/set_tid_address.2:31
4407 msgid "B<long set_tid_address(int *>I<tidptr>B<);>\n"
4411 #: build/C/man2/set_tid_address.2:38
4413 "The kernel keeps for each process two values called I<set_child_tid> and "
4414 "I<clear_child_tid> that are NULL by default."
4418 #: build/C/man2/set_tid_address.2:38
4420 msgid "set_child_tid"
4424 #: build/C/man2/set_tid_address.2:48
4426 "If a process is started using B<clone>(2) with the B<CLONE_CHILD_SETTID> "
4427 "flag, I<set_child_tid> is set to I<child_tidptr>, the fifth argument of that "
4432 #: build/C/man2/set_tid_address.2:53
4434 "When I<set_child_tid> is set, the very first thing the new process does is "
4435 "writing its PID at this address."
4439 #: build/C/man2/set_tid_address.2:53
4441 msgid "clear_child_tid"
4445 #: build/C/man2/set_tid_address.2:63
4447 "If a process is started using B<clone>(2) with the B<CLONE_CHILD_CLEARTID> "
4448 "flag, I<clear_child_tid> is set to I<child_tidptr>, the fifth argument of "
4453 #: build/C/man2/set_tid_address.2:70
4455 "The system call B<set_tid_address>() sets the I<clear_child_tid> value for "
4456 "the calling process to I<tidptr>."
4460 #: build/C/man2/set_tid_address.2:80
4462 "When I<clear_child_tid> is set, and the process exits, and the process was "
4463 "sharing memory with other processes or threads, then 0 is written at this "
4464 "address, and a I<futex(child_tidptr, FUTEX_WAKE, 1, NULL, NULL, 0);> call is "
4465 "done. (That is, wake a single process waiting on this futex.) Errors are "
4470 #: build/C/man2/set_tid_address.2:83
4471 msgid "B<set_tid_address>() always returns the PID of the calling process."
4475 #: build/C/man2/set_tid_address.2:86
4476 msgid "B<set_tid_address>() always succeeds."
4480 #: build/C/man2/set_tid_address.2:89
4482 "This call is present since Linux 2.5.48. Details as given here are valid "
4483 "since Linux 2.5.49."
4487 #: build/C/man2/set_tid_address.2:94
4488 msgid "B<clone>(2), B<futex>(2)"
4492 #: build/C/man2/splice.2:26
4498 #: build/C/man2/splice.2:26 build/C/man2/tee.2:26 build/C/man2/vmsplice.2:26
4504 #: build/C/man2/splice.2:29
4505 msgid "splice - splice data to/from a pipe"
4509 #: build/C/man2/splice.2:33 build/C/man2/tee.2:33
4512 "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n"
4513 "B<#include E<lt>fcntl.hE<gt>>\n"
4516 #. Return type was long before glibc 2.7
4518 #: build/C/man2/splice.2:38
4521 "B<ssize_t splice(int >I<fd_in>B<, loff_t *>I<off_in>B<, int >I<fd_out>B<,>\n"
4522 "B< loff_t *>I<off_out>B<, size_t >I<len>B<, unsigned int "
4527 #: build/C/man2/splice.2:50
4529 "B<splice>() moves data between two file descriptors without copying between "
4530 "kernel address space and user address space. It transfers up to I<len> "
4531 "bytes of data from the file descriptor I<fd_in> to the file descriptor "
4532 "I<fd_out>, where one of the descriptors must refer to a pipe."
4536 #: build/C/man2/splice.2:80
4538 "If I<fd_in> refers to a pipe, then I<off_in> must be NULL. If I<fd_in> does "
4539 "not refer to a pipe and I<off_in> is NULL, then bytes are read from I<fd_in> "
4540 "starting from the current file offset, and the current file offset is "
4541 "adjusted appropriately. If I<fd_in> does not refer to a pipe and I<off_in> "
4542 "is not NULL, then I<off_in> must point to a buffer which specifies the "
4543 "starting offset from which bytes will be read from I<fd_in>; in this case, "
4544 "the current file offset of I<fd_in> is not changed. Analogous statements "
4545 "apply for I<fd_out> and I<off_out>."
4549 #: build/C/man2/splice.2:85 build/C/man2/vmsplice.2:78
4551 "The I<flags> argument is a bit mask that is composed by ORing together zero "
4552 "or more of the following values:"
4556 #: build/C/man2/splice.2:85 build/C/man2/tee.2:62 build/C/man2/vmsplice.2:78
4558 msgid "B<SPLICE_F_MOVE>"
4562 #: build/C/man2/splice.2:98
4564 "Attempt to move pages instead of copying. This is only a hint to the "
4565 "kernel: pages may still be copied if the kernel cannot move the pages from "
4566 "the pipe, or if the pipe buffers don't refer to full pages. The initial "
4567 "implementation of this flag was buggy: therefore starting in Linux 2.6.21 it "
4568 "is a no-op (but is still permitted in a B<splice>() call); in the future, a "
4569 "correct implementation may be restored."
4573 #: build/C/man2/splice.2:98 build/C/man2/tee.2:68 build/C/man2/vmsplice.2:84
4575 msgid "B<SPLICE_F_NONBLOCK>"
4579 #: build/C/man2/splice.2:107
4581 "Do not block on I/O. This makes the splice pipe operations nonblocking, but "
4582 "B<splice>() may nevertheless block because the file descriptors that are "
4583 "spliced to/from may block (unless they have the B<O_NONBLOCK> flag set)."
4587 #: build/C/man2/splice.2:107 build/C/man2/tee.2:73 build/C/man2/vmsplice.2:91
4589 msgid "B<SPLICE_F_MORE>"
4593 #: build/C/man2/splice.2:121
4595 "More data will be coming in a subsequent splice. This is a helpful hint "
4596 "when the I<fd_out> refers to a socket (see also the description of "
4597 "B<MSG_MORE> in B<send>(2), and the description of B<TCP_CORK> in B<tcp>(7))"
4601 #: build/C/man2/splice.2:121 build/C/man2/tee.2:79 build/C/man2/vmsplice.2:97
4603 msgid "B<SPLICE_F_GIFT>"
4607 #: build/C/man2/splice.2:127
4608 msgid "Unused for B<splice>(); see B<vmsplice>(2)."
4612 #: build/C/man2/splice.2:136
4614 "Upon successful completion, B<splice>() returns the number of bytes spliced "
4615 "to or from the pipe. A return value of 0 means that there was no data to "
4616 "transfer, and it would not make sense to block, because there are no writers "
4617 "connected to the write end of the pipe referred to by I<fd_in>."
4621 #: build/C/man2/splice.2:142
4622 msgid "On error, B<splice>() returns -1 and I<errno> is set to indicate the error."
4626 #: build/C/man2/splice.2:147
4628 "One or both file descriptors are not valid, or do not have proper read-write "
4632 #. The append-mode error is given since 2.6.27; in earlier kernels,
4633 #. splice() in append mode was broken
4635 #: build/C/man2/splice.2:155
4637 "Target file system doesn't support splicing; target file is opened in append "
4638 "mode; neither of the descriptors refers to a pipe; or offset given for "
4639 "nonseekable device."
4643 #: build/C/man2/splice.2:158 build/C/man2/tee.2:114 build/C/man2/vmsplice.2:138
4644 msgid "Out of memory."
4648 #: build/C/man2/splice.2:158
4654 #: build/C/man2/splice.2:165
4656 "Either I<off_in> or I<off_out> was not NULL, but the corresponding file "
4657 "descriptor refers to a pipe."
4661 #: build/C/man2/splice.2:169
4662 msgid "The B<splice>() system call first appeared in Linux 2.6.17."
4666 #: build/C/man2/splice.2:181
4668 "The three system calls B<splice>(), B<vmsplice>(2), and B<tee>(2), provide "
4669 "userspace programs with full control over an arbitrary kernel buffer, "
4670 "implemented within the kernel using the same type of buffer that is used for "
4671 "a pipe. In overview, these system calls perform the following tasks:"
4675 #: build/C/man2/splice.2:181
4681 #: build/C/man2/splice.2:185
4683 "moves data from the buffer to an arbitrary file descriptor, or vice versa, "
4684 "or from one buffer to another."
4688 #: build/C/man2/splice.2:185
4694 #: build/C/man2/splice.2:188
4695 msgid "\"copies\" the data from one buffer to another."
4699 #: build/C/man2/splice.2:188
4701 msgid "B<vmsplice>(2)"
4705 #: build/C/man2/splice.2:191
4706 msgid "\"copies\" data from user space into the buffer."
4710 #. Linus: Now, imagine using the above in a media server, for example.
4711 #. Let's say that a year or two has passed, so that the video drivers
4712 #. have been updated to be able to do the splice thing, and what can
4715 #. - splice from the (mpeg or whatever - let's just assume that the video
4716 #. input is either digital or does the encoding on its own - like they
4717 #. pretty much all do) video input into a pipe (remember: no copies - the
4718 #. video input will just DMA directly into memory, and splice will just
4719 #. set up the pages in the pipe buffer)
4720 #. - tee that pipe to split it up
4721 #. - splice one end to a file (ie "save the compressed stream to disk")
4722 #. - splice the other end to a real-time video decoder window for your
4723 #. real-time viewing pleasure.
4725 #. Linus: Now, the advantage of splice()/tee() is that you can
4726 #. do zero-copy movement of data, and unlike sendfile() you can
4727 #. do it on _arbitrary_ data (and, as shown by "tee()", it's more
4728 #. than just sending the data to somebody else: you can duplicate
4729 #. the data and choose to forward it to two or more different
4730 #. users - for things like logging etc.).
4732 #: build/C/man2/splice.2:222
4734 "Though we talk of copying, actual copies are generally avoided. The kernel "
4735 "does this by implementing a pipe buffer as a set of reference-counted "
4736 "pointers to pages of kernel memory. The kernel creates \"copies\" of pages "
4737 "in a buffer by creating new pointers (for the output buffer) referring to "
4738 "the pages, and increasing the reference counts for the pages: only pointers "
4739 "are copied, not the pages of the buffer."
4743 #: build/C/man2/splice.2:222 build/C/man2/tee.2:129
4749 #: build/C/man2/splice.2:225
4750 msgid "See B<tee>(2)."
4754 #: build/C/man2/splice.2:229
4755 msgid "B<sendfile>(2), B<tee>(2), B<vmsplice>(2)"
4759 #: build/C/man2/tee.2:26
4765 #: build/C/man2/tee.2:29
4766 msgid "tee - duplicating pipe content"
4770 #: build/C/man2/tee.2:36
4773 "B<ssize_t tee(int >I<fd_in>B<, int >I<fd_out>B<, size_t >I<len>B<, unsigned "
4774 "int >I<flags>B<);>\n"
4777 #. Example programs http://brick.kernel.dk/snaps
4780 #. add a "tee(in, out1, out2)" system call that duplicates the pages
4781 #. (again, incrementing their reference count, not copying the data) from
4782 #. one pipe to two other pipes.
4784 #: build/C/man2/tee.2:56
4786 "B<tee>() duplicates up to I<len> bytes of data from the pipe referred to by "
4787 "the file descriptor I<fd_in> to the pipe referred to by the file descriptor "
4788 "I<fd_out>. It does not consume the data that is duplicated from I<fd_in>; "
4789 "therefore, that data can be copied by a subsequent B<splice>(2)."
4793 #: build/C/man2/tee.2:62
4795 "I<flags> is a series of modifier flags, which share the name space with "
4796 "B<splice>(2) and B<vmsplice>(2):"
4800 #: build/C/man2/tee.2:68
4801 msgid "Currently has no effect for B<tee>(); see B<splice>(2)."
4804 #. Not used for vmsplice
4805 #. May be in the future -- therefore EAGAIN
4807 #: build/C/man2/tee.2:73 build/C/man2/vmsplice.2:91
4808 msgid "Do not block on I/O; see B<splice>(2) for further details."
4812 #: build/C/man2/tee.2:79
4814 "Currently has no effect for B<tee>(), but may be implemented in the future; "
4819 #: build/C/man2/tee.2:85
4820 msgid "Unused for B<tee>(); see B<vmsplice>(2)."
4824 #: build/C/man2/tee.2:94
4826 "Upon successful completion, B<tee>() returns the number of bytes that were "
4827 "duplicated between the input and output. A return value of 0 means that "
4828 "there was no data to transfer, and it would not make sense to block, because "
4829 "there are no writers connected to the write end of the pipe referred to by "
4834 #: build/C/man2/tee.2:100
4835 msgid "On error, B<tee>() returns -1 and I<errno> is set to indicate the error."
4839 #: build/C/man2/tee.2:111
4841 "I<fd_in> or I<fd_out> does not refer to a pipe; or I<fd_in> and I<fd_out> "
4842 "refer to the same pipe."
4846 #: build/C/man2/tee.2:118
4847 msgid "The B<tee>() system call first appeared in Linux 2.6.17."
4851 #: build/C/man2/tee.2:129
4853 "Conceptually, B<tee>() copies the data between the two pipes. In reality "
4854 "no real data copying takes place though: under the covers, B<tee>() assigns "
4855 "data in the output by merely grabbing a reference to the input."
4859 #: build/C/man2/tee.2:135
4861 "The following example implements a basic B<tee>(1) program using the "
4862 "B<tee>() system call."
4866 #: build/C/man2/tee.2:144
4869 "#define _GNU_SOURCE\n"
4870 "#include E<lt>fcntl.hE<gt>\n"
4871 "#include E<lt>stdio.hE<gt>\n"
4872 "#include E<lt>stdlib.hE<gt>\n"
4873 "#include E<lt>unistd.hE<gt>\n"
4874 "#include E<lt>errno.hE<gt>\n"
4875 "#include E<lt>limits.hE<gt>\n"
4879 #: build/C/man2/tee.2:150
4883 "main(int argc, char *argv[])\n"
4890 #: build/C/man2/tee.2:155
4893 " if (argc != 2) {\n"
4894 " fprintf(stderr, \"Usage: %s E<lt>fileE<gt>\\en\", argv[0]);\n"
4895 " exit(EXIT_FAILURE);\n"
4900 #: build/C/man2/tee.2:161
4903 " fd = open(argv[1], O_WRONLY | O_CREAT | O_TRUNC, 0644);\n"
4904 " if (fd == -1) {\n"
4905 " perror(\"open\");\n"
4906 " exit(EXIT_FAILURE);\n"
4911 #: build/C/man2/tee.2:168
4916 " * tee stdin to stdout.\n"
4918 " len = tee(STDIN_FILENO, STDOUT_FILENO,\n"
4919 " INT_MAX, SPLICE_F_NONBLOCK);\n"
4923 #: build/C/man2/tee.2:177
4926 " if (len E<lt> 0) {\n"
4927 " if (errno == EAGAIN)\n"
4929 " perror(\"tee\");\n"
4930 " exit(EXIT_FAILURE);\n"
4937 #: build/C/man2/tee.2:191
4941 " * Consume stdin by splicing it to a file.\n"
4943 " while (len E<gt> 0) {\n"
4944 " slen = splice(STDIN_FILENO, NULL, fd, NULL,\n"
4945 " len, SPLICE_F_MOVE);\n"
4946 " if (slen E<lt> 0) {\n"
4947 " perror(\"splice\");\n"
4956 #: build/C/man2/tee.2:195
4960 " exit(EXIT_SUCCESS);\n"
4965 #: build/C/man2/tee.2:199
4966 msgid "B<splice>(2), B<vmsplice>(2)"
4970 #: build/C/man2/vm86.2:26
4976 #: build/C/man2/vm86.2:26
4982 #: build/C/man2/vm86.2:29
4983 msgid "vm86old, vm86 - enter virtual 8086 mode"
4987 #: build/C/man2/vm86.2:31
4988 msgid "B<#include E<lt>sys/vm86.hE<gt>>"
4992 #: build/C/man2/vm86.2:33
4993 msgid "B<int vm86old(struct vm86_struct *>I<info>B<);>"
4997 #: build/C/man2/vm86.2:35
4998 msgid "B<int vm86(unsigned long >I<fn>B<, struct vm86plus_struct *>I<v86>B<);>"
5002 #: build/C/man2/vm86.2:46
5004 "The system call B<vm86>() was introduced in Linux 0.97p2. In Linux 2.1.15 "
5005 "and 2.0.28 it was renamed to B<vm86old>(), and a new B<vm86>() was "
5006 "introduced. The definition of I<struct vm86_struct> was changed in 1.1.8 "
5011 #: build/C/man2/vm86.2:50
5013 "These calls cause the process to enter VM86 mode (virtual-8086 in Intel "
5014 "literature), and are used by B<dosemu>."
5018 #: build/C/man2/vm86.2:52
5019 msgid "VM86 mode is an emulation of real mode within a protected mode task."
5023 #: build/C/man2/vm86.2:62
5025 "This return value is specific to i386 and indicates a problem with getting "
5030 #: build/C/man2/vm86.2:66
5032 "This return value indicates the call is not implemented on the present "
5037 #: build/C/man2/vm86.2:71
5039 "Saved kernel stack exists. (This is a kernel sanity check; the saved stack "
5040 "should only exist within vm86 mode itself.)"
5044 #: build/C/man2/vm86.2:74
5046 "This call is specific to Linux on 32-bit Intel processors, and should not be "
5047 "used in programs intended to be portable."
5051 #: build/C/man2/vmsplice.2:26
5057 #: build/C/man2/vmsplice.2:29
5058 msgid "vmsplice - splice user pages into a pipe"
5062 #: build/C/man2/vmsplice.2:34
5065 "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n"
5066 "B<#include E<lt>fcntl.hE<gt>>\n"
5067 "B<#include E<lt>sys/uio.hE<gt>>\n"
5071 #: build/C/man2/vmsplice.2:37
5074 "B<ssize_t vmsplice(int >I<fd>B<, const struct iovec *>I<iov>B<,>\n"
5075 "B< unsigned long >I<nr_segs>B<, unsigned int "
5079 #. Linus: vmsplice() system call to basically do a "write to
5080 #. the buffer", but using the reference counting and VM traversal
5081 #. to actually fill the buffer. This means that the user needs to
5082 #. be careful not to reuse the user-space buffer it spliced into
5083 #. the kernel-space one (contrast this to "write()", which copies
5084 #. the actual data, and you can thus reuse the buffer immediately
5085 #. after a successful write), but that is often easy to do.
5087 #: build/C/man2/vmsplice.2:57
5089 "The B<vmsplice>() system call maps I<nr_segs> ranges of user memory "
5090 "described by I<iov> into a pipe. The file descriptor I<fd> must refer to a "
5095 #: build/C/man2/vmsplice.2:64
5097 "The pointer I<iov> points to an array of I<iovec> structures as defined in "
5098 "I<E<lt>sys/uio.hE<gt>>:"
5102 #: build/C/man2/vmsplice.2:71
5106 " void *iov_base; /* Starting address */\n"
5107 " size_t iov_len; /* Number of bytes */\n"
5112 #: build/C/man2/vmsplice.2:84
5113 msgid "Unused for B<vmsplice>(); see B<splice>(2)."
5117 #: build/C/man2/vmsplice.2:97
5119 "Currently has no effect for B<vmsplice>(), but may be implemented in the "
5120 "future; see B<splice>(2)."
5123 #. FIXME Explain the following line in a little more detail:
5124 #. .... if we expect to later SPLICE_F_MOVE to the cache.
5126 #: build/C/man2/vmsplice.2:113
5128 "The user pages are a gift to the kernel. The application may not modify "
5129 "this memory ever, or page cache and on-disk data may differ. Gifting pages "
5130 "to the kernel means that a subsequent B<splice>(2) B<SPLICE_F_MOVE> can "
5131 "successfully move the pages; if this flag is not specified, then a "
5132 "subsequent B<splice>(2) B<SPLICE_F_MOVE> must copy the pages. Data must "
5133 "also be properly page aligned, both in memory and length."
5137 #: build/C/man2/vmsplice.2:122
5139 "Upon successful completion, B<vmsplice>() returns the number of bytes "
5140 "transferred to the pipe. On error, B<vmsplice>() returns -1 and I<errno> "
5141 "is set to indicate the error."
5145 #: build/C/man2/vmsplice.2:127
5146 msgid "I<fd> either not valid, or doesn't refer to a pipe."
5150 #: build/C/man2/vmsplice.2:135
5152 "I<nr_segs> is 0 or greater than B<IOV_MAX>; or memory not aligned if "
5153 "B<SPLICE_F_GIFT> set."
5157 #: build/C/man2/vmsplice.2:142
5158 msgid "The B<vmsplice>() system call first appeared in Linux 2.6.17."
5162 #: build/C/man2/vmsplice.2:153
5164 "B<vmsplice>() follows the other vectorized read/write type functions when "
5165 "it comes to limitations on number of segments being passed in. This limit "
5166 "is B<IOV_MAX> as defined in I<E<lt>limits.hE<gt>>. At the time of this "
5167 "writing, that limit is 1024."
5171 #: build/C/man2/vmsplice.2:156
5172 msgid "B<splice>(2), B<tee>(2)"