mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35: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) {
|
if (noldfdlist && oldfdlist) {
|
||||||
size_t nfds;
|
size_t nfds;
|
||||||
if (virProcessGetNamespaces(getpid(),
|
virProcessGetNamespaces(getpid(), &nfds, oldfdlist);
|
||||||
&nfds,
|
|
||||||
oldfdlist) < 0)
|
|
||||||
goto error;
|
|
||||||
*noldfdlist = nfds;
|
*noldfdlist = nfds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4691,8 +4691,7 @@ static int lxcDomainLxcOpenNamespace(virDomainPtr dom,
|
|||||||
goto endjob;
|
goto endjob;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virProcessGetNamespaces(priv->initpid, &nfds, fdlist) < 0)
|
virProcessGetNamespaces(priv->initpid, &nfds, fdlist);
|
||||||
goto endjob;
|
|
||||||
|
|
||||||
ret = nfds;
|
ret = nfds;
|
||||||
|
|
||||||
|
@ -2737,8 +2737,7 @@ qemuProcessStartPRDaemonHook(void *opaque)
|
|||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
if (qemuDomainNamespaceEnabled(vm, QEMU_DOMAIN_NS_MOUNT)) {
|
if (qemuDomainNamespaceEnabled(vm, QEMU_DOMAIN_NS_MOUNT)) {
|
||||||
if (virProcessGetNamespaces(vm->pid, &nfds, &fds) < 0)
|
virProcessGetNamespaces(vm->pid, &nfds, &fds);
|
||||||
return ret;
|
|
||||||
|
|
||||||
if (nfds > 0 &&
|
if (nfds > 0 &&
|
||||||
virProcessSetNamespaces(nfds, fds) < 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,
|
void virProcessGetNamespaces(pid_t pid,
|
||||||
size_t *nfdlist,
|
size_t *nfdlist,
|
||||||
int **fdlist)
|
int **fdlist)
|
||||||
{
|
{
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
const char *ns[] = { "user", "ipc", "uts", "net", "pid", "mnt" };
|
const char *ns[] = { "user", "ipc", "uts", "net", "pid", "mnt" };
|
||||||
@ -673,8 +673,6 @@ int virProcessGetNamespaces(pid_t pid,
|
|||||||
(*fdlist)[(*nfdlist)-1] = fd;
|
(*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,
|
int virProcessGetStartTime(pid_t pid,
|
||||||
unsigned long long *timestamp);
|
unsigned long long *timestamp);
|
||||||
|
|
||||||
int virProcessGetNamespaces(pid_t pid,
|
void virProcessGetNamespaces(pid_t pid,
|
||||||
size_t *nfdlist,
|
size_t *nfdlist,
|
||||||
int **fdlist);
|
int **fdlist);
|
||||||
|
|
||||||
int virProcessSetNamespaces(size_t nfdlist,
|
int virProcessSetNamespaces(size_t nfdlist,
|
||||||
int *fdlist);
|
int *fdlist);
|
||||||
|
Loading…
Reference in New Issue
Block a user