summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-03-03 13:42:07 -0800
committerKeith Packard <keithp@keithp.com>2011-03-03 13:42:07 -0800
commit8e4c3ce55b0f186bc6ba4039e30629669b6087b7 (patch)
treec8cd39e320d50f8c5570bc7c0e57a40854868d2e /include
parentf3d19c0cf3327cceb90f7378f5d8fc0c3e327400 (diff)
parent296561506a91742cc150a0fb6fc0df5dbe98c780 (diff)
Merge remote branch 'rjy/clientids'
Diffstat (limited to 'include')
-rw-r--r--include/Makefile.am1
-rw-r--r--include/client.h59
-rw-r--r--include/dix-config.h.in3
-rw-r--r--include/dixstruct.h2
4 files changed, 65 insertions, 0 deletions
diff --git a/include/Makefile.am b/include/Makefile.am
index 42f008269..6f63c764f 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -3,6 +3,7 @@ sdk_HEADERS = \
XIstubs.h \
Xprintf.h \
callback.h \
+ client.h \
closestr.h \
closure.h \
colormap.h \
diff --git a/include/client.h b/include/client.h
new file mode 100644
index 000000000..aaafc7da6
--- /dev/null
+++ b/include/client.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 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, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * 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. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/* Author: Rami Ylimäki <rami.ylimaki@vincit.fi> */
+
+#ifndef CLIENT_H
+#define CLIENT_H
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif /* HAVE_DIX_CONFIG_H */
+#include <X11/Xfuncproto.h>
+#include <sys/types.h>
+
+/* Client IDs. Use GetClientPid, GetClientCmdName and GetClientCmdArgs
+ * instead of accessing the fields directly. */
+typedef struct {
+ pid_t pid; /* process ID, -1 if not available */
+ const char *cmdname; /* process name, NULL if not available */
+ const char *cmdargs; /* process arguments, NULL if not available */
+} ClientIdRec, *ClientIdPtr;
+
+struct _Client;
+
+/* Initialize and clean up. */
+void ReserveClientIds(struct _Client *client);
+void ReleaseClientIds(struct _Client *client);
+
+/* Determine client IDs for caching. Exported on purpose for
+ * extensions such as SELinux. */
+extern _X_EXPORT pid_t DetermineClientPid(struct _Client *client);
+extern _X_EXPORT void DetermineClientCmd(pid_t, const char **cmdname, const char **cmdargs);
+
+/* Query cached client IDs. Exported on purpose for drivers. */
+extern _X_EXPORT pid_t GetClientPid(struct _Client *client);
+extern _X_EXPORT const char *GetClientCmdName(struct _Client *client);
+extern _X_EXPORT const char *GetClientCmdArgs(struct _Client *client);
+
+#endif /* CLIENT_H */
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index 5622766b8..fc93f3ec1 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -279,6 +279,9 @@
/* Support X resource extension */
#undef RES
+/* Support client ID tracking in X resource extension */
+#undef CLIENTIDS
+
/* Support MIT-SCREEN-SAVER extension */
#undef SCREENSAVER
diff --git a/include/dixstruct.h b/include/dixstruct.h
index 8547b16ce..443e8b0ae 100644
--- a/include/dixstruct.h
+++ b/include/dixstruct.h
@@ -24,6 +24,7 @@ SOFTWARE.
#ifndef DIXSTRUCT_H
#define DIXSTRUCT_H
+#include "client.h"
#include "dix.h"
#include "resource.h"
#include "cursor.h"
@@ -121,6 +122,7 @@ typedef struct _Client {
long smart_check_tick;
DeviceIntPtr clientPtr;
+ ClientIdPtr clientIds;
} ClientRec;
/*