Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ sigaction(2) — DG/UX 5.4.2A

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

kill(2)

sigprocmask(2)

sigsuspend(2)

sigsetops(3C)



sigaction(2)                     DG/UX 5.4.2                    sigaction(2)


NAME
       sigaction - examine and change signal action

SYNOPSIS
       #include <signal.h>

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

   where:
       sig       A signal number.

       act       NULL, or a new action to be installed for sig.

       oact      NULL, or the current action associated with sig.  If act is
                 not NULL and the call is successful, oact will be replaced
                 by act.

DESCRIPTION
       The sigaction() function allows the calling process to examine or
       specify (or both) the action to be associated with a specific signal.
       The argument sig specifies the signal; acceptable values are defined
       in <signal.h>.

       The structure sigaction, used to describe an action to be taken, is
       defined in the header <signal.h> and includes the following members:

         Member       Member
          Type         Name                Description

       void (*)()   sa_handler   SIG_DFL, SIG_IGN, or pointer
                                 to a function.

       sigset_t     sa_mask      Additional set of signals to
                                 be blocked during execution of
                                 signal-catching function.

       int          sa_flags     Special flags to affect
                                 behavior of signal.

       If the argument act is not NULL, it points to a structure specifying
       the action to be associated with the specified signal.  If the
       argument oact is not NULL the action previously associated with the
       signal is stored in the location pointed to by the argument oact.  If
       the argument act is NULL signal handling is unchanged by this
       function call; thus, the call can be used to enquire about the
       current handling of a given signal.

       The sahandler field of the sigaction structure identifies the action
       to be associated with the specified signal.  It may have any of the
       values specified above.




Licensed material--property of copyright holder(s)                         1




sigaction(2)                     DG/UX 5.4.2                    sigaction(2)


       If the sahandler field specifies a signal-catching function, the
       samask field identifies a set of signals that shall be added to the
       process's set of blocked signals before the signal-catching function
       is invoked.  In addition, the signal that caused the handler to be
       invoked will be added to the set of blocked signals unless the
       SA_NODEFER flag has been specified (see the saflags description
       below).  The SIGKILL and SIGSTOP signals shall not be added to the
       signal mask using this mechanism; this restriction shall be enforced
       by the system without causing an error to be indicated.

       The saflags field can be used to modify the delivery of the
       specified signal.

       The following flags, defined in the header <signal.h>, can be set in
       saflags:

       Symbolic
       Constant       Description

       SA_ONSTACK     If set and the signal is caught, and an
                      alternate signal stack has been
                      declared, the signal is delivered to the
                      calling process using the alternate
                      stack.  Otherwise, the signal is
                      delivered on the same stack as the main
                      program.

       SA_RESETHAND   If set and the signal is caught, the
                      action of the signal is reset to
                      SIG_DFL.  (Note: SIGILL, SIGTRAP, and
                      SIGPWR cannot be automatically reset
                      when delivered; this restriction shall
                      be enforced by the system without
                      causing an error to be indicated.)

       SA_NODEFER     If set and the signal is caught, sig
                      will not be automatically blocked while
                      the handler is active.

       SA_RESTART     If set and the signal is caught, a
                      restartable system call that is
                      interrupted by the execution of the
                      signal's handler will be transparently
                      restarted when the handler finishes.  If
                      this flag is not set, a system call that
                      is interrupted will return EINTR.











Licensed material--property of copyright holder(s)                         2




sigaction(2)                     DG/UX 5.4.2                    sigaction(2)


       SA_SIGINFO     If this flag is not set and the signal
                      is caught, sig is passed as the only
                      argument to the signal handling
                      function.  If this flag is set and the
                      signal is caught, two additional
                      arguments will be passed to the signal
                      handling function.  If the second
                      argument is not equal to NULL, it will
                      point to an object of type siginfo_t,
                      which will explain the reason the signal
                      was generated (see siginfo.h).  The
                      third argument will point to an object
                      of type ucontext_t, which will describe
                      the receiving process' context at the
                      time it received the signal (see
                      ucontext.h).

       SA_NOCLDWAIT   If set and sig equals SIGCHLD, the
                      system will clean up after the calling
                      processes dead children.  If the calling
                      process subsequently calls wait(), it
                      will block until all of its processes
                      terminate and then return a value of -1
                      with errno set to ECHLD.

       SA_NOCLDSTOP   If set and sig equals SIGCHLD, sig will
                      not be sent to the calling process when
                      its child processes stop.

       When a signal is caught by a signal-catching function installed by
       the sigaction() function, a new signal mask is calculated and
       installed for the duration of the signal-catching function (or until
       a call to either the sigprocmask() or sigsuspend() function is made).
       This mask is formed by taking the union of the current signal mask
       and the value of the samask for the signal being delivered, and then
       including the signal being delivered (unless the SA_NODEFER flag is
       set, as described above).  If and when the user's signal handler
       returns normally, the original signal mask is restored.

       Once an action is installed for a specific signal, it remains
       installed until another action is explicitly requested (by another
       call to the sigaction() function), or until one of the exec()
       functions is called.  This behavior may be modified by using the
       SA_RESTART flag as described above.

       If the previous action for sig had been established by the signal()
       function, defined in the C Standard, the values of the fields
       returned in the structure pointed to by oact are unspecified, and in
       particular oact->svhandler is not necessarily the same value passed
       to the signal() function.  However, if a pointer to the same
       structure or a copy thereof is passed to a subsequent call to the
       sigaction() function via the act argument, handling of the signal
       shall be as if the original call to the signal() function were
       repeated.



Licensed material--property of copyright holder(s)                         3




sigaction(2)                     DG/UX 5.4.2                    sigaction(2)


       If the sigaction() function fails, no new signal handler is
       installed.

RETURN VALUE
       0      Successful completion.

       -1     An error occurred.  errno is set to indicate the error.

DIAGNOSTICS
       If any of the following conditions occur, the sigaction() function
       shall return -1 and set errno to the corresponding value:

       EINVAL    The value of the sig argument is an invalid or unsupported
                 signal number, or an attempt was made to catch a signal
                 that cannot be caught or to ignore a signal that cannot be
                 ignored.  See <signal.h>.

       EFAULT    act or oact points to an invalid location in the user's
                 address space.

SEE ALSO
       kill(2), sigprocmask(2), sigsuspend(2), sigsetops(3C), <signal.h>.

COPYRIGHTS
       Portions of this text are reprinted from IEEE Std 1003.1-1988,
       Portable Operating System Interface for Computer Environment,
       copyright © 1988 by the Institute of Electrical and Electronics
       Engineers, Inc., with the permission of the IEEE Standards
       Department.  To purchase IEEE Standards, call 800/678-IEEE.

       In the event of a discrepancy between the electronic and the original
       printed version, the original version takes precedence.

























Licensed material--property of copyright holder(s)                         4


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