Using GLIBTOP_GUILE' instead of HAVE_GUILE' so one should be able to use

1998-08-06  Martin Baulig  <martin@home-of-linux.org>

	* 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.
This commit is contained in:
Martin Baulig
1998-08-06 21:57:45 +00:00
committed by Martin Baulig
parent 2e454140f1
commit 0a7bd78704
50 changed files with 1030 additions and 28 deletions

View File

@@ -1,3 +1,16 @@
1998-08-06 Martin Baulig <martin@home-of-linux.org>
* 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 <martin@home-of-linux.org> 1998-08-01 Martin Baulig <martin@home-of-linux.org>
* include/glibtop/swap.h (glibtop_swap): Added `pagein' and `pageout'. * include/glibtop/swap.h (glibtop_swap): Added `pagein' and `pageout'.

View File

@@ -253,6 +253,7 @@ sysdeps/sun4/Makefile
sysdeps/osf1/Makefile sysdeps/osf1/Makefile
sysdeps/linux/Makefile sysdeps/linux/Makefile
sysdeps/kernel/Makefile sysdeps/kernel/Makefile
sysdeps/freebsd/Makefile
src/Makefile src/Makefile
src/server/Makefile src/server/Makefile
src/daemon/Makefile src/daemon/Makefile

View File

@@ -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_r __P((glibtop **, const unsigned long, const unsigned));
extern glibtop *glibtop_init_s __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. */ /* You need to link with -lgtop_guile to get this stuff here. */

View File

@@ -65,7 +65,7 @@ extern void glibtop_get_cpu_p __P((glibtop *, glibtop_cpu *));
extern void glibtop_get_cpu_s __P((glibtop *, glibtop_cpu *)); extern void glibtop_get_cpu_s __P((glibtop *, glibtop_cpu *));
#endif #endif
#ifdef HAVE_GUILE #ifdef GLIBTOP_GUILE
/* You need to link with -lgtop_guile to get this stuff here. */ /* You need to link with -lgtop_guile to get this stuff here. */

View File

@@ -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 *)); 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. */ /* You need to link with -lgtop_guile to get this stuff here. */

View File

@@ -63,11 +63,11 @@
#endif #endif
#ifdef WITHOUT_GUILE #ifdef WITHOUT_GUILE
#undef HAVE_GUILE #undef GLIBTOP_GUILE
#undef GLIBTOP_GUILE_NAMES #undef GLIBTOP_GUILE_NAMES
#endif #endif
#ifdef HAVE_GUILE #ifdef GLIBTOP_GUILE
#include <guile/gh.h> #include <guile/gh.h>
#endif #endif

View File

@@ -55,7 +55,7 @@ extern void glibtop_get_loadavg_p __P((glibtop *, glibtop_loadavg *));
extern void glibtop_get_loadavg_s __P((glibtop *, glibtop_loadavg *)); extern void glibtop_get_loadavg_s __P((glibtop *, glibtop_loadavg *));
#endif #endif
#ifdef HAVE_GUILE #ifdef GLIBTOP_GUILE
/* You need to link with -lgtop_guile to get this stuff here. */ /* You need to link with -lgtop_guile to get this stuff here. */

View File

@@ -69,7 +69,7 @@ extern void glibtop_get_mem_p __P((glibtop *, glibtop_mem *));
extern void glibtop_get_mem_s __P((glibtop *, glibtop_mem *)); extern void glibtop_get_mem_s __P((glibtop *, glibtop_mem *));
#endif #endif
#ifdef HAVE_GUILE #ifdef GLIBTOP_GUILE
/* You need to link with -lgtop_guile to get this stuff here. */ /* You need to link with -lgtop_guile to get this stuff here. */

View File

@@ -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)); 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. */ /* You need to link with -lgtop_guile to get this stuff here. */

View File

@@ -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 *)); extern void glibtop_get_msg_limits_s __P((glibtop *, glibtop_msg_limits *));
#endif #endif
#ifdef HAVE_GUILE #ifdef GLIBTOP_GUILE
/* You need to link with -lgtop_guile to get this stuff here. */ /* You need to link with -lgtop_guile to get this stuff here. */

View File

@@ -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)); extern void glibtop_get_proc_kernel_s __P((glibtop *, glibtop_proc_kernel *, pid_t));
#endif #endif
#ifdef HAVE_GUILE #ifdef GLIBTOP_GUILE
/* You need to link with -lgtop_guile to get this stuff here. */ /* You need to link with -lgtop_guile to get this stuff here. */

View File

@@ -59,7 +59,7 @@ extern unsigned *glibtop_get_proclist_p __P((glibtop *, glibtop_proclist *));
extern unsigned *glibtop_get_proclist_s __P((glibtop *, glibtop_proclist *)); extern unsigned *glibtop_get_proclist_s __P((glibtop *, glibtop_proclist *));
#endif #endif
#ifdef HAVE_GUILE #ifdef GLIBTOP_GUILE
/* You need to link with -lgtop_guile to get this stuff here. */ /* You need to link with -lgtop_guile to get this stuff here. */

View File

@@ -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)); extern void glibtop_get_proc_mem_s __P((glibtop *, glibtop_proc_mem *, pid_t));
#endif #endif
#ifdef HAVE_GUILE #ifdef GLIBTOP_GUILE
/* You need to link with -lgtop_guile to get this stuff here. */ /* You need to link with -lgtop_guile to get this stuff here. */

View File

@@ -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)); extern void glibtop_get_proc_segment_s __P((glibtop *, glibtop_proc_segment *, pid_t));
#endif #endif
#ifdef HAVE_GUILE #ifdef GLIBTOP_GUILE
/* You need to link with -lgtop_guile to get this stuff here. */ /* You need to link with -lgtop_guile to get this stuff here. */

View File

@@ -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)); extern void glibtop_get_proc_signal_s __P((glibtop *, glibtop_proc_signal *, pid_t));
#endif #endif
#ifdef HAVE_GUILE #ifdef GLIBTOP_GUILE
/* You need to link with -lgtop_guile to get this stuff here. */ /* You need to link with -lgtop_guile to get this stuff here. */

View File

@@ -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)); extern void glibtop_get_proc_state_s __P((glibtop *, glibtop_proc_state *, pid_t));
#endif #endif
#ifdef HAVE_GUILE #ifdef GLIBTOP_GUILE
/* You need to link with -lgtop_guile to get this stuff here. */ /* You need to link with -lgtop_guile to get this stuff here. */

View File

@@ -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)); extern void glibtop_get_proc_time_s __P((glibtop *, glibtop_proc_time *, pid_t));
#endif #endif
#ifdef HAVE_GUILE #ifdef GLIBTOP_GUILE
/* You need to link with -lgtop_guile to get this stuff here. */ /* You need to link with -lgtop_guile to get this stuff here. */

View File

@@ -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)); extern void glibtop_get_proc_uid_s __P((glibtop *, glibtop_proc_uid *, pid_t));
#endif #endif
#ifdef HAVE_GUILE #ifdef GLIBTOP_GUILE
/* You need to link with -lgtop_guile to get this stuff here. */ /* You need to link with -lgtop_guile to get this stuff here. */

View File

@@ -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 *)); extern void glibtop_get_sem_limits_s __P((glibtop *, glibtop_sem_limits *));
#endif #endif
#ifdef HAVE_GUILE #ifdef GLIBTOP_GUILE
/* You need to link with -lgtop_guile to get this stuff here. */ /* You need to link with -lgtop_guile to get this stuff here. */

View File

@@ -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 *)); extern void glibtop_get_shm_limits_s __P((glibtop *, glibtop_shm_limits *));
#endif #endif
#ifdef HAVE_GUILE #ifdef GLIBTOP_GUILE
/* You need to link with -lgtop_guile to get this stuff here. */ /* You need to link with -lgtop_guile to get this stuff here. */

View File

@@ -63,7 +63,7 @@ extern void glibtop_get_swap_p __P((glibtop *, glibtop_swap *));
extern void glibtop_get_swap_s __P((glibtop *, glibtop_swap *)); extern void glibtop_get_swap_s __P((glibtop *, glibtop_swap *));
#endif #endif
#ifdef HAVE_GUILE #ifdef GLIBTOP_GUILE
/* You need to link with -lgtop_guile to get this stuff here. */ /* You need to link with -lgtop_guile to get this stuff here. */

View File

@@ -81,7 +81,7 @@ struct _glibtop_sysdeps
extern void glibtop_get_sysdeps_r __P((glibtop *, 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. */ /* You need to link with -lgtop_guile to get this stuff here. */

View File

@@ -57,7 +57,7 @@ extern void glibtop_get_uptime_p __P((glibtop *, glibtop_uptime *));
extern void glibtop_get_uptime_s __P((glibtop *, glibtop_uptime *)); extern void glibtop_get_uptime_s __P((glibtop *, glibtop_uptime *));
#endif #endif
#ifdef HAVE_GUILE #ifdef GLIBTOP_GUILE
/* You need to link with -lgtop_guile to get this stuff here. */ /* You need to link with -lgtop_guile to get this stuff here. */

View File

@@ -131,7 +131,7 @@ glibtop_open_l (glibtop *server, const char *program_name,
close (server->input [1]); close (server->input [1]);
close (server->output [0]); close (server->output [0]);
sprintf (version, "Libgtop server %s ready.\n", sprintf (version, "libgtop server %s ready.\n",
LIBGTOP_VERSION); LIBGTOP_VERSION);
glibtop_read_l (server, sizeof (nbytes), &nbytes); 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))) if (memcmp (version, buffer, strlen (version)))
glibtop_error_r (server, "server version is not %s", glibtop_error_r (server, "server version is not %s",
LIBGTOP_VERSION); LIBGTOP_VERSION);
server->flags |= _GLIBTOP_INIT_STATE_SERVER;
server->features = -1;
break; break;
} }

View File

@@ -6,4 +6,5 @@ endif
SUBDIRS = @sysdeps_dir@ common names $(guile_SUBDIRS) 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

View File

@@ -360,7 +360,7 @@ read_filesystem_list (need_fs_type, all_fs)
#ifdef __NetBSD__ #ifdef __NetBSD__
me->me_type = xstrdup (fsp->f_fstypename); me->me_type = xstrdup (fsp->f_fstypename);
#else #else
me->me_type = fstype_to_string (fsp->f_type); me->me_type = xstrdup (fstype_to_string (fsp->f_type));
#endif #endif
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */ me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
me->me_next = NULL; 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 = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
me->me_devname = xstrdup (fsd.fd_req.devname); me->me_devname = xstrdup (fsd.fd_req.devname);
me->me_mountdir = xstrdup (fsd.fd_req.path); 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_dev = fsd.fd_req.dev;
me->me_next = NULL; 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 = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
me->me_devname = xstrdup (stats[counter].f_mntfromname); me->me_devname = xstrdup (stats[counter].f_mntfromname);
me->me_mountdir = xstrdup (stats[counter].f_mntonname); 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_dev = (dev_t) -1; /* Magic; means not known yet. */
me->me_next = NULL; me->me_next = NULL;
@@ -457,7 +457,7 @@ read_filesystem_list (need_fs_type, all_fs)
#endif #endif
me->me_mountdir = xstrdup (mnt.mt_filsys); me->me_mountdir = xstrdup (mnt.mt_filsys);
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */ me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
me->me_type = ""; me->me_type = xstrdup ("");
#ifdef GETFSTYP /* SVR3. */ #ifdef GETFSTYP /* SVR3. */
if (need_fs_type) if (need_fs_type)
{ {

View File

@@ -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

View File

@@ -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

28
sysdeps/freebsd/close.c Normal file
View File

@@ -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 <martin@home-of-linux.org>, 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 <glibtop/close.h>
/* Closes pipe to gtop server. */
void
glibtop_close_s (glibtop *server)
{ }

70
sysdeps/freebsd/cpu.c Normal file
View File

@@ -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 <martin@home-of-linux.org>, 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 <config.h>
#include <glibtop/cpu.h>
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;
}

View File

@@ -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 <martin@home-of-linux.org>, 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 <sys/types.h>
#include <sys/signal.h>
#include <sys/param.h>
#include <stdio.h>
#include <nlist.h>
#include <math.h>
#include <kvm.h>
#include <sys/errno.h>
#include <sys/sysctl.h>
#include <sys/dir.h>
#include <sys/dkstat.h>
#include <sys/file.h>
#include <sys/time.h>
#include <stdlib.h>
#include <sys/rlist.h>
#include <sys/conf.h>
__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

View File

@@ -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 <martin@home-of-linux.org>, 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

31
sysdeps/freebsd/loadavg.c Normal file
View File

@@ -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 <martin@home-of-linux.org>, 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 <config.h>
#include <glibtop/loadavg.h>
/* Provides load averange. */
void
glibtop_get_loadavg_p (glibtop *server, glibtop_loadavg *buf)
{
memset (buf, 0, sizeof (glibtop_loadavg));
}

31
sysdeps/freebsd/mem.c Normal file
View File

@@ -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 <martin@home-of-linux.org>, 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 <config.h>
#include <glibtop/mem.h>
/* Provides information about memory usage. */
void
glibtop_get_mem_p (glibtop *server, glibtop_mem *buf)
{
memset (buf, 0, sizeof (glibtop_mem));
}

View File

@@ -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 <martin@home-of-linux.org>, 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 <glibtop/msg_limits.h>
/* 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));
}

32
sysdeps/freebsd/nosuid.c Normal file
View File

@@ -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 <martin@home-of-linux.org>, 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 <glibtop.h>
#include <glibtop/open.h>
void
glibtop_open_s (glibtop *server, const char *program_name,
const unsigned long features, const unsigned flags)
{ }
void
glibtop_close_s (glibtop *server)
{ }

179
sysdeps/freebsd/open.c Normal file
View File

@@ -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 <martin@home-of-linux.org>, 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 <glibtop.h>
#include <glibtop/open.h>
#include <glibtop/xmalloc.h>
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;
}

View File

@@ -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 <martin@home-of-linux.org>, 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 <config.h>
#include <glibtop/prockernel.h>
/* 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));
}

View File

@@ -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 <martin@home-of-linux.org>, 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 <config.h>
#include <glibtop/proclist.h>
#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;
}

32
sysdeps/freebsd/procmem.c Normal file
View File

@@ -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 <martin@home-of-linux.org>, 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 <config.h>
#include <glibtop/procmem.h>
/* 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));
}

View File

@@ -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 <martin@home-of-linux.org>, 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 <config.h>
#include <glibtop/procsegment.h>
/* 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));
}

View File

@@ -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 <martin@home-of-linux.org>, 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 <config.h>
#include <glibtop/procsignal.h>
/* 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));
}

View File

@@ -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 <martin@home-of-linux.org>, 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 <config.h>
#include <glibtop/procstate.h>
/* 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));
}

View File

@@ -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 <martin@home-of-linux.org>, 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 <config.h>
#include <glibtop/proctime.h>
/* 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));
}

32
sysdeps/freebsd/procuid.c Normal file
View File

@@ -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 <martin@home-of-linux.org>, 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 <config.h>
#include <glibtop/procuid.h>
/* 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));
}

View File

@@ -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 <martin@home-of-linux.org>, 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 <glibtop/sem_limits.h>
/* 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));
}

View File

@@ -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 <martin@home-of-linux.org>, 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 <glibtop/shm_limits.h>
/* 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));
}

26
sysdeps/freebsd/siglist.c Normal file
View File

@@ -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 <martin@home-of-linux.org>, 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 <glibtop.h>
#include <glibtop/signal.h>
const glibtop_signame glibtop_sys_siglist [] =
{ { 0, NULL, NULL } };

31
sysdeps/freebsd/swap.c Normal file
View File

@@ -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 <martin@home-of-linux.org>, 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 <config.h>
#include <glibtop/swap.h>
/* Provides information about swap usage. */
void
glibtop_get_swap_p (glibtop *server, glibtop_swap *buf)
{
memset (buf, 0, sizeof (glibtop_swap));
}

31
sysdeps/freebsd/uptime.c Normal file
View File

@@ -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 <martin@home-of-linux.org>, 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 <config.h>
#include <glibtop/uptime.h>
/* Provides uptime and idle time. */
void
glibtop_get_uptime_p (glibtop *server, glibtop_uptime *buf)
{
memset (buf, 0, sizeof (glibtop_uptime));
}