Makefile.inc1: don't build aicasm
[dragonfly.git] / contrib / opie / libmissing / sigprocmask.c
blob4af1559cbe71ffbe27df586a38e31149523c0cb8
1 /* sigprocmask.c: A replacement for the sigprocmask() function
3 %%% portions-copyright-cmetz
4 Portions of this software are Copyright 1996 by Craig Metz, All Rights
5 Reserved. The Inner Net License Version 2 applies to these portions of
6 the software.
7 You should have received a copy of the license with this software. If
8 you didn't get a copy, you may request one from <license@inner.net>.
10 Portions of this software are Copyright 1995 by Randall Atkinson and Dan
11 McDonald, All Rights Reserved. All Rights under this copyright are assigned
12 to the U.S. Naval Research Laboratory (NRL). The NRL Copyright Notice and
13 License Agreement applies to this software.
15 History:
17 Created by cmetz for OPIE 2.2 from popen.c. Use FUNCTION
18 declaration et al. Include opie.h.
21 #include "opie_cfg.h"
23 #include <sys/types.h>
24 #if HAVE_SIGNAL_H
25 #include <signal.h>
26 #endif /* HAVE_SIGNAL_H */
27 #if HAVE_SYS_SIGNAL_H
28 #include <sys/signal.h>
29 #endif /* HAVE_SYS_SIGNAL_H */
31 #if !HAVE_SIGBLOCK || !HAVE_SIGSETMASK
32 Without sigblock and sigsetmask, we can't build a replacement sigprocmask.
33 #endif /* !HAVE_SIGBLOCK || !HAVE_SIGSETMASK */
35 #include "opie.h"
37 #ifndef sigset_t
38 #define sigset_t int
39 #endif /* sigset_t */
41 int sigprocmask FUNCTION((how, set, oset), int how AND sigset_t *set AND sigset_t *oset)
43 int old, new;
45 if (set && (set != (sigset_t *)SIG_IGN) && (set != (sigset_t *)SIG_ERR))
46 new = *set;
47 else
48 new = 0;
50 switch(how) {
51 case SIG_BLOCK:
52 old = sigblock(new);
53 if (oset && (oset != (sigset_t *)SIG_IGN) && (oset != (sigset_t *)SIG_ERR))
54 *oset = old;
55 return 0;
57 case SIG_SETMASK:
58 old = sigsetmask(new);
59 if (oset && (oset != (sigset_t *)SIG_IGN) && (oset != (sigset_t *)SIG_ERR))
60 *oset = old;
61 return 0;
63 case SIG_UNBLOCK:
64 /* not implemented */
65 default:
66 return 0;