[PATCH 1/3] os/xfree86: remove macro checking for POSIX symbols
Tiago Vignatti
tiago.vignatti at nokia.com
Tue Sep 7 05:39:17 PDT 2010
We assume already that our X implementation is POSIX compliant anyway. So
remove those redundant checking.
Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
---
hw/xfree86/common/xf86Init.c | 10 ----------
hw/xfree86/parser/write.c | 4 ----
os/osinit.c | 17 -----------------
os/utils.c | 21 ---------------------
4 files changed, 0 insertions(+), 52 deletions(-)
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index ca532ee..271167f 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -314,18 +314,10 @@ InstallSignalHandlers(void)
signal(SIGEMT, SIG_DFL);
#endif
signal(SIGFPE, SIG_DFL);
-#ifdef SIGBUS
signal(SIGBUS, SIG_DFL);
-#endif
-#ifdef SIGSYS
signal(SIGSYS, SIG_DFL);
-#endif
-#ifdef SIGXCPU
signal(SIGXCPU, SIG_DFL);
-#endif
-#ifdef SIGXFSZ
signal(SIGXFSZ, SIG_DFL);
-#endif
}
}
@@ -863,9 +855,7 @@ OsVendorInit(void)
{
static Bool beenHere = FALSE;
-#ifdef SIGCHLD
signal(SIGCHLD, SIG_DFL); /* Need to wait for child processes */
-#endif
if (!beenHere) {
umask(022);
diff --git a/hw/xfree86/parser/write.c b/hw/xfree86/parser/write.c
index 083203c..eea3f06 100644
--- a/hw/xfree86/parser/write.c
+++ b/hw/xfree86/parser/write.c
@@ -157,9 +157,7 @@ xf86writeConfigFile (const char *filename, XF86ConfigPtr cptr)
#if !defined(HAS_SAVED_IDS_AND_SETEUID)
/* Need to fork to change ruid without loosing euid */
-#ifdef SIGCHLD
csig = signal(SIGCHLD, SIG_DFL);
-#endif
switch ((pid = fork()))
{
case -1:
@@ -180,9 +178,7 @@ xf86writeConfigFile (const char *filename, XF86ConfigPtr cptr)
p = waitpid(pid, &status, 0);
} while (p == -1 && errno == EINTR);
}
-#ifdef SIGCHLD
signal(SIGCHLD, csig);
-#endif
if (p != -1 && WIFEXITED(status) && WEXITSTATUS(status) == 0)
return 1; /* success */
else
diff --git a/os/osinit.c b/os/osinit.c
index 32747df..98c27cc 100644
--- a/os/osinit.c
+++ b/os/osinit.c
@@ -114,11 +114,7 @@ OsRegisterSigWrapper(OsSigWrapperPtr newSigWrapper)
* Catch unexpected signals and exit or continue cleanly.
*/
static void
-#ifdef SA_SIGINFO
OsSigHandler(int signo, siginfo_t *sip, void *unused)
-#else
-OsSigHandler(int signo)
-#endif
{
#ifdef RTLD_DI_SETSIGNAL
const char *dlerr = dlerror();
@@ -138,7 +134,6 @@ OsSigHandler(int signo)
/* log, cleanup, and abort */
xorg_backtrace();
-#ifdef SA_SIGINFO
if (sip->si_code == SI_USER) {
ErrorF("Recieved signal %d sent by process %ld, uid %ld\n",
signo, (long) sip->si_pid, (long) sip->si_uid);
@@ -151,7 +146,6 @@ OsSigHandler(int signo)
ErrorF("%s at address %p\n", strsignal(signo), sip->si_addr);
}
}
-#endif
FatalError("Caught signal %d (%s). Server aborting\n",
signo, strsignal(signo));
@@ -168,27 +162,16 @@ OsInit(void)
struct sigaction act, oact;
int i;
int siglist[] = { SIGSEGV, SIGQUIT, SIGILL, SIGFPE, SIGBUS,
-#ifdef SIGSYS
SIGSYS,
-#endif
-#ifdef SIGXCPU
SIGXCPU,
-#endif
-#ifdef SIGXFSZ
SIGXFSZ,
-#endif
#ifdef SIGEMT
SIGEMT,
#endif
0 /* must be last */ };
sigemptyset(&act.sa_mask);
-#ifdef SA_SIGINFO
act.sa_sigaction = OsSigHandler;
act.sa_flags = SA_SIGINFO;
-#else
- act.sa_handler = OsSigHandler;
- act.sa_flags = 0;
-#endif
for (i = 0; siglist[i] != 0; i++) {
if (sigaction(siglist[i], &act, &oact)) {
ErrorF("failed to install signal handler for signal %d: %s\n",
diff --git a/os/utils.c b/os/utils.c
index 51455cc..547acfc 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -1117,10 +1117,7 @@ XNFstrdup(const char *s)
}
-#ifdef SIGVTALRM
#define SMART_SCHEDULE_POSSIBLE
-#endif
-
#ifdef SMART_SCHEDULE_POSSIBLE
#define SMART_SCHEDULE_SIGNAL SIGALRM
#define SMART_SCHEDULE_TIMER ITIMER_REAL
@@ -1206,30 +1203,18 @@ OsBlockSignals (void)
sigset_t set;
sigemptyset (&set);
-#ifdef SIGALRM
sigaddset (&set, SIGALRM);
-#endif
-#ifdef SIGVTALRM
sigaddset (&set, SIGVTALRM);
-#endif
#ifdef SIGWINCH
sigaddset (&set, SIGWINCH);
#endif
#ifdef SIGIO
sigaddset (&set, SIGIO);
#endif
-#ifdef SIGTSTP
sigaddset (&set, SIGTSTP);
-#endif
-#ifdef SIGTTIN
sigaddset (&set, SIGTTIN);
-#endif
-#ifdef SIGTTOU
sigaddset (&set, SIGTTOU);
-#endif
-#ifdef SIGCHLD
sigaddset (&set, SIGCHLD);
-#endif
sigprocmask (SIG_BLOCK, &set, &PreviousSignalMask);
}
#endif
@@ -1275,21 +1260,17 @@ int
System(char *command)
{
int pid, p;
-#ifdef SIGCHLD
void (*csig)(int);
-#endif
int status;
if (!command)
return 1;
-#ifdef SIGCHLD
csig = signal(SIGCHLD, SIG_DFL);
if (csig == SIG_ERR) {
perror("signal");
return -1;
}
-#endif
#ifdef DEBUG
ErrorF("System: `%s'\n", command);
@@ -1312,12 +1293,10 @@ System(char *command)
}
-#ifdef SIGCHLD
if (signal(SIGCHLD, csig) == SIG_ERR) {
perror("signal");
return -1;
}
-#endif
return p == -1 ? -1 : status;
}
--
1.7.1.226.g770c5
More information about the xorg-devel
mailing list