Annotation of src/include/signal.h, Revision 1.8
1.8 ! millert 1: /* $OpenBSD: signal.h,v 1.7 2003/06/02 19:34:12 millert Exp $ */
1.2 niklas 2: /* $NetBSD: signal.h,v 1.8 1996/02/29 00:04:57 jtc Exp $ */
1.1 deraadt 3:
4: /*-
5: * Copyright (c) 1991, 1993
6: * The Regents of the University of California. All rights reserved.
7: *
8: * Redistribution and use in source and binary forms, with or without
9: * modification, are permitted provided that the following conditions
10: * are met:
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.
1.7 millert 16: * 3. Neither the name of the University nor the names of its contributors
1.1 deraadt 17: * may be used to endorse or promote products derived from this software
18: * without specific prior written permission.
19: *
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
30: * SUCH DAMAGE.
31: *
32: * @(#)signal.h 8.3 (Berkeley) 3/30/94
33: */
34:
35: #ifndef _USER_SIGNAL_H
36: #define _USER_SIGNAL_H
37:
38: #include <sys/signal.h>
39:
40: #if !defined(_ANSI_SOURCE)
41: #include <sys/types.h>
42: #endif
43:
44: #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
45: extern __const char *__const sys_signame[_NSIG];
46: extern __const char *__const sys_siglist[_NSIG];
47: #endif
48:
49: __BEGIN_DECLS
1.5 millert 50: int raise(int);
1.1 deraadt 51: #ifndef _ANSI_SOURCE
1.8 ! millert 52: void (*bsd_signal(int, void (*)(int)))(int);
1.5 millert 53: int kill(pid_t, int);
54: int sigaction(int, const struct sigaction *, struct sigaction *);
55: int sigaddset(sigset_t *, int);
56: int sigdelset(sigset_t *, int);
57: int sigemptyset(sigset_t *);
58: int sigfillset(sigset_t *);
59: int sigismember(const sigset_t *, int);
60: int sigpending(sigset_t *);
61: int sigprocmask(int, const sigset_t *, sigset_t *);
62: int sigsuspend(const sigset_t *);
1.1 deraadt 63:
1.6 millert 64: #if defined(__GNUC__)
1.1 deraadt 65: extern __inline int sigaddset(sigset_t *set, int signo) {
66: extern int errno;
67:
68: if (signo <= 0 || signo >= _NSIG) {
69: errno = 22; /* EINVAL */
70: return -1;
71: }
72: *set |= (1 << ((signo)-1)); /* sigmask(signo) */
73: return (0);
74: }
75:
76: extern __inline int sigdelset(sigset_t *set, int signo) {
77: extern int errno;
78:
79: if (signo <= 0 || signo >= _NSIG) {
80: errno = 22; /* EINVAL */
81: return -1;
82: }
83: *set &= ~(1 << ((signo)-1)); /* sigmask(signo) */
84: return (0);
85: }
86:
87: extern __inline int sigismember(const sigset_t *set, int signo) {
88: extern int errno;
89:
90: if (signo <= 0 || signo >= _NSIG) {
91: errno = 22; /* EINVAL */
92: return -1;
93: }
94: return ((*set & (1 << ((signo)-1))) != 0);
95: }
96: #endif
97:
98: /* List definitions after function declarations, or Reiser cpp gets upset. */
99: #define sigemptyset(set) (*(set) = 0, 0)
100: #define sigfillset(set) (*(set) = ~(sigset_t)0, 0)
101:
102: #ifndef _POSIX_SOURCE
1.5 millert 103: int killpg(pid_t, int);
104: int sigblock(int);
105: int siginterrupt(int, int);
106: int sigpause(int);
107: int sigreturn(struct sigcontext *);
108: int sigsetmask(int);
109: int sigstack(const struct sigstack *, struct sigstack *);
110: int sigaltstack(const struct sigaltstack *, struct sigaltstack *);
111: int sigvec(int, struct sigvec *, struct sigvec *);
112: void psignal(unsigned int, const char *);
113: int sigwait(const sigset_t *, int *);
1.1 deraadt 114: #endif /* !_POSIX_SOURCE */
115: #endif /* !_ANSI_SOURCE */
116: __END_DECLS
117:
118: #endif /* !_USER_SIGNAL_H */