aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2022-12-05 22:43:18 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2022-12-22 21:11:35 +0000
commit0e07241c372d7352537a4a786c96a580a721be3c (patch)
treec339b5e684fbb0db895337d796f2571437bfac6c
parentf0592b3c8dd8e172f0e7165c11371108d4d8838d (diff)
downloadsrc-0e07241c372d7352537a4a786c96a580a721be3c.tar.gz
src-0e07241c372d7352537a4a786c96a580a721be3c.zip
ptrace(2): explain how to select specific thread to operate on
Requested by: emaste Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D37590
-rw-r--r--lib/libc/sys/ptrace.219
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/libc/sys/ptrace.2 b/lib/libc/sys/ptrace.2
index 4589fac92d26..01d83897a78b 100644
--- a/lib/libc/sys/ptrace.2
+++ b/lib/libc/sys/ptrace.2
@@ -122,6 +122,25 @@ Kernel drops any
signals queued to the traced children, which could be either generated by
not yet consumed debug events, or sent by other means, the later should
not be done anyway.
+.Sh SELECTING THE TARGET
+The
+.Fa pid
+argument of the call specifies the target on which to perform
+the requested operation.
+For operations affecting the global process state, the process ID
+is typically passed there.
+Similarly, for operations affecting only a thread, the thread ID
+needs to be passed.
+.Pp
+Still, for global operations, the ID of any thread can be used as the
+target, and system will perform the request on the process owning
+that thread.
+If a thread operation got the process ID as
+.Fa pid ,
+the system randomly selects a thread from among the threads owned
+by the process.
+For single-threaded processes there is no difference between specifying
+process or thread ID as the target.
.Sh DISABLING PTRACE
The
.Nm