1tkill(2)                      System Calls Manual                     tkill(2)
2
3
4

NAME

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

LIBRARY

9       Standard C library (libc, -lc)
10

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUE

40       On  success,  zero is returned.  On error, -1 is returned, and errno is
41       set to indicate the error.
42

ERRORS

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

STANDARDS

58       Linux.
59

HISTORY

61       tkill()
62              Linux 2.4.19 / 2.5.4.
63
64       tgkill()
65              Linux 2.5.75, glibc 2.30.
66

NOTES

68       See  the  description of CLONE_THREAD in clone(2) for an explanation of
69       thread groups.
70

SEE ALSO

72       clone(2), gettid(2), kill(2), rt_sigqueueinfo(2)
73
74
75
76Linux man-pages 6.04              2023-03-30                          tkill(2)
Impressum