BSD 4_3_Net_2 release
[unix-history] / usr / src / lib / libc / compat-43 / sigvec.2
index 9dc5994..dc4ce5c 100644 (file)
@@ -1,84 +1,94 @@
-.\" Copyright (c) 1980 The Regents of the University of California.
+.\" Copyright (c) 1980, 1991 The Regents of the University of California.
 .\" All rights reserved.
 .\"
 .\" All rights reserved.
 .\"
-.\" Redistribution and use in source and binary forms are permitted provided
-.\" that: (1) source distributions retain this entire copyright notice and
-.\" comment, and (2) distributions including binaries display the following
-.\" acknowledgement:  ``This product includes software developed by the
-.\" University of California, Berkeley and its contributors'' in the
-.\" documentation or other materials provided with the distribution and in
-.\" all advertising materials mentioning features or use of this software.
-.\" Neither the name of the University nor the names of its contributors may
-.\" be used to endorse or promote products derived from this software without
-.\" specific prior written permission.
-.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
-.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
-.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\"    must display the following acknowledgement:
+.\"    This product includes software developed by the University of
+.\"    California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\"    may be used to endorse or promote products derived from this software
+.\"    without specific prior written permission.
 .\"
 .\"
-.\"    @(#)sigvec.2    6.6 (Berkeley) 7/1/90
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
 .\"
 .\"
