sigqueue Subroutine

Purpose

Queues a signal to a process.

Library

Standard C Library (libc.a)

Syntax

#include <signal.h>

int sigqueue (pid, signo, value)
pid_t pid;
int signo;
const union sigval value;

Description

The sigqueue subroutine causes the signal specified by the signo parameter to be sent with the value specified by the value parameter to the process specified by the pid parameter. If the signo parameter is zero, error checking is performed but no signal is actually sent. This can be used to check the validity of the pid parameter.

The conditions required for a process to have permission to queue a signal to another process are the same as for the kill subroutine.

The sigqueue subroutine returns immediately. If SA_SIGINFO is set by the receiving process for the specified signal, and if the resources are available to queue the signal, the signal is queued and sent to the receiving process. If SA_SIGINFO is not set for the signo parameter, the signal is sent at least once to the receiving process.

If multiple signals in the range SIGRTMIN to SIGRTMAX should be available for delivery, the lowest numbered of them will be delivered first.

Parameters

Item Description
pid Specifies the process to which a signal is to be sent.
signo Specifies the signal number.
value Specifies the value to be sent with the signal.

Return Values

Upon successful completion the sigqueue subroutine returns a zero. If unsuccessful, it returns a -1 and sets the errno variable to indicate the error.

Error Code

The sigqueue subroutine will fail if:
Item Description
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.
EINVAL The value of the signo parameter is an invalid or unsupported signal number, or if the selected signal can either stop or continue the receiving process. AIX® does not support queuing of the following signals: SIGKILL, SIGSTOP, SIGTSTP, SIGCONT, SIGTTIN, SIGTTOU, and SIGCLD.
EPERM The process does not have the appropriate privilege to send the signal to the receiving process.
ESRCH The process specified by the pid parameter does not exist.