/* @(#)signal.h 2.8 (ULTRIX) 11/9/89 */ /************************************************************************ * * * Copyright (c) 1987-1989 by * * Digital Equipment Corporation, Maynard, MA * * All rights reserved. * * * * This software is furnished under a license and may be used and * * copied only in accordance with the terms of such license and * * with the inclusion of the above copyright notice. This * * software or any other copies thereof may not be provided or * * otherwise made available to any other person. No title to and * * ownership of the software is hereby transferred. * * * * This software is derived from software received from the * * University of California, Berkeley, and from Bell * * Laboratories. Use, duplication, or disclosure is subject to * * restrictions under license agreements with University of * * California and with AT&T. * * * * The information in this software is subject to change without * * notice and should not be construed as a commitment by Digital * * Equipment Corporation. * * * * Digital assumes no responsibility for the use or reliability * * of its software on equipment which is not supplied by Digital. * * * ************************************************************************/ #ifndef _SIGNAL_H_ #define _SIGNAL_H_ #include "ansi_compat.h" #define NSIG 32 #define SIGHUP 1 /* hangup */ #define SIGINT 2 /* interrupt */ #define SIGQUIT 3 /* quit */ #define SIGILL 4 /* illegal instruction (not reset when caught) */ #define SIGTRAP 5 /* trace trap (not reset when caught) */ #define SIGIOT 6 /* IOT instruction */ #define SIGEMT 7 /* EMT instruction */ #define SIGFPE 8 /* floating point exception */ #if !defined(_POSIX_SOURCE) #define FPE_INTOVF_TRAP 0x1 /* integer overflow */ #define FPE_INTDIV_TRAP 0x2 /* integer divide by zero */ #define FPE_FLTOVF_TRAP 0x3 /* floating overflow */ #define FPE_FLTDIV_TRAP 0x4 /* floating/decimal divide by zero */ #define FPE_FLTUND_TRAP 0x5 /* floating underflow */ #define FPE_DECOVF_TRAP 0x6 /* decimal overflow */ #define FPE_SUBRNG_TRAP 0x7 /* subscript out of range */ #define FPE_FLTOVF_FAULT 0x8 /* floating overflow fault */ #define FPE_FLTDIV_FAULT 0x9 /* divide by zero floating fault */ #define FPE_FLTUND_FAULT 0xa /* floating underflow fault */ /* the following are used to for Vector Arithmetic Exception handling */ #define FPE_VECTOR 0x3e0 /* Vector Arithmetic Exception Mask */ #define VFPE_FLTUND_TRAP 0x20 /* Floating Underflow */ #define VFPE_FLTDIV_TRAP 0x40 /* Floating Divide by Zero */ #define VFPE_FLTRSV_TRAP 0x80 /* Floating Reserved Operan */ #define VPFE_FLTOVF_FAULT 0x0100 /* Floating Overflow */ #define VFPE_INTOVF_TRAP 0x0200 /* Integer Overflow */ #endif /* !defined(_POSIX_SOURCE) */ #define SIGKILL 9 /* kill (cannot be caught or ignored) */ #define SIGBUS 10 /* bus error */ #define SIGSEGV 11 /* segmentation violation */ #define SIGSYS 12 /* bad argument to system call */ #define SIGPIPE 13 /* write on a pipe with no one to read it */ #define SIGALRM 14 /* alarm clock */ #define SIGTERM 15 /* software termination signal from kill */ #define SIGURG 16 /* urgent condition on IO channel */ #define SIGSTOP 17 /* sendable stop signal not from tty */ #define SIGTSTP 18 /* stop signal from tty */ #define SIGCONT 19 /* continue a stopped process */ #define SIGCHLD 20 /* to parent on child stop or exit */ #define SIGTTIN 21 /* to readers pgrp upon background tty read */ #define SIGTTOU 22 /* like TTIN for output if (tp->t_local<OSTOP) */ #define SIGIO 23 /* input/output possible signal */ #define SIGXCPU 24 /* exceeded CPU time limit */ #define SIGXFSZ 25 /* exceeded file size limit */ #define SIGVTALRM 26 /* virtual time alarm */ #define SIGPROF 27 /* profiling time alarm */ #define SIGWINCH 28 /* window size changes */ #define SIGLOST 29 /* Sys-V rec lock: notify user upon server crash */ #define SIGUSR1 30 /* User signal 1 (from SysV) */ #define SIGUSR2 31 /* User signal 2 (from SysV) */ /* Add System V signal definitions (DLB001) */ #define SIGCLD SIGCHLD /* System V name for SIGCHLD */ #define SIGABRT SIGIOT /* Added from BRL package for /usr/group. Signal * returned by abort(3C). Map onto SIGIOT. */ #if !defined(_POSIX_SOURCE) /* * Codes for the mips break instruction. */ #define BRK_USERBP 0 /* user bp (used by debuggers) */ #define BRK_KERNELBP 1 /* kernel bp (used by prom) */ #define BRK_ABORT 2 /* no longer used */ #define BRK_BD_TAKEN 3 /* for taken bd emulation */ #define BRK_BD_NOTTAKEN 4 /* for not taken bd emulation */ #define BRK_SSTEPBP 5 /* user bp (used by debuggers) */ #define BRK_OVERFLOW 6 /* overflow check */ #define BRK_DIVZERO 7 /* divide by zero check */ #define BRK_RANGE 8 /* range error check */ #define BRK_STACKOVERFLOW 9 /* used by Ada */ #endif /* !defined(_POSIX_SOURCE) */ /* Accesses to sig_atomic_t are atomic, even with async interrupts. Not an issue for us, but ANSI requires the definition. */ typedef long sig_atomic_t; typedef int sigset_t; /* type used for sigsetops() functions */ /* * Signal vector "template" used in sigvec call. */ struct sigvec { void (*sv_handler)(); /* signal handler */ sigset_t sv_mask; /* signal mask to apply */ int sv_flags; /* see signal options below */ }; /* * The following structure must be exactly the same as the above structure * with the names changed for POSIX compliance. */ struct sigaction { void (*sa_handler)(); /* signal handler */ sigset_t sa_mask; /* signal mask to apply */ int sa_flags; /* see signal options below */ }; #if !defined(_POSIX_SOURCE) #define SV_ONSTACK 0x0001 /* take signal on signal stack */ #define SV_INTERRUPT 0x0002 /* do not restart system on signal return */ #endif /* !defined(_POSIX_SOURCE) */ #define SA_NOCLDSTOP 0x0004 /* Don't generate SIGCLD when children stop */ #if !defined(_POSIX_SOURCE) #define SV_OLDSIG 0x1000 /* Emulate old signal() for POSIX */ #define sv_onstack sv_flags /* isn't compatibility wonderful! */ #endif /* !defined(_POSIX_SOURCE) */ /* Defines for sigprocmask() call. POSIX. */ #define SIG_BLOCK 1 /* Add these signals to block mask */ #define SIG_UNBLOCK 2 /* Remove these signals from block mask */ #define SIG_SETMASK 3 /* Set block mask to this mask */ /* * Structure used in sigstack call. */ struct sigstack { char *ss_sp; /* signal stack pointer */ int ss_onstack; /* current status */ }; /* * Information pushed on stack when a signal is delivered. * This is used by the kernel to restore state following * execution of the signal handler. It is also made available * to the handler to allow it to properly restore state if * a non-standard exit is performed. * */ struct sigcontext { int sc_onstack; /* sigstack state to restore */ int sc_mask; /* signal mask to restore */ int sc_pc; /* pc at time of signal */ /* * General purpose registers */ int sc_regs[32]; /* processor regs 0 to 31 */ int sc_mdlo; /* mul/div low */ int sc_mdhi; /* mul/div high */ /* * Floating point coprocessor state */ int sc_ownedfp; /* fp has been used */ int sc_fpregs[32]; /* fp regs 0 to 31 */ int sc_fpc_csr; /* floating point control and status reg */ int sc_fpc_eir; /* floating point exception instruction reg */ /* * END OF REGION THAT MUST AGREE WITH setjmp.h * END OF jmp_buf REGION */ /* * System coprocessor registers at time of signal */ int sc_cause; /* cp0 cause register */ int sc_badvaddr; /* cp0 bad virtual address */ int sc_badpaddr; /* cpu bd bad physical address */ }; #if !defined(_POSIX_SOURCE) #define BADSIG ((void (*)())(-1)) #endif /* !defined(_POSIX_SOURCE) */ #define SIG_ERR ((void (*)())(-1)) #define SIG_DFL ((void (*)())( 0)) #define SIG_IGN ((void (*)())( 1)) #ifdef KERNEL #define SIG_CATCH ((void (*)())( 2)) #define SIG_HOLD ((void (*)())( 3)) #else /* KERNEL */ #ifdef __STDC__ #ifndef _PID_T_ #define _PID_T_ typedef int pid_t; #endif /* _PID_T_ */ /* * prototypes * */ extern void (*signal(int __sig, void(*__func)(int)))(int); int raise( int __sig ); int kill( pid_t __pid, int __sig ); int sigemptyset( sigset_t *__set ); int sigfillset( sigset_t *__set ); int sigaddset( sigset_t *__set, int __signo ); int sigdelset( sigset_t *__set, int __signo ); int sigismember( const sigset_t *__set, int __signo ); int sigaction( int __sig, const struct sigaction *__act, struct sigaction *__oact ); int sigprocmask( int __how, const sigset_t *__set, sigset_t *__oset ); int sigpending( sigset_t *__set ); int sigsuspend( const sigset_t *__sigmask ); #else extern void (*signal())(); extern int raise(); extern int kill(); extern int sigaction(), sigaddset(), sigdelset(), sigemptyset(), sigfillset(), sigismember(), sigpending(), sigprocmask(), sigsuspend(); #endif /* __STDC__ */ #endif /* KERNEL */ /* * Macro for converting signal number to a mask suitable for * sigblock(). */ #if !defined(_POSIX_SOURCE) #define sigmask(m) (1 << ((m)-1)) #endif /* !defined(_POSIX_SOURCE) */ #endif /* _SIGNAL_H_ */