Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ sigaction(2) — posix — mips UMIPS RISC/os 4.52

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

kill(2)

sigprocmask(2)

sigsetops(3)

sigsuspend(2)



SIGACTION(2-POSIX)  RISC/os Reference Manual   SIGACTION(2-POSIX)



NAME
     sigaction - examine and change signal action

SYNOPSIS
     #include <signal.h>

     int sigaction(sig, act, oact)
     int sig;
     struct sigaction *act, *oact;

DESCRIPTION
     sigaction allows the calling process to examine or specify
     (or both) the action to be associated with a specific sig-
     nal.  sig specifies which signal, and can be assigned any of
     the signals specified in signal(2) except SIGKILL and SIG-
     STOP.

     The sigaction structure is defined in <signal.h> and
     includes the following members:

     void (*)() sa_handler; /* SIG_DFL, SIG_IGN, or function pointer */
     sigset_t   sa_mask;    /* additional set of signals to be blocked */
     int        sa_flags;   /* special flags to affect signal behavior */

     If act is not NULL, it indicates a structure that specifies
     the action to be associated with the signal.  If oact is not
     NULL, the action previously associated with the signal is
     stored at the address indicated by oact.

     If act is NULL, signal handling is unchanged.  By setting
     act to NULL, a process can enquire about the current han-
     dling of a signal.

     The sa_handler field of the sigaction structure specifies
     the action to be associated with the signal.  If sa_handler
     specifies a signal-catching function, sa_mask specifies a
     set of signals that are added to the process' signal mask
     before the signal-catching function is invoked.  SIGKILL and
     SIGSTOP cannot be added to the signal mask in this manner.
     This restriction is silently enforced.

     The sa_flags field of the sigaction structure can be used to
     modify the behavior of the signal.  The flag SA_NOCLDSTOP
     may be set in sa_flags.  If sig is SIGCHLD and SA_NOCLDSTOP
     is not set in sa_flags, a SIGCHLD signal is generated for
     the calling process if any of its child processes stop.  If
     sig is SIGCHLD and SA_NOCLDSTOP is set in sa_flags, a
     SIGCHLD signal will not be generated for child processes
     that stop.

     When a signal is caught by a signal-catching function that
     was installed by sigaction, the signal mask is replaced (for



                         Printed 1/15/91                   Page 1





SIGACTION(2-POSIX)  RISC/os Reference Manual   SIGACTION(2-POSIX)



     the duration of the signal-catching function or until a call
     to either sigprocmask or sigsuspend is made) with a mask
     that is the union of the current signal mask and the value
     of the sa_mask for the signal being delivered.  The new mask
     also includes the signal being delivered.  If and when the
     signal-handler returns normally, the original signal mask is
     restored.  When an action has been installed for a specific
     signal, it remains installed until another action is
     requested (by a call to sigaction), or until one of the exec
     functions is called.

     If the previous action for sig had been established by a
     call to signal, the values of the fields returned in oact
     are unspecified, and in particular, oact->sv_handler is not
     necessarily the same value passed to signal.  If a pointer
     to, or a copy of, the same structure is passed to a subse-
     quent call to sigaction via act, the signal handling is the
     same as if the original call to signal were repeated.

RETURN VALUES
     Upon successful completion, 0 is returned.  Otherwise, -1 is
     returned and errno is set to indicate the error.

ERRORS
     If sigaction fails, no new signal handler is installed.
     sigaction will fail if any of the following are true:

     [EINVAL]            sig is an invalid signal, or an attempt
                         was made to catch a signal that cannot
                         be caught or to ignore a signal that
                         cannot be ignored.

     [EINVAL]            An attempt was made to set the action to
                         SIG_DFL for a signal that cannot be
                         caught or ignored (or both).

     [EFAULT]            act or oact points outside the process'
                         allocated address space.

SEE ALSO
     kill(2), sigprocmask(2), sigsetops(3), sigsuspend(2).














 Page 2                  Printed 1/15/91



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026