Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ signal(S) — Xenix 2.3.4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

kill(C)

kill(S)

pause(S)

ptrace(S)

wait(S)

setjmp(S)



     SIGNAL(S)                XENIX System V                 SIGNAL(S)



     Name
          signal - Specifies what to do upon receipt of a signal.

     Syntax
          #include <signal.h>

          int (*signal (sig, func))()
          int sig;
          int (*func)();

     Description
          signal allows the calling process to choose one of three
          ways in which it is possible to handle the receipt of a
          specific signal.  sig specifies the signal and func
          specifies the choice.

          sig can be assigned any one of the following except SIGKILL:

          SIGHUP    01    Hangup
          SIGINT    02    Interrupt
          SIGQUIT   03*   Quit
          SIGILL    04*   Illegal instruction (not reset when caught)
          SIGTRAP   05*   Trace trap (not reset when caught)
          SIGIOT    06*   I/O trap instruction
          SIGEMT    07*   Emulator trap instruction
          SIGFPE    08*   Floating-point exception
          SIGKILL   09    Kill (cannot be caught or ignored)
          SIGBUS    10*   Bus error
          SIGSEGV   11*   Segmentation violation
          SIGSYS    12*   Bad argument to system call
          SIGPIPE   13    Write on a pipe with no one to read it
          SIGALRM   14    Alarm clock
          SIGTERM   15    Software termination signal
          SIGUSR1   16    User-defined signal 1
          SIGUSR2   17    User-defined signal 2
          SIGCLD    18    Death of a child (see Warning below)
          SIGPWR    19    Power fail (see Warning below)

          See number 7 below for the significance of the asterisk in
          the above list.

          func is assigned one of three values: SIG_DFL, SIG_IGN, or a
          function address.  The actions prescribed by these values
          are described below.

          The SIG_DFL value causes termination of the process upon
          receipt of a signal.  Upon receipt of the signal sig, the
          receiving process is to be terminated with the following
          consequences:






     Page 1                                           (printed 8/7/87)





     SIGNAL(S)                XENIX System V                 SIGNAL(S)



          1.  All of the receiving process' open file descriptors will
              be closed.

          2.  If the parent process of the receiving process is
              executing a wait, it will be notified of the termination
              of the receiving process and the terminating signal's
              number will be made available to the parent process; see
              wait(S).

          3.  If the parent process of the receiving process is not
              executing a wait, the receiving process will be
              transformed into a zombie process (see exit(S) for
              definition of zombie process).

          4.  The parent process ID of each of the receiving process'
              existing child processes and zombie processes will be
              set to 1.  This means the initialization process (see
              intro(S)) inherits each of these processes.

          5.  An accounting record will be written on the accounting
              file if the system's accounting routine is enabled; see
              acct(S).

          6.  If the receiving process' process ID, tty group ID, and
              process group ID are equal, the signal SIGHUP will be
              sent to all of the processes that have a process group
              ID equal to the process group ID of the receiving
              process.

          7.  A ``core image'' will be made in the current working
              directory of the receiving process if sig is one for
              which an asterisk (*) appears in the above list and the
              following conditions are met:

              - The effective user ID and the real user ID of the
              receiving process are equal.

              - An ordinary file named core exists and is writable or
              can be created.  If the file must be created, it will
              have a mode of 0666 modified by the file creation mask
              (see umask(S)), a file owner ID that is the same as the
              effective user ID of the receiving process, a file group
              ID that is the same as the effective group ID of the
              receiving process

          The SIG_IGN value causes the process to ignore a signal.
          The signal sig is to be ignored.  Note that the signal
          SIGKILL cannot be ignored.

          A function address value causes the process to catch a
          signal.  Upon receipt of the signal sig, the receiving
          process is to execute the signal-catching function pointed



     Page 2                                           (printed 8/7/87)





     SIGNAL(S)                XENIX System V                 SIGNAL(S)



          to by func.  The signal number sig will be passed as the
          only argument to the signal-catching function.  There are
          the following consequences:

          1.  Upon return from the signal-catching function, the
              receiving process will resume execution at the point it
              was interrupted and the value of func for the caught
              signal will be set to SIG_DFL unless the signal is
              SIGILL, SIGTRAP, SIGCLD, or SIGPWR.

          2.  When a signal that is to be caught occurs during a read,
              a write, an  open, or an ioctl system call on a slow
              device (like a terminal; but not a file), during a pause
              system call, or during a wait system call that does not
              return immediately due to the existence of a previously
              stopped or zombie process, the signal catching function
              will be executed and then the interrupted system call
              will return a -1 to the calling process with errno set
              to EINTR.

          3.  Note that the signal SIGKILL cannot be caught.

          A call to signal cancels a pending signal sig except for a
          pending SIGKILL signal.

          signal will fail if one or more of the following are true:

               sig is an illegal signal number, including SIGKILL.
               [EINVAL]

               func points to an illegal address.  [EFAULT]

     Return Value
          Upon successful completion, signal returns the previous
          value of func for the specified signal sig.  Otherwise, a
          value of -1 is returned and errno is set to indicate the
          error.

     See Also
          kill(C), kill(S), pause(S), ptrace(S), wait(S), setjmp(S).

     Warning
          Two other signals that behave differently than the signals
          described above exist in this release of the system; they
          are:

                  SIGCLD  18   Death of a child (not reset when caught)
                  SIGPWR  19   Power fail (not reset when caught)

          There is no guarantee that, in future releases of XENIX,
          these signals will continue to behave as described below;
          they are included only for compatibility with other versions



     Page 3                                           (printed 8/7/87)





     SIGNAL(S)                XENIX System V                 SIGNAL(S)



          of XENIX.  Their use in new programs is strongly
          discouraged.

          For these signals, func is assigned one of three values:
          SIG_DFL, SIG_IGN, or a function address.  The actions
          prescribed by these values are as follows:

            SIG_DFL - ignore signal
                    The signal is to be ignored.

            SIG_IGN - ignore signal
                    The signal is to be ignored.  Also, if sig is
                    SIGCLD, the calling process' child processes will
                    not create zombie processes when they terminate;
                    see exit(S).

            function address - catch signal
                    If the signal is SIGPWR, the action to be taken is
                    the same as that described above for func equal to
                    function address.  The same is true if the signal
                    is SIGCLD except, that while the process is
                    executing the signal-catching function any
                    received SIGCLD signals will be queued and the
                    signal-catching function will be continually
                    reentered until the queue is empty.

            The SIGCLD affects two other system calls (wait(S), and
            exit(S)) in the following ways:

            wait    If the func value of SIGCLD is set to SIG_IGN and
                    a wait is executed, the wait will block until all
                    of the calling process' child processes terminate;
                    it will then return a value of -1 with errno set
                    to ECHILD.

            exit    If in the exiting process' parent process the func
                    value of SIGCLD is set to SIG_IGN, the exiting
                    process will not create a zombie process.

            When processing a pipeline, the shell makes the last
            process in the pipeline the parent of the proceeding
            processes.  A process that may be piped into in this
            manner (and thus become the parent of other processes)
            should take care not to set SIGCLD to be caught.

     Notes
          The defined constant NSIG in signal.h standing for the
          number of signals is always at least one greater than the
          actual number.






     Page 4                                           (printed 8/7/87)





     SIGNAL(S)                XENIX System V                 SIGNAL(S)



          The calling process must make another call to signal after a
          signal is caught before another signal can be caught.  If
          this is not done, subsequent signals are processed in the
          default manner (see the description for SIG_DFL ).



















































     Page 5                                           (printed 8/7/87)



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