(submit/split-client.h) os: split off internal definitions from client.h

The client.h file is part of the public module API, but it also contains
definitions that aren't useful for being used in modules. Splitting them
out into their own client_priv.h file, which isn't part of the API.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-02-08 16:03:56 +01:00
parent c04222814e
commit fd77dbfa68
8 changed files with 41 additions and 20 deletions

View File

@ -15,6 +15,7 @@
#include "dix/registry_priv.h" #include "dix/registry_priv.h"
#include "miext/extinit_priv.h" #include "miext/extinit_priv.h"
#include "os/client_priv.h"
#include "misc.h" #include "misc.h"
#include "os.h" #include "os.h"
@ -25,7 +26,6 @@
#include "windowstr.h" #include "windowstr.h"
#include "gcstruct.h" #include "gcstruct.h"
#include "protocol-versions.h" #include "protocol-versions.h"
#include "client.h"
#include "list.h" #include "list.h"
#include "misc.h" #include "misc.h"
#include "hashtable.h" #include "hashtable.h"

View File

@ -36,6 +36,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "dix/registry_priv.h" #include "dix/registry_priv.h"
#include "dix/selection_priv.h" #include "dix/selection_priv.h"
#include "os/client_priv.h"
#include "inputstr.h" #include "inputstr.h"
#include "scrnintstr.h" #include "scrnintstr.h"
@ -43,7 +44,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "propertyst.h" #include "propertyst.h"
#include "extnsionst.h" #include "extnsionst.h"
#include "xacestr.h" #include "xacestr.h"
#include "client.h"
#define _XSELINUX_NEED_FLASK_MAP #define _XSELINUX_NEED_FLASK_MAP
#include "xselinuxint.h" #include "xselinuxint.h"

View File

@ -114,6 +114,7 @@ Equipment Corporation.
#include "include/resource.h" #include "include/resource.h"
#include "miext/extinit_priv.h" #include "miext/extinit_priv.h"
#include "os/auth.h" #include "os/auth.h"
#include "os/client_priv.h"
#include "os/ddx_priv.h" #include "os/ddx_priv.h"
#include "os/osdep.h" #include "os/osdep.h"
@ -134,7 +135,6 @@ Equipment Corporation.
#include "xace.h" #include "xace.h"
#include "inputstr.h" #include "inputstr.h"
#include "xkbsrv.h" #include "xkbsrv.h"
#include "client.h"
#include "xfixesint.h" #include "xfixesint.h"
#include "dixstruct_priv.h" #include "dixstruct_priv.h"

View File

@ -93,6 +93,7 @@ Equipment Corporation.
#include "dix/selection_priv.h" #include "dix/selection_priv.h"
#include "os/audit.h" #include "os/audit.h"
#include "os/auth.h" #include "os/auth.h"
#include "os/client_priv.h"
#include "os/cmdline.h" #include "os/cmdline.h"
#include "os/ddx_priv.h" #include "os/ddx_priv.h"
#include "os/osdep.h" #include "os/osdep.h"
@ -113,7 +114,6 @@ Equipment Corporation.
#include "dixfont.h" #include "dixfont.h"
#include "extnsionst.h" #include "extnsionst.h"
#include "privates.h" #include "privates.h"
#include "client.h"
#include "exevents.h" #include "exevents.h"
#ifdef PANORAMIX #ifdef PANORAMIX
#include "panoramiXsrv.h" #include "panoramiXsrv.h"

View File

@ -29,22 +29,12 @@
#ifdef HAVE_DIX_CONFIG_H #ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h> #include <dix-config.h>
#endif /* HAVE_DIX_CONFIG_H */ #endif /* HAVE_DIX_CONFIG_H */
#include <X11/Xfuncproto.h>
#include <sys/types.h>
/* Client IDs. Use GetClientPid, GetClientCmdName and GetClientCmdArgs #include <sys/types.h>
* instead of accessing the fields directly. */ #include <X11/Xfuncproto.h>
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; struct _Client;
typedef struct _ClientId *ClientIdPtr;
/* Initialize and clean up. */
void ReserveClientIds(struct _Client *client);
void ReleaseClientIds(struct _Client *client);
/* Determine client IDs for caching. Exported on purpose for /* Determine client IDs for caching. Exported on purpose for
* extensions such as SELinux. */ * extensions such as SELinux. */

View File

@ -76,6 +76,8 @@ typedef struct _saveSet {
/* currently largest one in use is 4 */ /* currently largest one in use is 4 */
#define MAX_CLIENT_RECV_FD 8 #define MAX_CLIENT_RECV_FD 8
struct _ClientId;
typedef struct _Client { typedef struct _Client {
void *requestBuffer; void *requestBuffer;
void *osPrivate; /* for OS layer, including scheduler */ void *osPrivate; /* for OS layer, including scheduler */
@ -112,7 +114,7 @@ typedef struct _Client {
int smart_stop_tick; int smart_stop_tick;
DeviceIntPtr clientPtr; DeviceIntPtr clientPtr;
ClientIdPtr clientIds; struct _ClientId *clientIds;
int recv_fd_count; int recv_fd_count;
int recv_fd_list[MAX_CLIENT_RECV_FD]; int recv_fd_list[MAX_CLIENT_RECV_FD];

View File

@ -50,12 +50,14 @@
* *
* Author: Rami Ylimäki <rami.ylimaki@vincit.fi> * Author: Rami Ylimäki <rami.ylimaki@vincit.fi>
*/ */
#include <dix-config.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#include "client.h" #include "os/client_priv.h"
#include "os.h" #include "os.h"
#include "dixstruct.h" #include "dixstruct.h"
@ -445,7 +447,7 @@ ReserveClientIds(struct _Client *client)
return; return;
assert(!client->clientIds); assert(!client->clientIds);
client->clientIds = calloc(1, sizeof(ClientIdRec)); client->clientIds = calloc(1, sizeof(struct _ClientId));
if (!client->clientIds) if (!client->clientIds)
return; return;

27
os/client_priv.h Normal file
View File

@ -0,0 +1,27 @@
/* SPDX-License-Identifier: MIT OR X11
*
* Copyright © 2024 Enrico Weigelt, metux IT consult <info@metux.net>
* Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies).
*/
#ifndef _XSERVER_DIX_CLIENT_PRIV_H
#define _XSERVER_DIX_CLIENT_PRIV_H
#include <sys/types.h>
#include "client.h"
/* Client IDs. Use GetClientPid, GetClientCmdName and GetClientCmdArgs
* instead of accessing the fields directly. */
struct _ClientId {
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 */
};
struct _Client;
/* Initialize and clean up. */
void ReserveClientIds(struct _Client *client);
void ReleaseClientIds(struct _Client *client);
#endif /* _XSERVER_DIX_CLIENT_PRIV_H */