summaryrefslogtreecommitdiff
path: root/get_load.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2024-02-17 15:24:12 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2024-02-17 15:24:12 -0800
commit491660b263c06396d11655351a09d80eafb83fb9 (patch)
tree8d07333832fa9e6727e0496d2ae694b3c22f88a0 /get_load.c
parentfa11c30113115991cdc5f15042944cf5bab6eb0b (diff)
Use imdent to realign remaining pre-processer directives
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'get_load.c')
-rw-r--r--get_load.c118
1 files changed, 59 insertions, 59 deletions
diff --git a/get_load.c b/get_load.c
index b801e69..0b79d54 100644
--- a/get_load.c
+++ b/get_load.c
@@ -129,15 +129,15 @@ void GetLoadPoint(
# else /* not HAVE_GETLOADAVG */
-# if !defined(linux) && !defined(__GLIBC__)
-# include <nlist.h>
-# endif /* !linux && ... */
+# if !defined(linux) && !defined(__GLIBC__)
+# include <nlist.h>
+# endif /* !linux && ... */
# ifdef CSRG_BASED
# include <sys/param.h>
# endif
-# if defined(linux) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__))
+# if defined(linux) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__))
void InitLoadPoint(void)
{
@@ -152,10 +152,10 @@ void GetLoadPoint(
static int fd = -1;
int n;
char buf[10] = {0, };
-# ifndef X_LOCALE
+# ifndef X_LOCALE
char *dp;
static char ldp = 0;
-# endif
+# endif
if (fd < 0)
@@ -167,21 +167,21 @@ void GetLoadPoint(
*(double *)call_data = 0.0;
return;
}
-# ifndef X_LOCALE
+# ifndef X_LOCALE
ldp = *localeconv()->decimal_point;
-# endif
+# endif
}
else
lseek(fd, 0, 0);
if ((n = read(fd, buf, sizeof(buf)-1)) > 0) {
-# ifndef X_LOCALE
+# ifndef X_LOCALE
if (ldp != '.')
while ((dp = memchr(buf,'.',sizeof(buf)-1)) != NULL) {
*(char *)dp = ldp;
}
-# endif
+# endif
if (sscanf(buf, "%lf", (double *)call_data) == 1)
return;
}
@@ -192,11 +192,11 @@ void GetLoadPoint(
return;
}
-# else /* linux */
+# else /* linux */
-# ifdef __GNU__
+# ifdef __GNU__
-# include <mach.h>
+# include <mach.h>
static processor_set_t default_set;
@@ -230,11 +230,11 @@ void GetLoadPoint(
return;
}
-# else /* __GNU__ */
+# else /* __GNU__ */
-# ifdef __APPLE__
+# ifdef __APPLE__
-# include <mach/mach.h>
+# include <mach/mach.h>
static mach_port_t host_priv_port;
@@ -264,13 +264,13 @@ void GetLoadPoint(
return;
}
-# else /* __APPLE__ */
+# else /* __APPLE__ */
-# ifdef __QNXNTO__
-# include <time.h>
-# include <sys/neutrino.h>
+# ifdef __QNXNTO__
+# include <time.h>
+# include <sys/neutrino.h>
static _Uint64t nto_idle = 0, nto_idle_last = 0;
static int nto_idle_id;
static struct timespec nto_now, nto_last;
@@ -303,44 +303,44 @@ GetLoadPoint( /* QNX NTO version */
nto_idle_last = nto_idle;
nto_last = nto_now;
}
-# else /* not __QNXNTO__ */
+# else /* not __QNXNTO__ */
-# ifndef KMEM_FILE
-# define KMEM_FILE "/dev/kmem"
-# endif
+# ifndef KMEM_FILE
+# define KMEM_FILE "/dev/kmem"
+# endif
-# ifndef KERNEL_FILE
+# ifndef KERNEL_FILE
/*
* provide default for everyone else
*/
/* If <paths.h> exists, check in it */
-# ifdef HAVE_PATHS_H
-# include <paths.h>
-# ifdef _PATH_UNIX
-# define KERNEL_FILE _PATH_UNIX
-# else
-# ifdef _PATH_KERNEL
-# define KERNEL_FILE _PATH_KERNEL
-# else
-# define KERNEL_FILE "/vmunix"
-# endif
-# endif
-# else /* HAVE_PATHS_H */
-# define KERNEL_FILE "/vmunix"
-# endif /* HAVE_PATHS_H */
-# endif /* KERNEL_FILE */
-
-
-# ifndef KERNEL_LOAD_VARIABLE
-# if defined(BSD) && (BSD >= 199103)
-# define KERNEL_LOAD_VARIABLE "_averunnable"
-# else /* BSD >= 199103 */
-# define KERNEL_LOAD_VARIABLE "_avenrun"
-# endif /* BSD >= 199103 */
-# endif /* KERNEL_LOAD_VARIABLE */
+# ifdef HAVE_PATHS_H
+# include <paths.h>
+# ifdef _PATH_UNIX
+# define KERNEL_FILE _PATH_UNIX
+# else
+# ifdef _PATH_KERNEL
+# define KERNEL_FILE _PATH_KERNEL
+# else
+# define KERNEL_FILE "/vmunix"
+# endif
+# endif
+# else /* HAVE_PATHS_H */
+# define KERNEL_FILE "/vmunix"
+# endif /* HAVE_PATHS_H */
+# endif /* KERNEL_FILE */
+
+
+# ifndef KERNEL_LOAD_VARIABLE
+# if defined(BSD) && (BSD >= 199103)
+# define KERNEL_LOAD_VARIABLE "_averunnable"
+# else /* BSD >= 199103 */
+# define KERNEL_LOAD_VARIABLE "_avenrun"
+# endif /* BSD >= 199103 */
+# endif /* KERNEL_LOAD_VARIABLE */
static struct nlist namelist[] = { /* namelist for vmunix grubbing */
-# define LOADAV 0
+# define LOADAV 0
{KERNEL_LOAD_VARIABLE},
{0}
};
@@ -350,9 +350,9 @@ static long loadavg_seek;
void InitLoadPoint()
{
-# if !defined(AIXV5) && !(BSD >= 199103) && !defined(__APPLE__)
+# if !defined(AIXV5) && !(BSD >= 199103) && !defined(__APPLE__)
extern void nlist();
-# endif
+# endif
nlist( KERNEL_FILE, namelist);
/*
@@ -381,21 +381,21 @@ void GetLoadPoint( w, closure, call_data )
(void) lseek(kmem, loadavg_seek, 0);
-# if (BSD >= 199103)
+# if (BSD >= 199103)
{
long temp;
(void) read(kmem, (char *)&temp, sizeof(long));
*loadavg = (double)temp/FSCALE;
}
-# else /* else not BSD */
+# else /* else not BSD */
(void) read(kmem, (char *)loadavg, sizeof(double));
-# endif /* or ... else */
+# endif /* or ... else */
return;
}
-# endif /* __QNXNTO__ else */
-# endif /* __APPLE__ else */
-# endif /* __GNU__ else */
-# endif /* linux else */
+# endif /* __QNXNTO__ else */
+# endif /* __APPLE__ else */
+# endif /* __GNU__ else */
+# endif /* linux else */
# endif /* HAVE_GETLOADAVG else */
static void xload_error(const char *str1, const char *str2)