mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-13 17:18:01 +03:00
rpc: remove unused API for creating services from FDs
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 <mprivozn@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
e2f012b8f0
commit
03fd51051e
@ -205,7 +205,6 @@ virNetServerServiceGetMaxRequests;
|
||||
virNetServerServiceGetPort;
|
||||
virNetServerServiceGetTLSContext;
|
||||
virNetServerServiceIsReadonly;
|
||||
virNetServerServiceNewFDOrUNIX;
|
||||
virNetServerServiceNewFDs;
|
||||
virNetServerServiceNewPostExecRestart;
|
||||
virNetServerServiceNewTCP;
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user