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__)
|
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__) || defined(__DragonFly__)
|
||||||
#include <sys/signal.h>
|
|
||||||
|
|
||||||
static Bool badSysCall = FALSE;
|
static Bool badSysCall = FALSE;
|
||||||
|
|
||||||
|
@ -170,7 +169,7 @@ CheckForShmSyscall(void)
|
||||||
int shmid = -1;
|
int shmid = -1;
|
||||||
|
|
||||||
/* If no SHM support in the kernel, the bad syscall will generate SIGSYS */
|
/* If no SHM support in the kernel, the bad syscall will generate SIGSYS */
|
||||||
oldHandler = signal(SIGSYS, SigSysHandler);
|
oldHandler = OsSignal(SIGSYS, SigSysHandler);
|
||||||
|
|
||||||
badSysCall = FALSE;
|
badSysCall = FALSE;
|
||||||
shmid = shmget(IPC_PRIVATE, 4096, IPC_CREAT);
|
shmid = shmget(IPC_PRIVATE, 4096, IPC_CREAT);
|
||||||
|
@ -183,7 +182,7 @@ CheckForShmSyscall(void)
|
||||||
/* Allocation failed */
|
/* Allocation failed */
|
||||||
badSysCall = TRUE;
|
badSysCall = TRUE;
|
||||||
}
|
}
|
||||||
signal(SIGSYS, oldHandler);
|
OsSignal(SIGSYS, oldHandler);
|
||||||
return !badSysCall;
|
return !badSysCall;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,8 +96,6 @@ static Bool badSysCall = FALSE;
|
||||||
|
|
||||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__) || defined(__DragonFly__)
|
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__) || defined(__DragonFly__)
|
||||||
|
|
||||||
#include <sys/signal.h>
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SigSysHandler(int signo)
|
SigSysHandler(int signo)
|
||||||
{
|
{
|
||||||
|
@ -111,7 +109,7 @@ CheckForShmSyscall(void)
|
||||||
int shmid = -1;
|
int shmid = -1;
|
||||||
|
|
||||||
/* If no SHM support in the kernel, the bad syscall will generate SIGSYS */
|
/* If no SHM support in the kernel, the bad syscall will generate SIGSYS */
|
||||||
oldHandler = signal(SIGSYS, SigSysHandler);
|
oldHandler = OsSignal(SIGSYS, SigSysHandler);
|
||||||
|
|
||||||
badSysCall = FALSE;
|
badSysCall = FALSE;
|
||||||
shmid = shmget(IPC_PRIVATE, 4096, IPC_CREAT);
|
shmid = shmget(IPC_PRIVATE, 4096, IPC_CREAT);
|
||||||
|
@ -123,7 +121,7 @@ CheckForShmSyscall(void)
|
||||||
/* Allocation failed */
|
/* Allocation failed */
|
||||||
badSysCall = TRUE;
|
badSysCall = TRUE;
|
||||||
}
|
}
|
||||||
signal(SIGSYS, oldHandler);
|
OsSignal(SIGSYS, oldHandler);
|
||||||
return !badSysCall;
|
return !badSysCall;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -158,7 +158,6 @@
|
||||||
#include <X11/Xos.h>
|
#include <X11/Xos.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <signal.h>
|
|
||||||
#include <sys/vt.h>
|
#include <sys/vt.h>
|
||||||
#include <sys/kd.h>
|
#include <sys/kd.h>
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
|
@ -505,7 +504,7 @@ kbdLinuxVTSignalHandler(int sig)
|
||||||
{
|
{
|
||||||
myPrivate *priv = PRIV;
|
myPrivate *priv = PRIV;
|
||||||
|
|
||||||
signal(sig, kbdLinuxVTSignalHandler);
|
OsSignal(sig, kbdLinuxVTSignalHandler);
|
||||||
if (priv) {
|
if (priv) {
|
||||||
ioctl(priv->fd, VT_RELDISP, VT_ACKACQ);
|
ioctl(priv->fd, VT_RELDISP, VT_ACKACQ);
|
||||||
priv->switched = !priv->switched;
|
priv->switched = !priv->switched;
|
||||||
|
@ -537,7 +536,7 @@ kbdLinuxActivate(int fd, int vtno, int setSig)
|
||||||
VT.acqsig = SIGUSR1;
|
VT.acqsig = SIGUSR1;
|
||||||
if (ioctl(fd, VT_SETMODE, &VT))
|
if (ioctl(fd, VT_SETMODE, &VT))
|
||||||
FATAL0("kbdLinuxActivate: VT_SETMODE VT_PROCESS failed\n");
|
FATAL0("kbdLinuxActivate: VT_SETMODE VT_PROCESS failed\n");
|
||||||
signal(SIGUSR1, kbdLinuxVTSignalHandler);
|
OsSignal(SIGUSR1, kbdLinuxVTSignalHandler);
|
||||||
}
|
}
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
#define _EPHYR_H_
|
#define _EPHYR_H_
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <signal.h>
|
|
||||||
#include <libgen.h>
|
#include <libgen.h>
|
||||||
#include <xcb/xcb_image.h>
|
#include <xcb/xcb_image.h>
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
#endif
|
#endif
|
||||||
#include "kdrive.h"
|
#include "kdrive.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <signal.h>
|
|
||||||
#include <linux/vt.h>
|
#include <linux/vt.h>
|
||||||
#include <linux/kd.h>
|
#include <linux/kd.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
|
@ -43,8 +43,6 @@
|
||||||
#include <execinfo.h>
|
#include <execinfo.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <signal.h>
|
|
||||||
|
|
||||||
#if defined(CONFIG_UDEV) || defined(CONFIG_HAL)
|
#if defined(CONFIG_UDEV) || defined(CONFIG_HAL)
|
||||||
#include <hotplug.h>
|
#include <hotplug.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
#if HAVE_X11_XF86KEYSYM_H
|
#if HAVE_X11_XF86KEYSYM_H
|
||||||
#include <X11/XF86keysym.h>
|
#include <X11/XF86keysym.h>
|
||||||
#endif
|
#endif
|
||||||
#include <signal.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#ifdef __sun
|
#ifdef __sun
|
||||||
#include <sys/file.h> /* needed for FNONBLOCK & FASYNC */
|
#include <sys/file.h> /* needed for FNONBLOCK & FASYNC */
|
||||||
|
|
|
@ -308,16 +308,16 @@ InstallSignalHandlers(void)
|
||||||
OsRegisterSigWrapper(xf86SigWrapper);
|
OsRegisterSigWrapper(xf86SigWrapper);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
signal(SIGSEGV, SIG_DFL);
|
OsSignal(SIGSEGV, SIG_DFL);
|
||||||
signal(SIGILL, SIG_DFL);
|
OsSignal(SIGILL, SIG_DFL);
|
||||||
#ifdef SIGEMT
|
#ifdef SIGEMT
|
||||||
signal(SIGEMT, SIG_DFL);
|
OsSignal(SIGEMT, SIG_DFL);
|
||||||
#endif
|
#endif
|
||||||
signal(SIGFPE, SIG_DFL);
|
OsSignal(SIGFPE, SIG_DFL);
|
||||||
signal(SIGBUS, SIG_DFL);
|
OsSignal(SIGBUS, SIG_DFL);
|
||||||
signal(SIGSYS, SIG_DFL);
|
OsSignal(SIGSYS, SIG_DFL);
|
||||||
signal(SIGXCPU, SIG_DFL);
|
OsSignal(SIGXCPU, SIG_DFL);
|
||||||
signal(SIGXFSZ, SIG_DFL);
|
OsSignal(SIGXFSZ, SIG_DFL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -924,7 +924,7 @@ OsVendorInit(void)
|
||||||
{
|
{
|
||||||
static Bool beenHere = FALSE;
|
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) {
|
if (!beenHere) {
|
||||||
umask(022);
|
umask(022);
|
||||||
|
|
|
@ -269,7 +269,7 @@ xf86OpenConsole()
|
||||||
"xf86OpenConsole: VT_WAITACTIVE failed\n");
|
"xf86OpenConsole: VT_WAITACTIVE failed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
signal(SIGUSR1, xf86VTRequest);
|
OsSignal(SIGUSR1, xf86VTRequest);
|
||||||
|
|
||||||
vtmode.mode = VT_PROCESS;
|
vtmode.mode = VT_PROCESS;
|
||||||
vtmode.relsig = SIGUSR1;
|
vtmode.relsig = SIGUSR1;
|
||||||
|
|
|
@ -247,7 +247,7 @@ xf86OpenConsole(void)
|
||||||
FatalError("xf86OpenConsole: VT_GETMODE failed %s\n",
|
FatalError("xf86OpenConsole: VT_GETMODE failed %s\n",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
|
|
||||||
signal(SIGUSR1, xf86VTRequest);
|
OsSignal(SIGUSR1, xf86VTRequest);
|
||||||
|
|
||||||
VT.mode = VT_PROCESS;
|
VT.mode = VT_PROCESS;
|
||||||
VT.relsig = SIGUSR1;
|
VT.relsig = SIGUSR1;
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
void
|
void
|
||||||
xf86VTRequest(int sig)
|
xf86VTRequest(int sig)
|
||||||
{
|
{
|
||||||
signal(sig, (void (*)(int)) xf86VTRequest);
|
OsSignal(sig, (void (*)(int)) xf86VTRequest);
|
||||||
xf86Info.vtRequestsPending = TRUE;
|
xf86Info.vtRequestsPending = TRUE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,6 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <signal.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#if defined(HAVE_SETEUID) && defined(_POSIX_SAVED_IDS) && _POSIX_SAVED_IDS > 0
|
#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);
|
void (*csig) (int);
|
||||||
|
|
||||||
/* Need to fork to change ruid without loosing euid */
|
/* Need to fork to change ruid without loosing euid */
|
||||||
csig = signal(SIGCHLD, SIG_DFL);
|
csig = OsSignal(SIGCHLD, SIG_DFL);
|
||||||
switch ((pid = fork())) {
|
switch ((pid = fork())) {
|
||||||
case -1:
|
case -1:
|
||||||
ErrorF("xf86writeConfigFile(): fork failed (%s)\n",
|
ErrorF("xf86writeConfigFile(): fork failed (%s)\n",
|
||||||
|
@ -159,7 +158,7 @@ xf86writeConfigFile(const char *filename, XF86ConfigPtr cptr)
|
||||||
p = waitpid(pid, &status, 0);
|
p = waitpid(pid, &status, 0);
|
||||||
} while (p == -1 && errno == EINTR);
|
} while (p == -1 && errno == EINTR);
|
||||||
}
|
}
|
||||||
signal(SIGCHLD, csig);
|
OsSignal(SIGCHLD, csig);
|
||||||
if (p != -1 && WIFEXITED(status) && WEXITSTATUS(status) == 0)
|
if (p != -1 && WIFEXITED(status) && WEXITSTATUS(status) == 0)
|
||||||
return 1; /* success */
|
return 1; /* success */
|
||||||
else
|
else
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
#ifndef _XSERV_GLOBAL_H_
|
#ifndef _XSERV_GLOBAL_H_
|
||||||
#define _XSERV_GLOBAL_H_
|
#define _XSERV_GLOBAL_H_
|
||||||
|
|
||||||
#include <signal.h>
|
|
||||||
|
|
||||||
#include "window.h" /* for WindowPtr */
|
#include "window.h" /* for WindowPtr */
|
||||||
#include "extinit.h"
|
#include "extinit.h"
|
||||||
|
|
||||||
|
|
|
@ -1395,7 +1395,7 @@ System(const char *command)
|
||||||
if (!command)
|
if (!command)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
csig = signal(SIGCHLD, SIG_DFL);
|
csig = OsSignal(SIGCHLD, SIG_DFL);
|
||||||
if (csig == SIG_ERR) {
|
if (csig == SIG_ERR) {
|
||||||
perror("signal");
|
perror("signal");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1420,7 +1420,7 @@ System(const char *command)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (signal(SIGCHLD, csig) == SIG_ERR) {
|
if (OsSignal(SIGCHLD, csig) == SIG_ERR) {
|
||||||
perror("signal");
|
perror("signal");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue