4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1988 AT&T */
28 /* All Rights Reserved */
30 #pragma ident "%Z%%M% %I% %E% SMI"
33 * POSIX signal manipulation functions.
35 #pragma weak _sigfillset = sigfillset
36 #pragma weak _sigemptyset = sigemptyset
37 #pragma weak _sigaddset = sigaddset
38 #pragma weak _sigdelset = sigdelset
39 #pragma weak _sigismember = sigismember
42 #include <sys/types.h>
44 #include <sys/param.h>
45 #include <sys/signal.h>
50 #define MAXBITNO (NBPW*8)
55 #define sigword(n) ((n-1)/MAXBITNO)
56 #define bitmask(n) (1L<<((n-1)%MAXBITNO))
61 if (sig
<= 0 || sig
> (MAXBITNO
* SIGSETSIZE
))
65 (void) __sigfillset(&sigs
);
69 return ((sigs
.__sigbits
[sigword(sig
)] & bitmask(sig
)) != 0);
73 sigfillset(sigset_t
*set
)
76 (void) __sigfillset(&sigs
);
85 sigemptyset(sigset_t
*set
)
87 set
->__sigbits
[0] = 0;
88 set
->__sigbits
[1] = 0;
89 set
->__sigbits
[2] = 0;
90 set
->__sigbits
[3] = 0;
95 sigaddset(sigset_t
*set
, int sig
)
101 set
->__sigbits
[sigword(sig
)] |= bitmask(sig
);
106 sigdelset(sigset_t
*set
, int sig
)
108 if (!sigvalid(sig
)) {
112 set
->__sigbits
[sigword(sig
)] &= ~bitmask(sig
);
117 sigismember(const sigset_t
*set
, int sig
)
119 if (!sigvalid(sig
)) {
123 return ((set
->__sigbits
[sigword(sig
)] & bitmask(sig
)) != 0);