Go to main content

man pages section 3: Basic Library Functions

Exit Print View

Updated: Thursday, June 13, 2019
 
 

proc_thr_kill (3C)

Name

proc_thr_kill, proc_thr_sigqueue, proc_thr_sigqueue_wait - Send or queue a signal to a thread in a process.

Synopsis

#include <signal.h>
int proc_thr_kill(pid_t pid, pthread_t thread, int sig);
int proc_thr_sigqueue(pid_t pid, pthread_t thread, int sig,
          const union sigval value);
int proc_thr_sigqueue_wait(pid_t pid, pthread_t thread, int sig,
          const union sigval value, const struct timespec *timeout);

Description

The proc_thr_kill() function sends the signal specified by sig to the thread specified by thread in the process specified by pid. The sig argument must be one of the signals listed in signal.h(3HEAD), with the exception of SIGCANCEL being reserved and off limits. If sig is 0, a validity check is performed for the existence of the target thread and no signal is sent.

The proc_thr_sigqueue() and proc_thr_sigqueue_wait() functions cause the signal specified by sig to be sent with the value specified by value to the thread specified by thread in the process specified by pid. The sig argument must be one of the signals listed in siginfo.h(3HEAD), with the exception of SIGCANCEL being reserved and off limits. If sig is 0, a validity check is performed for the existence of the target thread and no signal is sent.

The proc_thr_sigqueue() function returns immediately, possibly failing with an error EAGAIN. In contrast, proc_thr_sigqueue_wait() will wait for resources to become available to queue the signal if the caller's process already has the maximum number of queued signals allowed per process pending. If the timeout argument is not NULL, proc_thr_sigqueue_wait() will wait up to the specified time interval for the necessary resources to become available. If the timeout argument is NULL, proc_thr_sigqueue_wait() will wait as long as necessary.

For the proc_thr_sigqueue() and proc_thr_sigqueue_wait() functions, if SA_SIGINFO is set for sig in the target process and if the resources are available to queue the signal, the signal is queued and sent to the target thread. If SA_SIGINFO is not set for sig in the target process, then sig is sent at least once to the target thread. It is not specified whether value will be sent to the target thread as a result of this call.

Return Values

Upon successful completion of proc_thr_kill(), proc_thr_sigqueue(), or proc_thr_sigqueue_wait(), the specified signal will be sent, and the function returns 0. Otherwise, no signal is sent and the function returns an error number. It is not an error for the target thread to be a zombie thread.

Errors

The proc_thr_kill(), proc_thr_sigqueue(), proc_thr_sigqueue_wait() functions fail if:

EINVAL

The value of pid is zero or negative. The value of sig is an invalid or unsupported signal number.

ESRCH

The target process or the target thread does not exist.

The proc_thr_sigqueue() and proc_thr_sigqueue_wait() functions fail if:

EAGAIN

No resources are available to queue the signal within the specified time interval. The process has already queued its maximum number of signals that are still pending at the receiver(s), or a system wide resource limit has been exceeded. The maximum number of outstanding queued signals that a process can have is defined by its process.max-sigqueue-size resource control.

The proc_thr_sigqueue_wait() function will fail if:

EFAULT

The timeout argument is not NULL and is an invalid address.

EINVAL

The timeout argument specifies an invalid time.

EINTR

The function is interrupted while waiting.

Attributes

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Interface Stability
Committed
MT-Level
Async-Signal-Safe

See Also

kill(2), pthread_kill(3C), pthread_sigmask(3C), pthread_sigqueue(3C), sigqueue(3C), siginfo.h(3HEAD), signal.h(3HEAD), attributes(7), resource-controls(7)