72 lines
1.9 KiB
Diff
72 lines
1.9 KiB
Diff
From: Michal Privoznik <mprivozn@redhat.com>
|
|
Date: Thu, 19 Dec 2019 10:11:04 +0100
|
|
Subject: [PATCH] virhostuptime: Introduce virHostBootTimeInit()
|
|
|
|
The idea is to offer callers an init function that they can call
|
|
independently to ensure that the global variables get
|
|
initialized.
|
|
|
|
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
Reviewed-by: Cole Robinson <crobinso@redhat.com>
|
|
(cherry picked from commit 9d69bc19b94544b06838b2e2895826991d107178)
|
|
Signed-off-by: rpm-build <rpm-build>
|
|
|
|
Conflicts:
|
|
src/util/virhostuptime.h
|
|
---
|
|
src/libvirt_private.syms | 1 +
|
|
src/util/virhostuptime.c | 12 +++++++++++-
|
|
src/util/virhostuptime.h | 3 +++
|
|
3 files changed, 15 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
|
index c1c3974133..fbd1c25597 100644
|
|
--- a/src/libvirt_private.syms
|
|
+++ b/src/libvirt_private.syms
|
|
@@ -2136,6 +2136,7 @@ virHostMemSetParameters;
|
|
|
|
|
|
# util/virhostuptime.h
|
|
+virHostBootTimeInit;
|
|
virHostGetBootTime;
|
|
|
|
|
|
diff --git a/src/util/virhostuptime.c b/src/util/virhostuptime.c
|
|
index 94004d05db..d82e268264 100644
|
|
--- a/src/util/virhostuptime.c
|
|
+++ b/src/util/virhostuptime.c
|
|
@@ -126,7 +126,7 @@ virHostGetBootTimeOnceInit(void)
|
|
int
|
|
virHostGetBootTime(unsigned long long *when)
|
|
{
|
|
- if (virOnce(&virHostGetBootTimeOnce, virHostGetBootTimeOnceInit) < 0)
|
|
+ if (virHostBootTimeInit() < 0)
|
|
return -1;
|
|
|
|
if (bootTimeErrno) {
|
|
@@ -137,3 +137,13 @@ virHostGetBootTime(unsigned long long *when)
|
|
*when = bootTime;
|
|
return 0;
|
|
}
|
|
+
|
|
+
|
|
+int
|
|
+virHostBootTimeInit(void)
|
|
+{
|
|
+ if (virOnce(&virHostGetBootTimeOnce, virHostGetBootTimeOnceInit) < 0)
|
|
+ return -1;
|
|
+
|
|
+ return 0;
|
|
+}
|
|
diff --git a/src/util/virhostuptime.h b/src/util/virhostuptime.h
|
|
index 03c1517a64..0886b03767 100644
|
|
--- a/src/util/virhostuptime.h
|
|
+++ b/src/util/virhostuptime.h
|
|
@@ -25,3 +25,6 @@
|
|
int
|
|
virHostGetBootTime(unsigned long long *when)
|
|
ATTRIBUTE_NOINLINE;
|
|
+
|
|
+int
|
|
+virHostBootTimeInit(void);
|