summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-02-17 23:41:43 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2011-02-17 23:41:43 -0800
commit7d315eb67800796d7d7f39030eb7682340d985e5 (patch)
tree0204c6ba2532b67b02cbfcede3e09dcae29206fa
parentb803a8094fb59410c5bb2cb421e5905e71a99b8b (diff)
downloademacs-7d315eb67800796d7d7f39030eb7682340d985e5.tar.gz
Import IRIX 6.5 getloadavg fixes from gnulib.
* configure, lib/getloadavg.c, m4/getloadavg.m4: Regenerate.
-rw-r--r--ChangeLog5
-rwxr-xr-xconfigure2
-rw-r--r--lib/getloadavg.c20
-rw-r--r--m4/getloadavg.m42
4 files changed, 20 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 7a9252cb9f8..c574311d45c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-02-18 Paul Eggert <eggert@cs.ucla.edu>
+
+ Import IRIX 6.5 getloadavg fixes from gnulib.
+ * configure, lib/getloadavg.c, m4/getloadavg.m4: Regenerate.
+
2011-02-16 Paul Eggert <eggert@cs.ucla.edu>
Import getloadavg module from gnulib.
diff --git a/configure b/configure
index df3d1f72eda..a9cec714412 100755
--- a/configure
+++ b/configure
@@ -14475,6 +14475,8 @@ test -f "$srcdir/$gl_source_base/getloadavg.c" ||
gl_save_LIBS=$LIBS
+# getloadvg is present in libc on glibc >= 2.2, MacOS X, FreeBSD >= 2.0,
+# NetBSD >= 0.9, OpenBSD >= 2.0, Solaris >= 7.
ac_fn_c_check_func "$LINENO" "getloadavg" "ac_cv_func_getloadavg"
if test "x$ac_cv_func_getloadavg" = xyes; then :
diff --git a/lib/getloadavg.c b/lib/getloadavg.c
index 28e2ea0164b..d324451ef15 100644
--- a/lib/getloadavg.c
+++ b/lib/getloadavg.c
@@ -508,7 +508,7 @@ getloadavg (double loadavg[], int nelem)
elem = -1;
# endif
-# if !defined (LDAV_DONE) && defined (HAVE_LIBKSTAT)
+# if !defined (LDAV_DONE) && defined (HAVE_LIBKSTAT) /* Solaris <= 2.6 */
/* Use libkstat because we don't have to be root. */
# define LDAV_DONE
kstat_ctl_t *kc;
@@ -559,6 +559,7 @@ getloadavg (double loadavg[], int nelem)
# endif /* HAVE_LIBKSTAT */
# if !defined (LDAV_DONE) && defined (hpux) && defined (HAVE_PSTAT_GETDYNAMIC)
+ /* HP-UX */
/* Use pstat_getdynamic() because we don't have to be root. */
# define LDAV_DONE
# undef LOAD_AVE_TYPE
@@ -575,7 +576,7 @@ getloadavg (double loadavg[], int nelem)
# endif /* hpux && HAVE_PSTAT_GETDYNAMIC */
-# if ! defined LDAV_DONE && defined HAVE_LIBPERFSTAT
+# if ! defined LDAV_DONE && defined HAVE_LIBPERFSTAT /* AIX */
# define LDAV_DONE
# undef LOAD_AVE_TYPE
/* Use perfstat_cpu_total because we don't have to be root. */
@@ -592,6 +593,7 @@ getloadavg (double loadavg[], int nelem)
# endif
# if !defined (LDAV_DONE) && (defined (__linux__) || defined (__CYGWIN__))
+ /* Linux without glibc, Cygwin */
# define LDAV_DONE
# undef LOAD_AVE_TYPE
@@ -648,7 +650,7 @@ getloadavg (double loadavg[], int nelem)
# endif /* __linux__ || __CYGWIN__ */
-# if !defined (LDAV_DONE) && defined (__NetBSD__)
+# if !defined (LDAV_DONE) && defined (__NetBSD__) /* NetBSD < 0.9 */
# define LDAV_DONE
# undef LOAD_AVE_TYPE
@@ -680,7 +682,7 @@ getloadavg (double loadavg[], int nelem)
# endif /* __NetBSD__ */
-# if !defined (LDAV_DONE) && defined (NeXT)
+# if !defined (LDAV_DONE) && defined (NeXT) /* NeXTStep */
# define LDAV_DONE
/* The NeXT code was adapted from iscreen 3.2. */
@@ -842,6 +844,7 @@ getloadavg (double loadavg[], int nelem)
# endif /* OSF_MIPS */
# 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. */
@@ -851,7 +854,7 @@ getloadavg (double loadavg[], int nelem)
}
# endif /* __MSDOS__ || WINDOWS32 */
-# if !defined (LDAV_DONE) && defined (OSF_ALPHA)
+# if !defined (LDAV_DONE) && defined (OSF_ALPHA) /* OSF/1 */
# define LDAV_DONE
struct tbl_loadavg load_ave;
@@ -863,7 +866,7 @@ getloadavg (double loadavg[], int nelem)
: (load_ave.tl_avenrun.l[elem] / (double) load_ave.tl_lscale));
# endif /* OSF_ALPHA */
-# if ! defined LDAV_DONE && defined __VMS
+# if ! defined LDAV_DONE && defined __VMS /* VMS */
/* VMS specific code -- read from the Load Ave driver. */
LOAD_AVE_TYPE load_ave[3];
@@ -907,6 +910,7 @@ getloadavg (double loadavg[], int nelem)
# endif /* ! defined LDAV_DONE && defined __VMS */
# if ! defined LDAV_DONE && defined LOAD_AVE_TYPE && ! defined __VMS
+ /* IRIX, other old systems */
/* UNIX-specific code -- read the average from /dev/kmem. */
@@ -948,9 +952,7 @@ getloadavg (double loadavg[], int nelem)
}
# endif /* !SUNOS_5 */
# else /* sgi */
- int ldav_off;
-
- ldav_off = sysmp (MP_KERNADDR, MPKA_AVENRUN);
+ ptrdiff_t ldav_off = sysmp (MP_KERNADDR, MPKA_AVENRUN);
if (ldav_off != -1)
offset = (long int) ldav_off & 0x7fffffff;
# endif /* sgi */
diff --git a/m4/getloadavg.m4 b/m4/getloadavg.m4
index 4aae158e963..e58d29b238f 100644
--- a/m4/getloadavg.m4
+++ b/m4/getloadavg.m4
@@ -26,6 +26,8 @@ test -f "$srcdir/$1/getloadavg.c" ||
gl_save_LIBS=$LIBS
+# getloadvg is present in libc on glibc >= 2.2, MacOS X, FreeBSD >= 2.0,
+# NetBSD >= 0.9, OpenBSD >= 2.0, Solaris >= 7.
AC_CHECK_FUNC([getloadavg], [],
[gl_have_func=no