]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virprocess: Provide non-Linux stubs for virProcessGet{Stat,Sched}Info
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 6 Jan 2022 19:13:08 +0000 (20:13 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 7 Jan 2022 11:13:12 +0000 (12:13 +0100)
Both virProcessGetStatInfo() and virProcessGetSchedInfo() are
Linux centric. Provide stubs for non-Linux platforms.

Fixes: d73852c49962fbfe652fc7bec595a3f242faf847
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/util/virprocess.c

index c74bd16fe61c5725df464f42ac69fe2befa25d0f..5788faea9c8582f4cb41d26f78c1ad3ebbba065d 100644 (file)
@@ -1766,6 +1766,7 @@ virProcessGetStat(pid_t pid,
 }
 
 
+#ifdef __linux__
 int
 virProcessGetStatInfo(unsigned long long *cpuTime,
                       int *lastCpu,
@@ -1873,3 +1874,26 @@ virProcessGetSchedInfo(unsigned long long *cpuWait,
 
     return 0;
 }
+
+#else
+int
+virProcessGetStatInfo(unsigned long long *cpuTime G_GNUC_UNUSED,
+                      int *lastCpu G_GNUC_UNUSED,
+                      long *vm_rss G_GNUC_UNUSED,
+                      pid_t pid G_GNUC_UNUSED,
+                      pid_t tid G_GNUC_UNUSED)
+{
+    errno = ENOSYS;
+    return -1;
+}
+
+int
+virProcessGetSchedInfo(unsigned long long *cpuWait G_GNUC_UNUSED,
+                       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;
+}
+#endif /* __linux__ */