Annotation of cci/usr/src/man/man3/signal.3c, revision 1.1.1.1

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

unix.superglobalmegacorp.com

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