Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > S

sigsend(2)

HP-UX 11i Version 3: February 2007
» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

NAME

sigsend(), sigsendset() — send a signal to a process or a group of processes

SYNOPSIS

#include <sys/signal.h>

#include <sys/procset.h>

int sigsend (idtype_t idtype, id_t id, int sig);

int sigsendset (const procset_t *psp, int sig);

DESCRIPTION

The sigsend() system call sends a signal to a process or a group of processes. The process or group of processes to which the signal is to be sent is specified by id and idtype. The signal to be sent is specified by sig and is either one from the list given in signal() (see signal(2)) or 0.

If sig is equal to zero (the null signal), error checking is performed but no signal is actually sent. This can be used to check the validity of id and idtype.

The real or effective user ID of the sending process must match the real or effective user ID of the receiving process, unless the process has appropriate privileges, or sig is SIGCONT and the sending process has the same session ID as the receiving process.

idtype and id work together as follows:

  • If idtype is P_PID, sig will be sent to the process with a process ID equal to (pid_t)id.

  • If idtype is P_PGID, sig will be sent to any process with a process group ID equal to (pid_t)id.

  • If idtype is P_SID, sig will be sent to any process with a session ID equal to (pid_t)id.

  • If idtype is P_UID, sig will be sent to any process with an effective user ID equal to (uid_t)id.

  • If idtype is P_GID, sig will be sent to any process with an effective group ID equal to (gid_t)id.

  • If idtype is P_ALL, sig will be sent to all processes and id will be ignored.

  • If id is P_MYID, the value of id is taken from the calling process.

The process with a process ID of 0 is always excluded. The process with a process ID of 1 is included only if idtype is equal to P_PID.

sigsendset() provides an alternate interface for sending signals to a set of processes.

psp is a pointer to a structure that includes the following members:

idop p_op; idtype_t p_lidtype; id_t p_lid; idtype_t p_ridtype; id_t p_rid;

The structure defines a set of processes as the result of a set operation (difference, union, intersection, or exclusion) on two operands (idtype/id pairs). The left (right) operand is specified by p_lid (p_rid) and p_lidtype (p_ridtype). p_lid (p_rid) takes the values specified by id and p_lidtype (p_ridtype) takes the values specified by idtype in the sigsend() system call defined above. p_op specifies the operand, and takes one of the following values:

POP_DIFF

Set difference. The resultant set consists of the processes that are in the left operand and not in the right operand.

POP_AND

Set intersection. The resultant set consists of the processes that are in both the left and right operands.

POP_OR

Set union. The resultant set consists of the processes that are in either the left or right operand or both.

POP_XOR

Set exclusive OR. The resultant set consists of the processes that are in either the left or right operand but not in both.

RETURN VALUE

Upon successful completion, sigsend() returns a value of 0. Otherwise, it returns a value of -1 and sets errno to indicate the error.

ERRORS

If sigsend() fails, it sets errno (see errno(2)) to one of the following values:

[EINVAL]

sig is neither a valid signal number nor zero.

[EINVAL]

idtype is not a valid value.

[EINVAL]

sig is SIGKILL, idtype is P_PID, and id is 1.

[ESRCH]

No process can be found corresponding to that specified by id and idtype.

[EPERM]

The user ID of the sending process is not 0, and its real or effective user ID does not match the real or effective user ID of the receiving process, and the calling process is not sending SIGCONT to a process that shares the same session ID.

SEE ALSO

kill(2), signal(2).

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.