git: 0e07241c372d - main - ptrace(2): explain how to select specific thread to operate on
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 22 Dec 2022 22:10:54 UTC
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=0e07241c372d7352537a4a786c96a580a721be3c commit 0e07241c372d7352537a4a786c96a580a721be3c Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2022-12-05 22:43:18 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2022-12-22 21:11:35 +0000 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 --- lib/libc/sys/ptrace.2 | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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