-.TH SIGVEC 2 "July 1, 1990"
-.UC 4
-.ie t .ds d \(dg
-.el .ds d \z'|+'
-.ie t .ds b \(bu
-.el .ds b @
-.SH NAME
-sigvec \- software signal facilities
-.SH SYNOPSIS
-.nf
-.B #include <signal.h>
-.PP
-.B struct sigvec {
-.B     void    (*sv_handler)();
-.B     int     sv_mask;
-.B     int     sv_flags;
-.B };
-.PP
-.B sigvec(sig, vec, ovec)
-.B int sig;
-.B struct sigvec *vec, *ovec;
-.fi
-.SH DESCRIPTION
-.B "This interface is made obsolete by sigaction(2).
-.LP
+.\"     @(#)sigvec.2   6.7 (Berkeley) 4/29/91
+.\"
+.Dd April 29, 1991
+.Dt SIGVEC 2
+.Os BSD 4
+.Sh NAME
+.Nm sigvec
+.Nd software signal facilities
+.Sh SYNOPSIS
+.Fd #include <signal.h>
+.Bd -literal
+struct sigvec {
+        void     (*sv_handler)();
+       sigset_t sv_mask;
+       int      sv_flags;
+};
+.Ed
+.Fn sigvec "int sig" "struct sigvec *vec" "struct sigvec *ovec"
+.Sh DESCRIPTION
+.Bf -symbolic
+This interface is made obsolete by sigaction(2).
+.Ef
+.Pp
 The system defines a set of signals that may be delivered to a process.
 Signal delivery resembles the occurence of a hardware interrupt:
 the signal is blocked from further occurrence, the current process 
 context is saved, and a new one is built.  A process may specify a
 The system defines a set of signals that may be delivered to a process.
 Signal delivery resembles the occurence of a hardware interrupt:
 the signal is blocked from further occurrence, the current process 
 context is saved, and a new one is built.  A process may specify a
-.I handler
+.Em handler
 to which a signal is delivered, or specify that a signal is to be 
 to which a signal is delivered, or specify that a signal is to be 
-.I blocked
+.Em blocked
 or
 or
-.IR ignored .
+.Em ignored .
 A process may also specify that a default action is to be taken
 by the system when a signal occurs.
 Normally, signal handlers execute on the current stack
 of the process.  This may be changed, on a per-handler basis,
 so that signals are taken on a special
 A process may also specify that a default action is to be taken
 by the system when a signal occurs.
 Normally, signal handlers execute on the current stack
 of the process.  This may be changed, on a per-handler basis,
 so that signals are taken on a special
-.IR "signal stack" .
-.PP
+.Em "signal stack" .
+.Pp
 All signals have the same
 All signals have the same
-.IR priority .
+.Em priority .
 Signal routines execute with the signal that caused their
 invocation
 Signal routines execute with the signal that caused their
 invocation
-.IR blocked ,
+.Em blocked ,
 but other signals may yet occur.
 A global 
 but other signals may yet occur.
 A global 
-.I "signal mask"
+.Em "signal mask"
 defines the set of signals currently blocked from delivery
 to a process.  The signal mask for a process is initialized
 from that of its parent (normally 0).  It
 may be changed with a
 defines the set of signals currently blocked from delivery
 to a process.  The signal mask for a process is initialized
 from that of its parent (normally 0).  It
 may be changed with a
-.IR sigblock (2)
+.Xr sigblock 2
 or
 or
-.IR sigsetmask (2)
+.Xr sigsetmask 2
 call, or when a signal is delivered to the process.
 call, or when a signal is delivered to the process.
-.PP
+.Pp
 When a signal
 condition arises for a process, the signal is added to a set of
 signals pending for the process.  If the signal is not currently
 When a signal
 condition arises for a process, the signal is added to a set of
 signals pending for the process.  If the signal is not currently
-.I blocked
+.Em blocked
 by the process then it is delivered to the process.  When a signal
 is delivered, the current state of the process is saved,
 a new signal mask is calculated (as described below), 
 by the process then it is delivered to the process.  When a signal
 is delivered, the current state of the process is saved,
 a new signal mask is calculated (as described below), 
@@ -88,226 +98,228 @@ normally the process will resume execution in the context
 from before the signal's delivery.
 If the process wishes to resume in a different context, then it
 must arrange to restore the previous context itself.
 from before the signal's delivery.
 If the process wishes to resume in a different context, then it
 must arrange to restore the previous context itself.
-.PP
+.Pp
 When a signal is delivered to a process a new signal mask is
 installed for the duration of the process' signal handler
 (or until a
 When a signal is delivered to a process a new signal mask is
 installed for the duration of the process' signal handler
 (or until a
-.I sigblock
+.Xr sigblock
 or
 or
-.I sigsetmask
+.Xr sigsetmask
 call is made).
 This mask is formed by taking the current signal mask,
 adding the signal to be delivered, and 
 call is made).
 This mask is formed by taking the current signal mask,
 adding the signal to be delivered, and 
-.IR or 'ing
+.Em or Ns 'ing
 in the signal mask associated with the handler to be invoked.
 in the signal mask associated with the handler to be invoked.
-.PP
-.I Sigvec
+.Pp
+.Fn Sigvec
 assigns a handler for a specific signal.  If
 assigns a handler for a specific signal.  If
-.I vec
+.Fa vec
 is non-zero, it
 specifies a handler routine and mask
 to be used when delivering the specified signal.
 is non-zero, it
 specifies a handler routine and mask
 to be used when delivering the specified signal.
-Further, if the SV_ONSTACK bit is set in
-.I sv_flags,
+Further, if the
+.Dv SV_ONSTACK
+bit is set in
+.Fa sv_flags ,
 the system will deliver the signal to the process on a
 the system will deliver the signal to the process on a
-.IR "signal stack" ,
+.Em "signal stack" ,
 specified with
 specified with
-.IR sigstack (2).
+.Xr sigstack 2 .
 If 
 If 
-.I ovec
+.Fa ovec
 is non-zero, the previous handling information for the signal
 is returned to the user.
 is non-zero, the previous handling information for the signal
 is returned to the user.
-.PP
+.Pp
 The following is a list of all signals
 with names as in the include file
 The following is a list of all signals
 with names as in the include file
-.RI < signal.h >:
-.LP
-.nf
-.ta \w'SIGVTALRM 'u +\w'15*  'u
-SIGHUP 1       hangup
-SIGINT 2       interrupt
-SIGQUIT        3*      quit
-SIGILL 4*      illegal instruction
-SIGTRAP        5*      trace trap
-SIGIOT 6*      IOT instruction
-SIGEMT 7*      EMT instruction
-SIGFPE 8*      floating point exception
-SIGKILL        9       kill (cannot be caught, blocked, 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
-SIGURG 16\*b   urgent condition present on socket
-SIGSTOP        17\*d   stop (cannot be caught, blocked, or ignored)
-SIGTSTP        18\*d   stop signal generated from keyboard
-SIGCONT        19\*b   continue after stop
-SIGCHLD        20\*b   child status has changed
-SIGTTIN        21\*d   background read attempted from control terminal
-SIGTTOU        22\*d   background write attempted to control terminal
-SIGIO  23\*b   i/o is possible on a descriptor (see \fIfcntl\fP(2))
-SIGXCPU        24      cpu time limit exceeded (see \fIsetrlimit\fP(2))
-SIGXFSZ        25      file size limit exceeded (see \fIsetrlimit\fP(2))
-SIGVTALRM      26      virtual time alarm (see \fIsetitimer\fP(2))
-SIGPROF        27      profiling timer alarm (see \fIsetitimer\fP(2))
-SIGWINCH       28\*b   window size change
-SIGINFO        29\*b   status request from keyboard
-SIGUSR1        30      user defined signal 1
-SIGUSR2        31      user defined signal 2
-.fi
-.PP
-The starred signals in the list above cause a core image
-if not caught or ignored.
-.PP
+.Aq Pa signal.h :
+.Bl -column SIGVTALARMXX "create core imagexxx"
+.It Sy "  NAME  " "      Default Action  " "                 Description"
+.It Dv SIGHUP No "     terminate process" "    terminal line hangup"
+.It Dv SIGINT No "     terminate process" "    interrupt program"
+.It Dv SIGQUIT No "    create core image" "    quit program"
+.It Dv SIGILL No "     create core image" "    illegal instruction"
+.It Dv SIGTRAP No "    create core image" "    trace trap"
+.It Dv SIGABRT No "    create core image" Xr   abort 2
+call (formerly
+.Dv SIGIOT )
+.It Dv SIGEMT No "     create core image" "    emulate instruction executed"
+.It Dv SIGFPE No "     create core image" "    floating-point exception"
+.It Dv SIGKILL No "    terminate process" "    kill program"
+.It Dv SIGBUS No "     create core image" "    bus error"
+.It Dv SIGSEGV No "    create core image" "    segmentation violation"
+.It Dv SIGSYS No "     create core image" "    system call given invalid argument"
+.It Dv SIGPIPE No "    terminate process" "    write on a pipe with no reader"
+.It Dv SIGALRM No "    terminate process" "    real-time timer expired"
+.It Dv SIGTERM No "    terminate process" "    software termination signal"
+.It Dv SIGURG No "     discard signal" "       urgent condition present on socket"
+.It Dv SIGSTOP No "    stop process" " stop (cannot be caught or ignored)"
+.It Dv SIGTSTP No "    stop process" " stop signal generated from keyboard"
+.It Dv SIGCONT No "    discard signal" "       continue after stop"
+.It Dv SIGCHLD No "    discard signal" "       child status has changed"
+.It Dv SIGTTIN No "    stop process" " background read attempted from control terminal"
+.It Dv SIGTTOU No "    stop process" " background write attempted to control terminal"
+.It Dv SIGIO No "      discard signal" Tn "    I/O"
+is possible on a descriptor (see
+.Xr fcntl 2 )
+.It Dv SIGXCPU No "    terminate process" "    cpu time limit exceeded (see"
+.Xr setrlimit 2 )
+.It Dv SIGXFSZ No "    terminate process" "    file size limit exceeded (see"
+.Xr setrlimit 2 )
+.It Dv SIGVTALRM No "  terminate process" "    virtual time alarm (see"
+.Xr setitimer 2 )
+.It Dv SIGPROF No "    terminate process" "    profiling timer alarm (see"
+.Xr setitimer 2 )
+.It Dv SIGWINCH No "   discard signal" "       Window size change"
+.It Dv SIGINFO No "    discard signal" "       status request from keyboard"
+.It Dv SIGUSR1 No "    terminate process" "    User defined signal 1"
+.It Dv SIGUSR2 No "    terminate process" "    User defined signal 2"
+.El
+.Pp
 Once a signal handler is installed, it remains installed
 until another
 Once a signal handler is installed, it remains installed
 until another
