From 0e0df8ca1d53fddeeddb918323050b9e9bbffd4a Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sun, 11 Feb 2024 15:29:25 -0800 Subject: unifdef SYSV Signed-off-by: Alan Coopersmith --- get_load.c | 92 -------------------------------------------------------------- 1 file changed, 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 -# include -# include -# include -# include -# include -# 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= (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 */ # ifdef BSD # include @@ -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) -- cgit v1.2.3