Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ sigvec(2) — A/UX 2.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

kill(1)

ptrace(2)

kill(2)

sigblock(2)

setcompat(2)

setmask(2)

sigpause(2)

sigstack(2)

set42sig(3)

nal(3)

termio(7)




sigvec(2) sigvec(2)
NAME sigvec - optional BSD-compatible software signal facilities SYNOPSIS #include <signal.h> struct sigvec { int (*sv_handler)(); int sv_mask; int sv_flags; }; int sigvec(sig, vec, ovec) int sig; struct sigvec *vec, *ovec; DESCRIPTION The system defines a set of signals that may be delivered to a process. Signal delivery resembles the occurrence of a hardware interrupt: the signal is blocked from further oc- currence, the current process context is saved, and a new process context is built. A process may specify a handler to which a signal is delivered or specify that a signal is to be blocked or 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 can be changed on a per-handler basis, so that signals are taken on a special ``signal stack.'' All signals have the same priority. Signal routines execute with the signal that caused their invocation to be blocked, but other signals may yet occur. A global ``signal mask'' defines the set of signals currently blocked from being delivered to a process. The signal mask for a process is initialized from the signal mask of its parent (normally 0). It may be changed with a sigblock(2) or sigsetmask(2) call, or by a signal being delivered to the process. 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 blocked by the process, then it is delivered. When a signal is 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 handler is arranged so that if the signal han- dling routine returns normally, the process will resume exe- cution in the same context as before the signal's delivery. If the process wishes to resume in a different context, then it must arrange to restore the previous context. April, 1990 1



sigvec(2) sigvec(2)
When a signal is delivered to a process, a new signal mask is installed for the same duration as the process's signal handler (or until a sigblock or sigsetmask call is made). This mask is formed by taking the current signal mask, ad- ding the signal to be delivered, and ORing in the signal mask associated with the handler to be invoked. sigvec assigns a handler for a specific signal. If vec is nonzero, it specifies a handler routine and mask to be used when delivering the specified signal. If the SV_ONSTACK bit is set in sv_flags, the system will deliver the signal to the process on a signal stack, specified by sigstack(2). If the SV_INTERRUPT bit is set in sv_flags, system calls inter- rupted by a signal will not be restarted. If the SV_NOCLDSTOP bit is set in sv_flags, SIGCHLD will not be generated if a child process stops. If ovec is nonzero, the previous handling information for the signal is returned to the user. The following is a list of the A/UX signals with the corresponding names of the include file <signal.h>. 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 SIGUSR1 16 user defined signal 1 SIGUSR2 17 user defined signal 2 SIGCLD 18@ child status has changed SIGPWR 19 power-fail restart SIGTSTP 20† stop signal generated from keyboard SIGTTIN 21† background read attempted from control terminal SIGTTOU 22† background write attempted to control terminal SIGSTOP 23† stop (cannot be caught, blocked, or ignored) SIGXCPU 24 cpu time limit exceeded SIGXFSZ 25 file size limit exceeded SIGVTALRM 26 virtual time alarm (see setitimer(2)) SIGPROF 27 profiling timer alarm (see setitimer(2)) SIGWINCH 28@ window size change SIGCONT 29@ continue after stop (cannot be blocked) SIGURG 30@ urgent condition present on socket 2 April, 1990



sigvec(2) sigvec(2)
SIGIO 31@ I/O is possible on a descriptor (see fcntl(2)) The signals marked with an asterisk (*) in the list above cause a core image to be dumped if not caught or ignored. Once a signal handler is installed, it remains installed un- til another sigvec call is made or an execve(2) is per- formed. The default action for a signal may be reinstated by setting sv_handler to SIG_DFL; this default is termina- tion (with a core image for starred signals) except for sig- nals marked with @ or †. Signals marked with @ are discard- ed if the action is SIG_DFL; signals marked with † cause the process to stop if the process is part of a 4.2 job control group. They are ignored when using 5.2 signals. If sv_handler is SIG_IGN, the signal is subsequently ignored, and pending instances of the signal are discarded. If a caught signal occurs during certain system calls, the call is normally restarted. The affected system calls are read(2) or write(2) on a slow device (such as a terminal, but not a file) and during a wait(2). This behavior may be modified by options supplied to the setcompat(2) system call. After a fork(2), the child inherits all signals, the signal mask, and the signal stack. execve(2) resets all caught signals to the default action and resets all signals to be caught on the user stack. Ig- nored signals remain ignored; the signal mask remains the same; the signal handler reverts to the 5.2 signal mechan- ism. NOTES The mask specified in vec is not allowed to block SIGKILL, SIGSTOP, or SIGCONT. This is done silently by the system. RETURN VALUE A 0 value indicates that the call succeeded. A -1 return value indicates that an error occurred and errno is set to indicate the reason. ERRORS sigvec will fail and no new signal handler will be installed if one of the following occurs. [EFAULT] Either vec or ovec points to memory that is not a valid part of the process address space. [EINVAL] sig is not a valid signal number. April, 1990 3



sigvec(2) sigvec(2)
[EINVAL] An attempt is made to ignore or to supply a handler for SIGKILL or SIGSTOP. [EINVAL] An attempt is made to ignore SIGCONT (by de- fault SIGCONT is ignored). SEE ALSO kill(1), ptrace(2), kill(2), sigblock(2), setcompat(2), sig- setmask(2), sigpause(2), sigstack(2), set42sig(3), sig- nal(3), termio(7). 4 April, 1990

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026