diff src/getloadavg.c @ 442:abe6d1db359e r21-2-36

Import from CVS: tag r21-2-36
author cvs
date Mon, 13 Aug 2007 11:35:02 +0200
parents 8de8e3f6228a
children b39c14581166
line wrap: on
line diff
--- a/src/getloadavg.c	Mon Aug 13 11:33:40 2007 +0200
+++ b/src/getloadavg.c	Mon Aug 13 11:35:02 2007 +0200
@@ -44,7 +44,6 @@
    convex
    DGUX
    hpux
-   MSDOS			No-op for MSDOS.
    NeXT
    sgi
    sequent			Sequent Dynix 3.x.x (BSD)
@@ -52,7 +51,8 @@
    sony_news                    NEWS-OS (works at least for 4.1C)
    UMAX
    UMAX4_3
-   WIN32			No-op for Windows95/NT.
+   WIN32_NATIVE			No-op for Windows9x/NT.
+   CYGWIN			No-op for Cygwin.
    __linux__			Linux: assumes /proc filesystem mounted.
    				Support from Michael K. Johnson.
    __NetBSD__			NetBSD: assumes /kern filesystem mounted.
@@ -69,30 +69,8 @@
 #include <config.h>
 #endif
 
-#ifndef WINDOWSNT
-#ifndef __CYGWIN32__
-
-#include <sys/types.h>
-
-/* Both the Emacs and non-Emacs sections want this.  Some
-   configuration files' definitions for the LOAD_AVE_CVT macro (like
-   sparc.h's) use macros like FSCALE, defined here.  */
-#ifdef unix
-#include <sys/param.h>
-#endif
-
-#ifdef XEMACS
 #include "lisp.h"
 #include "sysfile.h" /* for encapsulated open, close, read, write */
-#endif /* XEMACS */
-
-/* Exclude all the code except the test program at the end
-   if the system has its own `getloadavg' function.
-
-   The declaration of `errno' is needed by the test program
-   as well as the function itself, so it comes first.  */
-
-#include <errno.h>
 
 #ifndef HAVE_GETLOADAVG
 
@@ -110,11 +88,9 @@
 #define LDAV_CVT(n) (LOAD_AVE_CVT (n) / 100.0)
 #endif
 
-#ifdef XEMACS
 #if defined (HAVE_KSTAT_H)
 #include <kstat.h>
 #endif /* HAVE_KSTAT_H */
-#endif /* XEMACS */
 
 #if !defined (BSD) && defined (ultrix)
 /* Ultrix behaves like BSD on Vaxen.  */
@@ -457,17 +433,10 @@
 #include <sys/dg_sys_info.h>
 #endif
 
-#ifdef XEMACS
 #if defined (HAVE_SYS_PSTAT_H)
 #include <sys/pstat.h>
 #endif /* HAVE_SYS_PSTAT_H (on HPUX) */
-#endif /* XEMACS */
 
-#if defined(HAVE_FCNTL_H) || defined(_POSIX_VERSION)
-#include <fcntl.h>
-#else
-#include <sys/file.h>
-#endif
 
 /* Avoid static vars inside a function since in HPUX they dump as pure.  */
 
@@ -512,6 +481,8 @@
    Return the number written (never more than 3, but may be less than NELEM),
    or -1 if an error occurred.  */
 
+int getloadavg (double loadavg[], int nelem);
+
 int
 getloadavg (double loadavg[], int nelem)
 {
@@ -779,7 +750,7 @@
        : (load_ave.tl_avenrun.l[0] / (double) load_ave.tl_lscale));
 #endif	/* OSF_MIPS */
 
-#if !defined (LDAV_DONE) && (defined (MSDOS) || defined (WIN32))
+#if !defined (LDAV_DONE) && (defined (WIN32_NATIVE) || defined (CYGWIN))
 #define LDAV_DONE
 
   /* A faithful emulation is going to have to be saved for a rainy day.  */
@@ -787,7 +758,7 @@
     {
       loadavg[elem] = 0.0;
     }
-#endif  /* MSDOS */
+#endif  /* WIN32_NATIVE or CYGWIN */
 
 #if !defined (LDAV_DONE) && defined (OSF_ALPHA)
 #define LDAV_DONE
@@ -960,22 +931,3 @@
   exit (0);
 }
 #endif /* TEST */
-
-#else
-
-/* Emulate getloadavg.  */
-int
-getloadavg (double loadavg[], int nelem)
-{
-  int i;
-
-  /* A faithful emulation is going to have to be saved for a rainy day.  */
-  for (i = 0; i < nelem; i++) 
-    {
-      loadavg[i] = 0.0;
-    }
-  return i;
-}
-
-#endif /*__GNUWIN32__*/
-#endif /* WINDOWSNT */