[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] getloadavg: Allow building on Windows without Cygwin
From: |
Bruno Haible |
Subject: |
Re: [PATCH] getloadavg: Allow building on Windows without Cygwin |
Date: |
Mon, 21 May 2018 01:26:31 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-124-generic; KDE/5.18.0; x86_64; ; ) |
Hi Paul,
But there is no implementation for native Windows!
Cygwin does it by use of the PDH functions [1], plus some custom
logic to get the averages right. But 'make' needs only the first number,
therefore it would be sufficient to provide the _current_ load instead
of an average, right? In this case, it could probably be done with
20 lines of code according to [1].
> An alternative would be to use ifdef WINDOWS32 instead of checking
> for unistd.h.
The proper condition for testing for a native Windows platform is
#if defined _WIN32 && ! defined __CYGWIN__
Bruno
[1] https://msdn.microsoft.com/en-us/library/aa373214(v=vs.85).aspx