[PATCH 4/4] configure: Check for sigprocmask

Jon Turney jon.turney at dronecode.org.uk
Thu Jul 28 19:20:26 UTC 2016


MinGW defines SIG_BLOCK, but doesn't have signal masks, so rather than
checking for SIG_BLOCK, add a configure check for sigprocmask.

Signed-off-by: Jon Turney <jon.turney at dronecode.org.uk>
---
 configure.ac            | 2 +-
 include/dix-config.h.in | 3 +++
 os/inputthread.c        | 4 ++++
 os/utils.c              | 8 ++++----
 4 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 1614584..b0b3250 100644
--- a/configure.ac
+++ b/configure.ac
@@ -219,7 +219,7 @@ dnl Checks for library functions.
 AC_CHECK_FUNCS([backtrace ffs geteuid getuid issetugid getresuid \
 	getdtablesize getifaddrs getpeereid getpeerucred getprogname getzoneid \
 	mmap posix_fallocate seteuid shmctl64 strncasecmp vasprintf vsnprintf \
-	walkcontext setitimer poll epoll_create1])
+	walkcontext setitimer poll epoll_create1 sigprocmask])
 AC_CONFIG_LIBOBJ_DIR([os])
 AC_REPLACE_FUNCS([reallocarray strcasecmp strcasestr strlcat strlcpy strndup])
 AM_CONDITIONAL(POLL, [test "x$ac_cv_func_poll" = "xyes"])
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index d49af92..3573122 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -533,4 +533,7 @@
 /* Have epoll_create1() */
 #undef HAVE_EPOLL_CREATE1
 
+/* Have sigprocmask */
+#undef HAVE_SIGPROCMASK
+
 #endif /* _DIX_CONFIG_H_ */
diff --git a/os/inputthread.c b/os/inputthread.c
index e815319..dec668a 100644
--- a/os/inputthread.c
+++ b/os/inputthread.c
@@ -503,7 +503,11 @@ extern int InputThreadUnregisterDev(int fd)
 
 int xthread_sigmask(int how, const sigset_t *set, sigset_t *oldset)
 {
+#ifdef HAVE_SIGPROCMASK
     return sigprocmask(how, set, oldset);
+#else
+    return 0;
+#endif
 }
 
 #endif
diff --git a/os/utils.c b/os/utils.c
index ac55cd7..6243310 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -1294,7 +1294,7 @@ SmartScheduleInit(void)
 #endif
 }
 
-#ifdef SIG_BLOCK
+#ifdef HAVE_SIGPROCMASK
 static sigset_t PreviousSignalMask;
 static int BlockedSignalCount;
 #endif
@@ -1302,7 +1302,7 @@ static int BlockedSignalCount;
 void
 OsBlockSignals(void)
 {
-#ifdef SIG_BLOCK
+#ifdef HAVE_SIGPROCMASK
     if (BlockedSignalCount++ == 0) {
         sigset_t set;
 
@@ -1324,7 +1324,7 @@ OsBlockSignals(void)
 void
 OsReleaseSignals(void)
 {
-#ifdef SIG_BLOCK
+#ifdef HAVE_SIGPROCMASK
     if (--BlockedSignalCount == 0) {
         xthread_sigmask(SIG_SETMASK, &PreviousSignalMask, 0);
     }
@@ -1334,7 +1334,7 @@ OsReleaseSignals(void)
 void
 OsResetSignals(void)
 {
-#ifdef SIG_BLOCK
+#ifdef HAVE_SIGPROCMASK
     while (BlockedSignalCount > 0)
         OsReleaseSignals();
     input_force_unlock();
-- 
2.8.3



More information about the xorg-devel mailing list