xserver: Branch 'XACE-SELINUX' - 2 commits

Eamon Walsh ewalsh at kemper.freedesktop.org
Mon Nov 26 13:01:09 PST 2007


 configure.ac               |    7 ----
 dix/dispatch.c             |   75 +--------------------------------------------
 dix/extension.c            |   14 --------
 dix/registry.c             |   19 +++++++++++
 hw/xfree86/loader/dixsym.c |    5 +++
 include/dix-config.h.in    |    3 -
 include/registry.h         |    2 +
 7 files changed, 28 insertions(+), 97 deletions(-)

New commits:
commit 996b621bec1bbc4fb21970c75eaec62053bc6ccb
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Mon Nov 26 15:59:44 2007 -0500

    registry: swap out the DTRACE XErrorDB stuff for the new registry call.

diff --git a/configure.ac b/configure.ac
index d78bc1c..042cfdd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -90,13 +90,6 @@ if test "x$WDTRACE" != "xno" ; then
 fi
 AM_CONDITIONAL(XSERVER_DTRACE, [test "x$WDTRACE" != "xno"])
 
-# DTrace support uses XErrorDB to get request names
-AC_ARG_WITH(xerrordb,
-            AS_HELP_STRING([--with-xerrordb=PATH], [Path to XErrorDB file (default: ${datadir}/X11/XErrorDB)]),
-	    [ XERRORDB_PATH="$withval" ],
-	    [ XERRORDB_PATH="${datadir}/X11/XErrorDB" ])
-AC_DEFINE_DIR(XERRORDB_PATH, XERRORDB_PATH, [Path to XErrorDB file])
-
 AC_HEADER_DIRENT
 AC_HEADER_STDC
 AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h])
diff --git a/dix/dispatch.c b/dix/dispatch.c
index dcd4b53..919bcda 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -148,14 +148,7 @@ int ProcInitialConnection();
 #endif
 
 #ifdef XSERVER_DTRACE
-#include <sys/types.h>
-typedef const char *string;
 #include "Xserver-dtrace.h"
-
-char *RequestNames[256];
-static void LoadRequestNames(void);
-static void FreeRequestNames(void);
-#define GetRequestName(i) (RequestNames[i])
 #endif
 
 #define mskcnt ((MAXCLIENTS + 31) / 32)
@@ -383,10 +376,6 @@ Dispatch(void)
     if (!clientReady)
 	return;
 
-#ifdef XSERVER_DTRACE
-    LoadRequestNames();
-#endif
-
     while (!dispatchException)
     {
         if (*icheck[0] != *icheck[1])
@@ -464,7 +453,7 @@ Dispatch(void)
 		client->requestLogIndex++;
 #endif
 #ifdef XSERVER_DTRACE
-		XSERVER_REQUEST_START(GetRequestName(MAJOROP), MAJOROP,
+		XSERVER_REQUEST_START(LookupMajorName(MAJOROP), MAJOROP,
 			      ((xReq *)client->requestBuffer)->length,
 			      client->index, client->requestBuffer);
 #endif
@@ -476,7 +465,7 @@ Dispatch(void)
 		    XaceHookAuditEnd(client, result);
 		}
 #ifdef XSERVER_DTRACE
-		XSERVER_REQUEST_DONE(GetRequestName(MAJOROP), MAJOROP,
+		XSERVER_REQUEST_DONE(LookupMajorName(MAJOROP), MAJOROP,
 			      client->sequence, client->index, result);
 #endif
 
@@ -510,9 +499,6 @@ Dispatch(void)
     KillAllClients();
     xfree(clientReady);
     dispatchException &= ~DE_RESET;
-#ifdef XSERVER_DTRACE
-    FreeRequestNames();
-#endif
 }
 
 #undef MAJOROP
@@ -4045,60 +4031,3 @@ MarkClientException(ClientPtr client)
 {
     client->noClientException = -1;
 }
-
-#ifdef XSERVER_DTRACE
-#include <ctype.h>
-
-/* Load table of request names for dtrace probes */
-static void LoadRequestNames(void)
-{
-    int i;
-    FILE *xedb;
-    extern void LoadExtensionNames(char **RequestNames);
-
-    bzero(RequestNames, 256 * sizeof(char *));
-
-    xedb = fopen(XERRORDB_PATH, "r");
-    if (xedb != NULL) {
-	char buf[256];
-	while (fgets(buf, sizeof(buf), xedb)) {
-	    if ((strncmp("XRequest.", buf, 9) == 0) && (isdigit(buf[9]))) {
-		char *name;
-		i = strtol(buf + 9, &name, 10);
-		if (RequestNames[i] == 0) {
-		    char *end = strchr(name, '\n');
-		    if (end) { *end = '\0'; }
-		    RequestNames[i] = strdup(name + 1);
-		}
-	    }
-	}
-	fclose(xedb);
-    }
-
-    LoadExtensionNames(RequestNames);
-
-    for (i = 0; i < 256; i++) {
-	if (RequestNames[i] == 0) {
-#define RN_SIZE 12 /* "Request#' + up to 3 digits + \0 */
-	    RequestNames[i] = xalloc(RN_SIZE);
-	    if (RequestNames[i]) {
-		snprintf(RequestNames[i], RN_SIZE, "Request#%d", i);
-	    }
-	}
-	/* fprintf(stderr, "%d: %s\n", i, RequestNames[i]); */
-    }
-}
-
-static void FreeRequestNames(void)
-{
-    int i;
-
-    for (i = 0; i < 256; i++) {
-	if (RequestNames[i] != 0) {
-	    free(RequestNames[i]);
-	    RequestNames[i] = 0;
-	}
-    }
-}
-
-#endif
diff --git a/dix/extension.c b/dix/extension.c
index 42fdc12..9740c1b 100644
--- a/dix/extension.c
+++ b/dix/extension.c
@@ -354,17 +354,3 @@ ProcListExtensions(ClientPtr client)
     }
     return(client->noClientException);
 }