-.I sigvec
-call is made, or an 
-.IR execve (2)
+.Fn sigvec
+call is made, or an
+.Xr execve 2
 is performed.
 is performed.
-The default action for a signal may be reinstated by setting
-.I sv_handler
-to SIG_DFL; this default is termination
-(with a core image for starred signals)
-except for signals marked with \*b or \*d.
-Signals marked with \*b are discarded if the action
-is SIG_DFL; signals marked
-with \*d cause the process to stop.
+A signal-specific default action may be reset by
+setting
+.Fa sv_handler
+to
+.Dv SIG_DFL .
+The defaults are process termination, possibly with core dump;
+no action; stopping the process; or continuing the process.
+See the above signal list for each signal's default action.
 If
 If
-.I sv_handler
-is SIG_IGN the signal is subsequently ignored,
-and pending instances of the signal are discarded.
-.PP
-If a caught signal occurs during certain system calls,
+.Fa sv_handler
+is
+.Dv SIG_IGN
+current and pending instances
+of the signal are ignored and discarded.
+.Pp
+If a signal is caught during the system calls listed below,
 the call is normally restarted.
 The call can be forced to terminate prematurely with an
 the call is normally restarted.
 The call can be forced to terminate prematurely with an
-EINTR error return by setting the SV_INTERRUPT bit in
-.I sv_flags.
+.Dv EINTR
+error return by setting the
+.Dv SV_INTERRUPT
+bit in
+.Fa sv_flags .
 The affected system calls include
 The affected system calls include
