1 /* $OpenBSD: signal.h,v 1.20 2012/12/05 23:19:57 deraadt Exp $ */
2 /* $NetBSD: signal.h,v 1.8 1996/02/29 00:04:57 jtc Exp $ */
5 * Copyright (c) 1991, 1993
6 * The Regents of the University of California. All rights reserved.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the name of the University nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * @(#)signal.h 8.3 (Berkeley) 3/30/94
35 #ifndef _USER_SIGNAL_H
36 #define _USER_SIGNAL_H
38 #include <sys/signal.h>
40 #if __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE
41 #include <sys/types.h>
46 extern __const
char *__const sys_signame
[_NSIG
];
47 extern __const
char *__const sys_siglist
[_NSIG
];
51 #if __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE
52 #if __BSD_VISIBLE || (__XPG_VISIBLE >= 500 && __XPG_VISIBLE < 700)
53 void (*bsd_signal(int, void (*)(int)))(int);
56 int sigaction(int, const struct sigaction
*__restrict
,
57 struct sigaction
*__restrict
);
58 int sigaddset(sigset_t
*, int);
59 int sigdelset(sigset_t
*, int);
60 int sigemptyset(sigset_t
*);
61 int sigfillset(sigset_t
*);
62 int sigismember(const sigset_t
*, int);
63 int sigpending(sigset_t
*);
64 int sigprocmask(int, const sigset_t
*__restrict
, sigset_t
*__restrict
);
65 #if __POSIX_VISIBLE >= 199506
66 int pthread_sigmask(int, const sigset_t
*__restrict
, sigset_t
*__restrict
);
68 int sigsuspend(const sigset_t
*);
70 #if !defined(_ANSI_LIBRARY) && !defined(lint)
72 extern int *__errno(void);
74 __only_inline
int sigaddset(sigset_t
*__set
, int __signo
) {
75 if (__signo
<= 0 || __signo
>= _NSIG
) {
76 *__errno() = 22; /* EINVAL */
79 *__set
|= (1U << ((__signo
)-1)); /* sigmask(__signo) */
83 __only_inline
int sigdelset(sigset_t
*__set
, int __signo
) {
84 if (__signo
<= 0 || __signo
>= _NSIG
) {
85 *__errno() = 22; /* EINVAL */
88 *__set
&= ~(1U << ((__signo
)-1)); /* sigmask(__signo) */
92 __only_inline
int sigismember(const sigset_t
*__set
, int __signo
) {
93 if (__signo
<= 0 || __signo
>= _NSIG
) {
94 *__errno() = 22; /* EINVAL */
97 return ((*__set
& (1U << ((__signo
)-1))) != 0);
99 #endif /* !_ANSI_LIBRARY && !lint */
101 /* List definitions after function declarations, or Reiser cpp gets upset. */
102 #define sigemptyset(set) (*(set) = 0, 0)
103 #define sigfillset(set) (*(set) = ~(sigset_t)0, 0)
105 #if __BSD_VISIBLE || __XPG_VISIBLE >= 420
106 int killpg(pid_t
, int);
107 int siginterrupt(int, int);
109 int sigaltstack(const struct sigaltstack
*__restrict
,
110 struct sigaltstack
*__restrict
);
113 int sigreturn(struct sigcontext
*);
115 int sigvec(int, struct sigvec
*, struct sigvec
*);
117 #endif /* __BSD_VISIBLE || __XPG_VISIBLE >= 420 */
118 #if __BSD_VISIBLE || __POSIX_VISIBLE >= 199309 || __XPG_VISIBLE >= 500
119 int sigwait(const sigset_t
*__restrict
, int *__restrict
);
121 #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809
122 void psignal(unsigned int, const char *);
124 #endif /* __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE */
127 #endif /* !_USER_SIGNAL_H */