-
-#ifdef XSERVER_DTRACE
-void LoadExtensionNames(char **RequestNames) {
-    int i;
-
-    for (i=0; i<NumExtensions; i++) {
-	int r = extensions[i]->base;
-
-	if (RequestNames[r] == NULL) {
-	    RequestNames[r] = strdup(extensions[i]->name);
-	}
-    }
-}
-#endif
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index c442962..2af994f 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -500,9 +500,6 @@
 /* Define to 1 if the DTrace Xserver provider probes should be built in */
 #undef XSERVER_DTRACE
 
-/* Path to XErrorDB file */
-#undef XERRORDB_PATH
-
 /* Define to 16-bit byteswap macro */
 #undef bswap_16
 
commit 54cb729ecc2d366c1af836cb3d2ffc8e864e9b79
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Mon Nov 26 15:59:01 2007 -0500

    registry: Add a call for DTRACE compatibility.

diff --git a/dix/registry.c b/dix/registry.c
index 02b42d4..10fa21f 100644
--- a/dix/registry.c
+++ b/dix/registry.c
@@ -218,6 +218,25 @@ LookupRequestName(int major, int minor)
 }
 
 const char *
+LookupMajorName(int major)
+{
+    if (major < 128) {
+	const char *retval;
+
+	if (major >= nmajor)
+	    return XREGISTRY_UNKNOWN;
+	if (0 >= nminor[major])
+	    return XREGISTRY_UNKNOWN;
+
+	retval = requests[major][0];
+	return retval ? retval + sizeof(CORE) : XREGISTRY_UNKNOWN;
+    } else {
+	ExtensionEntry *extEntry = GetExtensionEntry(major);
+	return extEntry ? extEntry->name : XREGISTRY_UNKNOWN;
+    }
+}
+
+const char *
 LookupEventName(int event)
 {
     event &= 127;
diff --git a/hw/xfree86/loader/dixsym.c b/hw/xfree86/loader/dixsym.c
index 79cc6e7..49c7d27 100644
--- a/hw/xfree86/loader/dixsym.c
+++ b/hw/xfree86/loader/dixsym.c
@@ -289,6 +289,11 @@ _X_HIDDEN void *dixLookupTab[] = {
     /* registry.c */
 #ifdef XREGISTRY
     SYMFUNC(RegisterResourceName)
+    SYMFUNC(LookupMajorName)
+    SYMFUNC(LookupRequestName)
+    SYMFUNC(LookupEventName)
+    SYMFUNC(LookupErrorName)
+    SYMFUNC(LookupResourceName)
 #endif
     /* swaprep.c */
     SYMFUNC(CopySwap32Write)
diff --git a/include/registry.h b/include/registry.h
index 90c3de3..edd6ef9 100644
--- a/include/registry.h
+++ b/include/registry.h
@@ -29,6 +29,7 @@ void RegisterExtensionNames(ExtensionEntry *ext);
 /*
  * Lookup functions.  The returned string must not be modified or freed.
  */
+const char *LookupMajorName(int major);
 const char *LookupRequestName(int major, int minor);
 const char *LookupEventName(int event);
 const char *LookupErrorName(int error);
@@ -51,6 +52,7 @@ void dixResetRegistry(void);
 #define RegisterResourceName(a, b) { ; }
 #define RegisterExtensionNames(a) { ; }
 
+#define LookupMajorName(a) XREGISTRY_UNKNOWN
 #define LookupRequestName(a, b) XREGISTRY_UNKNOWN
 #define LookupEventName(a) XREGISTRY_UNKNOWN
 #define LookupErrorName(a) XREGISTRY_UNKNOWN


More information about the xorg-commit mailing list