diff options
author | Keith Packard <keithp@keithp.com> | 2013-01-17 13:43:02 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2013-10-31 16:58:25 -0700 |
commit | 9fd35daa3160fd36f00ed354bfcbefefa1353cce (patch) | |
tree | 26c9cb45b4302c46b2edd8206a5bf7e3b7cbdd47 /include/dixstruct.h | |
parent | 264fc3abe5f18341d0cf9ddb6766e10e4154e447 (diff) |
Add interfaces to get FDs from clients over the socket
This adds two interfaces:
void SetReqFds(ClientPtr client, int req_fds)
Marks the number of file descriptors expected for this
request. Call this before any request processing so that
any un-retrieved file descriptors will be closed
automatically.
int ReadFdFromClient(ClientPtr client)
Reads the next queued file descriptor from the connection. If
this request is not expecting any more file descriptors, or
if there are no more file descriptors available from the
connection, then this will return -1.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'include/dixstruct.h')
-rw-r--r-- | include/dixstruct.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/dixstruct.h b/include/dixstruct.h index 7711cde99..456e63360 100644 --- a/include/dixstruct.h +++ b/include/dixstruct.h @@ -110,8 +110,16 @@ typedef struct _Client { DeviceIntPtr clientPtr; ClientIdPtr clientIds; + int req_fds; } ClientRec; +static inline void +SetReqFds(ClientPtr client, int req_fds) { + if (client->req_fds != 0 && req_fds != client->req_fds) + LogMessage(X_ERROR, "Mismatching number of request fds %d != %d\n", req_fds, client->req_fds); + client->req_fds = req_fds; +} + /* * Scheduling interface */ |