Get rid of the rest of the FD passing code when XTRANS_SEND_FDS isn't set
req_fds and SetReqFds in include/dixstruct.h ReadFdFromClient, WriteFdToClient and the FD flushing in os/io.c Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
a239e6faf3
commit
fc84166e65
|
@ -110,15 +110,19 @@ typedef struct _Client {
|
||||||
|
|
||||||
DeviceIntPtr clientPtr;
|
DeviceIntPtr clientPtr;
|
||||||
ClientIdPtr clientIds;
|
ClientIdPtr clientIds;
|
||||||
|
#if XTRANS_SEND_FDS
|
||||||
int req_fds;
|
int req_fds;
|
||||||
|
#endif
|
||||||
} ClientRec;
|
} ClientRec;
|
||||||
|
|
||||||
|
#if XTRANS_SEND_FDS
|
||||||
static inline void
|
static inline void
|
||||||
SetReqFds(ClientPtr client, int req_fds) {
|
SetReqFds(ClientPtr client, int req_fds) {
|
||||||
if (client->req_fds != 0 && req_fds != client->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);
|
LogMessage(X_ERROR, "Mismatching number of request fds %d != %d\n", req_fds, client->req_fds);
|
||||||
client->req_fds = req_fds;
|
client->req_fds = req_fds;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Scheduling interface
|
* Scheduling interface
|
||||||
|
|
|
@ -98,9 +98,11 @@ extern _X_EXPORT int WaitForSomething(int * /*pClientsReady */
|
||||||
|
|
||||||
extern _X_EXPORT int ReadRequestFromClient(ClientPtr /*client */ );
|
extern _X_EXPORT int ReadRequestFromClient(ClientPtr /*client */ );
|
||||||
|
|
||||||
|
#if XTRANS_SEND_FDS
|
||||||
extern _X_EXPORT int ReadFdFromClient(ClientPtr client);
|
extern _X_EXPORT int ReadFdFromClient(ClientPtr client);
|
||||||
|
|
||||||
extern _X_EXPORT int WriteFdToClient(ClientPtr client, int fd, Bool do_close);
|
extern _X_EXPORT int WriteFdToClient(ClientPtr client, int fd, Bool do_close);
|
||||||
|
#endif
|
||||||
|
|
||||||
extern _X_EXPORT Bool InsertFakeRequest(ClientPtr /*client */ ,
|
extern _X_EXPORT Bool InsertFakeRequest(ClientPtr /*client */ ,
|
||||||
char * /*data */ ,
|
char * /*data */ ,
|
||||||
|
|
4
os/io.c
4
os/io.c
|
@ -259,12 +259,14 @@ ReadRequestFromClient(ClientPtr client)
|
||||||
oc->input = oci;
|
oc->input = oci;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if XTRANS_SEND_FDS
|
||||||
/* Discard any unused file descriptors */
|
/* Discard any unused file descriptors */
|
||||||
while (client->req_fds > 0) {
|
while (client->req_fds > 0) {
|
||||||
int req_fd = ReadFdFromClient(client);
|
int req_fd = ReadFdFromClient(client);
|
||||||
if (req_fd >= 0)
|
if (req_fd >= 0)
|
||||||
close(req_fd);
|
close(req_fd);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
/* advance to start of next request */
|
/* advance to start of next request */
|
||||||
|
|
||||||
oci->bufptr += oci->lenLastReq;
|
oci->bufptr += oci->lenLastReq;
|
||||||
|
@ -491,6 +493,7 @@ ReadRequestFromClient(ClientPtr client)
|
||||||
return needed;
|
return needed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if XTRANS_SEND_FDS
|
||||||
int
|
int
|
||||||
ReadFdFromClient(ClientPtr client)
|
ReadFdFromClient(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
@ -513,6 +516,7 @@ WriteFdToClient(ClientPtr client, int fd, Bool do_close)
|
||||||
|
|
||||||
return _XSERVTransSendFd(oc->trans_conn, fd, do_close);
|
return _XSERVTransSendFd(oc->trans_conn, fd, do_close);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*****************************************************************
|
/*****************************************************************
|
||||||
* InsertFakeRequest
|
* InsertFakeRequest
|
||||||
|
|
Loading…
Reference in New Issue