-.IR read (2),
-.IR write (2),
-.IR sendto (2),
-.IR recvfrom (2),
-.IR sendmsg (2)
+.Xr read 2 ,
+.Xr write 2 ,
+.Xr sendto 2 ,
+.Xr recvfrom 2 ,
+.Xr sendmsg 2
 and
 and
-.IR recvmsg (2)
+.Xr recvmsg 2
 on a communications channel or a slow device (such as a terminal,
 but not a regular file)
 and during a
 on a communications channel or a slow device (such as a terminal,
 but not a regular file)
 and during a
-.IR wait (2)
+.Xr wait 2
 or
 or
-.IR ioctl (2).
+.Xr ioctl 2 .
 However, calls that have already committed are not restarted,
 but instead return a partial success (for example, a short read count).
 However, calls that have already committed are not restarted,
 but instead return a partial success (for example, a short read count).
-.PP
+.Pp
 After a
 After a
-.IR fork (2)
+.Xr fork 2
 or
 or
-.IR vfork (2)
-the child inherits
+.Xr vfork 2
 all signals, the signal mask, the signal stack,
 all signals, the signal mask, the signal stack,
-and the restart/interrupt flags.
-.PP
-.IR  Execve (2)
-resets all
-caught signals to default action and
+and the restart/interrupt flags are inherited by the child.
+.Pp
+.Xr Execve 2
+reinstates the default
+action for all signals which were caught and
 resets all signals to be caught on the user stack.
 Ignored signals remain ignored;
 the signal mask remains the same;
 signals that interrupt system calls continue to do so.
 resets all signals to be caught on the user stack.
 Ignored signals remain ignored;
 the signal mask remains the same;
 signals that interrupt system calls continue to do so.
-.SH NOTES
+.Sh NOTES
 The mask specified in 
 The mask specified in 
-.I vec
-is not allowed to block SIGKILL or SIGSTOP.
+.Fa vec
+is not allowed to block
+.Dv SIGKILL
+or
+.Dv SIGSTOP .
 This is done silently by the system.
 This is done silently by the system.
-.PP
-The SV_INTERRUPT flag is not available in 4.2BSD,
+.Pp
+The
+.Dv SV_INTERRUPT
+flag is not available in
+.Bx 4.2 ,
 hence it should not be used if backward compatibility is needed.
 hence it should not be used if backward compatibility is needed.
-.SH "RETURN VALUE
+.Sh RETURN VALUES
 A 0 value indicated that the call succeeded.  A \-1 return value
 indicates an error occurred and
 A 0 value indicated that the call succeeded.  A \-1 return value
 indicates an error occurred and
-.I errno
+.Va errno
 is set to indicated the reason.
 is set to indicated the reason.
-.SH ERRORS
-.I Sigvec
+.Sh ERRORS
+.Fn Sigvec
 will fail and no new signal handler will be installed if one
 of the following occurs:
 will fail and no new signal handler will be installed if one
 of the following occurs:
-.TP 15
-[EFAULT]
+.Bl -tag -width [EINVAL]
+.It Bq Er EFAULT
 Either
 Either
-.I vec
+.Fa vec
 or 
 or 
-.I ovec
+.Fa ovec
 points to memory that is not a valid part of the process
 address space.
 points to memory that is not a valid part of the process
 address space.
-.TP 15
-[EINVAL]
-.I Sig
+.It Bq Er EINVAL
+.Fa Sig
 is not a valid signal number.
 is not a valid signal number.
