1SIGVEC(2)                     System Calls Manual                    SIGVEC(2)
2
3
4

NAME

6       sigvec - software signal facilities
7

SYNOPSIS

9       #include <signal.h>
10
11       struct sigvec {
12       int  (*sv_handler)();
13       long sv_mask;
14       int  sv_flags;
15       };
16
17       sigvec(sig, vec, ovec)
18       int sig;
19       struct sigvec *vec, *ovec;
20

DESCRIPTION

22       This interface has been made obsolete by: sigaction(2).
23
24       The system defines a set of signals that may be delivered to a process.
25       Signal delivery resembles the occurence of a  hardware  interrupt:  the
26       signal  is blocked from further occurrence, the current process context
27       is saved, and a new one is built.  A process may specify a  handler  to
28       which  a signal is delivered, or specify that a signal is to be blocked
29       or ignored.  A process may also specify that a default action is to  be
30       taken  by  the  system when a signal occurs.  Normally, signal handlers
31       execute on the current stack of the process.  This may be changed, on a
32       per-handler basis, so that signals are taken on a special signal stack.
33
34       All  signals  have the same priority.  Signal routines execute with the
35       signal that caused their invocation blocked, but other signals may  yet
36       occur.   A  global  signal  mask  defines  the set of signals currently
37       blocked from delivery to a process.  The signal mask for a  process  is
38       initialized  from  that  of its parent (normally 0).  It may be changed
39       with a sigblock(2) or sigsetmask(2) call, or when a signal is delivered
40       to the process.
41
42       When  a signal condition arises for a process, the signal is added to a
43       set of signals pending for the process.  If the signal is not currently
44       blocked  by  the  process  then it is delivered to the process.  When a
45       signal is delivered, the current state of the process is saved,  a  new
46       signal  mask is calculated (as described below), and the signal handler
47       is invoked.  The call to the handler is arranged so that if the  signal
48       handling  routine returns normally the process will resume execution in
49       the context from before the signal's delivery.  If the  process  wishes
50       to  resume  in a different context, then it must arrange to restore the
51       previous context itself.
52
53       When a signal is delivered to a process a new signal mask is  installed
54       for the duration of the process' signal handler (or until a sigblock or
55       sigsetmask call is made).  This mask is formed by  taking  the  current
56       signal  mask, adding the signal to be delivered, and or'ing in the sig‐
57       nal mask associated with the handler to be invoked.
58
59       Sigvec assigns a handler for a specific signal.  If vec is non-zero, it
60       specifies  a  handler  routine  and mask to be used when delivering the
61       specified signal.  Further, if the SV_ONSTACK bit is set  in  sv_flags,
62       the  system  will  deliver the signal to the process on a signal stack,
63       specified with sigstack(2).  If ovec is non-zero, the previous handling
64       information for the signal is returned to the user.
65
66       The  following  is  a  list of all signals with names as in the include
67       file <signal.h>:
68
69       SIGHUP    1    hangup
70       SIGINT    2    interrupt
71       SIGQUIT   3*   quit
72       SIGILL    4*   illegal instruction
73       SIGTRAP   5*   trace trap
74       SIGIOT    6*   IOT instruction
75       SIGEMT    7*   EMT instruction
76       SIGFPE    8*   floating point exception
77       SIGKILL   9    kill (cannot be caught, blocked, or ignored)
78       SIGBUS    10*  bus error
79       SIGSEGV   11*  segmentation violation
80       SIGSYS    12*  bad argument to system call
81       SIGPIPE   13   write on a pipe with no one to read it
82       SIGALRM   14   alarm clock
83       SIGTERM   15   software termination signal
84       SIGURG    16@  urgent condition present on socket
85       SIGSTOP   17'|+'stop (cannot be caught, blocked, or ignored)
86       SIGTSTP   18'|+'stop signal generated from keyboard
87       SIGCONT   19@  continue after stop (cannot be blocked)
88       SIGCHLD   20@  child status has changed
89       SIGTTIN   21'|+'background read attempted from control terminal
90       SIGTTOU   22'|+'background write attempted to control terminal
91       SIGIO     23@  i/o is possible on a descriptor (see fcntl(2))
92       SIGXCPU   24   cpu time limit exceeded (see setrlimit(2))
93       SIGXFSZ   25   file size limit exceeded (see setrlimit(2))
94       SIGVTALRM 26   virtual time alarm (see setitimer(2))
95       SIGPROF   27   profiling timer alarm (see setitimer(2))
96       SIGWINCH  28@  window size change
97       SIGUSR1   30   user defined signal 1
98       SIGUSR2   31   user defined signal 2
99
100       The starred signals in the list above cause a core image if not  caught
101       or ignored.
102
103       Once  a signal handler is installed, it remains installed until another
104       sigvec call is made, or an execve(2) is performed.  The default  action
105       for  a  signal may be reinstated by setting sv_handler to SIG_DFL; this
106       default is termination (with a core image for starred  signals)  except
107       for  signals marked with @ or '|+'.  Signals marked with @ are discarded
108       if the action is SIG_DFL; signals marked with '|+' cause the process  to
109       stop.  If sv_handler is SIG_IGN the signal is subsequently ignored, and
110       pending instances of the signal are discarded.
111
112       If a caught signal occurs during certain system calls, the call is nor‐
113       mally  restarted.  The call can be forced to terminate prematurely with
114       an EINTR error return by setting the SV_INTERRUPT bit in sv_flags.  The
115       affected system calls are read(2) or write(2) on a slow device (such as
116       a terminal; but not a file) and during a wait(2).
117
118       After a fork(2) or vfork(2) the child inherits all signals, the  signal
119       mask, the signal stack, and the restart/interrupt flags.
120
121       Execve(2)  resets  all  caught signals to default action and resets all
122       signals to be  caught  on  the  user  stack.   Ignored  signals  remain
123       ignored;  the signal mask remains the same; signals that interrupt sys‐
124       tem calls continue to do so.
125

