SIGQUEUE(3P)
π sigqueue(3P) β the POSIX Programmer's Manual girlies know
okay so this is sigqueue(3P), straight out of the POSIX Programmer's Manual. bestie, real talk first:
β οΈ This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.
like. the Linux girlies might do it differently, or might not show up to the party at all. check your local page. π«Ά
πΈ NAME πΈ
sigqueue β queue a signal to a process
β¨ SYNOPSIS β¨
#include <signal.h>
int sigqueue(pid_t pid, int signo, union sigval value);
π DESCRIPTION π
So basically sigqueue() takes the signal you name in signo and sends it, carrying the little payload you put in value, to the process you point at with pid. π
If signo is zero β that's the null signal β it still does all the error checking but doesn't actually send anything. no cap. the null signal is literally just there so you can vibe check whether pid is even valid. π
The conditions a process needs to have permission to queue a signal to another process? Same ones as for the kill() function. same rules, same energy.
sigqueue() returns immediately, she does not wait around. Now here's the tea:
- If
SA_SIGINFOis set forsigno, and the resources were actually available to queue it, then the signal shall be queued and sent to the receiving process. - If
SA_SIGINFOis not set forsigno, thensignoshall be sent at least once to the receiving process β but whethervaluegets sent along as a result of this call is unspecified. π
And the plot twist nobody expects: if the value of pid causes signo to be generated for the sending process itself, and signo isn't blocked for the calling thread, and no other thread has signo unblocked or is waiting in a sigwait() function for signo β then either signo or at least the pending, unblocked signal shall be delivered to the calling thread before sigqueue() returns. she comes home to roost. π
Should multiple pending signals in the range SIGRTMIN to SIGRTMAX be up for delivery, the one that gets picked is the lowest numbered one. and the selection order between realtime and non-realtime signals, or between multiple pending non-realtime signals? unspecified. we don't know her. π€·βοΈ
π RETURN VALUE π
If everything slays: the specified signal shall have been queued, and sigqueue() returns a value of zero. π
Otherwise, she returns a value of -1 and sets errno to tell you what went wrong. π
π₯ ERRORS π₯
sigqueue() shall fail if:
EAGAINβ No resources are available to queue the signal. The process has already queued{SIGQUEUE_MAX}signals that are still pending at the receiver(s), or a system-wide resource limit has been exceeded. she's full, bestie, no more room. πEINVALβ The value of thesignoargument is an invalid or unsupported signal number. that's not a real signal, girl. π«EPERMβ The process does not have appropriate privileges to send the signal to the receiving process. not your business to send, respectfully. π βοΈESRCHβ The processpiddoes not exist. nobody's home. π»
The following sections are informative.
π EXAMPLES π
None.
like. literally none. iconic of her honestly. β¨
π¦ APPLICATION USAGE π¦
None.
again, nothing. we love a minimalist queen. π
π RATIONALE π
okay so WHY does sigqueue() exist, you ask? great question, bestie.
sigqueue() lets an application queue a realtime signal to itself or to another process, while specifying the application-defined value. This is common practice in realtime applications on existing realtime systems. The standard devs felt that specifying another function inside the sig... name space that was already carved out for signals was preferable to extending the interface to kill(). makes sense tbh. π§
This kind of function became necessary when the put/get event function of the message queues got removed. also, note this: sigqueue() implies reduced performance in a security-conscious implementation, because the access permissions between the sender and receiver have to be checked on every single send when the pid is resolved into a target process. such access checks were only necessary at message queue open in the previous interface. so. yeah. trade-offs. π
The standard developers required that sigqueue() have the same semantics with respect to the null signal as kill(), and that the same permission checking be used. BUT β because implementing the "broadcast" semantic of kill() is difficult (for example, to process groups) and because of the interaction with resource allocation, that semantic was not adopted. sigqueue() queues a signal to a single process specified by the pid argument. one target, one signal. no group chats. π΅
sigqueue() can fail if the system has insufficient resources to queue the signal. An explicit limit on the number of queued signals that a process could send was introduced. And here's the nuanced part: while the limit is "per-sender", this volume of POSIX.1β2017 does not specify that the resources be part of the state of the sender. That would require either that the sender be maintained after exit until all signals it had sent to other processes were handled, or that all such signals that had not yet been acted upon be removed from the queue(s) of the receivers. This volume of POSIX.1β2017 does not preclude this behavior β but an implementation that allocated queuing resources from a system-wide pool (with per-sender limits) and that leaves queued signals pending after the sender exits is also permitted. so it's giving "either way, we're not mad at it." π€·βοΈ
π FUTURE DIRECTIONS π
None.
she's perfect, no notes, no plans to change. β
π SEE ALSO π
- Section 2.8.1, Realtime Signals
- The Base Definitions volume of POSIX.1β2017,
<signal.h>
π COPYRIGHT π
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
and that's the whole page, bestie!! this absolute banger of a page is brought to you by IEEE/The Open Group, 2017, and yes the footer really does just say SIGQUEUE(3P) at the bottom like a little signature. π«Ά πβ¨π
π¦ where this page comes from
- alpine 3.22: man-pages-posix 2017a-r0 Β· custom
- alpine 3.23: man-pages-posix 2017a-r0 Β· custom
- alpine 3.24: man-pages-posix 2017a-r0 Β· custom
- arch rolling: man-pages 6.19-1
- 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-posix 2017a
- opensuse-leap 16.0: man-pages-posix 2017a-160000.4.1 Β· SUSE-IEEE
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms