Initial revision

This commit is contained in:
Martin Baulig
1998-05-19 18:19:50 +00:00
commit 33cdc01c1d
249 changed files with 19386 additions and 0 deletions

2
sysdeps/.cvsignore Normal file
View File

@@ -0,0 +1,2 @@
Makefile
Makefile.in

7
sysdeps/Makefile.am Normal file
View File

@@ -0,0 +1,7 @@
if GUILE
guile_SUBDIRS = guile
else
guile_SUBDIRS =
endif
SUBDIRS = @sysdeps_dir@ common names $(guile_SUBDIRS)

12
sysdeps/common/.cvsignore Normal file
View File

@@ -0,0 +1,12 @@
.deps
.libs
Makefile
Makefile.in
error.lo
libgtop_common.la
msg_limits.lo
sem_limits.lo
shm_limits.lo
sysdeps.lo
xmalloc.lo
so_locations

View File

@@ -0,0 +1,10 @@
LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
INCLUDES = @GTOP_INCS@
CFLAGS = -Wall -W @CFLAGS@
lib_LTLIBRARIES = libgtop_common.la
libgtop_common_la_SOURCES = sysdeps.c xmalloc.c error.c

39
sysdeps/common/error.c Normal file
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 <glibtop/error.h>
/* Prints error message and exits. */
void
glibtop_error__r (glibtop *server, char *format, ...)
{
va_list ap;
va_start (ap, format);
fprintf (stderr, "%s: ", server->name);
vfprintf (stderr, format, ap);
fprintf (stderr, "\n");
va_end (ap);
exit (1);
}

80
sysdeps/common/sysdeps.c Normal file
View File

@@ -0,0 +1,80 @@
/* 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/union.h>
#include <glibtop/sysdeps.h>
/* Checks which features are implemented. */
void
glibtop_get_sysdeps__r (glibtop *server, glibtop_sysdeps *buf)
{
glibtop_union data;
memset (buf, 0, sizeof (glibtop_sysdeps));
/* Call all system dependent functions to check which values
* they return. */
glibtop_get_cpu__r (server, &data.cpu);
buf->cpu = data.cpu.flags;
glibtop_get_mem__r (server, &data.mem);
buf->mem = data.mem.flags;
glibtop_get_swap__r (server, &data.swap);
buf->swap = data.swap.flags;
glibtop_get_uptime__r (server, &data.uptime);
buf->uptime = data.uptime.flags;
glibtop_get_loadavg__r (server, &data.loadavg);
buf->loadavg = data.loadavg.flags;
glibtop_get_shm_limits__r (server, &data.shm_limits);
buf->shm_limits = data.shm_limits.flags;
glibtop_get_msg_limits__r (server, &data.msg_limits);
buf->msg_limits = data.msg_limits.flags;
glibtop_get_sem_limits__r (server, &data.sem_limits);
buf->sem_limits = data.sem_limits.flags;
glibtop_get_proclist__r (server, &data.proclist);
buf->proclist = data.proclist.flags;
glibtop_get_proc_state__r (server, &data.proc_state, 0);
buf->proc_state = data.proc_state.flags;
glibtop_get_proc_uid__r (server, &data.proc_uid, 0);
buf->proc_uid = data.proc_uid.flags;
glibtop_get_proc_mem__r (server, &data.proc_mem, 0);
buf->proc_mem = data.proc_mem.flags;
glibtop_get_proc_time__r (server, &data.proc_time, 0);
buf->proc_time = data.proc_time.flags;
glibtop_get_proc_kernel__r (server, &data.proc_kernel, 0);
buf->proc_kernel = data.proc_kernel.flags;
glibtop_get_proc_segment__r (server, &data.proc_segment, 0);
buf->proc_segment = data.proc_segment.flags;
}

66
sysdeps/common/xmalloc.c Normal file
View File

@@ -0,0 +1,66 @@
/* $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/xmalloc.h>
/* Wrappers to malloc, calloc, realloc ... */
void *
glibtop_malloc__r (glibtop *server, size_t size)
{
void *buf = malloc (size);
if (!buf)
glibtop_error__r (server, _("malloc %d bytes: %s"),
size, strerror (errno));
return buf;
}
void *
glibtop_calloc__r (glibtop *server, size_t nmemb, size_t size)
{
void *buf = calloc (nmemb, size);
if (!buf)
glibtop_error__r (server, _("calloc %d block (%d bytes each): %s"),
nmemb, size, strerror (errno));
return buf;
}
void *
glibtop_realloc__r (glibtop *server, void *ptr, size_t size)
{
void *buf = realloc (ptr, size);
if (!buf)
glibtop_error__r (server, _("realloc %d bytes: %s"),
size, strerror (errno));
return buf;
}
void
glibtop_free__r (glibtop *server, void *ptr)
{
if (ptr) free (ptr);
}

25
sysdeps/guile/.cvsignore Normal file
View File

@@ -0,0 +1,25 @@
.deps
.libs
Makefile
Makefile.in
boot.lo
cpu.lo
libgtop_guile.la
loadavg.lo
mem.lo
msg_limits.lo
procdata.lo
prockernel.lo
proclist.lo
procmem.lo
procsegment.lo
procsignal.lo
procstate.lo
proctime.lo
procuid.lo
sem_limits.lo
shm_limits.lo
so_locations
swap.lo
sysdeps.lo
uptime.lo

15
sysdeps/guile/Makefile.am Normal file
View File

@@ -0,0 +1,15 @@
SUBDIRS = names
LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
INCLUDES = @GTOP_INCS@
CFLAGS = -Wall -W @CFLAGS@
lib_LTLIBRARIES = libgtop_guile.la
libgtop_guile_la_SOURCES = boot.c sysdeps.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

66
sysdeps/guile/boot.c Normal file
View File

