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-05-01 04:38+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:49 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:49 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:50 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:52 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:59 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:1580 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:1594 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:1598 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:1609 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:1619 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:1637 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:1639 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:1746 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:1760 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:1767 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.40 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:1595 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:1612 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:1675
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:49
1700 #: build/C/man2/ptrace.2:49
1706 #: build/C/man2/ptrace.2:52
1707 msgid "ptrace - process trace"
1711 #: build/C/man2/ptrace.2:55
1713 msgid "B<#include E<lt>sys/ptrace.hE<gt>>\n"
1717 #: build/C/man2/ptrace.2:58
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:67
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:78
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:80
1747 msgid " ptrace(PTRACE_foo, pid, ...)\n"
1751 #: build/C/man2/ptrace.2:84
1752 msgid "where I<pid> is the thread ID of the corresponding Linux thread."
1756 #: build/C/man2/ptrace.2:90
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:99
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:116
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:126
1788 "If the B<PTRACE_O_TRACEEXEC> option is not in effect, all successful calls "
1789 "to B<execve>(2) by the traced process will cause it to be sent a B<SIGTRAP> "
1790 "signal, giving the parent a chance to gain control before the new program "
1795 #: build/C/man2/ptrace.2:130
1797 "When the tracer is finished tracing, it can cause the tracee to continue "
1798 "executing in a normal, untraced mode via B<PTRACE_DETACH>."
1802 #: build/C/man2/ptrace.2:134
1803 msgid "The value of I<request> determines the action to be performed:"
1807 #: build/C/man2/ptrace.2:134
1809 msgid "B<PTRACE_TRACEME>"
1813 #: build/C/man2/ptrace.2:144
1815 "Indicate that this process is to be traced by its parent. A process "
1816 "probably shouldn't make this request if its parent isn't expecting to trace "
1817 "it. (I<pid>, I<addr>, and I<data> are ignored.)"
1821 #: build/C/man2/ptrace.2:157
1823 "The B<PTRACE_TRACEME> request is used only by the tracee; the remaining "
1824 "requests are used only by the tracer. In the following requests, I<pid> "
1825 "specifies the thread ID of the tracee to be acted on. For requests other "
1826 "than B<PTRACE_ATTACH> and B<PTRACE_KILL>, the tracee must be stopped."
1830 #: build/C/man2/ptrace.2:157
1832 msgid "B<PTRACE_PEEKTEXT>, B<PTRACE_PEEKDATA>"
1836 #: build/C/man2/ptrace.2:168
1838 "Read a word at the address I<addr> in the tracee's memory, returning the "
1839 "word as the result of the B<ptrace>() call. Linux does not have separate "
1840 "text and data address spaces, so these two requests are currently "
1841 "equivalent. (I<data> is ignored.)"
1845 #: build/C/man2/ptrace.2:168
1847 msgid "B<PTRACE_PEEKUSER>"
1850 #. PTRACE_PEEKUSR in kernel source, but glibc uses PTRACE_PEEKUSER,
1851 #. and that is the name that seems common on other systems.
1853 #: build/C/man2/ptrace.2:186
1855 "Read a word at offset I<addr> in the tracee's USER area, which holds the "
1856 "registers and other information about the process (see "
1857 "I<E<lt>sys/user.hE<gt>>). The word is returned as the result of the "
1858 "B<ptrace>() call. Typically, the offset must be word-aligned, though this "
1859 "might vary by architecture. See NOTES. (I<data> is ignored.)"
1863 #: build/C/man2/ptrace.2:186
1865 msgid "B<PTRACE_POKETEXT>, B<PTRACE_POKEDATA>"
1869 #: build/C/man2/ptrace.2:198
1871 "Copy the word I<data> to the address I<addr> in the tracee's memory. As for "
1872 "B<PTRACE_PEEKTEXT> and B<PTRACE_PEEKDATA>, these two requests are currently "
1877 #: build/C/man2/ptrace.2:198
1879 msgid "B<PTRACE_POKEUSER>"
1882 #. PTRACE_POKEUSR in kernel source, but glibc uses PTRACE_POKEUSER,
1883 #. and that is the name that seems common on other systems.
1884 #. FIXME In the preceding sentence, which modifications are disallowed,
1885 #. and when they are disallowed, how does userspace discover that fact?
1887 #: build/C/man2/ptrace.2:214
1889 "Copy the word I<data> to offset I<addr> in the tracee's USER area. As for "
1890 "B<PTRACE_PEEKUSER>, the offset must typically be word-aligned. In order to "
1891 "maintain the integrity of the kernel, some modifications to the USER area "
1896 #: build/C/man2/ptrace.2:214
1898 msgid "B<PTRACE_GETREGS>, B<PTRACE_GETFPREGS>"
1902 #: build/C/man2/ptrace.2:233
1904 "Copy the tracee's general-purpose or floating-point registers, respectively, "
1905 "to the address I<data> in the tracer. See I<E<lt>sys/user.hE<gt>> for "
1906 "information on the format of this data. (I<addr> is ignored.) Note that "
1907 "SPARC systems have the meaning of I<data> and I<addr> reversed; that is, "
1908 "I<data> is ignored and the registers are copied to the address I<addr>."
1912 #: build/C/man2/ptrace.2:233
1914 msgid "B<PTRACE_GETSIGINFO> (since Linux 2.3.99-pre6)"
1918 #: build/C/man2/ptrace.2:245
1920 "Retrieve information about the signal that caused the stop. Copy a "
1921 "I<siginfo_t> structure (see B<sigaction>(2)) from the tracee to the address "
1922 "I<data> in the tracer. (I<addr> is ignored.)"
1926 #: build/C/man2/ptrace.2:245
1928 msgid "B<PTRACE_SETREGS>, B<PTRACE_SETFPREGS>"
1931 #. FIXME In the preceding sentence, which modifications are disallowed,
1932 #. and when they are disallowed, how does userspace discover that fact?
1934 #: build/C/man2/ptrace.2:266
1936 "Copy the tracee's general-purpose or floating-point registers, respectively, "
1937 "from the address I<data> in the tracer. As for B<PTRACE_POKEUSER>, some "
1938 "general-purpose register modifications may be disallowed. (I<addr> is "
1939 "ignored.) Note that SPARC systems have the meaning of I<data> and I<addr> "
1940 "reversed; that is, I<data> is ignored and the registers are copied from the "
1945 #: build/C/man2/ptrace.2:266
1947 msgid "B<PTRACE_SETSIGINFO> (since Linux 2.3.99-pre6)"
1951 #: build/C/man2/ptrace.2:282
1953 "Set signal information: copy a I<siginfo_t> structure from the address "
1954 "I<data> in the tracer to the tracee. This will affect only signals that "
1955 "would normally be delivered to the tracee and were caught by the tracer. It "
1956 "may be difficult to tell these normal signals from synthetic signals "
1957 "generated by B<ptrace>() itself. (I<addr> is ignored.)"
1961 #: build/C/man2/ptrace.2:282
1963 msgid "B<PTRACE_SETOPTIONS> (since Linux 2.4.6; see BUGS for caveats)"
1967 #: build/C/man2/ptrace.2:291
1969 "Set ptrace options from I<data>. (I<addr> is ignored.) I<data> is "
1970 "interpreted as a bit mask of options, which are specified by the following "
1975 #: build/C/man2/ptrace.2:292
1977 msgid "B<PTRACE_O_TRACESYSGOOD> (since Linux 2.4.6)"
1981 #: build/C/man2/ptrace.2:301
1983 "When delivering system call traps, set bit 7 in the signal number (i.e., "
1984 "deliver I<SIGTRAP|0x80>). This makes it easy for the tracer to distinguish "
1985 "normal traps from those caused by a system call. (B<PTRACE_O_TRACESYSGOOD> "
1986 "may not work on all architectures.)"
1990 #: build/C/man2/ptrace.2:301
1992 msgid "B<PTRACE_O_TRACEFORK> (since Linux 2.5.46)"
1996 #: build/C/man2/ptrace.2:313
1998 "Stop the tracee at the next B<fork>(2) and automatically start tracing the "
1999 "newly forked process, which will start with a B<SIGSTOP>. A B<waitpid>(2) "
2000 "by the tracer will return a I<status> value such that"
2004 #: build/C/man2/ptrace.2:316
2006 msgid " statusE<gt>E<gt>8 == (SIGTRAP | (PTRACE_EVENT_FORKE<lt>E<lt>8))\n"
2010 #: build/C/man2/ptrace.2:320 build/C/man2/ptrace.2:339 build/C/man2/ptrace.2:358
2011 msgid "The PID of the new process can be retrieved with B<PTRACE_GETEVENTMSG>."
2015 #: build/C/man2/ptrace.2:320
2017 msgid "B<PTRACE_O_TRACEVFORK> (since Linux 2.5.46)"
2021 #: build/C/man2/ptrace.2:332
2023 "Stop the tracee at the next B<vfork>(2) and automatically start tracing the "
2024 "newly vforked process, which will start with a B<SIGSTOP>. A B<waitpid>(2) "
2025 "by the tracer will return a I<status> value such that"
2029 #: build/C/man2/ptrace.2:335
2031 msgid " statusE<gt>E<gt>8 == (SIGTRAP | (PTRACE_EVENT_VFORKE<lt>E<lt>8))\n"
2035 #: build/C/man2/ptrace.2:339
2037 msgid "B<PTRACE_O_TRACECLONE> (since Linux 2.5.46)"
2041 #: build/C/man2/ptrace.2:351
2043 "Stop the tracee at the next B<clone>(2) and automatically start tracing the "
2044 "newly cloned process, which will start with a B<SIGSTOP>. A B<waitpid>(2) "
2045 "by the tracer will return a I<status> value such that"
2049 #: build/C/man2/ptrace.2:354
2051 msgid " statusE<gt>E<gt>8 == (SIGTRAP | (PTRACE_EVENT_CLONEE<lt>E<lt>8))\n"
2055 #: build/C/man2/ptrace.2:379
2057 "This option may not catch B<clone>(2) calls in all cases. If the tracee "
2058 "calls B<clone>(2) with the B<CLONE_VFORK> flag, B<PTRACE_EVENT_VFORK> will "
2059 "be delivered instead if B<PTRACE_O_TRACEVFORK> is set; otherwise if the "
2060 "tracee calls B<clone>(2) with the exit signal set to B<SIGCHLD>, "
2061 "B<PTRACE_EVENT_FORK> will be delivered if B<PTRACE_O_TRACEFORK> is set."
2065 #: build/C/man2/ptrace.2:379
2067 msgid "B<PTRACE_O_TRACEEXEC> (since Linux 2.5.46)"
2071 #: build/C/man2/ptrace.2:388
2073 "Stop the tracee at the next B<execve>(2). A B<waitpid>(2) by the tracer "
2074 "will return a I<status> value such that"
2078 #: build/C/man2/ptrace.2:391
2080 msgid " statusE<gt>E<gt>8 == (SIGTRAP | (PTRACE_EVENT_EXECE<lt>E<lt>8))\n"
2084 #: build/C/man2/ptrace.2:397
2086 "If the execing thread is not a thread group leader, the thread ID is reset "
2087 "to thread group leader's ID before this stop. Since Linux 3.0, the former "
2088 "thread ID can be retrieved with B<PTRACE_GETEVENTMSG>."
2092 #: build/C/man2/ptrace.2:397
2094 msgid "B<PTRACE_O_TRACEVFORKDONE> (since Linux 2.5.60)"
2098 #: build/C/man2/ptrace.2:406
2100 "Stop the tracee at the completion of the next B<vfork>(2). A B<waitpid>(2) "
2101 "by the tracer will return a I<status> value such that"
2105 #: build/C/man2/ptrace.2:409
2107 msgid " statusE<gt>E<gt>8 == (SIGTRAP | (PTRACE_EVENT_VFORK_DONEE<lt>E<lt>8))\n"
2111 #: build/C/man2/ptrace.2:413
2113 "The PID of the new process can (since Linux 2.6.18) be retrieved with "
2114 "B<PTRACE_GETEVENTMSG>."
2118 #: build/C/man2/ptrace.2:413
2120 msgid "B<PTRACE_O_TRACEEXIT> (since Linux 2.5.60)"
2124 #: build/C/man2/ptrace.2:421
2126 "Stop the tracee at exit. A B<waitpid>(2) by the tracer will return a "
2127 "I<status> value such that"
2131 #: build/C/man2/ptrace.2:424
2133 msgid " statusE<gt>E<gt>8 == (SIGTRAP | (PTRACE_EVENT_EXITE<lt>E<lt>8))\n"
2137 #: build/C/man2/ptrace.2:428
2138 msgid "The tracee's exit status can be retrieved with B<PTRACE_GETEVENTMSG>."
2142 #: build/C/man2/ptrace.2:436
2144 "The tracee is stopped early during process exit, when registers are still "
2145 "available, allowing the tracer to see where the exit occurred, whereas the "
2146 "normal exit notification is done after the process is finished exiting. "
2147 "Even though context is available, the tracer cannot prevent the exit from "
2148 "happening at this point."
2152 #: build/C/man2/ptrace.2:437
2154 msgid "B<PTRACE_GETEVENTMSG> (since Linux 2.5.46)"
2158 #: build/C/man2/ptrace.2:457
2160 "Retrieve a message (as an I<unsigned long>) about the ptrace event that "
2161 "just happened, placing it at the address I<data> in the tracer. For "
2162 "B<PTRACE_EVENT_EXIT>, this is the tracee's exit status. For "
2163 "B<PTRACE_EVENT_FORK>, B<PTRACE_EVENT_VFORK>, B<PTRACE_EVENT_VFORK_DONE>, and "
2164 "B<PTRACE_EVENT_CLONE>, this is the PID of the new process. (I<addr> is "
2169 #: build/C/man2/ptrace.2:457
2171 msgid "B<PTRACE_CONT>"
2175 #: build/C/man2/ptrace.2:469
2177 "Restart the stopped tracee process. If I<data> is nonzero, it is "
2178 "interpreted as the number of a signal to be delivered to the tracee; "
2179 "otherwise, no signal is delivered. Thus, for example, the tracer can "
2180 "control whether a signal sent to the tracee is delivered or not. (I<addr> "
2185 #: build/C/man2/ptrace.2:469
2187 msgid "B<PTRACE_SYSCALL>, B<PTRACE_SINGLESTEP>"
2191 #: build/C/man2/ptrace.2:493
2193 "Restart the stopped tracee as for B<PTRACE_CONT>, but arrange for the tracee "
2194 "to be stopped at the next entry to or exit from a system call, or after "
2195 "execution of a single instruction, respectively. (The tracee will also, as "
2196 "usual, be stopped upon receipt of a signal.) From the tracer's perspective, "
2197 "the tracee will appear to have been stopped by receipt of a B<SIGTRAP>. So, "
2198 "for B<PTRACE_SYSCALL>, for example, the idea is to inspect the arguments to "
2199 "the system call at the first stop, then do another B<PTRACE_SYSCALL> and "
2200 "inspect the return value of the system call at the second stop. The I<data> "
2201 "argument is treated as for B<PTRACE_CONT>. (I<addr> is ignored.)"
2205 #: build/C/man2/ptrace.2:493
2207 msgid "B<PTRACE_SYSEMU>, B<PTRACE_SYSEMU_SINGLESTEP> (since Linux 2.6.14)"
2211 #: build/C/man2/ptrace.2:511
2213 "For B<PTRACE_SYSEMU>, continue and stop on entry to the next system call, "
2214 "which will not be executed. For B<PTRACE_SYSEMU_SINGLESTEP>, do the same "
2215 "but also singlestep if not a system call. This call is used by programs "
2216 "like User Mode Linux that want to emulate all the tracee's system calls. "
2217 "The I<data> argument is treated as for B<PTRACE_CONT>. (I<addr> is ignored; "
2218 "not supported on all architectures.)"
2222 #: build/C/man2/ptrace.2:511
2224 msgid "B<PTRACE_KILL>"
2228 #: build/C/man2/ptrace.2:520
2230 "Send the tracee a B<SIGKILL> to terminate it. (I<addr> and I<data> are "
2234 #. [Note from Denys Vlasenko:
2235 #. deprecation suggested by Oleg Nesterov. He prefers to deprecate it
2236 #. instead of describing (and needing to support) PTRACE_KILL's quirks.]
2238 #: build/C/man2/ptrace.2:539
2240 "I<This operation is deprecated; do not use it!> Instead, send a B<SIGKILL> "
2241 "directly using B<kill>(2) or B<tgkill>(2). The problem with B<PTRACE_KILL> "
2242 "is that it requires the tracee to be in signal-delivery-stop, otherwise it "
2243 "may not work (i.e., may complete successfully but won't kill the tracee). "
2244 "By contrast, sending a B<SIGKILL> directly has no such limitation."
2248 #: build/C/man2/ptrace.2:539
2250 msgid "B<PTRACE_ATTACH>"
2253 #. No longer true (removed by Denys Vlasenko, 2011, who remarks:
2254 #. "I think it isn't true in non-ancient 2.4 and in 2.6/3.x.
2255 #. Basically, it's not true for any Linux in practical use.
2256 #. ; the behavior of the tracee is as if it had done a
2257 #. .BR PTRACE_TRACEME .
2258 #. The calling process actually becomes the parent of the tracee
2259 #. process for most purposes (e.g., it will receive
2260 #. notification of tracee events and appears in
2262 #. output as the tracee's parent), but a
2264 #. by the tracee will still return the PID of the original parent.
2266 #: build/C/man2/ptrace.2:567
2268 "Attach to the process specified in I<pid>, making it a tracee of the calling "
2269 "process. The tracee is sent a B<SIGSTOP>, but will not necessarily have "
2270 "stopped by the completion of this call; use B<waitpid>(2) to wait for the "
2271 "tracee to stop. See the \"Attaching and detaching\" subsection for "
2272 "additional information. (I<addr> and I<data> are ignored.)"
2276 #: build/C/man2/ptrace.2:567
2278 msgid "B<PTRACE_DETACH>"
2282 #: build/C/man2/ptrace.2:576
2284 "Restart the stopped tracee as for B<PTRACE_CONT>, but first detach from it. "
2285 "Under Linux, a tracee can be detached in this way regardless of which method "
2286 "was used to initiate tracing. (I<addr> is ignored.)"
2290 #: build/C/man2/ptrace.2:576
2292 msgid "Death under ptrace"
2296 #: build/C/man2/ptrace.2:585
2298 "When a (possibly multithreaded) process receives a killing signal (one whose "
2299 "disposition is set to B<SIG_DFL> and whose default action is to kill the "
2300 "process), all threads exit. Tracees report their death to their tracer(s). "
2301 "Notification of this event is delivered via B<waitpid>(2)."
2305 #: build/C/man2/ptrace.2:594
2307 "Note that the killing signal will first cause signal-delivery-stop (on one "
2308 "tracee only), and only after it is injected by the tracer (or after it was "
2309 "dispatched to a thread which isn't traced), will death from the signal "
2310 "happen on I<all> tracees within a multithreaded process. (The term "
2311 "\"signal-delivery-stop\" is explained below.)"
2315 #: build/C/man2/ptrace.2:608
2317 "B<SIGKILL> operates similarly, with exceptions. No signal-delivery-stop is "
2318 "generated for B<SIGKILL> and therefore the tracer can't suppress it. "
2319 "B<SIGKILL> kills even within system calls (syscall-exit-stop is not "
2320 "generated prior to death by B<SIGKILL>). The net effect is that B<SIGKILL> "
2321 "always kills the process (all its threads), even if some threads of the "
2322 "process are ptraced."
2326 #: build/C/man2/ptrace.2:613
2328 "When the tracee calls B<_exit>(2), it reports its death to its tracer. "
2329 "Other threads are not affected."
2333 #: build/C/man2/ptrace.2:617
2335 "When any thread executes B<exit_group>(2), every tracee in its thread group "
2336 "reports its death to its tracer."
2340 #: build/C/man2/ptrace.2:631
2342 "If the B<PTRACE_O_TRACEEXIT> option is on, B<PTRACE_EVENT_EXIT> will happen "
2343 "before actual death. This applies to exits via B<exit>(2), "
2344 "B<exit_group>(2), and signal deaths (except B<SIGKILL>), and when threads "
2345 "are torn down on B<execve>(2) in a multithreaded process."
2349 #: build/C/man2/ptrace.2:656
2351 "The tracer cannot assume that the ptrace-stopped tracee exists. There are "
2352 "many scenarios when the tracee may die while stopped (such as B<SIGKILL>). "
2353 "Therefore, the tracer must be prepared to handle an B<ESRCH> error on any "
2354 "ptrace operation. Unfortunately, the same error is returned if the tracee "
2355 "exists but is not ptrace-stopped (for commands which require a stopped "
2356 "tracee), or if it is not traced by the process which issued the ptrace "
2357 "call. The tracer needs to keep track of the stopped/running state of the "
2358 "tracee, and interpret B<ESRCH> as \"tracee died unexpectedly\" only if it "
2359 "knows that the tracee has been observed to enter ptrace-stop. Note that "
2360 "there is no guarantee that I<waitpid(WNOHANG)> will reliably report the "
2361 "tracee's death status if a ptrace operation returned B<ESRCH>. "
2362 "I<waitpid(WNOHANG)> may return 0 instead. In other words, the tracee may be "
2363 "\"not yet fully dead\", but already refusing ptrace requests."
2367 #: build/C/man2/ptrace.2:670
2369 "The tracer can't assume that the tracee I<always> ends its life by reporting "
2370 "I<WIFEXITED(status)> or I<WIFSIGNALED(status)>; there are cases where this "
2371 "does not occur. For example, if a thread other than thread group leader "
2372 "does an B<execve>(2), it disappears; its PID will never be seen again, and "
2373 "any subsequent ptrace stops will be reported under the thread group leader's "
2378 #: build/C/man2/ptrace.2:670
2380 msgid "Stopped states"
2384 #: build/C/man2/ptrace.2:672
2385 msgid "A tracee can be in two states: running or stopped."
2389 #: build/C/man2/ptrace.2:676
2391 "There are many kinds of states when the tracee is stopped, and in ptrace "
2392 "discussions they are often conflated. Therefore, it is important to use "
2397 #: build/C/man2/ptrace.2:687
2399 "In this manual page, any stopped state in which the tracee is ready to "
2400 "accept ptrace commands from the tracer is called I<ptrace-stop>. "
2401 "Ptrace-stops can be further subdivided into I<signal-delivery-stop>, "
2402 "I<group-stop>, I<syscall-stop>, and so on. These stopped states are "
2403 "described in detail below."
2407 #: build/C/man2/ptrace.2:692
2409 "When the running tracee enters ptrace-stop, it notifies its tracer using "
2410 "B<waitpid>(2) (or one of the other \"wait\" system calls). Most of this "
2411 "manual page assumes that the tracer waits with:"
2415 #: build/C/man2/ptrace.2:694
2417 msgid " pid = waitpid(pid_or_minus_1, &status, __WALL);\n"
2421 #. Do we require __WALL usage, or will just using 0 be ok? (With 0,
2422 #. I am not 100% sure there aren't ugly corner cases.) Are the
2423 #. rules different if user wants to use waitid? Will waitid require
2426 #: build/C/man2/ptrace.2:706
2428 "Ptrace-stopped tracees are reported as returns with I<pid> greater than 0 "
2429 "and I<WIFSTOPPED(status)> true."
2433 #: build/C/man2/ptrace.2:714
2435 "The B<__WALL> flag does not include the B<WSTOPPED> and B<WEXITED> flags, "
2436 "but implies their functionality."
2440 #: build/C/man2/ptrace.2:721
2442 "Setting the B<WCONTINUED> flag when calling B<waitpid>(2) is not "
2443 "recommended: the \"continued\" state is per-process and consuming it can "
2444 "confuse the real parent of the tracee."
2448 #: build/C/man2/ptrace.2:729
2450 "Use of the B<WNOHANG> flag may cause B<waitpid>(2) to return 0 (\"no wait "
2451 "results available yet\") even if the tracer knows there should be a "
2452 "notification. Example:"
2456 #: build/C/man2/ptrace.2:733
2459 " kill(tracee, SIGKILL);\n"
2460 " waitpid(tracee, &status, __WALL | WNOHANG);\n"
2464 #: build/C/man2/ptrace.2:756
2466 "The following kinds of ptrace-stops exist: signal-delivery-stops, "
2467 "group-stops, B<PTRACE_EVENT> stops, syscall-stops. They all are reported by "
2468 "B<waitpid>(2) with I<WIFSTOPPED(status)> true. They may be differentiated "
2469 "by examining the value I<statusE<gt>E<gt>8>, and if there is ambiguity in "
2470 "that value, by querying B<PTRACE_GETSIGINFO>. (Note: the "
2471 "I<WSTOPSIG(status)> macro can't be used to perform this examination, because "
2472 "it returns the value I<(status\\E<gt>E<gt>8)\\ &\\ 0xff>.)"
2476 #: build/C/man2/ptrace.2:756
2478 msgid "Signal-delivery-stop"
2482 #: build/C/man2/ptrace.2:776
2484 "When a (possibly multithreaded) process receives any signal except "
2485 "B<SIGKILL>, the kernel selects an arbitrary thread which handles the "
2486 "signal. (If the signal is generated with B<tgkill>(2), the target thread "
2487 "can be explicitly selected by the caller.) If the selected thread is "
2488 "traced, it enters signal-delivery-stop. At this point, the signal is not "
2489 "yet delivered to the process, and can be suppressed by the tracer. If the "
2490 "tracer doesn't suppress the signal, it passes the signal to the tracee in "
2491 "the next ptrace restart request. This second step of signal delivery is "
2492 "called I<signal injection> in this manual page. Note that if the signal is "
2493 "blocked, signal-delivery-stop doesn't happen until the signal is unblocked, "
2494 "with the usual exception that B<SIGSTOP> can't be blocked."
2498 #: build/C/man2/ptrace.2:790
2500 "Signal-delivery-stop is observed by the tracer as B<waitpid>(2) returning "
2501 "with I<WIFSTOPPED(status)> true, with the signal returned by "
2502 "I<WSTOPSIG(status)>. If the signal is B<SIGTRAP>, this may be a different "
2503 "kind of ptrace-stop; see the \"Syscall-stops\" and \"execve\" sections below "
2504 "for details. If I<WSTOPSIG(status)> returns a stopping signal, this may be "
2505 "a group-stop; see below."
2509 #: build/C/man2/ptrace.2:790
2511 msgid "Signal injection and suppression"
2515 #: build/C/man2/ptrace.2:793
2517 "After signal-delivery-stop is observed by the tracer, the tracer should "
2518 "restart the tracee with the call"
2522 #: build/C/man2/ptrace.2:795
2524 msgid " ptrace(PTRACE_restart, pid, 0, sig)\n"
2528 #: build/C/man2/ptrace.2:808
2530 "where B<PTRACE_restart> is one of the restarting ptrace requests. If I<sig> "
2531 "is 0, then a signal is not delivered. Otherwise, the signal I<sig> is "
2532 "delivered. This operation is called I<signal injection> in this manual "
2533 "page, to distinguish it from signal-delivery-stop."
2537 #: build/C/man2/ptrace.2:814
2539 "The I<sig> value may be different from the I<WSTOPSIG(status)> value: the "
2540 "tracer can cause a different signal to be injected."
2544 #: build/C/man2/ptrace.2:830
2546 "Note that a suppressed signal still causes system calls to return "
2547 "prematurely. In this case system calls will be restarted: the tracer will "
2548 "observe the tracee to reexecute the interrupted system call (or "
2549 "B<restart_syscall>(2) system call for a few syscalls which use a different "
2550 "mechanism for restarting) if the tracer uses B<PTRACE_SYSCALL>. Even system "
2551 "calls (such as B<poll>(2)) which are not restartable after signal are "
2552 "restarted after signal is suppressed; however, kernel bugs exist which cause "
2553 "some syscalls to fail with B<EINTR> even though no observable signal is "
2554 "injected to the tracee."
2558 #: build/C/man2/ptrace.2:841
2560 "Restarting ptrace commands issued in ptrace-stops other than "
2561 "signal-delivery-stop are not guaranteed to inject a signal, even if I<sig> "
2562 "is nonzero. No error is reported; a nonzero I<sig> may simply be ignored. "
2563 "Ptrace users should not try to \"create a new signal\" this way: use "
2564 "B<tgkill>(2) instead."
2568 #: build/C/man2/ptrace.2:848
2570 "The fact that signal injection requests may be ignored when restarting the "
2571 "tracee after ptrace stops that are not signal-delivery-stops is a cause of "
2572 "confusion among ptrace users. One typical scenario is that the tracer "
2573 "observes group-stop, mistakes it for signal-delivery-stop, restarts the "
2578 #: build/C/man2/ptrace.2:850
2580 msgid " ptrace(PTRACE_rest, pid, 0, stopsig)\n"
2584 #: build/C/man2/ptrace.2:856
2586 "with the intention of injecting I<stopsig>, but I<stopsig> gets ignored and "
2587 "the tracee continues to run."
2591 #: build/C/man2/ptrace.2:876
2593 "The B<SIGCONT> signal has a side effect of waking up (all threads of) a "
2594 "group-stopped process. This side effect happens before "
2595 "signal-delivery-stop. The tracer can't suppress this side effect (it can "
2596 "only suppress signal injection, which only causes the B<SIGCONT> handler to "
2597 "not be executed in the tracee, if such a handler is installed). In fact, "
2598 "waking up from group-stop may be followed by signal-delivery-stop for "
2599 "signal(s) I<other than> B<SIGCONT>, if they were pending when B<SIGCONT> "
2600 "was delivered. In other words, B<SIGCONT> may be not the first signal "
2601 "observed by the tracee after it was sent."
2605 #: build/C/man2/ptrace.2:880
2607 "Stopping signals cause (all threads of) a process to enter group-stop. This "
2608 "side effect happens after signal injection, and therefore can be suppressed "
2612 #. In the Linux 2.4 sources, in arch/i386/kernel/signal.c::do_signal(),
2615 #. /* The debugger continued. Ignore SIGSTOP. */
2616 #. if (signr == SIGSTOP)
2619 #: build/C/man2/ptrace.2:890
2620 msgid "In Linux 2.4 and earlier, the B<SIGSTOP> signal can't be injected."
2624 #: build/C/man2/ptrace.2:907
2626 "B<PTRACE_GETSIGINFO> can be used to retrieve a I<siginfo_t> structure which "
2627 "corresponds to the delivered signal. B<PTRACE_SETSIGINFO> may be used to "
2628 "modify it. If B<PTRACE_SETSIGINFO> has been used to alter I<siginfo_t>, the "
2629 "I<si_signo> field and the I<sig> parameter in the restarting command must "
2630 "match, otherwise the result is undefined."
2634 #: build/C/man2/ptrace.2:907
2640 #: build/C/man2/ptrace.2:919
2642 "When a (possibly multithreaded) process receives a stopping signal, all "
2643 "threads stop. If some threads are traced, they enter a group-stop. Note "
2644 "that the stopping signal will first cause signal-delivery-stop (on one "
2645 "tracee only), and only after it is injected by the tracer (or after it was "
2646 "dispatched to a thread which isn't traced), will group-stop be initiated on "
2647 "I<all> tracees within the multithreaded process. As usual, every tracee "
2648 "reports its group-stop separately to the corresponding tracer."
2652 #: build/C/man2/ptrace.2:928
2654 "Group-stop is observed by the tracer as B<waitpid>(2) returning with "
2655 "I<WIFSTOPPED(status)> true, with the stopping signal available via "
2656 "I<WSTOPSIG(status)>. The same result is returned by some other classes of "
2657 "ptrace-stops, therefore the recommended practice is to perform the call"
2661 #: build/C/man2/ptrace.2:930
2663 msgid " ptrace(PTRACE_GETSIGINFO, pid, 0, &siginfo)\n"
2667 #: build/C/man2/ptrace.2:951
2669 "The call can be avoided if the signal is not B<SIGSTOP>, B<SIGTSTP>, "
2670 "B<SIGTTIN>, or B<SIGTTOU>; only these four signals are stopping signals. If "
2671 "the tracer sees something else, it can't be a group-stop. Otherwise, the "
2672 "tracer needs to call B<PTRACE_GETSIGINFO>. If B<PTRACE_GETSIGINFO> fails "
2673 "with B<EINVAL>, then it is definitely a group-stop. (Other failure codes "
2674 "are possible, such as B<ESRCH> (\"no such process\") if a B<SIGKILL> killed "
2679 #: build/C/man2/ptrace.2:960
2681 "As of kernel 2.6.38, after the tracer sees the tracee ptrace-stop and until "
2682 "it restarts or kills it, the tracee will not run, and will not send "
2683 "notifications (except B<SIGKILL> death) to the tracer, even if the tracer "
2684 "enters into another B<waitpid>(2) call."
2688 #: build/C/man2/ptrace.2:974
2690 "The kernel behavior described in the previous paragraph causes a problem "
2691 "with transparent handling of stopping signals. If the tracer restarts the "
2692 "tracee after group-stop, the stopping signal is effectively ignored\\(emthe "
2693 "tracee doesn't remain stopped, it runs. If the tracer doesn't restart the "
2694 "tracee before entering into the next B<waitpid>(2), future B<SIGCONT> "
2695 "signals will not be reported to the tracer; this would cause the B<SIGCONT> "
2696 "signals to have no effect on the tracee."
2700 #: build/C/man2/ptrace.2:974
2702 msgid "PTRACE_EVENT stops"
2706 #: build/C/man2/ptrace.2:980
2708 "If the tracer sets B<PTRACE_O_TRACE_*> options, the tracee will enter "
2709 "ptrace-stops called B<PTRACE_EVENT> stops."
2713 #: build/C/man2/ptrace.2:994
2715 "B<PTRACE_EVENT> stops are observed by the tracer as B<waitpid>(2) returning "
2716 "with I<WIFSTOPPED(status)>, and I<WSTOPSIG(status)> returns B<SIGTRAP>. An "
2717 "additional bit is set in the higher byte of the status word: the value "
2718 "I<statusE<gt>E<gt>8> will be"
2722 #: build/C/man2/ptrace.2:996
2724 msgid " (SIGTRAP | PTRACE_EVENT_foo E<lt>E<lt> 8).\n"
2728 #: build/C/man2/ptrace.2:998
2729 msgid "The following events exist:"
2733 #: build/C/man2/ptrace.2:998
2735 msgid "B<PTRACE_EVENT_VFORK>"
2739 #: build/C/man2/ptrace.2:1011
2741 "Stop before return from B<vfork>(2) or B<clone>(2) with the B<CLONE_VFORK> "
2742 "flag. When the tracee is continued after this stop, it will wait for child "
2743 "to exit/exec before continuing its execution (in other words, the usual "
2744 "behavior on B<vfork>(2))."
2748 #: build/C/man2/ptrace.2:1011
2750 msgid "B<PTRACE_EVENT_FORK>"
2754 #: build/C/man2/ptrace.2:1019
2756 "Stop before return from B<fork>(2) or B<clone>(2) with the exit signal set "
2761 #: build/C/man2/ptrace.2:1019
2763 msgid "B<PTRACE_EVENT_CLONE>"
2767 #: build/C/man2/ptrace.2:1023
2768 msgid "Stop before return from B<clone>(2)."
2772 #: build/C/man2/ptrace.2:1023
2774 msgid "B<PTRACE_EVENT_VFORK_DONE>"
2778 #: build/C/man2/ptrace.2:1033
2780 "Stop before return from B<vfork>(2) or B<clone>(2) with the B<CLONE_VFORK> "
2781 "flag, but after the child unblocked this tracee by exiting or execing."
2785 #: build/C/man2/ptrace.2:1039
2787 "For all four stops described above, the stop occurs in the parent (i.e., the "
2788 "tracee), not in the newly created thread. B<PTRACE_GETEVENTMSG> can be used "
2789 "to retrieve the new thread's ID."
2793 #: build/C/man2/ptrace.2:1039
2795 msgid "B<PTRACE_EVENT_EXEC>"
2799 #: build/C/man2/ptrace.2:1046
2801 "Stop before return from B<execve>(2). Since Linux 3.0, "
2802 "B<PTRACE_GETEVENTMSG> returns the former thread ID."
2806 #: build/C/man2/ptrace.2:1046
2808 msgid "B<PTRACE_EVENT_EXIT>"
2812 #: build/C/man2/ptrace.2:1062
2814 "Stop before exit (including death from B<exit_group>(2)), signal death, or "
2815 "exit caused by B<execve>(2) in a multithreaded process. "
2816 "B<PTRACE_GETEVENTMSG> returns the exit status. Registers can be examined "
2817 "(unlike when \"real\" exit happens). The tracee is still alive; it needs to "
2818 "be B<PTRACE_CONT>ed or B<PTRACE_DETACH>ed to finish exiting."
2822 #: build/C/man2/ptrace.2:1074
2824 "B<PTRACE_GETSIGINFO> on B<PTRACE_EVENT> stops returns B<SIGTRAP> in "
2825 "I<si_signo>, with I<si_code> set to I<(eventE<lt>E<lt>8)\\ |\\ SIGTRAP>."
2829 #: build/C/man2/ptrace.2:1074
2831 msgid "Syscall-stops"
2835 #: build/C/man2/ptrace.2:1087
2837 "If the tracee was restarted by B<PTRACE_SYSCALL>, the tracee enters "
2838 "syscall-enter-stop just prior to entering any system call. If the tracer "
2839 "restarts the tracee with B<PTRACE_SYSCALL>, the tracee enters "
2840 "syscall-exit-stop when the system call is finished, or if it is interrupted "
2841 "by a signal. (That is, signal-delivery-stop never happens between "
2842 "syscall-enter-stop and syscall-exit-stop; it happens I<after> "
2843 "syscall-exit-stop.)"
2847 #: build/C/man2/ptrace.2:1101
2849 "Other possibilities are that the tracee may stop in a B<PTRACE_EVENT> stop, "
2850 "exit (if it entered B<_exit>(2) or B<exit_group>(2)), be killed by "
2851 "B<SIGKILL>, or die silently (if it is a thread group leader, the "
2852 "B<execve>(2) happened in another thread, and that thread is not traced by "
2853 "the same tracer; this situation is discussed later)."
2857 #: build/C/man2/ptrace.2:1116
2859 "Syscall-enter-stop and syscall-exit-stop are observed by the tracer as "
2860 "B<waitpid>(2) returning with I<WIFSTOPPED(status)> true, and "
2861 "I<WSTOPSIG(status)> giving B<SIGTRAP>. If the B<PTRACE_O_TRACESYSGOOD> "
2862 "option was set by the tracer, then I<WSTOPSIG(status)> will give the value "
2863 "I<(SIGTRAP\\ |\\ 0x80)>."
2867 #: build/C/man2/ptrace.2:1122
2869 "Syscall-stops can be distinguished from signal-delivery-stop with B<SIGTRAP> "
2870 "by querying B<PTRACE_GETSIGINFO> for the following cases:"
2874 #: build/C/man2/ptrace.2:1122
2876 msgid "I<si_code> E<lt>= 0"
2880 #: build/C/man2/ptrace.2:1134
2882 "B<SIGTRAP> was delivered as a result of a userspace action, for example, a "
2883 "system call (B<tgkill>(2), B<kill>(2), B<sigqueue>(3), etc.), expiration of "
2884 "a POSIX timer, change of state on a POSIX message queue, or completion of an "
2885 "asynchronous I/O request."
2889 #: build/C/man2/ptrace.2:1134
2891 msgid "I<si_code> == SI_KERNEL (0x80)"
2895 #: build/C/man2/ptrace.2:1138
2896 msgid "B<SIGTRAP> was sent by the kernel."
2900 #: build/C/man2/ptrace.2:1138
2902 msgid "I<si_code> == SIGTRAP or I<si_code> == (SIGTRAP|0x80)"
2906 #: build/C/man2/ptrace.2:1141
2907 msgid "This is a syscall-stop."
2911 #: build/C/man2/ptrace.2:1146
2913 "However, syscall-stops happen very often (twice per system call), and "
2914 "performing B<PTRACE_GETSIGINFO> for every syscall-stop may be somewhat "
2919 #: build/C/man2/ptrace.2:1169
2921 "Some architectures allow the cases to be distinguished by examining "
2922 "registers. For example, on x86, I<rax> == -B<ENOSYS> in "
2923 "syscall-enter-stop. Since B<SIGTRAP> (like any other signal) always happens "
2924 "I<after> syscall-exit-stop, and at this point I<rax> almost never contains "
2925 "-B<ENOSYS>, the B<SIGTRAP> looks like \"syscall-stop which is not "
2926 "syscall-enter-stop\"; in other words, it looks like a \"stray "
2927 "syscall-exit-stop\" and can be detected this way. But such detection is "
2928 "fragile and is best avoided."
2932 #: build/C/man2/ptrace.2:1175
2934 "Using the B<PTRACE_O_TRACESYSGOOD> option is the recommended method to "
2935 "distinguish syscall-stops from other kinds of ptrace-stops, since it is "
2936 "reliable and does not incur a performance penalty."
2940 #: build/C/man2/ptrace.2:1186
2942 "Syscall-enter-stop and syscall-exit-stop are indistinguishable from each "
2943 "other by the tracer. The tracer needs to keep track of the sequence of "
2944 "ptrace-stops in order to not misinterpret syscall-enter-stop as "
2945 "syscall-exit-stop or vice versa. The rule is that syscall-enter-stop is "
2946 "always followed by syscall-exit-stop, B<PTRACE_EVENT> stop or the tracee's "
2947 "death; no other kinds of ptrace-stop can occur in between."
2951 #: build/C/man2/ptrace.2:1191
2953 "If after syscall-enter-stop, the tracer uses a restarting command other than "
2954 "B<PTRACE_SYSCALL>, syscall-exit-stop is not generated."
2958 #: build/C/man2/ptrace.2:1203
2960 "B<PTRACE_GETSIGINFO> on syscall-stops returns B<SIGTRAP> in I<si_signo>, "
2961 "with I<si_code> set to B<SIGTRAP> or I<(SIGTRAP|0x80)>."
2965 #: build/C/man2/ptrace.2:1203
2967 msgid "PTRACE_SINGLESTEP, PTRACE_SYSEMU, PTRACE_SYSEMU_SINGLESTEP stops"
2972 #. document stops occurring with PTRACE_SINGLESTEP, PTRACE_SYSEMU,
2973 #. PTRACE_SYSEMU_SINGLESTEP
2975 #: build/C/man2/ptrace.2:1209
2976 msgid "[Details of these kinds of stops are yet to be documented.]"
2980 #: build/C/man2/ptrace.2:1209
2982 msgid "Informational and restarting ptrace commands"
2986 #: build/C/man2/ptrace.2:1217
2988 "Most ptrace commands (all except B<PTRACE_ATTACH>, B<PTRACE_TRACEME>, and "
2989 "B<PTRACE_KILL>) require the tracee to be in a ptrace-stop, otherwise they "
2990 "fail with B<ESRCH>."
2994 #: build/C/man2/ptrace.2:1222
2996 "When the tracee is in ptrace-stop, the tracer can read and write data to the "
2997 "tracee using informational commands. These commands leave the tracee in "
2998 "ptrace-stopped state:"
3002 #: build/C/man2/ptrace.2:1232
3005 " ptrace(PTRACE_PEEKTEXT/PEEKDATA/PEEKUSER, pid, addr, 0);\n"
3006 " ptrace(PTRACE_POKETEXT/POKEDATA/POKEUSER, pid, addr, long_val);\n"
3007 " ptrace(PTRACE_GETREGS/GETFPREGS, pid, 0, &struct);\n"
3008 " ptrace(PTRACE_SETREGS/SETFPREGS, pid, 0, &struct);\n"
3009 " ptrace(PTRACE_GETSIGINFO, pid, 0, &siginfo);\n"
3010 " ptrace(PTRACE_SETSIGINFO, pid, 0, &siginfo);\n"
3011 " ptrace(PTRACE_GETEVENTMSG, pid, 0, &long_var);\n"
3012 " ptrace(PTRACE_SETOPTIONS, pid, 0, PTRACE_O_flags);\n"
3016 #: build/C/man2/ptrace.2:1244
3018 "Note that some errors are not reported. For example, setting signal "
3019 "information (I<siginfo>) may have no effect in some ptrace-stops, yet the "
3020 "call may succeed (return 0 and not set I<errno>); querying "
3021 "B<PTRACE_GETEVENTMSG> may succeed and return some random value if current "
3022 "ptrace-stop is not documented as returning a meaningful event message."
3026 #: build/C/man2/ptrace.2:1246
3031 #: build/C/man2/ptrace.2:1248
3033 msgid " ptrace(PTRACE_SETOPTIONS, pid, 0, PTRACE_O_flags);\n"
3037 #: build/C/man2/ptrace.2:1257
3039 "affects one tracee. The tracee's current flags are replaced. Flags are "
3040 "inherited by new tracees created and \"auto-attached\" via active "
3041 "B<PTRACE_O_TRACEFORK>, B<PTRACE_O_TRACEVFORK>, or B<PTRACE_O_TRACECLONE> "
3046 #: build/C/man2/ptrace.2:1260
3048 "Another group of commands makes the ptrace-stopped tracee run. They have "
3053 #: build/C/man2/ptrace.2:1262
3055 msgid " ptrace(cmd, pid, 0, sig);\n"
3059 #: build/C/man2/ptrace.2:1282
3061 "where I<cmd> is B<PTRACE_CONT>, B<PTRACE_DETACH>, B<PTRACE_SYSCALL>, "
3062 "B<PTRACE_SINGLESTEP>, B<PTRACE_SYSEMU>, or B<PTRACE_SYSEMU_SINGLESTEP>. If "
3063 "the tracee is in signal-delivery-stop, I<sig> is the signal to be injected "
3064 "(if it is nonzero). Otherwise, I<sig> may be ignored. (When restarting a "
3065 "tracee from a ptrace-stop other than signal-delivery-stop, recommended "
3066 "practice is to always pass 0 in I<sig>.)"
3070 #: build/C/man2/ptrace.2:1282
3072 msgid "Attaching and detaching"
3076 #: build/C/man2/ptrace.2:1284
3077 msgid "A thread can be attached to the tracer using the call"
3081 #: build/C/man2/ptrace.2:1286
3083 msgid " ptrace(PTRACE_ATTACH, pid, 0, 0);\n"
3087 #. FIXME: Describe how to attach to a thread which is already
3090 #: build/C/man2/ptrace.2:1310
3092 "This also sends B<SIGSTOP> to this thread. If the tracer wants this "
3093 "B<SIGSTOP> to have no effect, it needs to suppress it. Note that if other "
3094 "signals are concurrently sent to this thread during attach, the tracer may "
3095 "see the tracee enter signal-delivery-stop with other signal(s) first! The "
3096 "usual practice is to reinject these signals until B<SIGSTOP> is seen, then "
3097 "suppress B<SIGSTOP> injection. The design bug here is that a ptrace attach "
3098 "and a concurrently delivered B<SIGSTOP> may race and the concurrent "
3099 "B<SIGSTOP> may be lost."
3103 #: build/C/man2/ptrace.2:1317
3105 "Since attaching sends B<SIGSTOP> and the tracer usually suppresses it, this "
3106 "may cause a stray B<EINTR> return from the currently executing system call "
3107 "in the tracee, as described in the \"Signal injection and suppression\" "
3112 #: build/C/man2/ptrace.2:1319
3117 #: build/C/man2/ptrace.2:1321
3119 msgid " ptrace(PTRACE_TRACEME, 0, 0, 0);\n"
3123 #: build/C/man2/ptrace.2:1327
3125 "turns the calling thread into a tracee. The thread continues to run "
3126 "(doesn't enter ptrace-stop). A common practice is to follow the "
3127 "B<PTRACE_TRACEME> with"
3131 #: build/C/man2/ptrace.2:1329
3133 msgid " raise(SIGSTOP);\n"
3137 #: build/C/man2/ptrace.2:1332
3139 "and allow the parent (which is our tracer now) to observe our "
3140 "signal-delivery-stop."
3144 #: build/C/man2/ptrace.2:1356
3146 "If the B<PTRACE_O_TRACEFORK>, B<PTRACE_O_TRACEVFORK>, or "
3147 "B<PTRACE_O_TRACECLONE> options are in effect, then children created by, "
3148 "respectively, B<vfork>(2) or B<clone>(2) with the B<CLONE_VFORK> flag, "
3149 "B<fork>(2) or B<clone>(2) with the exit signal set to B<SIGCHLD>, and "
3150 "other kinds of B<clone>(2), are automatically attached to the same tracer "
3151 "which traced their parent. B<SIGSTOP> is delivered to the children, causing "
3152 "them to enter signal-delivery-stop after they exit the system call which "
3157 #: build/C/man2/ptrace.2:1358
3158 msgid "Detaching of the tracee is performed by:"
3162 #: build/C/man2/ptrace.2:1360
3164 msgid " ptrace(PTRACE_DETACH, pid, 0, sig);\n"
3168 #: build/C/man2/ptrace.2:1368
3170 "B<PTRACE_DETACH> is a restarting operation; therefore it requires the tracee "
3171 "to be in ptrace-stop. If the tracee is in signal-delivery-stop, a signal "
3172 "can be injected. Otherwise, the I<sig> parameter may be silently ignored."
3175 #. FIXME: Describe how to detach from a group-stopped tracee so that it
3176 #. doesn't run, but continues to wait for SIGCONT.
3178 #: build/C/man2/ptrace.2:1392
3180 "If the tracee is running when the tracer wants to detach it, the usual "
3181 "solution is to send B<SIGSTOP> (using B<tgkill>(2), to make sure it goes to "
3182 "the correct thread), wait for the tracee to stop in signal-delivery-stop for "
3183 "B<SIGSTOP> and then detach it (suppressing B<SIGSTOP> injection). A design "
3184 "bug is that this can race with concurrent B<SIGSTOP>s. Another complication "
3185 "is that the tracee may enter other ptrace-stops and needs to be restarted "
3186 "and waited for again, until B<SIGSTOP> is seen. Yet another complication is "
3187 "to be sure that the tracee is not already ptrace-stopped, because no signal "
3188 "delivery happens while it is\\(emnot even B<SIGSTOP>."
3192 #: build/C/man2/ptrace.2:1400
3194 "If the tracer dies, all tracees are automatically detached and restarted, "
3195 "unless they were in group-stop. Handling of restart from group-stop is "
3196 "currently buggy, but the \"as planned\" behavior is to leave tracee stopped "
3197 "and waiting for B<SIGCONT>. If the tracee is restarted from "
3198 "signal-delivery-stop, the pending signal is injected."
3202 #: build/C/man2/ptrace.2:1400
3204 msgid "execve(2) under ptrace"
3207 #. clone(2) THREAD_CLONE says:
3208 #. If any of the threads in a thread group performs an execve(2),
3209 #. then all threads other than the thread group leader are terminated,
3210 #. and the new program is executed in the thread group leader.
3212 #. In kernel 3.1 sources, see fs/exec.c::de_thread()
3214 #: build/C/man2/ptrace.2:1419
3216 "When one thread in a multithreaded process calls B<execve>(2), the kernel "
3217 "destroys all other threads in the process, and resets the thread ID of the "
3218 "execing thread to the thread group ID (process ID). (Or, to put things "
3219 "another way, when a multithreaded process does an B<execve>(2), at "
3220 "completion of the call, it appears as though the B<execve>(2) occurred in "
3221 "the thread group leader, regardless of which thread did the B<execve>(2).) "
3222 "This resetting of the thread ID looks very confusing to tracers:"
3226 #: build/C/man2/ptrace.2:1419 build/C/man2/ptrace.2:1429 build/C/man2/ptrace.2:1437 build/C/man2/ptrace.2:1443 build/C/man2/ptrace.2:1572
3232 #: build/C/man2/ptrace.2:1429
3234 "All other threads stop in B<PTRACE_EVENT_EXIT> stop, if the "
3235 "B<PTRACE_O_TRACEEXIT> option was turned on. Then all other threads except "
3236 "the thread group leader report death as if they exited via B<_exit>(2) with "
3241 #: build/C/man2/ptrace.2:1437
3243 "The execing tracee changes its thread ID while it is in the B<execve>(2). "
3244 "(Remember, under ptrace, the \"pid\" returned from B<waitpid>(2), or fed "
3245 "into ptrace calls, is the tracee's thread ID.) That is, the tracee's thread "
3246 "ID is reset to be the same as its process ID, which is the same as the "
3247 "thread group leader's thread ID."
3251 #: build/C/man2/ptrace.2:1443
3253 "Then a B<PTRACE_EVENT_EXEC> stop happens, if the B<PTRACE_O_TRACEEXEC> "
3254 "option was turned on."
3258 #: build/C/man2/ptrace.2:1464
3260 "If the thread group leader has reported its B<PTRACE_EVENT_EXIT> stop by "
3261 "this time, it appears to the tracer that the dead thread leader \"reappears "
3262 "from nowhere\". (Note: the thread group leader does not report death via "
3263 "I<WIFEXITED(status)> until there is at least one other live thread. This "
3264 "eliminates the possibility that the tracer will see it dying and then "
3265 "reappearing.) If the thread group leader was still alive, for the tracer "
3266 "this may look as if thread group leader returns from a different system call "
3267 "than it entered, or even \"returned from a system call even though it was "
3268 "not in any system call\". If the thread group leader was not traced (or was "
3269 "traced by a different tracer), then during B<execve>(2) it will appear as "
3270 "if it has become a tracee of the tracer of the execing tracee."
3274 #: build/C/man2/ptrace.2:1467
3276 "All of the above effects are the artifacts of the thread ID change in the "
3281 #: build/C/man2/ptrace.2:1487
3283 "The B<PTRACE_O_TRACEEXEC> option is the recommended tool for dealing with "
3284 "this situation. First, it enables B<PTRACE_EVENT_EXEC> stop, which occurs "
3285 "before B<execve>(2) returns. In this stop, the tracer can use "
3286 "B<PTRACE_GETEVENTMSG> to retrieve the tracee's former thread ID. (This "
3287 "feature was introduced in Linux 3.0). Second, the B<PTRACE_O_TRACEEXEC> "
3288 "option disables legacy B<SIGTRAP> generation on B<execve>(2)."
3292 #: build/C/man2/ptrace.2:1493
3294 "When the tracer receives B<PTRACE_EVENT_EXEC> stop notification, it is "
3295 "guaranteed that except this tracee and the thread group leader, no other "
3296 "threads from the process are alive."
3300 #: build/C/man2/ptrace.2:1501
3302 "On receiving the B<PTRACE_EVENT_EXEC> stop notification, the tracer should "
3303 "clean up all its internal data structures describing the threads of this "
3304 "process, and retain only one data structure\\(emone which describes the "
3305 "single still running tracee, with"
3309 #: build/C/man2/ptrace.2:1503
3311 msgid " thread ID == thread group ID == process ID.\n"
3315 #: build/C/man2/ptrace.2:1507
3316 msgid "Example: two threads call B<execve>(2) at the same time:"
3320 #: build/C/man2/ptrace.2:1518
3323 "*** we get syscall-enter-stop in thread 1: **\n"
3324 "PID1 execve(\"/bin/foo\", \"foo\" E<lt>unfinished ...E<gt>\n"
3325 "*** we issue PTRACE_SYSCALL for thread 1 **\n"
3326 "*** we get syscall-enter-stop in thread 2: **\n"
3327 "PID2 execve(\"/bin/bar\", \"bar\" E<lt>unfinished ...E<gt>\n"
3328 "*** we issue PTRACE_SYSCALL for thread 2 **\n"
3329 "*** we get PTRACE_EVENT_EXEC for PID0, we issue PTRACE_SYSCALL **\n"
3330 "*** we get syscall-exit-stop for PID0: **\n"
3331 "PID0 E<lt>... execve resumedE<gt> ) = 0\n"
3335 #: build/C/man2/ptrace.2:1541
3337 "If the B<PTRACE_O_TRACEEXEC> option is I<not> in effect for the execing "
3338 "tracee, the kernel delivers an extra B<SIGTRAP> to the tracee after "
3339 "B<execve>(2) returns. This is an ordinary signal (similar to one which can "
3340 "be generated by I<kill -TRAP>), not a special kind of ptrace-stop. "
3341 "Employing B<PTRACE_GETSIGINFO> for this signal returns I<si_code> set to 0 "
3342 "(I<SI_USER>). This signal may be blocked by signal mask, and thus may be "
3343 "delivered (much) later."
3347 #: build/C/man2/ptrace.2:1560
3349 "Usually, the tracer (for example, B<strace>(1)) would not want to show this "
3350 "extra post-execve B<SIGTRAP> signal to the user, and would suppress its "
3351 "delivery to the tracee (if B<SIGTRAP> is set to B<SIG_DFL>, it is a killing "
3352 "signal). However, determining I<which> B<SIGTRAP> to suppress is not easy. "
3353 "Setting the B<PTRACE_O_TRACEEXEC> option and thus suppressing this extra "
3354 "B<SIGTRAP> is the recommended approach."
3358 #: build/C/man2/ptrace.2:1560
3364 #: build/C/man2/ptrace.2:1567
3366 "The ptrace API (ab)uses the standard UNIX parent/child signaling over "
3367 "B<waitpid>(2). This used to cause the real parent of the process to stop "
3368 "receiving several kinds of B<waitpid>(2) notifications when the child "
3369 "process is traced by some other process."
3373 #: build/C/man2/ptrace.2:1570
3375 "Many of these bugs have been fixed, but as of Linux 2.6.38 several still "
3376 "exist; see BUGS below."
3380 #: build/C/man2/ptrace.2:1572
3381 msgid "As of Linux 2.6.38, the following is believed to work correctly:"
3385 #: build/C/man2/ptrace.2:1580
3387 "exit/death by signal is reported first to the tracer, then, when the tracer "
3388 "consumes the B<waitpid>(2) result, to the real parent (to the real parent "
3389 "only when the whole multithreaded process exits). If the tracer and the "
3390 "real parent are the same process, the report is sent only once."
3394 #: build/C/man2/ptrace.2:1594
3396 "On success, B<PTRACE_PEEK*> requests return the requested data, while other "
3397 "requests return zero. On error, all requests return -1, and I<errno> is set "
3398 "appropriately. Since the value returned by a successful B<PTRACE_PEEK*> "
3399 "request may be -1, the caller must clear I<errno> before the call, and then "
3400 "check it afterward to determine whether or not an error occurred."
3404 #: build/C/man2/ptrace.2:1598
3405 msgid "(i386 only) There was an error with allocating or freeing a debug register."
3409 #: build/C/man2/ptrace.2:1609
3411 "There was an attempt to read from or write to an invalid area in the "
3412 "tracer's or the tracee's memory, probably because the area wasn't mapped or "
3413 "accessible. Unfortunately, under Linux, different variations of this fault "
3414 "will return B<EIO> or B<EFAULT> more or less arbitrarily."
3418 #: build/C/man2/ptrace.2:1612
3419 msgid "An attempt was made to set an invalid option."
3423 #: build/C/man2/ptrace.2:1619
3425 "I<request> is invalid, or an attempt was made to read from or write to an "
3426 "invalid area in the tracer's or the tracee's memory, or there was a "
3427 "word-alignment violation, or an invalid signal was specified during a "
3432 #: build/C/man2/ptrace.2:1632
3434 "The specified process cannot be traced. This could be because the tracer "
3435 "has insufficient privileges (the required capability is B<CAP_SYS_PTRACE>); "
3436 "unprivileged processes cannot trace processes that they cannot send signals "
3437 "to or those running set-user-ID/set-group-ID programs, for obvious reasons. "
3438 "Alternatively, the process may already be being traced, or (on kernels "
3439 "before 2.6.26) be B<init>(8) (PID 1)."
3443 #: build/C/man2/ptrace.2:1632 build/C/man2/quotactl.2:459 build/C/man2/quotactl.2:502
3449 #: build/C/man2/ptrace.2:1637
3451 "The specified process does not exist, or is not currently being traced by "
3452 "the caller, or is not stopped (for requests that require a stopped tracee)."
3456 #: build/C/man2/ptrace.2:1639
3457 msgid "SVr4, 4.3BSD."
3461 #: build/C/man2/ptrace.2:1652
3463 "Although arguments to B<ptrace>() are interpreted according to the "
3464 "prototype given, glibc currently declares B<ptrace>() as a variadic "
3465 "function with only the I<request> argument fixed. This means that unneeded "
3466 "trailing arguments may be omitted, though doing so makes use of undocumented "
3467 "B<gcc>(1) behavior."
3470 #. See commit 00cd5c37afd5f431ac186dd131705048c0a11fdb
3472 #: build/C/man2/ptrace.2:1657
3474 "In Linux kernels before 2.6.26, B<init>(8), the process with PID 1, may not "
3478 #. See http://lkml.org/lkml/2008/5/8/375
3480 #: build/C/man2/ptrace.2:1664
3482 "The layout of the contents of memory and the USER area are quite "
3483 "operating-system- and architecture-specific. The offset supplied, and the "
3484 "data returned, might not entirely match with the definition of I<struct "
3489 #: build/C/man2/ptrace.2:1667
3491 "The size of a \"word\" is determined by the operating-system variant (e.g., "
3492 "for 32-bit Linux it is 32 bits, etc.)."
3496 #: build/C/man2/ptrace.2:1675
3498 "This page documents the way the B<ptrace>() call works currently in Linux. "
3499 "Its behavior differs noticeably on other flavors of UNIX. In any case, use "
3500 "of B<ptrace>() is highly specific to the operating system and architecture."
3504 #: build/C/man2/ptrace.2:1686
3506 "On hosts with 2.6 kernel headers, B<PTRACE_SETOPTIONS> is declared with a "
3507 "different value than the one for 2.4. This leads to applications compiled "
3508 "with 2.6 kernel headers failing when run on 2.4 kernels. This can be worked "
3509 "around by redefining B<PTRACE_SETOPTIONS> to B<PTRACE_OLDSETOPTIONS>, if "
3514 #: build/C/man2/ptrace.2:1689
3516 "Group-stop notifications are sent to the tracer, but not to real parent. "
3517 "Last confirmed on 2.6.38.6."
3520 #. Note from Denys Vlasenko:
3521 #. Here "exits" means any kind of death - _exit, exit_group,
3522 #. signal death. Signal death and exit_group cases are trivial,
3523 #. though: since signal death and exit_group kill all other threads
3524 #. too, "until all other threads exit" thing happens rather soon
3525 #. in these cases. Therefore, only _exit presents observably
3526 #. puzzling behavior to ptrace users: thread leader _exit's,
3527 #. but WIFEXITED isn't reported! We are trying to explain here
3529 #. FIXME: ^^^ need to test/verify this scenario
3531 #: build/C/man2/ptrace.2:1720
3533 "If a thread group leader is traced and exits by calling B<_exit>(2), a "
3534 "B<PTRACE_EVENT_EXIT> stop will happen for it (if requested), but the "
3535 "subsequent B<WIFEXITED> notification will not be delivered until all other "
3536 "threads exit. As explained above, if one of other threads calls "
3537 "B<execve>(2), the death of the thread group leader will I<never> be "
3538 "reported. If the execed thread is not traced by this tracer, the tracer "
3539 "will never know that B<execve>(2) happened. One possible workaround is to "
3540 "B<PTRACE_DETACH> the thread group leader instead of restarting it in this "
3541 "case. Last confirmed on 2.6.38.6."
3545 #: build/C/man2/ptrace.2:1730
3547 "A B<SIGKILL> signal may still cause a B<PTRACE_EVENT_EXIT> stop before "
3548 "actual signal death. This may be changed in the future; B<SIGKILL> is meant "
3549 "to always immediately kill tasks even under ptrace. Last confirmed on "
3554 #: build/C/man2/ptrace.2:1746
3556 "Some system calls return with B<EINTR> if a signal was sent to a tracee, but "
3557 "delivery was suppressed by the tracer. (This is very typical operation: it "
3558 "is usually done by debuggers on every attach, in order to not introduce a "
3559 "bogus B<SIGSTOP>). As of Linux 3.2.9, the following system calls are "
3560 "affected (this list is likely incomplete): B<epoll_wait>(2), and B<read>(2) "
3561 "from an B<inotify>(7) file descriptor."
3565 #: build/C/man2/ptrace.2:1760
3567 "B<gdb>(1), B<strace>(1), B<clone>(2), B<execve>(2), B<fork>(2), "
3568 "B<gettid>(2), B<sigaction>(2), B<tgkill>(2), B<vfork>(2), B<waitpid>(2), "
3569 "B<exec>(3), B<capabilities>(7), B<signal>(7)"
3573 #: build/C/man2/quotactl.2:25
3579 #: build/C/man2/quotactl.2:25
3585 #: build/C/man2/quotactl.2:28
3586 msgid "quotactl - manipulate disk quotas"
3590 #: build/C/man2/quotactl.2:32
3593 "B<#include E<lt>sys/quota.hE<gt>>\n"
3594 "B<#include E<lt>xfs/xqm.hE<gt>>\n"
3598 #: build/C/man2/quotactl.2:35
3601 "B<int quotactl(int >I<cmd>B<, const char *>I<special>B<, int >I<id>B<, "
3602 "caddr_t >I<addr>B<);>\n"
3606 #: build/C/man2/quotactl.2:47
3608 "The quota system can be used to set per-user and per-group limits on the "
3609 "amount of disk space used on a file system. For each user and/or group, a "
3610 "soft limit and a hard limit can be set for each file system. The hard limit "
3611 "can't be exceeded. The soft limit can be exceeded, but warnings will "
3612 "ensue. Moreover, the user can't exceed the soft limit for more than one "
3613 "week (by default) at a time; after this time, the soft limit counts as a "
3618 #: build/C/man2/quotactl.2:72
3620 "The B<quotactl>() call manipulates disk quotas. The I<cmd> argument "
3621 "indicates a command to be applied to the user or group ID specified in "
3622 "I<id>. To initialize the I<cmd> argument, use the I<QCMD(subcmd, type)> "
3623 "macro. The I<type> value is either B<USRQUOTA>, for user quotas, or "
3624 "B<GRPQUOTA>, for group quotas. The I<subcmd> value is described below."
3628 #: build/C/man2/quotactl.2:77
3630 "The I<special> argument is a pointer to a null-terminated string containing "
3631 "the pathname of the (mounted) block special device for the file system being "
3636 #: build/C/man2/quotactl.2:85
3638 "The I<addr> argument is the address of an optional, command-specific, data "
3639 "structure that is copied in or out of the system. The interpretation of "
3640 "I<addr> is given with each command below."
3644 #: build/C/man2/quotactl.2:89
3645 msgid "The I<subcmd> value is one of the following:"
3649 #: build/C/man2/quotactl.2:89
3651 msgid "B<Q_QUOTAON>"
3655 #: build/C/man2/quotactl.2:96
3657 "Turn on quotas for a file system. The I<id> argument is the identification "
3658 "number of the quota format to be used. Currently, there are three supported "
3663 #: build/C/man2/quotactl.2:97
3665 msgid "B<QFMT_VFS_OLD>"
3669 #: build/C/man2/quotactl.2:100
3670 msgid "The original quota format."
3674 #: build/C/man2/quotactl.2:100
3676 msgid "B<QFMT_VFS_V0>"
3680 #: build/C/man2/quotactl.2:104
3682 "The standard VFS v0 quota format, which can handle 32-bit UIDs and GIDs and "
3683 "quota limits up to 2^42 bytes and 2^32 inodes."
3687 #: build/C/man2/quotactl.2:104
3689 msgid "B<QFMT_VFS_V1>"
3693 #: build/C/man2/quotactl.2:108
3695 "A quota format that can handle 32-bit UIDs and GIDs and quota limits of 2^64 "
3696 "bytes and 2^64 inodes."
3700 #: build/C/man2/quotactl.2:119
3702 "The I<addr> argument points to the pathname of a file containing the quotas "
3703 "for the file system. The quota file must exist; it is normally created with "
3704 "the B<quotacheck>(8) program. This operation requires privilege "
3705 "(B<CAP_SYS_ADMIN>)."
3709 #: build/C/man2/quotactl.2:119
3711 msgid "B<Q_QUOTAOFF>"
3715 #: build/C/man2/quotactl.2:129
3717 "Turn off quotas for a file system. The I<addr> and I<id> arguments are "
3718 "ignored. This operation requires privilege (B<CAP_SYS_ADMIN>)."
3722 #: build/C/man2/quotactl.2:129
3724 msgid "B<Q_GETQUOTA>"
3728 #: build/C/man2/quotactl.2:140
3730 "Get disk quota limits and current usage for user or group I<id>. The "
3731 "I<addr> argument is a pointer to a I<dqblk> structure defined in "
3732 "I<E<lt>sys/quota.hE<gt>> as follows:"
3736 #: build/C/man2/quotactl.2:145 build/C/man2/quotactl.2:232
3739 "/* uint64_t is an unsigned 64-bit integer;\n"
3740 " uint32_t is an unsigned 32-bit integer */\n"
3744 #: build/C/man2/quotactl.2:165
3747 "struct dqblk { /* Definition since Linux 2.4.22 */\n"
3748 " uint64_t dqb_bhardlimit; /* absolute limit on disk\n"
3749 " quota blocks alloc */\n"
3750 " uint64_t dqb_bsoftlimit; /* preferred limit on\n"
3751 " disk quota blocks */\n"
3752 " uint64_t dqb_curspace; /* current quota block\n"
3754 " uint64_t dqb_ihardlimit; /* maximum number of\n"
3755 " allocated inodes */\n"
3756 " uint64_t dqb_isoftlimit; /* preferred inode limit */\n"
3757 " uint64_t dqb_curinodes; /* current number of\n"
3758 " allocated inodes */\n"
3759 " uint64_t dqb_btime; /* time limit for excessive\n"
3761 " uint64_t dqb_itime; /* time limit for excessive\n"
3763 " uint32_t dqb_valid; /* bit mask of QIF_*\n"
3769 #: build/C/man2/quotactl.2:168
3772 "/* Flags in dqb_valid that indicate which fields in\n"
3773 " dqblk structure are valid. */\n"
3777 #: build/C/man2/quotactl.2:179
3780 "#define QIF_BLIMITS 1\n"
3781 "#define QIF_SPACE 2\n"
3782 "#define QIF_ILIMITS 4\n"
3783 "#define QIF_INODES 8\n"
3784 "#define QIF_BTIME 16\n"
3785 "#define QIF_ITIME 32\n"
3786 "#define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS)\n"
3787 "#define QIF_USAGE (QIF_SPACE | QIF_INODES)\n"
3788 "#define QIF_TIMES (QIF_BTIME | QIF_ITIME)\n"
3789 "#define QIF_ALL (QIF_LIMITS | QIF_USAGE | QIF_TIMES)\n"
3793 #: build/C/man2/quotactl.2:196
3795 "The I<dqb_valid> field is a bit mask that is set to indicate the entries in "
3796 "the I<dqblk> structure that are valid. Currently, the kernel fills in all "
3797 "entries of the I<dqblk> structure and marks them as valid in the "
3798 "I<dqb_valid> field. Unprivileged users may retrieve only their own quotas; "
3799 "a privileged user (B<CAP_SYS_ADMIN>) can retrieve the quotas of any user."
3803 #: build/C/man2/quotactl.2:196
3805 msgid "B<Q_SETQUOTA>"
3809 #: build/C/man2/quotactl.2:216
3811 "Set quota information for user or group I<id>, using the information "
3812 "supplied in the I<dqblk> structure pointed to by I<addr>. The I<dqb_valid> "
3813 "field of the I<dqblk> structure indicates which entries in the structure "
3814 "have been set by the caller. This operation supersedes the B<Q_SETQLIM> and "
3815 "B<Q_SETUSE> operations in the previous quota interfaces. This operation "
3816 "requires privilege (B<CAP_SYS_ADMIN>)."
3820 #: build/C/man2/quotactl.2:216
3822 msgid "B<Q_GETINFO>"
3826 #: build/C/man2/quotactl.2:227
3828 "Get information (like grace times) about quotafile. The I<addr> argument "
3829 "should be a pointer to a I<dqinfo> structure. This structure is defined in "
3830 "I<E<lt>sys/quota.hE<gt>> as follows:"
3834 #: build/C/man2/quotactl.2:236
3837 "struct dqinfo { /* Defined since kernel 2.4.22 */\n"
3838 " uint64_t dqi_bgrace; /* Time before block soft limit\n"
3839 " becomes hard limit */\n"
3843 #: build/C/man2/quotactl.2:243
3846 " uint64_t dqi_igrace; /* Time before inode soft limit\n"
3847 " becomes hard limit */\n"
3848 " uint32_t dqi_flags; /* Flags for quotafile\n"
3850 " uint32_t dqi_valid;\n"
3855 #: build/C/man2/quotactl.2:245
3857 msgid "/* Bits for dqi_flags */\n"
3861 #: build/C/man2/quotactl.2:247
3863 msgid "/* Quota format QFMT_VFS_OLD */\n"
3867 #: build/C/man2/quotactl.2:249
3869 msgid "#define V1_DQF_RSQUASH\t1 /* Root squash enabled */\n"
3873 #: build/C/man2/quotactl.2:251
3875 msgid "/* Other quota formats have no dqi_flags bits defined */\n"
3879 #: build/C/man2/quotactl.2:254
3882 "/* Flags in dqi_valid that indicate which fields in\n"
3883 " dqinfo structure are valid. */\n"
3887 #: build/C/man2/quotactl.2:259
3890 "# define IIF_BGRACE\t1\n"
3891 "# define IIF_IGRACE\t2\n"
3892 "# define IIF_FLAGS\t4\n"
3893 "# define IIF_ALL\t(IIF_BGRACE | IIF_IGRACE | IIF_FLAGS)\n"
3897 #: build/C/man2/quotactl.2:275
3899 "The I<dqi_valid> field in the I<dqinfo> structure indicates the entries in "
3900 "the structure that are valid. Currently, the kernel fills in all entries of "
3901 "the I<dqinfo> structure and marks them all as valid in the I<dqi_valid> "
3902 "field. The I<id> argument is ignored."
3906 #: build/C/man2/quotactl.2:275
3908 msgid "B<Q_SETINFO>"
3912 #: build/C/man2/quotactl.2:299
3914 "Set information about quotafile. The I<addr> argument should be a pointer "
3915 "to a I<dqinfo> structure. The I<dqi_valid> field of the I<dqinfo> structure "
3916 "indicates the entries in the structure that have been set by the caller. "
3917 "This operation supersedes the B<Q_SETGRACE> and B<Q_SETFLAGS> operations in "
3918 "the previous quota interfaces. The I<id> argument is ignored. This "
3919 "operation requires privilege (B<CAP_SYS_ADMIN>)."
3923 #: build/C/man2/quotactl.2:299
3929 #: build/C/man2/quotactl.2:306
3931 "Get quota format used on the specified file system. The I<addr> argument "
3932 "should be a pointer to a 4-byte buffer where the format number will be "
3937 #: build/C/man2/quotactl.2:306
3943 #: build/C/man2/quotactl.2:317
3945 "Update the on-disk copy of quota usages for a file system. If I<special> is "
3946 "NULL, then all file systems with active quotas are sync'ed. The I<addr> and "
3947 "I<id> arguments are ignored."
3951 #: build/C/man2/quotactl.2:317
3953 msgid "B<Q_GETSTATS>"
3956 #. Q_GETSTATS was removed in kernel 2.4.22.
3958 #: build/C/man2/quotactl.2:337
3960 "Get statistics and other generic information about the quota subsystem. The "
3961 "I<addr> argument should be a pointer to a I<dqstats> structure in which data "
3962 "should be stored. This structure is defined in I<E<lt>sys/quota.hE<gt>.> "
3963 "The I<special> and I<id> arguments are ignored. This operation is obsolete "
3964 "and not supported by recent kernels. Files in I</proc/sys/fs/quota/> carry "
3965 "the information instead."
3969 #: build/C/man2/quotactl.2:340
3971 "For XFS file systems making use of the XFS Quota Manager (XQM), the above "
3972 "commands are bypassed and the following commands are used:"
3976 #: build/C/man2/quotactl.2:340
3978 msgid "B<Q_XQUOTAON>"
3982 #: build/C/man2/quotactl.2:361
3984 "Turn on quotas for an XFS file system. XFS provides the ability to turn "
3985 "on/off quota limit enforcement with quota accounting. Therefore, XFS "
3986 "expects I<addr> to be a pointer to an I<unsigned int> that contains either "
3987 "the flags B<XFS_QUOTA_UDQ_ACCT> and/or B<XFS_QUOTA_UDQ_ENFD> (for user "
3988 "quota), or B<XFS_QUOTA_GDQ_ACCT> and/or B<XFS_QUOTA_GDQ_ENFD> (for group "
3989 "quota), as defined in I<E<lt>xfs/xqm.hE<gt>>. This operation requires "
3990 "privilege (B<CAP_SYS_ADMIN>)."
3994 #: build/C/man2/quotactl.2:361
3996 msgid "B<Q_XQUOTAOFF>"
4000 #: build/C/man2/quotactl.2:372
4002 "Turn off quotas for an XFS file system. As with B<Q_QUOTAON>, XFS file "
4003 "systems expect a pointer to an I<unsigned int> that specifies whether quota "
4004 "accounting and/or limit enforcement need to be turned off. This operation "
4005 "requires privilege (B<CAP_SYS_ADMIN>)."
4009 #: build/C/man2/quotactl.2:372
4011 msgid "B<Q_XGETQUOTA>"
4015 #: build/C/man2/quotactl.2:386
4017 "Get disk quota limits and current usage for user I<id>. The I<addr> "
4018 "argument is a pointer to an I<fs_disk_quota> structure (defined in "
4019 "I<E<lt>xfs/xqm.hE<gt>>). Unprivileged users may retrieve only their own "
4020 "quotas; a privileged user (B<CAP_SYS_ADMIN>) may retrieve the quotas of any "
4025 #: build/C/man2/quotactl.2:386
4027 msgid "B<Q_XSETQLIM>"
4031 #: build/C/man2/quotactl.2:398
4033 "Set disk quota limits for user I<id>. The I<addr> argument is a pointer to "
4034 "an I<fs_disk_quota> structure (defined in I<E<lt>xfs/xqm.hE<gt>>). This "
4035 "operation requires privilege (B<CAP_SYS_ADMIN>)."
4039 #: build/C/man2/quotactl.2:398
4041 msgid "B<Q_XGETQSTAT>"
4045 #: build/C/man2/quotactl.2:406
4047 "Returns an I<fs_quota_stat> structure containing XFS file system specific "
4048 "quota information. This is useful for finding out how much space is used to "
4049 "store quota information, and also to get quotaon/off status of a given local "
4054 #: build/C/man2/quotactl.2:406
4056 msgid "B<Q_XQUOTARM>"
4060 #: build/C/man2/quotactl.2:410
4062 "Free the disk space taken by disk quotas. Quotas must have already been "
4067 #: build/C/man2/quotactl.2:417
4069 "There is no command equivalent to B<Q_SYNC> for XFS since B<sync>(1) writes "
4070 "quota information to disk (in addition to the other file system metadata "
4071 "that it writes out)."
4075 #: build/C/man2/quotactl.2:417
4077 msgid "RETURN VALUES"
4081 #: build/C/man2/quotactl.2:425
4083 "On success, B<quotactl>() returns 0; on error -1 is returned, and I<errno> "
4084 "is set to indicate the error."
4088 #: build/C/man2/quotactl.2:432
4089 msgid "I<addr> or I<special> is invalid."
4093 #: build/C/man2/quotactl.2:438
4094 msgid "I<cmd> or I<type> is invalid."
4098 #: build/C/man2/quotactl.2:438
4104 #: build/C/man2/quotactl.2:445
4105 msgid "The file specified by I<special> or I<addr> does not exist."
4109 #: build/C/man2/quotactl.2:450
4110 msgid "The kernel has not been compiled with the B<CONFIG_QUOTA> option."
4114 #: build/C/man2/quotactl.2:450
4120 #: build/C/man2/quotactl.2:454
4121 msgid "I<special> is not a block device."
4125 #: build/C/man2/quotactl.2:459
4127 "The caller lacked the required privilege (B<CAP_SYS_ADMIN>) for the "
4128 "specified operation."
4132 #: build/C/man2/quotactl.2:463
4134 "No disk quota is found for the indicated user. Quotas have not been turned "
4135 "on for this file system."
4139 #: build/C/man2/quotactl.2:472
4140 msgid "If I<cmd> is B<Q_SETQUOTA>, B<quotactl>() may also set I<errno> to:"
4144 #: build/C/man2/quotactl.2:475
4145 msgid "Specified limits are out of range allowed by quota format."
4149 #: build/C/man2/quotactl.2:484
4150 msgid "If I<cmd> is B<Q_QUOTAON>, B<quotactl>() may also set I<errno> to:"
4154 #: build/C/man2/quotactl.2:493
4156 "The quota file pointed to by I<addr> exists, but is not a regular file; or, "
4157 "the quota file pointed to by I<addr> exists, but is not on the file system "
4158 "pointed to by I<special>."
4162 #: build/C/man2/quotactl.2:499
4163 msgid "B<Q_QUOTAON> attempted, but another B<Q_QUOTAON> had already been performed."
4167 #: build/C/man2/quotactl.2:502
4168 msgid "The quota file is corrupted."
4172 #: build/C/man2/quotactl.2:505
4173 msgid "Specified quota format was not found."
4177 #: build/C/man2/quotactl.2:510
4178 msgid "B<quota>(1), B<getrlimit>(2), B<quotacheck>(8), B<quotaon>(8)"
4182 #: build/C/man2/sendfile.2:15
4188 #: build/C/man2/sendfile.2:15
4194 #: build/C/man2/sendfile.2:18
4195 msgid "sendfile - transfer data between file descriptors"
4199 #: build/C/man2/sendfile.2:20
4200 msgid "B<#include E<lt>sys/sendfile.hE<gt>>"
4203 #. The below is too ugly. Comments about glibc versions belong
4204 #. in the notes, not in the header.
4206 #. .B #include <features.h>
4208 #. .B #if (__GLIBC__==2 && __GLIBC_MINOR__>=1) || __GLIBC__>2
4210 #. .B #include <sys/sendfile.h>
4214 #. .B #include <sys/types.h>
4216 #. .B /* No system prototype before glibc 2.1. */
4218 #. .BI "ssize_t sendfile(int" " out_fd" ", int" " in_fd" ", off_t *" \
4219 #. offset ", size_t" " count" )
4223 #: build/C/man2/sendfile.2:43
4225 "B<ssize_t sendfile(int>I< out_fd>B<, int>I< in_fd>B<, off_t *>I<offset>B<, "
4226 "size_t>I< count>B<);>"
4230 #: build/C/man2/sendfile.2:53
4232 "B<sendfile>() copies data between one file descriptor and another. Because "
4233 "this copying is done within the kernel, B<sendfile>() is more efficient "
4234 "than the combination of B<read>(2) and B<write>(2), which would require "
4235 "transferring data to and from user space."
4239 #: build/C/man2/sendfile.2:58
4241 "I<in_fd> should be a file descriptor opened for reading and I<out_fd> should "
4242 "be a descriptor opened for writing."
4246 #: build/C/man2/sendfile.2:79
4248 "If I<offset> is not NULL, then it points to a variable holding the file "
4249 "offset from which B<sendfile>() will start reading data from I<in_fd>. "
4250 "When B<sendfile>() returns, this variable will be set to the offset of the "
4251 "byte following the last byte that was read. If I<offset> is not NULL, then "
4252 "B<sendfile>() does not modify the current file offset of I<in_fd>; "
4253 "otherwise the current file offset is adjusted to reflect the number of bytes "
4254 "read from I<in_fd>."
4258 #: build/C/man2/sendfile.2:86
4260 "If I<offset> is NULL, then data will be read from I<in_fd> starting at the "
4261 "current file offset, and the file offset will be updated by the call."
4265 #: build/C/man2/sendfile.2:89
4266 msgid "I<count> is the number of bytes to copy between the file descriptors."
4270 #: build/C/man2/sendfile.2:96
4272 "The I<in_fd> argument must correspond to a file which supports "
4273 "B<mmap>(2)-like operations (i.e., it cannot be a socket)."
4277 #: build/C/man2/sendfile.2:104
4279 "In Linux kernels before 2.6.33, I<out_fd> must refer to a socket. Since "
4280 "Linux 2.6.33 it can be any file. If it is a regular file, then "
4281 "B<sendfile>() changes the file offset appropriately."
4285 #: build/C/man2/sendfile.2:111
4287 "If the transfer was successful, the number of bytes written to I<out_fd> is "
4288 "returned. On error, -1 is returned, and I<errno> is set appropriately."
4292 #: build/C/man2/sendfile.2:117
4294 "Nonblocking I/O has been selected using B<O_NONBLOCK> and the write would "
4299 #: build/C/man2/sendfile.2:117 build/C/man2/splice.2:143 build/C/man2/vmsplice.2:123
4305 #: build/C/man2/sendfile.2:121
4307 "The input file was not opened for reading or the output file was not opened "
4312 #: build/C/man2/sendfile.2:124
4313 msgid "Bad address."
4317 #: build/C/man2/sendfile.2:130
4319 "Descriptor is not valid or locked, or an B<mmap>(2)-like operation is not "
4320 "available for I<in_fd>."
4324 #: build/C/man2/sendfile.2:134
4325 msgid "Unspecified error while reading from I<in_fd>."
4329 #: build/C/man2/sendfile.2:138
4330 msgid "Insufficient memory to read from I<in_fd>."
4334 #: build/C/man2/sendfile.2:144
4336 "B<sendfile>() is a new feature in Linux 2.2. The include file "
4337 "I<E<lt>sys/sendfile.hE<gt>> is present since glibc 2.1."
4341 #: build/C/man2/sendfile.2:146
4342 msgid "Not specified in POSIX.1-2001, or other standards."
4346 #: build/C/man2/sendfile.2:151
4348 "Other UNIX systems implement B<sendfile>() with different semantics and "
4349 "prototypes. It should not be used in portable programs."
4353 #: build/C/man2/sendfile.2:161
4355 "If you plan to use B<sendfile>() for sending files to a TCP socket, but "
4356 "need to send some header data in front of the file contents, you will find "
4357 "it useful to employ the B<TCP_CORK> option, described in B<tcp>(7), to "
4358 "minimize the number of packets and to tune performance."
4362 #: build/C/man2/sendfile.2:167
4364 "In Linux 2.4 and earlier, I<out_fd> could also refer to a regular file, and "
4365 "B<sendfile>() changed the current offset of that file."
4369 #: build/C/man2/sendfile.2:179
4371 "The original Linux B<sendfile>() system call was not designed to handle "
4372 "large file offsets. Consequently, Linux 2.4 added B<sendfile64>(), with a "
4373 "wider type for the I<offset> argument. The glibc B<sendfile>() wrapper "
4374 "function transparently deals with the kernel differences."
4378 #: build/C/man2/sendfile.2:188
4380 "Applications may wish to fall back to B<read>(2)/B<write>(2) in the case "
4381 "where B<sendfile>() fails with B<EINVAL> or B<ENOSYS>."
4385 #: build/C/man2/sendfile.2:193
4387 "The Linux-specific B<splice>(2) call supports transferring data between "
4388 "arbitrary files (e.g., a pair of sockets)."
4392 #: build/C/man2/sendfile.2:198
4393 msgid "B<mmap>(2), B<open>(2), B<socket>(2), B<splice>(2)"
4397 #: build/C/man2/set_tid_address.2:23
4399 msgid "SET_TID_ADDRESS"
4403 #: build/C/man2/set_tid_address.2:23
4409 #: build/C/man2/set_tid_address.2:26
4410 msgid "set_tid_address - set pointer to thread ID"
4414 #: build/C/man2/set_tid_address.2:29
4416 msgid "B<#include E<lt>linux/unistd.hE<gt>>\n"
4420 #: build/C/man2/set_tid_address.2:31
4422 msgid "B<long set_tid_address(int *>I<tidptr>B<);>\n"
4426 #: build/C/man2/set_tid_address.2:38
4428 "The kernel keeps for each process two values called I<set_child_tid> and "
4429 "I<clear_child_tid> that are NULL by default."
4433 #: build/C/man2/set_tid_address.2:38
4435 msgid "set_child_tid"
4439 #: build/C/man2/set_tid_address.2:48
4441 "If a process is started using B<clone>(2) with the B<CLONE_CHILD_SETTID> "
4442 "flag, I<set_child_tid> is set to I<child_tidptr>, the fifth argument of that "
4447 #: build/C/man2/set_tid_address.2:53
4449 "When I<set_child_tid> is set, the very first thing the new process does is "
4450 "writing its PID at this address."
4454 #: build/C/man2/set_tid_address.2:53
4456 msgid "clear_child_tid"
4460 #: build/C/man2/set_tid_address.2:63
4462 "If a process is started using B<clone>(2) with the B<CLONE_CHILD_CLEARTID> "
4463 "flag, I<clear_child_tid> is set to I<child_tidptr>, the fifth argument of "
4468 #: build/C/man2/set_tid_address.2:70
4470 "The system call B<set_tid_address>() sets the I<clear_child_tid> value for "
4471 "the calling process to I<tidptr>."
4475 #: build/C/man2/set_tid_address.2:80
4477 "When I<clear_child_tid> is set, and the process exits, and the process was "
4478 "sharing memory with other processes or threads, then 0 is written at this "
4479 "address, and a I<futex(child_tidptr, FUTEX_WAKE, 1, NULL, NULL, 0);> call is "
4480 "done. (That is, wake a single process waiting on this futex.) Errors are "
4485 #: build/C/man2/set_tid_address.2:83
4486 msgid "B<set_tid_address>() always returns the PID of the calling process."
4490 #: build/C/man2/set_tid_address.2:86
4491 msgid "B<set_tid_address>() always succeeds."
4495 #: build/C/man2/set_tid_address.2:89
4497 "This call is present since Linux 2.5.48. Details as given here are valid "
4498 "since Linux 2.5.49."
4502 #: build/C/man2/set_tid_address.2:94
4503 msgid "B<clone>(2), B<futex>(2)"
4507 #: build/C/man2/splice.2:26
4513 #: build/C/man2/splice.2:26 build/C/man2/tee.2:26 build/C/man2/vmsplice.2:26
4519 #: build/C/man2/splice.2:29
4520 msgid "splice - splice data to/from a pipe"
4524 #: build/C/man2/splice.2:33 build/C/man2/tee.2:33
4527 "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n"
4528 "B<#include E<lt>fcntl.hE<gt>>\n"
4531 #. Return type was long before glibc 2.7
4533 #: build/C/man2/splice.2:38
4536 "B<ssize_t splice(int >I<fd_in>B<, loff_t *>I<off_in>B<, int >I<fd_out>B<,>\n"
4537 "B< loff_t *>I<off_out>B<, size_t >I<len>B<, unsigned int "
4542 #: build/C/man2/splice.2:50
4544 "B<splice>() moves data between two file descriptors without copying between "
4545 "kernel address space and user address space. It transfers up to I<len> "
4546 "bytes of data from the file descriptor I<fd_in> to the file descriptor "
4547 "I<fd_out>, where one of the descriptors must refer to a pipe."
4551 #: build/C/man2/splice.2:80
4553 "If I<fd_in> refers to a pipe, then I<off_in> must be NULL. If I<fd_in> does "
4554 "not refer to a pipe and I<off_in> is NULL, then bytes are read from I<fd_in> "
4555 "starting from the current file offset, and the current file offset is "
4556 "adjusted appropriately. If I<fd_in> does not refer to a pipe and I<off_in> "
4557 "is not NULL, then I<off_in> must point to a buffer which specifies the "
4558 "starting offset from which bytes will be read from I<fd_in>; in this case, "
4559 "the current file offset of I<fd_in> is not changed. Analogous statements "
4560 "apply for I<fd_out> and I<off_out>."
4564 #: build/C/man2/splice.2:85 build/C/man2/vmsplice.2:78
4566 "The I<flags> argument is a bit mask that is composed by ORing together zero "
4567 "or more of the following values:"
4571 #: build/C/man2/splice.2:85 build/C/man2/tee.2:62 build/C/man2/vmsplice.2:78
4573 msgid "B<SPLICE_F_MOVE>"
4577 #: build/C/man2/splice.2:98
4579 "Attempt to move pages instead of copying. This is only a hint to the "
4580 "kernel: pages may still be copied if the kernel cannot move the pages from "
4581 "the pipe, or if the pipe buffers don't refer to full pages. The initial "
4582 "implementation of this flag was buggy: therefore starting in Linux 2.6.21 it "
4583 "is a no-op (but is still permitted in a B<splice>() call); in the future, a "
4584 "correct implementation may be restored."
4588 #: build/C/man2/splice.2:98 build/C/man2/tee.2:68 build/C/man2/vmsplice.2:84
4590 msgid "B<SPLICE_F_NONBLOCK>"
4594 #: build/C/man2/splice.2:107
4596 "Do not block on I/O. This makes the splice pipe operations nonblocking, but "
4597 "B<splice>() may nevertheless block because the file descriptors that are "
4598 "spliced to/from may block (unless they have the B<O_NONBLOCK> flag set)."
4602 #: build/C/man2/splice.2:107 build/C/man2/tee.2:73 build/C/man2/vmsplice.2:91
4604 msgid "B<SPLICE_F_MORE>"
4608 #: build/C/man2/splice.2:121
4610 "More data will be coming in a subsequent splice. This is a helpful hint "
4611 "when the I<fd_out> refers to a socket (see also the description of "
4612 "B<MSG_MORE> in B<send>(2), and the description of B<TCP_CORK> in B<tcp>(7))"
4616 #: build/C/man2/splice.2:121 build/C/man2/tee.2:79 build/C/man2/vmsplice.2:97
4618 msgid "B<SPLICE_F_GIFT>"
4622 #: build/C/man2/splice.2:127
4623 msgid "Unused for B<splice>(); see B<vmsplice>(2)."
4627 #: build/C/man2/splice.2:136
4629 "Upon successful completion, B<splice>() returns the number of bytes spliced "
4630 "to or from the pipe. A return value of 0 means that there was no data to "
4631 "transfer, and it would not make sense to block, because there are no writers "
4632 "connected to the write end of the pipe referred to by I<fd_in>."
4636 #: build/C/man2/splice.2:142
4637 msgid "On error, B<splice>() returns -1 and I<errno> is set to indicate the error."
4641 #: build/C/man2/splice.2:147
4643 "One or both file descriptors are not valid, or do not have proper read-write "
4647 #. The append-mode error is given since 2.6.27; in earlier kernels,
4648 #. splice() in append mode was broken
4650 #: build/C/man2/splice.2:155
4652 "Target file system doesn't support splicing; target file is opened in append "
4653 "mode; neither of the descriptors refers to a pipe; or offset given for "
4654 "nonseekable device."
4658 #: build/C/man2/splice.2:158 build/C/man2/tee.2:114 build/C/man2/vmsplice.2:138
4659 msgid "Out of memory."
4663 #: build/C/man2/splice.2:158
4669 #: build/C/man2/splice.2:165
4671 "Either I<off_in> or I<off_out> was not NULL, but the corresponding file "
4672 "descriptor refers to a pipe."
4676 #: build/C/man2/splice.2:169
4677 msgid "The B<splice>() system call first appeared in Linux 2.6.17."
4681 #: build/C/man2/splice.2:181
4683 "The three system calls B<splice>(), B<vmsplice>(2), and B<tee>(2), provide "
4684 "userspace programs with full control over an arbitrary kernel buffer, "
4685 "implemented within the kernel using the same type of buffer that is used for "
4686 "a pipe. In overview, these system calls perform the following tasks:"
4690 #: build/C/man2/splice.2:181
4696 #: build/C/man2/splice.2:185
4698 "moves data from the buffer to an arbitrary file descriptor, or vice versa, "
4699 "or from one buffer to another."
4703 #: build/C/man2/splice.2:185
4709 #: build/C/man2/splice.2:188
4710 msgid "\"copies\" the data from one buffer to another."
4714 #: build/C/man2/splice.2:188
4716 msgid "B<vmsplice>(2)"
4720 #: build/C/man2/splice.2:191
4721 msgid "\"copies\" data from user space into the buffer."
4725 #. Linus: Now, imagine using the above in a media server, for example.
4726 #. Let's say that a year or two has passed, so that the video drivers
4727 #. have been updated to be able to do the splice thing, and what can
4730 #. - splice from the (mpeg or whatever - let's just assume that the video
4731 #. input is either digital or does the encoding on its own - like they
4732 #. pretty much all do) video input into a pipe (remember: no copies - the
4733 #. video input will just DMA directly into memory, and splice will just
4734 #. set up the pages in the pipe buffer)
4735 #. - tee that pipe to split it up
4736 #. - splice one end to a file (ie "save the compressed stream to disk")
4737 #. - splice the other end to a real-time video decoder window for your
4738 #. real-time viewing pleasure.
4740 #. Linus: Now, the advantage of splice()/tee() is that you can
4741 #. do zero-copy movement of data, and unlike sendfile() you can
4742 #. do it on _arbitrary_ data (and, as shown by "tee()", it's more
4743 #. than just sending the data to somebody else: you can duplicate
4744 #. the data and choose to forward it to two or more different
4745 #. users - for things like logging etc.).
4747 #: build/C/man2/splice.2:222
4749 "Though we talk of copying, actual copies are generally avoided. The kernel "
4750 "does this by implementing a pipe buffer as a set of reference-counted "
4751 "pointers to pages of kernel memory. The kernel creates \"copies\" of pages "
4752 "in a buffer by creating new pointers (for the output buffer) referring to "
4753 "the pages, and increasing the reference counts for the pages: only pointers "
4754 "are copied, not the pages of the buffer."
4758 #: build/C/man2/splice.2:222 build/C/man2/tee.2:129
4764 #: build/C/man2/splice.2:225
4765 msgid "See B<tee>(2)."
4769 #: build/C/man2/splice.2:229
4770 msgid "B<sendfile>(2), B<tee>(2), B<vmsplice>(2)"
4774 #: build/C/man2/tee.2:26
4780 #: build/C/man2/tee.2:29
4781 msgid "tee - duplicating pipe content"
4785 #: build/C/man2/tee.2:36
4788 "B<ssize_t tee(int >I<fd_in>B<, int >I<fd_out>B<, size_t >I<len>B<, unsigned "
4789 "int >I<flags>B<);>\n"
4792 #. Example programs http://brick.kernel.dk/snaps
4795 #. add a "tee(in, out1, out2)" system call that duplicates the pages
4796 #. (again, incrementing their reference count, not copying the data) from
4797 #. one pipe to two other pipes.
4799 #: build/C/man2/tee.2:56
4801 "B<tee>() duplicates up to I<len> bytes of data from the pipe referred to by "
4802 "the file descriptor I<fd_in> to the pipe referred to by the file descriptor "
4803 "I<fd_out>. It does not consume the data that is duplicated from I<fd_in>; "
4804 "therefore, that data can be copied by a subsequent B<splice>(2)."
4808 #: build/C/man2/tee.2:62
4810 "I<flags> is a series of modifier flags, which share the name space with "
4811 "B<splice>(2) and B<vmsplice>(2):"
4815 #: build/C/man2/tee.2:68
4816 msgid "Currently has no effect for B<tee>(); see B<splice>(2)."
4819 #. Not used for vmsplice
4820 #. May be in the future -- therefore EAGAIN
4822 #: build/C/man2/tee.2:73 build/C/man2/vmsplice.2:91
4823 msgid "Do not block on I/O; see B<splice>(2) for further details."
4827 #: build/C/man2/tee.2:79
4829 "Currently has no effect for B<tee>(), but may be implemented in the future; "
4834 #: build/C/man2/tee.2:85
4835 msgid "Unused for B<tee>(); see B<vmsplice>(2)."
4839 #: build/C/man2/tee.2:94
4841 "Upon successful completion, B<tee>() returns the number of bytes that were "
4842 "duplicated between the input and output. A return value of 0 means that "
4843 "there was no data to transfer, and it would not make sense to block, because "
4844 "there are no writers connected to the write end of the pipe referred to by "
4849 #: build/C/man2/tee.2:100
4850 msgid "On error, B<tee>() returns -1 and I<errno> is set to indicate the error."
4854 #: build/C/man2/tee.2:111
4856 "I<fd_in> or I<fd_out> does not refer to a pipe; or I<fd_in> and I<fd_out> "
4857 "refer to the same pipe."
4861 #: build/C/man2/tee.2:118
4862 msgid "The B<tee>() system call first appeared in Linux 2.6.17."
4866 #: build/C/man2/tee.2:129
4868 "Conceptually, B<tee>() copies the data between the two pipes. In reality "
4869 "no real data copying takes place though: under the covers, B<tee>() assigns "
4870 "data in the output by merely grabbing a reference to the input."
4874 #: build/C/man2/tee.2:135
4876 "The following example implements a basic B<tee>(1) program using the "
4877 "B<tee>() system call."
4881 #: build/C/man2/tee.2:144
4884 "#define _GNU_SOURCE\n"
4885 "#include E<lt>fcntl.hE<gt>\n"
4886 "#include E<lt>stdio.hE<gt>\n"
4887 "#include E<lt>stdlib.hE<gt>\n"
4888 "#include E<lt>unistd.hE<gt>\n"
4889 "#include E<lt>errno.hE<gt>\n"
4890 "#include E<lt>limits.hE<gt>\n"
4894 #: build/C/man2/tee.2:150
4898 "main(int argc, char *argv[])\n"
4905 #: build/C/man2/tee.2:155
4908 " if (argc != 2) {\n"
4909 " fprintf(stderr, \"Usage: %s E<lt>fileE<gt>\\en\", argv[0]);\n"
4910 " exit(EXIT_FAILURE);\n"
4915 #: build/C/man2/tee.2:161
4918 " fd = open(argv[1], O_WRONLY | O_CREAT | O_TRUNC, 0644);\n"
4919 " if (fd == -1) {\n"
4920 " perror(\"open\");\n"
4921 " exit(EXIT_FAILURE);\n"
4926 #: build/C/man2/tee.2:168
4931 " * tee stdin to stdout.\n"
4933 " len = tee(STDIN_FILENO, STDOUT_FILENO,\n"
4934 " INT_MAX, SPLICE_F_NONBLOCK);\n"
4938 #: build/C/man2/tee.2:177
4941 " if (len E<lt> 0) {\n"
4942 " if (errno == EAGAIN)\n"
4944 " perror(\"tee\");\n"
4945 " exit(EXIT_FAILURE);\n"
4952 #: build/C/man2/tee.2:191
4956 " * Consume stdin by splicing it to a file.\n"
4958 " while (len E<gt> 0) {\n"
4959 " slen = splice(STDIN_FILENO, NULL, fd, NULL,\n"
4960 " len, SPLICE_F_MOVE);\n"
4961 " if (slen E<lt> 0) {\n"
4962 " perror(\"splice\");\n"
4971 #: build/C/man2/tee.2:195
4975 " exit(EXIT_SUCCESS);\n"
4980 #: build/C/man2/tee.2:199
4981 msgid "B<splice>(2), B<vmsplice>(2)"
4985 #: build/C/man2/vm86.2:26
4991 #: build/C/man2/vm86.2:26
4997 #: build/C/man2/vm86.2:29
4998 msgid "vm86old, vm86 - enter virtual 8086 mode"
5002 #: build/C/man2/vm86.2:31
5003 msgid "B<#include E<lt>sys/vm86.hE<gt>>"
5007 #: build/C/man2/vm86.2:33
5008 msgid "B<int vm86old(struct vm86_struct *>I<info>B<);>"
5012 #: build/C/man2/vm86.2:35
5013 msgid "B<int vm86(unsigned long >I<fn>B<, struct vm86plus_struct *>I<v86>B<);>"
5017 #: build/C/man2/vm86.2:46
5019 "The system call B<vm86>() was introduced in Linux 0.97p2. In Linux 2.1.15 "
5020 "and 2.0.28 it was renamed to B<vm86old>(), and a new B<vm86>() was "
5021 "introduced. The definition of I<struct vm86_struct> was changed in 1.1.8 "
5026 #: build/C/man2/vm86.2:50
5028 "These calls cause the process to enter VM86 mode (virtual-8086 in Intel "
5029 "literature), and are used by B<dosemu>."
5033 #: build/C/man2/vm86.2:52
5034 msgid "VM86 mode is an emulation of real mode within a protected mode task."
5038 #: build/C/man2/vm86.2:62
5040 "This return value is specific to i386 and indicates a problem with getting "
5045 #: build/C/man2/vm86.2:66
5047 "This return value indicates the call is not implemented on the present "
5052 #: build/C/man2/vm86.2:71
5054 "Saved kernel stack exists. (This is a kernel sanity check; the saved stack "
5055 "should only exist within vm86 mode itself.)"
5059 #: build/C/man2/vm86.2:74
5061 "This call is specific to Linux on 32-bit Intel processors, and should not be "
5062 "used in programs intended to be portable."
5066 #: build/C/man2/vmsplice.2:26
5072 #: build/C/man2/vmsplice.2:29
5073 msgid "vmsplice - splice user pages into a pipe"
5077 #: build/C/man2/vmsplice.2:34
5080 "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n"
5081 "B<#include E<lt>fcntl.hE<gt>>\n"
5082 "B<#include E<lt>sys/uio.hE<gt>>\n"
5086 #: build/C/man2/vmsplice.2:37
5089 "B<ssize_t vmsplice(int >I<fd>B<, const struct iovec *>I<iov>B<,>\n"
5090 "B< unsigned long >I<nr_segs>B<, unsigned int "
5094 #. Linus: vmsplice() system call to basically do a "write to
5095 #. the buffer", but using the reference counting and VM traversal
5096 #. to actually fill the buffer. This means that the user needs to
5097 #. be careful not to reuse the user-space buffer it spliced into
5098 #. the kernel-space one (contrast this to "write()", which copies
5099 #. the actual data, and you can thus reuse the buffer immediately
5100 #. after a successful write), but that is often easy to do.
5102 #: build/C/man2/vmsplice.2:57
5104 "The B<vmsplice>() system call maps I<nr_segs> ranges of user memory "
5105 "described by I<iov> into a pipe. The file descriptor I<fd> must refer to a "
5110 #: build/C/man2/vmsplice.2:64
5112 "The pointer I<iov> points to an array of I<iovec> structures as defined in "
5113 "I<E<lt>sys/uio.hE<gt>>:"
5117 #: build/C/man2/vmsplice.2:71
5121 " void *iov_base; /* Starting address */\n"
5122 " size_t iov_len; /* Number of bytes */\n"
5127 #: build/C/man2/vmsplice.2:84
5128 msgid "Unused for B<vmsplice>(); see B<splice>(2)."
5132 #: build/C/man2/vmsplice.2:97
5134 "Currently has no effect for B<vmsplice>(), but may be implemented in the "
5135 "future; see B<splice>(2)."
5138 #. FIXME Explain the following line in a little more detail:
5139 #. .... if we expect to later SPLICE_F_MOVE to the cache.
5141 #: build/C/man2/vmsplice.2:113
5143 "The user pages are a gift to the kernel. The application may not modify "
5144 "this memory ever, or page cache and on-disk data may differ. Gifting pages "
5145 "to the kernel means that a subsequent B<splice>(2) B<SPLICE_F_MOVE> can "
5146 "successfully move the pages; if this flag is not specified, then a "
5147 "subsequent B<splice>(2) B<SPLICE_F_MOVE> must copy the pages. Data must "
5148 "also be properly page aligned, both in memory and length."
5152 #: build/C/man2/vmsplice.2:122
5154 "Upon successful completion, B<vmsplice>() returns the number of bytes "
5155 "transferred to the pipe. On error, B<vmsplice>() returns -1 and I<errno> "
5156 "is set to indicate the error."
5160 #: build/C/man2/vmsplice.2:127
5161 msgid "I<fd> either not valid, or doesn't refer to a pipe."
5165 #: build/C/man2/vmsplice.2:135
5167 "I<nr_segs> is 0 or greater than B<IOV_MAX>; or memory not aligned if "
5168 "B<SPLICE_F_GIFT> set."
5172 #: build/C/man2/vmsplice.2:142
5173 msgid "The B<vmsplice>() system call first appeared in Linux 2.6.17."
5177 #: build/C/man2/vmsplice.2:153
5179 "B<vmsplice>() follows the other vectorized read/write type functions when "
5180 "it comes to limitations on number of segments being passed in. This limit "
5181 "is B<IOV_MAX> as defined in I<E<lt>limits.hE<gt>>. At the time of this "
5182 "writing, that limit is 1024."
5186 #: build/C/man2/vmsplice.2:156
5187 msgid "B<splice>(2), B<tee>(2)"