sigvec.2

来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· 2 代码 · 共 286 行

2
286
字号
.\" SCCSID: @(#)sigvec.2	2.3	6/8/87.TH sigvec 2 VAX.ie t .ds d \(dg.el .ds d \z'|+'.ie t .ds b \(bu.el .ds b @.SH Namesigvec \- software signal facilities.SH Syntax.nf#include <signal.h>.PPstruct sigvec {void		(*\fIsv_handler\fP)\^(\^);sigset_t	sv_mask;int		sv_flags;};.PPsigvec\^(\fIsig, vec, ovec\fP)int \fIsig\fP;struct sigvec *\fIvec, *ovec\fP;.fi.SH Description.NXR "sigvec system call".NXR "signal handler" "assigning"The system defines a set of signals that can be delivered to a process.Signal delivery resembles the occurrence 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 can specify a handlerto which a signal is delivered, or specify that a signal is to be blocked or ignored.A process can also specify that a default action is to be takenby the system when a signal occurs.Normally, signal handlers execute on the current stackof the process.  This can be changed on a per-handler basisso that signals are taken on a special signal stack..PPAll signals have the same priority.  Signal routines execute with thesignal that caused their invocation to be blocked , but other signals can occur.A global signal mask defines the set of signals currently blocked from deliveryto a process.  The signal mask for a process is initializedfrom that of its parent (normally 0).  It may be changed with a.PN sigblock or.PN sigsetmask call, or when a signal is delivered to the process..PPWhen a signal condition arises for a process, the signal is added to a set ofsignals pending for the process.  If the signal is not currentlyblocked by the process, it is delivered to the process.  When a signalis delivered, the current state of the process is saved,a new signal mask is calculated (as described later), and the signal handler is invoked.  The call to the handleris arranged so that, if the signal handling routine returnsnormally, the process resumes execution in the contextfrom before the signal's delivery.If the process wishes to resume in a different context, itmust arrange to restore the previous context itself..PPWhen a signal is delivered to a process, a new signal mask isinstalled for the duration of the process's signal handler(or until a.PN sigblockor.PN sigsetmaskcall is made).This mask is formed by taking the current signal mask,adding the signal to be delivered, and ORingin the signal mask associated with the handler to be invoked..PPThe.PN sigvecsystem call assigns a handler for a specific signal.  If.I vecis nonzero, it specifies a handler routine and maskto be used when delivering the specified signal.  Further, if the SV_ONSTACKbit is set in.I sv_flags,the system delivers the signal to the process on a signal stack,specified with .PN sigstack .If .I ovecis nonzero, the previous handling information for the signalis returned to the user..PPThe following is a list of all signalswith names as in the include file.PN <signal.h> :.NXR "sigvec system call" "signal list".PP.nf.ta \w'SIGVTALRM 'u +\w'15*  'uSIGHUP	1	hangupSIGINT	2	interruptSIGQUIT	3*	quitSIGILL	4*	illegal instructionSIGTRAP	5*	trace trapSIGIOT	6*	IOT instructionSIGEMT	7*	EMT instructionSIGFPE	8*	floating point exceptionSIGKILL	9	kill (cannot be caught, blocked, or ignored)SIGBUS	10*	bus errorSIGSEGV	11*	segmentation violationSIGSYS	12*	bad argument to system callSIGPIPE	13	write on a pipe with no one to read itSIGALRM	14	alarm clockSIGTERM	15	software termination signalSIGURG	16.	urgent condition present on socketSIGSTOP	17+	stop (cannot be caught, blocked, or ignored)SIGTSTP	18+	stop signal generated from keyboardSIGCONT	19.	continue after stop SIGCHLD	20.	child status has changedSIGTTIN	21+	background read attempted from control terminalSIGTTOU	22+	background write attempted to control terminalSIGIO	23.	I/O is possible on a descriptor (see fcntl(2))SIGXCPU	24	cpu time limit exceeded (see setrlimit(2))SIGXFSZ	25	file size limit exceeded (see setrlimit(2))SIGVTALRM	26	virtual time alarm (see setitimer(2))SIGPROF	27	profiling timer alarm (see setitimer(2))SIGWINCH	28.  window size changeSIGLOST	29	lock not reclaimed after server recoverySIGUSR1	30	user defined signal 1SIGUSR2	31	user defined signal 2SIGCLD		System V name for SIGCHLDSIGABRT		X/OPEN name for SIGIOT.fi.PPThe signals marked with asterisks (*) in this list cause a core imageif not caught or ignored.  Explanations of the meaning of the periods (.)and plus signs (+) are included in the following paragraph..PPOnce a signal handler is installed, it remains installeduntil another.PN sigveccall is made or an .PN execve is performed.The default action for a signal can be reinstated by setting.I sv_handlerto SIG_DFL. This default is termination (with a core image for signalsmarked with asterisks (*)),except for signals marked with periods (.) or plus signs (+).Signals marked with periods (.) arediscarded if the action is SIG_DFL. Signals marked with plus signs (+) cause theprocess to stop.  If.I sv_handleris SIG_IGN the signal is subsequently ignored, and pending instances of thesignal are discarded..PPIf a caught signal occurs during certain system calls,the call is normally restarted.The call can be forced to terminate prematurely with anEINTR error return, by setting the SV_INTERRUPT bit in.I sv_flags.The affected system calls are.PN read ,.PN write ,or.PN ioctlon a slow device (such as a terminal; but not a file),.PN flock ,and.PN wait ..PPAfter a .PN forkor.PN vfork ,the child inheritsall signals, the signal mask, the signal stack,and the restart/interrupt flags..PPThe.PN execvesystem call resets all caught signals to default action andresets 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..PPThe mask specified in .I vecis not allowed to block SIGKILL or SIGSTOP.  This is done silentlyby the system..PPThe SV_INTERRUPT flag is not available in ULTRIX 2.0 or earlier versions.Therefore, it should not be used if backward compatibility is needed..PP.B Notes .PP.NXR "sigvec system call" "VAX notes"The handler routine can be declared:.EXvoid handler(sig, code, scp)int sig, code;struct sigcontext *scp;.EEHere.I sigis the signal number into which the hardware faults and traps aremapped as defined in the following table. The.I codeis a parameter that is either a constantor, for compatibility mode faults, the code provided bythe hardware.  Compatibility mode faults are distinguished from theother SIGILL traps by having PSL_CM set in the psl.The.I scpis a pointer to the.I sigcontextstructure (defined in.PN <signal.h>), used to restore the context from before the signal..PPThe following defines the mapping of hardware traps to signalsand codes.  All of these symbols are defined in.PN <signal.h> :.PP.ta \w'     Floating/decimal divide by zero   'u +\w'15*  'u +8n.nf   \fBHardware condition	Signal	Code\fRArithmetic 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_FAULTLength access control	SIGSEGV	faulting virtual addrProtection violation	SIGBUS	faulting virtual addrReserved instruction	SIGILL	ILL_PRIVIN_FAULTCustomer-reserved instr.	SIGEMTReserved operand	SIGILL	ILL_RESOP_FAULTReserved addressing	SIGILL	ILL_RESAD_FAULTTrace pending	SIGTRAPBpt instruction	SIGTRAPCompatibility-mode	SIGILL	hardware-supplied codeChme	SIGSEGVChms	SIGSEGVChmu	SIGSEGV.fi.SH Return ValuesA zero (0) value indicates that the call succeeded.  A \-1 return valueindicates an error occurred, and.I errnois set to indicate the reason..SH Diagnostics.NXR "sigvec system call" "diagnostics"The.PN sigvecsystem call fails and no new signal handler is installed, if oneof the following occurs:.TP 15[EFAULT]Either.I vecor .I ovecpoints to memory that is not a valid part of the processaddress space..TP 15[EINVAL]The.I sigargument is not a valid signal number..TP 15[EINVAL]An attempt is made to ignore or supply a handler for SIGKILLor SIGSTOP..SH Environment.TPSYSTEM_FIVEYou can not use the.PN sigveccall in your program under SYSTEM_FIVE environment..SH See Alsokill(1), kill(2), ptrace(2), sigblock(2), sigpause(2), sigsetmask(2),sigstack(2), setjmp(3), siginterrupt(3), tty(4)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?