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: 2013-03-26 16:48+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:25
26 #: build/C/man2/arch_prctl.2:25
32 #: build/C/man2/arch_prctl.2:25 build/C/man2/futex.2:53 build/C/man2/get_robust_list.2:29 build/C/man2/getunwind.2:27 build/C/man2/kexec_load.2:26 build/C/man2/lookup_dcookie.2:27 build/C/man2/modify_ldt.2:24 build/C/man2/nfsservctl.2:8 build/C/man2/outb.2:26 build/C/man2/pciconfig_read.2:8 build/C/man2/perf_event_open.2:27 build/C/man2/perfmonctl.2:27 build/C/man2/personality.2:32 build/C/man2/pivot_root.2:10 build/C/man2/process_vm_readv.2:29 build/C/man2/ptrace.2:44 build/C/man2/quotactl.2:27 build/C/man2/sendfile.2:19 build/C/man2/set_tid_address.2:25 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:25 build/C/man2/futex.2:53 build/C/man2/getunwind.2:27 build/C/man2/kexec_load.2:26 build/C/man2/lookup_dcookie.2:27 build/C/man2/modify_ldt.2:24 build/C/man2/nfsservctl.2:8 build/C/man2/outb.2:26 build/C/man2/pciconfig_read.2:8 build/C/man2/perf_event_open.2:27 build/C/man2/perfmonctl.2:27 build/C/man2/personality.2:32 build/C/man2/pivot_root.2:10 build/C/man2/process_vm_readv.2:29 build/C/man2/ptrace.2:44 build/C/man2/quotactl.2:27 build/C/man2/sendfile.2:19 build/C/man2/set_tid_address.2:25 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:26 build/C/man2/futex.2:54 build/C/man2/get_robust_list.2:30 build/C/man2/getunwind.2:28 build/C/man2/kexec_load.2:27 build/C/man2/lookup_dcookie.2:28 build/C/man2/modify_ldt.2:25 build/C/man2/nfsservctl.2:9 build/C/man2/outb.2:27 build/C/man2/pciconfig_read.2:9 build/C/man2/perf_event_open.2:28 build/C/man2/perfmonctl.2:28 build/C/man2/personality.2:33 build/C/man2/pivot_root.2:11 build/C/man2/process_vm_readv.2:30 build/C/man2/ptrace.2:45 build/C/man2/quotactl.2:28 build/C/man2/sendfile.2:20 build/C/man2/set_tid_address.2:26 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:28
51 msgid "arch_prctl - set architecture-specific thread state"
55 #: build/C/man2/arch_prctl.2:28 build/C/man2/futex.2:56 build/C/man2/get_robust_list.2:32 build/C/man2/getunwind.2:30 build/C/man2/kexec_load.2:29 build/C/man2/lookup_dcookie.2:30 build/C/man2/modify_ldt.2:27 build/C/man2/nfsservctl.2:11 build/C/man2/outb.2:31 build/C/man2/pciconfig_read.2:11 build/C/man2/perf_event_open.2:30 build/C/man2/perfmonctl.2:30 build/C/man2/personality.2:35 build/C/man2/pivot_root.2:13 build/C/man2/process_vm_readv.2:32 build/C/man2/ptrace.2:47 build/C/man2/quotactl.2:30 build/C/man2/sendfile.2:22 build/C/man2/set_tid_address.2:28 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:31
63 msgid "B<#include E<lt>asm/prctl.hE<gt>>\n"
67 #: build/C/man2/arch_prctl.2:33
69 msgid "B<#include E<lt>sys/prctl.hE<gt>>\n"
73 #: build/C/man2/arch_prctl.2:36
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:37 build/C/man2/futex.2:68 build/C/man2/get_robust_list.2:44 build/C/man2/getunwind.2:40 build/C/man2/kexec_load.2:39 build/C/man2/lookup_dcookie.2:32 build/C/man2/modify_ldt.2:36 build/C/man2/nfsservctl.2:18 build/C/man2/outb.2:62 build/C/man2/pciconfig_read.2:22 build/C/man2/perf_event_open.2:42 build/C/man2/perfmonctl.2:39 build/C/man2/personality.2:39 build/C/man2/pivot_root.2:18 build/C/man2/process_vm_readv.2:50 build/C/man2/ptrace.2:54 build/C/man2/quotactl.2:38 build/C/man2/sendfile.2:47 build/C/man2/set_tid_address.2:34 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:52
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:54
98 msgid "Sub functions for x86-64 are:"
102 #: build/C/man2/arch_prctl.2:54
104 msgid "B<ARCH_SET_FS>"
108 #: build/C/man2/arch_prctl.2:60
109 msgid "Set the 64-bit base for the I<FS> register to I<addr>."
113 #: build/C/man2/arch_prctl.2:60
115 msgid "B<ARCH_GET_FS>"
119 #: build/C/man2/arch_prctl.2:68
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:68
128 msgid "B<ARCH_SET_GS>"
132 #: build/C/man2/arch_prctl.2:74
133 msgid "Set the 64-bit base for the I<GS> register to I<addr>."
137 #: build/C/man2/arch_prctl.2:74
139 msgid "B<ARCH_GET_GS>"
143 #: build/C/man2/arch_prctl.2:82
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:82 build/C/man2/futex.2:209 build/C/man2/get_robust_list.2:77 build/C/man2/getunwind.2:81 build/C/man2/kexec_load.2:114 build/C/man2/lookup_dcookie.2:43 build/C/man2/modify_ldt.2:98 build/C/man2/nfsservctl.2:51 build/C/man2/pciconfig_read.2:50 build/C/man2/perf_event_open.2:1804 build/C/man2/perfmonctl.2:190 build/C/man2/personality.2:57 build/C/man2/pivot_root.2:101 build/C/man2/process_vm_readv.2:209 build/C/man2/ptrace.2:1713 build/C/man2/sendfile.2:108 build/C/man2/set_tid_address.2:88 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:88
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:88 build/C/man2/futex.2:234 build/C/man2/get_robust_list.2:84 build/C/man2/getunwind.2:88 build/C/man2/kexec_load.2:121 build/C/man2/lookup_dcookie.2:50 build/C/man2/modify_ldt.2:108 build/C/man2/pciconfig_read.2:77 build/C/man2/perf_event_open.2:1810 build/C/man2/personality.2:64 build/C/man2/pivot_root.2:105 build/C/man2/process_vm_readv.2:229 build/C/man2/ptrace.2:1727 build/C/man2/quotactl.2:427 build/C/man2/sendfile.2:115 build/C/man2/set_tid_address.2:91 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:89 build/C/man2/futex.2:249 build/C/man2/get_robust_list.2:111 build/C/man2/lookup_dcookie.2:51 build/C/man2/modify_ldt.2:109 build/C/man2/process_vm_readv.2:251 build/C/man2/process_vm_readv.2:256 build/C/man2/ptrace.2:1731 build/C/man2/quotactl.2:428 build/C/man2/sendfile.2:125 build/C/man2/vm86.2:58
175 #: build/C/man2/arch_prctl.2:93
177 "I<addr> points to an unmapped address or is outside the process address "
182 #: build/C/man2/arch_prctl.2:93 build/C/man2/futex.2:261 build/C/man2/get_robust_list.2:88 build/C/man2/kexec_load.2:126 build/C/man2/lookup_dcookie.2:54 build/C/man2/modify_ldt.2:113 build/C/man2/pciconfig_read.2:78 build/C/man2/perf_event_open.2:1811 build/C/man2/personality.2:65 build/C/man2/pivot_root.2:114 build/C/man2/process_vm_readv.2:230 build/C/man2/process_vm_readv.2:241 build/C/man2/process_vm_readv.2:245 build/C/man2/ptrace.2:1742 build/C/man2/quotactl.2:434 build/C/man2/quotactl.2:501 build/C/man2/sendfile.2:128 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:97
189 msgid "I<code> is not a valid subcommand."
193 #: build/C/man2/arch_prctl.2:97 build/C/man2/get_robust_list.2:98 build/C/man2/kexec_load.2:133 build/C/man2/lookup_dcookie.2:65 build/C/man2/pciconfig_read.2:105 build/C/man2/pivot_root.2:120 build/C/man2/process_vm_readv.2:267 build/C/man2/ptrace.2:1752 build/C/man2/quotactl.2:456 build/C/man2/vm86.2:66
199 #. Man page written by Andi Kleen.
201 #: build/C/man2/arch_prctl.2:103
202 msgid "I<addr> is outside the process address space."
206 #: build/C/man2/arch_prctl.2:103 build/C/man2/futex.2:296 build/C/man2/getunwind.2:96 build/C/man2/kexec_load.2:142 build/C/man2/lookup_dcookie.2:78 build/C/man2/modify_ldt.2:130 build/C/man2/nfsservctl.2:56 build/C/man2/outb.2:87 build/C/man2/pciconfig_read.2:110 build/C/man2/perf_event_open.2:1829 build/C/man2/perfmonctl.2:199 build/C/man2/personality.2:68 build/C/man2/pivot_root.2:128 build/C/man2/process_vm_readv.2:279 build/C/man2/ptrace.2:1770 build/C/man2/sendfile.2:148 build/C/man2/set_tid_address.2:97 build/C/man2/splice.2:170 build/C/man2/tee.2:119 build/C/man2/vm86.2:71 build/C/man2/vmsplice.2:143
208 msgid "CONFORMING TO"
212 #: build/C/man2/arch_prctl.2:107
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:107 build/C/man2/futex.2:298 build/C/man2/get_robust_list.2:119 build/C/man2/getunwind.2:99 build/C/man2/kexec_load.2:144 build/C/man2/lookup_dcookie.2:81 build/C/man2/modify_ldt.2:133 build/C/man2/perf_event_open.2:1834 build/C/man2/perfmonctl.2:202 build/C/man2/pivot_root.2:131 build/C/man2/process_vm_readv.2:281 build/C/man2/ptrace.2:1772 build/C/man2/sendfile.2:155 build/C/man2/splice.2:172 build/C/man2/tee.2:121 build/C/man2/vmsplice.2:145
225 #: build/C/man2/arch_prctl.2:110
227 "B<arch_prctl>() is only supported on Linux/x86-64 for 64-bit programs "
232 #: build/C/man2/arch_prctl.2:112
233 msgid "The 64-bit base changes when a new 32-bit segment selector is loaded."
237 #: build/C/man2/arch_prctl.2:115
238 msgid "B<ARCH_SET_GS> is disabled in some kernels."
242 #: build/C/man2/arch_prctl.2:130
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:135
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:138
262 msgid "I<FS> may be already used by the threading library."
266 #: build/C/man2/arch_prctl.2:138 build/C/man2/futex.2:312 build/C/man2/get_robust_list.2:128 build/C/man2/getunwind.2:111 build/C/man2/kexec_load.2:159 build/C/man2/modify_ldt.2:136 build/C/man2/outb.2:96 build/C/man2/pciconfig_read.2:112 build/C/man2/perf_event_open.2:1948 build/C/man2/perfmonctl.2:205 build/C/man2/pivot_root.2:143 build/C/man2/process_vm_readv.2:331 build/C/man2/ptrace.2:1926 build/C/man2/quotactl.2:507 build/C/man2/sendfile.2:197 build/C/man2/set_tid_address.2:99 build/C/man2/splice.2:226 build/C/man2/tee.2:197 build/C/man2/vmsplice.2:154
272 #: build/C/man2/arch_prctl.2:143
273 msgid "B<mmap>(2), B<modify_ldt>(2), B<prctl>(2), B<set_thread_area>(2)"
277 #: build/C/man2/arch_prctl.2:145
278 msgid "AMD X86-64 Programmer's manual"
282 #: build/C/man2/arch_prctl.2:145 build/C/man2/futex.2:325 build/C/man2/get_robust_list.2:137 build/C/man2/getunwind.2:113 build/C/man2/kexec_load.2:162 build/C/man2/lookup_dcookie.2:88 build/C/man2/modify_ldt.2:138 build/C/man2/nfsservctl.2:58 build/C/man2/outb.2:99 build/C/man2/pciconfig_read.2:114 build/C/man2/perf_event_open.2:1954 build/C/man2/perfmonctl.2:209 build/C/man2/personality.2:72 build/C/man2/pivot_root.2:149 build/C/man2/process_vm_readv.2:334 build/C/man2/ptrace.2:1940 build/C/man2/quotactl.2:512 build/C/man2/sendfile.2:203 build/C/man2/set_tid_address.2:102 build/C/man2/splice.2:230 build/C/man2/tee.2:200 build/C/man2/vm86.2:74 build/C/man2/vmsplice.2:157
288 #: build/C/man2/arch_prctl.2:152 build/C/man2/futex.2:332 build/C/man2/get_robust_list.2:144 build/C/man2/getunwind.2:120 build/C/man2/kexec_load.2:169 build/C/man2/lookup_dcookie.2:95 build/C/man2/modify_ldt.2:145 build/C/man2/nfsservctl.2:65 build/C/man2/outb.2:106 build/C/man2/pciconfig_read.2:121 build/C/man2/perf_event_open.2:1961 build/C/man2/perfmonctl.2:216 build/C/man2/personality.2:79 build/C/man2/pivot_root.2:156 build/C/man2/process_vm_readv.2:341 build/C/man2/ptrace.2:1947 build/C/man2/quotactl.2:519 build/C/man2/sendfile.2:210 build/C/man2/set_tid_address.2:109 build/C/man2/splice.2:237 build/C/man2/tee.2:207 build/C/man2/vm86.2:81 build/C/man2/vmsplice.2:164
290 "This page is part of release 3.50 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:53
302 #: build/C/man2/futex.2:53
308 #: build/C/man2/futex.2:56
309 msgid "futex - fast user-space locking"
313 #: build/C/man2/futex.2:61
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:64
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:67
332 msgid "B< int *>I<uaddr2>B<, int >I<val3>B<);>\n"
336 #: build/C/man2/futex.2:84
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:91
350 "When a B<futex>(7) operation did not finish uncontended in user space, 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:98
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:106
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:108
375 msgid "Five operations are currently defined:"
379 #: build/C/man2/futex.2:108 build/C/man2/futex.2:216
381 msgid "B<FUTEX_WAIT>"
385 #: build/C/man2/futex.2:126
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 "minimum duration of the wait, which is infinite otherwise. The arguments "
391 "I<uaddr2> and I<val3> are ignored."
395 #: build/C/man2/futex.2:134
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:134 build/C/man2/futex.2:222
405 msgid "B<FUTEX_WAKE>"
409 #: build/C/man2/futex.2:145
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:151
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:151
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:167
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:172
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:176
451 "Because it was inherently racy, B<FUTEX_FD> has been removed from Linux "
456 #: build/C/man2/futex.2:176
458 msgid "B<FUTEX_REQUEUE> (since Linux 2.5.70)"
462 #: build/C/man2/futex.2:191
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:191
474 msgid "B<FUTEX_CMP_REQUEUE> (since Linux 2.6.7)"
478 #: build/C/man2/futex.2:209
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:216
490 "In the event of an error, all operations return -1, and set I<errno> to "
491 "indicate the error. The return value on success depends on the operation, "
492 "as described in the following list:"
496 #: build/C/man2/futex.2:222
498 "Returns 0 if the process was woken by a B<FUTEX_WAKE> call. See ERRORS for "
499 "the various possible error returns."
503 #: build/C/man2/futex.2:225 build/C/man2/futex.2:231 build/C/man2/futex.2:234
504 msgid "Returns the number of processes woken up."
508 #: build/C/man2/futex.2:225
514 #: build/C/man2/futex.2:228
515 msgid "Returns the new file descriptor associated with the futex."
519 #: build/C/man2/futex.2:228
521 msgid "B<FUTEX_REQUEUE>"
525 #: build/C/man2/futex.2:231
527 msgid "B<FUTEX_CMP_REQUEUE>"
531 #: build/C/man2/futex.2:235 build/C/man2/quotactl.2:486
537 #: build/C/man2/futex.2:238
538 msgid "No read access to futex memory."
542 #: build/C/man2/futex.2:238 build/C/man2/sendfile.2:116
548 #: build/C/man2/futex.2:249
550 "B<FUTEX_CMP_REQUEUE> detected that the value pointed to by I<uaddr> is not "
551 "equal to the expected value I<val3>. (This probably indicates a race; use "
552 "the safe B<FUTEX_WAKE> now.)"
556 #: build/C/man2/futex.2:254
557 msgid "Error retrieving I<timeout> information from user space."
561 #: build/C/man2/futex.2:254
567 #: build/C/man2/futex.2:261
569 "A B<FUTEX_WAIT> operation was interrupted by a signal (see B<signal>(7)) or "
574 #: build/C/man2/futex.2:264
575 msgid "Invalid argument."
579 #: build/C/man2/futex.2:264
585 #: build/C/man2/futex.2:267
586 msgid "The system limit on the total number of open files has been reached."
590 #: build/C/man2/futex.2:267 build/C/man2/modify_ldt.2:126 build/C/man2/pciconfig_read.2:93 build/C/man2/quotactl.2:447 build/C/man2/vm86.2:62
596 #: build/C/man2/futex.2:271
597 msgid "Invalid operation specified in I<op>."
601 #: build/C/man2/futex.2:271
607 #: build/C/man2/futex.2:276
608 msgid "Timeout during the B<FUTEX_WAIT> operation."
612 #: build/C/man2/futex.2:276
614 msgid "B<EWOULDBLOCK>"
618 #: build/C/man2/futex.2:286
620 "I<op> was B<FUTEX_WAIT> and the value pointed to by I<uaddr> was not equal "
621 "to the expected value I<val> at the time of the call."
625 #: build/C/man2/futex.2:286 build/C/man2/get_robust_list.2:115 build/C/man2/getunwind.2:94 build/C/man2/kexec_load.2:138 build/C/man2/lookup_dcookie.2:73 build/C/man2/perfmonctl.2:196 build/C/man2/pivot_root.2:125 build/C/man2/process_vm_readv.2:276 build/C/man2/sendfile.2:142 build/C/man2/set_tid_address.2:94 build/C/man2/splice.2:165 build/C/man2/tee.2:114 build/C/man2/vmsplice.2:138
631 #: build/C/man2/futex.2:296
633 "Initial futex support was merged in Linux 2.5.7 but with different semantics "
634 "from what was described above. A 4-argument system call with the semantics "
635 "described in this page was introduced in Linux 2.5.40. In Linux 2.5.70 one "
636 "argument was added. In Linux 2.6.7 a sixth argument was added\\(emmessy, "
637 "especially on the s390 architecture."
641 #: build/C/man2/futex.2:298 build/C/man2/kexec_load.2:144 build/C/man2/set_tid_address.2:99 build/C/man2/splice.2:172 build/C/man2/tee.2:121 build/C/man2/vmsplice.2:145
642 msgid "This system call is Linux-specific."
647 #. Futexes were designed and worked on by
648 #. Hubertus Franke (IBM Thomas J. Watson Research Center),
649 #. Matthew Kirkwood, Ingo Molnar (Red Hat)
650 #. and Rusty Russell (IBM Linux Technology Center).
651 #. This page written by bert hubert.
653 #: build/C/man2/futex.2:312
655 "To reiterate, bare futexes are not intended as an easy-to-use abstraction "
656 "for end-users. (There is no wrapper function for this system call in "
657 "glibc.) Implementors are expected to be assembly literate and to have read "
658 "the sources of the futex user-space library referenced below."
662 #: build/C/man2/futex.2:314
667 #: build/C/man2/futex.2:317
669 "I<Fuss, Futexes and Furwocks: Fast Userlevel Locking in Linux> (proceedings "
670 "of the Ottawa Linux Symposium 2002), online at"
674 #: build/C/man2/futex.2:320
676 "E<.UR http://kernel.org\\:/doc\\:/ols\\:/2002\\:/ols2002-pages-479-495.pdf> "
681 #: build/C/man2/futex.2:322
682 msgid "Futex example library, futex-*.tar.bz2 at"
686 #: build/C/man2/futex.2:325
688 "E<.UR ftp://ftp.nl.kernel.org\\:/pub\\:/linux\\:/kernel\\:/people\\:/rusty/> "
693 #: build/C/man2/get_robust_list.2:29
695 msgid "GET_ROBUST_LIST"
699 #: build/C/man2/get_robust_list.2:29 build/C/man2/kexec_load.2:26 build/C/man2/modify_ldt.2:24 build/C/man2/pivot_root.2:10
705 #: build/C/man2/get_robust_list.2:29
707 msgid "Linux System Calls"
711 #: build/C/man2/get_robust_list.2:32
712 msgid "get_robust_list, set_robust_list - get/set list of robust futexes"
716 #: build/C/man2/get_robust_list.2:36
719 "B<#include E<lt>linux/futex.hE<gt>>\n"
720 "B<#include E<lt>syscall.hE<gt>>\n"
724 #: build/C/man2/get_robust_list.2:40
727 "B<long get_robust_list(int >I<pid>B<, struct robust_list_head "
728 "**>I<head_ptr>B<,>\n"
729 "B<\t\t\t size_t *>I<len_ptr>B<);>\n"
730 "B<long set_robust_list(struct robust_list_head *>I<head>B<, size_t "
735 #: build/C/man2/get_robust_list.2:44
736 msgid "I<Note>: There are no glibc wrappers for these system calls; see NOTES."
740 #: build/C/man2/get_robust_list.2:49
742 "The robust futex implementation needs to maintain per-thread lists of robust "
743 "futexes which are unlocked when the thread exits. These lists are managed "
744 "in user space; the kernel is only notified about the location of the head of "
749 #: build/C/man2/get_robust_list.2:65
751 "The B<get_robust_list>() system call returns the head of the robust futex "
752 "list of the thread whose thread ID is specified in I<pid>. If I<pid> is 0, "
753 "the head of the list for the calling thread is returned. The list head is "
754 "stored in the location pointed to by I<head_ptr>. The size of the object "
755 "pointed to by I<**head_ptr> is stored in I<len_ptr>."
759 #: build/C/man2/get_robust_list.2:77
761 "The B<set_robust_list>() system call requests the kernel to record the head "
762 "of the list of robust futexes owned by the calling thread. The I<head> "
763 "argument is the list head to record. The I<len> argument should be "
768 #: build/C/man2/get_robust_list.2:84
770 "The B<set_robust_list>() and B<get_robust_list>() system calls return zero "
771 "when the operation is successful, an error code otherwise."
775 #: build/C/man2/get_robust_list.2:88
776 msgid "The B<set_robust_list>() system call can fail with the following error:"
780 #: build/C/man2/get_robust_list.2:94
782 "I<len> does not match the size of structure B<struct robust_list_head> "
783 "expected by kernel."
787 #: build/C/man2/get_robust_list.2:98
788 msgid "The B<get_robust_list>() system call can fail with the following errors:"
792 #: build/C/man2/get_robust_list.2:106
794 "The calling process does not have permission to see the robust futex list of "
795 "the thread with the thread ID I<pid>, and does not have the "
796 "B<CAP_SYS_PTRACE> capability."
800 #: build/C/man2/get_robust_list.2:106 build/C/man2/process_vm_readv.2:271 build/C/man2/ptrace.2:1765 build/C/man2/quotactl.2:461 build/C/man2/quotactl.2:504
806 #: build/C/man2/get_robust_list.2:111
807 msgid "No thread with the thread ID I<pid> could be found."
811 #: build/C/man2/get_robust_list.2:115
812 msgid "The head of the robust futex list can't be stored at the location I<head>."
816 #: build/C/man2/get_robust_list.2:119
818 "These system calls were added in Linux 2.6.17. No library support is "
819 "provided; use B<syscall>(2)."
823 #: build/C/man2/get_robust_list.2:124
825 "These system calls are not needed by normal applications. No support for "
826 "them is provided in glibc. In the unlikely event that you want to call them "
827 "directly, use B<syscall>(2)."
831 #: build/C/man2/get_robust_list.2:128
833 "A thread can have only one robust futex list; therefore applications that "
834 "wish to use this functionality should use the robust mutexes provided by "
838 #. .BR pthread_mutexattr_setrobust_np (3)
840 #: build/C/man2/get_robust_list.2:131
844 #. http://lwn.net/Articles/172149/
846 #: build/C/man2/get_robust_list.2:137
848 "I<Documentation/robust-futexes.txt> and "
849 "I<Documentation/robust-futex-ABI.txt> in the Linux kernel source tree"
853 #: build/C/man2/getunwind.2:27
859 #: build/C/man2/getunwind.2:27 build/C/man2/perfmonctl.2:27
865 #: build/C/man2/getunwind.2:30
866 msgid "getunwind - copy the unwind data to caller's buffer"
870 #: build/C/man2/getunwind.2:34
873 "B<#include E<lt>syscall.hE<gt>>\n"
874 "B<#include E<lt>linux/unwind.hE<gt>>\n"
878 #: build/C/man2/getunwind.2:36
880 msgid "B<long getunwind(void >I<*buf>B<, size_t >I<buf_size>B<);>\n"
884 #: build/C/man2/getunwind.2:40 build/C/man2/kexec_load.2:39 build/C/man2/modify_ldt.2:36 build/C/man2/perf_event_open.2:42 build/C/man2/perfmonctl.2:39 build/C/man2/pivot_root.2:18
885 msgid "I<Note>: There is no glibc wrapper for this system call; see NOTES."
889 #: build/C/man2/getunwind.2:42
890 msgid "I<Note: this function is obsolete.>"
894 #: build/C/man2/getunwind.2:52
896 "The IA-64-specific B<getunwind>() system call copies the kernel's call "
897 "frame unwind data into the buffer pointed to by I<buf> and returns the size "
898 "of the unwind data; this data describes the gate page (kernel code that is "
899 "mapped into user space)."
903 #: build/C/man2/getunwind.2:64
905 "The size of the buffer I<buf> is specified in I<buf_size>. The data is "
906 "copied only if I<buf_size> is greater than or equal to the size of the "
907 "unwind data and I<buf> is not NULL; otherwise, no data is copied, and the "
908 "call succeeds, returning the size that would be needed to store the unwind "
913 #: build/C/man2/getunwind.2:68
915 "The first part of the unwind data contains an unwind table. The rest "
916 "contains the associated unwind information, in no particular order. The "
917 "unwind table contains entries of the following form:"
921 #: build/C/man2/getunwind.2:73
924 "\tu64 start; (64-bit address of start of function)\n"
925 "\tu64 end; (64-bit address of end of function)\n"
926 "\tu64 info; (BUF-relative offset to unwind info)\n"
930 #: build/C/man2/getunwind.2:81
932 "An entry whose I<start> value is zero indicates the end of the table. For "
933 "more information about the format, see the I<IA-64 Software Conventions and "
934 "Runtime Architecture> manual."
938 #: build/C/man2/getunwind.2:88
940 "On success, B<getunwind>() returns the size of unwind table. On error, -1 "
941 "is returned and I<errno> is set to indicate the error."
945 #: build/C/man2/getunwind.2:94
947 "B<getunwind>() fails with the error B<EFAULT> if the unwind info can't be "
948 "stored in the space specified by I<buf>."
952 #: build/C/man2/getunwind.2:96
953 msgid "This system call is available since Linux 2.4."
957 #: build/C/man2/getunwind.2:99
959 "This system call is Linux specific, and is available only on the IA-64 "
964 #: build/C/man2/getunwind.2:107
966 "This system call has been deprecated. The modern way to obtain the kernel's "
967 "unwind data is via the gate DSO. The address of the ELF header for this DSO "
968 "is passed to user level via B<AT_SYSINFO_EHDR> (see B<getauxval>(3))."
972 #: build/C/man2/getunwind.2:111
974 "Glibc does not provide a wrapper for this system call; in the unlikely event "
975 "that you want to call it, use B<syscall>(2)."
979 #: build/C/man2/getunwind.2:113
980 msgid "B<getauxval>(3)"
984 #: build/C/man2/kexec_load.2:26
990 #: build/C/man2/kexec_load.2:29
991 msgid "kexec_load - load a new kernel for later execution"
995 #: build/C/man2/kexec_load.2:31
996 msgid "B<#include E<lt>linux/kexec.hE<gt>>"
1000 #: build/C/man2/kexec_load.2:33
1002 "B<long kexec_load(unsigned long >I<entry>B<, unsigned long "
1003 ">I<nr_segments>B<,>"
1007 #: build/C/man2/kexec_load.2:36
1008 msgid "B< struct kexec_segment *>I<segments>B<, unsigned long >I<flags>B<);>"
1012 #: build/C/man2/kexec_load.2:44
1014 "The B<kexec_load>() system call loads a new kernel that can be executed "
1015 "later by B<reboot>(2)."
1019 #: build/C/man2/kexec_load.2:50
1021 "The I<flags> argument is a mask whose high-order bits control the operation "
1022 "of the call. The following values can be specified in I<flags>:"
1026 #: build/C/man2/kexec_load.2:50
1028 msgid "B<KEXEC_ON_CRASH> (since Linux 2.6.13)"
1031 #. FIXME figure out how this is really used
1033 #: build/C/man2/kexec_load.2:54
1034 msgid "Execute the new kernel automatically on a system crash."
1038 #: build/C/man2/kexec_load.2:54
1040 msgid "B<KEXEC_PRESERVE_CONTEXT> (since Linux 2.6.27)"
1044 #: build/C/man2/kexec_load.2:64
1046 "Preserve the system hardware and software states before executing the new "
1047 "kernel. This could be used for system suspend. This flag is only available "
1048 "if the kernel was configured with B<CONFIG_KEXEC_JUMP>, and is only "
1049 "effective if I<nr_segments> is greater than 0."
1053 #: build/C/man2/kexec_load.2:84
1055 "The low-order bits of I<flags> contain the architecture of the "
1056 "to-be-executed kernel. Specify (OR) the constant B<KEXEC_ARCH_DEFAULT> to "
1057 "use the current architecture, or one of the following architecture constants "
1058 "B<KEXEC_ARCH_386>, B<KEXEC_ARCH_X86_64>, B<KEXEC_ARCH_PPC>, "
1059 "B<KEXEC_ARCH_PPC64>, B<KEXEC_ARCH_IA_64>, B<KEXEC_ARCH_ARM>, "
1060 "B<KEXEC_ARCH_S390>, B<KEXEC_ARCH_SH>, B<KEXEC_ARCH_MIPS>, and "
1061 "B<KEXEC_ARCH_MIPS_LE>. The architecture must be executable on the CPU of "
1066 #: build/C/man2/kexec_load.2:98
1068 "The I<entry> argument is the physical entry address in the kernel image. "
1069 "The I<nr_segments> argument is the number of segments pointed to by the "
1070 "I<segments> pointer. The I<segments> argument is an array of "
1071 "I<kexec_segment> structures which define the kernel layout:"
1075 #: build/C/man2/kexec_load.2:107
1078 "struct kexec_segment {\n"
1079 " void *buf; /* Buffer in user space */\n"
1080 " size_t bufsz; /* Buffer length in user space */\n"
1081 " void *mem; /* Physical address of kernel */\n"
1082 " size_t memsz; /* Physical address length */\n"
1086 #. FIXME elaborate on the following:
1088 #: build/C/man2/kexec_load.2:114
1090 "The kernel image defined by I<segments> is copied from the calling process "
1091 "into previously reserved memory."
1095 #: build/C/man2/kexec_load.2:121
1097 "On success, B<kexec_load>() returns 0. On error, -1 is returned and "
1098 "I<errno> is set to indicate the error."
1102 #: build/C/man2/kexec_load.2:122 build/C/man2/pivot_root.2:110 build/C/man2/ptrace.2:1728 build/C/man2/quotactl.2:495
1108 #: build/C/man2/kexec_load.2:126
1110 "Another crash kernel is already being loaded or a crash kernel is already in "
1114 #. KEXEC_SEGMENT_MAX == 16
1116 #: build/C/man2/kexec_load.2:133
1117 msgid "I<flags> is invalid; or I<nr_segments> is too large"
1121 #: build/C/man2/kexec_load.2:138
1122 msgid "The caller does not have the B<CAP_SYS_BOOT> capability."
1126 #: build/C/man2/kexec_load.2:142
1127 msgid "The B<kexec_load>() system call first appeared in Linux 2.6.13."
1131 #: build/C/man2/kexec_load.2:149
1133 "Currently, there is no glibc support for B<kexec_load>(). Call it using "
1137 #. FIXME Andi submitted a patch for this.
1138 #. Check if it got accepted later.
1140 #: build/C/man2/kexec_load.2:156
1142 "The required constants are in the Linux kernel source file I<linux/kexec.h>, "
1143 "which is not currently exported to glibc. Therefore, these constants must "
1144 "be defined manually."
1148 #: build/C/man2/kexec_load.2:159
1150 "This system call is only available if the kernel was configured with "
1155 #: build/C/man2/kexec_load.2:162
1156 msgid "B<reboot>(2), B<syscall>(2)"
1160 #: build/C/man2/lookup_dcookie.2:27
1162 msgid "LOOKUP_DCOOKIE"
1166 #: build/C/man2/lookup_dcookie.2:27
1172 #: build/C/man2/lookup_dcookie.2:30
1173 msgid "lookup_dcookie - return a directory entry's path"
1177 #: build/C/man2/lookup_dcookie.2:32
1179 "B<int lookup_dcookie(u64 >I<cookie>B<, char *>I<buffer>B<, size_t "
1184 #: build/C/man2/lookup_dcookie.2:38
1186 "Look up the full path of the directory entry specified by the value "
1187 "I<cookie>. The cookie is an opaque identifier uniquely identifying a "
1188 "particular directory entry. The buffer given is filled in with the full "
1189 "path of the directory entry."
1193 #: build/C/man2/lookup_dcookie.2:43
1195 "For B<lookup_dcookie>() to return successfully, the kernel must still hold "
1196 "a cookie reference to the directory entry."
1200 #: build/C/man2/lookup_dcookie.2:50
1202 "On success, B<lookup_dcookie>() returns the length of the path string "
1203 "copied into the buffer. On error, -1 is returned, and I<errno> is set "
1208 #: build/C/man2/lookup_dcookie.2:54
1209 msgid "The buffer was not valid."
1213 #: build/C/man2/lookup_dcookie.2:58
1215 "The kernel has no registered cookie/directory entry mappings at the time of "
1216 "lookup, or the cookie does not refer to a valid directory entry."
1220 #: build/C/man2/lookup_dcookie.2:58
1222 msgid "B<ENAMETOOLONG>"
1226 #: build/C/man2/lookup_dcookie.2:61
1227 msgid "The name could not fit in the buffer."
1231 #: build/C/man2/lookup_dcookie.2:61 build/C/man2/process_vm_readv.2:262 build/C/man2/sendfile.2:138 build/C/man2/splice.2:155 build/C/man2/tee.2:111 build/C/man2/vmsplice.2:135
1237 #: build/C/man2/lookup_dcookie.2:65
1239 "The kernel could not allocate memory for the temporary buffer holding the "
1244 #: build/C/man2/lookup_dcookie.2:70
1246 "The process does not have the capability B<CAP_SYS_ADMIN> required to look "
1251 #: build/C/man2/lookup_dcookie.2:70 build/C/man2/quotactl.2:474
1257 #: build/C/man2/lookup_dcookie.2:73
1258 msgid "The buffer was not large enough to hold the path of the directory entry."
1262 #: build/C/man2/lookup_dcookie.2:78
1264 "Available since Linux 2.5.43. The B<ENAMETOOLONG> error return was added in "
1269 #: build/C/man2/lookup_dcookie.2:81
1270 msgid "B<lookup_dcookie>() is Linux-specific."
1274 #: build/C/man2/lookup_dcookie.2:85
1276 "B<lookup_dcookie>() is a special-purpose system call, currently used only "
1277 "by the oprofile profiler. It relies on a kernel driver to register cookies "
1278 "for directory entries."
1282 #: build/C/man2/lookup_dcookie.2:88
1284 "The path returned may be suffixed by the string \" (deleted)\" if the "
1285 "directory entry has been removed."
1289 #: build/C/man2/modify_ldt.2:24
1295 #: build/C/man2/modify_ldt.2:27
1296 msgid "modify_ldt - get or set ldt"
1300 #: build/C/man2/modify_ldt.2:30
1302 msgid "B<#include E<lt>sys/types.hE<gt>>\n"
1306 #: build/C/man2/modify_ldt.2:32
1309 "B<int modify_ldt(int >I<func>B<, void *>I<ptr>B<, unsigned long "
1310 ">I<bytecount>B<);>\n"
1314 #: build/C/man2/modify_ldt.2:41
1316 "B<modify_ldt>() reads or writes the local descriptor table (ldt) for a "
1317 "process. The ldt is a per-process memory management table used by the i386 "
1318 "processor. For more information on this table, see an Intel 386 processor "
1323 #: build/C/man2/modify_ldt.2:51
1325 "When I<func> is 0, B<modify_ldt>() reads the ldt into the memory pointed to "
1326 "by I<ptr>. The number of bytes read is the smaller of I<bytecount> and the "
1327 "actual size of the ldt."
1331 #. FIXME ? say something about func == 2 and func == 0x11?
1332 #. In Linux 2.4, func == 2 returned "the default ldt"
1333 #. In Linux 2.6, func == 2 is a nop, returning a zeroed out structure.
1334 #. Linux 2.4 and 2.6 implement an operation for func == 0x11
1336 #: build/C/man2/modify_ldt.2:69
1338 "When I<func> is 1, B<modify_ldt>() modifies one ldt entry. I<ptr> points "
1339 "to a I<user_desc> structure and I<bytecount> must equal the size of this "
1344 #: build/C/man2/modify_ldt.2:73
1345 msgid "The I<user_desc> structure is defined in I<E<lt>asm/ldt.hE<gt>> as:"
1349 #: build/C/man2/modify_ldt.2:87
1352 "struct user_desc {\n"
1353 " unsigned int entry_number;\n"
1354 " unsigned long base_addr;\n"
1355 " unsigned int limit;\n"
1356 " unsigned int seg_32bit:1;\n"
1357 " unsigned int contents:2;\n"
1358 " unsigned int read_exec_only:1;\n"
1359 " unsigned int limit_in_pages:1;\n"
1360 " unsigned int seg_not_present:1;\n"
1361 " unsigned int useable:1;\n"
1366 #. The ldt is specific for the calling process. Any attempts to change
1367 #. the ldt to include the address space of another process or the kernel
1368 #. will result in a segmentation violation when trying to access the memory
1369 #. outside of the process address space. The memory protection is enforced
1370 #. at the paging layer.
1372 #: build/C/man2/modify_ldt.2:98
1373 msgid "In Linux 2.4 and earlier, this structure was named I<modify_ldt_ldt_s>."
1377 #: build/C/man2/modify_ldt.2:108
1379 "On success, B<modify_ldt>() returns either the actual number of bytes read "
1380 "(for reading) or 0 (for writing). On failure, B<modify_ldt>() returns -1 "
1381 "and sets I<errno> to indicate the error."
1385 #: build/C/man2/modify_ldt.2:113
1386 msgid "I<ptr> points outside the address space."
1390 #: build/C/man2/modify_ldt.2:126
1392 "I<ptr> is 0, or I<func> is 1 and I<bytecount> is not equal to the size of "
1393 "the structure I<modify_ldt_ldt_s>, or I<func> is 1 and the new ldt entry has "
1398 #: build/C/man2/modify_ldt.2:130
1399 msgid "I<func> is neither 0 nor 1."
1403 #: build/C/man2/modify_ldt.2:133
1405 "This call is Linux-specific and should not be used in programs intended to "
1410 #: build/C/man2/modify_ldt.2:136 build/C/man2/perfmonctl.2:205 build/C/man2/pivot_root.2:134
1412 "Glibc does not provide a wrapper for this system call; call it using "
1417 #: build/C/man2/modify_ldt.2:138
1422 #: build/C/man2/nfsservctl.2:8
1428 #: build/C/man2/nfsservctl.2:8
1434 #: build/C/man2/nfsservctl.2:11
1435 msgid "nfsservctl - syscall interface to kernel nfs daemon"
1439 #: build/C/man2/nfsservctl.2:14
1441 msgid "B<#include E<lt>linux/nfsd/syscall.hE<gt>>\n"
1445 #: build/C/man2/nfsservctl.2:17
1448 "B<long nfsservctl(int >I<cmd>B<, struct nfsctl_arg *>I<argp>B<,>\n"
1449 "B< union nfsctl_res *>I<resp>B<);>\n"
1453 #: build/C/man2/nfsservctl.2:21
1454 msgid "I<Note>: Since Linux 3.1, this system call no longer exists."
1458 #: build/C/man2/nfsservctl.2:33
1462 " * These are the commands understood by nfsctl().\n"
1464 "#define NFSCTL_SVC 0 /* This is a server process. */\n"
1465 "#define NFSCTL_ADDCLIENT 1 /* Add an NFS client. */\n"
1466 "#define NFSCTL_DELCLIENT 2 /* Remove an NFS client. */\n"
1467 "#define NFSCTL_EXPORT 3 /* export a file system. */\n"
1468 "#define NFSCTL_UNEXPORT 4 /* unexport a file system. */\n"
1469 "#define NFSCTL_UGIDUPDATE 5 /* update a client's UID/GID map. */\n"
1470 "#define NFSCTL_GETFH 6 /* get an fh (used by mountd) */\n"
1474 #: build/C/man2/nfsservctl.2:45
1477 "struct nfsctl_arg {\n"
1478 " int ca_version; /* safeguard */\n"
1480 " struct nfsctl_svc u_svc;\n"
1481 " struct nfsctl_client u_client;\n"
1482 " struct nfsctl_export u_export;\n"
1483 " struct nfsctl_uidmap u_umap;\n"
1484 " struct nfsctl_fhparm u_getfh;\n"
1485 " unsigned int u_debug;\n"
1491 #: build/C/man2/nfsservctl.2:50
1494 "union nfsctl_res {\n"
1495 " struct knfs_fh cr_getfh;\n"
1496 " unsigned int cr_debug;\n"
1501 #: build/C/man2/nfsservctl.2:56 build/C/man2/pivot_root.2:105 build/C/man2/vm86.2:57
1503 "On success, zero is returned. On error, -1 is returned, and I<errno> is set "
1508 #: build/C/man2/nfsservctl.2:58
1509 msgid "This call is Linux-specific."
1513 #: build/C/man2/outb.2:26
1519 #: build/C/man2/outb.2:26
1525 #: build/C/man2/outb.2:31
1527 "outb, outw, outl, outsb, outsw, outsl, inb, inw, inl, insb, insw, insl, "
1528 "outb_p, outw_p, outl_p, inb_p, inw_p, inl_p - port I/O"
1532 #: build/C/man2/outb.2:34
1534 msgid "B<#include E<lt>sys/io.hE<gt>>\n"
1538 #: build/C/man2/outb.2:41
1541 "B<unsigned char inb(unsigned short int >I<port>B<);>\n"
1542 "B<unsigned char inb_p(unsigned short int >I<port>B<);>\n"
1543 "B<unsigned short int inw(unsigned short int >I<port>B<);>\n"
1544 "B<unsigned short int inw_p(unsigned short int >I<port>B<);>\n"
1545 "B<unsigned int inl(unsigned short int >I<port>B<);>\n"
1546 "B<unsigned int inl_p(unsigned short int >I<port>B<);>\n"
1550 #: build/C/man2/outb.2:48
1553 "B<void outb(unsigned char >I<value>B<, unsigned short int >I<port>B<);>\n"
1554 "B<void outb_p(unsigned char >I<value>B<, unsigned short int >I<port>B<);>\n"
1555 "B<void outw(unsigned short int >I<value>B<, unsigned short int "
1557 "B<void outw_p(unsigned short int >I<value>B<, unsigned short int "
1559 "B<void outl(unsigned int >I<value>B<, unsigned short int >I<port>B<);>\n"
1560 "B<void outl_p(unsigned int >I<value>B<, unsigned short int >I<port>B<);>\n"
1564 #: build/C/man2/outb.2:61
1567 "B<void insb(unsigned short int >I<port>B<, void *>I<addr>B<,>\n"
1568 "B< unsigned long int >I<count>B<);>\n"
1569 "B<void insw(unsigned short int >I<port>B<, void *>I<addr>B<,>\n"
1570 "B< unsigned long int >I<count>B<);>\n"
1571 "B<void insl(unsigned short int >I<port>B<, void *>I<addr>B<,>\n"
1572 "B< unsigned long int >I<count>B<);>\n"
1573 "B<void outsb(unsigned short int >I<port>B<, const void *>I<addr>B<,>\n"
1574 "B< unsigned long int >I<count>B<);>\n"
1575 "B<void outsw(unsigned short int >I<port>B<, const void *>I<addr>B<,>\n"
1576 "B< unsigned long int >I<count>B<);>\n"
1577 "B<void outsl(unsigned short int >I<port>B<, const void *>I<addr>B<,>\n"
1578 "B< unsigned long int >I<count>B<);>\n"
1582 #: build/C/man2/outb.2:67
1584 "This family of functions is used to do low-level port input and output. The "
1585 "out* functions do port output, the in* functions do port input; the b-suffix "
1586 "functions are byte-width and the w-suffix functions word-width; the "
1587 "_p-suffix functions pause until the I/O completes."
1590 #. , given the following information
1591 #. in addition to that given in
1594 #: build/C/man2/outb.2:73
1596 "They are primarily designed for internal kernel use, but can be used from "
1601 #: build/C/man2/outb.2:78
1603 "You must compile with B<-O> or B<-O2> or similar. The functions are defined "
1604 "as inline macros, and will not be substituted in without optimization "
1605 "enabled, causing unresolved references at link time."
1609 #: build/C/man2/outb.2:87
1611 "You use B<ioperm>(2) or alternatively B<iopl>(2) to tell the kernel to "
1612 "allow the user space application to access the I/O ports in question. "
1613 "Failure to do this will cause the application to receive a segmentation "
1618 #: build/C/man2/outb.2:96
1620 "B<outb>() and friends are hardware-specific. The I<value> argument is "
1621 "passed first and the I<port> argument is passed second, which is the "
1622 "opposite order from most DOS implementations."
1626 #: build/C/man2/outb.2:99
1627 msgid "B<ioperm>(2), B<iopl>(2)"
1631 #: build/C/man2/pciconfig_read.2:8
1633 msgid "PCICONFIG_READ"
1637 #: build/C/man2/pciconfig_read.2:8
1643 #: build/C/man2/pciconfig_read.2:11
1645 "pciconfig_read, pciconfig_write, pciconfig_iobase - pci device information "
1650 #: build/C/man2/pciconfig_read.2:14
1652 msgid "B<#include E<lt>pci.hE<gt>>\n"
1656 #: build/C/man2/pciconfig_read.2:21
1659 "B<int pciconfig_read(unsigned long >I<bus>B<, unsigned long >I<dfn>B<,>\n"
1660 "B< unsigned long >I<off>B<, unsigned long >I<len>B<, void "
1662 "B<int pciconfig_write(unsigned long >I<bus>B<, unsigned long >I<dfn>B<,>\n"
1663 "B< unsigned long >I<off>B<, unsigned long >I<len>B<, void "
1665 "B<int pciconfig_iobase(long >I<which>B<, unsigned long >I<bus>B<,>\n"
1666 "B< unsigned long >I<devfn>B<);>\n"
1670 #: build/C/man2/pciconfig_read.2:27
1672 "Most of the interaction with PCI devices is already handled by the kernel "
1673 "PCI layer, and thus these calls should not normally need to be accessed from "
1678 #: build/C/man2/pciconfig_read.2:27 build/C/man2/pciconfig_read.2:51
1680 msgid "B<pciconfig_read>()"
1684 #: build/C/man2/pciconfig_read.2:36
1685 msgid "Reads to I<buf> from device I<dev> at offset I<off> value."
1689 #: build/C/man2/pciconfig_read.2:36 build/C/man2/pciconfig_read.2:57
1691 msgid "B<pciconfig_write>()"
1695 #: build/C/man2/pciconfig_read.2:45
1696 msgid "Writes from I<buf> to device I<dev> at offset I<off> value."
1700 #: build/C/man2/pciconfig_read.2:45 build/C/man2/pciconfig_read.2:63
1702 msgid "B<pciconfig_iobase>()"
1706 #: build/C/man2/pciconfig_read.2:50
1708 "You pass it a bus/devfn pair and get a physical address for either the "
1709 "memory offset (for things like prep, this is 0xc0000000), the IO base for "
1710 "PIO cycles, or the ISA holes if any."
1714 #: build/C/man2/pciconfig_read.2:57 build/C/man2/pciconfig_read.2:63
1716 "On success zero is returned. On error, -1 is returned and I<errno> is set "
1721 #: build/C/man2/pciconfig_read.2:77
1723 "Returns information on locations of various I/O regions in physical memory "
1724 "according to the I<which> value. Values for I<which> are: "
1725 "B<IOBASE_BRIDGE_NUMBER>, B<IOBASE_MEMORY>, B<IOBASE_IO>, B<IOBASE_ISA_IO>, "
1726 "B<IOBASE_ISA_MEM>."
1730 #: build/C/man2/pciconfig_read.2:84
1731 msgid "I<len> value is invalid. This does not apply to B<pciconfig_iobase>()."
1735 #: build/C/man2/pciconfig_read.2:84 build/C/man2/ptrace.2:1745 build/C/man2/sendfile.2:134
1741 #: build/C/man2/pciconfig_read.2:87
1746 #: build/C/man2/pciconfig_read.2:87
1752 #: build/C/man2/pciconfig_read.2:93
1754 "For B<pciconfig_iobase>(), \"hose\" value is NULL. For the other calls, "
1755 "could not find a slot."
1759 #: build/C/man2/pciconfig_read.2:98
1760 msgid "The system has not implemented these calls (B<CONFIG_PCI> not defined)."
1764 #: build/C/man2/pciconfig_read.2:98
1766 msgid "B<EOPNOTSUPP>"
1770 #: build/C/man2/pciconfig_read.2:105
1772 "This return value is only valid for B<pciconfig_iobase>(). It is returned "
1773 "if the value for I<which> is invalid."
1777 #: build/C/man2/pciconfig_read.2:110
1779 "User does not have the B<CAP_SYS_ADMIN> capability. This does not apply to "
1780 "B<pciconfig_iobase>()."
1784 #: build/C/man2/pciconfig_read.2:112
1785 msgid "These calls are Linux-specific, available since Linux 2.0.26/2.1.11."
1789 #: build/C/man2/pciconfig_read.2:114
1790 msgid "B<capabilities>(7)"
1794 #: build/C/man2/perf_event_open.2:27
1796 msgid "PERF_EVENT_OPEN"
1800 #: build/C/man2/perf_event_open.2:27
1806 #: build/C/man2/perf_event_open.2:30
1807 msgid "perf_event_open - set up performance monitoring"
1811 #: build/C/man2/perf_event_open.2:34
1814 "B<#include E<lt>linux/perf_event.hE<gt>>\n"
1815 "B<#include E<lt>linux/hw_breakpoint.hE<gt>>\n"
1819 #: build/C/man2/perf_event_open.2:38
1822 "B<int perf_event_open(struct perf_event_attr *>I<attr>B<,>\n"
1823 "B< pid_t >I<pid>B<, int >I<cpu>B<, int >I<group_fd>B<,>\n"
1824 "B< unsigned long >I<flags>B<);>\n"
1828 #: build/C/man2/perf_event_open.2:47
1830 "Given a list of parameters, B<perf_event_open>() returns a file descriptor, "
1831 "for use in subsequent system calls (B<read>(2), B<mmap>(2), B<prctl>(2), "
1832 "B<fcntl>(2), etc.)."
1836 #: build/C/man2/perf_event_open.2:55
1838 "A call to B<perf_event_open>() creates a file descriptor that allows "
1839 "measuring performance information. Each file descriptor corresponds to one "
1840 "event that is measured; these can be grouped together to measure multiple "
1841 "events simultaneously."
1845 #: build/C/man2/perf_event_open.2:62
1847 "Events can be enabled and disabled in two ways: via B<ioctl>(2) and via "
1848 "B<prctl>(2)B<.> When an event is disabled it does not count or generate "
1849 "overflows but does continue to exist and maintain its count value."
1853 #: build/C/man2/perf_event_open.2:76
1855 "Events come in two flavors: counting and sampled. A I<counting> event is "
1856 "one that is used for counting the aggregate number of events that occur. In "
1857 "general, counting event results are gathered with a B<read>(2) call. A "
1858 "I<sampling> event periodically writes measurements to a buffer that can then "
1859 "be accessed via B<mmap>(2)B<.>"
1863 #: build/C/man2/perf_event_open.2:76
1869 #: build/C/man2/perf_event_open.2:90
1871 "The argument I<pid> allows events to be attached to processes in various "
1872 "ways. If I<pid> is 0, measurements happen on the current thread, if I<pid> "
1873 "is greater than 0, the process indicated by I<pid> is measured, and if "
1874 "I<pid> is -1, all processes are counted."
1878 #: build/C/man2/perf_event_open.2:101
1880 "The I<cpu> argument allows measurements to be specific to a CPU. If I<cpu> "
1881 "is greater than or equal to 0, measurements are restricted to the specified "
1882 "CPU; if I<cpu> is -1, the events are measured on all CPUs."
1886 #: build/C/man2/perf_event_open.2:107
1887 msgid "Note that the combination of I<pid> == -1 and I<cpu> == -1 is not valid."
1891 #: build/C/man2/perf_event_open.2:115
1893 "A I<pid> E<gt> 0 and I<cpu> == -1 setting measures per-process and follows "
1894 "that process to whatever CPU the process gets scheduled to. Per-process "
1895 "events can be created by any user."
1899 #: build/C/man2/perf_event_open.2:126
1901 "A I<pid> == -1 and I<cpu> E<gt>= 0 setting is per-CPU and measures all "
1902 "processes on the specified CPU. Per-CPU events need the B<CAP_SYS_ADMIN> "
1903 "capability or a I</proc/sys/kernel/perf_event_paranoid> value of less than "
1908 #: build/C/man2/perf_event_open.2:148
1910 "The I<group_fd> argument allows event groups to be created. An event group "
1911 "has one event which is the group leader. The leader is created first, with "
1912 "I<group_fd> = -1. The rest of the group members are created with subsequent "
1913 "B<perf_event_open>() calls with I<group_fd> being set to the fd of the "
1914 "group leader. (A single event on its own is created with I<group_fd> = -1 "
1915 "and is considered to be a group with only 1 member.) An event group is "
1916 "scheduled onto the CPU as a unit: it will only be put onto the CPU if all of "
1917 "the events in the group can be put onto the CPU. This means that the values "
1918 "of the member events can be meaningfully compared, added, divided (to get "
1919 "ratios), etc., with each other, since they have counted events for the same "
1920 "set of executed instructions."
1924 #: build/C/man2/perf_event_open.2:152
1925 msgid "The I<flags> argument takes one of the following values:"
1929 #: build/C/man2/perf_event_open.2:152
1931 msgid "B<PERF_FLAG_FD_NO_GROUP>"
1934 #. FIXME The following sentence is unclear
1935 #. FIXME So, why is it useful?
1937 #: build/C/man2/perf_event_open.2:159
1939 "This flag allows creating an event as part of an event group but having no "
1940 "group leader. It is unclear why this is useful."
1944 #: build/C/man2/perf_event_open.2:159
1946 msgid "B<PERF_FLAG_FD_OUTPUT>"
1950 #: build/C/man2/perf_event_open.2:162
1951 msgid "This flag re-routes the output from an event to the group leader."
1955 #: build/C/man2/perf_event_open.2:162
1957 msgid "B<PERF_FLAG_PID_CGROUP> (Since Linux 2.6.39)."
1961 #: build/C/man2/perf_event_open.2:185
1963 "This flag activates per-container system-wide monitoring. A container is an "
1964 "abstraction that isolates a set of resources for finer grain control (CPUs, "
1965 "memory, etc...). In this mode, the event is measured only if the thread "
1966 "running on the monitored CPU belongs to the designated container (cgroup). "
1967 "The cgroup is identified by passing a file descriptor opened on its "
1968 "directory in the cgroupfs filesystem. For instance, if the cgroup to "
1969 "monitor is called I<test>, then a file descriptor opened on "
1970 "I</dev/cgroup/test> (assuming cgroupfs is mounted on I</dev/cgroup>) must "
1971 "be passed as the I<pid> parameter. cgroup monitoring is only available for "
1972 "system-wide events and may therefore require extra permissions."
1976 #: build/C/man2/perf_event_open.2:190
1978 "The I<perf_event_attr> structure provides detailed configuration information "
1979 "for the event being created."
1983 #: build/C/man2/perf_event_open.2:197
1986 "struct perf_event_attr {\n"
1987 " __u32 type; /* Type of event */\n"
1988 " __u32 size; /* Size of attribute structure */\n"
1989 " __u64 config; /* Type-specific configuration */\n"
1993 #: build/C/man2/perf_event_open.2:202
1997 " __u64 sample_period; /* Period of sampling */\n"
1998 " __u64 sample_freq; /* Frequency of sampling */\n"
2003 #: build/C/man2/perf_event_open.2:205
2006 " __u64 sample_type; /* Specifies values included in sample */\n"
2007 " __u64 read_format; /* Specifies values returned in read */\n"
2011 #: build/C/man2/perf_event_open.2:231
2014 " __u64 disabled : 1, /* off by default */\n"
2015 " inherit : 1, /* children inherit it */\n"
2016 " pinned : 1, /* must always be on PMU */\n"
2017 " exclusive : 1, /* only group on PMU */\n"
2018 " exclude_user : 1, /* don't count user */\n"
2019 " exclude_kernel : 1, /* don't count kernel */\n"
2020 " exclude_hv : 1, /* don't count hypervisor */\n"
2021 " exclude_idle : 1, /* don't count when idle */\n"
2022 " mmap : 1, /* include mmap data */\n"
2023 " comm : 1, /* include comm data */\n"
2024 " freq : 1, /* use freq, not period */\n"
2025 " inherit_stat : 1, /* per task counts */\n"
2026 " enable_on_exec : 1, /* next exec enables */\n"
2027 " task : 1, /* trace fork/exit */\n"
2028 " watermark : 1, /* wakeup_watermark */\n"
2029 " precise_ip : 2, /* skid constraint */\n"
2030 " mmap_data : 1, /* non-exec mmap data */\n"
2031 " sample_id_all : 1, /* sample_type all events */\n"
2032 " exclude_host : 1, /* don't count in host */\n"
2033 " exclude_guest : 1, /* don't count in guest */\n"
2034 " exclude_callchain_kernel : 1,\n"
2035 " /* exclude kernel callchains */\n"
2036 " exclude_callchain_user : 1,\n"
2037 "\t /* exclude user callchains */\n"
2038 " __reserved_1 : 41;\n"
2042 #: build/C/man2/perf_event_open.2:236
2046 " __u32 wakeup_events; /* wakeup every n events */\n"
2047 " __u32 wakeup_watermark; /* bytes before wakeup */\n"
2052 #: build/C/man2/perf_event_open.2:238
2054 msgid " __u32 bp_type; /* breakpoint type */\n"
2058 #: build/C/man2/perf_event_open.2:243
2062 " __u64 bp_addr; /* breakpoint address */\n"
2063 " __u64 config1; /* extension of config */\n"
2068 #: build/C/man2/perf_event_open.2:253
2072 " __u64 bp_len; /* breakpoint length */\n"
2073 " __u64 config2; /* extension of config1 */\n"
2075 " __u64 branch_sample_type; /* enum perf_branch_sample_type */\n"
2076 " __u64 sample_regs_user; /* user regs to dump on samples */\n"
2077 " __u32 sample_stack_user; /* size of stack to dump on\n"
2079 " __u32 __reserved_2; /* Align to u64 */\n"
2083 #: build/C/man2/perf_event_open.2:255
2089 #: build/C/man2/perf_event_open.2:261
2091 "The fields of the I<perf_event_attr> structure are described in more detail "
2096 #: build/C/man2/perf_event_open.2:261 build/C/man2/perf_event_open.2:1272
2102 #: build/C/man2/perf_event_open.2:265
2104 "This field specifies the overall event type. It has one of the following "
2109 #: build/C/man2/perf_event_open.2:266
2111 msgid "B<PERF_TYPE_HARDWARE>"
2115 #: build/C/man2/perf_event_open.2:273
2117 "This indicates one of the \"generalized\" hardware events provided by the "
2118 "kernel. See the I<config> field definition for more details."
2122 #: build/C/man2/perf_event_open.2:273
2124 msgid "B<PERF_TYPE_SOFTWARE>"
2128 #: build/C/man2/perf_event_open.2:277
2130 "This indicates one of the software-defined events provided by the kernel "
2131 "(even if no hardware support is available)."
2135 #: build/C/man2/perf_event_open.2:277
2137 msgid "B<PERF_TYPE_TRACEPOINT>"
2141 #: build/C/man2/perf_event_open.2:281
2143 "This indicates a tracepoint provided by the kernel tracepoint "
2148 #: build/C/man2/perf_event_open.2:281
2150 msgid "B<PERF_TYPE_HW_CACHE>"
2154 #: build/C/man2/perf_event_open.2:287
2156 "This indicates a hardware cache event. This has a special encoding, "
2157 "described in the I<config> field definition."
2161 #: build/C/man2/perf_event_open.2:287
2163 msgid "B<PERF_TYPE_RAW>"
2167 #: build/C/man2/perf_event_open.2:291
2169 "This indicates a \"raw\" implementation-specific event in the I<config> "
2174 #: build/C/man2/perf_event_open.2:291
2176 msgid "B<PERF_TYPE_BREAKPOINT> (Since Linux 2.6.33)"
2180 #: build/C/man2/perf_event_open.2:296
2182 "This indicates a hardware breakpoint as provided by the CPU. Breakpoints "
2183 "can be read/write accesses to an address as well as execution of an "
2184 "instruction address."
2188 #: build/C/man2/perf_event_open.2:296
2194 #: build/C/man2/perf_event_open.2:315
2196 "Since Linux 2.6.39, B<perf_event_open>() can support multiple PMUs. To "
2197 "enable this, a value exported by the kernel can be used in the I<type> field "
2198 "to indicate which PMU to use. The value to use can be found in the sysfs "
2199 "filesystem: there is a subdirectory per PMU instance under "
2200 "I</sys/bus/event_source/devices>. In each sub-directory there is a I<type> "
2201 "file whose content is an integer that can be used in the I<type> field. For "
2202 "instance, I</sys/bus/event_source/devices/cpu/type> contains the value for "
2203 "the core CPU PMU, which is usually 4."
2207 #: build/C/man2/perf_event_open.2:316 build/C/man2/perf_event_open.2:1588
2213 #: build/C/man2/perf_event_open.2:325
2215 "The size of the I<perf_event_attr> structure for forward/backward "
2216 "compatibility. Set this using I<sizeof(struct perf_event_attr)> to allow "
2217 "the kernel to see the struct size at the time of compilation."
2221 #: build/C/man2/perf_event_open.2:340
2223 "The related define B<PERF_ATTR_SIZE_VER0> is set to 64; this was the size of "
2224 "the first published struct. B<PERF_ATTR_SIZE_VER1> is 72, corresponding to "
2225 "the addition of breakpoints in Linux 2.6.33. B<PERF_ATTR_SIZE_VER2> is 80 "
2226 "corresponding to the addition of branch sampling in Linux 3.4. "
2227 "B<PERF_ATR_SIZE_VER3> is 96 corresponding to the addition of "
2228 "I<sample_regs_user> and I<sample_stack_user> in Linux 3.7."
2232 #: build/C/man2/perf_event_open.2:340
2238 #: build/C/man2/perf_event_open.2:351
2240 "This specifies which event you want, in conjunction with the I<type> field. "
2241 "The I<config1> and I<config2> fields are also taken into account in cases "
2242 "where 64 bits is not enough to fully specify the event. The encoding of "
2243 "these fields are event dependent."
2247 #: build/C/man2/perf_event_open.2:357
2249 "The most significant bit (bit 63) of I<config> signifies CPU-specific (raw) "
2250 "counter configuration data; if the most significant bit is unset, the next 7 "
2251 "bits are an event type and the rest of the bits are the event identifier."
2255 #: build/C/man2/perf_event_open.2:368
2257 "There are various ways to set the I<config> field that are dependent on the "
2258 "value of the previously described I<type> field. What follows are various "
2259 "possible settings for I<config> separated out by I<type>."
2263 #: build/C/man2/perf_event_open.2:378
2265 "If I<type> is B<PERF_TYPE_HARDWARE>, we are measuring one of the generalized "
2266 "hardware CPU events. Not all of these are available on all platforms. Set "
2267 "I<config> to one of the following:"
2271 #: build/C/man2/perf_event_open.2:379
2273 msgid "B<PERF_COUNT_HW_CPU_CYCLES>"
2277 #: build/C/man2/perf_event_open.2:383
2278 msgid "Total cycles. Be wary of what happens during CPU frequency scaling"
2282 #: build/C/man2/perf_event_open.2:383
2284 msgid "B<PERF_COUNT_HW_INSTRUCTIONS>"
2288 #: build/C/man2/perf_event_open.2:388
2290 "Retired instructions. Be careful, these can be affected by various issues, "
2291 "most notably hardware interrupt counts"
2295 #: build/C/man2/perf_event_open.2:388
2297 msgid "B<PERF_COUNT_HW_CACHE_REFERENCES>"
2301 #: build/C/man2/perf_event_open.2:395
2303 "Cache accesses. Usually this indicates Last Level Cache accesses but this "
2304 "may vary depending on your CPU. This may include prefetches and coherency "
2305 "messages; again this depends on the design of your CPU."
2309 #: build/C/man2/perf_event_open.2:395
2311 msgid "B<PERF_COUNT_HW_CACHE_MISSES>"
2315 #: build/C/man2/perf_event_open.2:402
2317 "Cache misses. Usually this indicates Last Level Cache misses; this is "
2318 "intended to be used in conjunction with the "
2319 "B<PERF_COUNT_HW_CACHE_REFERENCES> event to calculate cache miss rates."
2323 #: build/C/man2/perf_event_open.2:402
2325 msgid "B<PERF_COUNT_HW_BRANCH_INSTRUCTIONS>"
2329 #: build/C/man2/perf_event_open.2:407
2331 "Retired branch instructions. Prior to Linux 2.6.34, this used the wrong "
2332 "event on AMD processors."
2336 #: build/C/man2/perf_event_open.2:407
2338 msgid "B<PERF_COUNT_HW_BRANCH_MISSES>"
2342 #: build/C/man2/perf_event_open.2:410
2343 msgid "Mispredicted branch instructions."
2347 #: build/C/man2/perf_event_open.2:410
2349 msgid "B<PERF_COUNT_HW_BUS_CYCLES>"
2353 #: build/C/man2/perf_event_open.2:413
2354 msgid "Bus cycles, which can be different from total cycles."
2358 #: build/C/man2/perf_event_open.2:413
2360 msgid "B<PERF_COUNT_HW_STALLED_CYCLES_FRONTEND> (Since Linux 3.0)"
2364 #: build/C/man2/perf_event_open.2:416
2365 msgid "Stalled cycles during issue."
2369 #: build/C/man2/perf_event_open.2:416
2371 msgid "B<PERF_COUNT_HW_STALLED_CYCLES_BACKEND> (Since Linux 3.0)"
2375 #: build/C/man2/perf_event_open.2:419
2376 msgid "Stalled cycles during retirement."
2380 #: build/C/man2/perf_event_open.2:419
2382 msgid "B<PERF_COUNT_HW_REF_CPU_CYCLES> (Since Linux 3.3)"
2386 #: build/C/man2/perf_event_open.2:422
2387 msgid "Total cycles; not affected by CPU frequency scaling."
2391 #: build/C/man2/perf_event_open.2:432
2393 "If I<type> is B<PERF_TYPE_SOFTWARE>, we are measuring software events "
2394 "provided by the kernel. Set I<config> to one of the following:"
2398 #: build/C/man2/perf_event_open.2:433
2400 msgid "B<PERF_COUNT_SW_CPU_CLOCK>"
2404 #: build/C/man2/perf_event_open.2:436
2405 msgid "This reports the CPU clock, a high-resolution per-CPU timer."
2409 #: build/C/man2/perf_event_open.2:436
2411 msgid "B<PERF_COUNT_SW_TASK_CLOCK>"
2415 #: build/C/man2/perf_event_open.2:439
2416 msgid "This reports a clock count specific to the task that is running."
2420 #: build/C/man2/perf_event_open.2:439
2422 msgid "B<PERF_COUNT_SW_PAGE_FAULTS>"
2426 #: build/C/man2/perf_event_open.2:442
2427 msgid "This reports the number of page faults."
2431 #: build/C/man2/perf_event_open.2:442
2433 msgid "B<PERF_COUNT_SW_CONTEXT_SWITCHES>"
2437 #: build/C/man2/perf_event_open.2:447
2439 "This counts context switches. Until Linux 2.6.34, these were all reported "
2440 "as user-space events, after that they are reported as happening in the "
2445 #: build/C/man2/perf_event_open.2:447
2447 msgid "B<PERF_COUNT_SW_CPU_MIGRATIONS>"
2451 #: build/C/man2/perf_event_open.2:451
2452 msgid "This reports the number of times the process has migrated to a new CPU."
2456 #: build/C/man2/perf_event_open.2:451
2458 msgid "B<PERF_COUNT_SW_PAGE_FAULTS_MIN>"
2462 #: build/C/man2/perf_event_open.2:455
2464 "This counts the number of minor page faults. These did not require disk I/O "
2469 #: build/C/man2/perf_event_open.2:455
2471 msgid "B<PERF_COUNT_SW_PAGE_FAULTS_MAJ>"
2475 #: build/C/man2/perf_event_open.2:459
2477 "This counts the number of major page faults. These required disk I/O to "
2482 #: build/C/man2/perf_event_open.2:459
2484 msgid "B<PERF_COUNT_SW_ALIGNMENT_FAULTS> (Since Linux 2.6.33)"
2488 #: build/C/man2/perf_event_open.2:465
2490 "This counts the number of alignment faults. These happen when unaligned "
2491 "memory accesses happen; the kernel can handle these but it reduces "
2492 "performance. This only happens on some architectures (never on x86)."
2496 #: build/C/man2/perf_event_open.2:465
2498 msgid "B<PERF_COUNT_SW_EMULATION_FAULTS> (Since Linux 2.6.33)"
2502 #: build/C/man2/perf_event_open.2:471
2504 "This counts the number of emulation faults. The kernel sometimes traps on "
2505 "unimplemented instructions and emulates them for user space. This can "
2506 "negatively impact performance."
2510 #: build/C/man2/perf_event_open.2:484
2512 "If I<type> is B<PERF_TYPE_TRACEPOINT>, then we are measuring kernel "
2513 "tracepoints. The value to use in I<config> can be obtained from under "
2514 "debugfs I<tracing/events/*/*/id> if ftrace is enabled in the kernel."
2518 #: build/C/man2/perf_event_open.2:495
2520 "If I<type> is B<PERF_TYPE_HW_CACHE>, then we are measuring a hardware CPU "
2521 "cache event. To calculate the appropriate I<config> value use the following "
2526 #: build/C/man2/perf_event_open.2:500
2529 " (perf_hw_cache_id) | (perf_hw_cache_op_id E<lt>E<lt> 8) |\n"
2530 " (perf_hw_cache_op_result_id E<lt>E<lt> 16)\n"
2534 #: build/C/man2/perf_event_open.2:505
2535 msgid "where I<perf_hw_cache_id> is one of:"
2539 #: build/C/man2/perf_event_open.2:506
2541 msgid "B<PERF_COUNT_HW_CACHE_L1D>"
2545 #: build/C/man2/perf_event_open.2:509
2546 msgid "for measuring Level 1 Data Cache"
2550 #: build/C/man2/perf_event_open.2:509
2552 msgid "B<PERF_COUNT_HW_CACHE_L1I>"
2556 #: build/C/man2/perf_event_open.2:512
2557 msgid "for measuring Level 1 Instruction Cache"
2561 #: build/C/man2/perf_event_open.2:512
2563 msgid "B<PERF_COUNT_HW_CACHE_LL>"
2567 #: build/C/man2/perf_event_open.2:515
2568 msgid "for measuring Last-Level Cache"
2572 #: build/C/man2/perf_event_open.2:515
2574 msgid "B<PERF_COUNT_HW_CACHE_DTLB>"
2578 #: build/C/man2/perf_event_open.2:518
2579 msgid "for measuring the Data TLB"
2583 #: build/C/man2/perf_event_open.2:518
2585 msgid "B<PERF_COUNT_HW_CACHE_ITLB>"
2589 #: build/C/man2/perf_event_open.2:521
2590 msgid "for measuring the Instruction TLB"
2594 #: build/C/man2/perf_event_open.2:521
2596 msgid "B<PERF_COUNT_HW_CACHE_BPU>"
2600 #: build/C/man2/perf_event_open.2:524
2601 msgid "for measuring the branch prediction unit"
2605 #: build/C/man2/perf_event_open.2:524
2607 msgid "B<PERF_COUNT_HW_CACHE_NODE> (Since Linux 3.0)"
2611 #: build/C/man2/perf_event_open.2:527
2612 msgid "for measuring local memory accesses"
2616 #: build/C/man2/perf_event_open.2:532
2617 msgid "and I<perf_hw_cache_op_id> is one of"
2621 #: build/C/man2/perf_event_open.2:533
2623 msgid "B<PERF_COUNT_HW_CACHE_OP_READ>"
2627 #: build/C/man2/perf_event_open.2:536
2628 msgid "for read accesses"
2632 #: build/C/man2/perf_event_open.2:536
2634 msgid "B<PERF_COUNT_HW_CACHE_OP_WRITE>"
2638 #: build/C/man2/perf_event_open.2:539
2639 msgid "for write accesses"
2643 #: build/C/man2/perf_event_open.2:539
2645 msgid "B<PERF_COUNT_HW_CACHE_OP_PREFETCH>"
2649 #: build/C/man2/perf_event_open.2:542
2650 msgid "for prefetch accesses"
2654 #: build/C/man2/perf_event_open.2:547
2655 msgid "and I<perf_hw_cache_op_result_id> is one of"
2659 #: build/C/man2/perf_event_open.2:548
2661 msgid "B<PERF_COUNT_HW_CACHE_RESULT_ACCESS>"
2665 #: build/C/man2/perf_event_open.2:551
2666 msgid "to measure accesses"
2670 #: build/C/man2/perf_event_open.2:551
2672 msgid "B<PERF_COUNT_HW_CACHE_RESULT_MISS>"
2676 #: build/C/man2/perf_event_open.2:554
2677 msgid "to measure misses"
2681 #: build/C/man2/perf_event_open.2:572
2683 "If I<type> is B<PERF_TYPE_RAW>, then a custom \"raw\" I<config> value is "
2684 "needed. Most CPUs support events that are not covered by the "
2685 "\"generalized\" events. These are implementation defined; see your CPU "
2686 "manual (for example the Intel Volume 3B documentation or the AMD BIOS and "
2687 "Kernel Developer Guide). The libpfm4 library can be used to translate from "
2688 "the name in the architectural manuals to the raw hex value "
2689 "B<perf_event_open>() expects in this field."
2693 #: build/C/man2/perf_event_open.2:581
2695 "If I<type> is B<PERF_TYPE_BREAKPOINT>, then leave I<config> set to zero. "
2696 "Its parameters are set in other places."
2700 #: build/C/man2/perf_event_open.2:582
2702 msgid "I<sample_period>, I<sample_freq>"
2706 #: build/C/man2/perf_event_open.2:594
2708 "A \"sampling\" counter is one that generates an interrupt every N events, "
2709 "where N is given by I<sample_period>. A sampling counter has "
2710 "I<sample_period> E<gt> 0. When an overflow interrupt occurs, requested data "
2711 "is recorded in the mmap buffer. The I<sample_type> field controls what data "
2712 "is recorded on each interrupt."
2716 #: build/C/man2/perf_event_open.2:604
2718 "I<sample_freq> can be used if you wish to use frequency rather than period. "
2719 "In this case you set the I<freq> flag. The kernel will adjust the sampling "
2720 "period to try and achieve the desired rate. The rate of adjustment is a "
2725 #: build/C/man2/perf_event_open.2:604
2727 msgid "I<sample_type>"
2731 #: build/C/man2/perf_event_open.2:616
2733 "The various bits in this field specify which values to include in the "
2734 "sample. They will be recorded in a ring-buffer, which is available to user "
2735 "space using B<mmap>(2). The order in which the values are saved in the "
2736 "sample are documented in the MMAP Layout subsection below; it is not the "
2737 "I<enum perf_event_sample_format> order."
2741 #: build/C/man2/perf_event_open.2:617
2743 msgid "B<PERF_SAMPLE_IP>"
2747 #: build/C/man2/perf_event_open.2:620
2748 msgid "Records instruction pointer."
2752 #: build/C/man2/perf_event_open.2:620
2754 msgid "B<PERF_SAMPLE_TID>"
2758 #: build/C/man2/perf_event_open.2:623
2759 msgid "Records the process and thread IDs."
2763 #: build/C/man2/perf_event_open.2:623
2765 msgid "B<PERF_SAMPLE_TIME>"
2769 #: build/C/man2/perf_event_open.2:626
2770 msgid "Records a timestamp."
2774 #: build/C/man2/perf_event_open.2:626
2776 msgid "B<PERF_SAMPLE_ADDR>"
2780 #: build/C/man2/perf_event_open.2:629
2781 msgid "Records an address, if applicable."
2785 #: build/C/man2/perf_event_open.2:629
2787 msgid "B<PERF_SAMPLE_READ>"
2791 #: build/C/man2/perf_event_open.2:632
2792 msgid "Record counter values for all events in a group, not just the group leader."
2796 #: build/C/man2/perf_event_open.2:632
2798 msgid "B<PERF_SAMPLE_CALLCHAIN>"
2802 #: build/C/man2/perf_event_open.2:635
2803 msgid "Records the callchain (stack backtrace)."
2807 #: build/C/man2/perf_event_open.2:635
2809 msgid "B<PERF_SAMPLE_ID>"
2813 #: build/C/man2/perf_event_open.2:638
2814 msgid "Records a unique ID for the opened event's group leader."
2818 #: build/C/man2/perf_event_open.2:638
2820 msgid "B<PERF_SAMPLE_CPU>"
2824 #: build/C/man2/perf_event_open.2:641
2825 msgid "Records CPU number."
2829 #: build/C/man2/perf_event_open.2:641
2831 msgid "B<PERF_SAMPLE_PERIOD>"
2835 #: build/C/man2/perf_event_open.2:644
2836 msgid "Records the current sampling period."
2840 #: build/C/man2/perf_event_open.2:644
2842 msgid "B<PERF_SAMPLE_STREAM_ID>"
2846 #: build/C/man2/perf_event_open.2:651
2848 "Records a unique ID for the opened event. Unlike B<PERF_SAMPLE_ID> the "
2849 "actual ID is returned, not the group leader. This ID is the same as the one "
2850 "returned by PERF_FORMAT_ID."
2854 #: build/C/man2/perf_event_open.2:651
2856 msgid "B<PERF_SAMPLE_RAW>"
2860 #: build/C/man2/perf_event_open.2:655
2862 "Records additional data, if applicable. Usually returned by tracepoint "
2867 #: build/C/man2/perf_event_open.2:655
2869 msgid "B<PERF_SAMPLE_BRANCH_STACK> (Since Linux 3.4)"
2873 #: build/C/man2/perf_event_open.2:659
2874 msgid "Records the branch stack. See branch_sample_type."
2878 #: build/C/man2/perf_event_open.2:659
2880 msgid "B<PERF_SAMPLE_REGS_USER> (Since Linux 3.7)"
2884 #: build/C/man2/perf_event_open.2:662
2885 msgid "Records the current register state."
2889 #: build/C/man2/perf_event_open.2:662
2891 msgid "B<PERF_SAMPLE_STACK_USER> (Since Linux 3.7)"
2895 #: build/C/man2/perf_event_open.2:665 build/C/man2/perf_event_open.2:1786 build/C/man2/perf_event_open.2:1803
2896 msgid "[To be documented]"
2900 #: build/C/man2/perf_event_open.2:666
2902 msgid "I<read_format>"
2906 #: build/C/man2/perf_event_open.2:673
2908 "This field specifies the format of the data returned by B<read>(2) on a "
2909 "B<perf_event_open>() file descriptor."
2913 #: build/C/man2/perf_event_open.2:674
2915 msgid "B<PERF_FORMAT_TOTAL_TIME_ENABLED>"
2919 #: build/C/man2/perf_event_open.2:681
2921 "Adds the 64-bit I<time_enabled> field. This can be used to calculate "
2922 "estimated totals if the PMU is overcommitted and multiplexing is happening."
2926 #: build/C/man2/perf_event_open.2:681
2928 msgid "B<PERF_FORMAT_TOTAL_TIME_RUNNING>"
2932 #: build/C/man2/perf_event_open.2:688
2934 "Adds the 64-bit I<time_running> field. This can be used to calculate "
2935 "estimated totals if the PMU is overcommitted and multiplexing is happening."
2939 #: build/C/man2/perf_event_open.2:688
2941 msgid "B<PERF_FORMAT_ID>"
2945 #: build/C/man2/perf_event_open.2:691
2946 msgid "Adds a 64-bit unique value that corresponds to the event group."
2950 #: build/C/man2/perf_event_open.2:691
2952 msgid "B<PERF_FORMAT_GROUP>"
2956 #: build/C/man2/perf_event_open.2:694
2957 msgid "Allows all counter values in an event group to be read with one read."
2961 #: build/C/man2/perf_event_open.2:695
2967 #: build/C/man2/perf_event_open.2:705
2969 "The I<disabled> bit specifies whether the counter starts out disabled or "
2970 "enabled. If disabled, the event can later be enabled by B<ioctl>(2), "
2971 "B<prctl>(2), or I<enable_on_exec>."
2975 #: build/C/man2/perf_event_open.2:705
2981 #: build/C/man2/perf_event_open.2:714
2983 "The I<inherit> bit specifies that this counter should count events of child "
2984 "tasks as well as the task specified. This only applies to new children, not "
2985 "to any existing children at the time the counter is created (nor to any new "
2986 "children of existing children)."
2990 #: build/C/man2/perf_event_open.2:719
2992 "Inherit does not work for some combinations of I<read_format>s, such as "
2993 "B<PERF_FORMAT_GROUP>."
2997 #: build/C/man2/perf_event_open.2:719
3003 #: build/C/man2/perf_event_open.2:732
3005 "The I<pinned> bit specifies that the counter should always be on the CPU if "
3006 "at all possible. It only applies to hardware counters and only to group "
3007 "leaders. If a pinned counter cannot be put onto the CPU (e.g., because "
3008 "there are not enough hardware counters or because of a conflict with some "
3009 "other event), then the counter goes into an 'error' state, where reads "
3010 "return end-of-file (i.e., B<read>(2) returns 0) until the counter is "
3011 "subsequently enabled or disabled."
3015 #: build/C/man2/perf_event_open.2:732
3017 msgid "I<exclusive>"
3021 #: build/C/man2/perf_event_open.2:741
3023 "The I<exclusive> bit specifies that when this counter's group is on the CPU, "
3024 "it should be the only group using the CPU's counters. In the future this "
3025 "may allow monitoring programs to support PMU features that need to run alone "
3026 "so that they do not disrupt other hardware counters."
3030 #: build/C/man2/perf_event_open.2:741
3032 msgid "I<exclude_user>"
3036 #: build/C/man2/perf_event_open.2:744
3037 msgid "If this bit is set, the count excludes events that happen in user space."
3041 #: build/C/man2/perf_event_open.2:744
3043 msgid "I<exclude_kernel>"
3047 #: build/C/man2/perf_event_open.2:747
3048 msgid "If this bit is set, the count excludes events that happen in kernel-space."
3052 #: build/C/man2/perf_event_open.2:747
3054 msgid "I<exclude_hv>"
3058 #: build/C/man2/perf_event_open.2:755
3060 "If this bit is set, the count excludes events that happen in the "
3061 "hypervisor. This is mainly for PMUs that have built-in support for handling "
3062 "this (such as POWER). Extra support is needed for handling hypervisor "
3063 "measurements on most machines."
3067 #: build/C/man2/perf_event_open.2:755
3069 msgid "I<exclude_idle>"
3073 #: build/C/man2/perf_event_open.2:758
3074 msgid "If set, don't count when the CPU is idle."
3078 #: build/C/man2/perf_event_open.2:758
3084 #: build/C/man2/perf_event_open.2:763
3085 msgid "The I<mmap> bit enables recording of exec mmap events."
3089 #: build/C/man2/perf_event_open.2:763
3095 #: build/C/man2/perf_event_open.2:774
3097 "The I<comm> bit enables tracking of process command name as modified by the "
3098 "I<exec>(2) and I<prctl>(PR_SET_NAME) system calls. Unfortunately for "
3099 "tools, there is no way to distinguish one system call versus the other."
3103 #: build/C/man2/perf_event_open.2:774
3109 #: build/C/man2/perf_event_open.2:781
3111 "If this bit is set, then I<sample_frequency> not I<sample_period> is used "
3112 "when setting up the sampling interval."
3116 #: build/C/man2/perf_event_open.2:781
3118 msgid "I<inherit_stat>"
3122 #: build/C/man2/perf_event_open.2:788
3124 "This bit enables saving of event counts on context switch for inherited "
3125 "tasks. This is only meaningful if the I<inherit> field is set."
3129 #: build/C/man2/perf_event_open.2:788
3131 msgid "I<enable_on_exec>"
3135 #: build/C/man2/perf_event_open.2:793
3137 "If this bit is set, a counter is automatically enabled after a call to "
3142 #: build/C/man2/perf_event_open.2:793
3148 #: build/C/man2/perf_event_open.2:797
3150 "If this bit is set, then fork/exit notifications are included in the ring "
3155 #: build/C/man2/perf_event_open.2:797
3157 msgid "I<watermark>"
3161 #: build/C/man2/perf_event_open.2:805
3163 "If set, have a sampling interrupt happen when we cross the "
3164 "I<wakeup_watermark> boundary. Otherwise interrupts happen after "
3165 "I<wakeup_events> samples."
3169 #: build/C/man2/perf_event_open.2:805
3171 msgid "I<precise_ip> (Since Linux 2.6.35)"
3175 #: build/C/man2/perf_event_open.2:815
3177 "This controls the amount of skid. Skid is how many instructions execute "
3178 "between an event of interest happening and the kernel being able to stop and "
3179 "record the event. Smaller skid is better and allows more accurate reporting "
3180 "of which events correspond to which instructions, but hardware is often "
3181 "limited with how small this can be."
3185 #: build/C/man2/perf_event_open.2:817
3186 msgid "The values of this are the following:"
3190 #: build/C/man2/perf_event_open.2:818
3196 #: build/C/man2/perf_event_open.2:822
3197 msgid "B<SAMPLE_IP> can have arbitrary skid"
3201 #: build/C/man2/perf_event_open.2:822
3207 #: build/C/man2/perf_event_open.2:826
3208 msgid "B<SAMPLE_IP> must have constant skid"
3212 #: build/C/man2/perf_event_open.2:826
3218 #: build/C/man2/perf_event_open.2:830
3219 msgid "B<SAMPLE_IP> requested to have 0 skid"
3223 #: build/C/man2/perf_event_open.2:830
3229 #: build/C/man2/perf_event_open.2:836
3230 msgid "B<SAMPLE_IP> must have 0 skid. See also B<PERF_RECORD_MISC_EXACT_IP>."
3234 #: build/C/man2/perf_event_open.2:837
3236 msgid "I<mmap_data> (Since Linux 2.6.36)"
3240 #: build/C/man2/perf_event_open.2:843
3242 "The counterpart of the I<mmap> field, but enables including data mmap events "
3243 "in the ring-buffer."
3247 #: build/C/man2/perf_event_open.2:843
3249 msgid "I<sample_id_all> (Since Linux 2.6.38)"
3253 #: build/C/man2/perf_event_open.2:851
3255 "If set, then TID, TIME, ID, CPU, and STREAM_ID can additionally be included "
3256 "in non-B<PERF_RECORD_SAMPLE>s if the corresponding I<sample_type> is "
3261 #: build/C/man2/perf_event_open.2:851
3263 msgid "I<exclude_host> (Since Linux 3.2)"
3267 #: build/C/man2/perf_event_open.2:854
3268 msgid "Do not measure time spent in VM host"
3272 #: build/C/man2/perf_event_open.2:854
3274 msgid "I<exclude_guest> (Since Linux 3.2)"
3278 #: build/C/man2/perf_event_open.2:857
3279 msgid "Do not measure time spent in VM guest"
3283 #: build/C/man2/perf_event_open.2:857
3285 msgid "I<exclude_callchain_kernel> (Since Linux 3.7)"
3289 #: build/C/man2/perf_event_open.2:860
3290 msgid "Do not include kernel callchains."
3294 #: build/C/man2/perf_event_open.2:860
3296 msgid "I<exclude_callchain_user> (Since Linux 3.7)"
3300 #: build/C/man2/perf_event_open.2:863
3301 msgid "Do not include user callchains."
3305 #: build/C/man2/perf_event_open.2:863
3307 msgid "I<wakeup_events>, I<wakeup_watermark>"
3311 #: build/C/man2/perf_event_open.2:873
3313 "This union sets how many samples (I<wakeup_events>) or bytes "
3314 "(I<wakeup_watermark>) happen before an overflow signal happens. Which one "
3315 "is used is selected by the I<watermark> bitflag."
3319 #: build/C/man2/perf_event_open.2:873
3321 msgid "I<bp_type> (Since Linux 2.6.33)"
3325 #: build/C/man2/perf_event_open.2:877
3326 msgid "This chooses the breakpoint type. It is one of:"
3330 #: build/C/man2/perf_event_open.2:878
3332 msgid "B<HW_BREAKPOINT_EMPTY>"
3336 #: build/C/man2/perf_event_open.2:881
3337 msgid "no breakpoint"
3341 #: build/C/man2/perf_event_open.2:881
3343 msgid "B<HW_BREAKPOINT_R>"
3347 #: build/C/man2/perf_event_open.2:884
3348 msgid "count when we read the memory location"
3352 #: build/C/man2/perf_event_open.2:884
3354 msgid "B<HW_BREAKPOINT_W>"
3358 #: build/C/man2/perf_event_open.2:887
3359 msgid "count when we write the memory location"
3363 #: build/C/man2/perf_event_open.2:887
3365 msgid "B<HW_BREAKPOINT_RW>"
3369 #: build/C/man2/perf_event_open.2:890
3370 msgid "count when we read or write the memory location"
3374 #: build/C/man2/perf_event_open.2:890
3376 msgid "B<HW_BREAKPOINT_X>"
3380 #: build/C/man2/perf_event_open.2:893
3381 msgid "count when we execute code at the memory location"
3385 #: build/C/man2/perf_event_open.2:902
3387 "The values can be combined via a bitwise or, but the combination of "
3388 "B<HW_BREAKPOINT_R> or B<HW_BREAKPOINT_W> with B<HW_BREAKPOINT_X> is not "
3393 #: build/C/man2/perf_event_open.2:903
3395 msgid "I<bp_addr> (Since Linux 2.6.33)"
3399 #: build/C/man2/perf_event_open.2:910
3401 "I<bp_addr> address of the breakpoint. For execution breakpoints this is the "
3402 "memory address of the instruction of interest; for read and write "
3403 "breakpoints it is the memory address of the memory location of interest."
3407 #: build/C/man2/perf_event_open.2:910
3409 msgid "I<config1> (Since Linux 2.6.39)"
3413 #: build/C/man2/perf_event_open.2:917
3415 "I<config1> is used for setting events that need an extra register or "
3416 "otherwise do not fit in the regular config field. Raw OFFCORE_EVENTS on "
3417 "Nehalem/Westmere/SandyBridge use this field on 3.3 and later kernels."
3421 #: build/C/man2/perf_event_open.2:917
3423 msgid "I<bp_len> (Since Linux 2.6.33)"
3427 #: build/C/man2/perf_event_open.2:931
3429 "I<bp_len> is the length of the breakpoint being measured if I<type> is "
3430 "B<PERF_TYPE_BREAKPOINT>. Options are B<HW_BREAKPOINT_LEN_1>, "
3431 "B<HW_BREAKPOINT_LEN_2>, B<HW_BREAKPOINT_LEN_4>, B<HW_BREAKPOINT_LEN_8>. For "
3432 "an execution breakpoint, set this to I<sizeof(long)>."
3436 #: build/C/man2/perf_event_open.2:931
3438 msgid "I<config2> (Since Linux 2.6.39)"
3442 #: build/C/man2/perf_event_open.2:938
3443 msgid "I<config2> is a further extension of the I<config1> field."
3447 #: build/C/man2/perf_event_open.2:938
3449 msgid "I<branch_sample_type> (Since Linux 3.4)"
3453 #: build/C/man2/perf_event_open.2:942
3455 "This is used with the CPUs hardware branch sampling, if available. It can "
3456 "have one of the following values:"
3460 #: build/C/man2/perf_event_open.2:943
3462 msgid "B<PERF_SAMPLE_BRANCH_USER>"
3466 #: build/C/man2/perf_event_open.2:946
3467 msgid "Branch target is in user space"
3471 #: build/C/man2/perf_event_open.2:946
3473 msgid "B<PERF_SAMPLE_BRANCH_KERNEL>"
3477 #: build/C/man2/perf_event_open.2:949
3478 msgid "Branch target is in kernel space"
3482 #: build/C/man2/perf_event_open.2:949
3484 msgid "B<PERF_SAMPLE_BRANCH_HV>"
3488 #: build/C/man2/perf_event_open.2:952
3489 msgid "Branch target is in hypervisor"
3493 #: build/C/man2/perf_event_open.2:952
3495 msgid "B<PERF_SAMPLE_BRANCH_ANY>"
3499 #: build/C/man2/perf_event_open.2:955
3500 msgid "Any branch type."
3504 #: build/C/man2/perf_event_open.2:955
3506 msgid "B<PERF_SAMPLE_BRANCH_ANY_CALL>"
3510 #: build/C/man2/perf_event_open.2:958
3511 msgid "Any call branch"
3515 #: build/C/man2/perf_event_open.2:958
3517 msgid "B<PERF_SAMPLE_BRANCH_ANY_RETURN>"
3521 #: build/C/man2/perf_event_open.2:961
3522 msgid "Any return branch"
3526 #: build/C/man2/perf_event_open.2:961
3528 msgid "B<PERF_SAMPLE_BRANCH_IND_CALL>"
3532 #: build/C/man2/perf_event_open.2:964
3533 msgid "Indirect calls"
3537 #: build/C/man2/perf_event_open.2:964
3539 msgid "B<PERF_SAMPLE_BRANCH_PLM_ALL>"
3543 #: build/C/man2/perf_event_open.2:967
3544 msgid "User, kernel, and hv"
3548 #: build/C/man2/perf_event_open.2:968
3550 msgid "I<sample_regs_user> (Since Linux 3.7)"
3553 #. FIXME: The following reference seems to be not quite right:
3555 #: build/C/man2/perf_event_open.2:974
3557 "This defines the set of user registers to dump on samples. See "
3558 "I<asm/perf_regs.h>."
3562 #: build/C/man2/perf_event_open.2:974
3564 msgid "I<sample_stack_user> (Since Linux 3.7)"
3568 #: build/C/man2/perf_event_open.2:977
3569 msgid "This defines the size of the user stack to dump on samples."
3573 #: build/C/man2/perf_event_open.2:977
3575 msgid "Reading results"
3579 #: build/C/man2/perf_event_open.2:987
3581 "Once a B<perf_event_open>() file descriptor has been opened, the values of "
3582 "the events can be read from the file descriptor. The values that are there "
3583 "are specified by the I<read_format> field in the I<attr> structure at open "
3588 #: build/C/man2/perf_event_open.2:992
3590 "If you attempt to read into a buffer that is not big enough to hold the data "
3591 "B<ENOSPC> is returned"
3595 #: build/C/man2/perf_event_open.2:994
3596 msgid "Here is the layout of the data returned by a read:"
3600 #: build/C/man2/perf_event_open.2:994 build/C/man2/perf_event_open.2:1012 build/C/man2/ptrace.2:1552 build/C/man2/ptrace.2:1562 build/C/man2/ptrace.2:1570 build/C/man2/ptrace.2:1576 build/C/man2/ptrace.2:1705
3606 #: build/C/man2/perf_event_open.2:998
3608 "If B<PERF_FORMAT_GROUP> was specified to allow reading all events in a group "
3613 #: build/C/man2/perf_event_open.2:1010
3616 "struct read_format {\n"
3617 " u64 nr; /* The number of events */\n"
3618 " u64 time_enabled; /* if PERF_FORMAT_TOTAL_TIME_ENABLED */\n"
3619 " u64 time_running; /* if PERF_FORMAT_TOTAL_TIME_RUNNING */\n"
3621 " u64 value; /* The value of the event */\n"
3622 " u64 id; /* if PERF_FORMAT_ID */\n"
3628 #: build/C/man2/perf_event_open.2:1018
3629 msgid "If B<PERF_FORMAT_GROUP> was I<not> specified:"
3633 #: build/C/man2/perf_event_open.2:1027
3636 "struct read_format {\n"
3637 " u64 value; /* The value of the event */\n"
3638 " u64 time_enabled; /* if PERF_FORMAT_TOTAL_TIME_ENABLED */\n"
3639 " u64 time_running; /* if PERF_FORMAT_TOTAL_TIME_RUNNING */\n"
3640 " u64 id; /* if PERF_FORMAT_ID */\n"
3645 #: build/C/man2/perf_event_open.2:1031
3646 msgid "The values read are as follows:"
3650 #: build/C/man2/perf_event_open.2:1031
3656 #: build/C/man2/perf_event_open.2:1037
3658 "The number of events in this file descriptor. Only available if "
3659 "B<PERF_FORMAT_GROUP> was specified."
3663 #: build/C/man2/perf_event_open.2:1037
3665 msgid "I<time_enabled>, I<time_running>"
3669 #: build/C/man2/perf_event_open.2:1049
3671 "Total time the event was enabled and running. Normally these are the same. "
3672 "If more events are started than available counter slots on the PMU, then "
3673 "multiplexing happens and events only run part of the time. In that case the "
3674 "I<time_enabled> and I<time running> values can be used to scale an estimated "
3675 "value for the count."
3679 #: build/C/man2/perf_event_open.2:1049
3685 #: build/C/man2/perf_event_open.2:1052
3686 msgid "An unsigned 64-bit value containing the counter result."
3690 #: build/C/man2/perf_event_open.2:1052 build/C/man2/perf_event_open.2:1316 build/C/man2/perf_event_open.2:1451
3696 #: build/C/man2/perf_event_open.2:1058
3698 "A globally unique value for this particular event, only there if "
3699 "B<PERF_FORMAT_ID> was specified in I<read_format>."
3703 #: build/C/man2/perf_event_open.2:1058
3709 #: build/C/man2/perf_event_open.2:1068
3711 "When using B<perf_event_open>() in sampled mode, asynchronous events (like "
3712 "counter overflow or B<PROT_EXEC> mmap tracking) are logged into a "
3713 "ring-buffer. This ring-buffer is created and accessed through B<mmap>(2)."
3717 #: build/C/man2/perf_event_open.2:1074
3719 "The mmap size should be 1+2^n pages, where the first page is a metadata page "
3720 "(I<struct perf_event_mmap_page>) that contains various bits of information "
3721 "such as where the ring-buffer head is."
3725 #: build/C/man2/perf_event_open.2:1077
3727 "Before kernel 2.6.39, there is a bug that means you must allocate a mmap "
3728 "ring buffer when sampling even if you do not plan to access it."
3732 #: build/C/man2/perf_event_open.2:1079
3733 msgid "The structure of the first metadata mmap page is as follows:"
3737 #: build/C/man2/perf_event_open.2:1103
3740 "struct perf_event_mmap_page {\n"
3741 " __u32 version; /* version number of this structure */\n"
3742 " __u32 compat_version; /* lowest version this is compat with */\n"
3743 " __u32 lock; /* seqlock for synchronization */\n"
3744 " __u32 index; /* hardware counter identifier */\n"
3745 " __s64 offset; /* add to hardware counter value */\n"
3746 " __u64 time_enabled; /* time event active */\n"
3747 " __u64 time_running; /* time event on CPU */\n"
3749 " __u64 capabilities;\n"
3750 " __u64 cap_usr_time : 1,\n"
3751 " cap_usr_rdpmc : 1,\n"
3753 " __u16 pmc_width;\n"
3754 " __u16 time_shift;\n"
3755 " __u32 time_mult;\n"
3756 " __u64 time_offset;\n"
3757 " __u64 __reserved[120]; /* Pad to 1k */\n"
3758 " __u64 data_head; /* head in the data section */\n"
3759 " __u64 data_tail; /* user-space written tail */\n"
3764 #: build/C/man2/perf_event_open.2:1109
3766 "The following looks at the fields in the I<perf_event_mmap_page> structure "
3771 #: build/C/man2/perf_event_open.2:1109
3777 #: build/C/man2/perf_event_open.2:1112
3778 msgid "Version number of this structure."
3782 #: build/C/man2/perf_event_open.2:1112
3784 msgid "I<compat_version>"
3788 #: build/C/man2/perf_event_open.2:1115
3789 msgid "The lowest version this is compatible with."
3793 #: build/C/man2/perf_event_open.2:1115
3799 #: build/C/man2/perf_event_open.2:1118
3800 msgid "A seqlock for synchronization."
3804 #: build/C/man2/perf_event_open.2:1118
3810 #: build/C/man2/perf_event_open.2:1121
3811 msgid "A unique hardware counter identifier."
3815 #: build/C/man2/perf_event_open.2:1121
3822 #: build/C/man2/perf_event_open.2:1125
3823 msgid "Add this to hardware counter value??"
3827 #: build/C/man2/perf_event_open.2:1125
3829 msgid "I<time_enabled>"
3833 #: build/C/man2/perf_event_open.2:1128
3834 msgid "Time the event was active."
3838 #: build/C/man2/perf_event_open.2:1128
3840 msgid "I<time_running>"
3844 #: build/C/man2/perf_event_open.2:1131
3845 msgid "Time the event was running."
3849 #: build/C/man2/perf_event_open.2:1131
3851 msgid "I<cap_usr_time>"
3855 #: build/C/man2/perf_event_open.2:1134
3856 msgid "User time capability"
3860 #: build/C/man2/perf_event_open.2:1134
3862 msgid "I<cap_usr_rdpmc>"
3866 #: build/C/man2/perf_event_open.2:1139
3868 "If the hardware supports user-space read of performance counters without "
3869 "syscall (this is the \"rdpmc\" instruction on x86), then the following code "
3870 "can be used to do a read:"
3874 #: build/C/man2/perf_event_open.2:1146
3877 "u32 seq, time_mult, time_shift, idx, width;\n"
3878 "u64 count, enabled, running;\n"
3879 "u64 cyc, time_offset;\n"
3884 #: build/C/man2/perf_event_open.2:1152
3888 " seq = pc-E<gt>lock;\n"
3890 " enabled = pc-E<gt>time_enabled;\n"
3891 " running = pc-E<gt>time_running;\n"
3895 #: build/C/man2/perf_event_open.2:1159
3898 " if (pc-E<gt>cap_usr_time && enabled != running) {\n"
3900 " time_offset = pc-E<gt>time_offset;\n"
3901 " time_mult = pc-E<gt>time_mult;\n"
3902 " time_shift = pc-E<gt>time_shift;\n"
3907 #: build/C/man2/perf_event_open.2:1162
3910 " idx = pc-E<gt>index;\n"
3911 " count = pc-E<gt>offset;\n"
3915 #: build/C/man2/perf_event_open.2:1167
3918 " if (pc-E<gt>cap_usr_rdpmc && idx) {\n"
3919 " width = pc-E<gt>pmc_width;\n"
3920 " pmc = rdpmc(idx - 1);\n"
3925 #: build/C/man2/perf_event_open.2:1170
3929 "} while (pc-E<gt>lock != seq);\n"
3933 #: build/C/man2/perf_event_open.2:1172
3935 msgid "I<pmc_width>"
3939 #: build/C/man2/perf_event_open.2:1179
3941 "If I<cap_usr_rdpmc>, this field provides the bit-width of the value read "
3942 "using the rdpmc or equivalent instruction. This can be used to sign extend "
3947 #: build/C/man2/perf_event_open.2:1185
3950 "pmc E<lt>E<lt>= 64 - pmc_width;\n"
3951 "pmc E<gt>E<gt>= 64 - pmc_width; // signed shift right\n"
3956 #: build/C/man2/perf_event_open.2:1187
3958 msgid "I<time_shift>, I<time_mult>, I<time_offset>"
3962 #: build/C/man2/perf_event_open.2:1194
3964 "If I<cap_usr_time>, these fields can be used to compute the time delta since "
3965 "time_enabled (in nanoseconds) using rdtsc or similar."
3969 #: build/C/man2/perf_event_open.2:1202
3974 " quot = (cyc E<gt>E<gt> time_shift);\n"
3975 " rem = cyc & ((1 E<lt>E<lt> time_shift) - 1);\n"
3976 " delta = time_offset + quot * time_mult +\n"
3977 " ((rem * time_mult) E<gt>E<gt> time_shift);\n"
3981 #: build/C/man2/perf_event_open.2:1214
3983 "Where I<time_offset>, I<time_mult>, I<time_shift>, and I<cyc> are read in "
3984 "the seqcount loop described above. This delta can then be added to enabled "
3985 "and possible running (if idx), improving the scaling:"
3989 #: build/C/man2/perf_event_open.2:1222
3992 " enabled += delta;\n"
3994 " running += delta;\n"
3995 " quot = count / running;\n"
3996 " rem = count % running;\n"
3997 " count = quot * enabled + (rem * enabled) / running;\n"
4001 #: build/C/man2/perf_event_open.2:1223
4003 msgid "I<data_head>"
4007 #: build/C/man2/perf_event_open.2:1229
4009 "This points to the head of the data section. The value continuously "
4010 "increases, it does not wrap. The value needs to be manually wrapped by the "
4011 "size of the mmap buffer before accessing the samples."
4015 #: build/C/man2/perf_event_open.2:1232
4017 "On SMP-capable platforms, after reading the data_head value, user space "
4018 "should issue an rmb()."
4022 #: build/C/man2/perf_event_open.2:1232
4024 msgid "I<data_tail;>"
4028 #: build/C/man2/perf_event_open.2:1240
4030 "When the mapping is B<PROT_WRITE>, the I<data_tail> value should be written "
4031 "by user space to reflect the last read data. In this case the kernel will "
4032 "not over-write unread data."
4036 #: build/C/man2/perf_event_open.2:1242
4037 msgid "The following 2^n ring-buffer pages have the layout described below."
4041 #: build/C/man2/perf_event_open.2:1256
4043 "If I<perf_event_attr.sample_id_all> is set, then all event types will have "
4044 "the sample_type selected fields related to where/when (identity) an event "
4045 "took place (TID, TIME, ID, CPU, STREAM_ID) described in "
4046 "B<PERF_RECORD_SAMPLE> below, it will be stashed just after the "
4047 "I<perf_event_header> and the fields already present for the existing fields, "
4048 "i.e., at the end of the payload. That way a newer perf.data file will be "
4049 "supported by older perf tools, with these new optional fields being ignored."
4053 #: build/C/man2/perf_event_open.2:1258
4054 msgid "The mmap values start with a header:"
4058 #: build/C/man2/perf_event_open.2:1266
4061 "struct perf_event_header {\n"
4069 #: build/C/man2/perf_event_open.2:1272
4070 msgid "Below, we describe the I<perf_event_header> fields in more detail."
4074 #: build/C/man2/perf_event_open.2:1281
4076 "The I<type> value is one of the below. The values in the corresponding "
4077 "record (that follows the header) depend on the I<type> selected as shown."
4081 #: build/C/man2/perf_event_open.2:1282
4083 msgid "B<PERF_RECORD_MMAP>"
4087 #: build/C/man2/perf_event_open.2:1289
4089 "The MMAP events record the B<PROT_EXEC> mappings so that we can correlate "
4090 "user-space IPs to code. They have the following structure:"
4094 #: build/C/man2/perf_event_open.2:1300
4098 " struct perf_event_header header;\n"
4103 " char filename[];\n"
4108 #: build/C/man2/perf_event_open.2:1302
4110 msgid "B<PERF_RECORD_LOST>"
4114 #: build/C/man2/perf_event_open.2:1305
4115 msgid "This record indicates when events are lost."
4119 #: build/C/man2/perf_event_open.2:1313
4123 " struct perf_event_header header;\n"
4130 #: build/C/man2/perf_event_open.2:1319
4131 msgid "is the unique event ID for the samples that were lost."
4135 #: build/C/man2/perf_event_open.2:1319
4141 #: build/C/man2/perf_event_open.2:1322
4142 msgid "is the number of events that were lost."
4146 #: build/C/man2/perf_event_open.2:1323
4148 msgid "B<PERF_RECORD_COMM>"
4152 #: build/C/man2/perf_event_open.2:1326
4153 msgid "This record indicates a change in the process name."
4157 #: build/C/man2/perf_event_open.2:1334
4161 " struct perf_event_header header;\n"
4168 #: build/C/man2/perf_event_open.2:1336
4170 msgid "B<PERF_RECORD_EXIT>"
4174 #: build/C/man2/perf_event_open.2:1339
4175 msgid "This record indicates a process exit event."
4179 #: build/C/man2/perf_event_open.2:1348 build/C/man2/perf_event_open.2:1376
4183 " struct perf_event_header header;\n"
4191 #: build/C/man2/perf_event_open.2:1350
4193 msgid "B<PERF_RECORD_THROTTLE>, B<PERF_RECORD_UNTHROTTLE>"
4197 #: build/C/man2/perf_event_open.2:1353
4198 msgid "This record indicates a throttle/unthrottle event."
4202 #: build/C/man2/perf_event_open.2:1362
4206 " struct perf_event_header header;\n"
4214 #: build/C/man2/perf_event_open.2:1364
4216 msgid "B<PERF_RECORD_FORK>"
4220 #: build/C/man2/perf_event_open.2:1367
4221 msgid "This record indicates a fork event."
4225 #: build/C/man2/perf_event_open.2:1378
4227 msgid "B<PERF_RECORD_READ>"
4231 #: build/C/man2/perf_event_open.2:1381
4232 msgid "This record indicates a read event."
4236 #: build/C/man2/perf_event_open.2:1389
4240 " struct perf_event_header header;\n"
4242 " struct read_format values;\n"
4247 #: build/C/man2/perf_event_open.2:1391
4249 msgid "B<PERF_RECORD_SAMPLE>"
4253 #: build/C/man2/perf_event_open.2:1394
4254 msgid "This record indicates a sample."
4258 #: build/C/man2/perf_event_open.2:1422
4262 " struct perf_event_header header;\n"
4263 " u64 ip; /* if PERF_SAMPLE_IP */\n"
4264 " u32 pid, tid; /* if PERF_SAMPLE_TID */\n"
4265 " u64 time; /* if PERF_SAMPLE_TIME */\n"
4266 " u64 addr; /* if PERF_SAMPLE_ADDR */\n"
4267 " u64 id; /* if PERF_SAMPLE_ID */\n"
4268 " u64 stream_id; /* if PERF_SAMPLE_STREAM_ID */\n"
4269 " u32 cpu, res; /* if PERF_SAMPLE_CPU */\n"
4270 " u64 period; /* if PERF_SAMPLE_PERIOD */\n"
4271 " struct read_format v; /* if PERF_SAMPLE_READ */\n"
4272 " u64 nr; /* if PERF_SAMPLE_CALLCHAIN */\n"
4273 " u64 ips[nr]; /* if PERF_SAMPLE_CALLCHAIN */\n"
4274 " u32 size; /* if PERF_SAMPLE_RAW */\n"
4275 " char data[size]; /* if PERF_SAMPLE_RAW */\n"
4276 " u64 bnr; /* if PERF_SAMPLE_BRANCH_STACK */\n"
4277 " struct perf_branch_entry lbr[bnr];\n"
4278 " /* if PERF_SAMPLE_BRANCH_STACK */\n"
4279 " u64 abi; /* if PERF_SAMPLE_REGS_USER */\n"
4280 " u64 regs[weight(mask)];\n"
4281 " /* if PERF_SAMPLE_REGS_USER */\n"
4282 " u64 size; /* if PERF_SAMPLE_STACK_USER */\n"
4283 " char data[size]; /* if PERF_SAMPLE_STACK_USER */\n"
4284 " u64 dyn_size; /* if PERF_SAMPLE_STACK_USER */\n"
4289 #: build/C/man2/perf_event_open.2:1424
4295 #: build/C/man2/perf_event_open.2:1430
4297 "If B<PERF_SAMPLE_IP> is enabled, then a 64-bit instruction pointer value is "
4302 #: build/C/man2/perf_event_open.2:1430
4304 msgid "I<pid>, I<tid>"
4308 #: build/C/man2/perf_event_open.2:1436
4310 "If B<PERF_SAMPLE_TID> is enabled, then a 32-bit process ID and 32-bit thread "
4315 #: build/C/man2/perf_event_open.2:1436
4321 #: build/C/man2/perf_event_open.2:1444
4323 "If B<PERF_SAMPLE_TIME> is enabled, then a 64-bit timestamp is included. "
4324 "This is obtained via local_clock() which is a hardware timestamp if "
4325 "available and the jiffies value if not."
4329 #: build/C/man2/perf_event_open.2:1444
4335 #: build/C/man2/perf_event_open.2:1451
4337 "If B<PERF_SAMPLE_ADDR> is enabled, then a 64-bit address is included. This "
4338 "is usually the address of a tracepoint, breakpoint, or software event; "
4339 "otherwise the value is 0."
4343 #: build/C/man2/perf_event_open.2:1459
4345 "If B<PERF_SAMPLE_ID> is enabled, a 64-bit unique ID is included. If the "
4346 "event is a member of an event group, the group leader ID is returned. This "
4347 "ID is the same as the one returned by B<PERF_FORMAT_ID>."
4351 #: build/C/man2/perf_event_open.2:1459
4353 msgid "I<stream_id>"
4357 #: build/C/man2/perf_event_open.2:1469
4359 "If B<PERF_SAMPLE_STREAM_ID> is enabled, a 64-bit unique ID is included. "
4360 "Unlike B<PERF_SAMPLE_ID> the actual ID is returned, not the group leader. "
4361 "This ID is the same as the one returned by B<PERF_FORMAT_ID>."
4365 #: build/C/man2/perf_event_open.2:1469
4367 msgid "I<cpu>, I<res>"
4371 #: build/C/man2/perf_event_open.2:1476
4373 "If B<PERF_SAMPLE_CPU> is enabled, this is a 32-bit value indicating which "
4374 "CPU was being used, in addition to a reserved (unused) 32-bit value."
4378 #: build/C/man2/perf_event_open.2:1476
4384 #: build/C/man2/perf_event_open.2:1482
4386 "If B<PERF_SAMPLE_PERIOD> is enabled, a 64-bit value indicating the current "
4387 "sampling period is written."
4391 #: build/C/man2/perf_event_open.2:1482
4397 #: build/C/man2/perf_event_open.2:1493
4399 "If B<PERF_SAMPLE_READ> is enabled, a structure of type read_format is "
4400 "included which has values for all events in the event group. The values "
4401 "included depend on the I<read_format> value used at B<perf_event_open>() "
4406 #: build/C/man2/perf_event_open.2:1493
4408 msgid "I<nr>, I<ips[nr]>"
4412 #: build/C/man2/perf_event_open.2:1501
4414 "If B<PERF_SAMPLE_CALLCHAIN> is enabled, then a 64-bit number is included "
4415 "which indicates how many following 64-bit instruction pointers will follow. "
4416 "This is the current callchain."
4420 #: build/C/man2/perf_event_open.2:1501
4422 msgid "I<size>, I<data[size]>"
4426 #: build/C/man2/perf_event_open.2:1508
4428 "If B<PERF_SAMPLE_RAW> is enabled, then a 32-bit value indicating size is "
4429 "included followed by an array of 8-bit values of length size. The values "
4430 "are padded with 0 to have 64-bit alignment."
4434 #: build/C/man2/perf_event_open.2:1513
4436 "This RAW record data is opaque with respect to the ABI. The ABI doesn't "
4437 "make any promises with respect to the stability of its content, it may vary "
4438 "depending on event, hardware, and kernel version."
4442 #: build/C/man2/perf_event_open.2:1513
4444 msgid "I<bnr>, I<lbr[bnr]>"
4448 #: build/C/man2/perf_event_open.2:1524
4450 "If B<PERF_SAMPLE_BRANCH_STACK> is enabled, then a 64-bit value indicating "
4451 "the number of records is included, followed by I<bnr> I<perf_branch_entry> "
4452 "structures. These structures have from, to, and flags values indicating the "
4453 "from and to addresses from the branches on the callstack."
4457 #: build/C/man2/perf_event_open.2:1524
4459 msgid "I<abi>, I<regs[weight(mask)]>"
4463 #: build/C/man2/perf_event_open.2:1530
4464 msgid "If B<PERF_SAMPLE_REGS_USER> is enabled, then [to be documented]."
4468 #: build/C/man2/perf_event_open.2:1536
4470 "The I<abi> field is one of B<PERF_SAMPLE_REGS_ABI_NONE>, "
4471 "B<PERF_SAMPLE_REGS_ABI_32> or B<PERF_SAMPLE_REGS_ABI_64>."
4475 #: build/C/man2/perf_event_open.2:1536
4477 msgid "I<size>, I<data[size]>, I<dyn_size>"
4481 #: build/C/man2/perf_event_open.2:1542
4482 msgid "If B<PERF_SAMPLE_STACK_USER> is enabled, then [to be documented]."
4486 #: build/C/man2/perf_event_open.2:1544
4492 #: build/C/man2/perf_event_open.2:1549
4493 msgid "The I<misc> field contains additional information about the sample."
4497 #: build/C/man2/perf_event_open.2:1554
4499 "The CPU mode can be determined from this value by masking with "
4500 "B<PERF_RECORD_MISC_CPUMODE_MASK> and looking for one of the following (note "
4501 "these are not bit masks, only one can be set at a time):"
4505 #: build/C/man2/perf_event_open.2:1555
4507 msgid "B<PERF_RECORD_MISC_CPUMODE_UNKNOWN>"
4511 #: build/C/man2/perf_event_open.2:1558
4512 msgid "Unknown CPU mode."
4516 #: build/C/man2/perf_event_open.2:1558
4518 msgid "B<PERF_RECORD_MISC_KERNEL>"
4522 #: build/C/man2/perf_event_open.2:1561
4523 msgid "Sample happened in the kernel."
4527 #: build/C/man2/perf_event_open.2:1561
4529 msgid "B<PERF_RECORD_MISC_USER>"
4533 #: build/C/man2/perf_event_open.2:1564
4534 msgid "Sample happened in user code."
4538 #: build/C/man2/perf_event_open.2:1564
4540 msgid "B<PERF_RECORD_MISC_HYPERVISOR>"
4544 #: build/C/man2/perf_event_open.2:1567
4545 msgid "Sample happened in the hypervisor."
4549 #: build/C/man2/perf_event_open.2:1567
4551 msgid "B<PERF_RECORD_MISC_GUEST_KERNEL>"
4555 #: build/C/man2/perf_event_open.2:1570
4556 msgid "Sample happened in the guest kernel."
4560 #: build/C/man2/perf_event_open.2:1570
4562 msgid "B<PERF_RECORD_MISC_GUEST_USER>"
4566 #: build/C/man2/perf_event_open.2:1573
4567 msgid "Sample happened in guest user code."
4571 #: build/C/man2/perf_event_open.2:1576
4572 msgid "In addition, one of the following bits can be set:"
4576 #: build/C/man2/perf_event_open.2:1577
4578 msgid "B<PERF_RECORD_MISC_EXACT_IP>"
4582 #: build/C/man2/perf_event_open.2:1585
4584 "This indicates that the content of B<PERF_SAMPLE_IP> points to the actual "
4585 "instruction that triggered the event. See also "
4586 "I<perf_event_attr.precise_ip>."
4590 #: build/C/man2/perf_event_open.2:1585
4592 msgid "B<PERF_RECORD_MISC_EXT_RESERVED>"
4596 #: build/C/man2/perf_event_open.2:1588
4597 msgid "This indicates there is extended data available (currently not used)."
4601 #: build/C/man2/perf_event_open.2:1591
4602 msgid "This indicates the size of the record."
4606 #: build/C/man2/perf_event_open.2:1592
4608 msgid "Signal overflow"
4612 #: build/C/man2/perf_event_open.2:1601
4614 "Events can be set to deliver a signal when a threshold is crossed. The "
4615 "signal handler is set up using the B<poll>(2), B<select>(2), B<epoll>(2) "
4616 "and B<fcntl>(2), system calls."
4620 #: build/C/man2/perf_event_open.2:1605
4622 "To generate signals, sampling must be enabled (I<sample_period> must have a "
4627 #: build/C/man2/perf_event_open.2:1607
4628 msgid "There are two ways to generate signals."
4632 #: build/C/man2/perf_event_open.2:1617
4634 "The first is to set a I<wakeup_events> or I<wakeup_watermark> value that "
4635 "will generate a signal if a certain number of samples or bytes have been "
4636 "written to the mmap ring buffer. In this case a signal of type B<POLL_IN> "
4641 #: build/C/man2/perf_event_open.2:1629
4643 "The other way is by use of the B<PERF_EVENT_IOC_REFRESH> ioctl. This ioctl "
4644 "adds to a counter that decrements each time the event overflows. When "
4645 "non-zero, a B<POLL_IN> signal is sent on overflow, but once the value "
4646 "reaches 0, a signal is sent of type B<POLL_HUP> and the underlying event is "
4650 #. FIXME(Vince) : Find out when this was introduced
4652 #: build/C/man2/perf_event_open.2:1635
4654 "Note: on newer kernels (definitely noticed with 3.2) a signal is provided "
4655 "for every overflow, even if I<wakeup_events> is not set."
4659 #: build/C/man2/perf_event_open.2:1635
4661 msgid "rdpmc instruction"
4665 #: build/C/man2/perf_event_open.2:1642
4667 "Starting with Linux 3.4 on x86, you can use the I<rdpmc> instruction to get "
4668 "low-latency reads without having to enter the kernel. Note that using "
4669 "I<rdpmc> is not necessarily faster than other methods for reading event "
4674 #: build/C/man2/perf_event_open.2:1647
4676 "Support for this can be detected with the I<cap_usr_rdpmc> field in the mmap "
4677 "page; documentation on how to calculate event values can be found in that "
4682 #: build/C/man2/perf_event_open.2:1647
4684 msgid "perf_event ioctl calls"
4688 #: build/C/man2/perf_event_open.2:1652
4689 msgid "Various ioctls act on B<perf_event_open>() file descriptors"
4693 #: build/C/man2/perf_event_open.2:1652
4695 msgid "B<PERF_EVENT_IOC_ENABLE>"
4699 #: build/C/man2/perf_event_open.2:1656
4701 "Enables the individual event or event group specified by the file descriptor "
4706 #: build/C/man2/perf_event_open.2:1658 build/C/man2/perf_event_open.2:1671 build/C/man2/perf_event_open.2:1699
4707 msgid "The ioctl argument is ignored."
4711 #: build/C/man2/perf_event_open.2:1658
4713 msgid "B<PERF_EVENT_IOC_DISABLE>"
4717 #: build/C/man2/perf_event_open.2:1662
4719 "Disables the individual counter or event group specified by the file "
4720 "descriptor argument."
4724 #: build/C/man2/perf_event_open.2:1669
4726 "Enabling or disabling the leader of a group enables or disables the entire "
4727 "group; that is, while the group leader is disabled, none of the counters in "
4728 "the group will count. Enabling or disabling a member of a group other than "
4729 "the leader only affects that counter; disabling a non-leader stops that "
4730 "counter from counting but doesn't affect any other counter."
4734 #: build/C/man2/perf_event_open.2:1671
4736 msgid "B<PERF_EVENT_IOC_REFRESH>"
4740 #: build/C/man2/perf_event_open.2:1685
4742 "Non-inherited overflow counters can use this to enable a counter for a "
4743 "number of overflows specified by the argument, after which it is disabled. "
4744 "Subsequent calls of this ioctl add the argument value to the current count. "
4745 "A signal with B<POLL_IN> set will happen on each overflow until the count "
4746 "reaches 0; when that happens a signal with POLL_HUP set is sent and the "
4747 "event is disabled. Using an argument of 0 is considered undefined behavior."
4751 #: build/C/man2/perf_event_open.2:1685
4753 msgid "B<PERF_EVENT_IOC_RESET>"
4757 #: build/C/man2/perf_event_open.2:1697
4759 "Reset the event count specified by the file descriptor argumentto zero. "
4760 "This only resets the counts; there is no way to reset the multiplexing "
4761 "I<time_enabled> or I<time_running> values. When sent to a group leader, "
4762 "only the leader is reset (child events are not)."
4766 #: build/C/man2/perf_event_open.2:1699
4768 msgid "B<PERF_EVENT_IOC_PERIOD>"
4772 #: build/C/man2/perf_event_open.2:1703
4774 "IOC_PERIOD is the command to update the period; it does not update the "
4775 "current period but instead defers until next."
4779 #: build/C/man2/perf_event_open.2:1706
4781 "The argument is a pointer to a 64-bit value containing the desired new "
4786 #: build/C/man2/perf_event_open.2:1706
4788 msgid "B<PERF_EVENT_IOC_SET_OUTPUT>"
4792 #: build/C/man2/perf_event_open.2:1711
4794 "This tells the kernel to report event notifications to the specified file "
4795 "descriptor rather than the default one. The file descriptors must all be on "
4800 #: build/C/man2/perf_event_open.2:1714
4802 "The argument specifies the desired file descriptor, or -1 if output should "
4807 #: build/C/man2/perf_event_open.2:1714
4809 msgid "B<PERF_EVENT_IOC_SET_FILTER> (Since Linux 2.6.33)"
4813 #: build/C/man2/perf_event_open.2:1717
4814 msgid "This adds an ftrace filter to this event."
4818 #: build/C/man2/perf_event_open.2:1719
4819 msgid "The argument is a pointer to the desired ftrace filter."
4823 #: build/C/man2/perf_event_open.2:1719
4829 #: build/C/man2/perf_event_open.2:1732
4831 "A process can enable or disable all the event groups that are attached to it "
4832 "using the B<prctl>(2) B<PR_TASK_PERF_EVENTS_ENABLE> and "
4833 "B<PR_TASK_PERF_EVENTS_DISABLE> operations. This applies to all counters on "
4834 "the current process, whether created by this process or by another, and does "
4835 "not affect any counters that this process has created on other processes. "
4836 "It only enables or disables the group leaders, not any other members in the "
4841 #: build/C/man2/perf_event_open.2:1732
4843 msgid "perf_event related configuration files"
4847 #: build/C/man2/perf_event_open.2:1735
4848 msgid "Files in I</proc/sys/kernel/>"
4852 #: build/C/man2/perf_event_open.2:1736
4854 msgid "I</proc/sys/kernel/perf_event_paranoid>"
4858 #: build/C/man2/perf_event_open.2:1742
4860 "The I<perf_event_paranoid> file can be set to restrict access to the "
4861 "performance counters."
4865 #: build/C/man2/perf_event_open.2:1744
4866 msgid "2 - only allow user-space measurements"
4870 #: build/C/man2/perf_event_open.2:1746
4871 msgid "1 - (default) allow both kernel and user measurements"
4875 #: build/C/man2/perf_event_open.2:1748
4876 msgid "0 - allow access to CPU-specific data but not raw tracepoint samples"
4880 #: build/C/man2/perf_event_open.2:1750
4881 msgid "-1 - no restrictions"
4885 #: build/C/man2/perf_event_open.2:1755
4887 "The existence of the I<perf_event_paranoid> file is the official method for "
4888 "determining if a kernel supports B<perf_event_open>()."
4892 #: build/C/man2/perf_event_open.2:1755
4894 msgid "I</proc/sys/kernel/perf_event_max_sample_rate>"
4898 #: build/C/man2/perf_event_open.2:1764
4900 "This sets the maximum sample rate. Setting this too high can allow users to "
4901 "sample at a rate that impacts overall machine performance and potentially "
4902 "lock up the machine. The default value is 100000 (samples per second)."
4906 #: build/C/man2/perf_event_open.2:1764
4908 msgid "I</proc/sys/kernel/perf_event_mlock_kb>"
4912 #: build/C/man2/perf_event_open.2:1769
4914 "Maximum number of pages an unprivileged user can mlock (2) . The default is "
4919 #: build/C/man2/perf_event_open.2:1772
4920 msgid "Files in I</sys/bus/event_source/devices/>"
4924 #: build/C/man2/perf_event_open.2:1778
4926 "Since Linux 2.6.34 the kernel supports having multiple PMUs available for "
4927 "monitoring. Information on how to program these PMUs can be found under "
4928 "I</sys/bus/event_source/devices/>. Each subdirectory corresponds to a "
4933 #: build/C/man2/perf_event_open.2:1778
4935 msgid "I</sys/bus/event_source/devices/*/type>"
4939 #: build/C/man2/perf_event_open.2:1783
4941 "This contains an integer that can be used in the I<type> field of "
4942 "perf_event_attr to indicate you wish to use this PMU."
4946 #: build/C/man2/perf_event_open.2:1783
4948 msgid "I</sys/bus/event_source/devices/*/rdpmc>"
4952 #: build/C/man2/perf_event_open.2:1786
4954 msgid "I</sys/bus/event_source/devices/*/format/>"
4958 #: build/C/man2/perf_event_open.2:1791
4960 "This sub-directory contains information on what bits in the I<config> field "
4961 "of perf_event_attr correspond to."
4965 #: build/C/man2/perf_event_open.2:1791
4967 msgid "I</sys/bus/event_source/devices/*/events/>"
4971 #: build/C/man2/perf_event_open.2:1800
4973 "This sub-directory contains files with pre-defined events. The contents are "
4974 "strings describing the event settings expressed in terms of the fields found "
4975 "in the I<./format/> directory. These are not necessarily complete lists of "
4976 "all events supported by a PMU, but usually a subset of events deemed useful "
4981 #: build/C/man2/perf_event_open.2:1800
4983 msgid "I</sys/bus/event_source/devices/*/uevent>"
4987 #: build/C/man2/perf_event_open.2:1810
4989 "B<perf_event_open>() returns the new file descriptor, or -1 if an error "
4990 "occurred (in which case, I<errno> is set appropriately)."
4994 #: build/C/man2/perf_event_open.2:1814
4995 msgid "Returned if the specified event is not available."
4999 #: build/C/man2/perf_event_open.2:1814
5005 #: build/C/man2/perf_event_open.2:1824
5007 "Prior to Linux 3.3, if there was not enough room for the event, B<ENOSPC> "
5008 "was returned. Linus did not like this, and this was changed to B<EINVAL>. "
5009 "B<ENOSPC> is still returned if you try to read results into too small of a "
5014 #: build/C/man2/perf_event_open.2:1824
5020 #: build/C/man2/perf_event_open.2:1829
5022 "B<perf_event_open>() was introduced in Linux 2.6.31 but was called "
5023 "B<perf_counter_open>()B<.> It was renamed in Linux 2.6.32."
5027 #: build/C/man2/perf_event_open.2:1834
5029 "This B<perf_event_open>() system call Linux- specific and should not be "
5030 "used in programs intended to be portable."
5034 #: build/C/man2/perf_event_open.2:1838
5036 "Glibc does not provide a wrapper for this system call; call it using "
5037 "B<syscall>(2). See the example below."
5041 #: build/C/man2/perf_event_open.2:1844
5043 "The official way of knowing if B<perf_event_open>() support is enabled is "
5044 "checking for the existence of the file "
5045 "I</proc/sys/kernel/perf_event_paranoid>."
5049 #: build/C/man2/perf_event_open.2:1844 build/C/man2/pivot_root.2:134 build/C/man2/ptrace.2:1810
5055 #: build/C/man2/perf_event_open.2:1851
5057 "The B<F_SETOWN_EX> option to B<fcntl>(2) is needed to properly get overflow "
5058 "signals in threads. This was introduced in Linux 2.6.32."
5062 #: build/C/man2/perf_event_open.2:1859
5064 "Prior to Linux 2.6.33 (at least for x86) the kernel did not check if events "
5065 "could be scheduled together until read time. The same happens on all known "
5066 "kernels if the NMI watchdog is enabled. This means to see if a given set of "
5067 "events works you have to B<perf_event_open>(), start, then read before you "
5068 "know for sure you can get valid measurements."
5072 #: build/C/man2/perf_event_open.2:1863
5074 "Prior to Linux 2.6.34 event constraints were not enforced by the kernel. In "
5075 "that case, some events would silently return \"0\" if the kernel scheduled "
5076 "them in an improper counter slot."
5080 #: build/C/man2/perf_event_open.2:1866
5082 "Prior to Linux 2.6.34 there was a bug when multiplexing where the wrong "
5083 "results could be returned."
5087 #: build/C/man2/perf_event_open.2:1869
5089 "Kernels from Linux 2.6.35 to Linux 2.6.39 can quickly crash the kernel if "
5090 "\"inherit\" is enabled and many threads are started."
5094 #: build/C/man2/perf_event_open.2:1873
5096 "Prior to Linux 2.6.35, B<PERF_FORMAT_GROUP> did not work with attached "
5101 #: build/C/man2/perf_event_open.2:1878
5103 "In older Linux 2.6 versions, refreshing an event group leader refreshed all "
5104 "siblings, and refreshing with a parameter of 0 enabled infinite refresh. "
5105 "This behavior is unsupported and should not be relied on."
5109 #: build/C/man2/perf_event_open.2:1884
5111 "There is a bug in the kernel code between Linux 2.6.36 and Linux 3.0 that "
5112 "ignores the \"watermark\" field and acts as if a wakeup_event was chosen if "
5113 "the union has a non-zero value in it."
5117 #: build/C/man2/perf_event_open.2:1889
5119 "Always double-check your results! Various generalized events have had wrong "
5120 "values. For example, retired branches measured the wrong thing on AMD "
5121 "machines until Linux 2.6.35."
5125 #: build/C/man2/perf_event_open.2:1889 build/C/man2/process_vm_readv.2:295 build/C/man2/splice.2:223 build/C/man2/tee.2:130
5131 #: build/C/man2/perf_event_open.2:1893
5133 "The following is a short example that measures the total instruction count "
5134 "of a call to B<printf>(3)."
5138 #: build/C/man2/perf_event_open.2:1902
5141 "#include E<lt>stdlib.hE<gt>\n"
5142 "#include E<lt>stdio.hE<gt>\n"
5143 "#include E<lt>unistd.hE<gt>\n"
5144 "#include E<lt>string.hE<gt>\n"
5145 "#include E<lt>sys/ioctl.hE<gt>\n"
5146 "#include E<lt>linux/perf_event.hE<gt>\n"
5147 "#include E<lt>asm/unistd.hE<gt>\n"
5151 #: build/C/man2/perf_event_open.2:1908
5155 "perf_event_open(struct perf_event_attr *hw_event, pid_t pid,\n"
5156 " int cpu, int group_fd, unsigned long flags)\n"
5162 #: build/C/man2/perf_event_open.2:1913
5165 " ret = syscall(__NR_perf_event_open, hw_event, pid, cpu,\n"
5166 " group_fd, flags);\n"
5172 #: build/C/man2/perf_event_open.2:1920
5176 "main(int argc, char **argv)\n"
5178 " struct perf_event_attr pe;\n"
5179 " long long count;\n"
5184 #: build/C/man2/perf_event_open.2:1928
5187 " memset(&pe, 0, sizeof(struct perf_event_attr));\n"
5188 " pe.type = PERF_TYPE_HARDWARE;\n"
5189 " pe.size = sizeof(struct perf_event_attr);\n"
5190 " pe.config = PERF_COUNT_HW_INSTRUCTIONS;\n"
5191 " pe.disabled = 1;\n"
5192 " pe.exclude_kernel = 1;\n"
5193 " pe.exclude_hv = 1;\n"
5197 #: build/C/man2/perf_event_open.2:1934
5200 " fd = perf_event_open(&pe, 0, -1, -1, 0);\n"
5201 " if (fd == -1) {\n"
5202 " fprintf(stderr, \"Error opening leader %llx\\en\", pe.config);\n"
5203 " exit(EXIT_FAILURE);\n"
5208 #: build/C/man2/perf_event_open.2:1937
5211 " ioctl(fd, PERF_EVENT_IOC_RESET, 0);\n"
5212 " ioctl(fd, PERF_EVENT_IOC_ENABLE, 0);\n"
5216 #: build/C/man2/perf_event_open.2:1939
5218 msgid " printf(\"Measuring instruction count for this printf\\en\");\n"
5222 #: build/C/man2/perf_event_open.2:1942
5225 " ioctl(fd, PERF_EVENT_IOC_DISABLE, 0);\n"
5226 " read(fd, &count, sizeof(long long));\n"
5230 #: build/C/man2/perf_event_open.2:1944
5232 msgid " printf(\"Used %lld instructions\\en\", count);\n"
5236 #: build/C/man2/perf_event_open.2:1947
5244 #: build/C/man2/perf_event_open.2:1954
5245 msgid "B<fcntl>(2), B<mmap>(2), B<open>(2), B<prctl>(2), B<read>(2)"
5249 #: build/C/man2/perfmonctl.2:27
5255 #: build/C/man2/perfmonctl.2:30
5256 msgid "perfmonctl - interface to IA-64 performance monitoring unit"
5260 #: build/C/man2/perfmonctl.2:34
5263 "B<#include E<lt>syscall.hE<gt>>\n"
5264 "B<#include E<lt>perfmon.hE<gt>>\n"
5268 #: build/C/man2/perfmonctl.2:36
5271 "B<long perfmonctl(int >I<fd>B<, int >I<cmd>B<, void *>I<arg>B<, int "
5276 #: build/C/man2/perfmonctl.2:47
5278 "The IA-64-specific B<perfmonctl>() system call provides an interface to the "
5279 "PMU (performance monitoring unit). The PMU consists of PMD (performance "
5280 "monitoring data) registers and PMC (performance monitoring control) "
5281 "registers, which gather hardware statistics."
5285 #: build/C/man2/perfmonctl.2:57
5287 "B<perfmonctl>() applies the operation I<cmd> to the input arguments "
5288 "specified by I<arg>. The number of arguments is defined by I<narg>. The "
5289 "I<fd> argument specifies the perfmon context to operate on."
5293 #: build/C/man2/perfmonctl.2:61
5294 msgid "Supported values for I<cmd> are:"
5298 #: build/C/man2/perfmonctl.2:61
5300 msgid "B<PFM_CREATE_CONTEXT>"
5304 #: build/C/man2/perfmonctl.2:65
5307 "B<perfmonctl(int >I<fd>B<, PFM_CREATE_CONTEXT, pfarg_context_t *>I<ctxt>B<, "
5312 #: build/C/man2/perfmonctl.2:67
5313 msgid "Set up a context."
5317 #: build/C/man2/perfmonctl.2:74
5319 "The I<fd> parameter is ignored. A new perfmon context is created as "
5320 "specified in I<ctxt> and its file descriptor is returned in "
5321 "I<ctxt-E<gt>ctx_fd>."
5325 #: build/C/man2/perfmonctl.2:86
5327 "The file descriptor can be used in subsequent calls to B<perfmonctl>() and "
5328 "can be used to read event notifications (type I<pfm_msg_t>) using "
5329 "B<read>(2). The file descriptor is pollable using B<select>(2), B<poll>(2), "
5334 #: build/C/man2/perfmonctl.2:90
5335 msgid "The context can be destroyed by calling B<close>(2) on the file descriptor."
5339 #: build/C/man2/perfmonctl.2:90
5341 msgid "B<PFM_WRITE_PMCS>"
5345 #: build/C/man2/perfmonctl.2:95
5347 msgid "B<perfmonctl(int >I<fd>B<, PFM_WRITE_PMCS, pfarg_reg_t *>I<pmcs>B<, n);>\n"
5351 #: build/C/man2/perfmonctl.2:97
5352 msgid "Set PMC registers."
5356 #: build/C/man2/perfmonctl.2:97
5358 msgid "B<PFM_WRITE_PMDS>"
5362 #: build/C/man2/perfmonctl.2:101
5364 msgid "B<perfmonctl(int >I<fd>B<, PFM_WRITE_PMDS, pfarg_reg_t *>I<pmds>B<, n);>\n"
5369 #: build/C/man2/perfmonctl.2:104
5370 msgid "Set PMD registers."
5374 #: build/C/man2/perfmonctl.2:104
5376 msgid "B<PFM_READ_PMDS>"
5380 #: build/C/man2/perfmonctl.2:109
5382 msgid "B<perfmonctl(int >I<fd>B<, PFM_READ_PMDS, pfarg_reg_t *>I<pmds>B<, n);>\n"
5386 #: build/C/man2/perfmonctl.2:111
5387 msgid "Read PMD registers."
5391 #: build/C/man2/perfmonctl.2:111
5393 msgid "B<PFM_START>"
5396 #. .BI "perfmonctl(int " fd ", PFM_START, arg, 1);
5398 #: build/C/man2/perfmonctl.2:117
5400 msgid "B<perfmonctl(int >I<fd>B<, PFM_START, NULL, 0);>\n"
5404 #: build/C/man2/perfmonctl.2:119
5405 msgid "Start monitoring."
5409 #: build/C/man2/perfmonctl.2:119
5415 #: build/C/man2/perfmonctl.2:124
5417 msgid "B<perfmonctl(int >I<fd>B<, PFM_STOP, NULL, 0);>\n"
5421 #: build/C/man2/perfmonctl.2:126
5422 msgid "Stop monitoring."
5426 #: build/C/man2/perfmonctl.2:126
5428 msgid "B<PFM_LOAD_CONTEXT>"
5432 #: build/C/man2/perfmonctl.2:131
5435 "B<perfmonctl(int >I<fd>B<, PFM_LOAD_CONTEXT, pfarg_load_t *>I<largs>B<, "
5440 #: build/C/man2/perfmonctl.2:133
5441 msgid "Attach the context to a thread."
5445 #: build/C/man2/perfmonctl.2:133
5447 msgid "B<PFM_UNLOAD_CONTEXT>"
5451 #: build/C/man2/perfmonctl.2:138
5453 msgid "B<perfmonctl(int >I<fd>B<, PFM_UNLOAD_CONTEXT, NULL, 0);>\n"
5457 #: build/C/man2/perfmonctl.2:140
5458 msgid "Detach the context from a thread."
5462 #: build/C/man2/perfmonctl.2:140
5464 msgid "B<PFM_RESTART>"
5468 #: build/C/man2/perfmonctl.2:145
5470 msgid "B<perfmonctl(int >I<fd>B<, PFM_RESTART, NULL, 0);>\n"
5474 #: build/C/man2/perfmonctl.2:147
5475 msgid "Restart monitoring after receiving an overflow notification."
5479 #: build/C/man2/perfmonctl.2:147
5481 msgid "B<PFM_GET_FEATURES>"
5485 #: build/C/man2/perfmonctl.2:152
5488 "B<perfmonctl(int >I<fd>B<, PFM_GET_FEARURES, pfarg_features_t *>I<arg>B<, "
5493 #: build/C/man2/perfmonctl.2:153
5495 msgid "B<PFM_DEBUG>"
5499 #: build/C/man2/perfmonctl.2:158
5501 msgid "B<perfmonctl(int >I<fd>B<, PFM_DEBUG, >I<val>B<, 0);>\n"
5505 #: build/C/man2/perfmonctl.2:162
5506 msgid "If I<val> is nonzero, enable debugging mode, otherwise disable."
5510 #: build/C/man2/perfmonctl.2:162
5512 msgid "B<PFM_GET_PMC_RESET_VAL>"
5516 #: build/C/man2/perfmonctl.2:167
5519 "B<perfmonctl(int >I<fd>B<, PFM_GET_PMC_RESET_VAL, pfarg_reg_t * >I<req>B<, "
5526 #. .B PFM_CREATE_EVTSETS
5528 #. create or modify event sets
5530 #. .BI "perfmonctl(int " fd ", PFM_CREATE_EVTSETS, pfarg_setdesc_t *desc , n);
5533 #. .B PFM_DELETE_EVTSETS
5534 #. delete event sets
5536 #. .BI "perfmonctl(int " fd ", PFM_DELETE_EVTSET, pfarg_setdesc_t *desc , n);
5539 #. .B PFM_GETINFO_EVTSETS
5540 #. get information about event sets
5542 #. .BI "perfmonctl(int " fd ", PFM_GETINFO_EVTSETS, pfarg_setinfo_t *info, n);
5545 #: build/C/man2/perfmonctl.2:190
5546 msgid "Reset PMC registers to default values."
5550 #: build/C/man2/perfmonctl.2:196
5552 "B<performctl>() returns zero when the operation is successful. On error, "
5553 "-1 is returned and I<errno> is set to indicate the cause of the error."
5557 #: build/C/man2/perfmonctl.2:199
5558 msgid "B<perfmonctl>() is available since Linux 2.4."
5562 #: build/C/man2/perfmonctl.2:202
5564 "B<perfmonctl>() is Linux specific and is available only on the IA-64 "
5569 #: build/C/man2/perfmonctl.2:207
5574 #: build/C/man2/perfmonctl.2:209
5575 msgid "The perfmon2 interface specification"
5579 #: build/C/man2/personality.2:32
5585 #: build/C/man2/personality.2:32
5591 #: build/C/man2/personality.2:35
5592 msgid "personality - set the process execution domain"
5596 #: build/C/man2/personality.2:37
5597 msgid "B<#include E<lt>sys/personality.hE<gt>>"
5601 #: build/C/man2/personality.2:39
5602 msgid "B<int personality(unsigned long >I<persona>B<);>"
5606 #: build/C/man2/personality.2:47
5608 "Linux supports different execution domains, or personalities, for each "
5609 "process. Among other things, execution domains tell Linux how to map signal "
5610 "numbers into signal actions. The execution domain system allows Linux to "
5611 "provide limited support for binaries compiled under other UNIX-like "
5612 "operating systems."
5616 #: build/C/man2/personality.2:57
5618 "This function will return the current B<personality>() when I<persona> "
5619 "equals 0xffffffff. Otherwise, it will make the execution domain referenced "
5620 "by I<persona> the new execution domain of the calling process."
5624 #: build/C/man2/personality.2:64
5626 "On success, the previous I<persona> is returned. On error, -1 is returned, "
5627 "and I<errno> is set appropriately."
5631 #: build/C/man2/personality.2:68
5632 msgid "The kernel was unable to change the personality."
5636 #: build/C/man2/personality.2:72
5638 "B<personality>() is Linux-specific and should not be used in programs "
5639 "intended to be portable."
5643 #: build/C/man2/pivot_root.2:10
5649 #: build/C/man2/pivot_root.2:13
5650 msgid "pivot_root - change the root file system"
5654 #: build/C/man2/pivot_root.2:15
5655 msgid "B<int pivot_root(const char *>I<new_root>B<, const char *>I<put_old>B<);>"
5661 #. capability is required.
5663 #: build/C/man2/pivot_root.2:27
5665 "B<pivot_root>() moves the root file system of the calling process to the "
5666 "directory I<put_old> and makes I<new_root> the new root file system of the "
5671 #: build/C/man2/pivot_root.2:34
5673 "The typical use of B<pivot_root>() is during system startup, when the "
5674 "system mounts a temporary root file system (e.g., an B<initrd>), then mounts "
5675 "the real root file system, and eventually turns the latter into the current "
5676 "root of all relevant processes or threads."
5680 #: build/C/man2/pivot_root.2:46
5682 "B<pivot_root>() may or may not change the current root and the current "
5683 "working directory of any processes or threads which use the old root "
5684 "directory. The caller of B<pivot_root>() must ensure that processes with "
5685 "root or current working directory at the old root operate correctly in "
5686 "either case. An easy way to ensure this is to change their root and current "
5687 "working directory to I<new_root> before invoking B<pivot_root>()."
5691 #: build/C/man2/pivot_root.2:64
5693 "The paragraph above is intentionally vague because the implementation of "
5694 "B<pivot_root>() may change in the future. At the time of writing, "
5695 "B<pivot_root>() changes root and current working directory of each process "
5696 "or thread to I<new_root> if they point to the old root directory. This is "
5697 "necessary in order to prevent kernel threads from keeping the old root "
5698 "directory busy with their root and current working directory, even if they "
5699 "never access the file system in any way. In the future, there may be a "
5700 "mechanism for kernel threads to explicitly relinquish any access to the file "
5701 "system, such that this fairly intrusive mechanism can be removed from "
5706 #: build/C/man2/pivot_root.2:72
5708 "Note that this also applies to the calling process: B<pivot_root>() may or "
5709 "may not affect its current working directory. It is therefore recommended "
5710 "to call B<chdir(\"/\")> immediately after B<pivot_root>()."
5714 #: build/C/man2/pivot_root.2:74
5715 msgid "The following restrictions apply to I<new_root> and I<put_old>:"
5719 #: build/C/man2/pivot_root.2:74 build/C/man2/pivot_root.2:76 build/C/man2/pivot_root.2:79 build/C/man2/pivot_root.2:83
5725 #: build/C/man2/pivot_root.2:76
5726 msgid "They must be directories."
5730 #: build/C/man2/pivot_root.2:79
5732 "I<new_root> and I<put_old> must not be on the same file system as the "
5737 #: build/C/man2/pivot_root.2:83
5739 "I<put_old> must be underneath I<new_root>, that is, adding a nonzero number "
5740 "of I</..> to the string pointed to by I<put_old> must yield the same "
5741 "directory as I<new_root>."
5745 #: build/C/man2/pivot_root.2:85
5746 msgid "No other file system may be mounted on I<put_old>."
5750 #: build/C/man2/pivot_root.2:89
5751 msgid "See also B<pivot_root>(8) for additional usage examples."
5755 #: build/C/man2/pivot_root.2:96
5757 "If the current root is not a mount point (e.g., after B<chroot>(2) or "
5758 "B<pivot_root>(), see also below), not the old root directory, but the mount "
5759 "point of that file system is mounted on I<put_old>."
5763 #: build/C/man2/pivot_root.2:101
5765 "I<new_root> does not have to be a mount point. In this case, "
5766 "I</proc/mounts> will show the mount point of the file system containing "
5767 "I<new_root> as root (I</>)."
5771 #: build/C/man2/pivot_root.2:110
5773 "B<pivot_root>() may return (in I<errno>) any of the errors returned by "
5774 "B<stat>(2). Additionally, it may return:"
5778 #: build/C/man2/pivot_root.2:114
5780 "I<new_root> or I<put_old> are on the current root file system, or a file "
5781 "system is already mounted on I<put_old>."
5785 #: build/C/man2/pivot_root.2:117
5786 msgid "I<put_old> is not underneath I<new_root>."
5790 #: build/C/man2/pivot_root.2:117
5796 #: build/C/man2/pivot_root.2:120
5797 msgid "I<new_root> or I<put_old> is not a directory."
5801 #: build/C/man2/pivot_root.2:125
5802 msgid "The calling process does not have the B<CAP_SYS_ADMIN> capability."
5806 #: build/C/man2/pivot_root.2:128
5807 msgid "B<pivot_root>() was introduced in Linux 2.3.41."
5811 #: build/C/man2/pivot_root.2:131
5812 msgid "B<pivot_root>() is Linux-specific and hence is not portable."
5816 #: build/C/man2/pivot_root.2:138
5818 "B<pivot_root>() should not have to change root and current working "
5819 "directory of all other processes in the system."
5823 #: build/C/man2/pivot_root.2:143
5825 "Some of the more obscure uses of B<pivot_root>() may quickly lead to "
5830 #: build/C/man2/pivot_root.2:149
5831 msgid "B<chdir>(2), B<chroot>(2), B<stat>(2), B<initrd>(4), B<pivot_root>(8)"
5835 #: build/C/man2/process_vm_readv.2:29
5837 msgid "PROCESS_VM_READV"
5841 #: build/C/man2/process_vm_readv.2:29
5847 #: build/C/man2/process_vm_readv.2:32
5849 "process_vm_readv, process_vm_writev - transfer data between process address "
5854 #: build/C/man2/process_vm_readv.2:35
5856 msgid "B<#include E<lt>sys/uio.hE<gt>>\n"
5860 #: build/C/man2/process_vm_readv.2:42
5863 "B<ssize_t process_vm_readv(pid_t >I<pid>B<,>\n"
5864 "B< const struct iovec *>I<local_iov>B<,>\n"
5865 "B< unsigned long >I<liovcnt>B<,>\n"
5866 "B< const struct iovec *>I<remote_iov>B<,>\n"
5867 "B< unsigned long >I<riovcnt>B<,>\n"
5868 "B< unsigned long >I<flags>B<);>\n"
5872 #: build/C/man2/process_vm_readv.2:49
5875 "B<ssize_t process_vm_writev(pid_t >I<pid>B<,>\n"
5876 "B< const struct iovec *>I<local_iov>B<,>\n"
5877 "B< unsigned long >I<liovcnt>B<,>\n"
5878 "B< const struct iovec *>I<remote_iov>B<,>\n"
5879 "B< unsigned long >I<riovcnt>B<,>\n"
5880 "B< unsigned long >I<flags>B<);>\n"
5884 #: build/C/man2/process_vm_readv.2:57
5886 "These system calls transfer data between the address space of the calling "
5887 "process (\"the local process\") and the process identified by I<pid> (\"the "
5888 "remote process\"). The data moves directly between the address spaces of "
5889 "the two processes, without passing through kernel space."
5893 #: build/C/man2/process_vm_readv.2:82
5895 "The B<process_vm_readv>() system call transfers data from the remote "
5896 "process to the local process. The data to be transferred is identified by "
5897 "I<remote_iov> and I<riovcnt>: I<remote_iov> is a pointer to an array "
5898 "describing address ranges in the process I<pid>, and I<riovcnt> specifies "
5899 "the number of elements in I<remote_iov>. The data is transferred to the "
5900 "locations specified by I<local_iov> and I<liovcnt>: I<local_iov> is a "
5901 "pointer to an array describing address ranges in the calling process, and "
5902 "I<liovcnt> specifies the number of elements in I<local_iov>."
5906 #: build/C/man2/process_vm_readv.2:96
5908 "The B<process_vm_writev>() system call is the converse of "
5909 "B<process_vm_readv>()\\(emit transfers data from the local process to the "
5910 "remote process. Other than the direction of the transfer, the arguments "
5911 "I<liovcnt>, I<local_iov>, I<riovcnt>, and I<remote_iov> have the same "
5912 "meaning as for B<process_vm_readv>()."
5916 #: build/C/man2/process_vm_readv.2:106
5918 "The I<local_iov> and I<remote_iov> arguments point to an array of I<iovec> "
5919 "structures, defined in I<E<lt>sys/uio.hE<gt>> as:"
5923 #: build/C/man2/process_vm_readv.2:113
5927 " void *iov_base; /* Starting address */\n"
5928 " size_t iov_len; /* Number of bytes to transfer */\n"
5933 #: build/C/man2/process_vm_readv.2:129
5935 "Buffers are processed in array order. This means that B<process_vm_readv>() "
5936 "completely fills I<local_iov[0]> before proceeding to I<local_iov[1]>, and "
5937 "so on. Likewise, I<remote_iov[0]> is completely read before proceeding to "
5938 "I<remote_iov[1]>, and so on."
5942 #: build/C/man2/process_vm_readv.2:140
5944 "Similarly, B<process_vm_writev>() writes out the entire contents of "
5945 "I<local_iov[0]> before proceeding to I<local_iov[1]>, and it completely "
5946 "fills I<remote_iov[0]> before proceeding to I<remote_iov[1]>."
5950 #: build/C/man2/process_vm_readv.2:148
5952 "The lengths of I<remote_iov[i].iov_len> and I<local_iov[i].iov_len> do not "
5953 "have to be the same. Thus, it is possible to split a single local buffer "
5954 "into multiple remote buffers, or vice versa."
5958 #: build/C/man2/process_vm_readv.2:152
5959 msgid "The I<flags> argument is currently unused and must be set to 0."
5962 #. In time, glibc might provide a wrapper that works around this limit,
5963 #. as is done for readv()/writev()
5965 #: build/C/man2/process_vm_readv.2:165
5967 "The values specified in the I<liovcnt> and I<riovcnt> arguments must be less "
5968 "than or equal to B<IOV_MAX> (defined in I<E<lt>limits.hE<gt>> or accessible "
5969 "via the call I<sysconf(_SC_IOV_MAX)>)."
5973 #: build/C/man2/process_vm_readv.2:175
5975 "The count arguments and I<local_iov> are checked before doing any "
5976 "transfers. If the counts are too big, or I<local_iov> is invalid, or the "
5977 "addresses refer to regions that are inaccessible to the local process, none "
5978 "of the vectors will be processed and an error will be returned immediately."
5982 #: build/C/man2/process_vm_readv.2:195
5984 "Note, however, that these system calls do not check the memory regions in "
5985 "the remote process until just before doing the read/write. Consequently, a "
5986 "partial read/write (see RETURN VALUE) may result if one of the "
5987 "I<remote_iov> elements points to an invalid memory region in the remote "
5988 "process. No further reads/writes will be attempted beyond that point. Keep "
5989 "this in mind when attempting to read data of unknown length (such as C "
5990 "strings that are null-terminated) from a remote process, by avoiding "
5991 "spanning memory pages (typically 4KiB) in a single remote I<iovec> element. "
5992 "(Instead, split the remote read into two I<remote_iov> elements and have "
5993 "them merge back into a single write I<local_iov> entry. The first read "
5994 "entry goes up to the page boundary, while the second starts on the next page "
5999 #: build/C/man2/process_vm_readv.2:209
6001 "In order to read from or write to another process, either the caller must "
6002 "have the capability B<CAP_SYS_PTRACE>, or the real user ID, effective user "
6003 "ID, and saved set-user-ID of the remote process must match the real user ID "
6004 "of the caller I<and> the real group ID, effective group ID, and saved "
6005 "set-group-ID of the remote process must match the real group ID of the "
6006 "caller. (The permission required is exactly the same as that required to "
6007 "perform a B<ptrace>(2) B<PTRACE_ATTACH> on the remote process.)"
6011 #: build/C/man2/process_vm_readv.2:225
6013 "On success, B<process_vm_readv>() returns the number of bytes read and "
6014 "B<process_vm_writev>() returns the number of bytes written. This return "
6015 "value may be less than the total number of requested bytes, if a partial "
6016 "read/write occurred. (Partial transfers apply at the granularity of "
6017 "I<iovec> elements. These system calls won't perform a partial transfer that "
6018 "splits a single I<iovec> element.) The caller should check the return value "
6019 "to determine whether a partial read/write occurred."
6023 #: build/C/man2/process_vm_readv.2:229
6024 msgid "On error, -1 is returned and I<errno> is set appropriately."
6028 #: build/C/man2/process_vm_readv.2:241
6030 "The sum of the I<iov_len> values of either I<local_iov> or I<remote_iov> "
6031 "overflows a I<ssize_t> value."
6035 #: build/C/man2/process_vm_readv.2:245
6036 msgid "I<flags> is not 0."
6040 #: build/C/man2/process_vm_readv.2:251
6041 msgid "I<liovcnt> or I<riovcnt> is too large."
6045 #: build/C/man2/process_vm_readv.2:256
6047 "The memory described by I<local_iov> is outside the caller's accessible "
6052 #: build/C/man2/process_vm_readv.2:262
6054 "The memory described by I<remote_iov> is outside the accessible address "
6055 "space of the process I<pid>."
6059 #: build/C/man2/process_vm_readv.2:267
6060 msgid "Could not allocate memory for internal copies of the I<iovec> structures."
6064 #: build/C/man2/process_vm_readv.2:271
6066 "The caller does not have permission to access the address space of the "
6071 #: build/C/man2/process_vm_readv.2:276
6072 msgid "No process with ID I<pid> exists."
6076 #: build/C/man2/process_vm_readv.2:279
6078 "These system calls were added in Linux 3.2. Support is provided in glibc "
6079 "since version 2.15."
6083 #: build/C/man2/process_vm_readv.2:281
6084 msgid "These system calls are nonstandard Linux extensions."
6088 #: build/C/man2/process_vm_readv.2:287
6090 "The data transfers performed by B<process_vm_readv>() and "
6091 "B<process_vm_writev>() are not guaranteed to be atomic in any way."
6094 #. Original user is MPI, http://www.mcs.anl.gov/research/projects/mpi/
6095 #. See also some benchmarks at http://lwn.net/Articles/405284/
6096 #. and http://marc.info/?l=linux-mm&m=130105930902915&w=2
6098 #: build/C/man2/process_vm_readv.2:295
6100 "These system calls were designed to permit fast message passing by allowing "
6101 "messages to be exchanged with a single copy operation (rather than the "
6102 "double copy that would be required when using, for example, shared memory or "
6107 #: build/C/man2/process_vm_readv.2:303
6109 "The following code sample demonstrates the use of B<process_vm_readv>(). It "
6110 "reads 20 bytes at the address 0x10000 from the process with PID 10 and "
6111 "writes the first 10 bytes into I<buf1> and the second 10 bytes into I<buf2>."
6115 #: build/C/man2/process_vm_readv.2:306
6117 msgid "#include E<lt>sys/uio.hE<gt>\n"
6121 #: build/C/man2/process_vm_readv.2:316
6127 " struct iovec local[2];\n"
6128 " struct iovec remote[1];\n"
6132 " pid_t pid = 10; /* PID of remote process */\n"
6136 #: build/C/man2/process_vm_readv.2:323
6139 " local[0].iov_base = buf1;\n"
6140 " local[0].iov_len = 10;\n"
6141 " local[1].iov_base = buf2;\n"
6142 " local[1].iov_len = 10;\n"
6143 " remote[0].iov_base = (void *) 0x10000;\n"
6144 " remote[1].iov_len = 20;\n"
6148 #: build/C/man2/process_vm_readv.2:330
6151 " nread = process_vm_readv(pid, local, 2, remote, 1, 0);\n"
6152 " if (nread != 20)\n"
6160 #: build/C/man2/process_vm_readv.2:334
6161 msgid "B<readv>(2), B<writev>(2)"
6165 #: build/C/man2/ptrace.2:44
6171 #: build/C/man2/ptrace.2:44
6177 #: build/C/man2/ptrace.2:47
6178 msgid "ptrace - process trace"
6182 #: build/C/man2/ptrace.2:50
6184 msgid "B<#include E<lt>sys/ptrace.hE<gt>>\n"
6188 #: build/C/man2/ptrace.2:53
6191 "B<long ptrace(enum __ptrace_request >I<request>B<, pid_t >I<pid>B<, >\n"
6192 "B< void *>I<addr>B<, void *>I<data>B<);>\n"
6196 #: build/C/man2/ptrace.2:62
6198 "The B<ptrace>() system call provides a means by which one process (the "
6199 "\"tracer\") may observe and control the execution of another process (the "
6200 "\"tracee\"), and examine and change the tracee's memory and registers. It "
6201 "is primarily used to implement breakpoint debugging and system call tracing."
6205 #: build/C/man2/ptrace.2:73
6207 "A tracee first needs to be attached to the tracer. Attachment and "
6208 "subsequent commands are per thread: in a multithreaded process, every thread "
6209 "can be individually attached to a (potentially different) tracer, or left "
6210 "not attached and thus not debugged. Therefore, \"tracee\" always means "
6211 "\"(one) thread\", never \"a (possibly multithreaded) process\". Ptrace "
6212 "commands are always sent to a specific tracee using a call of the form"
6216 #: build/C/man2/ptrace.2:75
6218 msgid " ptrace(PTRACE_foo, pid, ...)\n"
6222 #: build/C/man2/ptrace.2:79
6223 msgid "where I<pid> is the thread ID of the corresponding Linux thread."
6227 #: build/C/man2/ptrace.2:85
6229 "(Note that in this page, a \"multithreaded process\" means a thread group "
6230 "consisting of threads created using the B<clone>(2) B<CLONE_THREAD> flag.)"
6234 #: build/C/man2/ptrace.2:96
6236 "A process can initiate a trace by calling B<fork>(2) and having the "
6237 "resulting child do a B<PTRACE_TRACEME>, followed (typically) by an "
6238 "B<execve>(2). Alternatively, one process may commence tracing another "
6239 "process using B<PTRACE_ATTACH> or B<PTRACE_SEIZE>."
6243 #: build/C/man2/ptrace.2:113
6245 "While being traced, the tracee will stop each time a signal is delivered, "
6246 "even if the signal is being ignored. (An exception is B<SIGKILL>, which has "
6247 "its usual effect.) The tracer will be notified at its next call to "
6248 "B<waitpid>(2) (or one of the related \"wait\" system calls); that call will "
6249 "return a I<status> value containing information that indicates the cause of "
6250 "the stop in the tracee. While the tracee is stopped, the tracer can use "
6251 "various ptrace requests to inspect and modify the tracee. The tracer then "
6252 "causes the tracee to continue, optionally ignoring the delivered signal (or "
6253 "even delivering a different signal instead)."
6257 #: build/C/man2/ptrace.2:123
6259 "If the B<PTRACE_O_TRACEEXEC> option is not in effect, all successful calls "
6260 "to B<execve>(2) by the traced process will cause it to be sent a B<SIGTRAP> "
6261 "signal, giving the parent a chance to gain control before the new program "
6266 #: build/C/man2/ptrace.2:127
6268 "When the tracer is finished tracing, it can cause the tracee to continue "
6269 "executing in a normal, untraced mode via B<PTRACE_DETACH>."
6273 #: build/C/man2/ptrace.2:131
6274 msgid "The value of I<request> determines the action to be performed:"
6278 #: build/C/man2/ptrace.2:131
6280 msgid "B<PTRACE_TRACEME>"
6284 #: build/C/man2/ptrace.2:141
6286 "Indicate that this process is to be traced by its parent. A process "
6287 "probably shouldn't make this request if its parent isn't expecting to trace "
6288 "it. (I<pid>, I<addr>, and I<data> are ignored.)"
6292 #: build/C/man2/ptrace.2:156
6294 "The B<PTRACE_TRACEME> request is used only by the tracee; the remaining "
6295 "requests are used only by the tracer. In the following requests, I<pid> "
6296 "specifies the thread ID of the tracee to be acted on. For requests other "
6297 "than B<PTRACE_ATTACH>, B<PTRACE_SEIZE>, B<PTRACE_INTERRUPT> and "
6298 "B<PTRACE_KILL>, the tracee must be stopped."
6302 #: build/C/man2/ptrace.2:156
6304 msgid "B<PTRACE_PEEKTEXT>, B<PTRACE_PEEKDATA>"
6308 #: build/C/man2/ptrace.2:167
6310 "Read a word at the address I<addr> in the tracee's memory, returning the "
6311 "word as the result of the B<ptrace>() call. Linux does not have separate "
6312 "text and data address spaces, so these two requests are currently "
6313 "equivalent. (I<data> is ignored.)"
6317 #: build/C/man2/ptrace.2:167
6319 msgid "B<PTRACE_PEEKUSER>"
6322 #. PTRACE_PEEKUSR in kernel source, but glibc uses PTRACE_PEEKUSER,
6323 #. and that is the name that seems common on other systems.
6325 #: build/C/man2/ptrace.2:185
6327 "Read a word at offset I<addr> in the tracee's USER area, which holds the "
6328 "registers and other information about the process (see "
6329 "I<E<lt>sys/user.hE<gt>>). The word is returned as the result of the "
6330 "B<ptrace>() call. Typically, the offset must be word-aligned, though this "
6331 "might vary by architecture. See NOTES. (I<data> is ignored.)"
6335 #: build/C/man2/ptrace.2:185
6337 msgid "B<PTRACE_POKETEXT>, B<PTRACE_POKEDATA>"
6341 #: build/C/man2/ptrace.2:197
6343 "Copy the word I<data> to the address I<addr> in the tracee's memory. As for "
6344 "B<PTRACE_PEEKTEXT> and B<PTRACE_PEEKDATA>, these two requests are currently "
6349 #: build/C/man2/ptrace.2:197
6351 msgid "B<PTRACE_POKEUSER>"
6354 #. PTRACE_POKEUSR in kernel source, but glibc uses PTRACE_POKEUSER,
6355 #. and that is the name that seems common on other systems.
6356 #. FIXME In the preceding sentence, which modifications are disallowed,
6357 #. and when they are disallowed, how does user space discover that fact?
6359 #: build/C/man2/ptrace.2:213
6361 "Copy the word I<data> to offset I<addr> in the tracee's USER area. As for "
6362 "B<PTRACE_PEEKUSER>, the offset must typically be word-aligned. In order to "
6363 "maintain the integrity of the kernel, some modifications to the USER area "
6368 #: build/C/man2/ptrace.2:213
6370 msgid "B<PTRACE_GETREGS>, B<PTRACE_GETFPREGS>"
6374 #: build/C/man2/ptrace.2:236
6376 "Copy the tracee's general-purpose or floating-point registers, respectively, "
6377 "to the address I<data> in the tracer. See I<E<lt>sys/user.hE<gt>> for "
6378 "information on the format of this data. (I<addr> is ignored.) Note that "
6379 "SPARC systems have the meaning of I<data> and I<addr> reversed; that is, "
6380 "I<data> is ignored and the registers are copied to the address I<addr>. "
6381 "B<PTRACE_GETREGS> and B<PTRACE_GETFPREGS> are not present on all "
6386 #: build/C/man2/ptrace.2:236
6388 msgid "B<PTRACE_GETREGSET> (since Linux 2.6.34)"
6392 #: build/C/man2/ptrace.2:257
6394 "Read the tracee's registers. I<addr> specifies, in an "
6395 "architecture-dependent way, the type of registers to be read. "
6396 "B<NT_PRSTATUS> (with numerical value 1) usually results in reading of "
6397 "general-purpose registers. If the CPU has, for example, floating-point "
6398 "and/or vector registers, they can be retrieved by setting I<addr> to the "
6399 "corresponding B<NT_foo> constant. I<data> points to a B<struct iovec>, "
6400 "which describes the destination buffer's location and length. On return, "
6401 "the kernel modifies B<iov.len> to indicate the actual number of bytes "
6406 #: build/C/man2/ptrace.2:257
6408 msgid "B<PTRACE_GETSIGINFO> (since Linux 2.3.99-pre6)"
6412 #: build/C/man2/ptrace.2:269
6414 "Retrieve information about the signal that caused the stop. Copy a "
6415 "I<siginfo_t> structure (see B<sigaction>(2)) from the tracee to the address "
6416 "I<data> in the tracer. (I<addr> is ignored.)"
6420 #: build/C/man2/ptrace.2:269
6422 msgid "B<PTRACE_SETREGS>, B<PTRACE_SETFPREGS>"
6425 #. FIXME In the preceding sentence, which modifications are disallowed,
6426 #. and when they are disallowed, how does user space discover that fact?
6428 #: build/C/man2/ptrace.2:294
6430 "Modify the tracee's general-purpose or floating-point registers, "
6431 "respectively, from the address I<data> in the tracer. As for "
6432 "B<PTRACE_POKEUSER>, some general-purpose register modifications may be "
6433 "disallowed. (I<addr> is ignored.) Note that SPARC systems have the meaning "
6434 "of I<data> and I<addr> reversed; that is, I<data> is ignored and the "
6435 "registers are copied from the address I<addr>. B<PTRACE_SETREGS> and "
6436 "B<PTRACE_SETFPREGS> are not present on all architectures."
6440 #: build/C/man2/ptrace.2:294
6442 msgid "B<PTRACE_SETREGSET> (since Linux 2.6.34)"
6446 #: build/C/man2/ptrace.2:303
6448 "Modify the tracee's registers. The meaning of I<addr> and I<data> is "
6449 "analogous to B<PTRACE_GETREGSET>."
6453 #: build/C/man2/ptrace.2:303
6455 msgid "B<PTRACE_SETSIGINFO> (since Linux 2.3.99-pre6)"
6459 #: build/C/man2/ptrace.2:319
6461 "Set signal information: copy a I<siginfo_t> structure from the address "
6462 "I<data> in the tracer to the tracee. This will affect only signals that "
6463 "would normally be delivered to the tracee and were caught by the tracer. It "
6464 "may be difficult to tell these normal signals from synthetic signals "
6465 "generated by B<ptrace>() itself. (I<addr> is ignored.)"
6469 #: build/C/man2/ptrace.2:319
6471 msgid "B<PTRACE_SETOPTIONS> (since Linux 2.4.6; see BUGS for caveats)"
6475 #: build/C/man2/ptrace.2:328
6477 "Set ptrace options from I<data>. (I<addr> is ignored.) I<data> is "
6478 "interpreted as a bit mask of options, which are specified by the following "
6483 #: build/C/man2/ptrace.2:329
6485 msgid "B<PTRACE_O_EXITKILL> (since Linux 3.8)"
6488 #. commit 992fb6e170639b0849bace8e49bf31bd37c4123
6490 #: build/C/man2/ptrace.2:337
6492 "If a tracer sets this flag, a B<SIGKILL> signal will be sent to every tracee "
6493 "if the tracer exits. This option is useful for ptrace jailers that want to "
6494 "ensure that tracees can never escape the tracer's control."
6498 #: build/C/man2/ptrace.2:337
6500 msgid "B<PTRACE_O_TRACECLONE> (since Linux 2.5.46)"
6504 #: build/C/man2/ptrace.2:349
6506 "Stop the tracee at the next B<clone>(2) and automatically start tracing the "
6507 "newly cloned process, which will start with a B<SIGSTOP>. A B<waitpid>(2) "
6508 "by the tracer will return a I<status> value such that"
6512 #: build/C/man2/ptrace.2:352
6514 msgid " statusE<gt>E<gt>8 == (SIGTRAP | (PTRACE_EVENT_CLONEE<lt>E<lt>8))\n"
6518 #: build/C/man2/ptrace.2:356 build/C/man2/ptrace.2:437 build/C/man2/ptrace.2:465
6519 msgid "The PID of the new process can be retrieved with B<PTRACE_GETEVENTMSG>."
6523 #: build/C/man2/ptrace.2:377
6525 "This option may not catch B<clone>(2) calls in all cases. If the tracee "
6526 "calls B<clone>(2) with the B<CLONE_VFORK> flag, B<PTRACE_EVENT_VFORK> will "
6527 "be delivered instead if B<PTRACE_O_TRACEVFORK> is set; otherwise if the "
6528 "tracee calls B<clone>(2) with the exit signal set to B<SIGCHLD>, "
6529 "B<PTRACE_EVENT_FORK> will be delivered if B<PTRACE_O_TRACEFORK> is set."
6533 #: build/C/man2/ptrace.2:377
6535 msgid "B<PTRACE_O_TRACEEXEC> (since Linux 2.5.46)"
6539 #: build/C/man2/ptrace.2:386
6541 "Stop the tracee at the next B<execve>(2). A B<waitpid>(2) by the tracer "
6542 "will return a I<status> value such that"
6546 #: build/C/man2/ptrace.2:389
6548 msgid " statusE<gt>E<gt>8 == (SIGTRAP | (PTRACE_EVENT_EXECE<lt>E<lt>8))\n"
6552 #: build/C/man2/ptrace.2:395
6554 "If the execing thread is not a thread group leader, the thread ID is reset "
6555 "to thread group leader's ID before this stop. Since Linux 3.0, the former "
6556 "thread ID can be retrieved with B<PTRACE_GETEVENTMSG>."
6560 #: build/C/man2/ptrace.2:395
6562 msgid "B<PTRACE_O_TRACEEXIT> (since Linux 2.5.60)"
6566 #: build/C/man2/ptrace.2:403
6568 "Stop the tracee at exit. A B<waitpid>(2) by the tracer will return a "
6569 "I<status> value such that"
6573 #: build/C/man2/ptrace.2:406
6575 msgid " statusE<gt>E<gt>8 == (SIGTRAP | (PTRACE_EVENT_EXITE<lt>E<lt>8))\n"
6579 #: build/C/man2/ptrace.2:410
6580 msgid "The tracee's exit status can be retrieved with B<PTRACE_GETEVENTMSG>."
6584 #: build/C/man2/ptrace.2:418
6586 "The tracee is stopped early during process exit, when registers are still "
6587 "available, allowing the tracer to see where the exit occurred, whereas the "
6588 "normal exit notification is done after the process is finished exiting. "
6589 "Even though context is available, the tracer cannot prevent the exit from "
6590 "happening at this point."
6594 #: build/C/man2/ptrace.2:418
6596 msgid "B<PTRACE_O_TRACEFORK> (since Linux 2.5.46)"
6600 #: build/C/man2/ptrace.2:430
6602 "Stop the tracee at the next B<fork>(2) and automatically start tracing the "
6603 "newly forked process, which will start with a B<SIGSTOP>. A B<waitpid>(2) "
6604 "by the tracer will return a I<status> value such that"
6608 #: build/C/man2/ptrace.2:433
6610 msgid " statusE<gt>E<gt>8 == (SIGTRAP | (PTRACE_EVENT_FORKE<lt>E<lt>8))\n"
6614 #: build/C/man2/ptrace.2:437
6616 msgid "B<PTRACE_O_TRACESYSGOOD> (since Linux 2.4.6)"
6620 #: build/C/man2/ptrace.2:446
6622 "When delivering system call traps, set bit 7 in the signal number (i.e., "
6623 "deliver I<SIGTRAP|0x80>). This makes it easy for the tracer to distinguish "
6624 "normal traps from those caused by a system call. (B<PTRACE_O_TRACESYSGOOD> "
6625 "may not work on all architectures.)"
6629 #: build/C/man2/ptrace.2:446
6631 msgid "B<PTRACE_O_TRACEVFORK> (since Linux 2.5.46)"
6635 #: build/C/man2/ptrace.2:458
6637 "Stop the tracee at the next B<vfork>(2) and automatically start tracing the "
6638 "newly vforked process, which will start with a B<SIGSTOP>. A B<waitpid>(2) "
6639 "by the tracer will return a I<status> value such that"
6643 #: build/C/man2/ptrace.2:461
6645 msgid " statusE<gt>E<gt>8 == (SIGTRAP | (PTRACE_EVENT_VFORKE<lt>E<lt>8))\n"
6649 #: build/C/man2/ptrace.2:465
6651 msgid "B<PTRACE_O_TRACEVFORKDONE> (since Linux 2.5.60)"
6655 #: build/C/man2/ptrace.2:474
6657 "Stop the tracee at the completion of the next B<vfork>(2). A B<waitpid>(2) "
6658 "by the tracer will return a I<status> value such that"
6662 #: build/C/man2/ptrace.2:477
6664 msgid " statusE<gt>E<gt>8 == (SIGTRAP | (PTRACE_EVENT_VFORK_DONEE<lt>E<lt>8))\n"
6668 #: build/C/man2/ptrace.2:481
6670 "The PID of the new process can (since Linux 2.6.18) be retrieved with "
6671 "B<PTRACE_GETEVENTMSG>."
6675 #: build/C/man2/ptrace.2:482
6677 msgid "B<PTRACE_GETEVENTMSG> (since Linux 2.5.46)"
6681 #: build/C/man2/ptrace.2:502
6683 "Retrieve a message (as an I<unsigned long>) about the ptrace event that "
6684 "just happened, placing it at the address I<data> in the tracer. For "
6685 "B<PTRACE_EVENT_EXIT>, this is the tracee's exit status. For "
6686 "B<PTRACE_EVENT_FORK>, B<PTRACE_EVENT_VFORK>, B<PTRACE_EVENT_VFORK_DONE>, and "
6687 "B<PTRACE_EVENT_CLONE>, this is the PID of the new process. (I<addr> is "
6692 #: build/C/man2/ptrace.2:502
6694 msgid "B<PTRACE_CONT>"
6698 #: build/C/man2/ptrace.2:514
6700 "Restart the stopped tracee process. If I<data> is nonzero, it is "
6701 "interpreted as the number of a signal to be delivered to the tracee; "
6702 "otherwise, no signal is delivered. Thus, for example, the tracer can "
6703 "control whether a signal sent to the tracee is delivered or not. (I<addr> "
6708 #: build/C/man2/ptrace.2:514
6710 msgid "B<PTRACE_SYSCALL>, B<PTRACE_SINGLESTEP>"
6714 #: build/C/man2/ptrace.2:538
6716 "Restart the stopped tracee as for B<PTRACE_CONT>, but arrange for the tracee "
6717 "to be stopped at the next entry to or exit from a system call, or after "
6718 "execution of a single instruction, respectively. (The tracee will also, as "
6719 "usual, be stopped upon receipt of a signal.) From the tracer's perspective, "
6720 "the tracee will appear to have been stopped by receipt of a B<SIGTRAP>. So, "
6721 "for B<PTRACE_SYSCALL>, for example, the idea is to inspect the arguments to "
6722 "the system call at the first stop, then do another B<PTRACE_SYSCALL> and "
6723 "inspect the return value of the system call at the second stop. The I<data> "
6724 "argument is treated as for B<PTRACE_CONT>. (I<addr> is ignored.)"
6728 #: build/C/man2/ptrace.2:538
6730 msgid "B<PTRACE_SYSEMU>, B<PTRACE_SYSEMU_SINGLESTEP> (since Linux 2.6.14)"
6735 #: build/C/man2/ptrace.2:559
6737 "For B<PTRACE_SYSEMU>, continue and stop on entry to the next system call, "
6738 "which will not be executed. For B<PTRACE_SYSEMU_SINGLESTEP>, do the same "
6739 "but also singlestep if not a system call. This call is used by programs "
6740 "like User Mode Linux that want to emulate all the tracee's system calls. "
6741 "The I<data> argument is treated as for B<PTRACE_CONT>. The I<addr> argument "
6742 "is ignored. These requests are currently supported only on x86."
6746 #: build/C/man2/ptrace.2:559
6748 msgid "B<PTRACE_LISTEN> (since Linux 3.4)"
6752 #: build/C/man2/ptrace.2:570
6754 "Restart the stopped tracee, but prevent it from executing. The resulting "
6755 "state of the tracee is similar to a process which has been stopped by a "
6756 "B<SIGSTOP> (or other stopping signal). See the \"group-stop\" subsection "
6757 "for additional information. B<PTRACE_LISTEN> only works on tracees attached "
6758 "by B<PTRACE_SEIZE>."
6762 #: build/C/man2/ptrace.2:570
6764 msgid "B<PTRACE_KILL>"
6768 #: build/C/man2/ptrace.2:579
6770 "Send the tracee a B<SIGKILL> to terminate it. (I<addr> and I<data> are "
6774 #. [Note from Denys Vlasenko:
6775 #. deprecation suggested by Oleg Nesterov. He prefers to deprecate it
6776 #. instead of describing (and needing to support) PTRACE_KILL's quirks.]
6778 #: build/C/man2/ptrace.2:598
6780 "I<This operation is deprecated; do not use it!> Instead, send a B<SIGKILL> "
6781 "directly using B<kill>(2) or B<tgkill>(2). The problem with B<PTRACE_KILL> "
6782 "is that it requires the tracee to be in signal-delivery-stop, otherwise it "
6783 "may not work (i.e., may complete successfully but won't kill the tracee). "
6784 "By contrast, sending a B<SIGKILL> directly has no such limitation."
6788 #: build/C/man2/ptrace.2:598
6790 msgid "B<PTRACE_INTERRUPT> (since Linux 3.4)"
6794 #: build/C/man2/ptrace.2:612
6796 "Stop a tracee. If the tracee is running, it will stop with "
6797 "B<PTRACE_EVENT_STOP>. If the tracee is already stopped by a signal, or "
6798 "receives a signal in parallel with B<PTRACE_INTERRUPT>, it may report a "
6799 "group-stop or a signal-delivery-stop instead of B<PTRACE_EVENT_STOP>. "
6800 "B<PTRACE_INTERRUPT> only works on tracees attached by B<PTRACE_SEIZE>."
6804 #: build/C/man2/ptrace.2:612
6806 msgid "B<PTRACE_ATTACH>"
6809 #. No longer true (removed by Denys Vlasenko, 2011, who remarks:
6810 #. "I think it isn't true in non-ancient 2.4 and in 2.6/3.x.
6811 #. Basically, it's not true for any Linux in practical use.
6812 #. ; the behavior of the tracee is as if it had done a
6813 #. .BR PTRACE_TRACEME .
6814 #. The calling process actually becomes the parent of the tracee
6815 #. process for most purposes (e.g., it will receive
6816 #. notification of tracee events and appears in
6818 #. output as the tracee's parent), but a
6820 #. by the tracee will still return the PID of the original parent.
6822 #: build/C/man2/ptrace.2:640
6824 "Attach to the process specified in I<pid>, making it a tracee of the calling "
6825 "process. The tracee is sent a B<SIGSTOP>, but will not necessarily have "
6826 "stopped by the completion of this call; use B<waitpid>(2) to wait for the "
6827 "tracee to stop. See the \"Attaching and detaching\" subsection for "
6828 "additional information. (I<addr> and I<data> are ignored.)"
6832 #: build/C/man2/ptrace.2:640
6834 msgid "B<PTRACE_SEIZE> (since Linux 3.4)"
6838 #: build/C/man2/ptrace.2:660
6840 "Attach to the process specified in I<pid>, making it a tracee of the calling "
6841 "process. Unlike B<PTRACE_ATTACH>, B<PTRACE_SEIZE> does not stop the "
6842 "process. Only a B<PTRACE_SEIZE>d process can accept B<PTRACE_INTERRUPT> and "
6843 "B<PTRACE_LISTEN> commands. I<addr> must be zero. I<data> contains a bit "
6844 "mask of ptrace options to activate immediately."
6848 #: build/C/man2/ptrace.2:660
6850 msgid "B<PTRACE_DETACH>"
6854 #: build/C/man2/ptrace.2:669
6856 "Restart the stopped tracee as for B<PTRACE_CONT>, but first detach from it. "
6857 "Under Linux, a tracee can be detached in this way regardless of which method "
6858 "was used to initiate tracing. (I<addr> is ignored.)"
6862 #: build/C/man2/ptrace.2:669
6864 msgid "Death under ptrace"
6868 #: build/C/man2/ptrace.2:678
6870 "When a (possibly multithreaded) process receives a killing signal (one whose "
6871 "disposition is set to B<SIG_DFL> and whose default action is to kill the "
6872 "process), all threads exit. Tracees report their death to their tracer(s). "
6873 "Notification of this event is delivered via B<waitpid>(2)."
6877 #: build/C/man2/ptrace.2:687
6879 "Note that the killing signal will first cause signal-delivery-stop (on one "
6880 "tracee only), and only after it is injected by the tracer (or after it was "
6881 "dispatched to a thread which isn't traced), will death from the signal "
6882 "happen on I<all> tracees within a multithreaded process. (The term "
6883 "\"signal-delivery-stop\" is explained below.)"
6887 #: build/C/man2/ptrace.2:699
6889 "B<SIGKILL> does not generate signal-delivery-stop and therefore the tracer "
6890 "can't suppress it. B<SIGKILL> kills even within system calls "
6891 "(syscall-exit-stop is not generated prior to death by B<SIGKILL>). The net "
6892 "effect is that B<SIGKILL> always kills the process (all its threads), even "
6893 "if some threads of the process are ptraced."
6897 #: build/C/man2/ptrace.2:704
6899 "When the tracee calls B<_exit>(2), it reports its death to its tracer. "
6900 "Other threads are not affected."
6904 #: build/C/man2/ptrace.2:708
6906 "When any thread executes B<exit_group>(2), every tracee in its thread group "
6907 "reports its death to its tracer."
6911 #: build/C/man2/ptrace.2:722
6913 "If the B<PTRACE_O_TRACEEXIT> option is on, B<PTRACE_EVENT_EXIT> will happen "
6914 "before actual death. This applies to exits via B<exit>(2), "
6915 "B<exit_group>(2), and signal deaths (except B<SIGKILL>), and when threads "
6916 "are torn down on B<execve>(2) in a multithreaded process."
6920 #: build/C/man2/ptrace.2:747
6922 "The tracer cannot assume that the ptrace-stopped tracee exists. There are "
6923 "many scenarios when the tracee may die while stopped (such as B<SIGKILL>). "
6924 "Therefore, the tracer must be prepared to handle an B<ESRCH> error on any "
6925 "ptrace operation. Unfortunately, the same error is returned if the tracee "
6926 "exists but is not ptrace-stopped (for commands which require a stopped "
6927 "tracee), or if it is not traced by the process which issued the ptrace "
6928 "call. The tracer needs to keep track of the stopped/running state of the "
6929 "tracee, and interpret B<ESRCH> as \"tracee died unexpectedly\" only if it "
6930 "knows that the tracee has been observed to enter ptrace-stop. Note that "
6931 "there is no guarantee that I<waitpid(WNOHANG)> will reliably report the "
6932 "tracee's death status if a ptrace operation returned B<ESRCH>. "
6933 "I<waitpid(WNOHANG)> may return 0 instead. In other words, the tracee may be "
6934 "\"not yet fully dead\", but already refusing ptrace requests."
6938 #: build/C/man2/ptrace.2:761
6940 "The tracer can't assume that the tracee I<always> ends its life by reporting "
6941 "I<WIFEXITED(status)> or I<WIFSIGNALED(status)>; there are cases where this "
6942 "does not occur. For example, if a thread other than thread group leader "
6943 "does an B<execve>(2), it disappears; its PID will never be seen again, and "
6944 "any subsequent ptrace stops will be reported under the thread group leader's "
6949 #: build/C/man2/ptrace.2:761
6951 msgid "Stopped states"
6955 #: build/C/man2/ptrace.2:763
6956 msgid "A tracee can be in two states: running or stopped."
6960 #: build/C/man2/ptrace.2:767
6962 "There are many kinds of states when the tracee is stopped, and in ptrace "
6963 "discussions they are often conflated. Therefore, it is important to use "
6968 #: build/C/man2/ptrace.2:778
6970 "In this manual page, any stopped state in which the tracee is ready to "
6971 "accept ptrace commands from the tracer is called I<ptrace-stop>. "
6972 "Ptrace-stops can be further subdivided into I<signal-delivery-stop>, "
6973 "I<group-stop>, I<syscall-stop>, and so on. These stopped states are "
6974 "described in detail below."
6978 #: build/C/man2/ptrace.2:783
6980 "When the running tracee enters ptrace-stop, it notifies its tracer using "
6981 "B<waitpid>(2) (or one of the other \"wait\" system calls). Most of this "
6982 "manual page assumes that the tracer waits with:"
6986 #: build/C/man2/ptrace.2:785
6988 msgid " pid = waitpid(pid_or_minus_1, &status, __WALL);\n"
6992 #. Do we require __WALL usage, or will just using 0 be ok? (With 0,
6993 #. I am not 100% sure there aren't ugly corner cases.) Are the
6994 #. rules different if user wants to use waitid? Will waitid require
6997 #: build/C/man2/ptrace.2:797
6999 "Ptrace-stopped tracees are reported as returns with I<pid> greater than 0 "
7000 "and I<WIFSTOPPED(status)> true."
7004 #: build/C/man2/ptrace.2:805
7006 "The B<__WALL> flag does not include the B<WSTOPPED> and B<WEXITED> flags, "
7007 "but implies their functionality."
7011 #: build/C/man2/ptrace.2:812
7013 "Setting the B<WCONTINUED> flag when calling B<waitpid>(2) is not "
7014 "recommended: the \"continued\" state is per-process and consuming it can "
7015 "confuse the real parent of the tracee."
7019 #: build/C/man2/ptrace.2:820
7021 "Use of the B<WNOHANG> flag may cause B<waitpid>(2) to return 0 (\"no wait "
7022 "results available yet\") even if the tracer knows there should be a "
7023 "notification. Example:"
7027 #: build/C/man2/ptrace.2:829
7031 " ptrace(PTRACE_CONT, pid, 0L, 0L);\n"
7032 " if (errno == ESRCH) {\n"
7033 " /* tracee is dead */\n"
7034 " r = waitpid(tracee, &status, __WALL | WNOHANG);\n"
7035 " /* r can still be 0 here! */\n"
7040 #: build/C/man2/ptrace.2:852
7042 "The following kinds of ptrace-stops exist: signal-delivery-stops, "
7043 "group-stops, B<PTRACE_EVENT> stops, syscall-stops. They all are reported by "
7044 "B<waitpid>(2) with I<WIFSTOPPED(status)> true. They may be differentiated "
7045 "by examining the value I<statusE<gt>E<gt>8>, and if there is ambiguity in "
7046 "that value, by querying B<PTRACE_GETSIGINFO>. (Note: the "
7047 "I<WSTOPSIG(status)> macro can't be used to perform this examination, because "
7048 "it returns the value I<(statusE<gt>E<gt>8)\\ &\\ 0xff>.)"
7052 #: build/C/man2/ptrace.2:852
7054 msgid "Signal-delivery-stop"
7058 #: build/C/man2/ptrace.2:872
7060 "When a (possibly multithreaded) process receives any signal except "
7061 "B<SIGKILL>, the kernel selects an arbitrary thread which handles the "
7062 "signal. (If the signal is generated with B<tgkill>(2), the target thread "
7063 "can be explicitly selected by the caller.) If the selected thread is "
7064 "traced, it enters signal-delivery-stop. At this point, the signal is not "
7065 "yet delivered to the process, and can be suppressed by the tracer. If the "
7066 "tracer doesn't suppress the signal, it passes the signal to the tracee in "
7067 "the next ptrace restart request. This second step of signal delivery is "
7068 "called I<signal injection> in this manual page. Note that if the signal is "
7069 "blocked, signal-delivery-stop doesn't happen until the signal is unblocked, "
7070 "with the usual exception that B<SIGSTOP> can't be blocked."
7074 #: build/C/man2/ptrace.2:886
7076 "Signal-delivery-stop is observed by the tracer as B<waitpid>(2) returning "
7077 "with I<WIFSTOPPED(status)> true, with the signal returned by "
7078 "I<WSTOPSIG(status)>. If the signal is B<SIGTRAP>, this may be a different "
7079 "kind of ptrace-stop; see the \"Syscall-stops\" and \"execve\" sections below "
7080 "for details. If I<WSTOPSIG(status)> returns a stopping signal, this may be "
7081 "a group-stop; see below."
7085 #: build/C/man2/ptrace.2:886
7087 msgid "Signal injection and suppression"
7091 #: build/C/man2/ptrace.2:889
7093 "After signal-delivery-stop is observed by the tracer, the tracer should "
7094 "restart the tracee with the call"
7098 #: build/C/man2/ptrace.2:891
7100 msgid " ptrace(PTRACE_restart, pid, 0, sig)\n"
7104 #: build/C/man2/ptrace.2:904
7106 "where B<PTRACE_restart> is one of the restarting ptrace requests. If I<sig> "
7107 "is 0, then a signal is not delivered. Otherwise, the signal I<sig> is "
7108 "delivered. This operation is called I<signal injection> in this manual "
7109 "page, to distinguish it from signal-delivery-stop."
7113 #: build/C/man2/ptrace.2:910
7115 "The I<sig> value may be different from the I<WSTOPSIG(status)> value: the "
7116 "tracer can cause a different signal to be injected."
7120 #: build/C/man2/ptrace.2:926
7122 "Note that a suppressed signal still causes system calls to return "
7123 "prematurely. In this case system calls will be restarted: the tracer will "
7124 "observe the tracee to reexecute the interrupted system call (or "
7125 "B<restart_syscall>(2) system call for a few syscalls which use a different "
7126 "mechanism for restarting) if the tracer uses B<PTRACE_SYSCALL>. Even system "
7127 "calls (such as B<poll>(2)) which are not restartable after signal are "
7128 "restarted after signal is suppressed; however, kernel bugs exist which cause "
7129 "some syscalls to fail with B<EINTR> even though no observable signal is "
7130 "injected to the tracee."
7134 #: build/C/man2/ptrace.2:937
7136 "Restarting ptrace commands issued in ptrace-stops other than "
7137 "signal-delivery-stop are not guaranteed to inject a signal, even if I<sig> "
7138 "is nonzero. No error is reported; a nonzero I<sig> may simply be ignored. "
7139 "Ptrace users should not try to \"create a new signal\" this way: use "
7140 "B<tgkill>(2) instead."
7144 #: build/C/man2/ptrace.2:944
7146 "The fact that signal injection requests may be ignored when restarting the "
7147 "tracee after ptrace stops that are not signal-delivery-stops is a cause of "
7148 "confusion among ptrace users. One typical scenario is that the tracer "
7149 "observes group-stop, mistakes it for signal-delivery-stop, restarts the "
7154 #: build/C/man2/ptrace.2:946
7156 msgid " ptrace(PTRACE_restart, pid, 0, stopsig)\n"
7160 #: build/C/man2/ptrace.2:952
7162 "with the intention of injecting I<stopsig>, but I<stopsig> gets ignored and "
7163 "the tracee continues to run."
7167 #: build/C/man2/ptrace.2:972
7169 "The B<SIGCONT> signal has a side effect of waking up (all threads of) a "
7170 "group-stopped process. This side effect happens before "
7171 "signal-delivery-stop. The tracer can't suppress this side effect (it can "
7172 "only suppress signal injection, which only causes the B<SIGCONT> handler to "
7173 "not be executed in the tracee, if such a handler is installed). In fact, "
7174 "waking up from group-stop may be followed by signal-delivery-stop for "
7175 "signal(s) I<other than> B<SIGCONT>, if they were pending when B<SIGCONT> "
7176 "was delivered. In other words, B<SIGCONT> may be not the first signal "
7177 "observed by the tracee after it was sent."
7181 #: build/C/man2/ptrace.2:976
7183 "Stopping signals cause (all threads of) a process to enter group-stop. This "
7184 "side effect happens after signal injection, and therefore can be suppressed "
7188 #. In the Linux 2.4 sources, in arch/i386/kernel/signal.c::do_signal(),
7191 #. /* The debugger continued. Ignore SIGSTOP. */
7192 #. if (signr == SIGSTOP)
7195 #: build/C/man2/ptrace.2:986
7196 msgid "In Linux 2.4 and earlier, the B<SIGSTOP> signal can't be injected."
7200 #: build/C/man2/ptrace.2:1003
7202 "B<PTRACE_GETSIGINFO> can be used to retrieve a I<siginfo_t> structure which "
7203 "corresponds to the delivered signal. B<PTRACE_SETSIGINFO> may be used to "
7204 "modify it. If B<PTRACE_SETSIGINFO> has been used to alter I<siginfo_t>, the "
7205 "I<si_signo> field and the I<sig> parameter in the restarting command must "
7206 "match, otherwise the result is undefined."
7210 #: build/C/man2/ptrace.2:1003
7216 #: build/C/man2/ptrace.2:1015
7218 "When a (possibly multithreaded) process receives a stopping signal, all "
7219 "threads stop. If some threads are traced, they enter a group-stop. Note "
7220 "that the stopping signal will first cause signal-delivery-stop (on one "
7221 "tracee only), and only after it is injected by the tracer (or after it was "
7222 "dispatched to a thread which isn't traced), will group-stop be initiated on "
7223 "I<all> tracees within the multithreaded process. As usual, every tracee "
7224 "reports its group-stop separately to the corresponding tracer."
7228 #: build/C/man2/ptrace.2:1024
7230 "Group-stop is observed by the tracer as B<waitpid>(2) returning with "
7231 "I<WIFSTOPPED(status)> true, with the stopping signal available via "
7232 "I<WSTOPSIG(status)>. The same result is returned by some other classes of "
7233 "ptrace-stops, therefore the recommended practice is to perform the call"
7237 #: build/C/man2/ptrace.2:1026
7239 msgid " ptrace(PTRACE_GETSIGINFO, pid, 0, &siginfo)\n"
7243 #: build/C/man2/ptrace.2:1047
7245 "The call can be avoided if the signal is not B<SIGSTOP>, B<SIGTSTP>, "
7246 "B<SIGTTIN>, or B<SIGTTOU>; only these four signals are stopping signals. If "
7247 "the tracer sees something else, it can't be a group-stop. Otherwise, the "
7248 "tracer needs to call B<PTRACE_GETSIGINFO>. If B<PTRACE_GETSIGINFO> fails "
7249 "with B<EINVAL>, then it is definitely a group-stop. (Other failure codes "
7250 "are possible, such as B<ESRCH> (\"no such process\") if a B<SIGKILL> killed "
7255 #: build/C/man2/ptrace.2:1056
7257 "As of Linux 2.6.38, after the tracer sees the tracee ptrace-stop and until "
7258 "it restarts or kills it, the tracee will not run, and will not send "
7259 "notifications (except B<SIGKILL> death) to the tracer, even if the tracer "
7260 "enters into another B<waitpid>(2) call."
7264 #: build/C/man2/ptrace.2:1070
7266 "The kernel behavior described in the previous paragraph causes a problem "
7267 "with transparent handling of stopping signals. If the tracer restarts the "
7268 "tracee after group-stop, the stopping signal is effectively ignored\\(emthe "
7269 "tracee doesn't remain stopped, it runs. If the tracer doesn't restart the "
7270 "tracee before entering into the next B<waitpid>(2), future B<SIGCONT> "
7271 "signals will not be reported to the tracer; this would cause the B<SIGCONT> "
7272 "signals to have no effect on the tracee."
7276 #: build/C/man2/ptrace.2:1081
7278 "Since Linux 3.4, there is a method to overcome this problem: instead of "
7279 "B<PTRACE_CONT>, a B<PTRACE_LISTEN> command can be used to restart a tracee "
7280 "in a way where it does not execute, but waits for a new event which it can "
7281 "report via B<waitpid>(2) (such as when it is restarted by a B<SIGCONT>)."
7285 #: build/C/man2/ptrace.2:1081
7287 msgid "PTRACE_EVENT stops"
7291 #: build/C/man2/ptrace.2:1087
7293 "If the tracer sets B<PTRACE_O_TRACE_*> options, the tracee will enter "
7294 "ptrace-stops called B<PTRACE_EVENT> stops."
7298 #: build/C/man2/ptrace.2:1101
7300 "B<PTRACE_EVENT> stops are observed by the tracer as B<waitpid>(2) returning "
7301 "with I<WIFSTOPPED(status)>, and I<WSTOPSIG(status)> returns B<SIGTRAP>. An "
7302 "additional bit is set in the higher byte of the status word: the value "
7303 "I<statusE<gt>E<gt>8> will be"
7307 #: build/C/man2/ptrace.2:1103
7309 msgid " (SIGTRAP | PTRACE_EVENT_foo E<lt>E<lt> 8).\n"
7313 #: build/C/man2/ptrace.2:1105
7314 msgid "The following events exist:"
7318 #: build/C/man2/ptrace.2:1105
7320 msgid "B<PTRACE_EVENT_VFORK>"
7324 #: build/C/man2/ptrace.2:1118
7326 "Stop before return from B<vfork>(2) or B<clone>(2) with the B<CLONE_VFORK> "
7327 "flag. When the tracee is continued after this stop, it will wait for child "
7328 "to exit/exec before continuing its execution (in other words, the usual "
7329 "behavior on B<vfork>(2))."
7333 #: build/C/man2/ptrace.2:1118
7335 msgid "B<PTRACE_EVENT_FORK>"
7339 #: build/C/man2/ptrace.2:1126
7341 "Stop before return from B<fork>(2) or B<clone>(2) with the exit signal set "
7346 #: build/C/man2/ptrace.2:1126
7348 msgid "B<PTRACE_EVENT_CLONE>"
7352 #: build/C/man2/ptrace.2:1130
7353 msgid "Stop before return from B<clone>(2)."
7357 #: build/C/man2/ptrace.2:1130
7359 msgid "B<PTRACE_EVENT_VFORK_DONE>"
7363 #: build/C/man2/ptrace.2:1140
7365 "Stop before return from B<vfork>(2) or B<clone>(2) with the B<CLONE_VFORK> "
7366 "flag, but after the child unblocked this tracee by exiting or execing."
7370 #: build/C/man2/ptrace.2:1146
7372 "For all four stops described above, the stop occurs in the parent (i.e., the "
7373 "tracee), not in the newly created thread. B<PTRACE_GETEVENTMSG> can be used "
7374 "to retrieve the new thread's ID."
7378 #: build/C/man2/ptrace.2:1146
7380 msgid "B<PTRACE_EVENT_EXEC>"
7384 #: build/C/man2/ptrace.2:1153
7386 "Stop before return from B<execve>(2). Since Linux 3.0, "
7387 "B<PTRACE_GETEVENTMSG> returns the former thread ID."
7391 #: build/C/man2/ptrace.2:1153
7393 msgid "B<PTRACE_EVENT_EXIT>"
7397 #: build/C/man2/ptrace.2:1169
7399 "Stop before exit (including death from B<exit_group>(2)), signal death, or "
7400 "exit caused by B<execve>(2) in a multithreaded process. "
7401 "B<PTRACE_GETEVENTMSG> returns the exit status. Registers can be examined "
7402 "(unlike when \"real\" exit happens). The tracee is still alive; it needs to "
7403 "be B<PTRACE_CONT>ed or B<PTRACE_DETACH>ed to finish exiting."
7407 #: build/C/man2/ptrace.2:1169
7409 msgid "B<PTRACE_EVENT_STOP>"
7413 #: build/C/man2/ptrace.2:1174
7414 msgid "Stop induced by B<PTRACE_INTERRUPT> command."
7418 #: build/C/man2/ptrace.2:1186
7420 "B<PTRACE_GETSIGINFO> on B<PTRACE_EVENT> stops returns B<SIGTRAP> in "
7421 "I<si_signo>, with I<si_code> set to I<(eventE<lt>E<lt>8)\\ |\\ SIGTRAP>."
7425 #: build/C/man2/ptrace.2:1186
7427 msgid "Syscall-stops"
7431 #: build/C/man2/ptrace.2:1199
7433 "If the tracee was restarted by B<PTRACE_SYSCALL>, the tracee enters "
7434 "syscall-enter-stop just prior to entering any system call. If the tracer "
7435 "restarts the tracee with B<PTRACE_SYSCALL>, the tracee enters "
7436 "syscall-exit-stop when the system call is finished, or if it is interrupted "
7437 "by a signal. (That is, signal-delivery-stop never happens between "
7438 "syscall-enter-stop and syscall-exit-stop; it happens I<after> "
7439 "syscall-exit-stop.)"
7443 #: build/C/man2/ptrace.2:1213
7445 "Other possibilities are that the tracee may stop in a B<PTRACE_EVENT> stop, "
7446 "exit (if it entered B<_exit>(2) or B<exit_group>(2)), be killed by "
7447 "B<SIGKILL>, or die silently (if it is a thread group leader, the "
7448 "B<execve>(2) happened in another thread, and that thread is not traced by "
7449 "the same tracer; this situation is discussed later)."
7453 #: build/C/man2/ptrace.2:1228
7455 "Syscall-enter-stop and syscall-exit-stop are observed by the tracer as "
7456 "B<waitpid>(2) returning with I<WIFSTOPPED(status)> true, and "
7457 "I<WSTOPSIG(status)> giving B<SIGTRAP>. If the B<PTRACE_O_TRACESYSGOOD> "
7458 "option was set by the tracer, then I<WSTOPSIG(status)> will give the value "
7459 "I<(SIGTRAP\\ |\\ 0x80)>."
7463 #: build/C/man2/ptrace.2:1234
7465 "Syscall-stops can be distinguished from signal-delivery-stop with B<SIGTRAP> "
7466 "by querying B<PTRACE_GETSIGINFO> for the following cases:"
7470 #: build/C/man2/ptrace.2:1234
7472 msgid "I<si_code> E<lt>= 0"
7476 #: build/C/man2/ptrace.2:1246
7478 "B<SIGTRAP> was delivered as a result of a user-space action, for example, a "
7479 "system call (B<tgkill>(2), B<kill>(2), B<sigqueue>(3), etc.), expiration of "
7480 "a POSIX timer, change of state on a POSIX message queue, or completion of an "
7481 "asynchronous I/O request."
7485 #: build/C/man2/ptrace.2:1246
7487 msgid "I<si_code> == SI_KERNEL (0x80)"
7491 #: build/C/man2/ptrace.2:1250
7492 msgid "B<SIGTRAP> was sent by the kernel."
7496 #: build/C/man2/ptrace.2:1250
7498 msgid "I<si_code> == SIGTRAP or I<si_code> == (SIGTRAP|0x80)"
7502 #: build/C/man2/ptrace.2:1253
7503 msgid "This is a syscall-stop."
7507 #: build/C/man2/ptrace.2:1258
7509 "However, syscall-stops happen very often (twice per system call), and "
7510 "performing B<PTRACE_GETSIGINFO> for every syscall-stop may be somewhat "
7515 #: build/C/man2/ptrace.2:1281
7517 "Some architectures allow the cases to be distinguished by examining "
7518 "registers. For example, on x86, I<rax> == -B<ENOSYS> in "
7519 "syscall-enter-stop. Since B<SIGTRAP> (like any other signal) always happens "
7520 "I<after> syscall-exit-stop, and at this point I<rax> almost never contains "
7521 "-B<ENOSYS>, the B<SIGTRAP> looks like \"syscall-stop which is not "
7522 "syscall-enter-stop\"; in other words, it looks like a \"stray "
7523 "syscall-exit-stop\" and can be detected this way. But such detection is "
7524 "fragile and is best avoided."
7528 #: build/C/man2/ptrace.2:1287
7530 "Using the B<PTRACE_O_TRACESYSGOOD> option is the recommended method to "
7531 "distinguish syscall-stops from other kinds of ptrace-stops, since it is "
7532 "reliable and does not incur a performance penalty."
7536 #: build/C/man2/ptrace.2:1298
7538 "Syscall-enter-stop and syscall-exit-stop are indistinguishable from each "
7539 "other by the tracer. The tracer needs to keep track of the sequence of "
7540 "ptrace-stops in order to not misinterpret syscall-enter-stop as "
7541 "syscall-exit-stop or vice versa. The rule is that syscall-enter-stop is "
7542 "always followed by syscall-exit-stop, B<PTRACE_EVENT> stop or the tracee's "
7543 "death; no other kinds of ptrace-stop can occur in between."
7547 #: build/C/man2/ptrace.2:1303
7549 "If after syscall-enter-stop, the tracer uses a restarting command other than "
7550 "B<PTRACE_SYSCALL>, syscall-exit-stop is not generated."
7554 #: build/C/man2/ptrace.2:1315
7556 "B<PTRACE_GETSIGINFO> on syscall-stops returns B<SIGTRAP> in I<si_signo>, "
7557 "with I<si_code> set to B<SIGTRAP> or I<(SIGTRAP|0x80)>."
7561 #: build/C/man2/ptrace.2:1315
7563 msgid "PTRACE_SINGLESTEP, PTRACE_SYSEMU, PTRACE_SYSEMU_SINGLESTEP stops"
7568 #. document stops occurring with PTRACE_SINGLESTEP, PTRACE_SYSEMU,
7569 #. PTRACE_SYSEMU_SINGLESTEP
7571 #: build/C/man2/ptrace.2:1321
7572 msgid "[Details of these kinds of stops are yet to be documented.]"
7576 #: build/C/man2/ptrace.2:1321
7578 msgid "Informational and restarting ptrace commands"
7582 #: build/C/man2/ptrace.2:1331
7584 "Most ptrace commands (all except B<PTRACE_ATTACH>, B<PTRACE_SEIZE>, "
7585 "B<PTRACE_TRACEME>, B<PTRACE_INTERRUPT>, and B<PTRACE_KILL>) require the "
7586 "tracee to be in a ptrace-stop, otherwise they fail with B<ESRCH>."
7590 #: build/C/man2/ptrace.2:1336
7592 "When the tracee is in ptrace-stop, the tracer can read and write data to the "
7593 "tracee using informational commands. These commands leave the tracee in "
7594 "ptrace-stopped state:"
7598 #: build/C/man2/ptrace.2:1348
7601 " ptrace(PTRACE_PEEKTEXT/PEEKDATA/PEEKUSER, pid, addr, 0);\n"
7602 " ptrace(PTRACE_POKETEXT/POKEDATA/POKEUSER, pid, addr, long_val);\n"
7603 " ptrace(PTRACE_GETREGS/GETFPREGS, pid, 0, &struct);\n"
7604 " ptrace(PTRACE_SETREGS/SETFPREGS, pid, 0, &struct);\n"
7605 " ptrace(PTRACE_GETREGSET, pid, NT_foo, &iov);\n"
7606 " ptrace(PTRACE_SETREGSET, pid, NT_foo, &iov);\n"
7607 " ptrace(PTRACE_GETSIGINFO, pid, 0, &siginfo);\n"
7608 " ptrace(PTRACE_SETSIGINFO, pid, 0, &siginfo);\n"
7609 " ptrace(PTRACE_GETEVENTMSG, pid, 0, &long_var);\n"
7610 " ptrace(PTRACE_SETOPTIONS, pid, 0, PTRACE_O_flags);\n"
7614 #: build/C/man2/ptrace.2:1360
7616 "Note that some errors are not reported. For example, setting signal "
7617 "information (I<siginfo>) may have no effect in some ptrace-stops, yet the "
7618 "call may succeed (return 0 and not set I<errno>); querying "
7619 "B<PTRACE_GETEVENTMSG> may succeed and return some random value if current "
7620 "ptrace-stop is not documented as returning a meaningful event message."
7624 #: build/C/man2/ptrace.2:1362
7629 #: build/C/man2/ptrace.2:1364
7631 msgid " ptrace(PTRACE_SETOPTIONS, pid, 0, PTRACE_O_flags);\n"
7635 #: build/C/man2/ptrace.2:1373
7637 "affects one tracee. The tracee's current flags are replaced. Flags are "
7638 "inherited by new tracees created and \"auto-attached\" via active "
7639 "B<PTRACE_O_TRACEFORK>, B<PTRACE_O_TRACEVFORK>, or B<PTRACE_O_TRACECLONE> "
7644 #: build/C/man2/ptrace.2:1376
7646 "Another group of commands makes the ptrace-stopped tracee run. They have "
7651 #: build/C/man2/ptrace.2:1378
7653 msgid " ptrace(cmd, pid, 0, sig);\n"
7657 #: build/C/man2/ptrace.2:1399
7659 "where I<cmd> is B<PTRACE_CONT>, B<PTRACE_LISTEN>, B<PTRACE_DETACH>, "
7660 "B<PTRACE_SYSCALL>, B<PTRACE_SINGLESTEP>, B<PTRACE_SYSEMU>, or "
7661 "B<PTRACE_SYSEMU_SINGLESTEP>. If the tracee is in signal-delivery-stop, "
7662 "I<sig> is the signal to be injected (if it is nonzero). Otherwise, I<sig> "
7663 "may be ignored. (When restarting a tracee from a ptrace-stop other than "
7664 "signal-delivery-stop, recommended practice is to always pass 0 in I<sig>.)"
7668 #: build/C/man2/ptrace.2:1399
7670 msgid "Attaching and detaching"
7674 #: build/C/man2/ptrace.2:1401
7675 msgid "A thread can be attached to the tracer using the call"
7679 #: build/C/man2/ptrace.2:1403
7681 msgid " ptrace(PTRACE_ATTACH, pid, 0, 0);\n"
7685 #: build/C/man2/ptrace.2:1405 build/C/man2/ptrace.2:1894
7690 #: build/C/man2/ptrace.2:1407
7692 msgid " ptrace(PTRACE_SEIZE, pid, 0, PTRACE_O_flags);\n"
7696 #. FIXME: Describe how to attach to a thread which is already
7699 #: build/C/man2/ptrace.2:1432
7701 "B<PTRACE_ATTACH> sends B<SIGSTOP> to this thread. If the tracer wants this "
7702 "B<SIGSTOP> to have no effect, it needs to suppress it. Note that if other "
7703 "signals are concurrently sent to this thread during attach, the tracer may "
7704 "see the tracee enter signal-delivery-stop with other signal(s) first! The "
7705 "usual practice is to reinject these signals until B<SIGSTOP> is seen, then "
7706 "suppress B<SIGSTOP> injection. The design bug here is that a ptrace attach "
7707 "and a concurrently delivered B<SIGSTOP> may race and the concurrent "
7708 "B<SIGSTOP> may be lost."
7712 #: build/C/man2/ptrace.2:1439
7714 "Since attaching sends B<SIGSTOP> and the tracer usually suppresses it, this "
7715 "may cause a stray B<EINTR> return from the currently executing system call "
7716 "in the tracee, as described in the \"Signal injection and suppression\" "
7721 #: build/C/man2/ptrace.2:1450
7723 "Since Linux 3.4, B<PTRACE_SEIZE> can be used instead of B<PTRACE_ATTACH>. "
7724 "B<PTRACE_SEIZE> does not stop the attached process. If you need to stop it "
7725 "after attach (or at any other time) without sending it any signals, use "
7726 "B<PTRACE_INTERRUPT> command."
7730 #: build/C/man2/ptrace.2:1452
7735 #: build/C/man2/ptrace.2:1454
7737 msgid " ptrace(PTRACE_TRACEME, 0, 0, 0);\n"
7741 #: build/C/man2/ptrace.2:1460
7743 "turns the calling thread into a tracee. The thread continues to run "
7744 "(doesn't enter ptrace-stop). A common practice is to follow the "
7745 "B<PTRACE_TRACEME> with"
7749 #: build/C/man2/ptrace.2:1462
7751 msgid " raise(SIGSTOP);\n"
7755 #: build/C/man2/ptrace.2:1465
7757 "and allow the parent (which is our tracer now) to observe our "
7758 "signal-delivery-stop."
7762 #: build/C/man2/ptrace.2:1489
7764 "If the B<PTRACE_O_TRACEFORK>, B<PTRACE_O_TRACEVFORK>, or "
7765 "B<PTRACE_O_TRACECLONE> options are in effect, then children created by, "
7766 "respectively, B<vfork>(2) or B<clone>(2) with the B<CLONE_VFORK> flag, "
7767 "B<fork>(2) or B<clone>(2) with the exit signal set to B<SIGCHLD>, and "
7768 "other kinds of B<clone>(2), are automatically attached to the same tracer "
7769 "which traced their parent. B<SIGSTOP> is delivered to the children, causing "
7770 "them to enter signal-delivery-stop after they exit the system call which "
7775 #: build/C/man2/ptrace.2:1491
7776 msgid "Detaching of the tracee is performed by:"
7780 #: build/C/man2/ptrace.2:1493
7782 msgid " ptrace(PTRACE_DETACH, pid, 0, sig);\n"
7786 #: build/C/man2/ptrace.2:1501
7788 "B<PTRACE_DETACH> is a restarting operation; therefore it requires the tracee "
7789 "to be in ptrace-stop. If the tracee is in signal-delivery-stop, a signal "
7790 "can be injected. Otherwise, the I<sig> parameter may be silently ignored."
7793 #. FIXME: Describe how to detach from a group-stopped tracee so that it
7794 #. doesn't run, but continues to wait for SIGCONT.
7796 #: build/C/man2/ptrace.2:1525
7798 "If the tracee is running when the tracer wants to detach it, the usual "
7799 "solution is to send B<SIGSTOP> (using B<tgkill>(2), to make sure it goes to "
7800 "the correct thread), wait for the tracee to stop in signal-delivery-stop for "
7801 "B<SIGSTOP> and then detach it (suppressing B<SIGSTOP> injection). A design "
7802 "bug is that this can race with concurrent B<SIGSTOP>s. Another complication "
7803 "is that the tracee may enter other ptrace-stops and needs to be restarted "
7804 "and waited for again, until B<SIGSTOP> is seen. Yet another complication is "
7805 "to be sure that the tracee is not already ptrace-stopped, because no signal "
7806 "delivery happens while it is\\(emnot even B<SIGSTOP>."
7810 #: build/C/man2/ptrace.2:1533
7812 "If the tracer dies, all tracees are automatically detached and restarted, "
7813 "unless they were in group-stop. Handling of restart from group-stop is "
7814 "currently buggy, but the \"as planned\" behavior is to leave tracee stopped "
7815 "and waiting for B<SIGCONT>. If the tracee is restarted from "
7816 "signal-delivery-stop, the pending signal is injected."
7820 #: build/C/man2/ptrace.2:1533
7822 msgid "execve(2) under ptrace"
7825 #. clone(2) CLONE_THREAD says:
7826 #. If any of the threads in a thread group performs an execve(2),
7827 #. then all threads other than the thread group leader are terminated,
7828 #. and the new program is executed in the thread group leader.
7830 #. In kernel 3.1 sources, see fs/exec.c::de_thread()
7832 #: build/C/man2/ptrace.2:1552
7834 "When one thread in a multithreaded process calls B<execve>(2), the kernel "
7835 "destroys all other threads in the process, and resets the thread ID of the "
7836 "execing thread to the thread group ID (process ID). (Or, to put things "
7837 "another way, when a multithreaded process does an B<execve>(2), at "
7838 "completion of the call, it appears as though the B<execve>(2) occurred in "
7839 "the thread group leader, regardless of which thread did the B<execve>(2).) "
7840 "This resetting of the thread ID looks very confusing to tracers:"
7844 #: build/C/man2/ptrace.2:1562
7846 "All other threads stop in B<PTRACE_EVENT_EXIT> stop, if the "
7847 "B<PTRACE_O_TRACEEXIT> option was turned on. Then all other threads except "
7848 "the thread group leader report death as if they exited via B<_exit>(2) with "
7853 #: build/C/man2/ptrace.2:1570
7855 "The execing tracee changes its thread ID while it is in the B<execve>(2). "
7856 "(Remember, under ptrace, the \"pid\" returned from B<waitpid>(2), or fed "
7857 "into ptrace calls, is the tracee's thread ID.) That is, the tracee's thread "
7858 "ID is reset to be the same as its process ID, which is the same as the "
7859 "thread group leader's thread ID."
7863 #: build/C/man2/ptrace.2:1576
7865 "Then a B<PTRACE_EVENT_EXEC> stop happens, if the B<PTRACE_O_TRACEEXEC> "
7866 "option was turned on."
7870 #: build/C/man2/ptrace.2:1597
7872 "If the thread group leader has reported its B<PTRACE_EVENT_EXIT> stop by "
7873 "this time, it appears to the tracer that the dead thread leader \"reappears "
7874 "from nowhere\". (Note: the thread group leader does not report death via "
7875 "I<WIFEXITED(status)> until there is at least one other live thread. This "
7876 "eliminates the possibility that the tracer will see it dying and then "
7877 "reappearing.) If the thread group leader was still alive, for the tracer "
7878 "this may look as if thread group leader returns from a different system call "
7879 "than it entered, or even \"returned from a system call even though it was "
7880 "not in any system call\". If the thread group leader was not traced (or was "
7881 "traced by a different tracer), then during B<execve>(2) it will appear as "
7882 "if it has become a tracee of the tracer of the execing tracee."
7886 #: build/C/man2/ptrace.2:1600
7888 "All of the above effects are the artifacts of the thread ID change in the "
7893 #: build/C/man2/ptrace.2:1620
7895 "The B<PTRACE_O_TRACEEXEC> option is the recommended tool for dealing with "
7896 "this situation. First, it enables B<PTRACE_EVENT_EXEC> stop, which occurs "
7897 "before B<execve>(2) returns. In this stop, the tracer can use "
7898 "B<PTRACE_GETEVENTMSG> to retrieve the tracee's former thread ID. (This "
7899 "feature was introduced in Linux 3.0). Second, the B<PTRACE_O_TRACEEXEC> "
7900 "option disables legacy B<SIGTRAP> generation on B<execve>(2)."
7904 #: build/C/man2/ptrace.2:1626
7906 "When the tracer receives B<PTRACE_EVENT_EXEC> stop notification, it is "
7907 "guaranteed that except this tracee and the thread group leader, no other "
7908 "threads from the process are alive."
7912 #: build/C/man2/ptrace.2:1634
7914 "On receiving the B<PTRACE_EVENT_EXEC> stop notification, the tracer should "
7915 "clean up all its internal data structures describing the threads of this "
7916 "process, and retain only one data structure\\(emone which describes the "
7917 "single still running tracee, with"
7921 #: build/C/man2/ptrace.2:1636
7923 msgid " thread ID == thread group ID == process ID.\n"
7927 #: build/C/man2/ptrace.2:1640
7928 msgid "Example: two threads call B<execve>(2) at the same time:"
7932 #: build/C/man2/ptrace.2:1651
7935 "*** we get syscall-enter-stop in thread 1: **\n"
7936 "PID1 execve(\"/bin/foo\", \"foo\" E<lt>unfinished ...E<gt>\n"
7937 "*** we issue PTRACE_SYSCALL for thread 1 **\n"
7938 "*** we get syscall-enter-stop in thread 2: **\n"
7939 "PID2 execve(\"/bin/bar\", \"bar\" E<lt>unfinished ...E<gt>\n"
7940 "*** we issue PTRACE_SYSCALL for thread 2 **\n"
7941 "*** we get PTRACE_EVENT_EXEC for PID0, we issue PTRACE_SYSCALL **\n"
7942 "*** we get syscall-exit-stop for PID0: **\n"
7943 "PID0 E<lt>... execve resumedE<gt> ) = 0\n"
7947 #: build/C/man2/ptrace.2:1674
7949 "If the B<PTRACE_O_TRACEEXEC> option is I<not> in effect for the execing "
7950 "tracee, the kernel delivers an extra B<SIGTRAP> to the tracee after "
7951 "B<execve>(2) returns. This is an ordinary signal (similar to one which can "
7952 "be generated by I<kill -TRAP>), not a special kind of ptrace-stop. "
7953 "Employing B<PTRACE_GETSIGINFO> for this signal returns I<si_code> set to 0 "
7954 "(I<SI_USER>). This signal may be blocked by signal mask, and thus may be "
7955 "delivered (much) later."
7959 #: build/C/man2/ptrace.2:1693
7961 "Usually, the tracer (for example, B<strace>(1)) would not want to show this "
7962 "extra post-execve B<SIGTRAP> signal to the user, and would suppress its "
7963 "delivery to the tracee (if B<SIGTRAP> is set to B<SIG_DFL>, it is a killing "
7964 "signal). However, determining I<which> B<SIGTRAP> to suppress is not easy. "
7965 "Setting the B<PTRACE_O_TRACEEXEC> option and thus suppressing this extra "
7966 "B<SIGTRAP> is the recommended approach."
7970 #: build/C/man2/ptrace.2:1693
7976 #: build/C/man2/ptrace.2:1700
7978 "The ptrace API (ab)uses the standard UNIX parent/child signaling over "
7979 "B<waitpid>(2). This used to cause the real parent of the process to stop "
7980 "receiving several kinds of B<waitpid>(2) notifications when the child "
7981 "process is traced by some other process."
7985 #: build/C/man2/ptrace.2:1703
7987 "Many of these bugs have been fixed, but as of Linux 2.6.38 several still "
7988 "exist; see BUGS below."
7992 #: build/C/man2/ptrace.2:1705
7993 msgid "As of Linux 2.6.38, the following is believed to work correctly:"
7997 #: build/C/man2/ptrace.2:1713
7999 "exit/death by signal is reported first to the tracer, then, when the tracer "
8000 "consumes the B<waitpid>(2) result, to the real parent (to the real parent "
8001 "only when the whole multithreaded process exits). If the tracer and the "
8002 "real parent are the same process, the report is sent only once."
8006 #: build/C/man2/ptrace.2:1727
8008 "On success, B<PTRACE_PEEK*> requests return the requested data, while other "
8009 "requests return zero. On error, all requests return -1, and I<errno> is set "
8010 "appropriately. Since the value returned by a successful B<PTRACE_PEEK*> "
8011 "request may be -1, the caller must clear I<errno> before the call, and then "
8012 "check it afterward to determine whether or not an error occurred."
8016 #: build/C/man2/ptrace.2:1731
8017 msgid "(i386 only) There was an error with allocating or freeing a debug register."
8021 #: build/C/man2/ptrace.2:1742
8023 "There was an attempt to read from or write to an invalid area in the "
8024 "tracer's or the tracee's memory, probably because the area wasn't mapped or "
8025 "accessible. Unfortunately, under Linux, different variations of this fault "
8026 "will return B<EIO> or B<EFAULT> more or less arbitrarily."
8030 #: build/C/man2/ptrace.2:1745
8031 msgid "An attempt was made to set an invalid option."
8035 #: build/C/man2/ptrace.2:1752
8037 "I<request> is invalid, or an attempt was made to read from or write to an "
8038 "invalid area in the tracer's or the tracee's memory, or there was a "
8039 "word-alignment violation, or an invalid signal was specified during a "
8044 #: build/C/man2/ptrace.2:1765
8046 "The specified process cannot be traced. This could be because the tracer "
8047 "has insufficient privileges (the required capability is B<CAP_SYS_PTRACE>); "
8048 "unprivileged processes cannot trace processes that they cannot send signals "
8049 "to or those running set-user-ID/set-group-ID programs, for obvious reasons. "
8050 "Alternatively, the process may already be being traced, or (on kernels "
8051 "before 2.6.26) be B<init>(8) (PID 1)."
8055 #: build/C/man2/ptrace.2:1770
8057 "The specified process does not exist, or is not currently being traced by "
8058 "the caller, or is not stopped (for requests that require a stopped tracee)."
8062 #: build/C/man2/ptrace.2:1772
8063 msgid "SVr4, 4.3BSD."
8067 #: build/C/man2/ptrace.2:1787
8069 "Although arguments to B<ptrace>() are interpreted according to the "
8070 "prototype given, glibc currently declares B<ptrace>() as a variadic "
8071 "function with only the I<request> argument fixed. It is recommended to "
8072 "always supply four arguments, even if the requested operation does not use "
8073 "them, setting unused/ignored arguments to I<0L> or I<(void\\ *)\\ 0>."
8076 #. See commit 00cd5c37afd5f431ac186dd131705048c0a11fdb
8078 #: build/C/man2/ptrace.2:1792
8080 "In Linux kernels before 2.6.26, B<init>(8), the process with PID 1, may not "
8084 #. See http://lkml.org/lkml/2008/5/8/375
8086 #: build/C/man2/ptrace.2:1799
8088 "The layout of the contents of memory and the USER area are quite "
8089 "operating-system- and architecture-specific. The offset supplied, and the "
8090 "data returned, might not entirely match with the definition of I<struct "
8095 #: build/C/man2/ptrace.2:1802
8097 "The size of a \"word\" is determined by the operating-system variant (e.g., "
8098 "for 32-bit Linux it is 32 bits)."
8102 #: build/C/man2/ptrace.2:1810
8104 "This page documents the way the B<ptrace>() call works currently in Linux. "
8105 "Its behavior differs noticeably on other flavors of UNIX. In any case, use "
8106 "of B<ptrace>() is highly specific to the operating system and architecture."
8110 #: build/C/man2/ptrace.2:1821
8112 "On hosts with 2.6 kernel headers, B<PTRACE_SETOPTIONS> is declared with a "
8113 "different value than the one for 2.4. This leads to applications compiled "
8114 "with 2.6 kernel headers failing when run on 2.4 kernels. This can be worked "
8115 "around by redefining B<PTRACE_SETOPTIONS> to B<PTRACE_OLDSETOPTIONS>, if "
8120 #: build/C/man2/ptrace.2:1824
8122 "Group-stop notifications are sent to the tracer, but not to real parent. "
8123 "Last confirmed on 2.6.38.6."
8126 #. Note from Denys Vlasenko:
8127 #. Here "exits" means any kind of death - _exit, exit_group,
8128 #. signal death. Signal death and exit_group cases are trivial,
8129 #. though: since signal death and exit_group kill all other threads
8130 #. too, "until all other threads exit" thing happens rather soon
8131 #. in these cases. Therefore, only _exit presents observably
8132 #. puzzling behavior to ptrace users: thread leader _exit's,
8133 #. but WIFEXITED isn't reported! We are trying to explain here
8135 #. FIXME: ^^^ need to test/verify this scenario
8137 #: build/C/man2/ptrace.2:1855
8139 "If a thread group leader is traced and exits by calling B<_exit>(2), a "
8140 "B<PTRACE_EVENT_EXIT> stop will happen for it (if requested), but the "
8141 "subsequent B<WIFEXITED> notification will not be delivered until all other "
8142 "threads exit. As explained above, if one of other threads calls "
8143 "B<execve>(2), the death of the thread group leader will I<never> be "
8144 "reported. If the execed thread is not traced by this tracer, the tracer "
8145 "will never know that B<execve>(2) happened. One possible workaround is to "
8146 "B<PTRACE_DETACH> the thread group leader instead of restarting it in this "
8147 "case. Last confirmed on 2.6.38.6."
8151 #: build/C/man2/ptrace.2:1865
8153 "A B<SIGKILL> signal may still cause a B<PTRACE_EVENT_EXIT> stop before "
8154 "actual signal death. This may be changed in the future; B<SIGKILL> is meant "
8155 "to always immediately kill tasks even under ptrace. Last confirmed on "
8160 #: build/C/man2/ptrace.2:1883
8162 "Some system calls return with B<EINTR> if a signal was sent to a tracee, but "
8163 "delivery was suppressed by the tracer. (This is very typical operation: it "
8164 "is usually done by debuggers on every attach, in order to not introduce a "
8165 "bogus B<SIGSTOP>). As of Linux 3.2.9, the following system calls are "
8166 "affected (this list is likely incomplete): B<epoll_wait>(2), and B<read>(2) "
8167 "from an B<inotify>(7) file descriptor. The usual symptom of this bug is "
8168 "that when you attach to a quiescent process with the command"
8172 #: build/C/man2/ptrace.2:1885
8174 msgid " strace -p E<lt>process-IDE<gt>\n"
8178 #: build/C/man2/ptrace.2:1888
8179 msgid "then, instead of the usual and expected one-line output such as"
8183 #: build/C/man2/ptrace.2:1891
8185 msgid " restart_syscall(E<lt>... resuming interrupted call ...E<gt>_\n"
8189 #: build/C/man2/ptrace.2:1897
8191 msgid " select(6, [5], NULL, [5], NULL_\n"
8195 #: build/C/man2/ptrace.2:1901
8197 "('_' denotes the cursor position), you observe more than one line. For "
8202 #: build/C/man2/ptrace.2:1905
8205 " clock_gettime(CLOCK_MONOTONIC, {15370, 690928118}) = 0\n"
8210 #: build/C/man2/ptrace.2:1926
8212 "What is not visible here is that the process was blocked in B<epoll_wait>(2) "
8213 "before B<strace>(1) has attached to it. Attaching caused B<epoll_wait>(2) "
8214 "to return to user space with the error B<EINTR>. In this particular case, "
8215 "the program reacted to B<EINTR> by checking the current time, and then "
8216 "executing B<epoll_wait>(2) again. (Programs which do not expect such "
8217 "\"stray\" B<EINTR> errors may behave in an unintended way upon an "
8218 "B<strace>(1) attach.)"
8222 #: build/C/man2/ptrace.2:1940
8224 "B<gdb>(1), B<strace>(1), B<clone>(2), B<execve>(2), B<fork>(2), "
8225 "B<gettid>(2), B<sigaction>(2), B<tgkill>(2), B<vfork>(2), B<waitpid>(2), "
8226 "B<exec>(3), B<capabilities>(7), B<signal>(7)"
8230 #: build/C/man2/quotactl.2:27
8236 #: build/C/man2/quotactl.2:27
8242 #: build/C/man2/quotactl.2:30
8243 msgid "quotactl - manipulate disk quotas"
8247 #: build/C/man2/quotactl.2:34
8250 "B<#include E<lt>sys/quota.hE<gt>>\n"
8251 "B<#include E<lt>xfs/xqm.hE<gt>>\n"
8255 #: build/C/man2/quotactl.2:37
8258 "B<int quotactl(int >I<cmd>B<, const char *>I<special>B<, int >I<id>B<, "
8259 "caddr_t >I<addr>B<);>\n"
8263 #: build/C/man2/quotactl.2:49
8265 "The quota system can be used to set per-user and per-group limits on the "
8266 "amount of disk space used on a file system. For each user and/or group, a "
8267 "soft limit and a hard limit can be set for each file system. The hard limit "
8268 "can't be exceeded. The soft limit can be exceeded, but warnings will "
8269 "ensue. Moreover, the user can't exceed the soft limit for more than one "
8270 "week (by default) at a time; after this time, the soft limit counts as a "
8275 #: build/C/man2/quotactl.2:74
8277 "The B<quotactl>() call manipulates disk quotas. The I<cmd> argument "
8278 "indicates a command to be applied to the user or group ID specified in "
8279 "I<id>. To initialize the I<cmd> argument, use the I<QCMD(subcmd, type)> "
8280 "macro. The I<type> value is either B<USRQUOTA>, for user quotas, or "
8281 "B<GRPQUOTA>, for group quotas. The I<subcmd> value is described below."
8285 #: build/C/man2/quotactl.2:79
8287 "The I<special> argument is a pointer to a null-terminated string containing "
8288 "the pathname of the (mounted) block special device for the file system being "
8293 #: build/C/man2/quotactl.2:87
8295 "The I<addr> argument is the address of an optional, command-specific, data "
8296 "structure that is copied in or out of the system. The interpretation of "
8297 "I<addr> is given with each command below."
8301 #: build/C/man2/quotactl.2:91
8302 msgid "The I<subcmd> value is one of the following:"
8306 #: build/C/man2/quotactl.2:91
8308 msgid "B<Q_QUOTAON>"
8312 #: build/C/man2/quotactl.2:98
8314 "Turn on quotas for a file system. The I<id> argument is the identification "
8315 "number of the quota format to be used. Currently, there are three supported "
8320 #: build/C/man2/quotactl.2:99
8322 msgid "B<QFMT_VFS_OLD>"
8326 #: build/C/man2/quotactl.2:102
8327 msgid "The original quota format."
8331 #: build/C/man2/quotactl.2:102
8333 msgid "B<QFMT_VFS_V0>"
8337 #: build/C/man2/quotactl.2:106
8339 "The standard VFS v0 quota format, which can handle 32-bit UIDs and GIDs and "
8340 "quota limits up to 2^42 bytes and 2^32 inodes."
8344 #: build/C/man2/quotactl.2:106
8346 msgid "B<QFMT_VFS_V1>"
8350 #: build/C/man2/quotactl.2:110
8352 "A quota format that can handle 32-bit UIDs and GIDs and quota limits of 2^64 "
8353 "bytes and 2^64 inodes."
8357 #: build/C/man2/quotactl.2:121
8359 "The I<addr> argument points to the pathname of a file containing the quotas "
8360 "for the file system. The quota file must exist; it is normally created with "
8361 "the B<quotacheck>(8) program. This operation requires privilege "
8362 "(B<CAP_SYS_ADMIN>)."
8366 #: build/C/man2/quotactl.2:121
8368 msgid "B<Q_QUOTAOFF>"
8372 #: build/C/man2/quotactl.2:131
8374 "Turn off quotas for a file system. The I<addr> and I<id> arguments are "
8375 "ignored. This operation requires privilege (B<CAP_SYS_ADMIN>)."
8379 #: build/C/man2/quotactl.2:131
8381 msgid "B<Q_GETQUOTA>"
8385 #: build/C/man2/quotactl.2:142
8387 "Get disk quota limits and current usage for user or group I<id>. The "
8388 "I<addr> argument is a pointer to a I<dqblk> structure defined in "
8389 "I<E<lt>sys/quota.hE<gt>> as follows:"
8393 #: build/C/man2/quotactl.2:147 build/C/man2/quotactl.2:234
8396 "/* uint64_t is an unsigned 64-bit integer;\n"
8397 " uint32_t is an unsigned 32-bit integer */\n"
8401 #: build/C/man2/quotactl.2:167
8404 "struct dqblk { /* Definition since Linux 2.4.22 */\n"
8405 " uint64_t dqb_bhardlimit; /* absolute limit on disk\n"
8406 " quota blocks alloc */\n"
8407 " uint64_t dqb_bsoftlimit; /* preferred limit on\n"
8408 " disk quota blocks */\n"
8409 " uint64_t dqb_curspace; /* current quota block\n"
8411 " uint64_t dqb_ihardlimit; /* maximum number of\n"
8412 " allocated inodes */\n"
8413 " uint64_t dqb_isoftlimit; /* preferred inode limit */\n"
8414 " uint64_t dqb_curinodes; /* current number of\n"
8415 " allocated inodes */\n"
8416 " uint64_t dqb_btime; /* time limit for excessive\n"
8418 " uint64_t dqb_itime; /* time limit for excessive\n"
8420 " uint32_t dqb_valid; /* bit mask of QIF_*\n"
8426 #: build/C/man2/quotactl.2:170
8429 "/* Flags in dqb_valid that indicate which fields in\n"
8430 " dqblk structure are valid. */\n"
8434 #: build/C/man2/quotactl.2:181
8437 "#define QIF_BLIMITS 1\n"
8438 "#define QIF_SPACE 2\n"
8439 "#define QIF_ILIMITS 4\n"
8440 "#define QIF_INODES 8\n"
8441 "#define QIF_BTIME 16\n"
8442 "#define QIF_ITIME 32\n"
8443 "#define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS)\n"
8444 "#define QIF_USAGE (QIF_SPACE | QIF_INODES)\n"
8445 "#define QIF_TIMES (QIF_BTIME | QIF_ITIME)\n"
8446 "#define QIF_ALL (QIF_LIMITS | QIF_USAGE | QIF_TIMES)\n"
8450 #: build/C/man2/quotactl.2:198
8452 "The I<dqb_valid> field is a bit mask that is set to indicate the entries in "
8453 "the I<dqblk> structure that are valid. Currently, the kernel fills in all "
8454 "entries of the I<dqblk> structure and marks them as valid in the "
8455 "I<dqb_valid> field. Unprivileged users may retrieve only their own quotas; "
8456 "a privileged user (B<CAP_SYS_ADMIN>) can retrieve the quotas of any user."
8460 #: build/C/man2/quotactl.2:198
8462 msgid "B<Q_SETQUOTA>"
8466 #: build/C/man2/quotactl.2:218
8468 "Set quota information for user or group I<id>, using the information "
8469 "supplied in the I<dqblk> structure pointed to by I<addr>. The I<dqb_valid> "
8470 "field of the I<dqblk> structure indicates which entries in the structure "
8471 "have been set by the caller. This operation supersedes the B<Q_SETQLIM> and "
8472 "B<Q_SETUSE> operations in the previous quota interfaces. This operation "
8473 "requires privilege (B<CAP_SYS_ADMIN>)."
8477 #: build/C/man2/quotactl.2:218
8479 msgid "B<Q_GETINFO>"
8483 #: build/C/man2/quotactl.2:229
8485 "Get information (like grace times) about quotafile. The I<addr> argument "
8486 "should be a pointer to a I<dqinfo> structure. This structure is defined in "
8487 "I<E<lt>sys/quota.hE<gt>> as follows:"
8491 #: build/C/man2/quotactl.2:238
8494 "struct dqinfo { /* Defined since kernel 2.4.22 */\n"
8495 " uint64_t dqi_bgrace; /* Time before block soft limit\n"
8496 " becomes hard limit */\n"
8500 #: build/C/man2/quotactl.2:245
8503 " uint64_t dqi_igrace; /* Time before inode soft limit\n"
8504 " becomes hard limit */\n"
8505 " uint32_t dqi_flags; /* Flags for quotafile\n"
8507 " uint32_t dqi_valid;\n"
8512 #: build/C/man2/quotactl.2:247
8514 msgid "/* Bits for dqi_flags */\n"
8518 #: build/C/man2/quotactl.2:249
8520 msgid "/* Quota format QFMT_VFS_OLD */\n"
8524 #: build/C/man2/quotactl.2:251
8526 msgid "#define V1_DQF_RSQUASH\t1 /* Root squash enabled */\n"
8530 #: build/C/man2/quotactl.2:253
8532 msgid "/* Other quota formats have no dqi_flags bits defined */\n"
8536 #: build/C/man2/quotactl.2:256
8539 "/* Flags in dqi_valid that indicate which fields in\n"
8540 " dqinfo structure are valid. */\n"
8544 #: build/C/man2/quotactl.2:261
8547 "# define IIF_BGRACE\t1\n"
8548 "# define IIF_IGRACE\t2\n"
8549 "# define IIF_FLAGS\t4\n"
8550 "# define IIF_ALL\t(IIF_BGRACE | IIF_IGRACE | IIF_FLAGS)\n"
8554 #: build/C/man2/quotactl.2:277
8556 "The I<dqi_valid> field in the I<dqinfo> structure indicates the entries in "
8557 "the structure that are valid. Currently, the kernel fills in all entries of "
8558 "the I<dqinfo> structure and marks them all as valid in the I<dqi_valid> "
8559 "field. The I<id> argument is ignored."
8563 #: build/C/man2/quotactl.2:277
8565 msgid "B<Q_SETINFO>"
8569 #: build/C/man2/quotactl.2:301
8571 "Set information about quotafile. The I<addr> argument should be a pointer "
8572 "to a I<dqinfo> structure. The I<dqi_valid> field of the I<dqinfo> structure "
8573 "indicates the entries in the structure that have been set by the caller. "
8574 "This operation supersedes the B<Q_SETGRACE> and B<Q_SETFLAGS> operations in "
8575 "the previous quota interfaces. The I<id> argument is ignored. This "
8576 "operation requires privilege (B<CAP_SYS_ADMIN>)."
8580 #: build/C/man2/quotactl.2:301
8586 #: build/C/man2/quotactl.2:308
8588 "Get quota format used on the specified file system. The I<addr> argument "
8589 "should be a pointer to a 4-byte buffer where the format number will be "
8594 #: build/C/man2/quotactl.2:308
8600 #: build/C/man2/quotactl.2:319
8602 "Update the on-disk copy of quota usages for a file system. If I<special> is "
8603 "NULL, then all file systems with active quotas are sync'ed. The I<addr> and "
8604 "I<id> arguments are ignored."
8608 #: build/C/man2/quotactl.2:319
8610 msgid "B<Q_GETSTATS>"
8613 #. Q_GETSTATS was removed in kernel 2.4.22.
8615 #: build/C/man2/quotactl.2:339
8617 "Get statistics and other generic information about the quota subsystem. The "
8618 "I<addr> argument should be a pointer to a I<dqstats> structure in which data "
8619 "should be stored. This structure is defined in I<E<lt>sys/quota.hE<gt>.> "
8620 "The I<special> and I<id> arguments are ignored. This operation is obsolete "
8621 "and not supported by recent kernels. Files in I</proc/sys/fs/quota/> carry "
8622 "the information instead."
8626 #: build/C/man2/quotactl.2:342
8628 "For XFS file systems making use of the XFS Quota Manager (XQM), the above "
8629 "commands are bypassed and the following commands are used:"
8633 #: build/C/man2/quotactl.2:342
8635 msgid "B<Q_XQUOTAON>"
8639 #: build/C/man2/quotactl.2:363
8641 "Turn on quotas for an XFS file system. XFS provides the ability to turn "
8642 "on/off quota limit enforcement with quota accounting. Therefore, XFS "
8643 "expects I<addr> to be a pointer to an I<unsigned int> that contains either "
8644 "the flags B<XFS_QUOTA_UDQ_ACCT> and/or B<XFS_QUOTA_UDQ_ENFD> (for user "
8645 "quota), or B<XFS_QUOTA_GDQ_ACCT> and/or B<XFS_QUOTA_GDQ_ENFD> (for group "
8646 "quota), as defined in I<E<lt>xfs/xqm.hE<gt>>. This operation requires "
8647 "privilege (B<CAP_SYS_ADMIN>)."
8651 #: build/C/man2/quotactl.2:363
8653 msgid "B<Q_XQUOTAOFF>"
8657 #: build/C/man2/quotactl.2:374
8659 "Turn off quotas for an XFS file system. As with B<Q_QUOTAON>, XFS file "
8660 "systems expect a pointer to an I<unsigned int> that specifies whether quota "
8661 "accounting and/or limit enforcement need to be turned off. This operation "
8662 "requires privilege (B<CAP_SYS_ADMIN>)."
8666 #: build/C/man2/quotactl.2:374
8668 msgid "B<Q_XGETQUOTA>"
8672 #: build/C/man2/quotactl.2:388
8674 "Get disk quota limits and current usage for user I<id>. The I<addr> "
8675 "argument is a pointer to an I<fs_disk_quota> structure (defined in "
8676 "I<E<lt>xfs/xqm.hE<gt>>). Unprivileged users may retrieve only their own "
8677 "quotas; a privileged user (B<CAP_SYS_ADMIN>) may retrieve the quotas of any "
8682 #: build/C/man2/quotactl.2:388
8684 msgid "B<Q_XSETQLIM>"
8688 #: build/C/man2/quotactl.2:400
8690 "Set disk quota limits for user I<id>. The I<addr> argument is a pointer to "
8691 "an I<fs_disk_quota> structure (defined in I<E<lt>xfs/xqm.hE<gt>>). This "
8692 "operation requires privilege (B<CAP_SYS_ADMIN>)."
8696 #: build/C/man2/quotactl.2:400
8698 msgid "B<Q_XGETQSTAT>"
8702 #: build/C/man2/quotactl.2:408
8704 "Returns an I<fs_quota_stat> structure containing XFS file system specific "
8705 "quota information. This is useful for finding out how much space is used to "
8706 "store quota information, and also to get quotaon/off status of a given local "
8711 #: build/C/man2/quotactl.2:408
8713 msgid "B<Q_XQUOTARM>"
8717 #: build/C/man2/quotactl.2:412
8719 "Free the disk space taken by disk quotas. Quotas must have already been "
8724 #: build/C/man2/quotactl.2:419
8726 "There is no command equivalent to B<Q_SYNC> for XFS since B<sync>(1) writes "
8727 "quota information to disk (in addition to the other file system metadata "
8728 "that it writes out)."
8732 #: build/C/man2/quotactl.2:419
8734 msgid "RETURN VALUES"
8738 #: build/C/man2/quotactl.2:427
8740 "On success, B<quotactl>() returns 0; on error -1 is returned, and I<errno> "
8741 "is set to indicate the error."
8745 #: build/C/man2/quotactl.2:434
8746 msgid "I<addr> or I<special> is invalid."
8750 #: build/C/man2/quotactl.2:440
8751 msgid "I<cmd> or I<type> is invalid."
8755 #: build/C/man2/quotactl.2:440
8761 #: build/C/man2/quotactl.2:447
8762 msgid "The file specified by I<special> or I<addr> does not exist."
8766 #: build/C/man2/quotactl.2:452
8767 msgid "The kernel has not been compiled with the B<CONFIG_QUOTA> option."
8771 #: build/C/man2/quotactl.2:452
8777 #: build/C/man2/quotactl.2:456
8778 msgid "I<special> is not a block device."
8782 #: build/C/man2/quotactl.2:461
8784 "The caller lacked the required privilege (B<CAP_SYS_ADMIN>) for the "
8785 "specified operation."
8789 #: build/C/man2/quotactl.2:465
8791 "No disk quota is found for the indicated user. Quotas have not been turned "
8792 "on for this file system."
8796 #: build/C/man2/quotactl.2:474
8797 msgid "If I<cmd> is B<Q_SETQUOTA>, B<quotactl>() may also set I<errno> to:"
8801 #: build/C/man2/quotactl.2:477
8802 msgid "Specified limits are out of range allowed by quota format."
8806 #: build/C/man2/quotactl.2:486
8807 msgid "If I<cmd> is B<Q_QUOTAON>, B<quotactl>() may also set I<errno> to:"
8811 #: build/C/man2/quotactl.2:495
8813 "The quota file pointed to by I<addr> exists, but is not a regular file; or, "
8814 "the quota file pointed to by I<addr> exists, but is not on the file system "
8815 "pointed to by I<special>."
8819 #: build/C/man2/quotactl.2:501
8820 msgid "B<Q_QUOTAON> attempted, but another B<Q_QUOTAON> had already been performed."
8824 #: build/C/man2/quotactl.2:504
8825 msgid "The quota file is corrupted."
8829 #: build/C/man2/quotactl.2:507
8830 msgid "Specified quota format was not found."
8834 #: build/C/man2/quotactl.2:512
8835 msgid "B<quota>(1), B<getrlimit>(2), B<quotacheck>(8), B<quotaon>(8)"
8839 #: build/C/man2/sendfile.2:19
8845 #: build/C/man2/sendfile.2:19
8851 #: build/C/man2/sendfile.2:22
8852 msgid "sendfile - transfer data between file descriptors"
8856 #: build/C/man2/sendfile.2:24
8857 msgid "B<#include E<lt>sys/sendfile.hE<gt>>"
8860 #. The below is too ugly. Comments about glibc versions belong
8861 #. in the notes, not in the header.
8863 #. .B #include <features.h>
8865 #. .B #if (__GLIBC__==2 && __GLIBC_MINOR__>=1) || __GLIBC__>2
8867 #. .B #include <sys/sendfile.h>
8871 #. .B #include <sys/types.h>
8873 #. .B /* No system prototype before glibc 2.1. */
8875 #. .BI "ssize_t sendfile(int" " out_fd" ", int" " in_fd" ", off_t *" \
8876 #. offset ", size_t" " count" )
8880 #: build/C/man2/sendfile.2:47
8882 "B<ssize_t sendfile(int>I< out_fd>B<, int>I< in_fd>B<, off_t *>I<offset>B<, "
8883 "size_t>I< count>B<);>"
8887 #: build/C/man2/sendfile.2:57
8889 "B<sendfile>() copies data between one file descriptor and another. Because "
8890 "this copying is done within the kernel, B<sendfile>() is more efficient "
8891 "than the combination of B<read>(2) and B<write>(2), which would require "
8892 "transferring data to and from user space."
8896 #: build/C/man2/sendfile.2:62
8898 "I<in_fd> should be a file descriptor opened for reading and I<out_fd> should "
8899 "be a descriptor opened for writing."
8903 #: build/C/man2/sendfile.2:83
8905 "If I<offset> is not NULL, then it points to a variable holding the file "
8906 "offset from which B<sendfile>() will start reading data from I<in_fd>. "
8907 "When B<sendfile>() returns, this variable will be set to the offset of the "
8908 "byte following the last byte that was read. If I<offset> is not NULL, then "
8909 "B<sendfile>() does not modify the current file offset of I<in_fd>; "
8910 "otherwise the current file offset is adjusted to reflect the number of bytes "
8911 "read from I<in_fd>."
8915 #: build/C/man2/sendfile.2:90
8917 "If I<offset> is NULL, then data will be read from I<in_fd> starting at the "
8918 "current file offset, and the file offset will be updated by the call."
8922 #: build/C/man2/sendfile.2:93
8923 msgid "I<count> is the number of bytes to copy between the file descriptors."
8927 #: build/C/man2/sendfile.2:100
8929 "The I<in_fd> argument must correspond to a file which supports "
8930 "B<mmap>(2)-like operations (i.e., it cannot be a socket)."
8934 #: build/C/man2/sendfile.2:108
8936 "In Linux kernels before 2.6.33, I<out_fd> must refer to a socket. Since "
8937 "Linux 2.6.33 it can be any file. If it is a regular file, then "
8938 "B<sendfile>() changes the file offset appropriately."
8942 #: build/C/man2/sendfile.2:115
8944 "If the transfer was successful, the number of bytes written to I<out_fd> is "
8945 "returned. On error, -1 is returned, and I<errno> is set appropriately."
8949 #: build/C/man2/sendfile.2:121
8951 "Nonblocking I/O has been selected using B<O_NONBLOCK> and the write would "
8956 #: build/C/man2/sendfile.2:121 build/C/man2/splice.2:143 build/C/man2/vmsplice.2:123
8962 #: build/C/man2/sendfile.2:125
8964 "The input file was not opened for reading or the output file was not opened "
8969 #: build/C/man2/sendfile.2:128
8970 msgid "Bad address."
8974 #: build/C/man2/sendfile.2:134
8976 "Descriptor is not valid or locked, or an B<mmap>(2)-like operation is not "
8977 "available for I<in_fd>."
8981 #: build/C/man2/sendfile.2:138
8982 msgid "Unspecified error while reading from I<in_fd>."
8986 #: build/C/man2/sendfile.2:142
8987 msgid "Insufficient memory to read from I<in_fd>."
8991 #: build/C/man2/sendfile.2:148
8993 "B<sendfile>() is a new feature in Linux 2.2. The include file "
8994 "I<E<lt>sys/sendfile.hE<gt>> is present since glibc 2.1."
8998 #: build/C/man2/sendfile.2:150
8999 msgid "Not specified in POSIX.1-2001, or other standards."
9003 #: build/C/man2/sendfile.2:155
9005 "Other UNIX systems implement B<sendfile>() with different semantics and "
9006 "prototypes. It should not be used in portable programs."
9010 #: build/C/man2/sendfile.2:165
9012 "If you plan to use B<sendfile>() for sending files to a TCP socket, but "
9013 "need to send some header data in front of the file contents, you will find "
9014 "it useful to employ the B<TCP_CORK> option, described in B<tcp>(7), to "
9015 "minimize the number of packets and to tune performance."
9019 #: build/C/man2/sendfile.2:171
9021 "In Linux 2.4 and earlier, I<out_fd> could also refer to a regular file, and "
9022 "B<sendfile>() changed the current offset of that file."
9026 #: build/C/man2/sendfile.2:183
9028 "The original Linux B<sendfile>() system call was not designed to handle "
9029 "large file offsets. Consequently, Linux 2.4 added B<sendfile64>(), with a "
9030 "wider type for the I<offset> argument. The glibc B<sendfile>() wrapper "
9031 "function transparently deals with the kernel differences."
9035 #: build/C/man2/sendfile.2:192
9037 "Applications may wish to fall back to B<read>(2)/B<write>(2) in the case "
9038 "where B<sendfile>() fails with B<EINVAL> or B<ENOSYS>."
9042 #: build/C/man2/sendfile.2:197
9044 "The Linux-specific B<splice>(2) call supports transferring data between "
9045 "arbitrary files (e.g., a pair of sockets)."
9049 #: build/C/man2/sendfile.2:202
9050 msgid "B<mmap>(2), B<open>(2), B<socket>(2), B<splice>(2)"
9054 #: build/C/man2/set_tid_address.2:25
9056 msgid "SET_TID_ADDRESS"
9060 #: build/C/man2/set_tid_address.2:25
9066 #: build/C/man2/set_tid_address.2:28
9067 msgid "set_tid_address - set pointer to thread ID"
9071 #: build/C/man2/set_tid_address.2:31
9073 msgid "B<#include E<lt>linux/unistd.hE<gt>>\n"
9077 #: build/C/man2/set_tid_address.2:33
9079 msgid "B<long set_tid_address(int *>I<tidptr>B<);>\n"
9083 #: build/C/man2/set_tid_address.2:40
9085 "For each process, the kernel maintains two attributes (addresses) called "
9086 "I<set_child_tid> and I<clear_child_tid>. These two attributes contain the "
9087 "value NULL by default."
9091 #: build/C/man2/set_tid_address.2:40
9093 msgid "I<set_child_tid>"
9097 #: build/C/man2/set_tid_address.2:51
9099 "If a process is started using B<clone>(2) with the B<CLONE_CHILD_SETTID> "
9100 "flag, I<set_child_tid> is set to the value passed in the I<ctid> argument of "
9105 #: build/C/man2/set_tid_address.2:56
9107 "When I<set_child_tid> is set, the very first thing the new process does is "
9108 "writing its PID at this address."
9112 #: build/C/man2/set_tid_address.2:56
9114 msgid "I<clear_child_tid>"
9118 #: build/C/man2/set_tid_address.2:67
9120 "If a process is started using B<clone>(2) with the B<CLONE_CHILD_CLEARTID> "
9121 "flag, I<clear_child_tid> is set to the value passed in the I<ctid> argument "
9122 "of that system call."
9126 #: build/C/man2/set_tid_address.2:74
9128 "The system call B<set_tid_address>() sets the I<clear_child_tid> value for "
9129 "the calling process to I<tidptr>."
9133 #: build/C/man2/set_tid_address.2:82
9135 "When a process whose I<clear_child_tid> is not NULL terminates, then, if the "
9136 "process is sharing memory with other processes or threads, then 0 is written "
9137 "at the address specified in I<clear_child_tid> and the kernel performs the "
9138 "following operation:"
9142 #: build/C/man2/set_tid_address.2:84
9144 msgid " futex(clear_child_tid, FUTEX_WAKE, 1, NULL, NULL, 0);\n"
9148 #: build/C/man2/set_tid_address.2:88
9150 "The effect of this operation is to wake a single process that is performing "
9151 "a futex wait on the memory location. Errors from the futex wake operation "
9156 #: build/C/man2/set_tid_address.2:91
9157 msgid "B<set_tid_address>() always returns the PID of the calling process."
9161 #: build/C/man2/set_tid_address.2:94
9162 msgid "B<set_tid_address>() always succeeds."
9166 #: build/C/man2/set_tid_address.2:97
9168 "This call is present since Linux 2.5.48. Details as given here are valid "
9169 "since Linux 2.5.49."
9173 #: build/C/man2/set_tid_address.2:102
9174 msgid "B<clone>(2), B<futex>(2)"
9178 #: build/C/man2/splice.2:26
9184 #: build/C/man2/splice.2:26 build/C/man2/tee.2:26 build/C/man2/vmsplice.2:26
9190 #: build/C/man2/splice.2:29
9191 msgid "splice - splice data to/from a pipe"
9195 #: build/C/man2/splice.2:33 build/C/man2/tee.2:33
9198 "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n"
9199 "B<#include E<lt>fcntl.hE<gt>>\n"
9202 #. Return type was long before glibc 2.7
9204 #: build/C/man2/splice.2:38
9207 "B<ssize_t splice(int >I<fd_in>B<, loff_t *>I<off_in>B<, int >I<fd_out>B<,>\n"
9208 "B< loff_t *>I<off_out>B<, size_t >I<len>B<, unsigned int "
9213 #: build/C/man2/splice.2:50
9215 "B<splice>() moves data between two file descriptors without copying between "
9216 "kernel address space and user address space. It transfers up to I<len> "
9217 "bytes of data from the file descriptor I<fd_in> to the file descriptor "
9218 "I<fd_out>, where one of the descriptors must refer to a pipe."
9222 #: build/C/man2/splice.2:80
9224 "If I<fd_in> refers to a pipe, then I<off_in> must be NULL. If I<fd_in> does "
9225 "not refer to a pipe and I<off_in> is NULL, then bytes are read from I<fd_in> "
9226 "starting from the current file offset, and the current file offset is "
9227 "adjusted appropriately. If I<fd_in> does not refer to a pipe and I<off_in> "
9228 "is not NULL, then I<off_in> must point to a buffer which specifies the "
9229 "starting offset from which bytes will be read from I<fd_in>; in this case, "
9230 "the current file offset of I<fd_in> is not changed. Analogous statements "
9231 "apply for I<fd_out> and I<off_out>."
9235 #: build/C/man2/splice.2:85 build/C/man2/vmsplice.2:78
9237 "The I<flags> argument is a bit mask that is composed by ORing together zero "
9238 "or more of the following values:"
9242 #: build/C/man2/splice.2:85 build/C/man2/tee.2:62 build/C/man2/vmsplice.2:78
9244 msgid "B<SPLICE_F_MOVE>"
9248 #: build/C/man2/splice.2:98
9250 "Attempt to move pages instead of copying. This is only a hint to the "
9251 "kernel: pages may still be copied if the kernel cannot move the pages from "
9252 "the pipe, or if the pipe buffers don't refer to full pages. The initial "
9253 "implementation of this flag was buggy: therefore starting in Linux 2.6.21 it "
9254 "is a no-op (but is still permitted in a B<splice>() call); in the future, a "
9255 "correct implementation may be restored."
9259 #: build/C/man2/splice.2:98 build/C/man2/tee.2:68 build/C/man2/vmsplice.2:84
9261 msgid "B<SPLICE_F_NONBLOCK>"
9265 #: build/C/man2/splice.2:107
9267 "Do not block on I/O. This makes the splice pipe operations nonblocking, but "
9268 "B<splice>() may nevertheless block because the file descriptors that are "
9269 "spliced to/from may block (unless they have the B<O_NONBLOCK> flag set)."
9273 #: build/C/man2/splice.2:107 build/C/man2/tee.2:73 build/C/man2/vmsplice.2:91
9275 msgid "B<SPLICE_F_MORE>"
9279 #: build/C/man2/splice.2:121
9281 "More data will be coming in a subsequent splice. This is a helpful hint "
9282 "when the I<fd_out> refers to a socket (see also the description of "
9283 "B<MSG_MORE> in B<send>(2), and the description of B<TCP_CORK> in B<tcp>(7))"
9287 #: build/C/man2/splice.2:121 build/C/man2/tee.2:79 build/C/man2/vmsplice.2:97
9289 msgid "B<SPLICE_F_GIFT>"
9293 #: build/C/man2/splice.2:127
9294 msgid "Unused for B<splice>(); see B<vmsplice>(2)."
9298 #: build/C/man2/splice.2:136
9300 "Upon successful completion, B<splice>() returns the number of bytes spliced "
9301 "to or from the pipe. A return value of 0 means that there was no data to "
9302 "transfer, and it would not make sense to block, because there are no writers "
9303 "connected to the write end of the pipe referred to by I<fd_in>."
9307 #: build/C/man2/splice.2:142
9308 msgid "On error, B<splice>() returns -1 and I<errno> is set to indicate the error."
9312 #: build/C/man2/splice.2:147
9314 "One or both file descriptors are not valid, or do not have proper read-write "
9318 #. The append-mode error is given since 2.6.27; in earlier kernels,
9319 #. splice() in append mode was broken
9321 #: build/C/man2/splice.2:155
9323 "Target file system doesn't support splicing; target file is opened in append "
9324 "mode; neither of the descriptors refers to a pipe; or offset given for "
9325 "nonseekable device."
9329 #: build/C/man2/splice.2:158 build/C/man2/tee.2:114 build/C/man2/vmsplice.2:138
9330 msgid "Out of memory."
9334 #: build/C/man2/splice.2:158
9340 #: build/C/man2/splice.2:165
9342 "Either I<off_in> or I<off_out> was not NULL, but the corresponding file "
9343 "descriptor refers to a pipe."
9347 #: build/C/man2/splice.2:170
9349 "The B<splice>() system call first appeared in Linux 2.6.17; library support "
9350 "was added to glibc in version 2.5."
9354 #: build/C/man2/splice.2:182
9356 "The three system calls B<splice>(), B<vmsplice>(2), and B<tee>(2), provide "
9357 "user-space programs with full control over an arbitrary kernel buffer, "
9358 "implemented within the kernel using the same type of buffer that is used for "
9359 "a pipe. In overview, these system calls perform the following tasks:"
9363 #: build/C/man2/splice.2:182
9369 #: build/C/man2/splice.2:186
9371 "moves data from the buffer to an arbitrary file descriptor, or vice versa, "
9372 "or from one buffer to another."
9376 #: build/C/man2/splice.2:186
9382 #: build/C/man2/splice.2:189
9383 msgid "\"copies\" the data from one buffer to another."
9387 #: build/C/man2/splice.2:189
9389 msgid "B<vmsplice>(2)"
9393 #: build/C/man2/splice.2:192
9394 msgid "\"copies\" data from user space into the buffer."
9398 #. Linus: Now, imagine using the above in a media server, for example.
9399 #. Let's say that a year or two has passed, so that the video drivers
9400 #. have been updated to be able to do the splice thing, and what can
9403 #. - splice from the (mpeg or whatever - let's just assume that the video
9404 #. input is either digital or does the encoding on its own - like they
9405 #. pretty much all do) video input into a pipe (remember: no copies - the
9406 #. video input will just DMA directly into memory, and splice will just
9407 #. set up the pages in the pipe buffer)
9408 #. - tee that pipe to split it up
9409 #. - splice one end to a file (ie "save the compressed stream to disk")
9410 #. - splice the other end to a real-time video decoder window for your
9411 #. real-time viewing pleasure.
9413 #. Linus: Now, the advantage of splice()/tee() is that you can
9414 #. do zero-copy movement of data, and unlike sendfile() you can
9415 #. do it on _arbitrary_ data (and, as shown by "tee()", it's more
9416 #. than just sending the data to somebody else: you can duplicate
9417 #. the data and choose to forward it to two or more different
9418 #. users - for things like logging etc.).
9420 #: build/C/man2/splice.2:223
9422 "Though we talk of copying, actual copies are generally avoided. The kernel "
9423 "does this by implementing a pipe buffer as a set of reference-counted "
9424 "pointers to pages of kernel memory. The kernel creates \"copies\" of pages "
9425 "in a buffer by creating new pointers (for the output buffer) referring to "
9426 "the pages, and increasing the reference counts for the pages: only pointers "
9427 "are copied, not the pages of the buffer."
9431 #: build/C/man2/splice.2:226
9432 msgid "See B<tee>(2)."
9436 #: build/C/man2/splice.2:230
9437 msgid "B<sendfile>(2), B<tee>(2), B<vmsplice>(2)"
9441 #: build/C/man2/tee.2:26
9447 #: build/C/man2/tee.2:29
9448 msgid "tee - duplicating pipe content"
9452 #: build/C/man2/tee.2:36
9455 "B<ssize_t tee(int >I<fd_in>B<, int >I<fd_out>B<, size_t >I<len>B<, unsigned "
9456 "int >I<flags>B<);>\n"
9459 #. Example programs http://brick.kernel.dk/snaps
9462 #. add a "tee(in, out1, out2)" system call that duplicates the pages
9463 #. (again, incrementing their reference count, not copying the data) from
9464 #. one pipe to two other pipes.
9466 #: build/C/man2/tee.2:56
9468 "B<tee>() duplicates up to I<len> bytes of data from the pipe referred to by "
9469 "the file descriptor I<fd_in> to the pipe referred to by the file descriptor "
9470 "I<fd_out>. It does not consume the data that is duplicated from I<fd_in>; "
9471 "therefore, that data can be copied by a subsequent B<splice>(2)."
9475 #: build/C/man2/tee.2:62
9477 "I<flags> is a series of modifier flags, which share the name space with "
9478 "B<splice>(2) and B<vmsplice>(2):"
9482 #: build/C/man2/tee.2:68
9483 msgid "Currently has no effect for B<tee>(); see B<splice>(2)."
9486 #. Not used for vmsplice
9487 #. May be in the future -- therefore EAGAIN
9489 #: build/C/man2/tee.2:73 build/C/man2/vmsplice.2:91
9490 msgid "Do not block on I/O; see B<splice>(2) for further details."
9494 #: build/C/man2/tee.2:79
9496 "Currently has no effect for B<tee>(), but may be implemented in the future; "
9501 #: build/C/man2/tee.2:85
9502 msgid "Unused for B<tee>(); see B<vmsplice>(2)."
9506 #: build/C/man2/tee.2:94
9508 "Upon successful completion, B<tee>() returns the number of bytes that were "
9509 "duplicated between the input and output. A return value of 0 means that "
9510 "there was no data to transfer, and it would not make sense to block, because "
9511 "there are no writers connected to the write end of the pipe referred to by "
9516 #: build/C/man2/tee.2:100
9517 msgid "On error, B<tee>() returns -1 and I<errno> is set to indicate the error."
9521 #: build/C/man2/tee.2:111
9523 "I<fd_in> or I<fd_out> does not refer to a pipe; or I<fd_in> and I<fd_out> "
9524 "refer to the same pipe."
9528 #: build/C/man2/tee.2:119
9530 "The B<tee>() system call first appeared in Linux 2.6.17; library support "
9531 "was added to glibc in version 2.5."
9535 #: build/C/man2/tee.2:130
9537 "Conceptually, B<tee>() copies the data between the two pipes. In reality "
9538 "no real data copying takes place though: under the covers, B<tee>() assigns "
9539 "data in the output by merely grabbing a reference to the input."
9543 #: build/C/man2/tee.2:136
9545 "The following example implements a basic B<tee>(1) program using the "
9546 "B<tee>() system call."
9550 #: build/C/man2/tee.2:145
9553 "#define _GNU_SOURCE\n"
9554 "#include E<lt>fcntl.hE<gt>\n"
9555 "#include E<lt>stdio.hE<gt>\n"
9556 "#include E<lt>stdlib.hE<gt>\n"
9557 "#include E<lt>unistd.hE<gt>\n"
9558 "#include E<lt>errno.hE<gt>\n"
9559 "#include E<lt>limits.hE<gt>\n"
9563 #: build/C/man2/tee.2:151
9567 "main(int argc, char *argv[])\n"
9574 #: build/C/man2/tee.2:156
9577 " if (argc != 2) {\n"
9578 " fprintf(stderr, \"Usage: %s E<lt>fileE<gt>\\en\", argv[0]);\n"
9579 " exit(EXIT_FAILURE);\n"
9584 #: build/C/man2/tee.2:162
9587 " fd = open(argv[1], O_WRONLY | O_CREAT | O_TRUNC, 0644);\n"
9588 " if (fd == -1) {\n"
9589 " perror(\"open\");\n"
9590 " exit(EXIT_FAILURE);\n"
9595 #: build/C/man2/tee.2:169
9600 " * tee stdin to stdout.\n"
9602 " len = tee(STDIN_FILENO, STDOUT_FILENO,\n"
9603 " INT_MAX, SPLICE_F_NONBLOCK);\n"
9607 #: build/C/man2/tee.2:178
9610 " if (len E<lt> 0) {\n"
9611 " if (errno == EAGAIN)\n"
9613 " perror(\"tee\");\n"
9614 " exit(EXIT_FAILURE);\n"
9621 #: build/C/man2/tee.2:192
9625 " * Consume stdin by splicing it to a file.\n"
9627 " while (len E<gt> 0) {\n"
9628 " slen = splice(STDIN_FILENO, NULL, fd, NULL,\n"
9629 " len, SPLICE_F_MOVE);\n"
9630 " if (slen E<lt> 0) {\n"
9631 " perror(\"splice\");\n"
9640 #: build/C/man2/tee.2:196
9644 " exit(EXIT_SUCCESS);\n"
9649 #: build/C/man2/tee.2:200
9650 msgid "B<splice>(2), B<vmsplice>(2)"
9654 #: build/C/man2/vm86.2:26
9660 #: build/C/man2/vm86.2:26
9666 #: build/C/man2/vm86.2:29
9667 msgid "vm86old, vm86 - enter virtual 8086 mode"
9671 #: build/C/man2/vm86.2:31
9672 msgid "B<#include E<lt>sys/vm86.hE<gt>>"
9676 #: build/C/man2/vm86.2:33
9677 msgid "B<int vm86old(struct vm86_struct *>I<info>B<);>"
9681 #: build/C/man2/vm86.2:35
9682 msgid "B<int vm86(unsigned long >I<fn>B<, struct vm86plus_struct *>I<v86>B<);>"
9686 #: build/C/man2/vm86.2:46
9688 "The system call B<vm86>() was introduced in Linux 0.97p2. In Linux 2.1.15 "
9689 "and 2.0.28 it was renamed to B<vm86old>(), and a new B<vm86>() was "
9690 "introduced. The definition of I<struct vm86_struct> was changed in 1.1.8 "
9695 #: build/C/man2/vm86.2:50
9697 "These calls cause the process to enter VM86 mode (virtual-8086 in Intel "
9698 "literature), and are used by B<dosemu>."
9702 #: build/C/man2/vm86.2:52
9703 msgid "VM86 mode is an emulation of real mode within a protected mode task."
9707 #: build/C/man2/vm86.2:62
9709 "This return value is specific to i386 and indicates a problem with getting "
9714 #: build/C/man2/vm86.2:66
9716 "This return value indicates the call is not implemented on the present "
9721 #: build/C/man2/vm86.2:71
9723 "Saved kernel stack exists. (This is a kernel sanity check; the saved stack "
9724 "should only exist within vm86 mode itself.)"
9728 #: build/C/man2/vm86.2:74
9730 "This call is specific to Linux on 32-bit Intel processors, and should not be "
9731 "used in programs intended to be portable."
9735 #: build/C/man2/vmsplice.2:26
9741 #: build/C/man2/vmsplice.2:29
9742 msgid "vmsplice - splice user pages into a pipe"
9746 #: build/C/man2/vmsplice.2:34
9749 "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n"
9750 "B<#include E<lt>fcntl.hE<gt>>\n"
9751 "B<#include E<lt>sys/uio.hE<gt>>\n"
9755 #: build/C/man2/vmsplice.2:37
9758 "B<ssize_t vmsplice(int >I<fd>B<, const struct iovec *>I<iov>B<,>\n"
9759 "B< unsigned long >I<nr_segs>B<, unsigned int "
9763 #. Linus: vmsplice() system call to basically do a "write to
9764 #. the buffer", but using the reference counting and VM traversal
9765 #. to actually fill the buffer. This means that the user needs to
9766 #. be careful not to reuse the user-space buffer it spliced into
9767 #. the kernel-space one (contrast this to "write()", which copies
9768 #. the actual data, and you can thus reuse the buffer immediately
9769 #. after a successful write), but that is often easy to do.
9771 #: build/C/man2/vmsplice.2:57
9773 "The B<vmsplice>() system call maps I<nr_segs> ranges of user memory "
9774 "described by I<iov> into a pipe. The file descriptor I<fd> must refer to a "
9779 #: build/C/man2/vmsplice.2:64
9781 "The pointer I<iov> points to an array of I<iovec> structures as defined in "
9782 "I<E<lt>sys/uio.hE<gt>>:"
9786 #: build/C/man2/vmsplice.2:71
9790 " void *iov_base; /* Starting address */\n"
9791 " size_t iov_len; /* Number of bytes */\n"
9796 #: build/C/man2/vmsplice.2:84
9797 msgid "Unused for B<vmsplice>(); see B<splice>(2)."
9801 #: build/C/man2/vmsplice.2:97
9803 "Currently has no effect for B<vmsplice>(), but may be implemented in the "
9804 "future; see B<splice>(2)."
9807 #. FIXME Explain the following line in a little more detail:
9808 #. .... if we expect to later SPLICE_F_MOVE to the cache.
9810 #: build/C/man2/vmsplice.2:113
9812 "The user pages are a gift to the kernel. The application may not modify "
9813 "this memory ever, or page cache and on-disk data may differ. Gifting pages "
9814 "to the kernel means that a subsequent B<splice>(2) B<SPLICE_F_MOVE> can "
9815 "successfully move the pages; if this flag is not specified, then a "
9816 "subsequent B<splice>(2) B<SPLICE_F_MOVE> must copy the pages. Data must "
9817 "also be properly page aligned, both in memory and length."
9821 #: build/C/man2/vmsplice.2:122
9823 "Upon successful completion, B<vmsplice>() returns the number of bytes "
9824 "transferred to the pipe. On error, B<vmsplice>() returns -1 and I<errno> "
9825 "is set to indicate the error."
9829 #: build/C/man2/vmsplice.2:127
9830 msgid "I<fd> either not valid, or doesn't refer to a pipe."
9834 #: build/C/man2/vmsplice.2:135
9836 "I<nr_segs> is 0 or greater than B<IOV_MAX>; or memory not aligned if "
9837 "B<SPLICE_F_GIFT> set."
9841 #: build/C/man2/vmsplice.2:143
9843 "The B<vmsplice>() system call first appeared in Linux 2.6.17; library "
9844 "support was added to glibc in version 2.5."
9848 #: build/C/man2/vmsplice.2:154
9850 "B<vmsplice>() follows the other vectorized read/write type functions when "
9851 "it comes to limitations on number of segments being passed in. This limit "
9852 "is B<IOV_MAX> as defined in I<E<lt>limits.hE<gt>>. At the time of this "
9853 "writing, that limit is 1024."
9857 #: build/C/man2/vmsplice.2:157
9858 msgid "B<splice>(2), B<tee>(2)"