diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2011-12-13 14:19:54 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2011-12-13 14:19:54 +1000 |
commit | 7528a6b88eb32098af4369a8bd9d70a808fa6f1c (patch) | |
tree | 7c070cba51914690c3e858199aeef4ff491587f4 | |
parent | f0de5e3990b70df9899b7dd17d7ee6ff7c768183 (diff) | |
parent | 898d97672907a8074031d0d1038cd44bb5caf40d (diff) |
Merge branch 'for-whot' of git://people.freedesktop.org/~alanc/xserver into for-keith
-rw-r--r-- | dix/events.c | 2 | ||||
-rw-r--r-- | dix/grabs.c | 35 | ||||
-rw-r--r-- | dix/inpututils.c | 2 | ||||
-rw-r--r-- | include/inputstr.h | 2 |
4 files changed, 29 insertions, 12 deletions
diff --git a/dix/events.c b/dix/events.c index 653813966..8dff29973 100644 --- a/dix/events.c +++ b/dix/events.c @@ -190,7 +190,7 @@ core_get_type(const xEvent *event) static inline int xi2_get_type(const xEvent *event) { - xGenericEvent* e = (xGenericEvent*)event; + const xGenericEvent* e = (const xGenericEvent*)event; return (e->type != GenericEvent || e->extension != IReqCode) ? 0 : e->evtype; } diff --git a/dix/grabs.c b/dix/grabs.c index 6f8b39e49..da014dfc3 100644 --- a/dix/grabs.c +++ b/dix/grabs.c @@ -62,6 +62,7 @@ SOFTWARE. #include "exevents.h" #include "exglobals.h" #include "inpututils.h" +#include "client.h" #define BITMASK(i) (((Mask)1) << ((i) & 31)) #define MASKIDX(i) ((i) >> 5) @@ -78,25 +79,41 @@ PrintDeviceGrabInfo(DeviceIntPtr dev) int i, j; GrabInfoPtr devGrab = &dev->deviceGrab; GrabPtr grab = devGrab->grab; + Bool clientIdPrinted = FALSE; - ErrorF("Active grab 0x%lx (%s) on device '%s' (%d):", + ErrorF("Active grab 0x%lx (%s) on device '%s' (%d):\n", (unsigned long) grab->resource, (grab->grabtype == XI2) ? "xi2" : ((grab->grabtype == CORE) ? "core" : "xi1"), dev->name, dev->id); client = clients[CLIENT_ID(grab->resource)]; - if (client && GetLocalClientCreds(client, &lcc) != -1) + if (client) { - ErrorF(" client pid %ld uid %ld gid %ld\n", - (lcc->fieldsSet & LCC_PID_SET) ? (long) lcc->pid : 0, - (lcc->fieldsSet & LCC_UID_SET) ? (long) lcc->euid : 0, - (lcc->fieldsSet & LCC_GID_SET) ? (long) lcc->egid : 0); - FreeLocalClientCreds(lcc); + pid_t clientpid = GetClientPid(client); + const char *cmdname = GetClientCmdName(client); + const char *cmdargs = GetClientCmdArgs(client); + + if ((clientpid > 0) && (cmdname != NULL)) + { + ErrorF(" client pid %ld %s %s\n", + (long) clientpid, cmdname, cmdargs ? cmdargs : ""); + clientIdPrinted = TRUE; + } + else if (GetLocalClientCreds(client, &lcc) != -1) + { + ErrorF(" client pid %ld uid %ld gid %ld\n", + (lcc->fieldsSet & LCC_PID_SET) ? (long) lcc->pid : 0, + (lcc->fieldsSet & LCC_UID_SET) ? (long) lcc->euid : 0, + (lcc->fieldsSet & LCC_GID_SET) ? (long) lcc->egid : 0); + FreeLocalClientCreds(lcc); + clientIdPrinted = TRUE; + } } - else + if (!clientIdPrinted) { - ErrorF(" (no client information available)\n"); + ErrorF(" (no client information available for client %d)\n", + CLIENT_ID(grab->resource)); } /* XXX is this even correct? */ diff --git a/dix/inpututils.c b/dix/inpututils.c index 9232bdc29..8cd4d5921 100644 --- a/dix/inpututils.c +++ b/dix/inpututils.c @@ -626,7 +626,7 @@ void verify_internal_event(const InternalEvent *ev) if (ev && ev->any.header != ET_Internal) { int i; - unsigned char *data = (unsigned char*)ev; + const unsigned char *data = (const unsigned char*)ev; ErrorF("dix: invalid event type %d\n", ev->any.header); diff --git a/include/inputstr.h b/include/inputstr.h index 754a3f850..5aae1b512 100644 --- a/include/inputstr.h +++ b/include/inputstr.h @@ -57,7 +57,7 @@ SOFTWARE. #include "geext.h" #include "privates.h" -#define BitIsOn(ptr, bit) (!!(((BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7)))) +#define BitIsOn(ptr, bit) (!!(((const BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7)))) #define SetBit(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] |= (1 << ((bit) & 7))) #define ClearBit(ptr, bit) (((BYTE *)(ptr))[(bit)>>3] &= ~(1 << ((bit) & 7))) extern _X_EXPORT int CountBits(const uint8_t *mask, int len); |