os: consolidate busfault handling
The symbols HAVE_SIGACTION and BUSFAULT are set under the same conditions, so can be consolidated into one. Also define dummies when HAVE_SIGACTION is not set, so a few #ifdef's less clutterig the code. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1297>
This commit is contained in:
parent
eaa92ea422
commit
eed0697ec9
|
@ -99,7 +99,7 @@ QuartzInitServer(int argc, char **argv, char **envp)
|
|||
sigset_t set;
|
||||
sigemptyset(&set);
|
||||
sigaddset(&set, SIGALRM);
|
||||
#ifdef BUSFAULT
|
||||
#ifdef HAVE_SIGACTION
|
||||
sigaddset(&set, SIGBUS);
|
||||
#endif
|
||||
pthread_sigmask(SIG_BLOCK, &set, NULL);
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include <dix-config.h>
|
||||
|
||||
#ifdef BUSFAULT
|
||||
#ifdef HAVE_SIGACTION
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
|
@ -43,6 +43,11 @@ busfault_check(void);
|
|||
Bool
|
||||
busfault_init(void);
|
||||
|
||||
#else
|
||||
|
||||
static inline void busfault_check(void) {}
|
||||
static inline Bool busfault_init(void) { return FALSE; }
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _BUSFAULT_H_ */
|
||||
|
|
|
@ -179,8 +179,6 @@ conf_data.set('HAVE_VSNPRINTF', cc.has_function('vsnprintf') ? '1' : false)
|
|||
conf_data.set('HAVE_WALKCONTEXT', cc.has_function('walkcontext') ? '1' : false)
|
||||
conf_data.set('HAVE_XUCRED_CR_PID', cc.has_member('struct xucred', 'cr_pid', prefix : '#include <sys/ucred.h>') ? '1' : false)
|
||||
|
||||
conf_data.set('BUSFAULT', conf_data.get('HAVE_SIGACTION'))
|
||||
|
||||
# Don't let X dependencies typedef 'pointer'
|
||||
conf_data.set('_XTYPEDEF_POINTER', '1')
|
||||
conf_data.set('_XITYPEDEF_POINTER', '1')
|
||||
|
|
|
@ -180,9 +180,7 @@ WaitForSomething(Bool are_ready)
|
|||
|
||||
were_ready = FALSE;
|
||||
|
||||
#ifdef BUSFAULT
|
||||
busfault_check();
|
||||
#endif
|
||||
|
||||
/* We need a while loop here to handle
|
||||
crashed connections and the screen saver timeout */
|
||||
|
|
|
@ -46,7 +46,7 @@ if conf_data.get('HAVE_POLL').to_int() == 0
|
|||
srcs_os += 'xserver_poll.c'
|
||||
endif
|
||||
|
||||
if conf_data.get('BUSFAULT').to_int() != 0
|
||||
if conf_data.get('HAVE_SIGACTION').to_int() != 0
|
||||
srcs_os += 'busfault.c'
|
||||
endif
|
||||
|
||||
|
|
|
@ -199,9 +199,7 @@ OsInit(void)
|
|||
}
|
||||
}
|
||||
#endif /* !WIN32 || __CYGWIN__ */
|
||||
#ifdef BUSFAULT
|
||||
busfault_init();
|
||||
#endif
|
||||
server_poll = ospoll_create();
|
||||
if (!server_poll)
|
||||
FatalError("failed to allocate poll structure");
|
||||
|
|
Loading…
Reference in New Issue