open-src/xserver/xorg/dtrace.patch
changeset 606 068c11b419c9
parent 605 e5259db5befc
child 607 261c0d718d67
--- a/open-src/xserver/xorg/dtrace.patch	Sat Jan 10 10:35:32 2009 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,600 +0,0 @@
-/* Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, and/or sell copies of the Software, and to permit persons
- * to whom the Software is furnished to do so, provided that the above
- * copyright notice(s) and this permission notice appear in all copies of
- * the Software and that both the above copyright notice(s) and this
- * permission notice appear in supporting documentation.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
- * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
- * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- * 
- * Except as contained in this notice, the name of a copyright holder
- * shall not be used in advertising or otherwise to promote the sale, use
- * or other dealings in this Software without prior written authorization
- * of the copyright holder.
- */
-
-
---- dix/Xserver.d	1969-12-31 16:00:00.000000000 -0800
-+++ dix/Xserver.d	2005-07-04 11:09:17.267106000 -0700
-@@ -0,0 +1,59 @@
-+/* Copyright 2005-2006 Sun Microsystems, Inc.  All rights reserved.
-+ *
-+ * Permission is hereby granted, free of charge, to any person obtaining a
-+ * copy of this software and associated documentation files (the
-+ * "Software"), to deal in the Software without restriction, including
-+ * without limitation the rights to use, copy, modify, merge, publish,
-+ * distribute, and/or sell copies of the Software, and to permit persons
-+ * to whom the Software is furnished to do so, provided that the above
-+ * copyright notice(s) and this permission notice appear in all copies of
-+ * the Software and that both the above copyright notice(s) and this
-+ * permission notice appear in supporting documentation.
-+ * 
-+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
-+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
-+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
-+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
-+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
-+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-+ * 
-+ * Except as contained in this notice, the name of a copyright holder
-+ * shall not be used in advertising or otherwise to promote the sale, use
-+ * or other dealings in this Software without prior written authorization
-+ * of the copyright holder.
-+ */
-+
-+/*
-+ * Xserver dtrace provider definition
-+ */
-+
-+#include <sys/types.h>
-+
-+provider Xserver {
-+	/* reqType, data, length, client id, request buffer */
-+	probe request__start(string, uint8_t, uint16_t, int, void *);
-+	/* reqType, data, sequence, client id, result */
-+	probe request__done(string, uint8_t, uint32_t, int, int);
-+	/* client id, client fd */
-+	probe client__connect(int, int);
-+	/* client id, client address, client pid, client zone id */
-+	probe client__auth(int, string, pid_t, zoneid_t);
-+	/* client id */
-+	probe client__disconnect(int);
-+	/* resource id, resource type, value, resource type name */
-+	probe resource__alloc(uint32_t, uint32_t, void *, string);
-+	/* resource id, resource type, value, resource type name */
-+	probe resource__free(uint32_t, uint32_t, void *, string);
-+	/* client id, event type, event* */
-+	probe send__event(int, uint8_t, void *);
-+};
-+
-+#pragma D attributes Unstable/Unstable/Common provider Xserver provider
-+#pragma D attributes Private/Private/Unknown  provider Xserver module
-+#pragma D attributes Private/Private/Unknown  provider Xserver function
-+#pragma D attributes Unstable/Unstable/Common provider Xserver name
-+#pragma D attributes Unstable/Unstable/Common provider Xserver args
-+
-
-diff -urp -x '*~' -x '*.orig' configure.ac configure.ac
---- configure.ac	2007-04-19 18:23:40.000000000 -0700
-+++ configure.ac	2007-07-30 18:29:34.753611000 -0700
-@@ -77,6 +77,15 @@ AC_PROG_LEX
- AC_PROG_YACC
- XORG_PROG_RAWCPP
- 
-+dnl Check for dtrace program (needed to build Xserver dtrace probes)
-+AC_PATH_PROG(DTRACE, [dtrace], [not_found], [$PATH:/usr/sbin])
-+if test "x$DTRACE" != "xnot_found" ; then
-+  AC_DEFINE(XSERVER_DTRACE, 1, 
-+      [Define to 1 if the DTrace Xserver provider probes should be built in.])
-+fi
-+AM_CONDITIONAL(XSERVER_DTRACE, [test "x$DTRACE" != "xnot_found"])
-+AC_DEFINE_DIR(XERRORDB_PATH, libdir/XErrorDB, [Path to XErrorDB file])
-+
- AC_HEADER_DIRENT
- AC_HEADER_STDC
- AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h])
-@@ -860,8 +869,8 @@ AC_DEFINE(XCMISC, 1, [Support XCMisc ext
- AC_DEFINE(BIGREQS, 1, [Support BigRequests extension])
- AC_DEFINE(PIXPRIV, 1, [Support pixmap privates])
- 
--DIX_LIB='$(top_builddir)/dix/libdix.la'
--OS_LIB='$(top_builddir)/os/libos.la'
-+DIX_LIB='$(top_builddir)/dix/dix.O'
-+OS_LIB='$(top_builddir)/os/os.O'
- CWRAP_LIB='$(top_builddir)/os/libcwrapper.la'
- MI_LIB='$(top_builddir)/mi/libmi.la'
- MINIMI_LIB='$(top_builddir)/mi/libminimi.la'
-diff -urp -x '*~' -x '*.orig' dix/Makefile.am dix/Makefile.am
---- dix/Makefile.am	2006-11-16 10:01:22.000000000 -0800
-+++ dix/Makefile.am	2007-07-30 18:29:34.754152000 -0700
-@@ -37,4 +37,21 @@ libxpstubs_la_SOURCES =	\
- 
- INCLUDES = -I$(top_srcdir)/Xprint
- 
--EXTRA_DIST = buildatoms BuiltInAtoms CHANGES
-+EXTRA_DIST = buildatoms BuiltInAtoms CHANGES Xserver.d
-+
-+if XSERVER_DTRACE
-+# Generate dtrace header file for C sources to include
-+BUILT_SOURCES = Xserver-dtrace.h
-+
-+Xserver-dtrace.h: $(srcdir)/Xserver.d
-+	$(DTRACE) -C -h -o $@ -s $(srcdir)/Xserver.d
-+
-+# Generate dtrace object code for probes in libdix
-+dtrace-os.o: $(top_srcdir)/dix/Xserver.d $(am_libdix_la_OBJECTS)
-+	$(DTRACE) -G -C -o $@ -s $(top_srcdir)/dix/Xserver.d .libs/*.o
-+
-+noinst_PROGRAMS = dix.O
-+
-+dix.O: dtrace-os.o $(am_libdix_la_OBJECTS)
-+	ld -r -o $@ dtrace-os.o .libs/*.o
-+endif
-diff -urp -x '*~' -x '*.orig' dix/dispatch.c dix/dispatch.c
---- dix/dispatch.c	2006-11-16 10:01:22.000000000 -0800
-+++ dix/dispatch.c	2007-07-30 18:29:34.761328000 -0700
-@@ -74,6 +74,36 @@ Equipment Corporation.
- 
- ******************************************************************/
- 
-+/* XSERVER_DTRACE additions:
-+ * Copyright 2005-2006 Sun Microsystems, Inc.  All rights reserved.
-+ *
-+ * Permission is hereby granted, free of charge, to any person obtaining a
-+ * copy of this software and associated documentation files (the
-+ * "Software"), to deal in the Software without restriction, including
-+ * without limitation the rights to use, copy, modify, merge, publish,
-+ * distribute, and/or sell copies of the Software, and to permit persons
-+ * to whom the Software is furnished to do so, provided that the above
-+ * copyright notice(s) and this permission notice appear in all copies of
-+ * the Software and that both the above copyright notice(s) and this
-+ * permission notice appear in supporting documentation.
-+ * 
-+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
-+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
-+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
-+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
-+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
-+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-+ * 
-+ * Except as contained in this notice, the name of a copyright holder
-+ * shall not be used in advertising or otherwise to promote the sale, use
-+ * or other dealings in this Software without prior written authorization
-+ * of the copyright holder.
-+ */
-+
-+
- 
- #ifdef HAVE_DIX_CONFIG_H
- #include <dix-config.h>
-@@ -118,6 +148,17 @@ int ProcInitialConnection();
- #include <X11/extensions/XKBsrv.h>
- #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)
- #define BITMASK(i) (1U << ((i) & 31))
- #define MASKIDX(i) ((i) >> 5)
-@@ -372,6 +413,10 @@ Dispatch(void)
-     if (!clientReady)
- 	return;
- 
-+#ifdef XSERVER_DTRACE
-+    LoadRequestNames();
-+#endif
-+
-     while (!dispatchException)
-     {
-         if (*icheck[0] != *icheck[1])
-@@ -448,6 +493,11 @@ Dispatch(void)
- 		client->requestLog[client->requestLogIndex] = MAJOROP;
- 		client->requestLogIndex++;
- #endif
-+#ifdef XSERVER_DTRACE
-+		XSERVER_REQUEST_START(GetRequestName(MAJOROP), MAJOROP,
-+			      ((xReq *)client->requestBuffer)->length,
-+			      client->index, client->requestBuffer);
-+#endif
- 		if (result > (maxBigRequestSize << 2))
- 		    result = BadLength;
- 		else
-@@ -460,7 +510,11 @@ Dispatch(void)
- #else
-     		    result = (* client->requestVector[MAJOROP])(client);
- #endif /* XACE */
--	    
-+#ifdef XSERVER_DTRACE
-+		XSERVER_REQUEST_DONE(GetRequestName(MAJOROP), MAJOROP,
-+			      client->sequence, client->index, result);
-+#endif
-+
- 		if (result != Success) 
- 		{
- 		    if (client->noClientException != Success)
-@@ -491,6 +545,9 @@ Dispatch(void)
-     KillAllClients();
-     DEALLOCATE_LOCAL(clientReady);
-     dispatchException &= ~DE_RESET;
-+#ifdef XSERVER_DTRACE
-+    FreeRequestNames();
-+#endif
- }
- 
- #undef MAJOROP
-@@ -3565,6 +3622,9 @@ CloseDownClient(register ClientPtr clien
- 	    CallCallbacks((&ClientStateCallback), (pointer)&clientinfo);
- 	} 	    
- 	FreeClientResources(client);
-+#ifdef XSERVER_DTRACE
-+	XSERVER_CLIENT_DISCONNECT(client->index);
-+#endif	
- 	if (client->index < nextFreeClientID)
- 	    nextFreeClientID = client->index;
- 	clients[client->index] = NullClient;
-@@ -3990,3 +4050,60 @@ 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 -urp -x '*~' -x '*.orig' dix/events.c dix/events.c
---- dix/events.c	2006-11-16 10:01:22.000000000 -0800
-+++ dix/events.c	2007-07-30 18:29:34.764143000 -0700
-@@ -139,6 +139,12 @@ extern Bool XkbFilterEvents(ClientPtr, i
- #include "xace.h"
- #endif
- 
-+#ifdef XSERVER_DTRACE
-+#include <sys/types.h>
-+typedef const char *string;
-+#include "Xserver-dtrace.h"
-+#endif
-+
- #ifdef XEVIE
- extern WindowPtr *WindowTable;
- extern int       xevieFlag;
-@@ -4580,6 +4586,14 @@ WriteEventsToClient(ClientPtr pClient, i
- 	eventinfo.count = count;
- 	CallCallbacks(&EventCallback, (pointer)&eventinfo);
-     }
-+#ifdef XSERVER_DTRACE
-+    if (XSERVER_SEND_EVENT_ENABLED()) {
-+	for (i = 0; i < count; i++)
-+	{
-+	    XSERVER_SEND_EVENT(pClient->index, events[i].u.u.type, &events[i]);
-+	}
-+    }
-+#endif	
-     if(pClient->swapped)
-     {
- 	for(i = 0; i < count; i++)
-diff -urp -x '*~' -x '*.orig' dix/extension.c dix/extension.c
---- dix/extension.c	2006-11-16 10:01:23.000000000 -0800
-+++ dix/extension.c	2007-07-30 18:29:34.808650000 -0700
-@@ -482,3 +482,17 @@ RegisterScreenProc(char *name, ScreenPtr
-     }
-     return TRUE;
- }
-+
-+#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 -urp -x '*~' -x '*.orig' dix/resource.c dix/resource.c
---- dix/resource.c	2006-11-16 10:01:23.000000000 -0800
-+++ dix/resource.c	2007-07-30 18:29:34.809719000 -0700
-@@ -72,6 +72,34 @@ dealings in this Software without prior 
- Equipment Corporation.
- 
- ******************************************************************/
-+/* XSERVER_DTRACE additions:
-+ * Copyright 2005-2006 Sun Microsystems, Inc.  All rights reserved.
-+ *
-+ * Permission is hereby granted, free of charge, to any person obtaining a
-+ * copy of this software and associated documentation files (the
-+ * "Software"), to deal in the Software without restriction, including
-+ * without limitation the rights to use, copy, modify, merge, publish,
-+ * distribute, and/or sell copies of the Software, and to permit persons
-+ * to whom the Software is furnished to do so, provided that the above
-+ * copyright notice(s) and this permission notice appear in all copies of
-+ * the Software and that both the above copyright notice(s) and this
-+ * permission notice appear in supporting documentation.
-+ * 
-+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
-+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
-+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
-+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
-+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
-+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-+ * 
-+ * Except as contained in this notice, the name of a copyright holder
-+ * shall not be used in advertising or otherwise to promote the sale, use
-+ * or other dealings in this Software without prior written authorization
-+ * of the copyright holder.
-+ */
- 
- /* $TOG: resource.c /main/41 1998/02/09 14:20:31 kaleb $ */
- 
-@@ -125,6 +153,14 @@ Equipment Corporation.
- #endif
- #include <assert.h>
- 
-+#ifdef XSERVER_DTRACE
-+#include <sys/types.h>
-+typedef const char *string;
-+#include "Xserver-dtrace.h"
-+
-+#define TypeNameString(t) NameForAtom(ResourceNames[t & TypeMask])
-+#endif
-+
- static void RebuildTable(
-     int /*client*/
- );
-@@ -429,6 +465,9 @@ AddResource(XID id, RESTYPE type, pointe
-     register ClientResourceRec *rrec;
-     register ResourcePtr res, *head;
-     	
-+#ifdef XSERVER_DTRACE
-+    XSERVER_RESOURCE_ALLOC(id, type, value, TypeNameString(type));
-+#endif
-     client = CLIENT_ID(id);
-     rrec = &clientTable[client];
-     if (!rrec->buckets)
-@@ -528,6 +567,11 @@ FreeResource(XID id, RESTYPE skipDeleteF
- 	    if (res->id == id)
- 	    {
- 		RESTYPE rtype = res->type;
-+
-+#ifdef XSERVER_DTRACE
-+		XSERVER_RESOURCE_FREE(res->id, res->type,
-+			      res->value, TypeNameString(res->type));
-+#endif		    
- 		*prev = res->next;
- 		elements = --*eltptr;
- 		if (rtype & RC_CACHED)
-@@ -569,6 +613,10 @@ FreeResourceByType(XID id, RESTYPE type,
- 	{
- 	    if (res->id == id && res->type == type)
- 	    {
-+#ifdef XSERVER_DTRACE
-+		XSERVER_RESOURCE_FREE(res->id, res->type,
-+			      res->value, TypeNameString(res->type));
-+#endif		    		    
- 		*prev = res->next;
- 		if (type & RC_CACHED)
- 		    FlushClientCaches(res->id);
-@@ -731,6 +779,10 @@ FreeClientNeverRetainResources(ClientPtr
- 	    RESTYPE rtype = this->type;
- 	    if (rtype & RC_NEVERRETAIN)
- 	    {
-+#ifdef XSERVER_DTRACE
-+		XSERVER_RESOURCE_FREE(this->id, this->type,
-+			      this->value, TypeNameString(this->type));
-+#endif		    
- 		*prev = this->next;
- 		if (rtype & RC_CACHED)
- 		    FlushClientCaches(this->id);
-@@ -777,6 +829,10 @@ FreeClientResources(ClientPtr client)
-         for (this = *head; this; this = *head)
- 	{
- 	    RESTYPE rtype = this->type;
-+#ifdef XSERVER_DTRACE
-+	    XSERVER_RESOURCE_FREE(this->id, this->type,
-+			  this->value, TypeNameString(this->type));
-+#endif		    
- 	    *head = this->next;
- 	    if (rtype & RC_CACHED)
- 		FlushClientCaches(this->id);
-diff -urp -x '*~' -x '*.orig' include/dix-config.h.in include/dix-config.h.in
---- include/dix-config.h.in	2007-01-29 22:03:18.000000000 -0800
-+++ include/dix-config.h.in	2007-07-30 18:29:34.810329000 -0700
-@@ -440,4 +440,10 @@
- /* Have a monotonic clock from clock_gettime() */
- #undef MONOTONIC_CLOCK
- 
-+/* Define to 1 if the DTrace Xserver provider probes should be built in */
-+#undef XSERVER_DTRACE
-+
-+/* Path to XErrorDB file */
-+#undef XERRORDB_PATH
-+
- #endif /* _DIX_CONFIG_H_ */
-diff -urp -x '*~' -x '*.orig' os/Makefile.am os/Makefile.am
---- os/Makefile.am	2006-11-30 17:40:11.000000000 -0800
-+++ os/Makefile.am	2007-07-30 18:29:34.810652000 -0700
-@@ -50,3 +50,15 @@ libcwrapper_la_CFLAGS = \
- 
- EXTRA_DIST = $(K5AUTH_SOURCES) $(SECURERPC_SOURCES) $(INTERNALMALLOC_SOURCES) \
-      $(XCSECURITY_SOURCES) $(XDMCP_SOURCES) $(STRLCAT_SOURCES)
-+
-+if XSERVER_DTRACE
-+# Generate dtrace object code for probes in libos
-+dtrace-os.o: $(top_srcdir)/dix/Xserver.d $(am_libos_la_OBJECTS)
-+	$(DTRACE) -G -C -o $@ -s $(top_srcdir)/dix/Xserver.d .libs/*.o
-+
-+noinst_PROGRAMS = os.O
-+
-+os.O: dtrace-os.o $(am_libos_la_OBJECTS)
-+	ld -r -o $@ dtrace-os.o .libs/*.o
-+
-+endif
-diff -urp -x '*~' -x '*.orig' os/connection.c os/connection.c
---- os/connection.c	2007-02-17 17:37:56.000000000 -0800
-+++ os/connection.c	2007-07-30 18:29:34.811624000 -0700
-@@ -170,6 +170,12 @@ extern __const__ int _nfiles;
- # include <zone.h>
- #endif
- 
-+#ifdef XSERVER_DTRACE
-+# include <sys/types.h>
-+typedef const char *string;
-+# include "../dix/Xserver-dtrace.h"
-+#endif
-+
- int lastfdesc;			/* maximum file descriptor */
- 
- fd_set WellKnownConnections;	/* Listener mask */
-@@ -618,6 +624,10 @@ AuthAudit (ClientPtr client, Bool letin,
-     else {
- 	client_uid_string[0] = '\0';
-     }
-+
-+#ifdef XSERVER_DTRACE
-+  if (auditTrailLevel > 1) {
-+#endif
-     
-     if (proto_n)
- 	AuditF("client %d %s from %s%s\n  Auth name: %.*s ID: %d\n", 
-@@ -627,6 +637,24 @@ AuthAudit (ClientPtr client, Bool letin,
- 	AuditF("client %d %s from %s%s\n", 
- 	       client->index, letin ? "connected" : "rejected", addr,
- 	       client_uid_string);
-+#ifdef XSERVER_DTRACE
-+  }
-+  if (XSERVER_CLIENT_AUTH_ENABLED())
-+  {
-+      ucred_t *peercred = NULL;
-+      pid_t pid = -1;
-+      zoneid_t zid = -1;
-+      
-+      if (getpeerucred(((OsCommPtr)client->osPrivate)->fd, &peercred) >= 0) {
-+	  pid = ucred_getpid(peercred);
-+	  zid = ucred_getzoneid(peercred);
-+	  ucred_free(peercred);
-+      }
-+    
-+      XSERVER_CLIENT_AUTH(client->index, addr, pid, zid);
-+  }
-+#endif	
-+
- }
- 
- XID
-@@ -693,7 +721,9 @@ ClientAuthorized(ClientPtr client, 
- 	    else
- 	    {
- 		auth_id = (XID) 0;
-+#ifndef XSERVER_DTRACE
- 		if (auditTrailLevel > 1)
-+#endif
- 		    AuthAudit(client, TRUE,
- 			(struct sockaddr *) from, fromlen,
- 			proto_n, auth_proto, auth_id);
-@@ -709,7 +739,11 @@ ClientAuthorized(ClientPtr client, 
- 		return "Client is not authorized to connect to Server";
- 	}
-     }
-+#ifdef XSERVER_DTRACE
-+    else
-+#else
-     else if (auditTrailLevel > 1)
-+#endif
-     {
- 	if (_XSERVTransGetPeerAddr (trans_conn,
- 	    &family, &fromlen, &from) != -1)
-@@ -787,6 +821,9 @@ AllocNewConnection (XtransConnInfo trans
-     ErrorF("AllocNewConnection: client index = %d, socket fd = %d\n",
- 	   client->index, fd);
- #endif
-+#ifdef XSERVER_DTRACE
-+    XSERVER_CLIENT_CONNECT(client->index, fd);
-+#endif	
- 
-     return client;
- }