📄 signal.h
字号:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
include/signal.h
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00700 /* The <signal.h> header defines all the ANSI and POSIX signals.
00701 * MINIX supports all the signals required by POSIX. They are defined below.
00702 * Some additional signals are also supported.
00703 */
00704
00705 #ifndef _SIGNAL_H
00706 #define _SIGNAL_H
00707
00708 #ifndef _ANSI_H
00709 #include <ansi.h>
00710 #endif
00711
00712 /* Here are types that are closely associated with signal handling. */
00713 typedef int sig_atomic_t;
00714
00715 #ifdef _POSIX_SOURCE
00716 #ifndef _SIGSET_T
00717 #define _SIGSET_T
00718 typedef unsigned long sigset_t;
00719 #endif
00720 #endif
00721
00722 #define _NSIG 16 /* number of signals used */
00723
00724 #define SIGHUP 1 /* hangup */
00725 #define SIGINT 2 /* interrupt (DEL) */
00726 #define SIGQUIT 3 /* quit (ASCII FS) */
00727 #define SIGILL 4 /* illegal instruction */
00728 #define SIGTRAP 5 /* trace trap (not reset when caught) */
00729 #define SIGABRT 6 /* IOT instruction */
00730 #define SIGIOT 6 /* SIGABRT for people who speak PDP-11 */
00731 #define SIGUNUSED 7 /* spare code */
00732 #define SIGFPE 8 /* floating point exception */
00733 #define SIGKILL 9 /* kill (cannot be caught or ignored) */
00734 #define SIGUSR1 10 /* user defined signal # 1 */
00735 #define SIGSEGV 11 /* segmentation violation */
00736 #define SIGUSR2 12 /* user defined signal # 2 */
00737 #define SIGPIPE 13 /* write on a pipe with no one to read it */
00738 #define SIGALRM 14 /* alarm clock */
00739 #define SIGTERM 15 /* software termination signal from kill */
00740
00741 #define SIGEMT 7 /* obsolete */
00742 #define SIGBUS 10 /* obsolete */
00743
00744 /* POSIX requires the following signals to be defined, even if they are
00745 * not supported. Here are the definitions, but they are not supported.
00746 */
00747 #define SIGCHLD 17 /* child process terminated or stopped */
00748 #define SIGCONT 18 /* continue if stopped */
00749 #define SIGSTOP 19 /* stop signal */
00750 #define SIGTSTP 20 /* interactive stop signal */
00751 #define SIGTTIN 21 /* background process wants to read */
00752 #define SIGTTOU 22 /* background process wants to write */
00753
00754 /* The sighandler_t type is not allowed unless _POSIX_SOURCE is defined. */
00755 #ifdef _POSIX_SOURCE
00756 #define __sighandler_t sighandler_t
00757 #else
00758 typedef void (*__sighandler_t) (int);
00759 #endif
00760
00761 /* Macros used as function pointers. */
00762 #define SIG_ERR ((__sighandler_t) -1) /* error return */
00763 #define SIG_DFL ((__sighandler_t) 0) /* default signal handling */
00764 #define SIG_IGN ((__sighandler_t) 1) /* ignore signal */
00765 #define SIG_HOLD ((__sighandler_t) 2) /* block signal */
00766 #define SIG_CATCH ((__sighandler_t) 3) /* catch signal */
00767
00768 #ifdef _POSIX_SOURCE
00769 struct sigaction {
00770 __sighandler_t sa_handler; /* SIG_DFL, SIG_IGN, or pointer to function */
00771 sigset_t sa_mask; /* signals to be blocked during handler */
00772 int sa_flags; /* special flags */
00773 };
00774
00775 /* Fields for sa_flags. */
00776 #define SA_ONSTACK 0x0001 /* deliver signal on alternate stack */
00777 #define SA_RESETHAND 0x0002 /* reset signal handler when signal caught */
00778 #define SA_NODEFER 0x0004 /* don't block signal while catching it */
00779 #define SA_RESTART 0x0008 /* automatic system call restart */
00780 #define SA_SIGINFO 0x0010 /* extended signal handling */
00781 #define SA_NOCLDWAIT 0x0020 /* don't create zombies */
00782 #define SA_NOCLDSTOP 0x0040 /* don't receive SIGCHLD when child stops */
00783
00784 /* POSIX requires these values for use with sigprocmask(2). */
00785 #define SIG_BLOCK 0 /* for blocking signals */
00786 #define SIG_UNBLOCK 1 /* for unblocking signals */
00787 #define SIG_SETMASK 2 /* for setting the signal mask */
00788 #define SIG_INQUIRE 4 /* for internal use only */
00789 #endif /* _POSIX_SOURCE */
00790
00791 /* POSIX and ANSI function prototypes. */
00792 _PROTOTYPE( int raise, (int _sig) );
00793 _PROTOTYPE( __sighandler_t signal, (int _sig, __sighandler_t _func) );
00794
00795 #ifdef _POSIX_SOURCE
00796 _PROTOTYPE( int kill, (pid_t _pid, int _sig) );
00797 _PROTOTYPE( int sigaction,
00798 (int _sig, const struct sigaction *_act, struct sigaction *_oact) );
00799 _PROTOTYPE( int sigaddset, (sigset_t *_set, int _sig) );
00800 _PROTOTYPE( int sigdelset, (sigset_t *_set, int _sig) );
00801 _PROTOTYPE( int sigemptyset, (sigset_t *_set) );
00802 _PROTOTYPE( int sigfillset, (sigset_t *_set) );
00803 _PROTOTYPE( int sigismember, (sigset_t *_set, int _sig) );
00804 _PROTOTYPE( int sigpending, (sigset_t *_set) );
00805 _PROTOTYPE( int sigprocmask,
00806 (int _how, const sigset_t *_set, sigset_t *_oset) );
00807 _PROTOTYPE( int sigsuspend, (const sigset_t *_sigmask) );
00808 #endif
00809
00810 #endif /* _SIGNAL_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -