1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License.  See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1995 - 1999 by Ralf Baechle
7 * Copyright (C) 1999 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_SIGNAL_H
10#define _ASM_SIGNAL_H
11
12#include <linux/types.h>
13
14#define _NSIG		128
15#define _NSIG_BPW	64
16#define _NSIG_WORDS	(_NSIG / _NSIG_BPW)
17
18typedef struct {
19	unsigned long sig[_NSIG_WORDS];
20} sigset_t;
21
22#define _NSIG32		128
23#define _NSIG_BPW32	32
24#define _NSIG_WORDS32	(_NSIG32 / _NSIG_BPW32)
25
26typedef struct {
27	unsigned int sig[_NSIG_WORDS32];
28} sigset_t32;
29
30typedef unsigned long old_sigset_t;		/* at least 32 bits */
31typedef unsigned int old_sigset_t32;
32
33#define SIGHUP		 1	/* Hangup (POSIX).  */
34#define SIGINT		 2	/* Interrupt (ANSI).  */
35#define SIGQUIT		 3	/* Quit (POSIX).  */
36#define SIGILL		 4	/* Illegal instruction (ANSI).  */
37#define SIGTRAP		 5	/* Trace trap (POSIX).  */
38#define SIGIOT		 6	/* IOT trap (4.2 BSD).  */
39#define SIGABRT		 SIGIOT	/* Abort (ANSI).  */
40#define SIGEMT		 7
41#define SIGFPE		 8	/* Floating-point exception (ANSI).  */
42#define SIGKILL		 9	/* Kill, unblockable (POSIX).  */
43#define SIGBUS		10	/* BUS error (4.2 BSD).  */
44#define SIGSEGV		11	/* Segmentation violation (ANSI).  */
45#define SIGSYS		12
46#define SIGPIPE		13	/* Broken pipe (POSIX).  */
47#define SIGALRM		14	/* Alarm clock (POSIX).  */
48#define SIGTERM		15	/* Termination (ANSI).  */
49#define SIGUSR1		16	/* User-defined signal 1 (POSIX).  */
50#define SIGUSR2		17	/* User-defined signal 2 (POSIX).  */
51#define SIGCHLD		18	/* Child status has changed (POSIX).  */
52#define SIGCLD		SIGCHLD	/* Same as SIGCHLD (System V).  */
53#define SIGPWR		19	/* Power failure restart (System V).  */
54#define SIGWINCH	20	/* Window size change (4.3 BSD, Sun).  */
55#define SIGURG		21	/* Urgent condition on socket (4.2 BSD).  */
56#define SIGIO		22	/* I/O now possible (4.2 BSD).  */
57#define SIGPOLL		SIGIO	/* Pollable event occurred (System V).  */
58#define SIGSTOP		23	/* Stop, unblockable (POSIX).  */
59#define SIGTSTP		24	/* Keyboard stop (POSIX).  */
60#define SIGCONT		25	/* Continue (POSIX).  */
61#define SIGTTIN		26	/* Background read from tty (POSIX).  */
62#define SIGTTOU		27	/* Background write to tty (POSIX).  */
63#define SIGVTALRM	28	/* Virtual alarm clock (4.2 BSD).  */
64#define SIGPROF		29	/* Profiling alarm clock (4.2 BSD).  */
65#define SIGXCPU		30	/* CPU limit exceeded (4.2 BSD).  */
66#define SIGXFSZ		31	/* File size limit exceeded (4.2 BSD).  */
67
68/* These should not be considered constants from userland.  */
69#define SIGRTMIN	32
70#define SIGRTMAX	(_NSIG-1)
71
72/*
73 * SA_FLAGS values:
74 *
75 * SA_ONSTACK indicates that a registered stack_t will be used.
76 * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
77 * SA_RESTART flag to get restarting signals (which were the default long ago)
78 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
79 * SA_RESETHAND clears the handler when the signal is delivered.
80 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
81 * SA_NODEFER prevents the current signal from being masked in the handler.
82 *
83 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
84 * Unix names RESETHAND and NODEFER respectively.
85 */
86#define SA_ONSTACK	0x08000000
87#define SA_RESETHAND	0x80000000
88#define SA_RESTART	0x10000000
89#define SA_SIGINFO	0x00000008
90#define SA_NODEFER	0x40000000
91#define SA_NOCLDWAIT	0x00010000	/* Not supported yet */
92#define SA_NOCLDSTOP	0x00000001
93
94#define SA_NOMASK	SA_NODEFER
95#define SA_ONESHOT	SA_RESETHAND
96#define SA_INTERRUPT	0x20000000	/* dummy -- ignored */
97
98#define SA_RESTORER	0x04000000	/* Only for o32 compat code */
99
100/*
101 * sigaltstack controls
102 */
103#define SS_ONSTACK     1
104#define SS_DISABLE     2
105
106#define MINSIGSTKSZ    2048
107#define SIGSTKSZ       8192
108
109#ifdef __KERNEL__
110
111/*
112 * These values of sa_flags are used only by the kernel as part of the
113 * irq handling routines.
114 *
115 * SA_INTERRUPT is also used by the irq handling routines.
116 * SA_SHIRQ flag is for shared interrupt support on PCI and EISA.
117 */
118#define SA_PROBE		SA_ONESHOT
119#define SA_SAMPLE_RANDOM	SA_RESTART
120#define SA_SHIRQ		0x02000000
121
122#endif /* __KERNEL__ */
123
124#define SIG_BLOCK	1	/* for blocking signals */
125#define SIG_UNBLOCK	2	/* for unblocking signals */
126#define SIG_SETMASK	3	/* for setting the signal mask */
127#define SIG_SETMASK32	256	/* Goodie from SGI for BSD compatibility:
128				   set only the low 32 bit of the sigset.  */
129
130/* Type of a signal handler.  */
131typedef void (*__sighandler_t)(int);
132
133/* Fake signal functions */
134#define SIG_DFL	((__sighandler_t)0)	/* default signal handling */
135#define SIG_IGN	((__sighandler_t)1)	/* ignore signal */
136#define SIG_ERR	((__sighandler_t)-1)	/* error return from signal */
137
138struct sigaction {
139	unsigned int	sa_flags;
140	__sighandler_t	sa_handler;
141	sigset_t	sa_mask;
142	void		(*sa_restorer)(void);
143	int		sa_resv[1];	/* reserved */
144};
145
146struct k_sigaction {
147	struct sigaction sa;
148};
149
150/* IRIX compatible stack_t  */
151typedef struct sigaltstack {
152	void *ss_sp;
153	size_t ss_size;
154	int ss_flags;
155} stack_t;
156
157#ifdef __KERNEL__
158#include <asm/sigcontext.h>
159
160/*
161 * The following break codes are or were in use for specific purposes in
162 * other MIPS operating systems.  Linux/MIPS doesn't use all of them.  The
163 * unused ones are here as placeholders; we might encounter them in
164 * non-Linux/MIPS object files or make use of them in the future.
165 */
166#define BRK_USERBP	0	/* User bp (used by debuggers) */
167#define BRK_KERNELBP	1	/* Break in the kernel */
168#define BRK_ABORT	2	/* Sometimes used by abort(3) to SIGIOT */
169#define BRK_BD_TAKEN	3	/* For bd slot emulation - not implemented */
170#define BRK_BD_NOTTAKEN	4	/* For bd slot emulation - not implemented */
171#define BRK_SSTEPBP	5	/* User bp (used by debuggers) */
172#define BRK_OVERFLOW	6	/* Overflow check */
173#define BRK_DIVZERO	7	/* Divide by zero check */
174#define BRK_RANGE	8	/* Range error check */
175#define BRK_STACKOVERFLOW 9	/* For Ada stackchecking */
176#define BRK_NORLD	10	/* No rld found - not used by Linux/MIPS */
177#define _BRK_THREADBP	11	/* For threads, user bp (used by debuggers) */
178#define BRK_MULOVF	1023	/* Multiply overflow */
179#endif /* defined (__KERNEL__) || defined (__USE_MISC) */
180
181#endif /* !defined (_ASM_SIGNAL_H) */
182