1 | /*
|
---|
2 | * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). All
|
---|
3 | * rights reserved.
|
---|
4 | *
|
---|
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
|
---|
6 | * of this software and associated documentation files (the "Software"), to deal
|
---|
7 | * in the Software without restriction, including without limitation the rights
|
---|
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
---|
9 | * copies of the Software, and to permit persons to whom the Software is
|
---|
10 | * furnished to do so, subject to the following conditions:
|
---|
11 | *
|
---|
12 | * The above copyright notice and this permission notice shall be included in
|
---|
13 | * all copies or substantial portions of the Software.
|
---|
14 | *
|
---|
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
---|
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
---|
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
---|
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
---|
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
---|
21 | * THE SOFTWARE.
|
---|
22 | */
|
---|
23 |
|
---|
24 | /* Author: Rami Ylimäki <rami.ylimaki@vincit.fi> */
|
---|
25 |
|
---|
26 | #ifndef CLIENT_H
|
---|
27 | #define CLIENT_H
|
---|
28 |
|
---|
29 | #ifdef HAVE_DIX_CONFIG_H
|
---|
30 | #include <dix-config.h>
|
---|
31 | #endif /* HAVE_DIX_CONFIG_H */
|
---|
32 | #include <X11/Xfuncproto.h>
|
---|
33 | #include <sys/types.h>
|
---|
34 |
|
---|
35 | /* Client IDs. Use GetClientPid, GetClientCmdName and GetClientCmdArgs
|
---|
36 | * instead of accessing the fields directly. */
|
---|
37 | typedef struct {
|
---|
38 | pid_t pid; /* process ID, -1 if not available */
|
---|
39 | const char *cmdname; /* process name, NULL if not available */
|
---|
40 | const char *cmdargs; /* process arguments, NULL if not available */
|
---|
41 | } ClientIdRec, *ClientIdPtr;
|
---|
42 |
|
---|
43 | struct _Client;
|
---|
44 |
|
---|
45 | /* Initialize and clean up. */
|
---|
46 | void ReserveClientIds(struct _Client *client);
|
---|
47 | void ReleaseClientIds(struct _Client *client);
|
---|
48 |
|
---|
49 | /* Determine client IDs for caching. Exported on purpose for
|
---|
50 | * extensions such as SELinux. */
|
---|
51 | extern _X_EXPORT pid_t DetermineClientPid(struct _Client *client);
|
---|
52 | extern _X_EXPORT void DetermineClientCmd(pid_t, const char **cmdname,
|
---|
53 | const char **cmdargs);
|
---|
54 |
|
---|
55 | /* Query cached client IDs. Exported on purpose for drivers. */
|
---|
56 | extern _X_EXPORT pid_t GetClientPid(struct _Client *client);
|
---|
57 | extern _X_EXPORT const char *GetClientCmdName(struct _Client *client);
|
---|
58 | extern _X_EXPORT const char *GetClientCmdArgs(struct _Client *client);
|
---|
59 |
|
---|
60 | #endif /* CLIENT_H */
|
---|