xref: /386bsd/usr/share/man/cat3/signal.0 (revision a2142627)
1SIGNAL(3)                 386BSD Programmer's Manual                 SIGNAL(3)
2
3NNAAMMEE
4     ssiiggnnaall - simplified software signal facilities
5
6SSYYNNOOPPSSIISS
7     ##iinncclluuddee <<ssiiggnnaall..hh>>
8
9     _v_o_i_d
10     **ssiiggnnaall(_s_i_g, _f_u_n_c)()
11
12     _v_o_i_d
13     (**ffuunncc)()
14
15DDEESSCCRRIIPPTTIIOONN
16     This ssiiggnnaall() facility is a simplified interface to the more general
17     sigaction(2) facility.
18
19     Signals allow the manipulation of a process from outside its domain as
20     well as allowing the process to manipulate itself or copies of itself
21     (children). There are two general types of signals: those that cause
22     termination of a process and those that do not.  Signals which cause
23     termination of a program might result from an irrecoverable error or
24     might be the result of a user at a terminal typing the `interrupt'
25     character.  Signals are used when a process is stopped because it wishes
26     to access its control terminal while in the background (see tty(4)).
27     Signals are optionally generated when a process resumes after being
28     stopped, when the status of child processes changes, or when input is
29     ready at the control terminal.  Most signals result in the termination of
30     the process receiving them if no action is taken; some signals instead
31     cause the process receiving them to be stopped, or are simply discarded
32     if the process has not requested otherwise.  Except for the SIGKILL and
33     SIGSTOP signals, the ssiiggnnaall() function allows for a signal to be caught,
34     to be ignored, or to generate an interupt.  These signals are defined in
35     the file <_s_i_g_n_a_l._h>:
36
37     NNaammee              DDeeffaauulltt AAccttiioonn                      DDeessccrriippttiioonn
38     SIGHUP          terminate process       terminal line hangup
39     SIGINT          terminate process       interrupt program
40     SIGQUIT         create core image       quit program
41     SIGILL          create core image       illegal instruction
42     SIGTRAP         create core image       trace trap
43     SIGABRT         create core image       abort(2) call (formerly SIGIOT)
44     SIGEMT          create core image       emulate instruction executed
45     SIGFPE          create core image       floating-point exception
46     SIGKILL         terminate process       kill program
47     SIGBUS          create core image       bus error
48     SIGSEGV         create core image       segmentation violation
49     SIGSYS          create core image       system call given invalid
50                                             argument
51     SIGPIPE         terminate process       write on a pipe with no reader
52     SIGALRM         terminate process       real-time timer expired
53     SIGTERM         terminate process       software termination signal
54     SIGURG          discard signal          urgent condition present on
55                                             socket
56     SIGSTOP         stop process            stop (cannot be caught or
57                                             ignored)
58     SIGTSTP         stop process            stop signal generated from
59                                             keyboard
60     SIGCONT         discard signal          continue after stop
61     SIGCHLD         discard signal          child status has changed
62     SIGTTIN         stop process            background read attempted from
63                                             control terminal
64     SIGTTOU         stop process            background write attempted to
65
66                                             control terminal
67     SIGIO           discard signal          I/O is possible on a descriptor
68                                             (see fcntl(2))
69     SIGXCPU         terminate process       cpu time limit exceeded (see
70                                             setrlimit(2))
71     SIGXFSZ         terminate process       file size limit exceeded (see
72                                             setrlimit(2))
73     SIGVTALRM       terminate process       virtual time alarm (see
74                                             setitimer(2))
75     SIGPROF         terminate process       profiling timer alarm (see
76                                             setitimer(2))
77     SIGWINCH        discard signal          Window size change
78     SIGINFO         discard signal          status request from keyboard
79     SIGUSR1         terminate process       User defined signal 1
80     SIGUSR2         terminate process       User defined signal 2
81
82     The _f_u_n_c procedure allows a user to choose the action upon receipt of a
83     signal.  To set the default action of the signal to occur as listed
84     above, _f_u_n_c should be SIG_DFL. A SIG_DFL resets the default action.  To
85     ignore the signal _f_u_n_c should be SIG_IGN. This will cause subsequent
86     instances of the signal to be ignored and pending instances to be
87     discarded. If SIG_IGN is not used, further occurrences of the signal are
88     automatically blocked and _f_u_n_c is called.
89
90     The handled signal is unblocked with the function returns and the process
91     continues from where it left off when the signal occured.  UUnnlliikkee
92     pprreevviioouuss ssiiggnnaall ffaacciilliittiieess,, tthhee hhaannddlleerr ffuunncc(()) rreemmaaiinnss iinnssttaalllleedd aafftteerr aa
93     ssiiggnnaall hhaass bbeeeenn ddeelliivveerreedd..
94
95     For some system calls, if a signal is caught while the call is executing
96     and the call is permaturely terminated, the call is automatically
97     restarted.  (The handler is installed using the SA_RESTART flag with
98     sigaction(2).)  The affected system calls include read(2),  write(2),
99     sendto(2),  recvfrom(2),  sendmsg(2) and recvmsg(2) on a communications
100     channel or a low speed device and during a ioctl(2) or wait(2).  However,
101     calls that have already committed are not restarted, but instead return a
102     partial success (for example, a short read count).
103
104     When a process which has installed signal handlers forks, the child
105     process inherits the signals.  All caught signals may be reset to their
106     default action by a call to the execve(2) function; ignored signals
107     remain ignored.
108
109RREETTUURRNN VVAALLUUEESS
110     The previous action is returned on a successful call.  Otherwise, -1 is
111     returned and  the global variable _e_r_r_n_o is set to indicate the error.
112
113EERRRROORRSS
114     Signal will fail and no action will take place if one of the following
115     occur:
116
117     [EINVAL]  _S_i_g is not a valid signal number.
118
119     [EINVAL]  An attempt is made to ignore or supply a handler for SIGKILL or
120               SIGSTOP.
121
122SSEEEE AALLSSOO
123     kill(1),  ptrace(2),  kill(2),  sigaction(2),  sigprocmask(2),
124     sigsuspend(2),  sigstack(2),  setjmp(3),  tty(4)
125
126HHIISSTTOORRYY
127     This ssiiggnnaall facility appeared in 4.0BSD.
128
1294th Berkeley Distribution        July 31, 1991                               2
130
131
132
133