[BACK]Return to signal.h CVS log [TXT][DIR] Up to [local] / src / include

Annotation of src/include/signal.h, Revision 1.26

1.26    ! bluhm       1: /*     $OpenBSD: signal.h,v 1.25 2016/05/09 23:55:52 guenther 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:
1.9       millert    40: #if __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE
1.1       deraadt    41: #include <sys/types.h>
                     42: #endif
                     43:
1.12      kettenis   44: __BEGIN_DECLS
1.9       millert    45: #if __BSD_VISIBLE
1.22      guenther   46: extern const char *const sys_signame[_NSIG];
                     47: extern const char *const sys_siglist[_NSIG];
1.1       deraadt    48: #endif
                     49:
1.5       millert    50: int    raise(int);
1.9       millert    51: #if __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE
1.19      guenther   52: #if __BSD_VISIBLE || (__XPG_VISIBLE >= 500 && __XPG_VISIBLE < 700)
1.8       millert    53: void   (*bsd_signal(int, void (*)(int)))(int);
1.19      guenther   54: #endif
1.5       millert    55: int    kill(pid_t, int);
1.19      guenther   56: int    sigaction(int, const struct sigaction *__restrict,
                     57:            struct sigaction *__restrict);
1.5       millert    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 *);
1.19      guenther   64: int    sigprocmask(int, const sigset_t *__restrict, sigset_t *__restrict);
1.17      kettenis   65: #if __POSIX_VISIBLE >= 199506
1.19      guenther   66: int    pthread_sigmask(int, const sigset_t *__restrict, sigset_t *__restrict);
1.17      kettenis   67: #endif
1.5       millert    68: int    sigsuspend(const sigset_t *);
1.1       deraadt    69:
1.21      guenther   70: #if !defined(_ANSI_LIBRARY)
1.14      guenther   71:
1.18      espie      72: extern int *__errno(void);
                     73:
1.24      millert    74: __only_inline int sigaddset(sigset_t *__set, int __signo)
                     75: {
1.19      guenther   76:        if (__signo <= 0 || __signo >= _NSIG) {
1.10      millert    77:                *__errno() = 22;                /* EINVAL */
1.1       deraadt    78:                return -1;
                     79:        }
1.19      guenther   80:        *__set |= (1U << ((__signo)-1));        /* sigmask(__signo) */
1.1       deraadt    81:        return (0);
                     82: }
                     83:
1.24      millert    84: __only_inline int sigdelset(sigset_t *__set, int __signo)
                     85: {
1.19      guenther   86:        if (__signo <= 0 || __signo >= _NSIG) {
1.10      millert    87:                *__errno() = 22;                /* EINVAL */
1.1       deraadt    88:                return -1;
                     89:        }
1.19      guenther   90:        *__set &= ~(1U << ((__signo)-1));       /* sigmask(__signo) */
1.1       deraadt    91:        return (0);
                     92: }
                     93:
1.24      millert    94: __only_inline int sigismember(const sigset_t *__set, int __signo)
                     95: {
1.19      guenther   96:        if (__signo <= 0 || __signo >= _NSIG) {
1.10      millert    97:                *__errno() = 22;                /* EINVAL */
1.1       deraadt    98:                return -1;
                     99:        }
1.19      guenther  100:        return ((*__set & (1U << ((__signo)-1))) != 0);
1.1       deraadt   101: }
1.24      millert   102:
                    103: __only_inline int sigemptyset(sigset_t *__set)
                    104: {
                    105:        *__set = 0;
                    106:        return (0);
                    107: }
                    108:
                    109: __only_inline int sigfillset(sigset_t *__set)
                    110: {
                    111:        *__set = ~(sigset_t)0;
                    112:        return (0);
                    113: }
                    114:
1.21      guenther  115: #endif /* !_ANSI_LIBRARY */
1.1       deraadt   116:
1.9       millert   117: #if __BSD_VISIBLE || __XPG_VISIBLE >= 420
1.5       millert   118: int    killpg(pid_t, int);
                    119: int    siginterrupt(int, int);
1.19      guenther  120: int    sigaltstack(const struct sigaltstack *__restrict,
                    121:            struct sigaltstack *__restrict);
1.9       millert   122: #if __BSD_VISIBLE
                    123: int    sigblock(int);
1.26    ! bluhm     124: /* This is the traditional BSD sigpause() and not the XPG/POSIX sigpause(). */
        !           125: int    sigpause(int);
1.9       millert   126: int    sigsetmask(int);
1.5       millert   127: int    sigvec(int, struct sigvec *, struct sigvec *);
1.23      guenther  128: int    thrkill(pid_t _tid, int _signum, void *_tcb);
1.9       millert   129: #endif
1.16      guenther  130: #endif /* __BSD_VISIBLE || __XPG_VISIBLE >= 420 */
1.9       millert   131: #if __BSD_VISIBLE ||  __POSIX_VISIBLE >= 199309 || __XPG_VISIBLE >= 500
1.19      guenther  132: int    sigwait(const sigset_t *__restrict, int *__restrict);
1.9       millert   133: #endif
1.16      guenther  134: #if __BSD_VISIBLE ||  __POSIX_VISIBLE >= 200809
                    135: void   psignal(unsigned int, const char *);
                    136: #endif
1.9       millert   137: #endif /* __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE */
1.1       deraadt   138: __END_DECLS
                    139:
                    140: #endif /* !_USER_SIGNAL_H */