5 /* This module provides wrappers around system functions that could
6 * potentially block, e.g. select(). These wrappers will check that
7 * the "terminate" flag is still clear and then call the system
8 * function in one atomic operation. This ensures that fvwm will not
9 * block in a system function once it has received the signal to quit.
11 * This module was written by Chris Rankin, rankinc@zipworld.com.au
13 /* This module is intended to use POSIX.1 signal semantics, since most
14 * modern systems can reasonably be expected to support POSIX and since
15 * the semantics of the old "signal()" function vary from system to system.
16 * If POSIX.1 is not available then the module can provide BSD signal
17 * semantics, which can be summarised as follows:
18 * - the signal handler will NOT uninstall itself once it has been called
19 * - a signal will be temporarily blocked from further delivery so long
20 * as its handler is running
21 * - certain system calls will be automatically restarted if interrupted
25 #if !defined(HAVE_SIGACTION) \
26 && defined(HAVE_SIGBLOCK) && defined(HAVE_SIGSETMASK)
27 # define USE_BSD_SIGNALS
30 #ifdef USE_BSD_SIGNALS
31 # define BSD_BLOCK_SIGNALS int old_mask = sigblock( fvwmGetSignalMask() )
32 # define BSB_BLOCK_ALL_SIGNALS int old_mask = sigblock( ~0 )
33 # define BSD_UNBLOCK_SIGNALS sigsetmask( old_mask )
35 # define BSD_BLOCK_SIGNALS
36 # define BSD_BLOCK_ALL_SIGNALS
37 # define BSD_UNBLOCK_SIGNALS
43 # include <sys/select.h>
49 extern volatile sig_atomic_t isTerminated
;
55 RETSIGTYPE
fvwmReapChildren(int sig
);
56 extern void fvwmSetTerminate(int sig
);
58 #ifdef USE_BSD_SIGNALS
59 extern void fvwmSetSignalMask(int);
60 extern int fvwmGetSignalMask(void);
64 extern int fvwmSelect(
65 fd_set_size_t nfds
, fd_set
*readfds
, fd_set
*writefds
,
66 fd_set
*exceptfds
, struct timeval
*timeout
);
69 #endif /* FVWMSIGNAL_H */