NOTES

127       The mask specified in vec is not allowed to block SIGKILL, SIGSTOP,  or
128       SIGCONT.  This is done silently by the system.
129
130       The  SV_INTERRUPT  flag is not available in 4.2BSD, hence it should not
131       be used if backward compatibility is needed.
132

RETURN VALUE

134       A 0 value indicated that the call succeeded.  A -1 return  value  indi‐
135       cates an error occurred and errno is set to indicated the reason.
136

ERRORS

138       Sigvec  will fail and no new signal handler will be installed if one of
139       the following occurs:
140
141       [EFAULT]       Either vec or ovec points to memory that is not a  valid
142                      part of the process address space.
143
144       [EINVAL]       Sig is not a valid signal number.
145
146       [EINVAL]       An  attempt  is  made  to ignore or supply a handler for
147                      SIGKILL or SIGSTOP.
148
149       [EINVAL]       An attempt is made to ignore SIGCONT (by default SIGCONT
150                      is ignored).
151

SEE ALSO

153       kill(1),  ptrace(2),  kill(2), sigblock(2), sigsetmask(2), sigpause(2),
154       sigstack(2), sigvec(2), setjmp(3), siginterrupt(3), tty(4)
155

NOTES (VAX-11)

157       The handler routine can be declared:
158
159           handler(sig, code, scp)
160           int sig, code;
161           struct sigcontext *scp;
162
163       Here sig is the signal number, into which the hardware faults and traps
164       are mapped as defined below.  Code is a parameter that is either a con‐
165       stant as given below or, for compatibility mode faults, the  code  pro‐
166       vided by the hardware (Compatibility mode faults are distinguished from
167       the other SIGILL traps by having PSL_CM set in  the  psl).   Scp  is  a
168       pointer  to  the  sigcontext structure (defined in <signal.h>), used to
169       restore the context from before the signal.
170
171       The following defines the mapping of  hardware  traps  to  signals  and
172       codes.  All of these symbols are defined in <signal.h>:
173
174          Hardware condition                  Signal       Code
175
176       Arithmetic traps:
177          Integer overflow                    SIGFPE       FPE_INTOVF_TRAP
178          Integer division by zero            SIGFPE       FPE_INTDIV_TRAP
179          Floating overflow trap              SIGFPE       FPE_FLTOVF_TRAP
180          Floating/decimal division by zero   SIGFPE       FPE_FLTDIV_TRAP
181          Floating underflow trap             SIGFPE       FPE_FLTUND_TRAP
182          Decimal overflow trap               SIGFPE       FPE_DECOVF_TRAP
183          Subscript-range                     SIGFPE       FPE_SUBRNG_TRAP
184          Floating overflow fault             SIGFPE       FPE_FLTOVF_FAULT
185          Floating divide by zero fault       SIGFPE       FPE_FLTDIV_FAULT
186          Floating underflow fault            SIGFPE       FPE_FLTUND_FAULT
187       Length access control                  SIGSEGV
188       Protection violation                   SIGBUS
189       Reserved instruction                   SIGILL       ILL_RESAD_FAULT
190       Customer-reserved instr.               SIGEMT
191       Reserved operand                       SIGILL       ILL_PRIVIN_FAULT
192       Reserved addressing                    SIGILL       ILL_RESOP_FAULT
193       Trace pending                          SIGTRAP
194       Bpt instruction                        SIGTRAP
195       Compatibility-mode                     SIGILL       hardware supplied code
196       Chme                                   SIGSEGV
197       Chms                                   SIGSEGV
198       Chmu                                   SIGSEGV
199

