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
This commit is contained in:
Konstantin Belousov 2022-12-06 00:43:18 +02:00
parent f0592b3c8d
commit 0e07241c37

View File

@ -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