update from automake-1.1o
[gnulib.git] / lib / getloadavg.c
index 57e66ba..b6824e4 100644 (file)
 
 /* Compile-time symbols that this file uses:
 
+   HAVE_PSTAT_GETDYNAMIC       Define this if your system has the
+                                pstat_getdynamic function.  I think it
+                               is unique to HPUX9.  The best way to get the
+                               definition is through the AC_FUNC_GETLOADAVG
+                               macro that comes with autoconf 2.13 or newer.
+                               If that isn't an option, then just put
+                               AC_CHECK_FUNCS(pstat_getdynamic) in your
+                               configure.in file.
    FIXUP_KERNEL_SYMBOL_ADDR()  Adjust address in returned struct nlist.
    KERNEL_FILE                 Pathname of the kernel to nlist.
    LDAV_CVT()                  Scale the load average from the kernel.
@@ -543,10 +551,13 @@ getloadavg (loadavg, nelem)
   kstat_named_t *kn;
 
   kc = kstat_open ();
-  if (kc == 0) return -1;
+  if (kc == 0)
+    return -1;
   ksp = kstat_lookup (kc, "unix", 0, "system_misc");
-  if (ksp == 0 ) return -1;
-  if (kstat_read (kc, ksp, 0) == -1) return -1;
+  if (ksp == 0 )
+    return -1;
+  if (kstat_read (kc, ksp, 0) == -1)
+    return -1;
 
 
   kn = kstat_data_lookup (ksp, "avenrun_1min");
@@ -678,7 +689,7 @@ getloadavg (loadavg, nelem)
     {
       info_count = PROCESSOR_SET_BASIC_INFO_COUNT;
       if (processor_set_info (default_set, PROCESSOR_SET_BASIC_INFO, &host,
-                            (processor_set_info_t) &info, &info_count)
+                             (processor_set_info_t) &info, &info_count)
          != KERN_SUCCESS)
        getloadavg_initialized = 0;
       else
@@ -919,13 +930,13 @@ getloadavg (loadavg, nelem)
          }
 #   endif /* !SUNOS_5 */
 #  else  /* sgi */
-         int ldav_off;
+      int ldav_off;
 
-         ldav_off = sysmp (MP_KERNADDR, MPKA_AVENRUN);
-         if (ldav_off != -1)
-         offset = (long) ldav_off & 0x7fffffff;
+      ldav_off = sysmp (MP_KERNADDR, MPKA_AVENRUN);
+      if (ldav_off != -1)
+       offset = (long) ldav_off & 0x7fffffff;
 #  endif /* sgi */
-       }
+    }
 
   /* Make sure we have /dev/kmem open.  */
   if (!getloadavg_initialized)