summaryrefslogtreecommitdiff
path: root/manual/signal.texi
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2019-05-14 21:35:09 +0200
committerFlorian Weimer <fweimer@redhat.com>2019-05-14 22:55:51 +0200
commit04b261bdc13afd1f7644c756a23df3d43d400fa4 (patch)
tree760758002560f45d40b8b7d7f2ee377eda509516 /manual/signal.texi
parent6807f47b81bcae3874277f5480683ebeb7dfcf89 (diff)
downloadglibc-04b261bdc13afd1f7644c756a23df3d43d400fa4.tar.gz
Linux: Add the tgkill function
The tgkill function is sometimes used in crash handlers. <bits/signal_ext.h> follows the same approach as <bits/unistd_ext.h> (which was added for the gettid system call wrapper). Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'manual/signal.texi')
-rw-r--r--manual/signal.texi15
1 files changed, 15 insertions, 0 deletions
diff --git a/manual/signal.texi b/manual/signal.texi
index 8b3a52e22a..33e6646975 100644
--- a/manual/signal.texi
+++ b/manual/signal.texi
@@ -2291,6 +2291,21 @@ The @var{pid} argument does not refer to an existing process or group.
@end table
@end deftypefun
+@deftypefun int tgkill (pid_t @var{pid}, pid_t @var{tid}, int @var{signum})
+@standards{Linux, signal.h}
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
+The @code{tgkill} function sends the signal @var{signum} to the thread
+or process with ID @var{tid}, like the @code{kill} function, but only
+if the process ID of the thread @var{tid} is equal to @var{pid}. If
+the target thread belongs to another process, the function fails with
+@code{ESRCH}.
+
+The @code{tgkill} function can be used to avoid sending a signal to a
+thread in the wrong process if the caller ensures that the passed
+@var{pid} value is not reused by the kernel (for example, if it is the
+process ID of the current process, as returned by @code{getpid}).
+@end deftypefun
+
@deftypefun int killpg (int @var{pgid}, int @var{signum})
@standards{BSD, signal.h}
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}