bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] getloadavg: Allow building on Windows without Cygwin


From: Paul Smith
Subject: Re: [PATCH] getloadavg: Allow building on Windows without Cygwin
Date: Sun, 17 Jun 2018 11:31:12 -0400

On Mon, 2018-05-21 at 01:26 +0200, Bruno Haible wrote:
> Hi Paul,

> The proper condition for testing for a native Windows platform is
>   #if defined _WIN32 && ! defined __CYGWIN__

Does this mean you'd prefer to see a patch that tested this before
including unistd.h, versus the HAVE_UNISTD_H test?

I thought in general we were avoiding use of the _WINxx preprocessor
defines, and instead preferring WINDOWS32.  Certainly _WIN32 is not
used currently in getloadavg.c.

> But there is no implementation for native Windows!

True, but it does compile, run, and return a non-error code.  The
values are all 0 however.  From getloadavg.c:

  # if !defined (LDAV_DONE) && (defined (__MSDOS__) || defined (WINDOWS32))
                                                             /* DJGPP */
  #  define LDAV_DONE

    /* A faithful emulation is going to have to be saved for a rainy day.  */
    for ( ; elem < nelem; elem++)
      {
        loadavg[elem] = 0.0;
      }
  # endif  /* __MSDOS__ || WINDOWS32 */

In GNU make we just invoke getloadavg() on all platforms.  On Windows
since the returned loadavg is 0 it basically ignores the load parameter
with no messages; probably not great QOI but that's what it does.

I could instead change code inside GNU make to not invoke getloadavg()
at all on Windows, but that seems less clean... someday someone might
implement this feature.  Apparently there have not been sufficient, or
sufficiently, rainy days yet.

Thanks for your link to the Microsoft docs, but I'm personally not
going to undertake this effort.  Maybe someone else will.


Cheers!



reply via email to

[Prev in Thread] Current Thread [Next in Thread]