1TKILL(2)                   Linux Programmer's Manual                  TKILL(2)
2
3
4

NAME

6       tkill, tgkill - send a signal to a thread
7

SYNOPSIS

9       #include <signal.h>           /* Definition of SIG* constants */
10       #include <sys/syscall.h>      /* Definition of SYS_* constants */
11       #include <unistd.h>
12
13       int syscall(SYS_tkill, pid_t tid, int sig);
14
15       #include <signal.h>
16
17       int tgkill(pid_t tgid, pid_t tid, int sig);
18
19       Note:  glibc  provides no wrapper for tkill(), necessitating the use of
20       syscall(2).
21

DESCRIPTION

23       tgkill() sends the signal sig to the thread with the thread ID  tid  in
24       the  thread  group  tgid.   (By contrast, kill(2) can be used to send a
25       signal only to a process (i.e., thread group) as a whole, and the  sig‐
26       nal will be delivered to an arbitrary thread within that process.)
27
28       tkill()  is  an  obsolete  predecessor to tgkill().  It allows only the
29       target thread ID to be specified, which may result in the wrong  thread
30       being  signaled  if  a thread terminates and its thread ID is recycled.
31       Avoid using this system call.
32
33       These are the raw system call interfaces, meant for internal thread li‐
34       brary use.
35

RETURN VALUE

37       On  success,  zero is returned.  On error, -1 is returned, and errno is
38       set to indicate the error.
39

ERRORS

41       EAGAIN The RLIMIT_SIGPENDING resource limit was reached and  sig  is  a
42              real-time signal.
43
44       EAGAIN Insufficient  kernel memory was available and sig is a real-time
45              signal.
46
47       EINVAL An invalid thread ID, thread group ID, or signal was specified.
48
49       EPERM  Permission denied.  For the required permissions, see kill(2).
50
51       ESRCH  No process with the specified thread ID (and  thread  group  ID)
52              exists.
53

VERSIONS

55       tkill() is supported since Linux 2.4.19 / 2.5.4.  tgkill() was added in
56       Linux 2.5.75.
57
58       Library support for tgkill() was added to glibc in version 2.30.
59

CONFORMING TO

61       tkill() and tgkill() are Linux-specific and should not be used in  pro‐
62       grams that are intended to be portable.
63

NOTES

65       See  the  description of CLONE_THREAD in clone(2) for an explanation of
66       thread groups.
67
68       Before glibc 2.30, there was also no wrapper function for tgkill().
69

SEE ALSO

71       clone(2), gettid(2), kill(2), rt_sigqueueinfo(2)
72

COLOPHON

74       This page is part of release 5.13 of the Linux  man-pages  project.   A
75       description  of  the project, information about reporting bugs, and the
76       latest    version    of    this    page,    can     be     found     at
77       https://www.kernel.org/doc/man-pages/.
78
79
80
81Linux                             2021-03-22                          TKILL(2)
Impressum