As the man page for the latter states: The effects of signal() in a multithreaded process are unspecified.
We already have an interface to call sigaction() instead, use it. Signed-off-by: Adam Jackson <a...@redhat.com> --- Xext/shm.c | 5 ++--- Xext/xf86bigfont.c | 6 ++---- hw/dmx/input/lnx-keyboard.c | 5 ++--- hw/kdrive/ephyr/ephyr.h | 1 - hw/kdrive/linux/linux.c | 1 - hw/kdrive/src/kdrive.c | 2 -- hw/kdrive/src/kinput.c | 1 - hw/xfree86/common/xf86Init.c | 18 +++++++++--------- hw/xfree86/os-support/bsd/bsd_init.c | 2 +- hw/xfree86/os-support/linux/lnx_init.c | 2 +- hw/xfree86/os-support/shared/VTsw_usl.c | 2 +- hw/xfree86/parser/write.c | 5 ++--- include/globals.h | 2 -- os/utils.c | 4 ++-- 14 files changed, 22 insertions(+), 34 deletions(-) diff --git a/Xext/shm.c b/Xext/shm.c index b359a90..0a44b76 100644 --- a/Xext/shm.c +++ b/Xext/shm.c @@ -153,7 +153,6 @@ static ShmFuncs fbFuncs = { fbShmCreatePixmap, NULL }; } #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__) || defined(__DragonFly__) -#include <sys/signal.h> static Bool badSysCall = FALSE; @@ -170,7 +169,7 @@ CheckForShmSyscall(void) int shmid = -1; /* If no SHM support in the kernel, the bad syscall will generate SIGSYS */ - oldHandler = signal(SIGSYS, SigSysHandler); + oldHandler = OsSignal(SIGSYS, SigSysHandler); badSysCall = FALSE; shmid = shmget(IPC_PRIVATE, 4096, IPC_CREAT); @@ -183,7 +182,7 @@ CheckForShmSyscall(void) /* Allocation failed */ badSysCall = TRUE; } - signal(SIGSYS, oldHandler); + OsSignal(SIGSYS, oldHandler); return !badSysCall; } diff --git a/Xext/xf86bigfont.c b/Xext/xf86bigfont.c index 95b5371..97596ea 100644 --- a/Xext/xf86bigfont.c +++ b/Xext/xf86bigfont.c @@ -96,8 +96,6 @@ static Bool badSysCall = FALSE; #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__) || defined(__DragonFly__) -#include <sys/signal.h> - static void SigSysHandler(int signo) { @@ -111,7 +109,7 @@ CheckForShmSyscall(void) int shmid = -1; /* If no SHM support in the kernel, the bad syscall will generate SIGSYS */ - oldHandler = signal(SIGSYS, SigSysHandler); + oldHandler = OsSignal(SIGSYS, SigSysHandler); badSysCall = FALSE; shmid = shmget(IPC_PRIVATE, 4096, IPC_CREAT); @@ -123,7 +121,7 @@ CheckForShmSyscall(void) /* Allocation failed */ badSysCall = TRUE; } - signal(SIGSYS, oldHandler); + OsSignal(SIGSYS, oldHandler); return !badSysCall; } diff --git a/hw/dmx/input/lnx-keyboard.c b/hw/dmx/input/lnx-keyboard.c index 0aa62f4..2a5ce79 100644 --- a/hw/dmx/input/lnx-keyboard.c +++ b/hw/dmx/input/lnx-keyboard.c @@ -158,7 +158,6 @@ #include <X11/Xos.h> #include <sys/ioctl.h> #include <errno.h> -#include <signal.h> #include <sys/vt.h> #include <sys/kd.h> #include <termios.h> @@ -505,7 +504,7 @@ kbdLinuxVTSignalHandler(int sig) { myPrivate *priv = PRIV; - signal(sig, kbdLinuxVTSignalHandler); + OsSignal(sig, kbdLinuxVTSignalHandler); if (priv) { ioctl(priv->fd, VT_RELDISP, VT_ACKACQ); priv->switched = !priv->switched; @@ -537,7 +536,7 @@ kbdLinuxActivate(int fd, int vtno, int setSig) VT.acqsig = SIGUSR1; if (ioctl(fd, VT_SETMODE, &VT)) FATAL0("kbdLinuxActivate: VT_SETMODE VT_PROCESS failed\n"); - signal(SIGUSR1, kbdLinuxVTSignalHandler); + OsSignal(SIGUSR1, kbdLinuxVTSignalHandler); } return Success; } diff --git a/hw/kdrive/ephyr/ephyr.h b/hw/kdrive/ephyr/ephyr.h index f5015f6..7723bf1 100644 --- a/hw/kdrive/ephyr/ephyr.h +++ b/hw/kdrive/ephyr/ephyr.h @@ -27,7 +27,6 @@ #define _EPHYR_H_ #include <stdio.h> #include <unistd.h> -#include <signal.h> #include <libgen.h> #include <xcb/xcb_image.h> diff --git a/hw/kdrive/linux/linux.c b/hw/kdrive/linux/linux.c index a52bdef..76daaf2 100644 --- a/hw/kdrive/linux/linux.c +++ b/hw/kdrive/linux/linux.c @@ -25,7 +25,6 @@ #endif #include "kdrive.h" #include <errno.h> -#include <signal.h> #include <linux/vt.h> #include <linux/kd.h> #include <sys/stat.h> diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c index 52bea5a..f02d826 100644 --- a/hw/kdrive/src/kdrive.c +++ b/hw/kdrive/src/kdrive.c @@ -43,8 +43,6 @@ #include <execinfo.h> #endif -#include <signal.h> - #if defined(CONFIG_UDEV) || defined(CONFIG_HAL) #include <hotplug.h> #endif diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c index 4119b08..c2fc7bb 100644 --- a/hw/kdrive/src/kinput.c +++ b/hw/kdrive/src/kinput.c @@ -32,7 +32,6 @@ #if HAVE_X11_XF86KEYSYM_H #include <X11/XF86keysym.h> #endif -#include <signal.h> #include <stdio.h> #ifdef __sun #include <sys/file.h> /* needed for FNONBLOCK & FASYNC */ diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c index 323ac11..93c0d74 100644 --- a/hw/xfree86/common/xf86Init.c +++ b/hw/xfree86/common/xf86Init.c @@ -308,16 +308,16 @@ InstallSignalHandlers(void) OsRegisterSigWrapper(xf86SigWrapper); } else { - signal(SIGSEGV, SIG_DFL); - signal(SIGILL, SIG_DFL); + OsSignal(SIGSEGV, SIG_DFL); + OsSignal(SIGILL, SIG_DFL); #ifdef SIGEMT - signal(SIGEMT, SIG_DFL); + OsSignal(SIGEMT, SIG_DFL); #endif - signal(SIGFPE, SIG_DFL); - signal(SIGBUS, SIG_DFL); - signal(SIGSYS, SIG_DFL); - signal(SIGXCPU, SIG_DFL); - signal(SIGXFSZ, SIG_DFL); + OsSignal(SIGFPE, SIG_DFL); + OsSignal(SIGBUS, SIG_DFL); + OsSignal(SIGSYS, SIG_DFL); + OsSignal(SIGXCPU, SIG_DFL); + OsSignal(SIGXFSZ, SIG_DFL); } } @@ -924,7 +924,7 @@ OsVendorInit(void) { static Bool beenHere = FALSE; - signal(SIGCHLD, SIG_DFL); /* Need to wait for child processes */ + OsSignal(SIGCHLD, SIG_DFL); /* Need to wait for child processes */ if (!beenHere) { umask(022); diff --git a/hw/xfree86/os-support/bsd/bsd_init.c b/hw/xfree86/os-support/bsd/bsd_init.c index 38dfde1..0d5d3c8 100644 --- a/hw/xfree86/os-support/bsd/bsd_init.c +++ b/hw/xfree86/os-support/bsd/bsd_init.c @@ -269,7 +269,7 @@ xf86OpenConsole() "xf86OpenConsole: VT_WAITACTIVE failed\n"); } - signal(SIGUSR1, xf86VTRequest); + OsSignal(SIGUSR1, xf86VTRequest); vtmode.mode = VT_PROCESS; vtmode.relsig = SIGUSR1; diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c index 1ed213c..d3a53ea 100644 --- a/hw/xfree86/os-support/linux/lnx_init.c +++ b/hw/xfree86/os-support/linux/lnx_init.c @@ -247,7 +247,7 @@ xf86OpenConsole(void) FatalError("xf86OpenConsole: VT_GETMODE failed %s\n", strerror(errno)); - signal(SIGUSR1, xf86VTRequest); + OsSignal(SIGUSR1, xf86VTRequest); VT.mode = VT_PROCESS; VT.relsig = SIGUSR1; diff --git a/hw/xfree86/os-support/shared/VTsw_usl.c b/hw/xfree86/os-support/shared/VTsw_usl.c index f20106c..6440261 100644 --- a/hw/xfree86/os-support/shared/VTsw_usl.c +++ b/hw/xfree86/os-support/shared/VTsw_usl.c @@ -43,7 +43,7 @@ void xf86VTRequest(int sig) { - signal(sig, (void (*)(int)) xf86VTRequest); + OsSignal(sig, (void (*)(int)) xf86VTRequest); xf86Info.vtRequestsPending = TRUE; return; } diff --git a/hw/xfree86/parser/write.c b/hw/xfree86/parser/write.c index 9a24dd6..122e967 100644 --- a/hw/xfree86/parser/write.c +++ b/hw/xfree86/parser/write.c @@ -63,7 +63,6 @@ #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> -#include <signal.h> #include <errno.h> #if defined(HAVE_SETEUID) && defined(_POSIX_SAVED_IDS) && _POSIX_SAVED_IDS > 0 @@ -141,7 +140,7 @@ xf86writeConfigFile(const char *filename, XF86ConfigPtr cptr) void (*csig) (int); /* Need to fork to change ruid without loosing euid */ - csig = signal(SIGCHLD, SIG_DFL); + csig = OsSignal(SIGCHLD, SIG_DFL); switch ((pid = fork())) { case -1: ErrorF("xf86writeConfigFile(): fork failed (%s)\n", @@ -159,7 +158,7 @@ xf86writeConfigFile(const char *filename, XF86ConfigPtr cptr) p = waitpid(pid, &status, 0); } while (p == -1 && errno == EINTR); } - signal(SIGCHLD, csig); + OsSignal(SIGCHLD, csig); if (p != -1 && WIFEXITED(status) && WEXITSTATUS(status) == 0) return 1; /* success */ else diff --git a/include/globals.h b/include/globals.h index 858c9a3..693bdf4 100644 --- a/include/globals.h +++ b/include/globals.h @@ -2,8 +2,6 @@ #ifndef _XSERV_GLOBAL_H_ #define _XSERV_GLOBAL_H_ -#include <signal.h> - #include "window.h" /* for WindowPtr */ #include "extinit.h" diff --git a/os/utils.c b/os/utils.c index 086fe4f..5871ef8 100644 --- a/os/utils.c +++ b/os/utils.c @@ -1395,7 +1395,7 @@ System(const char *command) if (!command) return 1; - csig = signal(SIGCHLD, SIG_DFL); + csig = OsSignal(SIGCHLD, SIG_DFL); if (csig == SIG_ERR) { perror("signal"); return -1; @@ -1420,7 +1420,7 @@ System(const char *command) } - if (signal(SIGCHLD, csig) == SIG_ERR) { + if (OsSignal(SIGCHLD, csig) == SIG_ERR) { perror("signal"); return -1; } -- 2.7.4 _______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: https://lists.x.org/mailman/listinfo/xorg-devel