xserver: Branch 'server-1.4-branch' - 4 commits

Daniel Stone daniels at kemper.freedesktop.org
Wed May 7 01:46:14 PDT 2008


 configure.ac |    7 +++++++
 os/utils.c   |   28 ++++++++++++++++++++++++++--
 2 files changed, 33 insertions(+), 2 deletions(-)

New commits:
commit b95befdfd2c9bcb6b0cd896f2b8dfaaeb129dbff
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Fri Dec 7 17:28:37 2007 -0800

    Check for <sys/sdt.h> as well when determining to enable dtrace probes
    
    Avoids auto-detecting dtrace is present on systems with the ISDN trace tool
    named dtrace installed, but not the dynamic tracing facility named dtrace

diff --git a/configure.ac b/configure.ac
index 4841d26..c73f4a7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -66,6 +66,8 @@ AC_SYS_LARGEFILE
 XORG_PROG_RAWCPP
 
 dnl Check for dtrace program (needed to build Xserver dtrace probes)
+dnl Also checks for <sys/sdt.h>, since some Linux distros have an 
+dnl ISDN trace program named dtrace
 AC_ARG_WITH(dtrace, AS_HELP_STRING([--with-dtrace=PATH],
 	     [Enable dtrace probes (default: enabled if dtrace found)]),
 	     [WDTRACE=$withval], [WDTRACE=auto])
@@ -76,6 +78,11 @@ if test "x$WDTRACE" = "xyes" -o "x$WDTRACE" = "xauto" ; then
 			AC_MSG_FAILURE([dtrace requested but not found])
 		fi
 		WDTRACE="no"
+	else
+		AC_CHECK_HEADER(sys/sdt.h, [HAS_SDT_H="yes"], [HAS_SDT_H="no"])
+		if test "x$WDTRACE" = "xauto" -a "x$HAS_SDT_H" = "xno" ; then
+			WDTRACE="no"
+		fi
 	fi
 fi
 if test "x$WDTRACE" != "xno" ; then
commit 0fab9843c7b553bb59d57e68d9c3ea2d754bf809
Author: Ben Byer <bbyer at bbyer.apple.com>
Date:   Fri Sep 21 17:07:36 2007 -0700

    So, like, checking return codes of system calls (signal, etc) is good.
    Also, only restore an old signal handler if one was actually set
    (prevents the server from dying on OS X).

diff --git a/os/utils.c b/os/utils.c
index 144098b..36c8dfe 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -285,7 +285,8 @@ OsSignal(sig, handler)
 	sigaddset(&act.sa_mask, sig);
     act.sa_flags = 0;
     act.sa_handler = handler;
-    sigaction(sig, &act, &oact);
+    if (sigaction(sig, &act, &oact))
+      perror("sigaction");
     return oact.sa_handler;
 #endif
 }
@@ -1684,6 +1685,10 @@ System(char *command)
 
 #ifdef SIGCHLD
     csig = signal(SIGCHLD, SIG_DFL);
+    if (csig == SIG_ERR) {
+      perror("signal");
+      return -1;
+    }
 #endif
 
 #ifdef DEBUG
@@ -1708,7 +1713,10 @@ System(char *command)
     }
 
 #ifdef SIGCHLD
-    signal(SIGCHLD, csig);
+    if (signal(SIGCHLD, csig) == SIG_ERR) {
+      perror("signal");
+      return -1;
+    }
 #endif
 
     return p == -1 ? -1 : status;
@@ -1745,13 +1753,18 @@ Popen(char *command, char *type)
 
     /* Ignore the smart scheduler while this is going on */
     old_alarm = signal(SIGALRM, SIG_IGN);
+    if (old_alarm == SIG_ERR) {
+      perror("signal");
+      return NULL;
+    }
 
     switch (pid = fork()) {
     case -1: 	/* error */
 	close(pdes[0]);
 	close(pdes[1]);
 	xfree(cur);
-	signal(SIGALRM, old_alarm);
+	if (signal(SIGALRM, old_alarm) == SIG_ERR)
+	  perror("signal");
 	return NULL;
     case 0:	/* child */
 	if (setgid(getgid()) == -1)
@@ -1927,7 +1940,10 @@ Pclose(pointer iop)
     /* allow EINTR again */
     OsReleaseSignals ();
     
-    signal(SIGALRM, old_alarm);
+    if (old_alarm && signal(SIGALRM, old_alarm) == SIG_ERR) {
+      perror("signal");
+      return -1;
+    }
 
     return pid == -1 ? -1 : pstat;
 }
commit a02b989c68864a7388553fb96e4fbaf91f941c4a
Author: Eric Anholt <eric at anholt.net>
Date:   Wed Sep 12 13:23:13 2007 +0000

    Fix build on FreeBSD after Popen changes.

diff --git a/os/utils.c b/os/utils.c
index afcaae4..144098b 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -1720,7 +1720,7 @@ static struct pid {
     int pid;
 } *pidlist;
 
-static sighandler_t old_alarm = NULL; /* XXX horrible awful hack */
+void (*old_alarm)(int) = NULL; /* XXX horrible awful hack */
 
 pointer
 Popen(char *command, char *type)
commit 6a5066c2e9e872d4ef85ec70745c34d93580177e
Author: Adam Jackson <ajax at benzedrine.nwnk.net>
Date:   Tue Sep 11 11:37:06 2007 -0400

    Ignore - not just block - SIGALRM around Popen()/Pclose().
    
    Because our "popen" implementation uses stdio, and because nobody's stdio
    library is capable of surviving signals, we need to make absolutely sure
    that we hide the SIGALRM from the smart scheduler.  Otherwise, when you
    open a menu in openoffice, and it recompiles XKB to deal with the
    accelerators, and you popen xkbcomp because we suck, then the scheduler
    will tell you you're taking forever doing something stupid, and the
    wait() code will get confused, and input will hang and your CPU usage
    slams to 100%.  Down, not across.

diff --git a/os/utils.c b/os/utils.c
index 3bb7dbe..afcaae4 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -1720,6 +1720,8 @@ static struct pid {
     int pid;
 } *pidlist;
 
+static sighandler_t old_alarm = NULL; /* XXX horrible awful hack */
+
 pointer
 Popen(char *command, char *type)
 {
@@ -1741,11 +1743,15 @@ Popen(char *command, char *type)
 	return NULL;
     }
 
+    /* Ignore the smart scheduler while this is going on */
+    old_alarm = signal(SIGALRM, SIG_IGN);
+
     switch (pid = fork()) {
     case -1: 	/* error */
 	close(pdes[0]);
 	close(pdes[1]);
 	xfree(cur);
+	signal(SIGALRM, old_alarm);
 	return NULL;
     case 0:	/* child */
 	if (setgid(getgid()) == -1)
@@ -1921,6 +1927,8 @@ Pclose(pointer iop)
     /* allow EINTR again */
     OsReleaseSignals ();
     
+    signal(SIGALRM, old_alarm);
+
     return pid == -1 ? -1 : pstat;
 }
 


More information about the xorg-commit mailing list