@@ -0,0 +1,66 @@
/* $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/sysdeps.h>
#include <guile/gh.h>
void
glibtop_boot_guile (void)
{
gh_new_procedure0_0
("glibtop-get-cpu", glibtop_guile_get_cpu);
gh_new_procedure0_0
("glibtop-get-mem", glibtop_guile_get_mem);
gh_new_procedure0_0
("glibtop-get-swap", glibtop_guile_get_swap);
gh_new_procedure0_0
("glibtop-get-uptime", glibtop_guile_get_uptime);
gh_new_procedure0_0
("glibtop-get-loadavg", glibtop_guile_get_loadavg);
gh_new_procedure0_0
("glibtop-get-shm_limits",glibtop_guile_get_shm_limits);
gh_new_procedure0_0
("glibtop-get-msg_limits", glibtop_guile_get_msg_limits);
gh_new_procedure0_0
("glibtop-get-sem_limits", glibtop_guile_get_sem_limits);
gh_new_procedure0_0
("glibtop-get-sysdeps", glibtop_guile_get_sysdeps);
gh_new_procedure0_0
("glibtop-get-proclist", glibtop_guile_get_proclist);
gh_new_procedure1_0
("glibtop-get-proc_state", glibtop_guile_get_proc_state);
gh_new_procedure1_0
("glibtop-get-proc_uid", glibtop_guile_get_proc_uid);
gh_new_procedure1_0
("glibtop-get-proc_mem", glibtop_guile_get_proc_mem);
gh_new_procedure1_0
("glibtop-get-proc_time", glibtop_guile_get_proc_time);
gh_new_procedure1_0
("glibtop-get-proc_signal", glibtop_guile_get_proc_signal);
gh_new_procedure1_0
("glibtop-get-proc_kernel", glibtop_guile_get_proc_kernel);
gh_new_procedure1_0
("glibtop-get-proc_segment", glibtop_guile_get_proc_segment);
}

41
sysdeps/guile/cpu.c Normal file
View File

@@ -0,0 +1,41 @@
/* $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/cpu.h>
#include <guile/gh.h>
SCM glibtop_guile_get_cpu (void)
{
glibtop_cpu cpu;
glibtop_get_cpu (&cpu);
return gh_list (gh_ulong2scm (cpu.flags),
gh_ulong2scm (cpu.total),
gh_ulong2scm (cpu.user),
gh_ulong2scm (cpu.nice),
gh_ulong2scm (cpu.sys),
gh_ulong2scm (cpu.idle),
gh_ulong2scm (cpu.frequency),
SCM_UNDEFINED);
}

38
sysdeps/guile/loadavg.c Normal file
View File

@@ -0,0 +1,38 @@
/* $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/loadavg.h>
#include <guile/gh.h>
SCM glibtop_guile_get_loadavg (void)
{
glibtop_loadavg loadavg;
glibtop_get_loadavg (&loadavg);
return gh_list (gh_ulong2scm (loadavg.flags),
gh_double2scm (loadavg.loadavg [0]),
gh_double2scm (loadavg.loadavg [1]),
gh_double2scm (loadavg.loadavg [2]),
SCM_UNDEFINED);
}

42
sysdeps/guile/mem.c Normal file
View File

@@ -0,0 +1,42 @@
/* $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/mem.h>
#include <guile/gh.h>
SCM glibtop_guile_get_mem (void)
{
glibtop_mem mem;
glibtop_get_mem (&mem);
return gh_list (gh_ulong2scm (mem.flags),
gh_ulong2scm (mem.total),
gh_ulong2scm (mem.used),
gh_ulong2scm (mem.free),
gh_ulong2scm (mem.shared),
gh_ulong2scm (mem.buffer),
gh_ulong2scm (mem.cached),
gh_ulong2scm (mem.user),
SCM_UNDEFINED);
}

View File

@@ -0,0 +1,42 @@
/* $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/msg_limits.h>
#include <guile/gh.h>
SCM glibtop_guile_get_msg_limits (void)
{
glibtop_msg_limits msg_limits;
glibtop_get_msg_limits (&msg_limits);
return gh_list (gh_ulong2scm (msg_limits.flags),
gh_ulong2scm (msg_limits.msgpool),
gh_ulong2scm (msg_limits.msgmap),
gh_ulong2scm (msg_limits.msgmax),
gh_ulong2scm (msg_limits.msgmnb),
gh_ulong2scm (msg_limits.msgmni),
gh_ulong2scm (msg_limits.msgssz),
gh_ulong2scm (msg_limits.msgtql),
SCM_UNDEFINED);
}

View File

@@ -0,0 +1,26 @@
.deps
.libs
Makefile
Makefile.in
boot.lo
cpu.lo
libgtop_guile.la
libgtop_guile_names.la
loadavg.lo
mem.lo
msg_limits.lo
procdata.lo
prockernel.lo
proclist.lo
procmem.lo
procsegment.lo
procsignal.lo
procstate.lo
proctime.lo
procuid.lo
sem_limits.lo
shm_limits.lo
so_locations
swap.lo
sysdeps.lo
uptime.lo

View File

@@ -0,0 +1,16 @@
LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
INCLUDES = @GTOP_INCS@
CFLAGS = -Wall -W @CFLAGS@
DEFS = -DGLIBTOP_GUILE_NAMES @DEFS@
lib_LTLIBRARIES = libgtop_guile_names.la
libgtop_guile_names_la_SOURCES = boot.c sysdeps.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

168
sysdeps/guile/names/boot.c Normal file
View File

@@ -0,0 +1,168 @@
/* $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/sysdeps.h>
#include <guile/gh.h>
void
glibtop_boot_guile_names (void)
{
gh_new_procedure0_0
("glibtop-names-cpu", glibtop_guile_names_cpu);
gh_new_procedure0_0
("glibtop-names-mem", glibtop_guile_names_mem);
gh_new_procedure0_0
("glibtop-names-swap", glibtop_guile_names_swap);
gh_new_procedure0_0
("glibtop-names-uptime", glibtop_guile_names_uptime);
gh_new_procedure0_0
("glibtop-names-loadavg", glibtop_guile_names_loadavg);
gh_new_procedure0_0
("glibtop-names-shm_limits", glibtop_guile_names_shm_limits);
gh_new_procedure0_0
("glibtop-names-msg_limits", glibtop_guile_names_msg_limits);
gh_new_procedure0_0
("glibtop-names-sem_limits", glibtop_guile_names_sem_limits);
gh_new_procedure0_0
("glibtop-names-sysdeps", glibtop_guile_names_sysdeps);
gh_new_procedure0_0
("glibtop-names-proclist", glibtop_guile_names_proclist);
gh_new_procedure0_0
("glibtop-names-proc_state", glibtop_guile_names_proc_state);
gh_new_procedure0_0
("glibtop-names-proc_uid", glibtop_guile_names_proc_uid);
gh_new_procedure0_0
("glibtop-names-proc_mem", glibtop_guile_names_proc_mem);
gh_new_procedure0_0
("glibtop-names-proc_time", glibtop_guile_names_proc_time);
gh_new_procedure0_0
("glibtop-names-proc_signal", glibtop_guile_names_proc_signal);
gh_new_procedure0_0
("glibtop-names-proc_kernel", glibtop_guile_names_proc_kernel);
gh_new_procedure0_0
("glibtop-names-proc_segment", glibtop_guile_names_proc_segment);
gh_new_procedure0_0
("glibtop-types-cpu", glibtop_guile_types_cpu);
gh_new_procedure0_0
("glibtop-types-mem", glibtop_guile_types_mem);
gh_new_procedure0_0
("glibtop-types-swap", glibtop_guile_types_swap);
gh_new_procedure0_0
("glibtop-types-uptime", glibtop_guile_types_uptime);
gh_new_procedure0_0
("glibtop-types-loadavg", glibtop_guile_types_loadavg);
gh_new_procedure0_0
("glibtop-types-shm_limits", glibtop_guile_types_shm_limits);
gh_new_procedure0_0
("glibtop-types-msg_limits", glibtop_guile_types_msg_limits);
gh_new_procedure0_0
("glibtop-types-sem_limits", glibtop_guile_types_sem_limits);
gh_new_procedure0_0
("glibtop-types-sysdeps", glibtop_guile_types_sysdeps);
gh_new_procedure0_0
("glibtop-types-proclist", glibtop_guile_types_proclist);
gh_new_procedure0_0
("glibtop-types-proc_state", glibtop_guile_types_proc_state);
gh_new_procedure0_0
("glibtop-types-proc_uid", glibtop_guile_types_proc_uid);
gh_new_procedure0_0
("glibtop-types-proc_mem", glibtop_guile_types_proc_mem);
gh_new_procedure0_0
("glibtop-types-proc_signal", glibtop_guile_types_proc_signal);
gh_new_procedure0_0
("glibtop-types-proc_kernel", glibtop_guile_types_proc_kernel);
gh_new_procedure0_0
("glibtop-types-proc_segment", glibtop_guile_types_proc_segment);
gh_new_procedure0_0
("glibtop-labels-cpu", glibtop_guile_labels_cpu);
gh_new_procedure0_0
("glibtop-labels-mem", glibtop_guile_labels_mem);
gh_new_procedure0_0
("glibtop-labels-swap", glibtop_guile_labels_swap);
gh_new_procedure0_0
("glibtop-labels-uptime", glibtop_guile_labels_uptime);
gh_new_procedure0_0
("glibtop-labels-loadavg", glibtop_guile_labels_loadavg);
gh_new_procedure0_0
("glibtop-labels-shm_limits", glibtop_guile_labels_shm_limits);
gh_new_procedure0_0
("glibtop-labels-msg_limits", glibtop_guile_labels_msg_limits);
gh_new_procedure0_0
("glibtop-labels-sem_limits", glibtop_guile_labels_sem_limits);
gh_new_procedure0_0
("glibtop-labels-sysdeps", glibtop_guile_labels_sysdeps);
gh_new_procedure0_0
("glibtop-labels-proclist", glibtop_guile_labels_proclist);
gh_new_procedure0_0
("glibtop-labels-proc_state", glibtop_guile_labels_proc_state);
gh_new_procedure0_0
("glibtop-labels-proc_uid", glibtop_guile_labels_proc_uid);
gh_new_procedure0_0
("glibtop-labels-proc_mem", glibtop_guile_labels_proc_mem);
gh_new_procedure0_0
("glibtop-labels-proc_signal", glibtop_guile_labels_proc_signal);
gh_new_procedure0_0
("glibtop-labels-proc_kernel", glibtop_guile_labels_proc_kernel);
gh_new_procedure0_0
("glibtop-labels-proc_segment", glibtop_guile_labels_proc_segment);
gh_new_procedure0_0
("glibtop-descriptions-cpu", glibtop_guile_descriptions_cpu);
gh_new_procedure0_0
("glibtop-descriptions-mem", glibtop_guile_descriptions_mem);
gh_new_procedure0_0
("glibtop-descriptions-swap", glibtop_guile_descriptions_swap);
gh_new_procedure0_0
("glibtop-descriptions-uptime", glibtop_guile_descriptions_uptime);
gh_new_procedure0_0
("glibtop-descriptions-loadavg", glibtop_guile_descriptions_loadavg);
gh_new_procedure0_0
("glibtop-descriptions-shm_limits", glibtop_guile_descriptions_shm_limits);
gh_new_procedure0_0
("glibtop-descriptions-msg_limits", glibtop_guile_descriptions_msg_limits);
gh_new_procedure0_0
("glibtop-descriptions-sem_limits", glibtop_guile_descriptions_sem_limits);
gh_new_procedure0_0
("glibtop-descriptions-sysdeps", glibtop_guile_descriptions_sysdeps);
gh_new_procedure0_0
("glibtop-descriptions-proclist", glibtop_guile_descriptions_proclist);
gh_new_procedure0_0
("glibtop-descriptions-proc_state", glibtop_guile_descriptions_proc_state);
gh_new_procedure0_0
("glibtop-descriptions-proc_uid", glibtop_guile_descriptions_proc_uid);
gh_new_procedure0_0
("glibtop-descriptions-proc_mem", glibtop_guile_descriptions_proc_mem);
gh_new_procedure0_0
("glibtop-descriptions-proc_signal", glibtop_guile_descriptions_proc_signal);
gh_new_procedure0_0
("glibtop-descriptions-proc_kernel", glibtop_guile_descriptions_proc_kernel);
gh_new_procedure0_0
("glibtop-descriptions-proc_segment", glibtop_guile_descriptions_proc_segment);
}

95
sysdeps/guile/names/cpu.c Normal file
View File

@@ -0,0 +1,95 @@
/* $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/cpu.h>
#include <guile/gh.h>
SCM
glibtop_guile_names_cpu (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_CPU; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (glibtop_names_cpu [i]),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_types_cpu (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_CPU; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (glibtop_types_cpu [i]),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_labels_cpu (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_CPU; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (gettext
(glibtop_labels_cpu [i])),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_descriptions_cpu (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_CPU; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (gettext
(glibtop_descriptions_cpu [i])),
SCM_UNDEFINED));
return list;
}

View File

@@ -0,0 +1,95 @@
/* $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/loadavg.h>
#include <guile/gh.h>
SCM
glibtop_guile_names_loadavg (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_LOADAVG; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (glibtop_names_loadavg [i]),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_types_loadavg (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_LOADAVG; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (glibtop_types_loadavg [i]),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_labels_loadavg (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_LOADAVG; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (gettext
(glibtop_labels_loadavg [i])),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_descriptions_loadavg (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_LOADAVG; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (gettext
(glibtop_descriptions_loadavg [i])),
SCM_UNDEFINED));
return list;
}

95
sysdeps/guile/names/mem.c Normal file
View File

@@ -0,0 +1,95 @@
/* $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/mem.h>
#include <guile/gh.h>
SCM
glibtop_guile_names_mem (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_MEM; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (glibtop_names_mem [i]),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_types_mem (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_MEM; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (glibtop_types_mem [i]),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_labels_mem (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_MEM; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (gettext
(glibtop_labels_mem [i])),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_descriptions_mem (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_MEM; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (gettext
(glibtop_descriptions_mem [i])),
SCM_UNDEFINED));
return list;
}

View File

@@ -0,0 +1,95 @@
/* $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/msg_limits.h>
#include <guile/gh.h>
SCM
glibtop_guile_names_msg_limits (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_MSG_LIMITS; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (glibtop_names_msg_limits [i]),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_types_msg_limits (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_MSG_LIMITS; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (glibtop_types_msg_limits [i]),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_labels_msg_limits (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_MSG_LIMITS; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (gettext
(glibtop_labels_msg_limits [i])),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_descriptions_msg_limits (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_MSG_LIMITS; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (gettext
(glibtop_descriptions_msg_limits [i])),
SCM_UNDEFINED));
return list;
}

View File

@@ -0,0 +1,95 @@
/* $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/prockernel.h>
#include <guile/gh.h>
SCM
glibtop_guile_names_proc_kernel (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_PROC_KERNEL; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (glibtop_names_proc_kernel [i]),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_types_proc_kernel (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_PROC_KERNEL; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (glibtop_types_proc_kernel [i]),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_labels_proc_kernel (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_PROC_KERNEL; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (gettext
(glibtop_labels_proc_kernel [i])),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_descriptions_proc_kernel (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_PROC_KERNEL; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (gettext
(glibtop_descriptions_proc_kernel [i])),
SCM_UNDEFINED));
return list;
}

View File

@@ -0,0 +1,96 @@
/* $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/xmalloc.h>
#include <glibtop/proclist.h>
#include <guile/gh.h>
SCM
glibtop_guile_names_proclist (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_PROCLIST; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (glibtop_names_proclist [i]),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_types_proclist (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_PROCLIST; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (glibtop_labels_proclist [i]),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_labels_proclist (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_PROCLIST; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (gettext
(glibtop_labels_proclist [i])),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_descriptions_proclist (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_PROCLIST; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (gettext
(glibtop_descriptions_proclist [i])),
SCM_UNDEFINED));
return list;
}

View File

@@ -0,0 +1,95 @@
/* $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/procmem.h>
#include <guile/gh.h>
SCM
glibtop_guile_names_proc_mem (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_PROC_MEM; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (glibtop_names_proc_mem [i]),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_types_proc_mem (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_PROC_MEM; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (glibtop_labels_proc_mem [i]),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_labels_proc_mem (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_PROC_MEM; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (gettext
(glibtop_labels_proc_mem [i])),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_descriptions_proc_mem (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_PROC_MEM; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (gettext
(glibtop_descriptions_proc_mem [i])),
SCM_UNDEFINED));
return list;
}

View File

@@ -0,0 +1,95 @@
/* $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/procsegment.h>
#include <guile/gh.h>
SCM
glibtop_guile_names_proc_segment (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_PROC_SEGMENT; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (glibtop_names_proc_segment [i]),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_types_proc_segment (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_PROC_SEGMENT; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (glibtop_types_proc_segment [i]),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_labels_proc_segment (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_PROC_SEGMENT; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (gettext
(glibtop_labels_proc_segment [i])),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_descriptions_proc_segment (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_PROC_SEGMENT; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (gettext
(glibtop_descriptions_proc_segment [i])),
SCM_UNDEFINED));
return list;
}

View File

@@ -0,0 +1,95 @@
/* $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/procsignal.h>
#include <guile/gh.h>
SCM
glibtop_guile_names_proc_signal (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_PROC_SIGNAL; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (glibtop_names_proc_signal [i]),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_types_proc_signal (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_PROC_SIGNAL; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (glibtop_types_proc_signal [i]),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_labels_proc_signal (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_PROC_SIGNAL; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (gettext
(glibtop_labels_proc_signal [i])),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_descriptions_proc_signal (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_PROC_SIGNAL; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (gettext
(glibtop_descriptions_proc_signal [i])),
SCM_UNDEFINED));
return list;
}

View File

@@ -0,0 +1,95 @@
/* $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/procstate.h>
#include <guile/gh.h>
SCM
glibtop_guile_names_proc_state (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_PROC_STATE; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (glibtop_names_proc_state [i]),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_types_proc_state (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_PROC_STATE; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (glibtop_types_proc_state [i]),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_labels_proc_state (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_PROC_STATE; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (gettext
(glibtop_labels_proc_state [i])),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_descriptions_proc_state (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_PROC_STATE; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (gettext
(glibtop_descriptions_proc_state [i])),
SCM_UNDEFINED));
return list;
}

View File

@@ -0,0 +1,95 @@
/* $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/proctime.h>
#include <guile/gh.h>
SCM
glibtop_guile_names_proc_time (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_PROC_TIME; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (glibtop_names_proc_time [i]),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_types_proc_time (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_PROC_TIME; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (glibtop_types_proc_time [i]),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_labels_proc_time (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_PROC_TIME; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (gettext
(glibtop_labels_proc_time [i])),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_descriptions_proc_time (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_PROC_TIME; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (gettext
(glibtop_descriptions_proc_time [i])),
SCM_UNDEFINED));
return list;
}

View File

@@ -0,0 +1,95 @@
/* $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/procuid.h>
#include <guile/gh.h>
SCM
glibtop_guile_names_proc_uid (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_PROC_UID; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (glibtop_names_proc_uid [i]),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_types_proc_uid (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_PROC_UID; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (glibtop_types_proc_uid [i]),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_labels_proc_uid (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_PROC_UID; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (gettext
(glibtop_labels_proc_uid [i])),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_descriptions_proc_uid (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_PROC_UID; i++)
list = gh_append2
(list, gh_list
(gh_str02scm (gettext
(glibtop_descriptions_proc_uid [i])),
SCM_UNDEFINED));
return list;
}

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. */
#include <glibtop.h>
#include <glibtop/sem_limits.h>
#include <guile/gh.h>
SCM
glibtop_guile_names_sem_limits (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_SEM_LIMITS; i++)
list = gh_append2 (list, gh_list (gh_str02scm (glibtop_names_sem_limits [i]),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_types_sem_limits (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_SEM_LIMITS; i++)
list = gh_append2 (list, gh_list (gh_str02scm (gettext (glibtop_types_sem_limits [i])),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_labels_sem_limits (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_SEM_LIMITS; i++)
list = gh_append2 (list, gh_list (gh_str02scm (gettext (glibtop_labels_sem_limits [i])),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_descriptions_sem_limits (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_SEM_LIMITS; i++)
list = gh_append2 (list, gh_list (gh_str02scm (gettext (glibtop_descriptions_sem_limits [i])),
SCM_UNDEFINED));
return list;
}

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. */
#include <glibtop.h>
#include <glibtop/shm_limits.h>
#include <guile/gh.h>
SCM
glibtop_guile_names_shm_limits (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_SHM_LIMITS; i++)
list = gh_append2 (list, gh_list (gh_str02scm (glibtop_names_shm_limits [i]),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_types_shm_limits (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_SHM_LIMITS; i++)
list = gh_append2 (list, gh_list (gh_str02scm (gettext (glibtop_types_shm_limits [i])),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_labels_shm_limits (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_SHM_LIMITS; i++)
list = gh_append2 (list, gh_list (gh_str02scm (gettext (glibtop_labels_shm_limits [i])),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_descriptions_shm_limits (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_SHM_LIMITS; i++)
list = gh_append2 (list, gh_list (gh_str02scm (gettext (glibtop_descriptions_shm_limits [i])),
SCM_UNDEFINED));
return list;
}

View File

@@ -0,0 +1,84 @@
/* $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/swap.h>
#include <guile/gh.h>
SCM
glibtop_guile_names_swap (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_SWAP; i++)
list = gh_append2 (list, gh_list (gh_str02scm (glibtop_names_swap [i]), SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_types_swap (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_SWAP; i++)
list = gh_append2 (list, gh_list (gh_str02scm (gettext (glibtop_types_swap [i])),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_labels_swap (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_SWAP; i++)
list = gh_append2 (list, gh_list (gh_str02scm (gettext (glibtop_labels_swap [i])),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_descriptions_swap (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_SWAP; i++)
list = gh_append2 (list, gh_list (gh_str02scm (gettext (glibtop_descriptions_swap [i])),
SCM_UNDEFINED));
return list;
}

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. */
#include <glibtop.h>
#include <glibtop/sysdeps.h>
#include <guile/gh.h>
SCM
glibtop_guile_names_sysdeps (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_SYSDEPS; i++)
list = gh_append2 (list, gh_list (gh_str02scm (glibtop_names_sysdeps [i]),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_types_sysdeps (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_SYSDEPS; i++)
list = gh_append2 (list, gh_list (gh_str02scm (gettext (glibtop_types_sysdeps [i])),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_labels_sysdeps (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_SYSDEPS; i++)
list = gh_append2 (list, gh_list (gh_str02scm (gettext (glibtop_labels_sysdeps [i])),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_descriptions_sysdeps (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_SYSDEPS; i++)
list = gh_append2 (list, gh_list (gh_str02scm (gettext (glibtop_descriptions_sysdeps [i])),
SCM_UNDEFINED));
return list;
}

View File

@@ -0,0 +1,84 @@
/* $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/uptime.h>
#include <guile/gh.h>
SCM
glibtop_guile_names_uptime (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_UPTIME; i++)
list = gh_append2 (list, gh_list (gh_str02scm (glibtop_names_uptime [i]), SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_types_uptime (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_UPTIME; i++)
list = gh_append2 (list, gh_list (gh_str02scm (gettext (glibtop_types_uptime [i])),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_labels_uptime (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_UPTIME; i++)
list = gh_append2 (list, gh_list (gh_str02scm (gettext (glibtop_labels_uptime [i])),
SCM_UNDEFINED));
return list;
}
SCM
glibtop_guile_descriptions_uptime (void)
{
int i;
SCM list;
list = gh_list (SCM_UNDEFINED);
for (i = 0; i < GLIBTOP_MAX_UPTIME; i++)
list = gh_append2 (list, gh_list (gh_str02scm (gettext (glibtop_descriptions_uptime [i])),
SCM_UNDEFINED));
return list;
}

View File

@@ -0,0 +1,44 @@
/* $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/prockernel.h>
#include <guile/gh.h>
SCM
glibtop_guile_get_proc_kernel (SCM pid)
{
glibtop_proc_kernel p;
glibtop_get_proc_kernel (&p, (pid_t) gh_scm2long (pid));
return gh_list (gh_ulong2scm (p.flags),
gh_ulong2scm (p.k_flags),
gh_ulong2scm (p.min_flt),
gh_ulong2scm (p.maj_flt),
gh_ulong2scm (p.cmin_flt),
gh_ulong2scm (p.cmaj_flt),
gh_ulong2scm (p.kstk_esp),
gh_ulong2scm (p.kstk_eip),
gh_ulong2scm (p.wchan),
SCM_UNDEFINED);
}

52
sysdeps/guile/proclist.c Normal file
View File

@@ -0,0 +1,52 @@
/* $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/xmalloc.h>
#include <glibtop/proclist.h>
#include <guile/gh.h>
SCM
glibtop_guile_get_proclist (void)
{
glibtop_proclist proclist;
unsigned *ptr;
unsigned i;
SCM list;
ptr = glibtop_get_proclist (&proclist);
list = gh_list (gh_ulong2scm (proclist.flags),
gh_ulong2scm (proclist.number),
gh_ulong2scm (proclist.size),
gh_ulong2scm (proclist.total),
SCM_UNDEFINED);
if (ptr) {
for (i = 0; i < proclist.number; i++)
list = gh_append2 (list, gh_list (gh_ulong2scm ((unsigned long) ptr [i]), SCM_UNDEFINED));
}
glibtop_free (ptr);
return list;
}

42
sysdeps/guile/procmem.c Normal file
View File

@@ -0,0 +1,42 @@
/* $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/procmem.h>
#include <guile/gh.h>
SCM
glibtop_guile_get_proc_mem (SCM pid)
{
glibtop_proc_mem p;
glibtop_get_proc_mem (&p, (pid_t) gh_scm2long (pid));
return gh_list (gh_ulong2scm (p.flags),
gh_long2scm (p.size),
gh_long2scm (p.vsize),
gh_long2scm (p.resident),
gh_long2scm (p.share),
gh_long2scm (p.rss),
gh_long2scm (p.rss_rlim),
SCM_UNDEFINED);
}

View File

@@ -0,0 +1,43 @@
/* $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/procsegment.h>
#include <guile/gh.h>
SCM
glibtop_guile_get_proc_segment (SCM pid)
{
glibtop_proc_segment p;
glibtop_get_proc_segment (&p, (pid_t) gh_scm2long (pid));
return gh_list (gh_ulong2scm (p.flags),
gh_long2scm (p.trs),
gh_long2scm (p.lrs),
gh_long2scm (p.drs),
gh_long2scm (p.dt),
gh_ulong2scm (p.start_code),
gh_ulong2scm (p.end_code),
gh_ulong2scm (p.start_stack),
SCM_UNDEFINED);
}

View File

@@ -0,0 +1,40 @@
/* $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/procsignal.h>
#include <guile/gh.h>
SCM
glibtop_guile_get_proc_signal (SCM pid)
{
glibtop_proc_signal p;
glibtop_get_proc_signal (&p, (pid_t) gh_scm2long (pid));
return gh_list (gh_ulong2scm (p.flags),
gh_long2scm (p.signal),
gh_long2scm (p.blocked),
gh_long2scm (p.sigignore),
gh_long2scm (p.sigcatch),
SCM_UNDEFINED);
}

40
sysdeps/guile/procstate.c Normal file
View File

@@ -0,0 +1,40 @@
/* $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/procstate.h>
#include <guile/gh.h>
SCM
glibtop_guile_get_proc_state (SCM pid)
{
glibtop_proc_state p;
glibtop_get_proc_state (&p, (pid_t) gh_scm2long (pid));
return gh_list (gh_ulong2scm (p.flags),
gh_str02scm (p.cmd),
gh_char2scm (p.state),
gh_ulong2scm (p.uid),
gh_ulong2scm (p.gid),
SCM_UNDEFINED);
}

43
sysdeps/guile/proctime.c Normal file
View File

@@ -0,0 +1,43 @@
/* $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/proctime.h>
#include <guile/gh.h>
SCM
glibtop_guile_get_proc_time (SCM pid)
{
glibtop_proc_time p;
glibtop_get_proc_time (&p, (pid_t) gh_scm2long (pid));
return gh_list (gh_ulong2scm (p.flags),
gh_long2scm (p.start_time),
gh_long2scm (p.utime),
gh_long2scm (p.stime),
gh_long2scm (p.cutime),
gh_long2scm (p.cstime),
gh_long2scm (p.timeout),
gh_long2scm (p.it_real_value),
SCM_UNDEFINED);
}

48
sysdeps/guile/procuid.c Normal file
View File

@@ -0,0 +1,48 @@
/* $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/procuid.h>
#include <guile/gh.h>
SCM
glibtop_guile_get_proc_uid (SCM pid)
{
glibtop_proc_uid p;
glibtop_get_proc_uid (&p, (pid_t) gh_scm2long (pid));
return gh_list (gh_ulong2scm (p.flags),
gh_long2scm (p.uid),
gh_long2scm (p.euid),
gh_long2scm (p.gid),
gh_long2scm (p.egid),
gh_long2scm (p.pid),
gh_long2scm (p.ppid),
gh_long2scm (p.pgrp),
gh_long2scm (p.session),
gh_long2scm (p.tty),
gh_long2scm (p.tpgid),
gh_long2scm (p.priority),
gh_long2scm (p.nice),
SCM_UNDEFINED);
}

View File

@@ -0,0 +1,45 @@
/* $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/sem_limits.h>
#include <guile/gh.h>
SCM glibtop_guile_get_sem_limits (void)
{
glibtop_sem_limits sem_limits;
glibtop_get_sem_limits (&sem_limits);
return gh_list (gh_ulong2scm (sem_limits.flags),
gh_ulong2scm (sem_limits.semmap),
gh_ulong2scm (sem_limits.semmni),
gh_ulong2scm (sem_limits.semmns),
gh_ulong2scm (sem_limits.semmnu),
gh_ulong2scm (sem_limits.semmsl),
gh_ulong2scm (sem_limits.semopm),
gh_ulong2scm (sem_limits.semume),
gh_ulong2scm (sem_limits.semusz),
gh_ulong2scm (sem_limits.semvmx),
gh_ulong2scm (sem_limits.semaem),
SCM_UNDEFINED);
}

View File

@@ -0,0 +1,40 @@
/* $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/shm_limits.h>
#include <guile/gh.h>
SCM glibtop_guile_get_shm_limits (void)
{
glibtop_shm_limits shm_limits;
glibtop_get_shm_limits (&shm_limits);
return gh_list (gh_ulong2scm (shm_limits.flags),
gh_ulong2scm (shm_limits.shmmax),
gh_ulong2scm (shm_limits.shmmin),
gh_ulong2scm (shm_limits.shmmni),
gh_ulong2scm (shm_limits.shmseg),
gh_ulong2scm (shm_limits.shmall),
SCM_UNDEFINED);
}

38
sysdeps/guile/swap.c Normal file
View File

@@ -0,0 +1,38 @@
/* $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/swap.h>
#include <guile/gh.h>
SCM glibtop_guile_get_swap (void)
{
glibtop_swap swap;
glibtop_get_swap (&swap);
return gh_list (gh_ulong2scm (swap.flags),
gh_ulong2scm (swap.total),
gh_ulong2scm (swap.used),
gh_ulong2scm (swap.free),
SCM_UNDEFINED);
}

51
sysdeps/guile/sysdeps.c Normal file
View File

@@ -0,0 +1,51 @@
/* $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/sysdeps.h>
#include <guile/gh.h>
SCM glibtop_guile_get_sysdeps (void)
{
glibtop_sysdeps sysdeps;
glibtop_get_sysdeps (&sysdeps);
return gh_list (gh_ulong2scm (sysdeps.flags),
gh_ulong2scm (sysdeps.cpu),
gh_ulong2scm (sysdeps.mem),
gh_ulong2scm (sysdeps.swap),
gh_ulong2scm (sysdeps.uptime),
gh_ulong2scm (sysdeps.loadavg),
gh_ulong2scm (sysdeps.shm_limits),
gh_ulong2scm (sysdeps.msg_limits),
gh_ulong2scm (sysdeps.sem_limits),
gh_ulong2scm (sysdeps.proclist),
gh_ulong2scm (sysdeps.proc_state),
gh_ulong2scm (sysdeps.proc_uid),
gh_ulong2scm (sysdeps.proc_mem),
gh_ulong2scm (sysdeps.proc_time),
gh_ulong2scm (sysdeps.proc_signal),
gh_ulong2scm (sysdeps.proc_kernel),
gh_ulong2scm (sysdeps.proc_segment),
SCM_UNDEFINED);
}

37
sysdeps/guile/uptime.c Normal file
View File

@@ -0,0 +1,37 @@
/* $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/uptime.h>
#include <guile/gh.h>
SCM glibtop_guile_get_uptime (void)
{
glibtop_uptime uptime;
glibtop_get_uptime (&uptime);
return gh_list (gh_ulong2scm (uptime.flags),
gh_double2scm (uptime.uptime),
gh_double2scm (uptime.idletime),
SCM_UNDEFINED);
}

28
sysdeps/linux/.cvsignore Normal file
View File

@@ -0,0 +1,28 @@
.deps
.libs
Makefile
Makefile.in
close.lo
cpu.lo
init.lo
ipc_limits.lo
libgtop_sysdeps.la
loadavg.lo
mem.lo
msg_limits.lo
open.lo
procdata.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
sysinfo.lo
uptime.lo

13
sysdeps/linux/Makefile.am Normal file
View File

@@ -0,0 +1,13 @@
LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
INCLUDES = @GTOP_INCS@
CFLAGS = -Wall -W @CFLAGS@
lib_LTLIBRARIES = libgtop_sysdeps.la
libgtop_sysdeps_la_SOURCES = init.c open.c close.c cpu.c mem.c swap.c \
uptime.c loadavg.c shm_limits.c msg_limits.c \
sem_limits.c proclist.c procstate.c procuid.c \
proctime.c procmem.c procsignal.c prockernel.c \
procsegment.c

28
sysdeps/linux/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 (glibtop *server)
{ }

54
sysdeps/linux/cpu.c Normal file
View File

@@ -0,0 +1,54 @@
/* $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__r (glibtop *server, glibtop_cpu *buf)
{
FILE *f;
glibtop_init__r (&server);
memset (buf, 0, sizeof (glibtop_cpu));
buf->flags = _glibtop_sysdeps_cpu;
f = fopen ("/proc/stat", "r");
if (!f) return;
fscanf (f, "cpu %lu %lu %lu %lu\n",
&buf->user, &buf->nice, &buf->sys, &buf->idle);
buf->total = buf->user + buf->nice + buf->sys + buf->idle;
buf->frequency = 100;
fclose (f);
}

40
sysdeps/linux/init.c Normal file
View File

@@ -0,0 +1,40 @@
/* $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>
static glibtop _glibtop_global_server;
glibtop *glibtop_global_server = NULL;
glibtop *
glibtop_init__r (glibtop **server)
{
if (*server != NULL)
return *server;
if (glibtop_global_server == NULL) {
glibtop_global_server = &_glibtop_global_server;
glibtop_open (glibtop_global_server, "glibtop");
}
return *server = glibtop_global_server;
}

View File

@@ -0,0 +1,19 @@
# libsysdeps.la - a libtool library file
# Generated by ltmain.sh - GNU libtool 1.0h
# The name that we can dlopen(3).
dlname=''
# Names of this library.
library_names='libsysdeps.so.0.0.0 libsysdeps.so.0 libsysdeps.so'
# The name of the static archive.
old_library='libsysdeps.a'
# Version information for libsysdeps.
current=0
age=0
revision=0
# Directory that this library needs to be installed in:
libdir='/usr/local/lib'

48
sysdeps/linux/loadavg.c Normal file
View File

@@ -0,0 +1,48 @@
/* $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>
static const unsigned long _glibtop_sysdeps_loadavg =
(1 << GLIBTOP_LOADAVG_LOADAVG);
/* Provides load load averange. */
void
glibtop_get_loadavg__r (glibtop *server, glibtop_loadavg *buf)
{
FILE *f;
glibtop_init__r (&server);
memset (buf, 0, sizeof (glibtop_loadavg));
buf->flags = _glibtop_sysdeps_loadavg;
f = fopen ("/proc/loadavg", "r");
if (!f) return;
fscanf (f, "%lf %lf %lf\n",
&buf->loadavg [0], &buf->loadavg [1], &buf->loadavg [2]);
fclose (f);
}

53
sysdeps/linux/mem.c Normal file
View File

@@ -0,0 +1,53 @@
/* $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>
static const unsigned long _glibtop_sysdeps_mem =
(1 << GLIBTOP_MEM_TOTAL) + (1 << GLIBTOP_MEM_USED) +
(1 << GLIBTOP_MEM_FREE) + (1 << GLIBTOP_MEM_SHARED) +
(1 << GLIBTOP_MEM_BUFFER) + (1 << GLIBTOP_MEM_CACHED) +
(1 << GLIBTOP_MEM_USER);
/* Provides information about memory usage. */
void
glibtop_get_mem__r (glibtop *server, glibtop_mem *buf)
{
FILE *f;
glibtop_init__r (&server);
memset (buf, 0, sizeof (glibtop_mem));
buf->flags = _glibtop_sysdeps_mem;
f = fopen ("/proc/meminfo", "r");
if (!f) return;
fscanf (f, "%*[^\n]\nMem: %lu %lu %lu %lu %lu %lu\n",
&buf->total, &buf->used, &buf->free, &buf->shared, &buf->buffer, &buf->cached);
buf->user = buf->total - buf->free - buf->shared - buf->buffer;
fclose (f);
}

View File

@@ -0,0 +1,55 @@
/* $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>
#include <sys/ipc.h>
#include <sys/msg.h>
static const unsigned long _glibtop_sysdeps_msg_limits =
(1 << GLIBTOP_IPC_MSGPOOL) + (1 << GLIBTOP_IPC_MSGMAP) +
(1 << GLIBTOP_IPC_MSGMAX) + (1 << GLIBTOP_IPC_MSGMNB) +
(1 << GLIBTOP_IPC_MSGMNI) + (1 << GLIBTOP_IPC_MSGSSZ) +
(1 << GLIBTOP_IPC_MSGTQL);
/* Provides information about sysv ipc limits. */
void
glibtop_get_msg_limits__r (glibtop *server, glibtop_msg_limits *buf)
{
struct msginfo msginfo;
glibtop_init__r (&server);
memset (buf, 0, sizeof (glibtop_msg_limits));
buf->flags = _glibtop_sysdeps_msg_limits;
msgctl (0, IPC_INFO, (struct msqid_ds *) &msginfo);
buf->msgpool = msginfo.msgpool;
buf->msgmap = msginfo.msgmap;
buf->msgmax = msginfo.msgmax;
buf->msgmnb = msginfo.msgmnb;
buf->msgmni = msginfo.msgmni;
buf->msgssz = msginfo.msgssz;
buf->msgtql = msginfo.msgtql;
}

61
sysdeps/linux/open.c Normal file
View File

@@ -0,0 +1,61 @@
/* $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/open.h>
/* =====================================================
* Linux kernel version information for procps utilities
* Copyright (c) 1996 Charles Blake <cblake@bbn.com>
*/
#include <sys/utsname.h>
#define LINUX_VERSION(x,y,z) (0x10000*(x) + 0x100*(y) + z)
static int linux_version_code = 0;
static void set_linux_version(void) {
static struct utsname uts;
int x = 0, y = 0, z = 0; /* cleared in case sscanf() < 3 */
if (linux_version_code) return;
if (uname(&uts) == -1) /* failure most likely implies impending death */
exit(1);
if (sscanf(uts.release, "%d.%d.%d", &x, &y, &z) < 3)
fprintf(stderr, /* *very* unlikely to happen by accident */
"Non-standard uts for running kernel:\n"
"release %s=%d.%d.%d gives version code %d\n",
uts.release, x, y, z, LINUX_VERSION(x,y,z));
linux_version_code = LINUX_VERSION(x, y, z);
}
/* ======================================================= */
/* Opens pipe to gtop server. Returns 0 on success and -1 on error. */
void
glibtop_open (glibtop *server, const char *program_name)
{
memset (server, 0, sizeof (glibtop));
server->name = program_name;
set_linux_version ();
server->os_version_code = (unsigned long) linux_version_code;
}

178
sysdeps/linux/procdata.c Normal file
View File

@@ -0,0 +1,178 @@
/* $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/procdata.h>
#include <sys/stat.h>
#define LINUX_VERSION(x,y,z) (0x10000*(x) + 0x100*(y) + z)
#define BIT_SHIFT(x) (1 << (x % 32))
static const unsigned long _glibtop_sysdeps_procdata_0 =
BIT_SHIFT(GLIBTOP_PROCDATA_CMD) +
BIT_SHIFT(GLIBTOP_PROCDATA_STATE) +
BIT_SHIFT(GLIBTOP_PROCDATA_UID) +
BIT_SHIFT(GLIBTOP_PROCDATA_PID) +
BIT_SHIFT(GLIBTOP_PROCDATA_PPID) +
BIT_SHIFT(GLIBTOP_PROCDATA_PGRP) +
BIT_SHIFT(GLIBTOP_PROCDATA_SESSION) +
BIT_SHIFT(GLIBTOP_PROCDATA_TTY) +
BIT_SHIFT(GLIBTOP_PROCDATA_TPGID) +
BIT_SHIFT(GLIBTOP_PROCDATA_PRIORITY) +
BIT_SHIFT(GLIBTOP_PROCDATA_NICE) +
BIT_SHIFT(GLIBTOP_PROCDATA_SIGNAL) +
BIT_SHIFT(GLIBTOP_PROCDATA_BLOCKED) +
BIT_SHIFT(GLIBTOP_PROCDATA_SIGIGNORE) +
BIT_SHIFT(GLIBTOP_PROCDATA_SIGCATCH) +
BIT_SHIFT(GLIBTOP_PROCDATA_START_TIME) +
BIT_SHIFT(GLIBTOP_PROCDATA_UTIME) +
BIT_SHIFT(GLIBTOP_PROCDATA_STIME) +
BIT_SHIFT(GLIBTOP_PROCDATA_CUTIME) +
BIT_SHIFT(GLIBTOP_PROCDATA_CSTIME) +
BIT_SHIFT(GLIBTOP_PROCDATA_SIZE) +
BIT_SHIFT(GLIBTOP_PROCDATA_RESIDENT) +
BIT_SHIFT(GLIBTOP_PROCDATA_SHARE) +
BIT_SHIFT(GLIBTOP_PROCDATA_TRS) +
BIT_SHIFT(GLIBTOP_PROCDATA_LRS) +
BIT_SHIFT(GLIBTOP_PROCDATA_DRS) +
BIT_SHIFT(GLIBTOP_PROCDATA_DT) +
BIT_SHIFT(GLIBTOP_PROCDATA_VSIZE) +
BIT_SHIFT(GLIBTOP_PROCDATA_RSS) +
BIT_SHIFT(GLIBTOP_PROCDATA_RSS_RLIM) +
BIT_SHIFT(GLIBTOP_PROCDATA_TIMEOUT) +
BIT_SHIFT(GLIBTOP_PROCDATA_IT_REAL_VALUE);
static const unsigned long _glibtop_sysdeps_procdata_1 =
BIT_SHIFT(GLIBTOP_PROCDATA_K_FLAGS) +
BIT_SHIFT(GLIBTOP_PROCDATA_MIN_FLT) +
BIT_SHIFT(GLIBTOP_PROCDATA_MAJ_FLT) +
BIT_SHIFT(GLIBTOP_PROCDATA_CMIN_FLT) +
BIT_SHIFT(GLIBTOP_PROCDATA_CMAJ_FLT) +
BIT_SHIFT(GLIBTOP_PROCDATA_START_CODE) +
BIT_SHIFT(GLIBTOP_PROCDATA_END_CODE) +
BIT_SHIFT(GLIBTOP_PROCDATA_START_STACK) +
BIT_SHIFT(GLIBTOP_PROCDATA_KSTK_ESP) +
BIT_SHIFT(GLIBTOP_PROCDATA_KSTK_EIP) +
BIT_SHIFT(GLIBTOP_PROCDATA_WCHAN);
/* Provides detailed information about a process. */
void
glibtop_get_procdata__r (glibtop *server, glibtop_procdata *buf, pid_t pid)
{
char input [BUFSIZ], *tmp;
struct stat statb;
int nread;
FILE *f;
glibtop_init__r (&server);
memset (buf, 0, sizeof (glibtop_procdata));
if (pid == 0) {
/* Client is only interested in the flags. */
buf->flags [0] = _glibtop_sysdeps_procdata_0;
buf->flags [1] = _glibtop_sysdeps_procdata_1;
return;
}
sprintf (input, "/proc/%d/stat", pid);
if (stat (input, &statb)) return;
buf->uid = statb.st_uid;
f = fopen (input, "r");
if (!f) return;
nread = fread (input, 1, BUFSIZ, f);
if (nread < 0) {
fclose (f);
return;
}
input [nread] = 0;
/* This is from guile-utils/gtop/proc/readproc.c */
/* split into "PID (cmd" and "<rest>" */
tmp = strrchr (input, ')');
*tmp = '\0'; /* replace trailing ')' with NUL */
/* parse these two strings separately, skipping the leading "(". */
memset (buf->cmd, 0, sizeof (buf->cmd));
sscanf (input, "%d (%39c", &buf->pid, buf->cmd);
sscanf(tmp + 2, /* skip space after ')' too */
"%c %d %d %d %d %d %lu %lu %lu %lu %lu "
"%ld %ld %ld %ld %d %d %lu %lu %ld %lu "
"%lu %lu %lu %lu %lu %lu %lu %d %d %d %d %lu",
&buf->state, &buf->ppid, &buf->pgrp, &buf->session,
&buf->tty, &buf->tpgid, &buf->k_flags, &buf->min_flt,
&buf->cmin_flt, &buf->maj_flt, &buf->cmaj_flt,
&buf->utime, &buf->stime, &buf->cutime, &buf->cstime,
&buf->priority, &buf->nice, &buf->timeout,
&buf->it_real_value, &buf->start_time, &buf->vsize,
&buf->rss, &buf->rss_rlim, &buf->start_code,
&buf->end_code, &buf->start_stack, &buf->kstk_esp,
&buf->kstk_eip, &buf->signal, &buf->blocked,
&buf->sigignore, &buf->sigcatch, &buf->wchan);
if (buf->tty == 0)
/* the old notty val, update elsewhere bef. moving to 0 */
buf->tty = -1;
if (server->os_version_code < LINUX_VERSION(1,3,39)) {
/* map old meanings to new */
buf->priority = 2*15 - buf->priority;
buf->nice = 15 - buf->nice;
}
if (server->os_version_code < LINUX_VERSION(1,1,30) && buf->tty != -1)
/* when tty wasn't full devno */
buf->tty = 4*0x100 + buf->tty;
fclose (f);
sprintf (input, "/proc/%d/statm", pid);
f = fopen (input, "r");
if (!f) return;
nread = fread (input, 1, BUFSIZ, f);
if (nread < 0) {
fclose (f);
return;
}
input [nread] = 0;
sscanf (input, "%ld %ld %ld %ld %ld %ld %ld",
&buf->size, &buf->resident, &buf->share,
&buf->trs, &buf->lrs, &buf->drs, &buf->dt);
fclose (f);
buf->flags [0] = _glibtop_sysdeps_procdata_0;
buf->flags [1] = _glibtop_sysdeps_procdata_1;
}

View File

@@ -0,0 +1,82 @@
/* $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/prockernel.h>
static const unsigned long _glibtop_sysdeps_proc_kernel =
(1 << GLIBTOP_PROC_KERNEL_K_FLAGS) + (1 << GLIBTOP_PROC_KERNEL_MIN_FLT) +
(1 << GLIBTOP_PROC_KERNEL_MAJ_FLT) + (1 << GLIBTOP_PROC_KERNEL_CMIN_FLT) +
(1 << GLIBTOP_PROC_KERNEL_CMAJ_FLT) + (1 << GLIBTOP_PROC_KERNEL_KSTK_ESP) +
(1 << GLIBTOP_PROC_KERNEL_KSTK_EIP) + (1 << GLIBTOP_PROC_KERNEL_WCHAN);
/* Provides detailed information about a process. */
void
glibtop_get_proc_kernel__r (glibtop *server, glibtop_proc_kernel *buf, pid_t pid)
{
char input [BUFSIZ], *tmp;
int nread;
FILE *f;
glibtop_init__r (&server);
memset (buf, 0, sizeof (glibtop_proc_kernel));
if (pid == 0) {
/* Client is only interested in the flags. */
buf->flags = _glibtop_sysdeps_proc_kernel;
return;
}
sprintf (input, "/proc/%d/stat", pid);
f = fopen (input, "r");
if (!f) return;
nread = fread (input, 1, BUFSIZ, f);
if (nread < 0) {
fclose (f);
return;
}
input [nread] = 0;
/* This is from guile-utils/gtop/proc/readproc.c */
/* split into "PID (cmd" and "<rest>" */
tmp = strrchr (input, ')');
*tmp = '\0'; /* replace trailing ')' with NUL */
/* parse these two strings separately, skipping the leading "(". */
sscanf(tmp + 2, /* skip space after ')' too */
"%*c %*d %*d %*d %*d %*d %lu %lu %lu %lu %lu "
"%*d %*d %*d %*d %*d %*d %*u %*u %*d %*u "
"%*u %*u %*u %*u %*u %lu %lu %*d %*d %*d %*d %lu",
&buf->k_flags, &buf->min_flt, &buf->cmin_flt,
&buf->maj_flt, &buf->cmaj_flt, &buf->kstk_esp,
&buf->kstk_eip, &buf->wchan);
fclose (f);
buf->flags = _glibtop_sysdeps_proc_kernel;
}

155
sysdeps/linux/proclist.c Normal file
View File

@@ -0,0 +1,155 @@
/* $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/xmalloc.h>
#include <glibtop/proclist.h>
#include <sys/stat.h>
#include <unistd.h>
#include <dirent.h>
#include <ctype.h>
static const unsigned long _glibtop_sysdeps_proclist =
(1 << GLIBTOP_PROCLIST_TOTAL) + (1 << GLIBTOP_PROCLIST_NUMBER) +
(1 << GLIBTOP_PROCLIST_SIZE);
#define BLOCK_COUNT 256
#define BLOCK_SIZE (BLOCK_COUNT * sizeof (unsigned))
/* Fetch list of currently running processes.
*
* The interface of this function is a little bit different from the others:
* buf->flags is only set if the call succeeded, in this case pids_chain,
* a list of the pids of all currently running processes is returned,
* buf->number is the number of elements of this list and buf->size is
* the size of one single element (sizeof (unsigned)). The total size is
* stored in buf->total.
*
* The calling function has to free the memory to which a pointer is returned.
*
* On error, NULL is returned and buf->flags is zero. */
unsigned *
glibtop_get_proclist__r (glibtop *server, glibtop_proclist *buf)
{
DIR *proc;
struct dirent *entry;
char buffer [BUFSIZ];
unsigned count, total, pid;
unsigned pids [BLOCK_COUNT], *pids_chain = NULL;
unsigned pids_size = 0, pids_offset = 0, new_size;
struct stat statb;
int len, i, ok;
glibtop_init__r (&server);
memset (buf, 0, sizeof (glibtop_proclist));
proc = opendir ("/proc");
if (!proc) return NULL;
/* read every every entry in /proc */
for (count = total = 0, entry = readdir (proc); entry; entry = readdir (proc)) {
ok = 1; len = strlen (entry->d_name);
/* does it consist entirely of digits? */
for (i = 0; i < len; i++)
if (!isdigit (entry->d_name [i])) ok = 0;
if (!ok) continue;
/* convert it in a number */
if (sscanf (entry->d_name, "%u", &pid) != 1) continue;
/* is it really a directory? */
sprintf (buffer, "/proc/%d", pid);
if (stat (buffer, &statb)) continue;
if (!S_ISDIR (statb.st_mode)) continue;
/* Fine. Now we first try to store it in pids. If this buffer is
* full, we copy it to the pids_chain. */
if (count >= BLOCK_COUNT) {
/* The following call to glibtop_realloc will be equivalent to
* glibtop_malloc if pids_chain is NULL. We just calculate the
* new size and copy pids to the beginning of the newly allocated
* block. */
new_size = pids_size + BLOCK_SIZE;
pids_chain = glibtop_realloc__r (server, pids_chain, new_size);
memcpy (pids_chain + pids_offset, pids, BLOCK_SIZE);
pids_size = new_size;
pids_offset += BLOCK_COUNT;
count = 0;
}
/* pids is now big enough to hold at least one single pid. */
pids [count++] = pid;
total++;
}
closedir (proc);
/* count is only zero if an error occured (one a running Linux system, we
* only have at least one single process). */
if (!count) return NULL;
/* The following call to glibtop_realloc will be equivalent to
* glibtop_malloc if pids_chain is NULL. We just calculate the
* new size and copy pids to the beginning of the newly allocated
* block. */
new_size = pids_size + count * sizeof (unsigned);
pids_chain = glibtop_realloc__r (server, pids_chain, new_size);
memcpy (pids_chain + pids_offset, pids, count * sizeof (unsigned));
pids_size = new_size;
pids_offset += BLOCK_COUNT;
/* Since everything is ok now, we can set buf->flags, fill in the remaining fields
and return pids_chain. */
buf->flags = _glibtop_sysdeps_proclist;
buf->size = sizeof (unsigned);
buf->number = total;
buf->total = total * sizeof (unsigned);
return pids_chain;
}

96
sysdeps/linux/procmem.c Normal file
View File

@@ -0,0 +1,96 @@
/* $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/procmem.h>
static const unsigned long _glibtop_sysdeps_proc_mem =
(1 << GLIBTOP_PROC_MEM_SIZE) + (1 << GLIBTOP_PROC_MEM_VSIZE) +
(1 << GLIBTOP_PROC_MEM_RESIDENT) + (1 << GLIBTOP_PROC_MEM_SHARE) +
(1 << GLIBTOP_PROC_MEM_RSS) + (1 << GLIBTOP_PROC_MEM_RSS_RLIM);
/* Provides detailed information about a process. */
void
glibtop_get_proc_mem__r (glibtop *server, glibtop_proc_mem *buf, pid_t pid)
{
char input [BUFSIZ], *tmp;
int nread;
FILE *f;
glibtop_init__r (&server);
memset (buf, 0, sizeof (glibtop_proc_mem));
if (pid == 0) {
/* Client is only interested in the flags. */
buf->flags = _glibtop_sysdeps_proc_mem;
return;
}
sprintf (input, "/proc/%d/stat", pid);
f = fopen (input, "r");
if (!f) return;
nread = fread (input, 1, BUFSIZ, f);
if (nread < 0) {
fclose (f);
return;
}
input [nread] = 0;
/* This is from guile-utils/gtop/proc/readproc.c */
/* split into "PID (cmd" and "<rest>" */
tmp = strrchr (input, ')');
*tmp = '\0'; /* replace trailing ')' with NUL */
/* parse these two strings separately, skipping the leading "(". */
sscanf(tmp + 2, /* skip space after ')' too */
"%*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u "
"%*d %*d %*d %*d %*d %*d %*u %*u %*d %lu "
"%lu %lu", &buf->vsize, &buf->rss, &buf->rss_rlim);
fclose (f);
sprintf (input, "/proc/%d/statm", pid);
f = fopen (input, "r");
if (!f) return;
nread = fread (input, 1, BUFSIZ, f);
if (nread < 0) {
fclose (f);
return;
}
input [nread] = 0;
sscanf (input, "%ld %ld %ld",
&buf->size, &buf->resident, &buf->share);
fclose (f);
buf->flags = _glibtop_sysdeps_proc_mem;
}

View File

@@ -0,0 +1,99 @@
/* $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>
static const unsigned long _glibtop_sysdeps_proc_segment =
(1 << GLIBTOP_PROC_SEGMENT_TRS) + (1 << GLIBTOP_PROC_SEGMENT_LRS) +
(1 << GLIBTOP_PROC_SEGMENT_DRS) + (1 << GLIBTOP_PROC_SEGMENT_DT) +
(1 << GLIBTOP_PROC_SEGMENT_START_CODE) + (1 << GLIBTOP_PROC_SEGMENT_END_CODE) +
(1 << GLIBTOP_PROC_SEGMENT_START_STACK);
/* Provides detailed information about a process. */
void
glibtop_get_proc_segment__r (glibtop *server, glibtop_proc_segment *buf,
pid_t pid)
{
char input [BUFSIZ], *tmp;
int nread;
FILE *f;
glibtop_init__r (&server);
memset (buf, 0, sizeof (glibtop_proc_segment));
if (pid == 0) {
/* Client is only interested in the flags. */
buf->flags = _glibtop_sysdeps_proc_segment;
return;
}
sprintf (input, "/proc/%d/stat", pid);
f = fopen (input, "r");
if (!f) return;
nread = fread (input, 1, BUFSIZ, f);
if (nread < 0) {
fclose (f);
return;
}
input [nread] = 0;
/* This is from guile-utils/gtop/proc/readproc.c */
/* split into "PID (cmd" and "<rest>" */
tmp = strrchr (input, ')');
*tmp = '\0'; /* replace trailing ')' with NUL */
/* parse these two strings separately, skipping the leading "(". */
sscanf(tmp + 2, /* skip space after ')' too */
"%*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u "
"%*d %*d %*d %*d %*d %*d %*u %*u %*d %*u "
"%*u %*u %lu %lu %lu", &buf->start_code,
&buf->end_code, &buf->start_stack);
fclose (f);
sprintf (input, "/proc/%d/statm", pid);
f = fopen (input, "r");
if (!f) return;
nread = fread (input, 1, BUFSIZ, f);
if (nread < 0) {
fclose (f);
return;
}
input [nread] = 0;
sscanf (input, "%*d %*d %*d %ld %ld %ld %ld",
&buf->trs, &buf->lrs, &buf->drs, &buf->dt);
fclose (f);
buf->flags = _glibtop_sysdeps_proc_segment;
}

View File

@@ -0,0 +1,78 @@
/* $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/procsignal.h>
static const unsigned long _glibtop_sysdeps_proc_signal =
(1 << GLIBTOP_PROC_SIGNAL_SIGNAL) + (1 << GLIBTOP_PROC_SIGNAL_BLOCKED) +
(1 << GLIBTOP_PROC_SIGNAL_SIGIGNORE) + (1 << GLIBTOP_PROC_SIGNAL_SIGCATCH);
/* Provides detailed information about a process. */
void
glibtop_get_proc_signal__r (glibtop *server, glibtop_proc_signal *buf, pid_t pid)
{
char input [BUFSIZ], *tmp;
int nread;
FILE *f;
glibtop_init__r (&server);
memset (buf, 0, sizeof (glibtop_proc_signal));
if (pid == 0) {
/* Client is only interested in the flags. */
buf->flags = _glibtop_sysdeps_proc_signal;
return;
}
sprintf (input, "/proc/%d/stat", pid);
f = fopen (input, "r");
if (!f) return;
nread = fread (input, 1, BUFSIZ, f);
if (nread < 0) {
fclose (f);
return;
}
input [nread] = 0;
/* This is from guile-utils/gtop/proc/readproc.c */
/* split into "PID (cmd" and "<rest>" */
tmp = strrchr (input, ')');
*tmp = '\0'; /* replace trailing ')' with NUL */
/* parse these two strings separately, skipping the leading "(". */
sscanf(tmp + 2, /* skip space after ')' too */
"%*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u "
"%*d %*d %*d %*d %*d %*d %*u %*u %*d %*u "
"%*u %*u %*u %*u %*u %*u %*u %d %d %d %d",
&buf->signal, &buf->blocked, &buf->sigignore,
&buf->sigcatch);
fclose (f);
buf->flags = _glibtop_sysdeps_proc_signal;
}

88
sysdeps/linux/procstate.c Normal file
View File

@@ -0,0 +1,88 @@
/* $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/procstate.h>
#include <sys/stat.h>
static const unsigned long _glibtop_sysdeps_proc_state =
(1 << GLIBTOP_PROC_STATE_CMD) + (1 << GLIBTOP_PROC_STATE_STATE) +
(1 << GLIBTOP_PROC_STATE_UID) + (1 << GLIBTOP_PROC_STATE_GID);
/* Provides detailed information about a process. */
void
glibtop_get_proc_state__r (glibtop *server, glibtop_proc_state *buf, pid_t pid)
{
char input [BUFSIZ], *tmp;
struct stat statb;
int nread;
FILE *f;
glibtop_init__r (&server);
memset (buf, 0, sizeof (glibtop_proc_state));
if (pid == 0) {
/* Client is only interested in the flags. */
buf->flags = _glibtop_sysdeps_proc_state;
return;
}
sprintf (input, "/proc/%d/stat", pid);
/* IMPORTANT NOTICE: For security reasons it is extremely important
* that the 'uid' and 'gid' fields have correct
* values; NEVER set their flags values if this
* is not the case !!! */
if (stat (input, &statb)) return;
/* For security reasons we use stat () that is more failsafe than sscanf (). */
buf->uid = statb.st_uid;
buf->gid = statb.st_gid;
f = fopen (input, "r");
if (!f) return;
nread = fread (input, 1, BUFSIZ, f);
if (nread < 0) {
fclose (f);
return;
}
input [nread] = 0;
/* This is from guile-utils/gtop/proc/readproc.c */
/* split into "PID (cmd" and "<rest>" */
tmp = strrchr (input, ')');
*tmp = '\0'; /* replace trailing ')' with NUL */
/* parse these two strings separately, skipping the leading "(". */
memset (buf->cmd, 0, sizeof (buf->cmd));
sscanf (input, "%d (%39c", &pid, buf->cmd);
sscanf(tmp + 2, "%c", &buf->state); /* skip space after ')' too */
buf->flags = _glibtop_sysdeps_proc_state;
}

79
sysdeps/linux/proctime.c Normal file
View File

@@ -0,0 +1,79 @@
/* $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/proctime.h>
static const unsigned long _glibtop_sysdeps_proc_time =
(1 << GLIBTOP_PROC_TIME_START_TIME) + (1 << GLIBTOP_PROC_TIME_UTIME) +
(1 << GLIBTOP_PROC_TIME_STIME) + (1 << GLIBTOP_PROC_TIME_CUTIME) +
(1 << GLIBTOP_PROC_TIME_CSTIME) + (1 << GLIBTOP_PROC_TIME_TIMEOUT) +
(1 << GLIBTOP_PROC_TIME_IT_REAL_VALUE);
/* Provides detailed information about a process. */
void
glibtop_get_proc_time__r (glibtop *server, glibtop_proc_time *buf, pid_t pid)
{
char input [BUFSIZ], *tmp;
int nread;
FILE *f;
glibtop_init__r (&server);
memset (buf, 0, sizeof (glibtop_proc_time));
if (pid == 0) {
/* Client is only interested in the flags. */
buf->flags = _glibtop_sysdeps_proc_time;
return;
}
sprintf (input, "/proc/%d/stat", pid);
f = fopen (input, "r");
if (!f) return;
nread = fread (input, 1, BUFSIZ, f);
if (nread < 0) {
fclose (f);
return;
}
input [nread] = 0;
/* This is from guile-utils/gtop/proc/readproc.c */
/* split into "PID (cmd" and "<rest>" */
tmp = strrchr (input, ')');
*tmp = '\0'; /* replace trailing ')' with NUL */
/* parse these two strings separately, skipping the leading "(". */
sscanf(tmp + 2, /* skip space after ')' too */
"%*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u "
"%ld %ld %ld %ld %*d %*d %lu %lu %ld",
&buf->utime, &buf->stime, &buf->cutime, &buf->cstime,
&buf->timeout, &buf->it_real_value, &buf->start_time);
fclose (f);
buf->flags = _glibtop_sysdeps_proc_time;
}

122
sysdeps/linux/procuid.c Normal file
View File

@@ -0,0 +1,122 @@
/* $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/procuid.h>
static const unsigned long _glibtop_sysdeps_proc_uid =
(1 << GLIBTOP_PROC_UID_UID) + (1 << GLIBTOP_PROC_UID_EUID) +
(1 << GLIBTOP_PROC_UID_GID) + (1 << GLIBTOP_PROC_UID_EGID) +
(1 << GLIBTOP_PROC_UID_PID) + (1 << GLIBTOP_PROC_UID_PPID) +
(1 << GLIBTOP_PROC_UID_PGRP) + (1 << GLIBTOP_PROC_UID_SESSION) +
(1 << GLIBTOP_PROC_UID_TTY) + (1 << GLIBTOP_PROC_UID_TPGID) +
(1 << GLIBTOP_PROC_UID_PRIORITY) + (1 << GLIBTOP_PROC_UID_NICE);
#define LINUX_VERSION(x,y,z) (0x10000*(x) + 0x100*(y) + z)
/* Provides detailed information about a process. */
void
glibtop_get_proc_uid__r (glibtop *server, glibtop_proc_uid *buf, pid_t pid)
{
char input [BUFSIZ], *tmp;
int nread;
FILE *f;
glibtop_init__r (&server);
memset (buf, 0, sizeof (glibtop_proc_uid));
if (pid == 0) {
/* Client is only interested in the flags. */
buf->flags = _glibtop_sysdeps_proc_uid;
return;
}
sprintf (input, "/proc/%d/status", pid);
f = fopen (input, "r");
if (!f) return;
nread = fread (input, 1, BUFSIZ, f);
if (nread < 0) {
fclose (f);
return;
}
input [nread] = 0;
/* Search substring 'Pid:' */
tmp = strstr (input, "Pid:");
if (tmp == NULL) return;
sscanf (tmp, "\nPid: %u\nPPid: %u\nUid: %u %u %*u %*u\n"
"Gid: %u %u %*u %*u\n", &buf->pid, &buf->ppid,
&buf->uid, &buf->euid, &buf->gid, &buf->egid);
fclose (f);
sprintf (input, "/proc/%d/stat", pid);
f = fopen (input, "r");
if (!f) return;
nread = fread (input, 1, BUFSIZ, f);
if (nread < 0) {
fclose (f);
return;
}
input [nread] = 0;
/* This is from guile-utils/gtop/proc/readproc.c */
/* split into "PID (cmd" and "<rest>" */
tmp = strrchr (input, ')');
*tmp = '\0'; /* replace trailing ')' with NUL */
/* parse these two strings separately, skipping the leading "(". */
sscanf(tmp + 2, /* skip space after ')' too */
"%*c %*d %d %d %d %d %*u %*u %*u %*u %*u "
"%*d %*d %*d %*d %d %d",
&buf->pgrp, &buf->session, &buf->tty, &buf->tpgid,
&buf->priority, &buf->nice);
if (buf->tty == 0)
/* the old notty val, update elsewhere bef. moving to 0 */
buf->tty = -1;
if (server->os_version_code < LINUX_VERSION(1,3,39)) {
/* map old meanings to new */
buf->priority = 2*15 - buf->priority;
buf->nice = 15 - buf->nice;
}
if (server->os_version_code < LINUX_VERSION(1,1,30) && buf->tty != -1)
/* when tty wasn't full devno */
buf->tty = 4*0x100 + buf->tty;
fclose (f);
buf->flags = _glibtop_sysdeps_proc_uid;
}

View File

@@ -0,0 +1,61 @@
/* $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>
#include <sys/ipc.h>
#include <sys/sem.h>
static unsigned long _glibtop_sysdeps_sem_limits =
(1 << GLIBTOP_IPC_SEMMAP) + (1 << GLIBTOP_IPC_SEMMNI) +
(1 << GLIBTOP_IPC_SEMMNS) + (1 << GLIBTOP_IPC_SEMMNU) +
(1 << GLIBTOP_IPC_SEMMSL) + (1 << GLIBTOP_IPC_SEMOPM) +
(1 << GLIBTOP_IPC_SEMUME) + (1 << GLIBTOP_IPC_SEMUSZ) +
(1 << GLIBTOP_IPC_SEMVMX) + (1 << GLIBTOP_IPC_SEMAEM);
/* Provides information about sysv ipc limits. */
void
glibtop_get_sem_limits__r (glibtop *server, glibtop_sem_limits *buf)
{
struct seminfo seminfo;
union semun arg;
glibtop_init__r (&server);
memset (buf, 0, sizeof (glibtop_sem_limits));
buf->flags = _glibtop_sysdeps_sem_limits;
arg.array = (ushort *) &seminfo;
semctl (0, 0, IPC_INFO, arg);
buf->semmap = seminfo.semmap;
buf->semmni = seminfo.semmni;
buf->semmns = seminfo.semmns;
buf->semmnu = seminfo.semmnu;
buf->semmsl = seminfo.semmsl;
buf->semopm = seminfo.semopm;
buf->semume = seminfo.semume;
buf->semusz = seminfo.semusz;
buf->semvmx = seminfo.semvmx;
buf->semaem = seminfo.semaem;
}

View File

@@ -0,0 +1,52 @@
/* $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>
#include <sys/ipc.h>
#include <sys/shm.h>
static unsigned long _glibtop_sysdeps_shm_limits =
(1 << GLIBTOP_IPC_SHMMAX) + (1 << GLIBTOP_IPC_SHMMIN) +
(1 << GLIBTOP_IPC_SHMMNI) + (1 << GLIBTOP_IPC_SHMSEG) +
(1 << GLIBTOP_IPC_SHMALL);
/* Provides information about sysv ipc limits. */
void
glibtop_get_shm_limits__r (glibtop *server, glibtop_shm_limits *buf)
{
struct shminfo shminfo;
glibtop_init__r (&server);
memset (buf, 0, sizeof (glibtop_shm_limits));
buf->flags = _glibtop_sysdeps_shm_limits;
shmctl (0, IPC_INFO, (struct shmid_ds *) &shminfo);
buf->shmmax = shminfo.shmmax;
buf->shmmin = shminfo.shmmin;
buf->shmmni = shminfo.shmmni;
buf->shmseg = shminfo.shmseg;
buf->shmall = shminfo.shmall;
}

49
sysdeps/linux/swap.c Normal file
View File

@@ -0,0 +1,49 @@
/* $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>
static unsigned long _glibtop_sysdeps_swap =
(1 << GLIBTOP_SWAP_TOTAL) + (1 << GLIBTOP_SWAP_USED) +
(1 << GLIBTOP_SWAP_FREE);
/* Provides information about swap usage. */
void
glibtop_get_swap__r (glibtop *server, glibtop_swap *buf)
{
FILE *f;
glibtop_init__r (&server);
memset (buf, 0, sizeof (glibtop_swap));
buf->flags = _glibtop_sysdeps_swap;
f = fopen ("/proc/meminfo", "r");
if (!f) return;
fscanf (f, "%*[^\n]\n%*[^\n]\nSwap: %lu %lu %lu\n",
&buf->total, &buf->used, &buf->free);
fclose (f);
}

47
sysdeps/linux/uptime.c Normal file
View File

@@ -0,0 +1,47 @@
/* $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>
static unsigned long _glibtop_sysdeps_uptime =
(1 << GLIBTOP_UPTIME_UPTIME) + (1 << GLIBTOP_UPTIME_IDLETIME);
/* Provides uptime and idle time. */
void
glibtop_get_uptime__r (glibtop *server, glibtop_uptime *buf)
{
FILE *f;
glibtop_init__r (&server);
memset (buf, 0, sizeof (glibtop_uptime));
buf->flags = _glibtop_sysdeps_uptime;
f = fopen ("/proc/uptime", "r");
if (!f) return;
fscanf (f, "%lf %lf\n", &buf->uptime, &buf->idletime);
fclose (f);
}

24
sysdeps/names/.cvsignore Normal file
View File

@@ -0,0 +1,24 @@
.deps
.libs
Makefile
Makefile.in
cpu.lo
libgtop_names.la
loadavg.lo
mem.lo
msg_limits.lo
procdata.lo
prockernel.lo
proclist.lo
procmem.lo
procsegment.lo
procsignal.lo
procstate.lo
proctime.lo
procuid.lo
sem_limits.lo
shm_limits.lo
so_locations
swap.lo
sysdeps.lo
uptime.lo

16
sysdeps/names/Makefile.am Normal file
View File

@@ -0,0 +1,16 @@
LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
INCLUDES = @GTOP_INCS@
CFLAGS = -Wall -W @CFLAGS@
DEFS = -DGLIBTOP_NAMES @DEFS@
lib_LTLIBRARIES = libgtop_names.la
libgtop_names_la_SOURCES = cpu.c mem.c swap.c uptime.c loadavg.c \
shm_limits.c msg_limits.c sem_limits.c \
proclist.c sysdeps.c procstate.c procuid.c \
proctime.c procmem.c procsignal.c prockernel.c \
procsegment.c

60
sysdeps/names/cpu.c Normal file
View File

@@ -0,0 +1,60 @@
/* $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/cpu.h>
const char *glibtop_names_cpu [GLIBTOP_MAX_CPU] =
{
"total", "user", "nice", "sys", "idle", "frequency"
};
const char *glibtop_types_cpu [GLIBTOP_MAX_CPU] =
{
"unsigned long", "unsigned long", "unsigned long",
"unsigned long", "unsigned long", "unsigned long"
};
const char *glibtop_labels_cpu [GLIBTOP_MAX_CPU] =
{
N_("Total CPU Time"),
N_("CPU Time in User Mode"),
N_("CPU Time in User Mode (nice)"),
N_("CPU Time in System Mode"),
N_("CPU Time in the Idle Task"),
N_("Tick Frequency")
};
const char *glibtop_descriptions_cpu [GLIBTOP_MAX_CPU] =
{
N_("The number of jiffies (1/100ths of a second) since "
"system boot"),
N_("The number of jiffies (1/100ths of a second) that "
"the system spent in user mode"),
N_("The number of jiffies (1/100ths of a second) that "
"the system spent in user mode with low priority (nice)"),
N_("The number of jiffies (1/100ths of a second) that "
"the system spent in system mode"),
N_("The number of jiffies (1/100ths of a second) that "
"the system spend in the idle task"),
N_("All of the above values are in jiffies (1/100ths of "
"a second) unless otherwise stated in this field "
"(i.e. 'frequency != 100')")
};

42
sysdeps/names/loadavg.c Normal file
View File

@@ -0,0 +1,42 @@
/* $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/loadavg.h>
const char *glibtop_names_loadavg [GLIBTOP_MAX_LOADAVG] =
{
"loadavg"
};
const char *glibtop_types_loadavg [GLIBTOP_MAX_LOADAVG] =
{
"double"
};
const char *glibtop_labels_loadavg [GLIBTOP_MAX_LOADAVG] =
{
N_("Load Average")
};
const char *glibtop_descriptions_loadavg [GLIBTOP_MAX_LOADAVG] =
{
N_("Number of jobs running simultaneously averaged over 1, 5 and 15 minutes")
};

57
sysdeps/names/mem.c Normal file
View File

@@ -0,0 +1,57 @@
/* $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/mem.h>
const char *glibtop_names_mem [GLIBTOP_MAX_MEM] =
{
"total", "used", "free", "shared", "buffer",
"cached", "user"
};
const char *glibtop_types_mem [GLIBTOP_MAX_MEM] =
{
"unsigned long", "unsigned long", "unsigned long",
"unsigned long", "unsigned long", "unsigned long",
"unsigned long"
};
const char *glibtop_labels_mem [GLIBTOP_MAX_MEM] =
{
N_("Total Memory"),
N_("Used Memory"),
N_("Free Memory"),
N_("Shared Memory"),
N_("Buffers"),
N_("Cached"),
N_("User")
};
const char *glibtop_descriptions_mem [GLIBTOP_MAX_MEM] =
{
N_("Total physical memory in kB"),
N_("Used memory size in kB"),
N_("Free memory size in kB"),
N_("Shared memory size in kB"),
N_("Size of buffers kB"),
N_("Size of cached memory in kB"),
N_("Memory used from user processes in kB")
};

View File

@@ -0,0 +1,55 @@
/* $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>
const char *glibtop_names_msg_limits [GLIBTOP_MAX_MSG_LIMITS] =
{
"msgpool", "msgmap", "msgmax", "msgmnb", "msgmni", "msgssz", "msgtql"
};
const char *glibtop_types_msg_limits [GLIBTOP_MAX_MSG_LIMITS] =
{
"unsigned long", "unsigned long", "unsigned long", "unsigned long",
"unsigned long", "unsigned long", "unsigned long"
};
const char *glibtop_labels_msg_limits [GLIBTOP_MAX_MSG_LIMITS] =
{
N_("Size in kilobytes of message pool"),
N_("Number of entries in message map"),
N_("Max size of message"),
N_("Default max size of queue"),
N_("Max queues system wide"),
N_("Message segment size"),
N_("Number of system message headers")
};
const char *glibtop_descriptions_msg_limits [GLIBTOP_MAX_MSG_LIMITS] =
{
N_("Size in kilobytes of message pool"),
N_("Number of entries in message map"),
N_("Max size of message"),
N_("Default max size of queue"),
N_("Max queues system wide"),
N_("Message segment size"),
N_("Number of system message headers")
};

53
sysdeps/names/procdata.c Normal file
View File

@@ -0,0 +1,53 @@
/* $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/procdata.h>
const char *glibtop_names_procdata [GLIBTOP_MAX_PROCDATA] =
{ "cmd", "state", "uid", "pid", "ppid", "pgrp", "session",
"tty", "tpgid", "priority", "nice", "signal", "blocked",
"sigignore", "sigcatch", "start_time", "utime", "stime",
"cutime", "cstime", "size", "resident", "share", "trs",
"lrs", "drs", "dt", "vsize", "rss", "rss_rlim", "timeout",
"it_real_value", "k_flags", "min_flt", "maj_flt", "cmin_flt",
"cmaj_flt", "start_code", "end_code", "start_stack",
"kstk_esp", "kstk_eip", "wchan"
};
const char *glibtop_labels_procdata [GLIBTOP_MAX_PROCDATA] =
{ N_("Cmd"), N_("Stat"), N_("UID"), N_("PID"), N_("PPID"), N_("PGRP"),
N_("Session"), N_("Tty"), N_("TPGID"), N_("Priority"), N_("Nice"),
N_("Signal"), N_("Blocked"), N_("SigIgnore"), N_("SigCatch"),
N_("Start_Time"), N_("UTime"), N_("STime"), N_("CUTime"), N_("CSTime"),
N_("Size"), N_("Resident"), N_("Share"), N_("TRS"), N_("LRS"), N_("DRS"),
N_("DT"), N_("VSize"), N_("RSS"), N_("RSS_RLim"), N_("Timeout"),
N_("It_Real_Value"), N_("Flags"), N_("Min_Flt"), N_("Maj_Flt"),
N_("CMin_Flt"), N_("Cmaj_Flt"), N_("Start_Code"), N_("End_Code"),
N_("Start_Stack"), N_("KSTK_ESP"), N_("KSTK_EIP"), N_("WChan")
};
const char *glibtop_descriptions_procdata [GLIBTOP_MAX_PROCDATA] =
{ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL
};

View File

@@ -0,0 +1,76 @@
/* $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/prockernel.h>
const char *glibtop_names_proc_kernel [GLIBTOP_MAX_PROC_KERNEL] =
{
"k_flags", "min_flt", "maj_flt", "cmin_flt", "cmaj_flt",
"kstk_esp", "kstk_eip", "wchan"
};
const char *glibtop_types_proc_kernel [GLIBTOP_MAX_PROC_KERNEL] =
{
"unsigned long", "unsigned long", "unsigned long", "unsigned long",
"unsigned long", "unsigned long", "unsigned long", "unsigned long"
};
const char *glibtop_labels_proc_kernel [GLIBTOP_MAX_PROC_KERNEL] =
{
N_("K_Flags"), N_("Min_Flt"), N_("Maj_Flt"), N_("CMin_Flt"),
N_("CMaj_Flt"), N_("KStk_ESP"), N_("KStk_EIP"), N_("WChan")
};
const char *glibtop_descriptions_proc_kernel [GLIBTOP_MAX_PROC_KERNEL] =
{
/* K_Flags */
N_("Kernel flags of the process.\n\n"
"On Linux, currently every flag has the math bit set, because "
"crt0.s checks for math emulation, so this is not included in "
"the output.\n\n"
"This is probably a bug, as not every process is a compiled C "
"program.\n\n"
"The math bit should be a decimal 4, and the traced bit is "
"decimal 10."),
/* Min_Flt */
N_("The number of minor faults the process has made, those which "
"have not required loading a memory page from disk."),
/* Maj_Flt */
N_("The number of major faults the process has made, those which "
"have required loading a memory page from disk."),
/* CMin_Flt */
N_("The number of minor faults that the process and its children "
"have made."),
/* CMaj_Flt */
N_("The number of major faults that the process and its children "
"have made."),
/* KStk_ESP */
N_("The current value of esp (32-bit stack pointer), as found in "
"the kernel stack page for the process."),
/* KStk_EIP */
N_("The current EIP (32-bit instruction pointer)."),
/* WChan */
N_("This is the \"channel\" in which the process is waiting. This "
"is the address of a system call, and can be looked up in a "
"namelist if you need a textual name. (If you have an up-to-date "
"/etc/psdatabase, then try ps -l to see the WCHAN field in action)")
};

46
sysdeps/names/proclist.c Normal file
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. */
#include <glibtop/proclist.h>
const char *glibtop_names_proclist [GLIBTOP_MAX_PROCLIST] =
{
"number", "total", "size"
};
const char *glibtop_types_proclist [GLIBTOP_MAX_PROCLIST] =
{
"unsigned long", "unsigned long", "unsigned long"
};
const char *glibtop_labels_proclist [GLIBTOP_MAX_PROCLIST] =
{
N_("Number of list elements"),
N_("Total size of list"),
N_("Size of a single list element")
};
const char *glibtop_descriptions_proclist [GLIBTOP_MAX_PROCLIST] =
{
N_("Number of list elements"),
N_("Total size of list"),
N_("Size of a single list element")
};

61
sysdeps/names/procmem.c Normal file
View File

@@ -0,0 +1,61 @@
/* $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/procmem.h>
#define GLIBTOP_PROC_MEM_SIZE 0
#define GLIBTOP_PROC_MEM_VSIZE 1
#define GLIBTOP_PROC_MEM_RESIDENT 2
#define GLIBTOP_PROC_MEM_SHARE 3
#define GLIBTOP_PROC_MEM_RSS 4
#define GLIBTOP_PROC_MEM_RSS_RLIM 5
const char *glibtop_names_proc_mem [GLIBTOP_MAX_PROC_MEM] =
{
"size", "vsize", "resident", "share", "rss", "rss_rlim"
};
const char *glibtop_types_proc_mem [GLIBTOP_MAX_PROC_MEM] =
{
"long", "long", "long", "long", "long", "long"
};
const char *glibtop_labels_proc_mem [GLIBTOP_MAX_PROC_MEM] =
{
N_("Size"), N_("Virtual"), N_("Resident"), N_("Share"),
N_("Resident Set Size"), N_("Resident Set Size Limit")
};
const char *glibtop_descriptions_proc_mem [GLIBTOP_MAX_PROC_MEM] =
{
N_("Total # of pages of memory"),
N_("Number of pages of virtual memory"),
N_("Number of residnet set (non-swapped) pages"),
N_("Number of pages of shared (mmap'd) memory"),
N_("Number of pages the process has in real memory, minus 3 "
"for administrative purposes. This is just the pages which "
"count towards text, data, or stack space. This does not "
"include pages which have not been demand-loaded in, or which "
"are swapped out."),
N_("Current limit in bytes on the rss of the process "
"(usually 2,147,483,647).")
};

View File

@@ -0,0 +1,51 @@
/* $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/procsegment.h>
const char *glibtop_names_proc_segment [GLIBTOP_MAX_PROC_SEGMENT] =
{
"trs", "lrs", "drs", "dt", "start_code", "end_code", "start_stack"
};
const char *glibtop_types_proc_segment [GLIBTOP_MAX_PROC_SEGMENT] =
{
"long", "long", "long", "long", "unsigned long",
"unsigned long", "unsigned long"
};
const char *glibtop_labels_proc_segment [GLIBTOP_MAX_PROC_SEGMENT] =
{
N_("TRS"), N_("LRS"), N_("DRS"), N_("DT"), N_("Start_Code"),
N_("End_Code"), N_("Start_Stack")
};
const char *glibtop_descriptions_proc_segment [GLIBTOP_MAX_PROC_SEGMENT] =
{
N_("Text resident set size"),
N_("Shared-Lib resident set size"),
N_("Data resident set size"),
N_("Dirty pages"),
N_("Address of beginning of code segment"),
N_("Address of end of code segment"),
N_("Address of the bottom of stack segment")
};

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. */
#include <glibtop.h>
#include <glibtop/procsignal.h>
const char *glibtop_names_proc_signal [GLIBTOP_MAX_PROC_SIGNAL] =
{
"signal", "blocked", "sigignore", "sigcatch"
};
const char *glibtop_types_proc_signal [GLIBTOP_MAX_PROC_SIGNAL] =
{
"int", "int", "int", "int"
};
const char *glibtop_labels_proc_signal [GLIBTOP_MAX_PROC_SIGNAL] =
{
N_("Signal"), N_("Blocked"), N_("SigIgnore"), N_("SigCatch")
};
const char *glibtop_descriptions_proc_signal [GLIBTOP_MAX_PROC_SIGNAL] =
{
N_("Mask of pending signals"),
N_("Mask of blocked signals"),
N_("Mask of ignored signals"),
N_("Mask of caught signals")
};

46
sysdeps/names/procstate.c Normal file
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. */
#include <glibtop.h>
#include <glibtop/procstate.h>
const char *glibtop_names_proc_state [GLIBTOP_MAX_PROC_STATE] =
{
"cmd", "state", "uid", "gid"
};
const char *glibtop_types_proc_state [GLIBTOP_MAX_PROC_STATE] =
{
"char *", "char", "int", "int"
};
const char *glibtop_labels_proc_state [GLIBTOP_MAX_PROC_STATE] =
{
N_("Cmd"), N_("State"), N_("UID"), N_("GID")
};
const char *glibtop_descriptions_proc_state [GLIBTOP_MAX_PROC_STATE] =
{
N_("Basename of executable file in call to exec()"),
N_("Single-Char code for process state (S=sleeping)"),
N_("UID of process"),
N_("GID of process")
};

62
sysdeps/names/proctime.c Normal file
View File

@@ -0,0 +1,62 @@
/* $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/proctime.h>
#define GLIBTOP_PROC_TIME_START_TIME 0
#define GLIBTOP_PROC_TIME_UTIME 1
#define GLIBTOP_PROC_TIME_STIME 2
#define GLIBTOP_PROC_TIME_CUTIME 3
#define GLIBTOP_PROC_TIME_CSTIME 4
#define GLIBTOP_PROC_TIME_TIMEOUT 5
#define GLIBTOP_PROC_TIME_IT_REAL_VALUE 6
const char *glibtop_names_proc_time [GLIBTOP_MAX_PROC_TIME] =
{
"start_time", "utime", "stime", "cutime", "cstime",
"timeout", "it_real_value"
};
const char *glibtop_types_proc_time [GLIBTOP_MAX_PROC_TIME] =
{
"long", "long", "long", "long", "long", "long", "long"
};
const char *glibtop_labels_proc_time [GLIBTOP_MAX_PROC_TIME] =
{
N_("Start_Time"), N_("UTime"), N_("STime"), N_("CUTime"),
N_("CSTime"), N_("TimeOut"), N_("It_Real_Value")
};
const char *glibtop_descriptions_proc_time [GLIBTOP_MAX_PROC_TIME] =
{
N_("Start time of process in seconds since the epoch"),
N_("user-mode CPU time accumulated by process"),
N_("kernel-mode CPU time accumulated by process"),
N_("cumulative utime of process and reaped children"),
N_("cumulative stime of process and reaped children"),
N_("The time (in jiffies) of the process's next timeout"),
N_("The time (in jiffies) before the next SIGALRM is sent "
"to the process due to an interval timer.")
};

71
sysdeps/names/procuid.c Normal file
View File

@@ -0,0 +1,71 @@
/* $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/procuid.h>
#define GLIBTOP_PROC_UID_UID 0
#define GLIBTOP_PROC_UID_EUID 1
#define GLIBTOP_PROC_UID_GID 2
#define GLIBTOP_PROC_UID_EGID 3
#define GLIBTOP_PROC_UID_PID 4
#define GLIBTOP_PROC_UID_PPID 5
#define GLIBTOP_PROC_UID_PGRP 6
#define GLIBTOP_PROC_UID_SESSION 7
#define GLIBTOP_PROC_UID_TTY 8
#define GLIBTOP_PROC_UID_TPGID 9
#define GLIBTOP_PROC_UID_PRIORITY 10
#define GLIBTOP_PROC_UID_NICE 11
const char *glibtop_names_proc_uid [GLIBTOP_MAX_PROC_UID] =
{
"uid", "euid", "gid", "egid", "pid", "ppid", "pgrp",
"session", "tty", "tpgid", "priority", "nice"
};
const char *glibtop_types_proc_uid [GLIBTOP_MAX_PROC_UID] =
{
"int", "int", "int", "int", "int", "int", "int",
"int", "int", "int", "int", "int"
};
const char *glibtop_labels_proc_uid [GLIBTOP_MAX_PROC_UID] =
{
N_("Uid"), N_("EUid"), N_("Gid"), N_("EGid"), N_("Pid"),
N_("PPid"), N_("PGrp"), N_("Session"), N_("Tty"),
N_("TPGid"), N_("Priority"), N_("Nice")
};
const char *glibtop_descriptions_proc_uid [GLIBTOP_MAX_PROC_UID] =
{
N_("User ID"),
N_("Effective User ID"),
N_("Group ID"),
N_("Effective Group ID"),
N_("Process ID"),
N_("PID of parent process"),
N_("Process group ID"),
N_("Session ID"),
N_("Full device number of controlling terminal"),
N_("Terminal process group ID"),
N_("Kernel scheduling priority"),
N_("Standard unix nice level of process")
};

View File

@@ -0,0 +1,63 @@
/* $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>
const char *glibtop_names_sem_limits [GLIBTOP_MAX_SEM_LIMITS] =
{
"semmap", "semmni", "semmns", "semmnu", "semmsl",
"semopm", "semume", "semusz", "semvmx", "semaem"
};
const char *glibtop_types_sem_limits [GLIBTOP_MAX_SEM_LIMITS] =
{
"unsigned long", "unsigned long", "unsigned long", "unsigned long",
"unsigned long", "unsigned long", "unsigned long", "unsigned long",
"unsigned long", "unsigned long"
};
const char *glibtop_labels_sem_limits [GLIBTOP_MAX_SEM_LIMITS] =
{
N_("Number of entries in semaphore map"),
N_("Max number of arrays"),
N_("Max semaphores system wide"),
N_("Number of undo structures system wide"),
N_("Max semaphores per array"),
N_("Max ops per semop call"),
N_("Max number of undo entries per process"),
N_("sizeof struct sem_undo"),
N_("Semaphore max value"),
N_("Adjust on exit max value")
};
const char *glibtop_descriptions_sem_limits [GLIBTOP_MAX_SEM_LIMITS] =
{
N_("Number of entries in semaphore map"),
N_("Max number of arrays"),
N_("Max semaphores system wide"),
N_("Number of undo structures system wide"),
N_("Max semaphores per array"),
N_("Max ops per semop call"),
N_("Max number of undo entries per process"),
N_("sizeof struct sem_undo"),
N_("Semaphore max value"),
N_("Adjust on exit max value")
};

View File

@@ -0,0 +1,51 @@
/* $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>
const char *glibtop_names_shm_limits [GLIBTOP_MAX_SHM_LIMITS] =
{
"shmmax", "shmmin", "shmmni", "shmseg", "shmall"
};
const char *glibtop_types_shm_limits [GLIBTOP_MAX_SHM_LIMITS] =
{
"unsigned long", "unsigned long", "unsigned long",
"unsigned long", "unsigned long"
};
const char *glibtop_labels_shm_limits [GLIBTOP_MAX_SHM_LIMITS] =
{
N_("Max segment size"),
N_("Min segment size"),
N_("Max number of segments"),
N_("Max shared segments per process"),
N_("Max total shared memory")
};
const char *glibtop_descriptions_shm_limits [GLIBTOP_MAX_SHM_LIMITS] =
{
N_("Max segment size"),
N_("Min segment size"),
N_("Max number of segments"),
N_("Max shared segments per process"),
N_("Max total shared memory")
};

46
sysdeps/names/swap.c Normal file
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. */
#include <glibtop/swap.h>
const char *glibtop_names_swap [GLIBTOP_MAX_SWAP] =
{
"total", "used", "free"
};
const char *glibtop_types_swap [GLIBTOP_MAX_SWAP] =
{
"unsigned long", "unsigned long", "unsigned long"
};
const char *glibtop_labels_swap [GLIBTOP_MAX_SWAP] =
{
N_("Total Swap Space"),
N_("Used Swap Space"),
N_("Free Swap Space")
};
const char *glibtop_descriptions_swap [GLIBTOP_MAX_SWAP] =
{
N_("Total Swap Space"),
N_("Used Swap Space"),
N_("Free Swap Space")
};

78
sysdeps/names/sysdeps.c Normal file
View File

@@ -0,0 +1,78 @@
/* 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/union.h>
#include <glibtop/sysdeps.h>
const char *glibtop_names_sysdeps [GLIBTOP_MAX_SYSDEPS] =
{
"cpu", "mem", "swap", "uptime", "loadavg", "shm_limits",
"msg_limits", "sem_limits", "proclist", "proc_state",
"proc_uid", "proc_mem", "proc_time", "proc_signal",
"proc_kernel", "proc_segment"
};
const char *glibtop_types_sysdeps [GLIBTOP_MAX_SYSDEPS] =
{
"unsigned long", "unsigned long", "unsigned long", "unsigned long",
"unsigned long", "unsigned long", "unsigned long", "unsigned long",
"unsigned long", "unsigned long", "unsigned long", "unsigned long",
"unsigned long", "unsigned long", "unsigned long", "unsigned long"
};
const char *glibtop_labels_sysdeps [GLIBTOP_MAX_SYSDEPS] =
{
N_("CPU Usage"),
N_("Memory Usage"),
N_("Swap Usage"),
N_("System Uptime"),
N_("Load Averange"),
N_("Shared Memory Limits"),
N_("Message Queue Limits"),
N_("Semaphore Set Limits"),
N_("List of running Processes"),
N_("Process Status information"),
N_("Process UID and TTY information"),
N_("Process Memory information"),
N_("Process Time information"),
N_("Process Signal information"),
N_("Process Kernel Data information"),
N_("Process Segment information")
};
const char *glibtop_descriptions_sysdeps [GLIBTOP_MAX_SYSDEPS] =
{
N_("CPU Usage"),
N_("Memory Usage"),
N_("Swap Usage"),
N_("System Uptime"),
N_("Load Averange"),
N_("Shared Memory Limits"),
N_("Message Queue Limits"),
N_("Semaphore Set Limits"),
N_("List of running Processes"),
N_("Process Status information"),
N_("Process UID and TTY information"),
N_("Process Memory information"),
N_("Process Time information"),
N_("Process Signal information"),
N_("Process Kernel Data information"),
N_("Process Segment information")
};

44
sysdeps/names/uptime.c Normal file
View File

@@ -0,0 +1,44 @@
/* $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/uptime.h>
const char *glibtop_names_uptime [GLIBTOP_MAX_UPTIME] =
{
"uptime", "idletime"
};
const char *glibtop_types_uptime [GLIBTOP_MAX_UPTIME] =
{
"double", "double"
};
const char *glibtop_labels_uptime [GLIBTOP_MAX_UPTIME] =
{
N_("Uptime"),
N_("Idletime")
};
const char *glibtop_descriptions_uptime [GLIBTOP_MAX_UPTIME] =
{
N_("Time in seconds since system boot"),
N_("Time in seconds the system spent in the idle task since system boot")
};

21
sysdeps/osf1/.cvsignore Normal file
View File

@@ -0,0 +1,21 @@
.deps
.libs
Makefile
Makefile.in
close.lo
cpu.lo
libgtop_sysdeps.la
libsysdeps.la
loadavg.c
loadavg.lo
mem.lo
msg_limits.lo
open.lo
proclist.lo
sem_limits.lo
shm_limits.lo
swap.lo
sysdeps.lo
uptime.c
uptime.lo
so_locations

15
sysdeps/osf1/Makefile.am Normal file
View File

@@ -0,0 +1,15 @@
LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
INCLUDES = @GTOP_INCS@
CFLAGS = -Wall -W @CFLAGS@
lib_LTLIBRARIES = libgtop_sysdeps.la
libgtop_sysdeps_la_SOURCES = init.c open.c close.c cpu.c mem.c swap.c \
uptime.c loadavg.c shm_limits.c msg_limits.c \
sem_limits.c proclist.c procstate.c procuid.c \
proctime.c procmem.c procsignal.c prockernel.c \
procsegment.c
libgtop_sysdeps_la_LIBADD = -lmach

28
sysdeps/osf1/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 (glibtop *server)
{ }

59
sysdeps/osf1/cpu.c Normal file
View File

@@ -0,0 +1,59 @@
/* $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/error.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__r (glibtop *server, glibtop_cpu *buf)
{
struct tbl_sysinfo sysinfo;
int ret;
glibtop_init ();
memset (buf, 0, sizeof (glibtop_cpu));
ret = table (TBL_SYSINFO, 0, (char *) &sysinfo, 1,
sizeof (struct tbl_sysinfo));
if (ret != 1) return;
buf->flags = _glibtop_sysdeps_cpu;
buf->user = sysinfo.si_user;
buf->nice = sysinfo.si_nice;
buf->sys = sysinfo.si_sys;
buf->idle = sysinfo.si_idle;
buf->total = sysinfo.si_user + sysinfo.si_nice +
sysinfo.si_sys + sysinfo.si_idle;
buf->frequency = sysinfo.si_hz;
}

View File

@@ -0,0 +1,48 @@
/* $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/table.h>
/* The following are defined in <sys/table.h>. */
#undef sys
#undef user
#undef idle
__BEGIN_DECLS
extern int table __P((int id, int index, char *addr, int nel, u_int lel));
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 */
unsigned proctable_entries; /* Max entries in the proctable */
};
__END_DECLS
#endif

40
sysdeps/osf1/init.c Normal file
View File

@@ -0,0 +1,40 @@
/* $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>
static glibtop _glibtop_global_server;
glibtop *glibtop_global_server = NULL;
glibtop *
glibtop_init__r (glibtop **server)
{
if (*server != NULL)
return *server;
if (glibtop_global_server == NULL) {
glibtop_global_server = &_glibtop_global_server;
glibtop_open (glibtop_global_server, "glibtop");
}
return *server = glibtop_global_server;
}

59
sysdeps/osf1/mem.c Normal file
View File

@@ -0,0 +1,59 @@
/* $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/error.h>
#include <glibtop/mem.h>
#include <sys/vm.h>
#include <mach.h>
#include <mach/mach_types.h>
#include <mach/vm_statistics.h>
static const unsigned long _glibtop_sysdeps_mem =
(1 << GLIBTOP_MEM_TOTAL) + (1 << GLIBTOP_MEM_USED) +
(1 << GLIBTOP_MEM_FREE);
/* Provides information about memory usage. */
void
glibtop_get_mem__r (glibtop *server, glibtop_mem *buf)
{
vm_statistics_data_t vmstats;
glibtop_init ();
memset (buf, 0, sizeof (glibtop_mem));
buf->flags = _glibtop_sysdeps_mem;
(void) vm_statistics(task_self(), &vmstats);
buf->free = vmstats.free_count * vmstats.pagesize;
buf->used = vmstats.active_count * vmstats.pagesize;
/* [FIXME]: Is this correct? */
buf->total = (vmstats.active_count + vmstats.inactive_count +
vmstats.free_count + vmstats.wire_count) *
vmstats.pagesize;
}

77
sysdeps/osf1/msg_limits.c Normal file
View File

@@ -0,0 +1,77 @@
/* $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/error.h>
#include <glibtop/msg_limits.h>
static const unsigned long _glibtop_sysdeps_msg_limits =
(1 << GLIBTOP_IPC_MSGMAP) + (1 << GLIBTOP_IPC_MSGMAX) +
(1 << GLIBTOP_IPC_MSGMNB) + (1 << GLIBTOP_IPC_MSGMNI) +
(1 << GLIBTOP_IPC_MSGTQL);
/* Provides information about sysv ipc limits. */
void
glibtop_get_msg_limits__r (glibtop *server, glibtop_msg_limits *buf)
{
int ret, value;
glibtop_init ();
memset (buf, 0, sizeof (glibtop_msg_limits));
ret = table (TBL_MSGINFO, MSGINFO_MAX, (char *) &value, 1,
sizeof (value));
if (ret != 1) return;
buf->flags += (1 << GLIBTOP_IPC_MSGMAX);
buf->msgmax = value;
ret = table (TBL_MSGINFO, MSGINFO_MNB, (char *) &value, 1,
sizeof (value));
if (ret != 1) return;
buf->flags += (1 << GLIBTOP_IPC_MSGMNB);
buf->msgmnb = value;
ret = table (TBL_MSGINFO, MSGINFO_MNI, (char *) &value, 1,
sizeof (value));
if (ret != 1) return;
buf->flags += (1 << GLIBTOP_IPC_MSGMNI);
buf->msgmni = value;
ret = table (TBL_MSGINFO, MSGINFO_TQL, (char *) &value, 1,
sizeof (value));
if (ret != 1) return;
buf->flags += (1 << GLIBTOP_IPC_MSGTQL);
buf->msgtql = value;
}

64
sysdeps/osf1/open.c Normal file
View File

@@ -0,0 +1,64 @@
/* $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/open.h>
#include <unistd.h>
#include <sys/types.h>
/* Opens pipe to gtop server. Returns 0 on success and -1 on error. */
/* !!! THIS FUNCTION RUNS SUID ROOT - CHANGE WITH CAUTION !!! */
void
glibtop_open (glibtop *server, const char *program_name)
{
/* !!! WE ARE ROOT HERE - CHANGE WITH CAUTION !!! */
memset (server, 0, sizeof (glibtop));
server->name = program_name;
server->machine.uid = getuid ();
server->machine.euid = geteuid ();
server->machine.gid = getgid ();
server->machine.egid = getegid ();
server->machine.proctable_entries = table (TBL_PROCINFO, 0, NULL, INT_MAX, 0);
/* Drop priviledges; we only become root when necessary.
setreuid (ruid, euid) - set real and effective user id;
setregid (rgid, egid) - set real and effective group id;
*/
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.
*/
}

148
sysdeps/osf1/procdata.c Normal file
View File

@@ -0,0 +1,148 @@
/* $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/procdata.h>
#include <sys/user.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <mach.h>
#include <mach/mach_types.h>
#include <mach/task_info.h>
/* Provides detailed information about a process. */
#define BIT_SHIFT(x) (1 << (x % 32))
static const unsigned long _glibtop_sysdeps_procdata_0 =
BIT_SHIFT(GLIBTOP_PROCDATA_CMD) +
BIT_SHIFT(GLIBTOP_PROCDATA_STATE) +
BIT_SHIFT(GLIBTOP_PROCDATA_UID) +
BIT_SHIFT(GLIBTOP_PROCDATA_PID) +
BIT_SHIFT(GLIBTOP_PROCDATA_PPID) +
BIT_SHIFT(GLIBTOP_PROCDATA_PGRP) +
BIT_SHIFT(GLIBTOP_PROCDATA_TTY) +
BIT_SHIFT(GLIBTOP_PROCDATA_K_FLAGS) +
BIT_SHIFT(GLIBTOP_PROCDATA_SESSION) +
BIT_SHIFT(GLIBTOP_PROCDATA_TPGID) +
BIT_SHIFT(GLIBTOP_PROCDATA_SIGIGNORE) +
BIT_SHIFT(GLIBTOP_PROCDATA_SIGCATCH) +
BIT_SHIFT(GLIBTOP_PROCDATA_SIGNAL) +
BIT_SHIFT(GLIBTOP_PROCDATA_NICE);
static const unsigned long _glibtop_sysdeps_procdata_1 = 0;
void
glibtop_get_procdata__r (glibtop *server, glibtop_procdata *buf, pid_t pid)
{
struct tbl_procinfo procinfo;
task_basic_info_data_t taskinfo;
struct user u;
task_t thistask;
int ret, info_count;
memset (buf, 0, sizeof (glibtop_procdata));
glibtop_init ();
memset (buf, 0, sizeof (glibtop_procdata));
ret = table (TBL_PROCINFO, pid, (char *) &procinfo, 1,
sizeof (struct tbl_procinfo));
if (ret != 1) return;
strcpy (buf->cmd, procinfo.pi_comm);
buf->uid = procinfo.pi_uid;
buf->pid = procinfo.pi_pid;
buf->ppid = procinfo.pi_ppid;
buf->pgrp = procinfo.pi_pgrp;
buf->tty = procinfo.pi_ttyd;
buf->k_flags = procinfo.pi_flag;
buf->session = procinfo.pi_session;
buf->tpgid = procinfo.pi_tpgrp;
buf->sigignore = procinfo.pi_sigignore;
buf->sigcatch = procinfo.pi_sigcatch;
buf->signal = procinfo.pi_sig;
buf->flags [0] += _glibtop_sysdeps_procdata_0;
if (procinfo.pi_status != PI_ACTIVE) return;
/* From that point on, we are only interested in active processes. */
buf->nice = getpriority (PRIO_PROCESS, pid);
/* Get task structure. */
ret = task_by_unix_pid (task_self(), procinfo.pi_pid, &thistask);
if (ret != KERN_SUCCESS) return;
/* Get taskinfo about this task. */
info_count = TASK_BASIC_INFO_COUNT;
ret = task_info (thistask, TASK_BASIC_INFO, (task_info_t) &taskinfo, &info_count);
if (ret != KERN_SUCCESS) return;
buf->priority = taskinfo.base_priority;
buf->resident = taskinfo.resident_size;
buf->rss = taskinfo.resident_size;
buf->vsize = taskinfo.virtual_size;
buf->flags [0] += BIT_SHIFT(GLIBTOP_PROCDATA_PRIORITY) +
BIT_SHIFT(GLIBTOP_PROCDATA_RESIDENT) +
BIT_SHIFT(GLIBTOP_PROCDATA_RSS) +
BIT_SHIFT(GLIBTOP_PROCDATA_VSIZE);
ret = table (TBL_UAREA, pid, (char *) &u, 1,
sizeof (struct user));
if (ret != 1) return;
buf->start_code = (unsigned long) u.u_text_start;
buf->end_code = (unsigned long) u.u_data_start;
buf->start_stack = (unsigned long) u.u_stack_start;
buf->trs = u.u_tsize;
buf->drs = u.u_dsize;
buf->start_time = u.u_start.tv_sec;
buf->utime = u.u_ru.ru_utime.tv_sec;
buf->stime = u.u_ru.ru_stime.tv_sec;
buf->cutime = u.u_cru.ru_utime.tv_sec;
buf->cstime = u.u_cru.ru_stime.tv_sec;
buf->flags [0] += BIT_SHIFT(GLIBTOP_PROCDATA_START_TIME) +
BIT_SHIFT(GLIBTOP_PROCDATA_UTIME) + BIT_SHIFT(GLIBTOP_PROCDATA_STIME) +
BIT_SHIFT(GLIBTOP_PROCDATA_CUTIME) + BIT_SHIFT(GLIBTOP_PROCDATA_CSTIME) +
BIT_SHIFT(GLIBTOP_PROCDATA_TRS) + BIT_SHIFT(GLIBTOP_PROCDATA_DRS);
buf->flags [1] += BIT_SHIFT(GLIBTOP_PROCDATA_START_CODE) +
BIT_SHIFT(GLIBTOP_PROCDATA_END_CODE) +
BIT_SHIFT(GLIBTOP_PROCDATA_START_STACK);
}

Some files were not shown because too many files have changed in this diff Show More