dix: Use OsSignal() not signal()
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 <ajax@redhat.com> Reviewed-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
8174daa6bd
commit
6178b1c91c
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#define _EPHYR_H_
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <libgen.h>
|
||||
#include <xcb/xcb_image.h>
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -43,8 +43,6 @@
|
|||
#include <execinfo.h>
|
||||
#endif
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
#if defined(CONFIG_UDEV) || defined(CONFIG_HAL)
|
||||
#include <hotplug.h>
|
||||
#endif
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -269,7 +269,7 @@ xf86OpenConsole()
|
|||
"xf86OpenConsole: VT_WAITACTIVE failed\n");
|
||||
}
|
||||
|
||||
signal(SIGUSR1, xf86VTRequest);
|
||||
OsSignal(SIGUSR1, xf86VTRequest);
|
||||
|
||||
vtmode.mode = VT_PROCESS;
|
||||
vtmode.relsig = SIGUSR1;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
void
|
||||
xf86VTRequest(int sig)
|
||||
{
|
||||
signal(sig, (void (*)(int)) xf86VTRequest);
|
||||
OsSignal(sig, (void (*)(int)) xf86VTRequest);
|
||||
xf86Info.vtRequestsPending = TRUE;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
#ifndef _XSERV_GLOBAL_H_
|
||||
#define _XSERV_GLOBAL_H_
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
#include "window.h" /* for WindowPtr */
|
||||
#include "extinit.h"
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue