Add DTrace probe points for X server <-> client communications
See http://people.freedesktop.org/~alanc/dtrace/ for more details
This commit is contained in:
parent
037f23e6f8
commit
49a26681b2
29
configure.ac
29
configure.ac
|
@ -66,6 +66,26 @@ AC_PROG_YACC
|
|||
AC_SYS_LARGEFILE
|
||||
XORG_PROG_RAWCPP
|
||||
|
||||
dnl Check for dtrace program (needed to build Xserver dtrace probes)
|
||||
AC_ARG_WITH(dtrace, AS_HELP_STRING([--with-dtrace=PATH],
|
||||
[Enable dtrace probes (default: enabled if dtrace found)]),
|
||||
[WDTRACE=$withval], [WDTRACE=auto])
|
||||
if test "x$WDTRACE" = "xyes" -o "x$WDTRACE" = "xauto" ; then
|
||||
AC_PATH_PROG(DTRACE, [dtrace], [not_found], [$PATH:/usr/sbin])
|
||||
if test "x$DTRACE" = "xnot_found" ; then
|
||||
if test "x$WDTRACE" = "xyes" ; then
|
||||
AC_MSG_FAILURE([dtrace requested but not found])
|
||||
fi
|
||||
WDTRACE="no"
|
||||
fi
|
||||
fi
|
||||
if test "x$WDTRACE" != "xno" ; 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$WDTRACE" != "xno"])
|
||||
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])
|
||||
|
@ -873,8 +893,13 @@ AC_DEFINE(XCMISC, 1, [Support XCMisc extension])
|
|||
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'
|
||||
if test "x$WDTRACE" != "xno" ; then
|
||||
DIX_LIB='$(top_builddir)/dix/dix.O'
|
||||
OS_LIB='$(top_builddir)/os/os.O'
|
||||
else
|
||||
DIX_LIB='$(top_builddir)/dix/libdix.la'
|
||||
OS_LIB='$(top_builddir)/os/libos.la'
|
||||
fi
|
||||
CWRAP_LIB='$(top_builddir)/os/libcwrapper.la'
|
||||
MI_LIB='$(top_builddir)/mi/libmi.la'
|
||||
MINIMI_LIB='$(top_builddir)/mi/libminimi.la'
|
||||
|
|
|
@ -38,4 +38,22 @@ libxpstubs_la_SOURCES = \
|
|||
|
||||
INCLUDES = -I$(top_srcdir)/Xprint
|
||||
|
||||
EXTRA_DIST = buildatoms BuiltInAtoms CHANGES
|
||||
EXTRA_DIST = buildatoms BuiltInAtoms CHANGES Xserver.d Xserver-dtrace.h.in
|
||||
|
||||
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 \
|
||||
|| cp Xserver-dtrace.h.in $@
|
||||
|
||||
# Generate dtrace object code for probes in libdix
|
||||
dtrace-dix.o: $(top_srcdir)/dix/Xserver.d $(am_libdix_la_OBJECTS)
|
||||
$(DTRACE) -G -C -o $@ -s $(top_srcdir)/dix/Xserver.d .libs/*.o
|
||||
|
||||
noinst_LIBRARIES = dix.O
|
||||
|
||||
dix.O: dtrace-dix.o $(am_libdix_la_OBJECTS)
|
||||
ld -r -o $@ .libs/*.o
|
||||
endif
|
||||
|
|
|
@ -0,0 +1,100 @@
|
|||
/* Copyright 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Generated by dtrace(1M), and then modified for backwards compatibility
|
||||
* with older versions of dtrace. Used if dtrace -h fails.
|
||||
* (Since _ENABLED support was added after dtrace -h, this assumes if
|
||||
* dtrace -h fails, _ENABLED will too.)
|
||||
*/
|
||||
|
||||
#ifndef _XSERVER_DTRACE_H
|
||||
#define _XSERVER_DTRACE_H
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if _DTRACE_VERSION
|
||||
|
||||
#define XSERVER_CLIENT_AUTH(arg0, arg1, arg2, arg3) \
|
||||
__dtrace_Xserver___client__auth(arg0, arg1, arg2, arg3)
|
||||
#define XSERVER_CLIENT_CONNECT(arg0, arg1) \
|
||||
__dtrace_Xserver___client__connect(arg0, arg1)
|
||||
#define XSERVER_CLIENT_DISCONNECT(arg0) \
|
||||
__dtrace_Xserver___client__disconnect(arg0)
|
||||
#define XSERVER_REQUEST_DONE(arg0, arg1, arg2, arg3, arg4) \
|
||||
__dtrace_Xserver___request__done(arg0, arg1, arg2, arg3, arg4)
|
||||
#define XSERVER_REQUEST_START(arg0, arg1, arg2, arg3, arg4) \
|
||||
__dtrace_Xserver___request__start(arg0, arg1, arg2, arg3, arg4)
|
||||
#define XSERVER_RESOURCE_ALLOC(arg0, arg1, arg2, arg3) \
|
||||
__dtrace_Xserver___resource__alloc(arg0, arg1, arg2, arg3)
|
||||
#define XSERVER_RESOURCE_FREE(arg0, arg1, arg2, arg3) \
|
||||
__dtrace_Xserver___resource__free(arg0, arg1, arg2, arg3)
|
||||
#define XSERVER_SEND_EVENT(arg0, arg1, arg2) \
|
||||
__dtrace_Xserver___send__event(arg0, arg1, arg2)
|
||||
|
||||
|
||||
extern void __dtrace_Xserver___client__auth(int, string, pid_t, zoneid_t);
|
||||
extern void __dtrace_Xserver___client__connect(int, int);
|
||||
extern void __dtrace_Xserver___client__disconnect(int);
|
||||
extern void __dtrace_Xserver___request__done(string, uint8_t, uint32_t, int, int);
|
||||
extern void __dtrace_Xserver___request__start(string, uint8_t, uint16_t, int, void *);
|
||||
extern void __dtrace_Xserver___resource__alloc(uint32_t, uint32_t, void *, string);
|
||||
extern void __dtrace_Xserver___resource__free(uint32_t, uint32_t, void *, string);
|
||||
extern void __dtrace_Xserver___send__event(int, uint8_t, void *);
|
||||
|
||||
#else
|
||||
|
||||
#define XSERVER_CLIENT_AUTH(arg0, arg1, arg2, arg3)
|
||||
#define XSERVER_CLIENT_CONNECT(arg0, arg1)
|
||||
#define XSERVER_CLIENT_DISCONNECT(arg0)
|
||||
#define XSERVER_REQUEST_DONE(arg0, arg1, arg2, arg3, arg4)
|
||||
#define XSERVER_REQUEST_START(arg0, arg1, arg2, arg3, arg4)
|
||||
#define XSERVER_RESOURCE_ALLOC(arg0, arg1, arg2, arg3)
|
||||
#define XSERVER_RESOURCE_FREE(arg0, arg1, arg2, arg3)
|
||||
#define XSERVER_SEND_EVENT(arg0, arg1, arg2)
|
||||
|
||||
#endif
|
||||
|
||||
#define XSERVER_CLIENT_AUTH_ENABLED() (1)
|
||||
#define XSERVER_CLIENT_CONNECT_ENABLED() (1)
|
||||
#define XSERVER_CLIENT_DISCONNECT_ENABLED() (1)
|
||||
#define XSERVER_REQUEST_DONE_ENABLED() (1)
|
||||
#define XSERVER_REQUEST_START_ENABLED() (1)
|
||||
#define XSERVER_RESOURCE_ALLOC_ENABLED() (1)
|
||||
#define XSERVER_RESOURCE_FREE_ENABLED() (1)
|
||||
#define XSERVER_SEND_EVENT_ENABLED() (1)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _XSERVER_DTRACE_H */
|
|
@ -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
|
||||
|
119
dix/dispatch.c
119
dix/dispatch.c
|
@ -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>
|
||||
|
@ -119,6 +149,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)
|
||||
|
@ -373,6 +414,10 @@ Dispatch(void)
|
|||
if (!clientReady)
|
||||
return;
|
||||
|
||||
#ifdef XSERVER_DTRACE
|
||||
LoadRequestNames();
|
||||
#endif
|
||||
|
||||
while (!dispatchException)
|
||||
{
|
||||
if (*icheck[0] != *icheck[1])
|
||||
|
@ -451,6 +496,11 @@ Dispatch(void)
|
|||
client->requestLogIndex = 0;
|
||||
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;
|
||||
|
@ -464,7 +514,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)
|
||||
|
@ -495,6 +549,9 @@ Dispatch(void)
|
|||
KillAllClients();
|
||||
DEALLOCATE_LOCAL(clientReady);
|
||||
dispatchException &= ~DE_RESET;
|
||||
#ifdef XSERVER_DTRACE
|
||||
FreeRequestNames();
|
||||
#endif
|
||||
}
|
||||
|
||||
#undef MAJOROP
|
||||
|
@ -3569,6 +3626,9 @@ CloseDownClient(register ClientPtr client)
|
|||
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;
|
||||
|
@ -3995,3 +4055,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
|
||||
|
|
14
dix/events.c
14
dix/events.c
|
@ -141,6 +141,12 @@ extern Bool XkbFilterEvents(ClientPtr, int, xEvent *);
|
|||
#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;
|
||||
|
@ -4553,6 +4559,14 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
|
|||
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++)
|
||||
|
|
|
@ -482,3 +482,17 @@ RegisterScreenProc(char *name, ScreenPtr pScreen, ExtensionLookupProc proc)
|
|||
}
|
||||
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
|
||||
|
|
|
@ -72,6 +72,34 @@ dealings in this Software without prior written authorization from Digital
|
|||
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, pointer value)
|
|||
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 skipDeleteFuncType)
|
|||
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, Bool skipFree)
|
|||
{
|
||||
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 client)
|
|||
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);
|
||||
|
|
|
@ -460,4 +460,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_ */
|
||||
|
|
|
@ -50,3 +50,15 @@ libcwrapper_la_CFLAGS = \
|
|||
|
||||
EXTRA_DIST = $(K5AUTH_SOURCES) $(SECURERPC_SOURCES) $(INTERNALMALLOC_SOURCES) \
|
||||
$(XCSECURITY_SOURCES) $(XDMCP_SOURCES) $(LBX_SOURCES) $(STRLCAT_SOURCES)
|
||||
|
||||
if XSERVER_DTRACE
|
||||
# Generate dtrace object code for probes in libos & libdix
|
||||
dtrace.o: $(top_srcdir)/dix/Xserver.d $(am_libos_la_OBJECTS)
|
||||
$(DTRACE) -G -C -o $@ -s $(top_srcdir)/dix/Xserver.d .libs/*.o ../dix/.libs/*.o
|
||||
|
||||
noinst_LIBRARIES = os.O
|
||||
|
||||
os.O: dtrace.o $(am_libos_la_OBJECTS)
|
||||
ld -r -o $@ dtrace.o .libs/*.o
|
||||
|
||||
endif
|
||||
|
|
|
@ -170,6 +170,13 @@ extern __const__ int _nfiles;
|
|||
# include <zone.h>
|
||||
#endif
|
||||
|
||||
#ifdef XSERVER_DTRACE
|
||||
# include <sys/types.h>
|
||||
typedef const char *string;
|
||||
# include "../dix/Xserver-dtrace.h"
|
||||
# include <ucred.h>
|
||||
#endif
|
||||
|
||||
int lastfdesc; /* maximum file descriptor */
|
||||
|
||||
fd_set WellKnownConnections; /* Listener mask */
|
||||
|
@ -619,14 +626,22 @@ AuthAudit (ClientPtr client, Bool letin,
|
|||
client_uid_string[0] = '\0';
|
||||
}
|
||||
|
||||
if (proto_n)
|
||||
#ifdef XSERVER_DTRACE
|
||||
XSERVER_CLIENT_AUTH(client->index, addr, client_pid, client_zid);
|
||||
if (auditTrailLevel > 1) {
|
||||
#endif
|
||||
if (proto_n)
|
||||
AuditF("client %d %s from %s%s\n Auth name: %.*s ID: %d\n",
|
||||
client->index, letin ? "connected" : "rejected", addr,
|
||||
client_uid_string, (int)proto_n, auth_proto, auth_id);
|
||||
else
|
||||
else
|
||||
AuditF("client %d %s from %s%s\n",
|
||||
client->index, letin ? "connected" : "rejected", addr,
|
||||
client_uid_string);
|
||||
|
||||
#ifdef XSERVER_DTRACE
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
XID
|
||||
|
@ -693,7 +708,11 @@ ClientAuthorized(ClientPtr client,
|
|||
else
|
||||
{
|
||||
auth_id = (XID) 0;
|
||||
#ifdef XSERVER_DTRACE
|
||||
if ((auditTrailLevel > 1) || XSERVER_CLIENT_AUTH_ENABLED())
|
||||
#else
|
||||
if (auditTrailLevel > 1)
|
||||
#endif
|
||||
AuthAudit(client, TRUE,
|
||||
(struct sockaddr *) from, fromlen,
|
||||
proto_n, auth_proto, auth_id);
|
||||
|
@ -709,7 +728,11 @@ ClientAuthorized(ClientPtr client,
|
|||
return "Client is not authorized to connect to Server";
|
||||
}
|
||||
}
|
||||
#ifdef XSERVER_DTRACE
|
||||
else if ((auditTrailLevel > 1) || XSERVER_CLIENT_AUTH_ENABLED())
|
||||
#else
|
||||
else if (auditTrailLevel > 1)
|
||||
#endif
|
||||
{
|
||||
if (_XSERVTransGetPeerAddr (trans_conn,
|
||||
&family, &fromlen, &from) != -1)
|
||||
|
@ -787,6 +810,9 @@ AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time)
|
|||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue