Annotation of 43BSDReno/lib/libc/gen/signal.3, revision 1.1.1.1

1.1       root        1: .\" Copyright (c) 1980 Regents of the University of California.
                      2: .\" All rights reserved.  The Berkeley software License Agreement
                      3: .\" specifies the terms and conditions for redistribution.
                      4: .\"
                      5: .\"    @(#)signal.3    6.5 (Berkeley) 7/1/90
                      6: .\"
                      7: .TH SIGNAL 3C "July 1, 1990"
                      8: .UC 4
                      9: .ie t .ds d \(dg
                     10: .el .ds d \z'|+'
                     11: .ie t .ds b \(bu
                     12: .el .ds b @
                     13: .SH NAME
                     14: signal \- simplified software signal facilities
                     15: .SH SYNOPSIS
                     16: .nf
                     17: .B #include <signal.h>
                     18: .PP
                     19: .B void (*signal(sig, func))()
                     20: .B void (*func)();
                     21: .fi
                     22: .SH DESCRIPTION
                     23: .I Signal
                     24: is a simplified interface to the more general
                     25: .IR sigaction (2)
                     26: facility.
                     27: .PP
                     28: A signal
                     29: is generated by some abnormal event,
                     30: initiated by a user at a terminal (quit, interrupt, stop),
                     31: by a program error (bus error, etc.),
                     32: by request of another program (kill),
                     33: or when a process is stopped because it wishes to access
                     34: its control terminal while in the background (see
                     35: .IR tty (4)).
                     36: Signals are optionally generated
                     37: when a process resumes after being stopped,
                     38: when the status of child processes changes,
                     39: or when input is ready at the control terminal.
                     40: Most signals cause termination of the receiving process if no action
                     41: is taken; some signals instead cause the process receiving them
                     42: to be stopped, or are simply discarded if the process has not
                     43: requested otherwise.
                     44: Except for the SIGKILL and SIGSTOP
                     45: signals, the
                     46: .I signal
                     47: call allows signals either to be ignored
                     48: or to cause an interrupt to a specified location.
                     49: The following is a list of all signals with
                     50: names as in the include file
                     51: .RI < signal.h >:
                     52: .LP
                     53: .nf
                     54: .ta \w'SIGVTALRM 'u +\w'15*  'u
                     55: SIGHUP 1       hangup
                     56: SIGINT 2       interrupt
                     57: SIGQUIT        3*      quit
                     58: SIGILL 4*      illegal instruction
                     59: SIGTRAP        5*      trace trap
                     60: SIGABRT        6*      \fIabort\fP() call (formerly SIGIOT)
                     61: SIGEMT 7*      EMT instruction
                     62: SIGFPE 8*      floating point exception
                     63: SIGKILL        9       kill (cannot be caught or ignored)
                     64: SIGBUS 10*     bus error
                     65: SIGSEGV        11*     segmentation violation
                     66: SIGSYS 12*     bad argument to system call
                     67: SIGPIPE        13      write on a pipe with no one to read it
                     68: SIGALRM        14      alarm clock
                     69: SIGTERM        15      software termination signal
                     70: SIGURG 16\*b   urgent condition present on socket
                     71: SIGSTOP        17\*d   stop (cannot be caught or ignored)
                     72: SIGTSTP        18\*d   stop signal generated from keyboard
                     73: SIGCONT        19\*b   continue after stop
                     74: SIGCHLD        20\*b   child status has changed
                     75: SIGTTIN        21\*d   background read attempted from control terminal
                     76: SIGTTOU        22\*d   background write attempted to control terminal
                     77: SIGIO  23\*b   i/o is possible on a descriptor (see \fIfcntl\fP(2))
                     78: SIGXCPU        24      cpu time limit exceeded (see \fIsetrlimit\fP(2))
                     79: SIGXFSZ        25      file size limit exceeded (see \fIsetrlimit\fP(2))
                     80: SIGVTALRM      26      virtual time alarm (see \fIsetitimer\fP(2))
                     81: SIGPROF        27      profiling timer alarm (see \fIsetitimer\fP(2))
                     82: SIGWINCH       28\*b   Window size change
                     83: SIGINFO        29\*b   status request from keyboard
                     84: SIGUSR1        30      User defined signal 1
                     85: SIGUSR2        31      User defined signal 2
                     86: .fi
                     87: .PP
                     88: The starred signals in the list above cause a core image
                     89: if not caught or ignored.
                     90: .PP
                     91: If
                     92: .I func
                     93: is SIG_DFL, the default action
                     94: for signal
                     95: .I sig
                     96: is reinstated; this default is termination
                     97: (with a core image for starred signals)
                     98: except for signals marked with \*b or \*d.
                     99: Signals marked with \*b are discarded if the action
                    100: is SIG_DFL; signals marked
                    101: with \*d cause the process to stop.
                    102: If
                    103: .I func
                    104: is SIG_IGN the signal is subsequently ignored
                    105: and pending instances of the signal are discarded.
                    106: Otherwise, when the signal occurs
                    107: further occurrences of the signal are
                    108: automatically blocked and
                    109: .I func
                    110: is called.
                    111: .PP
                    112: A return from the function unblocks
                    113: the handled signal and
                    114: continues the process at the point it was interrupted.
                    115: \fBUnlike previous signal facilities, the handler \fIfunc\fP
                    116: remains installed after a signal has been delivered.\fP
                    117: .PP
                    118: If a caught signal occurs
                    119: during certain system calls, causing
                    120: the call to terminate prematurely, the call
                    121: is automatically restarted
                    122: (the handler is installed using the SA_RESTART flag with
                    123: .IR sigaction (2)).
                    124: The affected system calls include
                    125: .IR read (2),
                    126: .IR write (2),
                    127: .IR sendto (2),
                    128: .IR recvfrom (2),
                    129: .IR sendmsg (2)
                    130: and
                    131: .IR recvmsg (2)
                    132: on a communications channel or a slow device (such as a terminal,
                    133: but not a regular file)
                    134: and during a
                    135: .IR wait (2)
                    136: or
                    137: .IR ioctl (2).
                    138: However, calls that have already committed are not restarted,
                    139: but instead return a partial success (for example, a short read count).
                    140: .PP
                    141: The value of
                    142: .I signal
                    143: is the previous (or initial)
                    144: value of
                    145: .I func
                    146: for the particular signal.
                    147: .PP
                    148: After a
                    149: .IR fork (2)
                    150: or
                    151: .IR vfork (2)
                    152: the child inherits
                    153: all signals.
                    154: .IR  Execve (2)
                    155: resets all caught signals to the default action;
                    156: ignored signals remain ignored.
                    157: .SH "RETURN VALUE
                    158: The previous action is returned on a successful call.
                    159: Otherwise, \-1 is returned and 
                    160: .I errno
                    161: is set to indicate the error.
                    162: .SH ERRORS
                    163: .I Signal
                    164: will fail and no action will take place if one of the
                    165: following occur:
                    166: .TP 15
                    167: [EINVAL]
                    168: .I Sig
                    169: is not a valid signal number.
                    170: .TP 15
                    171: [EINVAL]
                    172: An attempt is made to ignore or supply a handler for SIGKILL
                    173: or SIGSTOP.
                    174: .SH "SEE ALSO"
                    175: kill(1), ptrace(2), kill(2),
                    176: sigaction(2), sigprocmask(2), sigsuspend(2),
                    177: sigstack(2), setjmp(3), tty(4)
                    178: .SH "NOTES  (VAX-11)"
                    179: The handler routine can be declared:
                    180: .PP
                    181:     void handler(sig, code, scp)
                    182: .PP
                    183: Here
                    184: .I sig
                    185: is the signal number, into which the hardware faults and traps are
                    186: mapped as defined below.  Code is a parameter which is either a constant
                    187: as given below or, for compatibility mode faults, the code provided by
                    188: the hardware. 
                    189: .I Scp
                    190: is a pointer to the
                    191: .I "struct sigcontext"
                    192: used by the system to restore the process context from before
                    193: the signal.
                    194: Compatibility mode faults are distinguished from the
                    195: other SIGILL traps by having PSL_CM set in the psl.
                    196: .PP
                    197: The following defines the mapping of hardware traps to signals
                    198: and codes.  All of these symbols are defined in
                    199: .RI < signal.h >:
                    200: .LP
                    201: .ta \w'     Floating/decimal divide by zero   'u +\w'15*  'u +8n
                    202: .nf
                    203:    Hardware condition  Signal  Code
                    204: 
                    205: Arithmetic traps:
                    206:    Integer overflow    SIGFPE  FPE_INTOVF_TRAP
                    207:    Integer division by zero    SIGFPE  FPE_INTDIV_TRAP
                    208:    Floating overflow trap      SIGFPE  FPE_FLTOVF_TRAP
                    209:    Floating/decimal division by zero   SIGFPE  FPE_FLTDIV_TRAP
                    210:    Floating underflow trap     SIGFPE  FPE_FLTUND_TRAP
                    211:    Decimal overflow trap       SIGFPE  FPE_DECOVF_TRAP
                    212:    Subscript-range     SIGFPE  FPE_SUBRNG_TRAP
                    213:    Floating overflow fault     SIGFPE  FPE_FLTOVF_FAULT
                    214:    Floating divide by zero fault       SIGFPE  FPE_FLTDIV_FAULT
                    215:    Floating underflow fault    SIGFPE  FPE_FLTUND_FAULT
                    216: Length access control  SIGSEGV
                    217: Protection violation   SIGBUS
                    218: Reserved instruction   SIGILL  ILL_RESAD_FAULT
                    219: Customer-reserved instr.       SIGEMT
                    220: Reserved operand       SIGILL  ILL_PRIVIN_FAULT
                    221: Reserved addressing    SIGILL  ILL_RESOP_FAULT
                    222: Trace pending  SIGTRAP
                    223: Bpt instruction        SIGTRAP
                    224: Compatibility-mode     SIGILL  hardware supplied code
                    225: Chme   SIGSEGV
                    226: Chms   SIGSEGV
                    227: Chmu   SIGSEGV
                    228: .fi

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.