NOTES (PDP-11)

201       The handler routine can be declared:
202
203           handler(sig, code, scp)
204           int sig, code;
205           struct sigcontext *scp;
206
207       Here sig is the signal number, into which the hardware faults and traps
208       are mapped as defined below.  Code is a parameter that is a constant as
209       given  below.  Scp is a pointer to the sigcontext structure (defined in
210       <signal.h>), used to restore the context from before the signal.
211
212       The following defines the mapping of  hardware  traps  to  signals  and
213       codes.  All of these symbols are defined in <signal.h>:
214
215          Hardware condition                  Signal       Code
216
217       Arithmetic traps:
218          Floating overflow trap              SIGFPE       FPE_FLTOVF_TRAP
219          Floating/decimal division by zero   SIGFPE       FPE_FLTDIV_TRAP
220          Floating underflow trap             SIGFPE       FPE_FLTUND_TRAP
221          Decimal overflow trap               SIGFPE       FPE_DECOVF_TRAP
222          Illegal return code                 SIGFPE       FPE_CRAZY
223          Bad op code                         SIGFPE       FPE_OPCODE_TRAP
224          Bad operand                         SIGFPE       FPE_OPERAND_TRAP
225          Maintenance trap                    SIGFPE       FPE_MAINT_TRAP
226       Length access control                  SIGSEGV
227       Protection violation (odd address)     SIGBUS
228       Reserved instruction                   SIGILL       ILL_RESAD_FAULT
229       Customer-reserved instr.               SIGEMT
230       Trace pending                          SIGTRAP
231       Bpt instruction                        SIGTRAP
232
233       The  handler  routine  must save any registers it uses and restore them
234       before returning.  On the PDP-11, the kernel saves  r0  and  r1  before
235       calling  the  handler routine, but expect the handler to save any other
236       registers it uses.  The standard entry code generated by the C compiler
237       for  handler  routines  written  in C automatically saves the remaining
238       general registers, but floating point registers are not  saved.   As  a
239       result  there  is  currently no [standard] method for a handler routine
240       written in C to perform floating point operations without  blowing  the
241       interrupted program out of the water.
242

BUGS

244       This manual page is still confusing.
245
246
247
2484th Berkeley Distribution      September 3, 1997                     SIGVEC(2)
Impressum