sigcompat.c (17141) | sigcompat.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 --- 15 unchanged lines hidden (view full) --- 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 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. | 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 --- 15 unchanged lines hidden (view full) --- 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 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 * $FreeBSD: head/lib/libc/compat-43/sigcompat.c 51794 1999-09-29 15:18:46Z marcel $ |
|
32 */ 33 34#if defined(LIBC_SCCS) && !defined(lint) 35static char sccsid[] = "@(#)sigcompat.c 8.1 (Berkeley) 6/2/93"; 36#endif /* LIBC_SCCS and not lint */ 37 38#include <sys/param.h> 39#include <signal.h> 40 41int 42sigvec(signo, sv, osv) 43 int signo; 44 struct sigvec *sv, *osv; 45{ 46 int ret; 47 48 if (sv) 49 sv->sv_flags ^= SV_INTERRUPT; /* !SA_INTERRUPT */ | 34 */ 35 36#if defined(LIBC_SCCS) && !defined(lint) 37static char sccsid[] = "@(#)sigcompat.c 8.1 (Berkeley) 6/2/93"; 38#endif /* LIBC_SCCS and not lint */ 39 40#include <sys/param.h> 41#include <signal.h> 42 43int 44sigvec(signo, sv, osv) 45 int signo; 46 struct sigvec *sv, *osv; 47{ 48 int ret; 49 50 if (sv) 51 sv->sv_flags ^= SV_INTERRUPT; /* !SA_INTERRUPT */ |
50 ret = sigaction(signo, (struct sigaction *)sv, (struct sigaction *)osv); | 52 ret = osigaction(signo, (struct osigaction *)sv, 53 (struct osigaction *)osv); |
51 if (ret == 0 && osv) 52 osv->sv_flags ^= SV_INTERRUPT; /* !SA_INTERRUPT */ 53 return (ret); 54} 55 56int 57sigsetmask(mask) 58 int mask; 59{ | 54 if (ret == 0 && osv) 55 osv->sv_flags ^= SV_INTERRUPT; /* !SA_INTERRUPT */ 56 return (ret); 57} 58 59int 60sigsetmask(mask) 61 int mask; 62{ |
60 int omask, n; | 63 sigset_t set, oset; |
61 | 64 |
62 n = sigprocmask(SIG_SETMASK, (sigset_t *) &mask, (sigset_t *) &omask); 63 if (n) 64 return (n); 65 return (omask); | 65 sigemptyset(&set); 66 set.__bits[0] = mask; 67 (void)sigprocmask(SIG_SETMASK, &set, &oset); 68 return (oset.__bits[0]); |
66} 67 68int 69sigblock(mask) 70 int mask; 71{ | 69} 70 71int 72sigblock(mask) 73 int mask; 74{ |
72 int omask, n; | 75 sigset_t set, oset; |
73 | 76 |
74 n = sigprocmask(SIG_BLOCK, (sigset_t *) &mask, (sigset_t *) &omask); 75 if (n) 76 return (n); 77 return (omask); | 77 sigemptyset(&set); 78 set.__bits[0] = mask; 79 80 (void)sigprocmask(SIG_BLOCK, &set, &oset); 81 return (oset.__bits[0]); |
78} 79 80int 81sigpause(mask) 82 int mask; 83{ | 82} 83 84int 85sigpause(mask) 86 int mask; 87{ |
84 return (sigsuspend((sigset_t *)&mask)); | 88 sigset_t set; 89 90 sigemptyset(&set); 91 set.__bits[0] = mask; 92 return (sigsuspend(&set)); |
85} | 93} |