1 # SOME DESCRIPTIVE TITLE
2 # Copyright (C) YEAR Free Software Foundation, Inc.
3 # This file is distributed under the same license as the PACKAGE package.
4 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
9 "Project-Id-Version: PACKAGE VERSION\n"
10 "POT-Creation-Date: 2014-06-03 01:29+0900\n"
11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Language-Team: LANGUAGE <LL@li.org>\n"
16 "Content-Type: text/plain; charset=UTF-8\n"
17 "Content-Transfer-Encoding: 8bit\n"
20 #: build/C/man2/arch_prctl.2:25
26 #: build/C/man2/arch_prctl.2:25
32 #: build/C/man2/arch_prctl.2:25 build/C/man2/futex.2:53 build/C/man2/get_robust_list.2:29 build/C/man2/getunwind.2:27 build/C/man2/kexec_load.2:26 build/C/man2/lookup_dcookie.2:27 build/C/man2/modify_ldt.2:24 build/C/man2/nfsservctl.2:8 build/C/man2/outb.2:26 build/C/man2/pciconfig_read.2:8 build/C/man2/perf_event_open.2:27 build/C/man2/perfmonctl.2:27 build/C/man2/personality.2:32 build/C/man2/pivot_root.2:10 build/C/man2/process_vm_readv.2:29 build/C/man2/ptrace.2:44 build/C/man2/quotactl.2:27 build/C/man2/sendfile.2:19 build/C/man2/set_tid_address.2:25 build/C/man2/splice.2:26 build/C/man2/tee.2:26 build/C/man2/vm86.2:26 build/C/man2/vmsplice.2:26
38 #: build/C/man2/arch_prctl.2:25 build/C/man2/futex.2:53 build/C/man2/getunwind.2:27 build/C/man2/kexec_load.2:26 build/C/man2/lookup_dcookie.2:27 build/C/man2/modify_ldt.2:24 build/C/man2/nfsservctl.2:8 build/C/man2/outb.2:26 build/C/man2/pciconfig_read.2:8 build/C/man2/perf_event_open.2:27 build/C/man2/perfmonctl.2:27 build/C/man2/personality.2:32 build/C/man2/pivot_root.2:10 build/C/man2/process_vm_readv.2:29 build/C/man2/ptrace.2:44 build/C/man2/quotactl.2:27 build/C/man2/sendfile.2:19 build/C/man2/set_tid_address.2:25 build/C/man2/splice.2:26 build/C/man2/tee.2:26 build/C/man2/vm86.2:26 build/C/man2/vmsplice.2:26
40 msgid "Linux Programmer's Manual"
44 #: build/C/man2/arch_prctl.2:26 build/C/man2/futex.2:54 build/C/man2/get_robust_list.2:30 build/C/man2/getunwind.2:28 build/C/man2/kexec_load.2:27 build/C/man2/lookup_dcookie.2:28 build/C/man2/modify_ldt.2:25 build/C/man2/nfsservctl.2:9 build/C/man2/outb.2:27 build/C/man2/pciconfig_read.2:9 build/C/man2/perf_event_open.2:28 build/C/man2/perfmonctl.2:28 build/C/man2/personality.2:33 build/C/man2/pivot_root.2:11 build/C/man2/process_vm_readv.2:30 build/C/man2/ptrace.2:45 build/C/man2/quotactl.2:28 build/C/man2/sendfile.2:20 build/C/man2/set_tid_address.2:26 build/C/man2/splice.2:27 build/C/man2/tee.2:27 build/C/man2/vm86.2:27 build/C/man2/vmsplice.2:27
50 #: build/C/man2/arch_prctl.2:28
51 msgid "arch_prctl - set architecture-specific thread state"
55 #: build/C/man2/arch_prctl.2:28 build/C/man2/futex.2:56 build/C/man2/get_robust_list.2:32 build/C/man2/getunwind.2:30 build/C/man2/kexec_load.2:29 build/C/man2/lookup_dcookie.2:30 build/C/man2/modify_ldt.2:27 build/C/man2/nfsservctl.2:11 build/C/man2/outb.2:31 build/C/man2/pciconfig_read.2:11 build/C/man2/perf_event_open.2:30 build/C/man2/perfmonctl.2:30 build/C/man2/personality.2:35 build/C/man2/pivot_root.2:13 build/C/man2/process_vm_readv.2:32 build/C/man2/ptrace.2:47 build/C/man2/quotactl.2:30 build/C/man2/sendfile.2:22 build/C/man2/set_tid_address.2:28 build/C/man2/splice.2:29 build/C/man2/tee.2:29 build/C/man2/vm86.2:29 build/C/man2/vmsplice.2:29
61 #: build/C/man2/arch_prctl.2:31
63 msgid "B<#include E<lt>asm/prctl.hE<gt>>\n"
67 #: build/C/man2/arch_prctl.2:33
69 msgid "B<#include E<lt>sys/prctl.hE<gt>>\n"
73 #: build/C/man2/arch_prctl.2:36
76 "B<int arch_prctl(int >I<code>B<, unsigned long >I<addr>B<);>\n"
77 "B<int arch_prctl(int >I<code>B<, unsigned long *>I<addr>B<);>\n"
80 #. Return type was long before glibc 2.7
82 #: build/C/man2/arch_prctl.2:37 build/C/man2/futex.2:70 build/C/man2/get_robust_list.2:45 build/C/man2/getunwind.2:40 build/C/man2/kexec_load.2:39 build/C/man2/lookup_dcookie.2:32 build/C/man2/modify_ldt.2:36 build/C/man2/nfsservctl.2:18 build/C/man2/outb.2:62 build/C/man2/pciconfig_read.2:22 build/C/man2/perf_event_open.2:42 build/C/man2/perfmonctl.2:39 build/C/man2/personality.2:39 build/C/man2/pivot_root.2:18 build/C/man2/process_vm_readv.2:66 build/C/man2/ptrace.2:54 build/C/man2/quotactl.2:38 build/C/man2/sendfile.2:47 build/C/man2/set_tid_address.2:34 build/C/man2/splice.2:39 build/C/man2/tee.2:38 build/C/man2/vm86.2:35 build/C/man2/vmsplice.2:39
88 #: build/C/man2/arch_prctl.2:52
90 "The B<arch_prctl>() function sets architecture-specific process or thread "
91 "state. I<code> selects a subfunction and passes argument I<addr> to it; "
92 "I<addr> is interpreted as either an I<unsigned long> for the \"set\" "
93 "operations, or as an I<unsigned long\\ *>, for the \"get\" operations."
97 #: build/C/man2/arch_prctl.2:54
98 msgid "Subfunctions for x86-64 are:"
102 #: build/C/man2/arch_prctl.2:54
104 msgid "B<ARCH_SET_FS>"
108 #: build/C/man2/arch_prctl.2:60
109 msgid "Set the 64-bit base for the I<FS> register to I<addr>."
113 #: build/C/man2/arch_prctl.2:60
115 msgid "B<ARCH_GET_FS>"
119 #: build/C/man2/arch_prctl.2:68
121 "Return the 64-bit base value for the I<FS> register of the current thread in "
122 "the I<unsigned long> pointed to by I<addr>."
126 #: build/C/man2/arch_prctl.2:68
128 msgid "B<ARCH_SET_GS>"
132 #: build/C/man2/arch_prctl.2:74
133 msgid "Set the 64-bit base for the I<GS> register to I<addr>."
137 #: build/C/man2/arch_prctl.2:74
139 msgid "B<ARCH_GET_GS>"
143 #: build/C/man2/arch_prctl.2:82
145 "Return the 64-bit base value for the I<GS> register of the current thread in "
146 "the I<unsigned long> pointed to by I<addr>."
150 #: build/C/man2/arch_prctl.2:82 build/C/man2/futex.2:216 build/C/man2/get_robust_list.2:78 build/C/man2/getunwind.2:81 build/C/man2/kexec_load.2:114 build/C/man2/lookup_dcookie.2:43 build/C/man2/modify_ldt.2:98 build/C/man2/nfsservctl.2:53 build/C/man2/pciconfig_read.2:50 build/C/man2/perf_event_open.2:2371 build/C/man2/perfmonctl.2:190 build/C/man2/personality.2:62 build/C/man2/pivot_root.2:101 build/C/man2/process_vm_readv.2:225 build/C/man2/ptrace.2:1853 build/C/man2/quotactl.2:419 build/C/man2/sendfile.2:108 build/C/man2/set_tid_address.2:88 build/C/man2/splice.2:127 build/C/man2/tee.2:85 build/C/man2/vm86.2:54 build/C/man2/vmsplice.2:113
156 #: build/C/man2/arch_prctl.2:88
158 "On success, B<arch_prctl>() returns 0; on error, -1 is returned, and "
159 "I<errno> is set to indicate the error."
163 #: build/C/man2/arch_prctl.2:88 build/C/man2/futex.2:241 build/C/man2/get_robust_list.2:85 build/C/man2/getunwind.2:88 build/C/man2/kexec_load.2:121 build/C/man2/lookup_dcookie.2:50 build/C/man2/modify_ldt.2:108 build/C/man2/pciconfig_read.2:77 build/C/man2/perf_event_open.2:2377 build/C/man2/personality.2:69 build/C/man2/pivot_root.2:105 build/C/man2/process_vm_readv.2:245 build/C/man2/ptrace.2:1868 build/C/man2/quotactl.2:427 build/C/man2/sendfile.2:115 build/C/man2/set_tid_address.2:91 build/C/man2/splice.2:142 build/C/man2/tee.2:100 build/C/man2/vm86.2:59 build/C/man2/vmsplice.2:122
169 #: build/C/man2/arch_prctl.2:89 build/C/man2/futex.2: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:2423 build/C/man2/process_vm_readv.2:267 build/C/man2/process_vm_readv.2:272 build/C/man2/ptrace.2:1872 build/C/man2/quotactl.2:428 build/C/man2/sendfile.2:125 build/C/man2/vm86.2:60
175 #: build/C/man2/arch_prctl.2:93
177 "I<addr> points to an unmapped address or is outside the process address "
182 #: build/C/man2/arch_prctl.2:93 build/C/man2/futex.2:268 build/C/man2/get_robust_list.2:89 build/C/man2/kexec_load.2:126 build/C/man2/lookup_dcookie.2:54 build/C/man2/modify_ldt.2:113 build/C/man2/pciconfig_read.2:78 build/C/man2/perf_event_open.2:2428 build/C/man2/personality.2:70 build/C/man2/pivot_root.2:114 build/C/man2/process_vm_readv.2:246 build/C/man2/process_vm_readv.2:257 build/C/man2/process_vm_readv.2:261 build/C/man2/ptrace.2:1883 build/C/man2/quotactl.2:434 build/C/man2/quotactl.2:501 build/C/man2/sendfile.2:128 build/C/man2/splice.2:147 build/C/man2/tee.2:101 build/C/man2/vmsplice.2:127
188 #: build/C/man2/arch_prctl.2:97
189 msgid "I<code> is not a valid subcommand."
193 #: build/C/man2/arch_prctl.2:97 build/C/man2/get_robust_list.2:99 build/C/man2/kexec_load.2:133 build/C/man2/lookup_dcookie.2:65 build/C/man2/pciconfig_read.2:105 build/C/man2/perf_event_open.2:2495 build/C/man2/pivot_root.2:120 build/C/man2/process_vm_readv.2:283 build/C/man2/ptrace.2:1893 build/C/man2/quotactl.2:456 build/C/man2/vm86.2:68
199 #. Man page written by Andi Kleen.
201 #: build/C/man2/arch_prctl.2:103
202 msgid "I<addr> is outside the process address space."
206 #: build/C/man2/arch_prctl.2:103 build/C/man2/futex.2:303 build/C/man2/getunwind.2:96 build/C/man2/kexec_load.2:142 build/C/man2/lookup_dcookie.2:78 build/C/man2/modify_ldt.2:130 build/C/man2/nfsservctl.2:58 build/C/man2/outb.2:87 build/C/man2/pciconfig_read.2:112 build/C/man2/perf_event_open.2:2516 build/C/man2/perfmonctl.2:199 build/C/man2/personality.2:73 build/C/man2/pivot_root.2:128 build/C/man2/process_vm_readv.2:295 build/C/man2/ptrace.2:1911 build/C/man2/sendfile.2:148 build/C/man2/set_tid_address.2:97 build/C/man2/splice.2:170 build/C/man2/tee.2:119 build/C/man2/vm86.2:73 build/C/man2/vmsplice.2:143
208 msgid "CONFORMING TO"
212 #: build/C/man2/arch_prctl.2:107
214 "B<arch_prctl>() is a Linux/x86-64 extension and should not be used in "
215 "programs intended to be portable."
219 #: build/C/man2/arch_prctl.2:107 build/C/man2/futex.2:305 build/C/man2/get_robust_list.2:120 build/C/man2/getunwind.2:99 build/C/man2/kexec_load.2:144 build/C/man2/lookup_dcookie.2:81 build/C/man2/modify_ldt.2:133 build/C/man2/perf_event_open.2:2521 build/C/man2/perfmonctl.2:202 build/C/man2/pivot_root.2:131 build/C/man2/process_vm_readv.2:297 build/C/man2/ptrace.2:1913 build/C/man2/sendfile.2:155 build/C/man2/splice.2:172 build/C/man2/tee.2:121 build/C/man2/vmsplice.2:145
225 #: build/C/man2/arch_prctl.2:110
227 "B<arch_prctl>() is supported only on Linux/x86-64 for 64-bit programs "
232 #: build/C/man2/arch_prctl.2:112
233 msgid "The 64-bit base changes when a new 32-bit segment selector is loaded."
237 #: build/C/man2/arch_prctl.2:115
238 msgid "B<ARCH_SET_GS> is disabled in some kernels."
242 #: build/C/man2/arch_prctl.2:130
244 "Context switches for 64-bit segment bases are rather expensive. It may be a "
245 "faster alternative to set a 32-bit base using a segment selector by setting "
246 "up an LDT with B<modify_ldt>(2) or using the B<set_thread_area>(2) system "
247 "call in kernel 2.5 or later. B<arch_prctl>() is needed only when you want "
248 "to set bases that are larger than 4GB. Memory in the first 2GB of address "
249 "space can be allocated by using B<mmap>(2) with the B<MAP_32BIT> flag."
253 #: build/C/man2/arch_prctl.2:135
255 "As of version 2.7, glibc provides no prototype for B<arch_prctl>(). You "
256 "have to declare it yourself for now. This may be fixed in future glibc "
261 #: build/C/man2/arch_prctl.2:138
262 msgid "I<FS> may be already used by the threading library."
266 #: build/C/man2/arch_prctl.2:138 build/C/man2/futex.2:319 build/C/man2/get_robust_list.2:129 build/C/man2/getunwind.2:111 build/C/man2/kexec_load.2:159 build/C/man2/modify_ldt.2:136 build/C/man2/outb.2:96 build/C/man2/pciconfig_read.2:114 build/C/man2/perf_event_open.2:2652 build/C/man2/perfmonctl.2:205 build/C/man2/pivot_root.2:143 build/C/man2/process_vm_readv.2:347 build/C/man2/ptrace.2:2079 build/C/man2/quotactl.2:507 build/C/man2/sendfile.2:197 build/C/man2/set_tid_address.2:99 build/C/man2/splice.2:226 build/C/man2/tee.2:197 build/C/man2/vmsplice.2:154
272 #: build/C/man2/arch_prctl.2:143
273 msgid "B<mmap>(2), B<modify_ldt>(2), B<prctl>(2), B<set_thread_area>(2)"
277 #: build/C/man2/arch_prctl.2:145
278 msgid "AMD X86-64 Programmer's manual"
282 #: build/C/man2/arch_prctl.2:145 build/C/man2/futex.2:333 build/C/man2/get_robust_list.2:138 build/C/man2/getunwind.2:113 build/C/man2/kexec_load.2:162 build/C/man2/lookup_dcookie.2:88 build/C/man2/modify_ldt.2:138 build/C/man2/nfsservctl.2:60 build/C/man2/outb.2:99 build/C/man2/pciconfig_read.2:116 build/C/man2/perf_event_open.2:2658 build/C/man2/perfmonctl.2:209 build/C/man2/personality.2:77 build/C/man2/pivot_root.2:149 build/C/man2/process_vm_readv.2:350 build/C/man2/ptrace.2:2093 build/C/man2/quotactl.2:512 build/C/man2/sendfile.2:203 build/C/man2/set_tid_address.2:102 build/C/man2/splice.2:230 build/C/man2/tee.2:200 build/C/man2/vm86.2:76 build/C/man2/vmsplice.2:157
288 #: build/C/man2/arch_prctl.2:153 build/C/man2/futex.2:341 build/C/man2/get_robust_list.2:146 build/C/man2/getunwind.2:121 build/C/man2/kexec_load.2:170 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:2666 build/C/man2/perfmonctl.2:217 build/C/man2/personality.2:85 build/C/man2/pivot_root.2:157 build/C/man2/process_vm_readv.2:358 build/C/man2/ptrace.2:2101 build/C/man2/quotactl.2:520 build/C/man2/sendfile.2:211 build/C/man2/set_tid_address.2:110 build/C/man2/splice.2:238 build/C/man2/tee.2:208 build/C/man2/vm86.2:84 build/C/man2/vmsplice.2:165
290 "This page is part of release 3.67 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/kexec_load.2:39 build/C/man2/modify_ldt.2:36 build/C/man2/perf_event_open.2:42 build/C/man2/perfmonctl.2:39 build/C/man2/pivot_root.2:18
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:2399 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
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:2481 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:138 build/C/man2/lookup_dcookie.2:73 build/C/man2/perfmonctl.2:196 build/C/man2/pivot_root.2:125 build/C/man2/process_vm_readv.2:292 build/C/man2/sendfile.2:142 build/C/man2/set_tid_address.2:94 build/C/man2/splice.2:165 build/C/man2/tee.2:114 build/C/man2/vmsplice.2:138
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/kexec_load.2:144 build/C/man2/set_tid_address.2:99 build/C/man2/splice.2:172 build/C/man2/tee.2:121 build/C/man2/vmsplice.2:145
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
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
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:2508 build/C/man2/process_vm_readv.2:287 build/C/man2/ptrace.2:1906 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:120
827 "These system calls were added in Linux 2.6.17. No library support is "
828 "provided; use B<syscall>(2)."
832 #: build/C/man2/get_robust_list.2:125
834 "These system calls are not needed by normal applications. No support for "
835 "them is provided in glibc. In the unlikely event that you want to call them "
836 "directly, use B<syscall>(2)."
840 #: build/C/man2/get_robust_list.2:129
842 "A thread can have only one robust futex list; therefore applications that "
843 "wish to use this functionality should use the robust mutexes provided by "
847 #. .BR pthread_mutexattr_setrobust_np (3)
849 #: build/C/man2/get_robust_list.2:132
853 #. http://lwn.net/Articles/172149/
855 #: build/C/man2/get_robust_list.2:138
857 "I<Documentation/robust-futexes.txt> and "
858 "I<Documentation/robust-futex-ABI.txt> in the Linux kernel source tree"
862 #: build/C/man2/getunwind.2:27
868 #: build/C/man2/getunwind.2:27 build/C/man2/perfmonctl.2:27
874 #: build/C/man2/getunwind.2:30
875 msgid "getunwind - copy the unwind data to caller's buffer"
879 #: build/C/man2/getunwind.2:34
882 "B<#include E<lt>syscall.hE<gt>>\n"
883 "B<#include E<lt>linux/unwind.hE<gt>>\n"
887 #: build/C/man2/getunwind.2:36
889 msgid "B<long getunwind(void >I<*buf>B<, size_t >I<buf_size>B<);>\n"
893 #: build/C/man2/getunwind.2:42
894 msgid "I<Note: this function is obsolete.>"
898 #: build/C/man2/getunwind.2:52
900 "The IA-64-specific B<getunwind>() system call copies the kernel's call "
901 "frame unwind data into the buffer pointed to by I<buf> and returns the size "
902 "of the unwind data; this data describes the gate page (kernel code that is "
903 "mapped into user space)."
907 #: build/C/man2/getunwind.2:64
909 "The size of the buffer I<buf> is specified in I<buf_size>. The data is "
910 "copied only if I<buf_size> is greater than or equal to the size of the "
911 "unwind data and I<buf> is not NULL; otherwise, no data is copied, and the "
912 "call succeeds, returning the size that would be needed to store the unwind "
917 #: build/C/man2/getunwind.2:68
919 "The first part of the unwind data contains an unwind table. The rest "
920 "contains the associated unwind information, in no particular order. The "
921 "unwind table contains entries of the following form:"
925 #: build/C/man2/getunwind.2:73
928 " u64 start; (64-bit address of start of function)\n"
929 " u64 end; (64-bit address of end of function)\n"
930 " u64 info; (BUF-relative offset to unwind info)\n"
934 #: build/C/man2/getunwind.2:81
936 "An entry whose I<start> value is zero indicates the end of the table. For "
937 "more information about the format, see the I<IA-64 Software Conventions and "
938 "Runtime Architecture> manual."
942 #: build/C/man2/getunwind.2:88
944 "On success, B<getunwind>() returns the size of unwind table. On error, -1 "
945 "is returned and I<errno> is set to indicate the error."
949 #: build/C/man2/getunwind.2:94
951 "B<getunwind>() fails with the error B<EFAULT> if the unwind info can't be "
952 "stored in the space specified by I<buf>."
956 #: build/C/man2/getunwind.2:96
957 msgid "This system call is available since Linux 2.4."
961 #: build/C/man2/getunwind.2:99
963 "This system call is Linux-specific, and is available only on the IA-64 "
968 #: build/C/man2/getunwind.2:107
970 "This system call has been deprecated. The modern way to obtain the kernel's "
971 "unwind data is via the gate DSO. The address of the ELF header for this DSO "
972 "is passed to user level via B<AT_SYSINFO_EHDR> (see B<getauxval>(3))."
976 #: build/C/man2/getunwind.2:111
978 "Glibc does not provide a wrapper for this system call; in the unlikely event "
979 "that you want to call it, use B<syscall>(2)."
983 #: build/C/man2/getunwind.2:113
984 msgid "B<getauxval>(3)"
988 #: build/C/man2/kexec_load.2:26
994 #: build/C/man2/kexec_load.2:26 build/C/man2/modify_ldt.2:24 build/C/man2/pivot_root.2:10
1000 #: build/C/man2/kexec_load.2:29
1001 msgid "kexec_load - load a new kernel for later execution"
1005 #: build/C/man2/kexec_load.2:31
1006 msgid "B<#include E<lt>linux/kexec.hE<gt>>"
1010 #: build/C/man2/kexec_load.2:33
1012 "B<long kexec_load(unsigned long >I<entry>B<, unsigned long "
1013 ">I<nr_segments>B<,>"
1017 #: build/C/man2/kexec_load.2:36
1018 msgid "B< struct kexec_segment *>I<segments>B<, unsigned long >I<flags>B<);>"
1022 #: build/C/man2/kexec_load.2:44
1024 "The B<kexec_load>() system call loads a new kernel that can be executed "
1025 "later by B<reboot>(2)."
1029 #: build/C/man2/kexec_load.2:50
1031 "The I<flags> argument is a mask whose high-order bits control the operation "
1032 "of the call. The following values can be specified in I<flags>:"
1036 #: build/C/man2/kexec_load.2:50
1038 msgid "B<KEXEC_ON_CRASH> (since Linux 2.6.13)"
1041 #. FIXME figure out how this is really used
1043 #: build/C/man2/kexec_load.2:54
1044 msgid "Execute the new kernel automatically on a system crash."
1048 #: build/C/man2/kexec_load.2:54
1050 msgid "B<KEXEC_PRESERVE_CONTEXT> (since Linux 2.6.27)"
1054 #: build/C/man2/kexec_load.2:64
1056 "Preserve the system hardware and software states before executing the new "
1057 "kernel. This could be used for system suspend. This flag is available only "
1058 "if the kernel was configured with B<CONFIG_KEXEC_JUMP>, and is effective "
1059 "only if I<nr_segments> is greater than 0."
1063 #: build/C/man2/kexec_load.2:84
1065 "The low-order bits of I<flags> contain the architecture of the "
1066 "to-be-executed kernel. Specify (OR) the constant B<KEXEC_ARCH_DEFAULT> to "
1067 "use the current architecture, or one of the following architecture constants "
1068 "B<KEXEC_ARCH_386>, B<KEXEC_ARCH_X86_64>, B<KEXEC_ARCH_PPC>, "
1069 "B<KEXEC_ARCH_PPC64>, B<KEXEC_ARCH_IA_64>, B<KEXEC_ARCH_ARM>, "
1070 "B<KEXEC_ARCH_S390>, B<KEXEC_ARCH_SH>, B<KEXEC_ARCH_MIPS>, and "
1071 "B<KEXEC_ARCH_MIPS_LE>. The architecture must be executable on the CPU of "
1076 #: build/C/man2/kexec_load.2:98
1078 "The I<entry> argument is the physical entry address in the kernel image. "
1079 "The I<nr_segments> argument is the number of segments pointed to by the "
1080 "I<segments> pointer. The I<segments> argument is an array of "
1081 "I<kexec_segment> structures which define the kernel layout:"
1085 #: build/C/man2/kexec_load.2:107
1088 "struct kexec_segment {\n"
1089 " void *buf; /* Buffer in user space */\n"
1090 " size_t bufsz; /* Buffer length in user space */\n"
1091 " void *mem; /* Physical address of kernel */\n"
1092 " size_t memsz; /* Physical address length */\n"
1096 #. FIXME elaborate on the following:
1098 #: build/C/man2/kexec_load.2:114
1100 "The kernel image defined by I<segments> is copied from the calling process "
1101 "into previously reserved memory."
1105 #: build/C/man2/kexec_load.2:121
1107 "On success, B<kexec_load>() returns 0. On error, -1 is returned and "
1108 "I<errno> is set to indicate the error."
1112 #: build/C/man2/kexec_load.2:122 build/C/man2/pivot_root.2:110 build/C/man2/ptrace.2:1869 build/C/man2/quotactl.2:495
1118 #: build/C/man2/kexec_load.2:126
1120 "Another crash kernel is already being loaded or a crash kernel is already in "
1124 #. KEXEC_SEGMENT_MAX == 16
1126 #: build/C/man2/kexec_load.2:133
1127 msgid "I<flags> is invalid; or I<nr_segments> is too large"
1131 #: build/C/man2/kexec_load.2:138
1132 msgid "The caller does not have the B<CAP_SYS_BOOT> capability."
1136 #: build/C/man2/kexec_load.2:142
1137 msgid "The B<kexec_load>() system call first appeared in Linux 2.6.13."
1141 #: build/C/man2/kexec_load.2:149
1143 "Currently, there is no glibc support for B<kexec_load>(). Call it using "
1147 #. FIXME Andi submitted a patch for this.
1148 #. Check if it got accepted later.
1150 #: build/C/man2/kexec_load.2:156
1152 "The required constants are in the Linux kernel source file I<linux/kexec.h>, "
1153 "which is not currently exported to glibc. Therefore, these constants must "
1154 "be defined manually."
1158 #: build/C/man2/kexec_load.2:159
1160 "This system call is available only if the kernel was configured with "
1165 #: build/C/man2/kexec_load.2:162
1166 msgid "B<reboot>(2), B<syscall>(2)"
1170 #: build/C/man2/lookup_dcookie.2:27
1172 msgid "LOOKUP_DCOOKIE"
1176 #: build/C/man2/lookup_dcookie.2:27
1182 #: build/C/man2/lookup_dcookie.2:30
1183 msgid "lookup_dcookie - return a directory entry's path"
1187 #: build/C/man2/lookup_dcookie.2:32
1189 "B<int lookup_dcookie(u64 >I<cookie>B<, char *>I<buffer>B<, size_t "
1194 #: build/C/man2/lookup_dcookie.2:38
1196 "Look up the full path of the directory entry specified by the value "
1197 "I<cookie>. The cookie is an opaque identifier uniquely identifying a "
1198 "particular directory entry. The buffer given is filled in with the full "
1199 "path of the directory entry."
1203 #: build/C/man2/lookup_dcookie.2:43
1205 "For B<lookup_dcookie>() to return successfully, the kernel must still hold "
1206 "a cookie reference to the directory entry."
1210 #: build/C/man2/lookup_dcookie.2:50
1212 "On success, B<lookup_dcookie>() returns the length of the path string "
1213 "copied into the buffer. On error, -1 is returned, and I<errno> is set "
1218 #: build/C/man2/lookup_dcookie.2:54
1219 msgid "The buffer was not valid."
1223 #: build/C/man2/lookup_dcookie.2:58
1225 "The kernel has no registered cookie/directory entry mappings at the time of "
1226 "lookup, or the cookie does not refer to a valid directory entry."
1230 #: build/C/man2/lookup_dcookie.2:58
1232 msgid "B<ENAMETOOLONG>"
1236 #: build/C/man2/lookup_dcookie.2:61
1237 msgid "The name could not fit in the buffer."
1241 #: 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:155 build/C/man2/tee.2:111 build/C/man2/vmsplice.2:135
1247 #: build/C/man2/lookup_dcookie.2:65
1249 "The kernel could not allocate memory for the temporary buffer holding the "
1254 #: build/C/man2/lookup_dcookie.2:70
1256 "The process does not have the capability B<CAP_SYS_ADMIN> required to look "
1261 #: build/C/man2/lookup_dcookie.2:70 build/C/man2/quotactl.2:474
1267 #: build/C/man2/lookup_dcookie.2:73
1268 msgid "The buffer was not large enough to hold the path of the directory entry."
1272 #: build/C/man2/lookup_dcookie.2:78
1274 "Available since Linux 2.5.43. The B<ENAMETOOLONG> error return was added in "
1279 #: build/C/man2/lookup_dcookie.2:81
1280 msgid "B<lookup_dcookie>() is Linux-specific."
1284 #: build/C/man2/lookup_dcookie.2:85
1286 "B<lookup_dcookie>() is a special-purpose system call, currently used only "
1287 "by the oprofile profiler. It relies on a kernel driver to register cookies "
1288 "for directory entries."
1292 #: build/C/man2/lookup_dcookie.2:88
1294 "The path returned may be suffixed by the string \" (deleted)\" if the "
1295 "directory entry has been removed."
1299 #: build/C/man2/modify_ldt.2:24
1305 #: build/C/man2/modify_ldt.2:27
1306 msgid "modify_ldt - get or set ldt"
1310 #: build/C/man2/modify_ldt.2:30
1312 msgid "B<#include E<lt>sys/types.hE<gt>>\n"
1316 #: build/C/man2/modify_ldt.2:32
1319 "B<int modify_ldt(int >I<func>B<, void *>I<ptr>B<, unsigned long "
1320 ">I<bytecount>B<);>\n"
1324 #: build/C/man2/modify_ldt.2:41
1326 "B<modify_ldt>() reads or writes the local descriptor table (ldt) for a "
1327 "process. The ldt is a per-process memory management table used by the i386 "
1328 "processor. For more information on this table, see an Intel 386 processor "
1333 #: build/C/man2/modify_ldt.2:51
1335 "When I<func> is 0, B<modify_ldt>() reads the ldt into the memory pointed to "
1336 "by I<ptr>. The number of bytes read is the smaller of I<bytecount> and the "
1337 "actual size of the ldt."
1341 #. FIXME ? say something about func == 2 and func == 0x11?
1342 #. In Linux 2.4, func == 2 returned "the default ldt"
1343 #. In Linux 2.6, func == 2 is a nop, returning a zeroed out structure.
1344 #. Linux 2.4 and 2.6 implement an operation for func == 0x11
1346 #: build/C/man2/modify_ldt.2:69
1348 "When I<func> is 1, B<modify_ldt>() modifies one ldt entry. I<ptr> points "
1349 "to a I<user_desc> structure and I<bytecount> must equal the size of this "
1354 #: build/C/man2/modify_ldt.2:73
1355 msgid "The I<user_desc> structure is defined in I<E<lt>asm/ldt.hE<gt>> as:"
1359 #: build/C/man2/modify_ldt.2:87
1362 "struct user_desc {\n"
1363 " unsigned int entry_number;\n"
1364 " unsigned long base_addr;\n"
1365 " unsigned int limit;\n"
1366 " unsigned int seg_32bit:1;\n"
1367 " unsigned int contents:2;\n"
1368 " unsigned int read_exec_only:1;\n"
1369 " unsigned int limit_in_pages:1;\n"
1370 " unsigned int seg_not_present:1;\n"
1371 " unsigned int useable:1;\n"
1376 #. The ldt is specific for the calling process. Any attempts to change
1377 #. the ldt to include the address space of another process or the kernel
1378 #. will result in a segmentation violation when trying to access the memory
1379 #. outside of the process address space. The memory protection is enforced
1380 #. at the paging layer.
1382 #: build/C/man2/modify_ldt.2:98
1383 msgid "In Linux 2.4 and earlier, this structure was named I<modify_ldt_ldt_s>."
1387 #: build/C/man2/modify_ldt.2:108
1389 "On success, B<modify_ldt>() returns either the actual number of bytes read "
1390 "(for reading) or 0 (for writing). On failure, B<modify_ldt>() returns -1 "
1391 "and sets I<errno> to indicate the error."
1395 #: build/C/man2/modify_ldt.2:113
1396 msgid "I<ptr> points outside the address space."
1400 #: build/C/man2/modify_ldt.2:126
1402 "I<ptr> is 0, or I<func> is 1 and I<bytecount> is not equal to the size of "
1403 "the structure I<modify_ldt_ldt_s>, or I<func> is 1 and the new ldt entry has "
1408 #: build/C/man2/modify_ldt.2:130
1409 msgid "I<func> is neither 0 nor 1."
1413 #: build/C/man2/modify_ldt.2:133
1415 "This call is Linux-specific and should not be used in programs intended to "
1420 #: build/C/man2/modify_ldt.2:136 build/C/man2/perfmonctl.2:205 build/C/man2/pivot_root.2:134
1422 "Glibc does not provide a wrapper for this system call; call it using "
1427 #: build/C/man2/modify_ldt.2:138
1432 #: build/C/man2/nfsservctl.2:8
1438 #: build/C/man2/nfsservctl.2:8
1444 #: build/C/man2/nfsservctl.2:11
1445 msgid "nfsservctl - syscall interface to kernel nfs daemon"
1449 #: build/C/man2/nfsservctl.2:14
1451 msgid "B<#include E<lt>linux/nfsd/syscall.hE<gt>>\n"
1455 #: build/C/man2/nfsservctl.2:17
1458 "B<long nfsservctl(int >I<cmd>B<, struct nfsctl_arg *>I<argp>B<,>\n"
1459 "B< union nfsctl_res *>I<resp>B<);>\n"
1463 #: build/C/man2/nfsservctl.2:21
1464 msgid "I<Note>: Since Linux 3.1, this system call no longer exists."
1468 #: build/C/man2/nfsservctl.2:35
1472 " * These are the commands understood by nfsctl().\n"
1474 "#define NFSCTL_SVC 0 /* This is a server process. */\n"
1475 "#define NFSCTL_ADDCLIENT 1 /* Add an NFS client. */\n"
1476 "#define NFSCTL_DELCLIENT 2 /* Remove an NFS client. */\n"
1477 "#define NFSCTL_EXPORT 3 /* Export a filesystem. */\n"
1478 "#define NFSCTL_UNEXPORT 4 /* Unexport a filesystem. */\n"
1479 "#define NFSCTL_UGIDUPDATE 5 /* Update a client's UID/GID map\n"
1480 " (only in Linux 2.4.x and earlier). */\n"
1481 "#define NFSCTL_GETFH 6 /* Get a file handle (used by mountd)\n"
1482 " (only in Linux 2.4.x and earlier). */\n"
1486 #: build/C/man2/nfsservctl.2:47
1489 "struct nfsctl_arg {\n"
1490 " int ca_version; /* safeguard */\n"
1492 " struct nfsctl_svc u_svc;\n"
1493 " struct nfsctl_client u_client;\n"
1494 " struct nfsctl_export u_export;\n"
1495 " struct nfsctl_uidmap u_umap;\n"
1496 " struct nfsctl_fhparm u_getfh;\n"
1497 " unsigned int u_debug;\n"
1503 #: build/C/man2/nfsservctl.2:52
1506 "union nfsctl_res {\n"
1507 " struct knfs_fh cr_getfh;\n"
1508 " unsigned int cr_debug;\n"
1513 #: build/C/man2/nfsservctl.2:58 build/C/man2/pivot_root.2:105 build/C/man2/vm86.2:59
1515 "On success, zero is returned. On error, -1 is returned, and I<errno> is set "
1520 #: build/C/man2/nfsservctl.2:60
1521 msgid "This call is Linux-specific."
1525 #: build/C/man2/outb.2:26
1531 #: build/C/man2/outb.2:26
1537 #: build/C/man2/outb.2:31
1539 "outb, outw, outl, outsb, outsw, outsl, inb, inw, inl, insb, insw, insl, "
1540 "outb_p, outw_p, outl_p, inb_p, inw_p, inl_p - port I/O"
1544 #: build/C/man2/outb.2:34
1546 msgid "B<#include E<lt>sys/io.hE<gt>>\n"
1550 #: build/C/man2/outb.2:41
1553 "B<unsigned char inb(unsigned short int >I<port>B<);>\n"
1554 "B<unsigned char inb_p(unsigned short int >I<port>B<);>\n"
1555 "B<unsigned short int inw(unsigned short int >I<port>B<);>\n"
1556 "B<unsigned short int inw_p(unsigned short int >I<port>B<);>\n"
1557 "B<unsigned int inl(unsigned short int >I<port>B<);>\n"
1558 "B<unsigned int inl_p(unsigned short int >I<port>B<);>\n"
1562 #: build/C/man2/outb.2:48
1565 "B<void outb(unsigned char >I<value>B<, unsigned short int >I<port>B<);>\n"
1566 "B<void outb_p(unsigned char >I<value>B<, unsigned short int >I<port>B<);>\n"
1567 "B<void outw(unsigned short int >I<value>B<, unsigned short int "
1569 "B<void outw_p(unsigned short int >I<value>B<, unsigned short int "
1571 "B<void outl(unsigned int >I<value>B<, unsigned short int >I<port>B<);>\n"
1572 "B<void outl_p(unsigned int >I<value>B<, unsigned short int >I<port>B<);>\n"
1576 #: build/C/man2/outb.2:61
1579 "B<void insb(unsigned short int >I<port>B<, void *>I<addr>B<,>\n"
1580 "B< unsigned long int >I<count>B<);>\n"
1581 "B<void insw(unsigned short int >I<port>B<, void *>I<addr>B<,>\n"
1582 "B< unsigned long int >I<count>B<);>\n"
1583 "B<void insl(unsigned short int >I<port>B<, void *>I<addr>B<,>\n"
1584 "B< unsigned long int >I<count>B<);>\n"
1585 "B<void outsb(unsigned short int >I<port>B<, const void *>I<addr>B<,>\n"
1586 "B< unsigned long int >I<count>B<);>\n"
1587 "B<void outsw(unsigned short int >I<port>B<, const void *>I<addr>B<,>\n"
1588 "B< unsigned long int >I<count>B<);>\n"
1589 "B<void outsl(unsigned short int >I<port>B<, const void *>I<addr>B<,>\n"
1590 "B< unsigned long int >I<count>B<);>\n"
1594 #: build/C/man2/outb.2:67
1596 "This family of functions is used to do low-level port input and output. The "
1597 "out* functions do port output, the in* functions do port input; the b-suffix "
1598 "functions are byte-width and the w-suffix functions word-width; the "
1599 "_p-suffix functions pause until the I/O completes."
1602 #. , given the following information
1603 #. in addition to that given in
1606 #: build/C/man2/outb.2:73
1608 "They are primarily designed for internal kernel use, but can be used from "
1613 #: build/C/man2/outb.2:78
1615 "You must compile with B<-O> or B<-O2> or similar. The functions are defined "
1616 "as inline macros, and will not be substituted in without optimization "
1617 "enabled, causing unresolved references at link time."
1621 #: build/C/man2/outb.2:87
1623 "You use B<ioperm>(2) or alternatively B<iopl>(2) to tell the kernel to "
1624 "allow the user space application to access the I/O ports in question. "
1625 "Failure to do this will cause the application to receive a segmentation "
1630 #: build/C/man2/outb.2:96
1632 "B<outb>() and friends are hardware-specific. The I<value> argument is "
1633 "passed first and the I<port> argument is passed second, which is the "
1634 "opposite order from most DOS implementations."
1638 #: build/C/man2/outb.2:99
1639 msgid "B<ioperm>(2), B<iopl>(2)"
1643 #: build/C/man2/pciconfig_read.2:8
1645 msgid "PCICONFIG_READ"
1649 #: build/C/man2/pciconfig_read.2:8
1655 #: build/C/man2/pciconfig_read.2:11
1657 "pciconfig_read, pciconfig_write, pciconfig_iobase - pci device information "
1662 #: build/C/man2/pciconfig_read.2:14
1664 msgid "B<#include E<lt>pci.hE<gt>>\n"
1668 #: build/C/man2/pciconfig_read.2:21
1671 "B<int pciconfig_read(unsigned long >I<bus>B<, unsigned long >I<dfn>B<,>\n"
1672 "B< unsigned long >I<off>B<, unsigned long >I<len>B<, void "
1674 "B<int pciconfig_write(unsigned long >I<bus>B<, unsigned long >I<dfn>B<,>\n"
1675 "B< unsigned long >I<off>B<, unsigned long >I<len>B<, void "
1677 "B<int pciconfig_iobase(long >I<which>B<, unsigned long >I<bus>B<,>\n"
1678 "B< unsigned long >I<devfn>B<);>\n"
1682 #: build/C/man2/pciconfig_read.2:27
1684 "Most of the interaction with PCI devices is already handled by the kernel "
1685 "PCI layer, and thus these calls should not normally need to be accessed from "
1690 #: build/C/man2/pciconfig_read.2:27 build/C/man2/pciconfig_read.2:51
1692 msgid "B<pciconfig_read>()"
1696 #: build/C/man2/pciconfig_read.2:36
1697 msgid "Reads to I<buf> from device I<dev> at offset I<off> value."
1701 #: build/C/man2/pciconfig_read.2:36 build/C/man2/pciconfig_read.2:57
1703 msgid "B<pciconfig_write>()"
1707 #: build/C/man2/pciconfig_read.2:45
1708 msgid "Writes from I<buf> to device I<dev> at offset I<off> value."
1712 #: build/C/man2/pciconfig_read.2:45 build/C/man2/pciconfig_read.2:63
1714 msgid "B<pciconfig_iobase>()"
1718 #: build/C/man2/pciconfig_read.2:50
1720 "You pass it a bus/devfn pair and get a physical address for either the "
1721 "memory offset (for things like prep, this is 0xc0000000), the IO base for "
1722 "PIO cycles, or the ISA holes if any."
1726 #: build/C/man2/pciconfig_read.2:57 build/C/man2/pciconfig_read.2:63
1728 "On success zero is returned. On error, -1 is returned and I<errno> is set "
1733 #: build/C/man2/pciconfig_read.2:77
1735 "Returns information on locations of various I/O regions in physical memory "
1736 "according to the I<which> value. Values for I<which> are: "
1737 "B<IOBASE_BRIDGE_NUMBER>, B<IOBASE_MEMORY>, B<IOBASE_IO>, B<IOBASE_ISA_IO>, "
1738 "B<IOBASE_ISA_MEM>."
1742 #: build/C/man2/pciconfig_read.2:84
1743 msgid "I<len> value is invalid. This does not apply to B<pciconfig_iobase>()."
1747 #: build/C/man2/pciconfig_read.2:84 build/C/man2/ptrace.2:1886 build/C/man2/sendfile.2:134
1753 #: build/C/man2/pciconfig_read.2:87
1758 #: build/C/man2/pciconfig_read.2:87 build/C/man2/perf_event_open.2:2460
1764 #: build/C/man2/pciconfig_read.2:93
1766 "For B<pciconfig_iobase>(), \"hose\" value is NULL. For the other calls, "
1767 "could not find a slot."
1771 #: build/C/man2/pciconfig_read.2:98
1772 msgid "The system has not implemented these calls (B<CONFIG_PCI> not defined)."
1776 #: build/C/man2/pciconfig_read.2:98 build/C/man2/perf_event_open.2:2488
1778 msgid "B<EOPNOTSUPP>"
1782 #: build/C/man2/pciconfig_read.2:105
1784 "This return value is valid only for B<pciconfig_iobase>(). It is returned "
1785 "if the value for I<which> is invalid."
1789 #: build/C/man2/pciconfig_read.2:112
1791 "User does not have the B<CAP_SYS_ADMIN> capability. This does not apply to "
1792 "B<pciconfig_iobase>()."
1796 #: build/C/man2/pciconfig_read.2:114
1797 msgid "These calls are Linux-specific, available since Linux 2.0.26/2.1.11."
1801 #: build/C/man2/pciconfig_read.2:116
1802 msgid "B<capabilities>(7)"
1806 #: build/C/man2/perf_event_open.2:27
1808 msgid "PERF_EVENT_OPEN"
1812 #: build/C/man2/perf_event_open.2:27
1818 #: build/C/man2/perf_event_open.2:30
1819 msgid "perf_event_open - set up performance monitoring"
1823 #: build/C/man2/perf_event_open.2:34
1826 "B<#include E<lt>linux/perf_event.hE<gt>>\n"
1827 "B<#include E<lt>linux/hw_breakpoint.hE<gt>>\n"
1831 #: build/C/man2/perf_event_open.2:38
1834 "B<int perf_event_open(struct perf_event_attr *>I<attr>B<,>\n"
1835 "B< pid_t >I<pid>B<, int >I<cpu>B<, int >I<group_fd>B<,>\n"
1836 "B< unsigned long >I<flags>B<);>\n"
1840 #: build/C/man2/perf_event_open.2:47
1842 "Given a list of parameters, B<perf_event_open>() returns a file descriptor, "
1843 "for use in subsequent system calls (B<read>(2), B<mmap>(2), B<prctl>(2), "
1844 "B<fcntl>(2), etc.)."
1848 #: build/C/man2/perf_event_open.2:55
1850 "A call to B<perf_event_open>() creates a file descriptor that allows "
1851 "measuring performance information. Each file descriptor corresponds to one "
1852 "event that is measured; these can be grouped together to measure multiple "
1853 "events simultaneously."
1857 #: build/C/man2/perf_event_open.2:62
1859 "Events can be enabled and disabled in two ways: via B<ioctl>(2) and via "
1860 "B<prctl>(2). When an event is disabled it does not count or generate "
1861 "overflows but does continue to exist and maintain its count value."
1865 #: build/C/man2/perf_event_open.2:76
1867 "Events come in two flavors: counting and sampled. A I<counting> event is "
1868 "one that is used for counting the aggregate number of events that occur. In "
1869 "general, counting event results are gathered with a B<read>(2) call. A "
1870 "I<sampling> event periodically writes measurements to a buffer that can then "
1871 "be accessed via B<mmap>(2)."
1875 #: build/C/man2/perf_event_open.2:76
1881 #: build/C/man2/perf_event_open.2:83
1883 "The I<pid> and I<cpu> arguments allow specifying which process and CPU to "
1888 #: build/C/man2/perf_event_open.2:83
1890 msgid "B<pid == 0> and B<cpu == -1>"
1894 #: build/C/man2/perf_event_open.2:86
1895 msgid "This measures the calling process/thread on any CPU."
1899 #: build/C/man2/perf_event_open.2:86
1901 msgid "B<pid == 0> and B<cpu E<gt>= 0>"
1905 #: build/C/man2/perf_event_open.2:90
1907 "This measures the calling process/thread only when running on the specified "
1912 #: build/C/man2/perf_event_open.2:90
1914 msgid "B<pid E<gt> 0> and B<cpu == -1>"
1918 #: build/C/man2/perf_event_open.2:93
1919 msgid "This measures the specified process/thread on any CPU."
1923 #: build/C/man2/perf_event_open.2:93
1925 msgid "B<pid E<gt> 0> and B<cpu E<gt>= 0>"
1929 #: build/C/man2/perf_event_open.2:97
1931 "This measures the specified process/thread only when running on the "
1936 #: build/C/man2/perf_event_open.2:97
1938 msgid "B<pid == -1> and B<cpu E<gt>= 0>"
1942 #: build/C/man2/perf_event_open.2:105
1944 "This measures all processes/threads on the specified CPU. This requires "
1945 "B<CAP_SYS_ADMIN> capability or a I</proc/sys/kernel/perf_event_paranoid> "
1946 "value of less than 1."
1950 #: build/C/man2/perf_event_open.2:105
1952 msgid "B<pid == -1> and B<cpu == -1>"
1956 #: build/C/man2/perf_event_open.2:108
1957 msgid "This setting is invalid and will return an error."
1961 #: build/C/man2/perf_event_open.2:130
1963 "The I<group_fd> argument allows event groups to be created. An event group "
1964 "has one event which is the group leader. The leader is created first, with "
1965 "I<group_fd> = -1. The rest of the group members are created with subsequent "
1966 "B<perf_event_open>() calls with I<group_fd> being set to the file "
1967 "descriptor of the group leader. (A single event on its own is created with "
1968 "I<group_fd> = -1 and is considered to be a group with only 1 member.) An "
1969 "event group is scheduled onto the CPU as a unit: it will be put onto the CPU "
1970 "only if all of the events in the group can be put onto the CPU. This means "
1971 "that the values of the member events can be meaningfully compared\\(emadded, "
1972 "divided (to get ratios), and so on\\(emwith each other, since they have "
1973 "counted events for the same set of executed instructions."
1977 #: build/C/man2/perf_event_open.2:134
1979 "The I<flags> argument is formed by ORing together zero or more of the "
1984 #: build/C/man2/perf_event_open.2:134
1986 msgid "B<PERF_FLAG_FD_CLOEXEC> (since Linux 3.14)."
1990 #: build/C/man2/perf_event_open.2:150
1992 "This flag enables the close-on-exec flag for the created event file "
1993 "descriptor, so that the file descriptor is automatically closed on "
1994 "B<execve>(2). Setting the close-on-exec flags at creation time, rather than "
1995 "later with B<fcntl>(2), avoids potential race conditions where the calling "
1996 "thread invokes B<perf_event_open>() and B<fcntl>(2) at the same time as "
1997 "another thread calls B<fork>(2) then B<execve>(2)."
2001 #: build/C/man2/perf_event_open.2:150
2003 msgid "B<PERF_FLAG_FD_NO_GROUP>"
2006 #. FIXME The following sentence is unclear
2007 #. FIXME So, why is it useful?
2009 #: build/C/man2/perf_event_open.2:157
2011 "This flag allows creating an event as part of an event group but having no "
2012 "group leader. It is unclear why this is useful."
2016 #: build/C/man2/perf_event_open.2:157
2018 msgid "B<PERF_FLAG_FD_OUTPUT>"
2022 #: build/C/man2/perf_event_open.2:160
2023 msgid "This flag reroutes the output from an event to the group leader."
2027 #: build/C/man2/perf_event_open.2:160
2029 msgid "B<PERF_FLAG_PID_CGROUP> (since Linux 2.6.39)."
2033 #: build/C/man2/perf_event_open.2:183
2035 "This flag activates per-container system-wide monitoring. A container is an "
2036 "abstraction that isolates a set of resources for finer-grained control "
2037 "(CPUs, memory, etc.). In this mode, the event is measured only if the "
2038 "thread running on the monitored CPU belongs to the designated container "
2039 "(cgroup). The cgroup is identified by passing a file descriptor opened on "
2040 "its directory in the cgroupfs filesystem. For instance, if the cgroup to "
2041 "monitor is called I<test>, then a file descriptor opened on "
2042 "I</dev/cgroup/test> (assuming cgroupfs is mounted on I</dev/cgroup>) must "
2043 "be passed as the I<pid> parameter. cgroup monitoring is available only for "
2044 "system-wide events and may therefore require extra permissions."
2048 #: build/C/man2/perf_event_open.2:188
2050 "The I<perf_event_attr> structure provides detailed configuration information "
2051 "for the event being created."
2055 #: build/C/man2/perf_event_open.2:195
2058 "struct perf_event_attr {\n"
2059 " __u32 type; /* Type of event */\n"
2060 " __u32 size; /* Size of attribute structure */\n"
2061 " __u64 config; /* Type-specific configuration */\n"
2065 #: build/C/man2/perf_event_open.2:200
2069 " __u64 sample_period; /* Period of sampling */\n"
2070 " __u64 sample_freq; /* Frequency of sampling */\n"
2075 #: build/C/man2/perf_event_open.2:203
2078 " __u64 sample_type; /* Specifies values included in sample */\n"
2079 " __u64 read_format; /* Specifies values returned in read */\n"
2083 #: build/C/man2/perf_event_open.2:229
2086 " __u64 disabled : 1, /* off by default */\n"
2087 " inherit : 1, /* children inherit it */\n"
2088 " pinned : 1, /* must always be on PMU */\n"
2089 " exclusive : 1, /* only group on PMU */\n"
2090 " exclude_user : 1, /* don't count user */\n"
2091 " exclude_kernel : 1, /* don't count kernel */\n"
2092 " exclude_hv : 1, /* don't count hypervisor */\n"
2093 " exclude_idle : 1, /* don't count when idle */\n"
2094 " mmap : 1, /* include mmap data */\n"
2095 " comm : 1, /* include comm data */\n"
2096 " freq : 1, /* use freq, not period */\n"
2097 " inherit_stat : 1, /* per task counts */\n"
2098 " enable_on_exec : 1, /* next exec enables */\n"
2099 " task : 1, /* trace fork/exit */\n"
2100 " watermark : 1, /* wakeup_watermark */\n"
2101 " precise_ip : 2, /* skid constraint */\n"
2102 " mmap_data : 1, /* non-exec mmap data */\n"
2103 " sample_id_all : 1, /* sample_type all events */\n"
2104 " exclude_host : 1, /* don't count in host */\n"
2105 " exclude_guest : 1, /* don't count in guest */\n"
2106 " exclude_callchain_kernel : 1,\n"
2107 " /* exclude kernel callchains */\n"
2108 " exclude_callchain_user : 1,\n"
2109 " /* exclude user callchains */\n"
2110 " __reserved_1 : 41;\n"
2114 #: build/C/man2/perf_event_open.2:234
2118 " __u32 wakeup_events; /* wakeup every n events */\n"
2119 " __u32 wakeup_watermark; /* bytes before wakeup */\n"
2124 #: build/C/man2/perf_event_open.2:236
2126 msgid " __u32 bp_type; /* breakpoint type */\n"
2130 #: build/C/man2/perf_event_open.2:241
2134 " __u64 bp_addr; /* breakpoint address */\n"
2135 " __u64 config1; /* extension of config */\n"
2140 #: build/C/man2/perf_event_open.2:251
2144 " __u64 bp_len; /* breakpoint length */\n"
2145 " __u64 config2; /* extension of config1 */\n"
2147 " __u64 branch_sample_type; /* enum perf_branch_sample_type */\n"
2148 " __u64 sample_regs_user; /* user regs to dump on samples */\n"
2149 " __u32 sample_stack_user; /* size of stack to dump on\n"
2151 " __u32 __reserved_2; /* Align to u64 */\n"
2155 #: build/C/man2/perf_event_open.2:253
2161 #: build/C/man2/perf_event_open.2:259
2163 "The fields of the I<perf_event_attr> structure are described in more detail "
2168 #: build/C/man2/perf_event_open.2:259 build/C/man2/perf_event_open.2:1556
2174 #: build/C/man2/perf_event_open.2:263
2176 "This field specifies the overall event type. It has one of the following "
2181 #: build/C/man2/perf_event_open.2:264
2183 msgid "B<PERF_TYPE_HARDWARE>"
2187 #: build/C/man2/perf_event_open.2:271
2189 "This indicates one of the \"generalized\" hardware events provided by the "
2190 "kernel. See the I<config> field definition for more details."
2194 #: build/C/man2/perf_event_open.2:271
2196 msgid "B<PERF_TYPE_SOFTWARE>"
2200 #: build/C/man2/perf_event_open.2:275
2202 "This indicates one of the software-defined events provided by the kernel "
2203 "(even if no hardware support is available)."
2207 #: build/C/man2/perf_event_open.2:275
2209 msgid "B<PERF_TYPE_TRACEPOINT>"
2213 #: build/C/man2/perf_event_open.2:279
2215 "This indicates a tracepoint provided by the kernel tracepoint "
2220 #: build/C/man2/perf_event_open.2:279
2222 msgid "B<PERF_TYPE_HW_CACHE>"
2226 #: build/C/man2/perf_event_open.2:285
2228 "This indicates a hardware cache event. This has a special encoding, "
2229 "described in the I<config> field definition."
2233 #: build/C/man2/perf_event_open.2:285
2235 msgid "B<PERF_TYPE_RAW>"
2239 #: build/C/man2/perf_event_open.2:289
2241 "This indicates a \"raw\" implementation-specific event in the I<config> "
2246 #: build/C/man2/perf_event_open.2:289
2248 msgid "B<PERF_TYPE_BREAKPOINT> (since Linux 2.6.33)"
2252 #: build/C/man2/perf_event_open.2:294
2254 "This indicates a hardware breakpoint as provided by the CPU. Breakpoints "
2255 "can be read/write accesses to an address as well as execution of an "
2256 "instruction address."
2260 #: build/C/man2/perf_event_open.2:294
2266 #: build/C/man2/perf_event_open.2:313
2268 "Since Linux 2.6.39, B<perf_event_open>() can support multiple PMUs. To "
2269 "enable this, a value exported by the kernel can be used in the I<type> field "
2270 "to indicate which PMU to use. The value to use can be found in the sysfs "
2271 "filesystem: there is a subdirectory per PMU instance under "
2272 "I</sys/bus/event_source/devices>. In each subdirectory there is a I<type> "
2273 "file whose content is an integer that can be used in the I<type> field. For "
2274 "instance, I</sys/bus/event_source/devices/cpu/type> contains the value for "
2275 "the core CPU PMU, which is usually 4."
2279 #: build/C/man2/perf_event_open.2:314 build/C/man2/perf_event_open.2:1504
2285 #: build/C/man2/perf_event_open.2:323
2287 "The size of the I<perf_event_attr> structure for forward/backward "
2288 "compatibility. Set this using I<sizeof(struct perf_event_attr)> to allow "
2289 "the kernel to see the struct size at the time of compilation."
2293 #: build/C/man2/perf_event_open.2:338
2295 "The related define B<PERF_ATTR_SIZE_VER0> is set to 64; this was the size of "
2296 "the first published struct. B<PERF_ATTR_SIZE_VER1> is 72, corresponding to "
2297 "the addition of breakpoints in Linux 2.6.33. B<PERF_ATTR_SIZE_VER2> is 80 "
2298 "corresponding to the addition of branch sampling in Linux 3.4. "
2299 "B<PERF_ATR_SIZE_VER3> is 96 corresponding to the addition of "
2300 "I<sample_regs_user> and I<sample_stack_user> in Linux 3.7."
2304 #: build/C/man2/perf_event_open.2:338
2310 #: build/C/man2/perf_event_open.2:349
2312 "This specifies which event you want, in conjunction with the I<type> field. "
2313 "The I<config1> and I<config2> fields are also taken into account in cases "
2314 "where 64 bits is not enough to fully specify the event. The encoding of "
2315 "these fields are event dependent."
2319 #: build/C/man2/perf_event_open.2:355
2321 "The most significant bit (bit 63) of I<config> signifies CPU-specific (raw) "
2322 "counter configuration data; if the most significant bit is unset, the next 7 "
2323 "bits are an event type and the rest of the bits are the event identifier."
2327 #: build/C/man2/perf_event_open.2:366
2329 "There are various ways to set the I<config> field that are dependent on the "
2330 "value of the previously described I<type> field. What follows are various "
2331 "possible settings for I<config> separated out by I<type>."
2335 #: build/C/man2/perf_event_open.2:376
2337 "If I<type> is B<PERF_TYPE_HARDWARE>, we are measuring one of the generalized "
2338 "hardware CPU events. Not all of these are available on all platforms. Set "
2339 "I<config> to one of the following:"
2343 #: build/C/man2/perf_event_open.2:377
2345 msgid "B<PERF_COUNT_HW_CPU_CYCLES>"
2349 #: build/C/man2/perf_event_open.2:381
2350 msgid "Total cycles. Be wary of what happens during CPU frequency scaling."
2354 #: build/C/man2/perf_event_open.2:381
2356 msgid "B<PERF_COUNT_HW_INSTRUCTIONS>"
2360 #: build/C/man2/perf_event_open.2:386
2362 "Retired instructions. Be careful, these can be affected by various issues, "
2363 "most notably hardware interrupt counts."
2367 #: build/C/man2/perf_event_open.2:386
2369 msgid "B<PERF_COUNT_HW_CACHE_REFERENCES>"
2373 #: build/C/man2/perf_event_open.2:393
2375 "Cache accesses. Usually this indicates Last Level Cache accesses but this "
2376 "may vary depending on your CPU. This may include prefetches and coherency "
2377 "messages; again this depends on the design of your CPU."
2381 #: build/C/man2/perf_event_open.2:393
2383 msgid "B<PERF_COUNT_HW_CACHE_MISSES>"
2387 #: build/C/man2/perf_event_open.2:400
2389 "Cache misses. Usually this indicates Last Level Cache misses; this is "
2390 "intended to be used in conjunction with the "
2391 "B<PERF_COUNT_HW_CACHE_REFERENCES> event to calculate cache miss rates."
2395 #: build/C/man2/perf_event_open.2:400
2397 msgid "B<PERF_COUNT_HW_BRANCH_INSTRUCTIONS>"
2401 #: build/C/man2/perf_event_open.2:405
2403 "Retired branch instructions. Prior to Linux 2.6.34, this used the wrong "
2404 "event on AMD processors."
2408 #: build/C/man2/perf_event_open.2:405
2410 msgid "B<PERF_COUNT_HW_BRANCH_MISSES>"
2414 #: build/C/man2/perf_event_open.2:408
2415 msgid "Mispredicted branch instructions."
2419 #: build/C/man2/perf_event_open.2:408
2421 msgid "B<PERF_COUNT_HW_BUS_CYCLES>"
2425 #: build/C/man2/perf_event_open.2:411
2426 msgid "Bus cycles, which can be different from total cycles."
2430 #: build/C/man2/perf_event_open.2:411
2432 msgid "B<PERF_COUNT_HW_STALLED_CYCLES_FRONTEND> (since Linux 3.0)"
2436 #: build/C/man2/perf_event_open.2:414
2437 msgid "Stalled cycles during issue."
2441 #: build/C/man2/perf_event_open.2:414
2443 msgid "B<PERF_COUNT_HW_STALLED_CYCLES_BACKEND> (since Linux 3.0)"
2447 #: build/C/man2/perf_event_open.2:417
2448 msgid "Stalled cycles during retirement."
2452 #: build/C/man2/perf_event_open.2:417
2454 msgid "B<PERF_COUNT_HW_REF_CPU_CYCLES> (since Linux 3.3)"
2458 #: build/C/man2/perf_event_open.2:420
2459 msgid "Total cycles; not affected by CPU frequency scaling."
2463 #: build/C/man2/perf_event_open.2:430
2465 "If I<type> is B<PERF_TYPE_SOFTWARE>, we are measuring software events "
2466 "provided by the kernel. Set I<config> to one of the following:"
2470 #: build/C/man2/perf_event_open.2:431
2472 msgid "B<PERF_COUNT_SW_CPU_CLOCK>"
2476 #: build/C/man2/perf_event_open.2:434
2477 msgid "This reports the CPU clock, a high-resolution per-CPU timer."
2481 #: build/C/man2/perf_event_open.2:434
2483 msgid "B<PERF_COUNT_SW_TASK_CLOCK>"
2487 #: build/C/man2/perf_event_open.2:437
2488 msgid "This reports a clock count specific to the task that is running."
2492 #: build/C/man2/perf_event_open.2:437
2494 msgid "B<PERF_COUNT_SW_PAGE_FAULTS>"
2498 #: build/C/man2/perf_event_open.2:440
2499 msgid "This reports the number of page faults."
2503 #: build/C/man2/perf_event_open.2:440
2505 msgid "B<PERF_COUNT_SW_CONTEXT_SWITCHES>"
2509 #: build/C/man2/perf_event_open.2:445
2511 "This counts context switches. Until Linux 2.6.34, these were all reported "
2512 "as user-space events, after that they are reported as happening in the "
2517 #: build/C/man2/perf_event_open.2:445
2519 msgid "B<PERF_COUNT_SW_CPU_MIGRATIONS>"
2523 #: build/C/man2/perf_event_open.2:449
2524 msgid "This reports the number of times the process has migrated to a new CPU."
2528 #: build/C/man2/perf_event_open.2:449
2530 msgid "B<PERF_COUNT_SW_PAGE_FAULTS_MIN>"
2534 #: build/C/man2/perf_event_open.2:453
2536 "This counts the number of minor page faults. These did not require disk I/O "
2541 #: build/C/man2/perf_event_open.2:453
2543 msgid "B<PERF_COUNT_SW_PAGE_FAULTS_MAJ>"
2547 #: build/C/man2/perf_event_open.2:457
2549 "This counts the number of major page faults. These required disk I/O to "
2554 #: build/C/man2/perf_event_open.2:457
2556 msgid "B<PERF_COUNT_SW_ALIGNMENT_FAULTS> (since Linux 2.6.33)"
2560 #: build/C/man2/perf_event_open.2:463
2562 "This counts the number of alignment faults. These happen when unaligned "
2563 "memory accesses happen; the kernel can handle these but it reduces "
2564 "performance. This happens only on some architectures (never on x86)."
2568 #: build/C/man2/perf_event_open.2:463
2570 msgid "B<PERF_COUNT_SW_EMULATION_FAULTS> (since Linux 2.6.33)"
2574 #: build/C/man2/perf_event_open.2:469
2576 "This counts the number of emulation faults. The kernel sometimes traps on "
2577 "unimplemented instructions and emulates them for user space. This can "
2578 "negatively impact performance."
2582 #: build/C/man2/perf_event_open.2:469
2584 msgid "B<PERF_COUNT_SW_DUMMY> (since Linux 3.12)"
2588 #: build/C/man2/perf_event_open.2:476
2590 "This is a placeholder event that counts nothing. Informational sample "
2591 "record types such as mmap or comm must be associated with an active event. "
2592 "This dummy event allows gathering such records without requiring a counting "
2597 #: build/C/man2/perf_event_open.2:489
2599 "If I<type> is B<PERF_TYPE_TRACEPOINT>, then we are measuring kernel "
2600 "tracepoints. The value to use in I<config> can be obtained from under "
2601 "debugfs I<tracing/events/*/*/id> if ftrace is enabled in the kernel."
2605 #: build/C/man2/perf_event_open.2:500
2607 "If I<type> is B<PERF_TYPE_HW_CACHE>, then we are measuring a hardware CPU "
2608 "cache event. To calculate the appropriate I<config> value use the following "
2613 #: build/C/man2/perf_event_open.2:505
2616 " (perf_hw_cache_id) | (perf_hw_cache_op_id E<lt>E<lt> 8) |\n"
2617 " (perf_hw_cache_op_result_id E<lt>E<lt> 16)\n"
2621 #: build/C/man2/perf_event_open.2:510
2622 msgid "where I<perf_hw_cache_id> is one of:"
2626 #: build/C/man2/perf_event_open.2:511
2628 msgid "B<PERF_COUNT_HW_CACHE_L1D>"
2632 #: build/C/man2/perf_event_open.2:514
2633 msgid "for measuring Level 1 Data Cache"
2637 #: build/C/man2/perf_event_open.2:514
2639 msgid "B<PERF_COUNT_HW_CACHE_L1I>"
2643 #: build/C/man2/perf_event_open.2:517
2644 msgid "for measuring Level 1 Instruction Cache"
2648 #: build/C/man2/perf_event_open.2:517
2650 msgid "B<PERF_COUNT_HW_CACHE_LL>"
2654 #: build/C/man2/perf_event_open.2:520
2655 msgid "for measuring Last-Level Cache"
2659 #: build/C/man2/perf_event_open.2:520
2661 msgid "B<PERF_COUNT_HW_CACHE_DTLB>"
2665 #: build/C/man2/perf_event_open.2:523
2666 msgid "for measuring the Data TLB"
2670 #: build/C/man2/perf_event_open.2:523
2672 msgid "B<PERF_COUNT_HW_CACHE_ITLB>"
2676 #: build/C/man2/perf_event_open.2:526
2677 msgid "for measuring the Instruction TLB"
2681 #: build/C/man2/perf_event_open.2:526
2683 msgid "B<PERF_COUNT_HW_CACHE_BPU>"
2687 #: build/C/man2/perf_event_open.2:529
2688 msgid "for measuring the branch prediction unit"
2692 #: build/C/man2/perf_event_open.2:529
2694 msgid "B<PERF_COUNT_HW_CACHE_NODE> (since Linux 3.0)"
2698 #: build/C/man2/perf_event_open.2:532
2699 msgid "for measuring local memory accesses"
2703 #: build/C/man2/perf_event_open.2:537
2704 msgid "and I<perf_hw_cache_op_id> is one of"
2708 #: build/C/man2/perf_event_open.2:538
2710 msgid "B<PERF_COUNT_HW_CACHE_OP_READ>"
2714 #: build/C/man2/perf_event_open.2:541
2715 msgid "for read accesses"
2719 #: build/C/man2/perf_event_open.2:541
2721 msgid "B<PERF_COUNT_HW_CACHE_OP_WRITE>"
2725 #: build/C/man2/perf_event_open.2:544
2726 msgid "for write accesses"
2730 #: build/C/man2/perf_event_open.2:544
2732 msgid "B<PERF_COUNT_HW_CACHE_OP_PREFETCH>"
2736 #: build/C/man2/perf_event_open.2:547
2737 msgid "for prefetch accesses"
2741 #: build/C/man2/perf_event_open.2:552
2742 msgid "and I<perf_hw_cache_op_result_id> is one of"
2746 #: build/C/man2/perf_event_open.2:553
2748 msgid "B<PERF_COUNT_HW_CACHE_RESULT_ACCESS>"
2752 #: build/C/man2/perf_event_open.2:556
2753 msgid "to measure accesses"
2757 #: build/C/man2/perf_event_open.2:556
2759 msgid "B<PERF_COUNT_HW_CACHE_RESULT_MISS>"
2763 #: build/C/man2/perf_event_open.2:559
2764 msgid "to measure misses"
2768 #: build/C/man2/perf_event_open.2:577
2770 "If I<type> is B<PERF_TYPE_RAW>, then a custom \"raw\" I<config> value is "
2771 "needed. Most CPUs support events that are not covered by the "
2772 "\"generalized\" events. These are implementation defined; see your CPU "
2773 "manual (for example the Intel Volume 3B documentation or the AMD BIOS and "
2774 "Kernel Developer Guide). The libpfm4 library can be used to translate from "
2775 "the name in the architectural manuals to the raw hex value "
2776 "B<perf_event_open>() expects in this field."
2780 #: build/C/man2/perf_event_open.2:586
2782 "If I<type> is B<PERF_TYPE_BREAKPOINT>, then leave I<config> set to zero. "
2783 "Its parameters are set in other places."
2787 #: build/C/man2/perf_event_open.2:587
2789 msgid "I<sample_period>, I<sample_freq>"
2793 #: build/C/man2/perf_event_open.2:599
2795 "A \"sampling\" counter is one that generates an interrupt every N events, "
2796 "where N is given by I<sample_period>. A sampling counter has "
2797 "I<sample_period> E<gt> 0. When an overflow interrupt occurs, requested data "
2798 "is recorded in the mmap buffer. The I<sample_type> field controls what data "
2799 "is recorded on each interrupt."
2803 #: build/C/man2/perf_event_open.2:609
2805 "I<sample_freq> can be used if you wish to use frequency rather than period. "
2806 "In this case, you set the I<freq> flag. The kernel will adjust the sampling "
2807 "period to try and achieve the desired rate. The rate of adjustment is a "
2812 #: build/C/man2/perf_event_open.2:609
2814 msgid "I<sample_type>"
2818 #: build/C/man2/perf_event_open.2:621
2820 "The various bits in this field specify which values to include in the "
2821 "sample. They will be recorded in a ring-buffer, which is available to user "
2822 "space using B<mmap>(2). The order in which the values are saved in the "
2823 "sample are documented in the MMAP Layout subsection below; it is not the "
2824 "I<enum perf_event_sample_format> order."
2828 #: build/C/man2/perf_event_open.2:622
2830 msgid "B<PERF_SAMPLE_IP>"
2834 #: build/C/man2/perf_event_open.2:625
2835 msgid "Records instruction pointer."
2839 #: build/C/man2/perf_event_open.2:625
2841 msgid "B<PERF_SAMPLE_TID>"
2845 #: build/C/man2/perf_event_open.2:628
2846 msgid "Records the process and thread IDs."
2850 #: build/C/man2/perf_event_open.2:628
2852 msgid "B<PERF_SAMPLE_TIME>"
2856 #: build/C/man2/perf_event_open.2:631
2857 msgid "Records a timestamp."
2861 #: build/C/man2/perf_event_open.2:631
2863 msgid "B<PERF_SAMPLE_ADDR>"
2867 #: build/C/man2/perf_event_open.2:634
2868 msgid "Records an address, if applicable."
2872 #: build/C/man2/perf_event_open.2:634
2874 msgid "B<PERF_SAMPLE_READ>"
2878 #: build/C/man2/perf_event_open.2:637
2879 msgid "Record counter values for all events in a group, not just the group leader."
2883 #: build/C/man2/perf_event_open.2:637
2885 msgid "B<PERF_SAMPLE_CALLCHAIN>"
2889 #: build/C/man2/perf_event_open.2:640
2890 msgid "Records the callchain (stack backtrace)."
2894 #: build/C/man2/perf_event_open.2:640
2896 msgid "B<PERF_SAMPLE_ID>"
2900 #: build/C/man2/perf_event_open.2:643
2901 msgid "Records a unique ID for the opened event's group leader."
2905 #: build/C/man2/perf_event_open.2:643
2907 msgid "B<PERF_SAMPLE_CPU>"
2911 #: build/C/man2/perf_event_open.2:646
2912 msgid "Records CPU number."
2916 #: build/C/man2/perf_event_open.2:646
2918 msgid "B<PERF_SAMPLE_PERIOD>"
2922 #: build/C/man2/perf_event_open.2:649
2923 msgid "Records the current sampling period."
2927 #: build/C/man2/perf_event_open.2:649
2929 msgid "B<PERF_SAMPLE_STREAM_ID>"
2933 #: build/C/man2/perf_event_open.2:657
2935 "Records a unique ID for the opened event. Unlike B<PERF_SAMPLE_ID> the "
2936 "actual ID is returned, not the group leader. This ID is the same as the one "
2937 "returned by B<PERF_FORMAT_ID>."
2941 #: build/C/man2/perf_event_open.2:657
2943 msgid "B<PERF_SAMPLE_RAW>"
2947 #: build/C/man2/perf_event_open.2:661
2949 "Records additional data, if applicable. Usually returned by tracepoint "
2954 #: build/C/man2/perf_event_open.2:661
2956 msgid "B<PERF_SAMPLE_BRANCH_STACK> (since Linux 3.4)"
2960 #: build/C/man2/perf_event_open.2:666
2962 "This provides a record of recent branches, as provided by CPU branch "
2963 "sampling hardware (such as Intel Last Branch Record). Not all hardware "
2964 "supports this feature."
2968 #: build/C/man2/perf_event_open.2:670
2970 "See the I<branch_sample_type> field for how to filter which branches are "
2975 #: build/C/man2/perf_event_open.2:670
2977 msgid "B<PERF_SAMPLE_REGS_USER> (since Linux 3.7)"
2981 #: build/C/man2/perf_event_open.2:674
2983 "Records the current user-level CPU register state (the values in the process "
2984 "before the kernel was called)."
2988 #: build/C/man2/perf_event_open.2:674
2990 msgid "B<PERF_SAMPLE_STACK_USER> (since Linux 3.7)"
2994 #: build/C/man2/perf_event_open.2:677
2995 msgid "Records the user level stack, allowing stack unwinding."
2999 #: build/C/man2/perf_event_open.2:677
3001 msgid "B<PERF_SAMPLE_WEIGHT> (since Linux 3.10)"
3005 #: build/C/man2/perf_event_open.2:683
3007 "Records a hardware provided weight value that expresses how costly the "
3008 "sampled event was. This allows the hardware to highlight expensive events "
3013 #: build/C/man2/perf_event_open.2:683
3015 msgid "B<PERF_SAMPLE_DATA_SRC> (since Linux 3.10)"
3019 #: build/C/man2/perf_event_open.2:689
3021 "Records the data source: where in the memory hierarchy the data associated "
3022 "with the sampled instruction came from. This is only available if the "
3023 "underlying hardware supports this feature."
3027 #: build/C/man2/perf_event_open.2:689
3029 msgid "B<PERF_SAMPLE_IDENTIFIER> (since Linux 3.12)"
3033 #: build/C/man2/perf_event_open.2:696
3035 "Places the B<SAMPLE_ID> value in a fixed position in the record, either at "
3036 "the beginning (for sample events) or at the end (if a non-sample event)."
3040 #: build/C/man2/perf_event_open.2:708
3042 "This was necessary because a sample stream may have records from various "
3043 "different event sources with different I<sample_type> settings. Parsing the "
3044 "event stream properly was not possible because the format of the record was "
3045 "needed to find B<SAMPLE_ID>, but the format could not be found without "
3046 "knowing what event the sample belonged to (causing a circular dependency)."
3050 #: build/C/man2/perf_event_open.2:718
3052 "This new B<PERF_SAMPLE_IDENTIFIER> setting makes the event stream always "
3053 "parsable by putting B<SAMPLE_ID> in a fixed location, even though it means "
3054 "having duplicate B<SAMPLE_ID> values in records."
3058 #: build/C/man2/perf_event_open.2:718
3060 msgid "B<PERF_SAMPLE_TRANSACTION> (Since Linux 3.13)"
3064 #: build/C/man2/perf_event_open.2:722
3066 "Records reasons for transactional memory abort events (for example, from "
3067 "Intel TSX transactional memory support)."
3071 #: build/C/man2/perf_event_open.2:730
3073 "The I<precise_ip> setting must be greater than 0 and a transactional memory "
3074 "abort event must be measured or no values will be recorded. Also note that "
3075 "some perf_event measurements, such as sampled cycle counting, may cause "
3076 "extraneous aborts (by causing an interrupt during a transaction)."
3080 #: build/C/man2/perf_event_open.2:731
3082 msgid "I<read_format>"
3086 #: build/C/man2/perf_event_open.2:738
3088 "This field specifies the format of the data returned by B<read>(2) on a "
3089 "B<perf_event_open>() file descriptor."
3093 #: build/C/man2/perf_event_open.2:739
3095 msgid "B<PERF_FORMAT_TOTAL_TIME_ENABLED>"
3099 #: build/C/man2/perf_event_open.2:746
3101 "Adds the 64-bit I<time_enabled> field. This can be used to calculate "
3102 "estimated totals if the PMU is overcommitted and multiplexing is happening."
3106 #: build/C/man2/perf_event_open.2:746
3108 msgid "B<PERF_FORMAT_TOTAL_TIME_RUNNING>"
3112 #: build/C/man2/perf_event_open.2:753
3114 "Adds the 64-bit I<time_running> field. This can be used to calculate "
3115 "estimated totals if the PMU is overcommitted and multiplexing is happening."
3119 #: build/C/man2/perf_event_open.2:753
3121 msgid "B<PERF_FORMAT_ID>"
3125 #: build/C/man2/perf_event_open.2:756
3126 msgid "Adds a 64-bit unique value that corresponds to the event group."
3130 #: build/C/man2/perf_event_open.2:756
3132 msgid "B<PERF_FORMAT_GROUP>"
3136 #: build/C/man2/perf_event_open.2:759
3137 msgid "Allows all counter values in an event group to be read with one read."
3141 #: build/C/man2/perf_event_open.2:760
3147 #: build/C/man2/perf_event_open.2:770
3149 "The I<disabled> bit specifies whether the counter starts out disabled or "
3150 "enabled. If disabled, the event can later be enabled by B<ioctl>(2), "
3151 "B<prctl>(2), or I<enable_on_exec>."
3155 #: build/C/man2/perf_event_open.2:781
3157 "When creating an event group, typically the group leader is initialized with "
3158 "I<disabled> set to 1 and any child events are initialized with I<disabled> "
3159 "set to 0. Despite I<disabled> being 0, the child events will not start "
3160 "until the group leader is enabled."
3164 #: build/C/man2/perf_event_open.2:781
3170 #: build/C/man2/perf_event_open.2:790
3172 "The I<inherit> bit specifies that this counter should count events of child "
3173 "tasks as well as the task specified. This applies only to new children, not "
3174 "to any existing children at the time the counter is created (nor to any new "
3175 "children of existing children)."
3179 #: build/C/man2/perf_event_open.2:795
3181 "Inherit does not work for some combinations of I<read_format>s, such as "
3182 "B<PERF_FORMAT_GROUP>."
3186 #: build/C/man2/perf_event_open.2:795
3192 #: build/C/man2/perf_event_open.2:808
3194 "The I<pinned> bit specifies that the counter should always be on the CPU if "
3195 "at all possible. It applies only to hardware counters and only to group "
3196 "leaders. If a pinned counter cannot be put onto the CPU (e.g., because "
3197 "there are not enough hardware counters or because of a conflict with some "
3198 "other event), then the counter goes into an 'error' state, where reads "
3199 "return end-of-file (i.e., B<read>(2) returns 0) until the counter is "
3200 "subsequently enabled or disabled."
3204 #: build/C/man2/perf_event_open.2:808
3206 msgid "I<exclusive>"
3210 #: build/C/man2/perf_event_open.2:817
3212 "The I<exclusive> bit specifies that when this counter's group is on the CPU, "
3213 "it should be the only group using the CPU's counters. In the future this "
3214 "may allow monitoring programs to support PMU features that need to run alone "
3215 "so that they do not disrupt other hardware counters."
3219 #: build/C/man2/perf_event_open.2:824
3221 "Note that many unexpected situations may prevent events with the "
3222 "I<exclusive> bit set from ever running. This includes any users running a "
3223 "system-wide measurement as well as any kernel use of the performance "
3224 "counters (including the commonly enabled NMI Watchdog Timer interface)."
3228 #: build/C/man2/perf_event_open.2:824
3230 msgid "I<exclude_user>"
3234 #: build/C/man2/perf_event_open.2:827
3235 msgid "If this bit is set, the count excludes events that happen in user space."
3239 #: build/C/man2/perf_event_open.2:827
3241 msgid "I<exclude_kernel>"
3245 #: build/C/man2/perf_event_open.2:830
3246 msgid "If this bit is set, the count excludes events that happen in kernel-space."
3250 #: build/C/man2/perf_event_open.2:830
3252 msgid "I<exclude_hv>"
3256 #: build/C/man2/perf_event_open.2:838
3258 "If this bit is set, the count excludes events that happen in the "
3259 "hypervisor. This is mainly for PMUs that have built-in support for handling "
3260 "this (such as POWER). Extra support is needed for handling hypervisor "
3261 "measurements on most machines."
3265 #: build/C/man2/perf_event_open.2:838
3267 msgid "I<exclude_idle>"
3271 #: build/C/man2/perf_event_open.2:841
3272 msgid "If set, don't count when the CPU is idle."
3276 #: build/C/man2/perf_event_open.2:841
3282 #: build/C/man2/perf_event_open.2:855
3284 "The I<mmap> bit enables generation of B<PERF_RECORD_MMAP> samples for every "
3285 "B<mmap>(2) call that has B<PROT_EXEC> set. This allows tools to notice new "
3286 "executable code being mapped into a program (dynamic shared libraries for "
3287 "example) so that addresses can be mapped back to the original code."
3291 #: build/C/man2/perf_event_open.2:855
3297 #: build/C/man2/perf_event_open.2:866
3299 "The I<comm> bit enables tracking of process command name as modified by the "
3300 "B<exec>(2) and B<prctl>(PR_SET_NAME) system calls. Unfortunately for "
3301 "tools, there is no way to distinguish one system call versus the other."
3305 #: build/C/man2/perf_event_open.2:866
3311 #: build/C/man2/perf_event_open.2:873
3313 "If this bit is set, then I<sample_frequency> not I<sample_period> is used "
3314 "when setting up the sampling interval."
3318 #: build/C/man2/perf_event_open.2:873
3320 msgid "I<inherit_stat>"
3324 #: build/C/man2/perf_event_open.2:880
3326 "This bit enables saving of event counts on context switch for inherited "
3327 "tasks. This is meaningful only if the I<inherit> field is set."
3331 #: build/C/man2/perf_event_open.2:880
3333 msgid "I<enable_on_exec>"
3337 #: build/C/man2/perf_event_open.2:885
3339 "If this bit is set, a counter is automatically enabled after a call to "
3344 #: build/C/man2/perf_event_open.2:885
3350 #: build/C/man2/perf_event_open.2:889
3352 "If this bit is set, then fork/exit notifications are included in the ring "
3357 #: build/C/man2/perf_event_open.2:889
3359 msgid "I<watermark>"
3363 #: build/C/man2/perf_event_open.2:897
3365 "If set, have a sampling interrupt happen when we cross the "
3366 "I<wakeup_watermark> boundary. Otherwise, interrupts happen after "
3367 "I<wakeup_events> samples."
3371 #: build/C/man2/perf_event_open.2:897
3373 msgid "I<precise_ip> (since Linux 2.6.35)"
3377 #: build/C/man2/perf_event_open.2:907
3379 "This controls the amount of skid. Skid is how many instructions execute "
3380 "between an event of interest happening and the kernel being able to stop and "
3381 "record the event. Smaller skid is better and allows more accurate reporting "
3382 "of which events correspond to which instructions, but hardware is often "
3383 "limited with how small this can be."
3387 #: build/C/man2/perf_event_open.2:909
3388 msgid "The values of this are the following:"
3392 #: build/C/man2/perf_event_open.2:910
3398 #: build/C/man2/perf_event_open.2:914
3399 msgid "B<SAMPLE_IP> can have arbitrary skid."
3403 #: build/C/man2/perf_event_open.2:914
3409 #: build/C/man2/perf_event_open.2:918
3410 msgid "B<SAMPLE_IP> must have constant skid."
3414 #: build/C/man2/perf_event_open.2:918
3420 #: build/C/man2/perf_event_open.2:922
3421 msgid "B<SAMPLE_IP> requested to have 0 skid."
3425 #: build/C/man2/perf_event_open.2:922
3431 #: build/C/man2/perf_event_open.2:928
3432 msgid "B<SAMPLE_IP> must have 0 skid. See also B<PERF_RECORD_MISC_EXACT_IP>."
3436 #: build/C/man2/perf_event_open.2:929
3438 msgid "I<mmap_data> (since Linux 2.6.36)"
3442 #: build/C/man2/perf_event_open.2:941
3444 "The counterpart of the I<mmap> field. This enables generation of "
3445 "B<PERF_RECORD_MMAP> samples for B<mmap>(2) calls that do not have "
3446 "B<PROT_EXEC> set (for example data and SysV shared memory)."
3450 #: build/C/man2/perf_event_open.2:941
3452 msgid "I<sample_id_all> (since Linux 2.6.38)"
3456 #: build/C/man2/perf_event_open.2:949
3458 "If set, then TID, TIME, ID, STREAM_ID, and CPU can additionally be included "
3459 "in non-B<PERF_RECORD_SAMPLE>s if the corresponding I<sample_type> is "
3464 #: build/C/man2/perf_event_open.2:957
3466 "If B<PERF_SAMPLE_IDENTIFIER> is specified, then an additional ID value is "
3467 "included as the last value to ease parsing the record stream. This may lead "
3468 "to the I<id> value appearing twice."
3472 #: build/C/man2/perf_event_open.2:959
3473 msgid "The layout is described by this pseudo-structure:"
3477 #: build/C/man2/perf_event_open.2:969
3480 "struct sample_id {\n"
3481 " { u32 pid, tid; } /* if PERF_SAMPLE_TID set */\n"
3482 " { u64 time; } /* if PERF_SAMPLE_TIME set */\n"
3483 " { u64 id; } /* if PERF_SAMPLE_ID set */\n"
3484 " { u64 stream_id;} /* if PERF_SAMPLE_STREAM_ID set */\n"
3485 " { u32 cpu, res; } /* if PERF_SAMPLE_CPU set */\n"
3486 " { u64 id; } /* if PERF_SAMPLE_IDENTIFIER set */\n"
3491 #: build/C/man2/perf_event_open.2:970
3493 msgid "I<exclude_host> (since Linux 3.2)"
3497 #: build/C/man2/perf_event_open.2:973
3498 msgid "Do not measure time spent in VM host."
3502 #: build/C/man2/perf_event_open.2:973
3504 msgid "I<exclude_guest> (since Linux 3.2)"
3508 #: build/C/man2/perf_event_open.2:976
3509 msgid "Do not measure time spent in VM guest."
3513 #: build/C/man2/perf_event_open.2:976
3515 msgid "I<exclude_callchain_kernel> (since Linux 3.7)"
3519 #: build/C/man2/perf_event_open.2:979
3520 msgid "Do not include kernel callchains."
3524 #: build/C/man2/perf_event_open.2:979
3526 msgid "I<exclude_callchain_user> (since Linux 3.7)"
3530 #: build/C/man2/perf_event_open.2:982
3531 msgid "Do not include user callchains."
3535 #: build/C/man2/perf_event_open.2:982
3537 msgid "I<wakeup_events>, I<wakeup_watermark>"
3541 #: build/C/man2/perf_event_open.2:992
3543 "This union sets how many samples (I<wakeup_events>) or bytes "
3544 "(I<wakeup_watermark>) happen before an overflow signal happens. Which one "
3545 "is used is selected by the I<watermark> bit flag."
3549 #: build/C/man2/perf_event_open.2:1002
3551 "I<wakeup_events> only counts B<PERF_RECORD_SAMPLE> record types. To receive "
3552 "a signal for every incoming B<PERF_RECORD> type set I<wakeup_watermark> to "
3557 #: build/C/man2/perf_event_open.2:1002
3559 msgid "I<bp_type> (since Linux 2.6.33)"
3563 #: build/C/man2/perf_event_open.2:1006
3564 msgid "This chooses the breakpoint type. It is one of:"
3568 #: build/C/man2/perf_event_open.2:1007
3570 msgid "B<HW_BREAKPOINT_EMPTY>"
3574 #: build/C/man2/perf_event_open.2:1010
3575 msgid "No breakpoint."
3579 #: build/C/man2/perf_event_open.2:1010
3581 msgid "B<HW_BREAKPOINT_R>"
3585 #: build/C/man2/perf_event_open.2:1013
3586 msgid "Count when we read the memory location."
3590 #: build/C/man2/perf_event_open.2:1013
3592 msgid "B<HW_BREAKPOINT_W>"
3596 #: build/C/man2/perf_event_open.2:1016
3597 msgid "Count when we write the memory location."
3601 #: build/C/man2/perf_event_open.2:1016
3603 msgid "B<HW_BREAKPOINT_RW>"
3607 #: build/C/man2/perf_event_open.2:1019
3608 msgid "Count when we read or write the memory location."
3612 #: build/C/man2/perf_event_open.2:1019
3614 msgid "B<HW_BREAKPOINT_X>"
3618 #: build/C/man2/perf_event_open.2:1022
3619 msgid "Count when we execute code at the memory location."
3623 #: build/C/man2/perf_event_open.2:1031
3625 "The values can be combined via a bitwise or, but the combination of "
3626 "B<HW_BREAKPOINT_R> or B<HW_BREAKPOINT_W> with B<HW_BREAKPOINT_X> is not "
3631 #: build/C/man2/perf_event_open.2:1032
3633 msgid "I<bp_addr> (since Linux 2.6.33)"
3637 #: build/C/man2/perf_event_open.2:1039
3639 "I<bp_addr> address of the breakpoint. For execution breakpoints this is the "
3640 "memory address of the instruction of interest; for read and write "
3641 "breakpoints it is the memory address of the memory location of interest."
3645 #: build/C/man2/perf_event_open.2:1039
3647 msgid "I<config1> (since Linux 2.6.39)"
3651 #: build/C/man2/perf_event_open.2:1046
3653 "I<config1> is used for setting events that need an extra register or "
3654 "otherwise do not fit in the regular config field. Raw OFFCORE_EVENTS on "
3655 "Nehalem/Westmere/SandyBridge use this field on 3.3 and later kernels."
3659 #: build/C/man2/perf_event_open.2:1046
3661 msgid "I<bp_len> (since Linux 2.6.33)"
3665 #: build/C/man2/perf_event_open.2:1060
3667 "I<bp_len> is the length of the breakpoint being measured if I<type> is "
3668 "B<PERF_TYPE_BREAKPOINT>. Options are B<HW_BREAKPOINT_LEN_1>, "
3669 "B<HW_BREAKPOINT_LEN_2>, B<HW_BREAKPOINT_LEN_4>, B<HW_BREAKPOINT_LEN_8>. For "
3670 "an execution breakpoint, set this to I<sizeof(long)>."
3674 #: build/C/man2/perf_event_open.2:1060
3676 msgid "I<config2> (since Linux 2.6.39)"
3680 #: build/C/man2/perf_event_open.2:1067
3681 msgid "I<config2> is a further extension of the I<config1> field."
3685 #: build/C/man2/perf_event_open.2:1067
3687 msgid "I<branch_sample_type> (since Linux 3.4)"
3691 #: build/C/man2/perf_event_open.2:1073
3693 "If B<PERF_SAMPLE_BRANCH_STACK> is enabled, then this specifies what branches "
3694 "to include in the branch record."
3698 #: build/C/man2/perf_event_open.2:1079
3700 "The first part of the value is the privilege level, which is a combination "
3701 "of one of the following values. If the user does not set privilege level "
3702 "explicitly, the kernel will use the event's privilege level. Event and "
3703 "branch privilege levels do not have to match."
3707 #: build/C/man2/perf_event_open.2:1080
3709 msgid "B<PERF_SAMPLE_BRANCH_USER>"
3713 #: build/C/man2/perf_event_open.2:1083
3714 msgid "Branch target is in user space."
3718 #: build/C/man2/perf_event_open.2:1083
3720 msgid "B<PERF_SAMPLE_BRANCH_KERNEL>"
3724 #: build/C/man2/perf_event_open.2:1086
3725 msgid "Branch target is in kernel space."
3729 #: build/C/man2/perf_event_open.2:1086
3731 msgid "B<PERF_SAMPLE_BRANCH_HV>"
3735 #: build/C/man2/perf_event_open.2:1089
3736 msgid "Branch target is in hypervisor."
3740 #: build/C/man2/perf_event_open.2:1089
3742 msgid "B<PERF_SAMPLE_BRANCH_PLM_ALL>"
3746 #: build/C/man2/perf_event_open.2:1092
3747 msgid "A convenience value that is the three preceding values ORed together."
3751 #: build/C/man2/perf_event_open.2:1096
3753 "In addition to the privilege value, at least one or more of the following "
3758 #: build/C/man2/perf_event_open.2:1097
3760 msgid "B<PERF_SAMPLE_BRANCH_ANY>"
3764 #: build/C/man2/perf_event_open.2:1100
3765 msgid "Any branch type."
3769 #: build/C/man2/perf_event_open.2:1100
3771 msgid "B<PERF_SAMPLE_BRANCH_ANY_CALL>"
3775 #: build/C/man2/perf_event_open.2:1103
3776 msgid "Any call branch."
3780 #: build/C/man2/perf_event_open.2:1103
3782 msgid "B<PERF_SAMPLE_BRANCH_ANY_RETURN>"
3786 #: build/C/man2/perf_event_open.2:1106
3787 msgid "Any return branch."
3791 #: build/C/man2/perf_event_open.2:1106
3793 msgid "B<PERF_SAMPLE_BRANCH_IND_CALL>"
3797 #: build/C/man2/perf_event_open.2:1109
3798 msgid "Indirect calls."
3802 #: build/C/man2/perf_event_open.2:1109
3804 msgid "B<PERF_SAMPLE_BRANCH_ABORT_TX> (since Linux 3.11)"
3808 #: build/C/man2/perf_event_open.2:1112
3809 msgid "Transactional memory aborts."
3813 #: build/C/man2/perf_event_open.2:1112
3815 msgid "B<PERF_SAMPLE_BRANCH_IN_TX> (since Linux 3.11)"
3819 #: build/C/man2/perf_event_open.2:1115
3820 msgid "Branch in transactional memory transaction."
3824 #: build/C/man2/perf_event_open.2:1115
3826 msgid "B<PERF_SAMPLE_BRANCH_NO_TX> (since Linux 3.11)"
3830 #: build/C/man2/perf_event_open.2:1118
3831 msgid "Branch not in transactional memory transaction."
3835 #: build/C/man2/perf_event_open.2:1120
3837 msgid "I<sample_regs_user> (since Linux 3.7)"
3841 #: build/C/man2/perf_event_open.2:1126
3843 "This bit mask defines the set of user CPU registers to dump on samples. The "
3844 "layout of the register mask is architecture-specific and described in the "
3845 "kernel header I<arch/ARCH/include/uapi/asm/perf_regs.h>."
3849 #: build/C/man2/perf_event_open.2:1126
3851 msgid "I<sample_stack_user> (since Linux 3.7)"
3855 #: build/C/man2/perf_event_open.2:1131
3857 "This defines the size of the user stack to dump if B<PERF_SAMPLE_STACK_USER> "
3862 #: build/C/man2/perf_event_open.2:1131
3864 msgid "Reading results"
3868 #: build/C/man2/perf_event_open.2:1141
3870 "Once a B<perf_event_open>() file descriptor has been opened, the values of "
3871 "the events can be read from the file descriptor. The values that are there "
3872 "are specified by the I<read_format> field in the I<attr> structure at open "
3877 #: build/C/man2/perf_event_open.2:1146
3879 "If you attempt to read into a buffer that is not big enough to hold the data "
3880 "B<ENOSPC> is returned"
3884 #: build/C/man2/perf_event_open.2:1148
3885 msgid "Here is the layout of the data returned by a read:"
3889 #: build/C/man2/perf_event_open.2:1148 build/C/man2/perf_event_open.2:1166 build/C/man2/ptrace.2:1692 build/C/man2/ptrace.2:1702 build/C/man2/ptrace.2:1710 build/C/man2/ptrace.2:1716 build/C/man2/ptrace.2:1845
3895 #: build/C/man2/perf_event_open.2:1152
3897 "If B<PERF_FORMAT_GROUP> was specified to allow reading all events in a group "
3902 #: build/C/man2/perf_event_open.2:1164
3905 "struct read_format {\n"
3906 " u64 nr; /* The number of events */\n"
3907 " u64 time_enabled; /* if PERF_FORMAT_TOTAL_TIME_ENABLED */\n"
3908 " u64 time_running; /* if PERF_FORMAT_TOTAL_TIME_RUNNING */\n"
3910 " u64 value; /* The value of the event */\n"
3911 " u64 id; /* if PERF_FORMAT_ID */\n"
3917 #: build/C/man2/perf_event_open.2:1172
3918 msgid "If B<PERF_FORMAT_GROUP> was I<not> specified:"
3922 #: build/C/man2/perf_event_open.2:1181
3925 "struct read_format {\n"
3926 " u64 value; /* The value of the event */\n"
3927 " u64 time_enabled; /* if PERF_FORMAT_TOTAL_TIME_ENABLED */\n"
3928 " u64 time_running; /* if PERF_FORMAT_TOTAL_TIME_RUNNING */\n"
3929 " u64 id; /* if PERF_FORMAT_ID */\n"
3934 #: build/C/man2/perf_event_open.2:1185
3935 msgid "The values read are as follows:"
3939 #: build/C/man2/perf_event_open.2:1185
3945 #: build/C/man2/perf_event_open.2:1191
3947 "The number of events in this file descriptor. Only available if "
3948 "B<PERF_FORMAT_GROUP> was specified."
3952 #: build/C/man2/perf_event_open.2:1191
3954 msgid "I<time_enabled>, I<time_running>"
3958 #: build/C/man2/perf_event_open.2:1203
3960 "Total time the event was enabled and running. Normally these are the same. "
3961 "If more events are started, then available counter slots on the PMU, then "
3962 "multiplexing happens and events run only part of the time. In that case, "
3963 "the I<time_enabled> and I<time running> values can be used to scale an "
3964 "estimated value for the count."
3968 #: build/C/man2/perf_event_open.2:1203
3974 #: build/C/man2/perf_event_open.2:1206
3975 msgid "An unsigned 64-bit value containing the counter result."
3979 #: build/C/man2/perf_event_open.2:1206 build/C/man2/perf_event_open.2:1602 build/C/man2/perf_event_open.2:1756
3985 #: build/C/man2/perf_event_open.2:1212
3987 "A globally unique value for this particular event, only there if "
3988 "B<PERF_FORMAT_ID> was specified in I<read_format>."
3992 #: build/C/man2/perf_event_open.2:1212
3998 #: build/C/man2/perf_event_open.2:1222
4000 "When using B<perf_event_open>() in sampled mode, asynchronous events (like "
4001 "counter overflow or B<PROT_EXEC> mmap tracking) are logged into a "
4002 "ring-buffer. This ring-buffer is created and accessed through B<mmap>(2)."
4006 #: build/C/man2/perf_event_open.2:1228
4008 "The mmap size should be 1+2^n pages, where the first page is a metadata page "
4009 "(I<struct perf_event_mmap_page>) that contains various bits of information "
4010 "such as where the ring-buffer head is."
4014 #: build/C/man2/perf_event_open.2:1231
4016 "Before kernel 2.6.39, there is a bug that means you must allocate a mmap "
4017 "ring buffer when sampling even if you do not plan to access it."
4021 #: build/C/man2/perf_event_open.2:1233
4022 msgid "The structure of the first metadata mmap page is as follows:"
4026 #: build/C/man2/perf_event_open.2:1262
4029 "struct perf_event_mmap_page {\n"
4030 " __u32 version; /* version number of this structure */\n"
4031 " __u32 compat_version; /* lowest version this is compat with */\n"
4032 " __u32 lock; /* seqlock for synchronization */\n"
4033 " __u32 index; /* hardware counter identifier */\n"
4034 " __s64 offset; /* add to hardware counter value */\n"
4035 " __u64 time_enabled; /* time event active */\n"
4036 " __u64 time_running; /* time event on CPU */\n"
4038 " __u64 capabilities;\n"
4040 " __u64 cap_usr_time / cap_usr_rdpmc / cap_bit0 : 1,\n"
4041 " cap_bit0_is_deprecated : 1,\n"
4042 " cap_user_rdpmc : 1,\n"
4043 " cap_user_time : 1,\n"
4044 " cap_user_time_zero : 1,\n"
4047 " __u16 pmc_width;\n"
4048 " __u16 time_shift;\n"
4049 " __u32 time_mult;\n"
4050 " __u64 time_offset;\n"
4051 " __u64 __reserved[120]; /* Pad to 1k */\n"
4052 " __u64 data_head; /* head in the data section */\n"
4053 " __u64 data_tail; /* user-space written tail */\n"
4058 #: build/C/man2/perf_event_open.2:1268
4060 "The following list describes the fields in the I<perf_event_mmap_page> "
4061 "structure in more detail:"
4065 #: build/C/man2/perf_event_open.2:1268
4071 #: build/C/man2/perf_event_open.2:1271
4072 msgid "Version number of this structure."
4076 #: build/C/man2/perf_event_open.2:1271
4078 msgid "I<compat_version>"
4082 #: build/C/man2/perf_event_open.2:1274
4083 msgid "The lowest version this is compatible with."
4087 #: build/C/man2/perf_event_open.2:1274
4093 #: build/C/man2/perf_event_open.2:1277
4094 msgid "A seqlock for synchronization."
4098 #: build/C/man2/perf_event_open.2:1277
4104 #: build/C/man2/perf_event_open.2:1280
4105 msgid "A unique hardware counter identifier."
4109 #: build/C/man2/perf_event_open.2:1280
4115 #: build/C/man2/perf_event_open.2:1285
4117 "When using rdpmc for reads this offset value must be added to the one "
4118 "returned by rdpmc to get the current total event count."
4122 #: build/C/man2/perf_event_open.2:1285
4124 msgid "I<time_enabled>"
4128 #: build/C/man2/perf_event_open.2:1288
4129 msgid "Time the event was active."
4133 #: build/C/man2/perf_event_open.2:1288
4135 msgid "I<time_running>"
4139 #: build/C/man2/perf_event_open.2:1291
4140 msgid "Time the event was running."
4144 #: build/C/man2/perf_event_open.2:1291
4146 msgid "I<cap_usr_time> / I<cap_usr_rdpmc> / I<cap_bit0> (since Linux 3.4)"
4150 #: build/C/man2/perf_event_open.2:1304
4152 "There was a bug in the definition of I<cap_usr_time> and I<cap_usr_rdpmc> "
4153 "from Linux 3.4 until Linux 3.11. Both bits were defined to point to the "
4154 "same location, so it was impossible to know if I<cap_usr_time> or "
4155 "I<cap_usr_rdpmc> were actually set."
4159 #: build/C/man2/perf_event_open.2:1312
4161 "Starting with 3.12 these are renamed to I<cap_bit0> and you should use the "
4162 "new I<cap_user_time> and I<cap_user_rdpmc> fields instead."
4166 #: build/C/man2/perf_event_open.2:1313
4168 msgid "I<cap_bit0_is_deprecated> (since Linux 3.12)"
4172 #: build/C/man2/perf_event_open.2:1321
4174 "If set, this bit indicates that the kernel supports the properly separated "
4175 "I<cap_user_time> and I<cap_user_rdpmc> bits."
4179 #: build/C/man2/perf_event_open.2:1328
4181 "If not-set, it indicates an older kernel where I<cap_usr_time> and "
4182 "I<cap_usr_rdpmc> map to the same bit and thus both features should be used "
4187 #: build/C/man2/perf_event_open.2:1329
4189 msgid "I<cap_user_rdpmc> (since Linux 3.12)"
4193 #: build/C/man2/perf_event_open.2:1334
4195 "If the hardware supports user-space read of performance counters without "
4196 "syscall (this is the \"rdpmc\" instruction on x86), then the following code "
4197 "can be used to do a read:"
4201 #: build/C/man2/perf_event_open.2:1340
4204 "u32 seq, time_mult, time_shift, idx, width;\n"
4205 "u64 count, enabled, running;\n"
4206 "u64 cyc, time_offset;\n"
4210 #: build/C/man2/perf_event_open.2:1346
4214 " seq = pc-E<gt>lock;\n"
4216 " enabled = pc-E<gt>time_enabled;\n"
4217 " running = pc-E<gt>time_running;\n"
4221 #: build/C/man2/perf_event_open.2:1353
4224 " if (pc-E<gt>cap_usr_time && enabled != running) {\n"
4226 " time_offset = pc-E<gt>time_offset;\n"
4227 " time_mult = pc-E<gt>time_mult;\n"
4228 " time_shift = pc-E<gt>time_shift;\n"
4233 #: build/C/man2/perf_event_open.2:1356
4236 " idx = pc-E<gt>index;\n"
4237 " count = pc-E<gt>offset;\n"
4241 #: build/C/man2/perf_event_open.2:1361
4244 " if (pc-E<gt>cap_usr_rdpmc && idx) {\n"
4245 " width = pc-E<gt>pmc_width;\n"
4246 " count += rdpmc(idx - 1);\n"
4251 #: build/C/man2/perf_event_open.2:1364
4255 "} while (pc-E<gt>lock != seq);\n"
4259 #: build/C/man2/perf_event_open.2:1366
4261 msgid "I<cap_user_time (since Linux 3.12)>"
4265 #: build/C/man2/perf_event_open.2:1370
4267 "This bit indicates the hardware has a constant, nonstop timestamp counter "
4272 #: build/C/man2/perf_event_open.2:1370
4274 msgid "I<cap_user_time_zero> (since Linux 3.12)"
4278 #: build/C/man2/perf_event_open.2:1376
4280 "Indicates the presence of I<time_zero> which allows mapping timestamp values "
4281 "to the hardware clock."
4285 #: build/C/man2/perf_event_open.2:1376
4287 msgid "I<pmc_width>"
4291 #: build/C/man2/perf_event_open.2:1383
4293 "If I<cap_usr_rdpmc>, this field provides the bit-width of the value read "
4294 "using the rdpmc or equivalent instruction. This can be used to sign extend "
4299 #: build/C/man2/perf_event_open.2:1389
4302 "pmc E<lt>E<lt>= 64 - pmc_width;\n"
4303 "pmc E<gt>E<gt>= 64 - pmc_width; // signed shift right\n"
4308 #: build/C/man2/perf_event_open.2:1391
4310 msgid "I<time_shift>, I<time_mult>, I<time_offset>"
4314 #: build/C/man2/perf_event_open.2:1398
4316 "If I<cap_usr_time>, these fields can be used to compute the time delta since "
4317 "time_enabled (in nanoseconds) using rdtsc or similar."
4321 #: build/C/man2/perf_event_open.2:1406
4326 " quot = (cyc E<gt>E<gt> time_shift);\n"
4327 " rem = cyc & ((1 E<lt>E<lt> time_shift) - 1);\n"
4328 " delta = time_offset + quot * time_mult +\n"
4329 " ((rem * time_mult) E<gt>E<gt> time_shift);\n"
4333 #: build/C/man2/perf_event_open.2:1418
4335 "Where I<time_offset>, I<time_mult>, I<time_shift>, and I<cyc> are read in "
4336 "the seqcount loop described above. This delta can then be added to enabled "
4337 "and possible running (if idx), improving the scaling:"
4341 #: build/C/man2/perf_event_open.2:1426
4344 " enabled += delta;\n"
4346 " running += delta;\n"
4347 " quot = count / running;\n"
4348 " rem = count % running;\n"
4349 " count = quot * enabled + (rem * enabled) / running;\n"
4353 #: build/C/man2/perf_event_open.2:1427
4355 msgid "I<time_zero> (since Linux 3.12)"
4359 #: build/C/man2/perf_event_open.2:1435
4361 "If I<cap_usr_time_zero> is set, then the hardware clock (the TSC timestamp "
4362 "counter on x86) can be calculated from the I<time_zero>, I<time_mult>, and "
4363 "I<time_shift> values:"
4367 #: build/C/man2/perf_event_open.2:1441
4370 " time = timestamp - time_zero;\n"
4371 " quot = time / time_mult;\n"
4372 " rem = time % time_mult;\n"
4373 " cyc = (quot E<lt>E<lt> time_shift) + (rem E<lt>E<lt> time_shift) / "
4378 #: build/C/man2/perf_event_open.2:1444
4379 msgid "And vice versa:"
4383 #: build/C/man2/perf_event_open.2:1450
4386 " quot = cyc E<gt>E<gt> time_shift;\n"
4387 " rem = cyc & ((1 E<lt>E<lt> time_shift) - 1);\n"
4388 " timestamp = time_zero + quot * time_mult +\n"
4389 " ((rem * time_mult) E<gt>E<gt> time_shift);\n"
4393 #: build/C/man2/perf_event_open.2:1451
4395 msgid "I<data_head>"
4399 #: build/C/man2/perf_event_open.2:1457
4401 "This points to the head of the data section. The value continuously "
4402 "increases, it does not wrap. The value needs to be manually wrapped by the "
4403 "size of the mmap buffer before accessing the samples."
4407 #: build/C/man2/perf_event_open.2:1462
4409 "On SMP-capable platforms, after reading the I<data_head> value, user space "
4410 "should issue an rmb()."
4414 #: build/C/man2/perf_event_open.2:1462
4416 msgid "I<data_tail>"
4420 #: build/C/man2/perf_event_open.2:1470
4422 "When the mapping is B<PROT_WRITE>, the I<data_tail> value should be written "
4423 "by user space to reflect the last read data. In this case, the kernel will "
4424 "not overwrite unread data."
4428 #: build/C/man2/perf_event_open.2:1472
4429 msgid "The following 2^n ring-buffer pages have the layout described below."
4433 #: build/C/man2/perf_event_open.2:1486
4435 "If I<perf_event_attr.sample_id_all> is set, then all event types will have "
4436 "the sample_type selected fields related to where/when (identity) an event "
4437 "took place (TID, TIME, ID, CPU, STREAM_ID) described in "
4438 "B<PERF_RECORD_SAMPLE> below, it will be stashed just after the "
4439 "I<perf_event_header> and the fields already present for the existing fields, "
4440 "that is, at the end of the payload. That way a newer perf.data file will be "
4441 "supported by older perf tools, with these new optional fields being ignored."
4445 #: build/C/man2/perf_event_open.2:1488
4446 msgid "The mmap values start with a header:"
4450 #: build/C/man2/perf_event_open.2:1496
4453 "struct perf_event_header {\n"
4461 #: build/C/man2/perf_event_open.2:1504
4463 "Below, we describe the I<perf_event_header> fields in more detail. For ease "
4464 "of reading, the fields with shorter descriptions are presented first."
4468 #: build/C/man2/perf_event_open.2:1507
4469 msgid "This indicates the size of the record."
4473 #: build/C/man2/perf_event_open.2:1507
4479 #: build/C/man2/perf_event_open.2:1512
4480 msgid "The I<misc> field contains additional information about the sample."
4484 #: build/C/man2/perf_event_open.2:1517
4486 "The CPU mode can be determined from this value by masking with "
4487 "B<PERF_RECORD_MISC_CPUMODE_MASK> and looking for one of the following (note "
4488 "these are not bit masks, only one can be set at a time):"
4492 #: build/C/man2/perf_event_open.2:1518
4494 msgid "B<PERF_RECORD_MISC_CPUMODE_UNKNOWN>"
4498 #: build/C/man2/perf_event_open.2:1521
4499 msgid "Unknown CPU mode."
4503 #: build/C/man2/perf_event_open.2:1521
4505 msgid "B<PERF_RECORD_MISC_KERNEL>"
4509 #: build/C/man2/perf_event_open.2:1524
4510 msgid "Sample happened in the kernel."
4514 #: build/C/man2/perf_event_open.2:1524
4516 msgid "B<PERF_RECORD_MISC_USER>"
4520 #: build/C/man2/perf_event_open.2:1527
4521 msgid "Sample happened in user code."
4525 #: build/C/man2/perf_event_open.2:1527
4527 msgid "B<PERF_RECORD_MISC_HYPERVISOR>"
4531 #: build/C/man2/perf_event_open.2:1530
4532 msgid "Sample happened in the hypervisor."
4536 #: build/C/man2/perf_event_open.2:1530
4538 msgid "B<PERF_RECORD_MISC_GUEST_KERNEL>"
4542 #: build/C/man2/perf_event_open.2:1533
4543 msgid "Sample happened in the guest kernel."
4547 #: build/C/man2/perf_event_open.2:1533
4549 msgid "B<PERF_RECORD_MISC_GUEST_USER>"
4553 #: build/C/man2/perf_event_open.2:1536
4554 msgid "Sample happened in guest user code."
4558 #: build/C/man2/perf_event_open.2:1540
4559 msgid "In addition, one of the following bits can be set:"
4563 #: build/C/man2/perf_event_open.2:1540
4565 msgid "B<PERF_RECORD_MISC_MMAP_DATA>"
4569 #: build/C/man2/perf_event_open.2:1544
4571 "This is set when the mapping is not executable; otherwise the mapping is "
4576 #: build/C/man2/perf_event_open.2:1544
4578 msgid "B<PERF_RECORD_MISC_EXACT_IP>"
4582 #: build/C/man2/perf_event_open.2:1552
4584 "This indicates that the content of B<PERF_SAMPLE_IP> points to the actual "
4585 "instruction that triggered the event. See also "
4586 "I<perf_event_attr.precise_ip>."
4590 #: build/C/man2/perf_event_open.2:1552
4592 msgid "B<PERF_RECORD_MISC_EXT_RESERVED>"
4596 #: build/C/man2/perf_event_open.2:1555
4597 msgid "This indicates there is extended data available (currently not used)."
4601 #: build/C/man2/perf_event_open.2:1565
4603 "The I<type> value is one of the below. The values in the corresponding "
4604 "record (that follows the header) depend on the I<type> selected as shown."
4608 #: build/C/man2/perf_event_open.2:1567
4610 msgid "B<PERF_RECORD_MMAP>"
4614 #: build/C/man2/perf_event_open.2:1574
4616 "The MMAP events record the B<PROT_EXEC> mappings so that we can correlate "
4617 "user-space IPs to code. They have the following structure:"
4621 #: build/C/man2/perf_event_open.2:1585
4625 " struct perf_event_header header;\n"
4630 " char filename[];\n"
4635 #: build/C/man2/perf_event_open.2:1587
4637 msgid "B<PERF_RECORD_LOST>"
4641 #: build/C/man2/perf_event_open.2:1590
4642 msgid "This record indicates when events are lost."
4646 #: build/C/man2/perf_event_open.2:1599
4650 " struct perf_event_header header;\n"
4653 " struct sample_id sample_id;\n"
4658 #: build/C/man2/perf_event_open.2:1605
4659 msgid "is the unique event ID for the samples that were lost."
4663 #: build/C/man2/perf_event_open.2:1605
4669 #: build/C/man2/perf_event_open.2:1608
4670 msgid "is the number of events that were lost."
4674 #: build/C/man2/perf_event_open.2:1609
4676 msgid "B<PERF_RECORD_COMM>"
4680 #: build/C/man2/perf_event_open.2:1612
4681 msgid "This record indicates a change in the process name."
4685 #: build/C/man2/perf_event_open.2:1621
4689 " struct perf_event_header header;\n"
4692 " struct sample_id sample_id;\n"
4697 #: build/C/man2/perf_event_open.2:1623
4699 msgid "B<PERF_RECORD_EXIT>"
4703 #: build/C/man2/perf_event_open.2:1626
4704 msgid "This record indicates a process exit event."
4708 #: build/C/man2/perf_event_open.2:1636 build/C/man2/perf_event_open.2:1666
4712 " struct perf_event_header header;\n"
4716 " struct sample_id sample_id;\n"
4721 #: build/C/man2/perf_event_open.2:1638
4723 msgid "B<PERF_RECORD_THROTTLE>, B<PERF_RECORD_UNTHROTTLE>"
4727 #: build/C/man2/perf_event_open.2:1641
4728 msgid "This record indicates a throttle/unthrottle event."
4732 #: build/C/man2/perf_event_open.2:1651
4736 " struct perf_event_header header;\n"
4740 " struct sample_id sample_id;\n"
4745 #: build/C/man2/perf_event_open.2:1653
4747 msgid "B<PERF_RECORD_FORK>"
4751 #: build/C/man2/perf_event_open.2:1656
4752 msgid "This record indicates a fork event."
4756 #: build/C/man2/perf_event_open.2:1668
4758 msgid "B<PERF_RECORD_READ>"
4762 #: build/C/man2/perf_event_open.2:1671
4763 msgid "This record indicates a read event."
4767 #: build/C/man2/perf_event_open.2:1680
4771 " struct perf_event_header header;\n"
4773 " struct read_format values;\n"
4774 " struct sample_id sample_id;\n"
4779 #: build/C/man2/perf_event_open.2:1682
4781 msgid "B<PERF_RECORD_SAMPLE>"
4785 #: build/C/man2/perf_event_open.2:1685
4786 msgid "This record indicates a sample."
4790 #: build/C/man2/perf_event_open.2:1717
4794 " struct perf_event_header header;\n"
4795 " u64 sample_id; /* if PERF_SAMPLE_IDENTIFIER */\n"
4796 " u64 ip; /* if PERF_SAMPLE_IP */\n"
4797 " u32 pid, tid; /* if PERF_SAMPLE_TID */\n"
4798 " u64 time; /* if PERF_SAMPLE_TIME */\n"
4799 " u64 addr; /* if PERF_SAMPLE_ADDR */\n"
4800 " u64 id; /* if PERF_SAMPLE_ID */\n"
4801 " u64 stream_id; /* if PERF_SAMPLE_STREAM_ID */\n"
4802 " u32 cpu, res; /* if PERF_SAMPLE_CPU */\n"
4803 " u64 period; /* if PERF_SAMPLE_PERIOD */\n"
4804 " struct read_format v; /* if PERF_SAMPLE_READ */\n"
4805 " u64 nr; /* if PERF_SAMPLE_CALLCHAIN */\n"
4806 " u64 ips[nr]; /* if PERF_SAMPLE_CALLCHAIN */\n"
4807 " u32 size; /* if PERF_SAMPLE_RAW */\n"
4808 " char data[size]; /* if PERF_SAMPLE_RAW */\n"
4809 " u64 bnr; /* if PERF_SAMPLE_BRANCH_STACK */\n"
4810 " struct perf_branch_entry lbr[bnr];\n"
4811 " /* if PERF_SAMPLE_BRANCH_STACK */\n"
4812 " u64 abi; /* if PERF_SAMPLE_REGS_USER */\n"
4813 " u64 regs[weight(mask)];\n"
4814 " /* if PERF_SAMPLE_REGS_USER */\n"
4815 " u64 size; /* if PERF_SAMPLE_STACK_USER */\n"
4816 " char data[size]; /* if PERF_SAMPLE_STACK_USER */\n"
4817 " u64 dyn_size; /* if PERF_SAMPLE_STACK_USER */\n"
4818 " u64 weight; /* if PERF_SAMPLE_WEIGHT */\n"
4819 " u64 data_src; /* if PERF_SAMPLE_DATA_SRC */\n"
4820 " u64 transaction;/* if PERF_SAMPLE_TRANSACTION */\n"
4825 #: build/C/man2/perf_event_open.2:1719
4827 msgid "I<sample_id>"
4831 #: build/C/man2/perf_event_open.2:1729
4833 "If B<PERF_SAMPLE_IDENTIFIER> is enabled, a 64-bit unique ID is included. "
4834 "This is a duplication of the B<PERF_SAMPLE_ID> I<id> value, but included at "
4835 "the beginning of the sample so parsers can easily obtain the value."
4839 #: build/C/man2/perf_event_open.2:1729
4845 #: build/C/man2/perf_event_open.2:1735
4847 "If B<PERF_SAMPLE_IP> is enabled, then a 64-bit instruction pointer value is "
4852 #: build/C/man2/perf_event_open.2:1735
4854 msgid "I<pid>, I<tid>"
4858 #: build/C/man2/perf_event_open.2:1741
4860 "If B<PERF_SAMPLE_TID> is enabled, then a 32-bit process ID and 32-bit thread "
4865 #: build/C/man2/perf_event_open.2:1741
4871 #: build/C/man2/perf_event_open.2:1749
4873 "If B<PERF_SAMPLE_TIME> is enabled, then a 64-bit timestamp is included. "
4874 "This is obtained via local_clock() which is a hardware timestamp if "
4875 "available and the jiffies value if not."
4879 #: build/C/man2/perf_event_open.2:1749
4885 #: build/C/man2/perf_event_open.2:1756
4887 "If B<PERF_SAMPLE_ADDR> is enabled, then a 64-bit address is included. This "
4888 "is usually the address of a tracepoint, breakpoint, or software event; "
4889 "otherwise the value is 0."
4893 #: build/C/man2/perf_event_open.2:1764
4895 "If B<PERF_SAMPLE_ID> is enabled, a 64-bit unique ID is included. If the "
4896 "event is a member of an event group, the group leader ID is returned. This "
4897 "ID is the same as the one returned by B<PERF_FORMAT_ID>."
4901 #: build/C/man2/perf_event_open.2:1764
4903 msgid "I<stream_id>"
4907 #: build/C/man2/perf_event_open.2:1774
4909 "If B<PERF_SAMPLE_STREAM_ID> is enabled, a 64-bit unique ID is included. "
4910 "Unlike B<PERF_SAMPLE_ID> the actual ID is returned, not the group leader. "
4911 "This ID is the same as the one returned by B<PERF_FORMAT_ID>."
4915 #: build/C/man2/perf_event_open.2:1774
4917 msgid "I<cpu>, I<res>"
4921 #: build/C/man2/perf_event_open.2:1781
4923 "If B<PERF_SAMPLE_CPU> is enabled, this is a 32-bit value indicating which "
4924 "CPU was being used, in addition to a reserved (unused) 32-bit value."
4928 #: build/C/man2/perf_event_open.2:1781
4934 #: build/C/man2/perf_event_open.2:1787
4936 "If B<PERF_SAMPLE_PERIOD> is enabled, a 64-bit value indicating the current "
4937 "sampling period is written."
4941 #: build/C/man2/perf_event_open.2:1787
4947 #: build/C/man2/perf_event_open.2:1798
4949 "If B<PERF_SAMPLE_READ> is enabled, a structure of type read_format is "
4950 "included which has values for all events in the event group. The values "
4951 "included depend on the I<read_format> value used at B<perf_event_open>() "
4956 #: build/C/man2/perf_event_open.2:1798
4958 msgid "I<nr>, I<ips[nr]>"
4962 #: build/C/man2/perf_event_open.2:1806
4964 "If B<PERF_SAMPLE_CALLCHAIN> is enabled, then a 64-bit number is included "
4965 "which indicates how many following 64-bit instruction pointers will follow. "
4966 "This is the current callchain."
4970 #: build/C/man2/perf_event_open.2:1806
4972 msgid "I<size>, I<data[size]>"
4976 #: build/C/man2/perf_event_open.2:1813
4978 "If B<PERF_SAMPLE_RAW> is enabled, then a 32-bit value indicating size is "
4979 "included followed by an array of 8-bit values of length size. The values "
4980 "are padded with 0 to have 64-bit alignment."
4984 #: build/C/man2/perf_event_open.2:1818
4986 "This RAW record data is opaque with respect to the ABI. The ABI doesn't "
4987 "make any promises with respect to the stability of its content, it may vary "
4988 "depending on event, hardware, and kernel version."
4992 #: build/C/man2/perf_event_open.2:1818
4994 msgid "I<bnr>, I<lbr[bnr]>"
4998 #: build/C/man2/perf_event_open.2:1827
5000 "If B<PERF_SAMPLE_BRANCH_STACK> is enabled, then a 64-bit value indicating "
5001 "the number of records is included, followed by I<bnr> I<perf_branch_entry> "
5002 "structures which each include the fields:"
5006 #: build/C/man2/perf_event_open.2:1828
5012 #: build/C/man2/perf_event_open.2:1831
5013 msgid "This indicates the source instruction (may not be a branch)."
5017 #: build/C/man2/perf_event_open.2:1831
5023 #: build/C/man2/perf_event_open.2:1834
5024 msgid "The branch target."
5028 #: build/C/man2/perf_event_open.2:1834
5034 #: build/C/man2/perf_event_open.2:1837
5035 msgid "The branch target was mispredicted."
5039 #: build/C/man2/perf_event_open.2:1837
5041 msgid "I<predicted>"
5045 #: build/C/man2/perf_event_open.2:1840
5046 msgid "The branch target was predicted."
5050 #: build/C/man2/perf_event_open.2:1840
5052 msgid "I<in_tx> (since Linux 3.11)"
5056 #: build/C/man2/perf_event_open.2:1843
5057 msgid "The branch was in a transactional memory transaction."
5061 #: build/C/man2/perf_event_open.2:1843
5063 msgid "I<abort> (since Linux 3.11)"
5067 #: build/C/man2/perf_event_open.2:1846
5068 msgid "The branch was in an aborted transactional memory transaction."
5072 #: build/C/man2/perf_event_open.2:1850
5074 "The entries are from most to least recent, so the first entry has the most "
5079 #: build/C/man2/perf_event_open.2:1857
5081 "Support for I<mispred> and I<predicted> is optional; if not supported, both "
5086 #: build/C/man2/perf_event_open.2:1861
5088 "The type of branches recorded is specified by the I<branch_sample_type> "
5093 #: build/C/man2/perf_event_open.2:1863
5095 msgid "I<abi>, I<regs[weight(mask)]>"
5099 #: build/C/man2/perf_event_open.2:1868
5101 "If B<PERF_SAMPLE_REGS_USER> is enabled, then the user CPU registers are "
5106 #: build/C/man2/perf_event_open.2:1874
5108 "The I<abi> field is one of B<PERF_SAMPLE_REGS_ABI_NONE>, "
5109 "B<PERF_SAMPLE_REGS_ABI_32> or B<PERF_SAMPLE_REGS_ABI_64>."
5113 #: build/C/man2/perf_event_open.2:1884
5115 "The I<regs> field is an array of the CPU registers that were specified by "
5116 "the I<sample_regs_user> attr field. The number of values is the number of "
5117 "bits set in the I<sample_regs_user> bit mask."
5121 #: build/C/man2/perf_event_open.2:1884
5123 msgid "I<size>, I<data[size]>, I<dyn_size>"
5127 #: build/C/man2/perf_event_open.2:1898
5129 "If B<PERF_SAMPLE_STACK_USER> is enabled, then record the user stack to "
5130 "enable backtracing. I<size> is the size requested by the user in "
5131 "I<stack_user_size> or else the maximum record size. I<data> is the stack "
5132 "data. I<dyn_size> is the amount of data actually dumped (can be less than "
5137 #: build/C/man2/perf_event_open.2:1898
5143 #: build/C/man2/perf_event_open.2:1906
5145 "If B<PERF_SAMPLE_WEIGHT> is enabled, then a 64-bit value provided by the "
5146 "hardware is recorded that indicates how costly the event was. This allows "
5147 "expensive events to stand out more clearly in profiles."
5151 #: build/C/man2/perf_event_open.2:1906
5157 #: build/C/man2/perf_event_open.2:1912
5159 "If B<PERF_SAMPLE_DATA_SRC> is enabled, then a 64-bit value is recorded that "
5160 "is made up of the following fields:"
5164 #: build/C/man2/perf_event_open.2:1913
5170 #: build/C/man2/perf_event_open.2:1916
5171 msgid "Type of opcode, a bitwise combination of:"
5175 #: build/C/man2/perf_event_open.2:1919
5177 msgid "B<PERF_MEM_OP_NA>"
5181 #: build/C/man2/perf_event_open.2:1922 build/C/man2/perf_event_open.2:1945 build/C/man2/perf_event_open.2:1995 build/C/man2/perf_event_open.2:2018 build/C/man2/perf_event_open.2:2032
5182 msgid "Not available"
5186 #: build/C/man2/perf_event_open.2:1922
5188 msgid "B<PERF_MEM_OP_LOAD>"
5192 #: build/C/man2/perf_event_open.2:1925
5193 msgid "Load instruction"
5197 #: build/C/man2/perf_event_open.2:1925
5199 msgid "B<PERF_MEM_OP_STORE>"
5203 #: build/C/man2/perf_event_open.2:1928
5204 msgid "Store instruction"
5208 #: build/C/man2/perf_event_open.2:1928
5210 msgid "B<PERF_MEM_OP_PFETCH>"
5214 #: build/C/man2/perf_event_open.2:1931
5219 #: build/C/man2/perf_event_open.2:1931
5221 msgid "B<PERF_MEM_OP_EXEC>"
5225 #: build/C/man2/perf_event_open.2:1934
5226 msgid "Executable code"
5230 #: build/C/man2/perf_event_open.2:1936
5236 #: build/C/man2/perf_event_open.2:1939
5237 msgid "Memory hierarchy level hit or miss, a bitwise combination of:"
5241 #: build/C/man2/perf_event_open.2:1942
5243 msgid "B<PERF_MEM_LVL_NA>"
5247 #: build/C/man2/perf_event_open.2:1945
5249 msgid "B<PERF_MEM_LVL_HIT>"
5253 #: build/C/man2/perf_event_open.2:1948 build/C/man2/perf_event_open.2:2035
5258 #: build/C/man2/perf_event_open.2:1948
5260 msgid "B<PERF_MEM_LVL_MISS>"
5264 #: build/C/man2/perf_event_open.2:1951 build/C/man2/perf_event_open.2:2038
5269 #: build/C/man2/perf_event_open.2:1951
5271 msgid "B<PERF_MEM_LVL_L1>"
5275 #: build/C/man2/perf_event_open.2:1954
5276 msgid "Level 1 cache"
5280 #: build/C/man2/perf_event_open.2:1954
5282 msgid "B<PERF_MEM_LVL_LFB>"
5286 #: build/C/man2/perf_event_open.2:1957
5287 msgid "Line fill buffer"
5291 #: build/C/man2/perf_event_open.2:1957
5293 msgid "B<PERF_MEM_LVL_L2>"
5297 #: build/C/man2/perf_event_open.2:1960
5298 msgid "Level 2 cache"
5302 #: build/C/man2/perf_event_open.2:1960
5304 msgid "B<PERF_MEM_LVL_L3>"
5308 #: build/C/man2/perf_event_open.2:1963
5309 msgid "Level 3 cache"
5313 #: build/C/man2/perf_event_open.2:1963
5315 msgid "B<PERF_MEM_LVL_LOC_RAM>"
5319 #: build/C/man2/perf_event_open.2:1966
5324 #: build/C/man2/perf_event_open.2:1966
5326 msgid "B<PERF_MEM_LVL_REM_RAM1>"
5330 #: build/C/man2/perf_event_open.2:1969
5331 msgid "Remote DRAM 1 hop"
5335 #: build/C/man2/perf_event_open.2:1969
5337 msgid "B<PERF_MEM_LVL_REM_RAM2>"
5341 #: build/C/man2/perf_event_open.2:1972
5342 msgid "Remote DRAM 2 hops"
5346 #: build/C/man2/perf_event_open.2:1972
5348 msgid "B<PERF_MEM_LVL_REM_CCE1>"
5352 #: build/C/man2/perf_event_open.2:1975
5353 msgid "Remote cache 1 hop"
5357 #: build/C/man2/perf_event_open.2:1975
5359 msgid "B<PERF_MEM_LVL_REM_CCE2>"
5363 #: build/C/man2/perf_event_open.2:1978
5364 msgid "Remote cache 2 hops"
5368 #: build/C/man2/perf_event_open.2:1978
5370 msgid "B<PERF_MEM_LVL_IO>"
5374 #: build/C/man2/perf_event_open.2:1981
5379 #: build/C/man2/perf_event_open.2:1981
5381 msgid "B<PERF_MEM_LVL_UNC>"
5385 #: build/C/man2/perf_event_open.2:1984
5386 msgid "Uncached memory"
5390 #: build/C/man2/perf_event_open.2:1986
5392 msgid "I<mem_snoop>"
5396 #: build/C/man2/perf_event_open.2:1989
5397 msgid "Snoop mode, a bitwise combination of:"
5401 #: build/C/man2/perf_event_open.2:1992
5403 msgid "B<PERF_MEM_SNOOP_NA>"
5407 #: build/C/man2/perf_event_open.2:1995
5409 msgid "B<PERF_MEM_SNOOP_NONE>"
5413 #: build/C/man2/perf_event_open.2:1998
5418 #: build/C/man2/perf_event_open.2:1998
5420 msgid "B<PERF_MEM_SNOOP_HIT>"
5424 #: build/C/man2/perf_event_open.2:2001
5429 #: build/C/man2/perf_event_open.2:2001
5431 msgid "B<PERF_MEM_SNOOP_MISS>"
5435 #: build/C/man2/perf_event_open.2:2004
5440 #: build/C/man2/perf_event_open.2:2004
5442 msgid "B<PERF_MEM_SNOOP_HITM>"
5446 #: build/C/man2/perf_event_open.2:2007
5447 msgid "Snoop hit modified"
5451 #: build/C/man2/perf_event_open.2:2009
5457 #: build/C/man2/perf_event_open.2:2012
5458 msgid "Lock instruction, a bitwise combination of:"
5462 #: build/C/man2/perf_event_open.2:2015
5464 msgid "B<PERF_MEM_LOCK_NA>"
5468 #: build/C/man2/perf_event_open.2:2018
5470 msgid "B<PERF_MEM_LOCK_LOCKED>"
5474 #: build/C/man2/perf_event_open.2:2021
5475 msgid "Locked transaction"
5479 #: build/C/man2/perf_event_open.2:2023
5485 #: build/C/man2/perf_event_open.2:2026
5486 msgid "TLB access hit or miss, a bitwise combination of:"
5490 #: build/C/man2/perf_event_open.2:2029
5492 msgid "B<PERF_MEM_TLB_NA>"
5496 #: build/C/man2/perf_event_open.2:2032
5498 msgid "B<PERF_MEM_TLB_HIT>"
5502 #: build/C/man2/perf_event_open.2:2035
5504 msgid "B<PERF_MEM_TLB_MISS>"
5508 #: build/C/man2/perf_event_open.2:2038
5510 msgid "B<PERF_MEM_TLB_L1>"
5514 #: build/C/man2/perf_event_open.2:2041
5519 #: build/C/man2/perf_event_open.2:2041
5521 msgid "B<PERF_MEM_TLB_L2>"
5525 #: build/C/man2/perf_event_open.2:2044
5530 #: build/C/man2/perf_event_open.2:2044
5532 msgid "B<PERF_MEM_TLB_WK>"
5536 #: build/C/man2/perf_event_open.2:2047
5537 msgid "Hardware walker"
5541 #: build/C/man2/perf_event_open.2:2047
5543 msgid "B<PERF_MEM_TLB_OS>"
5547 #: build/C/man2/perf_event_open.2:2050
5548 msgid "OS fault handler"
5552 #: build/C/man2/perf_event_open.2:2053
5554 msgid "I<transaction>"
5558 #: build/C/man2/perf_event_open.2:2059
5560 "If the B<PERF_SAMPLE_TRANSACTION> flag is set, then a 64-bit field is "
5561 "recorded describing the sources of any transactional memory aborts."
5565 #: build/C/man2/perf_event_open.2:2061
5566 msgid "The field is a bitwise combination of the following values:"
5570 #: build/C/man2/perf_event_open.2:2062
5572 msgid "B<PERF_TXN_ELISION>"
5576 #: build/C/man2/perf_event_open.2:2065
5577 msgid "Abort from an elision type transaction (Intel-CPU-specific)."
5581 #: build/C/man2/perf_event_open.2:2065
5583 msgid "B<PERF_TXN_TRANSACTION>"
5587 #: build/C/man2/perf_event_open.2:2068
5588 msgid "Abort from a generic transaction."
5592 #: build/C/man2/perf_event_open.2:2068
5594 msgid "B<PERF_TXN_SYNC>"
5598 #: build/C/man2/perf_event_open.2:2071
5599 msgid "Synchronous abort (related to the reported instruction)."
5603 #: build/C/man2/perf_event_open.2:2071
5605 msgid "B<PERF_TXN_ASYNC>"
5609 #: build/C/man2/perf_event_open.2:2074
5610 msgid "Asynchronous abort (not related to the reported instruction)."
5614 #: build/C/man2/perf_event_open.2:2074
5616 msgid "B<PERF_TXN_RETRY>"
5620 #: build/C/man2/perf_event_open.2:2077
5621 msgid "Retryable abort (retrying the transaction may have succeeded)."
5625 #: build/C/man2/perf_event_open.2:2077
5627 msgid "B<PERF_TXN_CONFLICT>"
5631 #: build/C/man2/perf_event_open.2:2080
5632 msgid "Abort due to memory conflicts with other threads."
5636 #: build/C/man2/perf_event_open.2:2080
5638 msgid "B<PERF_TXN_CAPACITY_WRITE>"
5642 #: build/C/man2/perf_event_open.2:2083
5643 msgid "Abort due to write capacity overflow."
5647 #: build/C/man2/perf_event_open.2:2083
5649 msgid "B<PERF_TXN_CAPACITY_READ>"
5653 #: build/C/man2/perf_event_open.2:2086
5654 msgid "Abort due to read capacity overflow."
5658 #: build/C/man2/perf_event_open.2:2093
5660 "In addition, a user-specified abort code can be obtained from the high 32 "
5661 "bits of the field by shifting right by B<PERF_TXN_ABORT_SHIFT> and masking "
5662 "with B<PERF_TXN_ABORT_MASK>."
5666 #: build/C/man2/perf_event_open.2:2095
5668 msgid "Signal overflow"
5672 #: build/C/man2/perf_event_open.2:2104
5674 "Events can be set to deliver a signal when a threshold is crossed. The "
5675 "signal handler is set up using the B<poll>(2), B<select>(2), B<epoll>(2) "
5676 "and B<fcntl>(2), system calls."
5680 #: build/C/man2/perf_event_open.2:2108
5682 "To generate signals, sampling must be enabled (I<sample_period> must have a "
5687 #: build/C/man2/perf_event_open.2:2110
5688 msgid "There are two ways to generate signals."
5692 #: build/C/man2/perf_event_open.2:2120
5694 "The first is to set a I<wakeup_events> or I<wakeup_watermark> value that "
5695 "will generate a signal if a certain number of samples or bytes have been "
5696 "written to the mmap ring buffer. In this case, a signal of type B<POLL_IN> "
5701 #: build/C/man2/perf_event_open.2:2132
5703 "The other way is by use of the B<PERF_EVENT_IOC_REFRESH> ioctl. This ioctl "
5704 "adds to a counter that decrements each time the event overflows. When "
5705 "nonzero, a B<POLL_IN> signal is sent on overflow, but once the value reaches "
5706 "0, a signal is sent of type B<POLL_HUP> and the underlying event is "
5710 #. FIXME(Vince) : Find out when this was introduced
5712 #: build/C/man2/perf_event_open.2:2138
5714 "Note: on newer kernels (definitely noticed with 3.2) a signal is provided "
5715 "for every overflow, even if I<wakeup_events> is not set."
5719 #: build/C/man2/perf_event_open.2:2138
5721 msgid "rdpmc instruction"
5725 #: build/C/man2/perf_event_open.2:2145
5727 "Starting with Linux 3.4 on x86, you can use the I<rdpmc> instruction to get "
5728 "low-latency reads without having to enter the kernel. Note that using "
5729 "I<rdpmc> is not necessarily faster than other methods for reading event "
5734 #: build/C/man2/perf_event_open.2:2150
5736 "Support for this can be detected with the I<cap_usr_rdpmc> field in the mmap "
5737 "page; documentation on how to calculate event values can be found in that "
5742 #: build/C/man2/perf_event_open.2:2150
5744 msgid "perf_event ioctl calls"
5748 #: build/C/man2/perf_event_open.2:2155
5749 msgid "Various ioctls act on B<perf_event_open>() file descriptors:"
5753 #: build/C/man2/perf_event_open.2:2155
5755 msgid "B<PERF_EVENT_IOC_ENABLE>"
5759 #: build/C/man2/perf_event_open.2:2159
5761 "This enables the individual event or event group specified by the file "
5762 "descriptor argument."
5766 #: build/C/man2/perf_event_open.2:2165
5768 "If the B<PERF_IOC_FLAG_GROUP> bit is set in the ioctl argument, then all "
5769 "events in a group are enabled, even if the event specified is not the group "
5770 "leader (but see BUGS)."
5774 #: build/C/man2/perf_event_open.2:2165
5776 msgid "B<PERF_EVENT_IOC_DISABLE>"
5780 #: build/C/man2/perf_event_open.2:2169
5782 "This disables the individual counter or event group specified by the file "
5783 "descriptor argument."
5787 #: build/C/man2/perf_event_open.2:2176
5789 "Enabling or disabling the leader of a group enables or disables the entire "
5790 "group; that is, while the group leader is disabled, none of the counters in "
5791 "the group will count. Enabling or disabling a member of a group other than "
5792 "the leader affects only that counter; disabling a non-leader stops that "
5793 "counter from counting but doesn't affect any other counter."
5797 #: build/C/man2/perf_event_open.2:2182
5799 "If the B<PERF_IOC_FLAG_GROUP> bit is set in the ioctl argument, then all "
5800 "events in a group are disabled, even if the event specified is not the group "
5801 "leader (but see BUGS)."
5805 #: build/C/man2/perf_event_open.2:2182
5807 msgid "B<PERF_EVENT_IOC_REFRESH>"
5811 #: build/C/man2/perf_event_open.2:2196
5813 "Non-inherited overflow counters can use this to enable a counter for a "
5814 "number of overflows specified by the argument, after which it is disabled. "
5815 "Subsequent calls of this ioctl add the argument value to the current count. "
5816 "A signal with B<POLL_IN> set will happen on each overflow until the count "
5817 "reaches 0; when that happens a signal with POLL_HUP set is sent and the "
5818 "event is disabled. Using an argument of 0 is considered undefined behavior."
5822 #: build/C/man2/perf_event_open.2:2196
5824 msgid "B<PERF_EVENT_IOC_RESET>"
5828 #: build/C/man2/perf_event_open.2:2206
5830 "Reset the event count specified by the file descriptor argument to zero. "
5831 "This resets only the counts; there is no way to reset the multiplexing "
5832 "I<time_enabled> or I<time_running> values."
5836 #: build/C/man2/perf_event_open.2:2212
5838 "If the B<PERF_IOC_FLAG_GROUP> bit is set in the ioctl argument, then all "
5839 "events in a group are reset, even if the event specified is not the group "
5840 "leader (but see BUGS)."
5844 #: build/C/man2/perf_event_open.2:2212
5846 msgid "B<PERF_EVENT_IOC_PERIOD>"
5850 #: build/C/man2/perf_event_open.2:2215
5851 msgid "This updates the overflow period for the event."
5855 #: build/C/man2/perf_event_open.2:2220
5857 "Since Linux 3.7 (on ARM) and Linux 3.14 (all other architectures), the new "
5858 "period takes effect immediately. On older kernels, the new period did not "
5859 "take effect until after the next overflow."
5863 #: build/C/man2/perf_event_open.2:2223
5865 "The argument is a pointer to a 64-bit value containing the desired new "
5870 #: build/C/man2/perf_event_open.2:2226
5871 msgid "Prior to Linux 2.6.36 this ioctl always failed due to a bug in the kernel."
5875 #: build/C/man2/perf_event_open.2:2227
5877 msgid "B<PERF_EVENT_IOC_SET_OUTPUT>"
5881 #: build/C/man2/perf_event_open.2:2232
5883 "This tells the kernel to report event notifications to the specified file "
5884 "descriptor rather than the default one. The file descriptors must all be on "
5889 #: build/C/man2/perf_event_open.2:2235
5891 "The argument specifies the desired file descriptor, or -1 if output should "
5896 #: build/C/man2/perf_event_open.2:2235
5898 msgid "B<PERF_EVENT_IOC_SET_FILTER> (since Linux 2.6.33)"
5902 #: build/C/man2/perf_event_open.2:2238
5903 msgid "This adds an ftrace filter to this event."
5907 #: build/C/man2/perf_event_open.2:2240
5908 msgid "The argument is a pointer to the desired ftrace filter."
5912 #: build/C/man2/perf_event_open.2:2240
5914 msgid "B<PERF_EVENT_IOC_ID> (since Linux 3.12)"
5918 #: build/C/man2/perf_event_open.2:2243
5919 msgid "This returns the event ID value for the given event file descriptor."
5923 #: build/C/man2/perf_event_open.2:2246
5924 msgid "The argument is a pointer to a 64-bit unsigned integer to hold the result."
5928 #: build/C/man2/perf_event_open.2:2246
5934 #: build/C/man2/perf_event_open.2:2259
5936 "A process can enable or disable all the event groups that are attached to it "
5937 "using the B<prctl>(2) B<PR_TASK_PERF_EVENTS_ENABLE> and "
5938 "B<PR_TASK_PERF_EVENTS_DISABLE> operations. This applies to all counters on "
5939 "the calling process, whether created by this process or by another, and does "
5940 "not affect any counters that this process has created on other processes. "
5941 "It enables or disables only the group leaders, not any other members in the "
5946 #: build/C/man2/perf_event_open.2:2259
5948 msgid "perf_event related configuration files"
5952 #: build/C/man2/perf_event_open.2:2262
5953 msgid "Files in I</proc/sys/kernel/>"
5957 #: build/C/man2/perf_event_open.2:2263
5959 msgid "I</proc/sys/kernel/perf_event_paranoid>"
5963 #: build/C/man2/perf_event_open.2:2269
5965 "The I<perf_event_paranoid> file can be set to restrict access to the "
5966 "performance counters."
5970 #: build/C/man2/perf_event_open.2:2270
5976 #: build/C/man2/perf_event_open.2:2272
5977 msgid "only allow user-space measurements."
5981 #: build/C/man2/perf_event_open.2:2272
5987 #: build/C/man2/perf_event_open.2:2274
5988 msgid "allow both kernel and user measurements (default)."
5992 #: build/C/man2/perf_event_open.2:2274
5998 #: build/C/man2/perf_event_open.2:2276
5999 msgid "allow access to CPU-specific data but not raw tracepoint samples."
6003 #: build/C/man2/perf_event_open.2:2276
6009 #: build/C/man2/perf_event_open.2:2278
6010 msgid "no restrictions."
6014 #: build/C/man2/perf_event_open.2:2284
6016 "The existence of the I<perf_event_paranoid> file is the official method for "
6017 "determining if a kernel supports B<perf_event_open>()."
6021 #: build/C/man2/perf_event_open.2:2284
6023 msgid "I</proc/sys/kernel/perf_event_max_sample_rate>"
6027 #: build/C/man2/perf_event_open.2:2293
6029 "This sets the maximum sample rate. Setting this too high can allow users to "
6030 "sample at a rate that impacts overall machine performance and potentially "
6031 "lock up the machine. The default value is 100000 (samples per second)."
6035 #: build/C/man2/perf_event_open.2:2293
6037 msgid "I</proc/sys/kernel/perf_event_mlock_kb>"
6041 #: build/C/man2/perf_event_open.2:2299
6043 "Maximum number of pages an unprivileged user can B<mlock>(2). The default "
6048 #: build/C/man2/perf_event_open.2:2303
6049 msgid "Files in I</sys/bus/event_source/devices/>"
6053 #: build/C/man2/perf_event_open.2:2309
6055 "Since Linux 2.6.34, the kernel supports having multiple PMUs available for "
6056 "monitoring. Information on how to program these PMUs can be found under "
6057 "I</sys/bus/event_source/devices/>. Each subdirectory corresponds to a "
6062 #: build/C/man2/perf_event_open.2:2309
6064 msgid "I</sys/bus/event_source/devices/*/type> (since Linux 2.6.38)"
6068 #: build/C/man2/perf_event_open.2:2316
6070 "This contains an integer that can be used in the I<type> field of "
6071 "I<perf_event_attr> to indicate that you wish to use this PMU."
6075 #: build/C/man2/perf_event_open.2:2316
6077 msgid "I</sys/bus/event_source/devices/*/rdpmc> (since Linux 3.4)"
6081 #: build/C/man2/perf_event_open.2:2321
6083 "If this file is 1, then direct user-space access to the performance counter "
6084 "registers is allowed via the rdpmc instruction. This can be disabled by "
6085 "echoing 0 to the file."
6089 #: build/C/man2/perf_event_open.2:2321
6091 msgid "I</sys/bus/event_source/devices/*/format/> (since Linux 3.4)"
6095 #: build/C/man2/perf_event_open.2:2329
6097 "This subdirectory contains information on the architecture-specific "
6098 "subfields available for programming the various I<config> fields in the "
6099 "I<perf_event_attr> struct."
6103 #: build/C/man2/perf_event_open.2:2340
6105 "The content of each file is the name of the config field, followed by a "
6106 "colon, followed by a series of integer bit ranges separated by commas. For "
6107 "example, the file I<event> may contain the value I<config1:1,6-10,44> which "
6108 "indicates that event is an attribute that occupies bits 1,6-10, and 44 of "
6109 "I<perf_event_attr::config1>."
6113 #: build/C/man2/perf_event_open.2:2340
6115 msgid "I</sys/bus/event_source/devices/*/events/> (since Linux 3.4)"
6119 #: build/C/man2/perf_event_open.2:2349
6121 "This subdirectory contains files with predefined events. The contents are "
6122 "strings describing the event settings expressed in terms of the fields found "
6123 "in the previously mentioned I<./format/> directory. These are not "
6124 "necessarily complete lists of all events supported by a PMU, but usually a "
6125 "subset of events deemed useful or interesting."
6129 #: build/C/man2/perf_event_open.2:2357
6131 "The content of each file is a list of attribute names separated by commas. "
6132 "Each entry has an optional value (either hex or decimal). If no value is "
6133 "specified, then it is assumed to be a single-bit field with a value of 1. "
6134 "An example entry may look like this: I<event=0x2,inv,ldlat=3>."
6138 #: build/C/man2/perf_event_open.2:2357
6140 msgid "I</sys/bus/event_source/devices/*/uevent>"
6144 #: build/C/man2/perf_event_open.2:2361
6146 "This file is the standard kernel device interface for injecting hotplug "
6151 #: build/C/man2/perf_event_open.2:2361
6153 msgid "I</sys/bus/event_source/devices/*/cpumask> (since Linux 3.7)"
6157 #: build/C/man2/perf_event_open.2:2370
6159 "The I<cpumask> file contains a comma-separated list of integers that "
6160 "indicate a representative CPU number for each socket (package) on the "
6161 "motherboard. This is needed when setting up uncore or northbridge events, "
6162 "as those PMUs present socket-wide events."
6166 #: build/C/man2/perf_event_open.2:2377
6168 "B<perf_event_open>() returns the new file descriptor, or -1 if an error "
6169 "occurred (in which case, I<errno> is set appropriately)."
6173 #: build/C/man2/perf_event_open.2:2382
6175 "The errors returned by B<perf_event_open>() can be inconsistent, and may "
6176 "vary across processor architectures and performance monitoring units."
6180 #: build/C/man2/perf_event_open.2:2382
6186 #: build/C/man2/perf_event_open.2:2399
6188 "Returned if the I<perf_event_attr> I<size> value is too small (smaller than "
6189 "B<PERF_ATTR_SIZE_VER0>), too big (larger than the page size), or larger than "
6190 "the kernel supports and the extra bytes are not zero. When B<E2BIG> is "
6191 "returned, the I<perf_event_attr> I<size> field is overwritten by the kernel "
6192 "to be the size of the structure it was expecting."
6196 #: build/C/man2/perf_event_open.2:2413
6198 "Returned when the requested event requires B<CAP_SYS_ADMIN> permissions (or "
6199 "a more permissive perf_event paranoid setting). Some common cases where an "
6200 "unprivileged process may encounter this error: attaching to a process owned "
6201 "by a different user; monitoring all processes on a given CPU (i.e., "
6202 "specifying the I<pid> argument as -1); and not setting I<exclude_kernel> "
6203 "when the paranoid setting requires it."
6207 #: build/C/man2/perf_event_open.2:2413 build/C/man2/sendfile.2:121 build/C/man2/splice.2:143 build/C/man2/vmsplice.2:123
6213 #: build/C/man2/perf_event_open.2:2423
6215 "Returned if the I<group_fd> file descriptor is not valid, or, if "
6216 "B<PERF_FLAG_PID_CGROUP> is set, the cgroup file descriptor in I<pid> is not "
6221 #: build/C/man2/perf_event_open.2:2428
6222 msgid "Returned if the I<attr> pointer points at an invalid memory address."
6226 #: build/C/man2/perf_event_open.2:2454
6228 "Returned if the specified event is invalid. There are many possible reasons "
6229 "for this. A not-exhaustive list: I<sample_freq> is higher than the maximum "
6230 "setting; the I<cpu> to monitor does not exist; I<read_format> is out of "
6231 "range; I<sample_type> is out of range; the I<flags> value is out of range; "
6232 "I<exclusive> or I<pinned> set and the event is not a group leader; the event "
6233 "I<config> values are out of range or set reserved bits; the generic event "
6234 "selected is not supported; or there is not enough room to add the selected "
6239 #: build/C/man2/perf_event_open.2:2454
6245 #: build/C/man2/perf_event_open.2:2460
6247 "Each opened event uses one file descriptor. If a large number of events are "
6248 "opened the per-user file descriptor limit (often 1024) will be hit and no "
6249 "more events can be created."
6253 #: build/C/man2/perf_event_open.2:2464
6254 msgid "Returned when the event involves a feature not supported by the current CPU."
6258 #: build/C/man2/perf_event_open.2:2464 build/C/man2/quotactl.2:440
6264 #: build/C/man2/perf_event_open.2:2471
6266 "Returned if the I<type> setting is not valid. This error is also returned "
6267 "for some unsupported generic events."
6271 #: build/C/man2/perf_event_open.2:2471
6277 #: build/C/man2/perf_event_open.2:2481
6279 "Prior to Linux 3.3, if there was not enough room for the event, B<ENOSPC> "
6280 "was returned. In Linux 3.3, this was changed to B<EINVAL>. B<ENOSPC> is "
6281 "still returned if you try to add more breakpoint events than supported by "
6286 #: build/C/man2/perf_event_open.2:2488
6288 "Returned if B<PERF_SAMPLE_STACK_USER> is set in I<sample_type> and it is not "
6289 "supported by hardware."
6293 #: build/C/man2/perf_event_open.2:2495
6295 "Returned if an event requiring a specific hardware feature is requested but "
6296 "there is no hardware support. This includes requesting low-skid events if "
6297 "not supported, branch tracing if it is not available, sampling if no PMU "
6298 "interrupt is available, and branch stacks for software events."
6302 #: build/C/man2/perf_event_open.2:2500
6304 "Returned on many (but not all) architectures when an unsupported "
6305 "I<exclude_hv>, I<exclude_idle>, I<exclude_user>, or I<exclude_kernel> "
6306 "setting is specified."
6310 #: build/C/man2/perf_event_open.2:2508
6312 "It can also happen, as with B<EACCES>, when the requested event requires "
6313 "B<CAP_SYS_ADMIN> permissions (or a more permissive perf_event paranoid "
6314 "setting). This includes setting a breakpoint on a kernel address, and "
6315 "(since Linux 3.13) setting a kernel function-trace tracepoint."
6319 #: build/C/man2/perf_event_open.2:2511
6320 msgid "Returned if attempting to attach to a process that does not exist."
6324 #: build/C/man2/perf_event_open.2:2511
6330 #: build/C/man2/perf_event_open.2:2516
6332 "B<perf_event_open>() was introduced in Linux 2.6.31 but was called "
6333 "B<perf_counter_open>(). It was renamed in Linux 2.6.32."
6337 #: build/C/man2/perf_event_open.2:2521
6339 "This B<perf_event_open>() system call Linux- specific and should not be "
6340 "used in programs intended to be portable."
6344 #: build/C/man2/perf_event_open.2:2525
6346 "Glibc does not provide a wrapper for this system call; call it using "
6347 "B<syscall>(2). See the example below."
6351 #: build/C/man2/perf_event_open.2:2531
6353 "The official way of knowing if B<perf_event_open>() support is enabled is "
6354 "checking for the existence of the file "
6355 "I</proc/sys/kernel/perf_event_paranoid>."
6359 #: build/C/man2/perf_event_open.2:2531 build/C/man2/pivot_root.2:134 build/C/man2/ptrace.2:1963
6365 #: build/C/man2/perf_event_open.2:2538
6367 "The B<F_SETOWN_EX> option to B<fcntl>(2) is needed to properly get overflow "
6368 "signals in threads. This was introduced in Linux 2.6.32."
6372 #: build/C/man2/perf_event_open.2:2546
6374 "Prior to Linux 2.6.33 (at least for x86), the kernel did not check if events "
6375 "could be scheduled together until read time. The same happens on all known "
6376 "kernels if the NMI watchdog is enabled. This means to see if a given set of "
6377 "events works you have to B<perf_event_open>(), start, then read before you "
6378 "know for sure you can get valid measurements."
6382 #: build/C/man2/perf_event_open.2:2550
6384 "Prior to Linux 2.6.34, event constraints were not enforced by the kernel. "
6385 "In that case, some events would silently return \"0\" if the kernel "
6386 "scheduled them in an improper counter slot."
6390 #: build/C/man2/perf_event_open.2:2553
6392 "Prior to Linux 2.6.34, there was a bug when multiplexing where the wrong "
6393 "results could be returned."
6397 #: build/C/man2/perf_event_open.2:2556
6399 "Kernels from Linux 2.6.35 to Linux 2.6.39 can quickly crash the kernel if "
6400 "\"inherit\" is enabled and many threads are started."
6404 #: build/C/man2/perf_event_open.2:2560
6406 "Prior to Linux 2.6.35, B<PERF_FORMAT_GROUP> did not work with attached "
6411 #: build/C/man2/perf_event_open.2:2565
6413 "In older Linux 2.6 versions, refreshing an event group leader refreshed all "
6414 "siblings, and refreshing with a parameter of 0 enabled infinite refresh. "
6415 "This behavior is unsupported and should not be relied on."
6419 #: build/C/man2/perf_event_open.2:2571
6421 "There is a bug in the kernel code between Linux 2.6.36 and Linux 3.0 that "
6422 "ignores the \"watermark\" field and acts as if a wakeup_event was chosen if "
6423 "the union has a nonzero value in it."
6427 #: build/C/man2/perf_event_open.2:2577
6429 "From Linux 2.6.31 to Linux 3.4, the B<PERF_IOC_FLAG_GROUP> ioctl argument "
6430 "was broken and would repeatedly operate on the event specified rather than "
6431 "iterating across all sibling events in a group."
6435 #: build/C/man2/perf_event_open.2:2588
6437 "From Linux 3.4 to Linux 3.11, the mmap I<cap_usr_rdpmc> and I<cap_usr_time> "
6438 "bits mapped to the same location. Code should migrate to the new "
6439 "I<cap_user_rdpmc> and I<cap_user_time> fields instead."
6443 #: build/C/man2/perf_event_open.2:2593
6445 "Always double-check your results! Various generalized events have had wrong "
6446 "values. For example, retired branches measured the wrong thing on AMD "
6447 "machines until Linux 2.6.35."
6451 #: build/C/man2/perf_event_open.2:2593 build/C/man2/process_vm_readv.2:311 build/C/man2/splice.2:223 build/C/man2/tee.2:130
6457 #: build/C/man2/perf_event_open.2:2597
6459 "The following is a short example that measures the total instruction count "
6460 "of a call to B<printf>(3)."
6464 #: build/C/man2/perf_event_open.2:2606
6467 "#include E<lt>stdlib.hE<gt>\n"
6468 "#include E<lt>stdio.hE<gt>\n"
6469 "#include E<lt>unistd.hE<gt>\n"
6470 "#include E<lt>string.hE<gt>\n"
6471 "#include E<lt>sys/ioctl.hE<gt>\n"
6472 "#include E<lt>linux/perf_event.hE<gt>\n"
6473 "#include E<lt>asm/unistd.hE<gt>\n"
6477 #: build/C/man2/perf_event_open.2:2612
6481 "perf_event_open(struct perf_event_attr *hw_event, pid_t pid,\n"
6482 " int cpu, int group_fd, unsigned long flags)\n"
6488 #: build/C/man2/perf_event_open.2:2617
6491 " ret = syscall(__NR_perf_event_open, hw_event, pid, cpu,\n"
6492 " group_fd, flags);\n"
6498 #: build/C/man2/perf_event_open.2:2624
6502 "main(int argc, char **argv)\n"
6504 " struct perf_event_attr pe;\n"
6505 " long long count;\n"
6510 #: build/C/man2/perf_event_open.2:2632
6513 " memset(&pe, 0, sizeof(struct perf_event_attr));\n"
6514 " pe.type = PERF_TYPE_HARDWARE;\n"
6515 " pe.size = sizeof(struct perf_event_attr);\n"
6516 " pe.config = PERF_COUNT_HW_INSTRUCTIONS;\n"
6517 " pe.disabled = 1;\n"
6518 " pe.exclude_kernel = 1;\n"
6519 " pe.exclude_hv = 1;\n"
6523 #: build/C/man2/perf_event_open.2:2638
6526 " fd = perf_event_open(&pe, 0, -1, -1, 0);\n"
6527 " if (fd == -1) {\n"
6528 " fprintf(stderr, \"Error opening leader %llx\\en\", pe.config);\n"
6529 " exit(EXIT_FAILURE);\n"
6534 #: build/C/man2/perf_event_open.2:2641
6537 " ioctl(fd, PERF_EVENT_IOC_RESET, 0);\n"
6538 " ioctl(fd, PERF_EVENT_IOC_ENABLE, 0);\n"
6542 #: build/C/man2/perf_event_open.2:2643
6544 msgid " printf(\"Measuring instruction count for this printf\\en\");\n"
6548 #: build/C/man2/perf_event_open.2:2646
6551 " ioctl(fd, PERF_EVENT_IOC_DISABLE, 0);\n"
6552 " read(fd, &count, sizeof(long long));\n"
6556 #: build/C/man2/perf_event_open.2:2648
6558 msgid " printf(\"Used %lld instructions\\en\", count);\n"
6562 #: build/C/man2/perf_event_open.2:2651
6570 #: build/C/man2/perf_event_open.2:2658
6571 msgid "B<fcntl>(2), B<mmap>(2), B<open>(2), B<prctl>(2), B<read>(2)"
6575 #: build/C/man2/perfmonctl.2:27
6581 #: build/C/man2/perfmonctl.2:30
6582 msgid "perfmonctl - interface to IA-64 performance monitoring unit"
6586 #: build/C/man2/perfmonctl.2:34
6589 "B<#include E<lt>syscall.hE<gt>>\n"
6590 "B<#include E<lt>perfmon.hE<gt>>\n"
6594 #: build/C/man2/perfmonctl.2:36
6597 "B<long perfmonctl(int >I<fd>B<, int >I<cmd>B<, void *>I<arg>B<, int "
6602 #: build/C/man2/perfmonctl.2:47
6604 "The IA-64-specific B<perfmonctl>() system call provides an interface to the "
6605 "PMU (performance monitoring unit). The PMU consists of PMD (performance "
6606 "monitoring data) registers and PMC (performance monitoring control) "
6607 "registers, which gather hardware statistics."
6611 #: build/C/man2/perfmonctl.2:57
6613 "B<perfmonctl>() applies the operation I<cmd> to the input arguments "
6614 "specified by I<arg>. The number of arguments is defined by I<narg>. The "
6615 "I<fd> argument specifies the perfmon context to operate on."
6619 #: build/C/man2/perfmonctl.2:61
6620 msgid "Supported values for I<cmd> are:"
6624 #: build/C/man2/perfmonctl.2:61
6626 msgid "B<PFM_CREATE_CONTEXT>"
6630 #: build/C/man2/perfmonctl.2:65
6633 "B<perfmonctl(int >I<fd>B<, PFM_CREATE_CONTEXT, pfarg_context_t *>I<ctxt>B<, "
6638 #: build/C/man2/perfmonctl.2:67
6639 msgid "Set up a context."
6643 #: build/C/man2/perfmonctl.2:74
6645 "The I<fd> parameter is ignored. A new perfmon context is created as "
6646 "specified in I<ctxt> and its file descriptor is returned in "
6647 "I<ctxt-E<gt>ctx_fd>."
6651 #: build/C/man2/perfmonctl.2:86
6653 "The file descriptor can be used in subsequent calls to B<perfmonctl>() and "
6654 "can be used to read event notifications (type I<pfm_msg_t>) using "
6655 "B<read>(2). The file descriptor is pollable using B<select>(2), B<poll>(2), "
6660 #: build/C/man2/perfmonctl.2:90
6661 msgid "The context can be destroyed by calling B<close>(2) on the file descriptor."
6665 #: build/C/man2/perfmonctl.2:90
6667 msgid "B<PFM_WRITE_PMCS>"
6671 #: build/C/man2/perfmonctl.2:95
6673 msgid "B<perfmonctl(int >I<fd>B<, PFM_WRITE_PMCS, pfarg_reg_t *>I<pmcs>B<, n);>\n"
6677 #: build/C/man2/perfmonctl.2:97
6678 msgid "Set PMC registers."
6682 #: build/C/man2/perfmonctl.2:97
6684 msgid "B<PFM_WRITE_PMDS>"
6688 #: build/C/man2/perfmonctl.2:101
6690 msgid "B<perfmonctl(int >I<fd>B<, PFM_WRITE_PMDS, pfarg_reg_t *>I<pmds>B<, n);>\n"
6695 #: build/C/man2/perfmonctl.2:104
6696 msgid "Set PMD registers."
6700 #: build/C/man2/perfmonctl.2:104
6702 msgid "B<PFM_READ_PMDS>"
6706 #: build/C/man2/perfmonctl.2:109
6708 msgid "B<perfmonctl(int >I<fd>B<, PFM_READ_PMDS, pfarg_reg_t *>I<pmds>B<, n);>\n"
6712 #: build/C/man2/perfmonctl.2:111
6713 msgid "Read PMD registers."
6717 #: build/C/man2/perfmonctl.2:111
6719 msgid "B<PFM_START>"
6722 #. .BI "perfmonctl(int " fd ", PFM_START, arg, 1);
6724 #: build/C/man2/perfmonctl.2:117
6726 msgid "B<perfmonctl(int >I<fd>B<, PFM_START, NULL, 0);>\n"
6730 #: build/C/man2/perfmonctl.2:119
6731 msgid "Start monitoring."
6735 #: build/C/man2/perfmonctl.2:119
6741 #: build/C/man2/perfmonctl.2:124
6743 msgid "B<perfmonctl(int >I<fd>B<, PFM_STOP, NULL, 0);>\n"
6747 #: build/C/man2/perfmonctl.2:126
6748 msgid "Stop monitoring."
6752 #: build/C/man2/perfmonctl.2:126
6754 msgid "B<PFM_LOAD_CONTEXT>"
6758 #: build/C/man2/perfmonctl.2:131
6761 "B<perfmonctl(int >I<fd>B<, PFM_LOAD_CONTEXT, pfarg_load_t *>I<largs>B<, "
6766 #: build/C/man2/perfmonctl.2:133
6767 msgid "Attach the context to a thread."
6771 #: build/C/man2/perfmonctl.2:133
6773 msgid "B<PFM_UNLOAD_CONTEXT>"
6777 #: build/C/man2/perfmonctl.2:138
6779 msgid "B<perfmonctl(int >I<fd>B<, PFM_UNLOAD_CONTEXT, NULL, 0);>\n"
6783 #: build/C/man2/perfmonctl.2:140
6784 msgid "Detach the context from a thread."
6788 #: build/C/man2/perfmonctl.2:140
6790 msgid "B<PFM_RESTART>"
6794 #: build/C/man2/perfmonctl.2:145
6796 msgid "B<perfmonctl(int >I<fd>B<, PFM_RESTART, NULL, 0);>\n"
6800 #: build/C/man2/perfmonctl.2:147
6801 msgid "Restart monitoring after receiving an overflow notification."
6805 #: build/C/man2/perfmonctl.2:147
6807 msgid "B<PFM_GET_FEATURES>"
6811 #: build/C/man2/perfmonctl.2:152
6814 "B<perfmonctl(int >I<fd>B<, PFM_GET_FEARURES, pfarg_features_t *>I<arg>B<, "
6819 #: build/C/man2/perfmonctl.2:153
6821 msgid "B<PFM_DEBUG>"
6825 #: build/C/man2/perfmonctl.2:158
6827 msgid "B<perfmonctl(int >I<fd>B<, PFM_DEBUG, >I<val>B<, 0);>\n"
6831 #: build/C/man2/perfmonctl.2:162
6832 msgid "If I<val> is nonzero, enable debugging mode, otherwise disable."
6836 #: build/C/man2/perfmonctl.2:162
6838 msgid "B<PFM_GET_PMC_RESET_VAL>"
6842 #: build/C/man2/perfmonctl.2:167
6845 "B<perfmonctl(int >I<fd>B<, PFM_GET_PMC_RESET_VAL, pfarg_reg_t * >I<req>B<, "
6852 #. .B PFM_CREATE_EVTSETS
6854 #. create or modify event sets
6856 #. .BI "perfmonctl(int " fd ", PFM_CREATE_EVTSETS, pfarg_setdesc_t *desc , n);
6859 #. .B PFM_DELETE_EVTSETS
6860 #. delete event sets
6862 #. .BI "perfmonctl(int " fd ", PFM_DELETE_EVTSET, pfarg_setdesc_t *desc , n);
6865 #. .B PFM_GETINFO_EVTSETS
6866 #. get information about event sets
6868 #. .BI "perfmonctl(int " fd ", PFM_GETINFO_EVTSETS, pfarg_setinfo_t *info, n);
6871 #: build/C/man2/perfmonctl.2:190
6872 msgid "Reset PMC registers to default values."
6876 #: build/C/man2/perfmonctl.2:196
6878 "B<perfmonctl>() returns zero when the operation is successful. On error, "
6879 "-1 is returned and I<errno> is set to indicate the cause of the error."
6883 #: build/C/man2/perfmonctl.2:199
6884 msgid "B<perfmonctl>() is available since Linux 2.4."
6888 #: build/C/man2/perfmonctl.2:202
6890 "B<perfmonctl>() is Linux-specific and is available only on the IA-64 "
6895 #: build/C/man2/perfmonctl.2:207
6900 #: build/C/man2/perfmonctl.2:209
6901 msgid "The perfmon2 interface specification"
6905 #: build/C/man2/personality.2:32
6911 #: build/C/man2/personality.2:32
6917 #: build/C/man2/personality.2:35
6918 msgid "personality - set the process execution domain"
6922 #: build/C/man2/personality.2:37
6923 msgid "B<#include E<lt>sys/personality.hE<gt>>"
6927 #: build/C/man2/personality.2:39
6928 msgid "B<int personality(unsigned long >I<persona>B<);>"
6932 #: build/C/man2/personality.2:47
6934 "Linux supports different execution domains, or personalities, for each "
6935 "process. Among other things, execution domains tell Linux how to map signal "
6936 "numbers into signal actions. The execution domain system allows Linux to "
6937 "provide limited support for binaries compiled under other UNIX-like "
6938 "operating systems."
6942 #: build/C/man2/personality.2:59
6944 "If I<persona> is not 0xffffffff, then B<personality>() sets the caller's "
6945 "execution domain to the value specified by I<persona>. Specifying "
6946 "I<persona> as 0xffffffff provides a way of retrieving the current persona "
6947 "without changing it."
6951 #: build/C/man2/personality.2:62
6953 "A list of the available execution domains can be found in "
6954 "I<E<lt>sys/personality.hE<gt>>."
6958 #: build/C/man2/personality.2:69
6960 "On success, the previous I<persona> is returned. On error, -1 is returned, "
6961 "and I<errno> is set appropriately."
6965 #: build/C/man2/personality.2:73
6966 msgid "The kernel was unable to change the personality."
6970 #: build/C/man2/personality.2:77
6972 "B<personality>() is Linux-specific and should not be used in programs "
6973 "intended to be portable."
6977 #: build/C/man2/pivot_root.2:10
6983 #: build/C/man2/pivot_root.2:13
6984 msgid "pivot_root - change the root filesystem"
6988 #: build/C/man2/pivot_root.2:15
6989 msgid "B<int pivot_root(const char *>I<new_root>B<, const char *>I<put_old>B<);>"
6995 #. capability is required.
6997 #: build/C/man2/pivot_root.2:27
6999 "B<pivot_root>() moves the root filesystem of the calling process to the "
7000 "directory I<put_old> and makes I<new_root> the new root filesystem of the "
7005 #: build/C/man2/pivot_root.2:34
7007 "The typical use of B<pivot_root>() is during system startup, when the "
7008 "system mounts a temporary root filesystem (e.g., an B<initrd>), then mounts "
7009 "the real root filesystem, and eventually turns the latter into the current "
7010 "root of all relevant processes or threads."
7014 #: build/C/man2/pivot_root.2:46
7016 "B<pivot_root>() may or may not change the current root and the current "
7017 "working directory of any processes or threads which use the old root "
7018 "directory. The caller of B<pivot_root>() must ensure that processes with "
7019 "root or current working directory at the old root operate correctly in "
7020 "either case. An easy way to ensure this is to change their root and current "
7021 "working directory to I<new_root> before invoking B<pivot_root>()."
7025 #: build/C/man2/pivot_root.2:64
7027 "The paragraph above is intentionally vague because the implementation of "
7028 "B<pivot_root>() may change in the future. At the time of writing, "
7029 "B<pivot_root>() changes root and current working directory of each process "
7030 "or thread to I<new_root> if they point to the old root directory. This is "
7031 "necessary in order to prevent kernel threads from keeping the old root "
7032 "directory busy with their root and current working directory, even if they "
7033 "never access the filesystem in any way. In the future, there may be a "
7034 "mechanism for kernel threads to explicitly relinquish any access to the "
7035 "filesystem, such that this fairly intrusive mechanism can be removed from "
7040 #: build/C/man2/pivot_root.2:72
7042 "Note that this also applies to the calling process: B<pivot_root>() may or "
7043 "may not affect its current working directory. It is therefore recommended "
7044 "to call B<chdir(\"/\")> immediately after B<pivot_root>()."
7048 #: build/C/man2/pivot_root.2:74
7049 msgid "The following restrictions apply to I<new_root> and I<put_old>:"
7053 #: 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
7059 #: build/C/man2/pivot_root.2:76
7060 msgid "They must be directories."
7064 #: build/C/man2/pivot_root.2:79
7066 "I<new_root> and I<put_old> must not be on the same filesystem as the current "
7071 #: build/C/man2/pivot_root.2:83
7073 "I<put_old> must be underneath I<new_root>, that is, adding a nonzero number "
7074 "of I</..> to the string pointed to by I<put_old> must yield the same "
7075 "directory as I<new_root>."
7079 #: build/C/man2/pivot_root.2:85
7080 msgid "No other filesystem may be mounted on I<put_old>."
7084 #: build/C/man2/pivot_root.2:89
7085 msgid "See also B<pivot_root>(8) for additional usage examples."
7089 #: build/C/man2/pivot_root.2:96
7091 "If the current root is not a mount point (e.g., after B<chroot>(2) or "
7092 "B<pivot_root>(), see also below), not the old root directory, but the mount "
7093 "point of that filesystem is mounted on I<put_old>."
7097 #: build/C/man2/pivot_root.2:101
7099 "I<new_root> does not have to be a mount point. In this case, "
7100 "I</proc/mounts> will show the mount point of the filesystem containing "
7101 "I<new_root> as root (I</>)."
7105 #: build/C/man2/pivot_root.2:110
7107 "B<pivot_root>() may return (in I<errno>) any of the errors returned by "
7108 "B<stat>(2). Additionally, it may return:"
7112 #: build/C/man2/pivot_root.2:114
7114 "I<new_root> or I<put_old> are on the current root filesystem, or a "
7115 "filesystem is already mounted on I<put_old>."
7119 #: build/C/man2/pivot_root.2:117
7120 msgid "I<put_old> is not underneath I<new_root>."
7124 #: build/C/man2/pivot_root.2:117
7130 #: build/C/man2/pivot_root.2:120
7131 msgid "I<new_root> or I<put_old> is not a directory."
7135 #: build/C/man2/pivot_root.2:125
7136 msgid "The calling process does not have the B<CAP_SYS_ADMIN> capability."
7140 #: build/C/man2/pivot_root.2:128
7141 msgid "B<pivot_root>() was introduced in Linux 2.3.41."
7145 #: build/C/man2/pivot_root.2:131
7146 msgid "B<pivot_root>() is Linux-specific and hence is not portable."
7150 #: build/C/man2/pivot_root.2:138
7152 "B<pivot_root>() should not have to change root and current working "
7153 "directory of all other processes in the system."
7157 #: build/C/man2/pivot_root.2:143
7159 "Some of the more obscure uses of B<pivot_root>() may quickly lead to "
7164 #: build/C/man2/pivot_root.2:149
7165 msgid "B<chdir>(2), B<chroot>(2), B<stat>(2), B<initrd>(4), B<pivot_root>(8)"
7169 #: build/C/man2/process_vm_readv.2:29
7171 msgid "PROCESS_VM_READV"
7175 #: build/C/man2/process_vm_readv.2:29
7181 #: build/C/man2/process_vm_readv.2:32
7183 "process_vm_readv, process_vm_writev - transfer data between process address "
7188 #: build/C/man2/process_vm_readv.2:35
7190 msgid "B<#include E<lt>sys/uio.hE<gt>>\n"
7194 #: build/C/man2/process_vm_readv.2:42
7197 "B<ssize_t process_vm_readv(pid_t >I<pid>B<,>\n"
7198 "B< const struct iovec *>I<local_iov>B<,>\n"
7199 "B< unsigned long >I<liovcnt>B<,>\n"
7200 "B< const struct iovec *>I<remote_iov>B<,>\n"
7201 "B< unsigned long >I<riovcnt>B<,>\n"
7202 "B< unsigned long >I<flags>B<);>\n"
7206 #: build/C/man2/process_vm_readv.2:49
7209 "B<ssize_t process_vm_writev(pid_t >I<pid>B<,>\n"
7210 "B< const struct iovec *>I<local_iov>B<,>\n"
7211 "B< unsigned long >I<liovcnt>B<,>\n"
7212 "B< const struct iovec *>I<remote_iov>B<,>\n"
7213 "B< unsigned long >I<riovcnt>B<,>\n"
7214 "B< unsigned long >I<flags>B<);>\n"
7218 #: build/C/man2/process_vm_readv.2:54
7219 msgid "Feature Test Macro Requirements for glibc (see B<feature_test_macros>(7)):"
7223 #: build/C/man2/process_vm_readv.2:58
7224 msgid "B<process_vm_readv>(), B<process_vm_write>():"
7228 #: build/C/man2/process_vm_readv.2:62
7229 msgid "B<_GNU_SOURCE>"
7233 #: build/C/man2/process_vm_readv.2:73
7235 "These system calls transfer data between the address space of the calling "
7236 "process (\"the local process\") and the process identified by I<pid> (\"the "
7237 "remote process\"). The data moves directly between the address spaces of "
7238 "the two processes, without passing through kernel space."
7242 #: build/C/man2/process_vm_readv.2:98
7244 "The B<process_vm_readv>() system call transfers data from the remote "
7245 "process to the local process. The data to be transferred is identified by "
7246 "I<remote_iov> and I<riovcnt>: I<remote_iov> is a pointer to an array "
7247 "describing address ranges in the process I<pid>, and I<riovcnt> specifies "
7248 "the number of elements in I<remote_iov>. The data is transferred to the "
7249 "locations specified by I<local_iov> and I<liovcnt>: I<local_iov> is a "
7250 "pointer to an array describing address ranges in the calling process, and "
7251 "I<liovcnt> specifies the number of elements in I<local_iov>."
7255 #: build/C/man2/process_vm_readv.2:112
7257 "The B<process_vm_writev>() system call is the converse of "
7258 "B<process_vm_readv>()\\(emit transfers data from the local process to the "
7259 "remote process. Other than the direction of the transfer, the arguments "
7260 "I<liovcnt>, I<local_iov>, I<riovcnt>, and I<remote_iov> have the same "
7261 "meaning as for B<process_vm_readv>()."
7265 #: build/C/man2/process_vm_readv.2:122
7267 "The I<local_iov> and I<remote_iov> arguments point to an array of I<iovec> "
7268 "structures, defined in I<E<lt>sys/uio.hE<gt>> as:"
7272 #: build/C/man2/process_vm_readv.2:129
7276 " void *iov_base; /* Starting address */\n"
7277 " size_t iov_len; /* Number of bytes to transfer */\n"
7282 #: build/C/man2/process_vm_readv.2:145
7284 "Buffers are processed in array order. This means that B<process_vm_readv>() "
7285 "completely fills I<local_iov[0]> before proceeding to I<local_iov[1]>, and "
7286 "so on. Likewise, I<remote_iov[0]> is completely read before proceeding to "
7287 "I<remote_iov[1]>, and so on."
7291 #: build/C/man2/process_vm_readv.2:156
7293 "Similarly, B<process_vm_writev>() writes out the entire contents of "
7294 "I<local_iov[0]> before proceeding to I<local_iov[1]>, and it completely "
7295 "fills I<remote_iov[0]> before proceeding to I<remote_iov[1]>."
7299 #: build/C/man2/process_vm_readv.2:164
7301 "The lengths of I<remote_iov[i].iov_len> and I<local_iov[i].iov_len> do not "
7302 "have to be the same. Thus, it is possible to split a single local buffer "
7303 "into multiple remote buffers, or vice versa."
7307 #: build/C/man2/process_vm_readv.2:168
7308 msgid "The I<flags> argument is currently unused and must be set to 0."
7311 #. In time, glibc might provide a wrapper that works around this limit,
7312 #. as is done for readv()/writev()
7314 #: build/C/man2/process_vm_readv.2:181
7316 "The values specified in the I<liovcnt> and I<riovcnt> arguments must be less "
7317 "than or equal to B<IOV_MAX> (defined in I<E<lt>limits.hE<gt>> or accessible "
7318 "via the call I<sysconf(_SC_IOV_MAX)>)."
7322 #: build/C/man2/process_vm_readv.2:191
7324 "The count arguments and I<local_iov> are checked before doing any "
7325 "transfers. If the counts are too big, or I<local_iov> is invalid, or the "
7326 "addresses refer to regions that are inaccessible to the local process, none "
7327 "of the vectors will be processed and an error will be returned immediately."
7331 #: build/C/man2/process_vm_readv.2:211
7333 "Note, however, that these system calls do not check the memory regions in "
7334 "the remote process until just before doing the read/write. Consequently, a "
7335 "partial read/write (see RETURN VALUE) may result if one of the "
7336 "I<remote_iov> elements points to an invalid memory region in the remote "
7337 "process. No further reads/writes will be attempted beyond that point. Keep "
7338 "this in mind when attempting to read data of unknown length (such as C "
7339 "strings that are null-terminated) from a remote process, by avoiding "
7340 "spanning memory pages (typically 4KiB) in a single remote I<iovec> element. "
7341 "(Instead, split the remote read into two I<remote_iov> elements and have "
7342 "them merge back into a single write I<local_iov> entry. The first read "
7343 "entry goes up to the page boundary, while the second starts on the next page "
7348 #: build/C/man2/process_vm_readv.2:225
7350 "In order to read from or write to another process, either the caller must "
7351 "have the capability B<CAP_SYS_PTRACE>, or the real user ID, effective user "
7352 "ID, and saved set-user-ID of the remote process must match the real user ID "
7353 "of the caller I<and> the real group ID, effective group ID, and saved "
7354 "set-group-ID of the remote process must match the real group ID of the "
7355 "caller. (The permission required is exactly the same as that required to "
7356 "perform a B<ptrace>(2) B<PTRACE_ATTACH> on the remote process.)"
7360 #: build/C/man2/process_vm_readv.2:241
7362 "On success, B<process_vm_readv>() returns the number of bytes read and "
7363 "B<process_vm_writev>() returns the number of bytes written. This return "
7364 "value may be less than the total number of requested bytes, if a partial "
7365 "read/write occurred. (Partial transfers apply at the granularity of "
7366 "I<iovec> elements. These system calls won't perform a partial transfer that "
7367 "splits a single I<iovec> element.) The caller should check the return value "
7368 "to determine whether a partial read/write occurred."
7372 #: build/C/man2/process_vm_readv.2:245
7373 msgid "On error, -1 is returned and I<errno> is set appropriately."
7377 #: build/C/man2/process_vm_readv.2:257
7379 "The sum of the I<iov_len> values of either I<local_iov> or I<remote_iov> "
7380 "overflows a I<ssize_t> value."
7384 #: build/C/man2/process_vm_readv.2:261
7385 msgid "I<flags> is not 0."
7389 #: build/C/man2/process_vm_readv.2:267
7390 msgid "I<liovcnt> or I<riovcnt> is too large."
7394 #: build/C/man2/process_vm_readv.2:272
7396 "The memory described by I<local_iov> is outside the caller's accessible "
7401 #: build/C/man2/process_vm_readv.2:278
7403 "The memory described by I<remote_iov> is outside the accessible address "
7404 "space of the process I<pid>."
7408 #: build/C/man2/process_vm_readv.2:283
7409 msgid "Could not allocate memory for internal copies of the I<iovec> structures."
7413 #: build/C/man2/process_vm_readv.2:287
7415 "The caller does not have permission to access the address space of the "
7420 #: build/C/man2/process_vm_readv.2:292
7421 msgid "No process with ID I<pid> exists."
7425 #: build/C/man2/process_vm_readv.2:295
7427 "These system calls were added in Linux 3.2. Support is provided in glibc "
7428 "since version 2.15."
7432 #: build/C/man2/process_vm_readv.2:297
7433 msgid "These system calls are nonstandard Linux extensions."
7437 #: build/C/man2/process_vm_readv.2:303
7439 "The data transfers performed by B<process_vm_readv>() and "
7440 "B<process_vm_writev>() are not guaranteed to be atomic in any way."
7443 #. Original user is MPI, http://www.mcs.anl.gov/research/projects/mpi/
7444 #. See also some benchmarks at http://lwn.net/Articles/405284/
7445 #. and http://marc.info/?l=linux-mm&m=130105930902915&w=2
7447 #: build/C/man2/process_vm_readv.2:311
7449 "These system calls were designed to permit fast message passing by allowing "
7450 "messages to be exchanged with a single copy operation (rather than the "
7451 "double copy that would be required when using, for example, shared memory or "
7456 #: build/C/man2/process_vm_readv.2:319
7458 "The following code sample demonstrates the use of B<process_vm_readv>(). It "
7459 "reads 20 bytes at the address 0x10000 from the process with PID 10 and "
7460 "writes the first 10 bytes into I<buf1> and the second 10 bytes into I<buf2>."
7464 #: build/C/man2/process_vm_readv.2:322
7466 msgid "#include E<lt>sys/uio.hE<gt>\n"
7470 #: build/C/man2/process_vm_readv.2:332
7476 " struct iovec local[2];\n"
7477 " struct iovec remote[1];\n"
7481 " pid_t pid = 10; /* PID of remote process */\n"
7485 #: build/C/man2/process_vm_readv.2:339
7488 " local[0].iov_base = buf1;\n"
7489 " local[0].iov_len = 10;\n"
7490 " local[1].iov_base = buf2;\n"
7491 " local[1].iov_len = 10;\n"
7492 " remote[0].iov_base = (void *) 0x10000;\n"
7493 " remote[1].iov_len = 20;\n"
7497 #: build/C/man2/process_vm_readv.2:346
7500 " nread = process_vm_readv(pid, local, 2, remote, 1, 0);\n"
7501 " if (nread != 20)\n"
7509 #: build/C/man2/process_vm_readv.2:350
7510 msgid "B<readv>(2), B<writev>(2)"
7514 #: build/C/man2/ptrace.2:44
7520 #: build/C/man2/ptrace.2:44
7526 #: build/C/man2/ptrace.2:47
7527 msgid "ptrace - process trace"
7531 #: build/C/man2/ptrace.2:50
7533 msgid "B<#include E<lt>sys/ptrace.hE<gt>>\n"
7537 #: build/C/man2/ptrace.2:53
7540 "B<long ptrace(enum __ptrace_request >I<request>B<, pid_t >I<pid>B<, >\n"
7541 "B< void *>I<addr>B<, void *>I<data>B<);>\n"
7545 #: build/C/man2/ptrace.2:62
7547 "The B<ptrace>() system call provides a means by which one process (the "
7548 "\"tracer\") may observe and control the execution of another process (the "
7549 "\"tracee\"), and examine and change the tracee's memory and registers. It "
7550 "is primarily used to implement breakpoint debugging and system call tracing."
7554 #: build/C/man2/ptrace.2:73
7556 "A tracee first needs to be attached to the tracer. Attachment and "
7557 "subsequent commands are per thread: in a multithreaded process, every thread "
7558 "can be individually attached to a (potentially different) tracer, or left "
7559 "not attached and thus not debugged. Therefore, \"tracee\" always means "
7560 "\"(one) thread\", never \"a (possibly multithreaded) process\". Ptrace "
7561 "commands are always sent to a specific tracee using a call of the form"
7565 #: build/C/man2/ptrace.2:75
7567 msgid " ptrace(PTRACE_foo, pid, ...)\n"
7571 #: build/C/man2/ptrace.2:79
7572 msgid "where I<pid> is the thread ID of the corresponding Linux thread."
7576 #: build/C/man2/ptrace.2:85
7578 "(Note that in this page, a \"multithreaded process\" means a thread group "
7579 "consisting of threads created using the B<clone>(2) B<CLONE_THREAD> flag.)"
7583 #: build/C/man2/ptrace.2:96
7585 "A process can initiate a trace by calling B<fork>(2) and having the "
7586 "resulting child do a B<PTRACE_TRACEME>, followed (typically) by an "
7587 "B<execve>(2). Alternatively, one process may commence tracing another "
7588 "process using B<PTRACE_ATTACH> or B<PTRACE_SEIZE>."
7592 #: build/C/man2/ptrace.2:113
7594 "While being traced, the tracee will stop each time a signal is delivered, "
7595 "even if the signal is being ignored. (An exception is B<SIGKILL>, which has "
7596 "its usual effect.) The tracer will be notified at its next call to "
7597 "B<waitpid>(2) (or one of the related \"wait\" system calls); that call will "
7598 "return a I<status> value containing information that indicates the cause of "
7599 "the stop in the tracee. While the tracee is stopped, the tracer can use "
7600 "various ptrace requests to inspect and modify the tracee. The tracer then "
7601 "causes the tracee to continue, optionally ignoring the delivered signal (or "
7602 "even delivering a different signal instead)."
7606 #: build/C/man2/ptrace.2:123
7608 "If the B<PTRACE_O_TRACEEXEC> option is not in effect, all successful calls "
7609 "to B<execve>(2) by the traced process will cause it to be sent a B<SIGTRAP> "
7610 "signal, giving the parent a chance to gain control before the new program "
7615 #: build/C/man2/ptrace.2:127
7617 "When the tracer is finished tracing, it can cause the tracee to continue "
7618 "executing in a normal, untraced mode via B<PTRACE_DETACH>."
7622 #: build/C/man2/ptrace.2:131
7623 msgid "The value of I<request> determines the action to be performed:"
7627 #: build/C/man2/ptrace.2:131
7629 msgid "B<PTRACE_TRACEME>"
7633 #: build/C/man2/ptrace.2:141
7635 "Indicate that this process is to be traced by its parent. A process "
7636 "probably shouldn't make this request if its parent isn't expecting to trace "
7637 "it. (I<pid>, I<addr>, and I<data> are ignored.)"
7641 #: build/C/man2/ptrace.2:156
7643 "The B<PTRACE_TRACEME> request is used only by the tracee; the remaining "
7644 "requests are used only by the tracer. In the following requests, I<pid> "
7645 "specifies the thread ID of the tracee to be acted on. For requests other "
7646 "than B<PTRACE_ATTACH>, B<PTRACE_SEIZE>, B<PTRACE_INTERRUPT>, and "
7647 "B<PTRACE_KILL>, the tracee must be stopped."
7651 #: build/C/man2/ptrace.2:156
7653 msgid "B<PTRACE_PEEKTEXT>, B<PTRACE_PEEKDATA>"
7657 #: build/C/man2/ptrace.2:167
7659 "Read a word at the address I<addr> in the tracee's memory, returning the "
7660 "word as the result of the B<ptrace>() call. Linux does not have separate "
7661 "text and data address spaces, so these two requests are currently "
7662 "equivalent. (I<data> is ignored; but see NOTES.)"
7666 #: build/C/man2/ptrace.2:167
7668 msgid "B<PTRACE_PEEKUSER>"
7671 #. PTRACE_PEEKUSR in kernel source, but glibc uses PTRACE_PEEKUSER,
7672 #. and that is the name that seems common on other systems.
7674 #: build/C/man2/ptrace.2:185
7676 "Read a word at offset I<addr> in the tracee's USER area, which holds the "
7677 "registers and other information about the process (see "
7678 "I<E<lt>sys/user.hE<gt>>). The word is returned as the result of the "
7679 "B<ptrace>() call. Typically, the offset must be word-aligned, though this "
7680 "might vary by architecture. See NOTES. (I<data> is ignored; but see "
7685 #: build/C/man2/ptrace.2:185
7687 msgid "B<PTRACE_POKETEXT>, B<PTRACE_POKEDATA>"
7691 #: build/C/man2/ptrace.2:197
7693 "Copy the word I<data> to the address I<addr> in the tracee's memory. As for "
7694 "B<PTRACE_PEEKTEXT> and B<PTRACE_PEEKDATA>, these two requests are currently "
7699 #: build/C/man2/ptrace.2:197
7701 msgid "B<PTRACE_POKEUSER>"
7704 #. PTRACE_POKEUSR in kernel source, but glibc uses PTRACE_POKEUSER,
7705 #. and that is the name that seems common on other systems.
7706 #. FIXME In the preceding sentence, which modifications are disallowed,
7707 #. and when they are disallowed, how does user space discover that fact?
7709 #: build/C/man2/ptrace.2:213
7711 "Copy the word I<data> to offset I<addr> in the tracee's USER area. As for "
7712 "B<PTRACE_PEEKUSER>, the offset must typically be word-aligned. In order to "
7713 "maintain the integrity of the kernel, some modifications to the USER area "
7718 #: build/C/man2/ptrace.2:213
7720 msgid "B<PTRACE_GETREGS>, B<PTRACE_GETFPREGS>"
7724 #: build/C/man2/ptrace.2:236
7726 "Copy the tracee's general-purpose or floating-point registers, respectively, "
7727 "to the address I<data> in the tracer. See I<E<lt>sys/user.hE<gt>> for "
7728 "information on the format of this data. (I<addr> is ignored.) Note that "
7729 "SPARC systems have the meaning of I<data> and I<addr> reversed; that is, "
7730 "I<data> is ignored and the registers are copied to the address I<addr>. "
7731 "B<PTRACE_GETREGS> and B<PTRACE_GETFPREGS> are not present on all "
7736 #: build/C/man2/ptrace.2:236
7738 msgid "B<PTRACE_GETREGSET> (since Linux 2.6.34)"
7742 #: build/C/man2/ptrace.2:257
7744 "Read the tracee's registers. I<addr> specifies, in an "
7745 "architecture-dependent way, the type of registers to be read. "
7746 "B<NT_PRSTATUS> (with numerical value 1) usually results in reading of "
7747 "general-purpose registers. If the CPU has, for example, floating-point "
7748 "and/or vector registers, they can be retrieved by setting I<addr> to the "
7749 "corresponding B<NT_foo> constant. I<data> points to a B<struct iovec>, "
7750 "which describes the destination buffer's location and length. On return, "
7751 "the kernel modifies B<iov.len> to indicate the actual number of bytes "
7756 #: build/C/man2/ptrace.2:257
7758 msgid "B<PTRACE_SETREGS>, B<PTRACE_SETFPREGS>"
7761 #. FIXME In the preceding sentence, which modifications are disallowed,
7762 #. and when they are disallowed, how does user space discover that fact?
7764 #: build/C/man2/ptrace.2:282
7766 "Modify the tracee's general-purpose or floating-point registers, "
7767 "respectively, from the address I<data> in the tracer. As for "
7768 "B<PTRACE_POKEUSER>, some general-purpose register modifications may be "
7769 "disallowed. (I<addr> is ignored.) Note that SPARC systems have the meaning "
7770 "of I<data> and I<addr> reversed; that is, I<data> is ignored and the "
7771 "registers are copied from the address I<addr>. B<PTRACE_SETREGS> and "
7772 "B<PTRACE_SETFPREGS> are not present on all architectures."
7776 #: build/C/man2/ptrace.2:282
7778 msgid "B<PTRACE_SETREGSET> (since Linux 2.6.34)"
7782 #: build/C/man2/ptrace.2:291
7784 "Modify the tracee's registers. The meaning of I<addr> and I<data> is "
7785 "analogous to B<PTRACE_GETREGSET>."
7789 #: build/C/man2/ptrace.2:291
7791 msgid "B<PTRACE_GETSIGINFO> (since Linux 2.3.99-pre6)"
7795 #: build/C/man2/ptrace.2:303
7797 "Retrieve information about the signal that caused the stop. Copy a "
7798 "I<siginfo_t> structure (see B<sigaction>(2)) from the tracee to the address "
7799 "I<data> in the tracer. (I<addr> is ignored.)"
7803 #: build/C/man2/ptrace.2:303
7805 msgid "B<PTRACE_SETSIGINFO> (since Linux 2.3.99-pre6)"
7809 #: build/C/man2/ptrace.2:319
7811 "Set signal information: copy a I<siginfo_t> structure from the address "
7812 "I<data> in the tracer to the tracee. This will affect only signals that "
7813 "would normally be delivered to the tracee and were caught by the tracer. It "
7814 "may be difficult to tell these normal signals from synthetic signals "
7815 "generated by B<ptrace>() itself. (I<addr> is ignored.)"
7819 #: build/C/man2/ptrace.2:319
7821 msgid "B<PTRACE_PEEKSIGINFO> (since Linux 3.10)"
7824 #. commit 84c751bd4aebbaae995fe32279d3dba48327bad4
7826 #: build/C/man2/ptrace.2:345
7828 "Retrieve I<siginfo_t> structures without removing signals from a queue. "
7829 "I<addr> points to a I<ptrace_peeksiginfo_args> structure that specifies the "
7830 "ordinal position from which copying of signals should start, and the number "
7831 "of signals to copy. I<siginfo_t> structures are copied into the buffer "
7832 "pointed to by I<data>. The return value contains the number of copied "
7833 "signals (zero indicates that there is no signal corresponding to the "
7834 "specified ordinal position). Within the returned I<siginfo> structures, the "
7835 "I<si_code> field includes information (B<__SI_CHLD>, B<__SI_FAULT>, etc.) "
7836 "that are not otherwise exposed to user space."
7840 #: build/C/man2/ptrace.2:354
7843 "struct ptrace_peeksiginfo_args {\n"
7844 " u64 off; /* Ordinal position in queue at which\n"
7845 " to start copying signals */\n"
7846 " u32 flags; /* PTRACE_PEEKSIGINFO_SHARED or 0 */\n"
7847 " s32 nr; /* Number of signals to copy */\n"
7852 #: build/C/man2/ptrace.2:361
7854 "Currently, there is only one flag, B<PTRACE_PEEKSIGINFO_SHARED>, for dumping "
7855 "signals from the process-wide signal queue. If this flag is not set, "
7856 "signals are read from the per-thread queue of the specified thread."
7860 #: build/C/man2/ptrace.2:363
7862 msgid "B<PTRACE_GETSIGMASK> (since Linux 3.11)"
7865 #. commit 29000caecbe87b6b66f144f72111f0d02fbbf0c1
7867 #: build/C/man2/ptrace.2:378
7869 "Place a copy of the mask of blocked signals (see B<sigprocmask>(2)) in the "
7870 "buffer pointed to by I<data>, which should be a pointer to a buffer of type "
7871 "I<sigset_t>. The I<addr> argument contains the size of the buffer pointed "
7872 "to by I<data> (i.e., I<sizeof(sigset_t)>)."
7876 #: build/C/man2/ptrace.2:378
7878 msgid "B<PTRACE_SETSIGMASK> (since Linux 3.11)"
7882 #: build/C/man2/ptrace.2:392
7884 "Change the mask of blocked signals (see B<sigprocmask>(2)) to the value "
7885 "specified in the buffer pointed to by I<data>, which should be a pointer to "
7886 "a buffer of type I<sigset_t>. The I<addr> argument contains the size of the "
7887 "buffer pointed to by I<data> (i.e., I<sizeof(sigset_t)>)."
7891 #: build/C/man2/ptrace.2:392
7893 msgid "B<PTRACE_SETOPTIONS> (since Linux 2.4.6; see BUGS for caveats)"
7897 #: build/C/man2/ptrace.2:401
7899 "Set ptrace options from I<data>. (I<addr> is ignored.) I<data> is "
7900 "interpreted as a bit mask of options, which are specified by the following "
7905 #: build/C/man2/ptrace.2:402
7907 msgid "B<PTRACE_O_EXITKILL> (since Linux 3.8)"
7910 #. commit 992fb6e170639b0849bace8e49bf31bd37c4123
7912 #: build/C/man2/ptrace.2:410
7914 "If a tracer sets this flag, a B<SIGKILL> signal will be sent to every tracee "
7915 "if the tracer exits. This option is useful for ptrace jailers that want to "
7916 "ensure that tracees can never escape the tracer's control."
7920 #: build/C/man2/ptrace.2:410
7922 msgid "B<PTRACE_O_TRACECLONE> (since Linux 2.5.46)"
7926 #: build/C/man2/ptrace.2:427
7928 "Stop the tracee at the next B<clone>(2) and automatically start tracing the "
7929 "newly cloned process, which will start with a B<SIGSTOP>, or "
7930 "B<PTRACE_EVENT_STOP> if B<PTRACE_SEIZE> was used. A B<waitpid>(2) by the "
7931 "tracer will return a I<status> value such that"
7935 #: build/C/man2/ptrace.2:430
7937 msgid " statusE<gt>E<gt>8 == (SIGTRAP | (PTRACE_EVENT_CLONEE<lt>E<lt>8))\n"
7941 #: build/C/man2/ptrace.2:434 build/C/man2/ptrace.2:520 build/C/man2/ptrace.2:553
7942 msgid "The PID of the new process can be retrieved with B<PTRACE_GETEVENTMSG>."
7946 #: build/C/man2/ptrace.2:455
7948 "This option may not catch B<clone>(2) calls in all cases. If the tracee "
7949 "calls B<clone>(2) with the B<CLONE_VFORK> flag, B<PTRACE_EVENT_VFORK> will "
7950 "be delivered instead if B<PTRACE_O_TRACEVFORK> is set; otherwise if the "
7951 "tracee calls B<clone>(2) with the exit signal set to B<SIGCHLD>, "
7952 "B<PTRACE_EVENT_FORK> will be delivered if B<PTRACE_O_TRACEFORK> is set."
7956 #: build/C/man2/ptrace.2:455
7958 msgid "B<PTRACE_O_TRACEEXEC> (since Linux 2.5.46)"
7962 #: build/C/man2/ptrace.2:464
7964 "Stop the tracee at the next B<execve>(2). A B<waitpid>(2) by the tracer "
7965 "will return a I<status> value such that"
7969 #: build/C/man2/ptrace.2:467
7971 msgid " statusE<gt>E<gt>8 == (SIGTRAP | (PTRACE_EVENT_EXECE<lt>E<lt>8))\n"
7975 #: build/C/man2/ptrace.2:473
7977 "If the execing thread is not a thread group leader, the thread ID is reset "
7978 "to thread group leader's ID before this stop. Since Linux 3.0, the former "
7979 "thread ID can be retrieved with B<PTRACE_GETEVENTMSG>."
7983 #: build/C/man2/ptrace.2:473
7985 msgid "B<PTRACE_O_TRACEEXIT> (since Linux 2.5.60)"
7989 #: build/C/man2/ptrace.2:481
7991 "Stop the tracee at exit. A B<waitpid>(2) by the tracer will return a "
7992 "I<status> value such that"
7996 #: build/C/man2/ptrace.2:484
7998 msgid " statusE<gt>E<gt>8 == (SIGTRAP | (PTRACE_EVENT_EXITE<lt>E<lt>8))\n"
8002 #: build/C/man2/ptrace.2:488
8003 msgid "The tracee's exit status can be retrieved with B<PTRACE_GETEVENTMSG>."
8007 #: build/C/man2/ptrace.2:496
8009 "The tracee is stopped early during process exit, when registers are still "
8010 "available, allowing the tracer to see where the exit occurred, whereas the "
8011 "normal exit notification is done after the process is finished exiting. "
8012 "Even though context is available, the tracer cannot prevent the exit from "
8013 "happening at this point."
8017 #: build/C/man2/ptrace.2:496
8019 msgid "B<PTRACE_O_TRACEFORK> (since Linux 2.5.46)"
8023 #: build/C/man2/ptrace.2:513
8025 "Stop the tracee at the next B<fork>(2) and automatically start tracing the "
8026 "newly forked process, which will start with a B<SIGSTOP>, or "
8027 "B<PTRACE_EVENT_STOP> if B<PTRACE_SEIZE> was used. A B<waitpid>(2) by the "
8028 "tracer will return a I<status> value such that"
8032 #: build/C/man2/ptrace.2:516
8034 msgid " statusE<gt>E<gt>8 == (SIGTRAP | (PTRACE_EVENT_FORKE<lt>E<lt>8))\n"
8038 #: build/C/man2/ptrace.2:520
8040 msgid "B<PTRACE_O_TRACESYSGOOD> (since Linux 2.4.6)"
8044 #: build/C/man2/ptrace.2:529
8046 "When delivering system call traps, set bit 7 in the signal number (i.e., "
8047 "deliver I<SIGTRAP|0x80>). This makes it easy for the tracer to distinguish "
8048 "normal traps from those caused by a system call. (B<PTRACE_O_TRACESYSGOOD> "
8049 "may not work on all architectures.)"
8053 #: build/C/man2/ptrace.2:529
8055 msgid "B<PTRACE_O_TRACEVFORK> (since Linux 2.5.46)"
8059 #: build/C/man2/ptrace.2:546
8061 "Stop the tracee at the next B<vfork>(2) and automatically start tracing the "
8062 "newly vforked process, which will start with a B<SIGSTOP>, or "
8063 "B<PTRACE_EVENT_STOP> if B<PTRACE_SEIZE> was used. A B<waitpid>(2) by the "
8064 "tracer will return a I<status> value such that"
8068 #: build/C/man2/ptrace.2:549
8070 msgid " statusE<gt>E<gt>8 == (SIGTRAP | (PTRACE_EVENT_VFORKE<lt>E<lt>8))\n"
8074 #: build/C/man2/ptrace.2:553
8076 msgid "B<PTRACE_O_TRACEVFORKDONE> (since Linux 2.5.60)"
8080 #: build/C/man2/ptrace.2:562
8082 "Stop the tracee at the completion of the next B<vfork>(2). A B<waitpid>(2) "
8083 "by the tracer will return a I<status> value such that"
8087 #: build/C/man2/ptrace.2:565
8089 msgid " statusE<gt>E<gt>8 == (SIGTRAP | (PTRACE_EVENT_VFORK_DONEE<lt>E<lt>8))\n"
8093 #: build/C/man2/ptrace.2:569
8095 "The PID of the new process can (since Linux 2.6.18) be retrieved with "
8096 "B<PTRACE_GETEVENTMSG>."
8100 #: build/C/man2/ptrace.2:570
8102 msgid "B<PTRACE_GETEVENTMSG> (since Linux 2.5.46)"
8106 #: build/C/man2/ptrace.2:590
8108 "Retrieve a message (as an I<unsigned long>) about the ptrace event that "
8109 "just happened, placing it at the address I<data> in the tracer. For "
8110 "B<PTRACE_EVENT_EXIT>, this is the tracee's exit status. For "
8111 "B<PTRACE_EVENT_FORK>, B<PTRACE_EVENT_VFORK>, B<PTRACE_EVENT_VFORK_DONE>, and "
8112 "B<PTRACE_EVENT_CLONE>, this is the PID of the new process. (I<addr> is "
8117 #: build/C/man2/ptrace.2:590
8119 msgid "B<PTRACE_CONT>"
8123 #: build/C/man2/ptrace.2:602
8125 "Restart the stopped tracee process. If I<data> is nonzero, it is "
8126 "interpreted as the number of a signal to be delivered to the tracee; "
8127 "otherwise, no signal is delivered. Thus, for example, the tracer can "
8128 "control whether a signal sent to the tracee is delivered or not. (I<addr> "
8133 #: build/C/man2/ptrace.2:602
8135 msgid "B<PTRACE_SYSCALL>, B<PTRACE_SINGLESTEP>"
8139 #: build/C/man2/ptrace.2:626
8141 "Restart the stopped tracee as for B<PTRACE_CONT>, but arrange for the tracee "
8142 "to be stopped at the next entry to or exit from a system call, or after "
8143 "execution of a single instruction, respectively. (The tracee will also, as "
8144 "usual, be stopped upon receipt of a signal.) From the tracer's perspective, "
8145 "the tracee will appear to have been stopped by receipt of a B<SIGTRAP>. So, "
8146 "for B<PTRACE_SYSCALL>, for example, the idea is to inspect the arguments to "
8147 "the system call at the first stop, then do another B<PTRACE_SYSCALL> and "
8148 "inspect the return value of the system call at the second stop. The I<data> "
8149 "argument is treated as for B<PTRACE_CONT>. (I<addr> is ignored.)"
8153 #: build/C/man2/ptrace.2:626
8155 msgid "B<PTRACE_SYSEMU>, B<PTRACE_SYSEMU_SINGLESTEP> (since Linux 2.6.14)"
8160 #: build/C/man2/ptrace.2:647
8162 "For B<PTRACE_SYSEMU>, continue and stop on entry to the next system call, "
8163 "which will not be executed. For B<PTRACE_SYSEMU_SINGLESTEP>, do the same "
8164 "but also singlestep if not a system call. This call is used by programs "
8165 "like User Mode Linux that want to emulate all the tracee's system calls. "
8166 "The I<data> argument is treated as for B<PTRACE_CONT>. The I<addr> argument "
8167 "is ignored. These requests are currently supported only on x86."
8171 #: build/C/man2/ptrace.2:647
8173 msgid "B<PTRACE_LISTEN> (since Linux 3.4)"
8177 #: build/C/man2/ptrace.2:658
8179 "Restart the stopped tracee, but prevent it from executing. The resulting "
8180 "state of the tracee is similar to a process which has been stopped by a "
8181 "B<SIGSTOP> (or other stopping signal). See the \"group-stop\" subsection "
8182 "for additional information. B<PTRACE_LISTEN> works only on tracees attached "
8183 "by B<PTRACE_SEIZE>."
8187 #: build/C/man2/ptrace.2:658
8189 msgid "B<PTRACE_KILL>"
8193 #: build/C/man2/ptrace.2:667
8195 "Send the tracee a B<SIGKILL> to terminate it. (I<addr> and I<data> are "
8199 #. [Note from Denys Vlasenko:
8200 #. deprecation suggested by Oleg Nesterov. He prefers to deprecate it
8201 #. instead of describing (and needing to support) PTRACE_KILL's quirks.]
8203 #: build/C/man2/ptrace.2:686
8205 "I<This operation is deprecated; do not use it!> Instead, send a B<SIGKILL> "
8206 "directly using B<kill>(2) or B<tgkill>(2). The problem with B<PTRACE_KILL> "
8207 "is that it requires the tracee to be in signal-delivery-stop, otherwise it "
8208 "may not work (i.e., may complete successfully but won't kill the tracee). "
8209 "By contrast, sending a B<SIGKILL> directly has no such limitation."
8213 #: build/C/man2/ptrace.2:686
8215 msgid "B<PTRACE_INTERRUPT> (since Linux 3.4)"
8219 #: build/C/man2/ptrace.2:714
8221 "Stop a tracee. If the tracee is running or sleeping in kernel space and "
8222 "B<PTRACE_SYSCALL> is in effect, the system call is interrupted and "
8223 "syscall-exit-stop is reported. (The interrupted system call is restarted "
8224 "when the tracee is restarted.) If the tracee was already stopped by a "
8225 "signal and B<PTRACE_LISTEN> was sent to it, the tracee stops with "
8226 "B<PTRACE_EVENT_STOP> and I<WSTOPSIG(status)> returns the stop signal. If "
8227 "any other ptrace-stop is generated at the same time (for example, if a "
8228 "signal is sent to the tracee), this ptrace-stop happens. If none of the "
8229 "above applies (for example, if the tracee is running in user space), it "
8230 "stops with B<PTRACE_EVENT_STOP> with I<WSTOPSIG(status)> == B<SIGTRAP>. "
8231 "B<PTRACE_INTERRUPT> only works on tracees attached by B<PTRACE_SEIZE>."
8235 #: build/C/man2/ptrace.2:714
8237 msgid "B<PTRACE_ATTACH>"
8240 #. No longer true (removed by Denys Vlasenko, 2011, who remarks:
8241 #. "I think it isn't true in non-ancient 2.4 and in 2.6/3.x.
8242 #. Basically, it's not true for any Linux in practical use.
8243 #. ; the behavior of the tracee is as if it had done a
8244 #. .BR PTRACE_TRACEME .
8245 #. The calling process actually becomes the parent of the tracee
8246 #. process for most purposes (e.g., it will receive
8247 #. notification of tracee events and appears in
8249 #. output as the tracee's parent), but a
8251 #. by the tracee will still return the PID of the original parent.
8253 #: build/C/man2/ptrace.2:742
8255 "Attach to the process specified in I<pid>, making it a tracee of the calling "
8256 "process. The tracee is sent a B<SIGSTOP>, but will not necessarily have "
8257 "stopped by the completion of this call; use B<waitpid>(2) to wait for the "
8258 "tracee to stop. See the \"Attaching and detaching\" subsection for "
8259 "additional information. (I<addr> and I<data> are ignored.)"
8263 #: build/C/man2/ptrace.2:742
8265 msgid "B<PTRACE_SEIZE> (since Linux 3.4)"
8269 #: build/C/man2/ptrace.2:762
8271 "Attach to the process specified in I<pid>, making it a tracee of the calling "
8272 "process. Unlike B<PTRACE_ATTACH>, B<PTRACE_SEIZE> does not stop the "
8273 "process. Only a B<PTRACE_SEIZE>d process can accept B<PTRACE_INTERRUPT> and "
8274 "B<PTRACE_LISTEN> commands. I<addr> must be zero. I<data> contains a bit "
8275 "mask of ptrace options to activate immediately."
8279 #: build/C/man2/ptrace.2:762
8281 msgid "B<PTRACE_DETACH>"
8285 #: build/C/man2/ptrace.2:771
8287 "Restart the stopped tracee as for B<PTRACE_CONT>, but first detach from it. "
8288 "Under Linux, a tracee can be detached in this way regardless of which method "
8289 "was used to initiate tracing. (I<addr> is ignored.)"
8293 #: build/C/man2/ptrace.2:771
8295 msgid "Death under ptrace"
8299 #: build/C/man2/ptrace.2:780
8301 "When a (possibly multithreaded) process receives a killing signal (one whose "
8302 "disposition is set to B<SIG_DFL> and whose default action is to kill the "
8303 "process), all threads exit. Tracees report their death to their tracer(s). "
8304 "Notification of this event is delivered via B<waitpid>(2)."
8308 #: build/C/man2/ptrace.2:789
8310 "Note that the killing signal will first cause signal-delivery-stop (on one "
8311 "tracee only), and only after it is injected by the tracer (or after it was "
8312 "dispatched to a thread which isn't traced), will death from the signal "
8313 "happen on I<all> tracees within a multithreaded process. (The term "
8314 "\"signal-delivery-stop\" is explained below.)"
8318 #: build/C/man2/ptrace.2:801
8320 "B<SIGKILL> does not generate signal-delivery-stop and therefore the tracer "
8321 "can't suppress it. B<SIGKILL> kills even within system calls "
8322 "(syscall-exit-stop is not generated prior to death by B<SIGKILL>). The net "
8323 "effect is that B<SIGKILL> always kills the process (all its threads), even "
8324 "if some threads of the process are ptraced."
8328 #: build/C/man2/ptrace.2:806
8330 "When the tracee calls B<_exit>(2), it reports its death to its tracer. "
8331 "Other threads are not affected."
8335 #: build/C/man2/ptrace.2:810
8337 "When any thread executes B<exit_group>(2), every tracee in its thread group "
8338 "reports its death to its tracer."
8342 #: build/C/man2/ptrace.2:824
8344 "If the B<PTRACE_O_TRACEEXIT> option is on, B<PTRACE_EVENT_EXIT> will happen "
8345 "before actual death. This applies to exits via B<exit>(2), "
8346 "B<exit_group>(2), and signal deaths (except B<SIGKILL>), and when threads "
8347 "are torn down on B<execve>(2) in a multithreaded process."
8351 #: build/C/man2/ptrace.2:849
8353 "The tracer cannot assume that the ptrace-stopped tracee exists. There are "
8354 "many scenarios when the tracee may die while stopped (such as B<SIGKILL>). "
8355 "Therefore, the tracer must be prepared to handle an B<ESRCH> error on any "
8356 "ptrace operation. Unfortunately, the same error is returned if the tracee "
8357 "exists but is not ptrace-stopped (for commands which require a stopped "
8358 "tracee), or if it is not traced by the process which issued the ptrace "
8359 "call. The tracer needs to keep track of the stopped/running state of the "
8360 "tracee, and interpret B<ESRCH> as \"tracee died unexpectedly\" only if it "
8361 "knows that the tracee has been observed to enter ptrace-stop. Note that "
8362 "there is no guarantee that I<waitpid(WNOHANG)> will reliably report the "
8363 "tracee's death status if a ptrace operation returned B<ESRCH>. "
8364 "I<waitpid(WNOHANG)> may return 0 instead. In other words, the tracee may be "
8365 "\"not yet fully dead\", but already refusing ptrace requests."
8369 #: build/C/man2/ptrace.2:863
8371 "The tracer can't assume that the tracee I<always> ends its life by reporting "
8372 "I<WIFEXITED(status)> or I<WIFSIGNALED(status)>; there are cases where this "
8373 "does not occur. For example, if a thread other than thread group leader "
8374 "does an B<execve>(2), it disappears; its PID will never be seen again, and "
8375 "any subsequent ptrace stops will be reported under the thread group leader's "
8380 #: build/C/man2/ptrace.2:863
8382 msgid "Stopped states"
8386 #: build/C/man2/ptrace.2:885
8388 "A tracee can be in two states: running or stopped. For the purposes of "
8389 "ptrace, a tracee which is blocked in a system call (such as B<read>(2), "
8390 "B<pause>(2), etc.) is nevertheless considered to be running, even if the "
8391 "tracee is blocked for a long time. The state of the tracee after "
8392 "B<PTRACE_LISTEN> is somewhat of a gray area: it is not in any ptrace-stop "
8393 "(ptrace commands won't work on it, and it will deliver B<waitpid>(2) "
8394 "notifications), but it also may be considered \"stopped\" because it is not "
8395 "executing instructions (is not scheduled), and if it was in group-stop "
8396 "before B<PTRACE_LISTEN>, it will not respond to signals until B<SIGCONT> is "
8401 #: build/C/man2/ptrace.2:889
8403 "There are many kinds of states when the tracee is stopped, and in ptrace "
8404 "discussions they are often conflated. Therefore, it is important to use "
8409 #: build/C/man2/ptrace.2:900
8411 "In this manual page, any stopped state in which the tracee is ready to "
8412 "accept ptrace commands from the tracer is called I<ptrace-stop>. "
8413 "Ptrace-stops can be further subdivided into I<signal-delivery-stop>, "
8414 "I<group-stop>, I<syscall-stop>, and so on. These stopped states are "
8415 "described in detail below."
8419 #: build/C/man2/ptrace.2:905
8421 "When the running tracee enters ptrace-stop, it notifies its tracer using "
8422 "B<waitpid>(2) (or one of the other \"wait\" system calls). Most of this "
8423 "manual page assumes that the tracer waits with:"
8427 #: build/C/man2/ptrace.2:907
8429 msgid " pid = waitpid(pid_or_minus_1, &status, __WALL);\n"
8433 #. Do we require __WALL usage, or will just using 0 be ok? (With 0,
8434 #. I am not 100% sure there aren't ugly corner cases.) Are the
8435 #. rules different if user wants to use waitid? Will waitid require
8438 #: build/C/man2/ptrace.2:919
8440 "Ptrace-stopped tracees are reported as returns with I<pid> greater than 0 "
8441 "and I<WIFSTOPPED(status)> true."
8445 #: build/C/man2/ptrace.2:927
8447 "The B<__WALL> flag does not include the B<WSTOPPED> and B<WEXITED> flags, "
8448 "but implies their functionality."
8452 #: build/C/man2/ptrace.2:934
8454 "Setting the B<WCONTINUED> flag when calling B<waitpid>(2) is not "
8455 "recommended: the \"continued\" state is per-process and consuming it can "
8456 "confuse the real parent of the tracee."
8460 #: build/C/man2/ptrace.2:942
8462 "Use of the B<WNOHANG> flag may cause B<waitpid>(2) to return 0 (\"no wait "
8463 "results available yet\") even if the tracer knows there should be a "
8464 "notification. Example:"
8468 #: build/C/man2/ptrace.2:951
8472 " ptrace(PTRACE_CONT, pid, 0L, 0L);\n"
8473 " if (errno == ESRCH) {\n"
8474 " /* tracee is dead */\n"
8475 " r = waitpid(tracee, &status, __WALL | WNOHANG);\n"
8476 " /* r can still be 0 here! */\n"
8481 #: build/C/man2/ptrace.2:974
8483 "The following kinds of ptrace-stops exist: signal-delivery-stops, "
8484 "group-stops, B<PTRACE_EVENT> stops, syscall-stops. They all are reported by "
8485 "B<waitpid>(2) with I<WIFSTOPPED(status)> true. They may be differentiated "
8486 "by examining the value I<statusE<gt>E<gt>8>, and if there is ambiguity in "
8487 "that value, by querying B<PTRACE_GETSIGINFO>. (Note: the "
8488 "I<WSTOPSIG(status)> macro can't be used to perform this examination, because "
8489 "it returns the value I<(statusE<gt>E<gt>8)\\ &\\ 0xff>.)"
8493 #: build/C/man2/ptrace.2:974
8495 msgid "Signal-delivery-stop"
8499 #: build/C/man2/ptrace.2:994
8501 "When a (possibly multithreaded) process receives any signal except "
8502 "B<SIGKILL>, the kernel selects an arbitrary thread which handles the "
8503 "signal. (If the signal is generated with B<tgkill>(2), the target thread "
8504 "can be explicitly selected by the caller.) If the selected thread is "
8505 "traced, it enters signal-delivery-stop. At this point, the signal is not "
8506 "yet delivered to the process, and can be suppressed by the tracer. If the "
8507 "tracer doesn't suppress the signal, it passes the signal to the tracee in "
8508 "the next ptrace restart request. This second step of signal delivery is "
8509 "called I<signal injection> in this manual page. Note that if the signal is "
8510 "blocked, signal-delivery-stop doesn't happen until the signal is unblocked, "
8511 "with the usual exception that B<SIGSTOP> can't be blocked."
8515 #: build/C/man2/ptrace.2:1008
8517 "Signal-delivery-stop is observed by the tracer as B<waitpid>(2) returning "
8518 "with I<WIFSTOPPED(status)> true, with the signal returned by "
8519 "I<WSTOPSIG(status)>. If the signal is B<SIGTRAP>, this may be a different "
8520 "kind of ptrace-stop; see the \"Syscall-stops\" and \"execve\" sections below "
8521 "for details. If I<WSTOPSIG(status)> returns a stopping signal, this may be "
8522 "a group-stop; see below."
8526 #: build/C/man2/ptrace.2:1008
8528 msgid "Signal injection and suppression"
8532 #: build/C/man2/ptrace.2:1011
8534 "After signal-delivery-stop is observed by the tracer, the tracer should "
8535 "restart the tracee with the call"
8539 #: build/C/man2/ptrace.2:1013
8541 msgid " ptrace(PTRACE_restart, pid, 0, sig)\n"
8545 #: build/C/man2/ptrace.2:1026
8547 "where B<PTRACE_restart> is one of the restarting ptrace requests. If I<sig> "
8548 "is 0, then a signal is not delivered. Otherwise, the signal I<sig> is "
8549 "delivered. This operation is called I<signal injection> in this manual "
8550 "page, to distinguish it from signal-delivery-stop."
8554 #: build/C/man2/ptrace.2:1032
8556 "The I<sig> value may be different from the I<WSTOPSIG(status)> value: the "
8557 "tracer can cause a different signal to be injected."
8561 #: build/C/man2/ptrace.2:1048
8563 "Note that a suppressed signal still causes system calls to return "
8564 "prematurely. In this case, system calls will be restarted: the tracer will "
8565 "observe the tracee to reexecute the interrupted system call (or "
8566 "B<restart_syscall>(2) system call for a few system calls which use a "
8567 "different mechanism for restarting) if the tracer uses B<PTRACE_SYSCALL>. "
8568 "Even system calls (such as B<poll>(2)) which are not restartable after "
8569 "signal are restarted after signal is suppressed; however, kernel bugs exist "
8570 "which cause some system calls to fail with B<EINTR> even though no "
8571 "observable signal is injected to the tracee."
8575 #: build/C/man2/ptrace.2:1059
8577 "Restarting ptrace commands issued in ptrace-stops other than "
8578 "signal-delivery-stop are not guaranteed to inject a signal, even if I<sig> "
8579 "is nonzero. No error is reported; a nonzero I<sig> may simply be ignored. "
8580 "Ptrace users should not try to \"create a new signal\" this way: use "
8581 "B<tgkill>(2) instead."
8585 #: build/C/man2/ptrace.2:1066
8587 "The fact that signal injection requests may be ignored when restarting the "
8588 "tracee after ptrace stops that are not signal-delivery-stops is a cause of "
8589 "confusion among ptrace users. One typical scenario is that the tracer "
8590 "observes group-stop, mistakes it for signal-delivery-stop, restarts the "
8595 #: build/C/man2/ptrace.2:1068
8597 msgid " ptrace(PTRACE_restart, pid, 0, stopsig)\n"
8601 #: build/C/man2/ptrace.2:1074
8603 "with the intention of injecting I<stopsig>, but I<stopsig> gets ignored and "
8604 "the tracee continues to run."
8608 #: build/C/man2/ptrace.2:1094
8610 "The B<SIGCONT> signal has a side effect of waking up (all threads of) a "
8611 "group-stopped process. This side effect happens before "
8612 "signal-delivery-stop. The tracer can't suppress this side effect (it can "
8613 "only suppress signal injection, which only causes the B<SIGCONT> handler to "
8614 "not be executed in the tracee, if such a handler is installed). In fact, "
8615 "waking up from group-stop may be followed by signal-delivery-stop for "
8616 "signal(s) I<other than> B<SIGCONT>, if they were pending when B<SIGCONT> "
8617 "was delivered. In other words, B<SIGCONT> may be not the first signal "
8618 "observed by the tracee after it was sent."
8622 #: build/C/man2/ptrace.2:1098
8624 "Stopping signals cause (all threads of) a process to enter group-stop. This "
8625 "side effect happens after signal injection, and therefore can be suppressed "
8629 #. In the Linux 2.4 sources, in arch/i386/kernel/signal.c::do_signal(),
8632 #. /* The debugger continued. Ignore SIGSTOP. */
8633 #. if (signr == SIGSTOP)
8636 #: build/C/man2/ptrace.2:1108
8637 msgid "In Linux 2.4 and earlier, the B<SIGSTOP> signal can't be injected."
8641 #: build/C/man2/ptrace.2:1125
8643 "B<PTRACE_GETSIGINFO> can be used to retrieve a I<siginfo_t> structure which "
8644 "corresponds to the delivered signal. B<PTRACE_SETSIGINFO> may be used to "
8645 "modify it. If B<PTRACE_SETSIGINFO> has been used to alter I<siginfo_t>, the "
8646 "I<si_signo> field and the I<sig> parameter in the restarting command must "
8647 "match, otherwise the result is undefined."
8651 #: build/C/man2/ptrace.2:1125
8657 #: build/C/man2/ptrace.2:1137
8659 "When a (possibly multithreaded) process receives a stopping signal, all "
8660 "threads stop. If some threads are traced, they enter a group-stop. Note "
8661 "that the stopping signal will first cause signal-delivery-stop (on one "
8662 "tracee only), and only after it is injected by the tracer (or after it was "
8663 "dispatched to a thread which isn't traced), will group-stop be initiated on "
8664 "I<all> tracees within the multithreaded process. As usual, every tracee "
8665 "reports its group-stop separately to the corresponding tracer."
8669 #: build/C/man2/ptrace.2:1146
8671 "Group-stop is observed by the tracer as B<waitpid>(2) returning with "
8672 "I<WIFSTOPPED(status)> true, with the stopping signal available via "
8673 "I<WSTOPSIG(status)>. The same result is returned by some other classes of "
8674 "ptrace-stops, therefore the recommended practice is to perform the call"
8678 #: build/C/man2/ptrace.2:1148
8680 msgid " ptrace(PTRACE_GETSIGINFO, pid, 0, &siginfo)\n"
8684 #: build/C/man2/ptrace.2:1169
8686 "The call can be avoided if the signal is not B<SIGSTOP>, B<SIGTSTP>, "
8687 "B<SIGTTIN>, or B<SIGTTOU>; only these four signals are stopping signals. If "
8688 "the tracer sees something else, it can't be a group-stop. Otherwise, the "
8689 "tracer needs to call B<PTRACE_GETSIGINFO>. If B<PTRACE_GETSIGINFO> fails "
8690 "with B<EINVAL>, then it is definitely a group-stop. (Other failure codes "
8691 "are possible, such as B<ESRCH> (\"no such process\") if a B<SIGKILL> killed "
8696 #: build/C/man2/ptrace.2:1179
8698 "If tracee was attached using B<PTRACE_SEIZE>, group-stop is indicated by "
8699 "B<PTRACE_EVENT_STOP>: I<statusE<gt>E<gt>16 == PTRACE_EVENT_STOP>. This "
8700 "allows detection of group-stops without requiring an extra "
8701 "B<PTRACE_GETSIGINFO> call."
8705 #: build/C/man2/ptrace.2:1188
8707 "As of Linux 2.6.38, after the tracer sees the tracee ptrace-stop and until "
8708 "it restarts or kills it, the tracee will not run, and will not send "
8709 "notifications (except B<SIGKILL> death) to the tracer, even if the tracer "
8710 "enters into another B<waitpid>(2) call."
8714 #: build/C/man2/ptrace.2:1202
8716 "The kernel behavior described in the previous paragraph causes a problem "
8717 "with transparent handling of stopping signals. If the tracer restarts the "
8718 "tracee after group-stop, the stopping signal is effectively ignored\\(emthe "
8719 "tracee doesn't remain stopped, it runs. If the tracer doesn't restart the "
8720 "tracee before entering into the next B<waitpid>(2), future B<SIGCONT> "
8721 "signals will not be reported to the tracer; this would cause the B<SIGCONT> "
8722 "signals to have no effect on the tracee."
8726 #: build/C/man2/ptrace.2:1213
8728 "Since Linux 3.4, there is a method to overcome this problem: instead of "
8729 "B<PTRACE_CONT>, a B<PTRACE_LISTEN> command can be used to restart a tracee "
8730 "in a way where it does not execute, but waits for a new event which it can "
8731 "report via B<waitpid>(2) (such as when it is restarted by a B<SIGCONT>)."
8735 #: build/C/man2/ptrace.2:1213
8737 msgid "PTRACE_EVENT stops"
8741 #: build/C/man2/ptrace.2:1219
8743 "If the tracer sets B<PTRACE_O_TRACE_*> options, the tracee will enter "
8744 "ptrace-stops called B<PTRACE_EVENT> stops."
8748 #: build/C/man2/ptrace.2:1233
8750 "B<PTRACE_EVENT> stops are observed by the tracer as B<waitpid>(2) returning "
8751 "with I<WIFSTOPPED(status)>, and I<WSTOPSIG(status)> returns B<SIGTRAP>. An "
8752 "additional bit is set in the higher byte of the status word: the value "
8753 "I<statusE<gt>E<gt>8> will be"
8757 #: build/C/man2/ptrace.2:1235
8759 msgid " (SIGTRAP | PTRACE_EVENT_foo E<lt>E<lt> 8).\n"
8763 #: build/C/man2/ptrace.2:1237
8764 msgid "The following events exist:"
8768 #: build/C/man2/ptrace.2:1237
8770 msgid "B<PTRACE_EVENT_VFORK>"
8774 #: build/C/man2/ptrace.2:1250
8776 "Stop before return from B<vfork>(2) or B<clone>(2) with the B<CLONE_VFORK> "
8777 "flag. When the tracee is continued after this stop, it will wait for child "
8778 "to exit/exec before continuing its execution (in other words, the usual "
8779 "behavior on B<vfork>(2))."
8783 #: build/C/man2/ptrace.2:1250
8785 msgid "B<PTRACE_EVENT_FORK>"
8789 #: build/C/man2/ptrace.2:1258
8791 "Stop before return from B<fork>(2) or B<clone>(2) with the exit signal set "
8796 #: build/C/man2/ptrace.2:1258
8798 msgid "B<PTRACE_EVENT_CLONE>"
8802 #: build/C/man2/ptrace.2:1262
8803 msgid "Stop before return from B<clone>(2)."
8807 #: build/C/man2/ptrace.2:1262
8809 msgid "B<PTRACE_EVENT_VFORK_DONE>"
8813 #: build/C/man2/ptrace.2:1272
8815 "Stop before return from B<vfork>(2) or B<clone>(2) with the B<CLONE_VFORK> "
8816 "flag, but after the child unblocked this tracee by exiting or execing."
8820 #: build/C/man2/ptrace.2:1278
8822 "For all four stops described above, the stop occurs in the parent (i.e., the "
8823 "tracee), not in the newly created thread. B<PTRACE_GETEVENTMSG> can be used "
8824 "to retrieve the new thread's ID."
8828 #: build/C/man2/ptrace.2:1278
8830 msgid "B<PTRACE_EVENT_EXEC>"
8834 #: build/C/man2/ptrace.2:1285
8836 "Stop before return from B<execve>(2). Since Linux 3.0, "
8837 "B<PTRACE_GETEVENTMSG> returns the former thread ID."
8841 #: build/C/man2/ptrace.2:1285
8843 msgid "B<PTRACE_EVENT_EXIT>"
8847 #: build/C/man2/ptrace.2:1301
8849 "Stop before exit (including death from B<exit_group>(2)), signal death, or "
8850 "exit caused by B<execve>(2) in a multithreaded process. "
8851 "B<PTRACE_GETEVENTMSG> returns the exit status. Registers can be examined "
8852 "(unlike when \"real\" exit happens). The tracee is still alive; it needs to "
8853 "be B<PTRACE_CONT>ed or B<PTRACE_DETACH>ed to finish exiting."
8857 #: build/C/man2/ptrace.2:1301
8859 msgid "B<PTRACE_EVENT_STOP>"
8863 #: build/C/man2/ptrace.2:1313
8865 "Stop induced by B<PTRACE_INTERRUPT> command, or group-stop, or initial "
8866 "ptrace-stop when a new child is attached (only if attached using "
8867 "B<PTRACE_SEIZE>), or B<PTRACE_EVENT_STOP> if B<PTRACE_SEIZE> was used."
8871 #: build/C/man2/ptrace.2:1325
8873 "B<PTRACE_GETSIGINFO> on B<PTRACE_EVENT> stops returns B<SIGTRAP> in "
8874 "I<si_signo>, with I<si_code> set to I<(eventE<lt>E<lt>8)\\ |\\ SIGTRAP>."
8878 #: build/C/man2/ptrace.2:1325
8880 msgid "Syscall-stops"
8884 #: build/C/man2/ptrace.2:1338
8886 "If the tracee was restarted by B<PTRACE_SYSCALL>, the tracee enters "
8887 "syscall-enter-stop just prior to entering any system call. If the tracer "
8888 "restarts the tracee with B<PTRACE_SYSCALL>, the tracee enters "
8889 "syscall-exit-stop when the system call is finished, or if it is interrupted "
8890 "by a signal. (That is, signal-delivery-stop never happens between "
8891 "syscall-enter-stop and syscall-exit-stop; it happens I<after> "
8892 "syscall-exit-stop.)"
8896 #: build/C/man2/ptrace.2:1352
8898 "Other possibilities are that the tracee may stop in a B<PTRACE_EVENT> stop, "
8899 "exit (if it entered B<_exit>(2) or B<exit_group>(2)), be killed by "
8900 "B<SIGKILL>, or die silently (if it is a thread group leader, the "
8901 "B<execve>(2) happened in another thread, and that thread is not traced by "
8902 "the same tracer; this situation is discussed later)."
8906 #: build/C/man2/ptrace.2:1367
8908 "Syscall-enter-stop and syscall-exit-stop are observed by the tracer as "
8909 "B<waitpid>(2) returning with I<WIFSTOPPED(status)> true, and "
8910 "I<WSTOPSIG(status)> giving B<SIGTRAP>. If the B<PTRACE_O_TRACESYSGOOD> "
8911 "option was set by the tracer, then I<WSTOPSIG(status)> will give the value "
8912 "I<(SIGTRAP\\ |\\ 0x80)>."
8916 #: build/C/man2/ptrace.2:1373
8918 "Syscall-stops can be distinguished from signal-delivery-stop with B<SIGTRAP> "
8919 "by querying B<PTRACE_GETSIGINFO> for the following cases:"
8923 #: build/C/man2/ptrace.2:1373
8925 msgid "I<si_code> E<lt>= 0"
8929 #: build/C/man2/ptrace.2:1385
8931 "B<SIGTRAP> was delivered as a result of a user-space action, for example, a "
8932 "system call (B<tgkill>(2), B<kill>(2), B<sigqueue>(3), etc.), expiration of "
8933 "a POSIX timer, change of state on a POSIX message queue, or completion of an "
8934 "asynchronous I/O request."
8938 #: build/C/man2/ptrace.2:1385
8940 msgid "I<si_code> == SI_KERNEL (0x80)"
8944 #: build/C/man2/ptrace.2:1389
8945 msgid "B<SIGTRAP> was sent by the kernel."
8949 #: build/C/man2/ptrace.2:1389
8951 msgid "I<si_code> == SIGTRAP or I<si_code> == (SIGTRAP|0x80)"
8955 #: build/C/man2/ptrace.2:1392
8956 msgid "This is a syscall-stop."
8960 #: build/C/man2/ptrace.2:1397
8962 "However, syscall-stops happen very often (twice per system call), and "
8963 "performing B<PTRACE_GETSIGINFO> for every syscall-stop may be somewhat "
8968 #: build/C/man2/ptrace.2:1420
8970 "Some architectures allow the cases to be distinguished by examining "
8971 "registers. For example, on x86, I<rax> == -B<ENOSYS> in "
8972 "syscall-enter-stop. Since B<SIGTRAP> (like any other signal) always happens "
8973 "I<after> syscall-exit-stop, and at this point I<rax> almost never contains "
8974 "-B<ENOSYS>, the B<SIGTRAP> looks like \"syscall-stop which is not "
8975 "syscall-enter-stop\"; in other words, it looks like a \"stray "
8976 "syscall-exit-stop\" and can be detected this way. But such detection is "
8977 "fragile and is best avoided."
8981 #: build/C/man2/ptrace.2:1426
8983 "Using the B<PTRACE_O_TRACESYSGOOD> option is the recommended method to "
8984 "distinguish syscall-stops from other kinds of ptrace-stops, since it is "
8985 "reliable and does not incur a performance penalty."
8989 #: build/C/man2/ptrace.2:1437
8991 "Syscall-enter-stop and syscall-exit-stop are indistinguishable from each "
8992 "other by the tracer. The tracer needs to keep track of the sequence of "
8993 "ptrace-stops in order to not misinterpret syscall-enter-stop as "
8994 "syscall-exit-stop or vice versa. The rule is that syscall-enter-stop is "
8995 "always followed by syscall-exit-stop, B<PTRACE_EVENT> stop or the tracee's "
8996 "death; no other kinds of ptrace-stop can occur in between."
9000 #: build/C/man2/ptrace.2:1442
9002 "If after syscall-enter-stop, the tracer uses a restarting command other than "
9003 "B<PTRACE_SYSCALL>, syscall-exit-stop is not generated."
9007 #: build/C/man2/ptrace.2:1454
9009 "B<PTRACE_GETSIGINFO> on syscall-stops returns B<SIGTRAP> in I<si_signo>, "
9010 "with I<si_code> set to B<SIGTRAP> or I<(SIGTRAP|0x80)>."
9014 #: build/C/man2/ptrace.2:1454
9016 msgid "PTRACE_SINGLESTEP, PTRACE_SYSEMU, PTRACE_SYSEMU_SINGLESTEP stops"
9021 #. document stops occurring with PTRACE_SINGLESTEP, PTRACE_SYSEMU,
9022 #. PTRACE_SYSEMU_SINGLESTEP
9024 #: build/C/man2/ptrace.2:1460
9025 msgid "[Details of these kinds of stops are yet to be documented.]"
9029 #: build/C/man2/ptrace.2:1460
9031 msgid "Informational and restarting ptrace commands"
9035 #: build/C/man2/ptrace.2:1470
9037 "Most ptrace commands (all except B<PTRACE_ATTACH>, B<PTRACE_SEIZE>, "
9038 "B<PTRACE_TRACEME>, B<PTRACE_INTERRUPT>, and B<PTRACE_KILL>) require the "
9039 "tracee to be in a ptrace-stop, otherwise they fail with B<ESRCH>."
9043 #: build/C/man2/ptrace.2:1475
9045 "When the tracee is in ptrace-stop, the tracer can read and write data to the "
9046 "tracee using informational commands. These commands leave the tracee in "
9047 "ptrace-stopped state:"
9051 #: build/C/man2/ptrace.2:1487
9054 " ptrace(PTRACE_PEEKTEXT/PEEKDATA/PEEKUSER, pid, addr, 0);\n"
9055 " ptrace(PTRACE_POKETEXT/POKEDATA/POKEUSER, pid, addr, long_val);\n"
9056 " ptrace(PTRACE_GETREGS/GETFPREGS, pid, 0, &struct);\n"
9057 " ptrace(PTRACE_SETREGS/SETFPREGS, pid, 0, &struct);\n"
9058 " ptrace(PTRACE_GETREGSET, pid, NT_foo, &iov);\n"
9059 " ptrace(PTRACE_SETREGSET, pid, NT_foo, &iov);\n"
9060 " ptrace(PTRACE_GETSIGINFO, pid, 0, &siginfo);\n"
9061 " ptrace(PTRACE_SETSIGINFO, pid, 0, &siginfo);\n"
9062 " ptrace(PTRACE_GETEVENTMSG, pid, 0, &long_var);\n"
9063 " ptrace(PTRACE_SETOPTIONS, pid, 0, PTRACE_O_flags);\n"
9067 #: build/C/man2/ptrace.2:1499
9069 "Note that some errors are not reported. For example, setting signal "
9070 "information (I<siginfo>) may have no effect in some ptrace-stops, yet the "
9071 "call may succeed (return 0 and not set I<errno>); querying "
9072 "B<PTRACE_GETEVENTMSG> may succeed and return some random value if current "
9073 "ptrace-stop is not documented as returning a meaningful event message."
9077 #: build/C/man2/ptrace.2:1501
9082 #: build/C/man2/ptrace.2:1503
9084 msgid " ptrace(PTRACE_SETOPTIONS, pid, 0, PTRACE_O_flags);\n"
9088 #: build/C/man2/ptrace.2:1512
9090 "affects one tracee. The tracee's current flags are replaced. Flags are "
9091 "inherited by new tracees created and \"auto-attached\" via active "
9092 "B<PTRACE_O_TRACEFORK>, B<PTRACE_O_TRACEVFORK>, or B<PTRACE_O_TRACECLONE> "
9097 #: build/C/man2/ptrace.2:1515
9099 "Another group of commands makes the ptrace-stopped tracee run. They have "
9104 #: build/C/man2/ptrace.2:1517
9106 msgid " ptrace(cmd, pid, 0, sig);\n"
9110 #: build/C/man2/ptrace.2:1538
9112 "where I<cmd> is B<PTRACE_CONT>, B<PTRACE_LISTEN>, B<PTRACE_DETACH>, "
9113 "B<PTRACE_SYSCALL>, B<PTRACE_SINGLESTEP>, B<PTRACE_SYSEMU>, or "
9114 "B<PTRACE_SYSEMU_SINGLESTEP>. If the tracee is in signal-delivery-stop, "
9115 "I<sig> is the signal to be injected (if it is nonzero). Otherwise, I<sig> "
9116 "may be ignored. (When restarting a tracee from a ptrace-stop other than "
9117 "signal-delivery-stop, recommended practice is to always pass 0 in I<sig>.)"
9121 #: build/C/man2/ptrace.2:1538
9123 msgid "Attaching and detaching"
9127 #: build/C/man2/ptrace.2:1540
9128 msgid "A thread can be attached to the tracer using the call"
9132 #: build/C/man2/ptrace.2:1542
9134 msgid " ptrace(PTRACE_ATTACH, pid, 0, 0);\n"
9138 #: build/C/man2/ptrace.2:1544 build/C/man2/ptrace.2:2047
9143 #: build/C/man2/ptrace.2:1546
9145 msgid " ptrace(PTRACE_SEIZE, pid, 0, PTRACE_O_flags);\n"
9149 #. FIXME: Describe how to attach to a thread which is already
9152 #: build/C/man2/ptrace.2:1571
9154 "B<PTRACE_ATTACH> sends B<SIGSTOP> to this thread. If the tracer wants this "
9155 "B<SIGSTOP> to have no effect, it needs to suppress it. Note that if other "
9156 "signals are concurrently sent to this thread during attach, the tracer may "
9157 "see the tracee enter signal-delivery-stop with other signal(s) first! The "
9158 "usual practice is to reinject these signals until B<SIGSTOP> is seen, then "
9159 "suppress B<SIGSTOP> injection. The design bug here is that a ptrace attach "
9160 "and a concurrently delivered B<SIGSTOP> may race and the concurrent "
9161 "B<SIGSTOP> may be lost."
9165 #: build/C/man2/ptrace.2:1578
9167 "Since attaching sends B<SIGSTOP> and the tracer usually suppresses it, this "
9168 "may cause a stray B<EINTR> return from the currently executing system call "
9169 "in the tracee, as described in the \"Signal injection and suppression\" "
9174 #: build/C/man2/ptrace.2:1590
9176 "Since Linux 3.4, B<PTRACE_SEIZE> can be used instead of B<PTRACE_ATTACH>. "
9177 "B<PTRACE_SEIZE> does not stop the attached process. If you need to stop it "
9178 "after attach (or at any other time) without sending it any signals, use "
9179 "B<PTRACE_INTERRUPT> command."
9183 #: build/C/man2/ptrace.2:1592
9188 #: build/C/man2/ptrace.2:1594
9190 msgid " ptrace(PTRACE_TRACEME, 0, 0, 0);\n"
9194 #: build/C/man2/ptrace.2:1600
9196 "turns the calling thread into a tracee. The thread continues to run "
9197 "(doesn't enter ptrace-stop). A common practice is to follow the "
9198 "B<PTRACE_TRACEME> with"
9202 #: build/C/man2/ptrace.2:1602
9204 msgid " raise(SIGSTOP);\n"
9208 #: build/C/man2/ptrace.2:1605
9210 "and allow the parent (which is our tracer now) to observe our "
9211 "signal-delivery-stop."
9215 #: build/C/man2/ptrace.2:1629
9217 "If the B<PTRACE_O_TRACEFORK>, B<PTRACE_O_TRACEVFORK>, or "
9218 "B<PTRACE_O_TRACECLONE> options are in effect, then children created by, "
9219 "respectively, B<vfork>(2) or B<clone>(2) with the B<CLONE_VFORK> flag, "
9220 "B<fork>(2) or B<clone>(2) with the exit signal set to B<SIGCHLD>, and "
9221 "other kinds of B<clone>(2), are automatically attached to the same tracer "
9222 "which traced their parent. B<SIGSTOP> is delivered to the children, causing "
9223 "them to enter signal-delivery-stop after they exit the system call which "
9228 #: build/C/man2/ptrace.2:1631
9229 msgid "Detaching of the tracee is performed by:"
9233 #: build/C/man2/ptrace.2:1633
9235 msgid " ptrace(PTRACE_DETACH, pid, 0, sig);\n"
9239 #: build/C/man2/ptrace.2:1641
9241 "B<PTRACE_DETACH> is a restarting operation; therefore it requires the tracee "
9242 "to be in ptrace-stop. If the tracee is in signal-delivery-stop, a signal "
9243 "can be injected. Otherwise, the I<sig> parameter may be silently ignored."
9246 #. FIXME: Describe how to detach from a group-stopped tracee so that it
9247 #. doesn't run, but continues to wait for SIGCONT.
9249 #: build/C/man2/ptrace.2:1665
9251 "If the tracee is running when the tracer wants to detach it, the usual "
9252 "solution is to send B<SIGSTOP> (using B<tgkill>(2), to make sure it goes to "
9253 "the correct thread), wait for the tracee to stop in signal-delivery-stop for "
9254 "B<SIGSTOP> and then detach it (suppressing B<SIGSTOP> injection). A design "
9255 "bug is that this can race with concurrent B<SIGSTOP>s. Another complication "
9256 "is that the tracee may enter other ptrace-stops and needs to be restarted "
9257 "and waited for again, until B<SIGSTOP> is seen. Yet another complication is "
9258 "to be sure that the tracee is not already ptrace-stopped, because no signal "
9259 "delivery happens while it is\\(emnot even B<SIGSTOP>."
9263 #: build/C/man2/ptrace.2:1673
9265 "If the tracer dies, all tracees are automatically detached and restarted, "
9266 "unless they were in group-stop. Handling of restart from group-stop is "
9267 "currently buggy, but the \"as planned\" behavior is to leave tracee stopped "
9268 "and waiting for B<SIGCONT>. If the tracee is restarted from "
9269 "signal-delivery-stop, the pending signal is injected."
9273 #: build/C/man2/ptrace.2:1673
9275 msgid "execve(2) under ptrace"
9278 #. clone(2) CLONE_THREAD says:
9279 #. If any of the threads in a thread group performs an execve(2),
9280 #. then all threads other than the thread group leader are terminated,
9281 #. and the new program is executed in the thread group leader.
9283 #. In kernel 3.1 sources, see fs/exec.c::de_thread()
9285 #: build/C/man2/ptrace.2:1692
9287 "When one thread in a multithreaded process calls B<execve>(2), the kernel "
9288 "destroys all other threads in the process, and resets the thread ID of the "
9289 "execing thread to the thread group ID (process ID). (Or, to put things "
9290 "another way, when a multithreaded process does an B<execve>(2), at "
9291 "completion of the call, it appears as though the B<execve>(2) occurred in "
9292 "the thread group leader, regardless of which thread did the B<execve>(2).) "
9293 "This resetting of the thread ID looks very confusing to tracers:"
9297 #: build/C/man2/ptrace.2:1702
9299 "All other threads stop in B<PTRACE_EVENT_EXIT> stop, if the "
9300 "B<PTRACE_O_TRACEEXIT> option was turned on. Then all other threads except "
9301 "the thread group leader report death as if they exited via B<_exit>(2) with "
9306 #: build/C/man2/ptrace.2:1710
9308 "The execing tracee changes its thread ID while it is in the B<execve>(2). "
9309 "(Remember, under ptrace, the \"pid\" returned from B<waitpid>(2), or fed "
9310 "into ptrace calls, is the tracee's thread ID.) That is, the tracee's thread "
9311 "ID is reset to be the same as its process ID, which is the same as the "
9312 "thread group leader's thread ID."
9316 #: build/C/man2/ptrace.2:1716
9318 "Then a B<PTRACE_EVENT_EXEC> stop happens, if the B<PTRACE_O_TRACEEXEC> "
9319 "option was turned on."
9323 #: build/C/man2/ptrace.2:1737
9325 "If the thread group leader has reported its B<PTRACE_EVENT_EXIT> stop by "
9326 "this time, it appears to the tracer that the dead thread leader \"reappears "
9327 "from nowhere\". (Note: the thread group leader does not report death via "
9328 "I<WIFEXITED(status)> until there is at least one other live thread. This "
9329 "eliminates the possibility that the tracer will see it dying and then "
9330 "reappearing.) If the thread group leader was still alive, for the tracer "
9331 "this may look as if thread group leader returns from a different system call "
9332 "than it entered, or even \"returned from a system call even though it was "
9333 "not in any system call\". If the thread group leader was not traced (or was "
9334 "traced by a different tracer), then during B<execve>(2) it will appear as "
9335 "if it has become a tracee of the tracer of the execing tracee."
9339 #: build/C/man2/ptrace.2:1740
9341 "All of the above effects are the artifacts of the thread ID change in the "
9346 #: build/C/man2/ptrace.2:1760
9348 "The B<PTRACE_O_TRACEEXEC> option is the recommended tool for dealing with "
9349 "this situation. First, it enables B<PTRACE_EVENT_EXEC> stop, which occurs "
9350 "before B<execve>(2) returns. In this stop, the tracer can use "
9351 "B<PTRACE_GETEVENTMSG> to retrieve the tracee's former thread ID. (This "
9352 "feature was introduced in Linux 3.0). Second, the B<PTRACE_O_TRACEEXEC> "
9353 "option disables legacy B<SIGTRAP> generation on B<execve>(2)."
9357 #: build/C/man2/ptrace.2:1766
9359 "When the tracer receives B<PTRACE_EVENT_EXEC> stop notification, it is "
9360 "guaranteed that except this tracee and the thread group leader, no other "
9361 "threads from the process are alive."
9365 #: build/C/man2/ptrace.2:1774
9367 "On receiving the B<PTRACE_EVENT_EXEC> stop notification, the tracer should "
9368 "clean up all its internal data structures describing the threads of this "
9369 "process, and retain only one data structure\\(emone which describes the "
9370 "single still running tracee, with"
9374 #: build/C/man2/ptrace.2:1776
9376 msgid " thread ID == thread group ID == process ID.\n"
9380 #: build/C/man2/ptrace.2:1780
9381 msgid "Example: two threads call B<execve>(2) at the same time:"
9385 #: build/C/man2/ptrace.2:1791
9388 "*** we get syscall-enter-stop in thread 1: **\n"
9389 "PID1 execve(\"/bin/foo\", \"foo\" E<lt>unfinished ...E<gt>\n"
9390 "*** we issue PTRACE_SYSCALL for thread 1 **\n"
9391 "*** we get syscall-enter-stop in thread 2: **\n"
9392 "PID2 execve(\"/bin/bar\", \"bar\" E<lt>unfinished ...E<gt>\n"
9393 "*** we issue PTRACE_SYSCALL for thread 2 **\n"
9394 "*** we get PTRACE_EVENT_EXEC for PID0, we issue PTRACE_SYSCALL **\n"
9395 "*** we get syscall-exit-stop for PID0: **\n"
9396 "PID0 E<lt>... execve resumedE<gt> ) = 0\n"
9400 #: build/C/man2/ptrace.2:1814
9402 "If the B<PTRACE_O_TRACEEXEC> option is I<not> in effect for the execing "
9403 "tracee, the kernel delivers an extra B<SIGTRAP> to the tracee after "
9404 "B<execve>(2) returns. This is an ordinary signal (similar to one which can "
9405 "be generated by I<kill -TRAP>), not a special kind of ptrace-stop. "
9406 "Employing B<PTRACE_GETSIGINFO> for this signal returns I<si_code> set to 0 "
9407 "(I<SI_USER>). This signal may be blocked by signal mask, and thus may be "
9408 "delivered (much) later."
9412 #: build/C/man2/ptrace.2:1833
9414 "Usually, the tracer (for example, B<strace>(1)) would not want to show this "
9415 "extra post-execve B<SIGTRAP> signal to the user, and would suppress its "
9416 "delivery to the tracee (if B<SIGTRAP> is set to B<SIG_DFL>, it is a killing "
9417 "signal). However, determining I<which> B<SIGTRAP> to suppress is not easy. "
9418 "Setting the B<PTRACE_O_TRACEEXEC> option and thus suppressing this extra "
9419 "B<SIGTRAP> is the recommended approach."
9423 #: build/C/man2/ptrace.2:1833
9429 #: build/C/man2/ptrace.2:1840
9431 "The ptrace API (ab)uses the standard UNIX parent/child signaling over "
9432 "B<waitpid>(2). This used to cause the real parent of the process to stop "
9433 "receiving several kinds of B<waitpid>(2) notifications when the child "
9434 "process is traced by some other process."
9438 #: build/C/man2/ptrace.2:1843
9440 "Many of these bugs have been fixed, but as of Linux 2.6.38 several still "
9441 "exist; see BUGS below."
9445 #: build/C/man2/ptrace.2:1845
9446 msgid "As of Linux 2.6.38, the following is believed to work correctly:"
9450 #: build/C/man2/ptrace.2:1853
9452 "exit/death by signal is reported first to the tracer, then, when the tracer "
9453 "consumes the B<waitpid>(2) result, to the real parent (to the real parent "
9454 "only when the whole multithreaded process exits). If the tracer and the "
9455 "real parent are the same process, the report is sent only once."
9459 #: build/C/man2/ptrace.2:1858
9461 "On success, the B<PTRACE_PEEK*> requests return the requested data (but see "
9462 "NOTES), while other requests return zero."
9466 #: build/C/man2/ptrace.2:1868
9468 "On error, all requests return -1, and I<errno> is set appropriately. Since "
9469 "the value returned by a successful B<PTRACE_PEEK*> request may be -1, the "
9470 "caller must clear I<errno> before the call, and then check it afterward to "
9471 "determine whether or not an error occurred."
9475 #: build/C/man2/ptrace.2:1872
9476 msgid "(i386 only) There was an error with allocating or freeing a debug register."
9480 #: build/C/man2/ptrace.2:1883
9482 "There was an attempt to read from or write to an invalid area in the "
9483 "tracer's or the tracee's memory, probably because the area wasn't mapped or "
9484 "accessible. Unfortunately, under Linux, different variations of this fault "
9485 "will return B<EIO> or B<EFAULT> more or less arbitrarily."
9489 #: build/C/man2/ptrace.2:1886
9490 msgid "An attempt was made to set an invalid option."
9494 #: build/C/man2/ptrace.2:1893
9496 "I<request> is invalid, or an attempt was made to read from or write to an "
9497 "invalid area in the tracer's or the tracee's memory, or there was a "
9498 "word-alignment violation, or an invalid signal was specified during a "
9503 #: build/C/man2/ptrace.2:1906
9505 "The specified process cannot be traced. This could be because the tracer "
9506 "has insufficient privileges (the required capability is B<CAP_SYS_PTRACE>); "
9507 "unprivileged processes cannot trace processes that they cannot send signals "
9508 "to or those running set-user-ID/set-group-ID programs, for obvious reasons. "
9509 "Alternatively, the process may already be being traced, or (on kernels "
9510 "before 2.6.26) be B<init>(8) (PID 1)."
9514 #: build/C/man2/ptrace.2:1911
9516 "The specified process does not exist, or is not currently being traced by "
9517 "the caller, or is not stopped (for requests that require a stopped tracee)."
9521 #: build/C/man2/ptrace.2:1913
9522 msgid "SVr4, 4.3BSD."
9526 #: build/C/man2/ptrace.2:1928
9528 "Although arguments to B<ptrace>() are interpreted according to the "
9529 "prototype given, glibc currently declares B<ptrace>() as a variadic "
9530 "function with only the I<request> argument fixed. It is recommended to "
9531 "always supply four arguments, even if the requested operation does not use "
9532 "them, setting unused/ignored arguments to I<0L> or I<(void\\ *)\\ 0>."
9536 #: build/C/man2/ptrace.2:1940
9538 "At the system call level, the B<PTRACE_PEEKTEXT>, B<PTRACE_PEEKDATA>, and "
9539 "B<PTRACE_PEEKUSER> requests have a different API: they store the result at "
9540 "the address specified by the I<data> parameter, and the return value is the "
9541 "error flag. The glibc wrapper function provides the API given in "
9542 "DESCRIPTION above, with the result being returned via the function return "
9546 #. See commit 00cd5c37afd5f431ac186dd131705048c0a11fdb
9548 #: build/C/man2/ptrace.2:1945
9550 "In Linux kernels before 2.6.26, B<init>(8), the process with PID 1, may not "
9554 #. See http://lkml.org/lkml/2008/5/8/375
9556 #: build/C/man2/ptrace.2:1952
9558 "The layout of the contents of memory and the USER area are quite "
9559 "operating-system- and architecture-specific. The offset supplied, and the "
9560 "data returned, might not entirely match with the definition of I<struct "
9565 #: build/C/man2/ptrace.2:1955
9567 "The size of a \"word\" is determined by the operating-system variant (e.g., "
9568 "for 32-bit Linux it is 32 bits)."
9572 #: build/C/man2/ptrace.2:1963
9574 "This page documents the way the B<ptrace>() call works currently in Linux. "
9575 "Its behavior differs significantly on other flavors of UNIX. In any case, "
9576 "use of B<ptrace>() is highly specific to the operating system and "
9581 #: build/C/man2/ptrace.2:1974
9583 "On hosts with 2.6 kernel headers, B<PTRACE_SETOPTIONS> is declared with a "
9584 "different value than the one for 2.4. This leads to applications compiled "
9585 "with 2.6 kernel headers failing when run on 2.4 kernels. This can be worked "
9586 "around by redefining B<PTRACE_SETOPTIONS> to B<PTRACE_OLDSETOPTIONS>, if "
9591 #: build/C/man2/ptrace.2:1977
9593 "Group-stop notifications are sent to the tracer, but not to real parent. "
9594 "Last confirmed on 2.6.38.6."
9597 #. Note from Denys Vlasenko:
9598 #. Here "exits" means any kind of death - _exit, exit_group,
9599 #. signal death. Signal death and exit_group cases are trivial,
9600 #. though: since signal death and exit_group kill all other threads
9601 #. too, "until all other threads exit" thing happens rather soon
9602 #. in these cases. Therefore, only _exit presents observably
9603 #. puzzling behavior to ptrace users: thread leader _exit's,
9604 #. but WIFEXITED isn't reported! We are trying to explain here
9606 #. FIXME: ^^^ need to test/verify this scenario
9608 #: build/C/man2/ptrace.2:2008
9610 "If a thread group leader is traced and exits by calling B<_exit>(2), a "
9611 "B<PTRACE_EVENT_EXIT> stop will happen for it (if requested), but the "
9612 "subsequent B<WIFEXITED> notification will not be delivered until all other "
9613 "threads exit. As explained above, if one of other threads calls "
9614 "B<execve>(2), the death of the thread group leader will I<never> be "
9615 "reported. If the execed thread is not traced by this tracer, the tracer "
9616 "will never know that B<execve>(2) happened. One possible workaround is to "
9617 "B<PTRACE_DETACH> the thread group leader instead of restarting it in this "
9618 "case. Last confirmed on 2.6.38.6."
9622 #: build/C/man2/ptrace.2:2018
9624 "A B<SIGKILL> signal may still cause a B<PTRACE_EVENT_EXIT> stop before "
9625 "actual signal death. This may be changed in the future; B<SIGKILL> is meant "
9626 "to always immediately kill tasks even under ptrace. Last confirmed on "
9631 #: build/C/man2/ptrace.2:2036
9633 "Some system calls return with B<EINTR> if a signal was sent to a tracee, but "
9634 "delivery was suppressed by the tracer. (This is very typical operation: it "
9635 "is usually done by debuggers on every attach, in order to not introduce a "
9636 "bogus B<SIGSTOP>). As of Linux 3.2.9, the following system calls are "
9637 "affected (this list is likely incomplete): B<epoll_wait>(2), and B<read>(2) "
9638 "from an B<inotify>(7) file descriptor. The usual symptom of this bug is "
9639 "that when you attach to a quiescent process with the command"
9643 #: build/C/man2/ptrace.2:2038
9645 msgid " strace -p E<lt>process-IDE<gt>\n"
9649 #: build/C/man2/ptrace.2:2041
9650 msgid "then, instead of the usual and expected one-line output such as"
9654 #: build/C/man2/ptrace.2:2044
9656 msgid " restart_syscall(E<lt>... resuming interrupted call ...E<gt>_\n"
9660 #: build/C/man2/ptrace.2:2050
9662 msgid " select(6, [5], NULL, [5], NULL_\n"
9666 #: build/C/man2/ptrace.2:2054
9668 "('_' denotes the cursor position), you observe more than one line. For "
9673 #: build/C/man2/ptrace.2:2058
9676 " clock_gettime(CLOCK_MONOTONIC, {15370, 690928118}) = 0\n"
9681 #: build/C/man2/ptrace.2:2079
9683 "What is not visible here is that the process was blocked in B<epoll_wait>(2) "
9684 "before B<strace>(1) has attached to it. Attaching caused B<epoll_wait>(2) "
9685 "to return to user space with the error B<EINTR>. In this particular case, "
9686 "the program reacted to B<EINTR> by checking the current time, and then "
9687 "executing B<epoll_wait>(2) again. (Programs which do not expect such "
9688 "\"stray\" B<EINTR> errors may behave in an unintended way upon an "
9689 "B<strace>(1) attach.)"
9693 #: build/C/man2/ptrace.2:2093
9695 "B<gdb>(1), B<strace>(1), B<clone>(2), B<execve>(2), B<fork>(2), "
9696 "B<gettid>(2), B<sigaction>(2), B<tgkill>(2), B<vfork>(2), B<waitpid>(2), "
9697 "B<exec>(3), B<capabilities>(7), B<signal>(7)"
9701 #: build/C/man2/quotactl.2:27
9707 #: build/C/man2/quotactl.2:27
9713 #: build/C/man2/quotactl.2:30
9714 msgid "quotactl - manipulate disk quotas"
9718 #: build/C/man2/quotactl.2:34
9721 "B<#include E<lt>sys/quota.hE<gt>>\n"
9722 "B<#include E<lt>xfs/xqm.hE<gt>>\n"
9726 #: build/C/man2/quotactl.2:37
9729 "B<int quotactl(int >I<cmd>B<, const char *>I<special>B<, int >I<id>B<, "
9730 "caddr_t >I<addr>B<);>\n"
9734 #: build/C/man2/quotactl.2:49
9736 "The quota system can be used to set per-user and per-group limits on the "
9737 "amount of disk space used on a filesystem. For each user and/or group, a "
9738 "soft limit and a hard limit can be set for each filesystem. The hard limit "
9739 "can't be exceeded. The soft limit can be exceeded, but warnings will "
9740 "ensue. Moreover, the user can't exceed the soft limit for more than one "
9741 "week (by default) at a time; after this time, the soft limit counts as a "
9746 #: build/C/man2/quotactl.2:74
9748 "The B<quotactl>() call manipulates disk quotas. The I<cmd> argument "
9749 "indicates a command to be applied to the user or group ID specified in "
9750 "I<id>. To initialize the I<cmd> argument, use the I<QCMD(subcmd, type)> "
9751 "macro. The I<type> value is either B<USRQUOTA>, for user quotas, or "
9752 "B<GRPQUOTA>, for group quotas. The I<subcmd> value is described below."
9756 #: build/C/man2/quotactl.2:79
9758 "The I<special> argument is a pointer to a null-terminated string containing "
9759 "the pathname of the (mounted) block special device for the filesystem being "
9764 #: build/C/man2/quotactl.2:87
9766 "The I<addr> argument is the address of an optional, command-specific, data "
9767 "structure that is copied in or out of the system. The interpretation of "
9768 "I<addr> is given with each command below."
9772 #: build/C/man2/quotactl.2:91
9773 msgid "The I<subcmd> value is one of the following:"
9777 #: build/C/man2/quotactl.2:91
9779 msgid "B<Q_QUOTAON>"
9783 #: build/C/man2/quotactl.2:98
9785 "Turn on quotas for a filesystem. The I<id> argument is the identification "
9786 "number of the quota format to be used. Currently, there are three supported "
9791 #: build/C/man2/quotactl.2:99
9793 msgid "B<QFMT_VFS_OLD>"
9797 #: build/C/man2/quotactl.2:102
9798 msgid "The original quota format."
9802 #: build/C/man2/quotactl.2:102
9804 msgid "B<QFMT_VFS_V0>"
9808 #: build/C/man2/quotactl.2:106
9810 "The standard VFS v0 quota format, which can handle 32-bit UIDs and GIDs and "
9811 "quota limits up to 2^42 bytes and 2^32 inodes."
9815 #: build/C/man2/quotactl.2:106
9817 msgid "B<QFMT_VFS_V1>"
9821 #: build/C/man2/quotactl.2:110
9823 "A quota format that can handle 32-bit UIDs and GIDs and quota limits of 2^64 "
9824 "bytes and 2^64 inodes."
9828 #: build/C/man2/quotactl.2:121
9830 "The I<addr> argument points to the pathname of a file containing the quotas "
9831 "for the filesystem. The quota file must exist; it is normally created with "
9832 "the B<quotacheck>(8) program. This operation requires privilege "
9833 "(B<CAP_SYS_ADMIN>)."
9837 #: build/C/man2/quotactl.2:121
9839 msgid "B<Q_QUOTAOFF>"
9843 #: build/C/man2/quotactl.2:131
9845 "Turn off quotas for a filesystem. The I<addr> and I<id> arguments are "
9846 "ignored. This operation requires privilege (B<CAP_SYS_ADMIN>)."
9850 #: build/C/man2/quotactl.2:131
9852 msgid "B<Q_GETQUOTA>"
9856 #: build/C/man2/quotactl.2:142
9858 "Get disk quota limits and current usage for user or group I<id>. The "
9859 "I<addr> argument is a pointer to a I<dqblk> structure defined in "
9860 "I<E<lt>sys/quota.hE<gt>> as follows:"
9864 #: build/C/man2/quotactl.2:147 build/C/man2/quotactl.2:234
9867 "/* uint64_t is an unsigned 64-bit integer;\n"
9868 " uint32_t is an unsigned 32-bit integer */\n"
9872 #: build/C/man2/quotactl.2:167
9875 "struct dqblk { /* Definition since Linux 2.4.22 */\n"
9876 " uint64_t dqb_bhardlimit; /* absolute limit on disk\n"
9877 " quota blocks alloc */\n"
9878 " uint64_t dqb_bsoftlimit; /* preferred limit on\n"
9879 " disk quota blocks */\n"
9880 " uint64_t dqb_curspace; /* current quota block\n"
9882 " uint64_t dqb_ihardlimit; /* maximum number of\n"
9883 " allocated inodes */\n"
9884 " uint64_t dqb_isoftlimit; /* preferred inode limit */\n"
9885 " uint64_t dqb_curinodes; /* current number of\n"
9886 " allocated inodes */\n"
9887 " uint64_t dqb_btime; /* time limit for excessive\n"
9889 " uint64_t dqb_itime; /* time limit for excessive\n"
9891 " uint32_t dqb_valid; /* bit mask of QIF_*\n"
9897 #: build/C/man2/quotactl.2:170
9900 "/* Flags in dqb_valid that indicate which fields in\n"
9901 " dqblk structure are valid. */\n"
9905 #: build/C/man2/quotactl.2:181
9908 "#define QIF_BLIMITS 1\n"
9909 "#define QIF_SPACE 2\n"
9910 "#define QIF_ILIMITS 4\n"
9911 "#define QIF_INODES 8\n"
9912 "#define QIF_BTIME 16\n"
9913 "#define QIF_ITIME 32\n"
9914 "#define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS)\n"
9915 "#define QIF_USAGE (QIF_SPACE | QIF_INODES)\n"
9916 "#define QIF_TIMES (QIF_BTIME | QIF_ITIME)\n"
9917 "#define QIF_ALL (QIF_LIMITS | QIF_USAGE | QIF_TIMES)\n"
9921 #: build/C/man2/quotactl.2:198
9923 "The I<dqb_valid> field is a bit mask that is set to indicate the entries in "
9924 "the I<dqblk> structure that are valid. Currently, the kernel fills in all "
9925 "entries of the I<dqblk> structure and marks them as valid in the "
9926 "I<dqb_valid> field. Unprivileged users may retrieve only their own quotas; "
9927 "a privileged user (B<CAP_SYS_ADMIN>) can retrieve the quotas of any user."
9931 #: build/C/man2/quotactl.2:198
9933 msgid "B<Q_SETQUOTA>"
9937 #: build/C/man2/quotactl.2:218
9939 "Set quota information for user or group I<id>, using the information "
9940 "supplied in the I<dqblk> structure pointed to by I<addr>. The I<dqb_valid> "
9941 "field of the I<dqblk> structure indicates which entries in the structure "
9942 "have been set by the caller. This operation supersedes the B<Q_SETQLIM> and "
9943 "B<Q_SETUSE> operations in the previous quota interfaces. This operation "
9944 "requires privilege (B<CAP_SYS_ADMIN>)."
9948 #: build/C/man2/quotactl.2:218
9950 msgid "B<Q_GETINFO>"
9954 #: build/C/man2/quotactl.2:229
9956 "Get information (like grace times) about quotafile. The I<addr> argument "
9957 "should be a pointer to a I<dqinfo> structure. This structure is defined in "
9958 "I<E<lt>sys/quota.hE<gt>> as follows:"
9962 #: build/C/man2/quotactl.2:238
9965 "struct dqinfo { /* Defined since kernel 2.4.22 */\n"
9966 " uint64_t dqi_bgrace; /* Time before block soft limit\n"
9967 " becomes hard limit */\n"
9971 #: build/C/man2/quotactl.2:245
9974 " uint64_t dqi_igrace; /* Time before inode soft limit\n"
9975 " becomes hard limit */\n"
9976 " uint32_t dqi_flags; /* Flags for quotafile\n"
9978 " uint32_t dqi_valid;\n"
9983 #: build/C/man2/quotactl.2:247
9985 msgid "/* Bits for dqi_flags */\n"
9989 #: build/C/man2/quotactl.2:249
9991 msgid "/* Quota format QFMT_VFS_OLD */\n"
9995 #: build/C/man2/quotactl.2:251
9997 msgid "#define V1_DQF_RSQUASH\t1 /* Root squash enabled */\n"
10000 #. type: Plain text
10001 #: build/C/man2/quotactl.2:253
10003 msgid "/* Other quota formats have no dqi_flags bits defined */\n"
10006 #. type: Plain text
10007 #: build/C/man2/quotactl.2:256
10010 "/* Flags in dqi_valid that indicate which fields in\n"
10011 " dqinfo structure are valid. */\n"
10014 #. type: Plain text
10015 #: build/C/man2/quotactl.2:261
10018 "# define IIF_BGRACE\t1\n"
10019 "# define IIF_IGRACE\t2\n"
10020 "# define IIF_FLAGS\t4\n"
10021 "# define IIF_ALL (IIF_BGRACE | IIF_IGRACE | IIF_FLAGS)\n"
10024 #. type: Plain text
10025 #: build/C/man2/quotactl.2:277
10027 "The I<dqi_valid> field in the I<dqinfo> structure indicates the entries in "
10028 "the structure that are valid. Currently, the kernel fills in all entries of "
10029 "the I<dqinfo> structure and marks them all as valid in the I<dqi_valid> "
10030 "field. The I<id> argument is ignored."
10034 #: build/C/man2/quotactl.2:277
10036 msgid "B<Q_SETINFO>"
10039 #. type: Plain text
10040 #: build/C/man2/quotactl.2:301
10042 "Set information about quotafile. The I<addr> argument should be a pointer "
10043 "to a I<dqinfo> structure. The I<dqi_valid> field of the I<dqinfo> structure "
10044 "indicates the entries in the structure that have been set by the caller. "
10045 "This operation supersedes the B<Q_SETGRACE> and B<Q_SETFLAGS> operations in "
10046 "the previous quota interfaces. The I<id> argument is ignored. This "
10047 "operation requires privilege (B<CAP_SYS_ADMIN>)."
10051 #: build/C/man2/quotactl.2:301
10053 msgid "B<Q_GETFMT>"
10056 #. type: Plain text
10057 #: build/C/man2/quotactl.2:308
10059 "Get quota format used on the specified filesystem. The I<addr> argument "
10060 "should be a pointer to a 4-byte buffer where the format number will be "
10065 #: build/C/man2/quotactl.2:308
10070 #. type: Plain text
10071 #: build/C/man2/quotactl.2:319
10073 "Update the on-disk copy of quota usages for a filesystem. If I<special> is "
10074 "NULL, then all filesystems with active quotas are sync'ed. The I<addr> and "
10075 "I<id> arguments are ignored."
10079 #: build/C/man2/quotactl.2:319
10081 msgid "B<Q_GETSTATS>"
10084 #. Q_GETSTATS was removed in kernel 2.4.22.
10085 #. type: Plain text
10086 #: build/C/man2/quotactl.2:339
10088 "Get statistics and other generic information about the quota subsystem. The "
10089 "I<addr> argument should be a pointer to a I<dqstats> structure in which data "
10090 "should be stored. This structure is defined in I<E<lt>sys/quota.hE<gt>>. "
10091 "The I<special> and I<id> arguments are ignored. This operation is obsolete "
10092 "and not supported by recent kernels. Files in I</proc/sys/fs/quota/> carry "
10093 "the information instead."
10096 #. type: Plain text
10097 #: build/C/man2/quotactl.2:342
10099 "For XFS filesystems making use of the XFS Quota Manager (XQM), the above "
10100 "commands are bypassed and the following commands are used:"
10104 #: build/C/man2/quotactl.2:342
10106 msgid "B<Q_XQUOTAON>"
10109 #. type: Plain text
10110 #: build/C/man2/quotactl.2:363
10112 "Turn on quotas for an XFS filesystem. XFS provides the ability to turn "
10113 "on/off quota limit enforcement with quota accounting. Therefore, XFS "
10114 "expects I<addr> to be a pointer to an I<unsigned int> that contains either "
10115 "the flags B<XFS_QUOTA_UDQ_ACCT> and/or B<XFS_QUOTA_UDQ_ENFD> (for user "
10116 "quota), or B<XFS_QUOTA_GDQ_ACCT> and/or B<XFS_QUOTA_GDQ_ENFD> (for group "
10117 "quota), as defined in I<E<lt>xfs/xqm.hE<gt>>. This operation requires "
10118 "privilege (B<CAP_SYS_ADMIN>)."
10122 #: build/C/man2/quotactl.2:363
10124 msgid "B<Q_XQUOTAOFF>"
10127 #. type: Plain text
10128 #: build/C/man2/quotactl.2:374
10130 "Turn off quotas for an XFS filesystem. As with B<Q_QUOTAON>, XFS "
10131 "filesystems expect a pointer to an I<unsigned int> that specifies whether "
10132 "quota accounting and/or limit enforcement need to be turned off. This "
10133 "operation requires privilege (B<CAP_SYS_ADMIN>)."
10137 #: build/C/man2/quotactl.2:374
10139 msgid "B<Q_XGETQUOTA>"
10142 #. type: Plain text
10143 #: build/C/man2/quotactl.2:388
10145 "Get disk quota limits and current usage for user I<id>. The I<addr> "
10146 "argument is a pointer to an I<fs_disk_quota> structure (defined in "
10147 "I<E<lt>xfs/xqm.hE<gt>>). Unprivileged users may retrieve only their own "
10148 "quotas; a privileged user (B<CAP_SYS_ADMIN>) may retrieve the quotas of any "
10153 #: build/C/man2/quotactl.2:388
10155 msgid "B<Q_XSETQLIM>"
10158 #. type: Plain text
10159 #: build/C/man2/quotactl.2:400
10161 "Set disk quota limits for user I<id>. The I<addr> argument is a pointer to "
10162 "an I<fs_disk_quota> structure (defined in I<E<lt>xfs/xqm.hE<gt>>). This "
10163 "operation requires privilege (B<CAP_SYS_ADMIN>)."
10167 #: build/C/man2/quotactl.2:400
10169 msgid "B<Q_XGETQSTAT>"
10172 #. type: Plain text
10173 #: build/C/man2/quotactl.2:408
10175 "Returns an I<fs_quota_stat> structure containing XFS filesystem-specific "
10176 "quota information. This is useful for finding out how much space is used to "
10177 "store quota information, and also to get quotaon/off status of a given local "
10182 #: build/C/man2/quotactl.2:408
10184 msgid "B<Q_XQUOTARM>"
10187 #. type: Plain text
10188 #: build/C/man2/quotactl.2:412
10190 "Free the disk space taken by disk quotas. Quotas must have already been "
10194 #. type: Plain text
10195 #: build/C/man2/quotactl.2:419
10197 "There is no command equivalent to B<Q_SYNC> for XFS since B<sync>(1) writes "
10198 "quota information to disk (in addition to the other filesystem metadata that "
10202 #. type: Plain text
10203 #: build/C/man2/quotactl.2:427
10205 "On success, B<quotactl>() returns 0; on error -1 is returned, and I<errno> "
10206 "is set to indicate the error."
10209 #. type: Plain text
10210 #: build/C/man2/quotactl.2:434
10211 msgid "I<addr> or I<special> is invalid."
10214 #. type: Plain text
10215 #: build/C/man2/quotactl.2:440
10216 msgid "I<cmd> or I<type> is invalid."
10219 #. type: Plain text
10220 #: build/C/man2/quotactl.2:447
10221 msgid "The file specified by I<special> or I<addr> does not exist."
10224 #. type: Plain text
10225 #: build/C/man2/quotactl.2:452
10226 msgid "The kernel has not been compiled with the B<CONFIG_QUOTA> option."
10230 #: build/C/man2/quotactl.2:452
10235 #. type: Plain text
10236 #: build/C/man2/quotactl.2:456
10237 msgid "I<special> is not a block device."
10240 #. type: Plain text
10241 #: build/C/man2/quotactl.2:461
10243 "The caller lacked the required privilege (B<CAP_SYS_ADMIN>) for the "
10244 "specified operation."
10247 #. type: Plain text
10248 #: build/C/man2/quotactl.2:465
10250 "No disk quota is found for the indicated user. Quotas have not been turned "
10251 "on for this filesystem."
10254 #. type: Plain text
10255 #: build/C/man2/quotactl.2:474
10256 msgid "If I<cmd> is B<Q_SETQUOTA>, B<quotactl>() may also set I<errno> to:"
10259 #. type: Plain text
10260 #: build/C/man2/quotactl.2:477
10261 msgid "Specified limits are out of range allowed by quota format."
10264 #. type: Plain text
10265 #: build/C/man2/quotactl.2:486
10266 msgid "If I<cmd> is B<Q_QUOTAON>, B<quotactl>() may also set I<errno> to:"
10269 #. type: Plain text
10270 #: build/C/man2/quotactl.2:495
10272 "The quota file pointed to by I<addr> exists, but is not a regular file; or, "
10273 "the quota file pointed to by I<addr> exists, but is not on the filesystem "
10274 "pointed to by I<special>."
10277 #. type: Plain text
10278 #: build/C/man2/quotactl.2:501
10279 msgid "B<Q_QUOTAON> attempted, but another B<Q_QUOTAON> had already been performed."
10282 #. type: Plain text
10283 #: build/C/man2/quotactl.2:504
10284 msgid "The quota file is corrupted."
10287 #. type: Plain text
10288 #: build/C/man2/quotactl.2:507
10289 msgid "Specified quota format was not found."
10292 #. type: Plain text
10293 #: build/C/man2/quotactl.2:512
10294 msgid "B<quota>(1), B<getrlimit>(2), B<quotacheck>(8), B<quotaon>(8)"
10298 #: build/C/man2/sendfile.2:19
10304 #: build/C/man2/sendfile.2:19
10309 #. type: Plain text
10310 #: build/C/man2/sendfile.2:22
10311 msgid "sendfile - transfer data between file descriptors"
10314 #. type: Plain text
10315 #: build/C/man2/sendfile.2:24
10316 msgid "B<#include E<lt>sys/sendfile.hE<gt>>"
10319 #. The below is too ugly. Comments about glibc versions belong
10320 #. in the notes, not in the header.
10322 #. .B #include <features.h>
10324 #. .B #if (__GLIBC__==2 && __GLIBC_MINOR__>=1) || __GLIBC__>2
10326 #. .B #include <sys/sendfile.h>
10330 #. .B #include <sys/types.h>
10332 #. .B /* No system prototype before glibc 2.1. */
10334 #. .BI "ssize_t sendfile(int" " out_fd" ", int" " in_fd" ", off_t *" \
10335 #. offset ", size_t" " count" )
10338 #. type: Plain text
10339 #: build/C/man2/sendfile.2:47
10341 "B<ssize_t sendfile(int>I< out_fd>B<, int>I< in_fd>B<, off_t *>I<offset>B<, "
10342 "size_t>I< count>B<);>"
10345 #. type: Plain text
10346 #: build/C/man2/sendfile.2:57
10348 "B<sendfile>() copies data between one file descriptor and another. Because "
10349 "this copying is done within the kernel, B<sendfile>() is more efficient "
10350 "than the combination of B<read>(2) and B<write>(2), which would require "
10351 "transferring data to and from user space."
10354 #. type: Plain text
10355 #: build/C/man2/sendfile.2:62
10357 "I<in_fd> should be a file descriptor opened for reading and I<out_fd> should "
10358 "be a descriptor opened for writing."
10361 #. type: Plain text
10362 #: build/C/man2/sendfile.2:83
10364 "If I<offset> is not NULL, then it points to a variable holding the file "
10365 "offset from which B<sendfile>() will start reading data from I<in_fd>. "
10366 "When B<sendfile>() returns, this variable will be set to the offset of the "
10367 "byte following the last byte that was read. If I<offset> is not NULL, then "
10368 "B<sendfile>() does not modify the current file offset of I<in_fd>; "
10369 "otherwise the current file offset is adjusted to reflect the number of bytes "
10370 "read from I<in_fd>."
10373 #. type: Plain text
10374 #: build/C/man2/sendfile.2:90
10376 "If I<offset> is NULL, then data will be read from I<in_fd> starting at the "
10377 "current file offset, and the file offset will be updated by the call."
10380 #. type: Plain text
10381 #: build/C/man2/sendfile.2:93
10382 msgid "I<count> is the number of bytes to copy between the file descriptors."
10385 #. type: Plain text
10386 #: build/C/man2/sendfile.2:100
10388 "The I<in_fd> argument must correspond to a file which supports "
10389 "B<mmap>(2)-like operations (i.e., it cannot be a socket)."
10392 #. type: Plain text
10393 #: build/C/man2/sendfile.2:108
10395 "In Linux kernels before 2.6.33, I<out_fd> must refer to a socket. Since "
10396 "Linux 2.6.33 it can be any file. If it is a regular file, then "
10397 "B<sendfile>() changes the file offset appropriately."
10400 #. type: Plain text
10401 #: build/C/man2/sendfile.2:115
10403 "If the transfer was successful, the number of bytes written to I<out_fd> is "
10404 "returned. On error, -1 is returned, and I<errno> is set appropriately."
10407 #. type: Plain text
10408 #: build/C/man2/sendfile.2:121
10410 "Nonblocking I/O has been selected using B<O_NONBLOCK> and the write would "
10414 #. type: Plain text
10415 #: build/C/man2/sendfile.2:125
10417 "The input file was not opened for reading or the output file was not opened "
10421 #. type: Plain text
10422 #: build/C/man2/sendfile.2:128
10423 msgid "Bad address."
10426 #. type: Plain text
10427 #: build/C/man2/sendfile.2:134
10429 "Descriptor is not valid or locked, or an B<mmap>(2)-like operation is not "
10430 "available for I<in_fd>."
10433 #. type: Plain text
10434 #: build/C/man2/sendfile.2:138
10435 msgid "Unspecified error while reading from I<in_fd>."
10438 #. type: Plain text
10439 #: build/C/man2/sendfile.2:142
10440 msgid "Insufficient memory to read from I<in_fd>."
10443 #. type: Plain text
10444 #: build/C/man2/sendfile.2:148
10446 "B<sendfile>() is a new feature in Linux 2.2. The include file "
10447 "I<E<lt>sys/sendfile.hE<gt>> is present since glibc 2.1."
10450 #. type: Plain text
10451 #: build/C/man2/sendfile.2:150
10452 msgid "Not specified in POSIX.1-2001, or other standards."
10455 #. type: Plain text
10456 #: build/C/man2/sendfile.2:155
10458 "Other UNIX systems implement B<sendfile>() with different semantics and "
10459 "prototypes. It should not be used in portable programs."
10462 #. type: Plain text
10463 #: build/C/man2/sendfile.2:165
10465 "If you plan to use B<sendfile>() for sending files to a TCP socket, but "
10466 "need to send some header data in front of the file contents, you will find "
10467 "it useful to employ the B<TCP_CORK> option, described in B<tcp>(7), to "
10468 "minimize the number of packets and to tune performance."
10471 #. type: Plain text
10472 #: build/C/man2/sendfile.2:171
10474 "In Linux 2.4 and earlier, I<out_fd> could also refer to a regular file, and "
10475 "B<sendfile>() changed the current offset of that file."
10478 #. type: Plain text
10479 #: build/C/man2/sendfile.2:183
10481 "The original Linux B<sendfile>() system call was not designed to handle "
10482 "large file offsets. Consequently, Linux 2.4 added B<sendfile64>(), with a "
10483 "wider type for the I<offset> argument. The glibc B<sendfile>() wrapper "
10484 "function transparently deals with the kernel differences."
10487 #. type: Plain text
10488 #: build/C/man2/sendfile.2:192
10490 "Applications may wish to fall back to B<read>(2)/B<write>(2) in the case "
10491 "where B<sendfile>() fails with B<EINVAL> or B<ENOSYS>."
10494 #. type: Plain text
10495 #: build/C/man2/sendfile.2:197
10497 "The Linux-specific B<splice>(2) call supports transferring data between "
10498 "arbitrary files (e.g., a pair of sockets)."
10501 #. type: Plain text
10502 #: build/C/man2/sendfile.2:202
10503 msgid "B<mmap>(2), B<open>(2), B<socket>(2), B<splice>(2)"
10507 #: build/C/man2/set_tid_address.2:25
10509 msgid "SET_TID_ADDRESS"
10513 #: build/C/man2/set_tid_address.2:25
10518 #. type: Plain text
10519 #: build/C/man2/set_tid_address.2:28
10520 msgid "set_tid_address - set pointer to thread ID"
10523 #. type: Plain text
10524 #: build/C/man2/set_tid_address.2:31
10526 msgid "B<#include E<lt>linux/unistd.hE<gt>>\n"
10529 #. type: Plain text
10530 #: build/C/man2/set_tid_address.2:33
10532 msgid "B<long set_tid_address(int *>I<tidptr>B<);>\n"
10535 #. type: Plain text
10536 #: build/C/man2/set_tid_address.2:40
10538 "For each process, the kernel maintains two attributes (addresses) called "
10539 "I<set_child_tid> and I<clear_child_tid>. These two attributes contain the "
10540 "value NULL by default."
10544 #: build/C/man2/set_tid_address.2:40
10546 msgid "I<set_child_tid>"
10549 #. type: Plain text
10550 #: build/C/man2/set_tid_address.2:51
10552 "If a process is started using B<clone>(2) with the B<CLONE_CHILD_SETTID> "
10553 "flag, I<set_child_tid> is set to the value passed in the I<ctid> argument of "
10554 "that system call."
10557 #. type: Plain text
10558 #: build/C/man2/set_tid_address.2:56
10560 "When I<set_child_tid> is set, the very first thing the new process does is "
10561 "writing its PID at this address."
10565 #: build/C/man2/set_tid_address.2:56
10567 msgid "I<clear_child_tid>"
10570 #. type: Plain text
10571 #: build/C/man2/set_tid_address.2:67
10573 "If a process is started using B<clone>(2) with the B<CLONE_CHILD_CLEARTID> "
10574 "flag, I<clear_child_tid> is set to the value passed in the I<ctid> argument "
10575 "of that system call."
10578 #. type: Plain text
10579 #: build/C/man2/set_tid_address.2:74
10581 "The system call B<set_tid_address>() sets the I<clear_child_tid> value for "
10582 "the calling process to I<tidptr>."
10585 #. type: Plain text
10586 #: build/C/man2/set_tid_address.2:82
10588 "When a process whose I<clear_child_tid> is not NULL terminates, then, if the "
10589 "process is sharing memory with other processes or threads, then 0 is written "
10590 "at the address specified in I<clear_child_tid> and the kernel performs the "
10591 "following operation:"
10594 #. type: Plain text
10595 #: build/C/man2/set_tid_address.2:84
10597 msgid " futex(clear_child_tid, FUTEX_WAKE, 1, NULL, NULL, 0);\n"
10600 #. type: Plain text
10601 #: build/C/man2/set_tid_address.2:88
10603 "The effect of this operation is to wake a single process that is performing "
10604 "a futex wait on the memory location. Errors from the futex wake operation "
10608 #. type: Plain text
10609 #: build/C/man2/set_tid_address.2:91
10610 msgid "B<set_tid_address>() always returns the PID of the calling process."
10613 #. type: Plain text
10614 #: build/C/man2/set_tid_address.2:94
10615 msgid "B<set_tid_address>() always succeeds."
10618 #. type: Plain text
10619 #: build/C/man2/set_tid_address.2:97
10621 "This call is present since Linux 2.5.48. Details as given here are valid "
10622 "since Linux 2.5.49."
10625 #. type: Plain text
10626 #: build/C/man2/set_tid_address.2:102
10627 msgid "B<clone>(2), B<futex>(2)"
10631 #: build/C/man2/splice.2:26
10637 #: build/C/man2/splice.2:26 build/C/man2/tee.2:26 build/C/man2/vmsplice.2:26
10642 #. type: Plain text
10643 #: build/C/man2/splice.2:29
10644 msgid "splice - splice data to/from a pipe"
10647 #. type: Plain text
10648 #: build/C/man2/splice.2:33 build/C/man2/tee.2:33
10651 "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n"
10652 "B<#include E<lt>fcntl.hE<gt>>\n"
10655 #. Return type was long before glibc 2.7
10656 #. type: Plain text
10657 #: build/C/man2/splice.2:38
10660 "B<ssize_t splice(int >I<fd_in>B<, loff_t *>I<off_in>B<, int >I<fd_out>B<,>\n"
10661 "B< loff_t *>I<off_out>B<, size_t >I<len>B<, unsigned int "
10665 #. type: Plain text
10666 #: build/C/man2/splice.2:50
10668 "B<splice>() moves data between two file descriptors without copying between "
10669 "kernel address space and user address space. It transfers up to I<len> "
10670 "bytes of data from the file descriptor I<fd_in> to the file descriptor "
10671 "I<fd_out>, where one of the descriptors must refer to a pipe."
10674 #. type: Plain text
10675 #: build/C/man2/splice.2:80
10677 "If I<fd_in> refers to a pipe, then I<off_in> must be NULL. If I<fd_in> does "
10678 "not refer to a pipe and I<off_in> is NULL, then bytes are read from I<fd_in> "
10679 "starting from the current file offset, and the current file offset is "
10680 "adjusted appropriately. If I<fd_in> does not refer to a pipe and I<off_in> "
10681 "is not NULL, then I<off_in> must point to a buffer which specifies the "
10682 "starting offset from which bytes will be read from I<fd_in>; in this case, "
10683 "the current file offset of I<fd_in> is not changed. Analogous statements "
10684 "apply for I<fd_out> and I<off_out>."
10687 #. type: Plain text
10688 #: build/C/man2/splice.2:85 build/C/man2/vmsplice.2:78
10690 "The I<flags> argument is a bit mask that is composed by ORing together zero "
10691 "or more of the following values:"
10695 #: build/C/man2/splice.2:85 build/C/man2/tee.2:62 build/C/man2/vmsplice.2:78
10697 msgid "B<SPLICE_F_MOVE>"
10700 #. type: Plain text
10701 #: build/C/man2/splice.2:98
10703 "Attempt to move pages instead of copying. This is only a hint to the "
10704 "kernel: pages may still be copied if the kernel cannot move the pages from "
10705 "the pipe, or if the pipe buffers don't refer to full pages. The initial "
10706 "implementation of this flag was buggy: therefore starting in Linux 2.6.21 it "
10707 "is a no-op (but is still permitted in a B<splice>() call); in the future, a "
10708 "correct implementation may be restored."
10712 #: build/C/man2/splice.2:98 build/C/man2/tee.2:68 build/C/man2/vmsplice.2:84
10714 msgid "B<SPLICE_F_NONBLOCK>"
10717 #. type: Plain text
10718 #: build/C/man2/splice.2:107
10720 "Do not block on I/O. This makes the splice pipe operations nonblocking, but "
10721 "B<splice>() may nevertheless block because the file descriptors that are "
10722 "spliced to/from may block (unless they have the B<O_NONBLOCK> flag set)."
10726 #: build/C/man2/splice.2:107 build/C/man2/tee.2:73 build/C/man2/vmsplice.2:91
10728 msgid "B<SPLICE_F_MORE>"
10731 #. type: Plain text
10732 #: build/C/man2/splice.2:121
10734 "More data will be coming in a subsequent splice. This is a helpful hint "
10735 "when the I<fd_out> refers to a socket (see also the description of "
10736 "B<MSG_MORE> in B<send>(2), and the description of B<TCP_CORK> in B<tcp>(7))"
10740 #: build/C/man2/splice.2:121 build/C/man2/tee.2:79 build/C/man2/vmsplice.2:97
10742 msgid "B<SPLICE_F_GIFT>"
10745 #. type: Plain text
10746 #: build/C/man2/splice.2:127
10747 msgid "Unused for B<splice>(); see B<vmsplice>(2)."
10750 #. type: Plain text
10751 #: build/C/man2/splice.2:136
10753 "Upon successful completion, B<splice>() returns the number of bytes spliced "
10754 "to or from the pipe. A return value of 0 means that there was no data to "
10755 "transfer, and it would not make sense to block, because there are no writers "
10756 "connected to the write end of the pipe referred to by I<fd_in>."
10759 #. type: Plain text
10760 #: build/C/man2/splice.2:142
10761 msgid "On error, B<splice>() returns -1 and I<errno> is set to indicate the error."
10764 #. type: Plain text
10765 #: build/C/man2/splice.2:147
10767 "One or both file descriptors are not valid, or do not have proper read-write "
10771 #. The append-mode error is given since 2.6.27; in earlier kernels,
10772 #. splice() in append mode was broken
10773 #. type: Plain text
10774 #: build/C/man2/splice.2:155
10776 "Target filesystem doesn't support splicing; target file is opened in append "
10777 "mode; neither of the descriptors refers to a pipe; or offset given for "
10778 "nonseekable device."
10781 #. type: Plain text
10782 #: build/C/man2/splice.2:158 build/C/man2/tee.2:114 build/C/man2/vmsplice.2:138
10783 msgid "Out of memory."
10787 #: build/C/man2/splice.2:158
10792 #. type: Plain text
10793 #: build/C/man2/splice.2:165
10795 "Either I<off_in> or I<off_out> was not NULL, but the corresponding file "
10796 "descriptor refers to a pipe."
10799 #. type: Plain text
10800 #: build/C/man2/splice.2:170
10802 "The B<splice>() system call first appeared in Linux 2.6.17; library support "
10803 "was added to glibc in version 2.5."
10806 #. type: Plain text
10807 #: build/C/man2/splice.2:182
10809 "The three system calls B<splice>(), B<vmsplice>(2), and B<tee>(2), provide "
10810 "user-space programs with full control over an arbitrary kernel buffer, "
10811 "implemented within the kernel using the same type of buffer that is used for "
10812 "a pipe. In overview, these system calls perform the following tasks:"
10816 #: build/C/man2/splice.2:182
10818 msgid "B<splice>()"
10821 #. type: Plain text
10822 #: build/C/man2/splice.2:186
10824 "moves data from the buffer to an arbitrary file descriptor, or vice versa, "
10825 "or from one buffer to another."
10829 #: build/C/man2/splice.2:186
10834 #. type: Plain text
10835 #: build/C/man2/splice.2:189
10836 msgid "\"copies\" the data from one buffer to another."
10840 #: build/C/man2/splice.2:189
10842 msgid "B<vmsplice>(2)"
10845 #. type: Plain text
10846 #: build/C/man2/splice.2:192
10847 msgid "\"copies\" data from user space into the buffer."
10851 #. Linus: Now, imagine using the above in a media server, for example.
10852 #. Let's say that a year or two has passed, so that the video drivers
10853 #. have been updated to be able to do the splice thing, and what can
10854 #. you do? You can:
10856 #. - splice from the (mpeg or whatever - let's just assume that the video
10857 #. input is either digital or does the encoding on its own - like they
10858 #. pretty much all do) video input into a pipe (remember: no copies - the
10859 #. video input will just DMA directly into memory, and splice will just
10860 #. set up the pages in the pipe buffer)
10861 #. - tee that pipe to split it up
10862 #. - splice one end to a file (ie "save the compressed stream to disk")
10863 #. - splice the other end to a real-time video decoder window for your
10864 #. real-time viewing pleasure.
10866 #. Linus: Now, the advantage of splice()/tee() is that you can
10867 #. do zero-copy movement of data, and unlike sendfile() you can
10868 #. do it on _arbitrary_ data (and, as shown by "tee()", it's more
10869 #. than just sending the data to somebody else: you can duplicate
10870 #. the data and choose to forward it to two or more different
10871 #. users - for things like logging etc.).
10872 #. type: Plain text
10873 #: build/C/man2/splice.2:223
10875 "Though we talk of copying, actual copies are generally avoided. The kernel "
10876 "does this by implementing a pipe buffer as a set of reference-counted "
10877 "pointers to pages of kernel memory. The kernel creates \"copies\" of pages "
10878 "in a buffer by creating new pointers (for the output buffer) referring to "
10879 "the pages, and increasing the reference counts for the pages: only pointers "
10880 "are copied, not the pages of the buffer."
10883 #. type: Plain text
10884 #: build/C/man2/splice.2:226
10885 msgid "See B<tee>(2)."
10888 #. type: Plain text
10889 #: build/C/man2/splice.2:230
10890 msgid "B<sendfile>(2), B<tee>(2), B<vmsplice>(2)"
10894 #: build/C/man2/tee.2:26
10899 #. type: Plain text
10900 #: build/C/man2/tee.2:29
10901 msgid "tee - duplicating pipe content"
10904 #. type: Plain text
10905 #: build/C/man2/tee.2:36
10908 "B<ssize_t tee(int >I<fd_in>B<, int >I<fd_out>B<, size_t >I<len>B<, unsigned "
10909 "int >I<flags>B<);>\n"
10912 #. Example programs http://brick.kernel.dk/snaps
10915 #. add a "tee(in, out1, out2)" system call that duplicates the pages
10916 #. (again, incrementing their reference count, not copying the data) from
10917 #. one pipe to two other pipes.
10918 #. type: Plain text
10919 #: build/C/man2/tee.2:56
10921 "B<tee>() duplicates up to I<len> bytes of data from the pipe referred to by "
10922 "the file descriptor I<fd_in> to the pipe referred to by the file descriptor "
10923 "I<fd_out>. It does not consume the data that is duplicated from I<fd_in>; "
10924 "therefore, that data can be copied by a subsequent B<splice>(2)."
10927 #. type: Plain text
10928 #: build/C/man2/tee.2:62
10930 "I<flags> is a series of modifier flags, which share the name space with "
10931 "B<splice>(2) and B<vmsplice>(2):"
10934 #. type: Plain text
10935 #: build/C/man2/tee.2:68
10936 msgid "Currently has no effect for B<tee>(); see B<splice>(2)."
10939 #. Not used for vmsplice
10940 #. May be in the future -- therefore EAGAIN
10941 #. type: Plain text
10942 #: build/C/man2/tee.2:73 build/C/man2/vmsplice.2:91
10943 msgid "Do not block on I/O; see B<splice>(2) for further details."
10946 #. type: Plain text
10947 #: build/C/man2/tee.2:79
10949 "Currently has no effect for B<tee>(), but may be implemented in the future; "
10950 "see B<splice>(2)."
10953 #. type: Plain text
10954 #: build/C/man2/tee.2:85
10955 msgid "Unused for B<tee>(); see B<vmsplice>(2)."
10958 #. type: Plain text
10959 #: build/C/man2/tee.2:94
10961 "Upon successful completion, B<tee>() returns the number of bytes that were "
10962 "duplicated between the input and output. A return value of 0 means that "
10963 "there was no data to transfer, and it would not make sense to block, because "
10964 "there are no writers connected to the write end of the pipe referred to by "
10968 #. type: Plain text
10969 #: build/C/man2/tee.2:100
10970 msgid "On error, B<tee>() returns -1 and I<errno> is set to indicate the error."
10973 #. type: Plain text
10974 #: build/C/man2/tee.2:111
10976 "I<fd_in> or I<fd_out> does not refer to a pipe; or I<fd_in> and I<fd_out> "
10977 "refer to the same pipe."
10980 #. type: Plain text
10981 #: build/C/man2/tee.2:119
10983 "The B<tee>() system call first appeared in Linux 2.6.17; library support "
10984 "was added to glibc in version 2.5."
10987 #. type: Plain text
10988 #: build/C/man2/tee.2:130
10990 "Conceptually, B<tee>() copies the data between the two pipes. In reality "
10991 "no real data copying takes place though: under the covers, B<tee>() assigns "
10992 "data in the output by merely grabbing a reference to the input."
10995 #. type: Plain text
10996 #: build/C/man2/tee.2:136
10998 "The following example implements a basic B<tee>(1) program using the "
10999 "B<tee>() system call."
11002 #. type: Plain text
11003 #: build/C/man2/tee.2:145
11006 "#define _GNU_SOURCE\n"
11007 "#include E<lt>fcntl.hE<gt>\n"
11008 "#include E<lt>stdio.hE<gt>\n"
11009 "#include E<lt>stdlib.hE<gt>\n"
11010 "#include E<lt>unistd.hE<gt>\n"
11011 "#include E<lt>errno.hE<gt>\n"
11012 "#include E<lt>limits.hE<gt>\n"
11015 #. type: Plain text
11016 #: build/C/man2/tee.2:151
11020 "main(int argc, char *argv[])\n"
11023 " int len, slen;\n"
11026 #. type: Plain text
11027 #: build/C/man2/tee.2:156
11030 " if (argc != 2) {\n"
11031 " fprintf(stderr, \"Usage: %s E<lt>fileE<gt>\\en\", argv[0]);\n"
11032 " exit(EXIT_FAILURE);\n"
11036 #. type: Plain text
11037 #: build/C/man2/tee.2:162
11040 " fd = open(argv[1], O_WRONLY | O_CREAT | O_TRUNC, 0644);\n"
11041 " if (fd == -1) {\n"
11042 " perror(\"open\");\n"
11043 " exit(EXIT_FAILURE);\n"
11047 #. type: Plain text
11048 #: build/C/man2/tee.2:169
11053 " * tee stdin to stdout.\n"
11055 " len = tee(STDIN_FILENO, STDOUT_FILENO,\n"
11056 " INT_MAX, SPLICE_F_NONBLOCK);\n"
11059 #. type: Plain text
11060 #: build/C/man2/tee.2:178
11063 " if (len E<lt> 0) {\n"
11064 " if (errno == EAGAIN)\n"
11066 " perror(\"tee\");\n"
11067 " exit(EXIT_FAILURE);\n"
11073 #. type: Plain text
11074 #: build/C/man2/tee.2:192
11078 " * Consume stdin by splicing it to a file.\n"
11080 " while (len E<gt> 0) {\n"
11081 " slen = splice(STDIN_FILENO, NULL, fd, NULL,\n"
11082 " len, SPLICE_F_MOVE);\n"
11083 " if (slen E<lt> 0) {\n"
11084 " perror(\"splice\");\n"
11092 #. type: Plain text
11093 #: build/C/man2/tee.2:196
11097 " exit(EXIT_SUCCESS);\n"
11101 #. type: Plain text
11102 #: build/C/man2/tee.2:200
11103 msgid "B<splice>(2), B<vmsplice>(2)"
11107 #: build/C/man2/vm86.2:26
11113 #: build/C/man2/vm86.2:26
11118 #. type: Plain text
11119 #: build/C/man2/vm86.2:29
11120 msgid "vm86old, vm86 - enter virtual 8086 mode"
11123 #. type: Plain text
11124 #: build/C/man2/vm86.2:31
11125 msgid "B<#include E<lt>sys/vm86.hE<gt>>"
11128 #. type: Plain text
11129 #: build/C/man2/vm86.2:33
11130 msgid "B<int vm86old(struct vm86_struct *>I<info>B<);>"
11133 #. type: Plain text
11134 #: build/C/man2/vm86.2:35
11135 msgid "B<int vm86(unsigned long >I<fn>B<, struct vm86plus_struct *>I<v86>B<);>"
11138 #. type: Plain text
11139 #: build/C/man2/vm86.2:48
11141 "The system call B<vm86>() was introduced in Linux 0.97p2. In Linux 2.1.15 "
11142 "and 2.0.28, it was renamed to B<vm86old>(), and a new B<vm86>() was "
11143 "introduced. The definition of I<struct vm86_struct> was changed in 1.1.8 "
11147 #. type: Plain text
11148 #: build/C/man2/vm86.2:52
11150 "These calls cause the process to enter VM86 mode (virtual-8086 in Intel "
11151 "literature), and are used by B<dosemu>."
11154 #. type: Plain text
11155 #: build/C/man2/vm86.2:54
11156 msgid "VM86 mode is an emulation of real mode within a protected mode task."
11159 #. type: Plain text
11160 #: build/C/man2/vm86.2:64
11162 "This return value is specific to i386 and indicates a problem with getting "
11166 #. type: Plain text
11167 #: build/C/man2/vm86.2:68
11169 "This return value indicates the call is not implemented on the present "
11173 #. type: Plain text
11174 #: build/C/man2/vm86.2:73
11176 "Saved kernel stack exists. (This is a kernel sanity check; the saved stack "
11177 "should exist only within vm86 mode itself.)"
11180 #. type: Plain text
11181 #: build/C/man2/vm86.2:76
11183 "This call is specific to Linux on 32-bit Intel processors, and should not be "
11184 "used in programs intended to be portable."
11188 #: build/C/man2/vmsplice.2:26
11193 #. type: Plain text
11194 #: build/C/man2/vmsplice.2:29
11195 msgid "vmsplice - splice user pages into a pipe"
11198 #. type: Plain text
11199 #: build/C/man2/vmsplice.2:34
11202 "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n"
11203 "B<#include E<lt>fcntl.hE<gt>>\n"
11204 "B<#include E<lt>sys/uio.hE<gt>>\n"
11207 #. type: Plain text
11208 #: build/C/man2/vmsplice.2:37
11211 "B<ssize_t vmsplice(int >I<fd>B<, const struct iovec *>I<iov>B<,>\n"
11212 "B< unsigned long >I<nr_segs>B<, unsigned int "
11216 #. Linus: vmsplice() system call to basically do a "write to
11217 #. the buffer", but using the reference counting and VM traversal
11218 #. to actually fill the buffer. This means that the user needs to
11219 #. be careful not to reuse the user-space buffer it spliced into
11220 #. the kernel-space one (contrast this to "write()", which copies
11221 #. the actual data, and you can thus reuse the buffer immediately
11222 #. after a successful write), but that is often easy to do.
11223 #. type: Plain text
11224 #: build/C/man2/vmsplice.2:57
11226 "The B<vmsplice>() system call maps I<nr_segs> ranges of user memory "
11227 "described by I<iov> into a pipe. The file descriptor I<fd> must refer to a "
11231 #. type: Plain text
11232 #: build/C/man2/vmsplice.2:64
11234 "The pointer I<iov> points to an array of I<iovec> structures as defined in "
11235 "I<E<lt>sys/uio.hE<gt>>:"
11238 #. type: Plain text
11239 #: build/C/man2/vmsplice.2:71
11243 " void *iov_base; /* Starting address */\n"
11244 " size_t iov_len; /* Number of bytes */\n"
11248 #. type: Plain text
11249 #: build/C/man2/vmsplice.2:84
11250 msgid "Unused for B<vmsplice>(); see B<splice>(2)."
11253 #. type: Plain text
11254 #: build/C/man2/vmsplice.2:97
11256 "Currently has no effect for B<vmsplice>(), but may be implemented in the "
11257 "future; see B<splice>(2)."
11260 #. FIXME Explain the following line in a little more detail:
11261 #. .... if we expect to later SPLICE_F_MOVE to the cache.
11262 #. type: Plain text
11263 #: build/C/man2/vmsplice.2:113
11265 "The user pages are a gift to the kernel. The application may not modify "
11266 "this memory ever, or page cache and on-disk data may differ. Gifting pages "
11267 "to the kernel means that a subsequent B<splice>(2) B<SPLICE_F_MOVE> can "
11268 "successfully move the pages; if this flag is not specified, then a "
11269 "subsequent B<splice>(2) B<SPLICE_F_MOVE> must copy the pages. Data must "
11270 "also be properly page aligned, both in memory and length."
11273 #. type: Plain text
11274 #: build/C/man2/vmsplice.2:122
11276 "Upon successful completion, B<vmsplice>() returns the number of bytes "
11277 "transferred to the pipe. On error, B<vmsplice>() returns -1 and I<errno> "
11278 "is set to indicate the error."
11281 #. type: Plain text
11282 #: build/C/man2/vmsplice.2:127
11283 msgid "I<fd> either not valid, or doesn't refer to a pipe."
11286 #. type: Plain text
11287 #: build/C/man2/vmsplice.2:135
11289 "I<nr_segs> is 0 or greater than B<IOV_MAX>; or memory not aligned if "
11290 "B<SPLICE_F_GIFT> set."
11293 #. type: Plain text
11294 #: build/C/man2/vmsplice.2:143
11296 "The B<vmsplice>() system call first appeared in Linux 2.6.17; library "
11297 "support was added to glibc in version 2.5."
11300 #. type: Plain text
11301 #: build/C/man2/vmsplice.2:154
11303 "B<vmsplice>() follows the other vectorized read/write type functions when "
11304 "it comes to limitations on number of segments being passed in. This limit "
11305 "is B<IOV_MAX> as defined in I<E<lt>limits.hE<gt>>. At the time of this "
11306 "writing, that limit is 1024."
11309 #. type: Plain text
11310 #: build/C/man2/vmsplice.2:157
11311 msgid "B<splice>(2), B<tee>(2)"