diff --git a/ChangeLog b/ChangeLog index 86acc872..8b59385a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +1998-08-06 Martin Baulig + + * include/glibtop/*.h: Using `GLIBTOP_GUILE' instead of `HAVE_GUILE' + so one should be able to use libgtop without guile in an application + even if guile is installed. + + * sysdeps/common/mountlist.c: Fixed some `xstrdup' problems. + + * lib/open.c: Now correctly reading server features for + `GLIBTOP_METHOD_PIPE'. + + * sysdeps/freebsd: New directory. + 1998-08-01 Martin Baulig * include/glibtop/swap.h (glibtop_swap): Added `pagein' and `pageout'. diff --git a/configure.in b/configure.in index 49766be2..1d03841c 100644 --- a/configure.in +++ b/configure.in @@ -253,6 +253,7 @@ sysdeps/sun4/Makefile sysdeps/osf1/Makefile sysdeps/linux/Makefile sysdeps/kernel/Makefile +sysdeps/freebsd/Makefile src/Makefile src/server/Makefile src/daemon/Makefile diff --git a/glibtop.h b/glibtop.h index d0855e73..810d9419 100644 --- a/glibtop.h +++ b/glibtop.h @@ -65,7 +65,7 @@ extern const unsigned long glibtop_server_features; extern glibtop *glibtop_init_r __P((glibtop **, const unsigned long, const unsigned)); extern glibtop *glibtop_init_s __P((glibtop **, const unsigned long, const unsigned)); -#ifdef HAVE_GUILE +#ifdef GLIBTOP_GUILE /* You need to link with -lgtop_guile to get this stuff here. */ diff --git a/include/glibtop/cpu.h b/include/glibtop/cpu.h index e367bd44..daec3187 100644 --- a/include/glibtop/cpu.h +++ b/include/glibtop/cpu.h @@ -65,7 +65,7 @@ extern void glibtop_get_cpu_p __P((glibtop *, glibtop_cpu *)); extern void glibtop_get_cpu_s __P((glibtop *, glibtop_cpu *)); #endif -#ifdef HAVE_GUILE +#ifdef GLIBTOP_GUILE /* You need to link with -lgtop_guile to get this stuff here. */ diff --git a/include/glibtop/fsusage.h b/include/glibtop/fsusage.h index b9ab88d1..91ce846d 100644 --- a/include/glibtop/fsusage.h +++ b/include/glibtop/fsusage.h @@ -55,7 +55,7 @@ extern void glibtop_get_fsusage_l __P((glibtop *, glibtop_fsusage *, const char extern void glibtop_get_fsusage_s __P((glibtop *, glibtop_fsusage *, const char *)); -#ifdef HAVE_GUILE +#ifdef GLIBTOP_GUILE /* You need to link with -lgtop_guile to get this stuff here. */ diff --git a/include/glibtop/global.h b/include/glibtop/global.h index 46bc9538..e4c1d180 100644 --- a/include/glibtop/global.h +++ b/include/glibtop/global.h @@ -63,11 +63,11 @@ #endif #ifdef WITHOUT_GUILE -#undef HAVE_GUILE +#undef GLIBTOP_GUILE #undef GLIBTOP_GUILE_NAMES #endif -#ifdef HAVE_GUILE +#ifdef GLIBTOP_GUILE #include #endif diff --git a/include/glibtop/loadavg.h b/include/glibtop/loadavg.h index cb3b7336..dedf0f16 100644 --- a/include/glibtop/loadavg.h +++ b/include/glibtop/loadavg.h @@ -55,7 +55,7 @@ extern void glibtop_get_loadavg_p __P((glibtop *, glibtop_loadavg *)); extern void glibtop_get_loadavg_s __P((glibtop *, glibtop_loadavg *)); #endif -#ifdef HAVE_GUILE +#ifdef GLIBTOP_GUILE /* You need to link with -lgtop_guile to get this stuff here. */ diff --git a/include/glibtop/mem.h b/include/glibtop/mem.h index 823deed9..366c4f7c 100644 --- a/include/glibtop/mem.h +++ b/include/glibtop/mem.h @@ -69,7 +69,7 @@ extern void glibtop_get_mem_p __P((glibtop *, glibtop_mem *)); extern void glibtop_get_mem_s __P((glibtop *, glibtop_mem *)); #endif -#ifdef HAVE_GUILE +#ifdef GLIBTOP_GUILE /* You need to link with -lgtop_guile to get this stuff here. */ diff --git a/include/glibtop/mountlist.h b/include/glibtop/mountlist.h index 54e58298..715a9dd8 100644 --- a/include/glibtop/mountlist.h +++ b/include/glibtop/mountlist.h @@ -63,7 +63,7 @@ extern glibtop_mountentry *glibtop_get_mountlist_l __P((glibtop *, glibtop_mount extern glibtop_mountentry *glibtop_get_mountlist_s __P((glibtop *, glibtop_mountlist *, int)); -#ifdef HAVE_GUILE +#ifdef GLIBTOP_GUILE /* You need to link with -lgtop_guile to get this stuff here. */ diff --git a/include/glibtop/msg_limits.h b/include/glibtop/msg_limits.h index f5e4af61..fb0f2561 100644 --- a/include/glibtop/msg_limits.h +++ b/include/glibtop/msg_limits.h @@ -67,7 +67,7 @@ extern void glibtop_get_msg_limits_p __P((glibtop *, glibtop_msg_limits *)); extern void glibtop_get_msg_limits_s __P((glibtop *, glibtop_msg_limits *)); #endif -#ifdef HAVE_GUILE +#ifdef GLIBTOP_GUILE /* You need to link with -lgtop_guile to get this stuff here. */ diff --git a/include/glibtop/prockernel.h b/include/glibtop/prockernel.h index 7a9cc06b..15b68990 100644 --- a/include/glibtop/prockernel.h +++ b/include/glibtop/prockernel.h @@ -76,7 +76,7 @@ extern void glibtop_get_proc_kernel_p __P((glibtop *, glibtop_proc_kernel *, pid extern void glibtop_get_proc_kernel_s __P((glibtop *, glibtop_proc_kernel *, pid_t)); #endif -#ifdef HAVE_GUILE +#ifdef GLIBTOP_GUILE /* You need to link with -lgtop_guile to get this stuff here. */ diff --git a/include/glibtop/proclist.h b/include/glibtop/proclist.h index 45dcb757..1d8d3c70 100644 --- a/include/glibtop/proclist.h +++ b/include/glibtop/proclist.h @@ -59,7 +59,7 @@ extern unsigned *glibtop_get_proclist_p __P((glibtop *, glibtop_proclist *)); extern unsigned *glibtop_get_proclist_s __P((glibtop *, glibtop_proclist *)); #endif -#ifdef HAVE_GUILE +#ifdef GLIBTOP_GUILE /* You need to link with -lgtop_guile to get this stuff here. */ diff --git a/include/glibtop/procmem.h b/include/glibtop/procmem.h index ced5a520..1cd9e9e4 100644 --- a/include/glibtop/procmem.h +++ b/include/glibtop/procmem.h @@ -69,7 +69,7 @@ extern void glibtop_get_proc_mem_p __P((glibtop *, glibtop_proc_mem *, pid_t)); extern void glibtop_get_proc_mem_s __P((glibtop *, glibtop_proc_mem *, pid_t)); #endif -#ifdef HAVE_GUILE +#ifdef GLIBTOP_GUILE /* You need to link with -lgtop_guile to get this stuff here. */ diff --git a/include/glibtop/procsegment.h b/include/glibtop/procsegment.h index 5d4249bb..b123c4e2 100644 --- a/include/glibtop/procsegment.h +++ b/include/glibtop/procsegment.h @@ -70,7 +70,7 @@ extern void glibtop_get_proc_segment_p __P((glibtop *, glibtop_proc_segment *, p extern void glibtop_get_proc_segment_s __P((glibtop *, glibtop_proc_segment *, pid_t)); #endif -#ifdef HAVE_GUILE +#ifdef GLIBTOP_GUILE /* You need to link with -lgtop_guile to get this stuff here. */ diff --git a/include/glibtop/procsignal.h b/include/glibtop/procsignal.h index f95a8745..8e919d89 100644 --- a/include/glibtop/procsignal.h +++ b/include/glibtop/procsignal.h @@ -63,7 +63,7 @@ extern void glibtop_get_proc_signal_p __P((glibtop *, glibtop_proc_signal *, pid extern void glibtop_get_proc_signal_s __P((glibtop *, glibtop_proc_signal *, pid_t)); #endif -#ifdef HAVE_GUILE +#ifdef GLIBTOP_GUILE /* You need to link with -lgtop_guile to get this stuff here. */ diff --git a/include/glibtop/procstate.h b/include/glibtop/procstate.h index 3de12b0d..933b70c0 100644 --- a/include/glibtop/procstate.h +++ b/include/glibtop/procstate.h @@ -70,7 +70,7 @@ extern void glibtop_get_proc_state_p __P((glibtop *, glibtop_proc_state *, pid_t extern void glibtop_get_proc_state_s __P((glibtop *, glibtop_proc_state *, pid_t)); #endif -#ifdef HAVE_GUILE +#ifdef GLIBTOP_GUILE /* You need to link with -lgtop_guile to get this stuff here. */ diff --git a/include/glibtop/proctime.h b/include/glibtop/proctime.h index 6bce6b5b..1a5fc7ab 100644 --- a/include/glibtop/proctime.h +++ b/include/glibtop/proctime.h @@ -75,7 +75,7 @@ extern void glibtop_get_proc_time_p __P((glibtop *, glibtop_proc_time *, pid_t)) extern void glibtop_get_proc_time_s __P((glibtop *, glibtop_proc_time *, pid_t)); #endif -#ifdef HAVE_GUILE +#ifdef GLIBTOP_GUILE /* You need to link with -lgtop_guile to get this stuff here. */ diff --git a/include/glibtop/procuid.h b/include/glibtop/procuid.h index 4238f91b..15643923 100644 --- a/include/glibtop/procuid.h +++ b/include/glibtop/procuid.h @@ -79,7 +79,7 @@ extern void glibtop_get_proc_uid_p __P((glibtop *, glibtop_proc_uid *, pid_t)); extern void glibtop_get_proc_uid_s __P((glibtop *, glibtop_proc_uid *, pid_t)); #endif -#ifdef HAVE_GUILE +#ifdef GLIBTOP_GUILE /* You need to link with -lgtop_guile to get this stuff here. */ diff --git a/include/glibtop/sem_limits.h b/include/glibtop/sem_limits.h index 71af5c68..d4d69d40 100644 --- a/include/glibtop/sem_limits.h +++ b/include/glibtop/sem_limits.h @@ -73,7 +73,7 @@ extern void glibtop_get_sem_limits_p __P((glibtop *, glibtop_sem_limits *)); extern void glibtop_get_sem_limits_s __P((glibtop *, glibtop_sem_limits *)); #endif -#ifdef HAVE_GUILE +#ifdef GLIBTOP_GUILE /* You need to link with -lgtop_guile to get this stuff here. */ diff --git a/include/glibtop/shm_limits.h b/include/glibtop/shm_limits.h index 933d61c8..03858852 100644 --- a/include/glibtop/shm_limits.h +++ b/include/glibtop/shm_limits.h @@ -63,7 +63,7 @@ extern void glibtop_get_shm_limits_p __P((glibtop *, glibtop_shm_limits *)); extern void glibtop_get_shm_limits_s __P((glibtop *, glibtop_shm_limits *)); #endif -#ifdef HAVE_GUILE +#ifdef GLIBTOP_GUILE /* You need to link with -lgtop_guile to get this stuff here. */ diff --git a/include/glibtop/swap.h b/include/glibtop/swap.h index 542abaaa..ce620bf6 100644 --- a/include/glibtop/swap.h +++ b/include/glibtop/swap.h @@ -63,7 +63,7 @@ extern void glibtop_get_swap_p __P((glibtop *, glibtop_swap *)); extern void glibtop_get_swap_s __P((glibtop *, glibtop_swap *)); #endif -#ifdef HAVE_GUILE +#ifdef GLIBTOP_GUILE /* You need to link with -lgtop_guile to get this stuff here. */ diff --git a/include/glibtop/sysdeps.h b/include/glibtop/sysdeps.h index 80e66986..dce97d7c 100644 --- a/include/glibtop/sysdeps.h +++ b/include/glibtop/sysdeps.h @@ -81,7 +81,7 @@ struct _glibtop_sysdeps extern void glibtop_get_sysdeps_r __P((glibtop *, glibtop_sysdeps *)); -#ifdef HAVE_GUILE +#ifdef GLIBTOP_GUILE /* You need to link with -lgtop_guile to get this stuff here. */ diff --git a/include/glibtop/uptime.h b/include/glibtop/uptime.h index 8bb08053..63e828ce 100644 --- a/include/glibtop/uptime.h +++ b/include/glibtop/uptime.h @@ -57,7 +57,7 @@ extern void glibtop_get_uptime_p __P((glibtop *, glibtop_uptime *)); extern void glibtop_get_uptime_s __P((glibtop *, glibtop_uptime *)); #endif -#ifdef HAVE_GUILE +#ifdef GLIBTOP_GUILE /* You need to link with -lgtop_guile to get this stuff here. */ diff --git a/lib/open.c b/lib/open.c index 690cece2..168b6a74 100644 --- a/lib/open.c +++ b/lib/open.c @@ -131,7 +131,7 @@ glibtop_open_l (glibtop *server, const char *program_name, close (server->input [1]); close (server->output [0]); - sprintf (version, "Libgtop server %s ready.\n", + sprintf (version, "libgtop server %s ready.\n", LIBGTOP_VERSION); glibtop_read_l (server, sizeof (nbytes), &nbytes); @@ -145,6 +145,10 @@ glibtop_open_l (glibtop *server, const char *program_name, if (memcmp (version, buffer, strlen (version))) glibtop_error_r (server, "server version is not %s", LIBGTOP_VERSION); + + server->flags |= _GLIBTOP_INIT_STATE_SERVER; + + server->features = -1; break; } diff --git a/sysdeps/Makefile.am b/sysdeps/Makefile.am index 20e6c7c2..29e6fffe 100644 --- a/sysdeps/Makefile.am +++ b/sysdeps/Makefile.am @@ -6,4 +6,5 @@ endif SUBDIRS = @sysdeps_dir@ common names $(guile_SUBDIRS) -DIST_SUBDIRS = common guile linux kernel names osf1 stub sun4 +DIST_SUBDIRS = common guile linux kernel names osf1 stub sun4 \ + freebsd diff --git a/sysdeps/common/mountlist.c b/sysdeps/common/mountlist.c index 8545e097..77f9755a 100644 --- a/sysdeps/common/mountlist.c +++ b/sysdeps/common/mountlist.c @@ -360,7 +360,7 @@ read_filesystem_list (need_fs_type, all_fs) #ifdef __NetBSD__ me->me_type = xstrdup (fsp->f_fstypename); #else - me->me_type = fstype_to_string (fsp->f_type); + me->me_type = xstrdup (fstype_to_string (fsp->f_type)); #endif me->me_dev = (dev_t) -1; /* Magic; means not known yet. */ me->me_next = NULL; @@ -385,7 +385,7 @@ read_filesystem_list (need_fs_type, all_fs) me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry)); me->me_devname = xstrdup (fsd.fd_req.devname); me->me_mountdir = xstrdup (fsd.fd_req.path); - me->me_type = gt_names[fsd.fd_req.fstype]; + me->me_type = xstrdup (gt_names[fsd.fd_req.fstype]); me->me_dev = fsd.fd_req.dev; me->me_next = NULL; @@ -422,7 +422,7 @@ read_filesystem_list (need_fs_type, all_fs) me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry)); me->me_devname = xstrdup (stats[counter].f_mntfromname); me->me_mountdir = xstrdup (stats[counter].f_mntonname); - me->me_type = mnt_names[stats[counter].f_type]; + me->me_type = xstrdup (mnt_names[stats[counter].f_type]); me->me_dev = (dev_t) -1; /* Magic; means not known yet. */ me->me_next = NULL; @@ -457,7 +457,7 @@ read_filesystem_list (need_fs_type, all_fs) #endif me->me_mountdir = xstrdup (mnt.mt_filsys); me->me_dev = (dev_t) -1; /* Magic; means not known yet. */ - me->me_type = ""; + me->me_type = xstrdup (""); #ifdef GETFSTYP /* SVR3. */ if (need_fs_type) { diff --git a/sysdeps/freebsd/.cvsignore b/sysdeps/freebsd/.cvsignore new file mode 100644 index 00000000..259351e1 --- /dev/null +++ b/sysdeps/freebsd/.cvsignore @@ -0,0 +1,25 @@ +.deps +.libs +Makefile +Makefile.in +close.lo +cpu.lo +init.lo +libgtop_sysdeps.la +loadavg.lo +mem.lo +msg_limits.lo +open.lo +prockernel.lo +proclist.lo +procmem.lo +procsegment.lo +procsignal.lo +procstate.lo +proctime.lo +procuid.lo +sem_limits.lo +shm_limits.lo +swap.lo +sysdeps.lo +uptime.lo diff --git a/sysdeps/freebsd/Makefile.am b/sysdeps/freebsd/Makefile.am new file mode 100644 index 00000000..046ec1bd --- /dev/null +++ b/sysdeps/freebsd/Makefile.am @@ -0,0 +1,15 @@ +LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@ + +CFLAGS = -Wall -W @CFLAGS@ + +lib_LTLIBRARIES = libgtop_sysdeps.la libgtop_sysdeps_suid.la + +libgtop_sysdeps_la_SOURCES = nosuid.c siglist.c + +libgtop_sysdeps_suid_la_SOURCES = open.c close.c siglist.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 + +include_HEADERS = glibtop_server.h glibtop_machine.h diff --git a/sysdeps/freebsd/close.c b/sysdeps/freebsd/close.c new file mode 100644 index 00000000..9506f275 --- /dev/null +++ b/sysdeps/freebsd/close.c @@ -0,0 +1,28 @@ +/* $Id$ */ + +/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the Gnome Top Library. + Contributed by Martin Baulig , April 1998. + + The Gnome Top Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Gnome Top Library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +/* Closes pipe to gtop server. */ + +void +glibtop_close_s (glibtop *server) +{ } diff --git a/sysdeps/freebsd/cpu.c b/sysdeps/freebsd/cpu.c new file mode 100644 index 00000000..8affc0e6 --- /dev/null +++ b/sysdeps/freebsd/cpu.c @@ -0,0 +1,70 @@ +/* $Id$ */ + +/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the Gnome Top Library. + Contributed by Martin Baulig , April 1998. + + The Gnome Top Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Gnome Top Library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +static const unsigned long _glibtop_sysdeps_cpu = +(1 << GLIBTOP_CPU_TOTAL) + (1 << GLIBTOP_CPU_USER) + +(1 << GLIBTOP_CPU_NICE) + (1 << GLIBTOP_CPU_SYS) + +(1 << GLIBTOP_CPU_IDLE) + (1 << GLIBTOP_CPU_FREQUENCY); + +/* Provides information about cpu usage. */ + +void +glibtop_get_cpu_p (glibtop *server, glibtop_cpu *buf) +{ + long cp_time [CPUSTATES]; + int i; + + glibtop_init_p (&server, 0, 0); + + memset (buf, 0, sizeof (glibtop_cpu)); + + /* !!! THE FOLLOWING CODE RUNS SGID KMEM - CHANGE WITH CAUTION !!! */ + + setregid (server->machine.gid, server->machine.egid); + + /* 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); + + if (setregid (server->machine.egid, server->machine.gid)) + _exit (1); + + /* !!! END OF SUID ROOT PART !!! */ + + 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 = server->machine.hz; + + /* 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/freebsd/glibtop_machine.h b/sysdeps/freebsd/glibtop_machine.h new file mode 100644 index 00000000..5f404a5f --- /dev/null +++ b/sysdeps/freebsd/glibtop_machine.h @@ -0,0 +1,85 @@ +/* $Id$ */ + +/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the Gnome Top Library. + Contributed by Martin Baulig , April 1998. + + The Gnome Top Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Gnome Top Library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. 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__ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +__BEGIN_DECLS + +#define X_CCPU 0 +#define X_CP_TIME 1 +#define X_HZ 2 +#define X_STATHZ 3 +#define X_AVENRUN 4 +#define VM_SWAPLIST 5 /* list of free swap areas */ +#define VM_SWDEVT 6 /* list of swap devices and sizes */ +#define VM_NSWAP 7 /* size of largest swap device */ +#define VM_NSWDEV 8 /* number of swap devices */ +#define VM_DMMAX 9 /* maximum size of a swap block */ +#define X_CNT 10 /* struct vmmeter cnt */ +#define X_LASTPID 11 + +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 */ + u_int64_t hz; /* Tick frequency */ + int ncpu; /* Number of CPUs we have */ + kvm_t *kd; +}; + +/* Those functions are used internally in libgtop */ + +#ifdef _IN_LIBGTOP + +extern struct nlist _glibtop_nlist[]; + +extern int _glibtop_check_nlist __P((void *, register struct nlist *)); + +extern int _glibtop_getkval __P((void *, unsigned long, int *, int, char *)); + +#endif + +__END_DECLS + +#endif diff --git a/sysdeps/freebsd/glibtop_server.h b/sysdeps/freebsd/glibtop_server.h new file mode 100644 index 00000000..4b37edfc --- /dev/null +++ b/sysdeps/freebsd/glibtop_server.h @@ -0,0 +1,46 @@ +/* $Id$ */ + +/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the Gnome Top Library. + Contributed by Martin Baulig , April 1998. + + The Gnome Top Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Gnome Top Library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. 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_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) + +__END_DECLS + +#endif diff --git a/sysdeps/freebsd/loadavg.c b/sysdeps/freebsd/loadavg.c new file mode 100644 index 00000000..714485e9 --- /dev/null +++ b/sysdeps/freebsd/loadavg.c @@ -0,0 +1,31 @@ +/* $Id$ */ + +/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the Gnome Top Library. + Contributed by Martin Baulig , April 1998. + + The Gnome Top Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Gnome Top Library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +/* Provides load averange. */ + +void +glibtop_get_loadavg_p (glibtop *server, glibtop_loadavg *buf) +{ + memset (buf, 0, sizeof (glibtop_loadavg)); +} diff --git a/sysdeps/freebsd/mem.c b/sysdeps/freebsd/mem.c new file mode 100644 index 00000000..9618a575 --- /dev/null +++ b/sysdeps/freebsd/mem.c @@ -0,0 +1,31 @@ +/* $Id$ */ + +/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the Gnome Top Library. + Contributed by Martin Baulig , April 1998. + + The Gnome Top Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Gnome Top Library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +/* Provides information about memory usage. */ + +void +glibtop_get_mem_p (glibtop *server, glibtop_mem *buf) +{ + memset (buf, 0, sizeof (glibtop_mem)); +} diff --git a/sysdeps/freebsd/msg_limits.c b/sysdeps/freebsd/msg_limits.c new file mode 100644 index 00000000..fbe5b3a5 --- /dev/null +++ b/sysdeps/freebsd/msg_limits.c @@ -0,0 +1,30 @@ +/* $Id$ */ + +/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the Gnome Top Library. + Contributed by Martin Baulig , April 1998. + + The Gnome Top Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Gnome Top Library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +/* Provides information about sysv ipc limits. */ + +void +glibtop_get_msg_limits_p (glibtop *server, glibtop_msg_limits *buf) +{ + memset (buf, 0, sizeof (glibtop_msg_limits)); +} diff --git a/sysdeps/freebsd/nosuid.c b/sysdeps/freebsd/nosuid.c new file mode 100644 index 00000000..e43e5c9f --- /dev/null +++ b/sysdeps/freebsd/nosuid.c @@ -0,0 +1,32 @@ +/* $Id$ */ + +/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the Gnome Top Library. + Contributed by Martin Baulig , April 1998. + + The Gnome Top Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Gnome Top Library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +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/freebsd/open.c b/sysdeps/freebsd/open.c new file mode 100644 index 00000000..edc6abaa --- /dev/null +++ b/sysdeps/freebsd/open.c @@ -0,0 +1,179 @@ +/* $Id$ */ + +/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the Gnome Top Library. + Contributed by Martin Baulig , April 1998. + + The Gnome Top Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Gnome Top Library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include + +struct nlist _glibtop_nlist[] = { + { "_ccpu" }, /* 0 */ + { "_cp_time" }, /* 1 */ + { "_hz" }, /* 2 */ + { "_stathz" }, /* 3 */ + { "_averunnable" }, /* 4 */ + { "_swaplist" }, /* 5 */ + { "_swdevt" }, /* 6 */ + { "_nswap" }, /* 7 */ + { "_nswdev" }, /* 8 */ + { "_dmmax" }, /* 9 */ + { "_cnt" }, /* 10 */ + { "_nextpid" }, /* 11 */ + { 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) +{ + /* !!! 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"); + + /* Make sure all of the symbols were found. */ + + if ((server->machine.nlist_count > 0) && + (_glibtop_check_nlist (server, _glibtop_nlist) > 0)) + _exit (1); + + /* Get tick frequency. */ + + (void) _glibtop_getkval (server, _glibtop_nlist [X_STATHZ].n_value, + (int *) &server->machine.hz, + sizeof (server->machine.hz), + _glibtop_nlist [X_STATHZ].n_name); + + if (!server->machine.hz) + (void) _glibtop_getkval + (server, _glibtop_nlist [X_HZ].n_value, + (int *) &server->machine.hz, + sizeof (server->machine.hz), + _glibtop_nlist [X_STATHZ].n_name); + + /* 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; +} + diff --git a/sysdeps/freebsd/prockernel.c b/sysdeps/freebsd/prockernel.c new file mode 100644 index 00000000..9312f924 --- /dev/null +++ b/sysdeps/freebsd/prockernel.c @@ -0,0 +1,32 @@ +/* $Id$ */ + +/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the Gnome Top Library. + Contributed by Martin Baulig , April 1998. + + The Gnome Top Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Gnome Top Library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +/* Provides detailed information about a process. */ + +void +glibtop_get_proc_kernel_p (glibtop *server, glibtop_proc_kernel *buf, + pid_t pid) +{ + memset (buf, 0, sizeof (glibtop_proc_kernel)); +} diff --git a/sysdeps/freebsd/proclist.c b/sysdeps/freebsd/proclist.c new file mode 100644 index 00000000..916d73ab --- /dev/null +++ b/sysdeps/freebsd/proclist.c @@ -0,0 +1,39 @@ +/* $Id$ */ + +/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the Gnome Top Library. + Contributed by Martin Baulig , April 1998. + + The Gnome Top Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Gnome Top Library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +#define GLIBTOP_PROCLIST_FLAGS 3 + +/* 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) +{ + memset (buf, 0, sizeof (glibtop_proclist)); + return NULL; +} diff --git a/sysdeps/freebsd/procmem.c b/sysdeps/freebsd/procmem.c new file mode 100644 index 00000000..70eadd88 --- /dev/null +++ b/sysdeps/freebsd/procmem.c @@ -0,0 +1,32 @@ +/* $Id$ */ + +/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the Gnome Top Library. + Contributed by Martin Baulig , April 1998. + + The Gnome Top Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Gnome Top Library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +/* Provides detailed information about a process. */ + +void +glibtop_get_proc_mem_p (glibtop *server, glibtop_proc_mem *buf, + pid_t pid) +{ + memset (buf, 0, sizeof (glibtop_proc_mem)); +} diff --git a/sysdeps/freebsd/procsegment.c b/sysdeps/freebsd/procsegment.c new file mode 100644 index 00000000..6bc504d1 --- /dev/null +++ b/sysdeps/freebsd/procsegment.c @@ -0,0 +1,32 @@ +/* $Id$ */ + +/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the Gnome Top Library. + Contributed by Martin Baulig , April 1998. + + The Gnome Top Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Gnome Top Library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +/* Provides detailed information about a process. */ + +void +glibtop_get_proc_segment_p (glibtop *server, glibtop_proc_segment *buf, + pid_t pid) +{ + memset (buf, 0, sizeof (glibtop_proc_segment)); +} diff --git a/sysdeps/freebsd/procsignal.c b/sysdeps/freebsd/procsignal.c new file mode 100644 index 00000000..09f4c7d0 --- /dev/null +++ b/sysdeps/freebsd/procsignal.c @@ -0,0 +1,32 @@ +/* $Id$ */ + +/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the Gnome Top Library. + Contributed by Martin Baulig , April 1998. + + The Gnome Top Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Gnome Top Library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +/* Provides detailed information about a process. */ + +void +glibtop_get_proc_signal_p (glibtop *server, glibtop_proc_signal *buf, + pid_t pid) +{ + memset (buf, 0, sizeof (glibtop_proc_signal)); +} diff --git a/sysdeps/freebsd/procstate.c b/sysdeps/freebsd/procstate.c new file mode 100644 index 00000000..4a3bd963 --- /dev/null +++ b/sysdeps/freebsd/procstate.c @@ -0,0 +1,32 @@ +/* $Id$ */ + +/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the Gnome Top Library. + Contributed by Martin Baulig , April 1998. + + The Gnome Top Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Gnome Top Library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +/* Provides detailed information about a process. */ + +void +glibtop_get_proc_state_p (glibtop *server, glibtop_proc_state *buf, + pid_t pid) +{ + memset (buf, 0, sizeof (glibtop_proc_state)); +} diff --git a/sysdeps/freebsd/proctime.c b/sysdeps/freebsd/proctime.c new file mode 100644 index 00000000..c0e6fddc --- /dev/null +++ b/sysdeps/freebsd/proctime.c @@ -0,0 +1,32 @@ +/* $Id$ */ + +/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the Gnome Top Library. + Contributed by Martin Baulig , April 1998. + + The Gnome Top Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Gnome Top Library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +/* Provides detailed information about a process. */ + +void +glibtop_get_proc_time_p (glibtop *server, glibtop_proc_time *buf, + pid_t pid) +{ + memset (buf, 0, sizeof (glibtop_proc_time)); +} diff --git a/sysdeps/freebsd/procuid.c b/sysdeps/freebsd/procuid.c new file mode 100644 index 00000000..759652f6 --- /dev/null +++ b/sysdeps/freebsd/procuid.c @@ -0,0 +1,32 @@ +/* $Id$ */ + +/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the Gnome Top Library. + Contributed by Martin Baulig , April 1998. + + The Gnome Top Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Gnome Top Library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +/* Provides detailed information about a process. */ + +void +glibtop_get_proc_uid_p (glibtop *server, glibtop_proc_uid *buf, + pid_t pid) +{ + memset (buf, 0, sizeof (glibtop_proc_uid)); +} diff --git a/sysdeps/freebsd/sem_limits.c b/sysdeps/freebsd/sem_limits.c new file mode 100644 index 00000000..35790c04 --- /dev/null +++ b/sysdeps/freebsd/sem_limits.c @@ -0,0 +1,30 @@ +/* $Id$ */ + +/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the Gnome Top Library. + Contributed by Martin Baulig , April 1998. + + The Gnome Top Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Gnome Top Library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +/* Provides information about sysv sem limits. */ + +void +glibtop_get_sem_limits_p (glibtop *server, glibtop_sem_limits *buf) +{ + memset (buf, 0, sizeof (glibtop_sem_limits)); +} diff --git a/sysdeps/freebsd/shm_limits.c b/sysdeps/freebsd/shm_limits.c new file mode 100644 index 00000000..b7695150 --- /dev/null +++ b/sysdeps/freebsd/shm_limits.c @@ -0,0 +1,30 @@ +/* $Id$ */ + +/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the Gnome Top Library. + Contributed by Martin Baulig , April 1998. + + The Gnome Top Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Gnome Top Library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include + +/* Provides information about sysv ipc limits. */ + +void +glibtop_get_shm_limits_p (glibtop *server, glibtop_shm_limits *buf) +{ + memset (buf, 0, sizeof (glibtop_shm_limits)); +} diff --git a/sysdeps/freebsd/siglist.c b/sysdeps/freebsd/siglist.c new file mode 100644 index 00000000..a4afb9bb --- /dev/null +++ b/sysdeps/freebsd/siglist.c @@ -0,0 +1,26 @@ +/* $Id$ */ + +/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the Gnome Top Library. + Contributed by Martin Baulig , April 1998. + + The Gnome Top Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Gnome Top Library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +const glibtop_signame glibtop_sys_siglist [] = +{ { 0, NULL, NULL } }; diff --git a/sysdeps/freebsd/swap.c b/sysdeps/freebsd/swap.c new file mode 100644 index 00000000..1a5a7476 --- /dev/null +++ b/sysdeps/freebsd/swap.c @@ -0,0 +1,31 @@ +/* $Id$ */ + +/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the Gnome Top Library. + Contributed by Martin Baulig , April 1998. + + The Gnome Top Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Gnome Top Library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +/* Provides information about swap usage. */ + +void +glibtop_get_swap_p (glibtop *server, glibtop_swap *buf) +{ + memset (buf, 0, sizeof (glibtop_swap)); +} diff --git a/sysdeps/freebsd/uptime.c b/sysdeps/freebsd/uptime.c new file mode 100644 index 00000000..0bda199a --- /dev/null +++ b/sysdeps/freebsd/uptime.c @@ -0,0 +1,31 @@ +/* $Id$ */ + +/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the Gnome Top Library. + Contributed by Martin Baulig , April 1998. + + The Gnome Top Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Gnome Top Library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +/* Provides uptime and idle time. */ + +void +glibtop_get_uptime_p (glibtop *server, glibtop_uptime *buf) +{ + memset (buf, 0, sizeof (glibtop_uptime)); +}