diff options
Diffstat (limited to 'sysdeps/sun4')
28 files changed, 0 insertions, 1950 deletions
diff --git a/sysdeps/sun4/.cvsignore b/sysdeps/sun4/.cvsignore deleted file mode 100644 index dd420e7f..00000000 --- a/sysdeps/sun4/.cvsignore +++ /dev/null @@ -1,17 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -close.lo -cpu.lo -libgtop_sysdeps.la -loadavg.lo -mem.lo -msg_limits.lo -open.lo -proclist.lo -sem_limits.lo -shm_limits.lo -swap.lo -sysdeps.lo -uptime.lo diff --git a/sysdeps/sun4/ChangeLog b/sysdeps/sun4/ChangeLog deleted file mode 100644 index 48a1688a..00000000 --- a/sysdeps/sun4/ChangeLog +++ /dev/null @@ -1,13 +0,0 @@ -1998-10-25 Martin Baulig <martin@home-of-linux.org> - - * ppp.c: New file. - -1998-08-25 Martin Baulig <martin@home-of-linux.org> - - * *.c (glibtop_init_p): Using correct `(1 << GLIBTOP_SYSDPES_*)'. - (<glibtop_suid.h>): Include. - - * glibtop_suid.h: New file. - - * ChangeLog: New file. - diff --git a/sysdeps/sun4/Makefile.am b/sysdeps/sun4/Makefile.am deleted file mode 100644 index 56e8a078..00000000 --- a/sysdeps/sun4/Makefile.am +++ /dev/null @@ -1,21 +0,0 @@ -LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@ - -INCLUDES = @INCLUDES@ - -lib_LTLIBRARIES = libgtop_sysdeps.la libgtop_sysdeps_suid.la - -libgtop_sysdeps_la_SOURCES = nosuid.c -libgtop_sysdeps_la_LDFLAGS = $(LT_VERSION_INFO) -libgtop_sysdeps_la_LIBADD = -lkvm - -libgtop_sysdeps_suid_la_SOURCES = open.c close.c cpu.c mem.c swap.c \ - uptime.c loadavg.c shm_limits.c msg_limits.c \ - sem_limits.c proclist.c procstate.c procuid.c \ - proctime.c procmem.c procsignal.c prockernel.c \ - procsegment.c ppp.c -libgtop_sysdeps_suid_la_LDFLAGS = $(LT_VERSION_INFO) -libgtop_sysdeps_suid_la_LIBADD = -lkvm - -include_HEADERS = glibtop_server.h glibtop_machine.h - -noinst_HEADERS = glibtop_suid.h diff --git a/sysdeps/sun4/close.c b/sysdeps/sun4/close.c deleted file mode 100644 index 95bffec1..00000000 --- a/sysdeps/sun4/close.c +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -/* $Id$ */ - -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 1.0. - - Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998. - - LibGTop is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - LibGTop is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with LibGTop; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#include <glibtop/close.h> - -/* Closes pipe to gtop server. */ - -void -glibtop_close_p (glibtop *server) -{ } diff --git a/sysdeps/sun4/cpu.c b/sysdeps/sun4/cpu.c deleted file mode 100644 index fbf599cb..00000000 --- a/sysdeps/sun4/cpu.c +++ /dev/null @@ -1,109 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -/* $Id$ */ - -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 1.0. - - Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998. - - LibGTop is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - LibGTop is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with LibGTop; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#include <glibtop.h> -#include <glibtop/cpu.h> - -#include <glibtop_suid.h> - -static const unsigned long _glibtop_sysdeps_cpu = -(1L << GLIBTOP_CPU_TOTAL) + (1L << GLIBTOP_CPU_USER) + -(1L << GLIBTOP_CPU_NICE) + (1L << GLIBTOP_CPU_SYS) + -(1L << GLIBTOP_CPU_IDLE) + (1L << GLIBTOP_CPU_FREQUENCY); - -/* Provides information about cpu usage. */ - -int -glibtop_get_cpu_p (glibtop *server, glibtop_cpu *buf) -{ - long cp_time [CPUSTATES], mp_time [NCPU][CPUSTATES]; - int i; - - glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_CPU), 0); - - memset (buf, 0, sizeof (glibtop_cpu)); - - /* !!! THE FOLLOWING CODE RUNS SGID KMEM - CHANGE WITH CAUTION !!! */ - - glibtop_suid_enter (server); - - /* get the cp_time array */ - - (void) _glibtop_getkval (server, _glibtop_nlist [X_CP_TIME].n_value, - (int *) cp_time, sizeof (cp_time), - _glibtop_nlist [X_CP_TIME].n_name); - -#ifdef MULTIPROCESSOR - /* get the mp_time array as well */ - - if (server->machine.ncpu > 1) { - (void) _glibtop_getkval (server, _glibtop_nlist [X_MP_TIME].n_value, - (int *) mp_time, sizeof (mp_time), - _glibtop_nlist [X_MP_TIME].n_name); - } -#endif - - glibtop_suid_leave (server); - - /* !!! END OF SUID ROOT PART !!! */ - -#ifdef MULTIPROCESSOR - /* If we have multiple processors, we add the times for each of them - * and set frequency to 100 times the number of the processors. */ - - /* [FIXME]: I had no machine with more than one processor to test - * this code !!! */ - - if (server->machine.ncpu > 1) { - for (i = 0; i < server->machine.ncpu; i++) { - buf->user += mp_time [i][CP_USER]; - buf->nice += mp_time [i][CP_NICE]; - buf->sys += mp_time [i][CP_SYS]; - buf->idle += mp_time [i][CP_IDLE]; - buf->frequency += 100; - } - } else { - buf->user = cp_time [CP_USER]; - buf->nice = cp_time [CP_NICE]; - buf->sys = cp_time [CP_SYS]; - buf->idle = cp_time [CP_IDLE]; - buf->frequency = 100; - } -#else - buf->user = cp_time [CP_USER]; - buf->nice = cp_time [CP_NICE]; - buf->sys = cp_time [CP_SYS]; - buf->idle = cp_time [CP_IDLE]; - buf->frequency = 100; -#endif - - /* Calculate total time. */ - - buf->total = buf->user + buf->nice + buf->sys + buf->idle; - - /* Now we can set the flags. */ - - buf->flags = _glibtop_sysdeps_cpu; -} diff --git a/sysdeps/sun4/glibtop_machine.h b/sysdeps/sun4/glibtop_machine.h deleted file mode 100644 index 8a1f645b..00000000 --- a/sysdeps/sun4/glibtop_machine.h +++ /dev/null @@ -1,119 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -/* $Id$ */ - -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 1.0. - - Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998. - - LibGTop is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - LibGTop is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with LibGTop; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#ifndef __GLIBTOP_MACHINE_H__ -#define __GLIBTOP_MACHINE_H__ - -/* make sure param.h gets loaded with KERNEL defined to get PZERO & NZERO */ -#define KERNEL -#include <sys/param.h> -#undef KERNEL - -#include <stdio.h> -#include <kvm.h> -#include <nlist.h> -#include <math.h> -#include <sys/dir.h> -#include <sys/user.h> -#include <sys/proc.h> -#include <sys/dk.h> -#include <sys/vm.h> -#include <sys/file.h> -#include <sys/time.h> -#include <vm/page.h> - -#ifdef solbourne -#include <sys/syscall.h> -#endif - -#include "loadavg.h" - -BEGIN_LIBGTOP_DECLS - -/* Older versions of SunOS don't have a typedef for pid_t. - Hopefully this will catch all those cases without causing other problems. - */ -#ifndef __sys_stdtypes_h -typedef int pid_t; -#endif - -/* definitions for indices in the nlist array */ -#define X_AVENRUN 0 -#define X_CCPU 1 -#define X_MPID 2 -#define X_NPROC 3 -#define X_PROC 4 -#define X_TOTAL 5 -#define X_CP_TIME 6 -#define X_PAGES 7 -#define X_EPAGES 8 -#define X_SHMINFO 9 -#define X_MSGINFO 10 -#define X_SEMINFO 11 - -#ifdef MULTIPROCESSOR -#define X_NCPU 12 -#define X_MP_TIME 13 -#endif - -/* Log base 2 of 1024 is 10 (2^10 == 1024) */ -#define LOG1024 10 - -typedef struct _glibtop_machine glibtop_machine; - -struct _glibtop_machine -{ - uid_t uid, euid; /* Real and effective user id */ - gid_t gid, egid; /* Real and effective group id */ - int nlist_count; /* Number of symbols in the nlist */ - int ncpu; /* Number of CPUs we have */ - int nproc; /* Number of entries in the process array */ - size_t ptable_size; /* Size of process array. */ - unsigned long ptable_offset; /* Offset of process array in kernel. */ - struct proc *proc_table; /* Process array. */ - unsigned long pages, epages; - struct page *physpage; - int bytesize, count; - int pageshift; /* log base 2 of the pagesize */ - kvm_t *kd; -}; - -/* Those functions are used internally in libgtop */ - -#ifdef _IN_LIBGTOP - -extern struct nlist _glibtop_nlist[]; - -int _glibtop_check_nlist (void *server, register struct nlist *nlst); -int _glibtop_getkval (void *void_server, unsigned long offset, int *ptr, - int size, char *refstr); -void _glibtop_read_proc_table (void *void_server); -struct proc *_glibtop_find_pid (void *void_server, pid_t pid); - -#endif - -END_LIBGTOP_DECLS - -#endif diff --git a/sysdeps/sun4/glibtop_server.h b/sysdeps/sun4/glibtop_server.h deleted file mode 100644 index e98bf898..00000000 --- a/sysdeps/sun4/glibtop_server.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -/* $Id$ */ - -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 1.0. - - Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998. - - LibGTop is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - LibGTop is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with LibGTop; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#ifndef __GLIBTOP_SERVER_H__ -#define __GLIBTOP_SERVER_H__ - -BEGIN_LIBGTOP_DECLS - -#define GLIBTOP_SUID_CPU (1 << GLIBTOP_SYSDEPS_CPU) -#define GLIBTOP_SUID_MEM (1 << GLIBTOP_SYSDEPS_MEM) -#define GLIBTOP_SUID_SWAP (1 << GLIBTOP_SYSDEPS_SWAP) -#define GLIBTOP_SUID_UPTIME (1 << GLIBTOP_SYSDEPS_UPTIME) -#define GLIBTOP_SUID_LOADAVG (1 << GLIBTOP_SYSDEPS_LOADAVG) -#define GLIBTOP_SUID_SHM_LIMITS (1 << GLIBTOP_SYSDEPS_SHM_LIMITS) -#define GLIBTOP_SUID_MSG_LIMITS (1 << GLIBTOP_SYSDEPS_MSG_LIMITS) -#define GLIBTOP_SUID_SEM_LIMITS (1 << GLIBTOP_SYSDEPS_SEM_LIMITS) -#define GLIBTOP_SUID_PROCLIST (1 << GLIBTOP_SYSDEPS_PROCLIST) -#define GLIBTOP_SUID_PROC_STATE (1 << GLIBTOP_SYSDEPS_PROC_STATE) -#define GLIBTOP_SUID_PROC_UID (1 << GLIBTOP_SYSDEPS_PROC_UID) -#define GLIBTOP_SUID_PROC_MEM (1 << GLIBTOP_SYSDEPS_PROC_MEM) -#define GLIBTOP_SUID_PROC_TIME (1 << GLIBTOP_SYSDEPS_PROC_TIME) -#define GLIBTOP_SUID_PROC_SIGNAL (1 << GLIBTOP_SYSDEPS_PROC_SIGNAL) -#define GLIBTOP_SUID_PROC_KERNEL (1 << GLIBTOP_SYSDEPS_PROC_KERNEL) -#define GLIBTOP_SUID_PROC_SEGMENT (1 << GLIBTOP_SYSDEPS_PROC_SEGMENT) -#define GLIBTOP_SUID_PROC_MAP (1 << GLIBTOP_SYSDEPS_PROC_MAP) - -END_LIBGTOP_DECLS - -#endif diff --git a/sysdeps/sun4/glibtop_suid.h b/sysdeps/sun4/glibtop_suid.h deleted file mode 100644 index a11e5ea6..00000000 --- a/sysdeps/sun4/glibtop_suid.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -/* $Id$ */ - -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 1.0. - - Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998. - - LibGTop is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - LibGTop is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with LibGTop; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#ifndef __GLIBTOP_SUID_H__ -#define __GLIBTOP_SUID_H__ - -BEGIN_LIBGTOP_DECLS - -static inline void glibtop_suid_enter (glibtop *server) { - setregid (server->machine.gid, server->machine.egid); -}; - -static inline void glibtop_suid_leave (glibtop *server) { - if (setregid (server->machine.egid, server->machine.gid)) - _exit (1); -}; - -void -glibtop_init_p (glibtop *server, const unsigned long features, - const unsigned flags); -void -glibtop_open_p (glibtop *server, const char *program_name, - const unsigned long features, - const unsigned flags); - -END_LIBGTOP_DECLS - -#endif diff --git a/sysdeps/sun4/loadavg.c b/sysdeps/sun4/loadavg.c deleted file mode 100644 index 66a88d3a..00000000 --- a/sysdeps/sun4/loadavg.c +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -/* $Id$ */ - -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 1.0. - - Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998. - - LibGTop is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - LibGTop is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with LibGTop; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#include <glibtop.h> -#include <glibtop/loadavg.h> - -#include <glibtop_suid.h> - -static const unsigned long _glibtop_sysdeps_loadavg = -(1L << GLIBTOP_LOADAVG_LOADAVG); - -/* Provides load averange. */ - -int -glibtop_get_loadavg_p (glibtop *server, glibtop_loadavg *buf) -{ - load_avg avenrun [3]; - int i; - - glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_LOADAVG), 0); - - memset (buf, 0, sizeof (glibtop_loadavg)); - - /* !!! THE FOLLOWING CODE RUNS SGID KMEM - CHANGE WITH CAUTION !!! */ - - setregid (server->machine.gid, server->machine.egid); - - /* get the load average array */ - - (void) _glibtop_getkval (server, _glibtop_nlist [X_AVENRUN].n_value, - (int *) avenrun, sizeof (avenrun), - _glibtop_nlist [X_AVENRUN].n_name); - - if (setregid (server->machine.egid, server->machine.gid)) - _exit (1); - - /* !!! END OF SGID KMEM PART !!! */ - - for (i = 0; i < 3; i++) { - /* Calculate loadavg values from avenrun. */ - buf->loadavg [i] = loaddouble (avenrun [i]); - } - - /* Now we can set the flags. */ - - buf->flags = _glibtop_sysdeps_loadavg; -} diff --git a/sysdeps/sun4/loadavg.h b/sysdeps/sun4/loadavg.h deleted file mode 100644 index f2c20d81..00000000 --- a/sysdeps/sun4/loadavg.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -/* - * Top - a top users display for Berkeley Unix - * - * Defines required to access load average figures. - * - * This include file sets up everything we need to access the load average - * values in the kernel in a machine independent way. First, it sets the - * typedef "load_avg" to be either double or long (depending on what is - * needed), then it defines these macros appropriately: - * - * loaddouble(la) - convert load_avg to double. - * intload(i) - convert integer to load_avg. - */ - -/* - * We assume that if FSCALE is defined, then avenrun and ccpu are type long. - * If your machine is an exception (mips, perhaps?) then make adjustments - * here. - * - * Defined types: load_avg for load averages, pctcpu for cpu percentages. - */ -#if defined(mips) && !defined(NetBSD) -# include <sys/fixpoint.h> -# if defined(FBITS) && !defined(FSCALE) -# define FSCALE (1 << FBITS) /* mips */ -# endif -#endif - -#ifdef FSCALE -# define FIXED_LOADAVG FSCALE -# define FIXED_PCTCPU FSCALE -#endif - -#ifdef ibm032 -# undef FIXED_LOADAVG -# undef FIXED_PCTCPU -# define FIXED_PCTCPU PCT_SCALE -#endif - - -#ifdef FIXED_PCTCPU -typedef long pctcpu; -# define pctdouble(p) ((double)(p) / FIXED_PCTCPU) -#else -typedef double pctcpu; -# define pctdouble(p) (p) -#endif - -#ifdef FIXED_LOADAVG -typedef long load_avg; -# define loaddouble(la) ((double)(la) / FIXED_LOADAVG) -# define intload(i) ((int)((i) * FIXED_LOADAVG)) -#else -typedef double load_avg; -# define loaddouble(la) (la) -# define intload(i) ((double)(i)) -#endif diff --git a/sysdeps/sun4/mem.c b/sysdeps/sun4/mem.c deleted file mode 100644 index 6bc327e2..00000000 --- a/sysdeps/sun4/mem.c +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -/* $Id$ */ - -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 1.0. - - Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998. - - LibGTop is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - LibGTop is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with LibGTop; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#include <glibtop.h> -#include <glibtop/mem.h> - -#include <glibtop_suid.h> - -static const unsigned long _glibtop_sysdeps_mem = -(1L << GLIBTOP_MEM_TOTAL) + (1L << GLIBTOP_MEM_USED) + -(1L << GLIBTOP_MEM_FREE) + (1L << GLIBTOP_MEM_LOCKED); - -/* define pagetok in terms of pageshift */ - -#define pagetok(size) ((size) << server->machine.pageshift) - -/* Provides information about memory usage. */ - -int -glibtop_get_mem_p (glibtop *server, glibtop_mem *buf) -{ - glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_MEM), 0); - - memset (buf, 0, sizeof (glibtop_mem)); - - /* !!! THE FOLLOWING CODE RUNS SGID KMEM - CHANGE WITH CAUTION !!! */ - - glibtop_suid_enter (server); - - /* get the array of physpage descriptors */ - - (void) _glibtop_getkval (server, server->machine.pages, - (int *) server->machine.physpage, - server->machine.bytesize, - "array _page"); - - glibtop_suid_leave (server); - - /* !!! END OF SGID KMEM PART !!! */ - - - { /* sum memory statistics */ - register struct page *pp; - register int cnt; - register int inuse; - register int free; - register int locked; - - /* bop thru the array counting page types */ - - pp = server->machine.physpage; - inuse = free = locked = 0; - for (cnt = server->machine.count; --cnt >= 0; pp++) { - if (pp->p_free) - free++; - else if (pp->p_lock || pp->p_keepcnt > 0) - locked++; - else - inuse++; - } - - /* convert memory stats to Kbytes */ - - buf->total = pagetok (inuse + free); - buf->used = pagetok (inuse); - buf->free = pagetok (free); - buf->locked = pagetok (locked); - - buf->flags = _glibtop_sysdeps_mem; - } -} diff --git a/sysdeps/sun4/msg_limits.c b/sysdeps/sun4/msg_limits.c deleted file mode 100644 index 7b997f5c..00000000 --- a/sysdeps/sun4/msg_limits.c +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -/* $Id$ */ - -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 1.0. - - Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998. - - LibGTop is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - LibGTop is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with LibGTop; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#include <glibtop.h> -#include <glibtop/msg_limits.h> - -#include <glibtop_suid.h> - -/* #define KERNEL to get declaration of `struct msginfo'. */ - -#define KERNEL - -#include <sys/ipc.h> -#include <sys/msg.h> - -static const unsigned long _glibtop_sysdeps_msg_limits = -(1L << GLIBTOP_MSG_LIMITS_MSGMAP) + (1L << GLIBTOP_MSG_LIMITS_MSGMAX) + -(1L << GLIBTOP_MSG_LIMITS_MSGMNB) + (1L << GLIBTOP_MSG_LIMITS_MSGMNI) + -(1L << GLIBTOP_MSG_LIMITS_MSGSSZ) + (1L << GLIBTOP_MSG_LIMITS_MSGTQL); - -/* Provides information about sysv ipc limits. */ - -int -glibtop_get_msg_limits_p (glibtop *server, glibtop_msg_limits *buf) -{ - struct msginfo msginfo; - - glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_MSG_LIMITS), 0); - - memset (buf, 0, sizeof (glibtop_msg_limits)); - - /* !!! THE FOLLOWING CODE RUNS SGID KMEM - CHANGE WITH CAUTION !!! */ - - setregid (server->machine.gid, server->machine.egid); - - /* get the load average array */ - - (void) _glibtop_getkval (server, _glibtop_nlist [X_MSGINFO].n_value, - (int *) &msginfo, sizeof (msginfo), - _glibtop_nlist [X_MSGINFO].n_name); - - if (setregid (server->machine.egid, server->machine.gid)) - _exit (1); - - /* !!! END OF SGID KMEM PART !!! */ - - buf->msgmap = msginfo.msgmap; - buf->msgmax = msginfo.msgmax; - buf->msgmnb = msginfo.msgmnb; - buf->msgmni = msginfo.msgmni; - buf->msgssz = msginfo.msgssz; - buf->msgtql = msginfo.msgtql; - - buf->flags = _glibtop_sysdeps_msg_limits; -} diff --git a/sysdeps/sun4/nosuid.c b/sysdeps/sun4/nosuid.c deleted file mode 100644 index 0ee13dc4..00000000 --- a/sysdeps/sun4/nosuid.c +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -/* $Id$ */ - -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 1.0. - - Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998. - - LibGTop is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - LibGTop is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with LibGTop; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#include <glibtop.h> -#include <glibtop/open.h> -#include <glibtop/close.h> - -void -glibtop_open_s (glibtop *server, const char *program_name, - const unsigned long features, const unsigned flags) -{ } - -void -glibtop_close_s (glibtop *server) -{ } diff --git a/sysdeps/sun4/open.c b/sysdeps/sun4/open.c deleted file mode 100644 index e5f4d315..00000000 --- a/sysdeps/sun4/open.c +++ /dev/null @@ -1,310 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -/* $Id$ */ - -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 1.0. - - Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998. - - LibGTop is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - LibGTop is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with LibGTop; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#include <glibtop.h> -#include <glibtop/open.h> -#include <glibtop/xmalloc.h> - -struct nlist _glibtop_nlist[] = { -#ifdef i386 - { "avenrun" }, /* 0 */ - { "ccpu" }, /* 1 */ - { "mpid" }, /* 2 */ - { "nproc" }, /* 3 */ - { "proc" }, /* 4 */ - { "total" }, /* 5 */ - { "cp_time" }, /* 6 */ - { "pages" }, /* 7 */ - { "epages" }, /* 8 */ - { "shminfo" }, /* 9 */ - { "msginfo" }, /* 10 */ - { "seminfo" }, /* 11 */ -#else - { "_avenrun" }, /* 0 */ - { "_ccpu" }, /* 1 */ - { "_mpid" }, /* 2 */ - { "_nproc" }, /* 3 */ - { "_proc" }, /* 4 */ - { "_total" }, /* 5 */ - { "_cp_time" }, /* 6 */ - { "_pages" }, /* 7 */ - { "_epages" }, /* 8 */ - { "_shminfo" }, /* 9 */ - { "_msginfo" }, /* 10 */ - { "_seminfo" }, /* 11 */ -#ifdef MULTIPROCESSOR - { "_ncpu" }, - { "_mp_time" }, -#endif -#endif - { 0 } -}; - -/* Opens pipe to gtop server. Returns 0 on success and -1 on error. */ - -/* !!! THIS FUNCTION RUNS SUID ROOT - CHANGE WITH CAUTION !!! */ - -void -glibtop_init_p (glibtop *server, const unsigned long features, - const unsigned flags) -{ - if (server == NULL) - glibtop_error_r (NULL, "glibtop_init_p (server == NULL)"); - - glibtop_open_p (server, "glibtop", features, flags); -} - -void -glibtop_open_p (glibtop *server, const char *program_name, - const unsigned long features, const unsigned flags) -{ - register int pagesize; - - /* !!! WE ARE ROOT HERE - CHANGE WITH CAUTION !!! */ - - server->name = program_name; - - server->machine.uid = getuid (); - server->machine.euid = geteuid (); - server->machine.gid = getgid (); - server->machine.egid = getegid (); - - /* initialize the kernel interface */ - - server->machine.kd = kvm_open (NULL, NULL, NULL, O_RDONLY, "libgtop"); - - if (server->machine.kd == NULL) - glibtop_error_io_r (server, "kvm_open"); - - /* get the list of symbols we want to access in the kernel */ - - server->machine.nlist_count = kvm_nlist - (server->machine.kd, _glibtop_nlist); - - if (server->machine.nlist_count < 0) - glibtop_error_io_r (server, "nlist"); - -#ifdef MULTIPROCESSOR - /* were ncpu and xp_time not found in the nlist? */ - - if ((server->machine.nlist_count > 0) && - (_glibtop_nlist[X_NCPU].n_type == 0) && - (_glibtop_nlist[X_MP_TIME].n_type == 0)) { - /* we were compiled on an MP system but we are not running - * on one, so we will pretend this didn't happen and set - * ncpu = 1 */ - server->machine.nlist_count -= 2; - server->machine.ncpu = 1; - } -#endif - -#ifdef solbourne - { - unsigned int status, type; - - /* Get the number of CPUs on this system. */ - syscall(SYS_getcpustatus, &status, - &server->machine.ncpu, &type); - } -#endif - - /* Make sure all of the symbols were found. */ - - if ((server->machine.nlist_count > 0) && - (_glibtop_check_nlist (server, _glibtop_nlist) > 0)) - _exit (1); - - /* Get process array stuff. */ - - (void) _glibtop_getkval (server, _glibtop_nlist[X_NPROC].n_value, - (int *)(&server->machine.nproc), - sizeof (server->machine.nproc), - _glibtop_nlist[X_NPROC].n_name); - - (void) _glibtop_getkval (server, _glibtop_nlist[X_PROC].n_value, - (int *)(&server->machine.ptable_offset), - sizeof (server->machine.ptable_offset), - _glibtop_nlist[X_PROC].n_name); - - server->machine.ptable_size = (unsigned long) server->machine.nproc * - (unsigned long) sizeof (struct proc); - - server->machine.proc_table = glibtop_malloc_r - (server, server->machine.ptable_size); - - /* This are for the memory statistics. */ - - (void) _glibtop_getkval (server, _glibtop_nlist[X_PAGES].n_value, - (int *)(&server->machine.pages), - sizeof (server->machine.pages), - _glibtop_nlist[X_PAGES].n_name); - - (void) _glibtop_getkval (server, _glibtop_nlist[X_EPAGES].n_value, - (int *)(&server->machine.epages), - sizeof (server->machine.epages), - _glibtop_nlist[X_EPAGES].n_name); - - server->machine.bytesize = server->machine.epages - - server->machine.pages; - server->machine.count = server->machine.bytesize / - sizeof (struct page); - - server->machine.physpage = (struct page *) - glibtop_malloc_r (server, server->machine.bytesize); - - /* get the page size with "getpagesize" and - * calculate pageshift from it */ - - pagesize = getpagesize(); - - server->machine.pageshift = 0; - - while (pagesize > 1) { - server->machine.pageshift++; - pagesize >>= 1; - } - - /* we only need the amount of log(2)1024 for our conversion */ - - server->machine.pageshift -= LOG1024; - - /* Drop priviledges. */ - - if (setreuid (server->machine.euid, server->machine.uid)) - _exit (1); - - if (setregid (server->machine.egid, server->machine.gid)) - _exit (1); - - /* !!! END OF SUID ROOT PART !!! */ - - /* Our effective uid is now those of the user invoking the server, - * so we do no longer have any priviledges. */ - - /* NOTE: On SunOS, we do not need to be suid root, we just need to - * be sgid kmem. - * - * The server will only use setegid() to get back it's priviledges, - * so it will fail if it is suid root and not sgid kmem. */ -} - -/* Used internally. Returns number of symbols that cannot be found in - * the nlist. */ - -int -_glibtop_check_nlist (void *server, register struct nlist *nlst) -{ - register int not_found; - - /* check to see if we got ALL the symbols we requested */ - /* this will write one line to stderr for every symbol not found */ - - not_found = 0; - - while (nlst->n_name != NULL) { - -#ifdef i386 - if (nlst->n_value == 0) { - glibtop_error_r (server, - "kernel: no symbol named `%s'", - nlst->n_name); - not_found++; - } -#else - if (nlst->n_type == 0) { - glibtop_error_r (server, - "kernel: no symbol named `%s'", - nlst->n_name); - not_found++; - } -#endif - - nlst++; - } - - return not_found; -} - -/* Used internally. Fetches value from kernel. */ - -int -_glibtop_getkval (void *void_server, unsigned long offset, int *ptr, - int size, char *refstr) -{ - glibtop *server = (glibtop *) void_server; - - if (kvm_read (server->machine.kd, offset, ptr, size) != size) - { - if (*refstr == '!') return 0; - - glibtop_error_r (server, "kvm_read(%s): %s", - refstr, strerror (errno)); - } - - return 1; -} - -/* Used internally. Reads process table from kernel. */ - -void -_glibtop_read_proc_table (void *void_server) -{ - glibtop *server = (glibtop *) void_server; - - /* !!! THE FOLLOWING CODE RUNS SGID KMEM - CHANGE WITH CAUTION !!! */ - - setregid (server->machine.gid, server->machine.egid); - - /* Read process table from kernel. */ - - (void) _glibtop_getkval (server, server->machine.ptable_offset, - (int *) server->machine.proc_table, - (size_t) server->machine.ptable_size, - _glibtop_nlist[X_PROC].n_name); - - if (setregid (server->machine.egid, server->machine.gid)) - _exit (1); - - /* !!! END OF SGID KMEM PART !!! */ -} - -/* Used internally. Finds pid in process table. */ - -struct proc * -_glibtop_find_pid (void *void_server, pid_t pid) -{ - register struct proc *pp; - register int i; - - glibtop *server = (glibtop *) void_server; - - for (pp = server->machine.proc_table, i = 0; - i < server->machine.nproc; pp++, i++) { - if ((pp->p_stat != 0) && (pp->p_pid == pid)) - return pp; - } - - return NULL; -} diff --git a/sysdeps/sun4/ppp.c b/sysdeps/sun4/ppp.c deleted file mode 100644 index 4f738ff2..00000000 --- a/sysdeps/sun4/ppp.c +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -/* $Id$ */ - -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 1.0. - - Contributed by Martin Baulig <martin@home-of-linux.org>, October 1998. - - LibGTop is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - LibGTop is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with LibGTop; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#include <glibtop.h> -#include <glibtop/error.h> -#include <glibtop/ppp.h> - -static const unsigned long _glibtop_sysdeps_ppp = 0; - -/* Init function. */ - -int -glibtop_init_ppp_s (glibtop *server) -{ - server->sysdeps.ppp = _glibtop_sysdeps_ppp; -} - -/* Provides PPP/ISDN information. */ - -int -glibtop_get_ppp_s (glibtop *server, glibtop_ppp *buf, unsigned short device) -{ - memset (buf, 0, sizeof (glibtop_ppp)); -} diff --git a/sysdeps/sun4/procdata.c b/sysdeps/sun4/procdata.c deleted file mode 100644 index fdeb4db5..00000000 --- a/sysdeps/sun4/procdata.c +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -/* $Id$ */ - -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 1.0. - - Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998. - - LibGTop is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - LibGTop is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with LibGTop; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#include <config.h> -#include <glibtop/procdata.h> - -/* Provides detailed information about a process. */ - -void -glibtop_get_procdata_p (glibtop *server, glibtop_procdata *buf, pid_t pid) -{ - memset (buf, 0, sizeof (glibtop_procdata)); -} diff --git a/sysdeps/sun4/prockernel.c b/sysdeps/sun4/prockernel.c deleted file mode 100644 index 8011469c..00000000 --- a/sysdeps/sun4/prockernel.c +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -/* $Id$ */ - -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 1.0. - - Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998. - - LibGTop is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - LibGTop is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with LibGTop; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#include <glibtop.h> -#include <glibtop/prockernel.h> - -#include <glibtop_suid.h> - -static const unsigned long _glibtop_sysdeps_proc_kernel = -(1L << GLIBTOP_PROC_KERNEL_K_FLAGS) + (1L << GLIBTOP_PROC_KERNEL_WCHAN); - -/* Provides detailed information about a process. */ - -int -glibtop_get_proc_kernel_p (glibtop *server, glibtop_proc_kernel *buf, - pid_t pid) -{ - struct proc *pp; - - glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_KERNEL), 0); - - memset (buf, 0, sizeof (glibtop_proc_kernel)); - - /* Read process table from kernel. */ - - _glibtop_read_proc_table (server); - - /* Find the pid in the process table. */ - - pp = _glibtop_find_pid (server, pid); - - if (pp == NULL) return; - - /* Fill in data fields. */ - - buf->k_flags = pp->p_flag; - buf->nwchan = (unsigned long) pp->p_wchan; - - buf->flags = _glibtop_sysdeps_proc_kernel; -} diff --git a/sysdeps/sun4/proclist.c b/sysdeps/sun4/proclist.c deleted file mode 100644 index 1239c57a..00000000 --- a/sysdeps/sun4/proclist.c +++ /dev/null @@ -1,99 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -/* $Id$ */ - -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 1.0. - - Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998. - - LibGTop is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - LibGTop is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with LibGTop; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#include <glibtop.h> -#include <glibtop/xmalloc.h> -#include <glibtop/proclist.h> - -#include <glibtop_suid.h> - -static const unsigned long _glibtop_sysdeps_proclist = -(1L << GLIBTOP_PROCLIST_TOTAL) + (1L << GLIBTOP_PROCLIST_NUMBER) + -(1L << GLIBTOP_PROCLIST_SIZE); - -/* Fetch list of currently running processes. - * - * IMPORTANT NOTE: - * On error, this function MUST return NULL and set buf->flags to zero ! - * On success, it returnes a pointer to a list of buf->number elements - * each buf->size big. The total size is stored in buf->total. */ - -unsigned * -glibtop_get_proclist_p (glibtop *server, glibtop_proclist *buf, - int64_t which, int64_t arg) -{ - register struct proc *pp; - register int i, nproc = 0; - unsigned *proc_list = NULL; - size_t proc_size; - - glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROCLIST), 0); - - memset (buf, 0, sizeof (glibtop_proclist)); - - /* Read process table from kernel. */ - - _glibtop_read_proc_table (server); - - /* Count number of processes. */ - - for (pp = server->machine.proc_table, i = 0; - i < server->machine.nproc; pp++, i++) { - if (pp->p_stat == 0) - continue; - else - nproc++; - } - - if (nproc == 0) /* Should never happen. */ - return NULL; - - /* Allocate space for process list. */ - - proc_size = nproc * sizeof (unsigned); - - proc_list = glibtop_malloc_r (server, proc_size); - - /* Write process list. */ - - for (pp = server->machine.proc_table, i = 0, nproc = 0; - i < server->machine.nproc; pp++, i++) { - if (pp->p_stat == 0) - continue; - proc_list [nproc++] = pp->p_pid; - } - - /* Since everything is ok now, we can set buf->flags, fill in the remaining fields - and return proc_list. */ - - buf->flags = _glibtop_sysdeps_proclist; - - buf->size = sizeof (unsigned); - buf->number = nproc; - - buf->total = nproc * sizeof (unsigned); - - return proc_list; -} diff --git a/sysdeps/sun4/procmem.c b/sysdeps/sun4/procmem.c deleted file mode 100644 index 5bbf8852..00000000 --- a/sysdeps/sun4/procmem.c +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -/* $Id$ */ - -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 1.0. - - Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998. - - LibGTop is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - LibGTop is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with LibGTop; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#include <config.h> -#include <glibtop/procmem.h> - -#include <glibtop_suid.h> - -static const unsigned long _glibtop_sysdeps_proc_mem = -(1L << GLIBTOP_PROC_MEM_SIZE) + (1L << GLIBTOP_PROC_MEM_RSS) + -(1L << GLIBTOP_PROC_MEM_RSS_RLIM); - -/* Provides detailed information about a process. */ - -int -glibtop_get_proc_mem_p (glibtop *server, glibtop_proc_mem *buf, - pid_t pid) -{ - struct proc *pp; - - glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_MEM), 0); - - memset (buf, 0, sizeof (glibtop_proc_mem)); - - /* Read process table from kernel. */ - - _glibtop_read_proc_table (server); - - /* Find the pid in the process table. */ - - pp = _glibtop_find_pid (server, pid); - - if (pp == NULL) return; - - /* Fill in data fields. */ - - buf->size = (pp)->p_tsize + (pp)->p_dsize + (pp)->p_ssize; - - buf->rss = pp->p_rssize; - buf->rss_rlim = pp->p_maxrss; - - buf->flags = _glibtop_sysdeps_proc_mem; -} diff --git a/sysdeps/sun4/procsegment.c b/sysdeps/sun4/procsegment.c deleted file mode 100644 index 7c09ee6b..00000000 --- a/sysdeps/sun4/procsegment.c +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -/* $Id$ */ - -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 1.0. - - Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998. - - LibGTop is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - LibGTop is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with LibGTop; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#include <glibtop.h> -#include <glibtop/procsegment.h> - -#include <glibtop_suid.h> - -static const unsigned long _glibtop_sysdeps_proc_segment = -(1L << GLIBTOP_PROC_SEGMENT_TEXT_RSS) + -(1L << GLIBTOP_PROC_SEGMENT_DATA_RSS); - -/* Provides detailed information about a process. */ - -int -glibtop_get_proc_segment_p (glibtop *server, glibtop_proc_segment *buf, - pid_t pid) -{ - struct proc *pp; - - glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_SEGMENT), 0); - - memset (buf, 0, sizeof (glibtop_proc_segment)); - - /* Read process table from kernel. */ - - _glibtop_read_proc_table (server); - - /* Find the pid in the process table. */ - - pp = _glibtop_find_pid (server, pid); - - if (pp == NULL) return; - - /* Fill in data fields. */ - - buf->text_rss = pp->p_tsize; - buf->data_rss = pp->p_dsize; - - buf->flags = _glibtop_sysdeps_proc_segment; -} diff --git a/sysdeps/sun4/procsignal.c b/sysdeps/sun4/procsignal.c deleted file mode 100644 index 216c420d..00000000 --- a/sysdeps/sun4/procsignal.c +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -/* $Id$ */ - -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 1.0. - - Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998. - - LibGTop is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - LibGTop is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with LibGTop; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#include <glibtop.h> -#include <glibtop/procsignal.h> - -#include <glibtop_suid.h> - -static const unsigned long _glibtop_sysdeps_proc_signal = -(1L << GLIBTOP_PROC_SIGNAL_SIGNAL) + (1L << GLIBTOP_PROC_SIGNAL_BLOCKED) + -(1L << GLIBTOP_PROC_SIGNAL_SIGIGNORE) + (1L << GLIBTOP_PROC_SIGNAL_SIGCATCH); - -/* Provides detailed information about a process. */ - -int -glibtop_get_proc_signal_p (glibtop *server, glibtop_proc_signal *buf, - pid_t pid) -{ - struct proc *pp; - - glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_SIGNAL), 0); - - memset (buf, 0, sizeof (glibtop_proc_signal)); - - /* Read process table from kernel. */ - - _glibtop_read_proc_table (server); - - /* Find the pid in the process table. */ - - pp = _glibtop_find_pid (server, pid); - - if (pp == NULL) return; - - /* Fill in data fields. */ - - buf->signal [0] = pp->p_sig; - buf->blocked [0] = pp->p_sigmask; - buf->sigignore [0] = pp->p_sigignore; - buf->sigcatch [0] = pp->p_sigcatch; - - buf->flags = _glibtop_sysdeps_proc_signal; -} diff --git a/sysdeps/sun4/procstate.c b/sysdeps/sun4/procstate.c deleted file mode 100644 index 4fffd8bd..00000000 --- a/sysdeps/sun4/procstate.c +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -/* $Id$ */ - -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 1.0. - - Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998. - - LibGTop is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - LibGTop is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with LibGTop; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#include <glibtop.h> -#include <glibtop/procstate.h> - -#include <glibtop_suid.h> - -static const unsigned long _glibtop_sysdeps_proc_state = -(1L << GLIBTOP_PROC_STATE_STATE) + (1L << GLIBTOP_PROC_STATE_UID); - -/* Provides detailed information about a process. */ - -int -glibtop_get_proc_state_p (glibtop *server, glibtop_proc_state *buf, - pid_t pid) -{ - struct proc *pp; - - glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_STATE), 0); - - memset (buf, 0, sizeof (glibtop_proc_state)); - - /* Read process table from kernel. */ - - _glibtop_read_proc_table (server); - - /* Find the pid in the process table. */ - - pp = _glibtop_find_pid (server, pid); - - if (pp == NULL) return; - - /* Fill in data fields. */ - - buf->state = pp->p_stat; - buf->uid = pp->p_uid; - - buf->flags = _glibtop_sysdeps_proc_state; -} diff --git a/sysdeps/sun4/proctime.c b/sysdeps/sun4/proctime.c deleted file mode 100644 index c18376c2..00000000 --- a/sysdeps/sun4/proctime.c +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -/* $Id$ */ - -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 1.0. - - Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998. - - LibGTop is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - LibGTop is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with LibGTop; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#include <glibtop.h> -#include <glibtop/proctime.h> - -#include <glibtop_suid.h> - -static const unsigned long _glibtop_sysdeps_proc_time = -(1L << GLIBTOP_PROC_TIME_START_TIME) + (1L << GLIBTOP_PROC_TIME_UTIME); - -/* Provides detailed information about a process. */ - -int -glibtop_get_proc_time_p (glibtop *server, glibtop_proc_time *buf, - pid_t pid) -{ - struct proc *pp; - - glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_TIME), 0); - - memset (buf, 0, sizeof (glibtop_proc_time)); - - /* Read process table from kernel. */ - - _glibtop_read_proc_table (server); - - /* Find the pid in the process table. */ - - pp = _glibtop_find_pid (server, pid); - - if (pp == NULL) return; - - /* Fill in data fields. */ - - buf->start_time = pp->p_time; - buf->utime = pp->p_cpticks; - - buf->flags = _glibtop_sysdeps_proc_time; -} diff --git a/sysdeps/sun4/procuid.c b/sysdeps/sun4/procuid.c deleted file mode 100644 index c1b52ebc..00000000 --- a/sysdeps/sun4/procuid.c +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -/* $Id$ */ - -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 1.0. - - Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998. - - LibGTop is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - LibGTop is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with LibGTop; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#include <glibtop.h> -#include <glibtop/procuid.h> - -#include <glibtop_suid.h> - -static const unsigned long _glibtop_sysdeps_proc_uid = -(1L << GLIBTOP_PROC_UID_UID) + (1L << GLIBTOP_PROC_UID_EUID) + -(1L << GLIBTOP_PROC_UID_EGID) + (1L << GLIBTOP_PROC_UID_PID) + -(1L << GLIBTOP_PROC_UID_PPID) + (1L << GLIBTOP_PROC_UID_PGRP) + -(1L << GLIBTOP_PROC_UID_TPGID) + (1L << GLIBTOP_PROC_UID_PRIORITY) + -(1L << GLIBTOP_PROC_UID_NICE); - -/* Provides detailed information about a process. */ - -int -glibtop_get_proc_uid_p (glibtop *server, glibtop_proc_uid *buf, - pid_t pid) -{ - struct proc *pp; - - glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_UID), 0); - - memset (buf, 0, sizeof (glibtop_proc_uid)); - - /* Read process table from kernel. */ - - _glibtop_read_proc_table (server); - - /* Find the pid in the process table. */ - - pp = _glibtop_find_pid (server, pid); - - if (pp == NULL) return; - - /* Fill in data fields. */ - - buf->uid = pp->p_uid; - buf->euid = pp->p_suid; - buf->egid = pp->p_sgid; - buf->pid = pp->p_pid; - buf->ppid = pp->p_ppid; - buf->pgrp = pp->p_pgrp; - buf->tpgid = pp->p_pgrp; - buf->priority = pp->p_pri; - buf->nice = pp->p_nice; - - buf->flags = _glibtop_sysdeps_proc_uid; -} diff --git a/sysdeps/sun4/sem_limits.c b/sysdeps/sun4/sem_limits.c deleted file mode 100644 index df29ba5f..00000000 --- a/sysdeps/sun4/sem_limits.c +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -/* $Id$ */ - -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 1.0. - - Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998. - - LibGTop is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - LibGTop is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with LibGTop; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#include <glibtop.h> -#include <glibtop/sem_limits.h> - -#include <glibtop_suid.h> - -/* #define KERNEL to get declaration of `struct seminfo'. */ - -#define KERNEL - -#include <sys/ipc.h> -#include <sys/sem.h> - -static unsigned long _glibtop_sysdeps_sem_limits = -(1L << GLIBTOP_SEM_LIMITS_SEMMAP) + (1L << GLIBTOP_SEM_LIMITS_SEMMNI) + -(1L << GLIBTOP_SEM_LIMITS_SEMMNS) + (1L << GLIBTOP_SEM_LIMITS_SEMMNU) + -(1L << GLIBTOP_SEM_LIMITS_SEMMSL) + (1L << GLIBTOP_SEM_LIMITS_SEMOPM) + -(1L << GLIBTOP_SEM_LIMITS_SEMUME) + (1L << GLIBTOP_SEM_LIMITS_SEMUSZ) + -(1L << GLIBTOP_SEM_LIMITS_SEMVMX) + (1L << GLIBTOP_SEM_LIMITS_SEMAEM); - -/* Provides information about sysv sem limits. */ - -int -glibtop_get_sem_limits_p (glibtop *server, glibtop_sem_limits *buf) -{ - struct seminfo seminfo; - - glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_SEM_LIMITS), 0); - - memset (buf, 0, sizeof (glibtop_sem_limits)); - - /* !!! THE FOLLOWING CODE RUNS SGID KMEM - CHANGE WITH CAUTION !!! */ - - setregid (server->machine.gid, server->machine.egid); - - /* get the load average array */ - - (void) _glibtop_getkval (server, _glibtop_nlist [X_SEMINFO].n_value, - (int *) &seminfo, sizeof (seminfo), - _glibtop_nlist [X_SEMINFO].n_name); - - if (setregid (server->machine.egid, server->machine.gid)) - _exit (1); - - /* !!! END OF SGID KMEM PART !!! */ - - buf->semmap = seminfo.semmap; - buf->semmni = seminfo.semmni; - buf->semmns = seminfo.semmns; - buf->semmnu = seminfo.semmnu; - buf->semmsl = seminfo.semmsl; - buf->semopm = seminfo.semopm; - buf->semume = seminfo.semume; - buf->semusz = seminfo.semusz; - buf->semvmx = seminfo.semvmx; - buf->semaem = seminfo.semaem; - - buf->flags = _glibtop_sysdeps_sem_limits; -} diff --git a/sysdeps/sun4/shm_limits.c b/sysdeps/sun4/shm_limits.c deleted file mode 100644 index 842d843e..00000000 --- a/sysdeps/sun4/shm_limits.c +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -/* $Id$ */ - -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 1.0. - - Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998. - - LibGTop is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - LibGTop is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with LibGTop; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#include <glibtop.h> -#include <glibtop/shm_limits.h> - -#include <glibtop_suid.h> - -/* #define KERNEL to get declaration of `struct shminfo'. */ - -#define KERNEL - -#include <sys/ipc.h> -#include <sys/shm.h> - -static unsigned long _glibtop_sysdeps_shm_limits = -(1L << GLIBTOP_SHM_LIMITS_SHMMAX) + (1L << GLIBTOP_SHM_LIMITS_SHMMIN) + -(1L << GLIBTOP_SHM_LIMITS_SHMMNI) + (1L << GLIBTOP_SHM_LIMITS_SHMSEG) + -(1L << GLIBTOP_SHM_LIMITS_SHMALL); - -/* Provides information about sysv ipc limits. */ - -int -glibtop_get_shm_limits_p (glibtop *server, glibtop_shm_limits *buf) -{ - struct shminfo shminfo; - - glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_SHM_LIMITS), 0); - - memset (buf, 0, sizeof (glibtop_shm_limits)); - - /* !!! THE FOLLOWING CODE RUNS SGID KMEM - CHANGE WITH CAUTION !!! */ - - setregid (server->machine.gid, server->machine.egid); - - /* get the load average array */ - - (void) _glibtop_getkval (server, _glibtop_nlist [X_SHMINFO].n_value, - (int *) &shminfo, sizeof (shminfo), - _glibtop_nlist [X_SHMINFO].n_name); - - if (setregid (server->machine.egid, server->machine.gid)) - _exit (1); - - /* !!! END OF SGID KMEM PART !!! */ - - buf->shmmax = shminfo.shmmax; - buf->shmmin = shminfo.shmmin; - buf->shmmni = shminfo.shmmni; - buf->shmseg = shminfo.shmseg; - buf->shmall = shminfo.shmall; - - buf->flags = _glibtop_sysdeps_shm_limits; -} diff --git a/sysdeps/sun4/swap.c b/sysdeps/sun4/swap.c deleted file mode 100644 index ac6bfa39..00000000 --- a/sysdeps/sun4/swap.c +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -/* $Id$ */ - -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 1.0. - - Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998. - - LibGTop is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - LibGTop is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with LibGTop; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#include <glibtop.h> -#include <glibtop/swap.h> - -#include <glibtop_suid.h> - -/* Provides information about swap usage. */ - -int -glibtop_get_swap_p (glibtop *server, glibtop_swap *buf) -{ - glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_SWAP), 0); - - memset (buf, 0, sizeof (glibtop_swap)); -} diff --git a/sysdeps/sun4/uptime.c b/sysdeps/sun4/uptime.c deleted file mode 100644 index 35db26f1..00000000 --- a/sysdeps/sun4/uptime.c +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -/* $Id$ */ - -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 1.0. - - Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998. - - LibGTop is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - LibGTop is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with LibGTop; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#include <glibtop.h> -#include <glibtop/cpu.h> -#include <glibtop/uptime.h> - -#include <glibtop_suid.h> - -static const unsigned long _glibtop_sysdeps_uptime = -(1L << GLIBTOP_UPTIME_UPTIME) + (1L << GLIBTOP_UPTIME_IDLETIME); - -/* Provides uptime and idle time. */ - -int -glibtop_get_uptime_p (glibtop *server, glibtop_uptime *buf) -{ - glibtop_cpu cpu; - - glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_UPTIME), 0); - - /* Get currect cpu usage. */ - - glibtop_get_cpu_p (server, &cpu); - - /* Make sure all required fields are present. */ - - if (((cpu.flags & (1L << GLIBTOP_CPU_TOTAL)) == 0) || - ((cpu.flags & (1L << GLIBTOP_CPU_IDLE)) == 0) || - ((cpu.flags & (1L << GLIBTOP_CPU_FREQUENCY)) == 0) || - (cpu.frequency == 0)) - return; - - /* Simply calculate uptime and idle time from - * cpu usage. */ - - buf->uptime = (double) cpu.total / (double) cpu.frequency; - buf->idletime = (double) cpu.idle / (double) cpu.frequency; - - buf->flags = _glibtop_sysdeps_uptime; -} |