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: 2014-04-24 00:51+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=UTF-8\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 "Subfunctions 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:214 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:53 build/C/man2/pciconfig_read.2:50 build/C/man2/perf_event_open.2:2371 build/C/man2/perfmonctl.2:190 build/C/man2/personality.2:62 build/C/man2/pivot_root.2:101 build/C/man2/process_vm_readv.2:209 build/C/man2/ptrace.2:1853 build/C/man2/quotactl.2:419 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:54 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:239 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:2377 build/C/man2/personality.2:69 build/C/man2/pivot_root.2:105 build/C/man2/process_vm_readv.2:229 build/C/man2/ptrace.2:1868 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:59 build/C/man2/vmsplice.2:122
169 #: build/C/man2/arch_prctl.2:89 build/C/man2/futex.2:254 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/perf_event_open.2:2423 build/C/man2/process_vm_readv.2:251 build/C/man2/process_vm_readv.2:256 build/C/man2/ptrace.2:1872 build/C/man2/quotactl.2:428 build/C/man2/sendfile.2:125 build/C/man2/vm86.2:60
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:266 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:2428 build/C/man2/personality.2:70 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:1883 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/perf_event_open.2:2495 build/C/man2/pivot_root.2:120 build/C/man2/process_vm_readv.2:267 build/C/man2/ptrace.2:1893 build/C/man2/quotactl.2:456 build/C/man2/vm86.2:68
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:301 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:58 build/C/man2/outb.2:87 build/C/man2/pciconfig_read.2:112 build/C/man2/perf_event_open.2:2516 build/C/man2/perfmonctl.2:199 build/C/man2/personality.2:73 build/C/man2/pivot_root.2:128 build/C/man2/process_vm_readv.2:279 build/C/man2/ptrace.2:1911 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:73 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:303 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:2521 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:1913 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 supported only 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 needed only 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:317 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:114 build/C/man2/perf_event_open.2:2652 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:2079 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:331 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:60 build/C/man2/outb.2:99 build/C/man2/pciconfig_read.2:116 build/C/man2/perf_event_open.2:2658 build/C/man2/perfmonctl.2:209 build/C/man2/personality.2:77 build/C/man2/pivot_root.2:149 build/C/man2/process_vm_readv.2:334 build/C/man2/ptrace.2:2093 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:76 build/C/man2/vmsplice.2:157
288 #: build/C/man2/arch_prctl.2:152 build/C/man2/futex.2:338 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:67 build/C/man2/outb.2:106 build/C/man2/pciconfig_read.2:123 build/C/man2/perf_event_open.2:2665 build/C/man2/perfmonctl.2:216 build/C/man2/personality.2:84 build/C/man2/pivot_root.2:156 build/C/man2/process_vm_readv.2:341 build/C/man2/ptrace.2:2100 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:83 build/C/man2/vmsplice.2:164
290 "This page is part of release 3.65 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:221
381 msgid "B<FUTEX_WAIT>"
385 #: build/C/man2/futex.2:131
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 specify the "
390 "duration of the wait. (This interval will be rounded up to the system clock "
391 "granularity, and kernel scheduling delays mean that the blocking interval "
392 "may overrun by a small amount.) If I<timeout> is NULL, the call blocks "
393 "indefinitely. The arguments I<uaddr2> and I<val3> are ignored."
397 #: build/C/man2/futex.2:139
399 "For B<futex>(7), this call is executed if decrementing the count gave a "
400 "negative value (indicating contention), and will sleep until another process "
401 "releases the futex and executes the B<FUTEX_WAKE> operation."
405 #: build/C/man2/futex.2:139 build/C/man2/futex.2:227
407 msgid "B<FUTEX_WAKE>"
411 #: build/C/man2/futex.2:150
413 "This operation wakes at most I<val> processes waiting on this futex address "
414 "(i.e., inside B<FUTEX_WAIT>). The arguments I<timeout>, I<uaddr2> and "
415 "I<val3> are ignored."
419 #: build/C/man2/futex.2:156
421 "For B<futex>(7), this is executed if incrementing the count showed that "
422 "there were waiters, once the futex value has been set to 1 (indicating that "
427 #: build/C/man2/futex.2:156
429 msgid "B<FUTEX_FD> (present up to and including Linux 2.6.25)"
432 #. , suitable for .BR poll (2).
434 #: build/C/man2/futex.2:172
436 "To support asynchronous wakeups, this operation associates a file descriptor "
437 "with a futex. If another process executes a B<FUTEX_WAKE>, the process will "
438 "receive the signal number that was passed in I<val>. The calling process "
439 "must close the returned file descriptor after use. The arguments "
440 "I<timeout>, I<uaddr2> and I<val3> are ignored."
444 #: build/C/man2/futex.2:177
446 "To prevent race conditions, the caller should test if the futex has been "
447 "upped after B<FUTEX_FD> returns."
451 #: build/C/man2/futex.2:181
453 "Because it was inherently racy, B<FUTEX_FD> has been removed from Linux "
458 #: build/C/man2/futex.2:181
460 msgid "B<FUTEX_REQUEUE> (since Linux 2.5.70)"
464 #: build/C/man2/futex.2:196
466 "This operation was introduced in order to avoid a \"thundering herd\" effect "
467 "when B<FUTEX_WAKE> is used and all processes woken up need to acquire "
468 "another futex. This call wakes up I<val> processes, and requeues all other "
469 "waiters on the futex at address I<uaddr2>. The arguments I<timeout> and "
470 "I<val3> are ignored."
474 #: build/C/man2/futex.2:196
476 msgid "B<FUTEX_CMP_REQUEUE> (since Linux 2.6.7)"
480 #: build/C/man2/futex.2:214
482 "There was a race in the intended use of B<FUTEX_REQUEUE>, so "
483 "B<FUTEX_CMP_REQUEUE> was introduced. This is similar to B<FUTEX_REQUEUE>, "
484 "but first checks whether the location I<uaddr> still contains the value "
485 "I<val3>. If not, the operation fails with the error B<EAGAIN>. The "
486 "argument I<timeout> is ignored."
490 #: build/C/man2/futex.2:221
492 "In the event of an error, all operations return -1, and set I<errno> to "
493 "indicate the error. The return value on success depends on the operation, "
494 "as described in the following list:"
498 #: build/C/man2/futex.2:227
500 "Returns 0 if the process was woken by a B<FUTEX_WAKE> call. See ERRORS for "
501 "the various possible error returns."
505 #: build/C/man2/futex.2:230 build/C/man2/futex.2:236 build/C/man2/futex.2:239
506 msgid "Returns the number of processes woken up."
510 #: build/C/man2/futex.2:230
516 #: build/C/man2/futex.2:233
517 msgid "Returns the new file descriptor associated with the futex."
521 #: build/C/man2/futex.2:233
523 msgid "B<FUTEX_REQUEUE>"
527 #: build/C/man2/futex.2:236
529 msgid "B<FUTEX_CMP_REQUEUE>"
533 #: build/C/man2/futex.2:240 build/C/man2/perf_event_open.2:2399 build/C/man2/quotactl.2:486
539 #: build/C/man2/futex.2:243
540 msgid "No read access to futex memory."
544 #: build/C/man2/futex.2:243 build/C/man2/sendfile.2:116
550 #: build/C/man2/futex.2:254
552 "B<FUTEX_CMP_REQUEUE> detected that the value pointed to by I<uaddr> is not "
553 "equal to the expected value I<val3>. (This probably indicates a race; use "
554 "the safe B<FUTEX_WAKE> now.)"
558 #: build/C/man2/futex.2:259
559 msgid "Error retrieving I<timeout> information from user space."
563 #: build/C/man2/futex.2:259
569 #: build/C/man2/futex.2:266
571 "A B<FUTEX_WAIT> operation was interrupted by a signal (see B<signal>(7)) or "
576 #: build/C/man2/futex.2:269
577 msgid "Invalid argument."
581 #: build/C/man2/futex.2:269
587 #: build/C/man2/futex.2:272
588 msgid "The system limit on the total number of open files has been reached."
592 #: build/C/man2/futex.2:272 build/C/man2/modify_ldt.2:126 build/C/man2/pciconfig_read.2:93 build/C/man2/perf_event_open.2:2481 build/C/man2/quotactl.2:447 build/C/man2/vm86.2:64
598 #: build/C/man2/futex.2:276
599 msgid "Invalid operation specified in I<op>."
603 #: build/C/man2/futex.2:276
609 #: build/C/man2/futex.2:281
610 msgid "Timeout during the B<FUTEX_WAIT> operation."
614 #: build/C/man2/futex.2:281
616 msgid "B<EWOULDBLOCK>"
620 #: build/C/man2/futex.2:291
622 "I<op> was B<FUTEX_WAIT> and the value pointed to by I<uaddr> was not equal "
623 "to the expected value I<val> at the time of the call."
627 #: build/C/man2/futex.2:291 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
633 #: build/C/man2/futex.2:301
635 "Initial futex support was merged in Linux 2.5.7 but with different semantics "
636 "from what was described above. A 4-argument system call with the semantics "
637 "described in this page was introduced in Linux 2.5.40. In Linux 2.5.70 one "
638 "argument was added. In Linux 2.6.7 a sixth argument was added\\(emmessy, "
639 "especially on the s390 architecture."
643 #: build/C/man2/futex.2:303 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
644 msgid "This system call is Linux-specific."
649 #. Futexes were designed and worked on by
650 #. Hubertus Franke (IBM Thomas J. Watson Research Center),
651 #. Matthew Kirkwood, Ingo Molnar (Red Hat)
652 #. and Rusty Russell (IBM Linux Technology Center).
653 #. This page written by bert hubert.
655 #: build/C/man2/futex.2:317
657 "To reiterate, bare futexes are not intended as an easy-to-use abstraction "
658 "for end-users. (There is no wrapper function for this system call in "
659 "glibc.) Implementors are expected to be assembly literate and to have read "
660 "the sources of the futex user-space library referenced below."
664 #: build/C/man2/futex.2:320
665 msgid "B<restart_syscall>(2), B<futex>(7)"
669 #: build/C/man2/futex.2:323
671 "I<Fuss, Futexes and Furwocks: Fast Userlevel Locking in Linux> (proceedings "
672 "of the Ottawa Linux Symposium 2002), online at"
676 #: build/C/man2/futex.2:326
678 "E<.UR http://kernel.org\\:/doc\\:/ols\\:/2002\\:/ols2002-pages-479-495.pdf> "
683 #: build/C/man2/futex.2:328
684 msgid "Futex example library, futex-*.tar.bz2 at"
688 #: build/C/man2/futex.2:331
690 "E<.UR ftp://ftp.kernel.org\\:/pub\\:/linux\\:/kernel\\:/people\\:/rusty/> "
695 #: build/C/man2/get_robust_list.2:29
697 msgid "GET_ROBUST_LIST"
701 #: 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
707 #: build/C/man2/get_robust_list.2:29
709 msgid "Linux System Calls"
713 #: build/C/man2/get_robust_list.2:32
714 msgid "get_robust_list, set_robust_list - get/set list of robust futexes"
718 #: build/C/man2/get_robust_list.2:36
721 "B<#include E<lt>linux/futex.hE<gt>>\n"
722 "B<#include E<lt>syscall.hE<gt>>\n"
726 #: build/C/man2/get_robust_list.2:40
729 "B<long get_robust_list(int >I<pid>B<, struct robust_list_head "
730 "**>I<head_ptr>B<,>\n"
731 "B< size_t *>I<len_ptr>B<);>\n"
732 "B<long set_robust_list(struct robust_list_head *>I<head>B<, size_t "
737 #: build/C/man2/get_robust_list.2:44
738 msgid "I<Note>: There are no glibc wrappers for these system calls; see NOTES."
742 #: build/C/man2/get_robust_list.2:49
744 "The robust futex implementation needs to maintain per-thread lists of robust "
745 "futexes which are unlocked when the thread exits. These lists are managed "
746 "in user space; the kernel is notified about only the location of the head of "
751 #: build/C/man2/get_robust_list.2:65
753 "The B<get_robust_list>() system call returns the head of the robust futex "
754 "list of the thread whose thread ID is specified in I<pid>. If I<pid> is 0, "
755 "the head of the list for the calling thread is returned. The list head is "
756 "stored in the location pointed to by I<head_ptr>. The size of the object "
757 "pointed to by I<**head_ptr> is stored in I<len_ptr>."
761 #: build/C/man2/get_robust_list.2:77
763 "The B<set_robust_list>() system call requests the kernel to record the head "
764 "of the list of robust futexes owned by the calling thread. The I<head> "
765 "argument is the list head to record. The I<len> argument should be "
770 #: build/C/man2/get_robust_list.2:84
772 "The B<set_robust_list>() and B<get_robust_list>() system calls return zero "
773 "when the operation is successful, an error code otherwise."
777 #: build/C/man2/get_robust_list.2:88
778 msgid "The B<set_robust_list>() system call can fail with the following error:"
782 #: build/C/man2/get_robust_list.2:94
784 "I<len> does not match the size of structure B<struct robust_list_head> "
785 "expected by kernel."
789 #: build/C/man2/get_robust_list.2:98
790 msgid "The B<get_robust_list>() system call can fail with the following errors:"
794 #: build/C/man2/get_robust_list.2:106
796 "The calling process does not have permission to see the robust futex list of "
797 "the thread with the thread ID I<pid>, and does not have the "
798 "B<CAP_SYS_PTRACE> capability."
802 #: build/C/man2/get_robust_list.2:106 build/C/man2/perf_event_open.2:2508 build/C/man2/process_vm_readv.2:271 build/C/man2/ptrace.2:1906 build/C/man2/quotactl.2:461 build/C/man2/quotactl.2:504
808 #: build/C/man2/get_robust_list.2:111
809 msgid "No thread with the thread ID I<pid> could be found."
813 #: build/C/man2/get_robust_list.2:115
814 msgid "The head of the robust futex list can't be stored at the location I<head>."
818 #: build/C/man2/get_robust_list.2:119
820 "These system calls were added in Linux 2.6.17. No library support is "
821 "provided; use B<syscall>(2)."
825 #: build/C/man2/get_robust_list.2:124
827 "These system calls are not needed by normal applications. No support for "
828 "them is provided in glibc. In the unlikely event that you want to call them "
829 "directly, use B<syscall>(2)."
833 #: build/C/man2/get_robust_list.2:128
835 "A thread can have only one robust futex list; therefore applications that "
836 "wish to use this functionality should use the robust mutexes provided by "
840 #. .BR pthread_mutexattr_setrobust_np (3)
842 #: build/C/man2/get_robust_list.2:131
846 #. http://lwn.net/Articles/172149/
848 #: build/C/man2/get_robust_list.2:137
850 "I<Documentation/robust-futexes.txt> and "
851 "I<Documentation/robust-futex-ABI.txt> in the Linux kernel source tree"
855 #: build/C/man2/getunwind.2:27
861 #: build/C/man2/getunwind.2:27 build/C/man2/perfmonctl.2:27
867 #: build/C/man2/getunwind.2:30
868 msgid "getunwind - copy the unwind data to caller's buffer"
872 #: build/C/man2/getunwind.2:34
875 "B<#include E<lt>syscall.hE<gt>>\n"
876 "B<#include E<lt>linux/unwind.hE<gt>>\n"
880 #: build/C/man2/getunwind.2:36
882 msgid "B<long getunwind(void >I<*buf>B<, size_t >I<buf_size>B<);>\n"
886 #: 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
887 msgid "I<Note>: There is no glibc wrapper for this system call; see NOTES."
891 #: build/C/man2/getunwind.2:42
892 msgid "I<Note: this function is obsolete.>"
896 #: build/C/man2/getunwind.2:52
898 "The IA-64-specific B<getunwind>() system call copies the kernel's call "
899 "frame unwind data into the buffer pointed to by I<buf> and returns the size "
900 "of the unwind data; this data describes the gate page (kernel code that is "
901 "mapped into user space)."
905 #: build/C/man2/getunwind.2:64
907 "The size of the buffer I<buf> is specified in I<buf_size>. The data is "
908 "copied only if I<buf_size> is greater than or equal to the size of the "
909 "unwind data and I<buf> is not NULL; otherwise, no data is copied, and the "
910 "call succeeds, returning the size that would be needed to store the unwind "
915 #: build/C/man2/getunwind.2:68
917 "The first part of the unwind data contains an unwind table. The rest "
918 "contains the associated unwind information, in no particular order. The "
919 "unwind table contains entries of the following form:"
923 #: build/C/man2/getunwind.2:73
926 " u64 start; (64-bit address of start of function)\n"
927 " u64 end; (64-bit address of end of function)\n"
928 " u64 info; (BUF-relative offset to unwind info)\n"
932 #: build/C/man2/getunwind.2:81
934 "An entry whose I<start> value is zero indicates the end of the table. For "
935 "more information about the format, see the I<IA-64 Software Conventions and "
936 "Runtime Architecture> manual."
940 #: build/C/man2/getunwind.2:88
942 "On success, B<getunwind>() returns the size of unwind table. On error, -1 "
943 "is returned and I<errno> is set to indicate the error."
947 #: build/C/man2/getunwind.2:94
949 "B<getunwind>() fails with the error B<EFAULT> if the unwind info can't be "
950 "stored in the space specified by I<buf>."
954 #: build/C/man2/getunwind.2:96
955 msgid "This system call is available since Linux 2.4."
959 #: build/C/man2/getunwind.2:99
961 "This system call is Linux-specific, and is available only on the IA-64 "
966 #: build/C/man2/getunwind.2:107
968 "This system call has been deprecated. The modern way to obtain the kernel's "
969 "unwind data is via the gate DSO. The address of the ELF header for this DSO "
970 "is passed to user level via B<AT_SYSINFO_EHDR> (see B<getauxval>(3))."
974 #: build/C/man2/getunwind.2:111
976 "Glibc does not provide a wrapper for this system call; in the unlikely event "
977 "that you want to call it, use B<syscall>(2)."
981 #: build/C/man2/getunwind.2:113
982 msgid "B<getauxval>(3)"
986 #: build/C/man2/kexec_load.2:26
992 #: build/C/man2/kexec_load.2:29
993 msgid "kexec_load - load a new kernel for later execution"
997 #: build/C/man2/kexec_load.2:31
998 msgid "B<#include E<lt>linux/kexec.hE<gt>>"
1002 #: build/C/man2/kexec_load.2:33
1004 "B<long kexec_load(unsigned long >I<entry>B<, unsigned long "
1005 ">I<nr_segments>B<,>"
1009 #: build/C/man2/kexec_load.2:36
1010 msgid "B< struct kexec_segment *>I<segments>B<, unsigned long >I<flags>B<);>"
1014 #: build/C/man2/kexec_load.2:44
1016 "The B<kexec_load>() system call loads a new kernel that can be executed "
1017 "later by B<reboot>(2)."
1021 #: build/C/man2/kexec_load.2:50
1023 "The I<flags> argument is a mask whose high-order bits control the operation "
1024 "of the call. The following values can be specified in I<flags>:"
1028 #: build/C/man2/kexec_load.2:50
1030 msgid "B<KEXEC_ON_CRASH> (since Linux 2.6.13)"
1033 #. FIXME figure out how this is really used
1035 #: build/C/man2/kexec_load.2:54
1036 msgid "Execute the new kernel automatically on a system crash."
1040 #: build/C/man2/kexec_load.2:54
1042 msgid "B<KEXEC_PRESERVE_CONTEXT> (since Linux 2.6.27)"
1046 #: build/C/man2/kexec_load.2:64
1048 "Preserve the system hardware and software states before executing the new "
1049 "kernel. This could be used for system suspend. This flag is available only "
1050 "if the kernel was configured with B<CONFIG_KEXEC_JUMP>, and is effective "
1051 "only if I<nr_segments> is greater than 0."
1055 #: build/C/man2/kexec_load.2:84
1057 "The low-order bits of I<flags> contain the architecture of the "
1058 "to-be-executed kernel. Specify (OR) the constant B<KEXEC_ARCH_DEFAULT> to "
1059 "use the current architecture, or one of the following architecture constants "
1060 "B<KEXEC_ARCH_386>, B<KEXEC_ARCH_X86_64>, B<KEXEC_ARCH_PPC>, "
1061 "B<KEXEC_ARCH_PPC64>, B<KEXEC_ARCH_IA_64>, B<KEXEC_ARCH_ARM>, "
1062 "B<KEXEC_ARCH_S390>, B<KEXEC_ARCH_SH>, B<KEXEC_ARCH_MIPS>, and "
1063 "B<KEXEC_ARCH_MIPS_LE>. The architecture must be executable on the CPU of "
1068 #: build/C/man2/kexec_load.2:98
1070 "The I<entry> argument is the physical entry address in the kernel image. "
1071 "The I<nr_segments> argument is the number of segments pointed to by the "
1072 "I<segments> pointer. The I<segments> argument is an array of "
1073 "I<kexec_segment> structures which define the kernel layout:"
1077 #: build/C/man2/kexec_load.2:107
1080 "struct kexec_segment {\n"
1081 " void *buf; /* Buffer in user space */\n"
1082 " size_t bufsz; /* Buffer length in user space */\n"
1083 " void *mem; /* Physical address of kernel */\n"
1084 " size_t memsz; /* Physical address length */\n"
1088 #. FIXME elaborate on the following:
1090 #: build/C/man2/kexec_load.2:114
1092 "The kernel image defined by I<segments> is copied from the calling process "
1093 "into previously reserved memory."
1097 #: build/C/man2/kexec_load.2:121
1099 "On success, B<kexec_load>() returns 0. On error, -1 is returned and "
1100 "I<errno> is set to indicate the error."
1104 #: build/C/man2/kexec_load.2:122 build/C/man2/pivot_root.2:110 build/C/man2/ptrace.2:1869 build/C/man2/quotactl.2:495
1110 #: build/C/man2/kexec_load.2:126
1112 "Another crash kernel is already being loaded or a crash kernel is already in "
1116 #. KEXEC_SEGMENT_MAX == 16
1118 #: build/C/man2/kexec_load.2:133
1119 msgid "I<flags> is invalid; or I<nr_segments> is too large"
1123 #: build/C/man2/kexec_load.2:138
1124 msgid "The caller does not have the B<CAP_SYS_BOOT> capability."
1128 #: build/C/man2/kexec_load.2:142
1129 msgid "The B<kexec_load>() system call first appeared in Linux 2.6.13."
1133 #: build/C/man2/kexec_load.2:149
1135 "Currently, there is no glibc support for B<kexec_load>(). Call it using "
1139 #. FIXME Andi submitted a patch for this.
1140 #. Check if it got accepted later.
1142 #: build/C/man2/kexec_load.2:156
1144 "The required constants are in the Linux kernel source file I<linux/kexec.h>, "
1145 "which is not currently exported to glibc. Therefore, these constants must "
1146 "be defined manually."
1150 #: build/C/man2/kexec_load.2:159
1152 "This system call is available only if the kernel was configured with "
1157 #: build/C/man2/kexec_load.2:162
1158 msgid "B<reboot>(2), B<syscall>(2)"
1162 #: build/C/man2/lookup_dcookie.2:27
1164 msgid "LOOKUP_DCOOKIE"
1168 #: build/C/man2/lookup_dcookie.2:27
1174 #: build/C/man2/lookup_dcookie.2:30
1175 msgid "lookup_dcookie - return a directory entry's path"
1179 #: build/C/man2/lookup_dcookie.2:32
1181 "B<int lookup_dcookie(u64 >I<cookie>B<, char *>I<buffer>B<, size_t "
1186 #: build/C/man2/lookup_dcookie.2:38
1188 "Look up the full path of the directory entry specified by the value "
1189 "I<cookie>. The cookie is an opaque identifier uniquely identifying a "
1190 "particular directory entry. The buffer given is filled in with the full "
1191 "path of the directory entry."
1195 #: build/C/man2/lookup_dcookie.2:43
1197 "For B<lookup_dcookie>() to return successfully, the kernel must still hold "
1198 "a cookie reference to the directory entry."
1202 #: build/C/man2/lookup_dcookie.2:50
1204 "On success, B<lookup_dcookie>() returns the length of the path string "
1205 "copied into the buffer. On error, -1 is returned, and I<errno> is set "
1210 #: build/C/man2/lookup_dcookie.2:54
1211 msgid "The buffer was not valid."
1215 #: build/C/man2/lookup_dcookie.2:58
1217 "The kernel has no registered cookie/directory entry mappings at the time of "
1218 "lookup, or the cookie does not refer to a valid directory entry."
1222 #: build/C/man2/lookup_dcookie.2:58
1224 msgid "B<ENAMETOOLONG>"
1228 #: build/C/man2/lookup_dcookie.2:61
1229 msgid "The name could not fit in the buffer."
1233 #: 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
1239 #: build/C/man2/lookup_dcookie.2:65
1241 "The kernel could not allocate memory for the temporary buffer holding the "
1246 #: build/C/man2/lookup_dcookie.2:70
1248 "The process does not have the capability B<CAP_SYS_ADMIN> required to look "
1253 #: build/C/man2/lookup_dcookie.2:70 build/C/man2/quotactl.2:474
1259 #: build/C/man2/lookup_dcookie.2:73
1260 msgid "The buffer was not large enough to hold the path of the directory entry."
1264 #: build/C/man2/lookup_dcookie.2:78
1266 "Available since Linux 2.5.43. The B<ENAMETOOLONG> error return was added in "
1271 #: build/C/man2/lookup_dcookie.2:81
1272 msgid "B<lookup_dcookie>() is Linux-specific."
1276 #: build/C/man2/lookup_dcookie.2:85
1278 "B<lookup_dcookie>() is a special-purpose system call, currently used only "
1279 "by the oprofile profiler. It relies on a kernel driver to register cookies "
1280 "for directory entries."
1284 #: build/C/man2/lookup_dcookie.2:88
1286 "The path returned may be suffixed by the string \" (deleted)\" if the "
1287 "directory entry has been removed."
1291 #: build/C/man2/modify_ldt.2:24
1297 #: build/C/man2/modify_ldt.2:27
1298 msgid "modify_ldt - get or set ldt"
1302 #: build/C/man2/modify_ldt.2:30
1304 msgid "B<#include E<lt>sys/types.hE<gt>>\n"
1308 #: build/C/man2/modify_ldt.2:32
1311 "B<int modify_ldt(int >I<func>B<, void *>I<ptr>B<, unsigned long "
1312 ">I<bytecount>B<);>\n"
1316 #: build/C/man2/modify_ldt.2:41
1318 "B<modify_ldt>() reads or writes the local descriptor table (ldt) for a "
1319 "process. The ldt is a per-process memory management table used by the i386 "
1320 "processor. For more information on this table, see an Intel 386 processor "
1325 #: build/C/man2/modify_ldt.2:51
1327 "When I<func> is 0, B<modify_ldt>() reads the ldt into the memory pointed to "
1328 "by I<ptr>. The number of bytes read is the smaller of I<bytecount> and the "
1329 "actual size of the ldt."
1333 #. FIXME ? say something about func == 2 and func == 0x11?
1334 #. In Linux 2.4, func == 2 returned "the default ldt"
1335 #. In Linux 2.6, func == 2 is a nop, returning a zeroed out structure.
1336 #. Linux 2.4 and 2.6 implement an operation for func == 0x11
1338 #: build/C/man2/modify_ldt.2:69
1340 "When I<func> is 1, B<modify_ldt>() modifies one ldt entry. I<ptr> points "
1341 "to a I<user_desc> structure and I<bytecount> must equal the size of this "
1346 #: build/C/man2/modify_ldt.2:73
1347 msgid "The I<user_desc> structure is defined in I<E<lt>asm/ldt.hE<gt>> as:"
1351 #: build/C/man2/modify_ldt.2:87
1354 "struct user_desc {\n"
1355 " unsigned int entry_number;\n"
1356 " unsigned long base_addr;\n"
1357 " unsigned int limit;\n"
1358 " unsigned int seg_32bit:1;\n"
1359 " unsigned int contents:2;\n"
1360 " unsigned int read_exec_only:1;\n"
1361 " unsigned int limit_in_pages:1;\n"
1362 " unsigned int seg_not_present:1;\n"
1363 " unsigned int useable:1;\n"
1368 #. The ldt is specific for the calling process. Any attempts to change
1369 #. the ldt to include the address space of another process or the kernel
1370 #. will result in a segmentation violation when trying to access the memory
1371 #. outside of the process address space. The memory protection is enforced
1372 #. at the paging layer.
1374 #: build/C/man2/modify_ldt.2:98
1375 msgid "In Linux 2.4 and earlier, this structure was named I<modify_ldt_ldt_s>."
1379 #: build/C/man2/modify_ldt.2:108
1381 "On success, B<modify_ldt>() returns either the actual number of bytes read "
1382 "(for reading) or 0 (for writing). On failure, B<modify_ldt>() returns -1 "
1383 "and sets I<errno> to indicate the error."
1387 #: build/C/man2/modify_ldt.2:113
1388 msgid "I<ptr> points outside the address space."
1392 #: build/C/man2/modify_ldt.2:126
1394 "I<ptr> is 0, or I<func> is 1 and I<bytecount> is not equal to the size of "
1395 "the structure I<modify_ldt_ldt_s>, or I<func> is 1 and the new ldt entry has "
1400 #: build/C/man2/modify_ldt.2:130
1401 msgid "I<func> is neither 0 nor 1."
1405 #: build/C/man2/modify_ldt.2:133
1407 "This call is Linux-specific and should not be used in programs intended to "
1412 #: build/C/man2/modify_ldt.2:136 build/C/man2/perfmonctl.2:205 build/C/man2/pivot_root.2:134
1414 "Glibc does not provide a wrapper for this system call; call it using "
1419 #: build/C/man2/modify_ldt.2:138
1424 #: build/C/man2/nfsservctl.2:8
1430 #: build/C/man2/nfsservctl.2:8
1436 #: build/C/man2/nfsservctl.2:11
1437 msgid "nfsservctl - syscall interface to kernel nfs daemon"
1441 #: build/C/man2/nfsservctl.2:14
1443 msgid "B<#include E<lt>linux/nfsd/syscall.hE<gt>>\n"
1447 #: build/C/man2/nfsservctl.2:17
1450 "B<long nfsservctl(int >I<cmd>B<, struct nfsctl_arg *>I<argp>B<,>\n"
1451 "B< union nfsctl_res *>I<resp>B<);>\n"
1455 #: build/C/man2/nfsservctl.2:21
1456 msgid "I<Note>: Since Linux 3.1, this system call no longer exists."
1460 #: build/C/man2/nfsservctl.2:35
1464 " * These are the commands understood by nfsctl().\n"
1466 "#define NFSCTL_SVC 0 /* This is a server process. */\n"
1467 "#define NFSCTL_ADDCLIENT 1 /* Add an NFS client. */\n"
1468 "#define NFSCTL_DELCLIENT 2 /* Remove an NFS client. */\n"
1469 "#define NFSCTL_EXPORT 3 /* Export a filesystem. */\n"
1470 "#define NFSCTL_UNEXPORT 4 /* Unexport a filesystem. */\n"
1471 "#define NFSCTL_UGIDUPDATE 5 /* Update a client's UID/GID map\n"
1472 " (only in Linux 2.4.x and earlier). */\n"
1473 "#define NFSCTL_GETFH 6 /* Get a file handle (used by mountd)\n"
1474 " (only in Linux 2.4.x and earlier). */\n"
1478 #: build/C/man2/nfsservctl.2:47
1481 "struct nfsctl_arg {\n"
1482 " int ca_version; /* safeguard */\n"
1484 " struct nfsctl_svc u_svc;\n"
1485 " struct nfsctl_client u_client;\n"
1486 " struct nfsctl_export u_export;\n"
1487 " struct nfsctl_uidmap u_umap;\n"
1488 " struct nfsctl_fhparm u_getfh;\n"
1489 " unsigned int u_debug;\n"
1495 #: build/C/man2/nfsservctl.2:52
1498 "union nfsctl_res {\n"
1499 " struct knfs_fh cr_getfh;\n"
1500 " unsigned int cr_debug;\n"
1505 #: build/C/man2/nfsservctl.2:58 build/C/man2/pivot_root.2:105 build/C/man2/vm86.2:59
1507 "On success, zero is returned. On error, -1 is returned, and I<errno> is set "
1512 #: build/C/man2/nfsservctl.2:60
1513 msgid "This call is Linux-specific."
1517 #: build/C/man2/outb.2:26
1523 #: build/C/man2/outb.2:26
1529 #: build/C/man2/outb.2:31
1531 "outb, outw, outl, outsb, outsw, outsl, inb, inw, inl, insb, insw, insl, "
1532 "outb_p, outw_p, outl_p, inb_p, inw_p, inl_p - port I/O"
1536 #: build/C/man2/outb.2:34
1538 msgid "B<#include E<lt>sys/io.hE<gt>>\n"
1542 #: build/C/man2/outb.2:41
1545 "B<unsigned char inb(unsigned short int >I<port>B<);>\n"
1546 "B<unsigned char inb_p(unsigned short int >I<port>B<);>\n"
1547 "B<unsigned short int inw(unsigned short int >I<port>B<);>\n"
1548 "B<unsigned short int inw_p(unsigned short int >I<port>B<);>\n"
1549 "B<unsigned int inl(unsigned short int >I<port>B<);>\n"
1550 "B<unsigned int inl_p(unsigned short int >I<port>B<);>\n"
1554 #: build/C/man2/outb.2:48
1557 "B<void outb(unsigned char >I<value>B<, unsigned short int >I<port>B<);>\n"
1558 "B<void outb_p(unsigned char >I<value>B<, unsigned short int >I<port>B<);>\n"
1559 "B<void outw(unsigned short int >I<value>B<, unsigned short int "
1561 "B<void outw_p(unsigned short int >I<value>B<, unsigned short int "
1563 "B<void outl(unsigned int >I<value>B<, unsigned short int >I<port>B<);>\n"
1564 "B<void outl_p(unsigned int >I<value>B<, unsigned short int >I<port>B<);>\n"
1568 #: build/C/man2/outb.2:61
1571 "B<void insb(unsigned short int >I<port>B<, void *>I<addr>B<,>\n"
1572 "B< unsigned long int >I<count>B<);>\n"
1573 "B<void insw(unsigned short int >I<port>B<, void *>I<addr>B<,>\n"
1574 "B< unsigned long int >I<count>B<);>\n"
1575 "B<void insl(unsigned short int >I<port>B<, void *>I<addr>B<,>\n"
1576 "B< unsigned long int >I<count>B<);>\n"
1577 "B<void outsb(unsigned short int >I<port>B<, const void *>I<addr>B<,>\n"
1578 "B< unsigned long int >I<count>B<);>\n"
1579 "B<void outsw(unsigned short int >I<port>B<, const void *>I<addr>B<,>\n"
1580 "B< unsigned long int >I<count>B<);>\n"
1581 "B<void outsl(unsigned short int >I<port>B<, const void *>I<addr>B<,>\n"
1582 "B< unsigned long int >I<count>B<);>\n"
1586 #: build/C/man2/outb.2:67
1588 "This family of functions is used to do low-level port input and output. The "
1589 "out* functions do port output, the in* functions do port input; the b-suffix "
1590 "functions are byte-width and the w-suffix functions word-width; the "
1591 "_p-suffix functions pause until the I/O completes."
1594 #. , given the following information
1595 #. in addition to that given in
1598 #: build/C/man2/outb.2:73
1600 "They are primarily designed for internal kernel use, but can be used from "
1605 #: build/C/man2/outb.2:78
1607 "You must compile with B<-O> or B<-O2> or similar. The functions are defined "
1608 "as inline macros, and will not be substituted in without optimization "
1609 "enabled, causing unresolved references at link time."
1613 #: build/C/man2/outb.2:87
1615 "You use B<ioperm>(2) or alternatively B<iopl>(2) to tell the kernel to "
1616 "allow the user space application to access the I/O ports in question. "
1617 "Failure to do this will cause the application to receive a segmentation "
1622 #: build/C/man2/outb.2:96
1624 "B<outb>() and friends are hardware-specific. The I<value> argument is "
1625 "passed first and the I<port> argument is passed second, which is the "
1626 "opposite order from most DOS implementations."
1630 #: build/C/man2/outb.2:99
1631 msgid "B<ioperm>(2), B<iopl>(2)"
1635 #: build/C/man2/pciconfig_read.2:8
1637 msgid "PCICONFIG_READ"
1641 #: build/C/man2/pciconfig_read.2:8
1647 #: build/C/man2/pciconfig_read.2:11
1649 "pciconfig_read, pciconfig_write, pciconfig_iobase - pci device information "
1654 #: build/C/man2/pciconfig_read.2:14
1656 msgid "B<#include E<lt>pci.hE<gt>>\n"
1660 #: build/C/man2/pciconfig_read.2:21
1663 "B<int pciconfig_read(unsigned long >I<bus>B<, unsigned long >I<dfn>B<,>\n"
1664 "B< unsigned long >I<off>B<, unsigned long >I<len>B<, void "
1666 "B<int pciconfig_write(unsigned long >I<bus>B<, unsigned long >I<dfn>B<,>\n"
1667 "B< unsigned long >I<off>B<, unsigned long >I<len>B<, void "
1669 "B<int pciconfig_iobase(long >I<which>B<, unsigned long >I<bus>B<,>\n"
1670 "B< unsigned long >I<devfn>B<);>\n"
1674 #: build/C/man2/pciconfig_read.2:27
1676 "Most of the interaction with PCI devices is already handled by the kernel "
1677 "PCI layer, and thus these calls should not normally need to be accessed from "
1682 #: build/C/man2/pciconfig_read.2:27 build/C/man2/pciconfig_read.2:51
1684 msgid "B<pciconfig_read>()"
1688 #: build/C/man2/pciconfig_read.2:36
1689 msgid "Reads to I<buf> from device I<dev> at offset I<off> value."
1693 #: build/C/man2/pciconfig_read.2:36 build/C/man2/pciconfig_read.2:57
1695 msgid "B<pciconfig_write>()"
1699 #: build/C/man2/pciconfig_read.2:45
1700 msgid "Writes from I<buf> to device I<dev> at offset I<off> value."
1704 #: build/C/man2/pciconfig_read.2:45 build/C/man2/pciconfig_read.2:63
1706 msgid "B<pciconfig_iobase>()"
1710 #: build/C/man2/pciconfig_read.2:50
1712 "You pass it a bus/devfn pair and get a physical address for either the "
1713 "memory offset (for things like prep, this is 0xc0000000), the IO base for "
1714 "PIO cycles, or the ISA holes if any."
1718 #: build/C/man2/pciconfig_read.2:57 build/C/man2/pciconfig_read.2:63
1720 "On success zero is returned. On error, -1 is returned and I<errno> is set "
1725 #: build/C/man2/pciconfig_read.2:77
1727 "Returns information on locations of various I/O regions in physical memory "
1728 "according to the I<which> value. Values for I<which> are: "
1729 "B<IOBASE_BRIDGE_NUMBER>, B<IOBASE_MEMORY>, B<IOBASE_IO>, B<IOBASE_ISA_IO>, "
1730 "B<IOBASE_ISA_MEM>."
1734 #: build/C/man2/pciconfig_read.2:84
1735 msgid "I<len> value is invalid. This does not apply to B<pciconfig_iobase>()."
1739 #: build/C/man2/pciconfig_read.2:84 build/C/man2/ptrace.2:1886 build/C/man2/sendfile.2:134
1745 #: build/C/man2/pciconfig_read.2:87
1750 #: build/C/man2/pciconfig_read.2:87 build/C/man2/perf_event_open.2:2460
1756 #: build/C/man2/pciconfig_read.2:93
1758 "For B<pciconfig_iobase>(), \"hose\" value is NULL. For the other calls, "
1759 "could not find a slot."
1763 #: build/C/man2/pciconfig_read.2:98
1764 msgid "The system has not implemented these calls (B<CONFIG_PCI> not defined)."
1768 #: build/C/man2/pciconfig_read.2:98 build/C/man2/perf_event_open.2:2488
1770 msgid "B<EOPNOTSUPP>"
1774 #: build/C/man2/pciconfig_read.2:105
1776 "This return value is valid only for B<pciconfig_iobase>(). It is returned "
1777 "if the value for I<which> is invalid."
1781 #: build/C/man2/pciconfig_read.2:112
1783 "User does not have the B<CAP_SYS_ADMIN> capability. This does not apply to "
1784 "B<pciconfig_iobase>()."
1788 #: build/C/man2/pciconfig_read.2:114
1789 msgid "These calls are Linux-specific, available since Linux 2.0.26/2.1.11."
1793 #: build/C/man2/pciconfig_read.2:116
1794 msgid "B<capabilities>(7)"
1798 #: build/C/man2/perf_event_open.2:27
1800 msgid "PERF_EVENT_OPEN"
1804 #: build/C/man2/perf_event_open.2:27
1810 #: build/C/man2/perf_event_open.2:30
1811 msgid "perf_event_open - set up performance monitoring"
1815 #: build/C/man2/perf_event_open.2:34
1818 "B<#include E<lt>linux/perf_event.hE<gt>>\n"
1819 "B<#include E<lt>linux/hw_breakpoint.hE<gt>>\n"
1823 #: build/C/man2/perf_event_open.2:38
1826 "B<int perf_event_open(struct perf_event_attr *>I<attr>B<,>\n"
1827 "B< pid_t >I<pid>B<, int >I<cpu>B<, int >I<group_fd>B<,>\n"
1828 "B< unsigned long >I<flags>B<);>\n"
1832 #: build/C/man2/perf_event_open.2:47
1834 "Given a list of parameters, B<perf_event_open>() returns a file descriptor, "
1835 "for use in subsequent system calls (B<read>(2), B<mmap>(2), B<prctl>(2), "
1836 "B<fcntl>(2), etc.)."
1840 #: build/C/man2/perf_event_open.2:55
1842 "A call to B<perf_event_open>() creates a file descriptor that allows "
1843 "measuring performance information. Each file descriptor corresponds to one "
1844 "event that is measured; these can be grouped together to measure multiple "
1845 "events simultaneously."
1849 #: build/C/man2/perf_event_open.2:62
1851 "Events can be enabled and disabled in two ways: via B<ioctl>(2) and via "
1852 "B<prctl>(2). When an event is disabled it does not count or generate "
1853 "overflows but does continue to exist and maintain its count value."
1857 #: build/C/man2/perf_event_open.2:76
1859 "Events come in two flavors: counting and sampled. A I<counting> event is "
1860 "one that is used for counting the aggregate number of events that occur. In "
1861 "general, counting event results are gathered with a B<read>(2) call. A "
1862 "I<sampling> event periodically writes measurements to a buffer that can then "
1863 "be accessed via B<mmap>(2)."
1867 #: build/C/man2/perf_event_open.2:76
1873 #: build/C/man2/perf_event_open.2:83
1875 "The I<pid> and I<cpu> arguments allow specifying which process and CPU to "
1880 #: build/C/man2/perf_event_open.2:83
1882 msgid "B<pid == 0> and B<cpu == -1>"
1886 #: build/C/man2/perf_event_open.2:86
1887 msgid "This measures the calling process/thread on any CPU."
1891 #: build/C/man2/perf_event_open.2:86
1893 msgid "B<pid == 0> and B<cpu E<gt>= 0>"
1897 #: build/C/man2/perf_event_open.2:90
1899 "This measures the calling process/thread only when running on the specified "
1904 #: build/C/man2/perf_event_open.2:90
1906 msgid "B<pid E<gt> 0> and B<cpu == -1>"
1910 #: build/C/man2/perf_event_open.2:93
1911 msgid "This measures the specified process/thread on any CPU."
1915 #: build/C/man2/perf_event_open.2:93
1917 msgid "B<pid E<gt> 0> and B<cpu E<gt>= 0>"
1921 #: build/C/man2/perf_event_open.2:97
1923 "This measures the specified process/thread only when running on the "
1928 #: build/C/man2/perf_event_open.2:97
1930 msgid "B<pid == -1> and B<cpu E<gt>= 0>"
1934 #: build/C/man2/perf_event_open.2:105
1936 "This measures all processes/threads on the specified CPU. This requires "
1937 "B<CAP_SYS_ADMIN> capability or a I</proc/sys/kernel/perf_event_paranoid> "
1938 "value of less than 1."
1942 #: build/C/man2/perf_event_open.2:105
1944 msgid "B<pid == -1> and B<cpu == -1>"
1948 #: build/C/man2/perf_event_open.2:108
1949 msgid "This setting is invalid and will return an error."
1953 #: build/C/man2/perf_event_open.2:130
1955 "The I<group_fd> argument allows event groups to be created. An event group "
1956 "has one event which is the group leader. The leader is created first, with "
1957 "I<group_fd> = -1. The rest of the group members are created with subsequent "
1958 "B<perf_event_open>() calls with I<group_fd> being set to the file "
1959 "descriptor of the group leader. (A single event on its own is created with "
1960 "I<group_fd> = -1 and is considered to be a group with only 1 member.) An "
1961 "event group is scheduled onto the CPU as a unit: it will be put onto the CPU "
1962 "only if all of the events in the group can be put onto the CPU. This means "
1963 "that the values of the member events can be meaningfully compared\\(emadded, "
1964 "divided (to get ratios), and so on\\(emwith each other, since they have "
1965 "counted events for the same set of executed instructions."
1969 #: build/C/man2/perf_event_open.2:134
1971 "The I<flags> argument is formed by ORing together zero or more of the "
1976 #: build/C/man2/perf_event_open.2:134
1978 msgid "B<PERF_FLAG_FD_CLOEXEC> (since Linux 3.14)."
1982 #: build/C/man2/perf_event_open.2:150
1984 "This flag enables the close-on-exec flag for the created event file "
1985 "descriptor, so that the file descriptor is automatically closed on "
1986 "B<execve>(2). Setting the close-on-exec flags at creation time, rather than "
1987 "later with B<fcntl>(2), avoids potential race conditions where the calling "
1988 "thread invokes B<perf_event_open>() and B<fcntl>(2) at the same time as "
1989 "another thread calls B<fork>(2) then B<execve>(2)."
1993 #: build/C/man2/perf_event_open.2:150
1995 msgid "B<PERF_FLAG_FD_NO_GROUP>"
1998 #. FIXME The following sentence is unclear
1999 #. FIXME So, why is it useful?
2001 #: build/C/man2/perf_event_open.2:157
2003 "This flag allows creating an event as part of an event group but having no "
2004 "group leader. It is unclear why this is useful."
2008 #: build/C/man2/perf_event_open.2:157
2010 msgid "B<PERF_FLAG_FD_OUTPUT>"
2014 #: build/C/man2/perf_event_open.2:160
2015 msgid "This flag reroutes the output from an event to the group leader."
2019 #: build/C/man2/perf_event_open.2:160
2021 msgid "B<PERF_FLAG_PID_CGROUP> (since Linux 2.6.39)."
2025 #: build/C/man2/perf_event_open.2:183
2027 "This flag activates per-container system-wide monitoring. A container is an "
2028 "abstraction that isolates a set of resources for finer-grained control "
2029 "(CPUs, memory, etc.). In this mode, the event is measured only if the "
2030 "thread running on the monitored CPU belongs to the designated container "
2031 "(cgroup). The cgroup is identified by passing a file descriptor opened on "
2032 "its directory in the cgroupfs filesystem. For instance, if the cgroup to "
2033 "monitor is called I<test>, then a file descriptor opened on "
2034 "I</dev/cgroup/test> (assuming cgroupfs is mounted on I</dev/cgroup>) must "
2035 "be passed as the I<pid> parameter. cgroup monitoring is available only for "
2036 "system-wide events and may therefore require extra permissions."
2040 #: build/C/man2/perf_event_open.2:188
2042 "The I<perf_event_attr> structure provides detailed configuration information "
2043 "for the event being created."
2047 #: build/C/man2/perf_event_open.2:195
2050 "struct perf_event_attr {\n"
2051 " __u32 type; /* Type of event */\n"
2052 " __u32 size; /* Size of attribute structure */\n"
2053 " __u64 config; /* Type-specific configuration */\n"
2057 #: build/C/man2/perf_event_open.2:200
2061 " __u64 sample_period; /* Period of sampling */\n"
2062 " __u64 sample_freq; /* Frequency of sampling */\n"
2067 #: build/C/man2/perf_event_open.2:203
2070 " __u64 sample_type; /* Specifies values included in sample */\n"
2071 " __u64 read_format; /* Specifies values returned in read */\n"
2075 #: build/C/man2/perf_event_open.2:229
2078 " __u64 disabled : 1, /* off by default */\n"
2079 " inherit : 1, /* children inherit it */\n"
2080 " pinned : 1, /* must always be on PMU */\n"
2081 " exclusive : 1, /* only group on PMU */\n"
2082 " exclude_user : 1, /* don't count user */\n"
2083 " exclude_kernel : 1, /* don't count kernel */\n"
2084 " exclude_hv : 1, /* don't count hypervisor */\n"
2085 " exclude_idle : 1, /* don't count when idle */\n"
2086 " mmap : 1, /* include mmap data */\n"
2087 " comm : 1, /* include comm data */\n"
2088 " freq : 1, /* use freq, not period */\n"
2089 " inherit_stat : 1, /* per task counts */\n"
2090 " enable_on_exec : 1, /* next exec enables */\n"
2091 " task : 1, /* trace fork/exit */\n"
2092 " watermark : 1, /* wakeup_watermark */\n"
2093 " precise_ip : 2, /* skid constraint */\n"
2094 " mmap_data : 1, /* non-exec mmap data */\n"
2095 " sample_id_all : 1, /* sample_type all events */\n"
2096 " exclude_host : 1, /* don't count in host */\n"
2097 " exclude_guest : 1, /* don't count in guest */\n"
2098 " exclude_callchain_kernel : 1,\n"
2099 " /* exclude kernel callchains */\n"
2100 " exclude_callchain_user : 1,\n"
2101 " /* exclude user callchains */\n"
2102 " __reserved_1 : 41;\n"
2106 #: build/C/man2/perf_event_open.2:234
2110 " __u32 wakeup_events; /* wakeup every n events */\n"
2111 " __u32 wakeup_watermark; /* bytes before wakeup */\n"
2116 #: build/C/man2/perf_event_open.2:236
2118 msgid " __u32 bp_type; /* breakpoint type */\n"
2122 #: build/C/man2/perf_event_open.2:241
2126 " __u64 bp_addr; /* breakpoint address */\n"
2127 " __u64 config1; /* extension of config */\n"
2132 #: build/C/man2/perf_event_open.2:251
2136 " __u64 bp_len; /* breakpoint length */\n"
2137 " __u64 config2; /* extension of config1 */\n"
2139 " __u64 branch_sample_type; /* enum perf_branch_sample_type */\n"
2140 " __u64 sample_regs_user; /* user regs to dump on samples */\n"
2141 " __u32 sample_stack_user; /* size of stack to dump on\n"
2143 " __u32 __reserved_2; /* Align to u64 */\n"
2147 #: build/C/man2/perf_event_open.2:253
2153 #: build/C/man2/perf_event_open.2:259
2155 "The fields of the I<perf_event_attr> structure are described in more detail "
2160 #: build/C/man2/perf_event_open.2:259 build/C/man2/perf_event_open.2:1556
2166 #: build/C/man2/perf_event_open.2:263
2168 "This field specifies the overall event type. It has one of the following "
2173 #: build/C/man2/perf_event_open.2:264
2175 msgid "B<PERF_TYPE_HARDWARE>"
2179 #: build/C/man2/perf_event_open.2:271
2181 "This indicates one of the \"generalized\" hardware events provided by the "
2182 "kernel. See the I<config> field definition for more details."
2186 #: build/C/man2/perf_event_open.2:271
2188 msgid "B<PERF_TYPE_SOFTWARE>"
2192 #: build/C/man2/perf_event_open.2:275
2194 "This indicates one of the software-defined events provided by the kernel "
2195 "(even if no hardware support is available)."
2199 #: build/C/man2/perf_event_open.2:275
2201 msgid "B<PERF_TYPE_TRACEPOINT>"
2205 #: build/C/man2/perf_event_open.2:279
2207 "This indicates a tracepoint provided by the kernel tracepoint "
2212 #: build/C/man2/perf_event_open.2:279
2214 msgid "B<PERF_TYPE_HW_CACHE>"
2218 #: build/C/man2/perf_event_open.2:285
2220 "This indicates a hardware cache event. This has a special encoding, "
2221 "described in the I<config> field definition."
2225 #: build/C/man2/perf_event_open.2:285
2227 msgid "B<PERF_TYPE_RAW>"
2231 #: build/C/man2/perf_event_open.2:289
2233 "This indicates a \"raw\" implementation-specific event in the I<config> "
2238 #: build/C/man2/perf_event_open.2:289
2240 msgid "B<PERF_TYPE_BREAKPOINT> (since Linux 2.6.33)"
2244 #: build/C/man2/perf_event_open.2:294
2246 "This indicates a hardware breakpoint as provided by the CPU. Breakpoints "
2247 "can be read/write accesses to an address as well as execution of an "
2248 "instruction address."
2252 #: build/C/man2/perf_event_open.2:294
2258 #: build/C/man2/perf_event_open.2:313
2260 "Since Linux 2.6.39, B<perf_event_open>() can support multiple PMUs. To "
2261 "enable this, a value exported by the kernel can be used in the I<type> field "
2262 "to indicate which PMU to use. The value to use can be found in the sysfs "
2263 "filesystem: there is a subdirectory per PMU instance under "
2264 "I</sys/bus/event_source/devices>. In each subdirectory there is a I<type> "
2265 "file whose content is an integer that can be used in the I<type> field. For "
2266 "instance, I</sys/bus/event_source/devices/cpu/type> contains the value for "
2267 "the core CPU PMU, which is usually 4."
2271 #: build/C/man2/perf_event_open.2:314 build/C/man2/perf_event_open.2:1504
2277 #: build/C/man2/perf_event_open.2:323
2279 "The size of the I<perf_event_attr> structure for forward/backward "
2280 "compatibility. Set this using I<sizeof(struct perf_event_attr)> to allow "
2281 "the kernel to see the struct size at the time of compilation."
2285 #: build/C/man2/perf_event_open.2:338
2287 "The related define B<PERF_ATTR_SIZE_VER0> is set to 64; this was the size of "
2288 "the first published struct. B<PERF_ATTR_SIZE_VER1> is 72, corresponding to "
2289 "the addition of breakpoints in Linux 2.6.33. B<PERF_ATTR_SIZE_VER2> is 80 "
2290 "corresponding to the addition of branch sampling in Linux 3.4. "
2291 "B<PERF_ATR_SIZE_VER3> is 96 corresponding to the addition of "
2292 "I<sample_regs_user> and I<sample_stack_user> in Linux 3.7."
2296 #: build/C/man2/perf_event_open.2:338
2302 #: build/C/man2/perf_event_open.2:349
2304 "This specifies which event you want, in conjunction with the I<type> field. "
2305 "The I<config1> and I<config2> fields are also taken into account in cases "
2306 "where 64 bits is not enough to fully specify the event. The encoding of "
2307 "these fields are event dependent."
2311 #: build/C/man2/perf_event_open.2:355
2313 "The most significant bit (bit 63) of I<config> signifies CPU-specific (raw) "
2314 "counter configuration data; if the most significant bit is unset, the next 7 "
2315 "bits are an event type and the rest of the bits are the event identifier."
2319 #: build/C/man2/perf_event_open.2:366
2321 "There are various ways to set the I<config> field that are dependent on the "
2322 "value of the previously described I<type> field. What follows are various "
2323 "possible settings for I<config> separated out by I<type>."
2327 #: build/C/man2/perf_event_open.2:376
2329 "If I<type> is B<PERF_TYPE_HARDWARE>, we are measuring one of the generalized "
2330 "hardware CPU events. Not all of these are available on all platforms. Set "
2331 "I<config> to one of the following:"
2335 #: build/C/man2/perf_event_open.2:377
2337 msgid "B<PERF_COUNT_HW_CPU_CYCLES>"
2341 #: build/C/man2/perf_event_open.2:381
2342 msgid "Total cycles. Be wary of what happens during CPU frequency scaling."
2346 #: build/C/man2/perf_event_open.2:381
2348 msgid "B<PERF_COUNT_HW_INSTRUCTIONS>"
2352 #: build/C/man2/perf_event_open.2:386
2354 "Retired instructions. Be careful, these can be affected by various issues, "
2355 "most notably hardware interrupt counts."
2359 #: build/C/man2/perf_event_open.2:386
2361 msgid "B<PERF_COUNT_HW_CACHE_REFERENCES>"
2365 #: build/C/man2/perf_event_open.2:393
2367 "Cache accesses. Usually this indicates Last Level Cache accesses but this "
2368 "may vary depending on your CPU. This may include prefetches and coherency "
2369 "messages; again this depends on the design of your CPU."
2373 #: build/C/man2/perf_event_open.2:393
2375 msgid "B<PERF_COUNT_HW_CACHE_MISSES>"
2379 #: build/C/man2/perf_event_open.2:400
2381 "Cache misses. Usually this indicates Last Level Cache misses; this is "
2382 "intended to be used in conjunction with the "
2383 "B<PERF_COUNT_HW_CACHE_REFERENCES> event to calculate cache miss rates."
2387 #: build/C/man2/perf_event_open.2:400
2389 msgid "B<PERF_COUNT_HW_BRANCH_INSTRUCTIONS>"
2393 #: build/C/man2/perf_event_open.2:405
2395 "Retired branch instructions. Prior to Linux 2.6.34, this used the wrong "
2396 "event on AMD processors."
2400 #: build/C/man2/perf_event_open.2:405
2402 msgid "B<PERF_COUNT_HW_BRANCH_MISSES>"
2406 #: build/C/man2/perf_event_open.2:408
2407 msgid "Mispredicted branch instructions."
2411 #: build/C/man2/perf_event_open.2:408
2413 msgid "B<PERF_COUNT_HW_BUS_CYCLES>"
2417 #: build/C/man2/perf_event_open.2:411
2418 msgid "Bus cycles, which can be different from total cycles."
2422 #: build/C/man2/perf_event_open.2:411
2424 msgid "B<PERF_COUNT_HW_STALLED_CYCLES_FRONTEND> (since Linux 3.0)"
2428 #: build/C/man2/perf_event_open.2:414
2429 msgid "Stalled cycles during issue."
2433 #: build/C/man2/perf_event_open.2:414
2435 msgid "B<PERF_COUNT_HW_STALLED_CYCLES_BACKEND> (since Linux 3.0)"
2439 #: build/C/man2/perf_event_open.2:417
2440 msgid "Stalled cycles during retirement."
2444 #: build/C/man2/perf_event_open.2:417
2446 msgid "B<PERF_COUNT_HW_REF_CPU_CYCLES> (since Linux 3.3)"
2450 #: build/C/man2/perf_event_open.2:420
2451 msgid "Total cycles; not affected by CPU frequency scaling."
2455 #: build/C/man2/perf_event_open.2:430
2457 "If I<type> is B<PERF_TYPE_SOFTWARE>, we are measuring software events "
2458 "provided by the kernel. Set I<config> to one of the following:"
2462 #: build/C/man2/perf_event_open.2:431
2464 msgid "B<PERF_COUNT_SW_CPU_CLOCK>"
2468 #: build/C/man2/perf_event_open.2:434
2469 msgid "This reports the CPU clock, a high-resolution per-CPU timer."
2473 #: build/C/man2/perf_event_open.2:434
2475 msgid "B<PERF_COUNT_SW_TASK_CLOCK>"
2479 #: build/C/man2/perf_event_open.2:437
2480 msgid "This reports a clock count specific to the task that is running."
2484 #: build/C/man2/perf_event_open.2:437
2486 msgid "B<PERF_COUNT_SW_PAGE_FAULTS>"
2490 #: build/C/man2/perf_event_open.2:440
2491 msgid "This reports the number of page faults."
2495 #: build/C/man2/perf_event_open.2:440
2497 msgid "B<PERF_COUNT_SW_CONTEXT_SWITCHES>"
2501 #: build/C/man2/perf_event_open.2:445
2503 "This counts context switches. Until Linux 2.6.34, these were all reported "
2504 "as user-space events, after that they are reported as happening in the "
2509 #: build/C/man2/perf_event_open.2:445
2511 msgid "B<PERF_COUNT_SW_CPU_MIGRATIONS>"
2515 #: build/C/man2/perf_event_open.2:449
2516 msgid "This reports the number of times the process has migrated to a new CPU."
2520 #: build/C/man2/perf_event_open.2:449
2522 msgid "B<PERF_COUNT_SW_PAGE_FAULTS_MIN>"
2526 #: build/C/man2/perf_event_open.2:453
2528 "This counts the number of minor page faults. These did not require disk I/O "
2533 #: build/C/man2/perf_event_open.2:453
2535 msgid "B<PERF_COUNT_SW_PAGE_FAULTS_MAJ>"
2539 #: build/C/man2/perf_event_open.2:457
2541 "This counts the number of major page faults. These required disk I/O to "
2546 #: build/C/man2/perf_event_open.2:457
2548 msgid "B<PERF_COUNT_SW_ALIGNMENT_FAULTS> (since Linux 2.6.33)"
2552 #: build/C/man2/perf_event_open.2:463
2554 "This counts the number of alignment faults. These happen when unaligned "
2555 "memory accesses happen; the kernel can handle these but it reduces "
2556 "performance. This happens only on some architectures (never on x86)."
2560 #: build/C/man2/perf_event_open.2:463
2562 msgid "B<PERF_COUNT_SW_EMULATION_FAULTS> (since Linux 2.6.33)"
2566 #: build/C/man2/perf_event_open.2:469
2568 "This counts the number of emulation faults. The kernel sometimes traps on "
2569 "unimplemented instructions and emulates them for user space. This can "
2570 "negatively impact performance."
2574 #: build/C/man2/perf_event_open.2:469
2576 msgid "B<PERF_COUNT_SW_DUMMY> (since Linux 3.12)"
2580 #: build/C/man2/perf_event_open.2:476
2582 "This is a placeholder event that counts nothing. Informational sample "
2583 "record types such as mmap or comm must be associated with an active event. "
2584 "This dummy event allows gathering such records without requiring a counting "
2589 #: build/C/man2/perf_event_open.2:489
2591 "If I<type> is B<PERF_TYPE_TRACEPOINT>, then we are measuring kernel "
2592 "tracepoints. The value to use in I<config> can be obtained from under "
2593 "debugfs I<tracing/events/*/*/id> if ftrace is enabled in the kernel."
2597 #: build/C/man2/perf_event_open.2:500
2599 "If I<type> is B<PERF_TYPE_HW_CACHE>, then we are measuring a hardware CPU "
2600 "cache event. To calculate the appropriate I<config> value use the following "
2605 #: build/C/man2/perf_event_open.2:505
2608 " (perf_hw_cache_id) | (perf_hw_cache_op_id E<lt>E<lt> 8) |\n"
2609 " (perf_hw_cache_op_result_id E<lt>E<lt> 16)\n"
2613 #: build/C/man2/perf_event_open.2:510
2614 msgid "where I<perf_hw_cache_id> is one of:"
2618 #: build/C/man2/perf_event_open.2:511
2620 msgid "B<PERF_COUNT_HW_CACHE_L1D>"
2624 #: build/C/man2/perf_event_open.2:514
2625 msgid "for measuring Level 1 Data Cache"
2629 #: build/C/man2/perf_event_open.2:514
2631 msgid "B<PERF_COUNT_HW_CACHE_L1I>"
2635 #: build/C/man2/perf_event_open.2:517
2636 msgid "for measuring Level 1 Instruction Cache"
2640 #: build/C/man2/perf_event_open.2:517
2642 msgid "B<PERF_COUNT_HW_CACHE_LL>"
2646 #: build/C/man2/perf_event_open.2:520
2647 msgid "for measuring Last-Level Cache"
2651 #: build/C/man2/perf_event_open.2:520
2653 msgid "B<PERF_COUNT_HW_CACHE_DTLB>"
2657 #: build/C/man2/perf_event_open.2:523
2658 msgid "for measuring the Data TLB"
2662 #: build/C/man2/perf_event_open.2:523
2664 msgid "B<PERF_COUNT_HW_CACHE_ITLB>"
2668 #: build/C/man2/perf_event_open.2:526
2669 msgid "for measuring the Instruction TLB"
2673 #: build/C/man2/perf_event_open.2:526
2675 msgid "B<PERF_COUNT_HW_CACHE_BPU>"
2679 #: build/C/man2/perf_event_open.2:529
2680 msgid "for measuring the branch prediction unit"
2684 #: build/C/man2/perf_event_open.2:529
2686 msgid "B<PERF_COUNT_HW_CACHE_NODE> (since Linux 3.0)"
2690 #: build/C/man2/perf_event_open.2:532
2691 msgid "for measuring local memory accesses"
2695 #: build/C/man2/perf_event_open.2:537
2696 msgid "and I<perf_hw_cache_op_id> is one of"
2700 #: build/C/man2/perf_event_open.2:538
2702 msgid "B<PERF_COUNT_HW_CACHE_OP_READ>"
2706 #: build/C/man2/perf_event_open.2:541
2707 msgid "for read accesses"
2711 #: build/C/man2/perf_event_open.2:541
2713 msgid "B<PERF_COUNT_HW_CACHE_OP_WRITE>"
2717 #: build/C/man2/perf_event_open.2:544
2718 msgid "for write accesses"
2722 #: build/C/man2/perf_event_open.2:544
2724 msgid "B<PERF_COUNT_HW_CACHE_OP_PREFETCH>"
2728 #: build/C/man2/perf_event_open.2:547
2729 msgid "for prefetch accesses"
2733 #: build/C/man2/perf_event_open.2:552
2734 msgid "and I<perf_hw_cache_op_result_id> is one of"
2738 #: build/C/man2/perf_event_open.2:553
2740 msgid "B<PERF_COUNT_HW_CACHE_RESULT_ACCESS>"
2744 #: build/C/man2/perf_event_open.2:556
2745 msgid "to measure accesses"
2749 #: build/C/man2/perf_event_open.2:556
2751 msgid "B<PERF_COUNT_HW_CACHE_RESULT_MISS>"
2755 #: build/C/man2/perf_event_open.2:559
2756 msgid "to measure misses"
2760 #: build/C/man2/perf_event_open.2:577
2762 "If I<type> is B<PERF_TYPE_RAW>, then a custom \"raw\" I<config> value is "
2763 "needed. Most CPUs support events that are not covered by the "
2764 "\"generalized\" events. These are implementation defined; see your CPU "
2765 "manual (for example the Intel Volume 3B documentation or the AMD BIOS and "
2766 "Kernel Developer Guide). The libpfm4 library can be used to translate from "
2767 "the name in the architectural manuals to the raw hex value "
2768 "B<perf_event_open>() expects in this field."
2772 #: build/C/man2/perf_event_open.2:586
2774 "If I<type> is B<PERF_TYPE_BREAKPOINT>, then leave I<config> set to zero. "
2775 "Its parameters are set in other places."
2779 #: build/C/man2/perf_event_open.2:587
2781 msgid "I<sample_period>, I<sample_freq>"
2785 #: build/C/man2/perf_event_open.2:599
2787 "A \"sampling\" counter is one that generates an interrupt every N events, "
2788 "where N is given by I<sample_period>. A sampling counter has "
2789 "I<sample_period> E<gt> 0. When an overflow interrupt occurs, requested data "
2790 "is recorded in the mmap buffer. The I<sample_type> field controls what data "
2791 "is recorded on each interrupt."
2795 #: build/C/man2/perf_event_open.2:609
2797 "I<sample_freq> can be used if you wish to use frequency rather than period. "
2798 "In this case, you set the I<freq> flag. The kernel will adjust the sampling "
2799 "period to try and achieve the desired rate. The rate of adjustment is a "
2804 #: build/C/man2/perf_event_open.2:609
2806 msgid "I<sample_type>"
2810 #: build/C/man2/perf_event_open.2:621
2812 "The various bits in this field specify which values to include in the "
2813 "sample. They will be recorded in a ring-buffer, which is available to user "
2814 "space using B<mmap>(2). The order in which the values are saved in the "
2815 "sample are documented in the MMAP Layout subsection below; it is not the "
2816 "I<enum perf_event_sample_format> order."
2820 #: build/C/man2/perf_event_open.2:622
2822 msgid "B<PERF_SAMPLE_IP>"
2826 #: build/C/man2/perf_event_open.2:625
2827 msgid "Records instruction pointer."
2831 #: build/C/man2/perf_event_open.2:625
2833 msgid "B<PERF_SAMPLE_TID>"
2837 #: build/C/man2/perf_event_open.2:628
2838 msgid "Records the process and thread IDs."
2842 #: build/C/man2/perf_event_open.2:628
2844 msgid "B<PERF_SAMPLE_TIME>"
2848 #: build/C/man2/perf_event_open.2:631
2849 msgid "Records a timestamp."
2853 #: build/C/man2/perf_event_open.2:631
2855 msgid "B<PERF_SAMPLE_ADDR>"
2859 #: build/C/man2/perf_event_open.2:634
2860 msgid "Records an address, if applicable."
2864 #: build/C/man2/perf_event_open.2:634
2866 msgid "B<PERF_SAMPLE_READ>"
2870 #: build/C/man2/perf_event_open.2:637
2871 msgid "Record counter values for all events in a group, not just the group leader."
2875 #: build/C/man2/perf_event_open.2:637
2877 msgid "B<PERF_SAMPLE_CALLCHAIN>"
2881 #: build/C/man2/perf_event_open.2:640
2882 msgid "Records the callchain (stack backtrace)."
2886 #: build/C/man2/perf_event_open.2:640
2888 msgid "B<PERF_SAMPLE_ID>"
2892 #: build/C/man2/perf_event_open.2:643
2893 msgid "Records a unique ID for the opened event's group leader."
2897 #: build/C/man2/perf_event_open.2:643
2899 msgid "B<PERF_SAMPLE_CPU>"
2903 #: build/C/man2/perf_event_open.2:646
2904 msgid "Records CPU number."
2908 #: build/C/man2/perf_event_open.2:646
2910 msgid "B<PERF_SAMPLE_PERIOD>"
2914 #: build/C/man2/perf_event_open.2:649
2915 msgid "Records the current sampling period."
2919 #: build/C/man2/perf_event_open.2:649
2921 msgid "B<PERF_SAMPLE_STREAM_ID>"
2925 #: build/C/man2/perf_event_open.2:657
2927 "Records a unique ID for the opened event. Unlike B<PERF_SAMPLE_ID> the "
2928 "actual ID is returned, not the group leader. This ID is the same as the one "
2929 "returned by B<PERF_FORMAT_ID>."
2933 #: build/C/man2/perf_event_open.2:657
2935 msgid "B<PERF_SAMPLE_RAW>"
2939 #: build/C/man2/perf_event_open.2:661
2941 "Records additional data, if applicable. Usually returned by tracepoint "
2946 #: build/C/man2/perf_event_open.2:661
2948 msgid "B<PERF_SAMPLE_BRANCH_STACK> (since Linux 3.4)"
2952 #: build/C/man2/perf_event_open.2:666
2954 "This provides a record of recent branches, as provided by CPU branch "
2955 "sampling hardware (such as Intel Last Branch Record). Not all hardware "
2956 "supports this feature."
2960 #: build/C/man2/perf_event_open.2:670
2962 "See the I<branch_sample_type> field for how to filter which branches are "
2967 #: build/C/man2/perf_event_open.2:670
2969 msgid "B<PERF_SAMPLE_REGS_USER> (since Linux 3.7)"
2973 #: build/C/man2/perf_event_open.2:674
2975 "Records the current user-level CPU register state (the values in the process "
2976 "before the kernel was called)."
2980 #: build/C/man2/perf_event_open.2:674
2982 msgid "B<PERF_SAMPLE_STACK_USER> (since Linux 3.7)"
2986 #: build/C/man2/perf_event_open.2:677
2987 msgid "Records the user level stack, allowing stack unwinding."
2991 #: build/C/man2/perf_event_open.2:677
2993 msgid "B<PERF_SAMPLE_WEIGHT> (since Linux 3.10)"
2997 #: build/C/man2/perf_event_open.2:683
2999 "Records a hardware provided weight value that expresses how costly the "
3000 "sampled event was. This allows the hardware to highlight expensive events "
3005 #: build/C/man2/perf_event_open.2:683
3007 msgid "B<PERF_SAMPLE_DATA_SRC> (since Linux 3.10)"
3011 #: build/C/man2/perf_event_open.2:689
3013 "Records the data source: where in the memory hierarchy the data associated "
3014 "with the sampled instruction came from. This is only available if the "
3015 "underlying hardware supports this feature."
3019 #: build/C/man2/perf_event_open.2:689
3021 msgid "B<PERF_SAMPLE_IDENTIFIER> (since Linux 3.12)"
3025 #: build/C/man2/perf_event_open.2:696
3027 "Places the B<SAMPLE_ID> value in a fixed position in the record, either at "
3028 "the beginning (for sample events) or at the end (if a non-sample event)."
3032 #: build/C/man2/perf_event_open.2:708
3034 "This was necessary because a sample stream may have records from various "
3035 "different event sources with different I<sample_type> settings. Parsing the "
3036 "event stream properly was not possible because the format of the record was "
3037 "needed to find B<SAMPLE_ID>, but the format could not be found without "
3038 "knowing what event the sample belonged to (causing a circular dependency)."
3042 #: build/C/man2/perf_event_open.2:718
3044 "This new B<PERF_SAMPLE_IDENTIFIER> setting makes the event stream always "
3045 "parsable by putting B<SAMPLE_ID> in a fixed location, even though it means "
3046 "having duplicate B<SAMPLE_ID> values in records."
3050 #: build/C/man2/perf_event_open.2:718
3052 msgid "B<PERF_SAMPLE_TRANSACTION> (Since Linux 3.13)"
3056 #: build/C/man2/perf_event_open.2:722
3058 "Records reasons for transactional memory abort events (for example, from "
3059 "Intel TSX transactional memory support)."
3063 #: build/C/man2/perf_event_open.2:730
3065 "The I<precise_ip> setting must be greater than 0 and a transactional memory "
3066 "abort event must be measured or no values will be recorded. Also note that "
3067 "some perf_event measurements, such as sampled cycle counting, may cause "
3068 "extraneous aborts (by causing an interrupt during a transaction)."
3072 #: build/C/man2/perf_event_open.2:731
3074 msgid "I<read_format>"
3078 #: build/C/man2/perf_event_open.2:738
3080 "This field specifies the format of the data returned by B<read>(2) on a "
3081 "B<perf_event_open>() file descriptor."
3085 #: build/C/man2/perf_event_open.2:739
3087 msgid "B<PERF_FORMAT_TOTAL_TIME_ENABLED>"
3091 #: build/C/man2/perf_event_open.2:746
3093 "Adds the 64-bit I<time_enabled> field. This can be used to calculate "
3094 "estimated totals if the PMU is overcommitted and multiplexing is happening."
3098 #: build/C/man2/perf_event_open.2:746
3100 msgid "B<PERF_FORMAT_TOTAL_TIME_RUNNING>"
3104 #: build/C/man2/perf_event_open.2:753
3106 "Adds the 64-bit I<time_running> field. This can be used to calculate "
3107 "estimated totals if the PMU is overcommitted and multiplexing is happening."
3111 #: build/C/man2/perf_event_open.2:753
3113 msgid "B<PERF_FORMAT_ID>"
3117 #: build/C/man2/perf_event_open.2:756
3118 msgid "Adds a 64-bit unique value that corresponds to the event group."
3122 #: build/C/man2/perf_event_open.2:756
3124 msgid "B<PERF_FORMAT_GROUP>"
3128 #: build/C/man2/perf_event_open.2:759
3129 msgid "Allows all counter values in an event group to be read with one read."
3133 #: build/C/man2/perf_event_open.2:760
3139 #: build/C/man2/perf_event_open.2:770
3141 "The I<disabled> bit specifies whether the counter starts out disabled or "
3142 "enabled. If disabled, the event can later be enabled by B<ioctl>(2), "
3143 "B<prctl>(2), or I<enable_on_exec>."
3147 #: build/C/man2/perf_event_open.2:781
3149 "When creating an event group, typically the group leader is initialized with "
3150 "I<disabled> set to 1 and any child events are initialized with I<disabled> "
3151 "set to 0. Despite I<disabled> being 0, the child events will not start "
3152 "until the group leader is enabled."
3156 #: build/C/man2/perf_event_open.2:781
3162 #: build/C/man2/perf_event_open.2:790
3164 "The I<inherit> bit specifies that this counter should count events of child "
3165 "tasks as well as the task specified. This applies only to new children, not "
3166 "to any existing children at the time the counter is created (nor to any new "
3167 "children of existing children)."
3171 #: build/C/man2/perf_event_open.2:795
3173 "Inherit does not work for some combinations of I<read_format>s, such as "
3174 "B<PERF_FORMAT_GROUP>."
3178 #: build/C/man2/perf_event_open.2:795
3184 #: build/C/man2/perf_event_open.2:808
3186 "The I<pinned> bit specifies that the counter should always be on the CPU if "
3187 "at all possible. It applies only to hardware counters and only to group "
3188 "leaders. If a pinned counter cannot be put onto the CPU (e.g., because "
3189 "there are not enough hardware counters or because of a conflict with some "
3190 "other event), then the counter goes into an 'error' state, where reads "
3191 "return end-of-file (i.e., B<read>(2) returns 0) until the counter is "
3192 "subsequently enabled or disabled."
3196 #: build/C/man2/perf_event_open.2:808
3198 msgid "I<exclusive>"
3202 #: build/C/man2/perf_event_open.2:817
3204 "The I<exclusive> bit specifies that when this counter's group is on the CPU, "
3205 "it should be the only group using the CPU's counters. In the future this "
3206 "may allow monitoring programs to support PMU features that need to run alone "
3207 "so that they do not disrupt other hardware counters."
3211 #: build/C/man2/perf_event_open.2:824
3213 "Note that many unexpected situations may prevent events with the "
3214 "I<exclusive> bit set from ever running. This includes any users running a "
3215 "system-wide measurement as well as any kernel use of the performance "
3216 "counters (including the commonly enabled NMI Watchdog Timer interface)."
3220 #: build/C/man2/perf_event_open.2:824
3222 msgid "I<exclude_user>"
3226 #: build/C/man2/perf_event_open.2:827
3227 msgid "If this bit is set, the count excludes events that happen in user space."
3231 #: build/C/man2/perf_event_open.2:827
3233 msgid "I<exclude_kernel>"
3237 #: build/C/man2/perf_event_open.2:830
3238 msgid "If this bit is set, the count excludes events that happen in kernel-space."
3242 #: build/C/man2/perf_event_open.2:830
3244 msgid "I<exclude_hv>"
3248 #: build/C/man2/perf_event_open.2:838
3250 "If this bit is set, the count excludes events that happen in the "
3251 "hypervisor. This is mainly for PMUs that have built-in support for handling "
3252 "this (such as POWER). Extra support is needed for handling hypervisor "
3253 "measurements on most machines."
3257 #: build/C/man2/perf_event_open.2:838
3259 msgid "I<exclude_idle>"
3263 #: build/C/man2/perf_event_open.2:841
3264 msgid "If set, don't count when the CPU is idle."
3268 #: build/C/man2/perf_event_open.2:841
3274 #: build/C/man2/perf_event_open.2:855
3276 "The I<mmap> bit enables generation of B<PERF_RECORD_MMAP> samples for every "
3277 "B<mmap>(2) call that has B<PROT_EXEC> set. This allows tools to notice new "
3278 "executable code being mapped into a program (dynamic shared libraries for "
3279 "example) so that addresses can be mapped back to the original code."
3283 #: build/C/man2/perf_event_open.2:855
3289 #: build/C/man2/perf_event_open.2:866
3291 "The I<comm> bit enables tracking of process command name as modified by the "
3292 "B<exec>(2) and B<prctl>(PR_SET_NAME) system calls. Unfortunately for "
3293 "tools, there is no way to distinguish one system call versus the other."
3297 #: build/C/man2/perf_event_open.2:866
3303 #: build/C/man2/perf_event_open.2:873
3305 "If this bit is set, then I<sample_frequency> not I<sample_period> is used "
3306 "when setting up the sampling interval."
3310 #: build/C/man2/perf_event_open.2:873
3312 msgid "I<inherit_stat>"
3316 #: build/C/man2/perf_event_open.2:880
3318 "This bit enables saving of event counts on context switch for inherited "
3319 "tasks. This is meaningful only if the I<inherit> field is set."
3323 #: build/C/man2/perf_event_open.2:880
3325 msgid "I<enable_on_exec>"
3329 #: build/C/man2/perf_event_open.2:885
3331 "If this bit is set, a counter is automatically enabled after a call to "
3336 #: build/C/man2/perf_event_open.2:885
3342 #: build/C/man2/perf_event_open.2:889
3344 "If this bit is set, then fork/exit notifications are included in the ring "
3349 #: build/C/man2/perf_event_open.2:889
3351 msgid "I<watermark>"
3355 #: build/C/man2/perf_event_open.2:897
3357 "If set, have a sampling interrupt happen when we cross the "
3358 "I<wakeup_watermark> boundary. Otherwise interrupts happen after "
3359 "I<wakeup_events> samples."
3363 #: build/C/man2/perf_event_open.2:897
3365 msgid "I<precise_ip> (since Linux 2.6.35)"
3369 #: build/C/man2/perf_event_open.2:907
3371 "This controls the amount of skid. Skid is how many instructions execute "
3372 "between an event of interest happening and the kernel being able to stop and "
3373 "record the event. Smaller skid is better and allows more accurate reporting "
3374 "of which events correspond to which instructions, but hardware is often "
3375 "limited with how small this can be."
3379 #: build/C/man2/perf_event_open.2:909
3380 msgid "The values of this are the following:"
3384 #: build/C/man2/perf_event_open.2:910
3390 #: build/C/man2/perf_event_open.2:914
3391 msgid "B<SAMPLE_IP> can have arbitrary skid."
3395 #: build/C/man2/perf_event_open.2:914
3401 #: build/C/man2/perf_event_open.2:918
3402 msgid "B<SAMPLE_IP> must have constant skid."
3406 #: build/C/man2/perf_event_open.2:918
3412 #: build/C/man2/perf_event_open.2:922
3413 msgid "B<SAMPLE_IP> requested to have 0 skid."
3417 #: build/C/man2/perf_event_open.2:922
3423 #: build/C/man2/perf_event_open.2:928
3424 msgid "B<SAMPLE_IP> must have 0 skid. See also B<PERF_RECORD_MISC_EXACT_IP>."
3428 #: build/C/man2/perf_event_open.2:929
3430 msgid "I<mmap_data> (since Linux 2.6.36)"
3434 #: build/C/man2/perf_event_open.2:941
3436 "The counterpart of the I<mmap> field. This enables generation of "
3437 "B<PERF_RECORD_MMAP> samples for B<mmap>(2) calls that do not have "
3438 "B<PROT_EXEC> set (for example data and SysV shared memory)."
3442 #: build/C/man2/perf_event_open.2:941
3444 msgid "I<sample_id_all> (since Linux 2.6.38)"
3448 #: build/C/man2/perf_event_open.2:949
3450 "If set, then TID, TIME, ID, STREAM_ID, and CPU can additionally be included "
3451 "in non-B<PERF_RECORD_SAMPLE>s if the corresponding I<sample_type> is "
3456 #: build/C/man2/perf_event_open.2:957
3458 "If B<PERF_SAMPLE_IDENTIFIER> is specified, then an additional ID value is "
3459 "included as the last value to ease parsing the record stream. This may lead "
3460 "to the I<id> value appearing twice."
3464 #: build/C/man2/perf_event_open.2:959
3465 msgid "The layout is described by this pseudo-structure:"
3469 #: build/C/man2/perf_event_open.2:969
3472 "struct sample_id {\n"
3473 " { u32 pid, tid; } /* if PERF_SAMPLE_TID set */\n"
3474 " { u64 time; } /* if PERF_SAMPLE_TIME set */\n"
3475 " { u64 id; } /* if PERF_SAMPLE_ID set */\n"
3476 " { u64 stream_id;} /* if PERF_SAMPLE_STREAM_ID set */\n"
3477 " { u32 cpu, res; } /* if PERF_SAMPLE_CPU set */\n"
3478 " { u64 id; } /* if PERF_SAMPLE_IDENTIFIER set */\n"
3483 #: build/C/man2/perf_event_open.2:970
3485 msgid "I<exclude_host> (since Linux 3.2)"
3489 #: build/C/man2/perf_event_open.2:973
3490 msgid "Do not measure time spent in VM host."
3494 #: build/C/man2/perf_event_open.2:973
3496 msgid "I<exclude_guest> (since Linux 3.2)"
3500 #: build/C/man2/perf_event_open.2:976
3501 msgid "Do not measure time spent in VM guest."
3505 #: build/C/man2/perf_event_open.2:976
3507 msgid "I<exclude_callchain_kernel> (since Linux 3.7)"
3511 #: build/C/man2/perf_event_open.2:979
3512 msgid "Do not include kernel callchains."
3516 #: build/C/man2/perf_event_open.2:979
3518 msgid "I<exclude_callchain_user> (since Linux 3.7)"
3522 #: build/C/man2/perf_event_open.2:982
3523 msgid "Do not include user callchains."
3527 #: build/C/man2/perf_event_open.2:982
3529 msgid "I<wakeup_events>, I<wakeup_watermark>"
3533 #: build/C/man2/perf_event_open.2:992
3535 "This union sets how many samples (I<wakeup_events>) or bytes "
3536 "(I<wakeup_watermark>) happen before an overflow signal happens. Which one "
3537 "is used is selected by the I<watermark> bitflag."
3541 #: build/C/man2/perf_event_open.2:1002
3543 "I<wakeup_events> only counts B<PERF_RECORD_SAMPLE> record types. To receive "
3544 "a signal for every incoming B<PERF_RECORD> type set I<wakeup_watermark> to "
3549 #: build/C/man2/perf_event_open.2:1002
3551 msgid "I<bp_type> (since Linux 2.6.33)"
3555 #: build/C/man2/perf_event_open.2:1006
3556 msgid "This chooses the breakpoint type. It is one of:"
3560 #: build/C/man2/perf_event_open.2:1007
3562 msgid "B<HW_BREAKPOINT_EMPTY>"
3566 #: build/C/man2/perf_event_open.2:1010
3567 msgid "No breakpoint."
3571 #: build/C/man2/perf_event_open.2:1010
3573 msgid "B<HW_BREAKPOINT_R>"
3577 #: build/C/man2/perf_event_open.2:1013
3578 msgid "Count when we read the memory location."
3582 #: build/C/man2/perf_event_open.2:1013
3584 msgid "B<HW_BREAKPOINT_W>"
3588 #: build/C/man2/perf_event_open.2:1016
3589 msgid "Count when we write the memory location."
3593 #: build/C/man2/perf_event_open.2:1016
3595 msgid "B<HW_BREAKPOINT_RW>"
3599 #: build/C/man2/perf_event_open.2:1019
3600 msgid "Count when we read or write the memory location."
3604 #: build/C/man2/perf_event_open.2:1019
3606 msgid "B<HW_BREAKPOINT_X>"
3610 #: build/C/man2/perf_event_open.2:1022
3611 msgid "Count when we execute code at the memory location."
3615 #: build/C/man2/perf_event_open.2:1031
3617 "The values can be combined via a bitwise or, but the combination of "
3618 "B<HW_BREAKPOINT_R> or B<HW_BREAKPOINT_W> with B<HW_BREAKPOINT_X> is not "
3623 #: build/C/man2/perf_event_open.2:1032
3625 msgid "I<bp_addr> (since Linux 2.6.33)"
3629 #: build/C/man2/perf_event_open.2:1039
3631 "I<bp_addr> address of the breakpoint. For execution breakpoints this is the "
3632 "memory address of the instruction of interest; for read and write "
3633 "breakpoints it is the memory address of the memory location of interest."
3637 #: build/C/man2/perf_event_open.2:1039
3639 msgid "I<config1> (since Linux 2.6.39)"
3643 #: build/C/man2/perf_event_open.2:1046
3645 "I<config1> is used for setting events that need an extra register or "
3646 "otherwise do not fit in the regular config field. Raw OFFCORE_EVENTS on "
3647 "Nehalem/Westmere/SandyBridge use this field on 3.3 and later kernels."
3651 #: build/C/man2/perf_event_open.2:1046
3653 msgid "I<bp_len> (since Linux 2.6.33)"
3657 #: build/C/man2/perf_event_open.2:1060
3659 "I<bp_len> is the length of the breakpoint being measured if I<type> is "
3660 "B<PERF_TYPE_BREAKPOINT>. Options are B<HW_BREAKPOINT_LEN_1>, "
3661 "B<HW_BREAKPOINT_LEN_2>, B<HW_BREAKPOINT_LEN_4>, B<HW_BREAKPOINT_LEN_8>. For "
3662 "an execution breakpoint, set this to I<sizeof(long)>."
3666 #: build/C/man2/perf_event_open.2:1060
3668 msgid "I<config2> (since Linux 2.6.39)"
3672 #: build/C/man2/perf_event_open.2:1067
3673 msgid "I<config2> is a further extension of the I<config1> field."
3677 #: build/C/man2/perf_event_open.2:1067
3679 msgid "I<branch_sample_type> (since Linux 3.4)"
3683 #: build/C/man2/perf_event_open.2:1073
3685 "If B<PERF_SAMPLE_BRANCH_STACK> is enabled, then this specifies what branches "
3686 "to include in the branch record."
3690 #: build/C/man2/perf_event_open.2:1079
3692 "The first part of the value is the privilege level, which is a combination "
3693 "of one of the following values. If the user does not set privilege level "
3694 "explicitly, the kernel will use the event's privilege level. Event and "
3695 "branch privilege levels do not have to match."
3699 #: build/C/man2/perf_event_open.2:1080
3701 msgid "B<PERF_SAMPLE_BRANCH_USER>"
3705 #: build/C/man2/perf_event_open.2:1083
3706 msgid "Branch target is in user space."
3710 #: build/C/man2/perf_event_open.2:1083
3712 msgid "B<PERF_SAMPLE_BRANCH_KERNEL>"
3716 #: build/C/man2/perf_event_open.2:1086
3717 msgid "Branch target is in kernel space."
3721 #: build/C/man2/perf_event_open.2:1086
3723 msgid "B<PERF_SAMPLE_BRANCH_HV>"
3727 #: build/C/man2/perf_event_open.2:1089
3728 msgid "Branch target is in hypervisor."
3732 #: build/C/man2/perf_event_open.2:1089
3734 msgid "B<PERF_SAMPLE_BRANCH_PLM_ALL>"
3738 #: build/C/man2/perf_event_open.2:1092
3739 msgid "A convenience value that is the three preceding values ORed together."
3743 #: build/C/man2/perf_event_open.2:1096
3745 "In addition to the privilege value, at least one or more of the following "
3750 #: build/C/man2/perf_event_open.2:1097
3752 msgid "B<PERF_SAMPLE_BRANCH_ANY>"
3756 #: build/C/man2/perf_event_open.2:1100
3757 msgid "Any branch type."
3761 #: build/C/man2/perf_event_open.2:1100
3763 msgid "B<PERF_SAMPLE_BRANCH_ANY_CALL>"
3767 #: build/C/man2/perf_event_open.2:1103
3768 msgid "Any call branch."
3772 #: build/C/man2/perf_event_open.2:1103
3774 msgid "B<PERF_SAMPLE_BRANCH_ANY_RETURN>"
3778 #: build/C/man2/perf_event_open.2:1106
3779 msgid "Any return branch."
3783 #: build/C/man2/perf_event_open.2:1106
3785 msgid "B<PERF_SAMPLE_BRANCH_IND_CALL>"
3789 #: build/C/man2/perf_event_open.2:1109
3790 msgid "Indirect calls."
3794 #: build/C/man2/perf_event_open.2:1109
3796 msgid "B<PERF_SAMPLE_BRANCH_ABORT_TX> (since Linux 3.11)"
3800 #: build/C/man2/perf_event_open.2:1112
3801 msgid "Transactional memory aborts."
3805 #: build/C/man2/perf_event_open.2:1112
3807 msgid "B<PERF_SAMPLE_BRANCH_IN_TX> (since Linux 3.11)"
3811 #: build/C/man2/perf_event_open.2:1115
3812 msgid "Branch in transactional memory transaction."
3816 #: build/C/man2/perf_event_open.2:1115
3818 msgid "B<PERF_SAMPLE_BRANCH_NO_TX> (since Linux 3.11)"
3822 #: build/C/man2/perf_event_open.2:1118
3823 msgid "Branch not in transactional memory transaction."
3827 #: build/C/man2/perf_event_open.2:1120
3829 msgid "I<sample_regs_user> (since Linux 3.7)"
3833 #: build/C/man2/perf_event_open.2:1126
3835 "This bit mask defines the set of user CPU registers to dump on samples. The "
3836 "layout of the register mask is architecture-specific and described in the "
3837 "kernel header I<arch/ARCH/include/uapi/asm/perf_regs.h>."
3841 #: build/C/man2/perf_event_open.2:1126
3843 msgid "I<sample_stack_user> (since Linux 3.7)"
3847 #: build/C/man2/perf_event_open.2:1131
3849 "This defines the size of the user stack to dump if B<PERF_SAMPLE_STACK_USER> "
3854 #: build/C/man2/perf_event_open.2:1131
3856 msgid "Reading results"
3860 #: build/C/man2/perf_event_open.2:1141
3862 "Once a B<perf_event_open>() file descriptor has been opened, the values of "
3863 "the events can be read from the file descriptor. The values that are there "
3864 "are specified by the I<read_format> field in the I<attr> structure at open "
3869 #: build/C/man2/perf_event_open.2:1146
3871 "If you attempt to read into a buffer that is not big enough to hold the data "
3872 "B<ENOSPC> is returned"
3876 #: build/C/man2/perf_event_open.2:1148
3877 msgid "Here is the layout of the data returned by a read:"
3881 #: build/C/man2/perf_event_open.2:1148 build/C/man2/perf_event_open.2:1166 build/C/man2/ptrace.2:1692 build/C/man2/ptrace.2:1702 build/C/man2/ptrace.2:1710 build/C/man2/ptrace.2:1716 build/C/man2/ptrace.2:1845
3887 #: build/C/man2/perf_event_open.2:1152
3889 "If B<PERF_FORMAT_GROUP> was specified to allow reading all events in a group "
3894 #: build/C/man2/perf_event_open.2:1164
3897 "struct read_format {\n"
3898 " u64 nr; /* The number of events */\n"
3899 " u64 time_enabled; /* if PERF_FORMAT_TOTAL_TIME_ENABLED */\n"
3900 " u64 time_running; /* if PERF_FORMAT_TOTAL_TIME_RUNNING */\n"
3902 " u64 value; /* The value of the event */\n"
3903 " u64 id; /* if PERF_FORMAT_ID */\n"
3909 #: build/C/man2/perf_event_open.2:1172
3910 msgid "If B<PERF_FORMAT_GROUP> was I<not> specified:"
3914 #: build/C/man2/perf_event_open.2:1181
3917 "struct read_format {\n"
3918 " u64 value; /* The value of the event */\n"
3919 " u64 time_enabled; /* if PERF_FORMAT_TOTAL_TIME_ENABLED */\n"
3920 " u64 time_running; /* if PERF_FORMAT_TOTAL_TIME_RUNNING */\n"
3921 " u64 id; /* if PERF_FORMAT_ID */\n"
3926 #: build/C/man2/perf_event_open.2:1185
3927 msgid "The values read are as follows:"
3931 #: build/C/man2/perf_event_open.2:1185
3937 #: build/C/man2/perf_event_open.2:1191
3939 "The number of events in this file descriptor. Only available if "
3940 "B<PERF_FORMAT_GROUP> was specified."
3944 #: build/C/man2/perf_event_open.2:1191
3946 msgid "I<time_enabled>, I<time_running>"
3950 #: build/C/man2/perf_event_open.2:1203
3952 "Total time the event was enabled and running. Normally these are the same. "
3953 "If more events are started, then available counter slots on the PMU, then "
3954 "multiplexing happens and events run only part of the time. In that case, "
3955 "the I<time_enabled> and I<time running> values can be used to scale an "
3956 "estimated value for the count."
3960 #: build/C/man2/perf_event_open.2:1203
3966 #: build/C/man2/perf_event_open.2:1206
3967 msgid "An unsigned 64-bit value containing the counter result."
3971 #: build/C/man2/perf_event_open.2:1206 build/C/man2/perf_event_open.2:1602 build/C/man2/perf_event_open.2:1756
3977 #: build/C/man2/perf_event_open.2:1212
3979 "A globally unique value for this particular event, only there if "
3980 "B<PERF_FORMAT_ID> was specified in I<read_format>."
3984 #: build/C/man2/perf_event_open.2:1212
3990 #: build/C/man2/perf_event_open.2:1222
3992 "When using B<perf_event_open>() in sampled mode, asynchronous events (like "
3993 "counter overflow or B<PROT_EXEC> mmap tracking) are logged into a "
3994 "ring-buffer. This ring-buffer is created and accessed through B<mmap>(2)."
3998 #: build/C/man2/perf_event_open.2:1228
4000 "The mmap size should be 1+2^n pages, where the first page is a metadata page "
4001 "(I<struct perf_event_mmap_page>) that contains various bits of information "
4002 "such as where the ring-buffer head is."
4006 #: build/C/man2/perf_event_open.2:1231
4008 "Before kernel 2.6.39, there is a bug that means you must allocate a mmap "
4009 "ring buffer when sampling even if you do not plan to access it."
4013 #: build/C/man2/perf_event_open.2:1233
4014 msgid "The structure of the first metadata mmap page is as follows:"
4018 #: build/C/man2/perf_event_open.2:1262
4021 "struct perf_event_mmap_page {\n"
4022 " __u32 version; /* version number of this structure */\n"
4023 " __u32 compat_version; /* lowest version this is compat with */\n"
4024 " __u32 lock; /* seqlock for synchronization */\n"
4025 " __u32 index; /* hardware counter identifier */\n"
4026 " __s64 offset; /* add to hardware counter value */\n"
4027 " __u64 time_enabled; /* time event active */\n"
4028 " __u64 time_running; /* time event on CPU */\n"
4030 " __u64 capabilities;\n"
4032 " __u64 cap_usr_time / cap_usr_rdpmc / cap_bit0 : 1,\n"
4033 " cap_bit0_is_deprecated : 1,\n"
4034 " cap_user_rdpmc : 1,\n"
4035 " cap_user_time : 1,\n"
4036 " cap_user_time_zero : 1,\n"
4039 " __u16 pmc_width;\n"
4040 " __u16 time_shift;\n"
4041 " __u32 time_mult;\n"
4042 " __u64 time_offset;\n"
4043 " __u64 __reserved[120]; /* Pad to 1k */\n"
4044 " __u64 data_head; /* head in the data section */\n"
4045 " __u64 data_tail; /* user-space written tail */\n"
4050 #: build/C/man2/perf_event_open.2:1268
4052 "The following list describes the fields in the I<perf_event_mmap_page> "
4053 "structure in more detail:"
4057 #: build/C/man2/perf_event_open.2:1268
4063 #: build/C/man2/perf_event_open.2:1271
4064 msgid "Version number of this structure."
4068 #: build/C/man2/perf_event_open.2:1271
4070 msgid "I<compat_version>"
4074 #: build/C/man2/perf_event_open.2:1274
4075 msgid "The lowest version this is compatible with."
4079 #: build/C/man2/perf_event_open.2:1274
4085 #: build/C/man2/perf_event_open.2:1277
4086 msgid "A seqlock for synchronization."
4090 #: build/C/man2/perf_event_open.2:1277
4096 #: build/C/man2/perf_event_open.2:1280
4097 msgid "A unique hardware counter identifier."
4101 #: build/C/man2/perf_event_open.2:1280
4107 #: build/C/man2/perf_event_open.2:1285
4109 "When using rdpmc for reads this offset value must be added to the one "
4110 "returned by rdpmc to get the current total event count."
4114 #: build/C/man2/perf_event_open.2:1285
4116 msgid "I<time_enabled>"
4120 #: build/C/man2/perf_event_open.2:1288
4121 msgid "Time the event was active."
4125 #: build/C/man2/perf_event_open.2:1288
4127 msgid "I<time_running>"
4131 #: build/C/man2/perf_event_open.2:1291
4132 msgid "Time the event was running."
4136 #: build/C/man2/perf_event_open.2:1291
4138 msgid "I<cap_usr_time> / I<cap_usr_rdpmc> / I<cap_bit0> (since Linux 3.4)"
4142 #: build/C/man2/perf_event_open.2:1304
4144 "There was a bug in the definition of I<cap_usr_time> and I<cap_usr_rdpmc> "
4145 "from Linux 3.4 until Linux 3.11. Both bits were defined to point to the "
4146 "same location, so it was impossible to know if I<cap_usr_time> or "
4147 "I<cap_usr_rdpmc> were actually set."
4151 #: build/C/man2/perf_event_open.2:1312
4153 "Starting with 3.12 these are renamed to I<cap_bit0> and you should use the "
4154 "new I<cap_user_time> and I<cap_user_rdpmc> fields instead."
4158 #: build/C/man2/perf_event_open.2:1313
4160 msgid "I<cap_bit0_is_deprecated> (since Linux 3.12)"
4164 #: build/C/man2/perf_event_open.2:1321
4166 "If set, this bit indicates that the kernel supports the properly separated "
4167 "I<cap_user_time> and I<cap_user_rdpmc> bits."
4171 #: build/C/man2/perf_event_open.2:1328
4173 "If not-set, it indicates an older kernel where I<cap_usr_time> and "
4174 "I<cap_usr_rdpmc> map to the same bit and thus both features should be used "
4179 #: build/C/man2/perf_event_open.2:1329
4181 msgid "I<cap_user_rdpmc> (since Linux 3.12)"
4185 #: build/C/man2/perf_event_open.2:1334
4187 "If the hardware supports user-space read of performance counters without "
4188 "syscall (this is the \"rdpmc\" instruction on x86), then the following code "
4189 "can be used to do a read:"
4193 #: build/C/man2/perf_event_open.2:1340
4196 "u32 seq, time_mult, time_shift, idx, width;\n"
4197 "u64 count, enabled, running;\n"
4198 "u64 cyc, time_offset;\n"
4202 #: build/C/man2/perf_event_open.2:1346
4206 " seq = pc-E<gt>lock;\n"
4208 " enabled = pc-E<gt>time_enabled;\n"
4209 " running = pc-E<gt>time_running;\n"
4213 #: build/C/man2/perf_event_open.2:1353
4216 " if (pc-E<gt>cap_usr_time && enabled != running) {\n"
4218 " time_offset = pc-E<gt>time_offset;\n"
4219 " time_mult = pc-E<gt>time_mult;\n"
4220 " time_shift = pc-E<gt>time_shift;\n"
4225 #: build/C/man2/perf_event_open.2:1356
4228 " idx = pc-E<gt>index;\n"
4229 " count = pc-E<gt>offset;\n"
4233 #: build/C/man2/perf_event_open.2:1361
4236 " if (pc-E<gt>cap_usr_rdpmc && idx) {\n"
4237 " width = pc-E<gt>pmc_width;\n"
4238 " count += rdpmc(idx - 1);\n"
4243 #: build/C/man2/perf_event_open.2:1364
4247 "} while (pc-E<gt>lock != seq);\n"
4251 #: build/C/man2/perf_event_open.2:1366
4253 msgid "I<cap_user_time (since Linux 3.12)>"
4257 #: build/C/man2/perf_event_open.2:1370
4259 "This bit indicates the hardware has a constant, nonstop timestamp counter "
4264 #: build/C/man2/perf_event_open.2:1370
4266 msgid "I<cap_user_time_zero> (since Linux 3.12)"
4270 #: build/C/man2/perf_event_open.2:1376
4272 "Indicates the presence of I<time_zero> which allows mapping timestamp values "
4273 "to the hardware clock."
4277 #: build/C/man2/perf_event_open.2:1376
4279 msgid "I<pmc_width>"
4283 #: build/C/man2/perf_event_open.2:1383
4285 "If I<cap_usr_rdpmc>, this field provides the bit-width of the value read "
4286 "using the rdpmc or equivalent instruction. This can be used to sign extend "
4291 #: build/C/man2/perf_event_open.2:1389
4294 "pmc E<lt>E<lt>= 64 - pmc_width;\n"
4295 "pmc E<gt>E<gt>= 64 - pmc_width; // signed shift right\n"
4300 #: build/C/man2/perf_event_open.2:1391
4302 msgid "I<time_shift>, I<time_mult>, I<time_offset>"
4306 #: build/C/man2/perf_event_open.2:1398
4308 "If I<cap_usr_time>, these fields can be used to compute the time delta since "
4309 "time_enabled (in nanoseconds) using rdtsc or similar."
4313 #: build/C/man2/perf_event_open.2:1406
4318 " quot = (cyc E<gt>E<gt> time_shift);\n"
4319 " rem = cyc & ((1 E<lt>E<lt> time_shift) - 1);\n"
4320 " delta = time_offset + quot * time_mult +\n"
4321 " ((rem * time_mult) E<gt>E<gt> time_shift);\n"
4325 #: build/C/man2/perf_event_open.2:1418
4327 "Where I<time_offset>, I<time_mult>, I<time_shift>, and I<cyc> are read in "
4328 "the seqcount loop described above. This delta can then be added to enabled "
4329 "and possible running (if idx), improving the scaling:"
4333 #: build/C/man2/perf_event_open.2:1426
4336 " enabled += delta;\n"
4338 " running += delta;\n"
4339 " quot = count / running;\n"
4340 " rem = count % running;\n"
4341 " count = quot * enabled + (rem * enabled) / running;\n"
4345 #: build/C/man2/perf_event_open.2:1427
4347 msgid "I<time_zero> (since Linux 3.12)"
4351 #: build/C/man2/perf_event_open.2:1435
4353 "If I<cap_usr_time_zero> is set, then the hardware clock (the TSC timestamp "
4354 "counter on x86) can be calculated from the I<time_zero>, I<time_mult>, and "
4355 "I<time_shift> values:"
4359 #: build/C/man2/perf_event_open.2:1441
4362 " time = timestamp - time_zero;\n"
4363 " quot = time / time_mult;\n"
4364 " rem = time % time_mult;\n"
4365 " cyc = (quot E<lt>E<lt> time_shift) + (rem E<lt>E<lt> time_shift) / "
4370 #: build/C/man2/perf_event_open.2:1444
4371 msgid "And vice versa:"
4375 #: build/C/man2/perf_event_open.2:1450
4378 " quot = cyc E<gt>E<gt> time_shift;\n"
4379 " rem = cyc & ((1 E<lt>E<lt> time_shift) - 1);\n"
4380 " timestamp = time_zero + quot * time_mult +\n"
4381 " ((rem * time_mult) E<gt>E<gt> time_shift);\n"
4385 #: build/C/man2/perf_event_open.2:1451
4387 msgid "I<data_head>"
4391 #: build/C/man2/perf_event_open.2:1457
4393 "This points to the head of the data section. The value continuously "
4394 "increases, it does not wrap. The value needs to be manually wrapped by the "
4395 "size of the mmap buffer before accessing the samples."
4399 #: build/C/man2/perf_event_open.2:1462
4401 "On SMP-capable platforms, after reading the I<data_head> value, user space "
4402 "should issue an rmb()."
4406 #: build/C/man2/perf_event_open.2:1462
4408 msgid "I<data_tail>"
4412 #: build/C/man2/perf_event_open.2:1470
4414 "When the mapping is B<PROT_WRITE>, the I<data_tail> value should be written "
4415 "by user space to reflect the last read data. In this case, the kernel will "
4416 "not overwrite unread data."
4420 #: build/C/man2/perf_event_open.2:1472
4421 msgid "The following 2^n ring-buffer pages have the layout described below."
4425 #: build/C/man2/perf_event_open.2:1486
4427 "If I<perf_event_attr.sample_id_all> is set, then all event types will have "
4428 "the sample_type selected fields related to where/when (identity) an event "
4429 "took place (TID, TIME, ID, CPU, STREAM_ID) described in "
4430 "B<PERF_RECORD_SAMPLE> below, it will be stashed just after the "
4431 "I<perf_event_header> and the fields already present for the existing fields, "
4432 "that is, at the end of the payload. That way a newer perf.data file will be "
4433 "supported by older perf tools, with these new optional fields being ignored."
4437 #: build/C/man2/perf_event_open.2:1488
4438 msgid "The mmap values start with a header:"
4442 #: build/C/man2/perf_event_open.2:1496
4445 "struct perf_event_header {\n"
4453 #: build/C/man2/perf_event_open.2:1504
4455 "Below, we describe the I<perf_event_header> fields in more detail. For ease "
4456 "of reading, the fields with shorter descriptions are presented first."
4460 #: build/C/man2/perf_event_open.2:1507
4461 msgid "This indicates the size of the record."
4465 #: build/C/man2/perf_event_open.2:1507
4471 #: build/C/man2/perf_event_open.2:1512
4472 msgid "The I<misc> field contains additional information about the sample."
4476 #: build/C/man2/perf_event_open.2:1517
4478 "The CPU mode can be determined from this value by masking with "
4479 "B<PERF_RECORD_MISC_CPUMODE_MASK> and looking for one of the following (note "
4480 "these are not bit masks, only one can be set at a time):"
4484 #: build/C/man2/perf_event_open.2:1518
4486 msgid "B<PERF_RECORD_MISC_CPUMODE_UNKNOWN>"
4490 #: build/C/man2/perf_event_open.2:1521
4491 msgid "Unknown CPU mode."
4495 #: build/C/man2/perf_event_open.2:1521
4497 msgid "B<PERF_RECORD_MISC_KERNEL>"
4501 #: build/C/man2/perf_event_open.2:1524
4502 msgid "Sample happened in the kernel."
4506 #: build/C/man2/perf_event_open.2:1524
4508 msgid "B<PERF_RECORD_MISC_USER>"
4512 #: build/C/man2/perf_event_open.2:1527
4513 msgid "Sample happened in user code."
4517 #: build/C/man2/perf_event_open.2:1527
4519 msgid "B<PERF_RECORD_MISC_HYPERVISOR>"
4523 #: build/C/man2/perf_event_open.2:1530
4524 msgid "Sample happened in the hypervisor."
4528 #: build/C/man2/perf_event_open.2:1530
4530 msgid "B<PERF_RECORD_MISC_GUEST_KERNEL>"
4534 #: build/C/man2/perf_event_open.2:1533
4535 msgid "Sample happened in the guest kernel."
4539 #: build/C/man2/perf_event_open.2:1533
4541 msgid "B<PERF_RECORD_MISC_GUEST_USER>"
4545 #: build/C/man2/perf_event_open.2:1536
4546 msgid "Sample happened in guest user code."
4550 #: build/C/man2/perf_event_open.2:1540
4551 msgid "In addition, one of the following bits can be set:"
4555 #: build/C/man2/perf_event_open.2:1540
4557 msgid "B<PERF_RECORD_MISC_MMAP_DATA>"
4561 #: build/C/man2/perf_event_open.2:1544
4563 "This is set when the mapping is not executable; otherwise the mapping is "
4568 #: build/C/man2/perf_event_open.2:1544
4570 msgid "B<PERF_RECORD_MISC_EXACT_IP>"
4574 #: build/C/man2/perf_event_open.2:1552
4576 "This indicates that the content of B<PERF_SAMPLE_IP> points to the actual "
4577 "instruction that triggered the event. See also "
4578 "I<perf_event_attr.precise_ip>."
4582 #: build/C/man2/perf_event_open.2:1552
4584 msgid "B<PERF_RECORD_MISC_EXT_RESERVED>"
4588 #: build/C/man2/perf_event_open.2:1555
4589 msgid "This indicates there is extended data available (currently not used)."
4593 #: build/C/man2/perf_event_open.2:1565
4595 "The I<type> value is one of the below. The values in the corresponding "
4596 "record (that follows the header) depend on the I<type> selected as shown."
4600 #: build/C/man2/perf_event_open.2:1567
4602 msgid "B<PERF_RECORD_MMAP>"
4606 #: build/C/man2/perf_event_open.2:1574
4608 "The MMAP events record the B<PROT_EXEC> mappings so that we can correlate "
4609 "user-space IPs to code. They have the following structure:"
4613 #: build/C/man2/perf_event_open.2:1585
4617 " struct perf_event_header header;\n"
4622 " char filename[];\n"
4627 #: build/C/man2/perf_event_open.2:1587
4629 msgid "B<PERF_RECORD_LOST>"
4633 #: build/C/man2/perf_event_open.2:1590
4634 msgid "This record indicates when events are lost."
4638 #: build/C/man2/perf_event_open.2:1599
4642 " struct perf_event_header header;\n"
4645 " struct sample_id sample_id;\n"
4650 #: build/C/man2/perf_event_open.2:1605
4651 msgid "is the unique event ID for the samples that were lost."
4655 #: build/C/man2/perf_event_open.2:1605
4661 #: build/C/man2/perf_event_open.2:1608
4662 msgid "is the number of events that were lost."
4666 #: build/C/man2/perf_event_open.2:1609
4668 msgid "B<PERF_RECORD_COMM>"
4672 #: build/C/man2/perf_event_open.2:1612
4673 msgid "This record indicates a change in the process name."
4677 #: build/C/man2/perf_event_open.2:1621
4681 " struct perf_event_header header;\n"
4684 " struct sample_id sample_id;\n"
4689 #: build/C/man2/perf_event_open.2:1623
4691 msgid "B<PERF_RECORD_EXIT>"
4695 #: build/C/man2/perf_event_open.2:1626
4696 msgid "This record indicates a process exit event."
4700 #: build/C/man2/perf_event_open.2:1636 build/C/man2/perf_event_open.2:1666
4704 " struct perf_event_header header;\n"
4708 " struct sample_id sample_id;\n"
4713 #: build/C/man2/perf_event_open.2:1638
4715 msgid "B<PERF_RECORD_THROTTLE>, B<PERF_RECORD_UNTHROTTLE>"
4719 #: build/C/man2/perf_event_open.2:1641
4720 msgid "This record indicates a throttle/unthrottle event."
4724 #: build/C/man2/perf_event_open.2:1651
4728 " struct perf_event_header header;\n"
4732 " struct sample_id sample_id;\n"
4737 #: build/C/man2/perf_event_open.2:1653
4739 msgid "B<PERF_RECORD_FORK>"
4743 #: build/C/man2/perf_event_open.2:1656
4744 msgid "This record indicates a fork event."
4748 #: build/C/man2/perf_event_open.2:1668
4750 msgid "B<PERF_RECORD_READ>"
4754 #: build/C/man2/perf_event_open.2:1671
4755 msgid "This record indicates a read event."
4759 #: build/C/man2/perf_event_open.2:1680
4763 " struct perf_event_header header;\n"
4765 " struct read_format values;\n"
4766 " struct sample_id sample_id;\n"
4771 #: build/C/man2/perf_event_open.2:1682
4773 msgid "B<PERF_RECORD_SAMPLE>"
4777 #: build/C/man2/perf_event_open.2:1685
4778 msgid "This record indicates a sample."
4782 #: build/C/man2/perf_event_open.2:1717
4786 " struct perf_event_header header;\n"
4787 " u64 sample_id; /* if PERF_SAMPLE_IDENTIFIER */\n"
4788 " u64 ip; /* if PERF_SAMPLE_IP */\n"
4789 " u32 pid, tid; /* if PERF_SAMPLE_TID */\n"
4790 " u64 time; /* if PERF_SAMPLE_TIME */\n"
4791 " u64 addr; /* if PERF_SAMPLE_ADDR */\n"
4792 " u64 id; /* if PERF_SAMPLE_ID */\n"
4793 " u64 stream_id; /* if PERF_SAMPLE_STREAM_ID */\n"
4794 " u32 cpu, res; /* if PERF_SAMPLE_CPU */\n"
4795 " u64 period; /* if PERF_SAMPLE_PERIOD */\n"
4796 " struct read_format v; /* if PERF_SAMPLE_READ */\n"
4797 " u64 nr; /* if PERF_SAMPLE_CALLCHAIN */\n"
4798 " u64 ips[nr]; /* if PERF_SAMPLE_CALLCHAIN */\n"
4799 " u32 size; /* if PERF_SAMPLE_RAW */\n"
4800 " char data[size]; /* if PERF_SAMPLE_RAW */\n"
4801 " u64 bnr; /* if PERF_SAMPLE_BRANCH_STACK */\n"
4802 " struct perf_branch_entry lbr[bnr];\n"
4803 " /* if PERF_SAMPLE_BRANCH_STACK */\n"
4804 " u64 abi; /* if PERF_SAMPLE_REGS_USER */\n"
4805 " u64 regs[weight(mask)];\n"
4806 " /* if PERF_SAMPLE_REGS_USER */\n"
4807 " u64 size; /* if PERF_SAMPLE_STACK_USER */\n"
4808 " char data[size]; /* if PERF_SAMPLE_STACK_USER */\n"
4809 " u64 dyn_size; /* if PERF_SAMPLE_STACK_USER */\n"
4810 " u64 weight; /* if PERF_SAMPLE_WEIGHT */\n"
4811 " u64 data_src; /* if PERF_SAMPLE_DATA_SRC */\n"
4812 " u64 transaction;/* if PERF_SAMPLE_TRANSACTION */\n"
4817 #: build/C/man2/perf_event_open.2:1719
4819 msgid "I<sample_id>"
4823 #: build/C/man2/perf_event_open.2:1729
4825 "If B<PERF_SAMPLE_IDENTIFIER> is enabled, a 64-bit unique ID is included. "
4826 "This is a duplication of the B<PERF_SAMPLE_ID> I<id> value, but included at "
4827 "the beginning of the sample so parsers can easily obtain the value."
4831 #: build/C/man2/perf_event_open.2:1729
4837 #: build/C/man2/perf_event_open.2:1735
4839 "If B<PERF_SAMPLE_IP> is enabled, then a 64-bit instruction pointer value is "
4844 #: build/C/man2/perf_event_open.2:1735
4846 msgid "I<pid>, I<tid>"
4850 #: build/C/man2/perf_event_open.2:1741
4852 "If B<PERF_SAMPLE_TID> is enabled, then a 32-bit process ID and 32-bit thread "
4857 #: build/C/man2/perf_event_open.2:1741
4863 #: build/C/man2/perf_event_open.2:1749
4865 "If B<PERF_SAMPLE_TIME> is enabled, then a 64-bit timestamp is included. "
4866 "This is obtained via local_clock() which is a hardware timestamp if "
4867 "available and the jiffies value if not."
4871 #: build/C/man2/perf_event_open.2:1749
4877 #: build/C/man2/perf_event_open.2:1756
4879 "If B<PERF_SAMPLE_ADDR> is enabled, then a 64-bit address is included. This "
4880 "is usually the address of a tracepoint, breakpoint, or software event; "
4881 "otherwise the value is 0."
4885 #: build/C/man2/perf_event_open.2:1764
4887 "If B<PERF_SAMPLE_ID> is enabled, a 64-bit unique ID is included. If the "
4888 "event is a member of an event group, the group leader ID is returned. This "
4889 "ID is the same as the one returned by B<PERF_FORMAT_ID>."
4893 #: build/C/man2/perf_event_open.2:1764
4895 msgid "I<stream_id>"
4899 #: build/C/man2/perf_event_open.2:1774
4901 "If B<PERF_SAMPLE_STREAM_ID> is enabled, a 64-bit unique ID is included. "
4902 "Unlike B<PERF_SAMPLE_ID> the actual ID is returned, not the group leader. "
4903 "This ID is the same as the one returned by B<PERF_FORMAT_ID>."
4907 #: build/C/man2/perf_event_open.2:1774
4909 msgid "I<cpu>, I<res>"
4913 #: build/C/man2/perf_event_open.2:1781
4915 "If B<PERF_SAMPLE_CPU> is enabled, this is a 32-bit value indicating which "
4916 "CPU was being used, in addition to a reserved (unused) 32-bit value."
4920 #: build/C/man2/perf_event_open.2:1781
4926 #: build/C/man2/perf_event_open.2:1787
4928 "If B<PERF_SAMPLE_PERIOD> is enabled, a 64-bit value indicating the current "
4929 "sampling period is written."
4933 #: build/C/man2/perf_event_open.2:1787
4939 #: build/C/man2/perf_event_open.2:1798
4941 "If B<PERF_SAMPLE_READ> is enabled, a structure of type read_format is "
4942 "included which has values for all events in the event group. The values "
4943 "included depend on the I<read_format> value used at B<perf_event_open>() "
4948 #: build/C/man2/perf_event_open.2:1798
4950 msgid "I<nr>, I<ips[nr]>"
4954 #: build/C/man2/perf_event_open.2:1806
4956 "If B<PERF_SAMPLE_CALLCHAIN> is enabled, then a 64-bit number is included "
4957 "which indicates how many following 64-bit instruction pointers will follow. "
4958 "This is the current callchain."
4962 #: build/C/man2/perf_event_open.2:1806
4964 msgid "I<size>, I<data[size]>"
4968 #: build/C/man2/perf_event_open.2:1813
4970 "If B<PERF_SAMPLE_RAW> is enabled, then a 32-bit value indicating size is "
4971 "included followed by an array of 8-bit values of length size. The values "
4972 "are padded with 0 to have 64-bit alignment."
4976 #: build/C/man2/perf_event_open.2:1818
4978 "This RAW record data is opaque with respect to the ABI. The ABI doesn't "
4979 "make any promises with respect to the stability of its content, it may vary "
4980 "depending on event, hardware, and kernel version."
4984 #: build/C/man2/perf_event_open.2:1818
4986 msgid "I<bnr>, I<lbr[bnr]>"
4990 #: build/C/man2/perf_event_open.2:1827
4992 "If B<PERF_SAMPLE_BRANCH_STACK> is enabled, then a 64-bit value indicating "
4993 "the number of records is included, followed by I<bnr> I<perf_branch_entry> "
4994 "structures which each include the fields:"
4998 #: build/C/man2/perf_event_open.2:1828
5004 #: build/C/man2/perf_event_open.2:1831
5005 msgid "This indicates the source instruction (may not be a branch)."
5009 #: build/C/man2/perf_event_open.2:1831
5015 #: build/C/man2/perf_event_open.2:1834
5016 msgid "The branch target."
5020 #: build/C/man2/perf_event_open.2:1834
5026 #: build/C/man2/perf_event_open.2:1837
5027 msgid "The branch target was mispredicted."
5031 #: build/C/man2/perf_event_open.2:1837
5033 msgid "I<predicted>"
5037 #: build/C/man2/perf_event_open.2:1840
5038 msgid "The branch target was predicted."
5042 #: build/C/man2/perf_event_open.2:1840
5044 msgid "I<in_tx> (since Linux 3.11)"
5048 #: build/C/man2/perf_event_open.2:1843
5049 msgid "The branch was in a transactional memory transaction."
5053 #: build/C/man2/perf_event_open.2:1843
5055 msgid "I<abort> (since Linux 3.11)"
5059 #: build/C/man2/perf_event_open.2:1846
5060 msgid "The branch was in an aborted transactional memory transaction."
5064 #: build/C/man2/perf_event_open.2:1850
5066 "The entries are from most to least recent, so the first entry has the most "
5071 #: build/C/man2/perf_event_open.2:1857
5073 "Support for I<mispred> and I<predicted> is optional; if not supported, both "
5078 #: build/C/man2/perf_event_open.2:1861
5080 "The type of branches recorded is specified by the I<branch_sample_type> "
5085 #: build/C/man2/perf_event_open.2:1863
5087 msgid "I<abi>, I<regs[weight(mask)]>"
5091 #: build/C/man2/perf_event_open.2:1868
5093 "If B<PERF_SAMPLE_REGS_USER> is enabled, then the user CPU registers are "
5098 #: build/C/man2/perf_event_open.2:1874
5100 "The I<abi> field is one of B<PERF_SAMPLE_REGS_ABI_NONE>, "
5101 "B<PERF_SAMPLE_REGS_ABI_32> or B<PERF_SAMPLE_REGS_ABI_64>."
5105 #: build/C/man2/perf_event_open.2:1884
5107 "The I<regs> field is an array of the CPU registers that were specified by "
5108 "the I<sample_regs_user> attr field. The number of values is the number of "
5109 "bits set in the I<sample_regs_user> bit mask."
5113 #: build/C/man2/perf_event_open.2:1884
5115 msgid "I<size>, I<data[size]>, I<dyn_size>"
5119 #: build/C/man2/perf_event_open.2:1898
5121 "If B<PERF_SAMPLE_STACK_USER> is enabled, then record the user stack to "
5122 "enable backtracing. I<size> is the size requested by the user in "
5123 "I<stack_user_size> or else the maximum record size. I<data> is the stack "
5124 "data. I<dyn_size> is the amount of data actually dumped (can be less than "
5129 #: build/C/man2/perf_event_open.2:1898
5135 #: build/C/man2/perf_event_open.2:1906
5137 "If B<PERF_SAMPLE_WEIGHT> is enabled, then a 64-bit value provided by the "
5138 "hardware is recorded that indicates how costly the event was. This allows "
5139 "expensive events to stand out more clearly in profiles."
5143 #: build/C/man2/perf_event_open.2:1906
5149 #: build/C/man2/perf_event_open.2:1912
5151 "If B<PERF_SAMPLE_DATA_SRC> is enabled, then a 64-bit value is recorded that "
5152 "is made up of the following fields:"
5156 #: build/C/man2/perf_event_open.2:1913
5162 #: build/C/man2/perf_event_open.2:1916
5163 msgid "Type of opcode, a bitwise combination of:"
5167 #: build/C/man2/perf_event_open.2:1919
5169 msgid "B<PERF_MEM_OP_NA>"
5173 #: build/C/man2/perf_event_open.2:1922 build/C/man2/perf_event_open.2:1945 build/C/man2/perf_event_open.2:1995 build/C/man2/perf_event_open.2:2018 build/C/man2/perf_event_open.2:2032
5174 msgid "Not available"
5178 #: build/C/man2/perf_event_open.2:1922
5180 msgid "B<PERF_MEM_OP_LOAD>"
5184 #: build/C/man2/perf_event_open.2:1925
5185 msgid "Load instruction"
5189 #: build/C/man2/perf_event_open.2:1925
5191 msgid "B<PERF_MEM_OP_STORE>"
5195 #: build/C/man2/perf_event_open.2:1928
5196 msgid "Store instruction"
5200 #: build/C/man2/perf_event_open.2:1928
5202 msgid "B<PERF_MEM_OP_PFETCH>"
5206 #: build/C/man2/perf_event_open.2:1931
5211 #: build/C/man2/perf_event_open.2:1931
5213 msgid "B<PERF_MEM_OP_EXEC>"
5217 #: build/C/man2/perf_event_open.2:1934
5218 msgid "Executable code"
5222 #: build/C/man2/perf_event_open.2:1936
5228 #: build/C/man2/perf_event_open.2:1939
5229 msgid "Memory hierarchy level hit or miss, a bitwise combination of:"
5233 #: build/C/man2/perf_event_open.2:1942
5235 msgid "B<PERF_MEM_LVL_NA>"
5239 #: build/C/man2/perf_event_open.2:1945
5241 msgid "B<PERF_MEM_LVL_HIT>"
5245 #: build/C/man2/perf_event_open.2:1948 build/C/man2/perf_event_open.2:2035
5250 #: build/C/man2/perf_event_open.2:1948
5252 msgid "B<PERF_MEM_LVL_MISS>"
5256 #: build/C/man2/perf_event_open.2:1951 build/C/man2/perf_event_open.2:2038
5261 #: build/C/man2/perf_event_open.2:1951
5263 msgid "B<PERF_MEM_LVL_L1>"
5267 #: build/C/man2/perf_event_open.2:1954
5268 msgid "Level 1 cache"
5272 #: build/C/man2/perf_event_open.2:1954
5274 msgid "B<PERF_MEM_LVL_LFB>"
5278 #: build/C/man2/perf_event_open.2:1957
5279 msgid "Line fill buffer"
5283 #: build/C/man2/perf_event_open.2:1957
5285 msgid "B<PERF_MEM_LVL_L2>"
5289 #: build/C/man2/perf_event_open.2:1960
5290 msgid "Level 2 cache"
5294 #: build/C/man2/perf_event_open.2:1960
5296 msgid "B<PERF_MEM_LVL_L3>"
5300 #: build/C/man2/perf_event_open.2:1963
5301 msgid "Level 3 cache"
5305 #: build/C/man2/perf_event_open.2:1963
5307 msgid "B<PERF_MEM_LVL_LOC_RAM>"
5311 #: build/C/man2/perf_event_open.2:1966
5316 #: build/C/man2/perf_event_open.2:1966
5318 msgid "B<PERF_MEM_LVL_REM_RAM1>"
5322 #: build/C/man2/perf_event_open.2:1969
5323 msgid "Remote DRAM 1 hop"
5327 #: build/C/man2/perf_event_open.2:1969
5329 msgid "B<PERF_MEM_LVL_REM_RAM2>"
5333 #: build/C/man2/perf_event_open.2:1972
5334 msgid "Remote DRAM 2 hops"
5338 #: build/C/man2/perf_event_open.2:1972
5340 msgid "B<PERF_MEM_LVL_REM_CCE1>"
5344 #: build/C/man2/perf_event_open.2:1975
5345 msgid "Remote cache 1 hop"
5349 #: build/C/man2/perf_event_open.2:1975
5351 msgid "B<PERF_MEM_LVL_REM_CCE2>"
5355 #: build/C/man2/perf_event_open.2:1978
5356 msgid "Remote cache 2 hops"
5360 #: build/C/man2/perf_event_open.2:1978
5362 msgid "B<PERF_MEM_LVL_IO>"
5366 #: build/C/man2/perf_event_open.2:1981
5371 #: build/C/man2/perf_event_open.2:1981
5373 msgid "B<PERF_MEM_LVL_UNC>"
5377 #: build/C/man2/perf_event_open.2:1984
5378 msgid "Uncached memory"
5382 #: build/C/man2/perf_event_open.2:1986
5384 msgid "I<mem_snoop>"
5388 #: build/C/man2/perf_event_open.2:1989
5389 msgid "Snoop mode, a bitwise combination of:"
5393 #: build/C/man2/perf_event_open.2:1992
5395 msgid "B<PERF_MEM_SNOOP_NA>"
5399 #: build/C/man2/perf_event_open.2:1995
5401 msgid "B<PERF_MEM_SNOOP_NONE>"
5405 #: build/C/man2/perf_event_open.2:1998
5410 #: build/C/man2/perf_event_open.2:1998
5412 msgid "B<PERF_MEM_SNOOP_HIT>"
5416 #: build/C/man2/perf_event_open.2:2001
5421 #: build/C/man2/perf_event_open.2:2001
5423 msgid "B<PERF_MEM_SNOOP_MISS>"
5427 #: build/C/man2/perf_event_open.2:2004
5432 #: build/C/man2/perf_event_open.2:2004
5434 msgid "B<PERF_MEM_SNOOP_HITM>"
5438 #: build/C/man2/perf_event_open.2:2007
5439 msgid "Snoop hit modified"
5443 #: build/C/man2/perf_event_open.2:2009
5449 #: build/C/man2/perf_event_open.2:2012
5450 msgid "Lock instruction, a bitwise combination of:"
5454 #: build/C/man2/perf_event_open.2:2015
5456 msgid "B<PERF_MEM_LOCK_NA>"
5460 #: build/C/man2/perf_event_open.2:2018
5462 msgid "B<PERF_MEM_LOCK_LOCKED>"
5466 #: build/C/man2/perf_event_open.2:2021
5467 msgid "Locked transaction"
5471 #: build/C/man2/perf_event_open.2:2023
5477 #: build/C/man2/perf_event_open.2:2026
5478 msgid "TLB access hit or miss, a bitwise combination of:"
5482 #: build/C/man2/perf_event_open.2:2029
5484 msgid "B<PERF_MEM_TLB_NA>"
5488 #: build/C/man2/perf_event_open.2:2032
5490 msgid "B<PERF_MEM_TLB_HIT>"
5494 #: build/C/man2/perf_event_open.2:2035
5496 msgid "B<PERF_MEM_TLB_MISS>"
5500 #: build/C/man2/perf_event_open.2:2038
5502 msgid "B<PERF_MEM_TLB_L1>"
5506 #: build/C/man2/perf_event_open.2:2041
5511 #: build/C/man2/perf_event_open.2:2041
5513 msgid "B<PERF_MEM_TLB_L2>"
5517 #: build/C/man2/perf_event_open.2:2044
5522 #: build/C/man2/perf_event_open.2:2044
5524 msgid "B<PERF_MEM_TLB_WK>"
5528 #: build/C/man2/perf_event_open.2:2047
5529 msgid "Hardware walker"
5533 #: build/C/man2/perf_event_open.2:2047
5535 msgid "B<PERF_MEM_TLB_OS>"
5539 #: build/C/man2/perf_event_open.2:2050
5540 msgid "OS fault handler"
5544 #: build/C/man2/perf_event_open.2:2053
5546 msgid "I<transaction>"
5550 #: build/C/man2/perf_event_open.2:2059
5552 "If the B<PERF_SAMPLE_TRANSACTION> flag is set, then a 64-bit field is "
5553 "recorded describing the sources of any transactional memory aborts."
5557 #: build/C/man2/perf_event_open.2:2061
5558 msgid "The field is a bitwise combination of the following values:"
5562 #: build/C/man2/perf_event_open.2:2062
5564 msgid "B<PERF_TXN_ELISION>"
5568 #: build/C/man2/perf_event_open.2:2065
5569 msgid "Abort from an elision type transaction (Intel-CPU-specific)."
5573 #: build/C/man2/perf_event_open.2:2065
5575 msgid "B<PERF_TXN_TRANSACTION>"
5579 #: build/C/man2/perf_event_open.2:2068
5580 msgid "Abort from a generic transaction."
5584 #: build/C/man2/perf_event_open.2:2068
5586 msgid "B<PERF_TXN_SYNC>"
5590 #: build/C/man2/perf_event_open.2:2071
5591 msgid "Synchronous abort (related to the reported instruction)."
5595 #: build/C/man2/perf_event_open.2:2071
5597 msgid "B<PERF_TXN_ASYNC>"
5601 #: build/C/man2/perf_event_open.2:2074
5602 msgid "Asynchronous abort (not related to the reported instruction)."
5606 #: build/C/man2/perf_event_open.2:2074
5608 msgid "B<PERF_TXN_RETRY>"
5612 #: build/C/man2/perf_event_open.2:2077
5613 msgid "Retryable abort (retrying the transaction may have succeeded)."
5617 #: build/C/man2/perf_event_open.2:2077
5619 msgid "B<PERF_TXN_CONFLICT>"
5623 #: build/C/man2/perf_event_open.2:2080
5624 msgid "Abort due to memory conflicts with other threads."
5628 #: build/C/man2/perf_event_open.2:2080
5630 msgid "B<PERF_TXN_CAPACITY_WRITE>"
5634 #: build/C/man2/perf_event_open.2:2083
5635 msgid "Abort due to write capacity overflow."
5639 #: build/C/man2/perf_event_open.2:2083
5641 msgid "B<PERF_TXN_CAPACITY_READ>"
5645 #: build/C/man2/perf_event_open.2:2086
5646 msgid "Abort due to read capacity overflow."
5650 #: build/C/man2/perf_event_open.2:2093
5652 "In addition, a user-specified abort code can be obtained from the high 32 "
5653 "bits of the field by shifting right by B<PERF_TXN_ABORT_SHIFT> and masking "
5654 "with B<PERF_TXN_ABORT_MASK>."
5658 #: build/C/man2/perf_event_open.2:2095
5660 msgid "Signal overflow"
5664 #: build/C/man2/perf_event_open.2:2104
5666 "Events can be set to deliver a signal when a threshold is crossed. The "
5667 "signal handler is set up using the B<poll>(2), B<select>(2), B<epoll>(2) "
5668 "and B<fcntl>(2), system calls."
5672 #: build/C/man2/perf_event_open.2:2108
5674 "To generate signals, sampling must be enabled (I<sample_period> must have a "
5679 #: build/C/man2/perf_event_open.2:2110
5680 msgid "There are two ways to generate signals."
5684 #: build/C/man2/perf_event_open.2:2120
5686 "The first is to set a I<wakeup_events> or I<wakeup_watermark> value that "
5687 "will generate a signal if a certain number of samples or bytes have been "
5688 "written to the mmap ring buffer. In this case, a signal of type B<POLL_IN> "
5693 #: build/C/man2/perf_event_open.2:2132
5695 "The other way is by use of the B<PERF_EVENT_IOC_REFRESH> ioctl. This ioctl "
5696 "adds to a counter that decrements each time the event overflows. When "
5697 "nonzero, a B<POLL_IN> signal is sent on overflow, but once the value reaches "
5698 "0, a signal is sent of type B<POLL_HUP> and the underlying event is "
5702 #. FIXME(Vince) : Find out when this was introduced
5704 #: build/C/man2/perf_event_open.2:2138
5706 "Note: on newer kernels (definitely noticed with 3.2) a signal is provided "
5707 "for every overflow, even if I<wakeup_events> is not set."
5711 #: build/C/man2/perf_event_open.2:2138
5713 msgid "rdpmc instruction"
5717 #: build/C/man2/perf_event_open.2:2145
5719 "Starting with Linux 3.4 on x86, you can use the I<rdpmc> instruction to get "
5720 "low-latency reads without having to enter the kernel. Note that using "
5721 "I<rdpmc> is not necessarily faster than other methods for reading event "
5726 #: build/C/man2/perf_event_open.2:2150
5728 "Support for this can be detected with the I<cap_usr_rdpmc> field in the mmap "
5729 "page; documentation on how to calculate event values can be found in that "
5734 #: build/C/man2/perf_event_open.2:2150
5736 msgid "perf_event ioctl calls"
5740 #: build/C/man2/perf_event_open.2:2155
5741 msgid "Various ioctls act on B<perf_event_open>() file descriptors:"
5745 #: build/C/man2/perf_event_open.2:2155
5747 msgid "B<PERF_EVENT_IOC_ENABLE>"
5751 #: build/C/man2/perf_event_open.2:2159
5753 "This enables the individual event or event group specified by the file "
5754 "descriptor argument."
5758 #: build/C/man2/perf_event_open.2:2165
5760 "If the B<PERF_IOC_FLAG_GROUP> bit is set in the ioctl argument, then all "
5761 "events in a group are enabled, even if the event specified is not the group "
5762 "leader (but see BUGS)."
5766 #: build/C/man2/perf_event_open.2:2165
5768 msgid "B<PERF_EVENT_IOC_DISABLE>"
5772 #: build/C/man2/perf_event_open.2:2169
5774 "This disables the individual counter or event group specified by the file "
5775 "descriptor argument."
5779 #: build/C/man2/perf_event_open.2:2176
5781 "Enabling or disabling the leader of a group enables or disables the entire "
5782 "group; that is, while the group leader is disabled, none of the counters in "
5783 "the group will count. Enabling or disabling a member of a group other than "
5784 "the leader affects only that counter; disabling a non-leader stops that "
5785 "counter from counting but doesn't affect any other counter."
5789 #: build/C/man2/perf_event_open.2:2182
5791 "If the B<PERF_IOC_FLAG_GROUP> bit is set in the ioctl argument, then all "
5792 "events in a group are disabled, even if the event specified is not the group "
5793 "leader (but see BUGS)."
5797 #: build/C/man2/perf_event_open.2:2182
5799 msgid "B<PERF_EVENT_IOC_REFRESH>"
5803 #: build/C/man2/perf_event_open.2:2196
5805 "Non-inherited overflow counters can use this to enable a counter for a "
5806 "number of overflows specified by the argument, after which it is disabled. "
5807 "Subsequent calls of this ioctl add the argument value to the current count. "
5808 "A signal with B<POLL_IN> set will happen on each overflow until the count "
5809 "reaches 0; when that happens a signal with POLL_HUP set is sent and the "
5810 "event is disabled. Using an argument of 0 is considered undefined behavior."
5814 #: build/C/man2/perf_event_open.2:2196
5816 msgid "B<PERF_EVENT_IOC_RESET>"
5820 #: build/C/man2/perf_event_open.2:2206
5822 "Reset the event count specified by the file descriptor argument to zero. "
5823 "This resets only the counts; there is no way to reset the multiplexing "
5824 "I<time_enabled> or I<time_running> values."
5828 #: build/C/man2/perf_event_open.2:2212
5830 "If the B<PERF_IOC_FLAG_GROUP> bit is set in the ioctl argument, then all "
5831 "events in a group are reset, even if the event specified is not the group "
5832 "leader (but see BUGS)."
5836 #: build/C/man2/perf_event_open.2:2212
5838 msgid "B<PERF_EVENT_IOC_PERIOD>"
5842 #: build/C/man2/perf_event_open.2:2215
5843 msgid "This updates the overflow period for the event."
5847 #: build/C/man2/perf_event_open.2:2220
5849 "Since Linux 3.7 (on ARM) and Linux 3.14 (all other architectures), the new "
5850 "period takes effect immediately. On older kernels, the new period did not "
5851 "take effect until after the next overflow."
5855 #: build/C/man2/perf_event_open.2:2223
5857 "The argument is a pointer to a 64-bit value containing the desired new "
5862 #: build/C/man2/perf_event_open.2:2226
5863 msgid "Prior to Linux 2.6.36 this ioctl always failed due to a bug in the kernel."
5867 #: build/C/man2/perf_event_open.2:2227
5869 msgid "B<PERF_EVENT_IOC_SET_OUTPUT>"
5873 #: build/C/man2/perf_event_open.2:2232
5875 "This tells the kernel to report event notifications to the specified file "
5876 "descriptor rather than the default one. The file descriptors must all be on "
5881 #: build/C/man2/perf_event_open.2:2235
5883 "The argument specifies the desired file descriptor, or -1 if output should "
5888 #: build/C/man2/perf_event_open.2:2235
5890 msgid "B<PERF_EVENT_IOC_SET_FILTER> (since Linux 2.6.33)"
5894 #: build/C/man2/perf_event_open.2:2238
5895 msgid "This adds an ftrace filter to this event."
5899 #: build/C/man2/perf_event_open.2:2240
5900 msgid "The argument is a pointer to the desired ftrace filter."
5904 #: build/C/man2/perf_event_open.2:2240
5906 msgid "B<PERF_EVENT_IOC_ID> (since Linux 3.12)"
5910 #: build/C/man2/perf_event_open.2:2243
5911 msgid "This returns the event ID value for the given event file descriptor."
5915 #: build/C/man2/perf_event_open.2:2246
5916 msgid "The argument is a pointer to a 64-bit unsigned integer to hold the result."
5920 #: build/C/man2/perf_event_open.2:2246
5926 #: build/C/man2/perf_event_open.2:2259
5928 "A process can enable or disable all the event groups that are attached to it "
5929 "using the B<prctl>(2) B<PR_TASK_PERF_EVENTS_ENABLE> and "
5930 "B<PR_TASK_PERF_EVENTS_DISABLE> operations. This applies to all counters on "
5931 "the calling process, whether created by this process or by another, and does "
5932 "not affect any counters that this process has created on other processes. "
5933 "It enables or disables only the group leaders, not any other members in the "
5938 #: build/C/man2/perf_event_open.2:2259
5940 msgid "perf_event related configuration files"
5944 #: build/C/man2/perf_event_open.2:2262
5945 msgid "Files in I</proc/sys/kernel/>"
5949 #: build/C/man2/perf_event_open.2:2263
5951 msgid "I</proc/sys/kernel/perf_event_paranoid>"
5955 #: build/C/man2/perf_event_open.2:2269
5957 "The I<perf_event_paranoid> file can be set to restrict access to the "
5958 "performance counters."
5962 #: build/C/man2/perf_event_open.2:2270
5968 #: build/C/man2/perf_event_open.2:2272
5969 msgid "only allow user-space measurements."
5973 #: build/C/man2/perf_event_open.2:2272
5979 #: build/C/man2/perf_event_open.2:2274
5980 msgid "allow both kernel and user measurements (default)."
5984 #: build/C/man2/perf_event_open.2:2274
5990 #: build/C/man2/perf_event_open.2:2276
5991 msgid "allow access to CPU-specific data but not raw tracepoint samples."
5995 #: build/C/man2/perf_event_open.2:2276
6001 #: build/C/man2/perf_event_open.2:2278
6002 msgid "no restrictions."
6006 #: build/C/man2/perf_event_open.2:2284
6008 "The existence of the I<perf_event_paranoid> file is the official method for "
6009 "determining if a kernel supports B<perf_event_open>()."
6013 #: build/C/man2/perf_event_open.2:2284
6015 msgid "I</proc/sys/kernel/perf_event_max_sample_rate>"
6019 #: build/C/man2/perf_event_open.2:2293
6021 "This sets the maximum sample rate. Setting this too high can allow users to "
6022 "sample at a rate that impacts overall machine performance and potentially "
6023 "lock up the machine. The default value is 100000 (samples per second)."
6027 #: build/C/man2/perf_event_open.2:2293
6029 msgid "I</proc/sys/kernel/perf_event_mlock_kb>"
6033 #: build/C/man2/perf_event_open.2:2299
6035 "Maximum number of pages an unprivileged user can B<mlock>(2). The default "
6040 #: build/C/man2/perf_event_open.2:2303
6041 msgid "Files in I</sys/bus/event_source/devices/>"
6045 #: build/C/man2/perf_event_open.2:2309
6047 "Since Linux 2.6.34, the kernel supports having multiple PMUs available for "
6048 "monitoring. Information on how to program these PMUs can be found under "
6049 "I</sys/bus/event_source/devices/>. Each subdirectory corresponds to a "
6054 #: build/C/man2/perf_event_open.2:2309
6056 msgid "I</sys/bus/event_source/devices/*/type> (since Linux 2.6.38)"
6060 #: build/C/man2/perf_event_open.2:2316
6062 "This contains an integer that can be used in the I<type> field of "
6063 "I<perf_event_attr> to indicate that you wish to use this PMU."
6067 #: build/C/man2/perf_event_open.2:2316
6069 msgid "I</sys/bus/event_source/devices/*/rdpmc> (since Linux 3.4)"
6073 #: build/C/man2/perf_event_open.2:2321
6075 "If this file is 1, then direct user-space access to the performance counter "
6076 "registers is allowed via the rdpmc instruction. This can be disabled by "
6077 "echoing 0 to the file."
6081 #: build/C/man2/perf_event_open.2:2321
6083 msgid "I</sys/bus/event_source/devices/*/format/> (since Linux 3.4)"
6087 #: build/C/man2/perf_event_open.2:2329
6089 "This subdirectory contains information on the architecture-specific "
6090 "subfields available for programming the various I<config> fields in the "
6091 "I<perf_event_attr> struct."
6095 #: build/C/man2/perf_event_open.2:2340
6097 "The content of each file is the name of the config field, followed by a "
6098 "colon, followed by a series of integer bit ranges separated by commas. For "
6099 "example, the file I<event> may contain the value I<config1:1,6-10,44> which "
6100 "indicates that event is an attribute that occupies bits 1,6-10, and 44 of "
6101 "I<perf_event_attr::config1>."
6105 #: build/C/man2/perf_event_open.2:2340
6107 msgid "I</sys/bus/event_source/devices/*/events/> (since Linux 3.4)"
6111 #: build/C/man2/perf_event_open.2:2349
6113 "This subdirectory contains files with predefined events. The contents are "
6114 "strings describing the event settings expressed in terms of the fields found "
6115 "in the previously mentioned I<./format/> directory. These are not "
6116 "necessarily complete lists of all events supported by a PMU, but usually a "
6117 "subset of events deemed useful or interesting."
6121 #: build/C/man2/perf_event_open.2:2357
6123 "The content of each file is a list of attribute names separated by commas. "
6124 "Each entry has an optional value (either hex or decimal). If no value is "
6125 "specified, then it is assumed to be a single-bit field with a value of 1. "
6126 "An example entry may look like this: I<event=0x2,inv,ldlat=3>."
6130 #: build/C/man2/perf_event_open.2:2357
6132 msgid "I</sys/bus/event_source/devices/*/uevent>"
6136 #: build/C/man2/perf_event_open.2:2361
6138 "This file is the standard kernel device interface for injecting hotplug "
6143 #: build/C/man2/perf_event_open.2:2361
6145 msgid "I</sys/bus/event_source/devices/*/cpumask> (since Linux 3.7)"
6149 #: build/C/man2/perf_event_open.2:2370
6151 "The I<cpumask> file contains a comma-separated list of integers that "
6152 "indicate a representative CPU number for each socket (package) on the "
6153 "motherboard. This is needed when setting up uncore or northbridge events, "
6154 "as those PMUs present socket-wide events."
6158 #: build/C/man2/perf_event_open.2:2377
6160 "B<perf_event_open>() returns the new file descriptor, or -1 if an error "
6161 "occurred (in which case, I<errno> is set appropriately)."
6165 #: build/C/man2/perf_event_open.2:2382
6167 "The errors returned by B<perf_event_open>() can be inconsistent, and may "
6168 "vary across processor architectures and performance monitoring units."
6172 #: build/C/man2/perf_event_open.2:2382
6178 #: build/C/man2/perf_event_open.2:2399
6180 "Returned if the I<perf_event_attr> I<size> value is too small (smaller than "
6181 "B<PERF_ATTR_SIZE_VER0>), too big (larger than the page size), or larger than "
6182 "the kernel supports and the extra bytes are not zero. When B<E2BIG> is "
6183 "returned, the I<perf_event_attr> I<size> field is overwritten by the kernel "
6184 "to be the size of the structure it was expecting."
6188 #: build/C/man2/perf_event_open.2:2413
6190 "Returned when the requested event requires B<CAP_SYS_ADMIN> permissions (or "
6191 "a more permissive perf_event paranoid setting). Some common cases where an "
6192 "unprivileged process may encounter this error: attaching to a process owned "
6193 "by a different user; monitoring all processes on a given CPU (i.e., "
6194 "specifying the I<pid> argument as -1); and not setting I<exclude_kernel> "
6195 "when the paranoid setting requires it."
6199 #: build/C/man2/perf_event_open.2:2413 build/C/man2/sendfile.2:121 build/C/man2/splice.2:143 build/C/man2/vmsplice.2:123
6205 #: build/C/man2/perf_event_open.2:2423
6207 "Returned if the I<group_fd> file descriptor is not valid, or, if "
6208 "B<PERF_FLAG_PID_CGROUP> is set, the cgroup file descriptor in I<pid> is not "
6213 #: build/C/man2/perf_event_open.2:2428
6214 msgid "Returned if the I<attr> pointer points at an invalid memory address."
6218 #: build/C/man2/perf_event_open.2:2454
6220 "Returned if the specified event is invalid. There are many possible reasons "
6221 "for this. A not-exhaustive list: I<sample_freq> is higher than the maximum "
6222 "setting; the I<cpu> to monitor does not exist; I<read_format> is out of "
6223 "range; I<sample_type> is out of range; the I<flags> value is out of range; "
6224 "I<exclusive> or I<pinned> set and the event is not a group leader; the event "
6225 "I<config> values are out of range or set reserved bits; the generic event "
6226 "selected is not supported; or there is not enough room to add the selected "
6231 #: build/C/man2/perf_event_open.2:2454
6237 #: build/C/man2/perf_event_open.2:2460
6239 "Each opened event uses one file descriptor. If a large number of events are "
6240 "opened the per-user file descriptor limit (often 1024) will be hit and no "
6241 "more events can be created."
6245 #: build/C/man2/perf_event_open.2:2464
6246 msgid "Returned when the event involves a feature not supported by the current CPU."
6250 #: build/C/man2/perf_event_open.2:2464 build/C/man2/quotactl.2:440
6256 #: build/C/man2/perf_event_open.2:2471
6258 "Returned if the I<type> setting is not valid. This error is also returned "
6259 "for some unsupported generic events."
6263 #: build/C/man2/perf_event_open.2:2471
6269 #: build/C/man2/perf_event_open.2:2481
6271 "Prior to Linux 3.3, if there was not enough room for the event, B<ENOSPC> "
6272 "was returned. In Linux 3.3, this was changed to B<EINVAL>. B<ENOSPC> is "
6273 "still returned if you try to add more breakpoint events than supported by "
6278 #: build/C/man2/perf_event_open.2:2488
6280 "Returned if B<PERF_SAMPLE_STACK_USER> is set in I<sample_type> and it is not "
6281 "supported by hardware."
6285 #: build/C/man2/perf_event_open.2:2495
6287 "Returned if an event requiring a specific hardware feature is requested but "
6288 "there is no hardware support. This includes requesting low-skid events if "
6289 "not supported, branch tracing if it is not available, sampling if no PMU "
6290 "interrupt is available, and branch stacks for software events."
6294 #: build/C/man2/perf_event_open.2:2500
6296 "Returned on many (but not all) architectures when an unsupported "
6297 "I<exclude_hv>, I<exclude_idle>, I<exclude_user>, or I<exclude_kernel> "
6298 "setting is specified."
6302 #: build/C/man2/perf_event_open.2:2508
6304 "It can also happen, as with B<EACCES>, when the requested event requires "
6305 "B<CAP_SYS_ADMIN> permissions (or a more permissive perf_event paranoid "
6306 "setting). This includes setting a breakpoint on a kernel address, and "
6307 "(since Linux 3.13) setting a kernel function-trace tracepoint."
6311 #: build/C/man2/perf_event_open.2:2511
6312 msgid "Returned if attempting to attach to a process that does not exist."
6316 #: build/C/man2/perf_event_open.2:2511
6322 #: build/C/man2/perf_event_open.2:2516
6324 "B<perf_event_open>() was introduced in Linux 2.6.31 but was called "
6325 "B<perf_counter_open>(). It was renamed in Linux 2.6.32."
6329 #: build/C/man2/perf_event_open.2:2521
6331 "This B<perf_event_open>() system call Linux- specific and should not be "
6332 "used in programs intended to be portable."
6336 #: build/C/man2/perf_event_open.2:2525
6338 "Glibc does not provide a wrapper for this system call; call it using "
6339 "B<syscall>(2). See the example below."
6343 #: build/C/man2/perf_event_open.2:2531
6345 "The official way of knowing if B<perf_event_open>() support is enabled is "
6346 "checking for the existence of the file "
6347 "I</proc/sys/kernel/perf_event_paranoid>."
6351 #: build/C/man2/perf_event_open.2:2531 build/C/man2/pivot_root.2:134 build/C/man2/ptrace.2:1963
6357 #: build/C/man2/perf_event_open.2:2538
6359 "The B<F_SETOWN_EX> option to B<fcntl>(2) is needed to properly get overflow "
6360 "signals in threads. This was introduced in Linux 2.6.32."
6364 #: build/C/man2/perf_event_open.2:2546
6366 "Prior to Linux 2.6.33 (at least for x86), the kernel did not check if events "
6367 "could be scheduled together until read time. The same happens on all known "
6368 "kernels if the NMI watchdog is enabled. This means to see if a given set of "
6369 "events works you have to B<perf_event_open>(), start, then read before you "
6370 "know for sure you can get valid measurements."
6374 #: build/C/man2/perf_event_open.2:2550
6376 "Prior to Linux 2.6.34, event constraints were not enforced by the kernel. "
6377 "In that case, some events would silently return \"0\" if the kernel "
6378 "scheduled them in an improper counter slot."
6382 #: build/C/man2/perf_event_open.2:2553
6384 "Prior to Linux 2.6.34, there was a bug when multiplexing where the wrong "
6385 "results could be returned."
6389 #: build/C/man2/perf_event_open.2:2556
6391 "Kernels from Linux 2.6.35 to Linux 2.6.39 can quickly crash the kernel if "
6392 "\"inherit\" is enabled and many threads are started."
6396 #: build/C/man2/perf_event_open.2:2560
6398 "Prior to Linux 2.6.35, B<PERF_FORMAT_GROUP> did not work with attached "
6403 #: build/C/man2/perf_event_open.2:2565
6405 "In older Linux 2.6 versions, refreshing an event group leader refreshed all "
6406 "siblings, and refreshing with a parameter of 0 enabled infinite refresh. "
6407 "This behavior is unsupported and should not be relied on."
6411 #: build/C/man2/perf_event_open.2:2571
6413 "There is a bug in the kernel code between Linux 2.6.36 and Linux 3.0 that "
6414 "ignores the \"watermark\" field and acts as if a wakeup_event was chosen if "
6415 "the union has a nonzero value in it."
6419 #: build/C/man2/perf_event_open.2:2577
6421 "From Linux 2.6.31 to Linux 3.4, the B<PERF_IOC_FLAG_GROUP> ioctl argument "
6422 "was broken and would repeatedly operate on the event specified rather than "
6423 "iterating across all sibling events in a group."
6427 #: build/C/man2/perf_event_open.2:2588
6429 "From Linux 3.4 to Linux 3.11, the mmap I<cap_usr_rdpmc> and I<cap_usr_time> "
6430 "bits mapped to the same location. Code should migrate to the new "
6431 "I<cap_user_rdpmc> and I<cap_user_time> fields instead."
6435 #: build/C/man2/perf_event_open.2:2593
6437 "Always double-check your results! Various generalized events have had wrong "
6438 "values. For example, retired branches measured the wrong thing on AMD "
6439 "machines until Linux 2.6.35."
6443 #: build/C/man2/perf_event_open.2:2593 build/C/man2/process_vm_readv.2:295 build/C/man2/splice.2:223 build/C/man2/tee.2:130
6449 #: build/C/man2/perf_event_open.2:2597
6451 "The following is a short example that measures the total instruction count "
6452 "of a call to B<printf>(3)."
6456 #: build/C/man2/perf_event_open.2:2606
6459 "#include E<lt>stdlib.hE<gt>\n"
6460 "#include E<lt>stdio.hE<gt>\n"
6461 "#include E<lt>unistd.hE<gt>\n"
6462 "#include E<lt>string.hE<gt>\n"
6463 "#include E<lt>sys/ioctl.hE<gt>\n"
6464 "#include E<lt>linux/perf_event.hE<gt>\n"
6465 "#include E<lt>asm/unistd.hE<gt>\n"
6469 #: build/C/man2/perf_event_open.2:2612
6473 "perf_event_open(struct perf_event_attr *hw_event, pid_t pid,\n"
6474 " int cpu, int group_fd, unsigned long flags)\n"
6480 #: build/C/man2/perf_event_open.2:2617
6483 " ret = syscall(__NR_perf_event_open, hw_event, pid, cpu,\n"
6484 " group_fd, flags);\n"
6490 #: build/C/man2/perf_event_open.2:2624
6494 "main(int argc, char **argv)\n"
6496 " struct perf_event_attr pe;\n"
6497 " long long count;\n"
6502 #: build/C/man2/perf_event_open.2:2632
6505 " memset(&pe, 0, sizeof(struct perf_event_attr));\n"
6506 " pe.type = PERF_TYPE_HARDWARE;\n"
6507 " pe.size = sizeof(struct perf_event_attr);\n"
6508 " pe.config = PERF_COUNT_HW_INSTRUCTIONS;\n"
6509 " pe.disabled = 1;\n"
6510 " pe.exclude_kernel = 1;\n"
6511 " pe.exclude_hv = 1;\n"
6515 #: build/C/man2/perf_event_open.2:2638
6518 " fd = perf_event_open(&pe, 0, -1, -1, 0);\n"
6519 " if (fd == -1) {\n"
6520 " fprintf(stderr, \"Error opening leader %llx\\en\", pe.config);\n"
6521 " exit(EXIT_FAILURE);\n"
6526 #: build/C/man2/perf_event_open.2:2641
6529 " ioctl(fd, PERF_EVENT_IOC_RESET, 0);\n"
6530 " ioctl(fd, PERF_EVENT_IOC_ENABLE, 0);\n"
6534 #: build/C/man2/perf_event_open.2:2643
6536 msgid " printf(\"Measuring instruction count for this printf\\en\");\n"
6540 #: build/C/man2/perf_event_open.2:2646
6543 " ioctl(fd, PERF_EVENT_IOC_DISABLE, 0);\n"
6544 " read(fd, &count, sizeof(long long));\n"
6548 #: build/C/man2/perf_event_open.2:2648
6550 msgid " printf(\"Used %lld instructions\\en\", count);\n"
6554 #: build/C/man2/perf_event_open.2:2651
6562 #: build/C/man2/perf_event_open.2:2658
6563 msgid "B<fcntl>(2), B<mmap>(2), B<open>(2), B<prctl>(2), B<read>(2)"
6567 #: build/C/man2/perfmonctl.2:27
6573 #: build/C/man2/perfmonctl.2:30
6574 msgid "perfmonctl - interface to IA-64 performance monitoring unit"
6578 #: build/C/man2/perfmonctl.2:34
6581 "B<#include E<lt>syscall.hE<gt>>\n"
6582 "B<#include E<lt>perfmon.hE<gt>>\n"
6586 #: build/C/man2/perfmonctl.2:36
6589 "B<long perfmonctl(int >I<fd>B<, int >I<cmd>B<, void *>I<arg>B<, int "
6594 #: build/C/man2/perfmonctl.2:47
6596 "The IA-64-specific B<perfmonctl>() system call provides an interface to the "
6597 "PMU (performance monitoring unit). The PMU consists of PMD (performance "
6598 "monitoring data) registers and PMC (performance monitoring control) "
6599 "registers, which gather hardware statistics."
6603 #: build/C/man2/perfmonctl.2:57
6605 "B<perfmonctl>() applies the operation I<cmd> to the input arguments "
6606 "specified by I<arg>. The number of arguments is defined by I<narg>. The "
6607 "I<fd> argument specifies the perfmon context to operate on."
6611 #: build/C/man2/perfmonctl.2:61
6612 msgid "Supported values for I<cmd> are:"
6616 #: build/C/man2/perfmonctl.2:61
6618 msgid "B<PFM_CREATE_CONTEXT>"
6622 #: build/C/man2/perfmonctl.2:65
6625 "B<perfmonctl(int >I<fd>B<, PFM_CREATE_CONTEXT, pfarg_context_t *>I<ctxt>B<, "
6630 #: build/C/man2/perfmonctl.2:67
6631 msgid "Set up a context."
6635 #: build/C/man2/perfmonctl.2:74
6637 "The I<fd> parameter is ignored. A new perfmon context is created as "
6638 "specified in I<ctxt> and its file descriptor is returned in "
6639 "I<ctxt-E<gt>ctx_fd>."
6643 #: build/C/man2/perfmonctl.2:86
6645 "The file descriptor can be used in subsequent calls to B<perfmonctl>() and "
6646 "can be used to read event notifications (type I<pfm_msg_t>) using "
6647 "B<read>(2). The file descriptor is pollable using B<select>(2), B<poll>(2), "
6652 #: build/C/man2/perfmonctl.2:90
6653 msgid "The context can be destroyed by calling B<close>(2) on the file descriptor."
6657 #: build/C/man2/perfmonctl.2:90
6659 msgid "B<PFM_WRITE_PMCS>"
6663 #: build/C/man2/perfmonctl.2:95
6665 msgid "B<perfmonctl(int >I<fd>B<, PFM_WRITE_PMCS, pfarg_reg_t *>I<pmcs>B<, n);>\n"
6669 #: build/C/man2/perfmonctl.2:97
6670 msgid "Set PMC registers."
6674 #: build/C/man2/perfmonctl.2:97
6676 msgid "B<PFM_WRITE_PMDS>"
6680 #: build/C/man2/perfmonctl.2:101
6682 msgid "B<perfmonctl(int >I<fd>B<, PFM_WRITE_PMDS, pfarg_reg_t *>I<pmds>B<, n);>\n"
6687 #: build/C/man2/perfmonctl.2:104
6688 msgid "Set PMD registers."
6692 #: build/C/man2/perfmonctl.2:104
6694 msgid "B<PFM_READ_PMDS>"
6698 #: build/C/man2/perfmonctl.2:109
6700 msgid "B<perfmonctl(int >I<fd>B<, PFM_READ_PMDS, pfarg_reg_t *>I<pmds>B<, n);>\n"
6704 #: build/C/man2/perfmonctl.2:111
6705 msgid "Read PMD registers."
6709 #: build/C/man2/perfmonctl.2:111
6711 msgid "B<PFM_START>"
6714 #. .BI "perfmonctl(int " fd ", PFM_START, arg, 1);
6716 #: build/C/man2/perfmonctl.2:117
6718 msgid "B<perfmonctl(int >I<fd>B<, PFM_START, NULL, 0);>\n"
6722 #: build/C/man2/perfmonctl.2:119
6723 msgid "Start monitoring."
6727 #: build/C/man2/perfmonctl.2:119
6733 #: build/C/man2/perfmonctl.2:124
6735 msgid "B<perfmonctl(int >I<fd>B<, PFM_STOP, NULL, 0);>\n"
6739 #: build/C/man2/perfmonctl.2:126
6740 msgid "Stop monitoring."
6744 #: build/C/man2/perfmonctl.2:126
6746 msgid "B<PFM_LOAD_CONTEXT>"
6750 #: build/C/man2/perfmonctl.2:131
6753 "B<perfmonctl(int >I<fd>B<, PFM_LOAD_CONTEXT, pfarg_load_t *>I<largs>B<, "
6758 #: build/C/man2/perfmonctl.2:133
6759 msgid "Attach the context to a thread."
6763 #: build/C/man2/perfmonctl.2:133
6765 msgid "B<PFM_UNLOAD_CONTEXT>"
6769 #: build/C/man2/perfmonctl.2:138
6771 msgid "B<perfmonctl(int >I<fd>B<, PFM_UNLOAD_CONTEXT, NULL, 0);>\n"
6775 #: build/C/man2/perfmonctl.2:140
6776 msgid "Detach the context from a thread."
6780 #: build/C/man2/perfmonctl.2:140
6782 msgid "B<PFM_RESTART>"
6786 #: build/C/man2/perfmonctl.2:145
6788 msgid "B<perfmonctl(int >I<fd>B<, PFM_RESTART, NULL, 0);>\n"
6792 #: build/C/man2/perfmonctl.2:147
6793 msgid "Restart monitoring after receiving an overflow notification."
6797 #: build/C/man2/perfmonctl.2:147
6799 msgid "B<PFM_GET_FEATURES>"
6803 #: build/C/man2/perfmonctl.2:152
6806 "B<perfmonctl(int >I<fd>B<, PFM_GET_FEARURES, pfarg_features_t *>I<arg>B<, "
6811 #: build/C/man2/perfmonctl.2:153
6813 msgid "B<PFM_DEBUG>"
6817 #: build/C/man2/perfmonctl.2:158
6819 msgid "B<perfmonctl(int >I<fd>B<, PFM_DEBUG, >I<val>B<, 0);>\n"
6823 #: build/C/man2/perfmonctl.2:162
6824 msgid "If I<val> is nonzero, enable debugging mode, otherwise disable."
6828 #: build/C/man2/perfmonctl.2:162
6830 msgid "B<PFM_GET_PMC_RESET_VAL>"
6834 #: build/C/man2/perfmonctl.2:167
6837 "B<perfmonctl(int >I<fd>B<, PFM_GET_PMC_RESET_VAL, pfarg_reg_t * >I<req>B<, "
6844 #. .B PFM_CREATE_EVTSETS
6846 #. create or modify event sets
6848 #. .BI "perfmonctl(int " fd ", PFM_CREATE_EVTSETS, pfarg_setdesc_t *desc , n);
6851 #. .B PFM_DELETE_EVTSETS
6852 #. delete event sets
6854 #. .BI "perfmonctl(int " fd ", PFM_DELETE_EVTSET, pfarg_setdesc_t *desc , n);
6857 #. .B PFM_GETINFO_EVTSETS
6858 #. get information about event sets
6860 #. .BI "perfmonctl(int " fd ", PFM_GETINFO_EVTSETS, pfarg_setinfo_t *info, n);
6863 #: build/C/man2/perfmonctl.2:190
6864 msgid "Reset PMC registers to default values."
6868 #: build/C/man2/perfmonctl.2:196
6870 "B<perfmonctl>() returns zero when the operation is successful. On error, "
6871 "-1 is returned and I<errno> is set to indicate the cause of the error."
6875 #: build/C/man2/perfmonctl.2:199
6876 msgid "B<perfmonctl>() is available since Linux 2.4."
6880 #: build/C/man2/perfmonctl.2:202
6882 "B<perfmonctl>() is Linux-specific and is available only on the IA-64 "
6887 #: build/C/man2/perfmonctl.2:207
6892 #: build/C/man2/perfmonctl.2:209
6893 msgid "The perfmon2 interface specification"
6897 #: build/C/man2/personality.2:32
6903 #: build/C/man2/personality.2:32
6909 #: build/C/man2/personality.2:35
6910 msgid "personality - set the process execution domain"
6914 #: build/C/man2/personality.2:37
6915 msgid "B<#include E<lt>sys/personality.hE<gt>>"
6919 #: build/C/man2/personality.2:39
6920 msgid "B<int personality(unsigned long >I<persona>B<);>"
6924 #: build/C/man2/personality.2:47
6926 "Linux supports different execution domains, or personalities, for each "
6927 "process. Among other things, execution domains tell Linux how to map signal "
6928 "numbers into signal actions. The execution domain system allows Linux to "
6929 "provide limited support for binaries compiled under other UNIX-like "
6930 "operating systems."
6934 #: build/C/man2/personality.2:59
6936 "If I<persona> is not 0xffffffff, then B<personality>() sets the caller's "
6937 "execution domain to the value specified by I<persona>. Specifying "
6938 "I<persona> as 0xffffffff provides a way of retrieving the current persona "
6939 "without changing it."
6943 #: build/C/man2/personality.2:62
6945 "A list of the available execution domains can be found in "
6946 "I<E<lt>sys/personality.hE<gt>>."
6950 #: build/C/man2/personality.2:69
6952 "On success, the previous I<persona> is returned. On error, -1 is returned, "
6953 "and I<errno> is set appropriately."
6957 #: build/C/man2/personality.2:73
6958 msgid "The kernel was unable to change the personality."
6962 #: build/C/man2/personality.2:77
6964 "B<personality>() is Linux-specific and should not be used in programs "
6965 "intended to be portable."
6969 #: build/C/man2/pivot_root.2:10
6975 #: build/C/man2/pivot_root.2:13
6976 msgid "pivot_root - change the root filesystem"
6980 #: build/C/man2/pivot_root.2:15
6981 msgid "B<int pivot_root(const char *>I<new_root>B<, const char *>I<put_old>B<);>"
6987 #. capability is required.
6989 #: build/C/man2/pivot_root.2:27
6991 "B<pivot_root>() moves the root filesystem of the calling process to the "
6992 "directory I<put_old> and makes I<new_root> the new root filesystem of the "
6997 #: build/C/man2/pivot_root.2:34
6999 "The typical use of B<pivot_root>() is during system startup, when the "
7000 "system mounts a temporary root filesystem (e.g., an B<initrd>), then mounts "
7001 "the real root filesystem, and eventually turns the latter into the current "
7002 "root of all relevant processes or threads."
7006 #: build/C/man2/pivot_root.2:46
7008 "B<pivot_root>() may or may not change the current root and the current "
7009 "working directory of any processes or threads which use the old root "
7010 "directory. The caller of B<pivot_root>() must ensure that processes with "
7011 "root or current working directory at the old root operate correctly in "
7012 "either case. An easy way to ensure this is to change their root and current "
7013 "working directory to I<new_root> before invoking B<pivot_root>()."
7017 #: build/C/man2/pivot_root.2:64
7019 "The paragraph above is intentionally vague because the implementation of "
7020 "B<pivot_root>() may change in the future. At the time of writing, "
7021 "B<pivot_root>() changes root and current working directory of each process "
7022 "or thread to I<new_root> if they point to the old root directory. This is "
7023 "necessary in order to prevent kernel threads from keeping the old root "
7024 "directory busy with their root and current working directory, even if they "
7025 "never access the filesystem in any way. In the future, there may be a "
7026 "mechanism for kernel threads to explicitly relinquish any access to the "
7027 "filesystem, such that this fairly intrusive mechanism can be removed from "
7032 #: build/C/man2/pivot_root.2:72
7034 "Note that this also applies to the calling process: B<pivot_root>() may or "
7035 "may not affect its current working directory. It is therefore recommended "
7036 "to call B<chdir(\"/\")> immediately after B<pivot_root>()."
7040 #: build/C/man2/pivot_root.2:74
7041 msgid "The following restrictions apply to I<new_root> and I<put_old>:"
7045 #: 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
7051 #: build/C/man2/pivot_root.2:76
7052 msgid "They must be directories."
7056 #: build/C/man2/pivot_root.2:79
7058 "I<new_root> and I<put_old> must not be on the same filesystem as the current "
7063 #: build/C/man2/pivot_root.2:83
7065 "I<put_old> must be underneath I<new_root>, that is, adding a nonzero number "
7066 "of I</..> to the string pointed to by I<put_old> must yield the same "
7067 "directory as I<new_root>."
7071 #: build/C/man2/pivot_root.2:85
7072 msgid "No other filesystem may be mounted on I<put_old>."
7076 #: build/C/man2/pivot_root.2:89
7077 msgid "See also B<pivot_root>(8) for additional usage examples."
7081 #: build/C/man2/pivot_root.2:96
7083 "If the current root is not a mount point (e.g., after B<chroot>(2) or "
7084 "B<pivot_root>(), see also below), not the old root directory, but the mount "
7085 "point of that filesystem is mounted on I<put_old>."
7089 #: build/C/man2/pivot_root.2:101
7091 "I<new_root> does not have to be a mount point. In this case, "
7092 "I</proc/mounts> will show the mount point of the filesystem containing "
7093 "I<new_root> as root (I</>)."
7097 #: build/C/man2/pivot_root.2:110
7099 "B<pivot_root>() may return (in I<errno>) any of the errors returned by "
7100 "B<stat>(2). Additionally, it may return:"
7104 #: build/C/man2/pivot_root.2:114
7106 "I<new_root> or I<put_old> are on the current root filesystem, or a "
7107 "filesystem is already mounted on I<put_old>."
7111 #: build/C/man2/pivot_root.2:117
7112 msgid "I<put_old> is not underneath I<new_root>."
7116 #: build/C/man2/pivot_root.2:117
7122 #: build/C/man2/pivot_root.2:120
7123 msgid "I<new_root> or I<put_old> is not a directory."
7127 #: build/C/man2/pivot_root.2:125
7128 msgid "The calling process does not have the B<CAP_SYS_ADMIN> capability."
7132 #: build/C/man2/pivot_root.2:128
7133 msgid "B<pivot_root>() was introduced in Linux 2.3.41."
7137 #: build/C/man2/pivot_root.2:131
7138 msgid "B<pivot_root>() is Linux-specific and hence is not portable."
7142 #: build/C/man2/pivot_root.2:138
7144 "B<pivot_root>() should not have to change root and current working "
7145 "directory of all other processes in the system."
7149 #: build/C/man2/pivot_root.2:143
7151 "Some of the more obscure uses of B<pivot_root>() may quickly lead to "
7156 #: build/C/man2/pivot_root.2:149
7157 msgid "B<chdir>(2), B<chroot>(2), B<stat>(2), B<initrd>(4), B<pivot_root>(8)"
7161 #: build/C/man2/process_vm_readv.2:29
7163 msgid "PROCESS_VM_READV"
7167 #: build/C/man2/process_vm_readv.2:29
7173 #: build/C/man2/process_vm_readv.2:32
7175 "process_vm_readv, process_vm_writev - transfer data between process address "
7180 #: build/C/man2/process_vm_readv.2:35
7182 msgid "B<#include E<lt>sys/uio.hE<gt>>\n"
7186 #: build/C/man2/process_vm_readv.2:42
7189 "B<ssize_t process_vm_readv(pid_t >I<pid>B<,>\n"
7190 "B< const struct iovec *>I<local_iov>B<,>\n"
7191 "B< unsigned long >I<liovcnt>B<,>\n"
7192 "B< const struct iovec *>I<remote_iov>B<,>\n"
7193 "B< unsigned long >I<riovcnt>B<,>\n"
7194 "B< unsigned long >I<flags>B<);>\n"
7198 #: build/C/man2/process_vm_readv.2:49
7201 "B<ssize_t process_vm_writev(pid_t >I<pid>B<,>\n"
7202 "B< const struct iovec *>I<local_iov>B<,>\n"
7203 "B< unsigned long >I<liovcnt>B<,>\n"
7204 "B< const struct iovec *>I<remote_iov>B<,>\n"
7205 "B< unsigned long >I<riovcnt>B<,>\n"
7206 "B< unsigned long >I<flags>B<);>\n"
7210 #: build/C/man2/process_vm_readv.2:57
7212 "These system calls transfer data between the address space of the calling "
7213 "process (\"the local process\") and the process identified by I<pid> (\"the "
7214 "remote process\"). The data moves directly between the address spaces of "
7215 "the two processes, without passing through kernel space."
7219 #: build/C/man2/process_vm_readv.2:82
7221 "The B<process_vm_readv>() system call transfers data from the remote "
7222 "process to the local process. The data to be transferred is identified by "
7223 "I<remote_iov> and I<riovcnt>: I<remote_iov> is a pointer to an array "
7224 "describing address ranges in the process I<pid>, and I<riovcnt> specifies "
7225 "the number of elements in I<remote_iov>. The data is transferred to the "
7226 "locations specified by I<local_iov> and I<liovcnt>: I<local_iov> is a "
7227 "pointer to an array describing address ranges in the calling process, and "
7228 "I<liovcnt> specifies the number of elements in I<local_iov>."
7232 #: build/C/man2/process_vm_readv.2:96
7234 "The B<process_vm_writev>() system call is the converse of "
7235 "B<process_vm_readv>()\\(emit transfers data from the local process to the "
7236 "remote process. Other than the direction of the transfer, the arguments "
7237 "I<liovcnt>, I<local_iov>, I<riovcnt>, and I<remote_iov> have the same "
7238 "meaning as for B<process_vm_readv>()."
7242 #: build/C/man2/process_vm_readv.2:106
7244 "The I<local_iov> and I<remote_iov> arguments point to an array of I<iovec> "
7245 "structures, defined in I<E<lt>sys/uio.hE<gt>> as:"
7249 #: build/C/man2/process_vm_readv.2:113
7253 " void *iov_base; /* Starting address */\n"
7254 " size_t iov_len; /* Number of bytes to transfer */\n"
7259 #: build/C/man2/process_vm_readv.2:129
7261 "Buffers are processed in array order. This means that B<process_vm_readv>() "
7262 "completely fills I<local_iov[0]> before proceeding to I<local_iov[1]>, and "
7263 "so on. Likewise, I<remote_iov[0]> is completely read before proceeding to "
7264 "I<remote_iov[1]>, and so on."
7268 #: build/C/man2/process_vm_readv.2:140
7270 "Similarly, B<process_vm_writev>() writes out the entire contents of "
7271 "I<local_iov[0]> before proceeding to I<local_iov[1]>, and it completely "
7272 "fills I<remote_iov[0]> before proceeding to I<remote_iov[1]>."
7276 #: build/C/man2/process_vm_readv.2:148
7278 "The lengths of I<remote_iov[i].iov_len> and I<local_iov[i].iov_len> do not "
7279 "have to be the same. Thus, it is possible to split a single local buffer "
7280 "into multiple remote buffers, or vice versa."
7284 #: build/C/man2/process_vm_readv.2:152
7285 msgid "The I<flags> argument is currently unused and must be set to 0."
7288 #. In time, glibc might provide a wrapper that works around this limit,
7289 #. as is done for readv()/writev()
7291 #: build/C/man2/process_vm_readv.2:165
7293 "The values specified in the I<liovcnt> and I<riovcnt> arguments must be less "
7294 "than or equal to B<IOV_MAX> (defined in I<E<lt>limits.hE<gt>> or accessible "
7295 "via the call I<sysconf(_SC_IOV_MAX)>)."
7299 #: build/C/man2/process_vm_readv.2:175
7301 "The count arguments and I<local_iov> are checked before doing any "
7302 "transfers. If the counts are too big, or I<local_iov> is invalid, or the "
7303 "addresses refer to regions that are inaccessible to the local process, none "
7304 "of the vectors will be processed and an error will be returned immediately."
7308 #: build/C/man2/process_vm_readv.2:195
7310 "Note, however, that these system calls do not check the memory regions in "
7311 "the remote process until just before doing the read/write. Consequently, a "
7312 "partial read/write (see RETURN VALUE) may result if one of the "
7313 "I<remote_iov> elements points to an invalid memory region in the remote "
7314 "process. No further reads/writes will be attempted beyond that point. Keep "
7315 "this in mind when attempting to read data of unknown length (such as C "
7316 "strings that are null-terminated) from a remote process, by avoiding "
7317 "spanning memory pages (typically 4KiB) in a single remote I<iovec> element. "
7318 "(Instead, split the remote read into two I<remote_iov> elements and have "
7319 "them merge back into a single write I<local_iov> entry. The first read "
7320 "entry goes up to the page boundary, while the second starts on the next page "
7325 #: build/C/man2/process_vm_readv.2:209
7327 "In order to read from or write to another process, either the caller must "
7328 "have the capability B<CAP_SYS_PTRACE>, or the real user ID, effective user "
7329 "ID, and saved set-user-ID of the remote process must match the real user ID "
7330 "of the caller I<and> the real group ID, effective group ID, and saved "
7331 "set-group-ID of the remote process must match the real group ID of the "
7332 "caller. (The permission required is exactly the same as that required to "
7333 "perform a B<ptrace>(2) B<PTRACE_ATTACH> on the remote process.)"
7337 #: build/C/man2/process_vm_readv.2:225
7339 "On success, B<process_vm_readv>() returns the number of bytes read and "
7340 "B<process_vm_writev>() returns the number of bytes written. This return "
7341 "value may be less than the total number of requested bytes, if a partial "
7342 "read/write occurred. (Partial transfers apply at the granularity of "
7343 "I<iovec> elements. These system calls won't perform a partial transfer that "
7344 "splits a single I<iovec> element.) The caller should check the return value "
7345 "to determine whether a partial read/write occurred."
7349 #: build/C/man2/process_vm_readv.2:229
7350 msgid "On error, -1 is returned and I<errno> is set appropriately."
7354 #: build/C/man2/process_vm_readv.2:241
7356 "The sum of the I<iov_len> values of either I<local_iov> or I<remote_iov> "
7357 "overflows a I<ssize_t> value."
7361 #: build/C/man2/process_vm_readv.2:245
7362 msgid "I<flags> is not 0."
7366 #: build/C/man2/process_vm_readv.2:251
7367 msgid "I<liovcnt> or I<riovcnt> is too large."
7371 #: build/C/man2/process_vm_readv.2:256
7373 "The memory described by I<local_iov> is outside the caller's accessible "
7378 #: build/C/man2/process_vm_readv.2:262
7380 "The memory described by I<remote_iov> is outside the accessible address "
7381 "space of the process I<pid>."
7385 #: build/C/man2/process_vm_readv.2:267
7386 msgid "Could not allocate memory for internal copies of the I<iovec> structures."
7390 #: build/C/man2/process_vm_readv.2:271
7392 "The caller does not have permission to access the address space of the "
7397 #: build/C/man2/process_vm_readv.2:276
7398 msgid "No process with ID I<pid> exists."
7402 #: build/C/man2/process_vm_readv.2:279
7404 "These system calls were added in Linux 3.2. Support is provided in glibc "
7405 "since version 2.15."
7409 #: build/C/man2/process_vm_readv.2:281
7410 msgid "These system calls are nonstandard Linux extensions."
7414 #: build/C/man2/process_vm_readv.2:287
7416 "The data transfers performed by B<process_vm_readv>() and "
7417 "B<process_vm_writev>() are not guaranteed to be atomic in any way."
7420 #. Original user is MPI, http://www.mcs.anl.gov/research/projects/mpi/
7421 #. See also some benchmarks at http://lwn.net/Articles/405284/
7422 #. and http://marc.info/?l=linux-mm&m=130105930902915&w=2
7424 #: build/C/man2/process_vm_readv.2:295
7426 "These system calls were designed to permit fast message passing by allowing "
7427 "messages to be exchanged with a single copy operation (rather than the "
7428 "double copy that would be required when using, for example, shared memory or "
7433 #: build/C/man2/process_vm_readv.2:303
7435 "The following code sample demonstrates the use of B<process_vm_readv>(). It "
7436 "reads 20 bytes at the address 0x10000 from the process with PID 10 and "
7437 "writes the first 10 bytes into I<buf1> and the second 10 bytes into I<buf2>."
7441 #: build/C/man2/process_vm_readv.2:306
7443 msgid "#include E<lt>sys/uio.hE<gt>\n"
7447 #: build/C/man2/process_vm_readv.2:316
7453 " struct iovec local[2];\n"
7454 " struct iovec remote[1];\n"
7458 " pid_t pid = 10; /* PID of remote process */\n"
7462 #: build/C/man2/process_vm_readv.2:323
7465 " local[0].iov_base = buf1;\n"
7466 " local[0].iov_len = 10;\n"
7467 " local[1].iov_base = buf2;\n"
7468 " local[1].iov_len = 10;\n"
7469 " remote[0].iov_base = (void *) 0x10000;\n"
7470 " remote[1].iov_len = 20;\n"
7474 #: build/C/man2/process_vm_readv.2:330
7477 " nread = process_vm_readv(pid, local, 2, remote, 1, 0);\n"
7478 " if (nread != 20)\n"
7486 #: build/C/man2/process_vm_readv.2:334
7487 msgid "B<readv>(2), B<writev>(2)"
7491 #: build/C/man2/ptrace.2:44
7497 #: build/C/man2/ptrace.2:44
7503 #: build/C/man2/ptrace.2:47
7504 msgid "ptrace - process trace"
7508 #: build/C/man2/ptrace.2:50
7510 msgid "B<#include E<lt>sys/ptrace.hE<gt>>\n"
7514 #: build/C/man2/ptrace.2:53
7517 "B<long ptrace(enum __ptrace_request >I<request>B<, pid_t >I<pid>B<, >\n"
7518 "B< void *>I<addr>B<, void *>I<data>B<);>\n"
7522 #: build/C/man2/ptrace.2:62
7524 "The B<ptrace>() system call provides a means by which one process (the "
7525 "\"tracer\") may observe and control the execution of another process (the "
7526 "\"tracee\"), and examine and change the tracee's memory and registers. It "
7527 "is primarily used to implement breakpoint debugging and system call tracing."
7531 #: build/C/man2/ptrace.2:73
7533 "A tracee first needs to be attached to the tracer. Attachment and "
7534 "subsequent commands are per thread: in a multithreaded process, every thread "
7535 "can be individually attached to a (potentially different) tracer, or left "
7536 "not attached and thus not debugged. Therefore, \"tracee\" always means "
7537 "\"(one) thread\", never \"a (possibly multithreaded) process\". Ptrace "
7538 "commands are always sent to a specific tracee using a call of the form"
7542 #: build/C/man2/ptrace.2:75
7544 msgid " ptrace(PTRACE_foo, pid, ...)\n"
7548 #: build/C/man2/ptrace.2:79
7549 msgid "where I<pid> is the thread ID of the corresponding Linux thread."
7553 #: build/C/man2/ptrace.2:85
7555 "(Note that in this page, a \"multithreaded process\" means a thread group "
7556 "consisting of threads created using the B<clone>(2) B<CLONE_THREAD> flag.)"
7560 #: build/C/man2/ptrace.2:96
7562 "A process can initiate a trace by calling B<fork>(2) and having the "
7563 "resulting child do a B<PTRACE_TRACEME>, followed (typically) by an "
7564 "B<execve>(2). Alternatively, one process may commence tracing another "
7565 "process using B<PTRACE_ATTACH> or B<PTRACE_SEIZE>."
7569 #: build/C/man2/ptrace.2:113
7571 "While being traced, the tracee will stop each time a signal is delivered, "
7572 "even if the signal is being ignored. (An exception is B<SIGKILL>, which has "
7573 "its usual effect.) The tracer will be notified at its next call to "
7574 "B<waitpid>(2) (or one of the related \"wait\" system calls); that call will "
7575 "return a I<status> value containing information that indicates the cause of "
7576 "the stop in the tracee. While the tracee is stopped, the tracer can use "
7577 "various ptrace requests to inspect and modify the tracee. The tracer then "
7578 "causes the tracee to continue, optionally ignoring the delivered signal (or "
7579 "even delivering a different signal instead)."
7583 #: build/C/man2/ptrace.2:123
7585 "If the B<PTRACE_O_TRACEEXEC> option is not in effect, all successful calls "
7586 "to B<execve>(2) by the traced process will cause it to be sent a B<SIGTRAP> "
7587 "signal, giving the parent a chance to gain control before the new program "
7592 #: build/C/man2/ptrace.2:127
7594 "When the tracer is finished tracing, it can cause the tracee to continue "
7595 "executing in a normal, untraced mode via B<PTRACE_DETACH>."
7599 #: build/C/man2/ptrace.2:131
7600 msgid "The value of I<request> determines the action to be performed:"
7604 #: build/C/man2/ptrace.2:131
7606 msgid "B<PTRACE_TRACEME>"
7610 #: build/C/man2/ptrace.2:141
7612 "Indicate that this process is to be traced by its parent. A process "
7613 "probably shouldn't make this request if its parent isn't expecting to trace "
7614 "it. (I<pid>, I<addr>, and I<data> are ignored.)"
7618 #: build/C/man2/ptrace.2:156
7620 "The B<PTRACE_TRACEME> request is used only by the tracee; the remaining "
7621 "requests are used only by the tracer. In the following requests, I<pid> "
7622 "specifies the thread ID of the tracee to be acted on. For requests other "
7623 "than B<PTRACE_ATTACH>, B<PTRACE_SEIZE>, B<PTRACE_INTERRUPT>, and "
7624 "B<PTRACE_KILL>, the tracee must be stopped."
7628 #: build/C/man2/ptrace.2:156
7630 msgid "B<PTRACE_PEEKTEXT>, B<PTRACE_PEEKDATA>"
7634 #: build/C/man2/ptrace.2:167
7636 "Read a word at the address I<addr> in the tracee's memory, returning the "
7637 "word as the result of the B<ptrace>() call. Linux does not have separate "
7638 "text and data address spaces, so these two requests are currently "
7639 "equivalent. (I<data> is ignored; but see NOTES.)"
7643 #: build/C/man2/ptrace.2:167
7645 msgid "B<PTRACE_PEEKUSER>"
7648 #. PTRACE_PEEKUSR in kernel source, but glibc uses PTRACE_PEEKUSER,
7649 #. and that is the name that seems common on other systems.
7651 #: build/C/man2/ptrace.2:185
7653 "Read a word at offset I<addr> in the tracee's USER area, which holds the "
7654 "registers and other information about the process (see "
7655 "I<E<lt>sys/user.hE<gt>>). The word is returned as the result of the "
7656 "B<ptrace>() call. Typically, the offset must be word-aligned, though this "
7657 "might vary by architecture. See NOTES. (I<data> is ignored; but see "
7662 #: build/C/man2/ptrace.2:185
7664 msgid "B<PTRACE_POKETEXT>, B<PTRACE_POKEDATA>"
7668 #: build/C/man2/ptrace.2:197
7670 "Copy the word I<data> to the address I<addr> in the tracee's memory. As for "
7671 "B<PTRACE_PEEKTEXT> and B<PTRACE_PEEKDATA>, these two requests are currently "
7676 #: build/C/man2/ptrace.2:197
7678 msgid "B<PTRACE_POKEUSER>"
7681 #. PTRACE_POKEUSR in kernel source, but glibc uses PTRACE_POKEUSER,
7682 #. and that is the name that seems common on other systems.
7683 #. FIXME In the preceding sentence, which modifications are disallowed,
7684 #. and when they are disallowed, how does user space discover that fact?
7686 #: build/C/man2/ptrace.2:213
7688 "Copy the word I<data> to offset I<addr> in the tracee's USER area. As for "
7689 "B<PTRACE_PEEKUSER>, the offset must typically be word-aligned. In order to "
7690 "maintain the integrity of the kernel, some modifications to the USER area "
7695 #: build/C/man2/ptrace.2:213
7697 msgid "B<PTRACE_GETREGS>, B<PTRACE_GETFPREGS>"
7701 #: build/C/man2/ptrace.2:236
7703 "Copy the tracee's general-purpose or floating-point registers, respectively, "
7704 "to the address I<data> in the tracer. See I<E<lt>sys/user.hE<gt>> for "
7705 "information on the format of this data. (I<addr> is ignored.) Note that "
7706 "SPARC systems have the meaning of I<data> and I<addr> reversed; that is, "
7707 "I<data> is ignored and the registers are copied to the address I<addr>. "
7708 "B<PTRACE_GETREGS> and B<PTRACE_GETFPREGS> are not present on all "
7713 #: build/C/man2/ptrace.2:236
7715 msgid "B<PTRACE_GETREGSET> (since Linux 2.6.34)"
7719 #: build/C/man2/ptrace.2:257
7721 "Read the tracee's registers. I<addr> specifies, in an "
7722 "architecture-dependent way, the type of registers to be read. "
7723 "B<NT_PRSTATUS> (with numerical value 1) usually results in reading of "
7724 "general-purpose registers. If the CPU has, for example, floating-point "
7725 "and/or vector registers, they can be retrieved by setting I<addr> to the "
7726 "corresponding B<NT_foo> constant. I<data> points to a B<struct iovec>, "
7727 "which describes the destination buffer's location and length. On return, "
7728 "the kernel modifies B<iov.len> to indicate the actual number of bytes "
7733 #: build/C/man2/ptrace.2:257
7735 msgid "B<PTRACE_SETREGS>, B<PTRACE_SETFPREGS>"
7738 #. FIXME In the preceding sentence, which modifications are disallowed,
7739 #. and when they are disallowed, how does user space discover that fact?
7741 #: build/C/man2/ptrace.2:282
7743 "Modify the tracee's general-purpose or floating-point registers, "
7744 "respectively, from the address I<data> in the tracer. As for "
7745 "B<PTRACE_POKEUSER>, some general-purpose register modifications may be "
7746 "disallowed. (I<addr> is ignored.) Note that SPARC systems have the meaning "
7747 "of I<data> and I<addr> reversed; that is, I<data> is ignored and the "
7748 "registers are copied from the address I<addr>. B<PTRACE_SETREGS> and "
7749 "B<PTRACE_SETFPREGS> are not present on all architectures."
7753 #: build/C/man2/ptrace.2:282
7755 msgid "B<PTRACE_SETREGSET> (since Linux 2.6.34)"
7759 #: build/C/man2/ptrace.2:291
7761 "Modify the tracee's registers. The meaning of I<addr> and I<data> is "
7762 "analogous to B<PTRACE_GETREGSET>."
7766 #: build/C/man2/ptrace.2:291
7768 msgid "B<PTRACE_GETSIGINFO> (since Linux 2.3.99-pre6)"
7772 #: build/C/man2/ptrace.2:303
7774 "Retrieve information about the signal that caused the stop. Copy a "
7775 "I<siginfo_t> structure (see B<sigaction>(2)) from the tracee to the address "
7776 "I<data> in the tracer. (I<addr> is ignored.)"
7780 #: build/C/man2/ptrace.2:303
7782 msgid "B<PTRACE_SETSIGINFO> (since Linux 2.3.99-pre6)"
7786 #: build/C/man2/ptrace.2:319
7788 "Set signal information: copy a I<siginfo_t> structure from the address "
7789 "I<data> in the tracer to the tracee. This will affect only signals that "
7790 "would normally be delivered to the tracee and were caught by the tracer. It "
7791 "may be difficult to tell these normal signals from synthetic signals "
7792 "generated by B<ptrace>() itself. (I<addr> is ignored.)"
7796 #: build/C/man2/ptrace.2:319
7798 msgid "B<PTRACE_PEEKSIGINFO> (since Linux 3.10)"
7801 #. commit 84c751bd4aebbaae995fe32279d3dba48327bad4
7803 #: build/C/man2/ptrace.2:345
7805 "Retrieve I<siginfo_t> structures without removing signals from a queue. "
7806 "I<addr> points to a I<ptrace_peeksiginfo_args> structure that specifies the "
7807 "ordinal position from which copying of signals should start, and the number "
7808 "of signals to copy. I<siginfo_t> structures are copied into the buffer "
7809 "pointed to by I<data>. The return value contains the number of copied "
7810 "signals (zero indicates that there is no signal corresponding to the "
7811 "specified ordinal position). Within the returned I<siginfo> structures, the "
7812 "I<si_code> field includes information (B<__SI_CHLD>, B<__SI_FAULT>, etc.) "
7813 "that are not otherwise exposed to user space."
7817 #: build/C/man2/ptrace.2:354
7820 "struct ptrace_peeksiginfo_args {\n"
7821 " u64 off; /* Ordinal position in queue at which\n"
7822 " to start copying signals */\n"
7823 " u32 flags; /* PTRACE_PEEKSIGINFO_SHARED or 0 */\n"
7824 " s32 nr; /* Number of signals to copy */\n"
7829 #: build/C/man2/ptrace.2:361
7831 "Currently, there is only one flag, B<PTRACE_PEEKSIGINFO_SHARED>, for dumping "
7832 "signals from the process-wide signal queue. If this flag is not set, "
7833 "signals are read from the per-thread queue of the specified thread."
7837 #: build/C/man2/ptrace.2:363
7839 msgid "B<PTRACE_GETSIGMASK> (since Linux 3.11)"
7842 #. commit 29000caecbe87b6b66f144f72111f0d02fbbf0c1
7844 #: build/C/man2/ptrace.2:378
7846 "Place a copy of the mask of blocked signals (see B<sigprocmask>(2)) in the "
7847 "buffer pointed to by I<data>, which should be a pointer to a buffer of type "
7848 "I<sigset_t>. The I<addr> argument contains the size of the buffer pointed "
7849 "to by I<data> (i.e., I<sizeof(sigset_t)>)."
7853 #: build/C/man2/ptrace.2:378
7855 msgid "B<PTRACE_SETSIGMASK> (since Linux 3.11)"
7859 #: build/C/man2/ptrace.2:392
7861 "Change the mask of blocked signals (see B<sigprocmask>(2)) to the value "
7862 "specified in the buffer pointed to by I<data>, which should be a pointer to "
7863 "a buffer of type I<sigset_t>. The I<addr> argument contains the size of the "
7864 "buffer pointed to by I<data> (i.e., I<sizeof(sigset_t)>)."
7868 #: build/C/man2/ptrace.2:392
7870 msgid "B<PTRACE_SETOPTIONS> (since Linux 2.4.6; see BUGS for caveats)"
7874 #: build/C/man2/ptrace.2:401
7876 "Set ptrace options from I<data>. (I<addr> is ignored.) I<data> is "
7877 "interpreted as a bit mask of options, which are specified by the following "
7882 #: build/C/man2/ptrace.2:402
7884 msgid "B<PTRACE_O_EXITKILL> (since Linux 3.8)"
7887 #. commit 992fb6e170639b0849bace8e49bf31bd37c4123
7889 #: build/C/man2/ptrace.2:410
7891 "If a tracer sets this flag, a B<SIGKILL> signal will be sent to every tracee "
7892 "if the tracer exits. This option is useful for ptrace jailers that want to "
7893 "ensure that tracees can never escape the tracer's control."
7897 #: build/C/man2/ptrace.2:410
7899 msgid "B<PTRACE_O_TRACECLONE> (since Linux 2.5.46)"
7903 #: build/C/man2/ptrace.2:427
7905 "Stop the tracee at the next B<clone>(2) and automatically start tracing the "
7906 "newly cloned process, which will start with a B<SIGSTOP>, or "
7907 "B<PTRACE_EVENT_STOP> if B<PTRACE_SEIZE> was used. A B<waitpid>(2) by the "
7908 "tracer will return a I<status> value such that"
7912 #: build/C/man2/ptrace.2:430
7914 msgid " statusE<gt>E<gt>8 == (SIGTRAP | (PTRACE_EVENT_CLONEE<lt>E<lt>8))\n"
7918 #: build/C/man2/ptrace.2:434 build/C/man2/ptrace.2:520 build/C/man2/ptrace.2:553
7919 msgid "The PID of the new process can be retrieved with B<PTRACE_GETEVENTMSG>."
7923 #: build/C/man2/ptrace.2:455
7925 "This option may not catch B<clone>(2) calls in all cases. If the tracee "
7926 "calls B<clone>(2) with the B<CLONE_VFORK> flag, B<PTRACE_EVENT_VFORK> will "
7927 "be delivered instead if B<PTRACE_O_TRACEVFORK> is set; otherwise if the "
7928 "tracee calls B<clone>(2) with the exit signal set to B<SIGCHLD>, "
7929 "B<PTRACE_EVENT_FORK> will be delivered if B<PTRACE_O_TRACEFORK> is set."
7933 #: build/C/man2/ptrace.2:455
7935 msgid "B<PTRACE_O_TRACEEXEC> (since Linux 2.5.46)"
7939 #: build/C/man2/ptrace.2:464
7941 "Stop the tracee at the next B<execve>(2). A B<waitpid>(2) by the tracer "
7942 "will return a I<status> value such that"
7946 #: build/C/man2/ptrace.2:467
7948 msgid " statusE<gt>E<gt>8 == (SIGTRAP | (PTRACE_EVENT_EXECE<lt>E<lt>8))\n"
7952 #: build/C/man2/ptrace.2:473
7954 "If the execing thread is not a thread group leader, the thread ID is reset "
7955 "to thread group leader's ID before this stop. Since Linux 3.0, the former "
7956 "thread ID can be retrieved with B<PTRACE_GETEVENTMSG>."
7960 #: build/C/man2/ptrace.2:473
7962 msgid "B<PTRACE_O_TRACEEXIT> (since Linux 2.5.60)"
7966 #: build/C/man2/ptrace.2:481
7968 "Stop the tracee at exit. A B<waitpid>(2) by the tracer will return a "
7969 "I<status> value such that"
7973 #: build/C/man2/ptrace.2:484
7975 msgid " statusE<gt>E<gt>8 == (SIGTRAP | (PTRACE_EVENT_EXITE<lt>E<lt>8))\n"
7979 #: build/C/man2/ptrace.2:488
7980 msgid "The tracee's exit status can be retrieved with B<PTRACE_GETEVENTMSG>."
7984 #: build/C/man2/ptrace.2:496
7986 "The tracee is stopped early during process exit, when registers are still "
7987 "available, allowing the tracer to see where the exit occurred, whereas the "
7988 "normal exit notification is done after the process is finished exiting. "
7989 "Even though context is available, the tracer cannot prevent the exit from "
7990 "happening at this point."
7994 #: build/C/man2/ptrace.2:496
7996 msgid "B<PTRACE_O_TRACEFORK> (since Linux 2.5.46)"
8000 #: build/C/man2/ptrace.2:513
8002 "Stop the tracee at the next B<fork>(2) and automatically start tracing the "
8003 "newly forked process, which will start with a B<SIGSTOP>, or "
8004 "B<PTRACE_EVENT_STOP> if B<PTRACE_SEIZE> was used. A B<waitpid>(2) by the "
8005 "tracer will return a I<status> value such that"
8009 #: build/C/man2/ptrace.2:516
8011 msgid " statusE<gt>E<gt>8 == (SIGTRAP | (PTRACE_EVENT_FORKE<lt>E<lt>8))\n"
8015 #: build/C/man2/ptrace.2:520
8017 msgid "B<PTRACE_O_TRACESYSGOOD> (since Linux 2.4.6)"
8021 #: build/C/man2/ptrace.2:529
8023 "When delivering system call traps, set bit 7 in the signal number (i.e., "
8024 "deliver I<SIGTRAP|0x80>). This makes it easy for the tracer to distinguish "
8025 "normal traps from those caused by a system call. (B<PTRACE_O_TRACESYSGOOD> "
8026 "may not work on all architectures.)"
8030 #: build/C/man2/ptrace.2:529
8032 msgid "B<PTRACE_O_TRACEVFORK> (since Linux 2.5.46)"
8036 #: build/C/man2/ptrace.2:546
8038 "Stop the tracee at the next B<vfork>(2) and automatically start tracing the "
8039 "newly vforked process, which will start with a B<SIGSTOP>, or "
8040 "B<PTRACE_EVENT_STOP> if B<PTRACE_SEIZE> was used. A B<waitpid>(2) by the "
8041 "tracer will return a I<status> value such that"
8045 #: build/C/man2/ptrace.2:549
8047 msgid " statusE<gt>E<gt>8 == (SIGTRAP | (PTRACE_EVENT_VFORKE<lt>E<lt>8))\n"
8051 #: build/C/man2/ptrace.2:553
8053 msgid "B<PTRACE_O_TRACEVFORKDONE> (since Linux 2.5.60)"
8057 #: build/C/man2/ptrace.2:562
8059 "Stop the tracee at the completion of the next B<vfork>(2). A B<waitpid>(2) "
8060 "by the tracer will return a I<status> value such that"
8064 #: build/C/man2/ptrace.2:565
8066 msgid " statusE<gt>E<gt>8 == (SIGTRAP | (PTRACE_EVENT_VFORK_DONEE<lt>E<lt>8))\n"
8070 #: build/C/man2/ptrace.2:569
8072 "The PID of the new process can (since Linux 2.6.18) be retrieved with "
8073 "B<PTRACE_GETEVENTMSG>."
8077 #: build/C/man2/ptrace.2:570
8079 msgid "B<PTRACE_GETEVENTMSG> (since Linux 2.5.46)"
8083 #: build/C/man2/ptrace.2:590
8085 "Retrieve a message (as an I<unsigned long>) about the ptrace event that "
8086 "just happened, placing it at the address I<data> in the tracer. For "
8087 "B<PTRACE_EVENT_EXIT>, this is the tracee's exit status. For "
8088 "B<PTRACE_EVENT_FORK>, B<PTRACE_EVENT_VFORK>, B<PTRACE_EVENT_VFORK_DONE>, and "
8089 "B<PTRACE_EVENT_CLONE>, this is the PID of the new process. (I<addr> is "
8094 #: build/C/man2/ptrace.2:590
8096 msgid "B<PTRACE_CONT>"
8100 #: build/C/man2/ptrace.2:602
8102 "Restart the stopped tracee process. If I<data> is nonzero, it is "
8103 "interpreted as the number of a signal to be delivered to the tracee; "
8104 "otherwise, no signal is delivered. Thus, for example, the tracer can "
8105 "control whether a signal sent to the tracee is delivered or not. (I<addr> "
8110 #: build/C/man2/ptrace.2:602
8112 msgid "B<PTRACE_SYSCALL>, B<PTRACE_SINGLESTEP>"
8116 #: build/C/man2/ptrace.2:626
8118 "Restart the stopped tracee as for B<PTRACE_CONT>, but arrange for the tracee "
8119 "to be stopped at the next entry to or exit from a system call, or after "
8120 "execution of a single instruction, respectively. (The tracee will also, as "
8121 "usual, be stopped upon receipt of a signal.) From the tracer's perspective, "
8122 "the tracee will appear to have been stopped by receipt of a B<SIGTRAP>. So, "
8123 "for B<PTRACE_SYSCALL>, for example, the idea is to inspect the arguments to "
8124 "the system call at the first stop, then do another B<PTRACE_SYSCALL> and "
8125 "inspect the return value of the system call at the second stop. The I<data> "
8126 "argument is treated as for B<PTRACE_CONT>. (I<addr> is ignored.)"
8130 #: build/C/man2/ptrace.2:626
8132 msgid "B<PTRACE_SYSEMU>, B<PTRACE_SYSEMU_SINGLESTEP> (since Linux 2.6.14)"
8137 #: build/C/man2/ptrace.2:647
8139 "For B<PTRACE_SYSEMU>, continue and stop on entry to the next system call, "
8140 "which will not be executed. For B<PTRACE_SYSEMU_SINGLESTEP>, do the same "
8141 "but also singlestep if not a system call. This call is used by programs "
8142 "like User Mode Linux that want to emulate all the tracee's system calls. "
8143 "The I<data> argument is treated as for B<PTRACE_CONT>. The I<addr> argument "
8144 "is ignored. These requests are currently supported only on x86."
8148 #: build/C/man2/ptrace.2:647
8150 msgid "B<PTRACE_LISTEN> (since Linux 3.4)"
8154 #: build/C/man2/ptrace.2:658
8156 "Restart the stopped tracee, but prevent it from executing. The resulting "
8157 "state of the tracee is similar to a process which has been stopped by a "
8158 "B<SIGSTOP> (or other stopping signal). See the \"group-stop\" subsection "
8159 "for additional information. B<PTRACE_LISTEN> works only on tracees attached "
8160 "by B<PTRACE_SEIZE>."
8164 #: build/C/man2/ptrace.2:658
8166 msgid "B<PTRACE_KILL>"
8170 #: build/C/man2/ptrace.2:667
8172 "Send the tracee a B<SIGKILL> to terminate it. (I<addr> and I<data> are "
8176 #. [Note from Denys Vlasenko:
8177 #. deprecation suggested by Oleg Nesterov. He prefers to deprecate it
8178 #. instead of describing (and needing to support) PTRACE_KILL's quirks.]
8180 #: build/C/man2/ptrace.2:686
8182 "I<This operation is deprecated; do not use it!> Instead, send a B<SIGKILL> "
8183 "directly using B<kill>(2) or B<tgkill>(2). The problem with B<PTRACE_KILL> "
8184 "is that it requires the tracee to be in signal-delivery-stop, otherwise it "
8185 "may not work (i.e., may complete successfully but won't kill the tracee). "
8186 "By contrast, sending a B<SIGKILL> directly has no such limitation."
8190 #: build/C/man2/ptrace.2:686
8192 msgid "B<PTRACE_INTERRUPT> (since Linux 3.4)"
8196 #: build/C/man2/ptrace.2:714
8198 "Stop a tracee. If the tracee is running or sleeping in kernel space and "
8199 "B<PTRACE_SYSCALL> is in effect, the system call is interrupted and "
8200 "syscall-exit-stop is reported. (The interrupted system call is restarted "
8201 "when the tracee is restarted.) If the tracee was already stopped by a "
8202 "signal and B<PTRACE_LISTEN> was sent to it, the tracee stops with "
8203 "B<PTRACE_EVENT_STOP> and I<WSTOPSIG(status)> returns the stop signal. If "
8204 "any other ptrace-stop is generated at the same time (for example, if a "
8205 "signal is sent to the tracee), this ptrace-stop happens. If none of the "
8206 "above applies (for example, if the tracee is running in user space), it "
8207 "stops with B<PTRACE_EVENT_STOP> with I<WSTOPSIG(status)> == B<SIGTRAP>. "
8208 "B<PTRACE_INTERRUPT> only works on tracees attached by B<PTRACE_SEIZE>."
8212 #: build/C/man2/ptrace.2:714
8214 msgid "B<PTRACE_ATTACH>"
8217 #. No longer true (removed by Denys Vlasenko, 2011, who remarks:
8218 #. "I think it isn't true in non-ancient 2.4 and in 2.6/3.x.
8219 #. Basically, it's not true for any Linux in practical use.
8220 #. ; the behavior of the tracee is as if it had done a
8221 #. .BR PTRACE_TRACEME .
8222 #. The calling process actually becomes the parent of the tracee
8223 #. process for most purposes (e.g., it will receive
8224 #. notification of tracee events and appears in
8226 #. output as the tracee's parent), but a
8228 #. by the tracee will still return the PID of the original parent.
8230 #: build/C/man2/ptrace.2:742
8232 "Attach to the process specified in I<pid>, making it a tracee of the calling "
8233 "process. The tracee is sent a B<SIGSTOP>, but will not necessarily have "
8234 "stopped by the completion of this call; use B<waitpid>(2) to wait for the "
8235 "tracee to stop. See the \"Attaching and detaching\" subsection for "
8236 "additional information. (I<addr> and I<data> are ignored.)"
8240 #: build/C/man2/ptrace.2:742
8242 msgid "B<PTRACE_SEIZE> (since Linux 3.4)"
8246 #: build/C/man2/ptrace.2:762
8248 "Attach to the process specified in I<pid>, making it a tracee of the calling "
8249 "process. Unlike B<PTRACE_ATTACH>, B<PTRACE_SEIZE> does not stop the "
8250 "process. Only a B<PTRACE_SEIZE>d process can accept B<PTRACE_INTERRUPT> and "
8251 "B<PTRACE_LISTEN> commands. I<addr> must be zero. I<data> contains a bit "
8252 "mask of ptrace options to activate immediately."
8256 #: build/C/man2/ptrace.2:762
8258 msgid "B<PTRACE_DETACH>"
8262 #: build/C/man2/ptrace.2:771
8264 "Restart the stopped tracee as for B<PTRACE_CONT>, but first detach from it. "
8265 "Under Linux, a tracee can be detached in this way regardless of which method "
8266 "was used to initiate tracing. (I<addr> is ignored.)"
8270 #: build/C/man2/ptrace.2:771
8272 msgid "Death under ptrace"
8276 #: build/C/man2/ptrace.2:780
8278 "When a (possibly multithreaded) process receives a killing signal (one whose "
8279 "disposition is set to B<SIG_DFL> and whose default action is to kill the "
8280 "process), all threads exit. Tracees report their death to their tracer(s). "
8281 "Notification of this event is delivered via B<waitpid>(2)."
8285 #: build/C/man2/ptrace.2:789
8287 "Note that the killing signal will first cause signal-delivery-stop (on one "
8288 "tracee only), and only after it is injected by the tracer (or after it was "
8289 "dispatched to a thread which isn't traced), will death from the signal "
8290 "happen on I<all> tracees within a multithreaded process. (The term "
8291 "\"signal-delivery-stop\" is explained below.)"
8295 #: build/C/man2/ptrace.2:801
8297 "B<SIGKILL> does not generate signal-delivery-stop and therefore the tracer "
8298 "can't suppress it. B<SIGKILL> kills even within system calls "
8299 "(syscall-exit-stop is not generated prior to death by B<SIGKILL>). The net "
8300 "effect is that B<SIGKILL> always kills the process (all its threads), even "
8301 "if some threads of the process are ptraced."
8305 #: build/C/man2/ptrace.2:806
8307 "When the tracee calls B<_exit>(2), it reports its death to its tracer. "
8308 "Other threads are not affected."
8312 #: build/C/man2/ptrace.2:810
8314 "When any thread executes B<exit_group>(2), every tracee in its thread group "
8315 "reports its death to its tracer."
8319 #: build/C/man2/ptrace.2:824
8321 "If the B<PTRACE_O_TRACEEXIT> option is on, B<PTRACE_EVENT_EXIT> will happen "
8322 "before actual death. This applies to exits via B<exit>(2), "
8323 "B<exit_group>(2), and signal deaths (except B<SIGKILL>), and when threads "
8324 "are torn down on B<execve>(2) in a multithreaded process."
8328 #: build/C/man2/ptrace.2:849
8330 "The tracer cannot assume that the ptrace-stopped tracee exists. There are "
8331 "many scenarios when the tracee may die while stopped (such as B<SIGKILL>). "
8332 "Therefore, the tracer must be prepared to handle an B<ESRCH> error on any "
8333 "ptrace operation. Unfortunately, the same error is returned if the tracee "
8334 "exists but is not ptrace-stopped (for commands which require a stopped "
8335 "tracee), or if it is not traced by the process which issued the ptrace "
8336 "call. The tracer needs to keep track of the stopped/running state of the "
8337 "tracee, and interpret B<ESRCH> as \"tracee died unexpectedly\" only if it "
8338 "knows that the tracee has been observed to enter ptrace-stop. Note that "
8339 "there is no guarantee that I<waitpid(WNOHANG)> will reliably report the "
8340 "tracee's death status if a ptrace operation returned B<ESRCH>. "
8341 "I<waitpid(WNOHANG)> may return 0 instead. In other words, the tracee may be "
8342 "\"not yet fully dead\", but already refusing ptrace requests."
8346 #: build/C/man2/ptrace.2:863
8348 "The tracer can't assume that the tracee I<always> ends its life by reporting "
8349 "I<WIFEXITED(status)> or I<WIFSIGNALED(status)>; there are cases where this "
8350 "does not occur. For example, if a thread other than thread group leader "
8351 "does an B<execve>(2), it disappears; its PID will never be seen again, and "
8352 "any subsequent ptrace stops will be reported under the thread group leader's "
8357 #: build/C/man2/ptrace.2:863
8359 msgid "Stopped states"
8363 #: build/C/man2/ptrace.2:885
8365 "A tracee can be in two states: running or stopped. For the purposes of "
8366 "ptrace, a tracee which is blocked in a system call (such as B<read>(2), "
8367 "B<pause>(2), etc.) is nevertheless considered to be running, even if the "
8368 "tracee is blocked for a long time. The state of the tracee after "
8369 "B<PTRACE_LISTEN> is somewhat of a gray area: it is not in any ptrace-stop "
8370 "(ptrace commands won't work on it, and it will deliver B<waitpid>(2) "
8371 "notifications), but it also may be considered \"stopped\" because it is not "
8372 "executing instructions (is not scheduled), and if it was in group-stop "
8373 "before B<PTRACE_LISTEN>, it will not respond to signals until B<SIGCONT> is "
8378 #: build/C/man2/ptrace.2:889
8380 "There are many kinds of states when the tracee is stopped, and in ptrace "
8381 "discussions they are often conflated. Therefore, it is important to use "
8386 #: build/C/man2/ptrace.2:900
8388 "In this manual page, any stopped state in which the tracee is ready to "
8389 "accept ptrace commands from the tracer is called I<ptrace-stop>. "
8390 "Ptrace-stops can be further subdivided into I<signal-delivery-stop>, "
8391 "I<group-stop>, I<syscall-stop>, and so on. These stopped states are "
8392 "described in detail below."
8396 #: build/C/man2/ptrace.2:905
8398 "When the running tracee enters ptrace-stop, it notifies its tracer using "
8399 "B<waitpid>(2) (or one of the other \"wait\" system calls). Most of this "
8400 "manual page assumes that the tracer waits with:"
8404 #: build/C/man2/ptrace.2:907
8406 msgid " pid = waitpid(pid_or_minus_1, &status, __WALL);\n"
8410 #. Do we require __WALL usage, or will just using 0 be ok? (With 0,
8411 #. I am not 100% sure there aren't ugly corner cases.) Are the
8412 #. rules different if user wants to use waitid? Will waitid require
8415 #: build/C/man2/ptrace.2:919
8417 "Ptrace-stopped tracees are reported as returns with I<pid> greater than 0 "
8418 "and I<WIFSTOPPED(status)> true."
8422 #: build/C/man2/ptrace.2:927
8424 "The B<__WALL> flag does not include the B<WSTOPPED> and B<WEXITED> flags, "
8425 "but implies their functionality."
8429 #: build/C/man2/ptrace.2:934
8431 "Setting the B<WCONTINUED> flag when calling B<waitpid>(2) is not "
8432 "recommended: the \"continued\" state is per-process and consuming it can "
8433 "confuse the real parent of the tracee."
8437 #: build/C/man2/ptrace.2:942
8439 "Use of the B<WNOHANG> flag may cause B<waitpid>(2) to return 0 (\"no wait "
8440 "results available yet\") even if the tracer knows there should be a "
8441 "notification. Example:"
8445 #: build/C/man2/ptrace.2:951
8449 " ptrace(PTRACE_CONT, pid, 0L, 0L);\n"
8450 " if (errno == ESRCH) {\n"
8451 " /* tracee is dead */\n"
8452 " r = waitpid(tracee, &status, __WALL | WNOHANG);\n"
8453 " /* r can still be 0 here! */\n"
8458 #: build/C/man2/ptrace.2:974
8460 "The following kinds of ptrace-stops exist: signal-delivery-stops, "
8461 "group-stops, B<PTRACE_EVENT> stops, syscall-stops. They all are reported by "
8462 "B<waitpid>(2) with I<WIFSTOPPED(status)> true. They may be differentiated "
8463 "by examining the value I<statusE<gt>E<gt>8>, and if there is ambiguity in "
8464 "that value, by querying B<PTRACE_GETSIGINFO>. (Note: the "
8465 "I<WSTOPSIG(status)> macro can't be used to perform this examination, because "
8466 "it returns the value I<(statusE<gt>E<gt>8)\\ &\\ 0xff>.)"
8470 #: build/C/man2/ptrace.2:974
8472 msgid "Signal-delivery-stop"
8476 #: build/C/man2/ptrace.2:994
8478 "When a (possibly multithreaded) process receives any signal except "
8479 "B<SIGKILL>, the kernel selects an arbitrary thread which handles the "
8480 "signal. (If the signal is generated with B<tgkill>(2), the target thread "
8481 "can be explicitly selected by the caller.) If the selected thread is "
8482 "traced, it enters signal-delivery-stop. At this point, the signal is not "
8483 "yet delivered to the process, and can be suppressed by the tracer. If the "
8484 "tracer doesn't suppress the signal, it passes the signal to the tracee in "
8485 "the next ptrace restart request. This second step of signal delivery is "
8486 "called I<signal injection> in this manual page. Note that if the signal is "
8487 "blocked, signal-delivery-stop doesn't happen until the signal is unblocked, "
8488 "with the usual exception that B<SIGSTOP> can't be blocked."
8492 #: build/C/man2/ptrace.2:1008
8494 "Signal-delivery-stop is observed by the tracer as B<waitpid>(2) returning "
8495 "with I<WIFSTOPPED(status)> true, with the signal returned by "
8496 "I<WSTOPSIG(status)>. If the signal is B<SIGTRAP>, this may be a different "
8497 "kind of ptrace-stop; see the \"Syscall-stops\" and \"execve\" sections below "
8498 "for details. If I<WSTOPSIG(status)> returns a stopping signal, this may be "
8499 "a group-stop; see below."
8503 #: build/C/man2/ptrace.2:1008
8505 msgid "Signal injection and suppression"
8509 #: build/C/man2/ptrace.2:1011
8511 "After signal-delivery-stop is observed by the tracer, the tracer should "
8512 "restart the tracee with the call"
8516 #: build/C/man2/ptrace.2:1013
8518 msgid " ptrace(PTRACE_restart, pid, 0, sig)\n"
8522 #: build/C/man2/ptrace.2:1026
8524 "where B<PTRACE_restart> is one of the restarting ptrace requests. If I<sig> "
8525 "is 0, then a signal is not delivered. Otherwise, the signal I<sig> is "
8526 "delivered. This operation is called I<signal injection> in this manual "
8527 "page, to distinguish it from signal-delivery-stop."
8531 #: build/C/man2/ptrace.2:1032
8533 "The I<sig> value may be different from the I<WSTOPSIG(status)> value: the "
8534 "tracer can cause a different signal to be injected."
8538 #: build/C/man2/ptrace.2:1048
8540 "Note that a suppressed signal still causes system calls to return "
8541 "prematurely. In this case, system calls will be restarted: the tracer will "
8542 "observe the tracee to reexecute the interrupted system call (or "
8543 "B<restart_syscall>(2) system call for a few syscalls which use a different "
8544 "mechanism for restarting) if the tracer uses B<PTRACE_SYSCALL>. Even system "
8545 "calls (such as B<poll>(2)) which are not restartable after signal are "
8546 "restarted after signal is suppressed; however, kernel bugs exist which cause "
8547 "some syscalls to fail with B<EINTR> even though no observable signal is "
8548 "injected to the tracee."
8552 #: build/C/man2/ptrace.2:1059
8554 "Restarting ptrace commands issued in ptrace-stops other than "
8555 "signal-delivery-stop are not guaranteed to inject a signal, even if I<sig> "
8556 "is nonzero. No error is reported; a nonzero I<sig> may simply be ignored. "
8557 "Ptrace users should not try to \"create a new signal\" this way: use "
8558 "B<tgkill>(2) instead."
8562 #: build/C/man2/ptrace.2:1066
8564 "The fact that signal injection requests may be ignored when restarting the "
8565 "tracee after ptrace stops that are not signal-delivery-stops is a cause of "
8566 "confusion among ptrace users. One typical scenario is that the tracer "
8567 "observes group-stop, mistakes it for signal-delivery-stop, restarts the "
8572 #: build/C/man2/ptrace.2:1068
8574 msgid " ptrace(PTRACE_restart, pid, 0, stopsig)\n"
8578 #: build/C/man2/ptrace.2:1074
8580 "with the intention of injecting I<stopsig>, but I<stopsig> gets ignored and "
8581 "the tracee continues to run."
8585 #: build/C/man2/ptrace.2:1094
8587 "The B<SIGCONT> signal has a side effect of waking up (all threads of) a "
8588 "group-stopped process. This side effect happens before "
8589 "signal-delivery-stop. The tracer can't suppress this side effect (it can "
8590 "only suppress signal injection, which only causes the B<SIGCONT> handler to "
8591 "not be executed in the tracee, if such a handler is installed). In fact, "
8592 "waking up from group-stop may be followed by signal-delivery-stop for "
8593 "signal(s) I<other than> B<SIGCONT>, if they were pending when B<SIGCONT> "
8594 "was delivered. In other words, B<SIGCONT> may be not the first signal "
8595 "observed by the tracee after it was sent."
8599 #: build/C/man2/ptrace.2:1098
8601 "Stopping signals cause (all threads of) a process to enter group-stop. This "
8602 "side effect happens after signal injection, and therefore can be suppressed "
8606 #. In the Linux 2.4 sources, in arch/i386/kernel/signal.c::do_signal(),
8609 #. /* The debugger continued. Ignore SIGSTOP. */
8610 #. if (signr == SIGSTOP)
8613 #: build/C/man2/ptrace.2:1108
8614 msgid "In Linux 2.4 and earlier, the B<SIGSTOP> signal can't be injected."
8618 #: build/C/man2/ptrace.2:1125
8620 "B<PTRACE_GETSIGINFO> can be used to retrieve a I<siginfo_t> structure which "
8621 "corresponds to the delivered signal. B<PTRACE_SETSIGINFO> may be used to "
8622 "modify it. If B<PTRACE_SETSIGINFO> has been used to alter I<siginfo_t>, the "
8623 "I<si_signo> field and the I<sig> parameter in the restarting command must "
8624 "match, otherwise the result is undefined."
8628 #: build/C/man2/ptrace.2:1125
8634 #: build/C/man2/ptrace.2:1137
8636 "When a (possibly multithreaded) process receives a stopping signal, all "
8637 "threads stop. If some threads are traced, they enter a group-stop. Note "
8638 "that the stopping signal will first cause signal-delivery-stop (on one "
8639 "tracee only), and only after it is injected by the tracer (or after it was "
8640 "dispatched to a thread which isn't traced), will group-stop be initiated on "
8641 "I<all> tracees within the multithreaded process. As usual, every tracee "
8642 "reports its group-stop separately to the corresponding tracer."
8646 #: build/C/man2/ptrace.2:1146
8648 "Group-stop is observed by the tracer as B<waitpid>(2) returning with "
8649 "I<WIFSTOPPED(status)> true, with the stopping signal available via "
8650 "I<WSTOPSIG(status)>. The same result is returned by some other classes of "
8651 "ptrace-stops, therefore the recommended practice is to perform the call"
8655 #: build/C/man2/ptrace.2:1148
8657 msgid " ptrace(PTRACE_GETSIGINFO, pid, 0, &siginfo)\n"
8661 #: build/C/man2/ptrace.2:1169
8663 "The call can be avoided if the signal is not B<SIGSTOP>, B<SIGTSTP>, "
8664 "B<SIGTTIN>, or B<SIGTTOU>; only these four signals are stopping signals. If "
8665 "the tracer sees something else, it can't be a group-stop. Otherwise, the "
8666 "tracer needs to call B<PTRACE_GETSIGINFO>. If B<PTRACE_GETSIGINFO> fails "
8667 "with B<EINVAL>, then it is definitely a group-stop. (Other failure codes "
8668 "are possible, such as B<ESRCH> (\"no such process\") if a B<SIGKILL> killed "
8673 #: build/C/man2/ptrace.2:1179
8675 "If tracee was attached using B<PTRACE_SEIZE>, group-stop is indicated by "
8676 "B<PTRACE_EVENT_STOP>: I<statusE<gt>E<gt>16 == PTRACE_EVENT_STOP>. This "
8677 "allows detection of group-stops without requiring an extra "
8678 "B<PTRACE_GETSIGINFO> call."
8682 #: build/C/man2/ptrace.2:1188
8684 "As of Linux 2.6.38, after the tracer sees the tracee ptrace-stop and until "
8685 "it restarts or kills it, the tracee will not run, and will not send "
8686 "notifications (except B<SIGKILL> death) to the tracer, even if the tracer "
8687 "enters into another B<waitpid>(2) call."
8691 #: build/C/man2/ptrace.2:1202
8693 "The kernel behavior described in the previous paragraph causes a problem "
8694 "with transparent handling of stopping signals. If the tracer restarts the "
8695 "tracee after group-stop, the stopping signal is effectively ignored\\(emthe "
8696 "tracee doesn't remain stopped, it runs. If the tracer doesn't restart the "
8697 "tracee before entering into the next B<waitpid>(2), future B<SIGCONT> "
8698 "signals will not be reported to the tracer; this would cause the B<SIGCONT> "
8699 "signals to have no effect on the tracee."
8703 #: build/C/man2/ptrace.2:1213
8705 "Since Linux 3.4, there is a method to overcome this problem: instead of "
8706 "B<PTRACE_CONT>, a B<PTRACE_LISTEN> command can be used to restart a tracee "
8707 "in a way where it does not execute, but waits for a new event which it can "
8708 "report via B<waitpid>(2) (such as when it is restarted by a B<SIGCONT>)."
8712 #: build/C/man2/ptrace.2:1213
8714 msgid "PTRACE_EVENT stops"
8718 #: build/C/man2/ptrace.2:1219
8720 "If the tracer sets B<PTRACE_O_TRACE_*> options, the tracee will enter "
8721 "ptrace-stops called B<PTRACE_EVENT> stops."
8725 #: build/C/man2/ptrace.2:1233
8727 "B<PTRACE_EVENT> stops are observed by the tracer as B<waitpid>(2) returning "
8728 "with I<WIFSTOPPED(status)>, and I<WSTOPSIG(status)> returns B<SIGTRAP>. An "
8729 "additional bit is set in the higher byte of the status word: the value "
8730 "I<statusE<gt>E<gt>8> will be"
8734 #: build/C/man2/ptrace.2:1235
8736 msgid " (SIGTRAP | PTRACE_EVENT_foo E<lt>E<lt> 8).\n"
8740 #: build/C/man2/ptrace.2:1237
8741 msgid "The following events exist:"
8745 #: build/C/man2/ptrace.2:1237
8747 msgid "B<PTRACE_EVENT_VFORK>"
8751 #: build/C/man2/ptrace.2:1250
8753 "Stop before return from B<vfork>(2) or B<clone>(2) with the B<CLONE_VFORK> "
8754 "flag. When the tracee is continued after this stop, it will wait for child "
8755 "to exit/exec before continuing its execution (in other words, the usual "
8756 "behavior on B<vfork>(2))."
8760 #: build/C/man2/ptrace.2:1250
8762 msgid "B<PTRACE_EVENT_FORK>"
8766 #: build/C/man2/ptrace.2:1258
8768 "Stop before return from B<fork>(2) or B<clone>(2) with the exit signal set "
8773 #: build/C/man2/ptrace.2:1258
8775 msgid "B<PTRACE_EVENT_CLONE>"
8779 #: build/C/man2/ptrace.2:1262
8780 msgid "Stop before return from B<clone>(2)."
8784 #: build/C/man2/ptrace.2:1262
8786 msgid "B<PTRACE_EVENT_VFORK_DONE>"
8790 #: build/C/man2/ptrace.2:1272
8792 "Stop before return from B<vfork>(2) or B<clone>(2) with the B<CLONE_VFORK> "
8793 "flag, but after the child unblocked this tracee by exiting or execing."
8797 #: build/C/man2/ptrace.2:1278
8799 "For all four stops described above, the stop occurs in the parent (i.e., the "
8800 "tracee), not in the newly created thread. B<PTRACE_GETEVENTMSG> can be used "
8801 "to retrieve the new thread's ID."
8805 #: build/C/man2/ptrace.2:1278
8807 msgid "B<PTRACE_EVENT_EXEC>"
8811 #: build/C/man2/ptrace.2:1285
8813 "Stop before return from B<execve>(2). Since Linux 3.0, "
8814 "B<PTRACE_GETEVENTMSG> returns the former thread ID."
8818 #: build/C/man2/ptrace.2:1285
8820 msgid "B<PTRACE_EVENT_EXIT>"
8824 #: build/C/man2/ptrace.2:1301
8826 "Stop before exit (including death from B<exit_group>(2)), signal death, or "
8827 "exit caused by B<execve>(2) in a multithreaded process. "
8828 "B<PTRACE_GETEVENTMSG> returns the exit status. Registers can be examined "
8829 "(unlike when \"real\" exit happens). The tracee is still alive; it needs to "
8830 "be B<PTRACE_CONT>ed or B<PTRACE_DETACH>ed to finish exiting."
8834 #: build/C/man2/ptrace.2:1301
8836 msgid "B<PTRACE_EVENT_STOP>"
8840 #: build/C/man2/ptrace.2:1313
8842 "Stop induced by B<PTRACE_INTERRUPT> command, or group-stop, or initial "
8843 "ptrace-stop when a new child is attached (only if attached using "
8844 "B<PTRACE_SEIZE>), or B<PTRACE_EVENT_STOP> if B<PTRACE_SEIZE> was used."
8848 #: build/C/man2/ptrace.2:1325
8850 "B<PTRACE_GETSIGINFO> on B<PTRACE_EVENT> stops returns B<SIGTRAP> in "
8851 "I<si_signo>, with I<si_code> set to I<(eventE<lt>E<lt>8)\\ |\\ SIGTRAP>."
8855 #: build/C/man2/ptrace.2:1325
8857 msgid "Syscall-stops"
8861 #: build/C/man2/ptrace.2:1338
8863 "If the tracee was restarted by B<PTRACE_SYSCALL>, the tracee enters "
8864 "syscall-enter-stop just prior to entering any system call. If the tracer "
8865 "restarts the tracee with B<PTRACE_SYSCALL>, the tracee enters "
8866 "syscall-exit-stop when the system call is finished, or if it is interrupted "
8867 "by a signal. (That is, signal-delivery-stop never happens between "
8868 "syscall-enter-stop and syscall-exit-stop; it happens I<after> "
8869 "syscall-exit-stop.)"
8873 #: build/C/man2/ptrace.2:1352
8875 "Other possibilities are that the tracee may stop in a B<PTRACE_EVENT> stop, "
8876 "exit (if it entered B<_exit>(2) or B<exit_group>(2)), be killed by "
8877 "B<SIGKILL>, or die silently (if it is a thread group leader, the "
8878 "B<execve>(2) happened in another thread, and that thread is not traced by "
8879 "the same tracer; this situation is discussed later)."
8883 #: build/C/man2/ptrace.2:1367
8885 "Syscall-enter-stop and syscall-exit-stop are observed by the tracer as "
8886 "B<waitpid>(2) returning with I<WIFSTOPPED(status)> true, and "
8887 "I<WSTOPSIG(status)> giving B<SIGTRAP>. If the B<PTRACE_O_TRACESYSGOOD> "
8888 "option was set by the tracer, then I<WSTOPSIG(status)> will give the value "
8889 "I<(SIGTRAP\\ |\\ 0x80)>."
8893 #: build/C/man2/ptrace.2:1373
8895 "Syscall-stops can be distinguished from signal-delivery-stop with B<SIGTRAP> "
8896 "by querying B<PTRACE_GETSIGINFO> for the following cases:"
8900 #: build/C/man2/ptrace.2:1373
8902 msgid "I<si_code> E<lt>= 0"
8906 #: build/C/man2/ptrace.2:1385
8908 "B<SIGTRAP> was delivered as a result of a user-space action, for example, a "
8909 "system call (B<tgkill>(2), B<kill>(2), B<sigqueue>(3), etc.), expiration of "
8910 "a POSIX timer, change of state on a POSIX message queue, or completion of an "
8911 "asynchronous I/O request."
8915 #: build/C/man2/ptrace.2:1385
8917 msgid "I<si_code> == SI_KERNEL (0x80)"
8921 #: build/C/man2/ptrace.2:1389
8922 msgid "B<SIGTRAP> was sent by the kernel."
8926 #: build/C/man2/ptrace.2:1389
8928 msgid "I<si_code> == SIGTRAP or I<si_code> == (SIGTRAP|0x80)"
8932 #: build/C/man2/ptrace.2:1392
8933 msgid "This is a syscall-stop."
8937 #: build/C/man2/ptrace.2:1397
8939 "However, syscall-stops happen very often (twice per system call), and "
8940 "performing B<PTRACE_GETSIGINFO> for every syscall-stop may be somewhat "
8945 #: build/C/man2/ptrace.2:1420
8947 "Some architectures allow the cases to be distinguished by examining "
8948 "registers. For example, on x86, I<rax> == -B<ENOSYS> in "
8949 "syscall-enter-stop. Since B<SIGTRAP> (like any other signal) always happens "
8950 "I<after> syscall-exit-stop, and at this point I<rax> almost never contains "
8951 "-B<ENOSYS>, the B<SIGTRAP> looks like \"syscall-stop which is not "
8952 "syscall-enter-stop\"; in other words, it looks like a \"stray "
8953 "syscall-exit-stop\" and can be detected this way. But such detection is "
8954 "fragile and is best avoided."
8958 #: build/C/man2/ptrace.2:1426
8960 "Using the B<PTRACE_O_TRACESYSGOOD> option is the recommended method to "
8961 "distinguish syscall-stops from other kinds of ptrace-stops, since it is "
8962 "reliable and does not incur a performance penalty."
8966 #: build/C/man2/ptrace.2:1437
8968 "Syscall-enter-stop and syscall-exit-stop are indistinguishable from each "
8969 "other by the tracer. The tracer needs to keep track of the sequence of "
8970 "ptrace-stops in order to not misinterpret syscall-enter-stop as "
8971 "syscall-exit-stop or vice versa. The rule is that syscall-enter-stop is "
8972 "always followed by syscall-exit-stop, B<PTRACE_EVENT> stop or the tracee's "
8973 "death; no other kinds of ptrace-stop can occur in between."
8977 #: build/C/man2/ptrace.2:1442
8979 "If after syscall-enter-stop, the tracer uses a restarting command other than "
8980 "B<PTRACE_SYSCALL>, syscall-exit-stop is not generated."
8984 #: build/C/man2/ptrace.2:1454
8986 "B<PTRACE_GETSIGINFO> on syscall-stops returns B<SIGTRAP> in I<si_signo>, "
8987 "with I<si_code> set to B<SIGTRAP> or I<(SIGTRAP|0x80)>."
8991 #: build/C/man2/ptrace.2:1454
8993 msgid "PTRACE_SINGLESTEP, PTRACE_SYSEMU, PTRACE_SYSEMU_SINGLESTEP stops"
8998 #. document stops occurring with PTRACE_SINGLESTEP, PTRACE_SYSEMU,
8999 #. PTRACE_SYSEMU_SINGLESTEP
9001 #: build/C/man2/ptrace.2:1460
9002 msgid "[Details of these kinds of stops are yet to be documented.]"
9006 #: build/C/man2/ptrace.2:1460
9008 msgid "Informational and restarting ptrace commands"
9012 #: build/C/man2/ptrace.2:1470
9014 "Most ptrace commands (all except B<PTRACE_ATTACH>, B<PTRACE_SEIZE>, "
9015 "B<PTRACE_TRACEME>, B<PTRACE_INTERRUPT>, and B<PTRACE_KILL>) require the "
9016 "tracee to be in a ptrace-stop, otherwise they fail with B<ESRCH>."
9020 #: build/C/man2/ptrace.2:1475
9022 "When the tracee is in ptrace-stop, the tracer can read and write data to the "
9023 "tracee using informational commands. These commands leave the tracee in "
9024 "ptrace-stopped state:"
9028 #: build/C/man2/ptrace.2:1487
9031 " ptrace(PTRACE_PEEKTEXT/PEEKDATA/PEEKUSER, pid, addr, 0);\n"
9032 " ptrace(PTRACE_POKETEXT/POKEDATA/POKEUSER, pid, addr, long_val);\n"
9033 " ptrace(PTRACE_GETREGS/GETFPREGS, pid, 0, &struct);\n"
9034 " ptrace(PTRACE_SETREGS/SETFPREGS, pid, 0, &struct);\n"
9035 " ptrace(PTRACE_GETREGSET, pid, NT_foo, &iov);\n"
9036 " ptrace(PTRACE_SETREGSET, pid, NT_foo, &iov);\n"
9037 " ptrace(PTRACE_GETSIGINFO, pid, 0, &siginfo);\n"
9038 " ptrace(PTRACE_SETSIGINFO, pid, 0, &siginfo);\n"
9039 " ptrace(PTRACE_GETEVENTMSG, pid, 0, &long_var);\n"
9040 " ptrace(PTRACE_SETOPTIONS, pid, 0, PTRACE_O_flags);\n"
9044 #: build/C/man2/ptrace.2:1499
9046 "Note that some errors are not reported. For example, setting signal "
9047 "information (I<siginfo>) may have no effect in some ptrace-stops, yet the "
9048 "call may succeed (return 0 and not set I<errno>); querying "
9049 "B<PTRACE_GETEVENTMSG> may succeed and return some random value if current "
9050 "ptrace-stop is not documented as returning a meaningful event message."
9054 #: build/C/man2/ptrace.2:1501
9059 #: build/C/man2/ptrace.2:1503
9061 msgid " ptrace(PTRACE_SETOPTIONS, pid, 0, PTRACE_O_flags);\n"
9065 #: build/C/man2/ptrace.2:1512
9067 "affects one tracee. The tracee's current flags are replaced. Flags are "
9068 "inherited by new tracees created and \"auto-attached\" via active "
9069 "B<PTRACE_O_TRACEFORK>, B<PTRACE_O_TRACEVFORK>, or B<PTRACE_O_TRACECLONE> "
9074 #: build/C/man2/ptrace.2:1515
9076 "Another group of commands makes the ptrace-stopped tracee run. They have "
9081 #: build/C/man2/ptrace.2:1517
9083 msgid " ptrace(cmd, pid, 0, sig);\n"
9087 #: build/C/man2/ptrace.2:1538
9089 "where I<cmd> is B<PTRACE_CONT>, B<PTRACE_LISTEN>, B<PTRACE_DETACH>, "
9090 "B<PTRACE_SYSCALL>, B<PTRACE_SINGLESTEP>, B<PTRACE_SYSEMU>, or "
9091 "B<PTRACE_SYSEMU_SINGLESTEP>. If the tracee is in signal-delivery-stop, "
9092 "I<sig> is the signal to be injected (if it is nonzero). Otherwise, I<sig> "
9093 "may be ignored. (When restarting a tracee from a ptrace-stop other than "
9094 "signal-delivery-stop, recommended practice is to always pass 0 in I<sig>.)"
9098 #: build/C/man2/ptrace.2:1538
9100 msgid "Attaching and detaching"
9104 #: build/C/man2/ptrace.2:1540
9105 msgid "A thread can be attached to the tracer using the call"
9109 #: build/C/man2/ptrace.2:1542
9111 msgid " ptrace(PTRACE_ATTACH, pid, 0, 0);\n"
9115 #: build/C/man2/ptrace.2:1544 build/C/man2/ptrace.2:2047
9120 #: build/C/man2/ptrace.2:1546
9122 msgid " ptrace(PTRACE_SEIZE, pid, 0, PTRACE_O_flags);\n"
9126 #. FIXME: Describe how to attach to a thread which is already
9129 #: build/C/man2/ptrace.2:1571
9131 "B<PTRACE_ATTACH> sends B<SIGSTOP> to this thread. If the tracer wants this "
9132 "B<SIGSTOP> to have no effect, it needs to suppress it. Note that if other "
9133 "signals are concurrently sent to this thread during attach, the tracer may "
9134 "see the tracee enter signal-delivery-stop with other signal(s) first! The "
9135 "usual practice is to reinject these signals until B<SIGSTOP> is seen, then "
9136 "suppress B<SIGSTOP> injection. The design bug here is that a ptrace attach "
9137 "and a concurrently delivered B<SIGSTOP> may race and the concurrent "
9138 "B<SIGSTOP> may be lost."
9142 #: build/C/man2/ptrace.2:1578
9144 "Since attaching sends B<SIGSTOP> and the tracer usually suppresses it, this "
9145 "may cause a stray B<EINTR> return from the currently executing system call "
9146 "in the tracee, as described in the \"Signal injection and suppression\" "
9151 #: build/C/man2/ptrace.2:1590
9153 "Since Linux 3.4, B<PTRACE_SEIZE> can be used instead of B<PTRACE_ATTACH>. "
9154 "B<PTRACE_SEIZE> does not stop the attached process. If you need to stop it "
9155 "after attach (or at any other time) without sending it any signals, use "
9156 "B<PTRACE_INTERRUPT> command."
9160 #: build/C/man2/ptrace.2:1592
9165 #: build/C/man2/ptrace.2:1594
9167 msgid " ptrace(PTRACE_TRACEME, 0, 0, 0);\n"
9171 #: build/C/man2/ptrace.2:1600
9173 "turns the calling thread into a tracee. The thread continues to run "
9174 "(doesn't enter ptrace-stop). A common practice is to follow the "
9175 "B<PTRACE_TRACEME> with"
9179 #: build/C/man2/ptrace.2:1602
9181 msgid " raise(SIGSTOP);\n"
9185 #: build/C/man2/ptrace.2:1605
9187 "and allow the parent (which is our tracer now) to observe our "
9188 "signal-delivery-stop."
9192 #: build/C/man2/ptrace.2:1629
9194 "If the B<PTRACE_O_TRACEFORK>, B<PTRACE_O_TRACEVFORK>, or "
9195 "B<PTRACE_O_TRACECLONE> options are in effect, then children created by, "
9196 "respectively, B<vfork>(2) or B<clone>(2) with the B<CLONE_VFORK> flag, "
9197 "B<fork>(2) or B<clone>(2) with the exit signal set to B<SIGCHLD>, and "
9198 "other kinds of B<clone>(2), are automatically attached to the same tracer "
9199 "which traced their parent. B<SIGSTOP> is delivered to the children, causing "
9200 "them to enter signal-delivery-stop after they exit the system call which "
9205 #: build/C/man2/ptrace.2:1631
9206 msgid "Detaching of the tracee is performed by:"
9210 #: build/C/man2/ptrace.2:1633
9212 msgid " ptrace(PTRACE_DETACH, pid, 0, sig);\n"
9216 #: build/C/man2/ptrace.2:1641
9218 "B<PTRACE_DETACH> is a restarting operation; therefore it requires the tracee "
9219 "to be in ptrace-stop. If the tracee is in signal-delivery-stop, a signal "
9220 "can be injected. Otherwise, the I<sig> parameter may be silently ignored."
9223 #. FIXME: Describe how to detach from a group-stopped tracee so that it
9224 #. doesn't run, but continues to wait for SIGCONT.
9226 #: build/C/man2/ptrace.2:1665
9228 "If the tracee is running when the tracer wants to detach it, the usual "
9229 "solution is to send B<SIGSTOP> (using B<tgkill>(2), to make sure it goes to "
9230 "the correct thread), wait for the tracee to stop in signal-delivery-stop for "
9231 "B<SIGSTOP> and then detach it (suppressing B<SIGSTOP> injection). A design "
9232 "bug is that this can race with concurrent B<SIGSTOP>s. Another complication "
9233 "is that the tracee may enter other ptrace-stops and needs to be restarted "
9234 "and waited for again, until B<SIGSTOP> is seen. Yet another complication is "
9235 "to be sure that the tracee is not already ptrace-stopped, because no signal "
9236 "delivery happens while it is\\(emnot even B<SIGSTOP>."
9240 #: build/C/man2/ptrace.2:1673
9242 "If the tracer dies, all tracees are automatically detached and restarted, "
9243 "unless they were in group-stop. Handling of restart from group-stop is "
9244 "currently buggy, but the \"as planned\" behavior is to leave tracee stopped "
9245 "and waiting for B<SIGCONT>. If the tracee is restarted from "
9246 "signal-delivery-stop, the pending signal is injected."
9250 #: build/C/man2/ptrace.2:1673
9252 msgid "execve(2) under ptrace"
9255 #. clone(2) CLONE_THREAD says:
9256 #. If any of the threads in a thread group performs an execve(2),
9257 #. then all threads other than the thread group leader are terminated,
9258 #. and the new program is executed in the thread group leader.
9260 #. In kernel 3.1 sources, see fs/exec.c::de_thread()
9262 #: build/C/man2/ptrace.2:1692
9264 "When one thread in a multithreaded process calls B<execve>(2), the kernel "
9265 "destroys all other threads in the process, and resets the thread ID of the "
9266 "execing thread to the thread group ID (process ID). (Or, to put things "
9267 "another way, when a multithreaded process does an B<execve>(2), at "
9268 "completion of the call, it appears as though the B<execve>(2) occurred in "
9269 "the thread group leader, regardless of which thread did the B<execve>(2).) "
9270 "This resetting of the thread ID looks very confusing to tracers:"
9274 #: build/C/man2/ptrace.2:1702
9276 "All other threads stop in B<PTRACE_EVENT_EXIT> stop, if the "
9277 "B<PTRACE_O_TRACEEXIT> option was turned on. Then all other threads except "
9278 "the thread group leader report death as if they exited via B<_exit>(2) with "
9283 #: build/C/man2/ptrace.2:1710
9285 "The execing tracee changes its thread ID while it is in the B<execve>(2). "
9286 "(Remember, under ptrace, the \"pid\" returned from B<waitpid>(2), or fed "
9287 "into ptrace calls, is the tracee's thread ID.) That is, the tracee's thread "
9288 "ID is reset to be the same as its process ID, which is the same as the "
9289 "thread group leader's thread ID."
9293 #: build/C/man2/ptrace.2:1716
9295 "Then a B<PTRACE_EVENT_EXEC> stop happens, if the B<PTRACE_O_TRACEEXEC> "
9296 "option was turned on."
9300 #: build/C/man2/ptrace.2:1737
9302 "If the thread group leader has reported its B<PTRACE_EVENT_EXIT> stop by "
9303 "this time, it appears to the tracer that the dead thread leader \"reappears "
9304 "from nowhere\". (Note: the thread group leader does not report death via "
9305 "I<WIFEXITED(status)> until there is at least one other live thread. This "
9306 "eliminates the possibility that the tracer will see it dying and then "
9307 "reappearing.) If the thread group leader was still alive, for the tracer "
9308 "this may look as if thread group leader returns from a different system call "
9309 "than it entered, or even \"returned from a system call even though it was "
9310 "not in any system call\". If the thread group leader was not traced (or was "
9311 "traced by a different tracer), then during B<execve>(2) it will appear as "
9312 "if it has become a tracee of the tracer of the execing tracee."
9316 #: build/C/man2/ptrace.2:1740
9318 "All of the above effects are the artifacts of the thread ID change in the "
9323 #: build/C/man2/ptrace.2:1760
9325 "The B<PTRACE_O_TRACEEXEC> option is the recommended tool for dealing with "
9326 "this situation. First, it enables B<PTRACE_EVENT_EXEC> stop, which occurs "
9327 "before B<execve>(2) returns. In this stop, the tracer can use "
9328 "B<PTRACE_GETEVENTMSG> to retrieve the tracee's former thread ID. (This "
9329 "feature was introduced in Linux 3.0). Second, the B<PTRACE_O_TRACEEXEC> "
9330 "option disables legacy B<SIGTRAP> generation on B<execve>(2)."
9334 #: build/C/man2/ptrace.2:1766
9336 "When the tracer receives B<PTRACE_EVENT_EXEC> stop notification, it is "
9337 "guaranteed that except this tracee and the thread group leader, no other "
9338 "threads from the process are alive."
9342 #: build/C/man2/ptrace.2:1774
9344 "On receiving the B<PTRACE_EVENT_EXEC> stop notification, the tracer should "
9345 "clean up all its internal data structures describing the threads of this "
9346 "process, and retain only one data structure\\(emone which describes the "
9347 "single still running tracee, with"
9351 #: build/C/man2/ptrace.2:1776
9353 msgid " thread ID == thread group ID == process ID.\n"
9357 #: build/C/man2/ptrace.2:1780
9358 msgid "Example: two threads call B<execve>(2) at the same time:"
9362 #: build/C/man2/ptrace.2:1791
9365 "*** we get syscall-enter-stop in thread 1: **\n"
9366 "PID1 execve(\"/bin/foo\", \"foo\" E<lt>unfinished ...E<gt>\n"
9367 "*** we issue PTRACE_SYSCALL for thread 1 **\n"
9368 "*** we get syscall-enter-stop in thread 2: **\n"
9369 "PID2 execve(\"/bin/bar\", \"bar\" E<lt>unfinished ...E<gt>\n"
9370 "*** we issue PTRACE_SYSCALL for thread 2 **\n"
9371 "*** we get PTRACE_EVENT_EXEC for PID0, we issue PTRACE_SYSCALL **\n"
9372 "*** we get syscall-exit-stop for PID0: **\n"
9373 "PID0 E<lt>... execve resumedE<gt> ) = 0\n"
9377 #: build/C/man2/ptrace.2:1814
9379 "If the B<PTRACE_O_TRACEEXEC> option is I<not> in effect for the execing "
9380 "tracee, the kernel delivers an extra B<SIGTRAP> to the tracee after "
9381 "B<execve>(2) returns. This is an ordinary signal (similar to one which can "
9382 "be generated by I<kill -TRAP>), not a special kind of ptrace-stop. "
9383 "Employing B<PTRACE_GETSIGINFO> for this signal returns I<si_code> set to 0 "
9384 "(I<SI_USER>). This signal may be blocked by signal mask, and thus may be "
9385 "delivered (much) later."
9389 #: build/C/man2/ptrace.2:1833
9391 "Usually, the tracer (for example, B<strace>(1)) would not want to show this "
9392 "extra post-execve B<SIGTRAP> signal to the user, and would suppress its "
9393 "delivery to the tracee (if B<SIGTRAP> is set to B<SIG_DFL>, it is a killing "
9394 "signal). However, determining I<which> B<SIGTRAP> to suppress is not easy. "
9395 "Setting the B<PTRACE_O_TRACEEXEC> option and thus suppressing this extra "
9396 "B<SIGTRAP> is the recommended approach."
9400 #: build/C/man2/ptrace.2:1833
9406 #: build/C/man2/ptrace.2:1840
9408 "The ptrace API (ab)uses the standard UNIX parent/child signaling over "
9409 "B<waitpid>(2). This used to cause the real parent of the process to stop "
9410 "receiving several kinds of B<waitpid>(2) notifications when the child "
9411 "process is traced by some other process."
9415 #: build/C/man2/ptrace.2:1843
9417 "Many of these bugs have been fixed, but as of Linux 2.6.38 several still "
9418 "exist; see BUGS below."
9422 #: build/C/man2/ptrace.2:1845
9423 msgid "As of Linux 2.6.38, the following is believed to work correctly:"
9427 #: build/C/man2/ptrace.2:1853
9429 "exit/death by signal is reported first to the tracer, then, when the tracer "
9430 "consumes the B<waitpid>(2) result, to the real parent (to the real parent "
9431 "only when the whole multithreaded process exits). If the tracer and the "
9432 "real parent are the same process, the report is sent only once."
9436 #: build/C/man2/ptrace.2:1858
9438 "On success, the B<PTRACE_PEEK*> requests return the requested data (but see "
9439 "NOTES), while other requests return zero."
9443 #: build/C/man2/ptrace.2:1868
9445 "On error, all requests return -1, and I<errno> is set appropriately. Since "
9446 "the value returned by a successful B<PTRACE_PEEK*> request may be -1, the "
9447 "caller must clear I<errno> before the call, and then check it afterward to "
9448 "determine whether or not an error occurred."
9452 #: build/C/man2/ptrace.2:1872
9453 msgid "(i386 only) There was an error with allocating or freeing a debug register."
9457 #: build/C/man2/ptrace.2:1883
9459 "There was an attempt to read from or write to an invalid area in the "
9460 "tracer's or the tracee's memory, probably because the area wasn't mapped or "
9461 "accessible. Unfortunately, under Linux, different variations of this fault "
9462 "will return B<EIO> or B<EFAULT> more or less arbitrarily."
9466 #: build/C/man2/ptrace.2:1886
9467 msgid "An attempt was made to set an invalid option."
9471 #: build/C/man2/ptrace.2:1893
9473 "I<request> is invalid, or an attempt was made to read from or write to an "
9474 "invalid area in the tracer's or the tracee's memory, or there was a "
9475 "word-alignment violation, or an invalid signal was specified during a "
9480 #: build/C/man2/ptrace.2:1906
9482 "The specified process cannot be traced. This could be because the tracer "
9483 "has insufficient privileges (the required capability is B<CAP_SYS_PTRACE>); "
9484 "unprivileged processes cannot trace processes that they cannot send signals "
9485 "to or those running set-user-ID/set-group-ID programs, for obvious reasons. "
9486 "Alternatively, the process may already be being traced, or (on kernels "
9487 "before 2.6.26) be B<init>(8) (PID 1)."
9491 #: build/C/man2/ptrace.2:1911
9493 "The specified process does not exist, or is not currently being traced by "
9494 "the caller, or is not stopped (for requests that require a stopped tracee)."
9498 #: build/C/man2/ptrace.2:1913
9499 msgid "SVr4, 4.3BSD."
9503 #: build/C/man2/ptrace.2:1928
9505 "Although arguments to B<ptrace>() are interpreted according to the "
9506 "prototype given, glibc currently declares B<ptrace>() as a variadic "
9507 "function with only the I<request> argument fixed. It is recommended to "
9508 "always supply four arguments, even if the requested operation does not use "
9509 "them, setting unused/ignored arguments to I<0L> or I<(void\\ *)\\ 0>."
9513 #: build/C/man2/ptrace.2:1940
9515 "At the system call level, the B<PTRACE_PEEKTEXT>, B<PTRACE_PEEKDATA>, and "
9516 "B<PTRACE_PEEKUSER> requests have a different API: they store the result at "
9517 "the address specified by the I<data> parameter, and the return value is the "
9518 "error flag. The glibc wrapper function provides the API given in "
9519 "DESCRIPTION above, with the result being returned via the function return "
9523 #. See commit 00cd5c37afd5f431ac186dd131705048c0a11fdb
9525 #: build/C/man2/ptrace.2:1945
9527 "In Linux kernels before 2.6.26, B<init>(8), the process with PID 1, may not "
9531 #. See http://lkml.org/lkml/2008/5/8/375
9533 #: build/C/man2/ptrace.2:1952
9535 "The layout of the contents of memory and the USER area are quite "
9536 "operating-system- and architecture-specific. The offset supplied, and the "
9537 "data returned, might not entirely match with the definition of I<struct "
9542 #: build/C/man2/ptrace.2:1955
9544 "The size of a \"word\" is determined by the operating-system variant (e.g., "
9545 "for 32-bit Linux it is 32 bits)."
9549 #: build/C/man2/ptrace.2:1963
9551 "This page documents the way the B<ptrace>() call works currently in Linux. "
9552 "Its behavior differs noticeably on other flavors of UNIX. In any case, use "
9553 "of B<ptrace>() is highly specific to the operating system and architecture."
9557 #: build/C/man2/ptrace.2:1974
9559 "On hosts with 2.6 kernel headers, B<PTRACE_SETOPTIONS> is declared with a "
9560 "different value than the one for 2.4. This leads to applications compiled "
9561 "with 2.6 kernel headers failing when run on 2.4 kernels. This can be worked "
9562 "around by redefining B<PTRACE_SETOPTIONS> to B<PTRACE_OLDSETOPTIONS>, if "
9567 #: build/C/man2/ptrace.2:1977
9569 "Group-stop notifications are sent to the tracer, but not to real parent. "
9570 "Last confirmed on 2.6.38.6."
9573 #. Note from Denys Vlasenko:
9574 #. Here "exits" means any kind of death - _exit, exit_group,
9575 #. signal death. Signal death and exit_group cases are trivial,
9576 #. though: since signal death and exit_group kill all other threads
9577 #. too, "until all other threads exit" thing happens rather soon
9578 #. in these cases. Therefore, only _exit presents observably
9579 #. puzzling behavior to ptrace users: thread leader _exit's,
9580 #. but WIFEXITED isn't reported! We are trying to explain here
9582 #. FIXME: ^^^ need to test/verify this scenario
9584 #: build/C/man2/ptrace.2:2008
9586 "If a thread group leader is traced and exits by calling B<_exit>(2), a "
9587 "B<PTRACE_EVENT_EXIT> stop will happen for it (if requested), but the "
9588 "subsequent B<WIFEXITED> notification will not be delivered until all other "
9589 "threads exit. As explained above, if one of other threads calls "
9590 "B<execve>(2), the death of the thread group leader will I<never> be "
9591 "reported. If the execed thread is not traced by this tracer, the tracer "
9592 "will never know that B<execve>(2) happened. One possible workaround is to "
9593 "B<PTRACE_DETACH> the thread group leader instead of restarting it in this "
9594 "case. Last confirmed on 2.6.38.6."
9598 #: build/C/man2/ptrace.2:2018
9600 "A B<SIGKILL> signal may still cause a B<PTRACE_EVENT_EXIT> stop before "
9601 "actual signal death. This may be changed in the future; B<SIGKILL> is meant "
9602 "to always immediately kill tasks even under ptrace. Last confirmed on "
9607 #: build/C/man2/ptrace.2:2036
9609 "Some system calls return with B<EINTR> if a signal was sent to a tracee, but "
9610 "delivery was suppressed by the tracer. (This is very typical operation: it "
9611 "is usually done by debuggers on every attach, in order to not introduce a "
9612 "bogus B<SIGSTOP>). As of Linux 3.2.9, the following system calls are "
9613 "affected (this list is likely incomplete): B<epoll_wait>(2), and B<read>(2) "
9614 "from an B<inotify>(7) file descriptor. The usual symptom of this bug is "
9615 "that when you attach to a quiescent process with the command"
9619 #: build/C/man2/ptrace.2:2038
9621 msgid " strace -p E<lt>process-IDE<gt>\n"
9625 #: build/C/man2/ptrace.2:2041
9626 msgid "then, instead of the usual and expected one-line output such as"
9630 #: build/C/man2/ptrace.2:2044
9632 msgid " restart_syscall(E<lt>... resuming interrupted call ...E<gt>_\n"
9636 #: build/C/man2/ptrace.2:2050
9638 msgid " select(6, [5], NULL, [5], NULL_\n"
9642 #: build/C/man2/ptrace.2:2054
9644 "('_' denotes the cursor position), you observe more than one line. For "
9649 #: build/C/man2/ptrace.2:2058
9652 " clock_gettime(CLOCK_MONOTONIC, {15370, 690928118}) = 0\n"
9657 #: build/C/man2/ptrace.2:2079
9659 "What is not visible here is that the process was blocked in B<epoll_wait>(2) "
9660 "before B<strace>(1) has attached to it. Attaching caused B<epoll_wait>(2) "
9661 "to return to user space with the error B<EINTR>. In this particular case, "
9662 "the program reacted to B<EINTR> by checking the current time, and then "
9663 "executing B<epoll_wait>(2) again. (Programs which do not expect such "
9664 "\"stray\" B<EINTR> errors may behave in an unintended way upon an "
9665 "B<strace>(1) attach.)"
9669 #: build/C/man2/ptrace.2:2093
9671 "B<gdb>(1), B<strace>(1), B<clone>(2), B<execve>(2), B<fork>(2), "
9672 "B<gettid>(2), B<sigaction>(2), B<tgkill>(2), B<vfork>(2), B<waitpid>(2), "
9673 "B<exec>(3), B<capabilities>(7), B<signal>(7)"
9677 #: build/C/man2/quotactl.2:27
9683 #: build/C/man2/quotactl.2:27
9689 #: build/C/man2/quotactl.2:30
9690 msgid "quotactl - manipulate disk quotas"
9694 #: build/C/man2/quotactl.2:34
9697 "B<#include E<lt>sys/quota.hE<gt>>\n"
9698 "B<#include E<lt>xfs/xqm.hE<gt>>\n"
9702 #: build/C/man2/quotactl.2:37
9705 "B<int quotactl(int >I<cmd>B<, const char *>I<special>B<, int >I<id>B<, "
9706 "caddr_t >I<addr>B<);>\n"
9710 #: build/C/man2/quotactl.2:49
9712 "The quota system can be used to set per-user and per-group limits on the "
9713 "amount of disk space used on a filesystem. For each user and/or group, a "
9714 "soft limit and a hard limit can be set for each filesystem. The hard limit "
9715 "can't be exceeded. The soft limit can be exceeded, but warnings will "
9716 "ensue. Moreover, the user can't exceed the soft limit for more than one "
9717 "week (by default) at a time; after this time, the soft limit counts as a "
9722 #: build/C/man2/quotactl.2:74
9724 "The B<quotactl>() call manipulates disk quotas. The I<cmd> argument "
9725 "indicates a command to be applied to the user or group ID specified in "
9726 "I<id>. To initialize the I<cmd> argument, use the I<QCMD(subcmd, type)> "
9727 "macro. The I<type> value is either B<USRQUOTA>, for user quotas, or "
9728 "B<GRPQUOTA>, for group quotas. The I<subcmd> value is described below."
9732 #: build/C/man2/quotactl.2:79
9734 "The I<special> argument is a pointer to a null-terminated string containing "
9735 "the pathname of the (mounted) block special device for the filesystem being "
9740 #: build/C/man2/quotactl.2:87
9742 "The I<addr> argument is the address of an optional, command-specific, data "
9743 "structure that is copied in or out of the system. The interpretation of "
9744 "I<addr> is given with each command below."
9748 #: build/C/man2/quotactl.2:91
9749 msgid "The I<subcmd> value is one of the following:"
9753 #: build/C/man2/quotactl.2:91
9755 msgid "B<Q_QUOTAON>"
9759 #: build/C/man2/quotactl.2:98
9761 "Turn on quotas for a filesystem. The I<id> argument is the identification "
9762 "number of the quota format to be used. Currently, there are three supported "
9767 #: build/C/man2/quotactl.2:99
9769 msgid "B<QFMT_VFS_OLD>"
9773 #: build/C/man2/quotactl.2:102
9774 msgid "The original quota format."
9778 #: build/C/man2/quotactl.2:102
9780 msgid "B<QFMT_VFS_V0>"
9784 #: build/C/man2/quotactl.2:106
9786 "The standard VFS v0 quota format, which can handle 32-bit UIDs and GIDs and "
9787 "quota limits up to 2^42 bytes and 2^32 inodes."
9791 #: build/C/man2/quotactl.2:106
9793 msgid "B<QFMT_VFS_V1>"
9797 #: build/C/man2/quotactl.2:110
9799 "A quota format that can handle 32-bit UIDs and GIDs and quota limits of 2^64 "
9800 "bytes and 2^64 inodes."
9804 #: build/C/man2/quotactl.2:121
9806 "The I<addr> argument points to the pathname of a file containing the quotas "
9807 "for the filesystem. The quota file must exist; it is normally created with "
9808 "the B<quotacheck>(8) program. This operation requires privilege "
9809 "(B<CAP_SYS_ADMIN>)."
9813 #: build/C/man2/quotactl.2:121
9815 msgid "B<Q_QUOTAOFF>"
9819 #: build/C/man2/quotactl.2:131
9821 "Turn off quotas for a filesystem. The I<addr> and I<id> arguments are "
9822 "ignored. This operation requires privilege (B<CAP_SYS_ADMIN>)."
9826 #: build/C/man2/quotactl.2:131
9828 msgid "B<Q_GETQUOTA>"
9832 #: build/C/man2/quotactl.2:142
9834 "Get disk quota limits and current usage for user or group I<id>. The "
9835 "I<addr> argument is a pointer to a I<dqblk> structure defined in "
9836 "I<E<lt>sys/quota.hE<gt>> as follows:"
9840 #: build/C/man2/quotactl.2:147 build/C/man2/quotactl.2:234
9843 "/* uint64_t is an unsigned 64-bit integer;\n"
9844 " uint32_t is an unsigned 32-bit integer */\n"
9848 #: build/C/man2/quotactl.2:167
9851 "struct dqblk { /* Definition since Linux 2.4.22 */\n"
9852 " uint64_t dqb_bhardlimit; /* absolute limit on disk\n"
9853 " quota blocks alloc */\n"
9854 " uint64_t dqb_bsoftlimit; /* preferred limit on\n"
9855 " disk quota blocks */\n"
9856 " uint64_t dqb_curspace; /* current quota block\n"
9858 " uint64_t dqb_ihardlimit; /* maximum number of\n"
9859 " allocated inodes */\n"
9860 " uint64_t dqb_isoftlimit; /* preferred inode limit */\n"
9861 " uint64_t dqb_curinodes; /* current number of\n"
9862 " allocated inodes */\n"
9863 " uint64_t dqb_btime; /* time limit for excessive\n"
9865 " uint64_t dqb_itime; /* time limit for excessive\n"
9867 " uint32_t dqb_valid; /* bit mask of QIF_*\n"
9873 #: build/C/man2/quotactl.2:170
9876 "/* Flags in dqb_valid that indicate which fields in\n"
9877 " dqblk structure are valid. */\n"
9881 #: build/C/man2/quotactl.2:181
9884 "#define QIF_BLIMITS 1\n"
9885 "#define QIF_SPACE 2\n"
9886 "#define QIF_ILIMITS 4\n"
9887 "#define QIF_INODES 8\n"
9888 "#define QIF_BTIME 16\n"
9889 "#define QIF_ITIME 32\n"
9890 "#define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS)\n"
9891 "#define QIF_USAGE (QIF_SPACE | QIF_INODES)\n"
9892 "#define QIF_TIMES (QIF_BTIME | QIF_ITIME)\n"
9893 "#define QIF_ALL (QIF_LIMITS | QIF_USAGE | QIF_TIMES)\n"
9897 #: build/C/man2/quotactl.2:198
9899 "The I<dqb_valid> field is a bit mask that is set to indicate the entries in "
9900 "the I<dqblk> structure that are valid. Currently, the kernel fills in all "
9901 "entries of the I<dqblk> structure and marks them as valid in the "
9902 "I<dqb_valid> field. Unprivileged users may retrieve only their own quotas; "
9903 "a privileged user (B<CAP_SYS_ADMIN>) can retrieve the quotas of any user."
9907 #: build/C/man2/quotactl.2:198
9909 msgid "B<Q_SETQUOTA>"
9913 #: build/C/man2/quotactl.2:218
9915 "Set quota information for user or group I<id>, using the information "
9916 "supplied in the I<dqblk> structure pointed to by I<addr>. The I<dqb_valid> "
9917 "field of the I<dqblk> structure indicates which entries in the structure "
9918 "have been set by the caller. This operation supersedes the B<Q_SETQLIM> and "
9919 "B<Q_SETUSE> operations in the previous quota interfaces. This operation "
9920 "requires privilege (B<CAP_SYS_ADMIN>)."
9924 #: build/C/man2/quotactl.2:218
9926 msgid "B<Q_GETINFO>"
9930 #: build/C/man2/quotactl.2:229
9932 "Get information (like grace times) about quotafile. The I<addr> argument "
9933 "should be a pointer to a I<dqinfo> structure. This structure is defined in "
9934 "I<E<lt>sys/quota.hE<gt>> as follows:"
9938 #: build/C/man2/quotactl.2:238
9941 "struct dqinfo { /* Defined since kernel 2.4.22 */\n"
9942 " uint64_t dqi_bgrace; /* Time before block soft limit\n"
9943 " becomes hard limit */\n"
9947 #: build/C/man2/quotactl.2:245
9950 " uint64_t dqi_igrace; /* Time before inode soft limit\n"
9951 " becomes hard limit */\n"
9952 " uint32_t dqi_flags; /* Flags for quotafile\n"
9954 " uint32_t dqi_valid;\n"
9959 #: build/C/man2/quotactl.2:247
9961 msgid "/* Bits for dqi_flags */\n"
9965 #: build/C/man2/quotactl.2:249
9967 msgid "/* Quota format QFMT_VFS_OLD */\n"
9971 #: build/C/man2/quotactl.2:251
9973 msgid "#define V1_DQF_RSQUASH\t1 /* Root squash enabled */\n"
9977 #: build/C/man2/quotactl.2:253
9979 msgid "/* Other quota formats have no dqi_flags bits defined */\n"
9983 #: build/C/man2/quotactl.2:256
9986 "/* Flags in dqi_valid that indicate which fields in\n"
9987 " dqinfo structure are valid. */\n"
9991 #: build/C/man2/quotactl.2:261
9994 "# define IIF_BGRACE\t1\n"
9995 "# define IIF_IGRACE\t2\n"
9996 "# define IIF_FLAGS\t4\n"
9997 "# define IIF_ALL (IIF_BGRACE | IIF_IGRACE | IIF_FLAGS)\n"
10000 #. type: Plain text
10001 #: build/C/man2/quotactl.2:277
10003 "The I<dqi_valid> field in the I<dqinfo> structure indicates the entries in "
10004 "the structure that are valid. Currently, the kernel fills in all entries of "
10005 "the I<dqinfo> structure and marks them all as valid in the I<dqi_valid> "
10006 "field. The I<id> argument is ignored."
10010 #: build/C/man2/quotactl.2:277
10012 msgid "B<Q_SETINFO>"
10015 #. type: Plain text
10016 #: build/C/man2/quotactl.2:301
10018 "Set information about quotafile. The I<addr> argument should be a pointer "
10019 "to a I<dqinfo> structure. The I<dqi_valid> field of the I<dqinfo> structure "
10020 "indicates the entries in the structure that have been set by the caller. "
10021 "This operation supersedes the B<Q_SETGRACE> and B<Q_SETFLAGS> operations in "
10022 "the previous quota interfaces. The I<id> argument is ignored. This "
10023 "operation requires privilege (B<CAP_SYS_ADMIN>)."
10027 #: build/C/man2/quotactl.2:301
10029 msgid "B<Q_GETFMT>"
10032 #. type: Plain text
10033 #: build/C/man2/quotactl.2:308
10035 "Get quota format used on the specified filesystem. The I<addr> argument "
10036 "should be a pointer to a 4-byte buffer where the format number will be "
10041 #: build/C/man2/quotactl.2:308
10046 #. type: Plain text
10047 #: build/C/man2/quotactl.2:319
10049 "Update the on-disk copy of quota usages for a filesystem. If I<special> is "
10050 "NULL, then all filesystems with active quotas are sync'ed. The I<addr> and "
10051 "I<id> arguments are ignored."
10055 #: build/C/man2/quotactl.2:319
10057 msgid "B<Q_GETSTATS>"
10060 #. Q_GETSTATS was removed in kernel 2.4.22.
10061 #. type: Plain text
10062 #: build/C/man2/quotactl.2:339
10064 "Get statistics and other generic information about the quota subsystem. The "
10065 "I<addr> argument should be a pointer to a I<dqstats> structure in which data "
10066 "should be stored. This structure is defined in I<E<lt>sys/quota.hE<gt>>. "
10067 "The I<special> and I<id> arguments are ignored. This operation is obsolete "
10068 "and not supported by recent kernels. Files in I</proc/sys/fs/quota/> carry "
10069 "the information instead."
10072 #. type: Plain text
10073 #: build/C/man2/quotactl.2:342
10075 "For XFS filesystems making use of the XFS Quota Manager (XQM), the above "
10076 "commands are bypassed and the following commands are used:"
10080 #: build/C/man2/quotactl.2:342
10082 msgid "B<Q_XQUOTAON>"
10085 #. type: Plain text
10086 #: build/C/man2/quotactl.2:363
10088 "Turn on quotas for an XFS filesystem. XFS provides the ability to turn "
10089 "on/off quota limit enforcement with quota accounting. Therefore, XFS "
10090 "expects I<addr> to be a pointer to an I<unsigned int> that contains either "
10091 "the flags B<XFS_QUOTA_UDQ_ACCT> and/or B<XFS_QUOTA_UDQ_ENFD> (for user "
10092 "quota), or B<XFS_QUOTA_GDQ_ACCT> and/or B<XFS_QUOTA_GDQ_ENFD> (for group "
10093 "quota), as defined in I<E<lt>xfs/xqm.hE<gt>>. This operation requires "
10094 "privilege (B<CAP_SYS_ADMIN>)."
10098 #: build/C/man2/quotactl.2:363
10100 msgid "B<Q_XQUOTAOFF>"
10103 #. type: Plain text
10104 #: build/C/man2/quotactl.2:374
10106 "Turn off quotas for an XFS filesystem. As with B<Q_QUOTAON>, XFS "
10107 "filesystems expect a pointer to an I<unsigned int> that specifies whether "
10108 "quota accounting and/or limit enforcement need to be turned off. This "
10109 "operation requires privilege (B<CAP_SYS_ADMIN>)."
10113 #: build/C/man2/quotactl.2:374
10115 msgid "B<Q_XGETQUOTA>"
10118 #. type: Plain text
10119 #: build/C/man2/quotactl.2:388
10121 "Get disk quota limits and current usage for user I<id>. The I<addr> "
10122 "argument is a pointer to an I<fs_disk_quota> structure (defined in "
10123 "I<E<lt>xfs/xqm.hE<gt>>). Unprivileged users may retrieve only their own "
10124 "quotas; a privileged user (B<CAP_SYS_ADMIN>) may retrieve the quotas of any "
10129 #: build/C/man2/quotactl.2:388
10131 msgid "B<Q_XSETQLIM>"
10134 #. type: Plain text
10135 #: build/C/man2/quotactl.2:400
10137 "Set disk quota limits for user I<id>. The I<addr> argument is a pointer to "
10138 "an I<fs_disk_quota> structure (defined in I<E<lt>xfs/xqm.hE<gt>>). This "
10139 "operation requires privilege (B<CAP_SYS_ADMIN>)."
10143 #: build/C/man2/quotactl.2:400
10145 msgid "B<Q_XGETQSTAT>"
10148 #. type: Plain text
10149 #: build/C/man2/quotactl.2:408
10151 "Returns an I<fs_quota_stat> structure containing XFS filesystem-specific "
10152 "quota information. This is useful for finding out how much space is used to "
10153 "store quota information, and also to get quotaon/off status of a given local "
10158 #: build/C/man2/quotactl.2:408
10160 msgid "B<Q_XQUOTARM>"
10163 #. type: Plain text
10164 #: build/C/man2/quotactl.2:412
10166 "Free the disk space taken by disk quotas. Quotas must have already been "
10170 #. type: Plain text
10171 #: build/C/man2/quotactl.2:419
10173 "There is no command equivalent to B<Q_SYNC> for XFS since B<sync>(1) writes "
10174 "quota information to disk (in addition to the other filesystem metadata that "
10178 #. type: Plain text
10179 #: build/C/man2/quotactl.2:427
10181 "On success, B<quotactl>() returns 0; on error -1 is returned, and I<errno> "
10182 "is set to indicate the error."
10185 #. type: Plain text
10186 #: build/C/man2/quotactl.2:434
10187 msgid "I<addr> or I<special> is invalid."
10190 #. type: Plain text
10191 #: build/C/man2/quotactl.2:440
10192 msgid "I<cmd> or I<type> is invalid."
10195 #. type: Plain text
10196 #: build/C/man2/quotactl.2:447
10197 msgid "The file specified by I<special> or I<addr> does not exist."
10200 #. type: Plain text
10201 #: build/C/man2/quotactl.2:452
10202 msgid "The kernel has not been compiled with the B<CONFIG_QUOTA> option."
10206 #: build/C/man2/quotactl.2:452
10211 #. type: Plain text
10212 #: build/C/man2/quotactl.2:456
10213 msgid "I<special> is not a block device."
10216 #. type: Plain text
10217 #: build/C/man2/quotactl.2:461
10219 "The caller lacked the required privilege (B<CAP_SYS_ADMIN>) for the "
10220 "specified operation."
10223 #. type: Plain text
10224 #: build/C/man2/quotactl.2:465
10226 "No disk quota is found for the indicated user. Quotas have not been turned "
10227 "on for this filesystem."
10230 #. type: Plain text
10231 #: build/C/man2/quotactl.2:474
10232 msgid "If I<cmd> is B<Q_SETQUOTA>, B<quotactl>() may also set I<errno> to:"
10235 #. type: Plain text
10236 #: build/C/man2/quotactl.2:477
10237 msgid "Specified limits are out of range allowed by quota format."
10240 #. type: Plain text
10241 #: build/C/man2/quotactl.2:486
10242 msgid "If I<cmd> is B<Q_QUOTAON>, B<quotactl>() may also set I<errno> to:"
10245 #. type: Plain text
10246 #: build/C/man2/quotactl.2:495
10248 "The quota file pointed to by I<addr> exists, but is not a regular file; or, "
10249 "the quota file pointed to by I<addr> exists, but is not on the filesystem "
10250 "pointed to by I<special>."
10253 #. type: Plain text
10254 #: build/C/man2/quotactl.2:501
10255 msgid "B<Q_QUOTAON> attempted, but another B<Q_QUOTAON> had already been performed."
10258 #. type: Plain text
10259 #: build/C/man2/quotactl.2:504
10260 msgid "The quota file is corrupted."
10263 #. type: Plain text
10264 #: build/C/man2/quotactl.2:507
10265 msgid "Specified quota format was not found."
10268 #. type: Plain text
10269 #: build/C/man2/quotactl.2:512
10270 msgid "B<quota>(1), B<getrlimit>(2), B<quotacheck>(8), B<quotaon>(8)"
10274 #: build/C/man2/sendfile.2:19
10280 #: build/C/man2/sendfile.2:19
10285 #. type: Plain text
10286 #: build/C/man2/sendfile.2:22
10287 msgid "sendfile - transfer data between file descriptors"
10290 #. type: Plain text
10291 #: build/C/man2/sendfile.2:24
10292 msgid "B<#include E<lt>sys/sendfile.hE<gt>>"
10295 #. The below is too ugly. Comments about glibc versions belong
10296 #. in the notes, not in the header.
10298 #. .B #include <features.h>
10300 #. .B #if (__GLIBC__==2 && __GLIBC_MINOR__>=1) || __GLIBC__>2
10302 #. .B #include <sys/sendfile.h>
10306 #. .B #include <sys/types.h>
10308 #. .B /* No system prototype before glibc 2.1. */
10310 #. .BI "ssize_t sendfile(int" " out_fd" ", int" " in_fd" ", off_t *" \
10311 #. offset ", size_t" " count" )
10314 #. type: Plain text
10315 #: build/C/man2/sendfile.2:47
10317 "B<ssize_t sendfile(int>I< out_fd>B<, int>I< in_fd>B<, off_t *>I<offset>B<, "
10318 "size_t>I< count>B<);>"
10321 #. type: Plain text
10322 #: build/C/man2/sendfile.2:57
10324 "B<sendfile>() copies data between one file descriptor and another. Because "
10325 "this copying is done within the kernel, B<sendfile>() is more efficient "
10326 "than the combination of B<read>(2) and B<write>(2), which would require "
10327 "transferring data to and from user space."
10330 #. type: Plain text
10331 #: build/C/man2/sendfile.2:62
10333 "I<in_fd> should be a file descriptor opened for reading and I<out_fd> should "
10334 "be a descriptor opened for writing."
10337 #. type: Plain text
10338 #: build/C/man2/sendfile.2:83
10340 "If I<offset> is not NULL, then it points to a variable holding the file "
10341 "offset from which B<sendfile>() will start reading data from I<in_fd>. "
10342 "When B<sendfile>() returns, this variable will be set to the offset of the "
10343 "byte following the last byte that was read. If I<offset> is not NULL, then "
10344 "B<sendfile>() does not modify the current file offset of I<in_fd>; "
10345 "otherwise the current file offset is adjusted to reflect the number of bytes "
10346 "read from I<in_fd>."
10349 #. type: Plain text
10350 #: build/C/man2/sendfile.2:90
10352 "If I<offset> is NULL, then data will be read from I<in_fd> starting at the "
10353 "current file offset, and the file offset will be updated by the call."
10356 #. type: Plain text
10357 #: build/C/man2/sendfile.2:93
10358 msgid "I<count> is the number of bytes to copy between the file descriptors."
10361 #. type: Plain text
10362 #: build/C/man2/sendfile.2:100
10364 "The I<in_fd> argument must correspond to a file which supports "
10365 "B<mmap>(2)-like operations (i.e., it cannot be a socket)."
10368 #. type: Plain text
10369 #: build/C/man2/sendfile.2:108
10371 "In Linux kernels before 2.6.33, I<out_fd> must refer to a socket. Since "
10372 "Linux 2.6.33 it can be any file. If it is a regular file, then "
10373 "B<sendfile>() changes the file offset appropriately."
10376 #. type: Plain text
10377 #: build/C/man2/sendfile.2:115
10379 "If the transfer was successful, the number of bytes written to I<out_fd> is "
10380 "returned. On error, -1 is returned, and I<errno> is set appropriately."
10383 #. type: Plain text
10384 #: build/C/man2/sendfile.2:121
10386 "Nonblocking I/O has been selected using B<O_NONBLOCK> and the write would "
10390 #. type: Plain text
10391 #: build/C/man2/sendfile.2:125
10393 "The input file was not opened for reading or the output file was not opened "
10397 #. type: Plain text
10398 #: build/C/man2/sendfile.2:128
10399 msgid "Bad address."
10402 #. type: Plain text
10403 #: build/C/man2/sendfile.2:134
10405 "Descriptor is not valid or locked, or an B<mmap>(2)-like operation is not "
10406 "available for I<in_fd>."
10409 #. type: Plain text
10410 #: build/C/man2/sendfile.2:138
10411 msgid "Unspecified error while reading from I<in_fd>."
10414 #. type: Plain text
10415 #: build/C/man2/sendfile.2:142
10416 msgid "Insufficient memory to read from I<in_fd>."
10419 #. type: Plain text
10420 #: build/C/man2/sendfile.2:148
10422 "B<sendfile>() is a new feature in Linux 2.2. The include file "
10423 "I<E<lt>sys/sendfile.hE<gt>> is present since glibc 2.1."
10426 #. type: Plain text
10427 #: build/C/man2/sendfile.2:150
10428 msgid "Not specified in POSIX.1-2001, or other standards."
10431 #. type: Plain text
10432 #: build/C/man2/sendfile.2:155
10434 "Other UNIX systems implement B<sendfile>() with different semantics and "
10435 "prototypes. It should not be used in portable programs."
10438 #. type: Plain text
10439 #: build/C/man2/sendfile.2:165
10441 "If you plan to use B<sendfile>() for sending files to a TCP socket, but "
10442 "need to send some header data in front of the file contents, you will find "
10443 "it useful to employ the B<TCP_CORK> option, described in B<tcp>(7), to "
10444 "minimize the number of packets and to tune performance."
10447 #. type: Plain text
10448 #: build/C/man2/sendfile.2:171
10450 "In Linux 2.4 and earlier, I<out_fd> could also refer to a regular file, and "
10451 "B<sendfile>() changed the current offset of that file."
10454 #. type: Plain text
10455 #: build/C/man2/sendfile.2:183
10457 "The original Linux B<sendfile>() system call was not designed to handle "
10458 "large file offsets. Consequently, Linux 2.4 added B<sendfile64>(), with a "
10459 "wider type for the I<offset> argument. The glibc B<sendfile>() wrapper "
10460 "function transparently deals with the kernel differences."
10463 #. type: Plain text
10464 #: build/C/man2/sendfile.2:192
10466 "Applications may wish to fall back to B<read>(2)/B<write>(2) in the case "
10467 "where B<sendfile>() fails with B<EINVAL> or B<ENOSYS>."
10470 #. type: Plain text
10471 #: build/C/man2/sendfile.2:197
10473 "The Linux-specific B<splice>(2) call supports transferring data between "
10474 "arbitrary files (e.g., a pair of sockets)."
10477 #. type: Plain text
10478 #: build/C/man2/sendfile.2:202
10479 msgid "B<mmap>(2), B<open>(2), B<socket>(2), B<splice>(2)"
10483 #: build/C/man2/set_tid_address.2:25
10485 msgid "SET_TID_ADDRESS"
10489 #: build/C/man2/set_tid_address.2:25
10494 #. type: Plain text
10495 #: build/C/man2/set_tid_address.2:28
10496 msgid "set_tid_address - set pointer to thread ID"
10499 #. type: Plain text
10500 #: build/C/man2/set_tid_address.2:31
10502 msgid "B<#include E<lt>linux/unistd.hE<gt>>\n"
10505 #. type: Plain text
10506 #: build/C/man2/set_tid_address.2:33
10508 msgid "B<long set_tid_address(int *>I<tidptr>B<);>\n"
10511 #. type: Plain text
10512 #: build/C/man2/set_tid_address.2:40
10514 "For each process, the kernel maintains two attributes (addresses) called "
10515 "I<set_child_tid> and I<clear_child_tid>. These two attributes contain the "
10516 "value NULL by default."
10520 #: build/C/man2/set_tid_address.2:40
10522 msgid "I<set_child_tid>"
10525 #. type: Plain text
10526 #: build/C/man2/set_tid_address.2:51
10528 "If a process is started using B<clone>(2) with the B<CLONE_CHILD_SETTID> "
10529 "flag, I<set_child_tid> is set to the value passed in the I<ctid> argument of "
10530 "that system call."
10533 #. type: Plain text
10534 #: build/C/man2/set_tid_address.2:56
10536 "When I<set_child_tid> is set, the very first thing the new process does is "
10537 "writing its PID at this address."
10541 #: build/C/man2/set_tid_address.2:56
10543 msgid "I<clear_child_tid>"
10546 #. type: Plain text
10547 #: build/C/man2/set_tid_address.2:67
10549 "If a process is started using B<clone>(2) with the B<CLONE_CHILD_CLEARTID> "
10550 "flag, I<clear_child_tid> is set to the value passed in the I<ctid> argument "
10551 "of that system call."
10554 #. type: Plain text
10555 #: build/C/man2/set_tid_address.2:74
10557 "The system call B<set_tid_address>() sets the I<clear_child_tid> value for "
10558 "the calling process to I<tidptr>."
10561 #. type: Plain text
10562 #: build/C/man2/set_tid_address.2:82
10564 "When a process whose I<clear_child_tid> is not NULL terminates, then, if the "
10565 "process is sharing memory with other processes or threads, then 0 is written "
10566 "at the address specified in I<clear_child_tid> and the kernel performs the "
10567 "following operation:"
10570 #. type: Plain text
10571 #: build/C/man2/set_tid_address.2:84
10573 msgid " futex(clear_child_tid, FUTEX_WAKE, 1, NULL, NULL, 0);\n"
10576 #. type: Plain text
10577 #: build/C/man2/set_tid_address.2:88
10579 "The effect of this operation is to wake a single process that is performing "
10580 "a futex wait on the memory location. Errors from the futex wake operation "
10584 #. type: Plain text
10585 #: build/C/man2/set_tid_address.2:91
10586 msgid "B<set_tid_address>() always returns the PID of the calling process."
10589 #. type: Plain text
10590 #: build/C/man2/set_tid_address.2:94
10591 msgid "B<set_tid_address>() always succeeds."
10594 #. type: Plain text
10595 #: build/C/man2/set_tid_address.2:97
10597 "This call is present since Linux 2.5.48. Details as given here are valid "
10598 "since Linux 2.5.49."
10601 #. type: Plain text
10602 #: build/C/man2/set_tid_address.2:102
10603 msgid "B<clone>(2), B<futex>(2)"
10607 #: build/C/man2/splice.2:26
10613 #: build/C/man2/splice.2:26 build/C/man2/tee.2:26 build/C/man2/vmsplice.2:26
10618 #. type: Plain text
10619 #: build/C/man2/splice.2:29
10620 msgid "splice - splice data to/from a pipe"
10623 #. type: Plain text
10624 #: build/C/man2/splice.2:33 build/C/man2/tee.2:33
10627 "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n"
10628 "B<#include E<lt>fcntl.hE<gt>>\n"
10631 #. Return type was long before glibc 2.7
10632 #. type: Plain text
10633 #: build/C/man2/splice.2:38
10636 "B<ssize_t splice(int >I<fd_in>B<, loff_t *>I<off_in>B<, int >I<fd_out>B<,>\n"
10637 "B< loff_t *>I<off_out>B<, size_t >I<len>B<, unsigned int "
10641 #. type: Plain text
10642 #: build/C/man2/splice.2:50
10644 "B<splice>() moves data between two file descriptors without copying between "
10645 "kernel address space and user address space. It transfers up to I<len> "
10646 "bytes of data from the file descriptor I<fd_in> to the file descriptor "
10647 "I<fd_out>, where one of the descriptors must refer to a pipe."
10650 #. type: Plain text
10651 #: build/C/man2/splice.2:80
10653 "If I<fd_in> refers to a pipe, then I<off_in> must be NULL. If I<fd_in> does "
10654 "not refer to a pipe and I<off_in> is NULL, then bytes are read from I<fd_in> "
10655 "starting from the current file offset, and the current file offset is "
10656 "adjusted appropriately. If I<fd_in> does not refer to a pipe and I<off_in> "
10657 "is not NULL, then I<off_in> must point to a buffer which specifies the "
10658 "starting offset from which bytes will be read from I<fd_in>; in this case, "
10659 "the current file offset of I<fd_in> is not changed. Analogous statements "
10660 "apply for I<fd_out> and I<off_out>."
10663 #. type: Plain text
10664 #: build/C/man2/splice.2:85 build/C/man2/vmsplice.2:78
10666 "The I<flags> argument is a bit mask that is composed by ORing together zero "
10667 "or more of the following values:"
10671 #: build/C/man2/splice.2:85 build/C/man2/tee.2:62 build/C/man2/vmsplice.2:78
10673 msgid "B<SPLICE_F_MOVE>"
10676 #. type: Plain text
10677 #: build/C/man2/splice.2:98
10679 "Attempt to move pages instead of copying. This is only a hint to the "
10680 "kernel: pages may still be copied if the kernel cannot move the pages from "
10681 "the pipe, or if the pipe buffers don't refer to full pages. The initial "
10682 "implementation of this flag was buggy: therefore starting in Linux 2.6.21 it "
10683 "is a no-op (but is still permitted in a B<splice>() call); in the future, a "
10684 "correct implementation may be restored."
10688 #: build/C/man2/splice.2:98 build/C/man2/tee.2:68 build/C/man2/vmsplice.2:84
10690 msgid "B<SPLICE_F_NONBLOCK>"
10693 #. type: Plain text
10694 #: build/C/man2/splice.2:107
10696 "Do not block on I/O. This makes the splice pipe operations nonblocking, but "
10697 "B<splice>() may nevertheless block because the file descriptors that are "
10698 "spliced to/from may block (unless they have the B<O_NONBLOCK> flag set)."
10702 #: build/C/man2/splice.2:107 build/C/man2/tee.2:73 build/C/man2/vmsplice.2:91
10704 msgid "B<SPLICE_F_MORE>"
10707 #. type: Plain text
10708 #: build/C/man2/splice.2:121
10710 "More data will be coming in a subsequent splice. This is a helpful hint "
10711 "when the I<fd_out> refers to a socket (see also the description of "
10712 "B<MSG_MORE> in B<send>(2), and the description of B<TCP_CORK> in B<tcp>(7))"
10716 #: build/C/man2/splice.2:121 build/C/man2/tee.2:79 build/C/man2/vmsplice.2:97
10718 msgid "B<SPLICE_F_GIFT>"
10721 #. type: Plain text
10722 #: build/C/man2/splice.2:127
10723 msgid "Unused for B<splice>(); see B<vmsplice>(2)."
10726 #. type: Plain text
10727 #: build/C/man2/splice.2:136
10729 "Upon successful completion, B<splice>() returns the number of bytes spliced "
10730 "to or from the pipe. A return value of 0 means that there was no data to "
10731 "transfer, and it would not make sense to block, because there are no writers "
10732 "connected to the write end of the pipe referred to by I<fd_in>."
10735 #. type: Plain text
10736 #: build/C/man2/splice.2:142
10737 msgid "On error, B<splice>() returns -1 and I<errno> is set to indicate the error."
10740 #. type: Plain text
10741 #: build/C/man2/splice.2:147
10743 "One or both file descriptors are not valid, or do not have proper read-write "
10747 #. The append-mode error is given since 2.6.27; in earlier kernels,
10748 #. splice() in append mode was broken
10749 #. type: Plain text
10750 #: build/C/man2/splice.2:155
10752 "Target filesystem doesn't support splicing; target file is opened in append "
10753 "mode; neither of the descriptors refers to a pipe; or offset given for "
10754 "nonseekable device."
10757 #. type: Plain text
10758 #: build/C/man2/splice.2:158 build/C/man2/tee.2:114 build/C/man2/vmsplice.2:138
10759 msgid "Out of memory."
10763 #: build/C/man2/splice.2:158
10768 #. type: Plain text
10769 #: build/C/man2/splice.2:165
10771 "Either I<off_in> or I<off_out> was not NULL, but the corresponding file "
10772 "descriptor refers to a pipe."
10775 #. type: Plain text
10776 #: build/C/man2/splice.2:170
10778 "The B<splice>() system call first appeared in Linux 2.6.17; library support "
10779 "was added to glibc in version 2.5."
10782 #. type: Plain text
10783 #: build/C/man2/splice.2:182
10785 "The three system calls B<splice>(), B<vmsplice>(2), and B<tee>(2), provide "
10786 "user-space programs with full control over an arbitrary kernel buffer, "
10787 "implemented within the kernel using the same type of buffer that is used for "
10788 "a pipe. In overview, these system calls perform the following tasks:"
10792 #: build/C/man2/splice.2:182
10794 msgid "B<splice>()"
10797 #. type: Plain text
10798 #: build/C/man2/splice.2:186
10800 "moves data from the buffer to an arbitrary file descriptor, or vice versa, "
10801 "or from one buffer to another."
10805 #: build/C/man2/splice.2:186
10810 #. type: Plain text
10811 #: build/C/man2/splice.2:189
10812 msgid "\"copies\" the data from one buffer to another."
10816 #: build/C/man2/splice.2:189
10818 msgid "B<vmsplice>(2)"
10821 #. type: Plain text
10822 #: build/C/man2/splice.2:192
10823 msgid "\"copies\" data from user space into the buffer."
10827 #. Linus: Now, imagine using the above in a media server, for example.
10828 #. Let's say that a year or two has passed, so that the video drivers
10829 #. have been updated to be able to do the splice thing, and what can
10830 #. you do? You can:
10832 #. - splice from the (mpeg or whatever - let's just assume that the video
10833 #. input is either digital or does the encoding on its own - like they
10834 #. pretty much all do) video input into a pipe (remember: no copies - the
10835 #. video input will just DMA directly into memory, and splice will just
10836 #. set up the pages in the pipe buffer)
10837 #. - tee that pipe to split it up
10838 #. - splice one end to a file (ie "save the compressed stream to disk")
10839 #. - splice the other end to a real-time video decoder window for your
10840 #. real-time viewing pleasure.
10842 #. Linus: Now, the advantage of splice()/tee() is that you can
10843 #. do zero-copy movement of data, and unlike sendfile() you can
10844 #. do it on _arbitrary_ data (and, as shown by "tee()", it's more
10845 #. than just sending the data to somebody else: you can duplicate
10846 #. the data and choose to forward it to two or more different
10847 #. users - for things like logging etc.).
10848 #. type: Plain text
10849 #: build/C/man2/splice.2:223
10851 "Though we talk of copying, actual copies are generally avoided. The kernel "
10852 "does this by implementing a pipe buffer as a set of reference-counted "
10853 "pointers to pages of kernel memory. The kernel creates \"copies\" of pages "
10854 "in a buffer by creating new pointers (for the output buffer) referring to "
10855 "the pages, and increasing the reference counts for the pages: only pointers "
10856 "are copied, not the pages of the buffer."
10859 #. type: Plain text
10860 #: build/C/man2/splice.2:226
10861 msgid "See B<tee>(2)."
10864 #. type: Plain text
10865 #: build/C/man2/splice.2:230
10866 msgid "B<sendfile>(2), B<tee>(2), B<vmsplice>(2)"
10870 #: build/C/man2/tee.2:26
10875 #. type: Plain text
10876 #: build/C/man2/tee.2:29
10877 msgid "tee - duplicating pipe content"
10880 #. type: Plain text
10881 #: build/C/man2/tee.2:36
10884 "B<ssize_t tee(int >I<fd_in>B<, int >I<fd_out>B<, size_t >I<len>B<, unsigned "
10885 "int >I<flags>B<);>\n"
10888 #. Example programs http://brick.kernel.dk/snaps
10891 #. add a "tee(in, out1, out2)" system call that duplicates the pages
10892 #. (again, incrementing their reference count, not copying the data) from
10893 #. one pipe to two other pipes.
10894 #. type: Plain text
10895 #: build/C/man2/tee.2:56
10897 "B<tee>() duplicates up to I<len> bytes of data from the pipe referred to by "
10898 "the file descriptor I<fd_in> to the pipe referred to by the file descriptor "
10899 "I<fd_out>. It does not consume the data that is duplicated from I<fd_in>; "
10900 "therefore, that data can be copied by a subsequent B<splice>(2)."
10903 #. type: Plain text
10904 #: build/C/man2/tee.2:62
10906 "I<flags> is a series of modifier flags, which share the name space with "
10907 "B<splice>(2) and B<vmsplice>(2):"
10910 #. type: Plain text
10911 #: build/C/man2/tee.2:68
10912 msgid "Currently has no effect for B<tee>(); see B<splice>(2)."
10915 #. Not used for vmsplice
10916 #. May be in the future -- therefore EAGAIN
10917 #. type: Plain text
10918 #: build/C/man2/tee.2:73 build/C/man2/vmsplice.2:91
10919 msgid "Do not block on I/O; see B<splice>(2) for further details."
10922 #. type: Plain text
10923 #: build/C/man2/tee.2:79
10925 "Currently has no effect for B<tee>(), but may be implemented in the future; "
10926 "see B<splice>(2)."
10929 #. type: Plain text
10930 #: build/C/man2/tee.2:85
10931 msgid "Unused for B<tee>(); see B<vmsplice>(2)."
10934 #. type: Plain text
10935 #: build/C/man2/tee.2:94
10937 "Upon successful completion, B<tee>() returns the number of bytes that were "
10938 "duplicated between the input and output. A return value of 0 means that "
10939 "there was no data to transfer, and it would not make sense to block, because "
10940 "there are no writers connected to the write end of the pipe referred to by "
10944 #. type: Plain text
10945 #: build/C/man2/tee.2:100
10946 msgid "On error, B<tee>() returns -1 and I<errno> is set to indicate the error."
10949 #. type: Plain text
10950 #: build/C/man2/tee.2:111
10952 "I<fd_in> or I<fd_out> does not refer to a pipe; or I<fd_in> and I<fd_out> "
10953 "refer to the same pipe."
10956 #. type: Plain text
10957 #: build/C/man2/tee.2:119
10959 "The B<tee>() system call first appeared in Linux 2.6.17; library support "
10960 "was added to glibc in version 2.5."
10963 #. type: Plain text
10964 #: build/C/man2/tee.2:130
10966 "Conceptually, B<tee>() copies the data between the two pipes. In reality "
10967 "no real data copying takes place though: under the covers, B<tee>() assigns "
10968 "data in the output by merely grabbing a reference to the input."
10971 #. type: Plain text
10972 #: build/C/man2/tee.2:136
10974 "The following example implements a basic B<tee>(1) program using the "
10975 "B<tee>() system call."
10978 #. type: Plain text
10979 #: build/C/man2/tee.2:145
10982 "#define _GNU_SOURCE\n"
10983 "#include E<lt>fcntl.hE<gt>\n"
10984 "#include E<lt>stdio.hE<gt>\n"
10985 "#include E<lt>stdlib.hE<gt>\n"
10986 "#include E<lt>unistd.hE<gt>\n"
10987 "#include E<lt>errno.hE<gt>\n"
10988 "#include E<lt>limits.hE<gt>\n"
10991 #. type: Plain text
10992 #: build/C/man2/tee.2:151
10996 "main(int argc, char *argv[])\n"
10999 " int len, slen;\n"
11002 #. type: Plain text
11003 #: build/C/man2/tee.2:156
11006 " if (argc != 2) {\n"
11007 " fprintf(stderr, \"Usage: %s E<lt>fileE<gt>\\en\", argv[0]);\n"
11008 " exit(EXIT_FAILURE);\n"
11012 #. type: Plain text
11013 #: build/C/man2/tee.2:162
11016 " fd = open(argv[1], O_WRONLY | O_CREAT | O_TRUNC, 0644);\n"
11017 " if (fd == -1) {\n"
11018 " perror(\"open\");\n"
11019 " exit(EXIT_FAILURE);\n"
11023 #. type: Plain text
11024 #: build/C/man2/tee.2:169
11029 " * tee stdin to stdout.\n"
11031 " len = tee(STDIN_FILENO, STDOUT_FILENO,\n"
11032 " INT_MAX, SPLICE_F_NONBLOCK);\n"
11035 #. type: Plain text
11036 #: build/C/man2/tee.2:178
11039 " if (len E<lt> 0) {\n"
11040 " if (errno == EAGAIN)\n"
11042 " perror(\"tee\");\n"
11043 " exit(EXIT_FAILURE);\n"
11049 #. type: Plain text
11050 #: build/C/man2/tee.2:192
11054 " * Consume stdin by splicing it to a file.\n"
11056 " while (len E<gt> 0) {\n"
11057 " slen = splice(STDIN_FILENO, NULL, fd, NULL,\n"
11058 " len, SPLICE_F_MOVE);\n"
11059 " if (slen E<lt> 0) {\n"
11060 " perror(\"splice\");\n"
11068 #. type: Plain text
11069 #: build/C/man2/tee.2:196
11073 " exit(EXIT_SUCCESS);\n"
11077 #. type: Plain text
11078 #: build/C/man2/tee.2:200
11079 msgid "B<splice>(2), B<vmsplice>(2)"
11083 #: build/C/man2/vm86.2:26
11089 #: build/C/man2/vm86.2:26
11094 #. type: Plain text
11095 #: build/C/man2/vm86.2:29
11096 msgid "vm86old, vm86 - enter virtual 8086 mode"
11099 #. type: Plain text
11100 #: build/C/man2/vm86.2:31
11101 msgid "B<#include E<lt>sys/vm86.hE<gt>>"
11104 #. type: Plain text
11105 #: build/C/man2/vm86.2:33
11106 msgid "B<int vm86old(struct vm86_struct *>I<info>B<);>"
11109 #. type: Plain text
11110 #: build/C/man2/vm86.2:35
11111 msgid "B<int vm86(unsigned long >I<fn>B<, struct vm86plus_struct *>I<v86>B<);>"
11114 #. type: Plain text
11115 #: build/C/man2/vm86.2:48
11117 "The system call B<vm86>() was introduced in Linux 0.97p2. In Linux 2.1.15 "
11118 "and 2.0.28 it was renamed to B<vm86old>(), and a new B<vm86>() was "
11119 "introduced. The definition of I<struct vm86_struct> was changed in 1.1.8 "
11123 #. type: Plain text
11124 #: build/C/man2/vm86.2:52
11126 "These calls cause the process to enter VM86 mode (virtual-8086 in Intel "
11127 "literature), and are used by B<dosemu>."
11130 #. type: Plain text
11131 #: build/C/man2/vm86.2:54
11132 msgid "VM86 mode is an emulation of real mode within a protected mode task."
11135 #. type: Plain text
11136 #: build/C/man2/vm86.2:64
11138 "This return value is specific to i386 and indicates a problem with getting "
11142 #. type: Plain text
11143 #: build/C/man2/vm86.2:68
11145 "This return value indicates the call is not implemented on the present "
11149 #. type: Plain text
11150 #: build/C/man2/vm86.2:73
11152 "Saved kernel stack exists. (This is a kernel sanity check; the saved stack "
11153 "should exist only within vm86 mode itself.)"
11156 #. type: Plain text
11157 #: build/C/man2/vm86.2:76
11159 "This call is specific to Linux on 32-bit Intel processors, and should not be "
11160 "used in programs intended to be portable."
11164 #: build/C/man2/vmsplice.2:26
11169 #. type: Plain text
11170 #: build/C/man2/vmsplice.2:29
11171 msgid "vmsplice - splice user pages into a pipe"
11174 #. type: Plain text
11175 #: build/C/man2/vmsplice.2:34
11178 "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n"
11179 "B<#include E<lt>fcntl.hE<gt>>\n"
11180 "B<#include E<lt>sys/uio.hE<gt>>\n"
11183 #. type: Plain text
11184 #: build/C/man2/vmsplice.2:37
11187 "B<ssize_t vmsplice(int >I<fd>B<, const struct iovec *>I<iov>B<,>\n"
11188 "B< unsigned long >I<nr_segs>B<, unsigned int "
11192 #. Linus: vmsplice() system call to basically do a "write to
11193 #. the buffer", but using the reference counting and VM traversal
11194 #. to actually fill the buffer. This means that the user needs to
11195 #. be careful not to reuse the user-space buffer it spliced into
11196 #. the kernel-space one (contrast this to "write()", which copies
11197 #. the actual data, and you can thus reuse the buffer immediately
11198 #. after a successful write), but that is often easy to do.
11199 #. type: Plain text
11200 #: build/C/man2/vmsplice.2:57
11202 "The B<vmsplice>() system call maps I<nr_segs> ranges of user memory "
11203 "described by I<iov> into a pipe. The file descriptor I<fd> must refer to a "
11207 #. type: Plain text
11208 #: build/C/man2/vmsplice.2:64
11210 "The pointer I<iov> points to an array of I<iovec> structures as defined in "
11211 "I<E<lt>sys/uio.hE<gt>>:"
11214 #. type: Plain text
11215 #: build/C/man2/vmsplice.2:71
11219 " void *iov_base; /* Starting address */\n"
11220 " size_t iov_len; /* Number of bytes */\n"
11224 #. type: Plain text
11225 #: build/C/man2/vmsplice.2:84
11226 msgid "Unused for B<vmsplice>(); see B<splice>(2)."
11229 #. type: Plain text
11230 #: build/C/man2/vmsplice.2:97
11232 "Currently has no effect for B<vmsplice>(), but may be implemented in the "
11233 "future; see B<splice>(2)."
11236 #. FIXME Explain the following line in a little more detail:
11237 #. .... if we expect to later SPLICE_F_MOVE to the cache.
11238 #. type: Plain text
11239 #: build/C/man2/vmsplice.2:113
11241 "The user pages are a gift to the kernel. The application may not modify "
11242 "this memory ever, or page cache and on-disk data may differ. Gifting pages "
11243 "to the kernel means that a subsequent B<splice>(2) B<SPLICE_F_MOVE> can "
11244 "successfully move the pages; if this flag is not specified, then a "
11245 "subsequent B<splice>(2) B<SPLICE_F_MOVE> must copy the pages. Data must "
11246 "also be properly page aligned, both in memory and length."
11249 #. type: Plain text
11250 #: build/C/man2/vmsplice.2:122
11252 "Upon successful completion, B<vmsplice>() returns the number of bytes "
11253 "transferred to the pipe. On error, B<vmsplice>() returns -1 and I<errno> "
11254 "is set to indicate the error."
11257 #. type: Plain text
11258 #: build/C/man2/vmsplice.2:127
11259 msgid "I<fd> either not valid, or doesn't refer to a pipe."
11262 #. type: Plain text
11263 #: build/C/man2/vmsplice.2:135
11265 "I<nr_segs> is 0 or greater than B<IOV_MAX>; or memory not aligned if "
11266 "B<SPLICE_F_GIFT> set."
11269 #. type: Plain text
11270 #: build/C/man2/vmsplice.2:143
11272 "The B<vmsplice>() system call first appeared in Linux 2.6.17; library "
11273 "support was added to glibc in version 2.5."
11276 #. type: Plain text
11277 #: build/C/man2/vmsplice.2:154
11279 "B<vmsplice>() follows the other vectorized read/write type functions when "
11280 "it comes to limitations on number of segments being passed in. This limit "
11281 "is B<IOV_MAX> as defined in I<E<lt>limits.hE<gt>>. At the time of this "
11282 "writing, that limit is 1024."
11285 #. type: Plain text
11286 #: build/C/man2/vmsplice.2:157
11287 msgid "B<splice>(2), B<tee>(2)"