提交 9d69bc19 编写于 作者: M Michal Privoznik

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: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NCole Robinson <crobinso@redhat.com>
上级 40a65ab4
...@@ -2199,6 +2199,7 @@ virHostMemSetParameters; ...@@ -2199,6 +2199,7 @@ virHostMemSetParameters;
# util/virhostuptime.h # util/virhostuptime.h
virHostBootTimeInit;
virHostGetBootTime; virHostGetBootTime;
......
...@@ -126,7 +126,7 @@ virHostGetBootTimeOnceInit(void) ...@@ -126,7 +126,7 @@ virHostGetBootTimeOnceInit(void)
int int
virHostGetBootTime(unsigned long long *when) virHostGetBootTime(unsigned long long *when)
{ {
if (virOnce(&virHostGetBootTimeOnce, virHostGetBootTimeOnceInit) < 0) if (virHostBootTimeInit() < 0)
return -1; return -1;
if (bootTimeErrno) { if (bootTimeErrno) {
...@@ -137,3 +137,13 @@ virHostGetBootTime(unsigned long long *when) ...@@ -137,3 +137,13 @@ virHostGetBootTime(unsigned long long *when)
*when = bootTime; *when = bootTime;
return 0; return 0;
} }
int
virHostBootTimeInit(void)
{
if (virOnce(&virHostGetBootTimeOnce, virHostGetBootTimeOnceInit) < 0)
return -1;
return 0;
}
...@@ -25,3 +25,6 @@ ...@@ -25,3 +25,6 @@
int int
virHostGetBootTime(unsigned long long *when) virHostGetBootTime(unsigned long long *when)
G_GNUC_NO_INLINE; G_GNUC_NO_INLINE;
int
virHostBootTimeInit(void);
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册