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