4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
22 /* Copyright (c) 1988 AT&T */
23 /* All Rights Reserved */
26 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
28 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
29 * Use is subject to license terms.
35 #include <sys/feature_tests.h>
37 #if defined(__EXTENSIONS__) || !defined(_STRICT_STDC) || \
38 defined(__XOPEN_OR_POSIX)
39 #include <sys/types.h> /* need pid_t/uid_t/size_t/clock_t/caddr_t/pthread_t */
42 #include <iso/signal_iso.h>
43 #include <sys/signal.h>
46 * Allow global visibility for symbols defined in
47 * C++ "std" namespace in <iso/signal_iso.h>.
49 #if __cplusplus >= 199711L
50 using std::sig_atomic_t;
60 extern const char **_sys_siglistp
; /* signal descriptions */
61 extern const int _sys_siglistn
; /* # of signal descriptions */
63 #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX)
64 #define _sys_siglist _sys_siglistp
65 #define _sys_nsig _sys_siglistn
68 #if defined(__EXTENSIONS__) || !defined(_STRICT_STDC) || \
69 defined(__XOPEN_OR_POSIX)
70 extern int kill(pid_t
, int);
71 extern int sigaction(int, const struct sigaction
*_RESTRICT_KYWD
,
72 struct sigaction
*_RESTRICT_KYWD
);
74 extern int sigaddset(sigset_t
*, int);
75 extern int sigdelset(sigset_t
*, int);
76 extern int sigemptyset(sigset_t
*);
77 extern int sigfillset(sigset_t
*);
78 extern int sigismember(const sigset_t
*, int);
80 extern int sigpending(sigset_t
*);
81 extern int sigprocmask(int, const sigset_t
*_RESTRICT_KYWD
,
82 sigset_t
*_RESTRICT_KYWD
);
83 extern int sigsuspend(const sigset_t
*);
84 #endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC)... */
86 #if defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) && \
87 !defined(__XOPEN_OR_POSIX))
88 #include <sys/procset.h>
89 extern int gsignal(int);
90 extern int (*ssignal(int, int (*)(int)))(int);
91 extern int sigsend(idtype_t
, id_t
, int);
92 extern int sigsendset(const procset_t
*, int);
93 extern int sig2str(int, char *);
94 extern int str2sig(const char *, int *);
95 #define SIG2STR_MAX 32
96 #endif /* defined(__EXTENSIONS__) || (!defined(_STRICT_STDC)... */
98 #if defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) && \
99 !defined(__XOPEN_OR_POSIX)) || defined(_XPG4_2)
100 extern void (*bsd_signal(int, void (*)(int)))(int);
101 extern int killpg(pid_t
, int);
102 extern int siginterrupt(int, int);
103 extern int sigaltstack(const stack_t
*_RESTRICT_KYWD
, stack_t
*_RESTRICT_KYWD
);
104 extern int sighold(int);
105 extern int sigignore(int);
106 extern int sigpause(int);
107 extern int sigrelse(int);
108 extern void (*sigset(int, void (*)(int)))(int);
109 #endif /* defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) && ... */
111 /* Marked as LEGACY in SUSv2 and removed in SUSv3 */
112 #if defined(__EXTENSIONS__) || \
113 (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
114 (defined(_XPG4_2) && !defined(_XPG6))
115 extern int sigstack(struct sigstack
*, struct sigstack
*);
118 #if defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) && \
119 !defined(__XOPEN_OR_POSIX)) || (_POSIX_C_SOURCE > 2)
120 #include <sys/siginfo.h>
122 extern int pthread_kill(pthread_t
, int);
123 extern int pthread_sigmask(int, const sigset_t
*_RESTRICT_KYWD
,
124 sigset_t
*_RESTRICT_KYWD
);
125 extern int sigwaitinfo(const sigset_t
*_RESTRICT_KYWD
,
126 siginfo_t
*_RESTRICT_KYWD
);
127 extern int sigtimedwait(const sigset_t
*_RESTRICT_KYWD
,
128 siginfo_t
*_RESTRICT_KYWD
, const struct timespec
*_RESTRICT_KYWD
);
129 extern int sigqueue(pid_t
, int, const union sigval
);
130 #endif /* defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) && */
133 * sigwait() prototype is defined here.
136 #if defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) && \
137 !defined(__XOPEN_OR_POSIX)) || (_POSIX_C_SOURCE - 0 >= 199506L) || \
138 defined(_POSIX_PTHREAD_SEMANTICS)
140 #if (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
142 #ifdef __PRAGMA_REDEFINE_EXTNAME
143 #pragma redefine_extname sigwait __posix_sigwait
144 extern int sigwait(const sigset_t
*_RESTRICT_KYWD
, int *_RESTRICT_KYWD
);
145 #else /* __PRAGMA_REDEFINE_EXTNAME */
147 extern int __posix_sigwait(const sigset_t
*_RESTRICT_KYWD
,
148 int *_RESTRICT_KYWD
);
151 #define sigwait __posix_sigwait
155 sigwait(const sigset_t
*_RESTRICT_KYWD __setp
, int *_RESTRICT_KYWD __signo
)
157 return (__posix_sigwait(__setp
, __signo
));
161 #endif /* __PRAGMA_REDEFINE_EXTNAME */
163 #else /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
165 extern int sigwait(sigset_t
*);
167 #endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
169 #endif /* defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) ... */
175 #endif /* _SIGNAL_H */