-.TP 15
-[EINVAL]
-An attempt is made to ignore or supply a handler for SIGKILL
-or SIGSTOP.
-.SH "SEE ALSO"
-sigaction(2), kill(1), ptrace(2), kill(2),
-sigprocmask(2), sigsuspend(2),
-sigblock(2), sigsetmask(2), sigpause(2),
-sigstack(2), sigvec(2), sigsetops(3), setjmp(3), siginterrupt(3), tty(4)
-.SH "NOTES  (VAX-11)"
+.It Bq Er EINVAL
+An attempt is made to ignore or supply a handler for
+.Dv SIGKILL
+or
+.Dv SIGSTOP .
+.El
+.Sh SEE ALSO
+.Xr sigaction 2 ,
+.Xr kill 1 ,
+.Xr ptrace 2 ,
+.Xr kill 2 ,
+.Xr sigprocmask 2 ,
+.Xr sigsuspend 2 ,
+.Xr sigblock 2 ,
+.Xr sigsetmask 2 ,
+.Xr sigpause 2 ,
+.Xr sigstack 2 ,
+.Xr sigvec 2 ,
+.Xr sigsetops 3 ,
+.Xr setjmp 3 ,
+.Xr siginterrupt 3 ,
+.Xr tty 4
+.Sh EXAMPLE
+On the
+.Tn VAX\-11
 The handler routine can be declared:
 The handler routine can be declared:
-.PP
-    void handler(sig, code, scp)
-    int sig, code;
-    struct sigcontext *scp;
-.PP
+.Bd -literal -offset indent
+void handler(sig, code, scp)
+int sig, code;
+struct sigcontext *scp;
+.Ed
+.Pp
 Here
 Here
-.I sig
+.Fa sig
 is the signal number, into which the hardware faults and traps are
 mapped as defined below. 
 is the signal number, into which the hardware faults and traps are
 mapped as defined below. 
-.I Code
+.Fa Code
 is a parameter that is either a constant
 as given below or, for compatibility mode faults, the code provided by
 the hardware (Compatibility mode faults are distinguished from the
 is a parameter that is either a constant
 as given below or, for compatibility mode faults, the code provided by
 the hardware (Compatibility mode faults are distinguished from the
-other SIGILL traps by having PSL_CM set in the psl).
-.I Scp
+other
+.Dv SIGILL
+traps by having
+.Dv PSL_CM
+set in the psl).
+.Fa Scp
 is a pointer to the
 is a pointer to the
-.I sigcontext
+.Fa sigcontext
 structure (defined in
 structure (defined in
-.RI < signal.h >),
+.Aq Pa signal.h ) ,
 used to restore the context from before the signal.
 used to restore the context from before the signal.
-.PP
-The following defines the mapping of hardware traps to signals
-and codes.  All of these symbols are defined in
-.RI < signal.h >:
-.LP
-.ta \w'     Floating/decimal divide by zero   'u +\w'15*  'u +8n
-.nf
-   Hardware condition  Signal  Code
-
-Arithmetic traps:
-   Integer overflow    SIGFPE  FPE_INTOVF_TRAP
-   Integer division by zero    SIGFPE  FPE_INTDIV_TRAP
-   Floating overflow trap      SIGFPE  FPE_FLTOVF_TRAP
-   Floating/decimal division by zero   SIGFPE  FPE_FLTDIV_TRAP
-   Floating underflow trap     SIGFPE  FPE_FLTUND_TRAP
-   Decimal overflow trap       SIGFPE  FPE_DECOVF_TRAP
-   Subscript-range     SIGFPE  FPE_SUBRNG_TRAP
-   Floating overflow fault     SIGFPE  FPE_FLTOVF_FAULT
-   Floating divide by zero fault       SIGFPE  FPE_FLTDIV_FAULT
-   Floating underflow fault    SIGFPE  FPE_FLTUND_FAULT
-Length access control  SIGSEGV
-Protection violation   SIGBUS
-Reserved instruction   SIGILL  ILL_RESAD_FAULT
-Customer-reserved instr.       SIGEMT
-Reserved operand       SIGILL  ILL_PRIVIN_FAULT
-Reserved addressing    SIGILL  ILL_RESOP_FAULT
-Trace pending  SIGTRAP
-Bpt instruction        SIGTRAP
-Compatibility-mode     SIGILL  hardware supplied code
-Chme   SIGSEGV
-Chms   SIGSEGV
-Chmu   SIGSEGV
-.fi
-.SH BUGS
+.Sh BUGS
 This manual page is still confusing.
 This manual page is still confusing.