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: 2015-02-04 23:32+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:27 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:46 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:27 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:46 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:28 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:47 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:30 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:49 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:70 build/C/man2/get_robust_list.2:45 build/C/man2/getunwind.2:40 build/C/man2/kexec_load.2:47 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:66 build/C/man2/ptrace.2:56 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:216 build/C/man2/get_robust_list.2:78 build/C/man2/getunwind.2:81 build/C/man2/kexec_load.2:242 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:2607 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:225 build/C/man2/ptrace.2:1896 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:135 build/C/man2/tee.2:85 build/C/man2/vm86.2:54 build/C/man2/vmsplice.2:117
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:241 build/C/man2/get_robust_list.2:85 build/C/man2/getunwind.2:88 build/C/man2/kexec_load.2:247 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:2613 build/C/man2/personality.2:69 build/C/man2/pivot_root.2:105 build/C/man2/process_vm_readv.2:245 build/C/man2/ptrace.2:1911 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:150 build/C/man2/tee.2:100 build/C/man2/vm86.2:59 build/C/man2/vmsplice.2:126
169 #: build/C/man2/arch_prctl.2:89 build/C/man2/futex.2:256 build/C/man2/get_robust_list.2:112 build/C/man2/lookup_dcookie.2:51 build/C/man2/modify_ldt.2:109 build/C/man2/perf_event_open.2:2659 build/C/man2/process_vm_readv.2:267 build/C/man2/process_vm_readv.2:272 build/C/man2/ptrace.2:1915 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:268 build/C/man2/get_robust_list.2:89 build/C/man2/kexec_load.2:279 build/C/man2/kexec_load.2:283 build/C/man2/kexec_load.2:292 build/C/man2/kexec_load.2:298 build/C/man2/kexec_load.2:301 build/C/man2/kexec_load.2:306 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:2664 build/C/man2/personality.2:70 build/C/man2/pivot_root.2:114 build/C/man2/process_vm_readv.2:246 build/C/man2/process_vm_readv.2:257 build/C/man2/process_vm_readv.2:261 build/C/man2/ptrace.2:1926 build/C/man2/quotactl.2:434 build/C/man2/quotactl.2:501 build/C/man2/sendfile.2:128 build/C/man2/splice.2:161 build/C/man2/tee.2:107 build/C/man2/vmsplice.2:137
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:99 build/C/man2/kexec_load.2:323 build/C/man2/lookup_dcookie.2:65 build/C/man2/pciconfig_read.2:105 build/C/man2/perf_event_open.2:2732 build/C/man2/pivot_root.2:120 build/C/man2/process_vm_readv.2:283 build/C/man2/ptrace.2:1936 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:303 build/C/man2/getunwind.2:96 build/C/man2/kexec_load.2:335 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:2756 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:295 build/C/man2/ptrace.2:1954 build/C/man2/sendfile.2:148 build/C/man2/set_tid_address.2:97 build/C/man2/splice.2:184 build/C/man2/tee.2:125 build/C/man2/vm86.2:73 build/C/man2/vmsplice.2:153
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:305 build/C/man2/get_robust_list.2:118 build/C/man2/getunwind.2:99 build/C/man2/kexec_load.2:337 build/C/man2/lookup_dcookie.2:81 build/C/man2/modify_ldt.2:133 build/C/man2/perf_event_open.2:2761 build/C/man2/perfmonctl.2:202 build/C/man2/pivot_root.2:131 build/C/man2/process_vm_readv.2:297 build/C/man2/ptrace.2:1956 build/C/man2/sendfile.2:155 build/C/man2/splice.2:186 build/C/man2/tee.2:127 build/C/man2/vmsplice.2:155
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:319 build/C/man2/get_robust_list.2:127 build/C/man2/getunwind.2:111 build/C/man2/kexec_load.2:341 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:2903 build/C/man2/perfmonctl.2:205 build/C/man2/personality.2:77 build/C/man2/pivot_root.2:143 build/C/man2/process_vm_readv.2:347 build/C/man2/ptrace.2:2122 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:240 build/C/man2/tee.2:214 build/C/man2/vmsplice.2:164
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:333 build/C/man2/get_robust_list.2:136 build/C/man2/getunwind.2:113 build/C/man2/kexec_load.2:350 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:2909 build/C/man2/perfmonctl.2:209 build/C/man2/personality.2:79 build/C/man2/pivot_root.2:149 build/C/man2/process_vm_readv.2:350 build/C/man2/ptrace.2:2137 build/C/man2/quotactl.2:512 build/C/man2/sendfile.2:203 build/C/man2/set_tid_address.2:103 build/C/man2/splice.2:244 build/C/man2/tee.2:217 build/C/man2/vm86.2:76 build/C/man2/vmsplice.2:167
288 #: build/C/man2/arch_prctl.2:153 build/C/man2/futex.2:341 build/C/man2/get_robust_list.2:144 build/C/man2/getunwind.2:121 build/C/man2/kexec_load.2:358 build/C/man2/lookup_dcookie.2:96 build/C/man2/modify_ldt.2:146 build/C/man2/nfsservctl.2:68 build/C/man2/outb.2:107 build/C/man2/pciconfig_read.2:124 build/C/man2/perf_event_open.2:2917 build/C/man2/perfmonctl.2:217 build/C/man2/personality.2:87 build/C/man2/pivot_root.2:157 build/C/man2/process_vm_readv.2:358 build/C/man2/ptrace.2:2145 build/C/man2/quotactl.2:520 build/C/man2/sendfile.2:211 build/C/man2/set_tid_address.2:111 build/C/man2/splice.2:252 build/C/man2/tee.2:225 build/C/man2/vm86.2:84 build/C/man2/vmsplice.2:175
290 "This page is part of release 3.79 of the Linux I<man-pages> project. A "
291 "description of the project, information about reporting bugs, and the latest "
292 "version of this page, can be found at "
293 "\\%http://www.kernel.org/doc/man-pages/."
297 #: build/C/man2/futex.2:53
303 #: build/C/man2/futex.2:53
309 #: build/C/man2/futex.2:56
310 msgid "futex - fast user-space locking"
314 #: build/C/man2/futex.2:61
317 "B<#include E<lt>linux/futex.hE<gt>>\n"
318 "B<#include E<lt>sys/time.hE<gt>>\n"
322 #: build/C/man2/futex.2:64
325 "B<int futex(int *>I<uaddr>B<, int >I<op>B<, int >I<val>B<, const struct "
326 "timespec *>I<timeout>B<,>\n"
329 #. int *? void *? u32 *?
331 #: build/C/man2/futex.2:67
333 msgid "B< int *>I<uaddr2>B<, int >I<val3>B<);>\n"
337 #: build/C/man2/futex.2:70 build/C/man2/getunwind.2:40 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
338 msgid "I<Note>: There is no glibc wrapper for this system call; see NOTES."
342 #: build/C/man2/futex.2:86
344 "The B<futex>() system call provides a method for a program to wait for a "
345 "value at a given address to change, and a method to wake up anyone waiting "
346 "on a particular address (while the addresses for the same memory in separate "
347 "processes may not be equal, the kernel maps them internally so the same "
348 "memory mapped in different locations will correspond for B<futex>() "
349 "calls). This system call is typically used to implement the contended case "
350 "of a lock in shared memory, as described in B<futex>(7)."
354 #: build/C/man2/futex.2:93
356 "When a B<futex>(7) operation did not finish uncontended in user space, a "
357 "call needs to be made to the kernel to arbitrate. Arbitration can either "
358 "mean putting the calling process to sleep or, conversely, waking a waiting "
363 #: build/C/man2/futex.2:100
365 "Callers of this function are expected to adhere to the semantics as set out "
366 "in B<futex>(7). As these semantics involve writing nonportable assembly "
367 "instructions, this in turn probably means that most users will in fact be "
368 "library authors and not general application developers."
372 #: build/C/man2/futex.2:108
374 "The I<uaddr> argument needs to point to an aligned integer which stores the "
375 "counter. The operation to execute is passed via the I<op> argument, along "
376 "with a value I<val>."
380 #: build/C/man2/futex.2:110
381 msgid "Five operations are currently defined:"
385 #: build/C/man2/futex.2:110 build/C/man2/futex.2:223
387 msgid "B<FUTEX_WAIT>"
391 #: build/C/man2/futex.2:133
393 "This operation atomically verifies that the futex address I<uaddr> still "
394 "contains the value I<val>, and sleeps awaiting B<FUTEX_WAKE> on this futex "
395 "address. If the I<timeout> argument is non-NULL, its contents specify the "
396 "duration of the wait. (This interval will be rounded up to the system clock "
397 "granularity, and kernel scheduling delays mean that the blocking interval "
398 "may overrun by a small amount.) If I<timeout> is NULL, the call blocks "
399 "indefinitely. The arguments I<uaddr2> and I<val3> are ignored."
403 #: build/C/man2/futex.2:141
405 "For B<futex>(7), this call is executed if decrementing the count gave a "
406 "negative value (indicating contention), and will sleep until another process "
407 "releases the futex and executes the B<FUTEX_WAKE> operation."
411 #: build/C/man2/futex.2:141 build/C/man2/futex.2:229
413 msgid "B<FUTEX_WAKE>"
417 #: build/C/man2/futex.2:152
419 "This operation wakes at most I<val> processes waiting on this futex address "
420 "(i.e., inside B<FUTEX_WAIT>). The arguments I<timeout>, I<uaddr2> and "
421 "I<val3> are ignored."
425 #: build/C/man2/futex.2:158
427 "For B<futex>(7), this is executed if incrementing the count showed that "
428 "there were waiters, once the futex value has been set to 1 (indicating that "
433 #: build/C/man2/futex.2:158
435 msgid "B<FUTEX_FD> (present up to and including Linux 2.6.25)"
438 #. , suitable for .BR poll (2).
440 #: build/C/man2/futex.2:174
442 "To support asynchronous wakeups, this operation associates a file descriptor "
443 "with a futex. If another process executes a B<FUTEX_WAKE>, the process will "
444 "receive the signal number that was passed in I<val>. The calling process "
445 "must close the returned file descriptor after use. The arguments "
446 "I<timeout>, I<uaddr2> and I<val3> are ignored."
450 #: build/C/man2/futex.2:179
452 "To prevent race conditions, the caller should test if the futex has been "
453 "upped after B<FUTEX_FD> returns."
457 #: build/C/man2/futex.2:183
459 "Because it was inherently racy, B<FUTEX_FD> has been removed from Linux "
464 #: build/C/man2/futex.2:183
466 msgid "B<FUTEX_REQUEUE> (since Linux 2.5.70)"
470 #: build/C/man2/futex.2:198
472 "This operation was introduced in order to avoid a \"thundering herd\" effect "
473 "when B<FUTEX_WAKE> is used and all processes woken up need to acquire "
474 "another futex. This call wakes up I<val> processes, and requeues all other "
475 "waiters on the futex at address I<uaddr2>. The arguments I<timeout> and "
476 "I<val3> are ignored."
480 #: build/C/man2/futex.2:198
482 msgid "B<FUTEX_CMP_REQUEUE> (since Linux 2.6.7)"
486 #: build/C/man2/futex.2:216
488 "There was a race in the intended use of B<FUTEX_REQUEUE>, so "
489 "B<FUTEX_CMP_REQUEUE> was introduced. This is similar to B<FUTEX_REQUEUE>, "
490 "but first checks whether the location I<uaddr> still contains the value "
491 "I<val3>. If not, the operation fails with the error B<EAGAIN>. The "
492 "argument I<timeout> is ignored."
496 #: build/C/man2/futex.2:223
498 "In the event of an error, all operations return -1, and set I<errno> to "
499 "indicate the error. The return value on success depends on the operation, "
500 "as described in the following list:"
504 #: build/C/man2/futex.2:229
506 "Returns 0 if the process was woken by a B<FUTEX_WAKE> call. See ERRORS for "
507 "the various possible error returns."
511 #: build/C/man2/futex.2:232 build/C/man2/futex.2:238 build/C/man2/futex.2:241
512 msgid "Returns the number of processes woken up."
516 #: build/C/man2/futex.2:232
522 #: build/C/man2/futex.2:235
523 msgid "Returns the new file descriptor associated with the futex."
527 #: build/C/man2/futex.2:235
529 msgid "B<FUTEX_REQUEUE>"
533 #: build/C/man2/futex.2:238
535 msgid "B<FUTEX_CMP_REQUEUE>"
539 #: build/C/man2/futex.2:242 build/C/man2/perf_event_open.2:2635 build/C/man2/quotactl.2:486
545 #: build/C/man2/futex.2:245
546 msgid "No read access to futex memory."
550 #: build/C/man2/futex.2:245 build/C/man2/sendfile.2:116 build/C/man2/splice.2:151 build/C/man2/tee.2:101 build/C/man2/vmsplice.2:127
556 #: build/C/man2/futex.2:256
558 "B<FUTEX_CMP_REQUEUE> detected that the value pointed to by I<uaddr> is not "
559 "equal to the expected value I<val3>. (This probably indicates a race; use "
560 "the safe B<FUTEX_WAKE> now.)"
564 #: build/C/man2/futex.2:261
565 msgid "Error retrieving I<timeout> information from user space."
569 #: build/C/man2/futex.2:261
575 #: build/C/man2/futex.2:268
577 "A B<FUTEX_WAIT> operation was interrupted by a signal (see B<signal>(7)) or "
582 #: build/C/man2/futex.2:271
583 msgid "Invalid argument."
587 #: build/C/man2/futex.2:271
593 #: build/C/man2/futex.2:274
594 msgid "The system limit on the total number of open files has been reached."
598 #: build/C/man2/futex.2:274 build/C/man2/modify_ldt.2:126 build/C/man2/pciconfig_read.2:93 build/C/man2/perf_event_open.2:2718 build/C/man2/quotactl.2:447 build/C/man2/vm86.2:64
604 #: build/C/man2/futex.2:278
605 msgid "Invalid operation specified in I<op>."
609 #: build/C/man2/futex.2:278
615 #: build/C/man2/futex.2:283
616 msgid "Timeout during the B<FUTEX_WAIT> operation."
620 #: build/C/man2/futex.2:283
622 msgid "B<EWOULDBLOCK>"
626 #: build/C/man2/futex.2:293
628 "I<op> was B<FUTEX_WAIT> and the value pointed to by I<uaddr> was not equal "
629 "to the expected value I<val> at the time of the call."
633 #: build/C/man2/futex.2:293 build/C/man2/get_robust_list.2:116 build/C/man2/getunwind.2:94 build/C/man2/kexec_load.2:328 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:292 build/C/man2/sendfile.2:142 build/C/man2/set_tid_address.2:94 build/C/man2/splice.2:179 build/C/man2/tee.2:120 build/C/man2/vmsplice.2:148
639 #: build/C/man2/futex.2:303
641 "Initial futex support was merged in Linux 2.5.7 but with different semantics "
642 "from what was described above. A 4-argument system call with the semantics "
643 "described in this page was introduced in Linux 2.5.40. In Linux 2.5.70, one "
644 "argument was added. In Linux 2.6.7, a sixth argument was added\\(emmessy, "
645 "especially on the s390 architecture."
649 #: build/C/man2/futex.2:305 build/C/man2/set_tid_address.2:99 build/C/man2/splice.2:186 build/C/man2/tee.2:127 build/C/man2/vmsplice.2:155
650 msgid "This system call is Linux-specific."
655 #. Futexes were designed and worked on by
656 #. Hubertus Franke (IBM Thomas J. Watson Research Center),
657 #. Matthew Kirkwood, Ingo Molnar (Red Hat)
658 #. and Rusty Russell (IBM Linux Technology Center).
659 #. This page written by bert hubert.
661 #: build/C/man2/futex.2:319
663 "To reiterate, bare futexes are not intended as an easy-to-use abstraction "
664 "for end-users. (There is no wrapper function for this system call in "
665 "glibc.) Implementors are expected to be assembly literate and to have read "
666 "the sources of the futex user-space library referenced below."
670 #: build/C/man2/futex.2:322
671 msgid "B<restart_syscall>(2), B<futex>(7)"
675 #: build/C/man2/futex.2:325
677 "I<Fuss, Futexes and Furwocks: Fast Userlevel Locking in Linux> (proceedings "
678 "of the Ottawa Linux Symposium 2002), online at"
682 #: build/C/man2/futex.2:328
684 "E<.UR http://kernel.org\\:/doc\\:/ols\\:/2002\\:/ols2002-pages-479-495.pdf> "
689 #: build/C/man2/futex.2:330
690 msgid "Futex example library, futex-*.tar.bz2 at"
694 #: build/C/man2/futex.2:333
696 "E<.UR ftp://ftp.kernel.org\\:/pub\\:/linux\\:/kernel\\:/people\\:/rusty/> "
701 #: build/C/man2/get_robust_list.2:29
703 msgid "GET_ROBUST_LIST"
707 #: build/C/man2/get_robust_list.2:29 build/C/man2/ptrace.2:46
713 #: build/C/man2/get_robust_list.2:29
715 msgid "Linux System Calls"
719 #: build/C/man2/get_robust_list.2:32
720 msgid "get_robust_list, set_robust_list - get/set list of robust futexes"
724 #: build/C/man2/get_robust_list.2:37
727 "B<#include E<lt>linux/futex.hE<gt>>\n"
728 "B<#include E<lt>sys/types.hE<gt>>\n"
729 "B<#include E<lt>syscall.hE<gt>>\n"
733 #: build/C/man2/get_robust_list.2:41
736 "B<long get_robust_list(int >I<pid>B<, struct robust_list_head "
737 "**>I<head_ptr>B<,>\n"
738 "B< size_t *>I<len_ptr>B<);>\n"
739 "B<long set_robust_list(struct robust_list_head *>I<head>B<, size_t "
744 #: build/C/man2/get_robust_list.2:45 build/C/man2/kexec_load.2:47
745 msgid "I<Note>: There are no glibc wrappers for these system calls; see NOTES."
749 #: build/C/man2/get_robust_list.2:50
751 "The robust futex implementation needs to maintain per-thread lists of robust "
752 "futexes which are unlocked when the thread exits. These lists are managed "
753 "in user space; the kernel is notified about only the location of the head of "
758 #: build/C/man2/get_robust_list.2:66
760 "The B<get_robust_list>() system call returns the head of the robust futex "
761 "list of the thread whose thread ID is specified in I<pid>. If I<pid> is 0, "
762 "the head of the list for the calling thread is returned. The list head is "
763 "stored in the location pointed to by I<head_ptr>. The size of the object "
764 "pointed to by I<**head_ptr> is stored in I<len_ptr>."
768 #: build/C/man2/get_robust_list.2:78
770 "The B<set_robust_list>() system call requests the kernel to record the head "
771 "of the list of robust futexes owned by the calling thread. The I<head> "
772 "argument is the list head to record. The I<len> argument should be "
777 #: build/C/man2/get_robust_list.2:85
779 "The B<set_robust_list>() and B<get_robust_list>() system calls return zero "
780 "when the operation is successful, an error code otherwise."
784 #: build/C/man2/get_robust_list.2:89
785 msgid "The B<set_robust_list>() system call can fail with the following error:"
789 #: build/C/man2/get_robust_list.2:95
791 "I<len> does not match the size of structure B<struct robust_list_head> "
792 "expected by kernel."
796 #: build/C/man2/get_robust_list.2:99
797 msgid "The B<get_robust_list>() system call can fail with the following errors:"
801 #: build/C/man2/get_robust_list.2:107
803 "The calling process does not have permission to see the robust futex list of "
804 "the thread with the thread ID I<pid>, and does not have the "
805 "B<CAP_SYS_PTRACE> capability."
809 #: build/C/man2/get_robust_list.2:107 build/C/man2/perf_event_open.2:2746 build/C/man2/process_vm_readv.2:287 build/C/man2/ptrace.2:1949 build/C/man2/quotactl.2:461 build/C/man2/quotactl.2:504
815 #: build/C/man2/get_robust_list.2:112
816 msgid "No thread with the thread ID I<pid> could be found."
820 #: build/C/man2/get_robust_list.2:116
821 msgid "The head of the robust futex list can't be stored at the location I<head>."
825 #: build/C/man2/get_robust_list.2:118
826 msgid "These system calls were added in Linux 2.6.17."
830 #: build/C/man2/get_robust_list.2:123
832 "These system calls are not needed by normal applications. No support for "
833 "them is provided in glibc. In the unlikely event that you want to call them "
834 "directly, use B<syscall>(2)."
838 #: build/C/man2/get_robust_list.2:127
840 "A thread can have only one robust futex list; therefore applications that "
841 "wish to use this functionality should use the robust mutexes provided by "
845 #. .BR pthread_mutexattr_setrobust_np (3)
847 #: build/C/man2/get_robust_list.2:130
851 #. http://lwn.net/Articles/172149/
853 #: build/C/man2/get_robust_list.2:136
855 "I<Documentation/robust-futexes.txt> and "
856 "I<Documentation/robust-futex-ABI.txt> in the Linux kernel source tree"
860 #: build/C/man2/getunwind.2:27
866 #: build/C/man2/getunwind.2:27
872 #: build/C/man2/getunwind.2:30
873 msgid "getunwind - copy the unwind data to caller's buffer"
877 #: build/C/man2/getunwind.2:34
880 "B<#include E<lt>syscall.hE<gt>>\n"
881 "B<#include E<lt>linux/unwind.hE<gt>>\n"
885 #: build/C/man2/getunwind.2:36
887 msgid "B<long getunwind(void >I<*buf>B<, size_t >I<buf_size>B<);>\n"
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 the unwind data. On error, "
943 "-1 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:27
992 #: build/C/man2/kexec_load.2:27 build/C/man2/personality.2:32
998 #: build/C/man2/kexec_load.2:30
999 msgid "kexec_load, kexec_file_load - load a new kernel for later execution"
1003 #: build/C/man2/kexec_load.2:33
1005 msgid "B<#include E<lt>linux/kexec.hE<gt>>\n"
1009 #: build/C/man2/kexec_load.2:37
1012 "B<long kexec_load(unsigned long >I<entry>B<, unsigned long "
1013 ">I<nr_segments>B<,>\n"
1014 "B< struct kexec_segment *>I<segments>B<, unsigned long "
1019 #: build/C/man2/kexec_load.2:39
1021 msgid "B<long kexec_file_load(int >I<kernel_fd>B<, int >I<initrd_fd>B<,>\n"
1025 #: build/C/man2/kexec_load.2:43
1028 "B< unsigned long >I<cmdline_len>B<, const char "
1029 "*>I<cmdline>B<,>\n"
1030 "B< unsigned long >I<flags>B<);>\n"
1034 #: build/C/man2/kexec_load.2:52
1036 "The B<kexec_load>() system call loads a new kernel that can be executed "
1037 "later by B<reboot>(2)."
1041 #: build/C/man2/kexec_load.2:58
1043 "The I<flags> argument is a bit mask that controls the operation of the "
1044 "call. The following values can be specified in I<flags>:"
1048 #: build/C/man2/kexec_load.2:58
1050 msgid "B<KEXEC_ON_CRASH> (since Linux 2.6.13)"
1054 #: build/C/man2/kexec_load.2:74
1056 "Execute the new kernel automatically on a system crash. This \"crash "
1057 "kernel\" is loaded into an area of reserved memory that is determined at "
1058 "boot time using the I<craskkernel> kernel command-line parameter. The "
1059 "location of this reserved memory is exported to user space via the "
1060 "I</proc/iomem> file, in an entry labeled \"Crash kernel\". A user-space "
1061 "application can parse this file and prepare a list of segments (see below) "
1062 "that specify this reserved memory as destination. If this flag is "
1063 "specified, the kernel checks that the target segments specified in "
1064 "I<segments> fall within the reserved region."
1068 #: build/C/man2/kexec_load.2:74
1070 msgid "B<KEXEC_PRESERVE_CONTEXT> (since Linux 2.6.27)"
1074 #: build/C/man2/kexec_load.2:84
1076 "Preserve the system hardware and software states before executing the new "
1077 "kernel. This could be used for system suspend. This flag is available only "
1078 "if the kernel was configured with B<CONFIG_KEXEC_JUMP>, and is effective "
1079 "only if I<nr_segments> is greater than 0."
1083 #: build/C/man2/kexec_load.2:105
1085 "The high-order bits (corresponding to the mask 0xffff0000) of I<flags> "
1086 "contain the architecture of the to-be-executed kernel. Specify (OR) the "
1087 "constant B<KEXEC_ARCH_DEFAULT> to use the current architecture, or one of "
1088 "the following architecture constants B<KEXEC_ARCH_386>, B<KEXEC_ARCH_68K>, "
1089 "B<KEXEC_ARCH_X86_64>, B<KEXEC_ARCH_PPC>, B<KEXEC_ARCH_PPC64>, "
1090 "B<KEXEC_ARCH_IA_64>, B<KEXEC_ARCH_ARM>, B<KEXEC_ARCH_S390>, "
1091 "B<KEXEC_ARCH_SH>, B<KEXEC_ARCH_MIPS>, and B<KEXEC_ARCH_MIPS_LE>. The "
1092 "architecture must be executable on the CPU of the system."
1096 #: build/C/man2/kexec_load.2:120
1098 "The I<entry> argument is the physical entry address in the kernel image. "
1099 "The I<nr_segments> argument is the number of segments pointed to by the "
1100 "I<segments> pointer; the kernel imposes an (arbitrary) limit of 16 on the "
1101 "number of segments. The I<segments> argument is an array of "
1102 "I<kexec_segment> structures which define the kernel layout:"
1106 #: build/C/man2/kexec_load.2:129
1109 "struct kexec_segment {\n"
1110 " void *buf; /* Buffer in user space */\n"
1111 " size_t bufsz; /* Buffer length in user space */\n"
1112 " void *mem; /* Physical address of kernel */\n"
1113 " size_t memsz; /* Physical address length */\n"
1118 #: build/C/man2/kexec_load.2:146
1120 "The kernel image defined by I<segments> is copied from the calling process "
1121 "into the kernel either in regular memory or in reserved memory (if "
1122 "B<KEXEC_ON_CRASH> is set). The kernel first performs various sanity checks "
1123 "on the information passed in I<segments>. If these checks pass, the kernel "
1124 "copies the segment data to kernel memory. Each segment specified in "
1125 "I<segments> is copied as follows:"
1129 #: build/C/man2/kexec_load.2:146 build/C/man2/kexec_load.2:157 build/C/man2/kexec_load.2:164 build/C/man2/perf_event_open.2:1238 build/C/man2/perf_event_open.2:1256 build/C/man2/ptrace.2:1735 build/C/man2/ptrace.2:1745 build/C/man2/ptrace.2:1753 build/C/man2/ptrace.2:1759 build/C/man2/ptrace.2:1888 build/C/man2/splice.2:55 build/C/man2/splice.2:61 build/C/man2/splice.2:70
1135 #: build/C/man2/kexec_load.2:157
1137 "I<buf> and I<bufsz> identify a memory region in the caller's virtual address "
1138 "space that is the source of the copy. The value in I<bufsz> may not exceed "
1139 "the value in the I<memsz> field."
1143 #: build/C/man2/kexec_load.2:164
1145 "I<mem> and I<memsz> specify a physical address range that is the target of "
1146 "the copy. The values specified in both fields must be multiples of the "
1151 #: build/C/man2/kexec_load.2:172
1153 "I<bufsz> bytes are copied from the source buffer to the target kernel "
1154 "buffer. If I<bufsz> is less than I<memsz>, then the excess bytes in the "
1155 "kernel buffer are zeroed out."
1159 #: build/C/man2/kexec_load.2:181
1161 "In case of a normal kexec (i.e., the B<KEXEC_ON_CRASH> flag is not set), the "
1162 "segment data is loaded in any available memory and is moved to the final "
1163 "destination at kexec reboot time (e.g., when the B<kexec>(8) command is "
1164 "executed with the I<-e> option)."
1168 #: build/C/man2/kexec_load.2:187
1170 "In case of kexec on panic (i.e., the B<KEXEC_ON_CRASH> flag is set), the "
1171 "segment data is loaded to reserved memory at the time of the call, and, "
1172 "after a crash, the kexec mechanism simply passes control to that kernel."
1176 #: build/C/man2/kexec_load.2:192
1178 "The B<kexec_load>() system call is available only if the kernel was "
1179 "configured with B<CONFIG_KEXEC>."
1183 #: build/C/man2/kexec_load.2:192
1185 msgid "kexec_file_load()"
1189 #: build/C/man2/kexec_load.2:211
1191 "The B<kexec_file_load>() system call is similar to B<kexec_load>(), but it "
1192 "takes a different set of arguments. It reads the kernel to be loaded from "
1193 "the file referred to by the descriptor I<kernel_fd>, and the initrd (initial "
1194 "RAM disk) to be loaded from file referred to by the descriptor "
1195 "I<initrd_fd>. The I<cmdline> argument is a pointer to a buffer containing "
1196 "the command line for the new kernel. The I<cmdline_len> argument specifies "
1197 "size of the buffer. The last byte in the buffer must be a null byte "
1202 #: build/C/man2/kexec_load.2:217
1204 "The I<flags> argument is a bit mask which modifies the behavior of the "
1205 "call. The following values can be specified in I<flags>:"
1209 #: build/C/man2/kexec_load.2:217
1211 msgid "B<KEXEC_FILE_UNLOAD>"
1215 #: build/C/man2/kexec_load.2:220
1216 msgid "Unload the currently loaded kernel."
1220 #: build/C/man2/kexec_load.2:220
1222 msgid "B<KEXEC_FILE_ON_CRASH>"
1226 #: build/C/man2/kexec_load.2:226
1228 "Load the new kernel in the memory region reserved for the crash kernel (as "
1229 "for B<KEXEC_ON_CRASH).> This kernel is booted if the currently running "
1234 #: build/C/man2/kexec_load.2:226
1236 msgid "B<KEXEC_FILE_NO_INITRAMFS>"
1240 #: build/C/man2/kexec_load.2:233
1242 "Loading initrd/initramfs is optional. Specify this flag if no initramfs is "
1243 "being loaded. If this flag is set, the value passed in I<initrd_fd> is "
1247 #. See also http://lwn.net/Articles/603116/
1249 #: build/C/man2/kexec_load.2:242
1251 "The B<kexec_file_load>() system call was added to provide support for "
1252 "systems where \"kexec\" loading should be restricted to only kernels that "
1253 "are signed. This system call is available only if the kernel was configured "
1254 "with B<CONFIG_KEXEC_FILE>."
1258 #: build/C/man2/kexec_load.2:247
1260 "On success, these system calls returns 0. On error, -1 is returned and "
1261 "I<errno> is set to indicate the error."
1265 #: build/C/man2/kexec_load.2:248 build/C/man2/kexec_load.2:260
1267 msgid "B<EADDRNOTAVAIL>"
1270 #. See kernel/kexec.::sanity_check_segment_list in the 3.19 kernel source
1272 #: build/C/man2/kexec_load.2:260
1274 "The B<KEXEC_ON_CRASH> flags was specified, but the region specified by the "
1275 "I<mem> and I<memsz> fields of one of the I<segments> entries lies outside "
1276 "the range of memory reserved for the crash kernel."
1280 #: build/C/man2/kexec_load.2:269
1282 "The value in a I<mem> or I<memsz> field in one of the I<segments> entries is "
1283 "not a multiple of the system page size."
1287 #: build/C/man2/kexec_load.2:269 build/C/man2/perf_event_open.2:2649 build/C/man2/sendfile.2:121 build/C/man2/splice.2:157 build/C/man2/vmsplice.2:133
1293 #: build/C/man2/kexec_load.2:275
1294 msgid "I<kernel_fd> or I<initrd_fd> is not a valid file descriptor."
1298 #: build/C/man2/kexec_load.2:275 build/C/man2/pivot_root.2:110 build/C/man2/ptrace.2:1912 build/C/man2/quotactl.2:495
1304 #: build/C/man2/kexec_load.2:279
1306 "Another crash kernel is already being loaded or a crash kernel is already in "
1311 #: build/C/man2/kexec_load.2:283
1312 msgid "I<flags> is invalid."
1316 #: build/C/man2/kexec_load.2:292
1318 "The value of a I<bufsz> field in one of the I<segments> entries exceeds the "
1319 "value in the corresponding I<memsz> field."
1323 #: build/C/man2/kexec_load.2:298
1324 msgid "I<nr_segments> exceeds B<KEXEC_SEGMENT_MAX> (16)."
1328 #: build/C/man2/kexec_load.2:301
1329 msgid "Two or more of the kernel target buffers overlap."
1333 #: build/C/man2/kexec_load.2:306
1334 msgid "The value in I<cmdline[cmdline_len-1]> is not \\(aq\\e0\\(aq."
1338 #: build/C/man2/kexec_load.2:313
1339 msgid "The file referred to by I<kernel_fd> or I<initrd_fd> is empty (length zero)."
1343 #: build/C/man2/kexec_load.2:313 build/C/man2/lookup_dcookie.2:61 build/C/man2/process_vm_readv.2:278 build/C/man2/sendfile.2:138 build/C/man2/splice.2:169 build/C/man2/tee.2:117 build/C/man2/vmsplice.2:145
1349 #: build/C/man2/kexec_load.2:316
1350 msgid "Could not allocate memory."
1354 #: build/C/man2/kexec_load.2:316
1360 #: build/C/man2/kexec_load.2:323
1362 "I<kernel_fd> does not refer to an open file, or the kernel can't load this "
1363 "file. Currently, the file must be a bzImage and contain an x86 kernel that "
1364 "is loadable above 4GiB in memory (see the kernel source file "
1365 "I<Documentation/x86/boot.txt>)."
1369 #: build/C/man2/kexec_load.2:328
1370 msgid "The caller does not have the B<CAP_SYS_BOOT> capability."
1374 #: build/C/man2/kexec_load.2:335
1376 "The B<kexec_load>() system call first appeared in Linux 2.6.13. The "
1377 "B<kexec_file_load>() system call first appeared in Linux 3.17."
1381 #: build/C/man2/kexec_load.2:337
1382 msgid "These system calls are Linux-specific."
1386 #: build/C/man2/kexec_load.2:341
1388 "Currently, there is no glibc support for these system calls. Call them "
1389 "using B<syscall>(2)."
1393 #: build/C/man2/kexec_load.2:345
1394 msgid "B<reboot>(2), B<syscall>(2), B<kexec>(8)"
1398 #: build/C/man2/kexec_load.2:350
1400 "The kernel source files I<Documentation/kdump/kdump.txt> and "
1401 "I<Documentation/kernel-parameters.txt>."
1405 #: build/C/man2/lookup_dcookie.2:27
1407 msgid "LOOKUP_DCOOKIE"
1411 #: build/C/man2/lookup_dcookie.2:27
1417 #: build/C/man2/lookup_dcookie.2:30
1418 msgid "lookup_dcookie - return a directory entry's path"
1422 #: build/C/man2/lookup_dcookie.2:32
1424 "B<int lookup_dcookie(u64 >I<cookie>B<, char *>I<buffer>B<, size_t "
1429 #: build/C/man2/lookup_dcookie.2:38
1431 "Look up the full path of the directory entry specified by the value "
1432 "I<cookie>. The cookie is an opaque identifier uniquely identifying a "
1433 "particular directory entry. The buffer given is filled in with the full "
1434 "path of the directory entry."
1438 #: build/C/man2/lookup_dcookie.2:43
1440 "For B<lookup_dcookie>() to return successfully, the kernel must still hold "
1441 "a cookie reference to the directory entry."
1445 #: build/C/man2/lookup_dcookie.2:50
1447 "On success, B<lookup_dcookie>() returns the length of the path string "
1448 "copied into the buffer. On error, -1 is returned, and I<errno> is set "
1453 #: build/C/man2/lookup_dcookie.2:54
1454 msgid "The buffer was not valid."
1458 #: build/C/man2/lookup_dcookie.2:58
1460 "The kernel has no registered cookie/directory entry mappings at the time of "
1461 "lookup, or the cookie does not refer to a valid directory entry."
1465 #: build/C/man2/lookup_dcookie.2:58
1467 msgid "B<ENAMETOOLONG>"
1471 #: build/C/man2/lookup_dcookie.2:61
1472 msgid "The name could not fit in the buffer."
1476 #: build/C/man2/lookup_dcookie.2:65
1478 "The kernel could not allocate memory for the temporary buffer holding the "
1483 #: build/C/man2/lookup_dcookie.2:70
1485 "The process does not have the capability B<CAP_SYS_ADMIN> required to look "
1490 #: build/C/man2/lookup_dcookie.2:70 build/C/man2/quotactl.2:474
1496 #: build/C/man2/lookup_dcookie.2:73
1497 msgid "The buffer was not large enough to hold the path of the directory entry."
1501 #: build/C/man2/lookup_dcookie.2:78
1503 "Available since Linux 2.5.43. The B<ENAMETOOLONG> error return was added in "
1508 #: build/C/man2/lookup_dcookie.2:81
1509 msgid "B<lookup_dcookie>() is Linux-specific."
1513 #: build/C/man2/lookup_dcookie.2:85
1515 "B<lookup_dcookie>() is a special-purpose system call, currently used only "
1516 "by the oprofile profiler. It relies on a kernel driver to register cookies "
1517 "for directory entries."
1521 #: build/C/man2/lookup_dcookie.2:88
1523 "The path returned may be suffixed by the string \" (deleted)\" if the "
1524 "directory entry has been removed."
1528 #: build/C/man2/modify_ldt.2:24
1534 #: build/C/man2/modify_ldt.2:24 build/C/man2/pivot_root.2:10
1540 #: build/C/man2/modify_ldt.2:27
1541 msgid "modify_ldt - get or set ldt"
1545 #: build/C/man2/modify_ldt.2:30
1547 msgid "B<#include E<lt>sys/types.hE<gt>>\n"
1551 #: build/C/man2/modify_ldt.2:32
1554 "B<int modify_ldt(int >I<func>B<, void *>I<ptr>B<, unsigned long "
1555 ">I<bytecount>B<);>\n"
1559 #: build/C/man2/modify_ldt.2:41
1561 "B<modify_ldt>() reads or writes the local descriptor table (ldt) for a "
1562 "process. The ldt is a per-process memory management table used by the i386 "
1563 "processor. For more information on this table, see an Intel 386 processor "
1568 #: build/C/man2/modify_ldt.2:51
1570 "When I<func> is 0, B<modify_ldt>() reads the ldt into the memory pointed to "
1571 "by I<ptr>. The number of bytes read is the smaller of I<bytecount> and the "
1572 "actual size of the ldt."
1576 #. FIXME Should this page say something about func == 2 and func == 0x11?
1577 #. In Linux 2.4, func == 2 returned "the default ldt"
1578 #. In Linux 2.6, func == 2 is a nop, returning a zeroed out structure.
1579 #. Linux 2.4 and 2.6 implement an operation for func == 0x11
1581 #: build/C/man2/modify_ldt.2:69
1583 "When I<func> is 1, B<modify_ldt>() modifies one ldt entry. I<ptr> points "
1584 "to a I<user_desc> structure and I<bytecount> must equal the size of this "
1589 #: build/C/man2/modify_ldt.2:73
1590 msgid "The I<user_desc> structure is defined in I<E<lt>asm/ldt.hE<gt>> as:"
1594 #: build/C/man2/modify_ldt.2:87
1597 "struct user_desc {\n"
1598 " unsigned int entry_number;\n"
1599 " unsigned long base_addr;\n"
1600 " unsigned int limit;\n"
1601 " unsigned int seg_32bit:1;\n"
1602 " unsigned int contents:2;\n"
1603 " unsigned int read_exec_only:1;\n"
1604 " unsigned int limit_in_pages:1;\n"
1605 " unsigned int seg_not_present:1;\n"
1606 " unsigned int useable:1;\n"
1611 #. The ldt is specific for the calling process. Any attempts to change
1612 #. the ldt to include the address space of another process or the kernel
1613 #. will result in a segmentation violation when trying to access the memory
1614 #. outside of the process address space. The memory protection is enforced
1615 #. at the paging layer.
1617 #: build/C/man2/modify_ldt.2:98
1618 msgid "In Linux 2.4 and earlier, this structure was named I<modify_ldt_ldt_s>."
1622 #: build/C/man2/modify_ldt.2:108
1624 "On success, B<modify_ldt>() returns either the actual number of bytes read "
1625 "(for reading) or 0 (for writing). On failure, B<modify_ldt>() returns -1 "
1626 "and sets I<errno> to indicate the error."
1630 #: build/C/man2/modify_ldt.2:113
1631 msgid "I<ptr> points outside the address space."
1635 #: build/C/man2/modify_ldt.2:126
1637 "I<ptr> is 0, or I<func> is 1 and I<bytecount> is not equal to the size of "
1638 "the structure I<modify_ldt_ldt_s>, or I<func> is 1 and the new ldt entry has "
1643 #: build/C/man2/modify_ldt.2:130
1644 msgid "I<func> is neither 0 nor 1."
1648 #: build/C/man2/modify_ldt.2:133
1650 "This call is Linux-specific and should not be used in programs intended to "
1655 #: build/C/man2/modify_ldt.2:136 build/C/man2/perfmonctl.2:205 build/C/man2/pivot_root.2:134
1657 "Glibc does not provide a wrapper for this system call; call it using "
1662 #: build/C/man2/modify_ldt.2:138
1667 #: build/C/man2/nfsservctl.2:8
1673 #: build/C/man2/nfsservctl.2:8
1679 #: build/C/man2/nfsservctl.2:11
1680 msgid "nfsservctl - syscall interface to kernel nfs daemon"
1684 #: build/C/man2/nfsservctl.2:14
1686 msgid "B<#include E<lt>linux/nfsd/syscall.hE<gt>>\n"
1690 #: build/C/man2/nfsservctl.2:17
1693 "B<long nfsservctl(int >I<cmd>B<, struct nfsctl_arg *>I<argp>B<,>\n"
1694 "B< union nfsctl_res *>I<resp>B<);>\n"
1698 #: build/C/man2/nfsservctl.2:21
1699 msgid "I<Note>: Since Linux 3.1, this system call no longer exists."
1703 #: build/C/man2/nfsservctl.2:35
1707 " * These are the commands understood by nfsctl().\n"
1709 "#define NFSCTL_SVC 0 /* This is a server process. */\n"
1710 "#define NFSCTL_ADDCLIENT 1 /* Add an NFS client. */\n"
1711 "#define NFSCTL_DELCLIENT 2 /* Remove an NFS client. */\n"
1712 "#define NFSCTL_EXPORT 3 /* Export a filesystem. */\n"
1713 "#define NFSCTL_UNEXPORT 4 /* Unexport a filesystem. */\n"
1714 "#define NFSCTL_UGIDUPDATE 5 /* Update a client's UID/GID map\n"
1715 " (only in Linux 2.4.x and earlier). */\n"
1716 "#define NFSCTL_GETFH 6 /* Get a file handle (used by mountd)\n"
1717 " (only in Linux 2.4.x and earlier). */\n"
1721 #: build/C/man2/nfsservctl.2:47
1724 "struct nfsctl_arg {\n"
1725 " int ca_version; /* safeguard */\n"
1727 " struct nfsctl_svc u_svc;\n"
1728 " struct nfsctl_client u_client;\n"
1729 " struct nfsctl_export u_export;\n"
1730 " struct nfsctl_uidmap u_umap;\n"
1731 " struct nfsctl_fhparm u_getfh;\n"
1732 " unsigned int u_debug;\n"
1738 #: build/C/man2/nfsservctl.2:52
1741 "union nfsctl_res {\n"
1742 " struct knfs_fh cr_getfh;\n"
1743 " unsigned int cr_debug;\n"
1748 #: build/C/man2/nfsservctl.2:58 build/C/man2/pivot_root.2:105 build/C/man2/vm86.2:59
1750 "On success, zero is returned. On error, -1 is returned, and I<errno> is set "
1755 #: build/C/man2/nfsservctl.2:60
1756 msgid "This call is Linux-specific."
1760 #: build/C/man2/outb.2:26
1766 #: build/C/man2/outb.2:26
1772 #: build/C/man2/outb.2:31
1774 "outb, outw, outl, outsb, outsw, outsl, inb, inw, inl, insb, insw, insl, "
1775 "outb_p, outw_p, outl_p, inb_p, inw_p, inl_p - port I/O"
1779 #: build/C/man2/outb.2:34
1781 msgid "B<#include E<lt>sys/io.hE<gt>>\n"
1785 #: build/C/man2/outb.2:41
1788 "B<unsigned char inb(unsigned short int >I<port>B<);>\n"
1789 "B<unsigned char inb_p(unsigned short int >I<port>B<);>\n"
1790 "B<unsigned short int inw(unsigned short int >I<port>B<);>\n"
1791 "B<unsigned short int inw_p(unsigned short int >I<port>B<);>\n"
1792 "B<unsigned int inl(unsigned short int >I<port>B<);>\n"
1793 "B<unsigned int inl_p(unsigned short int >I<port>B<);>\n"
1797 #: build/C/man2/outb.2:48
1800 "B<void outb(unsigned char >I<value>B<, unsigned short int >I<port>B<);>\n"
1801 "B<void outb_p(unsigned char >I<value>B<, unsigned short int >I<port>B<);>\n"
1802 "B<void outw(unsigned short int >I<value>B<, unsigned short int "
1804 "B<void outw_p(unsigned short int >I<value>B<, unsigned short int "
1806 "B<void outl(unsigned int >I<value>B<, unsigned short int >I<port>B<);>\n"
1807 "B<void outl_p(unsigned int >I<value>B<, unsigned short int >I<port>B<);>\n"
1811 #: build/C/man2/outb.2:61
1814 "B<void insb(unsigned short int >I<port>B<, void *>I<addr>B<,>\n"
1815 "B< unsigned long int >I<count>B<);>\n"
1816 "B<void insw(unsigned short int >I<port>B<, void *>I<addr>B<,>\n"
1817 "B< unsigned long int >I<count>B<);>\n"
1818 "B<void insl(unsigned short int >I<port>B<, void *>I<addr>B<,>\n"
1819 "B< unsigned long int >I<count>B<);>\n"
1820 "B<void outsb(unsigned short int >I<port>B<, const void *>I<addr>B<,>\n"
1821 "B< unsigned long int >I<count>B<);>\n"
1822 "B<void outsw(unsigned short int >I<port>B<, const void *>I<addr>B<,>\n"
1823 "B< unsigned long int >I<count>B<);>\n"
1824 "B<void outsl(unsigned short int >I<port>B<, const void *>I<addr>B<,>\n"
1825 "B< unsigned long int >I<count>B<);>\n"
1829 #: build/C/man2/outb.2:67
1831 "This family of functions is used to do low-level port input and output. The "
1832 "out* functions do port output, the in* functions do port input; the b-suffix "
1833 "functions are byte-width and the w-suffix functions word-width; the "
1834 "_p-suffix functions pause until the I/O completes."
1837 #. , given the following information
1838 #. in addition to that given in
1841 #: build/C/man2/outb.2:73
1843 "They are primarily designed for internal kernel use, but can be used from "
1848 #: build/C/man2/outb.2:78
1850 "You must compile with B<-O> or B<-O2> or similar. The functions are defined "
1851 "as inline macros, and will not be substituted in without optimization "
1852 "enabled, causing unresolved references at link time."
1856 #: build/C/man2/outb.2:87
1858 "You use B<ioperm>(2) or alternatively B<iopl>(2) to tell the kernel to "
1859 "allow the user space application to access the I/O ports in question. "
1860 "Failure to do this will cause the application to receive a segmentation "
1865 #: build/C/man2/outb.2:96
1867 "B<outb>() and friends are hardware-specific. The I<value> argument is "
1868 "passed first and the I<port> argument is passed second, which is the "
1869 "opposite order from most DOS implementations."
1873 #: build/C/man2/outb.2:99
1874 msgid "B<ioperm>(2), B<iopl>(2)"
1878 #: build/C/man2/pciconfig_read.2:8
1880 msgid "PCICONFIG_READ"
1884 #: build/C/man2/pciconfig_read.2:8
1890 #: build/C/man2/pciconfig_read.2:11
1892 "pciconfig_read, pciconfig_write, pciconfig_iobase - pci device information "
1897 #: build/C/man2/pciconfig_read.2:14
1899 msgid "B<#include E<lt>pci.hE<gt>>\n"
1903 #: build/C/man2/pciconfig_read.2:21
1906 "B<int pciconfig_read(unsigned long >I<bus>B<, unsigned long >I<dfn>B<,>\n"
1907 "B< unsigned long >I<off>B<, unsigned long >I<len>B<, void "
1909 "B<int pciconfig_write(unsigned long >I<bus>B<, unsigned long >I<dfn>B<,>\n"
1910 "B< unsigned long >I<off>B<, unsigned long >I<len>B<, void "
1912 "B<int pciconfig_iobase(long >I<which>B<, unsigned long >I<bus>B<,>\n"
1913 "B< unsigned long >I<devfn>B<);>\n"
1917 #: build/C/man2/pciconfig_read.2:27
1919 "Most of the interaction with PCI devices is already handled by the kernel "
1920 "PCI layer, and thus these calls should not normally need to be accessed from "
1925 #: build/C/man2/pciconfig_read.2:27 build/C/man2/pciconfig_read.2:51
1927 msgid "B<pciconfig_read>()"
1931 #: build/C/man2/pciconfig_read.2:36
1932 msgid "Reads to I<buf> from device I<dev> at offset I<off> value."
1936 #: build/C/man2/pciconfig_read.2:36 build/C/man2/pciconfig_read.2:57
1938 msgid "B<pciconfig_write>()"
1942 #: build/C/man2/pciconfig_read.2:45
1943 msgid "Writes from I<buf> to device I<dev> at offset I<off> value."
1947 #: build/C/man2/pciconfig_read.2:45 build/C/man2/pciconfig_read.2:63
1949 msgid "B<pciconfig_iobase>()"
1953 #: build/C/man2/pciconfig_read.2:50
1955 "You pass it a bus/devfn pair and get a physical address for either the "
1956 "memory offset (for things like prep, this is 0xc0000000), the IO base for "
1957 "PIO cycles, or the ISA holes if any."
1961 #: build/C/man2/pciconfig_read.2:57 build/C/man2/pciconfig_read.2:63
1963 "On success zero is returned. On error, -1 is returned and I<errno> is set "
1968 #: build/C/man2/pciconfig_read.2:77
1970 "Returns information on locations of various I/O regions in physical memory "
1971 "according to the I<which> value. Values for I<which> are: "
1972 "B<IOBASE_BRIDGE_NUMBER>, B<IOBASE_MEMORY>, B<IOBASE_IO>, B<IOBASE_ISA_IO>, "
1973 "B<IOBASE_ISA_MEM>."
1977 #: build/C/man2/pciconfig_read.2:84
1978 msgid "I<len> value is invalid. This does not apply to B<pciconfig_iobase>()."
1982 #: build/C/man2/pciconfig_read.2:84 build/C/man2/ptrace.2:1929 build/C/man2/sendfile.2:134
1988 #: build/C/man2/pciconfig_read.2:87
1993 #: build/C/man2/pciconfig_read.2:87 build/C/man2/perf_event_open.2:2696
1999 #: build/C/man2/pciconfig_read.2:93
2001 "For B<pciconfig_iobase>(), \"hose\" value is NULL. For the other calls, "
2002 "could not find a slot."
2006 #: build/C/man2/pciconfig_read.2:98
2007 msgid "The system has not implemented these calls (B<CONFIG_PCI> not defined)."
2011 #: build/C/man2/pciconfig_read.2:98 build/C/man2/perf_event_open.2:2725
2013 msgid "B<EOPNOTSUPP>"
2017 #: build/C/man2/pciconfig_read.2:105
2019 "This return value is valid only for B<pciconfig_iobase>(). It is returned "
2020 "if the value for I<which> is invalid."
2024 #: build/C/man2/pciconfig_read.2:112
2026 "User does not have the B<CAP_SYS_ADMIN> capability. This does not apply to "
2027 "B<pciconfig_iobase>()."
2031 #: build/C/man2/pciconfig_read.2:114
2032 msgid "These calls are Linux-specific, available since Linux 2.0.26/2.1.11."
2036 #: build/C/man2/pciconfig_read.2:116
2037 msgid "B<capabilities>(7)"
2041 #: build/C/man2/perf_event_open.2:27
2043 msgid "PERF_EVENT_OPEN"
2047 #: build/C/man2/perf_event_open.2:27
2053 #: build/C/man2/perf_event_open.2:30
2054 msgid "perf_event_open - set up performance monitoring"
2058 #: build/C/man2/perf_event_open.2:34
2061 "B<#include E<lt>linux/perf_event.hE<gt>>\n"
2062 "B<#include E<lt>linux/hw_breakpoint.hE<gt>>\n"
2066 #: build/C/man2/perf_event_open.2:38
2069 "B<int perf_event_open(struct perf_event_attr *>I<attr>B<,>\n"
2070 "B< pid_t >I<pid>B<, int >I<cpu>B<, int >I<group_fd>B<,>\n"
2071 "B< unsigned long >I<flags>B<);>\n"
2075 #: build/C/man2/perf_event_open.2:47
2077 "Given a list of parameters, B<perf_event_open>() returns a file descriptor, "
2078 "for use in subsequent system calls (B<read>(2), B<mmap>(2), B<prctl>(2), "
2079 "B<fcntl>(2), etc.)."
2083 #: build/C/man2/perf_event_open.2:55
2085 "A call to B<perf_event_open>() creates a file descriptor that allows "
2086 "measuring performance information. Each file descriptor corresponds to one "
2087 "event that is measured; these can be grouped together to measure multiple "
2088 "events simultaneously."
2092 #: build/C/man2/perf_event_open.2:62
2094 "Events can be enabled and disabled in two ways: via B<ioctl>(2) and via "
2095 "B<prctl>(2). When an event is disabled it does not count or generate "
2096 "overflows but does continue to exist and maintain its count value."
2100 #: build/C/man2/perf_event_open.2:76
2102 "Events come in two flavors: counting and sampled. A I<counting> event is "
2103 "one that is used for counting the aggregate number of events that occur. In "
2104 "general, counting event results are gathered with a B<read>(2) call. A "
2105 "I<sampling> event periodically writes measurements to a buffer that can then "
2106 "be accessed via B<mmap>(2)."
2110 #: build/C/man2/perf_event_open.2:76
2116 #: build/C/man2/perf_event_open.2:83
2118 "The I<pid> and I<cpu> arguments allow specifying which process and CPU to "
2123 #: build/C/man2/perf_event_open.2:83
2125 msgid "B<pid == 0> and B<cpu == -1>"
2129 #: build/C/man2/perf_event_open.2:86
2130 msgid "This measures the calling process/thread on any CPU."
2134 #: build/C/man2/perf_event_open.2:86
2136 msgid "B<pid == 0> and B<cpu E<gt>= 0>"
2140 #: build/C/man2/perf_event_open.2:90
2142 "This measures the calling process/thread only when running on the specified "
2147 #: build/C/man2/perf_event_open.2:90
2149 msgid "B<pid E<gt> 0> and B<cpu == -1>"
2153 #: build/C/man2/perf_event_open.2:93
2154 msgid "This measures the specified process/thread on any CPU."
2158 #: build/C/man2/perf_event_open.2:93
2160 msgid "B<pid E<gt> 0> and B<cpu E<gt>= 0>"
2164 #: build/C/man2/perf_event_open.2:97
2166 "This measures the specified process/thread only when running on the "
2171 #: build/C/man2/perf_event_open.2:97
2173 msgid "B<pid == -1> and B<cpu E<gt>= 0>"
2177 #: build/C/man2/perf_event_open.2:105
2179 "This measures all processes/threads on the specified CPU. This requires "
2180 "B<CAP_SYS_ADMIN> capability or a I</proc/sys/kernel/perf_event_paranoid> "
2181 "value of less than 1."
2185 #: build/C/man2/perf_event_open.2:105
2187 msgid "B<pid == -1> and B<cpu == -1>"
2191 #: build/C/man2/perf_event_open.2:108
2192 msgid "This setting is invalid and will return an error."
2196 #: build/C/man2/perf_event_open.2:130
2198 "The I<group_fd> argument allows event groups to be created. An event group "
2199 "has one event which is the group leader. The leader is created first, with "
2200 "I<group_fd> = -1. The rest of the group members are created with subsequent "
2201 "B<perf_event_open>() calls with I<group_fd> being set to the file "
2202 "descriptor of the group leader. (A single event on its own is created with "
2203 "I<group_fd> = -1 and is considered to be a group with only 1 member.) An "
2204 "event group is scheduled onto the CPU as a unit: it will be put onto the CPU "
2205 "only if all of the events in the group can be put onto the CPU. This means "
2206 "that the values of the member events can be meaningfully compared\\(emadded, "
2207 "divided (to get ratios), and so on\\(emwith each other, since they have "
2208 "counted events for the same set of executed instructions."
2212 #: build/C/man2/perf_event_open.2:134
2214 "The I<flags> argument is formed by ORing together zero or more of the "
2219 #: build/C/man2/perf_event_open.2:134
2221 msgid "B<PERF_FLAG_FD_CLOEXEC> (since Linux 3.14)"
2224 #. commit a21b0b354d4ac39be691f51c53562e2c24443d9e
2226 #: build/C/man2/perf_event_open.2:151
2228 "This flag enables the close-on-exec flag for the created event file "
2229 "descriptor, so that the file descriptor is automatically closed on "
2230 "B<execve>(2). Setting the close-on-exec flags at creation time, rather than "
2231 "later with B<fcntl>(2), avoids potential race conditions where the calling "
2232 "thread invokes B<perf_event_open>() and B<fcntl>(2) at the same time as "
2233 "another thread calls B<fork>(2) then B<execve>(2)."
2237 #: build/C/man2/perf_event_open.2:151
2239 msgid "B<PERF_FLAG_FD_NO_GROUP>"
2243 #: build/C/man2/perf_event_open.2:159
2245 "This flag tells the event to ignore the I<group_fd> parameter except for the "
2246 "purpose of setting up output redirection using the B<PERF_FLAG_FD_OUTPUT> "
2251 #: build/C/man2/perf_event_open.2:159
2253 msgid "B<PERF_FLAG_FD_OUTPUT> (broken since Linux 2.6.35)"
2256 #. commit ac9721f3f54b27a16c7e1afb2481e7ee95a70318
2258 #: build/C/man2/perf_event_open.2:165
2260 "This flag re-routes the event's sampled output to instead be included in the "
2261 "mmap buffer of the event specified by I<group_fd>."
2265 #: build/C/man2/perf_event_open.2:165
2267 msgid "B<PERF_FLAG_PID_CGROUP> (since Linux 2.6.39)"
2270 #. commit e5d1367f17ba6a6fed5fd8b74e4d5720923e0c25
2272 #: build/C/man2/perf_event_open.2:189
2274 "This flag activates per-container system-wide monitoring. A container is an "
2275 "abstraction that isolates a set of resources for finer-grained control "
2276 "(CPUs, memory, etc.). In this mode, the event is measured only if the "
2277 "thread running on the monitored CPU belongs to the designated container "
2278 "(cgroup). The cgroup is identified by passing a file descriptor opened on "
2279 "its directory in the cgroupfs filesystem. For instance, if the cgroup to "
2280 "monitor is called I<test>, then a file descriptor opened on "
2281 "I</dev/cgroup/test> (assuming cgroupfs is mounted on I</dev/cgroup>) must "
2282 "be passed as the I<pid> parameter. cgroup monitoring is available only for "
2283 "system-wide events and may therefore require extra permissions."
2287 #: build/C/man2/perf_event_open.2:194
2289 "The I<perf_event_attr> structure provides detailed configuration information "
2290 "for the event being created."
2294 #: build/C/man2/perf_event_open.2:201
2297 "struct perf_event_attr {\n"
2298 " __u32 type; /* Type of event */\n"
2299 " __u32 size; /* Size of attribute structure */\n"
2300 " __u64 config; /* Type-specific configuration */\n"
2304 #: build/C/man2/perf_event_open.2:206
2308 " __u64 sample_period; /* Period of sampling */\n"
2309 " __u64 sample_freq; /* Frequency of sampling */\n"
2314 #: build/C/man2/perf_event_open.2:209
2317 " __u64 sample_type; /* Specifies values included in sample */\n"
2318 " __u64 read_format; /* Specifies values returned in read */\n"
2322 #: build/C/man2/perf_event_open.2:237
2325 " __u64 disabled : 1, /* off by default */\n"
2326 " inherit : 1, /* children inherit it */\n"
2327 " pinned : 1, /* must always be on PMU */\n"
2328 " exclusive : 1, /* only group on PMU */\n"
2329 " exclude_user : 1, /* don't count user */\n"
2330 " exclude_kernel : 1, /* don't count kernel */\n"
2331 " exclude_hv : 1, /* don't count hypervisor */\n"
2332 " exclude_idle : 1, /* don't count when idle */\n"
2333 " mmap : 1, /* include mmap data */\n"
2334 " comm : 1, /* include comm data */\n"
2335 " freq : 1, /* use freq, not period */\n"
2336 " inherit_stat : 1, /* per task counts */\n"
2337 " enable_on_exec : 1, /* next exec enables */\n"
2338 " task : 1, /* trace fork/exit */\n"
2339 " watermark : 1, /* wakeup_watermark */\n"
2340 " precise_ip : 2, /* skid constraint */\n"
2341 " mmap_data : 1, /* non-exec mmap data */\n"
2342 " sample_id_all : 1, /* sample_type all events */\n"
2343 " exclude_host : 1, /* don't count in host */\n"
2344 " exclude_guest : 1, /* don't count in guest */\n"
2345 " exclude_callchain_kernel : 1,\n"
2346 " /* exclude kernel callchains */\n"
2347 " exclude_callchain_user : 1,\n"
2348 " /* exclude user callchains */\n"
2349 " mmap2 : 1, /* include mmap with inode data */\n"
2350 " comm_exec : 1, /* flag comm events that are due to exec "
2352 " __reserved_1 : 39;\n"
2356 #: build/C/man2/perf_event_open.2:242
2360 " __u32 wakeup_events; /* wakeup every n events */\n"
2361 " __u32 wakeup_watermark; /* bytes before wakeup */\n"
2366 #: build/C/man2/perf_event_open.2:244
2368 msgid " __u32 bp_type; /* breakpoint type */\n"
2372 #: build/C/man2/perf_event_open.2:249
2376 " __u64 bp_addr; /* breakpoint address */\n"
2377 " __u64 config1; /* extension of config */\n"
2382 #: build/C/man2/perf_event_open.2:259
2386 " __u64 bp_len; /* breakpoint length */\n"
2387 " __u64 config2; /* extension of config1 */\n"
2389 " __u64 branch_sample_type; /* enum perf_branch_sample_type */\n"
2390 " __u64 sample_regs_user; /* user regs to dump on samples */\n"
2391 " __u32 sample_stack_user; /* size of stack to dump on\n"
2393 " __u32 __reserved_2; /* Align to u64 */\n"
2397 #: build/C/man2/perf_event_open.2:261
2403 #: build/C/man2/perf_event_open.2:267
2405 "The fields of the I<perf_event_attr> structure are described in more detail "
2410 #: build/C/man2/perf_event_open.2:267 build/C/man2/perf_event_open.2:1669
2416 #: build/C/man2/perf_event_open.2:271
2418 "This field specifies the overall event type. It has one of the following "
2423 #: build/C/man2/perf_event_open.2:272
2425 msgid "B<PERF_TYPE_HARDWARE>"
2429 #: build/C/man2/perf_event_open.2:279
2431 "This indicates one of the \"generalized\" hardware events provided by the "
2432 "kernel. See the I<config> field definition for more details."
2436 #: build/C/man2/perf_event_open.2:279
2438 msgid "B<PERF_TYPE_SOFTWARE>"
2442 #: build/C/man2/perf_event_open.2:283
2444 "This indicates one of the software-defined events provided by the kernel "
2445 "(even if no hardware support is available)."
2449 #: build/C/man2/perf_event_open.2:283
2451 msgid "B<PERF_TYPE_TRACEPOINT>"
2455 #: build/C/man2/perf_event_open.2:287
2457 "This indicates a tracepoint provided by the kernel tracepoint "
2462 #: build/C/man2/perf_event_open.2:287
2464 msgid "B<PERF_TYPE_HW_CACHE>"
2468 #: build/C/man2/perf_event_open.2:293
2470 "This indicates a hardware cache event. This has a special encoding, "
2471 "described in the I<config> field definition."
2475 #: build/C/man2/perf_event_open.2:293
2477 msgid "B<PERF_TYPE_RAW>"
2481 #: build/C/man2/perf_event_open.2:297
2483 "This indicates a \"raw\" implementation-specific event in the I<config> "
2488 #: build/C/man2/perf_event_open.2:297
2490 msgid "B<PERF_TYPE_BREAKPOINT> (since Linux 2.6.33)"
2493 #. commit 24f1e32c60c45c89a997c73395b69c8af6f0a84e
2495 #: build/C/man2/perf_event_open.2:303
2497 "This indicates a hardware breakpoint as provided by the CPU. Breakpoints "
2498 "can be read/write accesses to an address as well as execution of an "
2499 "instruction address."
2503 #: build/C/man2/perf_event_open.2:303
2508 #. commit 2e80a82a49c4c7eca4e35734380f28298ba5db19
2510 #: build/C/man2/perf_event_open.2:323
2512 "Since Linux 2.6.38, B<perf_event_open>() can support multiple PMUs. To "
2513 "enable this, a value exported by the kernel can be used in the I<type> field "
2514 "to indicate which PMU to use. The value to use can be found in the sysfs "
2515 "filesystem: there is a subdirectory per PMU instance under "
2516 "I</sys/bus/event_source/devices>. In each subdirectory there is a I<type> "
2517 "file whose content is an integer that can be used in the I<type> field. For "
2518 "instance, I</sys/bus/event_source/devices/cpu/type> contains the value for "
2519 "the core CPU PMU, which is usually 4."
2523 #: build/C/man2/perf_event_open.2:324 build/C/man2/perf_event_open.2:1601
2529 #: build/C/man2/perf_event_open.2:333
2531 "The size of the I<perf_event_attr> structure for forward/backward "
2532 "compatibility. Set this using I<sizeof(struct perf_event_attr)> to allow "
2533 "the kernel to see the struct size at the time of compilation."
2536 #. commit cb5d76999029ae7a517cb07dfa732c1b5a934fc2
2537 #. this was added much later when PERF_ATTR_SIZE_VER2 happened
2538 #. but the actual attr_size had increased in 2.6.33
2539 #. commit cb5d76999029ae7a517cb07dfa732c1b5a934fc2
2540 #. commit 1659d129ed014b715b0b2120e6fd929bdd33ed03
2542 #: build/C/man2/perf_event_open.2:353
2544 "The related define B<PERF_ATTR_SIZE_VER0> is set to 64; this was the size of "
2545 "the first published struct. B<PERF_ATTR_SIZE_VER1> is 72, corresponding to "
2546 "the addition of breakpoints in Linux 2.6.33. B<PERF_ATTR_SIZE_VER2> is 80 "
2547 "corresponding to the addition of branch sampling in Linux 3.4. "
2548 "B<PERF_ATTR_SIZE_VER3> is 96 corresponding to the addition of "
2549 "I<sample_regs_user> and I<sample_stack_user> in Linux 3.7."
2553 #: build/C/man2/perf_event_open.2:353
2559 #: build/C/man2/perf_event_open.2:364
2561 "This specifies which event you want, in conjunction with the I<type> field. "
2562 "The I<config1> and I<config2> fields are also taken into account in cases "
2563 "where 64 bits is not enough to fully specify the event. The encoding of "
2564 "these fields are event dependent."
2568 #: build/C/man2/perf_event_open.2:375
2570 "There are various ways to set the I<config> field that are dependent on the "
2571 "value of the previously described I<type> field. What follows are various "
2572 "possible settings for I<config> separated out by I<type>."
2576 #: build/C/man2/perf_event_open.2:385
2578 "If I<type> is B<PERF_TYPE_HARDWARE>, we are measuring one of the generalized "
2579 "hardware CPU events. Not all of these are available on all platforms. Set "
2580 "I<config> to one of the following:"
2584 #: build/C/man2/perf_event_open.2:386
2586 msgid "B<PERF_COUNT_HW_CPU_CYCLES>"
2590 #: build/C/man2/perf_event_open.2:390
2591 msgid "Total cycles. Be wary of what happens during CPU frequency scaling."
2595 #: build/C/man2/perf_event_open.2:390
2597 msgid "B<PERF_COUNT_HW_INSTRUCTIONS>"
2601 #: build/C/man2/perf_event_open.2:395
2603 "Retired instructions. Be careful, these can be affected by various issues, "
2604 "most notably hardware interrupt counts."
2608 #: build/C/man2/perf_event_open.2:395
2610 msgid "B<PERF_COUNT_HW_CACHE_REFERENCES>"
2614 #: build/C/man2/perf_event_open.2:402
2616 "Cache accesses. Usually this indicates Last Level Cache accesses but this "
2617 "may vary depending on your CPU. This may include prefetches and coherency "
2618 "messages; again this depends on the design of your CPU."
2622 #: build/C/man2/perf_event_open.2:402
2624 msgid "B<PERF_COUNT_HW_CACHE_MISSES>"
2628 #: build/C/man2/perf_event_open.2:409
2630 "Cache misses. Usually this indicates Last Level Cache misses; this is "
2631 "intended to be used in conjunction with the "
2632 "B<PERF_COUNT_HW_CACHE_REFERENCES> event to calculate cache miss rates."
2636 #: build/C/man2/perf_event_open.2:409
2638 msgid "B<PERF_COUNT_HW_BRANCH_INSTRUCTIONS>"
2641 #. commit f287d332ce835f77a4f5077d2c0ef1e3f9ea42d2
2643 #: build/C/man2/perf_event_open.2:415
2645 "Retired branch instructions. Prior to Linux 2.6.35, this used the wrong "
2646 "event on AMD processors."
2650 #: build/C/man2/perf_event_open.2:415
2652 msgid "B<PERF_COUNT_HW_BRANCH_MISSES>"
2656 #: build/C/man2/perf_event_open.2:418
2657 msgid "Mispredicted branch instructions."
2661 #: build/C/man2/perf_event_open.2:418
2663 msgid "B<PERF_COUNT_HW_BUS_CYCLES>"
2667 #: build/C/man2/perf_event_open.2:421
2668 msgid "Bus cycles, which can be different from total cycles."
2672 #: build/C/man2/perf_event_open.2:421
2674 msgid "B<PERF_COUNT_HW_STALLED_CYCLES_FRONTEND> (since Linux 3.0)"
2677 #. commit 8f62242246351b5a4bc0c1f00c0c7003edea128a
2679 #: build/C/man2/perf_event_open.2:425
2680 msgid "Stalled cycles during issue."
2684 #: build/C/man2/perf_event_open.2:425
2686 msgid "B<PERF_COUNT_HW_STALLED_CYCLES_BACKEND> (since Linux 3.0)"
2689 #. commit 8f62242246351b5a4bc0c1f00c0c7003edea128a
2691 #: build/C/man2/perf_event_open.2:429
2692 msgid "Stalled cycles during retirement."
2696 #: build/C/man2/perf_event_open.2:429
2698 msgid "B<PERF_COUNT_HW_REF_CPU_CYCLES> (since Linux 3.3)"
2701 #. commit c37e17497e01fc0f5d2d6feb5723b210b3ab8890
2703 #: build/C/man2/perf_event_open.2:433
2704 msgid "Total cycles; not affected by CPU frequency scaling."
2708 #: build/C/man2/perf_event_open.2:443
2710 "If I<type> is B<PERF_TYPE_SOFTWARE>, we are measuring software events "
2711 "provided by the kernel. Set I<config> to one of the following:"
2715 #: build/C/man2/perf_event_open.2:444
2717 msgid "B<PERF_COUNT_SW_CPU_CLOCK>"
2721 #: build/C/man2/perf_event_open.2:447
2722 msgid "This reports the CPU clock, a high-resolution per-CPU timer."
2726 #: build/C/man2/perf_event_open.2:447
2728 msgid "B<PERF_COUNT_SW_TASK_CLOCK>"
2732 #: build/C/man2/perf_event_open.2:450
2733 msgid "This reports a clock count specific to the task that is running."
2737 #: build/C/man2/perf_event_open.2:450
2739 msgid "B<PERF_COUNT_SW_PAGE_FAULTS>"
2743 #: build/C/man2/perf_event_open.2:453
2744 msgid "This reports the number of page faults."
2748 #: build/C/man2/perf_event_open.2:453
2750 msgid "B<PERF_COUNT_SW_CONTEXT_SWITCHES>"
2753 #. commit e49a5bd38159dfb1928fd25b173bc9de4bbadb21
2755 #: build/C/man2/perf_event_open.2:459
2757 "This counts context switches. Until Linux 2.6.34, these were all reported "
2758 "as user-space events, after that they are reported as happening in the "
2763 #: build/C/man2/perf_event_open.2:459
2765 msgid "B<PERF_COUNT_SW_CPU_MIGRATIONS>"
2769 #: build/C/man2/perf_event_open.2:463
2770 msgid "This reports the number of times the process has migrated to a new CPU."
2774 #: build/C/man2/perf_event_open.2:463
2776 msgid "B<PERF_COUNT_SW_PAGE_FAULTS_MIN>"
2780 #: build/C/man2/perf_event_open.2:467
2782 "This counts the number of minor page faults. These did not require disk I/O "
2787 #: build/C/man2/perf_event_open.2:467
2789 msgid "B<PERF_COUNT_SW_PAGE_FAULTS_MAJ>"
2793 #: build/C/man2/perf_event_open.2:471
2795 "This counts the number of major page faults. These required disk I/O to "
2800 #: build/C/man2/perf_event_open.2:471
2802 msgid "B<PERF_COUNT_SW_ALIGNMENT_FAULTS> (since Linux 2.6.33)"
2805 #. commit f7d7986060b2890fc26db6ab5203efbd33aa2497
2807 #: build/C/man2/perf_event_open.2:478
2809 "This counts the number of alignment faults. These happen when unaligned "
2810 "memory accesses happen; the kernel can handle these but it reduces "
2811 "performance. This happens only on some architectures (never on x86)."
2815 #: build/C/man2/perf_event_open.2:478
2817 msgid "B<PERF_COUNT_SW_EMULATION_FAULTS> (since Linux 2.6.33)"
2820 #. commit f7d7986060b2890fc26db6ab5203efbd33aa2497
2822 #: build/C/man2/perf_event_open.2:485
2824 "This counts the number of emulation faults. The kernel sometimes traps on "
2825 "unimplemented instructions and emulates them for user space. This can "
2826 "negatively impact performance."
2830 #: build/C/man2/perf_event_open.2:485
2832 msgid "B<PERF_COUNT_SW_DUMMY> (since Linux 3.12)"
2835 #. commit fa0097ee690693006ab1aea6c01ad3c851b65c77
2837 #: build/C/man2/perf_event_open.2:493
2839 "This is a placeholder event that counts nothing. Informational sample "
2840 "record types such as mmap or comm must be associated with an active event. "
2841 "This dummy event allows gathering such records without requiring a counting "
2846 #: build/C/man2/perf_event_open.2:506
2848 "If I<type> is B<PERF_TYPE_TRACEPOINT>, then we are measuring kernel "
2849 "tracepoints. The value to use in I<config> can be obtained from under "
2850 "debugfs I<tracing/events/*/*/id> if ftrace is enabled in the kernel."
2854 #: build/C/man2/perf_event_open.2:517
2856 "If I<type> is B<PERF_TYPE_HW_CACHE>, then we are measuring a hardware CPU "
2857 "cache event. To calculate the appropriate I<config> value use the following "
2862 #: build/C/man2/perf_event_open.2:522
2865 " (perf_hw_cache_id) | (perf_hw_cache_op_id E<lt>E<lt> 8) |\n"
2866 " (perf_hw_cache_op_result_id E<lt>E<lt> 16)\n"
2870 #: build/C/man2/perf_event_open.2:527
2871 msgid "where I<perf_hw_cache_id> is one of:"
2875 #: build/C/man2/perf_event_open.2:528
2877 msgid "B<PERF_COUNT_HW_CACHE_L1D>"
2881 #: build/C/man2/perf_event_open.2:531
2882 msgid "for measuring Level 1 Data Cache"
2886 #: build/C/man2/perf_event_open.2:531
2888 msgid "B<PERF_COUNT_HW_CACHE_L1I>"
2892 #: build/C/man2/perf_event_open.2:534
2893 msgid "for measuring Level 1 Instruction Cache"
2897 #: build/C/man2/perf_event_open.2:534
2899 msgid "B<PERF_COUNT_HW_CACHE_LL>"
2903 #: build/C/man2/perf_event_open.2:537
2904 msgid "for measuring Last-Level Cache"
2908 #: build/C/man2/perf_event_open.2:537
2910 msgid "B<PERF_COUNT_HW_CACHE_DTLB>"
2914 #: build/C/man2/perf_event_open.2:540
2915 msgid "for measuring the Data TLB"
2919 #: build/C/man2/perf_event_open.2:540
2921 msgid "B<PERF_COUNT_HW_CACHE_ITLB>"
2925 #: build/C/man2/perf_event_open.2:543
2926 msgid "for measuring the Instruction TLB"
2930 #: build/C/man2/perf_event_open.2:543
2932 msgid "B<PERF_COUNT_HW_CACHE_BPU>"
2936 #: build/C/man2/perf_event_open.2:546
2937 msgid "for measuring the branch prediction unit"
2941 #: build/C/man2/perf_event_open.2:546
2943 msgid "B<PERF_COUNT_HW_CACHE_NODE> (since Linux 3.1)"
2946 #. commit 89d6c0b5bdbb1927775584dcf532d98b3efe1477
2948 #: build/C/man2/perf_event_open.2:550
2949 msgid "for measuring local memory accesses"
2953 #: build/C/man2/perf_event_open.2:555
2954 msgid "and I<perf_hw_cache_op_id> is one of"
2958 #: build/C/man2/perf_event_open.2:556
2960 msgid "B<PERF_COUNT_HW_CACHE_OP_READ>"
2964 #: build/C/man2/perf_event_open.2:559
2965 msgid "for read accesses"
2969 #: build/C/man2/perf_event_open.2:559
2971 msgid "B<PERF_COUNT_HW_CACHE_OP_WRITE>"
2975 #: build/C/man2/perf_event_open.2:562
2976 msgid "for write accesses"
2980 #: build/C/man2/perf_event_open.2:562
2982 msgid "B<PERF_COUNT_HW_CACHE_OP_PREFETCH>"
2986 #: build/C/man2/perf_event_open.2:565
2987 msgid "for prefetch accesses"
2991 #: build/C/man2/perf_event_open.2:570
2992 msgid "and I<perf_hw_cache_op_result_id> is one of"
2996 #: build/C/man2/perf_event_open.2:571
2998 msgid "B<PERF_COUNT_HW_CACHE_RESULT_ACCESS>"
3002 #: build/C/man2/perf_event_open.2:574
3003 msgid "to measure accesses"
3007 #: build/C/man2/perf_event_open.2:574
3009 msgid "B<PERF_COUNT_HW_CACHE_RESULT_MISS>"
3013 #: build/C/man2/perf_event_open.2:577
3014 msgid "to measure misses"
3018 #: build/C/man2/perf_event_open.2:595
3020 "If I<type> is B<PERF_TYPE_RAW>, then a custom \"raw\" I<config> value is "
3021 "needed. Most CPUs support events that are not covered by the "
3022 "\"generalized\" events. These are implementation defined; see your CPU "
3023 "manual (for example the Intel Volume 3B documentation or the AMD BIOS and "
3024 "Kernel Developer Guide). The libpfm4 library can be used to translate from "
3025 "the name in the architectural manuals to the raw hex value "
3026 "B<perf_event_open>() expects in this field."
3030 #: build/C/man2/perf_event_open.2:604
3032 "If I<type> is B<PERF_TYPE_BREAKPOINT>, then leave I<config> set to zero. "
3033 "Its parameters are set in other places."
3037 #: build/C/man2/perf_event_open.2:605
3039 msgid "I<sample_period>, I<sample_freq>"
3043 #: build/C/man2/perf_event_open.2:617
3045 "A \"sampling\" event is one that generates an overflow notification every N "
3046 "events, where N is given by I<sample_period>. A sampling event has "
3047 "I<sample_period> E<gt> 0. When an overflow occurs, requested data is "
3048 "recorded in the mmap buffer. The I<sample_type> field controls what data is "
3049 "recorded on each overflow."
3053 #: build/C/man2/perf_event_open.2:627
3055 "I<sample_freq> can be used if you wish to use frequency rather than period. "
3056 "In this case, you set the I<freq> flag. The kernel will adjust the sampling "
3057 "period to try and achieve the desired rate. The rate of adjustment is a "
3062 #: build/C/man2/perf_event_open.2:627
3064 msgid "I<sample_type>"
3068 #: build/C/man2/perf_event_open.2:639
3070 "The various bits in this field specify which values to include in the "
3071 "sample. They will be recorded in a ring-buffer, which is available to user "
3072 "space using B<mmap>(2). The order in which the values are saved in the "
3073 "sample are documented in the MMAP Layout subsection below; it is not the "
3074 "I<enum perf_event_sample_format> order."
3078 #: build/C/man2/perf_event_open.2:640
3080 msgid "B<PERF_SAMPLE_IP>"
3084 #: build/C/man2/perf_event_open.2:643
3085 msgid "Records instruction pointer."
3089 #: build/C/man2/perf_event_open.2:643
3091 msgid "B<PERF_SAMPLE_TID>"
3095 #: build/C/man2/perf_event_open.2:646
3096 msgid "Records the process and thread IDs."
3100 #: build/C/man2/perf_event_open.2:646
3102 msgid "B<PERF_SAMPLE_TIME>"
3106 #: build/C/man2/perf_event_open.2:649
3107 msgid "Records a timestamp."
3111 #: build/C/man2/perf_event_open.2:649
3113 msgid "B<PERF_SAMPLE_ADDR>"
3117 #: build/C/man2/perf_event_open.2:652
3118 msgid "Records an address, if applicable."
3122 #: build/C/man2/perf_event_open.2:652
3124 msgid "B<PERF_SAMPLE_READ>"
3128 #: build/C/man2/perf_event_open.2:655
3129 msgid "Record counter values for all events in a group, not just the group leader."
3133 #: build/C/man2/perf_event_open.2:655
3135 msgid "B<PERF_SAMPLE_CALLCHAIN>"
3139 #: build/C/man2/perf_event_open.2:658
3140 msgid "Records the callchain (stack backtrace)."
3144 #: build/C/man2/perf_event_open.2:658
3146 msgid "B<PERF_SAMPLE_ID>"
3150 #: build/C/man2/perf_event_open.2:661
3151 msgid "Records a unique ID for the opened event's group leader."
3155 #: build/C/man2/perf_event_open.2:661
3157 msgid "B<PERF_SAMPLE_CPU>"
3161 #: build/C/man2/perf_event_open.2:664
3162 msgid "Records CPU number."
3166 #: build/C/man2/perf_event_open.2:664
3168 msgid "B<PERF_SAMPLE_PERIOD>"
3172 #: build/C/man2/perf_event_open.2:667
3173 msgid "Records the current sampling period."
3177 #: build/C/man2/perf_event_open.2:667
3179 msgid "B<PERF_SAMPLE_STREAM_ID>"
3183 #: build/C/man2/perf_event_open.2:675
3185 "Records a unique ID for the opened event. Unlike B<PERF_SAMPLE_ID> the "
3186 "actual ID is returned, not the group leader. This ID is the same as the one "
3187 "returned by B<PERF_FORMAT_ID>."
3191 #: build/C/man2/perf_event_open.2:675
3193 msgid "B<PERF_SAMPLE_RAW>"
3197 #: build/C/man2/perf_event_open.2:679
3199 "Records additional data, if applicable. Usually returned by tracepoint "
3204 #: build/C/man2/perf_event_open.2:679
3206 msgid "B<PERF_SAMPLE_BRANCH_STACK> (since Linux 3.4)"
3209 #. commit bce38cd53e5ddba9cb6d708c4ef3d04a4016ec7e
3211 #: build/C/man2/perf_event_open.2:685
3213 "This provides a record of recent branches, as provided by CPU branch "
3214 "sampling hardware (such as Intel Last Branch Record). Not all hardware "
3215 "supports this feature."
3219 #: build/C/man2/perf_event_open.2:689
3221 "See the I<branch_sample_type> field for how to filter which branches are "
3226 #: build/C/man2/perf_event_open.2:689
3228 msgid "B<PERF_SAMPLE_REGS_USER> (since Linux 3.7)"
3231 #. commit 4018994f3d8785275ef0e7391b75c3462c029e56
3233 #: build/C/man2/perf_event_open.2:694
3235 "Records the current user-level CPU register state (the values in the process "
3236 "before the kernel was called)."
3240 #: build/C/man2/perf_event_open.2:694
3242 msgid "B<PERF_SAMPLE_STACK_USER> (since Linux 3.7)"
3245 #. commit c5ebcedb566ef17bda7b02686e0d658a7bb42ee7
3247 #: build/C/man2/perf_event_open.2:698
3248 msgid "Records the user level stack, allowing stack unwinding."
3252 #: build/C/man2/perf_event_open.2:698
3254 msgid "B<PERF_SAMPLE_WEIGHT> (since Linux 3.10)"
3257 #. commit c3feedf2aaf9ac8bad6f19f5d21e4ee0b4b87e9c
3259 #: build/C/man2/perf_event_open.2:705
3261 "Records a hardware provided weight value that expresses how costly the "
3262 "sampled event was. This allows the hardware to highlight expensive events "
3267 #: build/C/man2/perf_event_open.2:705
3269 msgid "B<PERF_SAMPLE_DATA_SRC> (since Linux 3.10)"
3272 #. commit d6be9ad6c960f43800a6f118932bc8a5a4eadcd1
3274 #: build/C/man2/perf_event_open.2:712
3276 "Records the data source: where in the memory hierarchy the data associated "
3277 "with the sampled instruction came from. This is available only if the "
3278 "underlying hardware supports this feature."
3282 #: build/C/man2/perf_event_open.2:712
3284 msgid "B<PERF_SAMPLE_IDENTIFIER> (since Linux 3.12)"
3287 #. commit ff3d527cebc1fa3707c617bfe9e74f53fcfb0955
3289 #: build/C/man2/perf_event_open.2:720
3291 "Places the B<SAMPLE_ID> value in a fixed position in the record, either at "
3292 "the beginning (for sample events) or at the end (if a non-sample event)."
3296 #: build/C/man2/perf_event_open.2:732
3298 "This was necessary because a sample stream may have records from various "
3299 "different event sources with different I<sample_type> settings. Parsing the "
3300 "event stream properly was not possible because the format of the record was "
3301 "needed to find B<SAMPLE_ID>, but the format could not be found without "
3302 "knowing what event the sample belonged to (causing a circular dependency)."
3306 #: build/C/man2/perf_event_open.2:742
3308 "The B<PERF_SAMPLE_IDENTIFIER> setting makes the event stream always parsable "
3309 "by putting B<SAMPLE_ID> in a fixed location, even though it means having "
3310 "duplicate B<SAMPLE_ID> values in records."
3314 #: build/C/man2/perf_event_open.2:742
3316 msgid "B<PERF_SAMPLE_TRANSACTION> (since Linux 3.13)"
3319 #. commit fdfbbd07e91f8fe387140776f3fd94605f0c89e5
3321 #: build/C/man2/perf_event_open.2:747
3323 "Records reasons for transactional memory abort events (for example, from "
3324 "Intel TSX transactional memory support)."
3328 #: build/C/man2/perf_event_open.2:755
3330 "The I<precise_ip> setting must be greater than 0 and a transactional memory "
3331 "abort event must be measured or no values will be recorded. Also note that "
3332 "some perf_event measurements, such as sampled cycle counting, may cause "
3333 "extraneous aborts (by causing an interrupt during a transaction)."
3337 #: build/C/man2/perf_event_open.2:756
3339 msgid "I<read_format>"
3343 #: build/C/man2/perf_event_open.2:763
3345 "This field specifies the format of the data returned by B<read>(2) on a "
3346 "B<perf_event_open>() file descriptor."
3350 #: build/C/man2/perf_event_open.2:764
3352 msgid "B<PERF_FORMAT_TOTAL_TIME_ENABLED>"
3356 #: build/C/man2/perf_event_open.2:771
3358 "Adds the 64-bit I<time_enabled> field. This can be used to calculate "
3359 "estimated totals if the PMU is overcommitted and multiplexing is happening."
3363 #: build/C/man2/perf_event_open.2:771
3365 msgid "B<PERF_FORMAT_TOTAL_TIME_RUNNING>"
3369 #: build/C/man2/perf_event_open.2:778
3371 "Adds the 64-bit I<time_running> field. This can be used to calculate "
3372 "estimated totals if the PMU is overcommitted and multiplexing is happening."
3376 #: build/C/man2/perf_event_open.2:778
3378 msgid "B<PERF_FORMAT_ID>"
3382 #: build/C/man2/perf_event_open.2:781
3383 msgid "Adds a 64-bit unique value that corresponds to the event group."
3387 #: build/C/man2/perf_event_open.2:781
3389 msgid "B<PERF_FORMAT_GROUP>"
3393 #: build/C/man2/perf_event_open.2:784
3394 msgid "Allows all counter values in an event group to be read with one read."
3398 #: build/C/man2/perf_event_open.2:785
3404 #: build/C/man2/perf_event_open.2:795
3406 "The I<disabled> bit specifies whether the counter starts out disabled or "
3407 "enabled. If disabled, the event can later be enabled by B<ioctl>(2), "
3408 "B<prctl>(2), or I<enable_on_exec>."
3412 #: build/C/man2/perf_event_open.2:806
3414 "When creating an event group, typically the group leader is initialized with "
3415 "I<disabled> set to 1 and any child events are initialized with I<disabled> "
3416 "set to 0. Despite I<disabled> being 0, the child events will not start "
3417 "until the group leader is enabled."
3421 #: build/C/man2/perf_event_open.2:806
3427 #: build/C/man2/perf_event_open.2:815
3429 "The I<inherit> bit specifies that this counter should count events of child "
3430 "tasks as well as the task specified. This applies only to new children, not "
3431 "to any existing children at the time the counter is created (nor to any new "
3432 "children of existing children)."
3436 #: build/C/man2/perf_event_open.2:820
3438 "Inherit does not work for some combinations of I<read_format>s, such as "
3439 "B<PERF_FORMAT_GROUP>."
3443 #: build/C/man2/perf_event_open.2:820
3449 #: build/C/man2/perf_event_open.2:833
3451 "The I<pinned> bit specifies that the counter should always be on the CPU if "
3452 "at all possible. It applies only to hardware counters and only to group "
3453 "leaders. If a pinned counter cannot be put onto the CPU (e.g., because "
3454 "there are not enough hardware counters or because of a conflict with some "
3455 "other event), then the counter goes into an 'error' state, where reads "
3456 "return end-of-file (i.e., B<read>(2) returns 0) until the counter is "
3457 "subsequently enabled or disabled."
3461 #: build/C/man2/perf_event_open.2:833
3463 msgid "I<exclusive>"
3467 #: build/C/man2/perf_event_open.2:842
3469 "The I<exclusive> bit specifies that when this counter's group is on the CPU, "
3470 "it should be the only group using the CPU's counters. In the future this "
3471 "may allow monitoring programs to support PMU features that need to run alone "
3472 "so that they do not disrupt other hardware counters."
3476 #: build/C/man2/perf_event_open.2:849
3478 "Note that many unexpected situations may prevent events with the "
3479 "I<exclusive> bit set from ever running. This includes any users running a "
3480 "system-wide measurement as well as any kernel use of the performance "
3481 "counters (including the commonly enabled NMI Watchdog Timer interface)."
3485 #: build/C/man2/perf_event_open.2:849
3487 msgid "I<exclude_user>"
3491 #: build/C/man2/perf_event_open.2:852
3492 msgid "If this bit is set, the count excludes events that happen in user space."
3496 #: build/C/man2/perf_event_open.2:852
3498 msgid "I<exclude_kernel>"
3502 #: build/C/man2/perf_event_open.2:855
3503 msgid "If this bit is set, the count excludes events that happen in kernel-space."
3507 #: build/C/man2/perf_event_open.2:855
3509 msgid "I<exclude_hv>"
3513 #: build/C/man2/perf_event_open.2:863
3515 "If this bit is set, the count excludes events that happen in the "
3516 "hypervisor. This is mainly for PMUs that have built-in support for handling "
3517 "this (such as POWER). Extra support is needed for handling hypervisor "
3518 "measurements on most machines."
3522 #: build/C/man2/perf_event_open.2:863
3524 msgid "I<exclude_idle>"
3528 #: build/C/man2/perf_event_open.2:866
3529 msgid "If set, don't count when the CPU is idle."
3533 #: build/C/man2/perf_event_open.2:866
3539 #: build/C/man2/perf_event_open.2:880
3541 "The I<mmap> bit enables generation of B<PERF_RECORD_MMAP> samples for every "
3542 "B<mmap>(2) call that has B<PROT_EXEC> set. This allows tools to notice new "
3543 "executable code being mapped into a program (dynamic shared libraries for "
3544 "example) so that addresses can be mapped back to the original code."
3548 #: build/C/man2/perf_event_open.2:880 build/C/man2/perf_event_open.2:1761
3553 #. commit 82b897782d10fcc4930c9d4a15b175348fdd2871
3555 #: build/C/man2/perf_event_open.2:899
3557 "The I<comm> bit enables tracking of process command name as modified by the "
3558 "B<exec>(2) and B<prctl>(PR_SET_NAME) system calls as well as writing to "
3559 "I</proc/self/comm>. If the I<comm_exec> flag is also successfully set "
3560 "(possible since Linux 3.16), then the misc flag "
3561 "B<PERF_RECORD_MISC_COMM_EXEC> can be used to differentiate the B<exec>(2) "
3562 "case from the others."
3566 #: build/C/man2/perf_event_open.2:899
3572 #: build/C/man2/perf_event_open.2:906
3574 "If this bit is set, then I<sample_frequency> not I<sample_period> is used "
3575 "when setting up the sampling interval."
3579 #: build/C/man2/perf_event_open.2:906
3581 msgid "I<inherit_stat>"
3585 #: build/C/man2/perf_event_open.2:913
3587 "This bit enables saving of event counts on context switch for inherited "
3588 "tasks. This is meaningful only if the I<inherit> field is set."
3592 #: build/C/man2/perf_event_open.2:913
3594 msgid "I<enable_on_exec>"
3598 #: build/C/man2/perf_event_open.2:918
3600 "If this bit is set, a counter is automatically enabled after a call to "
3605 #: build/C/man2/perf_event_open.2:918
3611 #: build/C/man2/perf_event_open.2:922
3613 "If this bit is set, then fork/exit notifications are included in the ring "
3618 #: build/C/man2/perf_event_open.2:922
3620 msgid "I<watermark>"
3624 #: build/C/man2/perf_event_open.2:930
3626 "If set, have an overflow notification happen when we cross the "
3627 "I<wakeup_watermark> boundary. Otherwise, overflow notifications happen "
3628 "after I<wakeup_events> samples."
3632 #: build/C/man2/perf_event_open.2:930
3634 msgid "I<precise_ip> (since Linux 2.6.35)"
3637 #. commit ab608344bcbde4f55ec4cd911b686b0ce3eae076
3639 #: build/C/man2/perf_event_open.2:941
3641 "This controls the amount of skid. Skid is how many instructions execute "
3642 "between an event of interest happening and the kernel being able to stop and "
3643 "record the event. Smaller skid is better and allows more accurate reporting "
3644 "of which events correspond to which instructions, but hardware is often "
3645 "limited with how small this can be."
3649 #: build/C/man2/perf_event_open.2:943
3650 msgid "The values of this are the following:"
3654 #: build/C/man2/perf_event_open.2:944
3660 #: build/C/man2/perf_event_open.2:948
3661 msgid "B<SAMPLE_IP> can have arbitrary skid."
3665 #: build/C/man2/perf_event_open.2:948
3671 #: build/C/man2/perf_event_open.2:952
3672 msgid "B<SAMPLE_IP> must have constant skid."
3676 #: build/C/man2/perf_event_open.2:952
3682 #: build/C/man2/perf_event_open.2:956
3683 msgid "B<SAMPLE_IP> requested to have 0 skid."
3687 #: build/C/man2/perf_event_open.2:956
3693 #: build/C/man2/perf_event_open.2:962
3694 msgid "B<SAMPLE_IP> must have 0 skid. See also B<PERF_RECORD_MISC_EXACT_IP>."
3698 #: build/C/man2/perf_event_open.2:963
3700 msgid "I<mmap_data> (since Linux 2.6.36)"
3703 #. commit 3af9e859281bda7eb7c20b51879cf43aa788ac2e
3705 #: build/C/man2/perf_event_open.2:976
3707 "The counterpart of the I<mmap> field. This enables generation of "
3708 "B<PERF_RECORD_MMAP> samples for B<mmap>(2) calls that do not have "
3709 "B<PROT_EXEC> set (for example data and SysV shared memory)."
3713 #: build/C/man2/perf_event_open.2:976
3715 msgid "I<sample_id_all> (since Linux 2.6.38)"
3718 #. commit c980d1091810df13f21aabbce545fd98f545bbf7
3720 #: build/C/man2/perf_event_open.2:985
3722 "If set, then TID, TIME, ID, STREAM_ID, and CPU can additionally be included "
3723 "in non-B<PERF_RECORD_SAMPLE>s if the corresponding I<sample_type> is "
3728 #: build/C/man2/perf_event_open.2:993
3730 "If B<PERF_SAMPLE_IDENTIFIER> is specified, then an additional ID value is "
3731 "included as the last value to ease parsing the record stream. This may lead "
3732 "to the I<id> value appearing twice."
3736 #: build/C/man2/perf_event_open.2:995
3737 msgid "The layout is described by this pseudo-structure:"
3741 #: build/C/man2/perf_event_open.2:1005
3744 "struct sample_id {\n"
3745 " { u32 pid, tid; } /* if PERF_SAMPLE_TID set */\n"
3746 " { u64 time; } /* if PERF_SAMPLE_TIME set */\n"
3747 " { u64 id; } /* if PERF_SAMPLE_ID set */\n"
3748 " { u64 stream_id;} /* if PERF_SAMPLE_STREAM_ID set */\n"
3749 " { u32 cpu, res; } /* if PERF_SAMPLE_CPU set */\n"
3750 " { u64 id; } /* if PERF_SAMPLE_IDENTIFIER set */\n"
3755 #: build/C/man2/perf_event_open.2:1006
3757 msgid "I<exclude_host> (since Linux 3.2)"
3760 #. commit a240f76165e6255384d4bdb8139895fac7988799
3762 #: build/C/man2/perf_event_open.2:1010
3763 msgid "Do not measure time spent in VM host."
3767 #: build/C/man2/perf_event_open.2:1010
3769 msgid "I<exclude_guest> (since Linux 3.2)"
3772 #. commit a240f76165e6255384d4bdb8139895fac7988799
3774 #: build/C/man2/perf_event_open.2:1014
3775 msgid "Do not measure time spent in VM guest."
3779 #: build/C/man2/perf_event_open.2:1014
3781 msgid "I<exclude_callchain_kernel> (since Linux 3.7)"
3784 #. commit d077526485d5c9b12fe85d0b2b3b7041e6bc5f91
3786 #: build/C/man2/perf_event_open.2:1018
3787 msgid "Do not include kernel callchains."
3791 #: build/C/man2/perf_event_open.2:1018
3793 msgid "I<exclude_callchain_user> (since Linux 3.7)"
3796 #. commit d077526485d5c9b12fe85d0b2b3b7041e6bc5f91
3798 #: build/C/man2/perf_event_open.2:1022
3799 msgid "Do not include user callchains."
3803 #: build/C/man2/perf_event_open.2:1022
3805 msgid "I<mmap2> (since Linux 3.16)"
3808 #. commit 13d7a2410fa637f450a29ecb515ac318ee40c741
3809 #. This is tricky; was committed during 3.12 development
3810 #. but right before release was disabled.
3811 #. So while you could select mmap2 starting with 3.12
3812 #. it did not work until 3.16
3813 #. commit a5a5ba72843dd05f991184d6cb9a4471acce1005
3815 #: build/C/man2/perf_event_open.2:1035
3817 "Generate an extended executable mmap record that contains enough additional "
3818 "information to uniquely identify shared mappings. The I<mmap> flag must "
3819 "also be set for this to work."
3823 #: build/C/man2/perf_event_open.2:1035
3825 msgid "I<comm_exec> (since Linux 3.16)"
3828 #. commit 82b897782d10fcc4930c9d4a15b175348fdd2871
3830 #: build/C/man2/perf_event_open.2:1051
3832 "This is purely a feature-detection flag, it does not change kernel "
3833 "behavior. If this flag can successfully be set, then, when I<comm> is "
3834 "enabled, the B<PERF_RECORD_MISC_COMM_EXEC> flag will be set in the I<misc> "
3835 "field of a comm record header if the rename event being reported was caused "
3836 "by a call to B<exec>(2). This allows tools to distinguish between the "
3837 "various types of process renaming."
3841 #: build/C/man2/perf_event_open.2:1051
3843 msgid "I<wakeup_events>, I<wakeup_watermark>"
3847 #: build/C/man2/perf_event_open.2:1061
3849 "This union sets how many samples (I<wakeup_events>) or bytes "
3850 "(I<wakeup_watermark>) happen before an overflow notification happens. "
3851 "Which one is used is selected by the I<watermark> bit flag."
3855 #: build/C/man2/perf_event_open.2:1071
3857 "I<wakeup_events> counts only B<PERF_RECORD_SAMPLE> record types. To receive "
3858 "overflow notification for all B<PERF_RECORD> types choose watermark and set "
3859 "I<wakeup_watermark> to 1."
3862 #. commit f506b3dc0ec454a16d40cab9ee5d75435b39dc50
3864 #: build/C/man2/perf_event_open.2:1077
3866 "Prior to Linux 3.0 setting I<wakeup_events> to 0 resulted in no overflow "
3867 "notifications; more recent kernels treat 0 the same as 1."
3871 #: build/C/man2/perf_event_open.2:1077
3873 msgid "I<bp_type> (since Linux 2.6.33)"
3876 #. commit 24f1e32c60c45c89a997c73395b69c8af6f0a84e
3878 #: build/C/man2/perf_event_open.2:1082
3879 msgid "This chooses the breakpoint type. It is one of:"
3883 #: build/C/man2/perf_event_open.2:1083
3885 msgid "B<HW_BREAKPOINT_EMPTY>"
3889 #: build/C/man2/perf_event_open.2:1086
3890 msgid "No breakpoint."
3894 #: build/C/man2/perf_event_open.2:1086
3896 msgid "B<HW_BREAKPOINT_R>"
3900 #: build/C/man2/perf_event_open.2:1089
3901 msgid "Count when we read the memory location."
3905 #: build/C/man2/perf_event_open.2:1089
3907 msgid "B<HW_BREAKPOINT_W>"
3911 #: build/C/man2/perf_event_open.2:1092
3912 msgid "Count when we write the memory location."
3916 #: build/C/man2/perf_event_open.2:1092
3918 msgid "B<HW_BREAKPOINT_RW>"
3922 #: build/C/man2/perf_event_open.2:1095
3923 msgid "Count when we read or write the memory location."
3927 #: build/C/man2/perf_event_open.2:1095
3929 msgid "B<HW_BREAKPOINT_X>"
3933 #: build/C/man2/perf_event_open.2:1098
3934 msgid "Count when we execute code at the memory location."
3938 #: build/C/man2/perf_event_open.2:1107
3940 "The values can be combined via a bitwise or, but the combination of "
3941 "B<HW_BREAKPOINT_R> or B<HW_BREAKPOINT_W> with B<HW_BREAKPOINT_X> is not "
3946 #: build/C/man2/perf_event_open.2:1108
3948 msgid "I<bp_addr> (since Linux 2.6.33)"
3951 #. commit 24f1e32c60c45c89a997c73395b69c8af6f0a84e
3953 #: build/C/man2/perf_event_open.2:1116
3955 "I<bp_addr> address of the breakpoint. For execution breakpoints this is the "
3956 "memory address of the instruction of interest; for read and write "
3957 "breakpoints it is the memory address of the memory location of interest."
3961 #: build/C/man2/perf_event_open.2:1116
3963 msgid "I<config1> (since Linux 2.6.39)"
3966 #. commit a7e3ed1e470116c9d12c2f778431a481a6be8ab6
3968 #: build/C/man2/perf_event_open.2:1124
3970 "I<config1> is used for setting events that need an extra register or "
3971 "otherwise do not fit in the regular config field. Raw OFFCORE_EVENTS on "
3972 "Nehalem/Westmere/SandyBridge use this field on 3.3 and later kernels."
3976 #: build/C/man2/perf_event_open.2:1124
3978 msgid "I<bp_len> (since Linux 2.6.33)"
3981 #. commit 24f1e32c60c45c89a997c73395b69c8af6f0a84e
3983 #: build/C/man2/perf_event_open.2:1139
3985 "I<bp_len> is the length of the breakpoint being measured if I<type> is "
3986 "B<PERF_TYPE_BREAKPOINT>. Options are B<HW_BREAKPOINT_LEN_1>, "
3987 "B<HW_BREAKPOINT_LEN_2>, B<HW_BREAKPOINT_LEN_4>, B<HW_BREAKPOINT_LEN_8>. For "
3988 "an execution breakpoint, set this to I<sizeof(long)>."
3992 #: build/C/man2/perf_event_open.2:1139
3994 msgid "I<config2> (since Linux 2.6.39)"
3997 #. commit a7e3ed1e470116c9d12c2f778431a481a6be8ab6
3999 #: build/C/man2/perf_event_open.2:1147
4000 msgid "I<config2> is a further extension of the I<config1> field."
4004 #: build/C/man2/perf_event_open.2:1147
4006 msgid "I<branch_sample_type> (since Linux 3.4)"
4009 #. commit bce38cd53e5ddba9cb6d708c4ef3d04a4016ec7e
4011 #: build/C/man2/perf_event_open.2:1154
4013 "If B<PERF_SAMPLE_BRANCH_STACK> is enabled, then this specifies what branches "
4014 "to include in the branch record."
4018 #: build/C/man2/perf_event_open.2:1160
4020 "The first part of the value is the privilege level, which is a combination "
4021 "of one of the following values. If the user does not set privilege level "
4022 "explicitly, the kernel will use the event's privilege level. Event and "
4023 "branch privilege levels do not have to match."
4027 #: build/C/man2/perf_event_open.2:1161
4029 msgid "B<PERF_SAMPLE_BRANCH_USER>"
4033 #: build/C/man2/perf_event_open.2:1164
4034 msgid "Branch target is in user space."
4038 #: build/C/man2/perf_event_open.2:1164
4040 msgid "B<PERF_SAMPLE_BRANCH_KERNEL>"
4044 #: build/C/man2/perf_event_open.2:1167
4045 msgid "Branch target is in kernel space."
4049 #: build/C/man2/perf_event_open.2:1167
4051 msgid "B<PERF_SAMPLE_BRANCH_HV>"
4055 #: build/C/man2/perf_event_open.2:1170
4056 msgid "Branch target is in hypervisor."
4060 #: build/C/man2/perf_event_open.2:1170
4062 msgid "B<PERF_SAMPLE_BRANCH_PLM_ALL>"
4066 #: build/C/man2/perf_event_open.2:1173
4067 msgid "A convenience value that is the three preceding values ORed together."
4071 #: build/C/man2/perf_event_open.2:1177
4073 "In addition to the privilege value, at least one or more of the following "
4078 #: build/C/man2/perf_event_open.2:1178
4080 msgid "B<PERF_SAMPLE_BRANCH_ANY>"
4084 #: build/C/man2/perf_event_open.2:1181
4085 msgid "Any branch type."
4089 #: build/C/man2/perf_event_open.2:1181
4091 msgid "B<PERF_SAMPLE_BRANCH_ANY_CALL>"
4095 #: build/C/man2/perf_event_open.2:1184
4096 msgid "Any call branch."
4100 #: build/C/man2/perf_event_open.2:1184
4102 msgid "B<PERF_SAMPLE_BRANCH_ANY_RETURN>"
4106 #: build/C/man2/perf_event_open.2:1187
4107 msgid "Any return branch."
4111 #: build/C/man2/perf_event_open.2:1187
4113 msgid "B<PERF_SAMPLE_BRANCH_IND_CALL>"
4117 #: build/C/man2/perf_event_open.2:1190
4118 msgid "Indirect calls."
4122 #: build/C/man2/perf_event_open.2:1190
4124 msgid "B<PERF_SAMPLE_BRANCH_COND> (since Linux 3.16)"
4127 #. commit bac52139f0b7ab31330e98fd87fc5a2664951050
4129 #: build/C/man2/perf_event_open.2:1194
4130 msgid "Conditional branches."
4134 #: build/C/man2/perf_event_open.2:1194
4136 msgid "B<PERF_SAMPLE_BRANCH_ABORT_TX> (since Linux 3.11)"
4139 #. commit 135c5612c460f89657c4698fe2ea753f6f667963
4141 #: build/C/man2/perf_event_open.2:1198
4142 msgid "Transactional memory aborts."
4146 #: build/C/man2/perf_event_open.2:1198
4148 msgid "B<PERF_SAMPLE_BRANCH_IN_TX> (since Linux 3.11)"
4151 #. commit 135c5612c460f89657c4698fe2ea753f6f667963
4153 #: build/C/man2/perf_event_open.2:1202
4154 msgid "Branch in transactional memory transaction."
4158 #: build/C/man2/perf_event_open.2:1202
4160 msgid "B<PERF_SAMPLE_BRANCH_NO_TX> (since Linux 3.11)"
4163 #. commit 135c5612c460f89657c4698fe2ea753f6f667963
4165 #: build/C/man2/perf_event_open.2:1206
4166 msgid "Branch not in transactional memory transaction."
4170 #: build/C/man2/perf_event_open.2:1208
4172 msgid "I<sample_regs_user> (since Linux 3.7)"
4175 #. commit 4018994f3d8785275ef0e7391b75c3462c029e56
4177 #: build/C/man2/perf_event_open.2:1215
4179 "This bit mask defines the set of user CPU registers to dump on samples. The "
4180 "layout of the register mask is architecture-specific and described in the "
4181 "kernel header I<arch/ARCH/include/uapi/asm/perf_regs.h>."
4185 #: build/C/man2/perf_event_open.2:1215
4187 msgid "I<sample_stack_user> (since Linux 3.7)"
4190 #. commit c5ebcedb566ef17bda7b02686e0d658a7bb42ee7
4192 #: build/C/man2/perf_event_open.2:1221
4194 "This defines the size of the user stack to dump if B<PERF_SAMPLE_STACK_USER> "
4199 #: build/C/man2/perf_event_open.2:1221
4201 msgid "Reading results"
4205 #: build/C/man2/perf_event_open.2:1231
4207 "Once a B<perf_event_open>() file descriptor has been opened, the values of "
4208 "the events can be read from the file descriptor. The values that are there "
4209 "are specified by the I<read_format> field in the I<attr> structure at open "
4214 #: build/C/man2/perf_event_open.2:1236
4216 "If you attempt to read into a buffer that is not big enough to hold the data "
4217 "B<ENOSPC> is returned"
4221 #: build/C/man2/perf_event_open.2:1238
4222 msgid "Here is the layout of the data returned by a read:"
4226 #: build/C/man2/perf_event_open.2:1242
4228 "If B<PERF_FORMAT_GROUP> was specified to allow reading all events in a group "
4233 #: build/C/man2/perf_event_open.2:1254
4236 "struct read_format {\n"
4237 " u64 nr; /* The number of events */\n"
4238 " u64 time_enabled; /* if PERF_FORMAT_TOTAL_TIME_ENABLED */\n"
4239 " u64 time_running; /* if PERF_FORMAT_TOTAL_TIME_RUNNING */\n"
4241 " u64 value; /* The value of the event */\n"
4242 " u64 id; /* if PERF_FORMAT_ID */\n"
4248 #: build/C/man2/perf_event_open.2:1262
4249 msgid "If B<PERF_FORMAT_GROUP> was I<not> specified:"
4253 #: build/C/man2/perf_event_open.2:1271
4256 "struct read_format {\n"
4257 " u64 value; /* The value of the event */\n"
4258 " u64 time_enabled; /* if PERF_FORMAT_TOTAL_TIME_ENABLED */\n"
4259 " u64 time_running; /* if PERF_FORMAT_TOTAL_TIME_RUNNING */\n"
4260 " u64 id; /* if PERF_FORMAT_ID */\n"
4265 #: build/C/man2/perf_event_open.2:1275
4266 msgid "The values read are as follows:"
4270 #: build/C/man2/perf_event_open.2:1275
4276 #: build/C/man2/perf_event_open.2:1281
4278 "The number of events in this file descriptor. Only available if "
4279 "B<PERF_FORMAT_GROUP> was specified."
4283 #: build/C/man2/perf_event_open.2:1281
4285 msgid "I<time_enabled>, I<time_running>"
4289 #: build/C/man2/perf_event_open.2:1293
4291 "Total time the event was enabled and running. Normally these are the same. "
4292 "If more events are started, then available counter slots on the PMU, then "
4293 "multiplexing happens and events run only part of the time. In that case, "
4294 "the I<time_enabled> and I<time running> values can be used to scale an "
4295 "estimated value for the count."
4299 #: build/C/man2/perf_event_open.2:1293
4305 #: build/C/man2/perf_event_open.2:1296
4306 msgid "An unsigned 64-bit value containing the counter result."
4310 #: build/C/man2/perf_event_open.2:1296 build/C/man2/perf_event_open.2:1732 build/C/man2/perf_event_open.2:1898
4316 #: build/C/man2/perf_event_open.2:1302
4318 "A globally unique value for this particular event, only present if "
4319 "B<PERF_FORMAT_ID> was specified in I<read_format>."
4323 #: build/C/man2/perf_event_open.2:1302
4329 #: build/C/man2/perf_event_open.2:1312
4331 "When using B<perf_event_open>() in sampled mode, asynchronous events (like "
4332 "counter overflow or B<PROT_EXEC> mmap tracking) are logged into a "
4333 "ring-buffer. This ring-buffer is created and accessed through B<mmap>(2)."
4337 #: build/C/man2/perf_event_open.2:1318
4339 "The mmap size should be 1+2^n pages, where the first page is a metadata page "
4340 "(I<struct perf_event_mmap_page>) that contains various bits of information "
4341 "such as where the ring-buffer head is."
4345 #: build/C/man2/perf_event_open.2:1321
4347 "Before kernel 2.6.39, there is a bug that means you must allocate a mmap "
4348 "ring buffer when sampling even if you do not plan to access it."
4352 #: build/C/man2/perf_event_open.2:1323
4353 msgid "The structure of the first metadata mmap page is as follows:"
4357 #: build/C/man2/perf_event_open.2:1352
4360 "struct perf_event_mmap_page {\n"
4361 " __u32 version; /* version number of this structure */\n"
4362 " __u32 compat_version; /* lowest version this is compat with */\n"
4363 " __u32 lock; /* seqlock for synchronization */\n"
4364 " __u32 index; /* hardware counter identifier */\n"
4365 " __s64 offset; /* add to hardware counter value */\n"
4366 " __u64 time_enabled; /* time event active */\n"
4367 " __u64 time_running; /* time event on CPU */\n"
4369 " __u64 capabilities;\n"
4371 " __u64 cap_usr_time / cap_usr_rdpmc / cap_bit0 : 1,\n"
4372 " cap_bit0_is_deprecated : 1,\n"
4373 " cap_user_rdpmc : 1,\n"
4374 " cap_user_time : 1,\n"
4375 " cap_user_time_zero : 1,\n"
4378 " __u16 pmc_width;\n"
4379 " __u16 time_shift;\n"
4380 " __u32 time_mult;\n"
4381 " __u64 time_offset;\n"
4382 " __u64 __reserved[120]; /* Pad to 1k */\n"
4383 " __u64 data_head; /* head in the data section */\n"
4384 " __u64 data_tail; /* user-space written tail */\n"
4389 #: build/C/man2/perf_event_open.2:1358
4391 "The following list describes the fields in the I<perf_event_mmap_page> "
4392 "structure in more detail:"
4396 #: build/C/man2/perf_event_open.2:1358
4402 #: build/C/man2/perf_event_open.2:1361
4403 msgid "Version number of this structure."
4407 #: build/C/man2/perf_event_open.2:1361
4409 msgid "I<compat_version>"
4413 #: build/C/man2/perf_event_open.2:1364
4414 msgid "The lowest version this is compatible with."
4418 #: build/C/man2/perf_event_open.2:1364
4424 #: build/C/man2/perf_event_open.2:1367
4425 msgid "A seqlock for synchronization."
4429 #: build/C/man2/perf_event_open.2:1367
4435 #: build/C/man2/perf_event_open.2:1370
4436 msgid "A unique hardware counter identifier."
4440 #: build/C/man2/perf_event_open.2:1370
4446 #: build/C/man2/perf_event_open.2:1375
4448 "When using rdpmc for reads this offset value must be added to the one "
4449 "returned by rdpmc to get the current total event count."
4453 #: build/C/man2/perf_event_open.2:1375
4455 msgid "I<time_enabled>"
4459 #: build/C/man2/perf_event_open.2:1378
4460 msgid "Time the event was active."
4464 #: build/C/man2/perf_event_open.2:1378
4466 msgid "I<time_running>"
4470 #: build/C/man2/perf_event_open.2:1381
4471 msgid "Time the event was running."
4475 #: build/C/man2/perf_event_open.2:1381
4477 msgid "I<cap_usr_time> / I<cap_usr_rdpmc> / I<cap_bit0> (since Linux 3.4)"
4480 #. commit c7206205d00ab375839bd6c7ddb247d600693c09
4482 #: build/C/man2/perf_event_open.2:1395
4484 "There was a bug in the definition of I<cap_usr_time> and I<cap_usr_rdpmc> "
4485 "from Linux 3.4 until Linux 3.11. Both bits were defined to point to the "
4486 "same location, so it was impossible to know if I<cap_usr_time> or "
4487 "I<cap_usr_rdpmc> were actually set."
4490 #. commit fa7315871046b9a4c48627905691dbde57e51033
4492 #: build/C/man2/perf_event_open.2:1404
4494 "Starting with Linux 3.12, these are renamed to I<cap_bit0> and you should "
4495 "use the I<cap_user_time> and I<cap_user_rdpmc> fields instead."
4499 #: build/C/man2/perf_event_open.2:1405
4501 msgid "I<cap_bit0_is_deprecated> (since Linux 3.12)"
4504 #. commit fa7315871046b9a4c48627905691dbde57e51033
4506 #: build/C/man2/perf_event_open.2:1414
4508 "If set, this bit indicates that the kernel supports the properly separated "
4509 "I<cap_user_time> and I<cap_user_rdpmc> bits."
4513 #: build/C/man2/perf_event_open.2:1421
4515 "If not-set, it indicates an older kernel where I<cap_usr_time> and "
4516 "I<cap_usr_rdpmc> map to the same bit and thus both features should be used "
4521 #: build/C/man2/perf_event_open.2:1422
4523 msgid "I<cap_user_rdpmc> (since Linux 3.12)"
4526 #. commit fa7315871046b9a4c48627905691dbde57e51033
4528 #: build/C/man2/perf_event_open.2:1428
4530 "If the hardware supports user-space read of performance counters without "
4531 "syscall (this is the \"rdpmc\" instruction on x86), then the following code "
4532 "can be used to do a read:"
4536 #: build/C/man2/perf_event_open.2:1434
4539 "u32 seq, time_mult, time_shift, idx, width;\n"
4540 "u64 count, enabled, running;\n"
4541 "u64 cyc, time_offset;\n"
4545 #: build/C/man2/perf_event_open.2:1440
4549 " seq = pc-E<gt>lock;\n"
4551 " enabled = pc-E<gt>time_enabled;\n"
4552 " running = pc-E<gt>time_running;\n"
4556 #: build/C/man2/perf_event_open.2:1447
4559 " if (pc-E<gt>cap_usr_time && enabled != running) {\n"
4561 " time_offset = pc-E<gt>time_offset;\n"
4562 " time_mult = pc-E<gt>time_mult;\n"
4563 " time_shift = pc-E<gt>time_shift;\n"
4568 #: build/C/man2/perf_event_open.2:1450
4571 " idx = pc-E<gt>index;\n"
4572 " count = pc-E<gt>offset;\n"
4576 #: build/C/man2/perf_event_open.2:1455
4579 " if (pc-E<gt>cap_usr_rdpmc && idx) {\n"
4580 " width = pc-E<gt>pmc_width;\n"
4581 " count += rdpmc(idx - 1);\n"
4586 #: build/C/man2/perf_event_open.2:1458
4590 "} while (pc-E<gt>lock != seq);\n"
4594 #: build/C/man2/perf_event_open.2:1460
4596 msgid "I<cap_user_time> (since Linux 3.12)"
4599 #. commit fa7315871046b9a4c48627905691dbde57e51033
4601 #: build/C/man2/perf_event_open.2:1465
4603 "This bit indicates the hardware has a constant, nonstop timestamp counter "
4608 #: build/C/man2/perf_event_open.2:1465
4610 msgid "I<cap_user_time_zero> (since Linux 3.12)"
4613 #. commit fa7315871046b9a4c48627905691dbde57e51033
4615 #: build/C/man2/perf_event_open.2:1472
4617 "Indicates the presence of I<time_zero> which allows mapping timestamp values "
4618 "to the hardware clock."
4622 #: build/C/man2/perf_event_open.2:1472
4624 msgid "I<pmc_width>"
4628 #: build/C/man2/perf_event_open.2:1479
4630 "If I<cap_usr_rdpmc>, this field provides the bit-width of the value read "
4631 "using the rdpmc or equivalent instruction. This can be used to sign extend "
4636 #: build/C/man2/perf_event_open.2:1485
4639 "pmc E<lt>E<lt>= 64 - pmc_width;\n"
4640 "pmc E<gt>E<gt>= 64 - pmc_width; // signed shift right\n"
4645 #: build/C/man2/perf_event_open.2:1487
4647 msgid "I<time_shift>, I<time_mult>, I<time_offset>"
4651 #: build/C/man2/perf_event_open.2:1494
4653 "If I<cap_usr_time>, these fields can be used to compute the time delta since "
4654 "time_enabled (in nanoseconds) using rdtsc or similar."
4658 #: build/C/man2/perf_event_open.2:1502
4663 " quot = (cyc E<gt>E<gt> time_shift);\n"
4664 " rem = cyc & ((1 E<lt>E<lt> time_shift) - 1);\n"
4665 " delta = time_offset + quot * time_mult +\n"
4666 " ((rem * time_mult) E<gt>E<gt> time_shift);\n"
4670 #: build/C/man2/perf_event_open.2:1514
4672 "Where I<time_offset>, I<time_mult>, I<time_shift>, and I<cyc> are read in "
4673 "the seqcount loop described above. This delta can then be added to enabled "
4674 "and possible running (if idx), improving the scaling:"
4678 #: build/C/man2/perf_event_open.2:1522
4681 " enabled += delta;\n"
4683 " running += delta;\n"
4684 " quot = count / running;\n"
4685 " rem = count % running;\n"
4686 " count = quot * enabled + (rem * enabled) / running;\n"
4690 #: build/C/man2/perf_event_open.2:1523
4692 msgid "I<time_zero> (since Linux 3.12)"
4695 #. commit fa7315871046b9a4c48627905691dbde57e51033
4697 #: build/C/man2/perf_event_open.2:1532
4699 "If I<cap_usr_time_zero> is set, then the hardware clock (the TSC timestamp "
4700 "counter on x86) can be calculated from the I<time_zero>, I<time_mult>, and "
4701 "I<time_shift> values:"
4705 #: build/C/man2/perf_event_open.2:1538
4708 " time = timestamp - time_zero;\n"
4709 " quot = time / time_mult;\n"
4710 " rem = time % time_mult;\n"
4711 " cyc = (quot E<lt>E<lt> time_shift) + (rem E<lt>E<lt> time_shift) / "
4716 #: build/C/man2/perf_event_open.2:1541
4717 msgid "And vice versa:"
4721 #: build/C/man2/perf_event_open.2:1547
4724 " quot = cyc E<gt>E<gt> time_shift;\n"
4725 " rem = cyc & ((1 E<lt>E<lt> time_shift) - 1);\n"
4726 " timestamp = time_zero + quot * time_mult +\n"
4727 " ((rem * time_mult) E<gt>E<gt> time_shift);\n"
4731 #: build/C/man2/perf_event_open.2:1548
4733 msgid "I<data_head>"
4737 #: build/C/man2/perf_event_open.2:1554
4739 "This points to the head of the data section. The value continuously "
4740 "increases, it does not wrap. The value needs to be manually wrapped by the "
4741 "size of the mmap buffer before accessing the samples."
4745 #: build/C/man2/perf_event_open.2:1559
4747 "On SMP-capable platforms, after reading the I<data_head> value, user space "
4748 "should issue an rmb()."
4752 #: build/C/man2/perf_event_open.2:1559
4754 msgid "I<data_tail>"
4758 #: build/C/man2/perf_event_open.2:1567
4760 "When the mapping is B<PROT_WRITE>, the I<data_tail> value should be written "
4761 "by user space to reflect the last read data. In this case, the kernel will "
4762 "not overwrite unread data."
4766 #: build/C/man2/perf_event_open.2:1569
4767 msgid "The following 2^n ring-buffer pages have the layout described below."
4771 #: build/C/man2/perf_event_open.2:1583
4773 "If I<perf_event_attr.sample_id_all> is set, then all event types will have "
4774 "the sample_type selected fields related to where/when (identity) an event "
4775 "took place (TID, TIME, ID, CPU, STREAM_ID) described in "
4776 "B<PERF_RECORD_SAMPLE> below, it will be stashed just after the "
4777 "I<perf_event_header> and the fields already present for the existing fields, "
4778 "that is, at the end of the payload. That way a newer perf.data file will be "
4779 "supported by older perf tools, with these new optional fields being ignored."
4783 #: build/C/man2/perf_event_open.2:1585
4784 msgid "The mmap values start with a header:"
4788 #: build/C/man2/perf_event_open.2:1593
4791 "struct perf_event_header {\n"
4799 #: build/C/man2/perf_event_open.2:1601
4801 "Below, we describe the I<perf_event_header> fields in more detail. For ease "
4802 "of reading, the fields with shorter descriptions are presented first."
4806 #: build/C/man2/perf_event_open.2:1604
4807 msgid "This indicates the size of the record."
4811 #: build/C/man2/perf_event_open.2:1604
4817 #: build/C/man2/perf_event_open.2:1609
4818 msgid "The I<misc> field contains additional information about the sample."
4822 #: build/C/man2/perf_event_open.2:1614
4824 "The CPU mode can be determined from this value by masking with "
4825 "B<PERF_RECORD_MISC_CPUMODE_MASK> and looking for one of the following (note "
4826 "these are not bit masks, only one can be set at a time):"
4830 #: build/C/man2/perf_event_open.2:1615
4832 msgid "B<PERF_RECORD_MISC_CPUMODE_UNKNOWN>"
4836 #: build/C/man2/perf_event_open.2:1618
4837 msgid "Unknown CPU mode."
4841 #: build/C/man2/perf_event_open.2:1618
4843 msgid "B<PERF_RECORD_MISC_KERNEL>"
4847 #: build/C/man2/perf_event_open.2:1621
4848 msgid "Sample happened in the kernel."
4852 #: build/C/man2/perf_event_open.2:1621
4854 msgid "B<PERF_RECORD_MISC_USER>"
4858 #: build/C/man2/perf_event_open.2:1624
4859 msgid "Sample happened in user code."
4863 #: build/C/man2/perf_event_open.2:1624
4865 msgid "B<PERF_RECORD_MISC_HYPERVISOR>"
4869 #: build/C/man2/perf_event_open.2:1627
4870 msgid "Sample happened in the hypervisor."
4874 #: build/C/man2/perf_event_open.2:1627
4876 msgid "B<PERF_RECORD_MISC_GUEST_KERNEL> (since Linux 2.6.35)"
4879 #. commit 39447b386c846bbf1c56f6403c5282837486200f
4881 #: build/C/man2/perf_event_open.2:1631
4882 msgid "Sample happened in the guest kernel."
4886 #: build/C/man2/perf_event_open.2:1631
4888 msgid "B<PERF_RECORD_MISC_GUEST_USER (since Linux 2.6.35)>"
4891 #. commit 39447b386c846bbf1c56f6403c5282837486200f
4893 #: build/C/man2/perf_event_open.2:1635
4894 msgid "Sample happened in guest user code."
4898 #: build/C/man2/perf_event_open.2:1639
4899 msgid "In addition, one of the following bits can be set:"
4903 #: build/C/man2/perf_event_open.2:1639
4905 msgid "B<PERF_RECORD_MISC_MMAP_DATA> (since Linux 3.10)"
4908 #. commit 2fe85427e3bf65d791700d065132772fc26e4d75
4910 #: build/C/man2/perf_event_open.2:1644
4912 "This is set when the mapping is not executable; otherwise the mapping is "
4917 #: build/C/man2/perf_event_open.2:1644
4919 msgid "B<PERF_RECORD_MISC_COMM_EXEC> (since Linux 3.16)"
4922 #. commit 82b897782d10fcc4930c9d4a15b175348fdd2871
4924 #: build/C/man2/perf_event_open.2:1656
4926 "This is set for a B<PERF_RECORD_COMM> record on kernels more recent than "
4927 "Linux 3.16 if a process name change was caused by an B<exec>(2) system "
4928 "call. It is an alias for B<PERF_RECORD_MISC_MMAP_DATA> since the two values "
4929 "would not be set in the same record."
4933 #: build/C/man2/perf_event_open.2:1656
4935 msgid "B<PERF_RECORD_MISC_EXACT_IP>"
4939 #: build/C/man2/perf_event_open.2:1664
4941 "This indicates that the content of B<PERF_SAMPLE_IP> points to the actual "
4942 "instruction that triggered the event. See also "
4943 "I<perf_event_attr.precise_ip>."
4947 #: build/C/man2/perf_event_open.2:1664
4949 msgid "B<PERF_RECORD_MISC_EXT_RESERVED> (since Linux 2.6.35)"
4952 #. commit 1676b8a077c352085d52578fb4f29350b58b6e74
4954 #: build/C/man2/perf_event_open.2:1668
4955 msgid "This indicates there is extended data available (currently not used)."
4959 #: build/C/man2/perf_event_open.2:1678
4961 "The I<type> value is one of the below. The values in the corresponding "
4962 "record (that follows the header) depend on the I<type> selected as shown."
4966 #: build/C/man2/perf_event_open.2:1680
4968 msgid "B<PERF_RECORD_MMAP>"
4972 #: build/C/man2/perf_event_open.2:1687
4974 "The MMAP events record the B<PROT_EXEC> mappings so that we can correlate "
4975 "user-space IPs to code. They have the following structure:"
4979 #: build/C/man2/perf_event_open.2:1698
4983 " struct perf_event_header header;\n"
4988 " char filename[];\n"
4993 #: build/C/man2/perf_event_open.2:1701 build/C/man2/perf_event_open.2:1755 build/C/man2/perf_event_open.2:2276
4999 #: build/C/man2/perf_event_open.2:1704 build/C/man2/perf_event_open.2:1758 build/C/man2/perf_event_open.2:2279
5000 msgid "is the process ID."
5004 #: build/C/man2/perf_event_open.2:1704 build/C/man2/perf_event_open.2:1758 build/C/man2/perf_event_open.2:2279
5010 #: build/C/man2/perf_event_open.2:1707 build/C/man2/perf_event_open.2:1761 build/C/man2/perf_event_open.2:2282
5011 msgid "is the thread ID."
5015 #: build/C/man2/perf_event_open.2:1707 build/C/man2/perf_event_open.2:1891 build/C/man2/perf_event_open.2:2282
5021 #: build/C/man2/perf_event_open.2:1716
5023 "is the address of the allocated memory. I<len> is the length of the "
5024 "allocated memory. I<pgoff> is the page offset of the allocated memory. "
5025 "I<filename> is a string describing the backing of the allocated memory."
5029 #: build/C/man2/perf_event_open.2:1717
5031 msgid "B<PERF_RECORD_LOST>"
5035 #: build/C/man2/perf_event_open.2:1720
5036 msgid "This record indicates when events are lost."
5040 #: build/C/man2/perf_event_open.2:1729
5044 " struct perf_event_header header;\n"
5047 " struct sample_id sample_id;\n"
5052 #: build/C/man2/perf_event_open.2:1735
5053 msgid "is the unique event ID for the samples that were lost."
5057 #: build/C/man2/perf_event_open.2:1735
5063 #: build/C/man2/perf_event_open.2:1738
5064 msgid "is the number of events that were lost."
5068 #: build/C/man2/perf_event_open.2:1739
5070 msgid "B<PERF_RECORD_COMM>"
5074 #: build/C/man2/perf_event_open.2:1742
5075 msgid "This record indicates a change in the process name."
5079 #: build/C/man2/perf_event_open.2:1752
5083 " struct perf_event_header header;\n"
5087 " struct sample_id sample_id;\n"
5092 #: build/C/man2/perf_event_open.2:1764
5093 msgid "is a string containing the new name of the process."
5097 #: build/C/man2/perf_event_open.2:1765
5099 msgid "B<PERF_RECORD_EXIT>"
5103 #: build/C/man2/perf_event_open.2:1768
5104 msgid "This record indicates a process exit event."
5108 #: build/C/man2/perf_event_open.2:1778 build/C/man2/perf_event_open.2:1808
5112 " struct perf_event_header header;\n"
5116 " struct sample_id sample_id;\n"
5121 #: build/C/man2/perf_event_open.2:1780
5123 msgid "B<PERF_RECORD_THROTTLE>, B<PERF_RECORD_UNTHROTTLE>"
5127 #: build/C/man2/perf_event_open.2:1783
5128 msgid "This record indicates a throttle/unthrottle event."
5132 #: build/C/man2/perf_event_open.2:1793
5136 " struct perf_event_header header;\n"
5140 " struct sample_id sample_id;\n"
5145 #: build/C/man2/perf_event_open.2:1795
5147 msgid "B<PERF_RECORD_FORK>"
5151 #: build/C/man2/perf_event_open.2:1798
5152 msgid "This record indicates a fork event."
5156 #: build/C/man2/perf_event_open.2:1810
5158 msgid "B<PERF_RECORD_READ>"
5162 #: build/C/man2/perf_event_open.2:1813
5163 msgid "This record indicates a read event."
5167 #: build/C/man2/perf_event_open.2:1822
5171 " struct perf_event_header header;\n"
5173 " struct read_format values;\n"
5174 " struct sample_id sample_id;\n"
5179 #: build/C/man2/perf_event_open.2:1824
5181 msgid "B<PERF_RECORD_SAMPLE>"
5185 #: build/C/man2/perf_event_open.2:1827
5186 msgid "This record indicates a sample."
5190 #: build/C/man2/perf_event_open.2:1859
5194 " struct perf_event_header header;\n"
5195 " u64 sample_id; /* if PERF_SAMPLE_IDENTIFIER */\n"
5196 " u64 ip; /* if PERF_SAMPLE_IP */\n"
5197 " u32 pid, tid; /* if PERF_SAMPLE_TID */\n"
5198 " u64 time; /* if PERF_SAMPLE_TIME */\n"
5199 " u64 addr; /* if PERF_SAMPLE_ADDR */\n"
5200 " u64 id; /* if PERF_SAMPLE_ID */\n"
5201 " u64 stream_id; /* if PERF_SAMPLE_STREAM_ID */\n"
5202 " u32 cpu, res; /* if PERF_SAMPLE_CPU */\n"
5203 " u64 period; /* if PERF_SAMPLE_PERIOD */\n"
5204 " struct read_format v; /* if PERF_SAMPLE_READ */\n"
5205 " u64 nr; /* if PERF_SAMPLE_CALLCHAIN */\n"
5206 " u64 ips[nr]; /* if PERF_SAMPLE_CALLCHAIN */\n"
5207 " u32 size; /* if PERF_SAMPLE_RAW */\n"
5208 " char data[size]; /* if PERF_SAMPLE_RAW */\n"
5209 " u64 bnr; /* if PERF_SAMPLE_BRANCH_STACK */\n"
5210 " struct perf_branch_entry lbr[bnr];\n"
5211 " /* if PERF_SAMPLE_BRANCH_STACK */\n"
5212 " u64 abi; /* if PERF_SAMPLE_REGS_USER */\n"
5213 " u64 regs[weight(mask)];\n"
5214 " /* if PERF_SAMPLE_REGS_USER */\n"
5215 " u64 size; /* if PERF_SAMPLE_STACK_USER */\n"
5216 " char data[size]; /* if PERF_SAMPLE_STACK_USER */\n"
5217 " u64 dyn_size; /* if PERF_SAMPLE_STACK_USER */\n"
5218 " u64 weight; /* if PERF_SAMPLE_WEIGHT */\n"
5219 " u64 data_src; /* if PERF_SAMPLE_DATA_SRC */\n"
5220 " u64 transaction;/* if PERF_SAMPLE_TRANSACTION */\n"
5225 #: build/C/man2/perf_event_open.2:1861
5227 msgid "I<sample_id>"
5231 #: build/C/man2/perf_event_open.2:1871
5233 "If B<PERF_SAMPLE_IDENTIFIER> is enabled, a 64-bit unique ID is included. "
5234 "This is a duplication of the B<PERF_SAMPLE_ID> I<id> value, but included at "
5235 "the beginning of the sample so parsers can easily obtain the value."
5239 #: build/C/man2/perf_event_open.2:1871
5245 #: build/C/man2/perf_event_open.2:1877
5247 "If B<PERF_SAMPLE_IP> is enabled, then a 64-bit instruction pointer value is "
5252 #: build/C/man2/perf_event_open.2:1877
5254 msgid "I<pid>, I<tid>"
5258 #: build/C/man2/perf_event_open.2:1883
5260 "If B<PERF_SAMPLE_TID> is enabled, then a 32-bit process ID and 32-bit thread "
5265 #: build/C/man2/perf_event_open.2:1883
5271 #: build/C/man2/perf_event_open.2:1891
5273 "If B<PERF_SAMPLE_TIME> is enabled, then a 64-bit timestamp is included. "
5274 "This is obtained via local_clock() which is a hardware timestamp if "
5275 "available and the jiffies value if not."
5279 #: build/C/man2/perf_event_open.2:1898
5281 "If B<PERF_SAMPLE_ADDR> is enabled, then a 64-bit address is included. This "
5282 "is usually the address of a tracepoint, breakpoint, or software event; "
5283 "otherwise the value is 0."
5287 #: build/C/man2/perf_event_open.2:1906
5289 "If B<PERF_SAMPLE_ID> is enabled, a 64-bit unique ID is included. If the "
5290 "event is a member of an event group, the group leader ID is returned. This "
5291 "ID is the same as the one returned by B<PERF_FORMAT_ID>."
5295 #: build/C/man2/perf_event_open.2:1906
5297 msgid "I<stream_id>"
5301 #: build/C/man2/perf_event_open.2:1916
5303 "If B<PERF_SAMPLE_STREAM_ID> is enabled, a 64-bit unique ID is included. "
5304 "Unlike B<PERF_SAMPLE_ID> the actual ID is returned, not the group leader. "
5305 "This ID is the same as the one returned by B<PERF_FORMAT_ID>."
5309 #: build/C/man2/perf_event_open.2:1916
5311 msgid "I<cpu>, I<res>"
5315 #: build/C/man2/perf_event_open.2:1923
5317 "If B<PERF_SAMPLE_CPU> is enabled, this is a 32-bit value indicating which "
5318 "CPU was being used, in addition to a reserved (unused) 32-bit value."
5322 #: build/C/man2/perf_event_open.2:1923
5328 #: build/C/man2/perf_event_open.2:1929
5330 "If B<PERF_SAMPLE_PERIOD> is enabled, a 64-bit value indicating the current "
5331 "sampling period is written."
5335 #: build/C/man2/perf_event_open.2:1929
5341 #: build/C/man2/perf_event_open.2:1940
5343 "If B<PERF_SAMPLE_READ> is enabled, a structure of type read_format is "
5344 "included which has values for all events in the event group. The values "
5345 "included depend on the I<read_format> value used at B<perf_event_open>() "
5350 #: build/C/man2/perf_event_open.2:1940
5352 msgid "I<nr>, I<ips[nr]>"
5356 #: build/C/man2/perf_event_open.2:1948
5358 "If B<PERF_SAMPLE_CALLCHAIN> is enabled, then a 64-bit number is included "
5359 "which indicates how many following 64-bit instruction pointers will follow. "
5360 "This is the current callchain."
5364 #: build/C/man2/perf_event_open.2:1948
5366 msgid "I<size>, I<data[size]>"
5370 #: build/C/man2/perf_event_open.2:1955
5372 "If B<PERF_SAMPLE_RAW> is enabled, then a 32-bit value indicating size is "
5373 "included followed by an array of 8-bit values of length size. The values "
5374 "are padded with 0 to have 64-bit alignment."
5378 #: build/C/man2/perf_event_open.2:1960
5380 "This RAW record data is opaque with respect to the ABI. The ABI doesn't "
5381 "make any promises with respect to the stability of its content, it may vary "
5382 "depending on event, hardware, and kernel version."
5386 #: build/C/man2/perf_event_open.2:1960
5388 msgid "I<bnr>, I<lbr[bnr]>"
5392 #: build/C/man2/perf_event_open.2:1969
5394 "If B<PERF_SAMPLE_BRANCH_STACK> is enabled, then a 64-bit value indicating "
5395 "the number of records is included, followed by I<bnr> I<perf_branch_entry> "
5396 "structures which each include the fields:"
5400 #: build/C/man2/perf_event_open.2:1970
5406 #: build/C/man2/perf_event_open.2:1973
5407 msgid "This indicates the source instruction (may not be a branch)."
5411 #: build/C/man2/perf_event_open.2:1973
5417 #: build/C/man2/perf_event_open.2:1976
5418 msgid "The branch target."
5422 #: build/C/man2/perf_event_open.2:1976
5428 #: build/C/man2/perf_event_open.2:1979
5429 msgid "The branch target was mispredicted."
5433 #: build/C/man2/perf_event_open.2:1979
5435 msgid "I<predicted>"
5439 #: build/C/man2/perf_event_open.2:1982
5440 msgid "The branch target was predicted."
5444 #: build/C/man2/perf_event_open.2:1982
5446 msgid "I<in_tx> (since Linux 3.11)"
5449 #. commit 135c5612c460f89657c4698fe2ea753f6f667963
5451 #: build/C/man2/perf_event_open.2:1986
5452 msgid "The branch was in a transactional memory transaction."
5456 #: build/C/man2/perf_event_open.2:1986
5458 msgid "I<abort> (since Linux 3.11)"
5461 #. commit 135c5612c460f89657c4698fe2ea753f6f667963
5463 #: build/C/man2/perf_event_open.2:1990
5464 msgid "The branch was in an aborted transactional memory transaction."
5468 #: build/C/man2/perf_event_open.2:1994
5470 "The entries are from most to least recent, so the first entry has the most "
5475 #: build/C/man2/perf_event_open.2:2001
5477 "Support for I<mispred> and I<predicted> is optional; if not supported, both "
5482 #: build/C/man2/perf_event_open.2:2005
5484 "The type of branches recorded is specified by the I<branch_sample_type> "
5489 #: build/C/man2/perf_event_open.2:2007
5491 msgid "I<abi>, I<regs[weight(mask)]>"
5495 #: build/C/man2/perf_event_open.2:2012
5497 "If B<PERF_SAMPLE_REGS_USER> is enabled, then the user CPU registers are "
5502 #: build/C/man2/perf_event_open.2:2018
5504 "The I<abi> field is one of B<PERF_SAMPLE_REGS_ABI_NONE>, "
5505 "B<PERF_SAMPLE_REGS_ABI_32> or B<PERF_SAMPLE_REGS_ABI_64>."
5509 #: build/C/man2/perf_event_open.2:2028
5511 "The I<regs> field is an array of the CPU registers that were specified by "
5512 "the I<sample_regs_user> attr field. The number of values is the number of "
5513 "bits set in the I<sample_regs_user> bit mask."
5517 #: build/C/man2/perf_event_open.2:2028
5519 msgid "I<size>, I<data[size]>, I<dyn_size>"
5523 #: build/C/man2/perf_event_open.2:2044
5525 "If B<PERF_SAMPLE_STACK_USER> is enabled, then the user stack is recorded. "
5526 "This can be used to generate stack backtraces. I<size> is the size "
5527 "requested by the user in I<sample_stack_user> or else the maximum record "
5528 "size. I<data> is the stack data (a raw dump of the memory pointed to by the "
5529 "stack pointer at the time of sampling). I<dyn_size> is the amount of data "
5530 "actually dumped (can be less than I<size>)."
5534 #: build/C/man2/perf_event_open.2:2044
5540 #: build/C/man2/perf_event_open.2:2052
5542 "If B<PERF_SAMPLE_WEIGHT> is enabled, then a 64-bit value provided by the "
5543 "hardware is recorded that indicates how costly the event was. This allows "
5544 "expensive events to stand out more clearly in profiles."
5548 #: build/C/man2/perf_event_open.2:2052
5554 #: build/C/man2/perf_event_open.2:2058
5556 "If B<PERF_SAMPLE_DATA_SRC> is enabled, then a 64-bit value is recorded that "
5557 "is made up of the following fields:"
5561 #: build/C/man2/perf_event_open.2:2059
5567 #: build/C/man2/perf_event_open.2:2062
5568 msgid "Type of opcode, a bitwise combination of:"
5572 #: build/C/man2/perf_event_open.2:2065
5574 msgid "B<PERF_MEM_OP_NA>"
5578 #: build/C/man2/perf_event_open.2:2068 build/C/man2/perf_event_open.2:2093 build/C/man2/perf_event_open.2:2144 build/C/man2/perf_event_open.2:2168 build/C/man2/perf_event_open.2:2184
5579 msgid "Not available"
5583 #: build/C/man2/perf_event_open.2:2068
5585 msgid "B<PERF_MEM_OP_LOAD>"
5589 #: build/C/man2/perf_event_open.2:2071
5590 msgid "Load instruction"
5594 #: build/C/man2/perf_event_open.2:2071
5596 msgid "B<PERF_MEM_OP_STORE>"
5600 #: build/C/man2/perf_event_open.2:2074
5601 msgid "Store instruction"
5605 #: build/C/man2/perf_event_open.2:2074
5607 msgid "B<PERF_MEM_OP_PFETCH>"
5611 #: build/C/man2/perf_event_open.2:2077
5616 #: build/C/man2/perf_event_open.2:2077
5618 msgid "B<PERF_MEM_OP_EXEC>"
5622 #: build/C/man2/perf_event_open.2:2080
5623 msgid "Executable code"
5627 #: build/C/man2/perf_event_open.2:2082
5633 #: build/C/man2/perf_event_open.2:2087
5635 "Memory hierarchy level hit or miss, a bitwise combination of the following, "
5636 "shifted left by B<PERF_MEM_LVL_SHIFT>:"
5640 #: build/C/man2/perf_event_open.2:2090
5642 msgid "B<PERF_MEM_LVL_NA>"
5646 #: build/C/man2/perf_event_open.2:2093
5648 msgid "B<PERF_MEM_LVL_HIT>"
5652 #: build/C/man2/perf_event_open.2:2096 build/C/man2/perf_event_open.2:2187
5657 #: build/C/man2/perf_event_open.2:2096
5659 msgid "B<PERF_MEM_LVL_MISS>"
5663 #: build/C/man2/perf_event_open.2:2099 build/C/man2/perf_event_open.2:2190
5668 #: build/C/man2/perf_event_open.2:2099
5670 msgid "B<PERF_MEM_LVL_L1>"
5674 #: build/C/man2/perf_event_open.2:2102
5675 msgid "Level 1 cache"
5679 #: build/C/man2/perf_event_open.2:2102
5681 msgid "B<PERF_MEM_LVL_LFB>"
5685 #: build/C/man2/perf_event_open.2:2105
5686 msgid "Line fill buffer"
5690 #: build/C/man2/perf_event_open.2:2105
5692 msgid "B<PERF_MEM_LVL_L2>"
5696 #: build/C/man2/perf_event_open.2:2108
5697 msgid "Level 2 cache"
5701 #: build/C/man2/perf_event_open.2:2108
5703 msgid "B<PERF_MEM_LVL_L3>"
5707 #: build/C/man2/perf_event_open.2:2111
5708 msgid "Level 3 cache"
5712 #: build/C/man2/perf_event_open.2:2111
5714 msgid "B<PERF_MEM_LVL_LOC_RAM>"
5718 #: build/C/man2/perf_event_open.2:2114
5723 #: build/C/man2/perf_event_open.2:2114
5725 msgid "B<PERF_MEM_LVL_REM_RAM1>"
5729 #: build/C/man2/perf_event_open.2:2117
5730 msgid "Remote DRAM 1 hop"
5734 #: build/C/man2/perf_event_open.2:2117
5736 msgid "B<PERF_MEM_LVL_REM_RAM2>"
5740 #: build/C/man2/perf_event_open.2:2120
5741 msgid "Remote DRAM 2 hops"
5745 #: build/C/man2/perf_event_open.2:2120
5747 msgid "B<PERF_MEM_LVL_REM_CCE1>"
5751 #: build/C/man2/perf_event_open.2:2123
5752 msgid "Remote cache 1 hop"
5756 #: build/C/man2/perf_event_open.2:2123
5758 msgid "B<PERF_MEM_LVL_REM_CCE2>"
5762 #: build/C/man2/perf_event_open.2:2126
5763 msgid "Remote cache 2 hops"
5767 #: build/C/man2/perf_event_open.2:2126
5769 msgid "B<PERF_MEM_LVL_IO>"
5773 #: build/C/man2/perf_event_open.2:2129
5778 #: build/C/man2/perf_event_open.2:2129
5780 msgid "B<PERF_MEM_LVL_UNC>"
5784 #: build/C/man2/perf_event_open.2:2132
5785 msgid "Uncached memory"
5789 #: build/C/man2/perf_event_open.2:2134
5791 msgid "I<mem_snoop>"
5795 #: build/C/man2/perf_event_open.2:2138
5797 "Snoop mode, a bitwise combination of the following, shifted left by "
5798 "B<PERF_MEM_SNOOP_SHIFT>:"
5802 #: build/C/man2/perf_event_open.2:2141
5804 msgid "B<PERF_MEM_SNOOP_NA>"
5808 #: build/C/man2/perf_event_open.2:2144
5810 msgid "B<PERF_MEM_SNOOP_NONE>"
5814 #: build/C/man2/perf_event_open.2:2147
5819 #: build/C/man2/perf_event_open.2:2147
5821 msgid "B<PERF_MEM_SNOOP_HIT>"
5825 #: build/C/man2/perf_event_open.2:2150
5830 #: build/C/man2/perf_event_open.2:2150
5832 msgid "B<PERF_MEM_SNOOP_MISS>"
5836 #: build/C/man2/perf_event_open.2:2153
5841 #: build/C/man2/perf_event_open.2:2153
5843 msgid "B<PERF_MEM_SNOOP_HITM>"
5847 #: build/C/man2/perf_event_open.2:2156
5848 msgid "Snoop hit modified"
5852 #: build/C/man2/perf_event_open.2:2158
5858 #: build/C/man2/perf_event_open.2:2162
5860 "Lock instruction, a bitwise combination of the following, shifted left by "
5861 "B<PERF_MEM_LOCK_SHIFT>:"
5865 #: build/C/man2/perf_event_open.2:2165
5867 msgid "B<PERF_MEM_LOCK_NA>"
5871 #: build/C/man2/perf_event_open.2:2168
5873 msgid "B<PERF_MEM_LOCK_LOCKED>"
5877 #: build/C/man2/perf_event_open.2:2171
5878 msgid "Locked transaction"
5882 #: build/C/man2/perf_event_open.2:2173
5888 #: build/C/man2/perf_event_open.2:2178
5890 "TLB access hit or miss, a bitwise combination of the following, shifted left "
5891 "by B<PERF_MEM_TLB_SHIFT>:"
5895 #: build/C/man2/perf_event_open.2:2181
5897 msgid "B<PERF_MEM_TLB_NA>"
5901 #: build/C/man2/perf_event_open.2:2184
5903 msgid "B<PERF_MEM_TLB_HIT>"
5907 #: build/C/man2/perf_event_open.2:2187
5909 msgid "B<PERF_MEM_TLB_MISS>"
5913 #: build/C/man2/perf_event_open.2:2190
5915 msgid "B<PERF_MEM_TLB_L1>"
5919 #: build/C/man2/perf_event_open.2:2193
5924 #: build/C/man2/perf_event_open.2:2193
5926 msgid "B<PERF_MEM_TLB_L2>"
5930 #: build/C/man2/perf_event_open.2:2196
5935 #: build/C/man2/perf_event_open.2:2196
5937 msgid "B<PERF_MEM_TLB_WK>"
5941 #: build/C/man2/perf_event_open.2:2199
5942 msgid "Hardware walker"
5946 #: build/C/man2/perf_event_open.2:2199
5948 msgid "B<PERF_MEM_TLB_OS>"
5952 #: build/C/man2/perf_event_open.2:2202
5953 msgid "OS fault handler"
5957 #: build/C/man2/perf_event_open.2:2205
5959 msgid "I<transaction>"
5963 #: build/C/man2/perf_event_open.2:2211
5965 "If the B<PERF_SAMPLE_TRANSACTION> flag is set, then a 64-bit field is "
5966 "recorded describing the sources of any transactional memory aborts."
5970 #: build/C/man2/perf_event_open.2:2213
5971 msgid "The field is a bitwise combination of the following values:"
5975 #: build/C/man2/perf_event_open.2:2214
5977 msgid "B<PERF_TXN_ELISION>"
5981 #: build/C/man2/perf_event_open.2:2217
5982 msgid "Abort from an elision type transaction (Intel-CPU-specific)."
5986 #: build/C/man2/perf_event_open.2:2217
5988 msgid "B<PERF_TXN_TRANSACTION>"
5992 #: build/C/man2/perf_event_open.2:2220
5993 msgid "Abort from a generic transaction."
5997 #: build/C/man2/perf_event_open.2:2220
5999 msgid "B<PERF_TXN_SYNC>"
6003 #: build/C/man2/perf_event_open.2:2223
6004 msgid "Synchronous abort (related to the reported instruction)."
6008 #: build/C/man2/perf_event_open.2:2223
6010 msgid "B<PERF_TXN_ASYNC>"
6014 #: build/C/man2/perf_event_open.2:2226
6015 msgid "Asynchronous abort (not related to the reported instruction)."
6019 #: build/C/man2/perf_event_open.2:2226
6021 msgid "B<PERF_TXN_RETRY>"
6025 #: build/C/man2/perf_event_open.2:2229
6026 msgid "Retryable abort (retrying the transaction may have succeeded)."
6030 #: build/C/man2/perf_event_open.2:2229
6032 msgid "B<PERF_TXN_CONFLICT>"
6036 #: build/C/man2/perf_event_open.2:2232
6037 msgid "Abort due to memory conflicts with other threads."
6041 #: build/C/man2/perf_event_open.2:2232
6043 msgid "B<PERF_TXN_CAPACITY_WRITE>"
6047 #: build/C/man2/perf_event_open.2:2235
6048 msgid "Abort due to write capacity overflow."
6052 #: build/C/man2/perf_event_open.2:2235
6054 msgid "B<PERF_TXN_CAPACITY_READ>"
6058 #: build/C/man2/perf_event_open.2:2238
6059 msgid "Abort due to read capacity overflow."
6063 #: build/C/man2/perf_event_open.2:2245
6065 "In addition, a user-specified abort code can be obtained from the high 32 "
6066 "bits of the field by shifting right by B<PERF_TXN_ABORT_SHIFT> and masking "
6067 "with B<PERF_TXN_ABORT_MASK>."
6071 #: build/C/man2/perf_event_open.2:2246
6073 msgid "B<PERF_RECORD_MMAP2>"
6077 #: build/C/man2/perf_event_open.2:2255
6079 "This record includes extended information on B<mmap>(2) calls returning "
6080 "executable mappings. The format is similar to that of the "
6081 "B<PERF_RECORD_MMAP> record, but includes extra values that allow uniquely "
6082 "identifying shared mappings."
6086 #: build/C/man2/perf_event_open.2:2274
6090 " struct perf_event_header header;\n"
6099 " u64 ino_generation;\n"
6102 " char filename[];\n"
6103 " struct sample_id sample_id;\n"
6108 #: build/C/man2/perf_event_open.2:2285
6109 msgid "is the address of the allocated memory."
6113 #: build/C/man2/perf_event_open.2:2285
6119 #: build/C/man2/perf_event_open.2:2288
6120 msgid "is the length of the allocated memory."
6124 #: build/C/man2/perf_event_open.2:2288
6130 #: build/C/man2/perf_event_open.2:2291
6131 msgid "is the page offset of the allocated memory."
6135 #: build/C/man2/perf_event_open.2:2291
6141 #: build/C/man2/perf_event_open.2:2294
6142 msgid "is the major ID of the underlying device."
6146 #: build/C/man2/perf_event_open.2:2294
6152 #: build/C/man2/perf_event_open.2:2297
6153 msgid "is the minor ID of the underlying device."
6157 #: build/C/man2/perf_event_open.2:2297
6163 #: build/C/man2/perf_event_open.2:2300
6164 msgid "is the inode number."
6168 #: build/C/man2/perf_event_open.2:2300
6170 msgid "I<ino_generation>"
6174 #: build/C/man2/perf_event_open.2:2303
6175 msgid "is the inode generation."
6179 #: build/C/man2/perf_event_open.2:2303
6185 #: build/C/man2/perf_event_open.2:2306
6186 msgid "is the protection information."
6190 #: build/C/man2/perf_event_open.2:2306
6196 #: build/C/man2/perf_event_open.2:2309
6197 msgid "is the flags information."
6201 #: build/C/man2/perf_event_open.2:2309
6207 #: build/C/man2/perf_event_open.2:2312
6208 msgid "is a string describing the backing of the allocated memory."
6212 #: build/C/man2/perf_event_open.2:2314
6214 msgid "Overflow handling"
6218 #: build/C/man2/perf_event_open.2:2327
6220 "Events can be set to notify when a threshold is crossed, indicating an "
6221 "overflow. Overflow conditions can be captured by monitoring the event file "
6222 "descriptor with B<poll>(2), B<select>(2), or B<epoll>(2). Alternately, a "
6223 "SIGIO signal handler can be created and the event configured with "
6224 "B<fcntl>(2) to generate SIGIO signals."
6228 #: build/C/man2/perf_event_open.2:2331
6230 "Overflows are generated only by sampling events (I<sample_period> must have "
6235 #: build/C/man2/perf_event_open.2:2333
6236 msgid "There are two ways to generate overflow notifications."
6240 #: build/C/man2/perf_event_open.2:2343
6242 "The first is to set a I<wakeup_events> or I<wakeup_watermark> value that "
6243 "will trigger if a certain number of samples or bytes have been written to "
6244 "the mmap ring buffer. In this case B<POLL_IN> is indicated."
6248 #: build/C/man2/perf_event_open.2:2355
6250 "The other way is by use of the B<PERF_EVENT_IOC_REFRESH> ioctl. This ioctl "
6251 "adds to a counter that decrements each time the event overflows. When "
6252 "nonzero, B<POLL_IN> is indicated, but once the counter reaches 0 B<POLL_HUP> "
6253 "is indicated and the underlying event is disabled."
6256 #. commit 179033b3e064d2cd3f5f9945e76b0a0f0fbf4883
6258 #: build/C/man2/perf_event_open.2:2361
6260 "Starting with Linux 3.18, B<POLL_HUP> is indicated if the event being "
6261 "monitored is attached to a different process and that process exits."
6265 #: build/C/man2/perf_event_open.2:2361
6267 msgid "rdpmc instruction"
6270 #. commit c7206205d00ab375839bd6c7ddb247d600693c09
6272 #: build/C/man2/perf_event_open.2:2369
6274 "Starting with Linux 3.4 on x86, you can use the I<rdpmc> instruction to get "
6275 "low-latency reads without having to enter the kernel. Note that using "
6276 "I<rdpmc> is not necessarily faster than other methods for reading event "
6281 #: build/C/man2/perf_event_open.2:2374
6283 "Support for this can be detected with the I<cap_usr_rdpmc> field in the mmap "
6284 "page; documentation on how to calculate event values can be found in that "
6289 #: build/C/man2/perf_event_open.2:2374
6291 msgid "perf_event ioctl calls"
6295 #: build/C/man2/perf_event_open.2:2379
6296 msgid "Various ioctls act on B<perf_event_open>() file descriptors:"
6300 #: build/C/man2/perf_event_open.2:2379
6302 msgid "B<PERF_EVENT_IOC_ENABLE>"
6306 #: build/C/man2/perf_event_open.2:2383
6308 "This enables the individual event or event group specified by the file "
6309 "descriptor argument."
6313 #: build/C/man2/perf_event_open.2:2389
6315 "If the B<PERF_IOC_FLAG_GROUP> bit is set in the ioctl argument, then all "
6316 "events in a group are enabled, even if the event specified is not the group "
6317 "leader (but see BUGS)."
6321 #: build/C/man2/perf_event_open.2:2389
6323 msgid "B<PERF_EVENT_IOC_DISABLE>"
6327 #: build/C/man2/perf_event_open.2:2393
6329 "This disables the individual counter or event group specified by the file "
6330 "descriptor argument."
6334 #: build/C/man2/perf_event_open.2:2400
6336 "Enabling or disabling the leader of a group enables or disables the entire "
6337 "group; that is, while the group leader is disabled, none of the counters in "
6338 "the group will count. Enabling or disabling a member of a group other than "
6339 "the leader affects only that counter; disabling a non-leader stops that "
6340 "counter from counting but doesn't affect any other counter."
6344 #: build/C/man2/perf_event_open.2:2406
6346 "If the B<PERF_IOC_FLAG_GROUP> bit is set in the ioctl argument, then all "
6347 "events in a group are disabled, even if the event specified is not the group "
6348 "leader (but see BUGS)."
6352 #: build/C/man2/perf_event_open.2:2406
6354 msgid "B<PERF_EVENT_IOC_REFRESH>"
6358 #: build/C/man2/perf_event_open.2:2420
6360 "Non-inherited overflow counters can use this to enable a counter for a "
6361 "number of overflows specified by the argument, after which it is disabled. "
6362 "Subsequent calls of this ioctl add the argument value to the current count. "
6363 "An overflow notification with B<POLL_IN> set will happen on each overflow "
6364 "until the count reaches 0; when that happens a notification with B<POLL_HUP> "
6365 "set is sent and the event is disabled. Using an argument of 0 is considered "
6366 "undefined behavior."
6370 #: build/C/man2/perf_event_open.2:2420
6372 msgid "B<PERF_EVENT_IOC_RESET>"
6376 #: build/C/man2/perf_event_open.2:2430
6378 "Reset the event count specified by the file descriptor argument to zero. "
6379 "This resets only the counts; there is no way to reset the multiplexing "
6380 "I<time_enabled> or I<time_running> values."
6384 #: build/C/man2/perf_event_open.2:2436
6386 "If the B<PERF_IOC_FLAG_GROUP> bit is set in the ioctl argument, then all "
6387 "events in a group are reset, even if the event specified is not the group "
6388 "leader (but see BUGS)."
6392 #: build/C/man2/perf_event_open.2:2436
6394 msgid "B<PERF_EVENT_IOC_PERIOD>"
6398 #: build/C/man2/perf_event_open.2:2439
6399 msgid "This updates the overflow period for the event."
6402 #. commit 3581fe0ef37ce12ac7a4f74831168352ae848edc
6403 #. commit bad7192b842c83e580747ca57104dd51fe08c223
6405 #: build/C/man2/perf_event_open.2:2447
6407 "Since Linux 3.7 (on ARM) and Linux 3.14 (all other architectures), the new "
6408 "period takes effect immediately. On older kernels, the new period did not "
6409 "take effect until after the next overflow."
6413 #: build/C/man2/perf_event_open.2:2450
6415 "The argument is a pointer to a 64-bit value containing the desired new "
6419 #. commit ad0cf3478de8677f720ee06393b3147819568d6a
6421 #: build/C/man2/perf_event_open.2:2455
6422 msgid "Prior to Linux 2.6.36 this ioctl always failed due to a bug in the kernel."
6426 #: build/C/man2/perf_event_open.2:2456
6428 msgid "B<PERF_EVENT_IOC_SET_OUTPUT>"
6432 #: build/C/man2/perf_event_open.2:2461
6434 "This tells the kernel to report event notifications to the specified file "
6435 "descriptor rather than the default one. The file descriptors must all be on "
6440 #: build/C/man2/perf_event_open.2:2464
6442 "The argument specifies the desired file descriptor, or -1 if output should "
6447 #: build/C/man2/perf_event_open.2:2464
6449 msgid "B<PERF_EVENT_IOC_SET_FILTER> (since Linux 2.6.33)"
6452 #. commit 6fb2915df7f0747d9044da9dbff5b46dc2e20830
6454 #: build/C/man2/perf_event_open.2:2468
6455 msgid "This adds an ftrace filter to this event."
6459 #: build/C/man2/perf_event_open.2:2470
6460 msgid "The argument is a pointer to the desired ftrace filter."
6464 #: build/C/man2/perf_event_open.2:2470
6466 msgid "B<PERF_EVENT_IOC_ID> (since Linux 3.12)"
6469 #. commit cf4957f17f2a89984915ea808876d9c82225b862
6471 #: build/C/man2/perf_event_open.2:2474
6472 msgid "This returns the event ID value for the given event file descriptor."
6476 #: build/C/man2/perf_event_open.2:2477
6477 msgid "The argument is a pointer to a 64-bit unsigned integer to hold the result."
6481 #: build/C/man2/perf_event_open.2:2477
6487 #: build/C/man2/perf_event_open.2:2490
6489 "A process can enable or disable all the event groups that are attached to it "
6490 "using the B<prctl>(2) B<PR_TASK_PERF_EVENTS_ENABLE> and "
6491 "B<PR_TASK_PERF_EVENTS_DISABLE> operations. This applies to all counters on "
6492 "the calling process, whether created by this process or by another, and does "
6493 "not affect any counters that this process has created on other processes. "
6494 "It enables or disables only the group leaders, not any other members in the "
6499 #: build/C/man2/perf_event_open.2:2490
6501 msgid "perf_event related configuration files"
6505 #: build/C/man2/perf_event_open.2:2493
6506 msgid "Files in I</proc/sys/kernel/>"
6510 #: build/C/man2/perf_event_open.2:2494
6512 msgid "I</proc/sys/kernel/perf_event_paranoid>"
6516 #: build/C/man2/perf_event_open.2:2500
6518 "The I<perf_event_paranoid> file can be set to restrict access to the "
6519 "performance counters."
6523 #: build/C/man2/perf_event_open.2:2501
6529 #: build/C/man2/perf_event_open.2:2503
6530 msgid "allow only user-space measurements."
6534 #: build/C/man2/perf_event_open.2:2503
6540 #: build/C/man2/perf_event_open.2:2505
6541 msgid "allow both kernel and user measurements (default)."
6545 #: build/C/man2/perf_event_open.2:2505
6551 #: build/C/man2/perf_event_open.2:2507
6552 msgid "allow access to CPU-specific data but not raw tracepoint samples."
6556 #: build/C/man2/perf_event_open.2:2507
6562 #: build/C/man2/perf_event_open.2:2509
6563 msgid "no restrictions."
6567 #: build/C/man2/perf_event_open.2:2515
6569 "The existence of the I<perf_event_paranoid> file is the official method for "
6570 "determining if a kernel supports B<perf_event_open>()."
6574 #: build/C/man2/perf_event_open.2:2515
6576 msgid "I</proc/sys/kernel/perf_event_max_sample_rate>"
6580 #: build/C/man2/perf_event_open.2:2524
6582 "This sets the maximum sample rate. Setting this too high can allow users to "
6583 "sample at a rate that impacts overall machine performance and potentially "
6584 "lock up the machine. The default value is 100000 (samples per second)."
6588 #: build/C/man2/perf_event_open.2:2524
6590 msgid "I</proc/sys/kernel/perf_event_mlock_kb>"
6594 #: build/C/man2/perf_event_open.2:2530
6596 "Maximum number of pages an unprivileged user can B<mlock>(2). The default "
6601 #: build/C/man2/perf_event_open.2:2534
6602 msgid "Files in I</sys/bus/event_source/devices/>"
6606 #: build/C/man2/perf_event_open.2:2540
6608 "Since Linux 2.6.34, the kernel supports having multiple PMUs available for "
6609 "monitoring. Information on how to program these PMUs can be found under "
6610 "I</sys/bus/event_source/devices/>. Each subdirectory corresponds to a "
6615 #: build/C/man2/perf_event_open.2:2540
6617 msgid "I</sys/bus/event_source/devices/*/type> (since Linux 2.6.38)"
6620 #. commit abe43400579d5de0078c2d3a760e6598e183f871
6622 #: build/C/man2/perf_event_open.2:2548
6624 "This contains an integer that can be used in the I<type> field of "
6625 "I<perf_event_attr> to indicate that you wish to use this PMU."
6629 #: build/C/man2/perf_event_open.2:2548
6631 msgid "I</sys/bus/event_source/devices/*/rdpmc> (since Linux 3.4)"
6634 #. commit 0c9d42ed4cee2aa1dfc3a260b741baae8615744f
6636 #: build/C/man2/perf_event_open.2:2554
6638 "If this file is 1, then direct user-space access to the performance counter "
6639 "registers is allowed via the rdpmc instruction. This can be disabled by "
6640 "echoing 0 to the file."
6644 #: build/C/man2/perf_event_open.2:2554
6646 msgid "I</sys/bus/event_source/devices/*/format/> (since Linux 3.4)"
6649 #. commit 641cc938815dfd09f8fa1ec72deb814f0938ac33
6651 #: build/C/man2/perf_event_open.2:2563
6653 "This subdirectory contains information on the architecture-specific "
6654 "subfields available for programming the various I<config> fields in the "
6655 "I<perf_event_attr> struct."
6659 #: build/C/man2/perf_event_open.2:2574
6661 "The content of each file is the name of the config field, followed by a "
6662 "colon, followed by a series of integer bit ranges separated by commas. For "
6663 "example, the file I<event> may contain the value I<config1:1,6-10,44> which "
6664 "indicates that event is an attribute that occupies bits 1,6-10, and 44 of "
6665 "I<perf_event_attr::config1>."
6669 #: build/C/man2/perf_event_open.2:2574
6671 msgid "I</sys/bus/event_source/devices/*/events/> (since Linux 3.4)"
6674 #. commit 641cc938815dfd09f8fa1ec72deb814f0938ac33
6676 #: build/C/man2/perf_event_open.2:2584
6678 "This subdirectory contains files with predefined events. The contents are "
6679 "strings describing the event settings expressed in terms of the fields found "
6680 "in the previously mentioned I<./format/> directory. These are not "
6681 "necessarily complete lists of all events supported by a PMU, but usually a "
6682 "subset of events deemed useful or interesting."
6686 #: build/C/man2/perf_event_open.2:2592
6688 "The content of each file is a list of attribute names separated by commas. "
6689 "Each entry has an optional value (either hex or decimal). If no value is "
6690 "specified, then it is assumed to be a single-bit field with a value of 1. "
6691 "An example entry may look like this: I<event=0x2,inv,ldlat=3>."
6695 #: build/C/man2/perf_event_open.2:2592
6697 msgid "I</sys/bus/event_source/devices/*/uevent>"
6701 #: build/C/man2/perf_event_open.2:2596
6703 "This file is the standard kernel device interface for injecting hotplug "
6708 #: build/C/man2/perf_event_open.2:2596
6710 msgid "I</sys/bus/event_source/devices/*/cpumask> (since Linux 3.7)"
6713 #. commit 314d9f63f385096580e9e2a06eaa0745d92fe4ac
6715 #: build/C/man2/perf_event_open.2:2606
6717 "The I<cpumask> file contains a comma-separated list of integers that "
6718 "indicate a representative CPU number for each socket (package) on the "
6719 "motherboard. This is needed when setting up uncore or northbridge events, "
6720 "as those PMUs present socket-wide events."
6724 #: build/C/man2/perf_event_open.2:2613
6726 "B<perf_event_open>() returns the new file descriptor, or -1 if an error "
6727 "occurred (in which case, I<errno> is set appropriately)."
6731 #: build/C/man2/perf_event_open.2:2618
6733 "The errors returned by B<perf_event_open>() can be inconsistent, and may "
6734 "vary across processor architectures and performance monitoring units."
6738 #: build/C/man2/perf_event_open.2:2618
6744 #: build/C/man2/perf_event_open.2:2635
6746 "Returned if the I<perf_event_attr> I<size> value is too small (smaller than "
6747 "B<PERF_ATTR_SIZE_VER0>), too big (larger than the page size), or larger than "
6748 "the kernel supports and the extra bytes are not zero. When B<E2BIG> is "
6749 "returned, the I<perf_event_attr> I<size> field is overwritten by the kernel "
6750 "to be the size of the structure it was expecting."
6754 #: build/C/man2/perf_event_open.2:2649
6756 "Returned when the requested event requires B<CAP_SYS_ADMIN> permissions (or "
6757 "a more permissive perf_event paranoid setting). Some common cases where an "
6758 "unprivileged process may encounter this error: attaching to a process owned "
6759 "by a different user; monitoring all processes on a given CPU (i.e., "
6760 "specifying the I<pid> argument as -1); and not setting I<exclude_kernel> "
6761 "when the paranoid setting requires it."
6765 #: build/C/man2/perf_event_open.2:2659
6767 "Returned if the I<group_fd> file descriptor is not valid, or, if "
6768 "B<PERF_FLAG_PID_CGROUP> is set, the cgroup file descriptor in I<pid> is not "
6773 #: build/C/man2/perf_event_open.2:2664
6774 msgid "Returned if the I<attr> pointer points at an invalid memory address."
6778 #: build/C/man2/perf_event_open.2:2690
6780 "Returned if the specified event is invalid. There are many possible reasons "
6781 "for this. A not-exhaustive list: I<sample_freq> is higher than the maximum "
6782 "setting; the I<cpu> to monitor does not exist; I<read_format> is out of "
6783 "range; I<sample_type> is out of range; the I<flags> value is out of range; "
6784 "I<exclusive> or I<pinned> set and the event is not a group leader; the event "
6785 "I<config> values are out of range or set reserved bits; the generic event "
6786 "selected is not supported; or there is not enough room to add the selected "
6791 #: build/C/man2/perf_event_open.2:2690
6797 #: build/C/man2/perf_event_open.2:2696
6799 "Each opened event uses one file descriptor. If a large number of events are "
6800 "opened the per-user file descriptor limit (often 1024) will be hit and no "
6801 "more events can be created."
6805 #: build/C/man2/perf_event_open.2:2700
6806 msgid "Returned when the event involves a feature not supported by the current CPU."
6810 #: build/C/man2/perf_event_open.2:2700 build/C/man2/quotactl.2:440
6816 #: build/C/man2/perf_event_open.2:2707
6818 "Returned if the I<type> setting is not valid. This error is also returned "
6819 "for some unsupported generic events."
6823 #: build/C/man2/perf_event_open.2:2707
6828 #. commit aa2bc1ade59003a379ffc485d6da2d92ea3370a6
6830 #: build/C/man2/perf_event_open.2:2718
6832 "Prior to Linux 3.3, if there was not enough room for the event, B<ENOSPC> "
6833 "was returned. In Linux 3.3, this was changed to B<EINVAL>. B<ENOSPC> is "
6834 "still returned if you try to add more breakpoint events than supported by "
6839 #: build/C/man2/perf_event_open.2:2725
6841 "Returned if B<PERF_SAMPLE_STACK_USER> is set in I<sample_type> and it is not "
6842 "supported by hardware."
6846 #: build/C/man2/perf_event_open.2:2732
6848 "Returned if an event requiring a specific hardware feature is requested but "
6849 "there is no hardware support. This includes requesting low-skid events if "
6850 "not supported, branch tracing if it is not available, sampling if no PMU "
6851 "interrupt is available, and branch stacks for software events."
6855 #: build/C/man2/perf_event_open.2:2737
6857 "Returned on many (but not all) architectures when an unsupported "
6858 "I<exclude_hv>, I<exclude_idle>, I<exclude_user>, or I<exclude_kernel> "
6859 "setting is specified."
6862 #. commit a4e95fc2cbb31d70a65beffeaf8773f881328c34
6864 #: build/C/man2/perf_event_open.2:2746
6866 "It can also happen, as with B<EACCES>, when the requested event requires "
6867 "B<CAP_SYS_ADMIN> permissions (or a more permissive perf_event paranoid "
6868 "setting). This includes setting a breakpoint on a kernel address, and "
6869 "(since Linux 3.13) setting a kernel function-trace tracepoint."
6873 #: build/C/man2/perf_event_open.2:2749
6874 msgid "Returned if attempting to attach to a process that does not exist."
6878 #: build/C/man2/perf_event_open.2:2749
6883 #. commit 0793a61d4df8daeac6492dbf8d2f3e5713caae5e
6884 #. commit cdd6c482c9ff9c55475ee7392ec8f672eddb7be6
6886 #: build/C/man2/perf_event_open.2:2756
6888 "B<perf_event_open>() was introduced in Linux 2.6.31 but was called "
6889 "B<perf_counter_open>(). It was renamed in Linux 2.6.32."
6893 #: build/C/man2/perf_event_open.2:2761
6895 "This B<perf_event_open>() system call Linux- specific and should not be "
6896 "used in programs intended to be portable."
6900 #: build/C/man2/perf_event_open.2:2765
6902 "Glibc does not provide a wrapper for this system call; call it using "
6903 "B<syscall>(2). See the example below."
6907 #: build/C/man2/perf_event_open.2:2771
6909 "The official way of knowing if B<perf_event_open>() support is enabled is "
6910 "checking for the existence of the file "
6911 "I</proc/sys/kernel/perf_event_paranoid>."
6915 #: build/C/man2/perf_event_open.2:2771 build/C/man2/pivot_root.2:134 build/C/man2/ptrace.2:2006
6920 #. commit ba0a6c9f6fceed11c6a99e8326f0477fe383e6b5
6922 #: build/C/man2/perf_event_open.2:2779
6924 "The B<F_SETOWN_EX> option to B<fcntl>(2) is needed to properly get overflow "
6925 "signals in threads. This was introduced in Linux 2.6.32."
6928 #. commit b690081d4d3f6a23541493f1682835c3cd5c54a1
6930 #: build/C/man2/perf_event_open.2:2789
6932 "Prior to Linux 2.6.33 (at least for x86), the kernel did not check if events "
6933 "could be scheduled together until read time. The same happens on all known "
6934 "kernels if the NMI watchdog is enabled. This means to see if a given set of "
6935 "events works you have to B<perf_event_open>(), start, then read before you "
6936 "know for sure you can get valid measurements."
6939 #. FIXME: cannot find a kernel commit for this one
6941 #: build/C/man2/perf_event_open.2:2794
6943 "Prior to Linux 2.6.34, event constraints were not enforced by the kernel. "
6944 "In that case, some events would silently return \"0\" if the kernel "
6945 "scheduled them in an improper counter slot."
6948 #. commit 45e16a6834b6af098702e5ea6c9a40de42ff77d8
6950 #: build/C/man2/perf_event_open.2:2798
6952 "Prior to Linux 2.6.34, there was a bug when multiplexing where the wrong "
6953 "results could be returned."
6956 #. commit 38b435b16c36b0d863efcf3f07b34a6fac9873fd
6958 #: build/C/man2/perf_event_open.2:2802
6960 "Kernels from Linux 2.6.35 to Linux 2.6.39 can quickly crash the kernel if "
6961 "\"inherit\" is enabled and many threads are started."
6964 #. commit 050735b08ca8a016bbace4445fa025b88fee770b
6966 #: build/C/man2/perf_event_open.2:2807
6968 "Prior to Linux 2.6.35, B<PERF_FORMAT_GROUP> did not work with attached "
6973 #: build/C/man2/perf_event_open.2:2812
6975 "In older Linux 2.6 versions, refreshing an event group leader refreshed all "
6976 "siblings, and refreshing with a parameter of 0 enabled infinite refresh. "
6977 "This behavior is unsupported and should not be relied on."
6980 #. commit 4ec8363dfc1451f8c8f86825731fe712798ada02
6982 #: build/C/man2/perf_event_open.2:2819
6984 "There is a bug in the kernel code between Linux 2.6.36 and Linux 3.0 that "
6985 "ignores the \"watermark\" field and acts as if a wakeup_event was chosen if "
6986 "the union has a nonzero value in it."
6989 #. commit 724b6daa13e100067c30cfc4d1ad06629609dc4e
6991 #: build/C/man2/perf_event_open.2:2826
6993 "From Linux 2.6.31 to Linux 3.4, the B<PERF_IOC_FLAG_GROUP> ioctl argument "
6994 "was broken and would repeatedly operate on the event specified rather than "
6995 "iterating across all sibling events in a group."
6998 #. commit fa7315871046b9a4c48627905691dbde57e51033
7000 #: build/C/man2/perf_event_open.2:2838
7002 "From Linux 3.4 to Linux 3.11, the mmap I<cap_usr_rdpmc> and I<cap_usr_time> "
7003 "bits mapped to the same location. Code should migrate to the new "
7004 "I<cap_user_rdpmc> and I<cap_user_time> fields instead."
7007 #. commit f287d332ce835f77a4f5077d2c0ef1e3f9ea42d2
7009 #: build/C/man2/perf_event_open.2:2844
7011 "Always double-check your results! Various generalized events have had wrong "
7012 "values. For example, retired branches measured the wrong thing on AMD "
7013 "machines until Linux 2.6.35."
7017 #: build/C/man2/perf_event_open.2:2844 build/C/man2/process_vm_readv.2:311 build/C/man2/splice.2:237 build/C/man2/tee.2:136
7023 #: build/C/man2/perf_event_open.2:2848
7025 "The following is a short example that measures the total instruction count "
7026 "of a call to B<printf>(3)."
7030 #: build/C/man2/perf_event_open.2:2857
7033 "#include E<lt>stdlib.hE<gt>\n"
7034 "#include E<lt>stdio.hE<gt>\n"
7035 "#include E<lt>unistd.hE<gt>\n"
7036 "#include E<lt>string.hE<gt>\n"
7037 "#include E<lt>sys/ioctl.hE<gt>\n"
7038 "#include E<lt>linux/perf_event.hE<gt>\n"
7039 "#include E<lt>asm/unistd.hE<gt>\n"
7043 #: build/C/man2/perf_event_open.2:2863
7047 "perf_event_open(struct perf_event_attr *hw_event, pid_t pid,\n"
7048 " int cpu, int group_fd, unsigned long flags)\n"
7054 #: build/C/man2/perf_event_open.2:2868
7057 " ret = syscall(__NR_perf_event_open, hw_event, pid, cpu,\n"
7058 " group_fd, flags);\n"
7064 #: build/C/man2/perf_event_open.2:2875
7068 "main(int argc, char **argv)\n"
7070 " struct perf_event_attr pe;\n"
7071 " long long count;\n"
7076 #: build/C/man2/perf_event_open.2:2883
7079 " memset(&pe, 0, sizeof(struct perf_event_attr));\n"
7080 " pe.type = PERF_TYPE_HARDWARE;\n"
7081 " pe.size = sizeof(struct perf_event_attr);\n"
7082 " pe.config = PERF_COUNT_HW_INSTRUCTIONS;\n"
7083 " pe.disabled = 1;\n"
7084 " pe.exclude_kernel = 1;\n"
7085 " pe.exclude_hv = 1;\n"
7089 #: build/C/man2/perf_event_open.2:2889
7092 " fd = perf_event_open(&pe, 0, -1, -1, 0);\n"
7093 " if (fd == -1) {\n"
7094 " fprintf(stderr, \"Error opening leader %llx\\en\", pe.config);\n"
7095 " exit(EXIT_FAILURE);\n"
7100 #: build/C/man2/perf_event_open.2:2892
7103 " ioctl(fd, PERF_EVENT_IOC_RESET, 0);\n"
7104 " ioctl(fd, PERF_EVENT_IOC_ENABLE, 0);\n"
7108 #: build/C/man2/perf_event_open.2:2894
7110 msgid " printf(\"Measuring instruction count for this printf\\en\");\n"
7114 #: build/C/man2/perf_event_open.2:2897
7117 " ioctl(fd, PERF_EVENT_IOC_DISABLE, 0);\n"
7118 " read(fd, &count, sizeof(long long));\n"
7122 #: build/C/man2/perf_event_open.2:2899
7124 msgid " printf(\"Used %lld instructions\\en\", count);\n"
7128 #: build/C/man2/perf_event_open.2:2902
7136 #: build/C/man2/perf_event_open.2:2909
7137 msgid "B<fcntl>(2), B<mmap>(2), B<open>(2), B<prctl>(2), B<read>(2)"
7141 #: build/C/man2/perfmonctl.2:27
7147 #: build/C/man2/perfmonctl.2:27
7153 #: build/C/man2/perfmonctl.2:30
7154 msgid "perfmonctl - interface to IA-64 performance monitoring unit"
7158 #: build/C/man2/perfmonctl.2:34
7161 "B<#include E<lt>syscall.hE<gt>>\n"
7162 "B<#include E<lt>perfmon.hE<gt>>\n"
7166 #: build/C/man2/perfmonctl.2:36
7169 "B<long perfmonctl(int >I<fd>B<, int >I<cmd>B<, void *>I<arg>B<, int "
7174 #: build/C/man2/perfmonctl.2:47
7176 "The IA-64-specific B<perfmonctl>() system call provides an interface to the "
7177 "PMU (performance monitoring unit). The PMU consists of PMD (performance "
7178 "monitoring data) registers and PMC (performance monitoring control) "
7179 "registers, which gather hardware statistics."
7183 #: build/C/man2/perfmonctl.2:57
7185 "B<perfmonctl>() applies the operation I<cmd> to the input arguments "
7186 "specified by I<arg>. The number of arguments is defined by I<narg>. The "
7187 "I<fd> argument specifies the perfmon context to operate on."
7191 #: build/C/man2/perfmonctl.2:61
7192 msgid "Supported values for I<cmd> are:"
7196 #: build/C/man2/perfmonctl.2:61
7198 msgid "B<PFM_CREATE_CONTEXT>"
7202 #: build/C/man2/perfmonctl.2:65
7205 "B<perfmonctl(int >I<fd>B<, PFM_CREATE_CONTEXT, pfarg_context_t *>I<ctxt>B<, "
7210 #: build/C/man2/perfmonctl.2:67
7211 msgid "Set up a context."
7215 #: build/C/man2/perfmonctl.2:74
7217 "The I<fd> parameter is ignored. A new perfmon context is created as "
7218 "specified in I<ctxt> and its file descriptor is returned in "
7219 "I<ctxt-E<gt>ctx_fd>."
7223 #: build/C/man2/perfmonctl.2:86
7225 "The file descriptor can be used in subsequent calls to B<perfmonctl>() and "
7226 "can be used to read event notifications (type I<pfm_msg_t>) using "
7227 "B<read>(2). The file descriptor is pollable using B<select>(2), B<poll>(2), "
7232 #: build/C/man2/perfmonctl.2:90
7233 msgid "The context can be destroyed by calling B<close>(2) on the file descriptor."
7237 #: build/C/man2/perfmonctl.2:90
7239 msgid "B<PFM_WRITE_PMCS>"
7243 #: build/C/man2/perfmonctl.2:95
7245 msgid "B<perfmonctl(int >I<fd>B<, PFM_WRITE_PMCS, pfarg_reg_t *>I<pmcs>B<, n);>\n"
7249 #: build/C/man2/perfmonctl.2:97
7250 msgid "Set PMC registers."
7254 #: build/C/man2/perfmonctl.2:97
7256 msgid "B<PFM_WRITE_PMDS>"
7260 #: build/C/man2/perfmonctl.2:101
7262 msgid "B<perfmonctl(int >I<fd>B<, PFM_WRITE_PMDS, pfarg_reg_t *>I<pmds>B<, n);>\n"
7267 #: build/C/man2/perfmonctl.2:104
7268 msgid "Set PMD registers."
7272 #: build/C/man2/perfmonctl.2:104
7274 msgid "B<PFM_READ_PMDS>"
7278 #: build/C/man2/perfmonctl.2:109
7280 msgid "B<perfmonctl(int >I<fd>B<, PFM_READ_PMDS, pfarg_reg_t *>I<pmds>B<, n);>\n"
7284 #: build/C/man2/perfmonctl.2:111
7285 msgid "Read PMD registers."
7289 #: build/C/man2/perfmonctl.2:111
7291 msgid "B<PFM_START>"
7294 #. .BI "perfmonctl(int " fd ", PFM_START, arg, 1);
7296 #: build/C/man2/perfmonctl.2:117
7298 msgid "B<perfmonctl(int >I<fd>B<, PFM_START, NULL, 0);>\n"
7302 #: build/C/man2/perfmonctl.2:119
7303 msgid "Start monitoring."
7307 #: build/C/man2/perfmonctl.2:119
7313 #: build/C/man2/perfmonctl.2:124
7315 msgid "B<perfmonctl(int >I<fd>B<, PFM_STOP, NULL, 0);>\n"
7319 #: build/C/man2/perfmonctl.2:126
7320 msgid "Stop monitoring."
7324 #: build/C/man2/perfmonctl.2:126
7326 msgid "B<PFM_LOAD_CONTEXT>"
7330 #: build/C/man2/perfmonctl.2:131
7333 "B<perfmonctl(int >I<fd>B<, PFM_LOAD_CONTEXT, pfarg_load_t *>I<largs>B<, "
7338 #: build/C/man2/perfmonctl.2:133
7339 msgid "Attach the context to a thread."
7343 #: build/C/man2/perfmonctl.2:133
7345 msgid "B<PFM_UNLOAD_CONTEXT>"
7349 #: build/C/man2/perfmonctl.2:138
7351 msgid "B<perfmonctl(int >I<fd>B<, PFM_UNLOAD_CONTEXT, NULL, 0);>\n"
7355 #: build/C/man2/perfmonctl.2:140
7356 msgid "Detach the context from a thread."
7360 #: build/C/man2/perfmonctl.2:140
7362 msgid "B<PFM_RESTART>"
7366 #: build/C/man2/perfmonctl.2:145
7368 msgid "B<perfmonctl(int >I<fd>B<, PFM_RESTART, NULL, 0);>\n"
7372 #: build/C/man2/perfmonctl.2:147
7373 msgid "Restart monitoring after receiving an overflow notification."
7377 #: build/C/man2/perfmonctl.2:147
7379 msgid "B<PFM_GET_FEATURES>"
7383 #: build/C/man2/perfmonctl.2:152
7386 "B<perfmonctl(int >I<fd>B<, PFM_GET_FEARURES, pfarg_features_t *>I<arg>B<, "
7391 #: build/C/man2/perfmonctl.2:153
7393 msgid "B<PFM_DEBUG>"
7397 #: build/C/man2/perfmonctl.2:158
7399 msgid "B<perfmonctl(int >I<fd>B<, PFM_DEBUG, >I<val>B<, 0);>\n"
7403 #: build/C/man2/perfmonctl.2:162
7404 msgid "If I<val> is nonzero, enable debugging mode, otherwise disable."
7408 #: build/C/man2/perfmonctl.2:162
7410 msgid "B<PFM_GET_PMC_RESET_VAL>"
7414 #: build/C/man2/perfmonctl.2:167
7417 "B<perfmonctl(int >I<fd>B<, PFM_GET_PMC_RESET_VAL, pfarg_reg_t * >I<req>B<, "
7424 #. .B PFM_CREATE_EVTSETS
7426 #. create or modify event sets
7428 #. .BI "perfmonctl(int " fd ", PFM_CREATE_EVTSETS, pfarg_setdesc_t *desc , n);
7431 #. .B PFM_DELETE_EVTSETS
7432 #. delete event sets
7434 #. .BI "perfmonctl(int " fd ", PFM_DELETE_EVTSET, pfarg_setdesc_t *desc , n);
7437 #. .B PFM_GETINFO_EVTSETS
7438 #. get information about event sets
7440 #. .BI "perfmonctl(int " fd ", PFM_GETINFO_EVTSETS, pfarg_setinfo_t *info, n);
7443 #: build/C/man2/perfmonctl.2:190
7444 msgid "Reset PMC registers to default values."
7448 #: build/C/man2/perfmonctl.2:196
7450 "B<perfmonctl>() returns zero when the operation is successful. On error, "
7451 "-1 is returned and I<errno> is set to indicate the cause of the error."
7455 #: build/C/man2/perfmonctl.2:199
7456 msgid "B<perfmonctl>() is available since Linux 2.4."
7460 #: build/C/man2/perfmonctl.2:202
7462 "B<perfmonctl>() is Linux-specific and is available only on the IA-64 "
7467 #: build/C/man2/perfmonctl.2:207
7472 #: build/C/man2/perfmonctl.2:209
7473 msgid "The perfmon2 interface specification"
7477 #: build/C/man2/personality.2:32
7483 #: build/C/man2/personality.2:35
7484 msgid "personality - set the process execution domain"
7488 #: build/C/man2/personality.2:37
7489 msgid "B<#include E<lt>sys/personality.hE<gt>>"
7493 #: build/C/man2/personality.2:39
7494 msgid "B<int personality(unsigned long >I<persona>B<);>"
7498 #: build/C/man2/personality.2:47
7500 "Linux supports different execution domains, or personalities, for each "
7501 "process. Among other things, execution domains tell Linux how to map signal "
7502 "numbers into signal actions. The execution domain system allows Linux to "
7503 "provide limited support for binaries compiled under other UNIX-like "
7504 "operating systems."
7508 #: build/C/man2/personality.2:59
7510 "If I<persona> is not 0xffffffff, then B<personality>() sets the caller's "
7511 "execution domain to the value specified by I<persona>. Specifying "
7512 "I<persona> as 0xffffffff provides a way of retrieving the current persona "
7513 "without changing it."
7517 #: build/C/man2/personality.2:62
7519 "A list of the available execution domains can be found in "
7520 "I<E<lt>sys/personality.hE<gt>>."
7524 #: build/C/man2/personality.2:69
7526 "On success, the previous I<persona> is returned. On error, -1 is returned, "
7527 "and I<errno> is set appropriately."
7531 #: build/C/man2/personality.2:73
7532 msgid "The kernel was unable to change the personality."
7536 #: build/C/man2/personality.2:77
7538 "B<personality>() is Linux-specific and should not be used in programs "
7539 "intended to be portable."
7543 #: build/C/man2/personality.2:79
7544 msgid "B<setarch>(8)"
7548 #: build/C/man2/pivot_root.2:10
7554 #: build/C/man2/pivot_root.2:13
7555 msgid "pivot_root - change the root filesystem"
7559 #: build/C/man2/pivot_root.2:15
7560 msgid "B<int pivot_root(const char *>I<new_root>B<, const char *>I<put_old>B<);>"
7566 #. capability is required.
7568 #: build/C/man2/pivot_root.2:27
7570 "B<pivot_root>() moves the root filesystem of the calling process to the "
7571 "directory I<put_old> and makes I<new_root> the new root filesystem of the "
7576 #: build/C/man2/pivot_root.2:34
7578 "The typical use of B<pivot_root>() is during system startup, when the "
7579 "system mounts a temporary root filesystem (e.g., an B<initrd>), then mounts "
7580 "the real root filesystem, and eventually turns the latter into the current "
7581 "root of all relevant processes or threads."
7585 #: build/C/man2/pivot_root.2:46
7587 "B<pivot_root>() may or may not change the current root and the current "
7588 "working directory of any processes or threads which use the old root "
7589 "directory. The caller of B<pivot_root>() must ensure that processes with "
7590 "root or current working directory at the old root operate correctly in "
7591 "either case. An easy way to ensure this is to change their root and current "
7592 "working directory to I<new_root> before invoking B<pivot_root>()."
7596 #: build/C/man2/pivot_root.2:64
7598 "The paragraph above is intentionally vague because the implementation of "
7599 "B<pivot_root>() may change in the future. At the time of writing, "
7600 "B<pivot_root>() changes root and current working directory of each process "
7601 "or thread to I<new_root> if they point to the old root directory. This is "
7602 "necessary in order to prevent kernel threads from keeping the old root "
7603 "directory busy with their root and current working directory, even if they "
7604 "never access the filesystem in any way. In the future, there may be a "
7605 "mechanism for kernel threads to explicitly relinquish any access to the "
7606 "filesystem, such that this fairly intrusive mechanism can be removed from "
7611 #: build/C/man2/pivot_root.2:72
7613 "Note that this also applies to the calling process: B<pivot_root>() may or "
7614 "may not affect its current working directory. It is therefore recommended "
7615 "to call B<chdir(\"/\")> immediately after B<pivot_root>()."
7619 #: build/C/man2/pivot_root.2:74
7620 msgid "The following restrictions apply to I<new_root> and I<put_old>:"
7624 #: 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
7630 #: build/C/man2/pivot_root.2:76
7631 msgid "They must be directories."
7635 #: build/C/man2/pivot_root.2:79
7637 "I<new_root> and I<put_old> must not be on the same filesystem as the current "
7642 #: build/C/man2/pivot_root.2:83
7644 "I<put_old> must be underneath I<new_root>, that is, adding a nonzero number "
7645 "of I</..> to the string pointed to by I<put_old> must yield the same "
7646 "directory as I<new_root>."
7650 #: build/C/man2/pivot_root.2:85
7651 msgid "No other filesystem may be mounted on I<put_old>."
7655 #: build/C/man2/pivot_root.2:89
7656 msgid "See also B<pivot_root>(8) for additional usage examples."
7660 #: build/C/man2/pivot_root.2:96
7662 "If the current root is not a mount point (e.g., after B<chroot>(2) or "
7663 "B<pivot_root>(), see also below), not the old root directory, but the mount "
7664 "point of that filesystem is mounted on I<put_old>."
7668 #: build/C/man2/pivot_root.2:101
7670 "I<new_root> does not have to be a mount point. In this case, "
7671 "I</proc/mounts> will show the mount point of the filesystem containing "
7672 "I<new_root> as root (I</>)."
7676 #: build/C/man2/pivot_root.2:110
7678 "B<pivot_root>() may return (in I<errno>) any of the errors returned by "
7679 "B<stat>(2). Additionally, it may return:"
7683 #: build/C/man2/pivot_root.2:114
7685 "I<new_root> or I<put_old> are on the current root filesystem, or a "
7686 "filesystem is already mounted on I<put_old>."
7690 #: build/C/man2/pivot_root.2:117
7691 msgid "I<put_old> is not underneath I<new_root>."
7695 #: build/C/man2/pivot_root.2:117
7701 #: build/C/man2/pivot_root.2:120
7702 msgid "I<new_root> or I<put_old> is not a directory."
7706 #: build/C/man2/pivot_root.2:125
7707 msgid "The calling process does not have the B<CAP_SYS_ADMIN> capability."
7711 #: build/C/man2/pivot_root.2:128
7712 msgid "B<pivot_root>() was introduced in Linux 2.3.41."
7716 #: build/C/man2/pivot_root.2:131
7717 msgid "B<pivot_root>() is Linux-specific and hence is not portable."
7721 #: build/C/man2/pivot_root.2:138
7723 "B<pivot_root>() should not have to change root and current working "
7724 "directory of all other processes in the system."
7728 #: build/C/man2/pivot_root.2:143
7730 "Some of the more obscure uses of B<pivot_root>() may quickly lead to "
7735 #: build/C/man2/pivot_root.2:149
7736 msgid "B<chdir>(2), B<chroot>(2), B<stat>(2), B<initrd>(4), B<pivot_root>(8)"
7740 #: build/C/man2/process_vm_readv.2:29
7742 msgid "PROCESS_VM_READV"
7746 #: build/C/man2/process_vm_readv.2:29
7752 #: build/C/man2/process_vm_readv.2:32
7754 "process_vm_readv, process_vm_writev - transfer data between process address "
7759 #: build/C/man2/process_vm_readv.2:35
7761 msgid "B<#include E<lt>sys/uio.hE<gt>>\n"
7765 #: build/C/man2/process_vm_readv.2:42
7768 "B<ssize_t process_vm_readv(pid_t >I<pid>B<,>\n"
7769 "B< const struct iovec *>I<local_iov>B<,>\n"
7770 "B< unsigned long >I<liovcnt>B<,>\n"
7771 "B< const struct iovec *>I<remote_iov>B<,>\n"
7772 "B< unsigned long >I<riovcnt>B<,>\n"
7773 "B< unsigned long >I<flags>B<);>\n"
7777 #: build/C/man2/process_vm_readv.2:49
7780 "B<ssize_t process_vm_writev(pid_t >I<pid>B<,>\n"
7781 "B< const struct iovec *>I<local_iov>B<,>\n"
7782 "B< unsigned long >I<liovcnt>B<,>\n"
7783 "B< const struct iovec *>I<remote_iov>B<,>\n"
7784 "B< unsigned long >I<riovcnt>B<,>\n"
7785 "B< unsigned long >I<flags>B<);>\n"
7789 #: build/C/man2/process_vm_readv.2:54
7790 msgid "Feature Test Macro Requirements for glibc (see B<feature_test_macros>(7)):"
7794 #: build/C/man2/process_vm_readv.2:58
7795 msgid "B<process_vm_readv>(), B<process_vm_writev>():"
7799 #: build/C/man2/process_vm_readv.2:62
7800 msgid "B<_GNU_SOURCE>"
7804 #: build/C/man2/process_vm_readv.2:73
7806 "These system calls transfer data between the address space of the calling "
7807 "process (\"the local process\") and the process identified by I<pid> (\"the "
7808 "remote process\"). The data moves directly between the address spaces of "
7809 "the two processes, without passing through kernel space."
7813 #: build/C/man2/process_vm_readv.2:98
7815 "The B<process_vm_readv>() system call transfers data from the remote "
7816 "process to the local process. The data to be transferred is identified by "
7817 "I<remote_iov> and I<riovcnt>: I<remote_iov> is a pointer to an array "
7818 "describing address ranges in the process I<pid>, and I<riovcnt> specifies "
7819 "the number of elements in I<remote_iov>. The data is transferred to the "
7820 "locations specified by I<local_iov> and I<liovcnt>: I<local_iov> is a "
7821 "pointer to an array describing address ranges in the calling process, and "
7822 "I<liovcnt> specifies the number of elements in I<local_iov>."
7826 #: build/C/man2/process_vm_readv.2:112
7828 "The B<process_vm_writev>() system call is the converse of "
7829 "B<process_vm_readv>()\\(emit transfers data from the local process to the "
7830 "remote process. Other than the direction of the transfer, the arguments "
7831 "I<liovcnt>, I<local_iov>, I<riovcnt>, and I<remote_iov> have the same "
7832 "meaning as for B<process_vm_readv>()."
7836 #: build/C/man2/process_vm_readv.2:122
7838 "The I<local_iov> and I<remote_iov> arguments point to an array of I<iovec> "
7839 "structures, defined in I<E<lt>sys/uio.hE<gt>> as:"
7843 #: build/C/man2/process_vm_readv.2:129
7847 " void *iov_base; /* Starting address */\n"
7848 " size_t iov_len; /* Number of bytes to transfer */\n"
7853 #: build/C/man2/process_vm_readv.2:145
7855 "Buffers are processed in array order. This means that B<process_vm_readv>() "
7856 "completely fills I<local_iov[0]> before proceeding to I<local_iov[1]>, and "
7857 "so on. Likewise, I<remote_iov[0]> is completely read before proceeding to "
7858 "I<remote_iov[1]>, and so on."
7862 #: build/C/man2/process_vm_readv.2:156
7864 "Similarly, B<process_vm_writev>() writes out the entire contents of "
7865 "I<local_iov[0]> before proceeding to I<local_iov[1]>, and it completely "
7866 "fills I<remote_iov[0]> before proceeding to I<remote_iov[1]>."
7870 #: build/C/man2/process_vm_readv.2:164
7872 "The lengths of I<remote_iov[i].iov_len> and I<local_iov[i].iov_len> do not "
7873 "have to be the same. Thus, it is possible to split a single local buffer "
7874 "into multiple remote buffers, or vice versa."
7878 #: build/C/man2/process_vm_readv.2:168
7879 msgid "The I<flags> argument is currently unused and must be set to 0."
7882 #. In time, glibc might provide a wrapper that works around this limit,
7883 #. as is done for readv()/writev()
7885 #: build/C/man2/process_vm_readv.2:181
7887 "The values specified in the I<liovcnt> and I<riovcnt> arguments must be less "
7888 "than or equal to B<IOV_MAX> (defined in I<E<lt>limits.hE<gt>> or accessible "
7889 "via the call I<sysconf(_SC_IOV_MAX)>)."
7893 #: build/C/man2/process_vm_readv.2:191
7895 "The count arguments and I<local_iov> are checked before doing any "
7896 "transfers. If the counts are too big, or I<local_iov> is invalid, or the "
7897 "addresses refer to regions that are inaccessible to the local process, none "
7898 "of the vectors will be processed and an error will be returned immediately."
7902 #: build/C/man2/process_vm_readv.2:211
7904 "Note, however, that these system calls do not check the memory regions in "
7905 "the remote process until just before doing the read/write. Consequently, a "
7906 "partial read/write (see RETURN VALUE) may result if one of the "
7907 "I<remote_iov> elements points to an invalid memory region in the remote "
7908 "process. No further reads/writes will be attempted beyond that point. Keep "
7909 "this in mind when attempting to read data of unknown length (such as C "
7910 "strings that are null-terminated) from a remote process, by avoiding "
7911 "spanning memory pages (typically 4KiB) in a single remote I<iovec> element. "
7912 "(Instead, split the remote read into two I<remote_iov> elements and have "
7913 "them merge back into a single write I<local_iov> entry. The first read "
7914 "entry goes up to the page boundary, while the second starts on the next page "
7919 #: build/C/man2/process_vm_readv.2:225
7921 "In order to read from or write to another process, either the caller must "
7922 "have the capability B<CAP_SYS_PTRACE>, or the real user ID, effective user "
7923 "ID, and saved set-user-ID of the remote process must match the real user ID "
7924 "of the caller I<and> the real group ID, effective group ID, and saved "
7925 "set-group-ID of the remote process must match the real group ID of the "
7926 "caller. (The permission required is exactly the same as that required to "
7927 "perform a B<ptrace>(2) B<PTRACE_ATTACH> on the remote process.)"
7931 #: build/C/man2/process_vm_readv.2:241
7933 "On success, B<process_vm_readv>() returns the number of bytes read and "
7934 "B<process_vm_writev>() returns the number of bytes written. This return "
7935 "value may be less than the total number of requested bytes, if a partial "
7936 "read/write occurred. (Partial transfers apply at the granularity of "
7937 "I<iovec> elements. These system calls won't perform a partial transfer that "
7938 "splits a single I<iovec> element.) The caller should check the return value "
7939 "to determine whether a partial read/write occurred."
7943 #: build/C/man2/process_vm_readv.2:245
7944 msgid "On error, -1 is returned and I<errno> is set appropriately."
7948 #: build/C/man2/process_vm_readv.2:257
7950 "The sum of the I<iov_len> values of either I<local_iov> or I<remote_iov> "
7951 "overflows a I<ssize_t> value."
7955 #: build/C/man2/process_vm_readv.2:261
7956 msgid "I<flags> is not 0."
7960 #: build/C/man2/process_vm_readv.2:267
7961 msgid "I<liovcnt> or I<riovcnt> is too large."
7965 #: build/C/man2/process_vm_readv.2:272
7967 "The memory described by I<local_iov> is outside the caller's accessible "
7972 #: build/C/man2/process_vm_readv.2:278
7974 "The memory described by I<remote_iov> is outside the accessible address "
7975 "space of the process I<pid>."
7979 #: build/C/man2/process_vm_readv.2:283
7980 msgid "Could not allocate memory for internal copies of the I<iovec> structures."
7984 #: build/C/man2/process_vm_readv.2:287
7986 "The caller does not have permission to access the address space of the "
7991 #: build/C/man2/process_vm_readv.2:292
7992 msgid "No process with ID I<pid> exists."
7996 #: build/C/man2/process_vm_readv.2:295
7998 "These system calls were added in Linux 3.2. Support is provided in glibc "
7999 "since version 2.15."
8003 #: build/C/man2/process_vm_readv.2:297
8004 msgid "These system calls are nonstandard Linux extensions."
8008 #: build/C/man2/process_vm_readv.2:303
8010 "The data transfers performed by B<process_vm_readv>() and "
8011 "B<process_vm_writev>() are not guaranteed to be atomic in any way."
8014 #. Original user is MPI, http://www.mcs.anl.gov/research/projects/mpi/
8015 #. See also some benchmarks at http://lwn.net/Articles/405284/
8016 #. and http://marc.info/?l=linux-mm&m=130105930902915&w=2
8018 #: build/C/man2/process_vm_readv.2:311
8020 "These system calls were designed to permit fast message passing by allowing "
8021 "messages to be exchanged with a single copy operation (rather than the "
8022 "double copy that would be required when using, for example, shared memory or "
8027 #: build/C/man2/process_vm_readv.2:319
8029 "The following code sample demonstrates the use of B<process_vm_readv>(). It "
8030 "reads 20 bytes at the address 0x10000 from the process with PID 10 and "
8031 "writes the first 10 bytes into I<buf1> and the second 10 bytes into I<buf2>."
8035 #: build/C/man2/process_vm_readv.2:322
8037 msgid "#include E<lt>sys/uio.hE<gt>\n"
8041 #: build/C/man2/process_vm_readv.2:332
8047 " struct iovec local[2];\n"
8048 " struct iovec remote[1];\n"
8052 " pid_t pid = 10; /* PID of remote process */\n"
8056 #: build/C/man2/process_vm_readv.2:339
8059 " local[0].iov_base = buf1;\n"
8060 " local[0].iov_len = 10;\n"
8061 " local[1].iov_base = buf2;\n"
8062 " local[1].iov_len = 10;\n"
8063 " remote[0].iov_base = (void *) 0x10000;\n"
8064 " remote[0].iov_len = 20;\n"
8068 #: build/C/man2/process_vm_readv.2:346
8071 " nread = process_vm_readv(pid, local, 2, remote, 1, 0);\n"
8072 " if (nread != 20)\n"
8080 #: build/C/man2/process_vm_readv.2:350
8081 msgid "B<readv>(2), B<writev>(2)"
8085 #: build/C/man2/ptrace.2:46
8091 #: build/C/man2/ptrace.2:49
8092 msgid "ptrace - process trace"
8096 #: build/C/man2/ptrace.2:52
8098 msgid "B<#include E<lt>sys/ptrace.hE<gt>>\n"
8102 #: build/C/man2/ptrace.2:55
8105 "B<long ptrace(enum __ptrace_request >I<request>B<, pid_t >I<pid>B<, >\n"
8106 "B< void *>I<addr>B<, void *>I<data>B<);>\n"
8110 #: build/C/man2/ptrace.2:64
8112 "The B<ptrace>() system call provides a means by which one process (the "
8113 "\"tracer\") may observe and control the execution of another process (the "
8114 "\"tracee\"), and examine and change the tracee's memory and registers. It "
8115 "is primarily used to implement breakpoint debugging and system call tracing."
8119 #: build/C/man2/ptrace.2:75
8121 "A tracee first needs to be attached to the tracer. Attachment and "
8122 "subsequent commands are per thread: in a multithreaded process, every thread "
8123 "can be individually attached to a (potentially different) tracer, or left "
8124 "not attached and thus not debugged. Therefore, \"tracee\" always means "
8125 "\"(one) thread\", never \"a (possibly multithreaded) process\". Ptrace "
8126 "commands are always sent to a specific tracee using a call of the form"
8130 #: build/C/man2/ptrace.2:77
8132 msgid " ptrace(PTRACE_foo, pid, ...)\n"
8136 #: build/C/man2/ptrace.2:81
8137 msgid "where I<pid> is the thread ID of the corresponding Linux thread."
8141 #: build/C/man2/ptrace.2:87
8143 "(Note that in this page, a \"multithreaded process\" means a thread group "
8144 "consisting of threads created using the B<clone>(2) B<CLONE_THREAD> flag.)"
8148 #: build/C/man2/ptrace.2:98
8150 "A process can initiate a trace by calling B<fork>(2) and having the "
8151 "resulting child do a B<PTRACE_TRACEME>, followed (typically) by an "
8152 "B<execve>(2). Alternatively, one process may commence tracing another "
8153 "process using B<PTRACE_ATTACH> or B<PTRACE_SEIZE>."
8157 #: build/C/man2/ptrace.2:115
8159 "While being traced, the tracee will stop each time a signal is delivered, "
8160 "even if the signal is being ignored. (An exception is B<SIGKILL>, which has "
8161 "its usual effect.) The tracer will be notified at its next call to "
8162 "B<waitpid>(2) (or one of the related \"wait\" system calls); that call will "
8163 "return a I<status> value containing information that indicates the cause of "
8164 "the stop in the tracee. While the tracee is stopped, the tracer can use "
8165 "various ptrace requests to inspect and modify the tracee. The tracer then "
8166 "causes the tracee to continue, optionally ignoring the delivered signal (or "
8167 "even delivering a different signal instead)."
8171 #: build/C/man2/ptrace.2:125
8173 "If the B<PTRACE_O_TRACEEXEC> option is not in effect, all successful calls "
8174 "to B<execve>(2) by the traced process will cause it to be sent a B<SIGTRAP> "
8175 "signal, giving the parent a chance to gain control before the new program "
8180 #: build/C/man2/ptrace.2:129
8182 "When the tracer is finished tracing, it can cause the tracee to continue "
8183 "executing in a normal, untraced mode via B<PTRACE_DETACH>."
8187 #: build/C/man2/ptrace.2:133
8188 msgid "The value of I<request> determines the action to be performed:"
8192 #: build/C/man2/ptrace.2:133
8194 msgid "B<PTRACE_TRACEME>"
8198 #: build/C/man2/ptrace.2:143
8200 "Indicate that this process is to be traced by its parent. A process "
8201 "probably shouldn't make this request if its parent isn't expecting to trace "
8202 "it. (I<pid>, I<addr>, and I<data> are ignored.)"
8206 #: build/C/man2/ptrace.2:158
8208 "The B<PTRACE_TRACEME> request is used only by the tracee; the remaining "
8209 "requests are used only by the tracer. In the following requests, I<pid> "
8210 "specifies the thread ID of the tracee to be acted on. For requests other "
8211 "than B<PTRACE_ATTACH>, B<PTRACE_SEIZE>, B<PTRACE_INTERRUPT>, and "
8212 "B<PTRACE_KILL>, the tracee must be stopped."
8216 #: build/C/man2/ptrace.2:158
8218 msgid "B<PTRACE_PEEKTEXT>, B<PTRACE_PEEKDATA>"
8222 #: build/C/man2/ptrace.2:169
8224 "Read a word at the address I<addr> in the tracee's memory, returning the "
8225 "word as the result of the B<ptrace>() call. Linux does not have separate "
8226 "text and data address spaces, so these two requests are currently "
8227 "equivalent. (I<data> is ignored; but see NOTES.)"
8231 #: build/C/man2/ptrace.2:169
8233 msgid "B<PTRACE_PEEKUSER>"
8236 #. PTRACE_PEEKUSR in kernel source, but glibc uses PTRACE_PEEKUSER,
8237 #. and that is the name that seems common on other systems.
8239 #: build/C/man2/ptrace.2:187
8241 "Read a word at offset I<addr> in the tracee's USER area, which holds the "
8242 "registers and other information about the process (see "
8243 "I<E<lt>sys/user.hE<gt>>). The word is returned as the result of the "
8244 "B<ptrace>() call. Typically, the offset must be word-aligned, though this "
8245 "might vary by architecture. See NOTES. (I<data> is ignored; but see "
8250 #: build/C/man2/ptrace.2:187
8252 msgid "B<PTRACE_POKETEXT>, B<PTRACE_POKEDATA>"
8256 #: build/C/man2/ptrace.2:199
8258 "Copy the word I<data> to the address I<addr> in the tracee's memory. As for "
8259 "B<PTRACE_PEEKTEXT> and B<PTRACE_PEEKDATA>, these two requests are currently "
8264 #: build/C/man2/ptrace.2:199
8266 msgid "B<PTRACE_POKEUSER>"
8269 #. PTRACE_POKEUSR in kernel source, but glibc uses PTRACE_POKEUSER,
8270 #. and that is the name that seems common on other systems.
8271 #. FIXME In the preceding sentence, which modifications are disallowed,
8272 #. and when they are disallowed, how does user space discover that fact?
8274 #: build/C/man2/ptrace.2:215
8276 "Copy the word I<data> to offset I<addr> in the tracee's USER area. As for "
8277 "B<PTRACE_PEEKUSER>, the offset must typically be word-aligned. In order to "
8278 "maintain the integrity of the kernel, some modifications to the USER area "
8283 #: build/C/man2/ptrace.2:215
8285 msgid "B<PTRACE_GETREGS>, B<PTRACE_GETFPREGS>"
8289 #: build/C/man2/ptrace.2:238
8291 "Copy the tracee's general-purpose or floating-point registers, respectively, "
8292 "to the address I<data> in the tracer. See I<E<lt>sys/user.hE<gt>> for "
8293 "information on the format of this data. (I<addr> is ignored.) Note that "
8294 "SPARC systems have the meaning of I<data> and I<addr> reversed; that is, "
8295 "I<data> is ignored and the registers are copied to the address I<addr>. "
8296 "B<PTRACE_GETREGS> and B<PTRACE_GETFPREGS> are not present on all "
8301 #: build/C/man2/ptrace.2:238
8303 msgid "B<PTRACE_GETREGSET> (since Linux 2.6.34)"
8307 #: build/C/man2/ptrace.2:259
8309 "Read the tracee's registers. I<addr> specifies, in an "
8310 "architecture-dependent way, the type of registers to be read. "
8311 "B<NT_PRSTATUS> (with numerical value 1) usually results in reading of "
8312 "general-purpose registers. If the CPU has, for example, floating-point "
8313 "and/or vector registers, they can be retrieved by setting I<addr> to the "
8314 "corresponding B<NT_foo> constant. I<data> points to a B<struct iovec>, "
8315 "which describes the destination buffer's location and length. On return, "
8316 "the kernel modifies B<iov.len> to indicate the actual number of bytes "
8321 #: build/C/man2/ptrace.2:259
8323 msgid "B<PTRACE_SETREGS>, B<PTRACE_SETFPREGS>"
8326 #. FIXME . In the preceding sentence, which modifications are disallowed,
8327 #. and when they are disallowed, how does user space discover that fact?
8329 #: build/C/man2/ptrace.2:284
8331 "Modify the tracee's general-purpose or floating-point registers, "
8332 "respectively, from the address I<data> in the tracer. As for "
8333 "B<PTRACE_POKEUSER>, some general-purpose register modifications may be "
8334 "disallowed. (I<addr> is ignored.) Note that SPARC systems have the meaning "
8335 "of I<data> and I<addr> reversed; that is, I<data> is ignored and the "
8336 "registers are copied from the address I<addr>. B<PTRACE_SETREGS> and "
8337 "B<PTRACE_SETFPREGS> are not present on all architectures."
8341 #: build/C/man2/ptrace.2:284
8343 msgid "B<PTRACE_SETREGSET> (since Linux 2.6.34)"
8347 #: build/C/man2/ptrace.2:293
8349 "Modify the tracee's registers. The meaning of I<addr> and I<data> is "
8350 "analogous to B<PTRACE_GETREGSET>."
8354 #: build/C/man2/ptrace.2:293
8356 msgid "B<PTRACE_GETSIGINFO> (since Linux 2.3.99-pre6)"
8360 #: build/C/man2/ptrace.2:305
8362 "Retrieve information about the signal that caused the stop. Copy a "
8363 "I<siginfo_t> structure (see B<sigaction>(2)) from the tracee to the address "
8364 "I<data> in the tracer. (I<addr> is ignored.)"
8368 #: build/C/man2/ptrace.2:305
8370 msgid "B<PTRACE_SETSIGINFO> (since Linux 2.3.99-pre6)"
8374 #: build/C/man2/ptrace.2:321
8376 "Set signal information: copy a I<siginfo_t> structure from the address "
8377 "I<data> in the tracer to the tracee. This will affect only signals that "
8378 "would normally be delivered to the tracee and were caught by the tracer. It "
8379 "may be difficult to tell these normal signals from synthetic signals "
8380 "generated by B<ptrace>() itself. (I<addr> is ignored.)"
8384 #: build/C/man2/ptrace.2:321
8386 msgid "B<PTRACE_PEEKSIGINFO> (since Linux 3.10)"
8389 #. commit 84c751bd4aebbaae995fe32279d3dba48327bad4
8391 #: build/C/man2/ptrace.2:347
8393 "Retrieve I<siginfo_t> structures without removing signals from a queue. "
8394 "I<addr> points to a I<ptrace_peeksiginfo_args> structure that specifies the "
8395 "ordinal position from which copying of signals should start, and the number "
8396 "of signals to copy. I<siginfo_t> structures are copied into the buffer "
8397 "pointed to by I<data>. The return value contains the number of copied "
8398 "signals (zero indicates that there is no signal corresponding to the "
8399 "specified ordinal position). Within the returned I<siginfo> structures, the "
8400 "I<si_code> field includes information (B<__SI_CHLD>, B<__SI_FAULT>, etc.) "
8401 "that are not otherwise exposed to user space."
8405 #: build/C/man2/ptrace.2:356
8408 "struct ptrace_peeksiginfo_args {\n"
8409 " u64 off; /* Ordinal position in queue at which\n"
8410 " to start copying signals */\n"
8411 " u32 flags; /* PTRACE_PEEKSIGINFO_SHARED or 0 */\n"
8412 " s32 nr; /* Number of signals to copy */\n"
8417 #: build/C/man2/ptrace.2:363
8419 "Currently, there is only one flag, B<PTRACE_PEEKSIGINFO_SHARED>, for dumping "
8420 "signals from the process-wide signal queue. If this flag is not set, "
8421 "signals are read from the per-thread queue of the specified thread."
8425 #: build/C/man2/ptrace.2:365
8427 msgid "B<PTRACE_GETSIGMASK> (since Linux 3.11)"
8430 #. commit 29000caecbe87b6b66f144f72111f0d02fbbf0c1
8432 #: build/C/man2/ptrace.2:380
8434 "Place a copy of the mask of blocked signals (see B<sigprocmask>(2)) in the "
8435 "buffer pointed to by I<data>, which should be a pointer to a buffer of type "
8436 "I<sigset_t>. The I<addr> argument contains the size of the buffer pointed "
8437 "to by I<data> (i.e., I<sizeof(sigset_t)>)."
8441 #: build/C/man2/ptrace.2:380
8443 msgid "B<PTRACE_SETSIGMASK> (since Linux 3.11)"
8447 #: build/C/man2/ptrace.2:394
8449 "Change the mask of blocked signals (see B<sigprocmask>(2)) to the value "
8450 "specified in the buffer pointed to by I<data>, which should be a pointer to "
8451 "a buffer of type I<sigset_t>. The I<addr> argument contains the size of the "
8452 "buffer pointed to by I<data> (i.e., I<sizeof(sigset_t)>)."
8456 #: build/C/man2/ptrace.2:394
8458 msgid "B<PTRACE_SETOPTIONS> (since Linux 2.4.6; see BUGS for caveats)"
8462 #: build/C/man2/ptrace.2:403
8464 "Set ptrace options from I<data>. (I<addr> is ignored.) I<data> is "
8465 "interpreted as a bit mask of options, which are specified by the following "
8470 #: build/C/man2/ptrace.2:404
8472 msgid "B<PTRACE_O_EXITKILL> (since Linux 3.8)"
8475 #. commit 992fb6e170639b0849bace8e49bf31bd37c4123
8477 #: build/C/man2/ptrace.2:412
8479 "If a tracer sets this flag, a B<SIGKILL> signal will be sent to every tracee "
8480 "if the tracer exits. This option is useful for ptrace jailers that want to "
8481 "ensure that tracees can never escape the tracer's control."
8485 #: build/C/man2/ptrace.2:412
8487 msgid "B<PTRACE_O_TRACECLONE> (since Linux 2.5.46)"
8491 #: build/C/man2/ptrace.2:429
8493 "Stop the tracee at the next B<clone>(2) and automatically start tracing the "
8494 "newly cloned process, which will start with a B<SIGSTOP>, or "
8495 "B<PTRACE_EVENT_STOP> if B<PTRACE_SEIZE> was used. A B<waitpid>(2) by the "
8496 "tracer will return a I<status> value such that"
8500 #: build/C/man2/ptrace.2:432
8502 msgid " statusE<gt>E<gt>8 == (SIGTRAP | (PTRACE_EVENT_CLONEE<lt>E<lt>8))\n"
8506 #: build/C/man2/ptrace.2:436 build/C/man2/ptrace.2:522 build/C/man2/ptrace.2:555
8507 msgid "The PID of the new process can be retrieved with B<PTRACE_GETEVENTMSG>."
8511 #: build/C/man2/ptrace.2:457
8513 "This option may not catch B<clone>(2) calls in all cases. If the tracee "
8514 "calls B<clone>(2) with the B<CLONE_VFORK> flag, B<PTRACE_EVENT_VFORK> will "
8515 "be delivered instead if B<PTRACE_O_TRACEVFORK> is set; otherwise if the "
8516 "tracee calls B<clone>(2) with the exit signal set to B<SIGCHLD>, "
8517 "B<PTRACE_EVENT_FORK> will be delivered if B<PTRACE_O_TRACEFORK> is set."
8521 #: build/C/man2/ptrace.2:457
8523 msgid "B<PTRACE_O_TRACEEXEC> (since Linux 2.5.46)"
8527 #: build/C/man2/ptrace.2:466
8529 "Stop the tracee at the next B<execve>(2). A B<waitpid>(2) by the tracer "
8530 "will return a I<status> value such that"
8534 #: build/C/man2/ptrace.2:469
8536 msgid " statusE<gt>E<gt>8 == (SIGTRAP | (PTRACE_EVENT_EXECE<lt>E<lt>8))\n"
8540 #: build/C/man2/ptrace.2:475
8542 "If the execing thread is not a thread group leader, the thread ID is reset "
8543 "to thread group leader's ID before this stop. Since Linux 3.0, the former "
8544 "thread ID can be retrieved with B<PTRACE_GETEVENTMSG>."
8548 #: build/C/man2/ptrace.2:475
8550 msgid "B<PTRACE_O_TRACEEXIT> (since Linux 2.5.60)"
8554 #: build/C/man2/ptrace.2:483
8556 "Stop the tracee at exit. A B<waitpid>(2) by the tracer will return a "
8557 "I<status> value such that"
8561 #: build/C/man2/ptrace.2:486
8563 msgid " statusE<gt>E<gt>8 == (SIGTRAP | (PTRACE_EVENT_EXITE<lt>E<lt>8))\n"
8567 #: build/C/man2/ptrace.2:490
8568 msgid "The tracee's exit status can be retrieved with B<PTRACE_GETEVENTMSG>."
8572 #: build/C/man2/ptrace.2:498
8574 "The tracee is stopped early during process exit, when registers are still "
8575 "available, allowing the tracer to see where the exit occurred, whereas the "
8576 "normal exit notification is done after the process is finished exiting. "
8577 "Even though context is available, the tracer cannot prevent the exit from "
8578 "happening at this point."
8582 #: build/C/man2/ptrace.2:498
8584 msgid "B<PTRACE_O_TRACEFORK> (since Linux 2.5.46)"
8588 #: build/C/man2/ptrace.2:515
8590 "Stop the tracee at the next B<fork>(2) and automatically start tracing the "
8591 "newly forked process, which will start with a B<SIGSTOP>, or "
8592 "B<PTRACE_EVENT_STOP> if B<PTRACE_SEIZE> was used. A B<waitpid>(2) by the "
8593 "tracer will return a I<status> value such that"
8597 #: build/C/man2/ptrace.2:518
8599 msgid " statusE<gt>E<gt>8 == (SIGTRAP | (PTRACE_EVENT_FORKE<lt>E<lt>8))\n"
8603 #: build/C/man2/ptrace.2:522
8605 msgid "B<PTRACE_O_TRACESYSGOOD> (since Linux 2.4.6)"
8609 #: build/C/man2/ptrace.2:531
8611 "When delivering system call traps, set bit 7 in the signal number (i.e., "
8612 "deliver I<SIGTRAP|0x80>). This makes it easy for the tracer to distinguish "
8613 "normal traps from those caused by a system call. (B<PTRACE_O_TRACESYSGOOD> "
8614 "may not work on all architectures.)"
8618 #: build/C/man2/ptrace.2:531
8620 msgid "B<PTRACE_O_TRACEVFORK> (since Linux 2.5.46)"
8624 #: build/C/man2/ptrace.2:548
8626 "Stop the tracee at the next B<vfork>(2) and automatically start tracing the "
8627 "newly vforked process, which will start with a B<SIGSTOP>, or "
8628 "B<PTRACE_EVENT_STOP> if B<PTRACE_SEIZE> was used. A B<waitpid>(2) by the "
8629 "tracer will return a I<status> value such that"
8633 #: build/C/man2/ptrace.2:551
8635 msgid " statusE<gt>E<gt>8 == (SIGTRAP | (PTRACE_EVENT_VFORKE<lt>E<lt>8))\n"
8639 #: build/C/man2/ptrace.2:555
8641 msgid "B<PTRACE_O_TRACEVFORKDONE> (since Linux 2.5.60)"
8645 #: build/C/man2/ptrace.2:564
8647 "Stop the tracee at the completion of the next B<vfork>(2). A B<waitpid>(2) "
8648 "by the tracer will return a I<status> value such that"
8652 #: build/C/man2/ptrace.2:567
8654 msgid " statusE<gt>E<gt>8 == (SIGTRAP | (PTRACE_EVENT_VFORK_DONEE<lt>E<lt>8))\n"
8658 #: build/C/man2/ptrace.2:571
8660 "The PID of the new process can (since Linux 2.6.18) be retrieved with "
8661 "B<PTRACE_GETEVENTMSG>."
8665 #: build/C/man2/ptrace.2:571
8667 msgid "B<PTRACE_O_TRACESECCOMP> (since Linux 3.5)"
8671 #: build/C/man2/ptrace.2:582
8673 "Stop the tracee when a B<seccomp>(2) B<SECCOMP_RET_TRACE> rule is "
8674 "triggered. A B<waitpid>(2) by the tracer will return a I<status> value "
8679 #: build/C/man2/ptrace.2:585
8681 msgid " statusE<gt>E<gt>8 == (SIGTRAP | (PTRACE_EVENT_SECCOMPE<lt>E<lt>8))\n"
8685 #: build/C/man2/ptrace.2:595
8687 "While this triggers a B<PTRACE_EVENT> stop, it is similar to a "
8688 "syscall-enter-stop, in that the tracee has not yet entered the syscall that "
8689 "seccomp triggered on. The seccomp event message data (from the "
8690 "B<SECCOMP_RET_DATA> portion of the seccomp filter rule) can be retrieved "
8691 "with B<PTRACE_GETEVENTMSG>."
8695 #: build/C/man2/ptrace.2:596
8697 msgid "B<PTRACE_GETEVENTMSG> (since Linux 2.5.46)"
8701 #: build/C/man2/ptrace.2:623
8703 "Retrieve a message (as an I<unsigned long>) about the ptrace event that "
8704 "just happened, placing it at the address I<data> in the tracer. For "
8705 "B<PTRACE_EVENT_EXIT>, this is the tracee's exit status. For "
8706 "B<PTRACE_EVENT_FORK>, B<PTRACE_EVENT_VFORK>, B<PTRACE_EVENT_VFORK_DONE>, and "
8707 "B<PTRACE_EVENT_CLONE>, this is the PID of the new process. For "
8708 "B<PTRACE_EVENT_SECCOMP>, this is the B<seccomp>(2) filter's "
8709 "B<SECCOMP_RET_DATA> associated with the triggered rule. (I<addr> is "
8714 #: build/C/man2/ptrace.2:623
8716 msgid "B<PTRACE_CONT>"
8720 #: build/C/man2/ptrace.2:635
8722 "Restart the stopped tracee process. If I<data> is nonzero, it is "
8723 "interpreted as the number of a signal to be delivered to the tracee; "
8724 "otherwise, no signal is delivered. Thus, for example, the tracer can "
8725 "control whether a signal sent to the tracee is delivered or not. (I<addr> "
8730 #: build/C/man2/ptrace.2:635
8732 msgid "B<PTRACE_SYSCALL>, B<PTRACE_SINGLESTEP>"
8736 #: build/C/man2/ptrace.2:659
8738 "Restart the stopped tracee as for B<PTRACE_CONT>, but arrange for the tracee "
8739 "to be stopped at the next entry to or exit from a system call, or after "
8740 "execution of a single instruction, respectively. (The tracee will also, as "
8741 "usual, be stopped upon receipt of a signal.) From the tracer's perspective, "
8742 "the tracee will appear to have been stopped by receipt of a B<SIGTRAP>. So, "
8743 "for B<PTRACE_SYSCALL>, for example, the idea is to inspect the arguments to "
8744 "the system call at the first stop, then do another B<PTRACE_SYSCALL> and "
8745 "inspect the return value of the system call at the second stop. The I<data> "
8746 "argument is treated as for B<PTRACE_CONT>. (I<addr> is ignored.)"
8750 #: build/C/man2/ptrace.2:659
8752 msgid "B<PTRACE_SYSEMU>, B<PTRACE_SYSEMU_SINGLESTEP> (since Linux 2.6.14)"
8757 #: build/C/man2/ptrace.2:680
8759 "For B<PTRACE_SYSEMU>, continue and stop on entry to the next system call, "
8760 "which will not be executed. For B<PTRACE_SYSEMU_SINGLESTEP>, do the same "
8761 "but also singlestep if not a system call. This call is used by programs "
8762 "like User Mode Linux that want to emulate all the tracee's system calls. "
8763 "The I<data> argument is treated as for B<PTRACE_CONT>. The I<addr> argument "
8764 "is ignored. These requests are currently supported only on x86."
8768 #: build/C/man2/ptrace.2:680
8770 msgid "B<PTRACE_LISTEN> (since Linux 3.4)"
8774 #: build/C/man2/ptrace.2:691
8776 "Restart the stopped tracee, but prevent it from executing. The resulting "
8777 "state of the tracee is similar to a process which has been stopped by a "
8778 "B<SIGSTOP> (or other stopping signal). See the \"group-stop\" subsection "
8779 "for additional information. B<PTRACE_LISTEN> works only on tracees attached "
8780 "by B<PTRACE_SEIZE>."
8784 #: build/C/man2/ptrace.2:691
8786 msgid "B<PTRACE_KILL>"
8790 #: build/C/man2/ptrace.2:700
8792 "Send the tracee a B<SIGKILL> to terminate it. (I<addr> and I<data> are "
8796 #. [Note from Denys Vlasenko:
8797 #. deprecation suggested by Oleg Nesterov. He prefers to deprecate it
8798 #. instead of describing (and needing to support) PTRACE_KILL's quirks.]
8800 #: build/C/man2/ptrace.2:719
8802 "I<This operation is deprecated; do not use it!> Instead, send a B<SIGKILL> "
8803 "directly using B<kill>(2) or B<tgkill>(2). The problem with B<PTRACE_KILL> "
8804 "is that it requires the tracee to be in signal-delivery-stop, otherwise it "
8805 "may not work (i.e., may complete successfully but won't kill the tracee). "
8806 "By contrast, sending a B<SIGKILL> directly has no such limitation."
8810 #: build/C/man2/ptrace.2:719
8812 msgid "B<PTRACE_INTERRUPT> (since Linux 3.4)"
8816 #: build/C/man2/ptrace.2:747
8818 "Stop a tracee. If the tracee is running or sleeping in kernel space and "
8819 "B<PTRACE_SYSCALL> is in effect, the system call is interrupted and "
8820 "syscall-exit-stop is reported. (The interrupted system call is restarted "
8821 "when the tracee is restarted.) If the tracee was already stopped by a "
8822 "signal and B<PTRACE_LISTEN> was sent to it, the tracee stops with "
8823 "B<PTRACE_EVENT_STOP> and I<WSTOPSIG(status)> returns the stop signal. If "
8824 "any other ptrace-stop is generated at the same time (for example, if a "
8825 "signal is sent to the tracee), this ptrace-stop happens. If none of the "
8826 "above applies (for example, if the tracee is running in user space), it "
8827 "stops with B<PTRACE_EVENT_STOP> with I<WSTOPSIG(status)> == B<SIGTRAP>. "
8828 "B<PTRACE_INTERRUPT> only works on tracees attached by B<PTRACE_SEIZE>."
8832 #: build/C/man2/ptrace.2:747
8834 msgid "B<PTRACE_ATTACH>"
8837 #. No longer true (removed by Denys Vlasenko, 2011, who remarks:
8838 #. "I think it isn't true in non-ancient 2.4 and in 2.6/3.x.
8839 #. Basically, it's not true for any Linux in practical use.
8840 #. ; the behavior of the tracee is as if it had done a
8841 #. .BR PTRACE_TRACEME .
8842 #. The calling process actually becomes the parent of the tracee
8843 #. process for most purposes (e.g., it will receive
8844 #. notification of tracee events and appears in
8846 #. output as the tracee's parent), but a
8848 #. by the tracee will still return the PID of the original parent.
8850 #: build/C/man2/ptrace.2:775
8852 "Attach to the process specified in I<pid>, making it a tracee of the calling "
8853 "process. The tracee is sent a B<SIGSTOP>, but will not necessarily have "
8854 "stopped by the completion of this call; use B<waitpid>(2) to wait for the "
8855 "tracee to stop. See the \"Attaching and detaching\" subsection for "
8856 "additional information. (I<addr> and I<data> are ignored.)"
8860 #: build/C/man2/ptrace.2:775
8862 msgid "B<PTRACE_SEIZE> (since Linux 3.4)"
8866 #: build/C/man2/ptrace.2:795
8868 "Attach to the process specified in I<pid>, making it a tracee of the calling "
8869 "process. Unlike B<PTRACE_ATTACH>, B<PTRACE_SEIZE> does not stop the "
8870 "process. Only a B<PTRACE_SEIZE>d process can accept B<PTRACE_INTERRUPT> and "
8871 "B<PTRACE_LISTEN> commands. I<addr> must be zero. I<data> contains a bit "
8872 "mask of ptrace options to activate immediately."
8876 #: build/C/man2/ptrace.2:795
8878 msgid "B<PTRACE_DETACH>"
8882 #: build/C/man2/ptrace.2:804
8884 "Restart the stopped tracee as for B<PTRACE_CONT>, but first detach from it. "
8885 "Under Linux, a tracee can be detached in this way regardless of which method "
8886 "was used to initiate tracing. (I<addr> is ignored.)"
8890 #: build/C/man2/ptrace.2:804
8892 msgid "Death under ptrace"
8896 #: build/C/man2/ptrace.2:813
8898 "When a (possibly multithreaded) process receives a killing signal (one whose "
8899 "disposition is set to B<SIG_DFL> and whose default action is to kill the "
8900 "process), all threads exit. Tracees report their death to their tracer(s). "
8901 "Notification of this event is delivered via B<waitpid>(2)."
8905 #: build/C/man2/ptrace.2:822
8907 "Note that the killing signal will first cause signal-delivery-stop (on one "
8908 "tracee only), and only after it is injected by the tracer (or after it was "
8909 "dispatched to a thread which isn't traced), will death from the signal "
8910 "happen on I<all> tracees within a multithreaded process. (The term "
8911 "\"signal-delivery-stop\" is explained below.)"
8915 #: build/C/man2/ptrace.2:834
8917 "B<SIGKILL> does not generate signal-delivery-stop and therefore the tracer "
8918 "can't suppress it. B<SIGKILL> kills even within system calls "
8919 "(syscall-exit-stop is not generated prior to death by B<SIGKILL>). The net "
8920 "effect is that B<SIGKILL> always kills the process (all its threads), even "
8921 "if some threads of the process are ptraced."
8925 #: build/C/man2/ptrace.2:839
8927 "When the tracee calls B<_exit>(2), it reports its death to its tracer. "
8928 "Other threads are not affected."
8932 #: build/C/man2/ptrace.2:843
8934 "When any thread executes B<exit_group>(2), every tracee in its thread group "
8935 "reports its death to its tracer."
8939 #: build/C/man2/ptrace.2:857
8941 "If the B<PTRACE_O_TRACEEXIT> option is on, B<PTRACE_EVENT_EXIT> will happen "
8942 "before actual death. This applies to exits via B<exit>(2), "
8943 "B<exit_group>(2), and signal deaths (except B<SIGKILL>), and when threads "
8944 "are torn down on B<execve>(2) in a multithreaded process."
8948 #: build/C/man2/ptrace.2:882
8950 "The tracer cannot assume that the ptrace-stopped tracee exists. There are "
8951 "many scenarios when the tracee may die while stopped (such as B<SIGKILL>). "
8952 "Therefore, the tracer must be prepared to handle an B<ESRCH> error on any "
8953 "ptrace operation. Unfortunately, the same error is returned if the tracee "
8954 "exists but is not ptrace-stopped (for commands which require a stopped "
8955 "tracee), or if it is not traced by the process which issued the ptrace "
8956 "call. The tracer needs to keep track of the stopped/running state of the "
8957 "tracee, and interpret B<ESRCH> as \"tracee died unexpectedly\" only if it "
8958 "knows that the tracee has been observed to enter ptrace-stop. Note that "
8959 "there is no guarantee that I<waitpid(WNOHANG)> will reliably report the "
8960 "tracee's death status if a ptrace operation returned B<ESRCH>. "
8961 "I<waitpid(WNOHANG)> may return 0 instead. In other words, the tracee may be "
8962 "\"not yet fully dead\", but already refusing ptrace requests."
8966 #: build/C/man2/ptrace.2:896
8968 "The tracer can't assume that the tracee I<always> ends its life by reporting "
8969 "I<WIFEXITED(status)> or I<WIFSIGNALED(status)>; there are cases where this "
8970 "does not occur. For example, if a thread other than thread group leader "
8971 "does an B<execve>(2), it disappears; its PID will never be seen again, and "
8972 "any subsequent ptrace stops will be reported under the thread group leader's "
8977 #: build/C/man2/ptrace.2:896
8979 msgid "Stopped states"
8983 #: build/C/man2/ptrace.2:918
8985 "A tracee can be in two states: running or stopped. For the purposes of "
8986 "ptrace, a tracee which is blocked in a system call (such as B<read>(2), "
8987 "B<pause>(2), etc.) is nevertheless considered to be running, even if the "
8988 "tracee is blocked for a long time. The state of the tracee after "
8989 "B<PTRACE_LISTEN> is somewhat of a gray area: it is not in any ptrace-stop "
8990 "(ptrace commands won't work on it, and it will deliver B<waitpid>(2) "
8991 "notifications), but it also may be considered \"stopped\" because it is not "
8992 "executing instructions (is not scheduled), and if it was in group-stop "
8993 "before B<PTRACE_LISTEN>, it will not respond to signals until B<SIGCONT> is "
8998 #: build/C/man2/ptrace.2:922
9000 "There are many kinds of states when the tracee is stopped, and in ptrace "
9001 "discussions they are often conflated. Therefore, it is important to use "
9006 #: build/C/man2/ptrace.2:933
9008 "In this manual page, any stopped state in which the tracee is ready to "
9009 "accept ptrace commands from the tracer is called I<ptrace-stop>. "
9010 "Ptrace-stops can be further subdivided into I<signal-delivery-stop>, "
9011 "I<group-stop>, I<syscall-stop>, and so on. These stopped states are "
9012 "described in detail below."
9016 #: build/C/man2/ptrace.2:938
9018 "When the running tracee enters ptrace-stop, it notifies its tracer using "
9019 "B<waitpid>(2) (or one of the other \"wait\" system calls). Most of this "
9020 "manual page assumes that the tracer waits with:"
9024 #: build/C/man2/ptrace.2:940
9026 msgid " pid = waitpid(pid_or_minus_1, &status, __WALL);\n"
9030 #. Do we require __WALL usage, or will just using 0 be ok? (With 0,
9031 #. I am not 100% sure there aren't ugly corner cases.) Are the
9032 #. rules different if user wants to use waitid? Will waitid require
9035 #: build/C/man2/ptrace.2:952
9037 "Ptrace-stopped tracees are reported as returns with I<pid> greater than 0 "
9038 "and I<WIFSTOPPED(status)> true."
9042 #: build/C/man2/ptrace.2:960
9044 "The B<__WALL> flag does not include the B<WSTOPPED> and B<WEXITED> flags, "
9045 "but implies their functionality."
9049 #: build/C/man2/ptrace.2:967
9051 "Setting the B<WCONTINUED> flag when calling B<waitpid>(2) is not "
9052 "recommended: the \"continued\" state is per-process and consuming it can "
9053 "confuse the real parent of the tracee."
9057 #: build/C/man2/ptrace.2:975
9059 "Use of the B<WNOHANG> flag may cause B<waitpid>(2) to return 0 (\"no wait "
9060 "results available yet\") even if the tracer knows there should be a "
9061 "notification. Example:"
9065 #: build/C/man2/ptrace.2:984
9069 " ptrace(PTRACE_CONT, pid, 0L, 0L);\n"
9070 " if (errno == ESRCH) {\n"
9071 " /* tracee is dead */\n"
9072 " r = waitpid(tracee, &status, __WALL | WNOHANG);\n"
9073 " /* r can still be 0 here! */\n"
9078 #: build/C/man2/ptrace.2:1007
9080 "The following kinds of ptrace-stops exist: signal-delivery-stops, "
9081 "group-stops, B<PTRACE_EVENT> stops, syscall-stops. They all are reported by "
9082 "B<waitpid>(2) with I<WIFSTOPPED(status)> true. They may be differentiated "
9083 "by examining the value I<statusE<gt>E<gt>8>, and if there is ambiguity in "
9084 "that value, by querying B<PTRACE_GETSIGINFO>. (Note: the "
9085 "I<WSTOPSIG(status)> macro can't be used to perform this examination, because "
9086 "it returns the value I<(statusE<gt>E<gt>8)\\ &\\ 0xff>.)"
9090 #: build/C/man2/ptrace.2:1007
9092 msgid "Signal-delivery-stop"
9096 #: build/C/man2/ptrace.2:1027
9098 "When a (possibly multithreaded) process receives any signal except "
9099 "B<SIGKILL>, the kernel selects an arbitrary thread which handles the "
9100 "signal. (If the signal is generated with B<tgkill>(2), the target thread "
9101 "can be explicitly selected by the caller.) If the selected thread is "
9102 "traced, it enters signal-delivery-stop. At this point, the signal is not "
9103 "yet delivered to the process, and can be suppressed by the tracer. If the "
9104 "tracer doesn't suppress the signal, it passes the signal to the tracee in "
9105 "the next ptrace restart request. This second step of signal delivery is "
9106 "called I<signal injection> in this manual page. Note that if the signal is "
9107 "blocked, signal-delivery-stop doesn't happen until the signal is unblocked, "
9108 "with the usual exception that B<SIGSTOP> can't be blocked."
9112 #: build/C/man2/ptrace.2:1041
9114 "Signal-delivery-stop is observed by the tracer as B<waitpid>(2) returning "
9115 "with I<WIFSTOPPED(status)> true, with the signal returned by "
9116 "I<WSTOPSIG(status)>. If the signal is B<SIGTRAP>, this may be a different "
9117 "kind of ptrace-stop; see the \"Syscall-stops\" and \"execve\" sections below "
9118 "for details. If I<WSTOPSIG(status)> returns a stopping signal, this may be "
9119 "a group-stop; see below."
9123 #: build/C/man2/ptrace.2:1041
9125 msgid "Signal injection and suppression"
9129 #: build/C/man2/ptrace.2:1044
9131 "After signal-delivery-stop is observed by the tracer, the tracer should "
9132 "restart the tracee with the call"
9136 #: build/C/man2/ptrace.2:1046
9138 msgid " ptrace(PTRACE_restart, pid, 0, sig)\n"
9142 #: build/C/man2/ptrace.2:1059
9144 "where B<PTRACE_restart> is one of the restarting ptrace requests. If I<sig> "
9145 "is 0, then a signal is not delivered. Otherwise, the signal I<sig> is "
9146 "delivered. This operation is called I<signal injection> in this manual "
9147 "page, to distinguish it from signal-delivery-stop."
9151 #: build/C/man2/ptrace.2:1065
9153 "The I<sig> value may be different from the I<WSTOPSIG(status)> value: the "
9154 "tracer can cause a different signal to be injected."
9158 #: build/C/man2/ptrace.2:1081
9160 "Note that a suppressed signal still causes system calls to return "
9161 "prematurely. In this case, system calls will be restarted: the tracer will "
9162 "observe the tracee to reexecute the interrupted system call (or "
9163 "B<restart_syscall>(2) system call for a few system calls which use a "
9164 "different mechanism for restarting) if the tracer uses B<PTRACE_SYSCALL>. "
9165 "Even system calls (such as B<poll>(2)) which are not restartable after "
9166 "signal are restarted after signal is suppressed; however, kernel bugs exist "
9167 "which cause some system calls to fail with B<EINTR> even though no "
9168 "observable signal is injected to the tracee."
9172 #: build/C/man2/ptrace.2:1092
9174 "Restarting ptrace commands issued in ptrace-stops other than "
9175 "signal-delivery-stop are not guaranteed to inject a signal, even if I<sig> "
9176 "is nonzero. No error is reported; a nonzero I<sig> may simply be ignored. "
9177 "Ptrace users should not try to \"create a new signal\" this way: use "
9178 "B<tgkill>(2) instead."
9182 #: build/C/man2/ptrace.2:1099
9184 "The fact that signal injection requests may be ignored when restarting the "
9185 "tracee after ptrace stops that are not signal-delivery-stops is a cause of "
9186 "confusion among ptrace users. One typical scenario is that the tracer "
9187 "observes group-stop, mistakes it for signal-delivery-stop, restarts the "
9192 #: build/C/man2/ptrace.2:1101
9194 msgid " ptrace(PTRACE_restart, pid, 0, stopsig)\n"
9198 #: build/C/man2/ptrace.2:1107
9200 "with the intention of injecting I<stopsig>, but I<stopsig> gets ignored and "
9201 "the tracee continues to run."
9205 #: build/C/man2/ptrace.2:1127
9207 "The B<SIGCONT> signal has a side effect of waking up (all threads of) a "
9208 "group-stopped process. This side effect happens before "
9209 "signal-delivery-stop. The tracer can't suppress this side effect (it can "
9210 "only suppress signal injection, which only causes the B<SIGCONT> handler to "
9211 "not be executed in the tracee, if such a handler is installed). In fact, "
9212 "waking up from group-stop may be followed by signal-delivery-stop for "
9213 "signal(s) I<other than> B<SIGCONT>, if they were pending when B<SIGCONT> "
9214 "was delivered. In other words, B<SIGCONT> may be not the first signal "
9215 "observed by the tracee after it was sent."
9219 #: build/C/man2/ptrace.2:1131
9221 "Stopping signals cause (all threads of) a process to enter group-stop. This "
9222 "side effect happens after signal injection, and therefore can be suppressed "
9226 #. In the Linux 2.4 sources, in arch/i386/kernel/signal.c::do_signal(),
9229 #. /* The debugger continued. Ignore SIGSTOP. */
9230 #. if (signr == SIGSTOP)
9233 #: build/C/man2/ptrace.2:1141
9234 msgid "In Linux 2.4 and earlier, the B<SIGSTOP> signal can't be injected."
9238 #: build/C/man2/ptrace.2:1158
9240 "B<PTRACE_GETSIGINFO> can be used to retrieve a I<siginfo_t> structure which "
9241 "corresponds to the delivered signal. B<PTRACE_SETSIGINFO> may be used to "
9242 "modify it. If B<PTRACE_SETSIGINFO> has been used to alter I<siginfo_t>, the "
9243 "I<si_signo> field and the I<sig> parameter in the restarting command must "
9244 "match, otherwise the result is undefined."
9248 #: build/C/man2/ptrace.2:1158
9254 #: build/C/man2/ptrace.2:1170
9256 "When a (possibly multithreaded) process receives a stopping signal, all "
9257 "threads stop. If some threads are traced, they enter a group-stop. Note "
9258 "that the stopping signal will first cause signal-delivery-stop (on one "
9259 "tracee only), and only after it is injected by the tracer (or after it was "
9260 "dispatched to a thread which isn't traced), will group-stop be initiated on "
9261 "I<all> tracees within the multithreaded process. As usual, every tracee "
9262 "reports its group-stop separately to the corresponding tracer."
9266 #: build/C/man2/ptrace.2:1179
9268 "Group-stop is observed by the tracer as B<waitpid>(2) returning with "
9269 "I<WIFSTOPPED(status)> true, with the stopping signal available via "
9270 "I<WSTOPSIG(status)>. The same result is returned by some other classes of "
9271 "ptrace-stops, therefore the recommended practice is to perform the call"
9275 #: build/C/man2/ptrace.2:1181
9277 msgid " ptrace(PTRACE_GETSIGINFO, pid, 0, &siginfo)\n"
9281 #: build/C/man2/ptrace.2:1202
9283 "The call can be avoided if the signal is not B<SIGSTOP>, B<SIGTSTP>, "
9284 "B<SIGTTIN>, or B<SIGTTOU>; only these four signals are stopping signals. If "
9285 "the tracer sees something else, it can't be a group-stop. Otherwise, the "
9286 "tracer needs to call B<PTRACE_GETSIGINFO>. If B<PTRACE_GETSIGINFO> fails "
9287 "with B<EINVAL>, then it is definitely a group-stop. (Other failure codes "
9288 "are possible, such as B<ESRCH> (\"no such process\") if a B<SIGKILL> killed "
9293 #: build/C/man2/ptrace.2:1212
9295 "If tracee was attached using B<PTRACE_SEIZE>, group-stop is indicated by "
9296 "B<PTRACE_EVENT_STOP>: I<statusE<gt>E<gt>16 == PTRACE_EVENT_STOP>. This "
9297 "allows detection of group-stops without requiring an extra "
9298 "B<PTRACE_GETSIGINFO> call."
9302 #: build/C/man2/ptrace.2:1221
9304 "As of Linux 2.6.38, after the tracer sees the tracee ptrace-stop and until "
9305 "it restarts or kills it, the tracee will not run, and will not send "
9306 "notifications (except B<SIGKILL> death) to the tracer, even if the tracer "
9307 "enters into another B<waitpid>(2) call."
9311 #: build/C/man2/ptrace.2:1235
9313 "The kernel behavior described in the previous paragraph causes a problem "
9314 "with transparent handling of stopping signals. If the tracer restarts the "
9315 "tracee after group-stop, the stopping signal is effectively ignored\\(emthe "
9316 "tracee doesn't remain stopped, it runs. If the tracer doesn't restart the "
9317 "tracee before entering into the next B<waitpid>(2), future B<SIGCONT> "
9318 "signals will not be reported to the tracer; this would cause the B<SIGCONT> "
9319 "signals to have no effect on the tracee."
9323 #: build/C/man2/ptrace.2:1246
9325 "Since Linux 3.4, there is a method to overcome this problem: instead of "
9326 "B<PTRACE_CONT>, a B<PTRACE_LISTEN> command can be used to restart a tracee "
9327 "in a way where it does not execute, but waits for a new event which it can "
9328 "report via B<waitpid>(2) (such as when it is restarted by a B<SIGCONT>)."
9332 #: build/C/man2/ptrace.2:1246
9334 msgid "PTRACE_EVENT stops"
9338 #: build/C/man2/ptrace.2:1252
9340 "If the tracer sets B<PTRACE_O_TRACE_*> options, the tracee will enter "
9341 "ptrace-stops called B<PTRACE_EVENT> stops."
9345 #: build/C/man2/ptrace.2:1266
9347 "B<PTRACE_EVENT> stops are observed by the tracer as B<waitpid>(2) returning "
9348 "with I<WIFSTOPPED(status)>, and I<WSTOPSIG(status)> returns B<SIGTRAP>. An "
9349 "additional bit is set in the higher byte of the status word: the value "
9350 "I<statusE<gt>E<gt>8> will be"
9354 #: build/C/man2/ptrace.2:1268
9356 msgid " (SIGTRAP | PTRACE_EVENT_foo E<lt>E<lt> 8).\n"
9360 #: build/C/man2/ptrace.2:1270
9361 msgid "The following events exist:"
9365 #: build/C/man2/ptrace.2:1270
9367 msgid "B<PTRACE_EVENT_VFORK>"
9371 #: build/C/man2/ptrace.2:1283
9373 "Stop before return from B<vfork>(2) or B<clone>(2) with the B<CLONE_VFORK> "
9374 "flag. When the tracee is continued after this stop, it will wait for child "
9375 "to exit/exec before continuing its execution (in other words, the usual "
9376 "behavior on B<vfork>(2))."
9380 #: build/C/man2/ptrace.2:1283
9382 msgid "B<PTRACE_EVENT_FORK>"
9386 #: build/C/man2/ptrace.2:1291
9388 "Stop before return from B<fork>(2) or B<clone>(2) with the exit signal set "
9393 #: build/C/man2/ptrace.2:1291
9395 msgid "B<PTRACE_EVENT_CLONE>"
9399 #: build/C/man2/ptrace.2:1295
9400 msgid "Stop before return from B<clone>(2)."
9404 #: build/C/man2/ptrace.2:1295
9406 msgid "B<PTRACE_EVENT_VFORK_DONE>"
9410 #: build/C/man2/ptrace.2:1305
9412 "Stop before return from B<vfork>(2) or B<clone>(2) with the B<CLONE_VFORK> "
9413 "flag, but after the child unblocked this tracee by exiting or execing."
9417 #: build/C/man2/ptrace.2:1311
9419 "For all four stops described above, the stop occurs in the parent (i.e., the "
9420 "tracee), not in the newly created thread. B<PTRACE_GETEVENTMSG> can be used "
9421 "to retrieve the new thread's ID."
9425 #: build/C/man2/ptrace.2:1311
9427 msgid "B<PTRACE_EVENT_EXEC>"
9431 #: build/C/man2/ptrace.2:1318
9433 "Stop before return from B<execve>(2). Since Linux 3.0, "
9434 "B<PTRACE_GETEVENTMSG> returns the former thread ID."
9438 #: build/C/man2/ptrace.2:1318
9440 msgid "B<PTRACE_EVENT_EXIT>"
9444 #: build/C/man2/ptrace.2:1334
9446 "Stop before exit (including death from B<exit_group>(2)), signal death, or "
9447 "exit caused by B<execve>(2) in a multithreaded process. "
9448 "B<PTRACE_GETEVENTMSG> returns the exit status. Registers can be examined "
9449 "(unlike when \"real\" exit happens). The tracee is still alive; it needs to "
9450 "be B<PTRACE_CONT>ed or B<PTRACE_DETACH>ed to finish exiting."
9454 #: build/C/man2/ptrace.2:1334
9456 msgid "B<PTRACE_EVENT_STOP>"
9460 #: build/C/man2/ptrace.2:1346
9462 "Stop induced by B<PTRACE_INTERRUPT> command, or group-stop, or initial "
9463 "ptrace-stop when a new child is attached (only if attached using "
9464 "B<PTRACE_SEIZE>), or B<PTRACE_EVENT_STOP> if B<PTRACE_SEIZE> was used."
9468 #: build/C/man2/ptrace.2:1346
9470 msgid "B<PTRACE_EVENT_SECCOMP>"
9474 #: build/C/man2/ptrace.2:1357
9476 "Stop triggered by a B<seccomp>(2) rule on tracee syscall entry when "
9477 "B<PTRACE_O_TRACESECCOMP> has been set by the tracer. The seccomp event "
9478 "message data (from the B<SECCOMP_RET_DATA> portion of the seccomp filter "
9479 "rule) can be retrieved with B<PTRACE_GETEVENTMSG>."
9483 #: build/C/man2/ptrace.2:1369
9485 "B<PTRACE_GETSIGINFO> on B<PTRACE_EVENT> stops returns B<SIGTRAP> in "
9486 "I<si_signo>, with I<si_code> set to I<(eventE<lt>E<lt>8)\\ |\\ SIGTRAP>."
9490 #: build/C/man2/ptrace.2:1369
9492 msgid "Syscall-stops"
9496 #: build/C/man2/ptrace.2:1382
9498 "If the tracee was restarted by B<PTRACE_SYSCALL>, the tracee enters "
9499 "syscall-enter-stop just prior to entering any system call. If the tracer "
9500 "restarts the tracee with B<PTRACE_SYSCALL>, the tracee enters "
9501 "syscall-exit-stop when the system call is finished, or if it is interrupted "
9502 "by a signal. (That is, signal-delivery-stop never happens between "
9503 "syscall-enter-stop and syscall-exit-stop; it happens I<after> "
9504 "syscall-exit-stop.)"
9508 #: build/C/man2/ptrace.2:1396
9510 "Other possibilities are that the tracee may stop in a B<PTRACE_EVENT> stop, "
9511 "exit (if it entered B<_exit>(2) or B<exit_group>(2)), be killed by "
9512 "B<SIGKILL>, or die silently (if it is a thread group leader, the "
9513 "B<execve>(2) happened in another thread, and that thread is not traced by "
9514 "the same tracer; this situation is discussed later)."
9518 #: build/C/man2/ptrace.2:1411
9520 "Syscall-enter-stop and syscall-exit-stop are observed by the tracer as "
9521 "B<waitpid>(2) returning with I<WIFSTOPPED(status)> true, and "
9522 "I<WSTOPSIG(status)> giving B<SIGTRAP>. If the B<PTRACE_O_TRACESYSGOOD> "
9523 "option was set by the tracer, then I<WSTOPSIG(status)> will give the value "
9524 "I<(SIGTRAP\\ |\\ 0x80)>."
9528 #: build/C/man2/ptrace.2:1417
9530 "Syscall-stops can be distinguished from signal-delivery-stop with B<SIGTRAP> "
9531 "by querying B<PTRACE_GETSIGINFO> for the following cases:"
9535 #: build/C/man2/ptrace.2:1417
9537 msgid "I<si_code> E<lt>= 0"
9541 #: build/C/man2/ptrace.2:1429
9543 "B<SIGTRAP> was delivered as a result of a user-space action, for example, a "
9544 "system call (B<tgkill>(2), B<kill>(2), B<sigqueue>(3), etc.), expiration of "
9545 "a POSIX timer, change of state on a POSIX message queue, or completion of an "
9546 "asynchronous I/O request."
9550 #: build/C/man2/ptrace.2:1429
9552 msgid "I<si_code> == SI_KERNEL (0x80)"
9556 #: build/C/man2/ptrace.2:1433
9557 msgid "B<SIGTRAP> was sent by the kernel."
9561 #: build/C/man2/ptrace.2:1433
9563 msgid "I<si_code> == SIGTRAP or I<si_code> == (SIGTRAP|0x80)"
9567 #: build/C/man2/ptrace.2:1436
9568 msgid "This is a syscall-stop."
9572 #: build/C/man2/ptrace.2:1441
9574 "However, syscall-stops happen very often (twice per system call), and "
9575 "performing B<PTRACE_GETSIGINFO> for every syscall-stop may be somewhat "
9580 #: build/C/man2/ptrace.2:1464
9582 "Some architectures allow the cases to be distinguished by examining "
9583 "registers. For example, on x86, I<rax> == -B<ENOSYS> in "
9584 "syscall-enter-stop. Since B<SIGTRAP> (like any other signal) always happens "
9585 "I<after> syscall-exit-stop, and at this point I<rax> almost never contains "
9586 "-B<ENOSYS>, the B<SIGTRAP> looks like \"syscall-stop which is not "
9587 "syscall-enter-stop\"; in other words, it looks like a \"stray "
9588 "syscall-exit-stop\" and can be detected this way. But such detection is "
9589 "fragile and is best avoided."
9593 #: build/C/man2/ptrace.2:1470
9595 "Using the B<PTRACE_O_TRACESYSGOOD> option is the recommended method to "
9596 "distinguish syscall-stops from other kinds of ptrace-stops, since it is "
9597 "reliable and does not incur a performance penalty."
9601 #: build/C/man2/ptrace.2:1481
9603 "Syscall-enter-stop and syscall-exit-stop are indistinguishable from each "
9604 "other by the tracer. The tracer needs to keep track of the sequence of "
9605 "ptrace-stops in order to not misinterpret syscall-enter-stop as "
9606 "syscall-exit-stop or vice versa. The rule is that syscall-enter-stop is "
9607 "always followed by syscall-exit-stop, B<PTRACE_EVENT> stop or the tracee's "
9608 "death; no other kinds of ptrace-stop can occur in between."
9612 #: build/C/man2/ptrace.2:1486
9614 "If after syscall-enter-stop, the tracer uses a restarting command other than "
9615 "B<PTRACE_SYSCALL>, syscall-exit-stop is not generated."
9619 #: build/C/man2/ptrace.2:1498
9621 "B<PTRACE_GETSIGINFO> on syscall-stops returns B<SIGTRAP> in I<si_signo>, "
9622 "with I<si_code> set to B<SIGTRAP> or I<(SIGTRAP|0x80)>."
9626 #: build/C/man2/ptrace.2:1498
9628 msgid "PTRACE_SINGLESTEP, PTRACE_SYSEMU, PTRACE_SYSEMU_SINGLESTEP stops"
9633 #. document stops occurring with PTRACE_SINGLESTEP, PTRACE_SYSEMU,
9634 #. PTRACE_SYSEMU_SINGLESTEP
9636 #: build/C/man2/ptrace.2:1504
9637 msgid "[Details of these kinds of stops are yet to be documented.]"
9641 #: build/C/man2/ptrace.2:1504
9643 msgid "Informational and restarting ptrace commands"
9647 #: build/C/man2/ptrace.2:1514
9649 "Most ptrace commands (all except B<PTRACE_ATTACH>, B<PTRACE_SEIZE>, "
9650 "B<PTRACE_TRACEME>, B<PTRACE_INTERRUPT>, and B<PTRACE_KILL>) require the "
9651 "tracee to be in a ptrace-stop, otherwise they fail with B<ESRCH>."
9655 #: build/C/man2/ptrace.2:1519
9657 "When the tracee is in ptrace-stop, the tracer can read and write data to the "
9658 "tracee using informational commands. These commands leave the tracee in "
9659 "ptrace-stopped state:"
9663 #: build/C/man2/ptrace.2:1531
9666 " ptrace(PTRACE_PEEKTEXT/PEEKDATA/PEEKUSER, pid, addr, 0);\n"
9667 " ptrace(PTRACE_POKETEXT/POKEDATA/POKEUSER, pid, addr, long_val);\n"
9668 " ptrace(PTRACE_GETREGS/GETFPREGS, pid, 0, &struct);\n"
9669 " ptrace(PTRACE_SETREGS/SETFPREGS, pid, 0, &struct);\n"
9670 " ptrace(PTRACE_GETREGSET, pid, NT_foo, &iov);\n"
9671 " ptrace(PTRACE_SETREGSET, pid, NT_foo, &iov);\n"
9672 " ptrace(PTRACE_GETSIGINFO, pid, 0, &siginfo);\n"
9673 " ptrace(PTRACE_SETSIGINFO, pid, 0, &siginfo);\n"
9674 " ptrace(PTRACE_GETEVENTMSG, pid, 0, &long_var);\n"
9675 " ptrace(PTRACE_SETOPTIONS, pid, 0, PTRACE_O_flags);\n"
9679 #: build/C/man2/ptrace.2:1543
9681 "Note that some errors are not reported. For example, setting signal "
9682 "information (I<siginfo>) may have no effect in some ptrace-stops, yet the "
9683 "call may succeed (return 0 and not set I<errno>); querying "
9684 "B<PTRACE_GETEVENTMSG> may succeed and return some random value if current "
9685 "ptrace-stop is not documented as returning a meaningful event message."
9689 #: build/C/man2/ptrace.2:1545
9694 #: build/C/man2/ptrace.2:1547
9696 msgid " ptrace(PTRACE_SETOPTIONS, pid, 0, PTRACE_O_flags);\n"
9700 #: build/C/man2/ptrace.2:1556
9702 "affects one tracee. The tracee's current flags are replaced. Flags are "
9703 "inherited by new tracees created and \"auto-attached\" via active "
9704 "B<PTRACE_O_TRACEFORK>, B<PTRACE_O_TRACEVFORK>, or B<PTRACE_O_TRACECLONE> "
9709 #: build/C/man2/ptrace.2:1559
9711 "Another group of commands makes the ptrace-stopped tracee run. They have "
9716 #: build/C/man2/ptrace.2:1561
9718 msgid " ptrace(cmd, pid, 0, sig);\n"
9722 #: build/C/man2/ptrace.2:1582
9724 "where I<cmd> is B<PTRACE_CONT>, B<PTRACE_LISTEN>, B<PTRACE_DETACH>, "
9725 "B<PTRACE_SYSCALL>, B<PTRACE_SINGLESTEP>, B<PTRACE_SYSEMU>, or "
9726 "B<PTRACE_SYSEMU_SINGLESTEP>. If the tracee is in signal-delivery-stop, "
9727 "I<sig> is the signal to be injected (if it is nonzero). Otherwise, I<sig> "
9728 "may be ignored. (When restarting a tracee from a ptrace-stop other than "
9729 "signal-delivery-stop, recommended practice is to always pass 0 in I<sig>.)"
9733 #: build/C/man2/ptrace.2:1582
9735 msgid "Attaching and detaching"
9739 #: build/C/man2/ptrace.2:1584
9740 msgid "A thread can be attached to the tracer using the call"
9744 #: build/C/man2/ptrace.2:1586
9746 msgid " ptrace(PTRACE_ATTACH, pid, 0, 0);\n"
9750 #: build/C/man2/ptrace.2:1588 build/C/man2/ptrace.2:2090
9755 #: build/C/man2/ptrace.2:1590
9757 msgid " ptrace(PTRACE_SEIZE, pid, 0, PTRACE_O_flags);\n"
9761 #. FIXME . Describe how to attach to a thread which is already group-stopped.
9763 #: build/C/man2/ptrace.2:1614
9765 "B<PTRACE_ATTACH> sends B<SIGSTOP> to this thread. If the tracer wants this "
9766 "B<SIGSTOP> to have no effect, it needs to suppress it. Note that if other "
9767 "signals are concurrently sent to this thread during attach, the tracer may "
9768 "see the tracee enter signal-delivery-stop with other signal(s) first! The "
9769 "usual practice is to reinject these signals until B<SIGSTOP> is seen, then "
9770 "suppress B<SIGSTOP> injection. The design bug here is that a ptrace attach "
9771 "and a concurrently delivered B<SIGSTOP> may race and the concurrent "
9772 "B<SIGSTOP> may be lost."
9776 #: build/C/man2/ptrace.2:1621
9778 "Since attaching sends B<SIGSTOP> and the tracer usually suppresses it, this "
9779 "may cause a stray B<EINTR> return from the currently executing system call "
9780 "in the tracee, as described in the \"Signal injection and suppression\" "
9785 #: build/C/man2/ptrace.2:1633
9787 "Since Linux 3.4, B<PTRACE_SEIZE> can be used instead of B<PTRACE_ATTACH>. "
9788 "B<PTRACE_SEIZE> does not stop the attached process. If you need to stop it "
9789 "after attach (or at any other time) without sending it any signals, use "
9790 "B<PTRACE_INTERRUPT> command."
9794 #: build/C/man2/ptrace.2:1635
9799 #: build/C/man2/ptrace.2:1637
9801 msgid " ptrace(PTRACE_TRACEME, 0, 0, 0);\n"
9805 #: build/C/man2/ptrace.2:1643
9807 "turns the calling thread into a tracee. The thread continues to run "
9808 "(doesn't enter ptrace-stop). A common practice is to follow the "
9809 "B<PTRACE_TRACEME> with"
9813 #: build/C/man2/ptrace.2:1645
9815 msgid " raise(SIGSTOP);\n"
9819 #: build/C/man2/ptrace.2:1648
9821 "and allow the parent (which is our tracer now) to observe our "
9822 "signal-delivery-stop."
9826 #: build/C/man2/ptrace.2:1672
9828 "If the B<PTRACE_O_TRACEFORK>, B<PTRACE_O_TRACEVFORK>, or "
9829 "B<PTRACE_O_TRACECLONE> options are in effect, then children created by, "
9830 "respectively, B<vfork>(2) or B<clone>(2) with the B<CLONE_VFORK> flag, "
9831 "B<fork>(2) or B<clone>(2) with the exit signal set to B<SIGCHLD>, and "
9832 "other kinds of B<clone>(2), are automatically attached to the same tracer "
9833 "which traced their parent. B<SIGSTOP> is delivered to the children, causing "
9834 "them to enter signal-delivery-stop after they exit the system call which "
9839 #: build/C/man2/ptrace.2:1674
9840 msgid "Detaching of the tracee is performed by:"
9844 #: build/C/man2/ptrace.2:1676
9846 msgid " ptrace(PTRACE_DETACH, pid, 0, sig);\n"
9850 #: build/C/man2/ptrace.2:1684
9852 "B<PTRACE_DETACH> is a restarting operation; therefore it requires the tracee "
9853 "to be in ptrace-stop. If the tracee is in signal-delivery-stop, a signal "
9854 "can be injected. Otherwise, the I<sig> parameter may be silently ignored."
9857 #. FIXME . Describe how to detach from a group-stopped tracee so that it
9858 #. doesn't run, but continues to wait for SIGCONT.
9860 #: build/C/man2/ptrace.2:1708
9862 "If the tracee is running when the tracer wants to detach it, the usual "
9863 "solution is to send B<SIGSTOP> (using B<tgkill>(2), to make sure it goes to "
9864 "the correct thread), wait for the tracee to stop in signal-delivery-stop for "
9865 "B<SIGSTOP> and then detach it (suppressing B<SIGSTOP> injection). A design "
9866 "bug is that this can race with concurrent B<SIGSTOP>s. Another complication "
9867 "is that the tracee may enter other ptrace-stops and needs to be restarted "
9868 "and waited for again, until B<SIGSTOP> is seen. Yet another complication is "
9869 "to be sure that the tracee is not already ptrace-stopped, because no signal "
9870 "delivery happens while it is\\(emnot even B<SIGSTOP>."
9874 #: build/C/man2/ptrace.2:1716
9876 "If the tracer dies, all tracees are automatically detached and restarted, "
9877 "unless they were in group-stop. Handling of restart from group-stop is "
9878 "currently buggy, but the \"as planned\" behavior is to leave tracee stopped "
9879 "and waiting for B<SIGCONT>. If the tracee is restarted from "
9880 "signal-delivery-stop, the pending signal is injected."
9884 #: build/C/man2/ptrace.2:1716
9886 msgid "execve(2) under ptrace"
9889 #. clone(2) CLONE_THREAD says:
9890 #. If any of the threads in a thread group performs an execve(2),
9891 #. then all threads other than the thread group leader are terminated,
9892 #. and the new program is executed in the thread group leader.
9894 #. In kernel 3.1 sources, see fs/exec.c::de_thread()
9896 #: build/C/man2/ptrace.2:1735
9898 "When one thread in a multithreaded process calls B<execve>(2), the kernel "
9899 "destroys all other threads in the process, and resets the thread ID of the "
9900 "execing thread to the thread group ID (process ID). (Or, to put things "
9901 "another way, when a multithreaded process does an B<execve>(2), at "
9902 "completion of the call, it appears as though the B<execve>(2) occurred in "
9903 "the thread group leader, regardless of which thread did the B<execve>(2).) "
9904 "This resetting of the thread ID looks very confusing to tracers:"
9908 #: build/C/man2/ptrace.2:1745
9910 "All other threads stop in B<PTRACE_EVENT_EXIT> stop, if the "
9911 "B<PTRACE_O_TRACEEXIT> option was turned on. Then all other threads except "
9912 "the thread group leader report death as if they exited via B<_exit>(2) with "
9917 #: build/C/man2/ptrace.2:1753
9919 "The execing tracee changes its thread ID while it is in the B<execve>(2). "
9920 "(Remember, under ptrace, the \"pid\" returned from B<waitpid>(2), or fed "
9921 "into ptrace calls, is the tracee's thread ID.) That is, the tracee's thread "
9922 "ID is reset to be the same as its process ID, which is the same as the "
9923 "thread group leader's thread ID."
9927 #: build/C/man2/ptrace.2:1759
9929 "Then a B<PTRACE_EVENT_EXEC> stop happens, if the B<PTRACE_O_TRACEEXEC> "
9930 "option was turned on."
9934 #: build/C/man2/ptrace.2:1780
9936 "If the thread group leader has reported its B<PTRACE_EVENT_EXIT> stop by "
9937 "this time, it appears to the tracer that the dead thread leader \"reappears "
9938 "from nowhere\". (Note: the thread group leader does not report death via "
9939 "I<WIFEXITED(status)> until there is at least one other live thread. This "
9940 "eliminates the possibility that the tracer will see it dying and then "
9941 "reappearing.) If the thread group leader was still alive, for the tracer "
9942 "this may look as if thread group leader returns from a different system call "
9943 "than it entered, or even \"returned from a system call even though it was "
9944 "not in any system call\". If the thread group leader was not traced (or was "
9945 "traced by a different tracer), then during B<execve>(2) it will appear as "
9946 "if it has become a tracee of the tracer of the execing tracee."
9950 #: build/C/man2/ptrace.2:1783
9952 "All of the above effects are the artifacts of the thread ID change in the "
9957 #: build/C/man2/ptrace.2:1803
9959 "The B<PTRACE_O_TRACEEXEC> option is the recommended tool for dealing with "
9960 "this situation. First, it enables B<PTRACE_EVENT_EXEC> stop, which occurs "
9961 "before B<execve>(2) returns. In this stop, the tracer can use "
9962 "B<PTRACE_GETEVENTMSG> to retrieve the tracee's former thread ID. (This "
9963 "feature was introduced in Linux 3.0). Second, the B<PTRACE_O_TRACEEXEC> "
9964 "option disables legacy B<SIGTRAP> generation on B<execve>(2)."
9968 #: build/C/man2/ptrace.2:1809
9970 "When the tracer receives B<PTRACE_EVENT_EXEC> stop notification, it is "
9971 "guaranteed that except this tracee and the thread group leader, no other "
9972 "threads from the process are alive."
9976 #: build/C/man2/ptrace.2:1817
9978 "On receiving the B<PTRACE_EVENT_EXEC> stop notification, the tracer should "
9979 "clean up all its internal data structures describing the threads of this "
9980 "process, and retain only one data structure\\(emone which describes the "
9981 "single still running tracee, with"
9985 #: build/C/man2/ptrace.2:1819
9987 msgid " thread ID == thread group ID == process ID.\n"
9991 #: build/C/man2/ptrace.2:1823
9992 msgid "Example: two threads call B<execve>(2) at the same time:"
9996 #: build/C/man2/ptrace.2:1834
9999 "*** we get syscall-enter-stop in thread 1: **\n"
10000 "PID1 execve(\"/bin/foo\", \"foo\" E<lt>unfinished ...E<gt>\n"
10001 "*** we issue PTRACE_SYSCALL for thread 1 **\n"
10002 "*** we get syscall-enter-stop in thread 2: **\n"
10003 "PID2 execve(\"/bin/bar\", \"bar\" E<lt>unfinished ...E<gt>\n"
10004 "*** we issue PTRACE_SYSCALL for thread 2 **\n"
10005 "*** we get PTRACE_EVENT_EXEC for PID0, we issue PTRACE_SYSCALL **\n"
10006 "*** we get syscall-exit-stop for PID0: **\n"
10007 "PID0 E<lt>... execve resumedE<gt> ) = 0\n"
10010 #. type: Plain text
10011 #: build/C/man2/ptrace.2:1857
10013 "If the B<PTRACE_O_TRACEEXEC> option is I<not> in effect for the execing "
10014 "tracee, the kernel delivers an extra B<SIGTRAP> to the tracee after "
10015 "B<execve>(2) returns. This is an ordinary signal (similar to one which can "
10016 "be generated by I<kill -TRAP>), not a special kind of ptrace-stop. "
10017 "Employing B<PTRACE_GETSIGINFO> for this signal returns I<si_code> set to 0 "
10018 "(I<SI_USER>). This signal may be blocked by signal mask, and thus may be "
10019 "delivered (much) later."
10022 #. type: Plain text
10023 #: build/C/man2/ptrace.2:1876
10025 "Usually, the tracer (for example, B<strace>(1)) would not want to show this "
10026 "extra post-execve B<SIGTRAP> signal to the user, and would suppress its "
10027 "delivery to the tracee (if B<SIGTRAP> is set to B<SIG_DFL>, it is a killing "
10028 "signal). However, determining I<which> B<SIGTRAP> to suppress is not easy. "
10029 "Setting the B<PTRACE_O_TRACEEXEC> option and thus suppressing this extra "
10030 "B<SIGTRAP> is the recommended approach."
10034 #: build/C/man2/ptrace.2:1876
10036 msgid "Real parent"
10039 #. type: Plain text
10040 #: build/C/man2/ptrace.2:1883
10042 "The ptrace API (ab)uses the standard UNIX parent/child signaling over "
10043 "B<waitpid>(2). This used to cause the real parent of the process to stop "
10044 "receiving several kinds of B<waitpid>(2) notifications when the child "
10045 "process is traced by some other process."
10048 #. type: Plain text
10049 #: build/C/man2/ptrace.2:1886
10051 "Many of these bugs have been fixed, but as of Linux 2.6.38 several still "
10052 "exist; see BUGS below."
10055 #. type: Plain text
10056 #: build/C/man2/ptrace.2:1888
10057 msgid "As of Linux 2.6.38, the following is believed to work correctly:"
10060 #. type: Plain text
10061 #: build/C/man2/ptrace.2:1896
10063 "exit/death by signal is reported first to the tracer, then, when the tracer "
10064 "consumes the B<waitpid>(2) result, to the real parent (to the real parent "
10065 "only when the whole multithreaded process exits). If the tracer and the "
10066 "real parent are the same process, the report is sent only once."
10069 #. type: Plain text
10070 #: build/C/man2/ptrace.2:1901
10072 "On success, the B<PTRACE_PEEK*> requests return the requested data (but see "
10073 "NOTES), while other requests return zero."
10076 #. type: Plain text
10077 #: build/C/man2/ptrace.2:1911
10079 "On error, all requests return -1, and I<errno> is set appropriately. Since "
10080 "the value returned by a successful B<PTRACE_PEEK*> request may be -1, the "
10081 "caller must clear I<errno> before the call, and then check it afterward to "
10082 "determine whether or not an error occurred."
10085 #. type: Plain text
10086 #: build/C/man2/ptrace.2:1915
10087 msgid "(i386 only) There was an error with allocating or freeing a debug register."
10090 #. type: Plain text
10091 #: build/C/man2/ptrace.2:1926
10093 "There was an attempt to read from or write to an invalid area in the "
10094 "tracer's or the tracee's memory, probably because the area wasn't mapped or "
10095 "accessible. Unfortunately, under Linux, different variations of this fault "
10096 "will return B<EIO> or B<EFAULT> more or less arbitrarily."
10099 #. type: Plain text
10100 #: build/C/man2/ptrace.2:1929
10101 msgid "An attempt was made to set an invalid option."
10104 #. type: Plain text
10105 #: build/C/man2/ptrace.2:1936
10107 "I<request> is invalid, or an attempt was made to read from or write to an "
10108 "invalid area in the tracer's or the tracee's memory, or there was a "
10109 "word-alignment violation, or an invalid signal was specified during a "
10113 #. type: Plain text
10114 #: build/C/man2/ptrace.2:1949
10116 "The specified process cannot be traced. This could be because the tracer "
10117 "has insufficient privileges (the required capability is B<CAP_SYS_PTRACE>); "
10118 "unprivileged processes cannot trace processes that they cannot send signals "
10119 "to or those running set-user-ID/set-group-ID programs, for obvious reasons. "
10120 "Alternatively, the process may already be being traced, or (on kernels "
10121 "before 2.6.26) be B<init>(1) (PID 1)."
10124 #. type: Plain text
10125 #: build/C/man2/ptrace.2:1954
10127 "The specified process does not exist, or is not currently being traced by "
10128 "the caller, or is not stopped (for requests that require a stopped tracee)."
10131 #. type: Plain text
10132 #: build/C/man2/ptrace.2:1956
10133 msgid "SVr4, 4.3BSD."
10136 #. type: Plain text
10137 #: build/C/man2/ptrace.2:1971
10139 "Although arguments to B<ptrace>() are interpreted according to the "
10140 "prototype given, glibc currently declares B<ptrace>() as a variadic "
10141 "function with only the I<request> argument fixed. It is recommended to "
10142 "always supply four arguments, even if the requested operation does not use "
10143 "them, setting unused/ignored arguments to I<0L> or I<(void\\ *)\\ 0>."
10146 #. See commit 00cd5c37afd5f431ac186dd131705048c0a11fdb
10147 #. type: Plain text
10148 #: build/C/man2/ptrace.2:1976
10150 "In Linux kernels before 2.6.26, B<init>(1), the process with PID 1, may not "
10154 #. See http://lkml.org/lkml/2008/5/8/375
10155 #. type: Plain text
10156 #: build/C/man2/ptrace.2:1983
10158 "The layout of the contents of memory and the USER area are quite "
10159 "operating-system- and architecture-specific. The offset supplied, and the "
10160 "data returned, might not entirely match with the definition of I<struct "
10164 #. type: Plain text
10165 #: build/C/man2/ptrace.2:1986
10167 "The size of a \"word\" is determined by the operating-system variant (e.g., "
10168 "for 32-bit Linux it is 32 bits)."
10171 #. type: Plain text
10172 #: build/C/man2/ptrace.2:1994
10174 "This page documents the way the B<ptrace>() call works currently in Linux. "
10175 "Its behavior differs significantly on other flavors of UNIX. In any case, "
10176 "use of B<ptrace>() is highly specific to the operating system and "
10181 #: build/C/man2/ptrace.2:1994
10183 msgid "C library/kernel ABI differences"
10186 #. type: Plain text
10187 #: build/C/man2/ptrace.2:2006
10189 "At the system call level, the B<PTRACE_PEEKTEXT>, B<PTRACE_PEEKDATA>, and "
10190 "B<PTRACE_PEEKUSER> requests have a different API: they store the result at "
10191 "the address specified by the I<data> parameter, and the return value is the "
10192 "error flag. The glibc wrapper function provides the API given in "
10193 "DESCRIPTION above, with the result being returned via the function return "
10197 #. type: Plain text
10198 #: build/C/man2/ptrace.2:2017
10200 "On hosts with 2.6 kernel headers, B<PTRACE_SETOPTIONS> is declared with a "
10201 "different value than the one for 2.4. This leads to applications compiled "
10202 "with 2.6 kernel headers failing when run on 2.4 kernels. This can be worked "
10203 "around by redefining B<PTRACE_SETOPTIONS> to B<PTRACE_OLDSETOPTIONS>, if "
10207 #. type: Plain text
10208 #: build/C/man2/ptrace.2:2020
10210 "Group-stop notifications are sent to the tracer, but not to real parent. "
10211 "Last confirmed on 2.6.38.6."
10214 #. Note from Denys Vlasenko:
10215 #. Here "exits" means any kind of death - _exit, exit_group,
10216 #. signal death. Signal death and exit_group cases are trivial,
10217 #. though: since signal death and exit_group kill all other threads
10218 #. too, "until all other threads exit" thing happens rather soon
10219 #. in these cases. Therefore, only _exit presents observably
10220 #. puzzling behavior to ptrace users: thread leader _exit's,
10221 #. but WIFEXITED isn't reported! We are trying to explain here
10223 #. FIXME . need to test/verify this scenario
10224 #. type: Plain text
10225 #: build/C/man2/ptrace.2:2051
10227 "If a thread group leader is traced and exits by calling B<_exit>(2), a "
10228 "B<PTRACE_EVENT_EXIT> stop will happen for it (if requested), but the "
10229 "subsequent B<WIFEXITED> notification will not be delivered until all other "
10230 "threads exit. As explained above, if one of other threads calls "
10231 "B<execve>(2), the death of the thread group leader will I<never> be "
10232 "reported. If the execed thread is not traced by this tracer, the tracer "
10233 "will never know that B<execve>(2) happened. One possible workaround is to "
10234 "B<PTRACE_DETACH> the thread group leader instead of restarting it in this "
10235 "case. Last confirmed on 2.6.38.6."
10238 #. type: Plain text
10239 #: build/C/man2/ptrace.2:2061
10241 "A B<SIGKILL> signal may still cause a B<PTRACE_EVENT_EXIT> stop before "
10242 "actual signal death. This may be changed in the future; B<SIGKILL> is meant "
10243 "to always immediately kill tasks even under ptrace. Last confirmed on "
10247 #. type: Plain text
10248 #: build/C/man2/ptrace.2:2079
10250 "Some system calls return with B<EINTR> if a signal was sent to a tracee, but "
10251 "delivery was suppressed by the tracer. (This is very typical operation: it "
10252 "is usually done by debuggers on every attach, in order to not introduce a "
10253 "bogus B<SIGSTOP>). As of Linux 3.2.9, the following system calls are "
10254 "affected (this list is likely incomplete): B<epoll_wait>(2), and B<read>(2) "
10255 "from an B<inotify>(7) file descriptor. The usual symptom of this bug is "
10256 "that when you attach to a quiescent process with the command"
10259 #. type: Plain text
10260 #: build/C/man2/ptrace.2:2081
10262 msgid " strace -p E<lt>process-IDE<gt>\n"
10265 #. type: Plain text
10266 #: build/C/man2/ptrace.2:2084
10267 msgid "then, instead of the usual and expected one-line output such as"
10270 #. type: Plain text
10271 #: build/C/man2/ptrace.2:2087
10273 msgid " restart_syscall(E<lt>... resuming interrupted call ...E<gt>_\n"
10276 #. type: Plain text
10277 #: build/C/man2/ptrace.2:2093
10279 msgid " select(6, [5], NULL, [5], NULL_\n"
10282 #. type: Plain text
10283 #: build/C/man2/ptrace.2:2097
10285 "('_' denotes the cursor position), you observe more than one line. For "
10289 #. type: Plain text
10290 #: build/C/man2/ptrace.2:2101
10293 " clock_gettime(CLOCK_MONOTONIC, {15370, 690928118}) = 0\n"
10294 " epoll_wait(4,_\n"
10297 #. type: Plain text
10298 #: build/C/man2/ptrace.2:2122
10300 "What is not visible here is that the process was blocked in B<epoll_wait>(2) "
10301 "before B<strace>(1) has attached to it. Attaching caused B<epoll_wait>(2) "
10302 "to return to user space with the error B<EINTR>. In this particular case, "
10303 "the program reacted to B<EINTR> by checking the current time, and then "
10304 "executing B<epoll_wait>(2) again. (Programs which do not expect such "
10305 "\"stray\" B<EINTR> errors may behave in an unintended way upon an "
10306 "B<strace>(1) attach.)"
10309 #. type: Plain text
10310 #: build/C/man2/ptrace.2:2137
10312 "B<gdb>(1), B<strace>(1), B<clone>(2), B<execve>(2), B<fork>(2), "
10313 "B<gettid>(2), B<seccomp>(2), B<sigaction>(2), B<tgkill>(2), B<vfork>(2), "
10314 "B<waitpid>(2), B<exec>(3), B<capabilities>(7), B<signal>(7)"
10318 #: build/C/man2/quotactl.2:27
10324 #: build/C/man2/quotactl.2:27
10329 #. type: Plain text
10330 #: build/C/man2/quotactl.2:30
10331 msgid "quotactl - manipulate disk quotas"
10334 #. type: Plain text
10335 #: build/C/man2/quotactl.2:34
10338 "B<#include E<lt>sys/quota.hE<gt>>\n"
10339 "B<#include E<lt>xfs/xqm.hE<gt>>\n"
10342 #. type: Plain text
10343 #: build/C/man2/quotactl.2:37
10346 "B<int quotactl(int >I<cmd>B<, const char *>I<special>B<, int >I<id>B<, "
10347 "caddr_t >I<addr>B<);>\n"
10350 #. type: Plain text
10351 #: build/C/man2/quotactl.2:49
10353 "The quota system can be used to set per-user and per-group limits on the "
10354 "amount of disk space used on a filesystem. For each user and/or group, a "
10355 "soft limit and a hard limit can be set for each filesystem. The hard limit "
10356 "can't be exceeded. The soft limit can be exceeded, but warnings will "
10357 "ensue. Moreover, the user can't exceed the soft limit for more than one "
10358 "week (by default) at a time; after this time, the soft limit counts as a "
10362 #. type: Plain text
10363 #: build/C/man2/quotactl.2:74
10365 "The B<quotactl>() call manipulates disk quotas. The I<cmd> argument "
10366 "indicates a command to be applied to the user or group ID specified in "
10367 "I<id>. To initialize the I<cmd> argument, use the I<QCMD(subcmd, type)> "
10368 "macro. The I<type> value is either B<USRQUOTA>, for user quotas, or "
10369 "B<GRPQUOTA>, for group quotas. The I<subcmd> value is described below."
10372 #. type: Plain text
10373 #: build/C/man2/quotactl.2:79
10375 "The I<special> argument is a pointer to a null-terminated string containing "
10376 "the pathname of the (mounted) block special device for the filesystem being "
10380 #. type: Plain text
10381 #: build/C/man2/quotactl.2:87
10383 "The I<addr> argument is the address of an optional, command-specific, data "
10384 "structure that is copied in or out of the system. The interpretation of "
10385 "I<addr> is given with each command below."
10388 #. type: Plain text
10389 #: build/C/man2/quotactl.2:91
10390 msgid "The I<subcmd> value is one of the following:"
10394 #: build/C/man2/quotactl.2:91
10396 msgid "B<Q_QUOTAON>"
10399 #. type: Plain text
10400 #: build/C/man2/quotactl.2:98
10402 "Turn on quotas for a filesystem. The I<id> argument is the identification "
10403 "number of the quota format to be used. Currently, there are three supported "
10408 #: build/C/man2/quotactl.2:99
10410 msgid "B<QFMT_VFS_OLD>"
10413 #. type: Plain text
10414 #: build/C/man2/quotactl.2:102
10415 msgid "The original quota format."
10419 #: build/C/man2/quotactl.2:102
10421 msgid "B<QFMT_VFS_V0>"
10424 #. type: Plain text
10425 #: build/C/man2/quotactl.2:106
10427 "The standard VFS v0 quota format, which can handle 32-bit UIDs and GIDs and "
10428 "quota limits up to 2^42 bytes and 2^32 inodes."
10432 #: build/C/man2/quotactl.2:106
10434 msgid "B<QFMT_VFS_V1>"
10437 #. type: Plain text
10438 #: build/C/man2/quotactl.2:110
10440 "A quota format that can handle 32-bit UIDs and GIDs and quota limits of 2^64 "
10441 "bytes and 2^64 inodes."
10444 #. type: Plain text
10445 #: build/C/man2/quotactl.2:121
10447 "The I<addr> argument points to the pathname of a file containing the quotas "
10448 "for the filesystem. The quota file must exist; it is normally created with "
10449 "the B<quotacheck>(8) program. This operation requires privilege "
10450 "(B<CAP_SYS_ADMIN>)."
10454 #: build/C/man2/quotactl.2:121
10456 msgid "B<Q_QUOTAOFF>"
10459 #. type: Plain text
10460 #: build/C/man2/quotactl.2:131
10462 "Turn off quotas for a filesystem. The I<addr> and I<id> arguments are "
10463 "ignored. This operation requires privilege (B<CAP_SYS_ADMIN>)."
10467 #: build/C/man2/quotactl.2:131
10469 msgid "B<Q_GETQUOTA>"
10472 #. type: Plain text
10473 #: build/C/man2/quotactl.2:142
10475 "Get disk quota limits and current usage for user or group I<id>. The "
10476 "I<addr> argument is a pointer to a I<dqblk> structure defined in "
10477 "I<E<lt>sys/quota.hE<gt>> as follows:"
10480 #. type: Plain text
10481 #: build/C/man2/quotactl.2:147 build/C/man2/quotactl.2:234
10484 "/* uint64_t is an unsigned 64-bit integer;\n"
10485 " uint32_t is an unsigned 32-bit integer */\n"
10488 #. type: Plain text
10489 #: build/C/man2/quotactl.2:167
10492 "struct dqblk { /* Definition since Linux 2.4.22 */\n"
10493 " uint64_t dqb_bhardlimit; /* absolute limit on disk\n"
10494 " quota blocks alloc */\n"
10495 " uint64_t dqb_bsoftlimit; /* preferred limit on\n"
10496 " disk quota blocks */\n"
10497 " uint64_t dqb_curspace; /* current quota block\n"
10499 " uint64_t dqb_ihardlimit; /* maximum number of\n"
10500 " allocated inodes */\n"
10501 " uint64_t dqb_isoftlimit; /* preferred inode limit */\n"
10502 " uint64_t dqb_curinodes; /* current number of\n"
10503 " allocated inodes */\n"
10504 " uint64_t dqb_btime; /* time limit for excessive\n"
10506 " uint64_t dqb_itime; /* time limit for excessive\n"
10508 " uint32_t dqb_valid; /* bit mask of QIF_*\n"
10513 #. type: Plain text
10514 #: build/C/man2/quotactl.2:170
10517 "/* Flags in dqb_valid that indicate which fields in\n"
10518 " dqblk structure are valid. */\n"
10521 #. type: Plain text
10522 #: build/C/man2/quotactl.2:181
10525 "#define QIF_BLIMITS 1\n"
10526 "#define QIF_SPACE 2\n"
10527 "#define QIF_ILIMITS 4\n"
10528 "#define QIF_INODES 8\n"
10529 "#define QIF_BTIME 16\n"
10530 "#define QIF_ITIME 32\n"
10531 "#define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS)\n"
10532 "#define QIF_USAGE (QIF_SPACE | QIF_INODES)\n"
10533 "#define QIF_TIMES (QIF_BTIME | QIF_ITIME)\n"
10534 "#define QIF_ALL (QIF_LIMITS | QIF_USAGE | QIF_TIMES)\n"
10537 #. type: Plain text
10538 #: build/C/man2/quotactl.2:198
10540 "The I<dqb_valid> field is a bit mask that is set to indicate the entries in "
10541 "the I<dqblk> structure that are valid. Currently, the kernel fills in all "
10542 "entries of the I<dqblk> structure and marks them as valid in the "
10543 "I<dqb_valid> field. Unprivileged users may retrieve only their own quotas; "
10544 "a privileged user (B<CAP_SYS_ADMIN>) can retrieve the quotas of any user."
10548 #: build/C/man2/quotactl.2:198
10550 msgid "B<Q_SETQUOTA>"
10553 #. type: Plain text
10554 #: build/C/man2/quotactl.2:218
10556 "Set quota information for user or group I<id>, using the information "
10557 "supplied in the I<dqblk> structure pointed to by I<addr>. The I<dqb_valid> "
10558 "field of the I<dqblk> structure indicates which entries in the structure "
10559 "have been set by the caller. This operation supersedes the B<Q_SETQLIM> and "
10560 "B<Q_SETUSE> operations in the previous quota interfaces. This operation "
10561 "requires privilege (B<CAP_SYS_ADMIN>)."
10565 #: build/C/man2/quotactl.2:218
10567 msgid "B<Q_GETINFO>"
10570 #. type: Plain text
10571 #: build/C/man2/quotactl.2:229
10573 "Get information (like grace times) about quotafile. The I<addr> argument "
10574 "should be a pointer to a I<dqinfo> structure. This structure is defined in "
10575 "I<E<lt>sys/quota.hE<gt>> as follows:"
10578 #. type: Plain text
10579 #: build/C/man2/quotactl.2:238
10582 "struct dqinfo { /* Defined since kernel 2.4.22 */\n"
10583 " uint64_t dqi_bgrace; /* Time before block soft limit\n"
10584 " becomes hard limit */\n"
10587 #. type: Plain text
10588 #: build/C/man2/quotactl.2:245
10591 " uint64_t dqi_igrace; /* Time before inode soft limit\n"
10592 " becomes hard limit */\n"
10593 " uint32_t dqi_flags; /* Flags for quotafile\n"
10595 " uint32_t dqi_valid;\n"
10599 #. type: Plain text
10600 #: build/C/man2/quotactl.2:247
10602 msgid "/* Bits for dqi_flags */\n"
10605 #. type: Plain text
10606 #: build/C/man2/quotactl.2:249
10608 msgid "/* Quota format QFMT_VFS_OLD */\n"
10611 #. type: Plain text
10612 #: build/C/man2/quotactl.2:251
10614 msgid "#define V1_DQF_RSQUASH\t1 /* Root squash enabled */\n"
10617 #. type: Plain text
10618 #: build/C/man2/quotactl.2:253
10620 msgid "/* Other quota formats have no dqi_flags bits defined */\n"
10623 #. type: Plain text
10624 #: build/C/man2/quotactl.2:256
10627 "/* Flags in dqi_valid that indicate which fields in\n"
10628 " dqinfo structure are valid. */\n"
10631 #. type: Plain text
10632 #: build/C/man2/quotactl.2:261
10635 "# define IIF_BGRACE\t1\n"
10636 "# define IIF_IGRACE\t2\n"
10637 "# define IIF_FLAGS\t4\n"
10638 "# define IIF_ALL (IIF_BGRACE | IIF_IGRACE | IIF_FLAGS)\n"
10641 #. type: Plain text
10642 #: build/C/man2/quotactl.2:277
10644 "The I<dqi_valid> field in the I<dqinfo> structure indicates the entries in "
10645 "the structure that are valid. Currently, the kernel fills in all entries of "
10646 "the I<dqinfo> structure and marks them all as valid in the I<dqi_valid> "
10647 "field. The I<id> argument is ignored."
10651 #: build/C/man2/quotactl.2:277
10653 msgid "B<Q_SETINFO>"
10656 #. type: Plain text
10657 #: build/C/man2/quotactl.2:301
10659 "Set information about quotafile. The I<addr> argument should be a pointer "
10660 "to a I<dqinfo> structure. The I<dqi_valid> field of the I<dqinfo> structure "
10661 "indicates the entries in the structure that have been set by the caller. "
10662 "This operation supersedes the B<Q_SETGRACE> and B<Q_SETFLAGS> operations in "
10663 "the previous quota interfaces. The I<id> argument is ignored. This "
10664 "operation requires privilege (B<CAP_SYS_ADMIN>)."
10668 #: build/C/man2/quotactl.2:301
10670 msgid "B<Q_GETFMT>"
10673 #. type: Plain text
10674 #: build/C/man2/quotactl.2:308
10676 "Get quota format used on the specified filesystem. The I<addr> argument "
10677 "should be a pointer to a 4-byte buffer where the format number will be "
10682 #: build/C/man2/quotactl.2:308
10687 #. type: Plain text
10688 #: build/C/man2/quotactl.2:319
10690 "Update the on-disk copy of quota usages for a filesystem. If I<special> is "
10691 "NULL, then all filesystems with active quotas are sync'ed. The I<addr> and "
10692 "I<id> arguments are ignored."
10696 #: build/C/man2/quotactl.2:319
10698 msgid "B<Q_GETSTATS>"
10701 #. Q_GETSTATS was removed in kernel 2.4.22.
10702 #. type: Plain text
10703 #: build/C/man2/quotactl.2:339
10705 "Get statistics and other generic information about the quota subsystem. The "
10706 "I<addr> argument should be a pointer to a I<dqstats> structure in which data "
10707 "should be stored. This structure is defined in I<E<lt>sys/quota.hE<gt>>. "
10708 "The I<special> and I<id> arguments are ignored. This operation is obsolete "
10709 "and not supported by recent kernels. Files in I</proc/sys/fs/quota/> carry "
10710 "the information instead."
10713 #. type: Plain text
10714 #: build/C/man2/quotactl.2:342
10716 "For XFS filesystems making use of the XFS Quota Manager (XQM), the above "
10717 "commands are bypassed and the following commands are used:"
10721 #: build/C/man2/quotactl.2:342
10723 msgid "B<Q_XQUOTAON>"
10726 #. type: Plain text
10727 #: build/C/man2/quotactl.2:363
10729 "Turn on quotas for an XFS filesystem. XFS provides the ability to turn "
10730 "on/off quota limit enforcement with quota accounting. Therefore, XFS "
10731 "expects I<addr> to be a pointer to an I<unsigned int> that contains either "
10732 "the flags B<XFS_QUOTA_UDQ_ACCT> and/or B<XFS_QUOTA_UDQ_ENFD> (for user "
10733 "quota), or B<XFS_QUOTA_GDQ_ACCT> and/or B<XFS_QUOTA_GDQ_ENFD> (for group "
10734 "quota), as defined in I<E<lt>xfs/xqm.hE<gt>>. This operation requires "
10735 "privilege (B<CAP_SYS_ADMIN>)."
10739 #: build/C/man2/quotactl.2:363
10741 msgid "B<Q_XQUOTAOFF>"
10744 #. type: Plain text
10745 #: build/C/man2/quotactl.2:374
10747 "Turn off quotas for an XFS filesystem. As with B<Q_QUOTAON>, XFS "
10748 "filesystems expect a pointer to an I<unsigned int> that specifies whether "
10749 "quota accounting and/or limit enforcement need to be turned off. This "
10750 "operation requires privilege (B<CAP_SYS_ADMIN>)."
10754 #: build/C/man2/quotactl.2:374
10756 msgid "B<Q_XGETQUOTA>"
10759 #. type: Plain text
10760 #: build/C/man2/quotactl.2:388
10762 "Get disk quota limits and current usage for user I<id>. The I<addr> "
10763 "argument is a pointer to an I<fs_disk_quota> structure (defined in "
10764 "I<E<lt>xfs/xqm.hE<gt>>). Unprivileged users may retrieve only their own "
10765 "quotas; a privileged user (B<CAP_SYS_ADMIN>) may retrieve the quotas of any "
10770 #: build/C/man2/quotactl.2:388
10772 msgid "B<Q_XSETQLIM>"
10775 #. type: Plain text
10776 #: build/C/man2/quotactl.2:400
10778 "Set disk quota limits for user I<id>. The I<addr> argument is a pointer to "
10779 "an I<fs_disk_quota> structure (defined in I<E<lt>xfs/xqm.hE<gt>>). This "
10780 "operation requires privilege (B<CAP_SYS_ADMIN>)."
10784 #: build/C/man2/quotactl.2:400
10786 msgid "B<Q_XGETQSTAT>"
10789 #. type: Plain text
10790 #: build/C/man2/quotactl.2:408
10792 "Returns an I<fs_quota_stat> structure containing XFS filesystem-specific "
10793 "quota information. This is useful for finding out how much space is used to "
10794 "store quota information, and also to get quotaon/off status of a given local "
10799 #: build/C/man2/quotactl.2:408
10801 msgid "B<Q_XQUOTARM>"
10804 #. type: Plain text
10805 #: build/C/man2/quotactl.2:412
10807 "Free the disk space taken by disk quotas. Quotas must have already been "
10811 #. type: Plain text
10812 #: build/C/man2/quotactl.2:419
10814 "There is no command equivalent to B<Q_SYNC> for XFS since B<sync>(1) writes "
10815 "quota information to disk (in addition to the other filesystem metadata that "
10819 #. type: Plain text
10820 #: build/C/man2/quotactl.2:427
10822 "On success, B<quotactl>() returns 0; on error -1 is returned, and I<errno> "
10823 "is set to indicate the error."
10826 #. type: Plain text
10827 #: build/C/man2/quotactl.2:434
10828 msgid "I<addr> or I<special> is invalid."
10831 #. type: Plain text
10832 #: build/C/man2/quotactl.2:440
10833 msgid "I<cmd> or I<type> is invalid."
10836 #. type: Plain text
10837 #: build/C/man2/quotactl.2:447
10838 msgid "The file specified by I<special> or I<addr> does not exist."
10841 #. type: Plain text
10842 #: build/C/man2/quotactl.2:452
10843 msgid "The kernel has not been compiled with the B<CONFIG_QUOTA> option."
10847 #: build/C/man2/quotactl.2:452
10852 #. type: Plain text
10853 #: build/C/man2/quotactl.2:456
10854 msgid "I<special> is not a block device."
10857 #. type: Plain text
10858 #: build/C/man2/quotactl.2:461
10860 "The caller lacked the required privilege (B<CAP_SYS_ADMIN>) for the "
10861 "specified operation."
10864 #. type: Plain text
10865 #: build/C/man2/quotactl.2:465
10867 "No disk quota is found for the indicated user. Quotas have not been turned "
10868 "on for this filesystem."
10871 #. type: Plain text
10872 #: build/C/man2/quotactl.2:474
10873 msgid "If I<cmd> is B<Q_SETQUOTA>, B<quotactl>() may also set I<errno> to:"
10876 #. type: Plain text
10877 #: build/C/man2/quotactl.2:477
10878 msgid "Specified limits are out of range allowed by quota format."
10881 #. type: Plain text
10882 #: build/C/man2/quotactl.2:486
10883 msgid "If I<cmd> is B<Q_QUOTAON>, B<quotactl>() may also set I<errno> to:"
10886 #. type: Plain text
10887 #: build/C/man2/quotactl.2:495
10889 "The quota file pointed to by I<addr> exists, but is not a regular file; or, "
10890 "the quota file pointed to by I<addr> exists, but is not on the filesystem "
10891 "pointed to by I<special>."
10894 #. type: Plain text
10895 #: build/C/man2/quotactl.2:501
10896 msgid "B<Q_QUOTAON> attempted, but another B<Q_QUOTAON> had already been performed."
10899 #. type: Plain text
10900 #: build/C/man2/quotactl.2:504
10901 msgid "The quota file is corrupted."
10904 #. type: Plain text
10905 #: build/C/man2/quotactl.2:507
10906 msgid "Specified quota format was not found."
10909 #. type: Plain text
10910 #: build/C/man2/quotactl.2:512
10911 msgid "B<quota>(1), B<getrlimit>(2), B<quotacheck>(8), B<quotaon>(8)"
10915 #: build/C/man2/sendfile.2:19
10921 #: build/C/man2/sendfile.2:19
10926 #. type: Plain text
10927 #: build/C/man2/sendfile.2:22
10928 msgid "sendfile - transfer data between file descriptors"
10931 #. type: Plain text
10932 #: build/C/man2/sendfile.2:24
10933 msgid "B<#include E<lt>sys/sendfile.hE<gt>>"
10936 #. The below is too ugly. Comments about glibc versions belong
10937 #. in the notes, not in the header.
10939 #. .B #include <features.h>
10941 #. .B #if (__GLIBC__==2 && __GLIBC_MINOR__>=1) || __GLIBC__>2
10943 #. .B #include <sys/sendfile.h>
10947 #. .B #include <sys/types.h>
10949 #. .B /* No system prototype before glibc 2.1. */
10951 #. .BI "ssize_t sendfile(int" " out_fd" ", int" " in_fd" ", off_t *" \
10952 #. offset ", size_t" " count" )
10955 #. type: Plain text
10956 #: build/C/man2/sendfile.2:47
10958 "B<ssize_t sendfile(int>I< out_fd>B<, int>I< in_fd>B<, off_t *>I<offset>B<, "
10959 "size_t>I< count>B<);>"
10962 #. type: Plain text
10963 #: build/C/man2/sendfile.2:57
10965 "B<sendfile>() copies data between one file descriptor and another. Because "
10966 "this copying is done within the kernel, B<sendfile>() is more efficient "
10967 "than the combination of B<read>(2) and B<write>(2), which would require "
10968 "transferring data to and from user space."
10971 #. type: Plain text
10972 #: build/C/man2/sendfile.2:62
10974 "I<in_fd> should be a file descriptor opened for reading and I<out_fd> should "
10975 "be a descriptor opened for writing."
10978 #. type: Plain text
10979 #: build/C/man2/sendfile.2:83
10981 "If I<offset> is not NULL, then it points to a variable holding the file "
10982 "offset from which B<sendfile>() will start reading data from I<in_fd>. "
10983 "When B<sendfile>() returns, this variable will be set to the offset of the "
10984 "byte following the last byte that was read. If I<offset> is not NULL, then "
10985 "B<sendfile>() does not modify the current file offset of I<in_fd>; "
10986 "otherwise the current file offset is adjusted to reflect the number of bytes "
10987 "read from I<in_fd>."
10990 #. type: Plain text
10991 #: build/C/man2/sendfile.2:90
10993 "If I<offset> is NULL, then data will be read from I<in_fd> starting at the "
10994 "current file offset, and the file offset will be updated by the call."
10997 #. type: Plain text
10998 #: build/C/man2/sendfile.2:93
10999 msgid "I<count> is the number of bytes to copy between the file descriptors."
11002 #. type: Plain text
11003 #: build/C/man2/sendfile.2:100
11005 "The I<in_fd> argument must correspond to a file which supports "
11006 "B<mmap>(2)-like operations (i.e., it cannot be a socket)."
11009 #. type: Plain text
11010 #: build/C/man2/sendfile.2:108
11012 "In Linux kernels before 2.6.33, I<out_fd> must refer to a socket. Since "
11013 "Linux 2.6.33 it can be any file. If it is a regular file, then "
11014 "B<sendfile>() changes the file offset appropriately."
11017 #. type: Plain text
11018 #: build/C/man2/sendfile.2:115
11020 "If the transfer was successful, the number of bytes written to I<out_fd> is "
11021 "returned. On error, -1 is returned, and I<errno> is set appropriately."
11024 #. type: Plain text
11025 #: build/C/man2/sendfile.2:121
11027 "Nonblocking I/O has been selected using B<O_NONBLOCK> and the write would "
11031 #. type: Plain text
11032 #: build/C/man2/sendfile.2:125
11034 "The input file was not opened for reading or the output file was not opened "
11038 #. type: Plain text
11039 #: build/C/man2/sendfile.2:128
11040 msgid "Bad address."
11043 #. type: Plain text
11044 #: build/C/man2/sendfile.2:134
11046 "Descriptor is not valid or locked, or an B<mmap>(2)-like operation is not "
11047 "available for I<in_fd>."
11050 #. type: Plain text
11051 #: build/C/man2/sendfile.2:138
11052 msgid "Unspecified error while reading from I<in_fd>."
11055 #. type: Plain text
11056 #: build/C/man2/sendfile.2:142
11057 msgid "Insufficient memory to read from I<in_fd>."
11060 #. type: Plain text
11061 #: build/C/man2/sendfile.2:148
11063 "B<sendfile>() is a new feature in Linux 2.2. The include file "
11064 "I<E<lt>sys/sendfile.hE<gt>> is present since glibc 2.1."
11067 #. type: Plain text
11068 #: build/C/man2/sendfile.2:150
11069 msgid "Not specified in POSIX.1-2001, or other standards."
11072 #. type: Plain text
11073 #: build/C/man2/sendfile.2:155
11075 "Other UNIX systems implement B<sendfile>() with different semantics and "
11076 "prototypes. It should not be used in portable programs."
11079 #. type: Plain text
11080 #: build/C/man2/sendfile.2:165
11082 "If you plan to use B<sendfile>() for sending files to a TCP socket, but "
11083 "need to send some header data in front of the file contents, you will find "
11084 "it useful to employ the B<TCP_CORK> option, described in B<tcp>(7), to "
11085 "minimize the number of packets and to tune performance."
11088 #. type: Plain text
11089 #: build/C/man2/sendfile.2:171
11091 "In Linux 2.4 and earlier, I<out_fd> could also refer to a regular file, and "
11092 "B<sendfile>() changed the current offset of that file."
11095 #. type: Plain text
11096 #: build/C/man2/sendfile.2:183
11098 "The original Linux B<sendfile>() system call was not designed to handle "
11099 "large file offsets. Consequently, Linux 2.4 added B<sendfile64>(), with a "
11100 "wider type for the I<offset> argument. The glibc B<sendfile>() wrapper "
11101 "function transparently deals with the kernel differences."
11104 #. type: Plain text
11105 #: build/C/man2/sendfile.2:192
11107 "Applications may wish to fall back to B<read>(2)/B<write>(2) in the case "
11108 "where B<sendfile>() fails with B<EINVAL> or B<ENOSYS>."
11111 #. type: Plain text
11112 #: build/C/man2/sendfile.2:197
11114 "The Linux-specific B<splice>(2) call supports transferring data between "
11115 "arbitrary files (e.g., a pair of sockets)."
11118 #. type: Plain text
11119 #: build/C/man2/sendfile.2:202
11120 msgid "B<mmap>(2), B<open>(2), B<socket>(2), B<splice>(2)"
11124 #: build/C/man2/set_tid_address.2:25
11126 msgid "SET_TID_ADDRESS"
11130 #: build/C/man2/set_tid_address.2:25
11135 #. type: Plain text
11136 #: build/C/man2/set_tid_address.2:28
11137 msgid "set_tid_address - set pointer to thread ID"
11140 #. type: Plain text
11141 #: build/C/man2/set_tid_address.2:31
11143 msgid "B<#include E<lt>linux/unistd.hE<gt>>\n"
11146 #. type: Plain text
11147 #: build/C/man2/set_tid_address.2:33
11149 msgid "B<long set_tid_address(int *>I<tidptr>B<);>\n"
11152 #. type: Plain text
11153 #: build/C/man2/set_tid_address.2:40
11155 "For each thread, the kernel maintains two attributes (addresses) called "
11156 "I<set_child_tid> and I<clear_child_tid>. These two attributes contain the "
11157 "value NULL by default."
11161 #: build/C/man2/set_tid_address.2:40
11163 msgid "I<set_child_tid>"
11166 #. type: Plain text
11167 #: build/C/man2/set_tid_address.2:51
11169 "If a thread is started using B<clone>(2) with the B<CLONE_CHILD_SETTID> "
11170 "flag, I<set_child_tid> is set to the value passed in the I<ctid> argument of "
11171 "that system call."
11174 #. type: Plain text
11175 #: build/C/man2/set_tid_address.2:56
11177 "When I<set_child_tid> is set, the very first thing the new thread does is to "
11178 "write its thread ID at this address."
11182 #: build/C/man2/set_tid_address.2:56
11184 msgid "I<clear_child_tid>"
11187 #. type: Plain text
11188 #: build/C/man2/set_tid_address.2:67
11190 "If a thread is started using B<clone>(2) with the B<CLONE_CHILD_CLEARTID> "
11191 "flag, I<clear_child_tid> is set to the value passed in the I<ctid> argument "
11192 "of that system call."
11195 #. type: Plain text
11196 #: build/C/man2/set_tid_address.2:74
11198 "The system call B<set_tid_address>() sets the I<clear_child_tid> value for "
11199 "the calling thread to I<tidptr>."
11202 #. type: Plain text
11203 #: build/C/man2/set_tid_address.2:82
11205 "When a thread whose I<clear_child_tid> is not NULL terminates, then, if the "
11206 "thread is sharing memory with other threads, then 0 is written at the "
11207 "address specified in I<clear_child_tid> and the kernel performs the "
11208 "following operation:"
11211 #. type: Plain text
11212 #: build/C/man2/set_tid_address.2:84
11214 msgid " futex(clear_child_tid, FUTEX_WAKE, 1, NULL, NULL, 0);\n"
11217 #. type: Plain text
11218 #: build/C/man2/set_tid_address.2:88
11220 "The effect of this operation is to wake a single thread that is performing a "
11221 "futex wait on the memory location. Errors from the futex wake operation are "
11225 #. type: Plain text
11226 #: build/C/man2/set_tid_address.2:91
11227 msgid "B<set_tid_address>() always returns the caller's thread ID."
11230 #. type: Plain text
11231 #: build/C/man2/set_tid_address.2:94
11232 msgid "B<set_tid_address>() always succeeds."
11235 #. type: Plain text
11236 #: build/C/man2/set_tid_address.2:97
11238 "This call is present since Linux 2.5.48. Details as given here are valid "
11239 "since Linux 2.5.49."
11242 #. type: Plain text
11243 #: build/C/man2/set_tid_address.2:103
11244 msgid "B<clone>(2), B<futex>(2), B<gettid>(2)"
11248 #: build/C/man2/splice.2:26
11254 #: build/C/man2/splice.2:26 build/C/man2/tee.2:26
11259 #. type: Plain text
11260 #: build/C/man2/splice.2:29
11261 msgid "splice - splice data to/from a pipe"
11264 #. type: Plain text
11265 #: build/C/man2/splice.2:33 build/C/man2/tee.2:33
11268 "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n"
11269 "B<#include E<lt>fcntl.hE<gt>>\n"
11272 #. Return type was long before glibc 2.7
11273 #. type: Plain text
11274 #: build/C/man2/splice.2:38
11277 "B<ssize_t splice(int >I<fd_in>B<, loff_t *>I<off_in>B<, int >I<fd_out>B<,>\n"
11278 "B< loff_t *>I<off_out>B<, size_t >I<len>B<, unsigned int "
11282 #. type: Plain text
11283 #: build/C/man2/splice.2:50
11285 "B<splice>() moves data between two file descriptors without copying between "
11286 "kernel address space and user address space. It transfers up to I<len> "
11287 "bytes of data from the file descriptor I<fd_in> to the file descriptor "
11288 "I<fd_out>, where one of the descriptors must refer to a pipe."
11291 #. type: Plain text
11292 #: build/C/man2/splice.2:55
11293 msgid "The following semantics apply for I<fd_in> and I<off_in>:"
11296 #. type: Plain text
11297 #: build/C/man2/splice.2:61
11298 msgid "If I<fd_in> refers to a pipe, then I<off_in> must be NULL."
11301 #. type: Plain text
11302 #: build/C/man2/splice.2:70
11304 "If I<fd_in> does not refer to a pipe and I<off_in> is NULL, then bytes are "
11305 "read from I<fd_in> starting from the current file offset, and the current "
11306 "file offset is adjusted appropriately."
11309 #. type: Plain text
11310 #: build/C/man2/splice.2:83
11312 "If I<fd_in> does not refer to a pipe and I<off_in> is not NULL, then "
11313 "I<off_in> must point to a buffer which specifies the starting offset from "
11314 "which bytes will be read from I<fd_in>; in this case, the current file "
11315 "offset of I<fd_in> is not changed."
11318 #. type: Plain text
11319 #: build/C/man2/splice.2:88
11320 msgid "Analogous statements apply for I<fd_out> and I<off_out>."
11323 #. type: Plain text
11324 #: build/C/man2/splice.2:93 build/C/man2/vmsplice.2:78
11326 "The I<flags> argument is a bit mask that is composed by ORing together zero "
11327 "or more of the following values:"
11331 #: build/C/man2/splice.2:93 build/C/man2/tee.2:62 build/C/man2/vmsplice.2:78
11333 msgid "B<SPLICE_F_MOVE>"
11336 #. type: Plain text
11337 #: build/C/man2/splice.2:106
11339 "Attempt to move pages instead of copying. This is only a hint to the "
11340 "kernel: pages may still be copied if the kernel cannot move the pages from "
11341 "the pipe, or if the pipe buffers don't refer to full pages. The initial "
11342 "implementation of this flag was buggy: therefore starting in Linux 2.6.21 it "
11343 "is a no-op (but is still permitted in a B<splice>() call); in the future, a "
11344 "correct implementation may be restored."
11348 #: build/C/man2/splice.2:106 build/C/man2/tee.2:68 build/C/man2/vmsplice.2:84
11350 msgid "B<SPLICE_F_NONBLOCK>"
11353 #. type: Plain text
11354 #: build/C/man2/splice.2:115
11356 "Do not block on I/O. This makes the splice pipe operations nonblocking, but "
11357 "B<splice>() may nevertheless block because the file descriptors that are "
11358 "spliced to/from may block (unless they have the B<O_NONBLOCK> flag set)."
11362 #: build/C/man2/splice.2:115 build/C/man2/tee.2:73 build/C/man2/vmsplice.2:91
11364 msgid "B<SPLICE_F_MORE>"
11367 #. type: Plain text
11368 #: build/C/man2/splice.2:129
11370 "More data will be coming in a subsequent splice. This is a helpful hint "
11371 "when the I<fd_out> refers to a socket (see also the description of "
11372 "B<MSG_MORE> in B<send>(2), and the description of B<TCP_CORK> in B<tcp>(7))"
11376 #: build/C/man2/splice.2:129 build/C/man2/tee.2:79 build/C/man2/vmsplice.2:97
11378 msgid "B<SPLICE_F_GIFT>"
11381 #. type: Plain text
11382 #: build/C/man2/splice.2:135
11383 msgid "Unused for B<splice>(); see B<vmsplice>(2)."
11386 #. type: Plain text
11387 #: build/C/man2/splice.2:144
11389 "Upon successful completion, B<splice>() returns the number of bytes spliced "
11390 "to or from the pipe. A return value of 0 means that there was no data to "
11391 "transfer, and it would not make sense to block, because there are no writers "
11392 "connected to the write end of the pipe referred to by I<fd_in>."
11395 #. type: Plain text
11396 #: build/C/man2/splice.2:150
11397 msgid "On error, B<splice>() returns -1 and I<errno> is set to indicate the error."
11400 #. type: Plain text
11401 #: build/C/man2/splice.2:157 build/C/man2/tee.2:107 build/C/man2/vmsplice.2:133
11403 "B<SPLICE_F_NONBLOCK> was specified in I<flags>, and the operation would "
11407 #. type: Plain text
11408 #: build/C/man2/splice.2:161
11410 "One or both file descriptors are not valid, or do not have proper read-write "
11414 #. The append-mode error is given since 2.6.27; in earlier kernels,
11415 #. splice() in append mode was broken
11416 #. type: Plain text
11417 #: build/C/man2/splice.2:169
11419 "Target filesystem doesn't support splicing; target file is opened in append "
11420 "mode; neither of the descriptors refers to a pipe; or offset given for "
11421 "nonseekable device."
11424 #. type: Plain text
11425 #: build/C/man2/splice.2:172 build/C/man2/tee.2:120 build/C/man2/vmsplice.2:148
11426 msgid "Out of memory."
11430 #: build/C/man2/splice.2:172
11435 #. type: Plain text
11436 #: build/C/man2/splice.2:179
11438 "Either I<off_in> or I<off_out> was not NULL, but the corresponding file "
11439 "descriptor refers to a pipe."
11442 #. type: Plain text
11443 #: build/C/man2/splice.2:184
11445 "The B<splice>() system call first appeared in Linux 2.6.17; library support "
11446 "was added to glibc in version 2.5."
11449 #. type: Plain text
11450 #: build/C/man2/splice.2:196
11452 "The three system calls B<splice>(), B<vmsplice>(2), and B<tee>(2), provide "
11453 "user-space programs with full control over an arbitrary kernel buffer, "
11454 "implemented within the kernel using the same type of buffer that is used for "
11455 "a pipe. In overview, these system calls perform the following tasks:"
11459 #: build/C/man2/splice.2:196
11461 msgid "B<splice>()"
11464 #. type: Plain text
11465 #: build/C/man2/splice.2:200
11467 "moves data from the buffer to an arbitrary file descriptor, or vice versa, "
11468 "or from one buffer to another."
11472 #: build/C/man2/splice.2:200
11477 #. type: Plain text
11478 #: build/C/man2/splice.2:203
11479 msgid "\"copies\" the data from one buffer to another."
11483 #: build/C/man2/splice.2:203
11485 msgid "B<vmsplice>(2)"
11488 #. type: Plain text
11489 #: build/C/man2/splice.2:206
11490 msgid "\"copies\" data from user space into the buffer."
11494 #. Linus: Now, imagine using the above in a media server, for example.
11495 #. Let's say that a year or two has passed, so that the video drivers
11496 #. have been updated to be able to do the splice thing, and what can
11497 #. you do? You can:
11499 #. - splice from the (mpeg or whatever - let's just assume that the video
11500 #. input is either digital or does the encoding on its own - like they
11501 #. pretty much all do) video input into a pipe (remember: no copies - the
11502 #. video input will just DMA directly into memory, and splice will just
11503 #. set up the pages in the pipe buffer)
11504 #. - tee that pipe to split it up
11505 #. - splice one end to a file (ie "save the compressed stream to disk")
11506 #. - splice the other end to a real-time video decoder window for your
11507 #. real-time viewing pleasure.
11509 #. Linus: Now, the advantage of splice()/tee() is that you can
11510 #. do zero-copy movement of data, and unlike sendfile() you can
11511 #. do it on _arbitrary_ data (and, as shown by "tee()", it's more
11512 #. than just sending the data to somebody else: you can duplicate
11513 #. the data and choose to forward it to two or more different
11514 #. users - for things like logging etc.).
11515 #. type: Plain text
11516 #: build/C/man2/splice.2:237
11518 "Though we talk of copying, actual copies are generally avoided. The kernel "
11519 "does this by implementing a pipe buffer as a set of reference-counted "
11520 "pointers to pages of kernel memory. The kernel creates \"copies\" of pages "
11521 "in a buffer by creating new pointers (for the output buffer) referring to "
11522 "the pages, and increasing the reference counts for the pages: only pointers "
11523 "are copied, not the pages of the buffer."
11526 #. type: Plain text
11527 #: build/C/man2/splice.2:240
11528 msgid "See B<tee>(2)."
11531 #. type: Plain text
11532 #: build/C/man2/splice.2:244
11533 msgid "B<sendfile>(2), B<tee>(2), B<vmsplice>(2)"
11537 #: build/C/man2/tee.2:26
11542 #. type: Plain text
11543 #: build/C/man2/tee.2:29
11544 msgid "tee - duplicating pipe content"
11547 #. type: Plain text
11548 #: build/C/man2/tee.2:36
11551 "B<ssize_t tee(int >I<fd_in>B<, int >I<fd_out>B<, size_t >I<len>B<, unsigned "
11552 "int >I<flags>B<);>\n"
11555 #. Example programs http://brick.kernel.dk/snaps
11558 #. add a "tee(in, out1, out2)" system call that duplicates the pages
11559 #. (again, incrementing their reference count, not copying the data) from
11560 #. one pipe to two other pipes.
11561 #. type: Plain text
11562 #: build/C/man2/tee.2:56
11564 "B<tee>() duplicates up to I<len> bytes of data from the pipe referred to by "
11565 "the file descriptor I<fd_in> to the pipe referred to by the file descriptor "
11566 "I<fd_out>. It does not consume the data that is duplicated from I<fd_in>; "
11567 "therefore, that data can be copied by a subsequent B<splice>(2)."
11570 #. type: Plain text
11571 #: build/C/man2/tee.2:62
11573 "I<flags> is a series of modifier flags, which share the name space with "
11574 "B<splice>(2) and B<vmsplice>(2):"
11577 #. type: Plain text
11578 #: build/C/man2/tee.2:68
11579 msgid "Currently has no effect for B<tee>(); see B<splice>(2)."
11582 #. Not used for vmsplice
11583 #. May be in the future -- therefore EAGAIN
11584 #. type: Plain text
11585 #: build/C/man2/tee.2:73 build/C/man2/vmsplice.2:91
11586 msgid "Do not block on I/O; see B<splice>(2) for further details."
11589 #. type: Plain text
11590 #: build/C/man2/tee.2:79
11592 "Currently has no effect for B<tee>(), but may be implemented in the future; "
11593 "see B<splice>(2)."
11596 #. type: Plain text
11597 #: build/C/man2/tee.2:85
11598 msgid "Unused for B<tee>(); see B<vmsplice>(2)."
11601 #. type: Plain text
11602 #: build/C/man2/tee.2:94
11604 "Upon successful completion, B<tee>() returns the number of bytes that were "
11605 "duplicated between the input and output. A return value of 0 means that "
11606 "there was no data to transfer, and it would not make sense to block, because "
11607 "there are no writers connected to the write end of the pipe referred to by "
11611 #. type: Plain text
11612 #: build/C/man2/tee.2:100
11613 msgid "On error, B<tee>() returns -1 and I<errno> is set to indicate the error."
11616 #. type: Plain text
11617 #: build/C/man2/tee.2:117
11619 "I<fd_in> or I<fd_out> does not refer to a pipe; or I<fd_in> and I<fd_out> "
11620 "refer to the same pipe."
11623 #. type: Plain text
11624 #: build/C/man2/tee.2:125
11626 "The B<tee>() system call first appeared in Linux 2.6.17; library support "
11627 "was added to glibc in version 2.5."
11630 #. type: Plain text
11631 #: build/C/man2/tee.2:136
11633 "Conceptually, B<tee>() copies the data between the two pipes. In reality "
11634 "no real data copying takes place though: under the covers, B<tee>() assigns "
11635 "data in the output by merely grabbing a reference to the input."
11638 #. type: Plain text
11639 #: build/C/man2/tee.2:143
11641 "The example below implements a basic B<tee>(1) program using the B<tee>() "
11642 "system call. Here is an example of its use:"
11645 #. type: Plain text
11646 #: build/C/man2/tee.2:150
11649 "$ B<date |./a.out out.log | cat>\n"
11650 "Tue Oct 28 10:06:00 CET 2014\n"
11651 "$ B<cat out.log>\n"
11652 "Tue Oct 28 10:06:00 CET 2014\n"
11656 #: build/C/man2/tee.2:152
11658 msgid "Program source"
11661 #. type: Plain text
11662 #: build/C/man2/tee.2:162
11665 "#define _GNU_SOURCE\n"
11666 "#include E<lt>fcntl.hE<gt>\n"
11667 "#include E<lt>stdio.hE<gt>\n"
11668 "#include E<lt>stdlib.hE<gt>\n"
11669 "#include E<lt>unistd.hE<gt>\n"
11670 "#include E<lt>errno.hE<gt>\n"
11671 "#include E<lt>limits.hE<gt>\n"
11674 #. type: Plain text
11675 #: build/C/man2/tee.2:168
11679 "main(int argc, char *argv[])\n"
11682 " int len, slen;\n"
11685 #. type: Plain text
11686 #: build/C/man2/tee.2:173
11689 " if (argc != 2) {\n"
11690 " fprintf(stderr, \"Usage: %s E<lt>fileE<gt>\\en\", argv[0]);\n"
11691 " exit(EXIT_FAILURE);\n"
11695 #. type: Plain text
11696 #: build/C/man2/tee.2:179
11699 " fd = open(argv[1], O_WRONLY | O_CREAT | O_TRUNC, 0644);\n"
11700 " if (fd == -1) {\n"
11701 " perror(\"open\");\n"
11702 " exit(EXIT_FAILURE);\n"
11706 #. type: Plain text
11707 #: build/C/man2/tee.2:186
11712 " * tee stdin to stdout.\n"
11714 " len = tee(STDIN_FILENO, STDOUT_FILENO,\n"
11715 " INT_MAX, SPLICE_F_NONBLOCK);\n"
11718 #. type: Plain text
11719 #: build/C/man2/tee.2:195
11722 " if (len E<lt> 0) {\n"
11723 " if (errno == EAGAIN)\n"
11725 " perror(\"tee\");\n"
11726 " exit(EXIT_FAILURE);\n"
11732 #. type: Plain text
11733 #: build/C/man2/tee.2:209
11737 " * Consume stdin by splicing it to a file.\n"
11739 " while (len E<gt> 0) {\n"
11740 " slen = splice(STDIN_FILENO, NULL, fd, NULL,\n"
11741 " len, SPLICE_F_MOVE);\n"
11742 " if (slen E<lt> 0) {\n"
11743 " perror(\"splice\");\n"
11751 #. type: Plain text
11752 #: build/C/man2/tee.2:213
11756 " exit(EXIT_SUCCESS);\n"
11760 #. type: Plain text
11761 #: build/C/man2/tee.2:217
11762 msgid "B<splice>(2), B<vmsplice>(2)"
11766 #: build/C/man2/vm86.2:26
11772 #: build/C/man2/vm86.2:26
11777 #. type: Plain text
11778 #: build/C/man2/vm86.2:29
11779 msgid "vm86old, vm86 - enter virtual 8086 mode"
11782 #. type: Plain text
11783 #: build/C/man2/vm86.2:31
11784 msgid "B<#include E<lt>sys/vm86.hE<gt>>"
11787 #. type: Plain text
11788 #: build/C/man2/vm86.2:33
11789 msgid "B<int vm86old(struct vm86_struct *>I<info>B<);>"
11792 #. type: Plain text
11793 #: build/C/man2/vm86.2:35
11794 msgid "B<int vm86(unsigned long >I<fn>B<, struct vm86plus_struct *>I<v86>B<);>"
11797 #. type: Plain text
11798 #: build/C/man2/vm86.2:48
11800 "The system call B<vm86>() was introduced in Linux 0.97p2. In Linux 2.1.15 "
11801 "and 2.0.28, it was renamed to B<vm86old>(), and a new B<vm86>() was "
11802 "introduced. The definition of I<struct vm86_struct> was changed in 1.1.8 "
11806 #. type: Plain text
11807 #: build/C/man2/vm86.2:52
11809 "These calls cause the process to enter VM86 mode (virtual-8086 in Intel "
11810 "literature), and are used by B<dosemu>."
11813 #. type: Plain text
11814 #: build/C/man2/vm86.2:54
11815 msgid "VM86 mode is an emulation of real mode within a protected mode task."
11818 #. type: Plain text
11819 #: build/C/man2/vm86.2:64
11821 "This return value is specific to i386 and indicates a problem with getting "
11825 #. type: Plain text
11826 #: build/C/man2/vm86.2:68
11828 "This return value indicates the call is not implemented on the present "
11832 #. type: Plain text
11833 #: build/C/man2/vm86.2:73
11835 "Saved kernel stack exists. (This is a kernel sanity check; the saved stack "
11836 "should exist only within vm86 mode itself.)"
11839 #. type: Plain text
11840 #: build/C/man2/vm86.2:76
11842 "This call is specific to Linux on 32-bit Intel processors, and should not be "
11843 "used in programs intended to be portable."
11847 #: build/C/man2/vmsplice.2:26
11853 #: build/C/man2/vmsplice.2:26
11858 #. type: Plain text
11859 #: build/C/man2/vmsplice.2:29
11860 msgid "vmsplice - splice user pages into a pipe"
11863 #. type: Plain text
11864 #: build/C/man2/vmsplice.2:34
11867 "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n"
11868 "B<#include E<lt>fcntl.hE<gt>>\n"
11869 "B<#include E<lt>sys/uio.hE<gt>>\n"
11872 #. type: Plain text
11873 #: build/C/man2/vmsplice.2:37
11876 "B<ssize_t vmsplice(int >I<fd>B<, const struct iovec *>I<iov>B<,>\n"
11877 "B< unsigned long >I<nr_segs>B<, unsigned int "
11881 #. Linus: vmsplice() system call to basically do a "write to
11882 #. the buffer", but using the reference counting and VM traversal
11883 #. to actually fill the buffer. This means that the user needs to
11884 #. be careful not to reuse the user-space buffer it spliced into
11885 #. the kernel-space one (contrast this to "write()", which copies
11886 #. the actual data, and you can thus reuse the buffer immediately
11887 #. after a successful write), but that is often easy to do.
11888 #. type: Plain text
11889 #: build/C/man2/vmsplice.2:57
11891 "The B<vmsplice>() system call maps I<nr_segs> ranges of user memory "
11892 "described by I<iov> into a pipe. The file descriptor I<fd> must refer to a "
11896 #. type: Plain text
11897 #: build/C/man2/vmsplice.2:64
11899 "The pointer I<iov> points to an array of I<iovec> structures as defined in "
11900 "I<E<lt>sys/uio.hE<gt>>:"
11903 #. type: Plain text
11904 #: build/C/man2/vmsplice.2:71
11908 " void *iov_base; /* Starting address */\n"
11909 " size_t iov_len; /* Number of bytes */\n"
11913 #. type: Plain text
11914 #: build/C/man2/vmsplice.2:84
11915 msgid "Unused for B<vmsplice>(); see B<splice>(2)."
11918 #. type: Plain text
11919 #: build/C/man2/vmsplice.2:97
11921 "Currently has no effect for B<vmsplice>(), but may be implemented in the "
11922 "future; see B<splice>(2)."
11925 #. FIXME . Explain the following line in a little more detail:
11927 #. It looks like the page-alignment requirement went away with
11928 #. commit bd1a68b59c8e3bce45fb76632c64e1e063c3962d
11930 #. .... if we expect to later SPLICE_F_MOVE to the cache.
11931 #. type: Plain text
11932 #: build/C/man2/vmsplice.2:117
11934 "The user pages are a gift to the kernel. The application may not modify "
11935 "this memory ever, or page cache and on-disk data may differ. Gifting pages "
11936 "to the kernel means that a subsequent B<splice>(2) B<SPLICE_F_MOVE> can "
11937 "successfully move the pages; if this flag is not specified, then a "
11938 "subsequent B<splice>(2) B<SPLICE_F_MOVE> must copy the pages. Data must "
11939 "also be properly page aligned, both in memory and length."
11942 #. type: Plain text
11943 #: build/C/man2/vmsplice.2:126
11945 "Upon successful completion, B<vmsplice>() returns the number of bytes "
11946 "transferred to the pipe. On error, B<vmsplice>() returns -1 and I<errno> "
11947 "is set to indicate the error."
11950 #. type: Plain text
11951 #: build/C/man2/vmsplice.2:137
11952 msgid "I<fd> either not valid, or doesn't refer to a pipe."
11955 #. type: Plain text
11956 #: build/C/man2/vmsplice.2:145
11958 "I<nr_segs> is greater than B<IOV_MAX>; or memory not aligned if "
11959 "B<SPLICE_F_GIFT> set."
11962 #. type: Plain text
11963 #: build/C/man2/vmsplice.2:153
11965 "The B<vmsplice>() system call first appeared in Linux 2.6.17; library "
11966 "support was added to glibc in version 2.5."
11969 #. type: Plain text
11970 #: build/C/man2/vmsplice.2:164
11972 "B<vmsplice>() follows the other vectorized read/write type functions when "
11973 "it comes to limitations on number of segments being passed in. This limit "
11974 "is B<IOV_MAX> as defined in I<E<lt>limits.hE<gt>>. At the time of this "
11975 "writing, that limit is 1024."
11978 #. type: Plain text
11979 #: build/C/man2/vmsplice.2:167
11980 msgid "B<splice>(2), B<tee>(2)"