1 /*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
2 /*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
3 /*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
4 /*%% (c) Copyright 1993, 1994 Novell, Inc. */
5 /*%% $XConsortium: issignals.c /main/3 1995/10/23 11:44:41 rswiston $ */
7 static char sccsid[] = "@(#)issignals.c 1.7 89/08/30 Copyr 1988 Sun Micro";
10 * Copyright (c) 1988 by Sun Microsystems, Inc.
17 * Signal masking functions
21 #include "isam_impl.h"
25 * _issignal_mask() is called at the beginning of each ISAM update operation
26 * to mask signals for the duration of the operation. _issignals_unmask()
27 * is called at the end of the operation to restore the original signal
30 * _issignals_cntl() enables/disables this signal masking facility.
31 * (the default is "mask the signals").
33 * The variable already_masked is used to provide more robustness: it
34 * will prevent permanent signal masking due to bugs in the ISAM package.
35 * The permanent masking of signals would happen if _issignals_mask()
36 * were called twice in a row.
40 static int do_mask = 1; /* default value */
41 static int already_masked;
42 static sigset_t oldmask;
43 static sigset_t allsignals;
47 int opt; /* 1 will enable masking */
48 /* 0 will disable masking */
50 int oldmask = do_mask;
52 do_mask = opt ? 1 : 0;
59 if (do_mask && !already_masked) {
60 (void) sigfillset(&allsignals);
61 (void) sigdelset(&allsignals, SIGTRAP);
62 (void) sigdelset(&allsignals, SIGSEGV);
63 (void) sigdelset(&allsignals, SIGILL);
64 (void) sigdelset(&allsignals, SIGBUS);
65 (void) sigprocmask(SIG_SETMASK, &allsignals, &oldmask);
73 (void)sigprocmask(SIG_SETMASK, &oldmask, NULL);