From a17e05c5e05a87f35407bb8f551a43db9c61ae85 Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Tue, 20 Mar 2012 07:29:29 +1300 Subject: [PATCH] ptrace.2: Minor fixes Signed-off-by: Michael Kerrisk --- man2/ptrace.2 | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/man2/ptrace.2 b/man2/ptrace.2 index 3a7d95b04..5a8b648d1 100644 --- a/man2/ptrace.2 +++ b/man2/ptrace.2 @@ -46,7 +46,7 @@ .\" FIXME Linux 3.1 adds PTRACE_SEIZE, PTRACE_INTERRUPT, .\" and PTRACE_LISTEN. .\" -.TH PTRACE 2 2012-03-06 "Linux" "Linux Programmer's Manual" +.TH PTRACE 2 2012-03-20 "Linux" "Linux Programmer's Manual" .SH NAME ptrace \- process trace .SH SYNOPSIS @@ -553,13 +553,6 @@ Under Linux, a tracee can be detached in this way regardless of which method was used to initiate tracing. .RI ( addr is ignored.) -.\" -.\" In the text below, we decided to avoid prettifying the text with markup: -.\" it would make the source nearly impossible to edit, and we _do_ intend -.\" to edit it often, in order to keep it updated: -.\" ptrace API is full of quirks, no need to compound this situation by -.\" making it excruciatingly painful to document them! -.\" .SS Death under ptrace When a (possibly multithreaded) process receives a killing signal (one whose disposition is set to @@ -800,7 +793,7 @@ value: the tracer can cause a different signal to be injected. Note that a suppressed signal still causes system calls to return prematurely. In this case system calls will be restarted: the tracer will -observe the tracee to re-execute interrupted system call (or +observe the tracee to reexecute the interrupted system call (or .BR restart_syscall(2) system call for a few syscalls which use a different mechanism for restarting) if the tracer uses @@ -808,8 +801,8 @@ for restarting) if the tracer uses Even system calls (such as .BR poll(2) ) which are not restartable after signal are restarted after -signal is suppressed; however, kernel bugs exist which cause -some syscalls to fail with +signal is suppressed; +however, kernel bugs exist which cause some syscalls to fail with .B EINTR even though no observable signal is injected to the tracee. .LP @@ -1150,7 +1143,7 @@ But such detection is fragile and is best avoided. .LP Using the .B PTRACE_O_TRACESYSGOOD -option is the recommended method to distinquish syscall-stops +option is the recommended method to distinguish syscall-stops from other kinds of ptrace-stops, since it is reliable and does not incur a performance penalty. .LP @@ -1427,10 +1420,10 @@ If the thread group leader has reported its stop by this time, it appears to the tracer that the dead thread leader "reappears from nowhere". -(Note: thread group leader does not report death via +(Note: the thread group leader does not report death via .I WIFEXITED(status) until there is at least one other live thread. -This eliminates possibility that tracer will see +This eliminates the possibility that the tracer will see it dying and then reappearing.) If the thread group leader was still alive, for the tracer this may look as if thread group leader @@ -1708,16 +1701,21 @@ This may be changed in the future; is meant to always immediately kill tasks even under ptrace. Last confirmed on 2.6.38.6. .LP -Some syscalls return with +Some system calls return with .B EINTR -if a signal was sent to a tracee, but delivery was suppressed -by the tracer. (This is very typical operation: it is usually +if a signal was sent to a tracee, but delivery was suppressed by the tracer. +(This is very typical operation: it is usually done by debuggers on every attach, in order to not introduce -a bogus SIGSTOP). -As of linux 3.2.9, the following syscalls are affected: +a bogus +.BR SIGSTOP ). +As of Linux 3.2.9, the following system calls are affected +(this list is likely incomplete): .BR epoll_wait (2), +and .BR read (2) -from inotify file descriptor. The list is likely incomplete. +from an +.BR inotify (7) +file descriptor. .SH "SEE ALSO" .BR gdb (1), .BR strace (1),