1 /*
   2  * CDDL HEADER START
   3  *
   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
   7  * with the License.
   8  *
   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.
  13  *
  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]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*      Copyright (c) 1988 AT&T     */
  23 /*        All Rights Reserved   */
  24 
  25 
  26 /*
  27  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  28  * Use is subject to license terms.
  29  */
  30 
  31 #ifndef _SIGNAL_H
  32 #define _SIGNAL_H
  33 
  34 #include <sys/feature_tests.h>
  35 
  36 #if defined(__EXTENSIONS__) || !defined(_STRICT_STDC) || \
  37         defined(__XOPEN_OR_POSIX)
  38 #include <sys/types.h>    /* need pid_t/uid_t/size_t/clock_t/caddr_t/pthread_t */
  39 #endif
  40 
  41 #include <iso/signal_iso.h>
  42 #include <sys/signal.h>
  43 
  44 /*
  45  * Allow global visibility for symbols defined in
  46  * C++ "std" namespace in <iso/signal_iso.h>.
  47  */
  48 #if __cplusplus >= 199711L
  49 using std::sig_atomic_t;
  50 using std::signal;
  51 using std::raise;
  52 #endif
  53 
  54 #ifdef  __cplusplus
  55 extern "C" {
  56 #endif
  57 
  58 
  59 extern const char       **_sys_siglistp;        /* signal descriptions */
  60 extern const int        _sys_siglistn;          /* # of signal descriptions */
  61 
  62 #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX)
  63 #define _sys_siglist    _sys_siglistp
  64 #define _sys_nsig       _sys_siglistn
  65 #endif
  66 
  67 #if defined(__EXTENSIONS__) || !defined(_STRICT_STDC) || \
  68         defined(__XOPEN_OR_POSIX)
  69 extern int kill(pid_t, int);
  70 extern int sigaction(int, const struct sigaction *_RESTRICT_KYWD,
  71         struct sigaction *_RESTRICT_KYWD);
  72 #ifndef _KERNEL
  73 extern int sigaddset(sigset_t *, int);
  74 extern int sigdelset(sigset_t *, int);
  75 extern int sigemptyset(sigset_t *);
  76 extern int sigfillset(sigset_t *);
  77 extern int sigismember(const sigset_t *, int);
  78 #endif
  79 extern int sigpending(sigset_t *);
  80 extern int sigprocmask(int, const sigset_t *_RESTRICT_KYWD,
  81         sigset_t *_RESTRICT_KYWD);
  82 extern int sigsuspend(const sigset_t *);
  83 #endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC)... */
  84 
  85 #if defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) && \
  86         !defined(__XOPEN_OR_POSIX))
  87 #include <sys/procset.h>
  88 extern int gsignal(int);
  89 extern int (*ssignal(int, int (*)(int)))(int);
  90 extern int sigsend(idtype_t, id_t, int);
  91 extern int sigsendset(const procset_t *, int);
  92 extern int sig2str(int, char *);
  93 extern int str2sig(const char *, int *);
  94 #define SIG2STR_MAX     32
  95 #endif /* defined(__EXTENSIONS__) || (!defined(_STRICT_STDC)... */
  96 
  97 /* Added in Issue 4 version 2, obsoleted in Issue 6 and removed in Issue 7 */
  98 #if (!defined(_STRICT_SYMBOLS)) || (defined(_XPG4_2) && !defined(_XPG7))
  99 /* bsd_signal removed from Issue 7 */
 100 extern void (*bsd_signal(int, void (*)(int)))(int);
 101 #endif
 102 
 103 /* Added in Issue 4 version 2 */
 104 #if (!defined(_STRICT_SYMBOLS)) || defined(_XPG4_2)
 105 extern int killpg(pid_t, int);
 106 extern int siginterrupt(int, int);
 107 extern int sigaltstack(const stack_t *_RESTRICT_KYWD, stack_t *_RESTRICT_KYWD);
 108 extern int sighold(int);
 109 extern int sigignore(int);
 110 extern int sigpause(int);
 111 extern int sigrelse(int);
 112 extern void (*sigset(int, void (*)(int)))(int);
 113 #endif
 114 
 115 /* Added in Issue 4 version 2, obsoleted in SUSv2 and removed in SUSv3 */
 116 #if (!defined(_STRICT_SYMBOLS)) || (defined(_XPG4_2) && !defined(_XPG6))
 117 extern int sigstack(struct sigstack *, struct sigstack *);
 118 #endif
 119 
 120 #if defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) && \
 121         !defined(__XOPEN_OR_POSIX)) || (_POSIX_C_SOURCE > 2)
 122 #include <sys/siginfo.h>
 123 #include <time.h>
 124 extern int pthread_kill(pthread_t, int);
 125 extern int pthread_sigmask(int, const sigset_t *_RESTRICT_KYWD,
 126         sigset_t *_RESTRICT_KYWD);
 127 extern int sigwaitinfo(const sigset_t *_RESTRICT_KYWD,
 128         siginfo_t *_RESTRICT_KYWD);
 129 extern int sigtimedwait(const sigset_t *_RESTRICT_KYWD,
 130         siginfo_t *_RESTRICT_KYWD, const struct timespec *_RESTRICT_KYWD);
 131 extern int sigqueue(pid_t, int, const union sigval);
 132 #endif /* defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) && */
 133 
 134 /*
 135  * sigwait() prototype is defined here.
 136  */
 137 
 138 #if     defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) && \
 139         !defined(__XOPEN_OR_POSIX)) || (_POSIX_C_SOURCE - 0 >= 199506L) || \
 140         defined(_POSIX_PTHREAD_SEMANTICS)
 141 
 142 #if     (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
 143 
 144 #ifdef __PRAGMA_REDEFINE_EXTNAME
 145 #pragma redefine_extname sigwait __posix_sigwait
 146 extern int sigwait(const sigset_t *_RESTRICT_KYWD, int *_RESTRICT_KYWD);
 147 #else  /* __PRAGMA_REDEFINE_EXTNAME */
 148 
 149 extern int __posix_sigwait(const sigset_t *_RESTRICT_KYWD,
 150     int *_RESTRICT_KYWD);
 151 
 152 #ifdef  __lint
 153 #define sigwait __posix_sigwait
 154 #else   /* !__lint */
 155 
 156 static int
 157 sigwait(const sigset_t *_RESTRICT_KYWD __setp, int *_RESTRICT_KYWD __signo)
 158 {
 159         return (__posix_sigwait(__setp, __signo));
 160 }
 161 
 162 #endif /* !__lint */
 163 #endif /* __PRAGMA_REDEFINE_EXTNAME */
 164 
 165 #else  /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
 166 
 167 extern int sigwait(sigset_t *);
 168 
 169 #endif  /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
 170 
 171 #endif /* defined(__EXTENSIONS__) || (!defined(_STRICT_STDC) ... */
 172 
 173 #ifdef  __cplusplus
 174 }
 175 #endif
 176 
 177 #endif  /* _SIGNAL_H */