From 03fd51051eb8771be6ca598843ef763989348869 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Mon, 24 Jun 2019 11:52:40 +0100 Subject: [PATCH] rpc: remove unused API for creating services from FDs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The virNetServerServiceNewFDOrUNIX method cannot be correctly used when dealing with systemd activation of a service which can receive more than one socket FD as there is not guaranteed ordering of FDs. Reviewed-by: Michal Privoznik Signed-off-by: Daniel P. Berrangé --- src/libvirt_remote.syms | 1 - src/rpc/virnetserverservice.c | 46 ----------------------------------- src/rpc/virnetserverservice.h | 10 -------- 3 files changed, 57 deletions(-) diff --git a/src/libvirt_remote.syms b/src/libvirt_remote.syms index 386137c0d8..3307d74324 100644 --- a/src/libvirt_remote.syms +++ b/src/libvirt_remote.syms @@ -205,7 +205,6 @@ virNetServerServiceGetMaxRequests; virNetServerServiceGetPort; virNetServerServiceGetTLSContext; virNetServerServiceIsReadonly; -virNetServerServiceNewFDOrUNIX; virNetServerServiceNewFDs; virNetServerServiceNewPostExecRestart; virNetServerServiceNewTCP; diff --git a/src/rpc/virnetserverservice.c b/src/rpc/virnetserverservice.c index d5df5d5c20..66af27d9f7 100644 --- a/src/rpc/virnetserverservice.c +++ b/src/rpc/virnetserverservice.c @@ -88,52 +88,6 @@ static void virNetServerServiceAccept(virNetSocketPtr sock, } -virNetServerServicePtr -virNetServerServiceNewFDOrUNIX(const char *path, - mode_t mask, - gid_t grp, - int auth, - virNetTLSContextPtr tls, - bool readonly, - size_t max_queued_clients, - size_t nrequests_client_max, - unsigned int nfds, - unsigned int *cur_fd) -{ - if (*cur_fd - STDERR_FILENO > nfds) { - /* - * There are no more file descriptors to use, so we have to - * fallback to UNIX socket. - */ - return virNetServerServiceNewUNIX(path, - mask, - grp, - auth, - tls, - readonly, - max_queued_clients, - nrequests_client_max); - - } else { - int fds[] = {(*cur_fd)++}; - /* - * There's still enough file descriptors. In this case we'll - * use the current one and increment it afterwards. Take care - * with order of operation for pointer arithmetic and auto - * increment on cur_fd - the parentheses are necessary. - */ - return virNetServerServiceNewFDs(fds, - ARRAY_CARDINALITY(fds), - false, - auth, - tls, - readonly, - max_queued_clients, - nrequests_client_max); - } -} - - static virNetServerServicePtr virNetServerServiceNewSocket(virNetSocketPtr *socks, size_t nsocks, diff --git a/src/rpc/virnetserverservice.h b/src/rpc/virnetserverservice.h index 73d61dde99..d58fc43437 100644 --- a/src/rpc/virnetserverservice.h +++ b/src/rpc/virnetserverservice.h @@ -34,16 +34,6 @@ typedef int (*virNetServerServiceDispatchFunc)(virNetServerServicePtr svc, virNetSocketPtr sock, void *opaque); -virNetServerServicePtr virNetServerServiceNewFDOrUNIX(const char *path, - mode_t mask, - gid_t grp, - int auth, - virNetTLSContextPtr tls, - bool readonly, - size_t max_queued_clients, - size_t nrequests_client_max, - unsigned int nfds, - unsigned int *cur_fd); virNetServerServicePtr virNetServerServiceNewTCP(const char *nodename, const char *service, int family,