mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
util: Fix stubs for virProcessGet{Stat,Sched}Info()
Commit d73852c49962 moved the original QEMU-specific helpers to the utils module, which resulted in build failures on non-Unix platforms due to the unconditional use of Unix-only symbols such as _SC_CLK_TCK. To deal with that situation, commit d7c64453aa0e made the helpers Linux-only and added stubs for other platforms that, when called, would always fail with ENOSYS. However the original helpers had been carefully written so that, while they would only be able to produce useful output on Linux, they would still succeed on the other Unix platforms where we build the QEMU driver. Restore the original behavior so that calling APIs such as virDomainGetInfo() can once again work on FreeBSD and macOS. Resolves: https://gitlab.com/libvirt/libvirt/-/issues/298 Signed-off-by: Andrea Bolognani <abologna@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
48b9a6ae31
commit
8f651ad4d2
@ -1875,23 +1875,34 @@ virProcessGetSchedInfo(unsigned long long *cpuWait,
|
||||
|
||||
#else
|
||||
int
|
||||
virProcessGetStatInfo(unsigned long long *cpuTime G_GNUC_UNUSED,
|
||||
int *lastCpu G_GNUC_UNUSED,
|
||||
long *vm_rss G_GNUC_UNUSED,
|
||||
virProcessGetStatInfo(unsigned long long *cpuTime,
|
||||
int *lastCpu,
|
||||
long *vm_rss,
|
||||
pid_t pid G_GNUC_UNUSED,
|
||||
pid_t tid G_GNUC_UNUSED)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
/* We don't have a way to collect this information on non-Linux
|
||||
* platforms, so just report neutral values */
|
||||
if (cpuTime)
|
||||
*cpuTime = 0;
|
||||
if (lastCpu)
|
||||
*lastCpu = 0;
|
||||
if (vm_rss)
|
||||
*vm_rss = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
virProcessGetSchedInfo(unsigned long long *cpuWait G_GNUC_UNUSED,
|
||||
virProcessGetSchedInfo(unsigned long long *cpuWait,
|
||||
pid_t pid G_GNUC_UNUSED,
|
||||
pid_t tid G_GNUC_UNUSED)
|
||||
{
|
||||
virReportSystemError(ENOSYS, "%s",
|
||||
_("scheduler information is not supported on this platform"));
|
||||
return -1;
|
||||
/* We don't have a way to collect this information on non-Linux
|
||||
* platforms, so just report neutral values */
|
||||
if (cpuWait)
|
||||
*cpuWait = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* __linux__ */
|
||||
|
Loading…
x
Reference in New Issue
Block a user