summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2013-11-07 15:18:28 -0800
committerKeith Packard <keithp@keithp.com>2013-11-11 15:32:07 -0800
commitfc84166e65c35ad75f566b135dcfc305ad5a2fde (patch)
treed7070f8ac19aaece98245af234b8df76246ea116
parenta239e6faf3fce848ac0d10c48f8e817db68a493c (diff)
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>
-rw-r--r--include/dixstruct.h4
-rw-r--r--include/os.h2
-rw-r--r--os/io.c4
3 files changed, 10 insertions, 0 deletions
diff --git a/include/dixstruct.h b/include/dixstruct.h
index 456e63360..6f5667fcb 100644
--- a/include/dixstruct.h
+++ b/include/dixstruct.h
@@ -110,15 +110,19 @@ typedef struct _Client {
DeviceIntPtr clientPtr;
ClientIdPtr clientIds;
+#if XTRANS_SEND_FDS
int req_fds;
+#endif
} ClientRec;
+#if XTRANS_SEND_FDS
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;
}
+#endif
/*
* Scheduling interface
diff --git a/include/os.h b/include/os.h
index 11b219845..450e1a8e8 100644
--- a/include/os.h
+++ b/include/os.h
@@ -98,9 +98,11 @@ extern _X_EXPORT int WaitForSomething(int * /*pClientsReady */
extern _X_EXPORT int ReadRequestFromClient(ClientPtr /*client */ );
+#if XTRANS_SEND_FDS
extern _X_EXPORT int ReadFdFromClient(ClientPtr client);
extern _X_EXPORT int WriteFdToClient(ClientPtr client, int fd, Bool do_close);
+#endif
extern _X_EXPORT Bool InsertFakeRequest(ClientPtr /*client */ ,
char * /*data */ ,
diff --git a/os/io.c b/os/io.c
index a20faa56f..922a8eb02 100644
--- a/os/io.c
+++ b/os/io.c
@@ -259,12 +259,14 @@ ReadRequestFromClient(ClientPtr client)
oc->input = oci;
}
+#if XTRANS_SEND_FDS
/* Discard any unused file descriptors */
while (client->req_fds > 0) {
int req_fd = ReadFdFromClient(client);
if (req_fd >= 0)
close(req_fd);
}
+#endif
/* advance to start of next request */
oci->bufptr += oci->lenLastReq;
@@ -491,6 +493,7 @@ ReadRequestFromClient(ClientPtr client)
return needed;
}
+#if XTRANS_SEND_FDS
int
ReadFdFromClient(ClientPtr client)
{
@@ -513,6 +516,7 @@ WriteFdToClient(ClientPtr client, int fd, Bool do_close)
return _XSERVTransSendFd(oc->trans_conn, fd, do_close);
}
+#endif
/*****************************************************************
* InsertFakeRequest