Re: [PATCH 4/5] util: Introduce virhostuptime

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday, 14 August 2019 16:33:22 CEST Michal Privoznik wrote:
> +int
> +virHostGetBootTime(unsigned long long *when ATTRIBUTE_UNUSED)
> +{
> +#if defined(__linux__) || defined(__FreeBSD__)
> +    struct utmpx id = {.ut_type = BOOT_TIME};
> +    struct utmpx *res = NULL;
> +
> +    if (!(res = getutxid(&id))) {
> +        int theerrno = errno;
> +        endutxent();
> +        return -theerrno;
> +    }
> +
> +    *when = res->ut_tv.tv_sec;
> +    endutxent();
> +    return 0;
> +#else
> +    /* Unfortunately, mingw lacks utmp */
> +    errno = ENOSYS;
> +    return -errno;
> +#endif

In addition to what Jirka said, IMHO it would be better to do a
configure detection of the non-POSIX function, rather than assuming on
which platforms/OSes it is available.

-- 
Pino Toscano

Attachment: signature.asc
Description: This is a digitally signed message part.

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux