summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2024-02-11 15:29:25 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2024-02-11 15:31:40 -0800
commit0e0df8ca1d53fddeeddb918323050b9e9bbffd4a (patch)
treead6500d4c06b66256ea29759ff47330ac3f94a6d
parentf971deabd26413efd6fa87c0c3ab2952bae163bf (diff)
unifdef SYSV
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--get_load.c92
1 files changed, 0 insertions, 92 deletions
diff --git a/get_load.c b/get_load.c
index c6d831c..abe2ceb 100644
--- a/get_load.c
+++ b/get_load.c
@@ -161,93 +161,6 @@ void GetLoadPoint(
# endif
# endif
-# if defined(SYSV) && defined(i386)
-/*
- * inspired by 'avgload' by John F. Haugh II
- */
-# include <sys/param.h>
-# include <sys/buf.h>
-# include <sys/immu.h>
-# include <sys/region.h>
-# include <sys/var.h>
-# include <sys/proc.h>
-# define KERNEL_FILE "/unix"
-# define KMEM_FILE "/dev/kmem"
-# define VAR_NAME "v"
-# define PROC_NAME "proc"
-# define BUF_NAME "buf"
-# define DECAY 0.8
-struct nlist namelist[] = {
- {VAR_NAME},
- {PROC_NAME},
- {BUF_NAME},
- {0},
-};
-
-static int kmem;
-static struct var v;
-static struct proc *p;
-static XtPointer first_buf, last_buf;
-
-void InitLoadPoint() /* SYSV386 version */
-{
- int i;
-
- nlist( KERNEL_FILE, namelist);
-
- for (i=0; namelist[i].n_name; i++)
- if (namelist[i].n_value == 0)
- xload_error("cannot get name list from", KERNEL_FILE);
-
- if ((kmem = open(KMEM_FILE, O_RDONLY)) < 0)
- xload_error("cannot open", KMEM_FILE);
-
- if (lseek(kmem, namelist[0].n_value, 0) == -1)
- xload_error("cannot seek", VAR_NAME);
-
- if (read(kmem, &v, sizeof(v)) != sizeof(v))
- xload_error("cannot read", VAR_NAME);
-
- if ((p=(struct proc *)malloc(v.v_proc*sizeof(*p))) == NULL)
- xload_error("cannot allocate space for", PROC_NAME);
-
- first_buf = (XtPointer) namelist[2].n_value;
- last_buf = (char *)first_buf + v.v_buf * sizeof(struct buf);
-}
-
-/* ARGSUSED */
-void GetLoadPoint( w, closure, call_data ) /* SYSV386 version */
-Widget w; /* unused */
-XtPointer closure; /* unused */
-XtPointer call_data; /* pointer to (double) return value */
-{
- double *loadavg = (double *)call_data;
- static double avenrun = 0.0;
- int i, nproc, size;
-
- (void) lseek(kmem, namelist[0].n_value, 0);
- (void) read(kmem, &v, sizeof(v));
-
- size = (struct proc *)v.ve_proc - (struct proc *)namelist[1].n_value;
-
- (void) lseek(kmem, namelist[1].n_value, 0);
- (void) read(kmem, p, size * sizeof(struct proc));
-
- for (nproc = 0, i=0; i<size; i++)
- if ((p[i].p_stat == SRUN) ||
- (p[i].p_stat == SIDL) ||
- (p[i].p_stat == SXBRK) ||
- (p[i].p_stat == SSLEEP && (p[i].p_pri < PZERO) &&
- (p[i].p_wchan >= (char *)first_buf) && (p[i].p_wchan < (char *)last_buf)))
- nproc++;
-
- /* update the load average using a decay filter */
- avenrun = DECAY * avenrun + nproc * (1.0 - DECAY);
- *loadavg = avenrun;
-
- return;
-}
-# else /* not (SYSV && i386) */
# if defined(linux) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__))
@@ -526,9 +439,6 @@ void GetLoadPoint(
# ifdef SVR4
# define KERNEL_FILE "/stand/unix"
# else
-# ifdef SYSV
-# define KERNEL_FILE "/unix"
-# else
/* If a BSD system, check in <paths.h> */
# ifdef BSD
# include <paths.h>
@@ -544,7 +454,6 @@ void GetLoadPoint(
# else /* BSD */
# define KERNEL_FILE "/vmunix"
# endif /* BSD */
-# endif /* SYSV */
# endif /* SVR4 */
# endif /* KERNEL_FILE */
# endif /* KERNEL_FILE */
@@ -636,7 +545,6 @@ void GetLoadPoint( w, closure, call_data )
# endif /* __APPLE__ else */
# endif /* __GNU__ else */
# endif /* linux else */
-# endif /* SYSV && i386 else */
# endif /* HAVE_GETLOADAVG else */
static void xload_error(const char *str1, const char *str2)