mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 21:34:54 +03:00
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>
This commit is contained in:
parent
40a65ab4a9
commit
9d69bc19b9
@ -2199,6 +2199,7 @@ virHostMemSetParameters;
|
||||
|
||||
|
||||
# util/virhostuptime.h
|
||||
virHostBootTimeInit;
|
||||
virHostGetBootTime;
|
||||
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -25,3 +25,6 @@
|
||||
int
|
||||
virHostGetBootTime(unsigned long long *when)
|
||||
G_GNUC_NO_INLINE;
|
||||
|
||||
int
|
||||
virHostBootTimeInit(void);
|
||||
|
Loading…
Reference in New Issue
Block a user