sigsetops.c (31340) | sigsetops.c (51794) |
---|---|
1/*- 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)sigsetops.c 8.1 (Berkeley) 6/4/93 | 1/*- 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)sigsetops.c 8.1 (Berkeley) 6/4/93 |
34 * 35 * $FreeBSD: head/lib/libc/gen/sigsetops.c 51794 1999-09-29 15:18:46Z marcel $ |
|
34 */ 35 36#if defined(LIBC_SCCS) && !defined(lint) 37static char sccsid[] = "@(#)sigsetops.c 8.1 (Berkeley) 6/4/93"; 38#endif /* LIBC_SCCS and not lint */ 39 40#include <signal.h> 41 42#undef sigemptyset 43#undef sigfillset 44#undef sigaddset 45#undef sigdelset 46#undef sigismember 47 48int 49sigemptyset(set) 50 sigset_t *set; 51{ | 36 */ 37 38#if defined(LIBC_SCCS) && !defined(lint) 39static char sccsid[] = "@(#)sigsetops.c 8.1 (Berkeley) 6/4/93"; 40#endif /* LIBC_SCCS and not lint */ 41 42#include <signal.h> 43 44#undef sigemptyset 45#undef sigfillset 46#undef sigaddset 47#undef sigdelset 48#undef sigismember 49 50int 51sigemptyset(set) 52 sigset_t *set; 53{ |
52 *set = 0; | 54 int i; 55 56 for (i = 0; i < _SIG_WORDS; i++) 57 set->__bits[i] = 0; |
53 return (0); 54} 55 56int 57sigfillset(set) 58 sigset_t *set; 59{ | 58 return (0); 59} 60 61int 62sigfillset(set) 63 sigset_t *set; 64{ |
60 *set = ~(sigset_t)0; | 65 int i; 66 67 for (i = 0; i < _SIG_WORDS; i++) 68 set->__bits[i] = ~(unsigned int)0; |
61 return (0); 62} 63 64int 65sigaddset(set, signo) 66 sigset_t *set; 67 int signo; 68{ | 69 return (0); 70} 71 72int 73sigaddset(set, signo) 74 sigset_t *set; 75 int signo; 76{ |
69 *set |= sigmask(signo); | 77 78 if (signo <= 0 || signo > _SIG_MAXSIG) { 79 /* errno = EINVAL; */ 80 return (-1); 81 } 82 set->__bits[_SIG_WORD(signo)] |= _SIG_BIT(signo); |
70 return (0); 71} 72 73int 74sigdelset(set, signo) 75 sigset_t *set; 76 int signo; 77{ | 83 return (0); 84} 85 86int 87sigdelset(set, signo) 88 sigset_t *set; 89 int signo; 90{ |
78 *set &= ~sigmask(signo); | 91 92 if (signo <= 0 || signo > _SIG_MAXSIG) { 93 /* errno = EINVAL; */ 94 return (-1); 95 } 96 set->__bits[_SIG_WORD(signo)] &= ~_SIG_BIT(signo); |
79 return (0); 80} 81 82int 83sigismember(set, signo) 84 const sigset_t *set; 85 int signo; 86{ | 97 return (0); 98} 99 100int 101sigismember(set, signo) 102 const sigset_t *set; 103 int signo; 104{ |
87 return ((*set & sigmask(signo)) != 0); | 105 106 if (signo <= 0 || signo > _SIG_MAXSIG) { 107 /* errno = EINVAL; */ 108 return (-1); 109 } 110 return ((set->__bits[_SIG_WORD(signo)] & _SIG_BIT(signo)) ? 1 : 0); |
88} | 111} |