Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

kill(1)

kill(2)

ptrace(2)

sigblock(2)

sigpause(2)

sigsetmask(2)

sigstack(2)

setjmp(3C)

sde-target(1)



sigvec(2)                      DG/UX R4.11MU05                     sigvec(2)


NAME
       sigvec - specify what to do upon presentation of a signal

SYNOPSIS
       #include <signal.h>

       int sigvec (signal_number, new_signal_vector, old_signal_vector)
       int signal_number;
       struct sigvec * new_signal_vector;
       struct sigvec * old_signal_vector;

   where:
       signal_number       Any of the valid signals except SIGKILL or
                           SIGSTOP (see signal.h for a complete list)

       new_signal_vector   NULL or address of new handler specifier

       old_signal_vector   NULL or address of old handler specifier

DESCRIPTION
       Sigvec is used to install a new handler and retrieve the previous
       handler for signal signal_number.  A handler for the signal is
       optionally installed using the new_signal_vector parameter.  If
       new_signal_vector is NULL, the handler remains unchanged.  Otherwise,
       new_signal_vector is installed.  The previous handler for the signal
       may be obtained by the old_signal_vector parameter.  If
       old_signal_vector is NULL, the previous handler is not returned.
       Otherwise, the previous handler information is stored in the location
       pointed to by old_signal_vector.

       A signal handler has three components:  a set of flags (sv_flags), a
       signal mask (sv_mask), and an action (sv_handler).

       Each signal handler may choose to execute on either the current stack
       of the calling process or on a special signal stack.  The process
       must have previously defined the signal stack using sigstack.  The
       handler's stack choice is indicated by a flag in sv_flags.  Setting
       the flag SV_ONSTACK chooses the signal stack of the calling process;
       otherwise the current stack is used.  The stack address is chosen
       when the signal is presented.  Thus, subsequent sigstack operations
       may redirect the handler's signal stack.

       The handler's signal mask is an additional set of signals that are to
       be blocked from presentation while the signal is being handled.  The
       set of signals that are blocked while the signal is being handled is
       the union of the handler's signal mask, the signal that occurred, and
       the process's current set of blocked signals.

       Signal s is represented by the value sigmask(s) in sv_mask.

       The handler's action chooses one of three ways to handle the receipt
       of a signal.  new_signal_vector.sv_handler may be assigned one of the
       values:  SIG_DFL, SIG_IGN, or a function address.  The actions
       prescribed by these values are as follows:

       SIG_DFL   Default signal action.

                 The process's signal action vector entry for signal_number
                 is set to `default'.

                 When the signal signal_number is sent to the process, it
                 may be pended depending on the state of the blocked signal
                 vector.  When the signal is presented to the process, it
                 will cause the process to either terminate, stop, ignore
                 the signal, or terminate with a core dump depending on the
                 signal's type (see signal.h).

                 If a core dump is indicated, the receiving process must
                 have adequate permission to do so.

       SIG_IGN   Ignore signal.

                 The process's signal action vector entry for signal_number
                 is set to `ignore'.

                 When the signal signal_number is sent to the process, it
                 may be pended depending on the state of the blocked signal
                 vector.  When the signal is presented to the process, it
                 will be discarded.

                 SIGKILL and SIGSTOP cannot be ignored.

       address   Catch signal.

                 The process's signal action vector entry for signal_number
                 is set to `catch'.

                 When the signal signal_number is sent to the process, it
                 may be pended depending on the state of the blocked signal
                 vector.  When the signal is presented to the process, it
                 will cause the signal handler specified by action to be
                 invoked.  Upon invocation of the signal handler the first
                 argument to the handler function will always be the number
                 of the caught signal.  Other signal state information may
                 be passed to the handler via arguments depending upon the
                 current software development environment.  See siginfo(5)
                 and sde-target(1) for details.

                 The following attributes are set for the signal action
                 vector entry for signal_number:

                 ·      The signal mask addend is set to the union of
                        new_signal_vector.sv_mask and signal_number.  These
                        signals are added to the blocked signal vector for
                        the duration of the signal handler's invocation.

                 ·      The signal stack choice is set based on the flag
                        SV_ONSTACK.  This may cause a stack switch to take
                        place for the duration of the signal handler's
                        invocation.

                 ·      The new signal action is set to `unchanged'.  The
                        occurrence of multiple signals will not cause the
                        loss of signals or process termination.

                 ·      The restart system call choice is set based on the
                        flag SV_INTERRUPT.  If the flag is set, system calls
                        interrupted by signal signal_number will be be
                        terminated with errno set to EINTR rather than being
                        restarted.  If the flag is not set, restartable
                        system call will be transparently restarted when the
                        signal handler returns.

                 SIGKILL and SIGSTOP cannot be caught.

       After a fork, the child process inherits all software signal
       structures, except that the pending signal vector is cleared.

       Exec modifies the software signal structures in the following manner:
       1) The signal action for signals set to `catch' is changed to
       `default'.  2) The signal stack context is discarded.  3) All other
       software signal structures are unchanged.

       The mask specified in new_signal_vector is not allowed to block
       SIGKILL or SIGSTOP.  This is done silently by the system.

       Sigvec will fail and the signal handler will be unchanged if an error
       occurs.

ACCESS CONTROL
       No access is required to install a signal handler.

       The receiving process is granted permission to produce a core dump
       file provided

       ·      the effective-user-id and the real-user-id of the receiving
              process are equal, and

       ·      the receiving process has adequate file system permission to
              create or rewrite the core dump file.

RETURN VALUE
       0      Completed successfully.

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

DIAGNOSTICS
       Errno may be set to one of the following error codes:

       EFAULT    Either new_signal_vector or old_signal_vector point to
                 memory which is not a valid part of the process address
                 space.

       EINVAL    Signal_number is not a valid signal number.

       EINVAL    An attempt is made to ignore or supply a handler for
                 SIGKILL or SIGSTOP.

SEE ALSO
       kill(1), kill(2), ptrace(2), sigblock(2), sigpause(2), sigsetmask(2),
       sigstack(2), setjmp(3C), sde-target(1).


Licensed material--property of copyright holder(s)

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