pidfd_send_signal(2) System Calls Manual pidfd_send_signal(2) pidfd_send_signal - (libc -lc) #include /* Definition of SIG* constants */ #include /* Definition of SI_* constants */ #include /* Definition of SYS_* constants */ #include int syscall(SYS_pidfd_send_signal, int pidfd, int sig, siginfo_t *_Nullable info, unsigned int flags); : glibc pidfd_send_signal() syscall(2). pidfd_send_signal() sig pidfd PID . info siginfo_t rt_sigqueueinfo(2). info siginfo_t kill(2): o si_signo o si_errno 0 o si_code SI_USER o si_pid PID o si_uid . PID pidfd . flags . pidfd. pidfd -- pidfd pidfd_open(2) PIDFD_THREAD clone3(2) CLONE_PIDFD CLONE_THREAD-- pidfd pidfd_send_signal(2) flags 0 pidfd. PIDFD_SIGNAL_THREAD ( Linux 6.9) pidfd. PIDFD_SIGNAL_THREAD_GROUP ( Linux 6.9) pidfd pidfd . PIDFD_SIGNAL_PROCESS_GROUP ( Linux 6.9) pidfd pidfd . pidfd_send_signal() 0. -1 errno . EBADF pidfd PID . EINVAL sig . EINVAL PID . EINVAL flags . EPERM . EPERM pidfd info.si_code ( rt_sigqueueinfo(2)). ESRCH ( ). . Linux 5.1. PID pidfd PID . : o /proc/pid o pidfd_open(2); o PID clone(2) clone3(2) CLONE_PIDFD. pidfd_send_signal() ( kill(2)) . (PID) PID . PID pidfd_send_signal() ESRCH. #define _GNU_SOURCE #include #include #include #include #include #include #include #include static int pidfd_send_signal(int pidfd, int sig, siginfo_t *info, unsigned int flags) { return syscall(SYS_pidfd_send_signal, pidfd, sig, info, flags); } int main(int argc, char *argv[]) { int pidfd, sig; char path[PATH_MAX]; siginfo_t info; if (argc != 3) { fprintf(stderr, "Usage: %s \n", argv[0]); exit(EXIT_FAILURE); } sig = atoi(argv[2]); /* Obtain a PID file descriptor by opening the /proc/PID directory of the target process. */ snprintf(path, sizeof(path), "/proc/%s", argv[1]); pidfd = open(path, O_RDONLY); if (pidfd == -1) { perror("open"); exit(EXIT_FAILURE); } /* Populate a 'siginfo_t' structure for use with pidfd_send_signal(). */ memset(&info, 0, sizeof(info)); info.si_code = SI_QUEUE; info.si_signo = sig; info.si_errno = 0; info.si_uid = getuid(); info.si_pid = getpid(); info.si_value.sival_int = 1234; /* Send the signal. */ if (pidfd_send_signal(pidfd, sig, &info, 0) == -1) { perror("pidfd_send_signal"); exit(EXIT_FAILURE); } exit(EXIT_SUCCESS); } clone(2), kill(2), pidfd_open(2), rt_sigqueueinfo(2), sigaction(2), pid_namespaces(7), signal(7) 3 . . : . 6.18 8 2026 pidfd_send_signal(2)