xref: /openbsd-src/lib/libcurses/SigAction.h (revision a28daedfc357b214be5c701aa8ba8adb29a7f1c2)
1 /*	$OpenBSD: SigAction.h,v 1.3 2001/01/22 18:01:32 millert Exp $	*/
2 
3 /****************************************************************************
4  * Copyright (c) 1998,2000 Free Software Foundation, Inc.                   *
5  *                                                                          *
6  * Permission is hereby granted, free of charge, to any person obtaining a  *
7  * copy of this software and associated documentation files (the            *
8  * "Software"), to deal in the Software without restriction, including      *
9  * without limitation the rights to use, copy, modify, merge, publish,      *
10  * distribute, distribute with modifications, sublicense, and/or sell       *
11  * copies of the Software, and to permit persons to whom the Software is    *
12  * furnished to do so, subject to the following conditions:                 *
13  *                                                                          *
14  * The above copyright notice and this permission notice shall be included  *
15  * in all copies or substantial portions of the Software.                   *
16  *                                                                          *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
18  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
20  * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
21  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
22  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
23  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
24  *                                                                          *
25  * Except as contained in this notice, the name(s) of the above copyright   *
26  * holders shall not be used in advertising or otherwise to promote the     *
27  * sale, use or other dealings in this Software without prior written       *
28  * authorization.                                                           *
29  ****************************************************************************/
30 
31 /****************************************************************************
32  *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
33  *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
34  ****************************************************************************/
35 
36 /*
37  * $From: SigAction.h,v 1.6 2000/12/10 02:36:10 tom Exp $
38  *
39  * This file exists to handle non-POSIX systems which don't have <unistd.h>,
40  * and usually no sigaction() nor <termios.h>
41  */
42 
43 #ifndef _SIGACTION_H
44 #define _SIGACTION_H
45 
46 #ifndef HAVE_SIGACTION
47 #define HAVE_SIGACTION 0
48 #endif
49 
50 #ifndef HAVE_SIGVEC
51 #define HAVE_SIGVEC 0
52 #endif
53 
54 #if HAVE_SIGACTION
55 
56 #if !HAVE_TYPE_SIGACTION
57 typedef struct sigaction sigaction_t;
58 #endif
59 
60 #else	/* !HAVE_SIGACTION */
61 
62 #if HAVE_SIGVEC
63 
64 #if HAVE_LIBC_H
65 #include <libc.h>
66 #endif
67 
68 #undef  SIG_BLOCK
69 #define SIG_BLOCK       00
70 
71 #undef  SIG_UNBLOCK
72 #define SIG_UNBLOCK     01
73 
74 #undef  SIG_SETMASK
75 #define SIG_SETMASK     02
76 
77  	/*
78 	 * <bsd/signal.h> is in the Linux 1.2.8 + gcc 2.7.0 configuration,
79 	 * and is useful for testing this header file.
80 	 */
81 #if HAVE_BSD_SIGNAL_H
82 #include <bsd/signal.h>
83 #endif
84 
85 typedef struct sigvec sigaction_t;
86 
87 #define sigset_t _nc_sigset_t
88 typedef unsigned long sigset_t;
89 
90 #undef  sa_mask
91 #define sa_mask sv_mask
92 #undef  sa_handler
93 #define sa_handler sv_handler
94 #undef  sa_flags
95 #define sa_flags sv_flags
96 
97 #undef  sigaction
98 #define sigaction   _nc_sigaction
99 #undef  sigprocmask
100 #define sigprocmask _nc_sigprocmask
101 #undef  sigemptyset
102 #define sigemptyset _nc_sigemptyset
103 #undef  sigsuspend
104 #define sigsuspend  _nc_sigsuspend
105 #undef  sigdelset
106 #define sigdelset   _nc_sigdelset
107 #undef  sigaddset
108 #define sigaddset   _nc_sigaddset
109 
110 extern NCURSES_EXPORT(int) sigaction (int sig, sigaction_t * sigact, sigaction_t *  osigact);
111 extern NCURSES_EXPORT(int) sigprocmask (int how, sigset_t *mask, sigset_t *omask);
112 extern NCURSES_EXPORT(int) sigemptyset (sigset_t *mask);
113 extern NCURSES_EXPORT(int) sigsuspend (sigset_t *mask);
114 extern NCURSES_EXPORT(int) sigdelset (sigset_t *mask, int sig);
115 extern NCURSES_EXPORT(int) sigaddset (sigset_t *mask, int sig);
116 
117 #endif /* HAVE_SIGVEC */
118 #endif /* HAVE_SIGACTION */
119 #endif /* !defined(_SIGACTION_H) */
120