mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 18:54:38 +00:00
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>
This commit is contained in:
@@ -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
|
||||
*/
|
||||
|
||||
@@ -98,6 +98,8 @@ extern _X_EXPORT int WaitForSomething(int * /*pClientsReady */
|
||||
|
||||
extern _X_EXPORT int ReadRequestFromClient(ClientPtr /*client */ );
|
||||
|
||||
extern _X_EXPORT int ReadFdFromClient(ClientPtr client);
|
||||
|
||||
extern _X_EXPORT Bool InsertFakeRequest(ClientPtr /*client */ ,
|
||||
char * /*data */ ,
|
||||
int /*count */ );
|
||||
|
||||
Reference in New Issue
Block a user