(submit/recv-fds) os: read file descriptors into client struct at once

Instead of having the request handler ask for fd's one by one, just read them
all into a little array in ClientRec struct. And also automatically clean up
after request had been handled.

Request handlers need to set the entries to -1 if they shouldn't be closed
automatically.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2024-07-22 19:43:51 +02:00
parent 9fb7cf9204
commit 0737649fda
7 changed files with 37 additions and 44 deletions

View File

@@ -73,6 +73,9 @@ typedef struct _saveSet {
#define SaveSetAssignToRoot(ss,tr) ((ss).toRoot = (tr))
#define SaveSetAssignMap(ss,m) ((ss).map = (m))
/* currently largest one in use is 4 */
#define MAX_CLIENT_RECV_FD 8
typedef struct _Client {
void *requestBuffer;
void *osPrivate; /* for OS layer, including scheduler */
@@ -110,7 +113,9 @@ typedef struct _Client {
DeviceIntPtr clientPtr;
ClientIdPtr clientIds;
int req_fds;
int recv_fd_count;
int recv_fd_list[MAX_CLIENT_RECV_FD];
} ClientRec;
typedef struct _WorkQueue {