1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* Copyright (c) 1988 AT&T */ 23*7c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 24*7c478bd9Sstevel@tonic-gate 25*7c478bd9Sstevel@tonic-gate 26*7c478bd9Sstevel@tonic-gate /* 27*7c478bd9Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 28*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 29*7c478bd9Sstevel@tonic-gate */ 30*7c478bd9Sstevel@tonic-gate 31*7c478bd9Sstevel@tonic-gate #ifndef _SIGNAL_H 32*7c478bd9Sstevel@tonic-gate #define _SIGNAL_H 33*7c478bd9Sstevel@tonic-gate 34*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5.3.4 */ 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h> 37*7c478bd9Sstevel@tonic-gate 38*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || !defined(_STRICT_STDC) || \ 39*7c478bd9Sstevel@tonic-gate defined(__XOPEN_OR_POSIX) 40*7c478bd9Sstevel@tonic-gate #include <sys/types.h> /* need pid_t/uid_t/size_t/clock_t/caddr_t/pthread_t */ 41*7c478bd9Sstevel@tonic-gate #endif 42*7c478bd9Sstevel@tonic-gate 43*7c478bd9Sstevel@tonic-gate #include <iso/signal_iso.h> 44*7c478bd9Sstevel@tonic-gate #include <sys/signal.h> 45*7c478bd9Sstevel@tonic-gate 46*7c478bd9Sstevel@tonic-gate /* 47*7c478bd9Sstevel@tonic-gate * Allow global visibility for symbols defined in 48*7c478bd9Sstevel@tonic-gate * C++ "std" namespace in <iso/signal_iso.h>. 49*7c478bd9Sstevel@tonic-gate */ 50*7c478bd9Sstevel@tonic-gate #if __cplusplus >= 199711L 51*7c478bd9Sstevel@tonic-gate using std::sig_atomic_t; 52*7c478bd9Sstevel@tonic-gate using std::signal; 53*7c478bd9Sstevel@tonic-gate using std::raise; 54*7c478bd9Sstevel@tonic-gate #endif 55*7c478bd9Sstevel@tonic-gate 56*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 57*7c478bd9Sstevel@tonic-gate extern "C" { 58*7c478bd9Sstevel@tonic-gate #endif 59*7c478bd9Sstevel@tonic-gate 60*7c478bd9Sstevel@tonic-gate 61*7c478bd9Sstevel@tonic-gate #if defined(__STDC__) 62*7c478bd9Sstevel@tonic-gate 63*7c478bd9Sstevel@tonic-gate extern const char **_sys_siglistp; /* signal descriptions */ 64*7c478bd9Sstevel@tonic-gate extern const int _sys_siglistn; /* # of signal descriptions */ 65*7c478bd9Sstevel@tonic-gate 66*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) 67*7c478bd9Sstevel@tonic-gate #define _sys_siglist _sys_siglistp 68*7c478bd9Sstevel@tonic-gate #define _sys_nsig _sys_siglistn 69*7c478bd9Sstevel@tonic-gate #endif 70*7c478bd9Sstevel@tonic-gate 71*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || !defined(_STRICT_STDC) || \ 72*7c478bd9Sstevel@tonic-gate defined(__XOPEN_OR_POSIX) 73*7c478bd9Sstevel@tonic-gate extern int kill(pid_t, int); 74*7c478bd9Sstevel@tonic-gate extern int sigaction(int, const struct sigaction *_RESTRICT_KYWD, 75*7c478bd9Sstevel@tonic-gate struct sigaction *_RESTRICT_KYWD); 76*7c478bd9Sstevel@tonic-gate #ifndef _KERNEL 77*7c478bd9Sstevel@tonic-gate extern int sigaddset(sigset_t *, int); 78*7c478bd9Sstevel@tonic-gate extern int sigdelset(sigset_t *, int); 79*7c478bd9Sstevel@tonic-gate extern int sigemptyset(sigset_t *); 80*7c478bd9Sstevel@tonic-gate extern int sigfillset(sigset_t *); 81*7c478bd9Sstevel@tonic-gate extern int sigismember(const sigset_t *, int); 82*7c478bd9Sstevel@tonic-gate #endif 83*7c478bd9Sstevel@tonic-gate extern int sigpending(sigset_t *); 84*7c478bd9Sstevel@tonic-gate extern int sigprocmask(int, const sigset_t *_RESTRICT_KYWD, 85*7c478bd9Sstevel@tonic-gate sigset_t *_RESTRICT_KYWD); 86*7c478bd9Sstevel@tonic-gate extern int sigsuspend(const sigset_t *); 87*7c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC)... */ 88*7c478bd9Sstevel@tonic-gate 89*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) && \ 90*7c478bd9Sstevel@tonic-gate !defined(__XOPEN_OR_POSIX)) 91*7c478bd9Sstevel@tonic-gate #include <sys/procset.h> 92*7c478bd9Sstevel@tonic-gate extern int gsignal(int); 93*7c478bd9Sstevel@tonic-gate extern int (*ssignal(int, int (*)(int)))(int); 94*7c478bd9Sstevel@tonic-gate extern int sigsend(idtype_t, id_t, int); 95*7c478bd9Sstevel@tonic-gate extern int sigsendset(const procset_t *, int); 96*7c478bd9Sstevel@tonic-gate extern int sig2str(int, char *); 97*7c478bd9Sstevel@tonic-gate extern int str2sig(const char *, int *); 98*7c478bd9Sstevel@tonic-gate #define SIG2STR_MAX 32 99*7c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || (!defined(_STRICT_STDC)... */ 100*7c478bd9Sstevel@tonic-gate 101*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) && \ 102*7c478bd9Sstevel@tonic-gate !defined(__XOPEN_OR_POSIX)) || defined(_XPG4_2) 103*7c478bd9Sstevel@tonic-gate extern void (*bsd_signal(int, void (*)(int)))(int); 104*7c478bd9Sstevel@tonic-gate extern int killpg(pid_t, int); 105*7c478bd9Sstevel@tonic-gate extern int siginterrupt(int, int); 106*7c478bd9Sstevel@tonic-gate extern int sigaltstack(const stack_t *_RESTRICT_KYWD, stack_t *_RESTRICT_KYWD); 107*7c478bd9Sstevel@tonic-gate extern int sighold(int); 108*7c478bd9Sstevel@tonic-gate extern int sigignore(int); 109*7c478bd9Sstevel@tonic-gate extern int sigpause(int); 110*7c478bd9Sstevel@tonic-gate extern int sigrelse(int); 111*7c478bd9Sstevel@tonic-gate extern void (*sigset(int, void (*)(int)))(int); 112*7c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) && ... */ 113*7c478bd9Sstevel@tonic-gate 114*7c478bd9Sstevel@tonic-gate /* Marked as LEGACY in SUSv2 and removed in SUSv3 */ 115*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || \ 116*7c478bd9Sstevel@tonic-gate (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \ 117*7c478bd9Sstevel@tonic-gate (defined(_XPG4_2) && !defined(_XPG6)) 118*7c478bd9Sstevel@tonic-gate extern int sigstack(struct sigstack *, struct sigstack *); 119*7c478bd9Sstevel@tonic-gate #endif 120*7c478bd9Sstevel@tonic-gate 121*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) && \ 122*7c478bd9Sstevel@tonic-gate !defined(__XOPEN_OR_POSIX)) || (_POSIX_C_SOURCE > 2) 123*7c478bd9Sstevel@tonic-gate #include <sys/siginfo.h> 124*7c478bd9Sstevel@tonic-gate #include <time.h> 125*7c478bd9Sstevel@tonic-gate extern int pthread_kill(pthread_t, int); 126*7c478bd9Sstevel@tonic-gate extern int pthread_sigmask(int, const sigset_t *_RESTRICT_KYWD, 127*7c478bd9Sstevel@tonic-gate sigset_t *_RESTRICT_KYWD); 128*7c478bd9Sstevel@tonic-gate extern int sigwaitinfo(const sigset_t *_RESTRICT_KYWD, 129*7c478bd9Sstevel@tonic-gate siginfo_t *_RESTRICT_KYWD); 130*7c478bd9Sstevel@tonic-gate extern int sigtimedwait(const sigset_t *_RESTRICT_KYWD, 131*7c478bd9Sstevel@tonic-gate siginfo_t *_RESTRICT_KYWD, const struct timespec *_RESTRICT_KYWD); 132*7c478bd9Sstevel@tonic-gate extern int sigqueue(pid_t, int, const union sigval); 133*7c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) && */ 134*7c478bd9Sstevel@tonic-gate 135*7c478bd9Sstevel@tonic-gate #else /* __STDC__ */ 136*7c478bd9Sstevel@tonic-gate 137*7c478bd9Sstevel@tonic-gate extern char **_sys_siglistp; /* signal descriptions */ 138*7c478bd9Sstevel@tonic-gate extern int _sys_siglistn; /* # of signal descriptions */ 139*7c478bd9Sstevel@tonic-gate 140*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) 141*7c478bd9Sstevel@tonic-gate #define _sys_siglist _sys_siglistp 142*7c478bd9Sstevel@tonic-gate #define _sys_nsig _sys_siglistn 143*7c478bd9Sstevel@tonic-gate #endif 144*7c478bd9Sstevel@tonic-gate 145*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || defined(__XOPEN_OR_POSIX) 146*7c478bd9Sstevel@tonic-gate extern int kill(); 147*7c478bd9Sstevel@tonic-gate extern int sigaction(); 148*7c478bd9Sstevel@tonic-gate #ifndef _KERNEL 149*7c478bd9Sstevel@tonic-gate extern int sigaddset(); 150*7c478bd9Sstevel@tonic-gate extern int sigdelset(); 151*7c478bd9Sstevel@tonic-gate extern int sigemptyset(); 152*7c478bd9Sstevel@tonic-gate extern int sigfillset(); 153*7c478bd9Sstevel@tonic-gate extern int sigismember(); 154*7c478bd9Sstevel@tonic-gate #endif 155*7c478bd9Sstevel@tonic-gate extern int sigpending(); 156*7c478bd9Sstevel@tonic-gate extern int sigprocmask(); 157*7c478bd9Sstevel@tonic-gate extern int sigsuspend(); 158*7c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__)... */ 159*7c478bd9Sstevel@tonic-gate 160*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \ 161*7c478bd9Sstevel@tonic-gate defined(_XPG4_2) 162*7c478bd9Sstevel@tonic-gate extern void (*bsd_signal())(); 163*7c478bd9Sstevel@tonic-gate extern int killpg(); 164*7c478bd9Sstevel@tonic-gate extern int siginterrupt(); 165*7c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) ... */ 166*7c478bd9Sstevel@tonic-gate 167*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \ 168*7c478bd9Sstevel@tonic-gate (defined(_XPG4_2) && !defined(_XPG6)) 169*7c478bd9Sstevel@tonic-gate extern int sigstack(); 170*7c478bd9Sstevel@tonic-gate #endif 171*7c478bd9Sstevel@tonic-gate 172*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) 173*7c478bd9Sstevel@tonic-gate extern int gsignal(); 174*7c478bd9Sstevel@tonic-gate extern int (*ssignal)(); 175*7c478bd9Sstevel@tonic-gate extern int sigsend(); 176*7c478bd9Sstevel@tonic-gate extern int sigsendset(); 177*7c478bd9Sstevel@tonic-gate extern int sig2str(); 178*7c478bd9Sstevel@tonic-gate extern int str2sig(); 179*7c478bd9Sstevel@tonic-gate #define SIG2STR_MAX 32 180*7c478bd9Sstevel@tonic-gate #endif 181*7c478bd9Sstevel@tonic-gate 182*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \ 183*7c478bd9Sstevel@tonic-gate defined(_XPG4_2) 184*7c478bd9Sstevel@tonic-gate extern int sigaltstack(); 185*7c478bd9Sstevel@tonic-gate extern int sighold(); 186*7c478bd9Sstevel@tonic-gate extern int sigignore(); 187*7c478bd9Sstevel@tonic-gate extern int sigpause(); 188*7c478bd9Sstevel@tonic-gate extern int sigrelse(); 189*7c478bd9Sstevel@tonic-gate extern void (*sigset())(); 190*7c478bd9Sstevel@tonic-gate #endif 191*7c478bd9Sstevel@tonic-gate 192*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \ 193*7c478bd9Sstevel@tonic-gate (_POSIX_C_SOURCE > 2) 194*7c478bd9Sstevel@tonic-gate #include <sys/siginfo.h> 195*7c478bd9Sstevel@tonic-gate #include <sys/time.h> 196*7c478bd9Sstevel@tonic-gate extern int pthread_kill(); 197*7c478bd9Sstevel@tonic-gate extern int pthread_sigmask(); 198*7c478bd9Sstevel@tonic-gate extern int sigwaitinfo(); 199*7c478bd9Sstevel@tonic-gate extern int sigtimedwait(); 200*7c478bd9Sstevel@tonic-gate extern int sigqueue(); 201*7c478bd9Sstevel@tonic-gate #endif 202*7c478bd9Sstevel@tonic-gate 203*7c478bd9Sstevel@tonic-gate #endif /* __STDC__ */ 204*7c478bd9Sstevel@tonic-gate 205*7c478bd9Sstevel@tonic-gate /* 206*7c478bd9Sstevel@tonic-gate * sigwait() prototype is defined here. 207*7c478bd9Sstevel@tonic-gate */ 208*7c478bd9Sstevel@tonic-gate 209*7c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) && \ 210*7c478bd9Sstevel@tonic-gate !defined(__XOPEN_OR_POSIX)) || (_POSIX_C_SOURCE - 0 >= 199506L) || \ 211*7c478bd9Sstevel@tonic-gate defined(_POSIX_PTHREAD_SEMANTICS) 212*7c478bd9Sstevel@tonic-gate 213*7c478bd9Sstevel@tonic-gate #if defined(__STDC__) 214*7c478bd9Sstevel@tonic-gate 215*7c478bd9Sstevel@tonic-gate #if (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS) 216*7c478bd9Sstevel@tonic-gate 217*7c478bd9Sstevel@tonic-gate #ifdef __PRAGMA_REDEFINE_EXTNAME 218*7c478bd9Sstevel@tonic-gate #pragma redefine_extname sigwait __posix_sigwait 219*7c478bd9Sstevel@tonic-gate extern int sigwait(const sigset_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD); 220*7c478bd9Sstevel@tonic-gate #else /* __PRAGMA_REDEFINE_EXTNAME */ 221*7c478bd9Sstevel@tonic-gate 222*7c478bd9Sstevel@tonic-gate extern int __posix_sigwait(const sigset_t *_RESTRICT_KYWD, 223*7c478bd9Sstevel@tonic-gate int *_RESTRICT_KYWD); 224*7c478bd9Sstevel@tonic-gate 225*7c478bd9Sstevel@tonic-gate #ifdef __lint 226*7c478bd9Sstevel@tonic-gate #define sigwait __posix_sigwait 227*7c478bd9Sstevel@tonic-gate #else /* !__lint */ 228*7c478bd9Sstevel@tonic-gate 229*7c478bd9Sstevel@tonic-gate static int 230*7c478bd9Sstevel@tonic-gate sigwait(const sigset_t *_RESTRICT_KYWD __setp, int *_RESTRICT_KYWD __signo) 231*7c478bd9Sstevel@tonic-gate { 232*7c478bd9Sstevel@tonic-gate return (__posix_sigwait(__setp, __signo)); 233*7c478bd9Sstevel@tonic-gate } 234*7c478bd9Sstevel@tonic-gate 235*7c478bd9Sstevel@tonic-gate #endif /* !__lint */ 236*7c478bd9Sstevel@tonic-gate #endif /* __PRAGMA_REDEFINE_EXTNAME */ 237*7c478bd9Sstevel@tonic-gate 238*7c478bd9Sstevel@tonic-gate #else /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */ 239*7c478bd9Sstevel@tonic-gate 240*7c478bd9Sstevel@tonic-gate extern int sigwait(sigset_t *); 241*7c478bd9Sstevel@tonic-gate 242*7c478bd9Sstevel@tonic-gate #endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */ 243*7c478bd9Sstevel@tonic-gate 244*7c478bd9Sstevel@tonic-gate 245*7c478bd9Sstevel@tonic-gate #else /* __STDC__ */ 246*7c478bd9Sstevel@tonic-gate 247*7c478bd9Sstevel@tonic-gate 248*7c478bd9Sstevel@tonic-gate #if (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS) 249*7c478bd9Sstevel@tonic-gate 250*7c478bd9Sstevel@tonic-gate #ifdef __PRAGMA_REDEFINE_EXTNAME 251*7c478bd9Sstevel@tonic-gate #pragma redefine_extname sigwait __posix_sigwait 252*7c478bd9Sstevel@tonic-gate extern int sigwait(); 253*7c478bd9Sstevel@tonic-gate #else /* __PRAGMA_REDEFINE_EXTNAME */ 254*7c478bd9Sstevel@tonic-gate 255*7c478bd9Sstevel@tonic-gate extern int __posix_sigwait(); 256*7c478bd9Sstevel@tonic-gate 257*7c478bd9Sstevel@tonic-gate #ifdef __lint 258*7c478bd9Sstevel@tonic-gate #define sigwait __posix_sigwait 259*7c478bd9Sstevel@tonic-gate #else /* !__lint */ 260*7c478bd9Sstevel@tonic-gate 261*7c478bd9Sstevel@tonic-gate static int 262*7c478bd9Sstevel@tonic-gate sigwait(__setp, __signo) 263*7c478bd9Sstevel@tonic-gate sigset_t *__setp; 264*7c478bd9Sstevel@tonic-gate int *__signo; 265*7c478bd9Sstevel@tonic-gate { 266*7c478bd9Sstevel@tonic-gate return (__posix_sigwait(__setp, __signo)); 267*7c478bd9Sstevel@tonic-gate } 268*7c478bd9Sstevel@tonic-gate 269*7c478bd9Sstevel@tonic-gate #endif /* !__lint */ 270*7c478bd9Sstevel@tonic-gate #endif /* __PRAGMA_REDEFINE_EXTNAME */ 271*7c478bd9Sstevel@tonic-gate 272*7c478bd9Sstevel@tonic-gate #else /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */ 273*7c478bd9Sstevel@tonic-gate 274*7c478bd9Sstevel@tonic-gate extern int sigwait(); 275*7c478bd9Sstevel@tonic-gate 276*7c478bd9Sstevel@tonic-gate #endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */ 277*7c478bd9Sstevel@tonic-gate 278*7c478bd9Sstevel@tonic-gate #endif /* __STDC__ */ 279*7c478bd9Sstevel@tonic-gate 280*7c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) ... */ 281*7c478bd9Sstevel@tonic-gate 282*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 283*7c478bd9Sstevel@tonic-gate } 284*7c478bd9Sstevel@tonic-gate #endif 285*7c478bd9Sstevel@tonic-gate 286*7c478bd9Sstevel@tonic-gate #endif /* _SIGNAL_H */ 287