mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-21 21:25:25 +00:00
virprocess: virProcessGetNamespaces() to void
virProcessGetNamespaces() return value is invariant, so change it type and remove all dependent checks. Signed-off-by: Artem Chernyshev <artem.chernyshev@red-soft.ru> Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
88903f9abf
commit
d05cdd1879
@ -140,10 +140,7 @@ virDomainLxcEnterNamespace(virDomainPtr domain,
|
||||
|
||||
if (noldfdlist && oldfdlist) {
|
||||
size_t nfds;
|
||||
if (virProcessGetNamespaces(getpid(),
|
||||
&nfds,
|
||||
oldfdlist) < 0)
|
||||
goto error;
|
||||
virProcessGetNamespaces(getpid(), &nfds, oldfdlist);
|
||||
*noldfdlist = nfds;
|
||||
}
|
||||
|
||||
|
@ -4691,8 +4691,7 @@ static int lxcDomainLxcOpenNamespace(virDomainPtr dom,
|
||||
goto endjob;
|
||||
}
|
||||
|
||||
if (virProcessGetNamespaces(priv->initpid, &nfds, fdlist) < 0)
|
||||
goto endjob;
|
||||
virProcessGetNamespaces(priv->initpid, &nfds, fdlist);
|
||||
|
||||
ret = nfds;
|
||||
|
||||
|
@ -2737,8 +2737,7 @@ qemuProcessStartPRDaemonHook(void *opaque)
|
||||
int ret = -1;
|
||||
|
||||
if (qemuDomainNamespaceEnabled(vm, QEMU_DOMAIN_NS_MOUNT)) {
|
||||
if (virProcessGetNamespaces(vm->pid, &nfds, &fds) < 0)
|
||||
return ret;
|
||||
virProcessGetNamespaces(vm->pid, &nfds, &fds);
|
||||
|
||||
if (nfds > 0 &&
|
||||
virProcessSetNamespaces(nfds, fds) < 0)
|
||||
|
@ -652,9 +652,9 @@ int virProcessGetPids(pid_t pid, size_t *npids, pid_t **pids)
|
||||
}
|
||||
|
||||
|
||||
int virProcessGetNamespaces(pid_t pid,
|
||||
size_t *nfdlist,
|
||||
int **fdlist)
|
||||
void virProcessGetNamespaces(pid_t pid,
|
||||
size_t *nfdlist,
|
||||
int **fdlist)
|
||||
{
|
||||
size_t i = 0;
|
||||
const char *ns[] = { "user", "ipc", "uts", "net", "pid", "mnt" };
|
||||
@ -673,8 +673,6 @@ int virProcessGetNamespaces(pid_t pid,
|
||||
(*fdlist)[(*nfdlist)-1] = fd;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -70,9 +70,9 @@ int virProcessGetPids(pid_t pid, size_t *npids, pid_t **pids);
|
||||
int virProcessGetStartTime(pid_t pid,
|
||||
unsigned long long *timestamp);
|
||||
|
||||
int virProcessGetNamespaces(pid_t pid,
|
||||
size_t *nfdlist,
|
||||
int **fdlist);
|
||||
void virProcessGetNamespaces(pid_t pid,
|
||||
size_t *nfdlist,
|
||||
int **fdlist);
|
||||
|
||||
int virProcessSetNamespaces(size_t nfdlist,
|
||||
int *fdlist);
|
||||
|
Loading…
Reference in New Issue
Block a user