sigqueue(3)
โจ sigqueue(3) โจ
okay bestie, welcome to the Library Functions Manual page for sigqueue(3) โ she's a libc girlie and she is so underrated. buckle up ๐
๐ธ NAME ๐ธ
sigqueue โ queue a signal and data to a process ๐
๐ง LIBRARY ๐ง
Standard C library (libc, -lc)
โจ SYNOPSIS โจ
#include <signal.h>
int sigqueue(pid_t pid, int sig, const union sigval value);
๐ฆ Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
sigqueue():_POSIX_C_SOURCE >= 199309L
๐ DESCRIPTION ๐
so sigqueue() sends the signal you put in sig to the process whose PID you dropped in pid. the permissions you need to send a signal are literally the same ones as for kill(2). and just like with kill(2), you can use the null signal (0) to vibe-check whether a process with a given PID even exists ๐
the value argument is the little gift you're attaching to the signal โ it can be either an integer or a pointer value โ and its type looks like this:
union sigval {
int sival_int;
void *sival_ptr;
};
if the receiving process installed a handler for this signal using the SA_SIGINFO flag with sigaction(2), then it can grab that data through the si_value field of the siginfo_t structure that gets passed as the second argument to the handler. and bonus: the si_code field of that same structure gets set to SI_QUEUE. iykyk ๐ซถ
๐ RETURN VALUE ๐
on success, sigqueue() returns 0, which means the signal was successfully queued to the receiving process. slay. otherwise it returns -1 and errno gets set to tell you what went wrong ๐ญ
๐ ERRORS ๐
EAGAINโ the limit of signals that may be queued has been reached. (seesignal(7)for further information.)EINVALโsigwas invalid.EPERMโ the process does not have permission to send the signal to the receiving process. for the required permissions, seekill(2).ESRCHโ no process has a PID matchingpid.
๐ ATTRIBUTES ๐
for an explanation of the terms used in this section, see attributes(7).
- Interface:
sigqueue()โ Attribute: Thread safety โ Value:MT-Safe๐
๐ VERSIONS ๐
๐ฆ C library/kernel differences ๐ฆ
on Linux, sigqueue() is implemented using the rt_sigqueueinfo(2) system call. the system call differs in its third argument, which is the siginfo_t structure that will be supplied to the receiving process's signal handler or returned by the receiving process's sigtimedwait(2) call. inside the glibc sigqueue() wrapper, this argument, uinfo, is initialized as follows:
uinfo.si_signo = sig; /* Argument supplied to sigqueue() */
uinfo.si_code = SI_QUEUE;
uinfo.si_pid = getpid(); /* Process ID of sender */
uinfo.si_uid = getuid(); /* Real UID of sender */
uinfo.si_value = val; /* Argument supplied to sigqueue() */
โญ STANDARDS โญ
POSIX.1-2008.
๐ธ HISTORY ๐ธ
Linux 2.2. POSIX.1-2001.
๐ NOTES ๐
if this function results in the sending of a signal to the process that invoked it, and that signal was not blocked by the calling thread, and no other threads were willing to handle this signal (either by having it unblocked, or by waiting for it using sigwait(3)), then at least some signal must be delivered to this thread before this function returns. no cap, that's just how it goes ๐
๐ SEE ALSO ๐
kill(2), rt_sigqueueinfo(2), sigaction(2), signal(2), pthread_sigqueue(3), sigwait(3), signal(7)
and that's the whole page bestie, you ate it up ๐ this was brought to you by Linux man-pages 6.20, dated 2026-02-08, and sigqueue(3) herself being the main character of this manual entry. go queue some signals responsibly ๐โจ๐ซถ
๐ฆ where this page comes from
- arch rolling: man-pages 6.20-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- ๐ the page's license: Linux-man-pages-copyleft
- Copyright 2002, Michael Kerrisk <mtk.manpages@gmail.com>
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms