summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.cvsignore24
-rw-r--r--ANNOUNCE95
-rw-r--r--AUTHORS1
-rw-r--r--ChangeLog393
-rw-r--r--Makefile.am41
-rw-r--r--NEWS96
-rw-r--r--README57
-rw-r--r--README.LATEST8
-rw-r--r--acconfig.h30
-rw-r--r--acinclude.m4960
-rwxr-xr-xautogen.sh17
-rwxr-xr-xconfig.guess883
-rwxr-xr-xconfig.sub954
-rw-r--r--configure.in144
-rw-r--r--copyright.txt21
-rw-r--r--doc/.cvsignore15
-rw-r--r--doc/Makefile6
-rw-r--r--doc/catalog3
-rwxr-xr-xdoc/libgtop.dsl1627
-rw-r--r--doc/libgtop.sgml1332
-rw-r--r--examples/.cvsignore13
-rw-r--r--examples/Makefile.am66
-rw-r--r--examples/first.c326
-rw-r--r--examples/second.c140
-rw-r--r--examples/third.c51
-rw-r--r--examples/third.scm10
-rw-r--r--glibtop.h72
-rw-r--r--gtopConf.sh.in17
-rw-r--r--guile/header.scm440
-rw-r--r--guile/make-header.scm195
-rw-r--r--include/glibtop/close.h33
-rw-r--r--include/glibtop/command.h67
-rw-r--r--include/glibtop/cpu.h88
-rw-r--r--include/glibtop/error.h35
-rw-r--r--include/glibtop/global.h93
-rw-r--r--include/glibtop/loadavg.h78
-rw-r--r--include/glibtop/mem.h90
-rw-r--r--include/glibtop/msg_limits.h90
-rw-r--r--include/glibtop/open.h33
-rw-r--r--include/glibtop/output.h33
-rw-r--r--include/glibtop/prockernel.h99
-rw-r--r--include/glibtop/proclist.h82
-rw-r--r--include/glibtop/procmem.h92
-rw-r--r--include/glibtop/procsegment.h93
-rw-r--r--include/glibtop/procsignal.h86
-rw-r--r--include/glibtop/procstate.h93
-rw-r--r--include/glibtop/proctime.h98
-rw-r--r--include/glibtop/procuid.h102
-rw-r--r--include/glibtop/read.h36
-rw-r--r--include/glibtop/read_data.h36
-rw-r--r--include/glibtop/sem_limits.h96
-rw-r--r--include/glibtop/shm_limits.h86
-rw-r--r--include/glibtop/swap.h82
-rw-r--r--include/glibtop/sysdeps.h108
-rw-r--r--include/glibtop/union.h69
-rw-r--r--include/glibtop/uptime.h80
-rw-r--r--include/glibtop/version.h31
-rw-r--r--include/glibtop/write.h36
-rw-r--r--include/glibtop/xmalloc.h42
-rw-r--r--lib/.cvsignore34
-rw-r--r--lib/Makefile.am15
-rw-r--r--lib/close.c32
-rw-r--r--lib/command.c54
-rw-r--r--lib/cpu.c32
-rw-r--r--lib/init.c40
-rw-r--r--lib/loadavg.c33
-rw-r--r--lib/mem.c32
-rw-r--r--lib/msg_limits.c32
-rw-r--r--lib/open.c60
-rw-r--r--lib/prockernel.c35
-rw-r--r--lib/proclist.c32
-rw-r--r--lib/procmem.c35
-rw-r--r--lib/procsegment.c35
-rw-r--r--lib/procsignal.c35
-rw-r--r--lib/procstate.c35
-rw-r--r--lib/proctime.c35
-rw-r--r--lib/procuid.c35
-rw-r--r--lib/read.c41
-rw-r--r--lib/read_data.c48
-rw-r--r--lib/sem_limits.c32
-rw-r--r--lib/shm_limits.c32
-rw-r--r--lib/swap.c32
-rw-r--r--lib/sysdeps.c32
-rw-r--r--lib/uptime.c33
-rw-r--r--lib/write.c38
-rwxr-xr-xlibgtop-mirror.sh47
-rw-r--r--po/.cvsignore5
-rw-r--r--po/POTFILES.in78
-rw-r--r--po/stamp-cat-id1
-rw-r--r--src/.cvsignore2
-rw-r--r--src/Makefile.am1
-rw-r--r--src/server/.cvsignore5
-rw-r--r--src/server/Makefile.am14
-rw-r--r--src/server/main.c258
-rw-r--r--src/server/output.c31
-rw-r--r--src/server/version.c31
-rw-r--r--stamp-h.in1
-rw-r--r--sysdeps/.cvsignore2
-rw-r--r--sysdeps/Makefile.am7
-rw-r--r--sysdeps/common/.cvsignore12
-rw-r--r--sysdeps/common/Makefile.am10
-rw-r--r--sysdeps/common/error.c39
-rw-r--r--sysdeps/common/sysdeps.c80
-rw-r--r--sysdeps/common/xmalloc.c66
-rw-r--r--sysdeps/guile/.cvsignore25
-rw-r--r--sysdeps/guile/Makefile.am15
-rw-r--r--sysdeps/guile/boot.c66
-rw-r--r--sysdeps/guile/cpu.c41
-rw-r--r--sysdeps/guile/loadavg.c38
-rw-r--r--sysdeps/guile/mem.c42
-rw-r--r--sysdeps/guile/msg_limits.c42
-rw-r--r--sysdeps/guile/names/.cvsignore26
-rw-r--r--sysdeps/guile/names/Makefile.am16
-rw-r--r--sysdeps/guile/names/boot.c168
-rw-r--r--sysdeps/guile/names/cpu.c95
-rw-r--r--sysdeps/guile/names/loadavg.c95
-rw-r--r--sysdeps/guile/names/mem.c95
-rw-r--r--sysdeps/guile/names/msg_limits.c95
-rw-r--r--sysdeps/guile/names/prockernel.c95
-rw-r--r--sysdeps/guile/names/proclist.c96
-rw-r--r--sysdeps/guile/names/procmem.c95
-rw-r--r--sysdeps/guile/names/procsegment.c95
-rw-r--r--sysdeps/guile/names/procsignal.c95
-rw-r--r--sysdeps/guile/names/procstate.c95
-rw-r--r--sysdeps/guile/names/proctime.c95
-rw-r--r--sysdeps/guile/names/procuid.c95
-rw-r--r--sysdeps/guile/names/sem_limits.c85
-rw-r--r--sysdeps/guile/names/shm_limits.c85
-rw-r--r--sysdeps/guile/names/swap.c84
-rw-r--r--sysdeps/guile/names/sysdeps.c85
-rw-r--r--sysdeps/guile/names/uptime.c84
-rw-r--r--sysdeps/guile/prockernel.c44
-rw-r--r--sysdeps/guile/proclist.c52
-rw-r--r--sysdeps/guile/procmem.c42
-rw-r--r--sysdeps/guile/procsegment.c43
-rw-r--r--sysdeps/guile/procsignal.c40
-rw-r--r--sysdeps/guile/procstate.c40
-rw-r--r--sysdeps/guile/proctime.c43
-rw-r--r--sysdeps/guile/procuid.c48
-rw-r--r--sysdeps/guile/sem_limits.c45
-rw-r--r--sysdeps/guile/shm_limits.c40
-rw-r--r--sysdeps/guile/swap.c38
-rw-r--r--sysdeps/guile/sysdeps.c51
-rw-r--r--sysdeps/guile/uptime.c37
-rw-r--r--sysdeps/linux/.cvsignore28
-rw-r--r--sysdeps/linux/Makefile.am13
-rw-r--r--sysdeps/linux/close.c28
-rw-r--r--sysdeps/linux/cpu.c54
-rw-r--r--sysdeps/linux/init.c40
-rw-r--r--sysdeps/linux/libsysdeps.la19
-rw-r--r--sysdeps/linux/loadavg.c48
-rw-r--r--sysdeps/linux/mem.c53
-rw-r--r--sysdeps/linux/msg_limits.c55
-rw-r--r--sysdeps/linux/open.c61
-rw-r--r--sysdeps/linux/procdata.c178
-rw-r--r--sysdeps/linux/prockernel.c82
-rw-r--r--sysdeps/linux/proclist.c155
-rw-r--r--sysdeps/linux/procmem.c96
-rw-r--r--sysdeps/linux/procsegment.c99
-rw-r--r--sysdeps/linux/procsignal.c78
-rw-r--r--sysdeps/linux/procstate.c88
-rw-r--r--sysdeps/linux/proctime.c79
-rw-r--r--sysdeps/linux/procuid.c122
-rw-r--r--sysdeps/linux/sem_limits.c61
-rw-r--r--sysdeps/linux/shm_limits.c52
-rw-r--r--sysdeps/linux/swap.c49
-rw-r--r--sysdeps/linux/uptime.c47
-rw-r--r--sysdeps/names/.cvsignore24
-rw-r--r--sysdeps/names/Makefile.am16
-rw-r--r--sysdeps/names/cpu.c60
-rw-r--r--sysdeps/names/loadavg.c42
-rw-r--r--sysdeps/names/mem.c57
-rw-r--r--sysdeps/names/msg_limits.c55
-rw-r--r--sysdeps/names/procdata.c53
-rw-r--r--sysdeps/names/prockernel.c76
-rw-r--r--sysdeps/names/proclist.c46
-rw-r--r--sysdeps/names/procmem.c61
-rw-r--r--sysdeps/names/procsegment.c51
-rw-r--r--sysdeps/names/procsignal.c46
-rw-r--r--sysdeps/names/procstate.c46
-rw-r--r--sysdeps/names/proctime.c62
-rw-r--r--sysdeps/names/procuid.c71
-rw-r--r--sysdeps/names/sem_limits.c63
-rw-r--r--sysdeps/names/shm_limits.c51
-rw-r--r--sysdeps/names/swap.c46
-rw-r--r--sysdeps/names/sysdeps.c78
-rw-r--r--sysdeps/names/uptime.c44
-rw-r--r--sysdeps/osf1/.cvsignore21
-rw-r--r--sysdeps/osf1/Makefile.am15
-rw-r--r--sysdeps/osf1/close.c28
-rw-r--r--sysdeps/osf1/cpu.c59
-rw-r--r--sysdeps/osf1/glibtop_machine.h48
-rw-r--r--sysdeps/osf1/init.c40
-rw-r--r--sysdeps/osf1/mem.c59
-rw-r--r--sysdeps/osf1/msg_limits.c77
-rw-r--r--sysdeps/osf1/open.c64
-rw-r--r--sysdeps/osf1/procdata.c148
-rw-r--r--sysdeps/osf1/prockernel.c32
-rw-r--r--sysdeps/osf1/proclist.c155
-rw-r--r--sysdeps/osf1/procmem.c32
-rw-r--r--sysdeps/osf1/procsegment.c32
-rw-r--r--sysdeps/osf1/procsignal.c32
-rw-r--r--sysdeps/osf1/procstate.c32
-rw-r--r--sysdeps/osf1/proctime.c32
-rw-r--r--sysdeps/osf1/procuid.c32
-rw-r--r--sysdeps/osf1/sem_limits.c100
-rw-r--r--sysdeps/osf1/shm_limits.c79
-rw-r--r--sysdeps/osf1/swap.c54
-rw-r--r--sysdeps/stub/.cvsignore27
-rw-r--r--sysdeps/stub/Makefile.am14
-rw-r--r--sysdeps/stub/close.c28
-rw-r--r--sysdeps/stub/cpu.c31
-rw-r--r--sysdeps/stub/init.c40
-rw-r--r--sysdeps/stub/libsysdeps.la19
-rw-r--r--sysdeps/stub/mem.c31
-rw-r--r--sysdeps/stub/msg_limits.c30
-rw-r--r--sysdeps/stub/open.c31
-rw-r--r--sysdeps/stub/prockernel.c32
-rw-r--r--sysdeps/stub/proclist.c39
-rw-r--r--sysdeps/stub/procmem.c32
-rw-r--r--sysdeps/stub/procsegment.c32
-rw-r--r--sysdeps/stub/procsignal.c32
-rw-r--r--sysdeps/stub/procstate.c32
-rw-r--r--sysdeps/stub/proctime.c32
-rw-r--r--sysdeps/stub/procuid.c32
-rw-r--r--sysdeps/stub/sem_limits.c30
-rw-r--r--sysdeps/stub/shm_limits.c30
-rw-r--r--sysdeps/stub/swap.c31
-rw-r--r--sysdeps/sun4/.cvsignore19
-rw-r--r--sysdeps/sun4/Makefile.am14
-rw-r--r--sysdeps/sun4/close.c28
-rw-r--r--sysdeps/sun4/cpu.c31
-rw-r--r--sysdeps/sun4/init.c40
-rw-r--r--sysdeps/sun4/libsysdeps.la19
-rw-r--r--sysdeps/sun4/mem.c31
-rw-r--r--sysdeps/sun4/msg_limits.c30
-rw-r--r--sysdeps/sun4/open.c31
-rw-r--r--sysdeps/sun4/procdata.c31
-rw-r--r--sysdeps/sun4/prockernel.c32
-rw-r--r--sysdeps/sun4/proclist.c39
-rw-r--r--sysdeps/sun4/procmem.c32
-rw-r--r--sysdeps/sun4/procsegment.c32
-rw-r--r--sysdeps/sun4/procsignal.c32
-rw-r--r--sysdeps/sun4/procstate.c32
-rw-r--r--sysdeps/sun4/proctime.c32
-rw-r--r--sysdeps/sun4/procuid.c32
-rw-r--r--sysdeps/sun4/sem_limits.c30
-rw-r--r--sysdeps/sun4/shm_limits.c30
-rw-r--r--sysdeps/sun4/swap.c31
249 files changed, 19386 insertions, 0 deletions
diff --git a/.cvsignore b/.cvsignore
new file mode 100644
index 00000000..de689a21
--- /dev/null
+++ b/.cvsignore
@@ -0,0 +1,24 @@
+Makefile
+Makefile.in
+aclocal.m4
+alpha-dec-osf1
+autoh31167
+config.cache
+config.h
+config.h.in
+config.log
+config.status
+configure
+gtopConf.sh
+i386-bsdi
+i686-pc-linux-gnu
+intl
+libgtop-mirror.sh.swp
+libtool
+ltconfig
+stamp-h
+sun4
+sun4sol2
+ltmain.sh
+macros
+support
diff --git a/ANNOUNCE b/ANNOUNCE
new file mode 100644
index 00000000..2a54966d
--- /dev/null
+++ b/ANNOUNCE
@@ -0,0 +1,95 @@
+Hi all,
+
+I just uploaded the first working draft alpha version 0.01 to my website:
+
+ http://www.home-of-linux.org/gnome/libgtop/
+
+Libgtop is a library that fetches information about the running system such as cpu and
+memory usage, active processes etc. On Linux systems, these information are taken directly
+from the /proc filesystem. For other systems such as Solaris, where such programs need to be
+suid root (or only setgid kmem/mem on some systems), it provides a suid/setgid server that
+fetches those information and a client-side library that talks to this server. Main idea
+was to have the same interface for all operating systems, thus all system dependent details
+are hidden in the implementation of that server.
+
+Currently, it only works for Linux, documentation on how to port it to other systems is on
+the way. I'm planning to keep this site an up-to-date mirror of my local machine (which is
+connected to the internet over some expensive dialup connection, so I'll upload it about
+once every day I made significant changes) so that you can always find the latest version
+of the software here.
+
+I've written a simple guile interface for the library to show which information it can
+already fetch. See examples/third for details.
+
+===========================================================================================
+
+#include <glibtop.h>
+#include <glibtop/open.h>
+#include <glibtop/close.h>
+
+#include <glibtop/cpu.h>
+
+int
+main (int argc, char *argv [])
+{
+ glibtop server;
+ glibtop_cpu cpu;
+ unsigned i, *ptr;
+
+ setlocale (LC_ALL, "");
+ bindtextdomain (PACKAGE, GTOPLOCALEDIR);
+ textdomain (PACKAGE);
+
+ glibtop_open (&server, argv [0]);
+
+ glibtop_get_cpu (&server, &cpu);
+
+ fprintf (stderr, "CPU: %lu, %lu, %lu, %lu, %lu\n",
+ cpu.total, cpu.user, cpu.nice, cpu.sys, cpu.idle);
+
+ glibtop_close (&server);
+
+ exit (0);
+}
+
+===========================================================================================
+
+The following scheme code is used in examples/third to show all information that is
+currently available:
+
+ (display (get-cpu)) (newline)
+ (display (get-mem)) (newline)
+ (display (get-swap)) (newline)
+ (display (get-uptime)) (newline)
+ (display (get-loadavg)) (newline)
+ (display (get-shm_limits)) (newline)
+ (display (get-msg_limits)) (newline)
+ (display (get-sem_limits)) (newline)
+ (display (get-sysdeps)) (newline)
+ (display (get-proclist)) (newline)
+
+On my system, this yields:
+
+(3796245 348706 66 89999 3357474)
+(31715328 31354880 360448 13385728 401408 7237632 17567744)
+(133885952 42160128 91725824)
+(37962.49 33574.74)
+(0.01 0.02 0.0)
+(33554432 1 128 128 4194304)
+(2048 16384 4056 16384 128 16 16384)
+(4096 128 4096 4096 32 32 32 20 32767 16383)
+(31 127 7 3 1 31 127 1023 3)
+(71 4 284 1 2 3 246 247 210 8 48 81 83 153 157 167 170 171 172 173 174 175 178 181 195 191 200 203 207 248 215 216 217 220 222 227 245 249 250 251 253 254 315 267 331 373 338 334 335 345 337 372 374 342 343 344 375 14445 13119 6438 14555 13118 13801 6439 17362 18411 18455 6521 6522 6523 23979 23980 7905 7906)
+
+===========================================================================================
+
+Better documentation is on the way! There's still a little bit under the URL above.
+
+Enjoy it!
+
+Martin <martin@home-of-linux.org>
+
+
+
+
+
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 00000000..702002a3
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1 @@
+Martin Baulig (martin@home-of-linux.org)
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 00000000..83fedd85
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,393 @@
+1998-05-17 Martin Baulig <martin@home-of-linux.org>
+
+ * NEWS: added some stuff from 'README.LATEST'.
+
+ * README.LATEST: incorporated content of this file
+ into 'NEWS'.
+
+ * include/glibtop: added references to
+ 'glibtop_types_* []' and 'glibtop_guile_types_*'.
+
+ * sysdeps/guile/names: added implementations of
+ 'glibtop_types_*' and 'glibtop_description_*'.
+
+ * sysdeps/names: added 'glibtop_types_* []',
+ changed 'glibtop_descriptions_* []'.
+
+1998-05-11 Martin Baulig <martin@home-of-linux.org>
+
+ * sysdeps/linux: finished the remaining proc_*
+ functions.
+
+ * sysdeps/guile: all guile functions now return
+ the 'flags' member as first element of the list.
+
+ * include/glibtop/procstate.h (glibtop_proc_state):
+ added 'uid' and 'gid' members; the library tries hard
+ to set those values; it will never set the corresponding
+ 'flags' value unless the values are correct.
+
+ * examples/first.c: added some nice features.
+
+ * examples/second.c: new file - dumps out all
+ currently running processes.
+
+1998-05-11 Martin Baulig <baulig@merkur.uni-trier.de>
+
+ * sysdeps/linux/cpu.c: added 'frequency' member
+ to 'struct _glibtop_cpu'.
+
+ * include/glibtop/cpu.h (glibtop_cpu):
+ added 'frequency' member
+
+ * sysdeps/guile/names/procdata.c: splitted into
+ procstate.c, procuid.c, procmem.c, proctime.c,
+ procsignal.c, prockernel.c and procsegment.c
+
+ * sysdeps/guile/procdata.c: splitted into
+ procstate.c, procuid.c, procmem.c, proctime.c,
+ procsignal.c, prockernel.c and procsegment.c
+
+ * lib/procdata.c: splitted into
+ procstate.c, procuid.c, procmem.c, proctime.c,
+ procsignal.c, prockernel.c and procsegment.c
+
+ * include/glibtop/procdata.h: splitted into
+ procstate.h, procuid.h, procmem.h, proctime.h,
+ procsignal.h, prockernel.h and procsegment.h
+
+1998-05-10 Martin Baulig <martin@home-of-linux.org>
+
+ * sysdeps/osf1: port to OSF1 has been made.
+
+1998-05-07 Martin Baulig <martin@home-of-linux.org>
+
+ * sysdeps/guile/sysdeps.c: changes to reflect the
+ new flags of procdata.
+
+ * sysdeps/common/sysdeps.c: changes to reflect the
+ new flags of procdata.
+
+ * sysdeps/linux/procdata.c: 'flags' member is now
+ 'unsigned long flags [2]'. When we give
+ glibtop_get_procdata () a pid of zero, only
+ the flags are returned.
+
+ * sysdeps/linux: now using static constant instead
+ of #define for sysdeps.
+
+ * include/glibtop/procdata.h: flags is now
+ 'unsigned long flags [2]'.
+
+ * examples/first.c: output sysdeps
+
+1998-05-03 Martin Baulig <martin@home-of-linux.org>
+
+ * ltconfig.diff: ugly hack: when cross compiling, we assume
+ building shared libraries work.
+
+1998-05-02 Martin Baulig <martin@home-of-linux.org>
+
+ * sysdeps/stub/init.c: new file - initializes global server.
+
+ * sysdeps/linux/init.c: new file - initializes global server.
+
+ * lib/init.c: new file - initializes global server.
+
+ * glibtop.h: global changes to the interfaces, all functions except
+ glibtop_open() and glibtop_close() that took a server argument have
+ now a '__r' suffix; the original name is now a macro that uses
+ glibtop_global_server.
+
+1998-04-12 Martin Baulig <martin@home-of-linux.org>
+
+ * sysdeps/linux/open.c: we set server->os_version_code here,
+ copied from gnome-utils/gtop/proc/version.c
+
+ * sysdeps/linux/procdata.c: added implementation for this feature,
+ mainly copied from gnome-utils/gtop/proc/readproc.c
+
+ * glibtop.h: added os_version_code member to struct _glibtop
+
+ * src/server/Makefile.am: moved here from src
+
+ * src/server/version.c: moved here from src
+
+ * src/server/output.c: moved here from src
+
+ * src/server/main.c: moved here from src
+
+ * src/mico/server.cc: new file - simple mico client
+
+ * src/mico/client.cc: new file - simple mico client
+
+ * src/mico/proclist.idl: new file - simple mico interface
+
+ * src/version.c: moved to src/server
+
+ * src/output.c: moved to src/server
+
+ * src/main.c: moved to src/server
+
+1998-04-11 Martin Baulig <martin@home-of-linux.org>
+
+ * doc/libgtop.sgml: added chapter on how to extend the library
+
+ * sysdeps/names/procdata.c: new file - names for glibtop_procdata
+
+ * sysdeps/linux/procdata.c: new file - copy from sysdeps/stub
+
+ * sysdeps/stub/procdata.c: new file - stub for glibtop_procdata
+
+ * sysdeps/guile/names/procdata.c: new file - guile names for glibtop_procdata
+
+ * sysdeps/guile/procdata.c: new file - guile interface for glibtop_procdata
+
+ * lib/procdata.c: new file - library function for glibtop_procdata
+
+ * include/glibtop/procdata.h: new file - interface for glibtop_procdata -
+ get detailed information about a process
+
+1998-04-10 Martin Baulig <martin@home-of-linux.org>
+
+ * doc/libgtop.sgml: wrote some more documentation
+
+ * NEWS: Added new directory sysdeps/guile/names. It is the guile interface
+ to the gtop_names library found in sysdeps/names. Changed
+ GLIBTOP_DESCRIPTIONS to GLIBTOP_NAMES and added GLIBTOP_GUILE_NAMES
+ to the header files.
+
+ * sysdeps/guile/names/boot.c: new file - added also
+ cpu.c, mem.c, swap.c, uptime.c, loadavg.c, shm_limits.c,
+ msg_limits.c, sem_limits.c, proclist.c and sysdeps.c
+ to this directory.
+
+ * sysdeps/guile/cpu.c: bugfixes
+
+ * sysdeps/guile/proclist.c: bugfixes
+
+ * sysdeps/names/sysdeps.c (glibtop_labels_sysdeps): more verbose now
+
+ * examples/third.c: added gtop_guile_names library
+
+ * doc/libgtop.sgml: documented guile interface
+
+ * glibtop.h: changed GLIBTOP_DESCRIPTIONS to GLIBTOP_NAMES;
+ added GLIBTOP_GUILE_NAMES when we have the gtop_guile_names
+ library added in sysdeps/guile/names
+
+1998-04-09 Martin Baulig <martin@home-of-linux.org>
+
+ * NEWS: Added new directories guile and names to sysdeps. In names are
+ some string constants about the data stored in the structures.
+ guile is a guile interface for the library. It is used in
+ examples /third (which has been completely rewritten).
+ The header files define things from names when GLIBTOP_DESCRIPTIONS
+ if defined and/or from guile when HAVE_GUILE is defined.
+
+ * sysdeps/names/cpu.c: new file, also added
+ cpu.c, mem.c, swap.c, uptime.c loadavg.c, shm_limits.c,
+ msg_limits.c, sem_limits.c, proclist.c and sysdeps.c to
+ this directory
+
+ * sysdeps/guile/boot.c: new file, also added
+ cpu.c, mem.c, swap.c, uptime.c loadavg.c, shm_limits.c,
+ msg_limits.c, sem_limits.c, proclist.c and sysdeps.c to
+ this directory
+
+ * sysdeps/common/sem_limits.c: moved to sysdeps/names
+
+ * sysdeps/common/msg_limits.c: moved to sysdeps/names
+
+ * sysdeps/common/sem_limits.c: moved to sysdeps/names
+
+ * examples/third.c: completely rewritten - simple guile interpreter linked
+ with libgtop_guile
+
+ * examples/second.c: removed
+
+1998-04-08 Martin Baulig <martin@home-of-linux.org>
+
+ * ANNOUNCE: new file
+
+ * examples/third.scm: new file - sample guile file
+
+ * examples/third.c: new file - guile wrapper for libgtop
+
+ * examples/second.c: new file - simple guile test from guile-tut.info
+
+ * README: new file
+
+ * libgtop-mirror.sh: new file: mirror script for my web site
+
+ * doc/dbtohtml.dsl: renamed to libgtop.dsl
+
+1998-04-06 Martin Baulig <martin@home-of-linux.org>
+
+ * lib/command.c: some changes in the interface
+
+ * src/main.c: some changes in the interface, we can now return
+ some arbitrary data
+
+ * lib/proclist.c: new file - library function for glibtop_proclist
+
+ * sysdeps/linux/proclist.c: new file - implementation for glibtop_proclist
+
+ * sysdeps/stub/proclist.c: new file - stub for glibtop_proclist
+
+ * include/glibtop/proclist.h: new file - glibtop_proclist
+
+ * include/glibtop/union.h: new file
+
+ * lib/read_data.c: new file
+
+ * include/glibtop/read_data.h: new file
+
+ * sysdeps/common/xmalloc.c: new file - moved here from lib
+
+ * sysdeps/common/error.c: new file - moved here from lib
+
+ * lib/xmalloc.c: moved to sysdeps/common
+
+ * lib/error.c: moved to sysdeps/common
+
+1998-04-05 Martin Baulig <martin@home-of-linux.org>
+
+ * lib/shm_limits.c: new file - library function for
+ glibtop_shm_limits
+
+ * lib/msg_limits.c: new file - library function for
+ glibtop_msg_limits
+
+ * lib/sem_limits.c: new file - library function for
+ glibtop_sem_limits
+
+ * sysdeps/linux/shm_limits.c: new file - implementation for
+ glibtop_shm_limits
+
+ * sysdeps/linux/msg_limits.c: new file - implementation for
+ glibtop_msg_limits
+
+ * sysdeps/linux/sem_limits.c: new file - implementation for
+ glibtop_sem_limits
+
+ * sysdeps/stub/shm_limits.c: new file - stub for
+ glibtop_shm_limits
+
+ * sysdeps/stub/msg_limits.c: new file - stub for
+ glibtop_msg_limits
+
+ * sysdeps/stub/sem_limits.c: new file - stub for
+ glibtop_sem_limits
+
+ * sysdeps/common/shm_limits.c: new file - limit names
+
+ * sysdeps/common/msg_limits.c: new file - limit names
+
+ * sysdeps/common/sem_limits.c: new file - limit names
+
+ * include/glibtop/shm_limits.h: new file - glibtop_shm_limits
+
+ * include/glibtop/msg_limits.h: new file - glibtop_msg_limits
+
+ * include/glibtop/sem_limits.h: new file - glibtop_sem_limits
+
+ * sysdeps/common/sysdeps.c: moved here from sysdeps/stub
+
+ * sysdeps/linux/sysdeps.c: moved to sysdeps/common
+
+ * sysdeps/stub/sysdeps.c: moved to sysdeps/common
+
+ * sysdeps/stub/ipc_limits.c: splitted info shm_limits.c, msg_limits.c
+ and sem_limits.c
+
+ * sysdeps/linux/ipc_limits.c: splitted into shm_limits.c, msg_limits.c
+ and sem_limits.c
+
+ * lib/ipc_limits.c: splitted into shm_limits.c, msg_limits.c
+ and sem_limits.c
+
+ * include/ipc_limits.h: splitted into shm_limits.h, msg_limits.h
+ and sem_limits.s
+
+ * lib/ipc_limits.c: new file - library function for
+ glibtop_ipc_limits
+
+ * sysdeps/linux/ipc_limits.c: new file - implementation for
+ glibtop_ipc_limits
+
+ * sysdeps/stub/ipc_limits.c: new file - stub for
+ glibtop_ipc_limits
+
+ * include/glibtop/ipc_limits.h: new file - glibtop_ipc_limits -
+ sysv ipc limits
+
+ * doc/libgtop.sgml: worked on documentation
+
+ * lib/uptime.c: new file - library function for
+ glibtop_uptime
+
+ * lib/loadavg.c: new file - library function for
+ glibtop_loadavg
+
+ * lib/sysinfo.c: removed - splitted into
+ uptime.c and loadavg.c
+
+ * sysdeps/linux/uptime.c: new file - implementation for
+ glibtop_uptime
+
+ * sysdeps/linux/loadavg.c: new file - implementation for
+ glibtop_loadavg
+
+ * sysdeps/linux/sysinfo.c: removed - splitted into
+ uptime.c and loadavg.c
+
+ * sysdeps/stub/uptime.c: new file - stub for
+ glibtop_uptime
+
+ * sysdeps/stub/loadavg.c: new file - stub for
+ glibtop_loadavg
+
+ * sysdeps/stub/sysinfo.c: removed - splitted into
+ uptime.c and loadavg.c
+
+ * src/main.c: added GLIBTOP_CMND_UPTIME and
+ GLIBTOP_CMND_LOADAVG implementation
+
+ * include/glibtop/loadavg.h: new file - glibtop_loadavg
+
+ * include/glibtop/uptime.h: new file - glibtop_uptime
+
+ * include/glibtop/loadavg.h: removed - splitted into
+ uptime.h and loadavg.h
+
+ * src/main.c: added GLIBTOP_CMND_SYSDEPS implementation
+
+ * lib/sysdeps.c: new file - library function for glibtop_sysdeps
+
+ * sysdeps/linux/sysdeps.c: new file - copied from sysdeps/stub
+
+ * sysdeps/stub/sysdeps.c: new file - implementation for glibtop_sysinfo -
+ this is really the implementation and not just a stub
+
+ * src/sysdeps.c: moved to sysdeps/stub - this file is now part
+ of the library
+
+ * lib/sysinfo.c: new file - library function for glibtop_sysinfo
+
+ * sysdeps/linux/sysinfo.c: new file - linux version for glibtop_sysinfo
+
+ * sysdeps/stub/sysinfo.c: new file - stub for glibtop_sysinfo
+
+ * include/glibtop/sysinfo.h: new file - provides uptime, idle time
+ and load averange.
+
+ * po/libgtop.pot: removed file
+
+ * sysdeps/linux/cpu.c: using long unsigned format
+ * sysdeps/linux/mem.c: using long usigned format
+ * sysdeps/linux/swap.c: using long unsigned format
+ * examples/first.c: using long unsigned format
+
+ * initial version.
+
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 00000000..cfc36ad3
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,41 @@
+## Process this file with automake to produce Makefile.in.
+
+built_SUBDIRS = sysdeps src lib examples
+
+SUBDIRS = po intl support macros $(built_SUBDIRS)
+
+include_HEADERS =
+
+EXTRA_DIST = gtopConf.sh.in
+
+release:
+ $(MAKE) dist distdir=$(PACKAGE)$(VERSION)
+
+## Put `exec' in the name because this should be installed by
+## `install-exec', not `install-data'.
+confexecdir=$(libdir)
+confexec_DATA = $(top_builddir)/gtopConf.sh
+
+## to automatically rebuild aclocal.m4 if any of the macros in
+## `macros/' change
+@MAINT@include macros/macros.dep
+@MAINT@macros/macros.dep: macros/Makefile.am
+@MAINT@ cd macros && $(MAKE) macros.dep
+
+## We create gtopConf.sh here and not from configure because we want
+## to get the paths expanded correctly. Macros like srcdir are given
+## the value NONE in configure if the user doesn't specify them (this
+## is an autoconf feature, not a bug).
+gtopConf.sh: gtopConf.sh.in Makefile
+## Use sed and then mv to avoid problems if the user interrupts.
+ sed -e 's,\@GTOP_LIBDIR\@,$(libdir),g' \
+ -e 's,\@GTOP_INCLUDEDIR\@,$(includedir),g' \
+ -e 's,\@GTOP_LIBS\@,$(GTOP_LIBS),g' \
+ -e 's,\@GTOP_INCS\@,$(GTOP_INCS),g' \
+ -e 's,\@GTOP_BINDIR\@,$(GTOP_BINDIR),g' \
+ -e 's,\@GTOP_SERVER\@,$(GTOP_SERVER),g' \
+ -e 's,\@GTOP_SYSDEPS_DIR\@,$(sysdeps_dir),g' \
+ -e 's,\@GTOP_NEED_SERVER\@,$(need_server),g' \
+ -e 's,\@GTOP_USE_MACHINE_H\@,$(use_glibtop_machine_h),g' \
+ < $(srcdir)/gtopConf.sh.in > gtopConf.tmp \
+ && mv gtopConf.tmp gtopConf.sh
diff --git a/NEWS b/NEWS
new file mode 100644
index 00000000..1a067145
--- /dev/null
+++ b/NEWS
@@ -0,0 +1,96 @@
+$Id$
+
+May/17/1998
+===========
+
+* we have now 'const char *glibtop_types_* []' consisting
+ of the C types of the corresponding files of '_glibtop_*'.
+
+* added guile function '(glibtop-types-*)' and '(glibtop-descriptions-*)'.
+
+May/10/1998
+===========
+
+* Port to DEC OSF1 3.0 has been made:
+
+ cpu (total, user, nice, sys, idle)
+ mem (total, used, free)
+
+ loadavg (loadavg)
+ uptime (uptime)
+
+ msg_limits (map, max, mnb, mni, tql)
+ sem_limits (mni, msl, opm, vmx, aem)
+ shm_limits (max, min, mni, seg)
+
+ The following need the server to be SUID root:
+
+ proclist (total, number, size)
+ procdata (cmd, state, uid, pid, ppid, pgrp, tty, k_flags,
+ session, tpgid, sigignore, sigcatch, signal, nice,
+ priority, resident, rss, vsize, utime, stime,
+ cutime, cstime, trs, drs)
+
+May/07/1998
+===========
+
+* 'flags' member of sysdeps/linux/procdata.c is now
+ 'unsigned long flags [2]'.
+
+* When we give glibtop_get_procdata () a pid of zero, only
+ the flags are returned.
+
+* We now use static constants instead of #defines for sysdeps flags.
+
+May/03/1998
+===========
+
+* VPATH-Build now working; sometimes it's necessary to copy
+ $(top_srcdir)/po/cat-id-tbl.c to $(top_builddir)/po.
+
+* The library has been tested on the following systems:
+
+ - i686-pc-linux-gnu
+ - sparc-sun-sunos4.1.1
+ - alpha-dec-osf1 (that's DEC OSF1 3.0 and 3.2)
+
+* Compilation has been tested on the following systems (I have no root
+ access there and cannot test the library because of this):
+
+ - sparc-sun-solaris2
+ - i386-bsdi
+
+* Does no longer require Gnome.
+
+* Guile-Parts are compiled only if guile can be found.
+
+* Some of the executables are statically linked to copy them more easily
+ between machines.
+
+May/02/1998
+===========
+
+ * Global changes to the interfaces, all functions except glibtop_open()
+ and glibtop_close() that took a server argument have now a '__r' suffix;
+ the original name is now a macro that uses glibtop_global_server.
+
+Apr/10/1998
+===========
+Added new directory sysdeps/guile/names. It is the guile interface
+to the gtop_names library found in sysdeps/names. Changed
+GLIBTOP_DESCRIPTIONS to GLIBTOP_NAMES and added GLIBTOP_GUILE_NAMES
+to the header files.
+
+Apr/09/1998
+===========
+Added new directories guile and names to sysdeps. In names are
+some string constants about the data stored in the structures.
+guile is a guile interface for the library. It is used in
+examples/third (which has been completely rewritten).
+The header files define things from names when GLIBTOP_DESCRIPTIONS
+if defined and/or from guile when HAVE_GUILE is defined.
+
+Apr/08/1998
+===========
+
+Added guile wrapper for the library (see examples/third).
diff --git a/README b/README
new file mode 100644
index 00000000..5cfe7a3a
--- /dev/null
+++ b/README
@@ -0,0 +1,57 @@
+Hi all,
+
+[PLEASE READ THE FILE ``README.LATEST'' FOR LATEST NEWS]
+
+this is the latest alpha version of libgtop, a library that fetches
+information about the running system such as cpu and memory usage,
+active processes etc. On Linux systems, these information are taken
+directly from the /proc filesystem. For other systems such as Solaris,
+where such programs need to be suid root (or only setgid kmem/mem on
+some systems), it provides a suid/setgid server that fetches those
+information and a client-side library that talks to this server.
+
+Main idea was to have the same interface for all operating systems,
+thus all system dependent details are hidden in the implementation
+of that server.
+
+Currently, it only works for Linux, documentation on how to port it
+to other systems is on the way. I'm planning to keep this site an
+up-to-date mirror of my local machine (which is connected to the
+internet over some expensive dialup connection, so I'll upload it about
+once every day I made significant changes) so that you can always find
+the latest version of the software here.
+
+I've written a simple guile interface for the library to show which
+information it can already fetch. See examples/third for details.
+
+Source Code:
+===========
+
+ libgtop-current-cvs.cpio.gz is a cpio archive from the CVS repository
+ libgtop-current.cpio.gz contains the lates checked out sources
+ libgtop-stable.cpio.gz if present, it contains the last stable release
+
+Documentation:
+=============
+
+ libgtop.sgml is the SGML source of the (DocBook) documentation
+
+The next three files are only provided until they get too big to upload.
+
+ libgtop.tex TEX file of the documentation
+ libgtop.dvi DVI file of the documentation
+ libgtop.ps Postscript file of the documentation
+
+HTML-Documentation:
+==================
+
+ libgtop.shtml Start here to browse the HTML documentation
+
+Other stuff:
+===========
+
+ README, NEWS, ChangeLog copied from the sources
+
+Enjoy it!
+
+Martin (martin@home-of-linux.org - baulig@merkur.uni-trier.de)
diff --git a/README.LATEST b/README.LATEST
new file mode 100644
index 00000000..20129586
--- /dev/null
+++ b/README.LATEST
@@ -0,0 +1,8 @@
+$Id$
+
+LATEST NEWS:
+===========
+
+Please look also in the file 'NEWS' for latest news.
+
+Martin
diff --git a/acconfig.h b/acconfig.h
new file mode 100644
index 00000000..16425574
--- /dev/null
+++ b/acconfig.h
@@ -0,0 +1,30 @@
+#undef ENABLE_NLS
+#undef HAVE_CATGETS
+#undef HAVE_GETTEXT
+#undef HAVE_LC_MESSAGES
+#undef HAVE_STPCPY
+#undef HAVE_STRUCT_OSOCKADDR
+#undef PACKAGE
+#undef VERSION
+#undef HAVE_LIBSM
+#undef HAVE_LIBINTL_H
+#undef HAVE_GTK_SIGNAL_HANDLER_PENDING
+
+/* Do not remove this comments and the empty lines; they are needed */
+#undef HAVE_PROGRAM_INVOCATION_SHORT_NAME
+
+/* to fix a bug in autoheader on DEC OSF1. */
+#undef HAVE_PROGRAM_INVOCATION_NAME
+
+#undef HAVE_LIBJPEG
+#undef HAVE_LIBGIF
+#undef HAVE_LIBTIFF
+#undef HAVE_LIBZ
+#undef HAVE_LIBPNG
+#undef GNOME_ENABLE_DEBUG
+#undef HAVE_GMP2_INCLUDE_DIR
+#undef HAVE_GUILE
+#undef ssize_t
+
+#undef HAVE_GLIBTOP_MACHINE_H
+
diff --git a/acinclude.m4 b/acinclude.m4
new file mode 100644
index 00000000..d9148c37
--- /dev/null
+++ b/acinclude.m4
@@ -0,0 +1,960 @@
+dnl aclocal.m4 generated automatically by aclocal 1.2h
+
+dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+dnl This Makefile.in is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+dnl PARTICULAR PURPOSE.
+
+AC_DEFUN([AC_LC_CANONICAL_HOST],[
+ AC_REQUIRE([AC_CANONICAL_HOST])
+ # The way shlib-versions is used to generate soversions.mk uses a
+ # fairly simplistic model for name recognition that can't distinguish
+ # i486-pc-linux-gnu fully from i486-pc-gnu. So we mutate a $host_os
+ # of `gnu*' here to be `gnu-gnu*' just so that shlib-versions can
+ # tell. This doesn't get used much beyond that, so it's fairly safe.
+ case "$host_os" in
+ linux*)
+ ;;
+ gnu*)
+ host_os=`echo $host_os | sed -e 's/gnu/gnu-gnu/'`
+ ;;
+ esac
+])
+
+
+AC_DEFUN([AC_LC_SYSDEPS],[
+ AC_REQUIRE([AC_LC_CANONICAL_HOST])
+ AC_MSG_CHECKING(for sysdeps directory)
+ AC_ARG_WITH(sysdeps,
+ [ --with-sysdeps=dir which sysdeps directory should be used [default=auto]],
+ [if test "x$withval" = "xyes" ; then
+ ac_cv_sysdeps_dir=yes
+ elif test "x$withval" = "xauto" ; then
+ ac_cv_sysdeps_dir=yes
+ else
+ ac_cv_sysdeps_dir=$withval
+ fi],[ac_cv_sysdeps_dir=yes])
+ if test "x$ac_cv_sysdeps_dir" = "xyes" ; then
+ case "$host_os" in
+ linux*)
+ sysdeps_dir=linux
+ use_glibtop_machine_h=no
+ need_server=no
+ ;;
+ sunos4*)
+ sysdeps_dir=sun4
+ use_glibtop_machine_h=no
+ need_server=yes
+ ;;
+ osf*)
+ sysdeps_dir=osf1
+ use_glibtop_machine_h=yes
+ AC_DEFINE(HAVE_GLIBTOP_MACHINE_H)
+ need_server=yes
+ ;;
+ *)
+ sysdeps_dir=stub
+ use_glibtop_machine_h=no
+ need_server=no
+ ;;
+ esac
+ elif test "x$ac_cv_sysdeps_dir" = "xno" ; then
+ sysdeps_dir=stub
+ else
+ sysdeps_dir=stub
+ fi
+ test -d $srcdir/sysdeps/$sysdeps_dir || sysdeps_dir=stub
+ AC_MSG_RESULT($sysdeps_dir)
+ AC_SUBST(sysdeps_dir)
+ AC_SUBST(need_server)
+])
+
+
+# Like AC_CONFIG_HEADER, but automatically create stamp file.
+
+AC_DEFUN(AM_CONFIG_HEADER,
+[AC_PREREQ([2.12])
+AC_CONFIG_HEADER([$1])
+dnl When config.status generates a header, we must update the stamp-h file.
+dnl This file resides in the same directory as the config header
+dnl that is generated. We must strip everything past the first ":",
+dnl and everything past the last "/".
+AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
+ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
+<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
+<<am_indx=1
+for am_file in <<$1>>; do
+ case " <<$>>CONFIG_HEADERS " in
+ *" <<$>>am_file "*<<)>>
+ echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
+ ;;
+ esac
+ am_indx=`expr "<<$>>am_indx" + 1`
+done<<>>dnl>>)
+changequote([,]))])
+
+# Do all the work for Automake. This macro actually does too much --
+# some checks are only needed if your package does certain things.
+# But this isn't really a big deal.
+
+# serial 1
+
+dnl Usage:
+dnl AM_INIT_AUTOMAKE(package,version, [no-define])
+
+AC_DEFUN(AM_INIT_AUTOMAKE,
+[AC_REQUIRE([AM_PROG_INSTALL])
+PACKAGE=[$1]
+AC_SUBST(PACKAGE)
+VERSION=[$2]
+AC_SUBST(VERSION)
+dnl test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
+ AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+fi
+ifelse([$3],,
+AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
+AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
+AC_REQUIRE([AM_SANITY_CHECK])
+AC_REQUIRE([AC_ARG_PROGRAM])
+dnl FIXME This is truly gross.
+missing_dir=`cd $ac_aux_dir && pwd`
+AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
+AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
+AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
+AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
+AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
+AC_REQUIRE([AC_PROG_MAKE_SET])])
+
+
+# serial 1
+
+AC_DEFUN(AM_PROG_INSTALL,
+[AC_REQUIRE([AC_PROG_INSTALL])
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+AC_SUBST(INSTALL_SCRIPT)dnl
+])
+
+#
+# Check to make sure that the build environment is sane.
+#
+
+AC_DEFUN(AM_SANITY_CHECK,
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftestfile
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
+ if test "[$]*" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftestfile`
+ fi
+ if test "[$]*" != "X $srcdir/configure conftestfile" \
+ && test "[$]*" != "X conftestfile $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+alias in your environment])
+ fi
+
+ test "[$]2" = conftestfile
+ )
+then
+ # Ok.
+ :
+else
+ AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+rm -f conftest*
+AC_MSG_RESULT(yes)])
+
+dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
+dnl The program must properly implement --version.
+AC_DEFUN(AM_MISSING_PROG,
+[AC_MSG_CHECKING(for working $2)
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if ($2 --version) < /dev/null > /dev/null 2>&1; then
+ $1=$2
+ AC_MSG_RESULT(found)
+else
+ $1="$3/missing $2"
+ AC_MSG_RESULT(missing)
+fi
+AC_SUBST($1)])
+
+# Add --enable-maintainer-mode option to configure.
+# From Jim Meyering
+
+# serial 1
+
+AC_DEFUN(AM_MAINTAINER_MODE,
+[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
+ dnl maintainer-mode is disabled by default
+ AC_ARG_ENABLE(maintainer-mode,
+[ --enable-maintainer-mode enable make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer],
+ USE_MAINTAINER_MODE=$enableval,
+ USE_MAINTAINER_MODE=no)
+ AC_MSG_RESULT($USE_MAINTAINER_MODE)
+ if test $USE_MAINTAINER_MODE = yes; then
+ MAINT=
+ else
+ MAINT='#M#'
+ fi
+ AC_SUBST(MAINT)dnl
+]
+)
+
+# aclocal-include.m4
+#
+# This macro adds the name macrodir to the set of directories
+# that `aclocal' searches for macros.
+
+# serial 1
+
+dnl AM_ACLOCAL_INCLUDE(macrodir)
+AC_DEFUN([AM_ACLOCAL_INCLUDE],
+[ACLOCAL="$ACLOCAL -I $1"])
+
+dnl
+dnl GNOME_CHECK_GUILE (failflag)
+dnl
+dnl if failflag is "fail" then GNOME_CHECK_GUILE will abort if guile is not found.
+dnl
+
+AC_DEFUN([GNOME_CHECK_GUILE],
+[
+ saved_ldflags="$LDFLAGS"
+ saved_cppflags="$CPPFLAGS"
+ LDFLAGS="$LDFLAGS $GNOME_LIBDIR"
+
+ AC_CHECK_LIB(qthreads,main,[
+ QTTHREADS_LIB="-lqthreads"
+ ],[
+ AC_CHECK_LIB(qt, qt_null, QTTHREADS_LIB="-lqt")
+ ],$LIBS)
+ AC_SUBST(QTTHREADS_LIB)
+
+ AC_CHECK_LIB(termcap,main,TERMCAP_LIB="-ltermcap")
+ AC_CHECK_LIB(readline,main,READLINE_LIB="-lreadline",,$TERMCAP_LIB)
+
+ AC_SUBST(TERMCAP_LIB)
+ AC_SUBST(READLINE_LIB)
+
+ AC_CHECK_PROG(BUILD_GUILE, build-guile, yes, no)
+
+ if test "x$BUILD_GUILE" = "xyes"; then
+ AC_MSG_CHECKING(whether build-guile works)
+ if test x`build-guile --version >/dev/null 2>&1 || \
+ echo no` = xno; then
+ BUILD_GUILE=no
+ fi
+ AC_MSG_RESULT($BUILD_GUILE)
+ fi
+
+ AC_CHECK_LIB(m, sin)
+
+ if test "x$BUILD_GUILE" = "xyes"; then
+ AC_MSG_CHECKING(for guile libraries)
+ GUILE_LIBS="-L`build-guile info libdir` `build-guile link`"
+ AC_MSG_RESULT($GUILE_LIBS)
+ AC_MSG_CHECKING(for guile headers)
+ GUILE_INCS="-I`build-guile info includedir`"
+ AC_MSG_RESULT($GUILE_INCS)
+ else
+ GUILE_LIBS="$GNOME_LIBDIR"
+ GUILE_INCS="$GNOME_INCLUDEDIR"
+ AC_CHECK_LIB(rx, main, GUILE_LIBS="-lrx $GUILE_LIBS")
+ AC_CHECK_LIB(qt, main, GUILE_LIBS="-lqt $GUILE_LIBS")
+ AC_CHECK_LIB(dl, dlopen, GUILE_LIBS="-ldl $GUILE_LIBS")
+ GUILE_LIBS="-lguile $GUILE_LIBS $QTTHREADS_LIB $TERMCAP_LIB $READLINE_LIB"
+ fi
+
+ AC_SUBST(GUILE_LIBS)
+ AC_SUBST(GUILE_INCS)
+
+ LDFLAGS="$saved_ldflags $GUILE_LIBS"
+ CPPFLAGS="$saved_cppflags $GUILE_INCS"
+
+ AC_MSG_CHECKING(whether guile works)
+ AC_TRY_LINK([
+ #include <libguile.h>
+ #include <guile/gh.h>
+ ],[
+ gh_eval_str("(newline)");
+ scm_boot_guile(0,NULL,NULL,NULL);
+ ],[
+ ac_cv_guile_found=yes
+ AC_DEFINE(HAVE_GUILE)
+ ],[
+ ac_cv_guile_found=no
+ ])
+ AC_MSG_RESULT($ac_cv_guile_found)
+
+ if test x$ac_cv_guile_found = xno ; then
+ if test x$1 = xfail ; then
+ AC_MSG_ERROR(Can not find Guile 1.2 on this system)
+ else
+ AC_MSG_WARN(Can not find Guile 1.2 on this system)
+ fi
+ ac_cv_guile_found=no
+ fi
+
+ LDFLAGS="$saved_ldflags"
+ CPPFLAGS="$saved_cppflags"
+
+ AC_SUBST(GUILE_LIBS)
+ AM_CONDITIONAL(GUILE, test x$ac_cv_guile_found = xyes)
+])
+
+# Define a conditional.
+
+AC_DEFUN(AM_CONDITIONAL,
+[AC_SUBST($1_TRUE)
+AC_SUBST($1_FALSE)
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi])
+
+
+dnl AM_PROG_LEX
+dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT
+AC_DEFUN(AM_PROG_LEX,
+[AC_CHECK_PROGS(LEX, flex lex, "$1/missing flex")
+AC_PROG_LEX
+AC_DECL_YYTEXT])
+
+
+# serial 18 AM_PROG_LIBTOOL
+AC_DEFUN(AM_PROG_LIBTOOL,
+[AC_REQUIRE([AC_CANONICAL_HOST])
+AC_REQUIRE([AC_PROG_RANLIB])
+AC_REQUIRE([AC_PROG_CC])
+AC_REQUIRE([AM_PROG_LD])
+AC_REQUIRE([AM_PROG_NM])
+AC_REQUIRE([AC_PROG_LN_S])
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)
+
+dnl Allow the --disable-shared flag to stop us from building shared libs.
+AC_ARG_ENABLE(shared,
+[ --enable-shared build shared libraries [default=yes]],
+[if test "$enableval" = no; then
+ libtool_enable_shared=no
+else
+ libtool_enable_shared=yes
+fi])
+test -n "$libtool_enable_shared" && enable_shared="$libtool_enable_shared"
+libtool_shared=
+test "$enable_shared" = no && libtool_shared=" --disable-shared"
+
+dnl Allow the --disable-static flag to stop us from building static libs.
+AC_ARG_ENABLE(static,
+[ --enable-static build static libraries [default=yes]],
+[if test "$enableval" = no; then
+ libtool_enable_static=no
+else
+ libtool_enable_static=yes
+fi])
+test -n "$libtool_enable_static" && enable_static="$libtool_enable_static"
+libtool_static=
+test "$enable_static" = no && libtool_static=" --disable-static"
+
+libtool_flags="$libtool_shared$libtool_static"
+test "$silent" = yes && libtool_flags="$libtool_flags --silent"
+test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
+test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+[case "$host" in
+*-*-irix6*)
+ ac_save_CFLAGS="$CFLAGS"
+ flag_passed=no
+ for f in -32 -64 -n32 ABI -cckr -mips1 -mips2 -mips3 -mips4; do
+ case "$f" in
+ ABI)
+ test -n "$SGI_ABI" && flag_passed=yes
+ if test "$flag_passed" = no && test "$ac_cv_prog_gcc" = yes; then
+ # Choose the ABI flag according to GCC's specs.
+ if $CC -dumpspecs 2>&1 | sed '/^\*link:$/,/^$/!d' | egrep -e '[ ]-32' >/dev/null; then
+ LD="${LD-ld} -32"
+ else
+ LD="${LD-ld} -n32"
+ fi
+ fi
+ ;;
+
+ *)
+ if echo " $CC $CFLAGS " | egrep -e "[ ]$f[ ]" > /dev/null; then
+ flag_passed=yes
+ LD="${LD-ld} $f"
+ fi
+ ;;
+ esac
+ done
+ CFLAGS="$ac_save_CFLAGS"
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ CFLAGS="$CFLAGS -belf"
+ ;;
+esac]
+
+# Actually configure libtool. ac_aux_dir is where install-sh is found.
+CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
+LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
+${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \
+$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
+|| AC_MSG_ERROR([libtool configure failed])
+])
+
+# AM_PROG_LD - find the path to the GNU or non-GNU linker
+AC_DEFUN(AM_PROG_LD,
+[AC_ARG_WITH(gnu-ld,
+[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
+test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
+AC_REQUIRE([AC_PROG_CC])
+ac_prog=ld
+if test "$ac_cv_prog_gcc" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ AC_MSG_CHECKING([for ld used by GCC])
+ ac_prog=`($CC -print-prog-name=ld) 2>&5`
+ case "$ac_prog" in
+ # Accept absolute paths.
+ /*)
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ AC_MSG_CHECKING([for GNU ld])
+else
+ AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(ac_cv_path_LD,
+[if test -z "$LD"; then
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog"; then
+ ac_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some GNU ld's only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+ test "$with_gnu_ld" != no && break
+ else
+ test "$with_gnu_ld" != yes && break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+else
+ ac_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$ac_cv_path_LD"
+if test -n "$LD"; then
+ AC_MSG_RESULT($LD)
+else
+ AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_SUBST(LD)
+AM_PROG_LD_GNU
+])
+
+AC_DEFUN(AM_PROG_LD_GNU,
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+ ac_cv_prog_gnu_ld=yes
+else
+ ac_cv_prog_gnu_ld=no
+fi])
+])
+
+# AM_PROG_NM - find the path to a BSD-compatible name lister
+AC_DEFUN(AM_PROG_NM,
+[AC_MSG_CHECKING([for BSD-compatible nm])
+AC_CACHE_VAL(ac_cv_path_NM,
+[case "$NM" in
+/*)
+ ac_cv_path_NM="$NM" # Let the user override the test with a path.
+ ;;
+*)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do
+ test -z "$ac_dir" && dir=.
+ if test -f $ac_dir/nm; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1!d' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ if ($ac_dir/nm -B /dev/null 2>&1 | sed '1!d'; exit 0) | egrep /dev/null >/dev/null; then
+ ac_cv_path_NM="$ac_dir/nm -B"
+ elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1!d'; exit 0) | egrep /dev/null >/dev/null; then
+ ac_cv_path_NM="$ac_dir/nm -p"
+ else
+ ac_cv_path_NM="$ac_dir/nm"
+ fi
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
+ ;;
+esac])
+NM="$ac_cv_path_NM"
+AC_MSG_RESULT([$NM])
+AC_SUBST(NM)
+])
+
+dnl LIBGTOP_SUPPORT_CHECKS
+dnl Check for various support functions needed by the standard
+dnl Gnome libraries. Sets LIBOBJS, might define some macros,
+dnl and will set the need_libgtop_support shell variable to "yes"
+dnl or "no". Also sets up the Automake BUILD_LIBGTOP_SUPPORT
+dnl conditional.
+AC_DEFUN([LIBGTOP_SUPPORT_CHECKS],[
+ need_libgtop_support=no
+ save_LIBOBJS="$LIBOBJS"
+ LIBOBJS=
+
+ AC_CACHE_CHECK([for program_invocation_short_name], libgtop_cv_short_name, [
+ AC_TRY_LINK([#include <errno.h>],[
+ char *foo = program_invocation_short_name],
+ libgtop_cv_short_name=yes, libgtop_cv_short_name=no)])
+ if test "$libgtop_cv_short_name" = yes; then
+ AC_DEFINE(HAVE_PROGRAM_INVOCATION_SHORT_NAME)
+ fi
+
+ AC_CACHE_CHECK([for program_invocation_name], libgtop_cv_invocation_name, [
+ AC_TRY_LINK([#include <errno.h>],[
+ char *foo = program_invocation_name],
+ libgtop_cv_invocation_name=yes, libgtop_cv_invocation_name=no)])
+ if test "$libgtop_cv_invocation_name" = yes; then
+ AC_DEFINE(HAVE_PROGRAM_INVOCATION_NAME)
+ fi
+
+ AC_REPLACE_FUNCS(strtok_r strcasecmp strndup strnlen strerror)
+
+ if test "$LIBOBJS" != ""; then
+ need_libgtop_support=yes
+ fi
+ # Turn our LIBOBJS into libtool objects. This is gross, but it
+ # requires changes to autoconf before it goes away.
+ LTLIBOBJS=`echo "$LIBOBJS" | sed 's/\.o/.lo/g'`
+ AC_SUBST(LTLIBOBJS)
+
+ LIBOBJS="$save_LIBOBJS"
+ AM_CONDITIONAL(BUILD_LIBGTOP_SUPPORT, test "$need_libgtop_support" = yes)
+])
+
+# Macro to add for using GNU gettext.
+# Ulrich Drepper <drepper@cygnus.com>, 1995.
+#
+# This file file be copied and used freely without restrictions. It can
+# be used in projects which are not available under the GNU Public License
+# but which still want to provide support for the GNU gettext functionality.
+# Please note that the actual code is *not* freely available.
+
+# serial 3
+
+AC_DEFUN(AM_WITH_NLS,
+ [AC_MSG_CHECKING([whether NLS is requested])
+ dnl Default is enabled NLS
+ AC_ARG_ENABLE(nls,
+ [ --disable-nls do not use Native Language Support],
+ USE_NLS=$enableval, USE_NLS=yes)
+ AC_MSG_RESULT($USE_NLS)
+ AC_SUBST(USE_NLS)
+
+ USE_INCLUDED_LIBINTL=no
+
+ dnl If we use NLS figure out what method
+ if test "$USE_NLS" = "yes"; then
+ AC_DEFINE(ENABLE_NLS)
+ AC_MSG_CHECKING([whether included gettext is requested])
+ AC_ARG_WITH(included-gettext,
+ [ --with-included-gettext use the GNU gettext library included here],
+ nls_cv_force_use_gnu_gettext=$withval,
+ nls_cv_force_use_gnu_gettext=no)
+ AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
+
+ nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
+ if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
+ dnl User does not insist on using GNU NLS library. Figure out what
+ dnl to use. If gettext or catgets are available (in this order) we
+ dnl use this. Else we have to fall back to GNU NLS library.
+ dnl catgets is only used if permitted by option --with-catgets.
+ nls_cv_header_intl=
+ nls_cv_header_libgt=
+ CATOBJEXT=NONE
+
+ AC_CHECK_HEADER(libintl.h,
+ [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
+ [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
+ gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
+
+ if test "$gt_cv_func_gettext_libc" != "yes"; then
+ AC_CHECK_LIB(intl, bindtextdomain,
+ [AC_CACHE_CHECK([for gettext in libintl],
+ gt_cv_func_gettext_libintl,
+ [AC_TRY_LINK([], [return (int) gettext ("")],
+ gt_cv_func_gettext_libintl=yes,
+ gt_cv_func_gettext_libintl=no)])])
+ fi
+
+ if test "$gt_cv_func_gettext_libc" = "yes" \
+ || test "$gt_cv_func_gettext_libintl" = "yes"; then
+ AC_DEFINE(HAVE_GETTEXT)
+ AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
+ [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
+ if test "$MSGFMT" != "no"; then
+ AC_CHECK_FUNCS(dcgettext)
+ AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
+ AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
+ [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
+ AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
+ return _nl_msg_cat_cntr],
+ [CATOBJEXT=.gmo
+ DATADIRNAME=share],
+ [CATOBJEXT=.mo
+ DATADIRNAME=lib])
+ INSTOBJEXT=.mo
+ fi
+ fi
+ ])
+
+ if test "$CATOBJEXT" = "NONE"; then
+ AC_MSG_CHECKING([whether catgets can be used])
+ AC_ARG_WITH(catgets,
+ [ --with-catgets use catgets functions if available],
+ nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
+ AC_MSG_RESULT($nls_cv_use_catgets)
+
+ if test "$nls_cv_use_catgets" = "yes"; then
+ dnl No gettext in C library. Try catgets next.
+ AC_CHECK_LIB(i, main)
+ AC_CHECK_FUNC(catgets,
+ [AC_DEFINE(HAVE_CATGETS)
+ INTLOBJS="\$(CATOBJS)"
+ AC_PATH_PROG(GENCAT, gencat, no)dnl
+ if test "$GENCAT" != "no"; then
+ AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
+ if test "$GMSGFMT" = "no"; then
+ AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
+ [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
+ fi
+ AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
+ [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
+ USE_INCLUDED_LIBINTL=yes
+ CATOBJEXT=.cat
+ INSTOBJEXT=.cat
+ DATADIRNAME=lib
+ INTLDEPS='$(top_builddir)/intl/libintl.a'
+ INTLLIBS=$INTLDEPS
+ LIBS=`echo $LIBS | sed -e 's/-lintl//'`
+ nls_cv_header_intl=intl/libintl.h
+ nls_cv_header_libgt=intl/libgettext.h
+ fi])
+ fi
+ fi
+
+ if test "$CATOBJEXT" = "NONE"; then
+ dnl Neither gettext nor catgets in included in the C library.
+ dnl Fall back on GNU gettext library.
+ nls_cv_use_gnu_gettext=yes
+ fi
+ fi
+
+ if test "$nls_cv_use_gnu_gettext" = "yes"; then
+ dnl Mark actions used to generate GNU NLS library.
+ INTLOBJS="\$(GETTOBJS)"
+ AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
+ [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
+ AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
+ AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
+ [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
+ AC_SUBST(MSGFMT)
+ USE_INCLUDED_LIBINTL=yes
+ CATOBJEXT=.gmo
+ INSTOBJEXT=.mo
+ DATADIRNAME=share
+ INTLDEPS='$(top_builddir)/intl/libintl.a'
+ INTLLIBS=$INTLDEPS
+ LIBS=`echo $LIBS | sed -e 's/-lintl//'`
+ nls_cv_header_intl=intl/libintl.h
+ nls_cv_header_libgt=intl/libgettext.h
+ fi
+
+ dnl Test whether we really found GNU xgettext.
+ if test "$XGETTEXT" != ":"; then
+ dnl If it is no GNU xgettext we define it as : so that the
+ dnl Makefiles still can work.
+ if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
+ : ;
+ else
+ AC_MSG_RESULT(
+ [found xgettext programs is not GNU xgettext; ignore it])
+ XGETTEXT=":"
+ fi
+ fi
+
+ # We need to process the po/ directory.
+ POSUB=po
+ else
+ DATADIRNAME=share
+ nls_cv_header_intl=intl/libintl.h
+ nls_cv_header_libgt=intl/libgettext.h
+ fi
+
+ # If this is used in GNU gettext we have to set USE_NLS to `yes'
+ # because some of the sources are only built for this goal.
+ if test "$PACKAGE" = gettext; then
+ USE_NLS=yes
+ USE_INCLUDED_LIBINTL=yes
+ fi
+
+ dnl These rules are solely for the distribution goal. While doing this
+ dnl we only have to keep exactly one list of the available catalogs
+ dnl in configure.in.
+ for lang in $ALL_LINGUAS; do
+ GMOFILES="$GMOFILES $lang.gmo"
+ POFILES="$POFILES $lang.po"
+ done
+
+ dnl Make all variables we use known to autoconf.
+ AC_SUBST(USE_INCLUDED_LIBINTL)
+ AC_SUBST(CATALOGS)
+ AC_SUBST(CATOBJEXT)
+ AC_SUBST(DATADIRNAME)
+ AC_SUBST(GMOFILES)
+ AC_SUBST(INSTOBJEXT)
+ AC_SUBST(INTLDEPS)
+ AC_SUBST(INTLLIBS)
+ AC_SUBST(INTLOBJS)
+ AC_SUBST(POFILES)
+ AC_SUBST(POSUB)
+ ])
+
+AC_DEFUN(AM_GNU_GETTEXT,
+ [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+ AC_REQUIRE([AC_PROG_CC])dnl
+ AC_REQUIRE([AC_PROG_RANLIB])dnl
+ AC_REQUIRE([AC_ISC_POSIX])dnl
+ AC_REQUIRE([AC_HEADER_STDC])dnl
+ AC_REQUIRE([AC_C_CONST])dnl
+ AC_REQUIRE([AC_C_INLINE])dnl
+ AC_REQUIRE([AC_TYPE_OFF_T])dnl
+ AC_REQUIRE([AC_TYPE_SIZE_T])dnl
+ AC_REQUIRE([AC_FUNC_ALLOCA])dnl
+ AC_REQUIRE([AC_FUNC_MMAP])dnl
+
+ AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
+unistd.h values.h sys/param.h])
+ AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
+__argz_count __argz_stringify __argz_next])
+
+ if test "${ac_cv_func_stpcpy+set}" != "set"; then
+ AC_CHECK_FUNCS(stpcpy)
+ fi
+ if test "${ac_cv_func_stpcpy}" = "yes"; then
+ AC_DEFINE(HAVE_STPCPY)
+ fi
+
+ AM_LC_MESSAGES
+ AM_WITH_NLS
+
+ if test "x$CATOBJEXT" != "x"; then
+ if test "x$ALL_LINGUAS" = "x"; then
+ LINGUAS=
+ else
+ AC_MSG_CHECKING(for catalogs to be installed)
+ NEW_LINGUAS=
+ for lang in ${LINGUAS=$ALL_LINGUAS}; do
+ case "$ALL_LINGUAS" in
+ *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
+ esac
+ done
+ LINGUAS=$NEW_LINGUAS
+ AC_MSG_RESULT($LINGUAS)
+ fi
+
+ dnl Construct list of names of catalog files to be constructed.
+ if test -n "$LINGUAS"; then
+ for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
+ fi
+ fi
+
+ dnl The reference to <locale.h> in the installed <libintl.h> file
+ dnl must be resolved because we cannot expect the users of this
+ dnl to define HAVE_LOCALE_H.
+ if test $ac_cv_header_locale_h = yes; then
+ INCLUDE_LOCALE_H="#include <locale.h>"
+ else
+ INCLUDE_LOCALE_H="\
+/* The system does not provide the header <locale.h>. Take care yourself. */"
+ fi
+ AC_SUBST(INCLUDE_LOCALE_H)
+
+ dnl Determine which catalog format we have (if any is needed)
+ dnl For now we know about two different formats:
+ dnl Linux libc-5 and the normal X/Open format
+ test -d intl || mkdir intl
+ if test "$CATOBJEXT" = ".cat"; then
+ AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
+
+ dnl Transform the SED scripts while copying because some dumb SEDs
+ dnl cannot handle comments.
+ sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
+ fi
+ dnl po2tbl.sed is always needed.
+ sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
+ $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
+
+ dnl In the intl/Makefile.in we have a special dependency which makes
+ dnl only sense for gettext. We comment this out for non-gettext
+ dnl packages.
+ if test "$PACKAGE" = "gettext"; then
+ GT_NO="#NO#"
+ GT_YES=
+ else
+ GT_NO=
+ GT_YES="#YES#"
+ fi
+ AC_SUBST(GT_NO)
+ AC_SUBST(GT_YES)
+
+ dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
+ dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
+ dnl Try to locate is.
+ MKINSTALLDIRS=
+ if test -n "$ac_aux_dir"; then
+ MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
+ fi
+ if test -z "$MKINSTALLDIRS"; then
+ MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
+ fi
+ AC_SUBST(MKINSTALLDIRS)
+
+ dnl *** For now the libtool support in intl/Makefile is not for real.
+ l=
+ AC_SUBST(l)
+
+ dnl Generate list of files to be processed by xgettext which will
+ dnl be included in po/Makefile.
+ test -d po || mkdir po
+ if test "x$srcdir" != "x."; then
+ if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
+ posrcprefix="$srcdir/"
+ else
+ posrcprefix="../$srcdir/"
+ fi
+ else
+ posrcprefix="../"
+ fi
+ rm -f po/POTFILES
+ sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
+ < $srcdir/po/POTFILES.in > po/POTFILES
+ ])
+
+# Search path for a program which passes the given test.
+# Ulrich Drepper <drepper@cygnus.com>, 1996.
+#
+# This file file be copied and used freely without restrictions. It can
+# be used in projects which are not available under the GNU Public License
+# but which still want to provide support for the GNU gettext functionality.
+# Please note that the actual code is *not* freely available.
+
+# serial 1
+
+dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
+dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
+AC_DEFUN(AM_PATH_PROG_WITH_TEST,
+[# Extract the first word of "$2", so it can be a program name with args.
+set dummy $2; ac_word=[$]2
+AC_MSG_CHECKING([for $ac_word])
+AC_CACHE_VAL(ac_cv_path_$1,
+[case "[$]$1" in
+ /*)
+ ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
+ ;;
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in ifelse([$5], , $PATH, [$5]); do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ if [$3]; then
+ ac_cv_path_$1="$ac_dir/$ac_word"
+ break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+dnl If no 4th arg is given, leave the cache variable unset,
+dnl so AC_PATH_PROGS will keep looking.
+ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
+])dnl
+ ;;
+esac])dnl
+$1="$ac_cv_path_$1"
+if test -n "[$]$1"; then
+ AC_MSG_RESULT([$]$1)
+else
+ AC_MSG_RESULT(no)
+fi
+AC_SUBST($1)dnl
+])
+
+# Check whether LC_MESSAGES is available in <locale.h>.
+# Ulrich Drepper <drepper@cygnus.com>, 1995.
+#
+# This file file be copied and used freely without restrictions. It can
+# be used in projects which are not available under the GNU Public License
+# but which still want to provide support for the GNU gettext functionality.
+# Please note that the actual code is *not* freely available.
+
+# serial 1
+
+AC_DEFUN(AM_LC_MESSAGES,
+ [if test $ac_cv_header_locale_h = yes; then
+ AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
+ [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
+ am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
+ if test $am_cv_val_LC_MESSAGES = yes; then
+ AC_DEFINE(HAVE_LC_MESSAGES)
+ fi
+ fi])
+
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 00000000..13ee7e0c
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+# Run this to generate all the initial makefiles, etc.
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+PKG_NAME="Gnome Top Library"
+
+(test -f $srcdir/configure.in \
+ && test -f $srcdir/copyright.txt \
+ && test -d $srcdir/sysdeps) || {
+ echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
+ echo " top-level gnome directory"
+ exit 1
+}
+
+. $srcdir/macros/autogen.sh
diff --git a/config.guess b/config.guess
new file mode 100755
index 00000000..413ed41c
--- /dev/null
+++ b/config.guess
@@ -0,0 +1,883 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+# Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
+#
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Written by Per Bothner <bothner@cygnus.com>.
+# The master version of this file is at the FSF in /home/gd/gnu/lib.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub. If it succeeds, it prints the system name on stdout, and
+# exits with 0. Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit system type (host/target name).
+#
+# Only a few systems have been added to this list; please add others
+# (but try to keep the structure clean).
+#
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 8/24/94.)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+ PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ alpha:OSF1:*:*)
+ if test $UNAME_RELEASE = "V4.0"; then
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+ fi
+ # A Vn.n version is a released version.
+ # A Tn.n version is a released field test version.
+ # A Xn.n version is an unreleased experimental baselevel.
+ # 1.2 uses "1.2" for uname -r.
+ cat <<EOF >dummy.s
+ .globl main
+ .ent main
+main:
+ .frame \$30,0,\$26,0
+ .prologue 0
+ .long 0x47e03d80 # implver $0
+ lda \$2,259
+ .long 0x47e20c21 # amask $2,$1
+ srl \$1,8,\$2
+ sll \$2,2,\$2
+ sll \$0,3,\$0
+ addl \$1,\$0,\$0
+ addl \$2,\$0,\$0
+ ret \$31,(\$26),1
+ .end main
+EOF
+ ${CC-cc} dummy.s -o dummy 2>/dev/null
+ if test "$?" = 0 ; then
+ ./dummy
+ case "$?" in
+ 7)
+ UNAME_MACHINE="alpha"
+ ;;
+ 15)
+ UNAME_MACHINE="alphaev5"
+ ;;
+ 14)
+ UNAME_MACHINE="alphaev56"
+ ;;
+ 10)
+ UNAME_MACHINE="alphapca56"
+ ;;
+ 16)
+ UNAME_MACHINE="alphaev6"
+ ;;
+ esac
+ fi
+ rm -f dummy.s dummy
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]`
+ exit 0 ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+ exit 0 ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ echo m68k-cbm-sysv4
+ exit 0;;
+ amiga:NetBSD:*:*)
+ echo m68k-cbm-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ amiga:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ arc64:OpenBSD:*:*)
+ echo mips64el-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ arc:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ hkmips:OpenBSD:*:*)
+ echo mips-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ pmax:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sgi:OpenBSD:*:*)
+ echo mips-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ wgrisc:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix${UNAME_RELEASE}
+ exit 0;;
+ arm32:NetBSD:*:*)
+ echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ exit 0 ;;
+ SR2?01:HI-UX/MPP:*:*)
+ echo hppa1.1-hitachi-hiuxmpp
+ exit 0;;
+ Pyramid*:OSx*:*:*|MIS*:OSx*:*:*)
+ # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+ if test "`(/bin/universe) 2>/dev/null`" = att ; then
+ echo pyramid-pyramid-sysv3
+ else
+ echo pyramid-pyramid-bsd
+ fi
+ exit 0 ;;
+ NILE:*:*:dcosx)
+ echo pyramid-pyramid-svr4
+ exit 0 ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ i86pc:SunOS:5.*:*)
+ echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
+ # it's likely to be more like Solaris than SunOS4.
+ echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:*:*)
+ case "`/usr/bin/arch -k`" in
+ Series*|S4*)
+ UNAME_RELEASE=`uname -v`
+ ;;
+ esac
+ # Japanese Language versions have a version number like `4.1.3-JL'.
+ echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+ exit 0 ;;
+ sun3*:SunOS:*:*)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ exit 0 ;;
+ sun*:*:4.2BSD:*)
+ UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+ case "`/bin/arch`" in
+ sun3)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ ;;
+ sun4)
+ echo sparc-sun-sunos${UNAME_RELEASE}
+ ;;
+ esac
+ exit 0 ;;
+ aushp:SunOS:*:*)
+ echo sparc-auspex-sunos${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:NetBSD:*:*)
+ echo m68k-atari-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sun3*:NetBSD:*:*)
+ echo m68k-sun-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sun3*:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mac68k:NetBSD:*:*)
+ echo m68k-apple-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mac68k:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme68k:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme88k:OpenBSD:*:*)
+ echo m88k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ powerpc:machten:*:*)
+ echo powerpc-apple-machten${UNAME_RELEASE}
+ exit 0 ;;
+ RISC*:Mach:*:*)
+ echo mips-dec-mach_bsd4.3
+ exit 0 ;;
+ RISC*:ULTRIX:*:*)
+ echo mips-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ VAX*:ULTRIX*:*:*)
+ echo vax-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ 2020:CLIX:*:*)
+ echo clipper-intergraph-clix${UNAME_RELEASE}
+ exit 0 ;;
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ sed 's/^ //' << EOF >dummy.c
+ int main (argc, argv) int argc; char **argv; {
+ #if defined (host_mips) && defined (MIPSEB)
+ #if defined (SYSTYPE_SYSV)
+ printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_SVR4)
+ printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+ printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+ #endif
+ #endif
+ exit (-1);
+ }
+EOF
+ ${CC-cc} dummy.c -o dummy \
+ && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+ && rm dummy.c dummy && exit 0
+ rm -f dummy.c dummy
+ echo mips-mips-riscos${UNAME_RELEASE}
+ exit 0 ;;
+ Night_Hawk:Power_UNIX:*:*)
+ echo powerpc-harris-powerunix
+ exit 0 ;;
+ m88k:CX/UX:7*:*)
+ echo m88k-harris-cxux7
+ exit 0 ;;
+ m88k:*:4*:R4*)
+ echo m88k-motorola-sysv4
+ exit 0 ;;
+ m88k:*:3*:R3*)
+ echo m88k-motorola-sysv3
+ exit 0 ;;
+ AViiON:dgux:*:*)
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
+ if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
+ -o ${TARGET_BINARY_INTERFACE}x = x ] ; then
+ echo m88k-dg-dgux${UNAME_RELEASE}
+ else
+ echo m88k-dg-dguxbcs${UNAME_RELEASE}
+ fi
+ else echo i586-dg-dgux${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ echo m88k-dolphin-sysv3
+ exit 0 ;;
+ M88*:*:R3*:*)
+ # Delta 88k system running SVR3
+ echo m88k-motorola-sysv3
+ exit 0 ;;
+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+ echo m88k-tektronix-sysv3
+ exit 0 ;;
+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+ echo m68k-tektronix-bsd
+ exit 0 ;;
+ *:IRIX*:*:*)
+ echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+ exit 0 ;;
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ i?86:AIX:*:*)
+ echo i386-ibm-aix
+ exit 0 ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ sed 's/^ //' << EOF >dummy.c
+ #include <sys/systemcfg.h>
+
+ main()
+ {
+ if (!__power_pc())
+ exit(1);
+ puts("powerpc-ibm-aix3.2.5");
+ exit(0);
+ }
+EOF
+ ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
+ rm -f dummy.c dummy
+ echo rs6000-ibm-aix3.2.5
+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ echo rs6000-ibm-aix3.2.4
+ else
+ echo rs6000-ibm-aix3.2
+ fi
+ exit 0 ;;
+ *:AIX:*:4)
+ if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+ else
+ IBM_ARCH=powerpc
+ fi
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=4.${UNAME_RELEASE}
+ fi
+ echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+ exit 0 ;;
+ *:AIX:*:*)
+ echo rs6000-ibm-aix
+ exit 0 ;;
+ ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+ echo romp-ibm-bsd4.4
+ exit 0 ;;
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
+ echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
+ exit 0 ;; # report: romp-ibm BSD 4.3
+ *:BOSX:*:*)
+ echo rs6000-bull-bosx
+ exit 0 ;;
+ DPX/2?00:B.O.S.:*:*)
+ echo m68k-bull-sysv3
+ exit 0 ;;
+ 9000/[34]??:4.3bsd:1.*:*)
+ echo m68k-hp-bsd
+ exit 0 ;;
+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+ echo m68k-hp-bsd4.4
+ exit 0 ;;
+ 9000/[3478]??:HP-UX:*:*)
+ case "${UNAME_MACHINE}" in
+ 9000/31? ) HP_ARCH=m68000 ;;
+ 9000/[34]?? ) HP_ARCH=m68k ;;
+ 9000/7?? | 9000/8?[1679] ) HP_ARCH=hppa1.1 ;;
+ 9000/8?? ) HP_ARCH=hppa1.0 ;;
+ esac
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ exit 0 ;;
+ 3050*:HI-UX:*:*)
+ sed 's/^ //' << EOF >dummy.c
+ #include <unistd.h>
+ int
+ main ()
+ {
+ long cpu = sysconf (_SC_CPU_VERSION);
+ /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+ true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
+ results, however. */
+ if (CPU_IS_PA_RISC (cpu))
+ {
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+ default: puts ("hppa-hitachi-hiuxwe2"); break;
+ }
+ }
+ else if (CPU_IS_HP_MC68K (cpu))
+ puts ("m68k-hitachi-hiuxwe2");
+ else puts ("unknown-hitachi-hiuxwe2");
+ exit (0);
+ }
+EOF
+ ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
+ rm -f dummy.c dummy
+ echo unknown-hitachi-hiuxwe2
+ exit 0 ;;
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+ echo hppa1.1-hp-bsd
+ exit 0 ;;
+ 9000/8??:4.3bsd:*:*)
+ echo hppa1.0-hp-bsd
+ exit 0 ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+ echo hppa1.1-hp-osf
+ exit 0 ;;
+ hp8??:OSF1:*:*)
+ echo hppa1.0-hp-osf
+ exit 0 ;;
+ i?86:OSF1:*:*)
+ if [ -x /usr/sbin/sysversion ] ; then
+ echo ${UNAME_MACHINE}-unknown-osf1mk
+ else
+ echo ${UNAME_MACHINE}-unknown-osf1
+ fi
+ exit 0 ;;
+ parisc*:Lites*:*:*)
+ echo hppa1.1-hp-lites
+ exit 0 ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ echo c1-convex-bsd
+ exit 0 ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit 0 ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ echo c34-convex-bsd
+ exit 0 ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ echo c38-convex-bsd
+ exit 0 ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ echo c4-convex-bsd
+ exit 0 ;;
+ CRAY*X-MP:*:*:*)
+ echo xmp-cray-unicos
+ exit 0 ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos${UNAME_RELEASE}
+ exit 0 ;;
+ CRAY*[A-Z]90:*:*:*)
+ echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
+ exit 0 ;;
+ CRAY*TS:*:*:*)
+ echo t90-cray-unicos${UNAME_RELEASE}
+ exit 0 ;;
+ CRAY-2:*:*:*)
+ echo cray2-cray-unicos
+ exit 0 ;;
+ F300:UNIX_System_V:*:*)
+ FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit 0 ;;
+ F301:UNIX_System_V:*:*)
+ echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
+ exit 0 ;;
+ hp3[0-9][05]:NetBSD:*:*)
+ echo m68k-hp-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ hp300:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ i?86:BSD/386:*:* | *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ *:FreeBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit 0 ;;
+ *:NetBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ exit 0 ;;
+ *:OpenBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ exit 0 ;;
+ i*:CYGWIN*:*)
+ echo i386-pc-cygwin32
+ exit 0 ;;
+ i*:MINGW*:*)
+ echo i386-pc-mingw32
+ exit 0 ;;
+ p*:CYGWIN*:*)
+ echo powerpcle-unknown-cygwin32
+ exit 0 ;;
+ prep*:SunOS:5.*:*)
+ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ *:GNU:*:*)
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ exit 0 ;;
+ *:Linux:*:*)
+ # The BFD linker knows what the default object file format is, so
+ # first see if it will tell us.
+ ld_help_string=`ld --help 2>&1`
+ ld_supported_emulations=`echo $ld_help_string \
+ | sed -ne '/supported emulations:/!d
+ s/[ ][ ]*/ /g
+ s/.*supported emulations: *//
+ s/ .*//
+ p'`
+ case "$ld_supported_emulations" in
+ i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;;
+ i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;;
+ sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
+ m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
+ elf32ppc) echo "powerpc-unknown-linux-gnu" ; exit 0 ;;
+ esac
+
+ if test "${UNAME_MACHINE}" = "alpha" ; then
+ sed 's/^ //' <<EOF >dummy.s
+ .globl main
+ .ent main
+ main:
+ .frame \$30,0,\$26,0
+ .prologue 0
+ .long 0x47e03d80 # implver $0
+ lda \$2,259
+ .long 0x47e20c21 # amask $2,$1
+ srl \$1,8,\$2
+ sll \$2,2,\$2
+ sll \$0,3,\$0
+ addl \$1,\$0,\$0
+ addl \$2,\$0,\$0
+ ret \$31,(\$26),1
+ .end main
+EOF
+ LIBC=""
+ ${CC-cc} dummy.s -o dummy 2>/dev/null
+ if test "$?" = 0 ; then
+ ./dummy
+ case "$?" in
+ 7)
+ UNAME_MACHINE="alpha"
+ ;;
+ 15)
+ UNAME_MACHINE="alphaev5"
+ ;;
+ 14)
+ UNAME_MACHINE="alphaev56"
+ ;;
+ 10)
+ UNAME_MACHINE="alphapca56"
+ ;;
+ 16)
+ UNAME_MACHINE="alphaev6"
+ ;;
+ esac
+
+ objdump --private-headers dummy | \
+ grep ld.so.1 > /dev/null
+ if test "$?" = 0 ; then
+ LIBC="libc1"
+ fi
+ fi
+ rm -f dummy.s dummy
+ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
+ elif test "${UNAME_MACHINE}" = "mips" ; then
+ cat >dummy.c <<EOF
+main(argc, argv)
+ int argc;
+ char *argv[];
+{
+#ifdef __MIPSEB__
+ printf ("%s-unknown-linux-gnu\n", argv[1]);
+#endif
+#ifdef __MIPSEL__
+ printf ("%sel-unknown-linux-gnu\n", argv[1]);
+#endif
+ return 0;
+}
+EOF
+ ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
+ rm -f dummy.c dummy
+ else
+ # Either a pre-BFD a.out linker (linux-gnuoldld)
+ # or one that does not give us useful --help.
+ # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
+ # If ld does not provide *any* "supported emulations:"
+ # that means it is gnuoldld.
+ echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:"
+ test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
+
+ case "${UNAME_MACHINE}" in
+ i?86)
+ VENDOR=pc;
+ ;;
+ *)
+ VENDOR=unknown;
+ ;;
+ esac
+ # Determine whether the default compiler is a.out or elf
+ cat >dummy.c <<EOF
+#include <features.h>
+main(argc, argv)
+ int argc;
+ char *argv[];
+{
+#ifdef __ELF__
+# ifdef __GLIBC__
+# if __GLIBC__ >= 2
+ printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
+# else
+ printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
+# endif
+# else
+ printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
+# endif
+#else
+ printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
+#endif
+ return 0;
+}
+EOF
+ ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
+ rm -f dummy.c dummy
+ fi ;;
+# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
+# are messed up and put the nodename in both sysname and nodename.
+ i?86:DYNIX/ptx:4*:*)
+ echo i386-sequent-sysv4
+ exit 0 ;;
+ i?86:UNIX_SV:4.2MP:2.*)
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+ # I am not positive that other SVR4 systems won't match this,
+ # I just have to hope. -- rms.
+ # Use sysv4.2uw... so that sysv4* matches it.
+ echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ exit 0 ;;
+ i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+ echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
+ else
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ i?86:*:3.2:*)
+ if test -f /usr/options/cb.name; then
+ UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+ echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+ elif /bin/uname -X 2>/dev/null >/dev/null ; then
+ UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
+ && UNAME_MACHINE=i586
+ echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+ else
+ echo ${UNAME_MACHINE}-pc-sysv32
+ fi
+ exit 0 ;;
+ pc:*:*:*)
+ # uname -m prints for DJGPP always 'pc', but it prints nothing about
+ # the processor, so we play safe by assuming i386.
+ echo i386-pc-msdosdjgpp
+ exit 0 ;;
+ Intel:Mach:3*:*)
+ echo i386-pc-mach3
+ exit 0 ;;
+ paragon:*:*:*)
+ echo i860-intel-osf1
+ exit 0 ;;
+ i860:*:4.*:*) # i860-SVR4
+ if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+ echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+ else # Add other i860-SVR4 vendors below as they are discovered.
+ echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
+ fi
+ exit 0 ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ echo m68010-convergent-sysv
+ exit 0 ;;
+ M68*:*:R3V[567]*:*)
+ test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+ 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
+ OS_REL=''
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && echo i486-ncr-sysv4.3${OS_REL} && exit 0
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && echo i486-ncr-sysv4 && exit 0 ;;
+ m68*:LynxOS:2.*:*)
+ echo m68k-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ mc68030:UNIX_System_V:4.*:*)
+ echo m68k-atari-sysv4
+ exit 0 ;;
+ i?86:LynxOS:2.*:*)
+ echo i386-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ TSUNAMI:LynxOS:2.*:*)
+ echo sparc-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
+ echo rs6000-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ SM[BE]S:UNIX_SV:*:*)
+ echo mips-dde-sysv${UNAME_RELEASE}
+ exit 0 ;;
+ RM*:SINIX-*:*:*)
+ echo mips-sni-sysv4
+ exit 0 ;;
+ *:SINIX-*:*:*)
+ if uname -p 2>/dev/null >/dev/null ; then
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ echo ${UNAME_MACHINE}-sni-sysv4
+ else
+ echo ns32k-sni-sysv
+ fi
+ exit 0 ;;
+ PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit 0 ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes <hewes@openmarket.com>.
+ # How about differentiating between stratus architectures? -djm
+ echo hppa1.1-stratus-sysv4
+ exit 0 ;;
+ *:*:*:FTX*)
+ # From seanf@swdc.stratus.com.
+ echo i860-stratus-sysv4
+ exit 0 ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux${UNAME_RELEASE}
+ exit 0 ;;
+ news*:NEWS-OS:*:6*)
+ echo mips-sony-newsos6
+ exit 0 ;;
+ R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*)
+ if [ -d /usr/nec ]; then
+ echo mips-nec-sysv${UNAME_RELEASE}
+ else
+ echo mips-unknown-sysv${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+cat >dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+ printf ("arm-acorn-riscix"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+ printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+#if !defined (ultrix)
+ printf ("vax-dec-bsd\n"); exit (0);
+#else
+ printf ("vax-dec-ultrix\n"); exit (0);
+#endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
+rm -f dummy.c dummy
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+ case `getsysinfo -f cpu_type` in
+ c1*)
+ echo c1-convex-bsd
+ exit 0 ;;
+ c2*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit 0 ;;
+ c34*)
+ echo c34-convex-bsd
+ exit 0 ;;
+ c38*)
+ echo c38-convex-bsd
+ exit 0 ;;
+ c4*)
+ echo c4-convex-bsd
+ exit 0 ;;
+ esac
+fi
+
+#echo '(Unable to guess system type)' 1>&2
+
+exit 1
diff --git a/config.sub b/config.sub
new file mode 100755
index 00000000..213a6d47
--- /dev/null
+++ b/config.sub
@@ -0,0 +1,954 @@
+#! /bin/sh
+# Configuration validation subroutine script, version 1.1.
+# Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine. It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support. The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+if [ x$1 = x ]
+then
+ echo Configuration name missing. 1>&2
+ echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
+ echo "or $0 ALIAS" 1>&2
+ echo where ALIAS is a recognized configuration type. 1>&2
+ exit 1
+fi
+
+# First pass through any local machine types.
+case $1 in
+ *local*)
+ echo $1
+ exit 0
+ ;;
+ *)
+ ;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+ linux-gnu*)
+ os=-$maybe_os
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ ;;
+ *)
+ basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+ if [ $basic_machine != $1 ]
+ then os=`echo $1 | sed 's/.*-/-/'`
+ else os=; fi
+ ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work. We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+ -sun*os*)
+ # Prevent following clause from handling this invalid input.
+ ;;
+ -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+ -apple)
+ os=
+ basic_machine=$1
+ ;;
+ -hiux*)
+ os=-hiuxwe2
+ ;;
+ -sco5)
+ os=sco3.2v5
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco4)
+ os=-sco3.2v4
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2.[4-9]*)
+ os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2v[4-9]*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco*)
+ os=-sco3.2v2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -isc)
+ os=-isc2.2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -clix*)
+ basic_machine=clipper-intergraph
+ ;;
+ -isc*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -lynx*)
+ os=-lynxos
+ ;;
+ -ptx*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+ ;;
+ -windowsnt*)
+ os=`echo $os | sed -e 's/windowsnt/winnt/'`
+ ;;
+ -psos*)
+ os=-psos
+ ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+ # Recognize the basic CPU types without company name.
+ # Some are omitted here because they have special meanings below.
+ tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
+ | arme[lb] | pyramid | mn10200 | mn10300 \
+ | tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \
+ | alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \
+ | i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \
+ | mips64 | mipsel | mips64el | mips64orion | mips64orionel \
+ | mipstx39 | mipstx39el \
+ | sparc | sparclet | sparclite | sparc64 | v850)
+ basic_machine=$basic_machine-unknown
+ ;;
+ # We use `pc' rather than `unknown'
+ # because (1) that's what they normally are, and
+ # (2) the word "unknown" tends to confuse beginning users.
+ i[3456]86)
+ basic_machine=$basic_machine-pc
+ ;;
+ # Object if more than one company name word.
+ *-*-*)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+ # Recognize the basic CPU types with company name.
+ vax-* | tahoe-* | i[3456]86-* | i860-* | m32r-* | m68k-* | m68000-* \
+ | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
+ | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
+ | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \
+ | xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* \
+ | alpha-* | alphaev5-* | alphaev56-* | we32k-* | cydra-* \
+ | ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \
+ | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
+ | sparc64-* | mips64-* | mipsel-* \
+ | mips64el-* | mips64orion-* | mips64orionel-* \
+ | mipstx39-* | mipstx39el-* \
+ | f301-*)
+ ;;
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+ 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+ basic_machine=m68000-att
+ ;;
+ 3b*)
+ basic_machine=we32k-att
+ ;;
+ alliant | fx80)
+ basic_machine=fx80-alliant
+ ;;
+ altos | altos3068)
+ basic_machine=m68k-altos
+ ;;
+ am29k)
+ basic_machine=a29k-none
+ os=-bsd
+ ;;
+ amdahl)
+ basic_machine=580-amdahl
+ os=-sysv
+ ;;
+ amiga | amiga-*)
+ basic_machine=m68k-cbm
+ ;;
+ amigaos | amigados)
+ basic_machine=m68k-cbm
+ os=-amigaos
+ ;;
+ amigaunix | amix)
+ basic_machine=m68k-cbm
+ os=-sysv4
+ ;;
+ apollo68)
+ basic_machine=m68k-apollo
+ os=-sysv
+ ;;
+ aux)
+ basic_machine=m68k-apple
+ os=-aux
+ ;;
+ balance)
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ os=-bsd
+ ;;
+ convex-c2)
+ basic_machine=c2-convex
+ os=-bsd
+ ;;
+ convex-c32)
+ basic_machine=c32-convex
+ os=-bsd
+ ;;
+ convex-c34)
+ basic_machine=c34-convex
+ os=-bsd
+ ;;
+ convex-c38)
+ basic_machine=c38-convex
+ os=-bsd
+ ;;
+ cray | ymp)
+ basic_machine=ymp-cray
+ os=-unicos
+ ;;
+ cray2)
+ basic_machine=cray2-cray
+ os=-unicos
+ ;;
+ [ctj]90-cray)
+ basic_machine=c90-cray
+ os=-unicos
+ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ ;;
+ da30 | da30-*)
+ basic_machine=m68k-da30
+ ;;
+ decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+ basic_machine=mips-dec
+ ;;
+ delta | 3300 | motorola-3300 | motorola-delta \
+ | 3300-motorola | delta-motorola)
+ basic_machine=m68k-motorola
+ ;;
+ delta88)
+ basic_machine=m88k-motorola
+ os=-sysv3
+ ;;
+ dpx20 | dpx20-*)
+ basic_machine=rs6000-bull
+ os=-bosx
+ ;;
+ dpx2* | dpx2*-bull)
+ basic_machine=m68k-bull
+ os=-sysv3
+ ;;
+ ebmon29k)
+ basic_machine=a29k-amd
+ os=-ebmon
+ ;;
+ elxsi)
+ basic_machine=elxsi-elxsi
+ os=-bsd
+ ;;
+ encore | umax | mmax)
+ basic_machine=ns32k-encore
+ ;;
+ fx2800)
+ basic_machine=i860-alliant
+ ;;
+ genix)
+ basic_machine=ns32k-ns
+ ;;
+ gmicro)
+ basic_machine=tron-gmicro
+ os=-sysv
+ ;;
+ h3050r* | hiux*)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ h8300hms)
+ basic_machine=h8300-hitachi
+ os=-hms
+ ;;
+ harris)
+ basic_machine=m88k-harris
+ os=-sysv3
+ ;;
+ hp300-*)
+ basic_machine=m68k-hp
+ ;;
+ hp300bsd)
+ basic_machine=m68k-hp
+ os=-bsd
+ ;;
+ hp300hpux)
+ basic_machine=m68k-hp
+ os=-hpux
+ ;;
+ hp9k2[0-9][0-9] | hp9k31[0-9])
+ basic_machine=m68000-hp
+ ;;
+ hp9k3[2-9][0-9])
+ basic_machine=m68k-hp
+ ;;
+ hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][0-9] | hp8[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hppa-next)
+ os=-nextstep3
+ ;;
+ i370-ibm* | ibm*)
+ basic_machine=i370-ibm
+ os=-mvs
+ ;;
+# I'm not sure what "Sysv32" means. Should this be sysv3.2?
+ i[3456]86v32)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv32
+ ;;
+ i[3456]86v4*)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv4
+ ;;
+ i[3456]86v)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv
+ ;;
+ i[3456]86sol2)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-solaris2
+ ;;
+ iris | iris4d)
+ basic_machine=mips-sgi
+ case $os in
+ -irix*)
+ ;;
+ *)
+ os=-irix4
+ ;;
+ esac
+ ;;
+ isi68 | isi)
+ basic_machine=m68k-isi
+ os=-sysv
+ ;;
+ m88k-omron*)
+ basic_machine=m88k-omron
+ ;;
+ magnum | m3230)
+ basic_machine=mips-mips
+ os=-sysv
+ ;;
+ merlin)
+ basic_machine=ns32k-utek
+ os=-sysv
+ ;;
+ miniframe)
+ basic_machine=m68000-convergent
+ ;;
+ mipsel*-linux*)
+ basic_machine=mipsel-unknown
+ os=-linux-gnu
+ ;;
+ mips*-linux*)
+ basic_machine=mips-unknown
+ os=-linux-gnu
+ ;;
+ mips3*-*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ ;;
+ mips3*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ ;;
+ ncr3000)
+ basic_machine=i486-ncr
+ os=-sysv4
+ ;;
+ news | news700 | news800 | news900)
+ basic_machine=m68k-sony
+ os=-newsos
+ ;;
+ news1000)
+ basic_machine=m68030-sony
+ os=-newsos
+ ;;
+ news-3600 | risc-news)
+ basic_machine=mips-sony
+ os=-newsos
+ ;;
+ next | m*-next )
+ basic_machine=m68k-next
+ case $os in
+ -nextstep* )
+ ;;
+ -ns2*)
+ os=-nextstep2
+ ;;
+ *)
+ os=-nextstep3
+ ;;
+ esac
+ ;;
+ nh3000)
+ basic_machine=m68k-harris
+ os=-cxux
+ ;;
+ nh[45]000)
+ basic_machine=m88k-harris
+ os=-cxux
+ ;;
+ nindy960)
+ basic_machine=i960-intel
+ os=-nindy
+ ;;
+ np1)
+ basic_machine=np1-gould
+ ;;
+ pa-hitachi)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ paragon)
+ basic_machine=i860-intel
+ os=-osf
+ ;;
+ pbd)
+ basic_machine=sparc-tti
+ ;;
+ pbb)
+ basic_machine=m68k-tti
+ ;;
+ pc532 | pc532-*)
+ basic_machine=ns32k-pc532
+ ;;
+ pentium | p5)
+ basic_machine=i586-intel
+ ;;
+ pentiumpro | p6)
+ basic_machine=i686-intel
+ ;;
+ pentium-* | p5-*)
+ basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumpro-* | p6-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ k5)
+ # We don't have specific support for AMD's K5 yet, so just call it a Pentium
+ basic_machine=i586-amd
+ ;;
+ nexen)
+ # We don't have specific support for Nexgen yet, so just call it a Pentium
+ basic_machine=i586-nexgen
+ ;;
+ pn)
+ basic_machine=pn-gould
+ ;;
+ power) basic_machine=rs6000-ibm
+ ;;
+ ppc) basic_machine=powerpc-unknown
+ ;;
+ ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppcle | powerpclittle | ppc-le | powerpc-little)
+ basic_machine=powerpcle-unknown
+ ;;
+ ppcle-* | powerpclittle-*)
+ basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ps2)
+ basic_machine=i386-ibm
+ ;;
+ rm[46]00)
+ basic_machine=mips-siemens
+ ;;
+ rtpc | rtpc-*)
+ basic_machine=romp-ibm
+ ;;
+ sequent)
+ basic_machine=i386-sequent
+ ;;
+ sh)
+ basic_machine=sh-hitachi
+ os=-hms
+ ;;
+ sps7)
+ basic_machine=m68k-bull
+ os=-sysv2
+ ;;
+ spur)
+ basic_machine=spur-unknown
+ ;;
+ sun2)
+ basic_machine=m68000-sun
+ ;;
+ sun2os3)
+ basic_machine=m68000-sun
+ os=-sunos3
+ ;;
+ sun2os4)
+ basic_machine=m68000-sun
+ os=-sunos4
+ ;;
+ sun3os3)
+ basic_machine=m68k-sun
+ os=-sunos3
+ ;;
+ sun3os4)
+ basic_machine=m68k-sun
+ os=-sunos4
+ ;;
+ sun4os3)
+ basic_machine=sparc-sun
+ os=-sunos3
+ ;;
+ sun4os4)
+ basic_machine=sparc-sun
+ os=-sunos4
+ ;;
+ sun4sol2)
+ basic_machine=sparc-sun
+ os=-solaris2
+ ;;
+ sun3 | sun3-*)
+ basic_machine=m68k-sun
+ ;;
+ sun4)
+ basic_machine=sparc-sun
+ ;;
+ sun386 | sun386i | roadrunner)
+ basic_machine=i386-sun
+ ;;
+ symmetry)
+ basic_machine=i386-sequent
+ os=-dynix
+ ;;
+ tx39)
+ basic_machine=mipstx39-unknown
+ ;;
+ tx39el)
+ basic_machine=mipstx39el-unknown
+ ;;
+ tower | tower-32)
+ basic_machine=m68k-ncr
+ ;;
+ udi29k)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ ultra3)
+ basic_machine=a29k-nyu
+ os=-sym1
+ ;;
+ vaxv)
+ basic_machine=vax-dec
+ os=-sysv
+ ;;
+ vms)
+ basic_machine=vax-dec
+ os=-vms
+ ;;
+ vpp*|vx|vx-*)
+ basic_machine=f301-fujitsu
+ ;;
+ vxworks960)
+ basic_machine=i960-wrs
+ os=-vxworks
+ ;;
+ vxworks68)
+ basic_machine=m68k-wrs
+ os=-vxworks
+ ;;
+ vxworks29k)
+ basic_machine=a29k-wrs
+ os=-vxworks
+ ;;
+ xmp)
+ basic_machine=xmp-cray
+ os=-unicos
+ ;;
+ xps | xps100)
+ basic_machine=xps100-honeywell
+ ;;
+ none)
+ basic_machine=none-none
+ os=-none
+ ;;
+
+# Here we handle the default manufacturer of certain CPU types. It is in
+# some cases the only manufacturer, in others, it is the most popular.
+ mips)
+ if [ x$os = x-linux-gnu ]; then
+ basic_machine=mips-unknown
+ else
+ basic_machine=mips-mips
+ fi
+ ;;
+ romp)
+ basic_machine=romp-ibm
+ ;;
+ rs6000)
+ basic_machine=rs6000-ibm
+ ;;
+ vax)
+ basic_machine=vax-dec
+ ;;
+ pdp11)
+ basic_machine=pdp11-dec
+ ;;
+ we32k)
+ basic_machine=we32k-att
+ ;;
+ sparc)
+ basic_machine=sparc-sun
+ ;;
+ cydra)
+ basic_machine=cydra-cydrome
+ ;;
+ orion)
+ basic_machine=orion-highlevel
+ ;;
+ orion105)
+ basic_machine=clipper-highlevel
+ ;;
+ *)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+ *-digital*)
+ basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+ ;;
+ *-commodore*)
+ basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+ ;;
+ *)
+ ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+ # First match some system type aliases
+ # that might get confused with valid system types.
+ # -solaris* is a basic system type, with this one exception.
+ -solaris1 | -solaris1.*)
+ os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ ;;
+ -solaris)
+ os=-solaris2
+ ;;
+ -svr4*)
+ os=-sysv4
+ ;;
+ -unixware*)
+ os=-sysv4.2uw
+ ;;
+ -gnu/linux*)
+ os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+ ;;
+ # First accept the basic system types.
+ # The portable systems comes first.
+ # Each alternative MUST END IN A *, to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+ | -aos* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
+ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ | -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ | -mingw32* | -linux-gnu* | -uxpv*)
+ # Remember, each alternative MUST END IN *, to match a version number.
+ ;;
+ -linux*)
+ os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ ;;
+ -sunos5*)
+ os=`echo $os | sed -e 's|sunos5|solaris2|'`
+ ;;
+ -sunos6*)
+ os=`echo $os | sed -e 's|sunos6|solaris3|'`
+ ;;
+ -osfrose*)
+ os=-osfrose
+ ;;
+ -osf*)
+ os=-osf
+ ;;
+ -utek*)
+ os=-bsd
+ ;;
+ -dynix*)
+ os=-bsd
+ ;;
+ -acis*)
+ os=-aos
+ ;;
+ -ctix* | -uts*)
+ os=-sysv
+ ;;
+ -ns2 )
+ os=-nextstep2
+ ;;
+ # Preserve the version number of sinix5.
+ -sinix5.*)
+ os=`echo $os | sed -e 's|sinix|sysv|'`
+ ;;
+ -sinix*)
+ os=-sysv4
+ ;;
+ -triton*)
+ os=-sysv3
+ ;;
+ -oss*)
+ os=-sysv3
+ ;;
+ -svr4)
+ os=-sysv4
+ ;;
+ -svr3)
+ os=-sysv3
+ ;;
+ -sysvr4)
+ os=-sysv4
+ ;;
+ # This must come after -sysvr4.
+ -sysv*)
+ ;;
+ -xenix)
+ os=-xenix
+ ;;
+ -none)
+ ;;
+ *)
+ # Get rid of the `-' at the beginning of $os.
+ os=`echo $os | sed 's/[^-]*-//'`
+ echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system. Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+ *-acorn)
+ os=-riscix1.2
+ ;;
+ arm*-semi)
+ os=-aout
+ ;;
+ pdp11-*)
+ os=-none
+ ;;
+ *-dec | vax-*)
+ os=-ultrix4.2
+ ;;
+ m68*-apollo)
+ os=-domain
+ ;;
+ i386-sun)
+ os=-sunos4.0.2
+ ;;
+ m68000-sun)
+ os=-sunos3
+ # This also exists in the configure program, but was not the
+ # default.
+ # os=-sunos4
+ ;;
+ *-tti) # must be before sparc entry or we get the wrong os.
+ os=-sysv3
+ ;;
+ sparc-* | *-sun)
+ os=-sunos4.1.1
+ ;;
+ *-ibm)
+ os=-aix
+ ;;
+ *-hp)
+ os=-hpux
+ ;;
+ *-hitachi)
+ os=-hiux
+ ;;
+ i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+ os=-sysv
+ ;;
+ *-cbm)
+ os=-amigaos
+ ;;
+ *-dg)
+ os=-dgux
+ ;;
+ *-dolphin)
+ os=-sysv3
+ ;;
+ m68k-ccur)
+ os=-rtu
+ ;;
+ m88k-omron*)
+ os=-luna
+ ;;
+ *-next )
+ os=-nextstep
+ ;;
+ *-sequent)
+ os=-ptx
+ ;;
+ *-crds)
+ os=-unos
+ ;;
+ *-ns)
+ os=-genix
+ ;;
+ i370-*)
+ os=-mvs
+ ;;
+ *-next)
+ os=-nextstep3
+ ;;
+ *-gould)
+ os=-sysv
+ ;;
+ *-highlevel)
+ os=-bsd
+ ;;
+ *-encore)
+ os=-bsd
+ ;;
+ *-sgi)
+ os=-irix
+ ;;
+ *-siemens)
+ os=-sysv4
+ ;;
+ *-masscomp)
+ os=-rtu
+ ;;
+ f301-fujitsu)
+ os=-uxpv
+ ;;
+ *)
+ os=-none
+ ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer. We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+ *-unknown)
+ case $os in
+ -riscix*)
+ vendor=acorn
+ ;;
+ -sunos*)
+ vendor=sun
+ ;;
+ -aix*)
+ vendor=ibm
+ ;;
+ -hpux*)
+ vendor=hp
+ ;;
+ -hiux*)
+ vendor=hitachi
+ ;;
+ -unos*)
+ vendor=crds
+ ;;
+ -dgux*)
+ vendor=dg
+ ;;
+ -luna*)
+ vendor=omron
+ ;;
+ -genix*)
+ vendor=ns
+ ;;
+ -mvs*)
+ vendor=ibm
+ ;;
+ -ptx*)
+ vendor=sequent
+ ;;
+ -vxsim* | -vxworks*)
+ vendor=wrs
+ ;;
+ -aux*)
+ vendor=apple
+ ;;
+ esac
+ basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+ ;;
+esac
+
+echo $basic_machine$os
diff --git a/configure.in b/configure.in
new file mode 100644
index 00000000..ac7287f1
--- /dev/null
+++ b/configure.in
@@ -0,0 +1,144 @@
+dnl
+Mnl Configure script for the Gnome library
+dnl
+
+AC_INIT(copyright.txt)
+AM_CONFIG_HEADER(config.h)
+
+AM_INIT_AUTOMAKE(libgtop, 0.01)
+
+AM_MAINTAINER_MODE
+
+AM_ACLOCAL_INCLUDE(macros)
+
+AC_CANONICAL_HOST
+
+AC_CHECK_TOOL(CC,gcc)
+AC_CHECK_TOOL(CXX,g++)
+AC_CHECK_TOOL(RANLIB,ranlib)
+AC_CHECK_TOOL(LD,ld)
+AC_CHECK_TOOL(AS,as)
+AC_CHECK_TOOL(AR,ar)
+AC_CHECK_TOOL(NM,nm)
+
+NM=`which $NM`
+export CC CXX RANLIB LD AS AR NM
+
+AC_LC_SYSDEPS
+
+GNOME_CHECK_GUILE
+
+if test x$ac_cv_guile_found = xyes ; then
+ guile_examples='third third_static third_linux'
+ guile_subdirs='guile'
+else
+ guile_examples=
+ guile_subdirs=
+fi
+AC_SUBST(guile_examples)
+AC_SUBST(guile_subdirs)
+
+AC_ISC_POSIX
+AC_PROG_CXX
+AC_PROG_CC
+AC_PROG_CPP
+AC_STDC_HEADERS
+AC_ARG_PROGRAM
+AM_PROG_LEX
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_MAKE_SET
+
+export cross_compiling
+AM_PROG_LIBTOOL
+
+GNOME_SUPPORT_CHECKS
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_C_INLINE
+AC_TYPE_OFF_T
+AC_TYPE_PID_T
+AC_TYPE_SIZE_T
+AC_STRUCT_ST_RDEV
+AC_HEADER_TIME
+AC_STRUCT_TM
+AC_TYPE_UID_T
+
+dnl For SunOS
+AC_CHECK_TYPE(ssize_t, int)
+AC_CHECK_HEADERS(memory.h)
+AC_CHECK_HEADERS(string.h strings.h, break)
+AC_REPLACE_FUNCS(strerror)
+AC_CHECK_LIB(kvm, kvm_open)
+
+dnl For DEC OSF1
+AC_CHECK_LIB(mach, vm_statistics)
+
+dnl Checks for library functions.
+AC_FUNC_ALLOCA
+AC_FUNC_MMAP
+AC_TYPE_SIGNAL
+AC_FUNC_STRFTIME
+AC_CHECK_FUNCS(getcwd gettimeofday getwd putenv strdup strtoul uname)
+
+ALL_LINGUAS=""
+AM_GNU_GETTEXT
+
+AC_SUBST(CFLAGS)
+AC_SUBST(CPPFLAGS)
+AC_SUBST(LDFLAGS)
+
+AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [default=no]],AC_DEFINE(GNOME_ENABLE_DEBUG),)
+
+LIBSUPPORT=
+SUPPORTINCS=
+if test "$need_libgtop_support" = yes; then
+ LIBSUPPORT='$(top_builddir)/support/libgtopsupport.la'
+ SUPPORTINCS='-I$(top_srcdir)/support'
+fi
+
+dnl These definitions are expanded in make.
+GTOP_LIBS='-L$(libdir) -lgtop_common -lgtop '
+GTOP_INCS='-I$(includedir) -I$(top_builddir) -I$(top_srcdir) -I$(top_srcdir)/include'
+GTOP_BINDIR='$(bindir)'
+GTOP_SERVER='$(bindir)/gtop_server'
+
+GTOP_INCS="$GTOP_INCS -I\$(top_srcdir)/intl -DGTOPLOCALEDIR=\\\"\$(datadir)/locale\\\""
+
+if test "x$use_glibtop_machine_h" = "xyes" ; then
+ GTOP_INCS="$GTOP_INCS -I\$(top_srcdir)/sysdeps/\$(sysdeps_dir)"
+fi
+
+if test "x$ac_cv_guile_found" = "xyes" ; then
+ GTOP_INCS="$GTOP_INCS $GUILE_INCS"
+ GTOP_LIBS="$GTOP_LIBS $GUILE_LIBS"
+fi
+
+AC_SUBST(GTOP_LIBS)
+AC_SUBST(GTOP_INCS)
+AC_SUBST(GTOP_BINDIR)
+AC_SUBST(GTOP_SERVER)
+
+AC_SUBST(LIBSUPPORT)
+AC_SUBST(SUPPORTINCS)
+
+AC_OUTPUT([
+Makefile
+po/Makefile.in
+intl/Makefile
+sysdeps/Makefile
+sysdeps/common/Makefile
+sysdeps/names/Makefile
+sysdeps/guile/Makefile
+sysdeps/guile/names/Makefile
+sysdeps/stub/Makefile
+sysdeps/sun4/Makefile
+sysdeps/osf1/Makefile
+sysdeps/linux/Makefile
+src/Makefile
+src/server/Makefile
+lib/Makefile
+examples/Makefile
+support/Makefile
+macros/Makefile],[sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])
diff --git a/copyright.txt b/copyright.txt
new file mode 100644
index 00000000..87356576
--- /dev/null
+++ b/copyright.txt
@@ -0,0 +1,21 @@
+/* $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. */
+
diff --git a/doc/.cvsignore b/doc/.cvsignore
new file mode 100644
index 00000000..9af57b1c
--- /dev/null
+++ b/doc/.cvsignore
@@ -0,0 +1,15 @@
+*.shml
+.timestamp
+dbtohtml-1.shtml
+dbtohtml-2.shtml
+dbtohtml-3.shtml
+dbtohtml.shtml
+libgtop-1.shtml
+libgtop-2.shtml
+libgtop-3.shtml
+libgtop-4.shtml
+libgtop-5.shtml
+libgtop-INDEX.shtml
+libgtop.ced
+libgtop.fot
+libgtop.shtml
diff --git a/doc/Makefile b/doc/Makefile
new file mode 100644
index 00000000..92f4f866
--- /dev/null
+++ b/doc/Makefile
@@ -0,0 +1,6 @@
+all: .timestamp
+
+.timestamp: libgtop.sgml
+ jade -D /usr/lib/sgml/jade_dsl -d libgtop.dsl -t sgml \
+ -V %no-make-index% libgtop.sgml > /dev/null
+ touch .timestamp
diff --git a/doc/catalog b/doc/catalog
new file mode 100644
index 00000000..76a78096
--- /dev/null
+++ b/doc/catalog
@@ -0,0 +1,3 @@
+PUBLIC "-//James Clark//DTD DSSSL Flow Object Tree//EN" "fot.dtd"
+PUBLIC "ISO/IEC 10179:1996//DTD DSSSL Architecture//EN" "dsssl.dtd"
+PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" "style-sheet.dtd"
diff --git a/doc/libgtop.dsl b/doc/libgtop.dsl
new file mode 100755
index 00000000..5947abc6
--- /dev/null
+++ b/doc/libgtop.dsl
@@ -0,0 +1,1627 @@
+<!doctype style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN">
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;
+; dbtohtml.dsl - DSSSL style sheet for DocBook to HTML conversion (jadeware)
+;
+; Author : Mark Burton (markb@ordern.com)
+; Created On : Fri Jun 13 18:21:14 1997
+; Last Modified By: Mark Burton
+; Last Modified On: Thu Jul 10 21:58:53 1997
+;
+; $Id$
+;
+; Usage:
+;
+; jade -d dbtohtml.dsl -t sgml yourdoc.sgm
+;
+; Additional command line options:
+;
+; -V %no-split-output% sends all the output to one file
+; -V %no-make-index% disables index creation
+; -V %no-make-toc% disables TOC creation
+; -V %no-shade-screen% disables grey background to SCREEN regions
+; -V %show-comments% includes contents of COMMENT regions
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; Contributors
+
+; Mark Eichin (eichin@cygnus.com)
+; Jason Molenda (crash@cygnus.co.jp)
+; Mark Galassi (rosalia@cygnus.com)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; Parameterisation
+
+; This style sheet can easily be parameterised by the use of a driver.
+; Here is a simple example that sets the output file basename and directory.
+; If the driver is foo.dsl, use: jade -d foo.dsl -t sgml yourdoc.sgm
+
+<!--
+
+<!doctype style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
+<!ENTITY dbtohtml.dsl SYSTEM "dbtohtml.dsl" CDATA DSSSL >
+]>
+
+<style-specification id="foodbtohtml" use="dbtohtml">
+
+(define %output-basename% "foo")
+(define %output-directory% "foodir")
+
+</style-specification>
+
+<external-specification id="dbtohtml" document="dbtohtml.dsl">
+
+-->
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; declare non-standard functions
+
+(declare-flow-object-class element
+ "UNREGISTERED::James Clark//Flow Object Class::element")
+(declare-flow-object-class empty-element
+ "UNREGISTERED::James Clark//Flow Object Class::empty-element")
+(declare-flow-object-class document-type
+ "UNREGISTERED::James Clark//Flow Object Class::document-type")
+(declare-flow-object-class processing-instruction
+ "UNREGISTERED::James Clark//Flow Object Class::processing-instruction")
+(declare-flow-object-class entity
+ "UNREGISTERED::James Clark//Flow Object Class::entity")
+(declare-flow-object-class entity-ref
+ "UNREGISTERED::James Clark//Flow Object Class::entity-ref")
+(declare-flow-object-class formatting-instruction
+ "UNREGISTERED::James Clark//Flow Object Class::formatting-instruction")
+
+(declare-characteristic preserve-sdata?
+ "UNREGISTERED::James Clark//Characteristic::preserve-sdata?" #f)
+;;
+;; try setting this to true to see if ISO character entities get translated
+;;(declare-characteristic preserve-sdata?
+;; "UNREGISTERED::James Clark//Characteristic::preserve-sdata?" #t)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; variables
+
+(define %no-split-output% #f)
+(define %no-make-toc% #f)
+(define %no-make-index% #f)
+(define %no-shade-screen% #f)
+(define %show-comments% #f)
+(define %shade-width% "100%") ; width or #f
+(define %email-element% "TT") ; font changing element or #f
+
+(define %html-public-id% "-//W3C//DTD HTML 3.2 Final//EN")
+(define %body-bgcolor% "white")
+(define %output-directory% ".")
+(define %output-basename% "libgtop")
+(define %output-suffix% ".shtml")
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; top-level sections
+
+(define (book-common)
+ (cond (%no-split-output% ; everything goes in one file
+ (make-file (string-append %output-basename% %output-suffix%)
+ (make sequence
+ (process-children)
+ (cond ((not %no-make-index%)
+ (make sequence
+ (make-fat-rule)
+ (make-index)))
+ (#t (empty-sosofo))))))
+ (#t ; split output into separate files
+ (make sequence
+ (make-file (string-append %output-basename% %output-suffix%)
+ (make sequence
+ (process-first-descendant "TITLE")
+ (process-first-descendant "BOOKINFO")))
+ (process-matching-children "PREFACE"
+ "CHAPTER"
+ "APPENDIX"
+ "BIBLIOGRAPHY"
+ "GLOSSARY"
+ "ARTHEADER")
+ (cond ((not %no-make-index%)
+ (make-file (string-append %output-basename%
+ "-INDEX"
+ %output-suffix%)
+ (make-index)))
+ (#t (empty-sosofo)))))))
+
+(element BOOK (book-common))
+
+(define generator-version
+ "Generated from Docbook 3.0 DTD, dbtohtml.dsl version $Revision$")
+
+(define (make-file file-name content)
+ (make entity
+ system-id: (string-append %output-directory% "/" file-name)
+ (make sequence
+ (make document-type
+ name: "html"
+ public-id: %html-public-id%)
+ (make formatting-instruction data: "<")
+ (make formatting-instruction data: "!--")
+ (literal generator-version)
+ (make formatting-instruction data: "-->
+")
+ (make element
+ gi: "html"
+ (make sequence
+ (make element
+ gi: "head"
+ (make sequence
+ (make empty-element gi: "link"
+ attributes: (list (list "rel" "stylesheet")
+ (list "type" "text/css")
+ (list "href" "/style/docbook.css")))
+ (make empty-element gi: "meta"
+ attributes: (list (list "name" "generator")
+ (list "content" generator-version)))
+ (make empty-element gi: "meta"
+ attributes: (list (list "name" "ObjectType")
+ (list "content" "book")))
+ (make element
+ gi: "title"
+ (with-mode extract-title-text
+ (process-first-descendant "title")))))
+ (make element
+ gi: "body"
+ attributes: (list (list "bgcolor" %body-bgcolor%))
+ (make sequence
+ (make-anchor)
+ content
+ (make-footer)
+ (make formatting-instruction data: "<")
+ (make formatting-instruction data: "!--#include virtual=\"/includes/docbook_footer\"")
+ (make formatting-instruction data: "-->"))))))))
+
+(define (make-footer)
+ (let ((copyright (select-elements (descendants (book-node))
+ '("COPYRIGHT" "BOOKINFO"))))
+ (cond ((node-list-empty? copyright) (empty-sosofo))
+ (#t (make sequence
+ (make-fat-rule)
+ (process-node-list copyright))))))
+
+(define (node-list-last nl)
+ (node-list-ref nl (- (node-list-length nl) 1)))
+
+(define (make-nav-links parent-gi)
+ (make sequence
+ (make empty-element
+ gi: "P")
+ (make element
+ gi: "A"
+ attributes: (list (list "href" (link-file-name (ancestor parent-gi))))
+ (literal "Up"))
+ (literal " ")
+ (if (absolute-last-sibling?)
+ (empty-sosofo)
+ (make element
+ gi: "A"
+ attributes: (list (list "href"
+ (link-file-name (node-list-first
+ (follow (current-node))))))
+ (literal "Forward")))
+ (literal " ")
+ (if (absolute-first-sibling?)
+ (empty-sosofo)
+ (make element
+ gi: "A"
+ attributes: (list (list "href"
+ (link-file-name (node-list-last
+ (preced (current-node))))))
+ (literal "Back")))
+ (make empty-element
+ gi: "P")))
+
+(define (make-pref-chap-app)
+ (cond (%no-split-output%
+ (make sequence
+ (make-anchor)
+ (make-fat-rule)
+ (process-children)))
+ (#t
+ (make-file (link-file-name (current-node))
+ (make sequence
+ (make-nav-links "BOOK")
+ (process-children)
+ (make-nav-links "BOOK"))))))
+
+;;(element ARTICLE (process-children))
+(element ARTICLE (book-common))
+
+(element PREFACE (make-pref-chap-app))
+
+(element CHAPTER (make-pref-chap-app))
+
+(element APPENDIX (make-pref-chap-app))
+
+(element BEGINPAGE (make sequence
+ (make empty-element gi: "P")
+ (make empty-element gi: "HR")))
+
+(element BIBLIOGRAPHY (make-pref-chap-app))
+
+(element BOOKBIBLIO (process-children))
+
+(element BIBLIODIV (process-children))
+
+(element GLOSSARY (make-pref-chap-app))
+
+; (element GLOSSDIV (make-pref-chap-app))
+
+;;(element ARTHEADER (make-pref-chap-app))
+(element ARTHEADER
+ (make sequence
+ (cond ((not %no-make-toc%)
+ (make sequence
+ (make-fat-rule)
+ (make element
+ gi: "h2"
+ attributes: (list "align" "center")
+ (literal "Contents"))
+ (make element
+ gi: "ul"
+ attributes: (list "align" "center")
+ (with-mode make-toc-links
+ (process-node-list (book-node))))))
+ (#t (empty-sosofo)))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; sections
+
+(element SECT1
+ (make sequence
+ (make-anchor)
+ (process-children)))
+
+(element SECT2
+ (make sequence
+ (make-anchor)
+ (process-children)))
+
+(element SECT3
+ (make sequence
+ (make-anchor)
+ (process-children)))
+
+(element SECT4
+ (make sequence
+ (make-anchor)
+ (process-children)))
+
+(element SECT5
+ (make sequence
+ (make-anchor)
+ (process-children)))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; titles
+
+(mode extract-title-text
+ (element (TITLE)
+ (process-children)))
+
+(mode extract-title-text
+ (element (BRIDGEHEAD)
+ (process-children)))
+
+(element (BOOK TITLE)
+ (make element
+ gi: "h1"
+ attributes: (list "align" "center")
+ (process-children)))
+
+(element (ARTICLE TITLE)
+ (make element
+ gi: "h1"
+ attributes: (list "align" "center")
+ (process-children)))
+
+(element (CHAPTER TITLE)
+ (make sequence
+ (make element
+ gi: "h1"
+ (make sequence
+ (literal (chap-app-head-label "Chapter"))
+ (process-children-trim)))))
+
+(element (PREFACE TITLE)
+ (make element
+ gi: "h1"
+ (make sequence
+ (literal "Preface: ")
+ (process-children-trim))))
+
+(element (APPENDIX TITLE)
+ (make element
+ gi: "H1"
+ (make sequence
+ (literal (chap-app-head-label "Appendix"))
+ (process-children-trim))))
+
+(element (BIBLIOGRAPHY TITLE)
+ (make element gi: "H1"
+ (make sequence
+ (literal (chap-app-head-label "Bibliography"))
+ (process-children-trim))))
+
+(element (BOOKBIBLIO TITLE)
+ (make element gi: "H2"
+ (make sequence
+;;; (literal (chap-app-head-label "Bibliography"))
+ (process-children-trim))))
+
+(element (BIBLIODIV TITLE)
+ (make element gi: "H2"
+ (make sequence
+ (process-children-trim))))
+
+(element (GLOSSARY TITLE)
+ (make element gi: "H1"
+ (make sequence
+ (literal "Glossary")
+; (process-children-trim)
+)))
+
+(element (GLOSSDIV TITLE)
+ (make element gi: "H2"
+ (process-children-trim)))
+
+(element (ARTHEADER TITLE)
+ (make element gi: "H1"
+ (process-children-trim)))
+
+(element (ARTHEADER DATE)
+ (make element gi: "P"))
+
+(element (ARTHEADER SUBTITLE)
+ (make element
+ gi: "H2"
+ (make element
+ gi: "i"
+ (process-children-trim)
+ )))
+
+(element (SECT1 TITLE) (make element gi: "H2"))
+
+(element (SECT2 TITLE) (make element gi: "H3"))
+
+(element (SECT3 TITLE) (make element gi: "H4"))
+
+(element (SECT4 TITLE) (make element gi: "H5"))
+
+(element (SECT5 TITLE) (make element gi: "H6"))
+
+(element (FORMALPARA TITLE) (make element gi: "H6"))
+
+(element BRIDGEHEAD (make element gi: "H4"))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; font changers
+
+(element EMPHASIS
+ (make element gi: "EM"))
+
+(element TYPE
+ (make element gi: "STRONG"
+ (make element gi: "TT")))
+
+(element TOKEN
+ (make element gi: "EM"
+ (make element gi: "STRONG"
+ (make element gi: "TT"))))
+
+(element REPLACEABLE (make element gi: "EM"))
+
+(element FIRSTTERM (make element gi: "EM"))
+
+(element APPLICATION (make element gi: "TT"))
+
+(element FILENAME (make element gi: "TT"))
+
+(element LITERAL (make element gi: "TT"))
+
+(element GUIMENU (make element gi: "TT"))
+(element GUIMENUITEM (make element gi: "TT"))
+
+(element ENVAR (make element gi: "TT"))
+
+(element SUBSCRIPT (make element gi: "SUB"))
+
+(element SUPERSCRIPT (make element gi: "SUP"))
+
+(element CITATION (process-children))
+(element CITETITLE (make element gi: "I"))
+
+(element COMMAND (make element gi: "TT"))
+
+(element STRUCTFIELD (make element gi: "TT"))
+
+(element OPTION (make element gi: "TT"))
+
+(element USERINPUT (make element gi: "TT"))
+
+(element COMPUTEROUTPUT (make element gi: "TT"))
+
+(element PROMPT (make element gi: "TT"))
+
+(element PRODUCTNAME (make element gi: "I"))
+
+(element SGMLTAG (make element gi: "TT"))
+(element CLASSNAME (make element gi: "TT"))
+(element SYMBOL (make element gi: "TT"))
+(element LITERALLAYOUT (make element gi: "PRE"))
+(element PROGRAMLISTING (make element gi: "PRE"))
+
+(element FOREIGNPHRASE (make element gi: "I"))
+
+;; I think that title abbreviations don't really have a place in HTML.
+;; The only place in which I can imagine them being useful is if the
+;; HTML secret title (the one that goes in your bookmarks and stuff)
+;; is derived from the DocBook title abbrev
+;;
+;; (element ABBREV (process-children-trim))
+(element ABBREV (empty-sosofo))
+(element TITLEABBREV (empty-sosofo))
+
+(element EMAIL
+ (if %email-element%
+ (make element
+ gi: %email-element%
+ (process-children-trim))
+ (process-children-trim)))
+
+(element QUOTE
+ (make sequence
+ (make entity-ref
+ name: "quot")
+ (process-children-trim)
+ (make entity-ref
+ name: "quot")))
+
+(element ADDRESS
+ (make element
+ gi: "address"
+ (make element
+ gi: "em"
+ (process-children-trim))))
+
+(element (ADDRESS CITY)
+ (make sequence
+ (make empty-element
+ gi: "BR")
+ (process-children-trim)))
+
+(element (ADDRESS COUNTRY)
+ (make sequence
+ (make empty-element
+ gi: "BR")
+ (process-children-trim)))
+
+(element (ADDRESS EMAIL)
+ (make sequence
+ (make empty-element
+ gi: "BR")
+ ;; Now throw some space between street address and the email
+ ;; address. Sadly, the only way I know how to do it in HTML is to
+ ;; throw in an empty paragraph tag.
+ (make empty-element
+ gi: "spacer"
+ attributes: '(("align" "vertical") ("size" "10")))
+ (if %email-element%
+ (make element
+ gi: %email-element%
+ (process-children-trim))
+ (process-children-trim))))
+
+(element (ADDRESS FAX)
+ (make sequence
+ (make empty-element
+ gi: "BR")
+ (process-children-trim)))
+
+(element (ADDRESS OTHERADDR)
+ (make sequence
+ (make empty-element
+ gi: "BR")
+ (process-children-trim)))
+
+(element (ADDRESS POB)
+ (make sequence
+ (make empty-element
+ gi: "BR")
+ (process-children-trim)))
+
+(element (ADDRESS PHONE)
+ (make sequence
+ (make empty-element
+ gi: "BR")
+ (process-children-trim)))
+
+(element (ADDRESS POSTCODE)
+ (process-children-trim))
+
+(element (ADDRESS STATE)
+ (process-children-trim))
+
+(element (ADDRESS STREET)
+ (make sequence
+ (make empty-element
+ gi: "BR")
+ (process-children-trim)))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; paragraph like things
+
+(element CAUTION (make-special-para))
+
+(element IMPORTANT (make-special-para))
+
+(element WARNING (make-special-para))
+
+(element NOTE (make-special-para))
+
+(element TIP (make-special-para))
+
+(element EXAMPLE (make-special-para))
+
+(element INFORMALEXAMPLE
+ (make element
+ gi: "BLOCKQUOTE"))
+
+(element COMMENT
+ (cond (%show-comments%
+ (make element
+ gi: "FONT"
+ attributes: '(("color" "red"))
+ (make-special-para)))
+ (#t (empty-sosofo))))
+
+(element PARA
+ (make sequence
+ (make empty-element
+ gi: "P")
+ (with-mode footnote-ref
+ (process-children))
+ (with-mode footnote-def
+ (process-matching-children "FOOTNOTE"))))
+
+(element BLOCKQUOTE (make element gi: "BLOCKQUOTE"))
+
+(element SCREEN
+ (let ((gubbins (make element
+ gi: "PRE"
+ (process-children))))
+ (make sequence
+ (make empty-element
+ gi: "P")
+ (if %no-shade-screen%
+ gubbins
+ (make element
+ gi: "TABLE"
+ attributes: (append (list '("border" "0")
+ '("bgcolor" "#E0E0E0"))
+ (if %shade-width%
+ (list (list "width" %shade-width%))
+ '()))
+ (make element
+ gi: "TR"
+ (make element
+ gi: "TD"
+ gubbins)))))))
+
+(element FORMALPARA (process-children))
+
+(element PHRASE (maybe-bold-children))
+
+(mode footnote-ref
+ (element FOOTNOTE
+ (make sequence
+ (literal "[")
+ (literal (format-number (element-number (current-node)) "1"))
+ (literal "]"))))
+
+(mode footnote-def
+ (element FOOTNOTE
+ (make element
+ gi: "BLOCKQUOTE"
+ (make sequence
+ (literal "[")
+ (literal (format-number (element-number (current-node)) "1"))
+ (literal "]")
+ (process-children)))))
+
+(element (CAUTION TITLE)
+ (make element
+ gi: "H5"))
+
+(element (IMPORTANT TITLE)
+ (make element
+ gi: "H5"))
+
+(element (WARNING TITLE)
+ (make element
+ gi: "H5"))
+
+(element (NOTE TITLE)
+ (make element
+ gi: "H5"))
+
+(element (TIP TITLE)
+ (make element
+ gi: "H5"))
+
+(element (EXAMPLE TITLE)
+ (make element
+ gi: "H5"))
+
+(element (BIBLIOENTRY TITLE)
+ (make element
+ gi: "H3"))
+
+(element (BIBLIOENTRY PAGENUMS)
+ (make sequence
+ (literal "Pages: ")
+ (make element gi: "I")))
+
+(element (BIBLIOENTRY DATE)
+ (make sequence
+ (literal " Date: ")
+ (make element gi: "I")))
+
+(element (BIBLIOENTRY VOLUMENUM)
+ (make sequence
+ (literal " Volume: ")
+ (make element gi: "I")))
+
+(element (BIBLIOENTRY SERIESINFO) (process-children))
+
+(element (BIBLIOENTRY SERIESINFO TITLE)
+ (make element gi: "H4"))
+
+(element (BIBLIOENTRY BIBLIOMISC)
+ (make sequence
+ (literal " other: ")
+ (process-children)))
+
+; the para inside does the work, here...
+(element (BIBLIOENTRY ABSTRACT) (process-children))
+
+;; an article'sabstract is centered text
+(element ABSTRACT
+ (make sequence
+ (make empty-element gi: "HR")
+ (make element
+ gi: "H2"
+ (literal "Abstract"))
+ (make element
+ gi: "DIV"
+ attributes: (list (list "align" "left"))
+ (make element gi: "BLOCKQUOTE"
+ (process-children)))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; lists
+
+(element ITEMIZEDLIST
+ (make sequence
+ (make empty-element
+ gi: "P")
+ (make element
+ gi: "UL")))
+
+(element ORDEREDLIST
+ (make sequence
+ (make empty-element
+ gi: "P")
+ (make element
+ gi: "OL")))
+
+(element PROCEDURE
+ (make sequence
+ (make empty-element
+ gi: "P")
+ (make element
+ gi: "OL")))
+
+(element SIMPLELIST
+ (make sequence
+ (make empty-element
+ gi: "P")
+ (make element
+ gi: "UL")))
+
+(element (ITEMIZEDLIST LISTITEM)
+ (make sequence
+ (make empty-element
+ gi: "LI")
+ (process-children)
+ (make empty-element
+ gi: "P")))
+
+(element (ORDEREDLIST LISTITEM)
+ (make sequence
+ (make empty-element
+ gi: "LI")
+ (process-children)
+ (make empty-element
+ gi: "P")))
+
+(element STEP
+ (make sequence
+ (make empty-element
+ gi: "LI")
+ (process-children)
+ (make empty-element
+ gi: "P")))
+
+(element (SIMPLELIST MEMBER)
+ (make sequence
+ (make empty-element
+ gi: "LI")
+ (process-children)))
+
+(element VARIABLELIST
+ (make sequence
+ (make empty-element
+ gi: "P")
+ (make element
+ gi: "DL")))
+
+(element VARLISTENTRY
+ (make sequence
+ (make empty-element
+ gi: "DT")
+ (process-children)))
+
+(element (VARLISTENTRY LISTITEM)
+ (make sequence
+ (make empty-element
+ gi: "DD")
+ (process-children)
+ (make empty-element
+ gi: "P")))
+
+(element TERM (maybe-bold-children))
+
+(element GLOSSDIV
+ (make sequence
+ (make empty-element
+ gi: "P")
+ (make element
+ gi: "DL")))
+
+; (define (gloss-entry-name indexterm)
+; (string-append "gloss." (format-number (element-number indexterm) "1")))
+(define (gloss-entry-name glossterm)
+ (string-append "gloss." (data glossterm)))
+
+(element GLOSSENTRY
+ (process-children))
+
+(element (GLOSSENTRY GLOSSTERM)
+ (make sequence
+ (make empty-element
+ gi: "DT")
+ (make empty-element
+ gi: "A"
+ attributes: (list (list "name" (gloss-entry-name (current-node)))))
+ (process-children)))
+
+
+(element (GLOSSENTRY GLOSSDEF)
+ (make sequence
+ (make empty-element
+ gi: "DD")
+ (process-children)
+ (make empty-element
+ gi: "P")))
+
+(element (GLOSSENTRY GLOSSSEE)
+ (make sequence
+ (make empty-element
+ gi: "DD")
+ (literal "See ")
+ (make element
+ gi: "A"
+ attributes: (list (list "href"
+ (string-append "#"
+ (gloss-entry-name (current-node)))
+ )))
+ (make empty-element
+ gi: "P")))
+
+; (element GLOSSTERM (maybe-bold-children))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; index
+
+(define (index-entry-name indexterm)
+ (string-append "index." (format-number (element-number indexterm) "1")))
+
+(element INDEXTERM
+ (make sequence
+ (make element
+ gi: "A"
+ attributes: (list (list "name" (index-entry-name (current-node))))
+ (literal ""))
+ (empty-sosofo)))
+
+; DIY string-ci>?
+
+(define (string-ci>? s1 s2)
+ (let ((len1 (string-length s1))
+ (len2 (string-length s2)))
+ (let loop ((i 0))
+ (cond ((= i len1) #f)
+ ((= i len2) #t)
+ (#t (let ((c1 (index-char-val (string-ref s1 i)))
+ (c2 (index-char-val (string-ref s2 i))))
+ (cond
+ ((= c1 c2) (loop (+ i 1)))
+ (#t (> c1 c2)))))))))
+
+(define (index-char-val ch)
+ (case ch
+ ((#\A #\a) 65)
+ ((#\B #\b) 66)
+ ((#\C #\c) 67)
+ ((#\D #\d) 68)
+ ((#\E #\e) 69)
+ ((#\F #\f) 70)
+ ((#\G #\g) 71)
+ ((#\H #\h) 72)
+ ((#\I #\i) 73)
+ ((#\J #\j) 74)
+ ((#\K #\k) 75)
+ ((#\L #\l) 76)
+ ((#\M #\m) 77)
+ ((#\N #\n) 78)
+ ((#\O #\o) 79)
+ ((#\P #\p) 80)
+ ((#\Q #\q) 81)
+ ((#\R #\r) 82)
+ ((#\S #\s) 83)
+ ((#\T #\t) 84)
+ ((#\U #\u) 85)
+ ((#\V #\v) 86)
+ ((#\W #\w) 87)
+ ((#\X #\x) 88)
+ ((#\Y #\y) 89)
+ ((#\Z #\z) 90)
+
+ ((#\ ) 32)
+
+ ((#\0) 48)
+ ((#\1) 49)
+ ((#\2) 50)
+ ((#\3) 51)
+ ((#\4) 52)
+ ((#\5) 53)
+ ((#\6) 54)
+ ((#\7) 55)
+ ((#\8) 56)
+ ((#\9) 57)
+
+ ; laziness precludes me from filling this out further
+ (else 0)))
+
+(define (string->number-list s)
+ (let loop ((i (- (string-length s) 1))
+ (l '()))
+ (if (< i 0)
+ l
+ (loop (- i 1) (cons (index-char-val (string-ref s i)) l)))))
+
+(define (number-list>? l1 l2)
+ (cond ((null? l1) #f)
+ ((null? l2) #t)
+ ((= (car l1) (car l2))
+ (number-list>? (cdr l1) (cdr l2)))
+ (#t (> (car l1) (car l2)))))
+
+; return the string data for a given index entry
+
+(define (get-index-entry-data entry)
+ (let ((primary (select-elements (descendants entry) "PRIMARY"))
+ (secondary (select-elements (descendants entry) "SECONDARY")))
+ (if (node-list-empty? secondary)
+ (data primary)
+ (string-append (data primary) " - " (data secondary)))))
+
+(define (make-index-entry entry)
+ (let ((text (get-index-entry-data entry)))
+ (cons text
+ (make sequence
+ (make empty-element
+ gi: "LI")
+ (make element
+ gi: "A"
+ attributes: (list (list "href"
+ (string-append (link-file-name
+ entry)
+ "#"
+ (index-entry-name
+ entry))))
+ (literal text))))))
+
+(define (build-index nl)
+ (let loop ((result '())
+ (nl nl))
+ (if (node-list-empty? nl)
+ result
+ (loop (cons (make-index-entry (node-list-first nl)) result)
+ (node-list-rest nl)))))
+
+(define (sort-index il)
+ (letrec ((list-head (lambda (l n)
+ (if (> n 0)
+ (cons (car l) (list-head (cdr l) (- n 1)))
+ '())))
+ (merge (lambda (il1 il2)
+ (cond ((null? il1) il2)
+ ((null? il2) il1)
+ ((string-ci>? (car (car il1)) (car (car il2)))
+ (cons (car il2) (merge il1 (cdr il2))))
+ (#t
+ (cons (car il1) (merge (cdr il1) il2)))))))
+ (let* ((ll (length il))
+ (ldiv2 (quotient ll 2)))
+ (if (> 2 ll)
+ il
+ (merge (sort-index (list-head il ldiv2))
+ (sort-index (list-tail il ldiv2)))))))
+
+(define (output-index il)
+ (let extract-and-append ((il il)
+ (result (empty-sosofo)))
+ (if (null? il)
+ result
+ (extract-and-append (cdr il) (sosofo-append result (cdr (car il)))))))
+
+(define (make-index)
+ (make sequence
+ (make element
+ gi: "A"
+ attributes: (list (list "name" "INDEXTOP"))
+ (literal ""))
+ (make element
+ gi: "H1"
+ (literal "Index"))
+ (make element
+ gi: "UL"
+ (output-index
+ (sort-index
+ (build-index (select-elements (descendants (current-node))
+ "INDEXTERM")))))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; links & cross-references
+
+(define (link-file-name target)
+ (cond (%no-split-output% "")
+ (#t
+ (string-append
+ %output-basename%
+ (cond ((equal? (gi target) "CHAPTER")
+ (string-append
+ "-"
+ (format-number (child-number target) "1")))
+ ((ancestor-child-number "CHAPTER" target)
+ (string-append
+ "-"
+ (format-number (ancestor-child-number "CHAPTER" target) "1")))
+ ((equal? (gi target) "APPENDIX")
+ (string-append
+ "-"
+ (format-number (child-number target) "A")))
+ ((ancestor-child-number "APPENDIX" target)
+ (string-append
+ "-"
+ (format-number (ancestor-child-number "APPENDIX" target) "A")))
+ (#t ""))
+ %output-suffix%))))
+
+(element ANCHOR
+ (make-anchor))
+
+(element LINK
+ (let* ((target (element-with-id (attribute-string "linkend")
+ (book-node)))
+ (target-file-name (link-file-name target))
+ (endterm (attribute-string "endterm"))
+ (target-title-sosofo (if endterm
+ (with-mode extract-xref-text
+ (process-node-list
+ (element-with-id endterm
+ (book-node))))
+ (process-children))))
+ (make element
+ gi: "A"
+ attributes: (list
+ (list "href"
+ (string-append
+ target-file-name
+ "#"
+ (attribute-string "linkend"))))
+ target-title-sosofo)))
+(element ULINK
+ (make element
+ gi: "A"
+ attributes: (list
+ (list "href" (attribute-string "url")))))
+
+(element XREF
+ (let* ((target (element-with-id (attribute-string "LINKEND")
+ (book-node)))
+ (target-file-name (link-file-name target)))
+ (make element
+ gi: "A"
+ attributes: (list
+ (list "href"
+ (string-append target-file-name
+ "#"
+ (attribute-string "linkend"))))
+ (with-mode extract-xref-text
+ (process-node-list target)))))
+
+(mode extract-xref-text
+ (default
+ (let ((title-sosofo (with-mode extract-title-text
+ (process-first-descendant "TITLE"))))
+ (if (sosofo? title-sosofo)
+ title-sosofo
+ (literal (string-append "Reference to " (gi)))))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; figures
+
+(element FIGURE
+ (make sequence
+ (make empty-element
+ gi: "P")
+ (make-anchor)
+ (process-children)
+ (make empty-element
+ gi: "P")))
+
+(element (FIGURE TITLE)
+ (make sequence
+ (make element
+ gi: "B")
+ (make empty-element
+ gi: "P")))
+
+(element GRAPHIC
+ (let ((img
+ (make sequence
+ (make empty-element
+ gi: "P")
+ (make empty-element
+ gi: "IMG"
+ attributes: (list
+ (list "src"
+ (string-append (attribute-string "fileref")
+ ".gif")))))))
+ (if (equal?
+ (attribute-string "align")
+ "CENTER")
+ (make element
+ gi: "CENTER"
+ img)
+ img)))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; tables
+
+(element TABLE
+ (make sequence
+ (make empty-element
+ gi: "P")
+ (make element
+ gi: "TABLE"
+ attributes: (if (equal?
+ (attribute-string "frame")
+ "ALL")
+ '(("border" "2") ("cellpadding" "2"))
+ '()))
+ (make empty-element
+ gi: "P")))
+
+(element (TABLE TITLE)
+ (make element
+ gi: "H4"
+ (make sequence
+ (literal "Table: ")
+ (process-children-trim))))
+
+(element INFORMALTABLE
+ (make sequence
+ (make empty-element
+ gi: "P")
+ (make element
+ gi: "TABLE"
+ attributes: (if (equal?
+ (attribute-string "frame")
+ "ALL")
+ '(("border" "2") ("cellpadding" "2"))
+ '()))
+ (make empty-element
+ gi: "P")))
+
+(element TGROUP (process-children))
+
+(element THEAD (process-children))
+
+(element (THEAD ROW)
+ (make sequence
+ (make empty-element
+ gi: "TR")
+ (process-children)))
+
+(element (THEAD ROW ENTRY)
+ (make sequence
+ (make empty-element
+ gi: "TD")
+ (make element
+ gi: "B"
+ (process-children))))
+
+(element TBODY (process-children))
+
+(element (TBODY ROW)
+ (make sequence
+ (make empty-element
+ gi: "TR")
+ (process-children)))
+
+
+(element (TBODY ROW ENTRY)
+ (make sequence
+ (make empty-element
+ gi: "TD")
+ (process-children)))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; book info
+
+(element BOOKINFO
+ (make sequence
+ (make element
+ gi: "CENTER"
+ (process-children))
+ (cond ((not %no-make-toc%)
+ (make sequence
+ (make-fat-rule)
+ (make element
+ gi: "H2"
+ (literal "Contents"))
+ (make element
+ gi: "ul"
+ (with-mode make-toc-links
+ (process-node-list (book-node))))))
+ (#t (empty-sosofo)))))
+
+(element (BOOKINFO DATE)
+ (make element gi: "P"))
+
+(element (BOOKINFO TITLE)
+ (make element gi: "H1"))
+
+(element (BOOKINFO SUBTITLE)
+ (make element
+ gi: "H2"
+ (make element
+ gi: "i"
+ (process-children-trim)
+ )))
+
+(element AUTHORGROUP
+ (let ((reducer (lambda (sofar new)
+ (sosofo-append sofar (make element
+ gi: "H2"
+ (process-node-list new))))))
+ (make sequence
+ (node-list-reduce (select-elements (descendants (current-node)) "AUTHOR")
+ reducer
+ (empty-sosofo))
+ (node-list-reduce (select-elements (descendants (current-node)) "EDITOR")
+ reducer
+ (empty-sosofo))
+ (node-list-reduce (select-elements (descendants (current-node)) "CORPAUTHOR")
+ reducer
+ (empty-sosofo)))))
+
+;; I make a new left-aligned DIV sandwiched between HRs for the author
+;; blurb.
+(element AUTHORBLURB
+ (make sequence
+ (make empty-element gi: "HR")
+ (make element
+ gi: "DIV"
+ attributes: '(("align" "left"))
+ (make element
+ gi: "h4"
+ attributes: '(("align" "left"))
+ (literal "Author blurb for ")
+ (make element
+ gi: "i"
+ (process-matching-children "TITLE")
+ (literal ":")))
+ (process-matching-children "FORMALPARA" "PARA" "SIMPARA"))
+ (make empty-element gi: "HR")))
+
+(element (AUTHORBLURB TITLE)
+ (make element gi: "B"))
+
+(element CORPNAME
+ (make element gi: "H2"))
+
+(element (BIBLIOENTRY AUTHORGROUP)
+ (let ((reducer (lambda (sofar new)
+ (sosofo-append sofar (make element
+ gi: "H3"
+ (process-node-list new))))))
+ (make sequence
+ (node-list-reduce (select-elements (descendants (current-node)) "AUTHOR")
+ reducer
+ (empty-sosofo))
+ (node-list-reduce (select-elements (descendants (current-node)) "EDITOR")
+ reducer
+ (empty-sosofo))
+ (node-list-reduce (select-elements (descendants (current-node)) "CORPAUTHOR")
+ reducer
+ (empty-sosofo)))))
+
+(element COPYRIGHT
+ (make element
+ gi: "H4"
+ (make sequence
+ (make entity-ref
+ name: "copy")
+ (process-matching-children "HOLDER")
+ (process-matching-children "YEAR"))))
+
+(element HOLDER
+ (make sequence
+ (literal " ")
+ (process-children-trim)))
+
+(element YEAR
+ (make sequence
+ (literal " ")
+ (process-children-trim)))
+
+(element CORPAUTHOR
+ (process-children-trim))
+
+(element AUTHOR
+ (process-children-trim))
+
+(element EDITOR
+ (process-children-trim))
+
+(element CONFGROUP
+ (process-children-trim))
+
+(element CONFTITLE
+ (make sequence
+ (make empty-element
+ gi: "BR")
+ (make element gi: "I" (process-children))))
+
+(element CONFDATES
+ (make sequence
+ (make empty-element
+ gi: "BR")
+ (process-children)))
+
+(element HONORIFIC
+ (make sequence
+ (process-children-trim)
+ (literal " ")))
+
+(element FIRSTNAME
+ (make sequence
+ (process-children-trim)
+ (literal " ")))
+
+(element OTHERNAME
+ (make sequence
+ (process-children-trim)
+ (literal " ")))
+
+(element SURNAME
+ (make sequence
+ (process-children-trim)
+ (literal " ")))
+
+(element LINEAGE
+ (make sequence
+ (process-children-trim)
+ (literal " ")))
+
+(element TRADEMARK (process-children))
+
+(element PUBLISHERNAME (process-children))
+
+(element BIBLIOENTRY (process-children))
+
+(element ACRONYM (process-children))
+
+(element RELEASEINFO
+ (make sequence
+ (make empty-element
+ gi: "BR")
+ (make element gi: "B")))
+
+(element AFFILIATION
+ (make sequence
+ (make element
+ gi: "I")))
+
+(element ORGNAME
+ (make sequence
+ (make empty-element
+ gi: "BR")
+ (process-children)))
+
+;;(element ORGNAME
+;; (process-children))
+
+(element JOBTITLE
+ (make sequence
+ (make empty-element
+ gi: "BR")
+ (process-children)))
+
+(element ORGDIV
+ (make sequence
+ (make empty-element
+ gi: "BR")
+ (process-children)))
+
+(element PUBLISHER
+ (make sequence
+ (make empty-element
+ gi: "BR")
+ (process-children)))
+
+(element ISBN
+ (make sequence
+ (make empty-element
+ gi: "BR")
+ (process-children)))
+
+(element PUBDATE
+ (make sequence
+ (make empty-element
+ gi: "BR")
+ (process-children)))
+
+(element REVHISTORY
+ (empty-sosofo))
+
+(element LEGALNOTICE
+ (make sequence
+ (make element
+ gi: "H4"
+ attributes: '(("align" "left"))
+ (literal "Legal Notice: "))
+ (make element
+ gi: "DIV"
+ attributes: '(("align" "left")))))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; Synopses for command line, API functions and so forth
+;;(element FUNCSYNOPSIS
+;; (process-children))
+
+(element FUNCSYNOPSIS
+ (make sequence
+ (make empty-element gi: "P") ; go to a new line
+ ;; just in case there is some synopsisinfo, like #include directives
+ (process-matching-children "FUNCSYNOPSISINFO")
+ (make empty-element gi: "P") ; go to a new line
+ (process-matching-children "FUNCDEF") ; this gives the function name
+ (literal " (")
+ (process-matching-children "PARAMDEF") ; this gives the function arguments
+ (literal ")")
+ ))
+
+(element FUNCDEF
+ (make element gi: "TT"))
+
+(element FUNCTION
+ (make element gi: "B"))
+
+(element STRUCTNAME
+ (make element gi: "B"))
+
+(element FUNCSYNOPSISINFO
+ (make element
+ gi: "PRE"))
+
+(element PARAMDEF
+ (make element
+ gi: "TT"))
+
+(element PARAMETER
+ (make element
+ gi: "I"))
+
+(element FUNCPROTOTYPE
+ (make element
+ gi: "PRE"))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; TOC
+
+(element LOF (empty-sosofo))
+
+(element LOT (empty-sosofo))
+
+(element TOC (empty-sosofo))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; DIY TOC
+
+(mode make-toc-links
+ (element (BOOK)
+ (sosofo-append
+ (process-children)
+ (cond ((not %no-make-index%)
+ (make sequence
+ (make empty-element
+ gi: "LI")
+ (make element
+ gi: "A"
+ attributes: (list (list "href"
+ (cond (%no-split-output% "#INDEXTOP")
+ (#t
+ (string-append %output-basename%
+ "-INDEX"
+ %output-suffix%
+ "#INDEXTOP")))))
+ (literal "Index"))))
+ (#t (empty-sosofo)))))
+ (element (CHAPTER)
+ (make-chap-or-app-toc-links))
+ (element (APPENDIX)
+ (make-chap-or-app-toc-links))
+ (element (SECT1)
+ (make sequence
+ (make empty-element
+ gi: "LI")
+ (let ((title-text (with-mode extract-title-text
+ (process-first-descendant "TITLE"))))
+ (if (id)
+ (make element
+ gi: "A"
+ attributes: (list (list "href" (string-append (link-file-name (current-node))
+ "#"
+ (id))))
+ title-text)
+ title-text))))
+ (default
+ (empty-sosofo)))
+
+(define (make-chap-or-app-toc-links)
+ (make sequence
+ (make empty-element
+ gi: "LI")
+ (let ((title-text
+ (make sequence
+ (literal (if (equal? (gi) "CHAPTER")
+ (string-append "Chapter "
+ (format-number
+ (element-number (current-node))
+ "1")
+ " - ")
+ (string-append "Appendix "
+ (format-number
+ (element-number (current-node))
+ "A")
+ " - ")))
+ (with-mode extract-title-text
+ (process-first-descendant "TITLE")))))
+ (if (id)
+ (make element
+ gi: "A"
+ attributes: (list (list "href" (string-append (link-file-name (current-node))
+ "#"
+ (id))))
+ title-text)
+ title-text))
+ (make element
+ gi: "UL"
+ (with-mode make-toc-links
+ (process-matching-children "SECT1")))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; make the unimplemented bits stand out
+
+(default
+ (make element
+ gi: "FONT"
+ attributes: '(("color" "red"))
+ (make sequence
+ (literal (string-append "<" (gi) ">"))
+ (process-children)
+ (literal (string-append "</" (gi) ">")))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; standard subroutines
+
+(define (node-list-reduce nl combine init)
+ (if (node-list-empty? nl)
+ init
+ (node-list-reduce (node-list-rest nl)
+ combine
+ (combine init (node-list-first nl)))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; various homebrew subroutines
+
+(define (book-node)
+ (cond ((equal? (gi) "BOOK") (current-node))
+ (#t (let ((book-root (ancestor "BOOK")))
+ (if (node-list-empty? book-root)
+ (cond ((equal? (gi) "CHAPTER") (current-node))
+ (#t (ancestor "CHAPTER")))
+ book-root)))))
+
+(define (make-fat-rule)
+ (make sequence
+ (make empty-element gi: "P")
+ (make empty-element gi: "HR")))
+
+(define (chap-app-head-label chap-or-app)
+ (let ((label
+ (attribute-string "label" (ancestor chap-or-app))))
+ (string-append
+ chap-or-app
+ " "
+ (if label
+ (if (equal? label "auto")
+ (format-number
+ (element-number (ancestor chap-or-app))
+ (if (equal? chap-or-app "Chapter") "1" "A"))
+ label)
+ (format-number
+ (element-number (ancestor chap-or-app))
+ (if (equal? chap-or-app "Chapter") "1" "A")))
+ ". ")))
+
+(define (make-anchor)
+ (if (id)
+ (make element
+ gi: "A"
+ attributes: (list (list "name" (id)))
+ (literal ""))
+ (empty-sosofo)))
+
+(define (make-special-para)
+ (make sequence
+ (make empty-element
+ gi: "P")
+ (make element
+ gi: "B"
+ (literal (string-append (gi) ":")))
+ (make element
+ gi: "BLOCKQUOTE"
+ (process-children))))
+
+(define (maybe-bold-children)
+ (cond ((equal? (attribute-string "role")
+ "bold")
+ (make element
+ gi: "B"
+ (process-children-trim)))
+ (#t (process-children-trim))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; the end
diff --git a/doc/libgtop.sgml b/doc/libgtop.sgml
new file mode 100644
index 00000000..0b3eec6d
--- /dev/null
+++ b/doc/libgtop.sgml
@@ -0,0 +1,1332 @@
+<!-- $Id$ -->
+
+<!doctype book PUBLIC "-//Davenport//DTD DocBook V3.0//EN" [
+]>
+<book>
+ <bookinfo>
+ <title>GTop Library Project Documentation</title>
+ <authorgroup>
+ <author>
+ <firstname>Martin</firstname>
+ <surname>Baulig</surname>
+ <affiliation>
+ <address>
+ <email>martin@home-of-linux.org</email>
+ </address>
+ </affiliation>
+ </author>
+ </authorgroup>
+ <copyright>
+ <year>1998</year>
+ <holder>Martin Baulig</holder>
+ </copyright>
+ <legalnotice>
+
+ <para>
+ This documentation is free software; you can redistribute
+ it and/or modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later
+ version.
+
+ <para>
+ This 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 General Public License for more
+ details.
+
+ <para>
+ You should have received a copy of the GNU General Public
+ License along with this program; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ MA 02111-1307 USA
+
+ <para>
+ For more details see the file COPYING in the source
+ distribution of LibGTop.</para>
+
+ </legalnotice>
+ </bookinfo>
+
+ <toc></toc>
+
+ <chapter id="intro">
+ <title>Introduction</title>
+
+ <sect1 id="about">
+ <title>About the GTop Library Project</title>
+
+ <para>
+ On some systems like <emphasis/Solaris/ or <emphasis/SunOS/ every
+ program that wants to fetch information like those displayed in
+ <emphasis/GTop/ needs to be SGID kmem or even SUID root. This is
+ because either it has to access the kernel memory directly or
+ because the system only allows root to fetch those information
+ (like <emphasis>DEC OSF/1</emphasis>).
+
+ <para>
+ Of cause making a program that uses some toolkit like <emphasis/Gtk/
+ SUID root would be a very big security hole.
+
+ <para>
+ Because of this, some kind of server is needed that reada some
+ commands from standard input and dumps the requested information
+ to standard output. When written in a secure manner, it can be
+ SUID root on systems where this is needed.
+
+ <para>
+ Any program such as <emphasis/GTop/ can then use this server program
+ to fetch the required information.
+
+ <para>
+ This is what the <emphasis/GTop Library Project/ is about.
+
+ <sect1 id="steps">
+ <title>Project Overview</title>
+
+ <para>
+ The following steps have to be taken:
+
+ <variablelist>
+
+ <varlistentry>
+ <term>Interface Design
+ <listitem>
+
+ <para>
+ First, it is necessary to collect all sorts of information
+ that can be returned from the library and design some C
+ structures to hold them. Also, there has to be some method
+ to find out which elements are supported by the operating
+ system and which are not.
+
+ <para>
+ These C structures and definitions are then put in some
+ header files which are shared between server and client.
+ The idea behind this is that if they both use the same
+ header files - and thus the same interface - programs can
+ be linked directly with the server library on systems where
+ this is supported (where the server does not need any
+ priviledges such as under <emphasis/Linux/).
+
+ <varlistentry>
+ <term>Server Implementation
+ <listitem>
+
+ <para>
+ After the general interface is designed, the server part of
+ the library can be written. We will put both the server and
+ the client code in two distinct libraries.
+
+ <varlistentry>
+ <term>Client Implementation
+ <listitem>
+
+ <para>
+ As the next step, we can implement the client side library.
+ This library will open a pipe to the server, pass it the
+ request as input and parse its output.
+
+ <varlistentry>
+ <term>Rewriting existing applications
+ <listitem>
+
+ <para>
+ At this point, the library is ready for use. We can now
+ begin to rewrite existing applications to use it (or even
+ write some very new applications).
+
+ <varlistentry>
+ <term>Porting
+ <listitem>
+
+ <para>
+ As the very last step - once everything is running under
+ <emphasis/Linux/ - we can start porting it to other systems.
+
+ <para>
+ During development, I'll start under <emphasis/Linux/ but
+ periodically test it under <emphasis/SunOS/ and
+ <emphasis>DEC OSF/1 V3.0/3.2</emphasis>.
+
+ </variablelist>
+
+ <sect1 id="feedback">
+ <title>Feedback</title>
+
+ <para>
+ Please feel free to contact the author,
+ <ulink url="mailto:martin@home-of-linux.org">Martin Baulig</ulink>
+ if you have any comments.
+
+ <chapter id="getting-started">
+ <title>Getting Started</title>
+
+ <sect1 id="using-guile-interface">
+ <title>Using the Guile Interface</title>
+
+ <para>
+ In <filename>examples/third</filename> there is a simple guile
+ interpreter.
+
+ <para>
+ On Linux systems, you should use the <filename>third_linux</filename>
+ executable, this is statically linked with the system dependent library
+ and works without installing the server first.
+
+ <para>
+ Let's start with a simple example:
+
+ <screen>
+ <prompt>$</prompt> <userinput>./third</userinput>
+ <prompt>guile></prompt> <userinput>(glibtop-get-cpu)</userinput>
+ (1107488 39049 0 21981 1046458)
+ <prompt>guile></prompt> <userinput>(quit)</userinput>
+ </screen>
+
+ <para>
+ Fine, this is our current CPU usage, but what do this five numbers
+ really mean? Well, of cause one can look a the C header file:
+
+ <programlisting>
+ typedef struct _glibtop_cpu glibtop_cpu;
+
+ struct _glibtop_cpu
+ {
+ unsigned long flags,
+ total, /* GLIBTOP_CPU_TOTAL */
+ user, /* GLIBTOP_CPU_USER */
+ nice, /* GLIBTOP_CPU_NICE */
+ sys, /* GLIBTOP_CPU_SYS */
+ idle; /* GLIBTOP_CPU_IDLE */
+ };
+ </programlisting>
+
+ <para>
+ But there's also some easier way:
+
+ <screen>
+ <prompt>$</prompt> <userinput>./third_linux</userinput>
+ <prompt>guile></prompt> <userinput>(glibtop-get-cpu)</userinput>
+ (1604151 105343 0 63334 1435474)
+ <prompt>guile></prompt> <userinput>(glibtop-names-cpu)</userinput>
+ ("total" "user" "nice" "sys" "idle")
+ <prompt>guile></prompt> <userinput>(quit)</userinput>
+ </screen>
+
+ <para>
+ This displays the field names of the C structure
+ <structname>glibtop_cpu</structname>. They are not translated into
+ native language so that one can use guile to generate some C code
+ that deals with this data.
+
+ <para>
+ If you want to use this names in an application program, you should
+ use the following:
+
+ <screen>
+ <prompt>$</prompt> <userinput>./third_linux</userinput>
+ <prompt>guile></prompt> <userinput>(glibtop-get-cpu)</userinput>
+ (1642347 106696 0 63810 1471841)
+ <prompt>guile></prompt> <userinput>(glibtop-labels-cpu)</userinput>
+ ("total" "user" "nice" "sys" "idle")
+ <prompt>guile></prompt> <userinput>(quit)</userinput>
+ </screen>
+
+ <para>
+ There's no difference? You're correct, while I'm writing this manual,
+ translations in other languaged have not yet been made and labels have
+ not been written.
+
+ <para>
+ Let's use another example where this is already working:
+
+ <screen>
+ <prompt>$</prompt> <userinput>./third_linux</userinput>
+ <prompt>guile></prompt> <userinput>(glibtop-get-shm_limits)</userinput>
+ (33554432 1 128 128 4194304)
+ <prompt>guile></prompt> <userinput>(glibtop-names-shm_limits)</userinput>
+ ("shmmax" "shmmin" "shmmni" "shmseg" "shmall")
+ <prompt>guile></prompt> <userinput>(glibtop-labels-shm_limits)</userinput>
+ ("Max segment size" "Min segment size" "Max number of segments"
+ "Max shared segments per process" "Max total shared memory")
+ <prompt>guile></prompt> <userinput>(quit)</userinput>
+ </screen>
+
+ <para>
+ Great! But how can I know what features are currently implemented by the
+ library? Well, basically there are two ways.
+
+ <para>
+ First, you can use
+
+ <screen>
+ <prompt>$</prompt> <userinput>./third_linux</userinput>
+ <prompt>guile></prompt> <userinput>(apropos "glibtop-get")</userinput>
+ the-root-module: glibtop-get-cpu #&lt;primitive-procedure glibtop-get-cpu>
+ the-root-module: glibtop-get-uptime #&lt;primitive-procedure glibtop-get-uptime>
+ the-root-module: glibtop-get-sysdeps #&lt;primitive-procedure glibtop-get-sysdeps>
+ the-root-module: glibtop-get-loadavg #&lt;primitive-procedure glibtop-get-loadavg>
+ the-root-module: glibtop-get-swap #&lt;primitive-procedure glibtop-get-swap>
+ the-root-module: glibtop-get-proclist #&lt;primitive-procedure glibtop-get-proclist>
+ the-root-module: glibtop-get-sem_limits #&lt;primitive-procedure glibtop-get-sem_limits>
+ the-root-module: glibtop-get-msg_limits #&lt;primitive-procedure glibtop-get-msg_limits>
+ the-root-module: glibtop-get-shm_limits #&lt;primitive-procedure glibtop-get-shm_limits>
+ the-root-module: glibtop-get-mem #&lt;primitive-procedure glibtop-get-mem>
+ <prompt>guile></prompt> <userinput>(quit)</userinput>
+ </screen>
+
+ <para>
+ This gives you a basic idea which functions are defined in the library.
+ But there's also a better way:
+
+ <screen>
+ <prompt>$</prompt> <userinput>./third_linux</userinput>
+ <prompt>guile></prompt> <userinput>(glibtop-get-sysdeps)</userinput>
+ (31 127 7 3 1 31 127 1023 3)
+ <prompt>guile></prompt> <userinput>(glibtop-names-sysdeps)</userinput>
+ ("cpu" "mem" "swap" "uptime" "loadavg" "shm_limits" "msg_limits" "sem_limits"
+ "proclist")
+ <prompt>guile></prompt> <userinput>(glibtop-labels-sysdeps)</userinput>
+ ("CPU Usage" "Memory Usage" "Swap Usage" "System Uptime" "Load Averange"
+ "Shared Memory Limits" "Message Queue Limits" "Semaphore Set Limits"
+ "List of running Processes")
+ <prompt>guile></prompt> <userinput>(quit)</userinput>
+ </screen>
+
+ <para>
+ Back to the <function>glibtop_get_cpu</function>. Here is a nice example
+ on how you can convert the returned data to percents:
+
+ <para>
+ [FIXME: not yet written]
+
+ <sect1 id="guile-sysdeps">
+ <title>Using system dependent features</title>
+
+ <para>
+ Some of the features of the library are only implemented on some systems.
+ For instance, in our last example:
+
+ <screen>
+ <prompt>guile></prompt> <userinput>(glibtop-get-cpu)</userinput>
+ (2091847 130894 17 70602 1890334)
+ </screen>
+
+ <para>
+ Well fine - some process is running with nice now on my system - but in
+ the last section, we always got zero in the <structfield>nice</structfield>
+ field. When some feature is not implemented on a particular system, it is
+ set to zero. So how can we find out whether a feature is not implemented on
+ the current system or whether it is really zero all the time?
+
+ <para>
+ This is what the <structfield>flags</structfield> member of the C structure
+ is for. Since theese flags never change during the lifetime of a process,
+ on can call <function>glibtop_get_sysdeps</function> to get a structure
+ <structname>glibtop_sysdeps</structname> containing the
+ <structfield>flags</structfield> members of all currently available features.
+ The contents of the structure remains constant during the lifetime of a
+ process.
+
+ <para>
+ In guile, on can use <function>glibgtop-get-sysdeps</function>, too:
+
+ <screen>
+ <prompt>guile></prompt> <userinput>(glibtop-get-sysdeps)</userinput>
+ (31 127 7 3 1 31 127 1023 3)
+ </screen>
+
+ <para>
+ We already know that the first member of this list corresponds to
+ <structname>glibtop_cpu</structname>. So this <literal>31</literal>
+ tells us which features of <structname>glibtop_cpu</structname> are
+ implemented on this systems. The binary representation of
+ <literal>31</literal> is <literal>11111</literal>. If the lowest bit
+ of this constant is set, this means that the first list element is
+ implemented on the current system and so on. If, for instance, the
+ <structname>user</structname> member of <structname>glibtop_cpu</structname>
+ is not implemented, this constant will be <literal>11101</literal>
+ or <literal>29</literal> in decimal representation.
+
+ <sect1 id="c-basics">
+<title>Using the library in a C program</title>
+
+<para>
+Well, in C things are a little bit more complicated than in guile.
+Let's start with a very simple example:
+
+<example>
+<title>First steps</title>
+
+<programlisting>
+#include &lt;glibtop/open.h>
+#include &lt;glibtop/close.h>
+
+#include &lt;glibtop/cpu.h>
+
+int
+main (int argc, char *argv [])
+{
+ glibtop server;
+ glibtop_cpu cpu;
+
+ glibtop_open (&amp;server, argv [0]);
+
+ glibtop_get_cpu (&amp;server, &amp;cpu);
+
+ fprintf (stderr, "CPU: %lu, %lu, %lu, %lu, %lu\n",
+ cpu.total, cpu.user, cpu.nice, cpu.sys, cpu.idle);
+
+ glibtop_close (&amp;server);
+}
+</programlisting>
+</example>
+
+<para>
+This will print out:
+
+<screen>
+<prompt>$</prompt> <userinput>./first_linux</userinput>
+CPU: 2262741, 136828, 17, 72569, 2053327
+</screen>
+
+<para>
+Make sure to open a connection to the server by a call to
+<function>glibtop_open</function> before calling any other function
+of the library and to close that connection upon termination by a call to
+<function>glibtop_close</function>. Otherwise your program may either
+not work correctly or simply dump core.
+
+<sect1 id="c-names">
+<title>Using names and labels in C</title>
+
+<para>
+To dump out the field names of <structname>glibtop_cpu</structname>:
+
+<example>
+<title>Dump field names of <structname>glibtop_cpu</structname>:
+
+<programlisting>
+#include &lt;glibtop/open.h>
+#include &lt;glibtop/close.h>
+
+#include &lt;glibtop/cpu.h>
+
+int
+main (int argc, char *argv [])
+{
+ fprintf (stderr, "CPU Names: %s, %s, %s, %s, %s\n",
+ glibtop_names_cpu [GLIBTOP_CPU_TOTAL],
+ glibtop_names_cpu [GLIBTOP_CPU_USER],
+ glibtop_names_cpu [GLIBTOP_CPU_NICE],
+ glibtop_names_cpu [GLIBTOP_CPU_SYS],
+ glibtop_names_cpu [GLIBTOP_CPU_IDLE]);
+}
+</programlisting>
+</example>
+
+<para>
+Since this are constants, they also work without the server connection.
+
+<para>
+To dump all members of <structname>glibtop_cpu</structname> no matter
+how many there are:
+
+<example>
+<title>Dump all members of <structname>glibtop_cpu</structname> no matter
+how many</title>
+
+<programlisting>
+#include &lt;glibtop/open.h>
+#include &lt;glibtop/close.h>
+
+#include &lt;glibtop/cpu.h>
+
+int
+main (int argc, char *argv [])
+{
+ int i;
+
+ for (i = 0; i < GLIBTOP_MAX_CPU; i++)
+ fprintf (stderr,"#%d: %s\n", i, glibtop_names_cpu [i]);
+}
+</programlisting>
+</example>
+
+<para>
+Finaly, let's dump the internationalized labels:
+
+<example>
+<title>Dump internationalized labels</title>
+
+<programlisting>
+#include &lt;glibtop.h>
+#include &lt;glibtop/open.h>
+#include &lt;glibtop/close.h>
+
+#include &lt;glibtop/cpu.h>
+
+int
+main (int argc, char *argv [])
+{
+ int i;
+
+ setlocale (LC_ALL, "");
+ bindtextdomain (PACKAGE, GTOPLOCALEDIR);
+ textdomain (PACKAGE);
+
+ for (i = 0; i < GLIBTOP_MAX_CPU; i++)
+ fprintf (stderr,"#%d: %s\n", i,
+ gettext (glibtop_labels_cpu [i]));
+}
+</programlisting>
+</example>
+
+<sect1 id="c-sysdeps">
+<title>Using system dependent features in C</title>
+
+<para>
+In C, there are some constants defined in the header files:
+
+<programlisting>
+#define GLIBTOP_CPU_TOTAL 0
+#define GLIBTOP_CPU_USER 1
+#define GLIBTOP_CPU_NICE 2
+#define GLIBTOP_CPU_SYS 3
+#define GLIBTOP_CPU_IDLE 4
+</programlisting>
+
+<para>
+The value used in the <structfield>flags</structfield> member to indicate
+whether some feature is implemented on the current system is always
+<literal>2</literal> at the power of the corresponding constant.
+
+<para>
+For instance, if you want to print out the <structfield>user</structfield>
+field of <structname>glibtop_cpu</structname> when it's implemented on the
+current system, you can use:
+
+<example><title>
+Only print <structfield>user</structfield> member of
+<structname>glibtop_cpu</structname> when it's implemented
+</title>
+
+<programlisting>
+#include &lt;glibtop/open.h>
+#include &lt;glibtop/close.h>
+
+#include &lt;glibtop/cpu.h>
+
+int
+main (int argc, char *argv [])
+{
+ glibtop server;
+ glibtop_cpu cpu;
+
+ glibtop_open (&amp;server, argv [0]);
+
+ glibtop_get_cpu (&amp;server, &amp;cpu);
+
+ fprintf (stderr, "CPU: %lu, ", cpu.total);
+
+ /* FIXME: is this correct? */
+
+ if (cpu.flags & (1 << GLIBTOP_CPU_USER))
+ fprintf (stderr, "%lu, ", cpu.user);
+
+ fprintf (stderr, "%lu, %lu, %lu\n", cpu.nice, cpu.sys, cpu.idle);
+
+ glibtop_close (&amp;server);
+}
+</programlisting>
+</example>
+
+<chapter id="hacker-guide">
+<title>Hacker's Guide</title>
+
+<sect1 id="extending">
+<title>Extending the Library</title>
+
+<para>
+This section will give you a step by step tutorial on how to extend the
+library to add a new feature. It is not yet really complete.
+
+<sect2 id="extending-header">
+<title>The Header File</title>
+
+<para>
+First, we'll start writing the C header file for our new feature we want
+to add. Currently there is no support for getting information about a
+particular process, so we'll add it here.
+
+<para>
+All header files are put into <filename>includes/glibtop</filename> and
+are named after the feature they define. So we'll put everything into
+<filename>procdata.h</filename>:
+
+<example>
+<title>Start of <filename>procdata.h</filename>
+
+<programlisting>
+#ifndef __GLIBTOP_PROCDATA_H__
+#define __GLIBTOP_PROCDATA_H__
+
+#include &lt;glibtop.h>
+#include &lt;glibtop/global.h>
+</programlisting>
+</example>
+
+<para>
+This is how we start every header file. Make sure to include at lease
+<filename>glibtop.h</filename> and <filename>glibtop/global.h</filename>.
+They contain important declarations and include some other important
+header files.
+
+<para>
+Next, we look at the <filename>/proc</filename> filesystem of Linux to
+find out which information can be fetched about a particular process:
+
+<screen>
+<prompt>$</prompt> <userinput>cat /proc/self/stat</userinput>
+14919 (cat) R 14886 14919 14886 1220 14919 1048576 24 0 63 0 0 1 0 0 15 0 -1
+0 1915281 835584 67 2147483647 134512640 134527808 3221222564 3221222372
+1074212972 0 0 2147483648 0 0 0 0
+</screen>
+
+<para>
+Well, this is a rather complex example, but those are the most important
+information we need about a process. I think it would be best to start
+with the definition of the C structure
+<structname>glibtop_procdata</structname> that will be used to store all
+those information. We'll copy most from
+<filename>gnome-utils/gtop/proc/readproc.h</filename>:
+
+<example>
+<title>Definition of <structname>glibtop_procdata</structname>
+
+<programlisting>
+typedef struct _glibtop_procdata glibtop_procdata;
+
+struct _glibtop_procdata
+{
+ unsigned long flags;
+ char cmd[40], /* basename of executable file in call to exec(2) */
+ state; /* single-char code for process state (S=sleeping) */
+ int uid, /* user id */
+ pid, /* process id */
+ ppid, /* pid of parent process */
+ pgrp, /* process group id */
+ session, /* session id */
+ tty, /* full device number of controlling terminal */
+ tpgid, /* terminal process group id */
+ priority, /* kernel scheduling priority */
+ nice, /* standard unix nice level of process */
+ signal, /* mask of pending signals */
+ blocked, /* mask of blocked signals */
+ sigignore, /* mask of ignored signals */
+ sigcatch; /* mask of caught signals */
+ long start_time, /* start time of process -- seconds since 1-1-70 */
+ utime, /* user-mode CPU time accumulated by process */
+ stime, /* kernel-mode CPU time accumulated by process */
+ cutime, /* cumulative utime of process and reaped children */
+ cstime, /* cumulative stime of process and reaped children */
+ /* the next 7 members come from /proc/#/statm */
+ size, /* total # of pages of memory */
+ resident, /* number of resident set (non-swapped) pages (4k) */
+ share, /* number of pages of shared (mmap'd) memory */
+ trs, /* text resident set size */
+ lrs, /* shared-lib resident set size */
+ drs, /* data resident set size */
+ dt; /* dirty pages */
+ unsigned long vsize, /* number of pages of virtual memory ... */
+ rss, /* resident set size from /proc/#/stat */
+ rss_rlim, /* resident set size ... ? */
+ timeout, /* ? */
+ it_real_value, /* ? */
+ k_flags, /* kernel flags for the process */
+ min_flt, /* number of minor page faults since process start */
+ maj_flt, /* number of major page faults since process start */
+ cmin_flt, /* cumulative min_flt of process and child processes */
+ cmaj_flt, /* cumulative maj_flt of process and child processes */
+ start_code, /* address of beginning of code segment */
+ end_code, /* address of end of code segment */
+ start_stack, /* address of the bottom of stack for the process */
+ kstk_esp, /* kernel stack pointer */
+ kstk_eip, /* kernel stack pointer */
+ wchan; /* address of kernel wait channel proc is sleeping in */
+};
+</programlisting>
+</example>
+
+<para>
+For each field we now have to define an unique constant:
+
+<example>
+<title>Constant definitions for <structname>glibtop_procdata</structname>:</title>
+
+<programlisting>
+#define GLIBTOP_PROCDATA_CMD 0
+#define GLIBTOP_PROCDATA_STATE 1
+#define GLIBTOP_PROCDATA_UID 2
+#define GLIBTOP_PROCDATA_PID 3
+#define GLIBTOP_PROCDATA_PPID 4
+#define GLIBTOP_PROCDATA_PGRP 5
+#define GLIBTOP_PROCDATA_SESSION 6
+#define GLIBTOP_PROCDATA_TTY 7
+#define GLIBTOP_PROCDATA_TPGID 8
+#define GLIBTOP_PROCDATA_PRIORITY 9
+#define GLIBTOP_PROCDATA_NICE 10
+#define GLIBTOP_PROCDATA_SIGNAL 11
+#define GLIBTOP_PROCDATA_BLOCKED 12
+#define GLIBTOP_PROCDATA_SIGIGNORE 13
+#define GLIBTOP_PROCDATA_SIGCATCH 14
+#define GLIBTOP_PROCDATA_START_TIME 15
+#define GLIBTOP_PROCDATA_UTIME 16
+#define GLIBTOP_PROCDATA_STIME 17
+#define GLIBTOP_PROCDATA_CUTIME 18
+#define GLIBTOP_PROCDATA_CSTIME 19
+#define GLIBTOP_PROCDATA_SIZE 20
+#define GLIBTOP_PROCDATA_RESIDENT 21
+#define GLIBTOP_PROCDATA_SHARE 22
+#define GLIBTOP_PROCDATA_TRS 23
+#define GLIBTOP_PROCDATA_LRS 24
+#define GLIBTOP_PROCDATA_DRS 25
+#define GLIBTOP_PROCDATA_DT 26
+#define GLIBTOP_PROCDATA_VSIZE 27
+#define GLIBTOP_PROCDATA_RSS 28
+#define GLIBTOP_PROCDATA_RSS_RLIM 29
+#define GLIBTOP_PROCDATA_TIMEOUT 30
+#define GLIBTOP_PROCDATA_IT_REAL_VALUE 31
+#define GLIBTOP_PROCDATA_K_FLAGS 32
+#define GLIBTOP_PROCDATA_MIN_FLT 33
+#define GLIBTOP_PROCDATA_MAJ_FLT 34
+#define GLIBTOP_PROCDATA_CMIN_FLT 35
+#define GLIBTOP_PROCDATA_CMAJ_FLT 36
+#define GLIBTOP_PROCDATA_START_CODE 37
+#define GLIBTOP_PROCDATA_END_CODE 38
+#define GLIBTOP_PROCDATA_START_STACK 39
+#define GLIBTOP_PROCDATA_KSTK_ESP 40
+#define GLIBTOP_PROCDATA_KSTK_EIP 41
+#define GLIBTOP_PROCDATA_WCHAN 42
+
+#define GLIBTOP_MAX_PROCDATA 43
+</programlisting>
+</example>
+
+<para>
+Finally, we'll need some external definitions. They are discussed in detail
+later. Basically, you can copy them from any other header file and just
+change the names - in our example, we also have to add an additional
+parameter to <function>glibtop_get_procdata</function> and
+<function>glibtop_guile_get_procdata</function>:
+
+<example>
+<title>External definitions</title>
+
+<programlisting>
+extern void glibtop_get_procdata (glibtop *, glibtop_procdata *, pid_t);
+
+#ifdef HAVE_GUILE
+
+/* You need to link with -lgtop_guile to get this stuff here. */
+
+extern SCM glibtop_guile_get_procdata (SCM);
+
+#endif
+
+#ifdef GLIBTOP_GUILE_NAMES
+
+/* You need to link with -lgtop_guile_names to get this stuff here. */
+
+extern SCM glibtop_guile_names_procdata (void);
+extern SCM glibtop_guile_labels_procdata (void);
+extern SCM glibtop_guile_descriptions_procdata (void);
+
+#endif
+
+#ifdef GLIBTOP_NAMES
+
+/* You need to link with -lgtop_names to get this stuff here. */
+
+extern const char *glibtop_names_procdata [];
+extern const char *glibtop_labels_procdata [];
+extern const char *glibtop_descriptions_procdata [];
+
+#endif
+</programlisting>
+</example>
+
+<sect1 id="extendig-stub">
+<title>The Stub File</title>
+
+<para>
+The stub file is used when the library has not yet been ported to the
+system it is used on. It goes into <filename>sysdeps/stub</filename>
+and sets the whole structure <structname>glibtop_procdata</structname>
+to zero:
+
+<example>
+<title><filename>sysdeps/stub/procdata.c</filename></title>
+
+<programlisting>
+/* Provides detailed information about a process. */
+
+void
+glibtop_get_procdata (glibtop *server, glibtop_procdata *buf, pid_t pid)
+{
+ memset (buf, 0, sizeof (glibtop_procdata));
+}
+</programlisting>
+</example>
+
+<para>
+We'll see later how to port this stub to a particular operating system.
+At the moment it's enough to simply copy it to each of the other sysdeps
+directories (except for <filename>common</filename>,
+<filename>names</filename> and <filename>guile</filename>).
+
+<sect1 id="names">
+<title><filename>sysdeps/names</filename></title>
+
+<para>
+In <filename>sysdeps/names</filename>, we create the following file:
+
+<example>
+<title><filename>sysdeps/names/procdata.c</filename></title>
+
+<programlisting>
+#include &lt;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
+};
+</programlisting>
+</example>
+
+<sect1 id="extending-guile">
+<title>The Guile Interface</title>
+
+<para>
+The next step is to create the guile interface. It goes into
+<filename>sysdeps/guile</filename>:
+
+<example>
+<title><filename>sysdeps/guile/procdata.c</filename></title>
+
+<programlisting>
+SCM
+glibtop_guile_get_procdata (SCM pid)
+{
+ glibtop_procdata p;
+
+ glibtop_get_procdata (&amp;glibtop_global_server, &amp;p, (pid_t) gh_scm2long (pid));
+
+ return gh_list (gh_str02scm (p.cmd),
+ gh_char2scm (p.state),
+ 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),
+ gh_long2scm (p.signal),
+ gh_long2scm (p.blocked),
+ gh_long2scm (p.sigignore),
+ gh_long2scm (p.sigcatch),
+ gh_long2scm (p.utime),
+ gh_long2scm (p.stime),
+ gh_long2scm (p.cutime),
+ gh_long2scm (p.cstime),
+ gh_long2scm (p.size),
+ gh_long2scm (p.resident),
+ gh_long2scm (p.share),
+ gh_long2scm (p.trs),
+ gh_long2scm (p.lrs),
+ gh_long2scm (p.drs),
+ gh_long2scm (p.dt),
+ gh_ulong2scm (p.vsize),
+ gh_ulong2scm (p.rss),
+ gh_ulong2scm (p.rss_rlim),
+ gh_ulong2scm (p.timeout),
+ gh_ulong2scm (p.it_real_value),
+ 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.start_code),
+ gh_ulong2scm (p.end_code),
+ gh_ulong2scm (p.start_stack),
+ gh_ulong2scm (p.kstk_esp),
+ gh_ulong2scm (p.kstk_eip),
+ gh_ulong2scm (p.wchan),
+ SCM_UNDEFINED);
+}
+</programlisting>
+</example>
+
+<sect1 id="extending-guile-names">
+<title>Guile Names and Labels</title>
+
+<para>
+This is a little bit shorter again - all you have to do is copy one of
+the other files and change the names:
+
+<example>
+<title><filename>sysdeps/guile/names/procdata.c</filename></title>
+
+<programlisting>
+#include &lt;glibtop.h>
+#include &lt;glibtop/procdata.h>
+
+#include &lt;guile/gh.h>
+
+SCM
+glibtop_guile_names_procdata (void)
+{
+ int i;
+ SCM list;
+
+ list = gh_list (SCM_UNDEFINED);
+
+ for (i = 0; i < GLIBTOP_MAX_PROCDATA; i++)
+ list = gh_append2 (list, gh_list (gh_str02scm (glibtop_names_procdata [i]), SCM_UNDEFINED));
+
+ return list;
+}
+
+SCM
+glibtop_guile_labels_procdata (void)
+{
+ int i;
+ SCM list;
+
+ list = gh_list (SCM_UNDEFINED);
+
+ for (i = 0; i < GLIBTOP_MAX_PROCDATA; i++)
+ list = gh_append2 (list, gh_list (gh_str02scm (gettext (glibtop_labels_procdata [i])),
+ SCM_UNDEFINED));
+
+ return list;
+}
+</programlisting>
+</example>
+
+<sect1 id="extending-library">
+<title>The Library File</title>
+
+<para>
+The last one is the library file:
+
+<example>
+<title><filename>lib/procdata.c</filename></title>
+
+<programlisting>
+#include &lt;glibtop/procdata.h>
+#include &lt;glibtop/command.h>
+
+/* Provides detailed information about a process. */
+
+void
+glibtop_get_procdata (glibtop *server, glibtop_procdata *buf, pid_t pid)
+{
+ glibtop_call (server, GLIBTOP_CMND_PROCDATA, sizeof (pid_t), &amp;pid,
+ sizeof (glibtop_procdata), buf);
+}
+</programlisting>
+</example>
+
+<para>
+Make sure to define <literal>GLIBTOP_CMND_PROCDATA</literal> in
+<filename>command.h</filename>. The call to
+<function>glibtop_call</function> is simple - we send
+<parameter>pid</parameter> and its size and we get
+<parameter>buf</parameter> which is of type
+<structname>glibtop_procdata</structname>.
+
+<sect1 id="extending-sysdeps">
+<title>Sysdeps</title>
+
+<para>
+Finally, we add an entry to <filename>sysdeps.h</filename> and
+<filename>sysdeps.c</filename>:
+
+<example>
+<title><filename>includes/glibtop/sysdeps.h</filename></title>
+
+<programlisting>
+#include &lt;glibtop.h>
+#include &lt;glibtop/cpu.h>
+#include &lt;glibtop/mem.h>
+#include &lt;glibtop/swap.h>
+#include &lt;glibtop/uptime.h>
+#include &lt;glibtop/loadavg.h>
+#include &lt;glibtop/shm_limits.h>
+#include &lt;glibtop/msg_limits.h>
+#include &lt;glibtop/sem_limits.h>
+#include &lt;glibtop/proclist.h>
+#include &lt;glibtop/procdata.h>
+
+#define GLIBTOP_SYSDEPS_CPU 0
+#define GLIBTOP_SYSDEPS_MEM 1
+#define GLIBTOP_SYSDEPS_SWAP 2
+#define GLIBTOP_SYSDEPS_UPTIME 3
+#define GLIBTOP_SYSDEPS_LOADAVG 4
+#define GLIBTOP_SYSDEPS_SHM_LIMITS 5
+#define GLIBTOP_SYSDEPS_MSG_LIMITS 6
+#define GLIBTOP_SYSDEPS_SEM_LIMITS 7
+#define GLIBTOP_SYSDEPS_PROCLIST 8
+#define GLIBTOP_SYSDEPS_PROCDATA 9
+
+#define GLIBTOP_MAX_SYSDEPS 10
+
+typedef struct _glibtop_sysdeps glibtop_sysdeps;
+
+struct _glibtop_sysdeps
+{
+ unsigned long flags,
+ cpu, /* glibtop_cpu */
+ mem, /* glibtop_mem */
+ swap, /* glibtop_swap */
+ uptime, /* glibtop_uptime */
+ loadavg, /* glibtop_loadavg */
+ shm_limits, /* glibtop_shm_limits */
+ msg_limits, /* glibtop_msg_limits */
+ sem_limits, /* glibtop_sem_limits */
+ proclist, /* glibtop_proclist */
+ procdata; /* glibtop_procdata */
+};
+</programlisting>
+</example>
+
+<para>
+Just make sure to include <filename>procdata.h</filename>, to define
+<literal>GLIBTOP_SYSDEPS_PROCDATA</literal>, to increase
+<literal>GLIBTOP_MAX_SYSDEPS</literal> by one and to add to new element
+<structfield>procdata</structfield> to
+<structname>glibtop_sysdeps</structname>.
+
+<para>
+After that, add a <structfield>procdata</structfield> to
+<structname>glibtop_union</structname>
+(it's defined in <filename>union.h</filename>) and include
+<filename>procdata.h</filename> in that file:
+
+<example>
+<title><filename>include/glibtop/union.h</filename></title>
+
+<programlisting>
+#include &lt;glibtop/cpu.h>
+#include &lt;glibtop/mem.h>
+#include &lt;glibtop/swap.h>
+#include &lt;glibtop/uptime.h>
+#include &lt;glibtop/loadavg.h>
+#include &lt;glibtop/shm_limits.h>
+#include &lt;glibtop/msg_limits.h>
+#include &lt;glibtop/sem_limits.h>
+#include &lt;glibtop/proclist.h>
+#include &lt;glibtop/procdata.h>
+
+typedef union _glibtop_union glibtop_union;
+
+union _glibtop_union
+{
+ glibtop_cpu cpu;
+ glibtop_mem mem;
+ glibtop_swap swap;
+ glibtop_uptime uptime;
+ glibtop_loadavg loadavg;
+ glibtop_shm_limits shm_limits;
+ glibtop_msg_limits msg_limits;
+ glibtop_sem_limits sem_limits;
+ glibtop_proclist proclist;
+ glibtop_procdata procdata;
+};
+</programlisting>
+</example>
+
+<para>
+Now we can append the following to <function>glibtop_get_sysdeps</function>
+in <filename>sysdeps/common/sysdeps.c</filename>:
+
+<example><title>Add this at the end of
+<function>glibtop_get_sysdeps</function> in
+<filename>sysdeps/common/sysdeps.c</filename>
+</title>
+
+<programlisting>
+ glibtop_get_procdata (server, &amp;data.procdata, 0);
+ buf->procdata = data.procdata.flags;
+</programlisting>
+</example>
+
+<para>
+Also add the new name and label to <filename>sysdeps/names/sysdeps.c</filename>
+
+<sect1 id="extendig-server">
+<title>Adding the new command to the server</title>
+
+<para>
+We have to add the following <literal>switch</literal> case:
+
+<example><title>Add this to <filename>src/main.c</filename>:</title>
+
+<programlisting>
+ case GLIBTOP_CMND_PROCDATA:
+ if (sscanf (parameter, "%d", &amp;pid) != 1) pid = 0;
+ glibtop_get_procdata (&amp;server, &amp;data.procdata, pid);
+ glibtop_output (sizeof (glibtop_procdata), &amp;data.procdata);
+ glibtop_output (0, NULL);
+ break;
+</programlisting>
+</example>
+
+<sect1 id="extending-compile">
+<title>Compiling ...</title>
+
+<para>
+Now it's time to add <filename>procdata.c</filename> to the
+<filename>Makefile.am</filename> in each directory we added
+this file and run a <command>make</command>.
+
+<chapter id="interface-description">
+<title>Interface Description</title>
+
+<sect1 id="system-information-interface">
+<title>General information</title>
+
+<sect2 id="glibtop-cpu">
+<title><structname>glibtop_cpu</structname> - CPU usage</title>
+
+<programlisting>
+typedef struct _glibtop_cpu glibtop_cpu;
+
+struct _glibtop_cpu
+{
+ unsigned long flags,
+ total, /* GLIBTOP_CPU_TOTAL */
+ user, /* GLIBTOP_CPU_USER */
+ nice, /* GLIBTOP_CPU_NICE */
+ sys, /* GLIBTOP_CPU_SYS */
+ idle; /* GLIBTOP_CPU_IDLE */
+};
+</programlisting>
+
+<sect2 id="glibtop-mem">
+<title><structname>glibtop_mem</structname> - Memory usage</title>
+
+<programlisting>
+typedef struct _glibtop_mem glibtop_mem;
+
+struct _glibtop_mem
+{
+ unsigned long flags,
+ total, /* GLIBTOP_MEM_TOTAL */
+ used, /* GLIBTOP_MEM_USED */
+ free, /* GLIBTOP_MEM_FREE */
+ shared, /* GLIBTOP_MEM_SHARED */
+ buffer, /* GLIBTOP_MEM_BUFFER */
+ cached, /* GLIBTOP_MEM_CACHED */
+ user; /* GLIBTOP_MEM_USER */
+};
+</programlisting>
+
+<sect2 id="glibtop-swap">
+<title><structname>glibtop_swap</structname> - Swap usage</title>
+
+<programlisting>
+typedef struct _glibtop_swap glibtop_swap;
+
+struct _glibtop_swap
+{
+ unsigned long flags,
+ total, /* GLIBTOP_SWAP_TOTAL */
+ used, /* GLIBTOP_SWAP_USED */
+ free; /* GLIBTOP_SWAP_FREE */
+};
+</programlisting>
+
+<sect2 id="glibtop-uptime">
+<title><structname>glibtop_uptime</structname> - uptime and idletime</title>
+
+<programlisting>
+typedef struct _glibtop_uptime glibtop_uptime;
+
+struct _glibtop_uptime
+{
+ unsigned long flags;
+ double uptime, /* GLIBTOP_UPTIME_UPTIME */
+ idletime; /* GLIBTOP_UPTIME_IDLETIME */
+};
+</programlisting>
+
+<sect2 id="glibtop-loadavg">
+<title><structname>glibtop_loadavg</structname> - load averange</title>
+
+<programlisting>
+typedef struct _glibtop_loadavg glibtop_loadavg;
+
+struct _glibtop_loadavg
+{
+ unsigned long flags;
+ double loadavg [3]; /* GLIBTOP_LOADAVG_LOADAVG */
+};
+</programlisting>
+
+<chapter id="function-descriptions">
+<title>Function Descriptions</title>
+
+<sect1 id="open-and-close">
+<title>Opening and Closing</title>
+
+<para>
+Before you can use the library, you have to open a connection to the server.
+
+<sect2 id="glibtop-open">
+<title><function>glibtop_open()</function> - connect to server</title>
+
+<funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;glibtop.h>
+#include &lt;glibtop/open.h></funcsynopsisinfo>
+<funcdef>void <function>glibtop_open</function></funcdef>
+<paramdef>glibtop *<parameter>server</parameter>, const char *<parameter>program_name</parameter>
+</paramdef></funcsynopsis>
+
+<variablelist>
+<varlistentry>
+<term><replaceable class="parameter">server</replaceable>
+<listitem>
+
+<para>
+some data about the server (input and output pipes etc.) are stored here.
+
+<varlistentry>
+<term><replaceable class="parameter">program_name</replaceable>
+<listitem>
+
+<para>
+program name (used in error messages).
+</variablelist>
+
+<sect2 id="glibtop-close">
+<title><function>glibtop_close()</function> - close connection to server</title>
+
+<funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;glibtop.h>
+#include &lt;glibtop/close.h></funcsynopsisinfo>
+<funcdef>void <function>glibtop_close</function></funcdef>
+<paramdef>glibtop *<parameter>server</parameter>
+</paramdef></funcsynopsis>
+
+<variablelist>
+<varlistentry>
+<term><replaceable class="parameter">server</replaceable>
+<listitem>
+
+<para>
+the server you connected to.
+</variablelist>
+
+<sect2 id="glibtop-get-sysdeps">
+<title><function>glibtop_get_sysdeps()</function> - which features are implemented?</title>
+
+<funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;glibtop.h>
+#include &lt;glibtop/sysdeps.h></funcsynopsisinfo>
+<funcdef>void <function>glibtop_get_sysdeps</function></funcdef>
+<paramdef>glibtop *<parameter>server</parameter>, glibtop_sysdeps *<parameter>sysdeps</parameter>
+</paramdef></funcsynopsis>
+
+<sect1 id="system-information">
+<title>General information</title>
+
+<sect2 id="glibtop-get-cpu">
+<title><function>glibtop_get_cpu()</function> - get CPU usage</title>
+
+<funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;glibtop.h>
+#include &lt;glibtop/cpu.h></funcsynopsisinfo>
+<funcdef>void <function>glibtop_get_cpu</function></funcdef>
+<paramdef>glibtop *<parameter>server</parameter>, glibtop_cpu *<parameter>cpu_usage</parameter>
+</paramdef></funcsynopsis>
+
+<sect2 id="glibtop-get-mem">
+<title><function>glibtop_get_mem()</function> - get memory usage</title>
+
+<funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;glibtop.h>
+#include &lt;glibtop/mem.h></funcsynopsisinfo>
+<funcdef>void <function>glibtop_get_mem</function></funcdef>
+<paramdef>glibtop *<parameter>server</parameter>, glibtop_mem *<parameter>memory_usage</parameter>
+</paramdef></funcsynopsis>
+
+<sect2 id="glibtop-get-swap">
+<title><function>glibtop_get_swap()</function> - get swap usage</title>
+
+<funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;glibtop.h>
+#include &lt;glibtop/swap.h></funcsynopsisinfo>
+<funcdef>void <function>glibtop_get_swap</function></funcdef>
+<paramdef>glibtop *<parameter>server</parameter>, glibtop_swap *<parameter>swap_usage</parameter>
+</paramdef></funcsynopsis>
+
+<sect2 id="glibtop-get-uptime">
+<title><function>glibtop_get_uptime()</function> - get uptime and idle time</title>
+
+<funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;glibtop.h>
+#include &lt;glibtop/uptime.h></funcsynopsisinfo>
+<funcdef>void <function>glibtop_get_uptime</function></funcdef>
+<paramdef>glibtop *<parameter>server</parameter>, glibtop_uptime *<parameter>uptime</parameter>
+</paramdef></funcsynopsis>
+
+<sect2 id="glibtop-get-loadavg">
+<title><function>glibtop_get_loadavg()</function> - get load averange</title>
+
+<funcsynopsis>
+<funcsynopsisinfo>
+#include &lt;glibtop.h>
+#include &lt;glibtop/loadavg.h></funcsynopsisinfo>
+<funcdef>void <function>glibtop_get_loadavg</function></funcdef>
+<paramdef>glibtop *<parameter>server</parameter>, glibtop_loadavg *<parameter>loadavg</parameter>
+</paramdef></funcsynopsis>
+
+</book>
diff --git a/examples/.cvsignore b/examples/.cvsignore
new file mode 100644
index 00000000..d13bffe3
--- /dev/null
+++ b/examples/.cvsignore
@@ -0,0 +1,13 @@
+.deps
+.libs
+Makefile
+Makefile.in
+first
+first_linux
+first_static
+second
+third
+third_linux
+third_static
+second_static
+second_linux
diff --git a/examples/Makefile.am b/examples/Makefile.am
new file mode 100644
index 00000000..6c50866d
--- /dev/null
+++ b/examples/Makefile.am
@@ -0,0 +1,66 @@
+## Process this file with automake to produce Makefile.in
+
+LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
+
+INCLUDES = @GTOP_INCS@
+
+CFLAGS = -Wall -W @CFLAGS@
+
+DEFS = @DEFS@
+
+bin_PROGRAMS = first first_static first_linux \
+ second second_static second_linux \
+ @guile_examples@
+
+EXTRA_PROGRAMS = third third_static third_linux
+
+first_SOURCES = first.c
+first_LDADD = $(top_builddir)/sysdeps/common/libgtop_common.la \
+ $(top_builddir)/lib/libgtop.la \
+ @INTLLIBS@ @LIBSUPPORT@
+
+first_static_SOURCES = $(first_SOURCES)
+first_static_LDADD = $(first_LDADD)
+first_static_LDFLAGS = -static
+
+first_linux_SOURCES = $(first_SOURCES)
+first_linux_LDADD = $(top_builddir)/sysdeps/common/libgtop_common.la \
+ $(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
+ @INTLLIBS@ @LIBSUPPORT@
+first_linux_LDFLAGS = -static
+
+second_SOURCES = second.c
+second_LDADD = $(top_builddir)/sysdeps/common/libgtop_common.la \
+ $(top_builddir)/lib/libgtop.la \
+ @INTLLIBS@ @LIBSUPPORT@
+
+second_static_SOURCES = $(second_SOURCES)
+second_static_LDADD = $(second_LDADD)
+second_static_LDFLAGS = -static
+
+second_linux_SOURCES = $(second_SOURCES)
+second_linux_LDADD = $(top_builddir)/sysdeps/common/libgtop_common.la \
+ $(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
+ @INTLLIBS@ @LIBSUPPORT@
+second_linux_LDFLAGS = -static
+
+third_SOURCES = third.c
+third_LDADD = $(top_builddir)/sysdeps/guile/libgtop_guile.la \
+ $(top_builddir)/sysdeps/guile/names/libgtop_guile_names.la \
+ $(top_builddir)/sysdeps/names/libgtop_names.la \
+ $(top_builddir)/sysdeps/common/libgtop_common.la \
+ $(top_builddir)/lib/libgtop.la \
+ @GUILE_LIBS@ @INTLLIBS@ @LIBSUPPORT@
+
+third_static_SOURCES = $(third_SOURCES)
+third_static_LDADD = $(third_LDADD)
+third_static_LDFLAGS = -static
+
+third_linux_SOURCES = $(third_SOURCES)
+third_linux_LDADD = $(top_builddir)/sysdeps/guile/libgtop_guile.la \
+ $(top_builddir)/sysdeps/guile/names/libgtop_guile_names.la \
+ $(top_builddir)/sysdeps/names/libgtop_names.la \
+ $(top_builddir)/sysdeps/common/libgtop_common.la \
+ $(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
+ @GUILE_LIBS@ @INTLLIBS@ @LIBSUPPORT@
+third_linux_LDFLAGS = -static
diff --git a/examples/first.c b/examples/first.c
new file mode 100644
index 00000000..218a3fc0
--- /dev/null
+++ b/examples/first.c
@@ -0,0 +1,326 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ The Gnome Top Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Top Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <glibtop.h>
+#include <glibtop/open.h>
+#include <glibtop/close.h>
+#include <glibtop/xmalloc.h>
+
+#include <glibtop/union.h>
+#include <glibtop/sysdeps.h>
+
+int
+main (int argc, char *argv [])
+{
+ glibtop_union data;
+ glibtop_sysdeps sysdeps;
+ unsigned i, *ptr;
+ pid_t pid, ppid;
+
+ setlocale (LC_ALL, "");
+ bindtextdomain (PACKAGE, GTOPLOCALEDIR);
+ textdomain (PACKAGE);
+
+ glibtop_init__r (&glibtop_global_server);
+
+ glibtop_get_cpu (&data.cpu);
+
+ fprintf (stderr, "CPU (0x%08lx): %lu, %lu, %lu, %lu, %lu, %lu\n",
+ data.cpu.flags, data.cpu.total, data.cpu.user, data.cpu.nice,
+ data.cpu.sys, data.cpu.idle, data.cpu.frequency);
+
+ glibtop_get_mem (&data.mem);
+
+ fprintf (stderr, "Memory (0x%08lx): %lu, %lu, %lu, %lu, %lu, %lu, %lu\n",
+ data.mem.flags, data.mem.total, data.mem.used, data.mem.free,
+ data.mem.shared, data.mem.buffer, data.mem.cached,
+ data.mem.user);
+
+ glibtop_get_swap (&data.swap);
+
+ fprintf (stderr, "Swap (0x%08lx): %lu, %lu, %lu\n", data.swap.flags,
+ data.swap.total, data.swap.used, data.swap.free);
+
+ glibtop_get_uptime (&data.uptime);
+
+ fprintf (stderr, "Uptime (0x%08lx): %f, %f\n", data.uptime.flags,
+ data.uptime.uptime, data.uptime.idletime);
+
+ glibtop_get_loadavg (&data.loadavg);
+
+ fprintf (stderr, "Loadavg (0x%08lx): %f, %f, %f\n", data.loadavg.flags,
+ data.loadavg.loadavg [0], data.loadavg.loadavg [1],
+ data.loadavg.loadavg [2]);
+
+ glibtop_get_shm_limits (&data.shm_limits);
+
+ fprintf (stderr, "Shm Limits (0x%08lx): %ld, %ld, %ld, %ld, %ld\n",
+ data.shm_limits.flags, data.shm_limits.shmmax,
+ data.shm_limits.shmmin, data.shm_limits.shmmni,
+ data.shm_limits.shmseg, data.shm_limits.shmall);
+
+ glibtop_get_msg_limits (&data.msg_limits);
+
+ fprintf (stderr, "Msg Limits (0x%08lx): %ld, %ld, %ld, %ld, %ld, %ld, %ld\n",
+ data.msg_limits.flags, data.msg_limits.msgpool,
+ data.msg_limits.msgmap, data.msg_limits.msgmax,
+ data.msg_limits.msgmnb, data.msg_limits.msgmni,
+ data.msg_limits.msgssz, data.msg_limits.msgtql);
+
+ glibtop_get_sem_limits (&data.sem_limits);
+
+ fprintf (stderr, "Sem Limits (0x%08lx): "
+ "%ld, %ld, %ld, %ld, %ld, %ld, %ld, %ld, %ld, %ld\n",
+ data.sem_limits.flags, data.sem_limits.semmap,
+ data.sem_limits.semmni, data.sem_limits.semmns,
+ data.sem_limits.semmnu, data.sem_limits.semmsl,
+ data.sem_limits.semopm, data.sem_limits.semume,
+ data.sem_limits.semusz, data.sem_limits.semvmx,
+ data.sem_limits.semaem);
+
+ fprintf (stderr, "\n");
+
+ glibtop_get_sysdeps (&sysdeps);
+
+ fprintf (stderr, "Sysdeps (0x%08lx): %lu, %lu, %lu, %lu, %lu, "
+ "%lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu\n",
+ sysdeps.flags, sysdeps.cpu, sysdeps.mem, sysdeps.swap,
+ sysdeps.uptime, sysdeps.loadavg, sysdeps.shm_limits,
+ sysdeps.msg_limits, sysdeps.sem_limits,
+ sysdeps.proclist, sysdeps.proc_state,
+ sysdeps.proc_uid, sysdeps.proc_mem,
+ sysdeps.proc_time, sysdeps.proc_signal,
+ sysdeps.proc_kernel, sysdeps.proc_segment);
+
+ fprintf (stderr, "\n");
+
+ ptr = glibtop_get_proclist (&data.proclist);
+
+ fprintf (stderr, "Proclist (0x%08lx): %ld, %ld, %ld\n",
+ data.proclist.flags, data.proclist.number,
+ data.proclist.size, data.proclist.total);
+
+ if (ptr) {
+ fprintf (stderr, "\nProcess: ");
+ for (i = 0; i < data.proclist.number; i++)
+ fprintf (stderr, "%s%u", i ? ", " : "", ptr [i]);
+ fprintf (stderr, "\n");
+ }
+
+ glibtop_free (ptr);
+
+ pid = getpid ();
+ ppid = getppid ();
+
+ fprintf (stderr, "\n");
+
+ glibtop_get_proc_state (&data.proc_state, pid);
+
+ fprintf (stderr, "Proc_State PID %5u (0x%08lx): '%s', %c, %u, %u\n",
+ pid, data.proc_state.flags, data.proc_state.cmd,
+ data.proc_state.state, data.proc_state.uid,
+ data.proc_state.gid);
+
+ glibtop_get_proc_uid (&data.proc_uid, pid);
+
+ fprintf (stderr, "Proc_Uid PID %5u (0x%08lx): "
+ "%d %d %d %d %d %d %d %d %d %d %d %d\n",
+ pid, data.proc_uid.flags, data.proc_uid.uid,
+ data.proc_uid.euid, data.proc_uid.gid,
+ data.proc_uid.egid, data.proc_uid.pid,
+ data.proc_uid.ppid, data.proc_uid.pgrp,
+ data.proc_uid.session, data.proc_uid.tty,
+ data.proc_uid.tpgid, data.proc_uid.priority,
+ data.proc_uid.nice);
+
+ glibtop_get_proc_mem (&data.proc_mem, pid);
+
+ fprintf (stderr, "Proc_Mem PID %5u (0x%08lx): "
+ "%ld %ld %ld %ld %ld %ld\n", pid, data.proc_mem.flags,
+ data.proc_mem.size, data.proc_mem.vsize,
+ data.proc_mem.resident, data.proc_mem.share,
+ data.proc_mem.rss, data.proc_mem.rss_rlim);
+
+ glibtop_get_proc_time (&data.proc_time, pid);
+
+ fprintf (stderr, "Proc_Time PID %5u (0x%08lx): "
+ "%ld %ld %ld %ld %ld %ld %ld\n", pid, data.proc_time.flags,
+ data.proc_time.start_time, data.proc_time.utime,
+ data.proc_time.stime, data.proc_time.cutime,
+ data.proc_time.cstime, data.proc_time.timeout,
+ data.proc_time.it_real_value);
+
+ glibtop_get_proc_signal (&data.proc_signal, pid);
+
+ fprintf (stderr, "Proc_Signal PID %5u (0x%08lx): "
+ "%d %d %d %d\n", pid, data.proc_signal.flags,
+ data.proc_signal.signal, data.proc_signal.blocked,
+ data.proc_signal.sigignore, data.proc_signal.sigcatch);
+
+ glibtop_get_proc_kernel (&data.proc_kernel, pid);
+
+ fprintf (stderr, "Proc_Kernel PID %5u (0x%08lx): "
+ "%lu %lu %lu %lu %lu %lu %lu %lu\n", pid,
+ data.proc_kernel.flags, data.proc_kernel.k_flags,
+ data.proc_kernel.min_flt, data.proc_kernel.maj_flt,
+ data.proc_kernel.cmin_flt, data.proc_kernel.cmaj_flt,
+ data.proc_kernel.kstk_esp, data.proc_kernel.kstk_eip,
+ data.proc_kernel.wchan);
+
+ glibtop_get_proc_segment (&data.proc_segment, pid);
+
+ fprintf (stderr, "Proc_Segment PID %5u (0x%08lx): "
+ "%ld %ld %ld %ld %lu %lu %lu\n", pid, data.proc_segment.flags,
+ data.proc_segment.trs, data.proc_segment.lrs,
+ data.proc_segment.drs, data.proc_segment.dt,
+ data.proc_segment.start_code, data.proc_segment.end_code,
+ data.proc_segment.start_stack);
+
+ fprintf (stderr, "\n");
+
+ glibtop_get_proc_state (&data.proc_state, ppid);
+
+ fprintf (stderr, "Proc_State PPID %5u (0x%08lx): '%s', %c, %u, %u\n",
+ ppid, data.proc_state.flags, data.proc_state.cmd,
+ data.proc_state.state, data.proc_state.uid,
+ data.proc_state.gid);
+
+ glibtop_get_proc_uid (&data.proc_uid, ppid);
+
+ fprintf (stderr, "Proc_Uid PPID %5u (0x%08lx): "
+ "%d %d %d %d %d %d %d %d %d %d %d %d\n",
+ ppid, data.proc_uid.flags, data.proc_uid.uid,
+ data.proc_uid.euid, data.proc_uid.gid,
+ data.proc_uid.egid, data.proc_uid.pid,
+ data.proc_uid.ppid, data.proc_uid.pgrp,
+ data.proc_uid.session, data.proc_uid.tty,
+ data.proc_uid.tpgid, data.proc_uid.priority,
+ data.proc_uid.nice);
+
+ glibtop_get_proc_mem (&data.proc_mem, ppid);
+
+ fprintf (stderr, "Proc_Mem PPID %5u (0x%08lx): "
+ "%ld %ld %ld %ld %ld %ld\n", ppid, data.proc_mem.flags,
+ data.proc_mem.size, data.proc_mem.vsize,
+ data.proc_mem.resident, data.proc_mem.share,
+ data.proc_mem.rss, data.proc_mem.rss_rlim);
+
+ glibtop_get_proc_time (&data.proc_time, ppid);
+
+ fprintf (stderr, "Proc_Time PPID %5u (0x%08lx): "
+ "%ld %ld %ld %ld %ld %ld %ld\n", ppid, data.proc_time.flags,
+ data.proc_time.start_time, data.proc_time.utime,
+ data.proc_time.stime, data.proc_time.cutime,
+ data.proc_time.cstime, data.proc_time.timeout,
+ data.proc_time.it_real_value);
+
+ glibtop_get_proc_signal (&data.proc_signal, ppid);
+
+ fprintf (stderr, "Proc_Signal PPID %5u (0x%08lx): "
+ "%d %d %d %d\n", ppid, data.proc_signal.flags,
+ data.proc_signal.signal, data.proc_signal.blocked,
+ data.proc_signal.sigignore, data.proc_signal.sigcatch);
+
+ glibtop_get_proc_kernel (&data.proc_kernel, ppid);
+
+ fprintf (stderr, "Proc_Kernel PPID %5u (0x%08lx): "
+ "%lu %lu %lu %lu %lu %lu %lu %lu\n", ppid,
+ data.proc_kernel.flags, data.proc_kernel.k_flags,
+ data.proc_kernel.min_flt, data.proc_kernel.maj_flt,
+ data.proc_kernel.cmin_flt, data.proc_kernel.cmaj_flt,
+ data.proc_kernel.kstk_esp, data.proc_kernel.kstk_eip,
+ data.proc_kernel.wchan);
+
+ glibtop_get_proc_segment (&data.proc_segment, ppid);
+
+ fprintf (stderr, "Proc_Segment PPID %5u (0x%08lx): "
+ "%ld %ld %ld %ld %lu %lu %lu\n", ppid, data.proc_segment.flags,
+ data.proc_segment.trs, data.proc_segment.lrs,
+ data.proc_segment.drs, data.proc_segment.dt,
+ data.proc_segment.start_code, data.proc_segment.end_code,
+ data.proc_segment.start_stack);
+
+ fprintf (stderr, "\n");
+
+ glibtop_get_proc_state (&data.proc_state, 1);
+
+ fprintf (stderr, "Proc_State INIT %5u (0x%08lx): '%s', %c, %u, %u\n",
+ 1, data.proc_state.flags, data.proc_state.cmd,
+ data.proc_state.state, data.proc_state.uid,
+ data.proc_state.gid);
+
+ glibtop_get_proc_uid (&data.proc_uid, 1);
+
+ fprintf (stderr, "Proc_Uid INIT %5u (0x%08lx): "
+ "%d %d %d %d %d %d %d %d %d %d %d %d\n",
+ 1, data.proc_uid.flags, data.proc_uid.uid,
+ data.proc_uid.euid, data.proc_uid.gid,
+ data.proc_uid.egid, data.proc_uid.pid,
+ data.proc_uid.ppid, data.proc_uid.pgrp,
+ data.proc_uid.session, data.proc_uid.tty,
+ data.proc_uid.tpgid, data.proc_uid.priority,
+ data.proc_uid.nice);
+
+ glibtop_get_proc_mem (&data.proc_mem, 1);
+
+ fprintf (stderr, "Proc_Mem INIT %5u (0x%08lx): "
+ "%ld %ld %ld %ld %ld %ld\n", 1, data.proc_mem.flags,
+ data.proc_mem.size, data.proc_mem.vsize,
+ data.proc_mem.resident, data.proc_mem.share,
+ data.proc_mem.rss, data.proc_mem.rss_rlim);
+
+ glibtop_get_proc_time (&data.proc_time, 1);
+
+ fprintf (stderr, "Proc_Time INIT %5u (0x%08lx): "
+ "%ld %ld %ld %ld %ld %ld %ld\n", 1, data.proc_time.flags,
+ data.proc_time.start_time, data.proc_time.utime,
+ data.proc_time.stime, data.proc_time.cutime,
+ data.proc_time.cstime, data.proc_time.timeout,
+ data.proc_time.it_real_value);
+
+ glibtop_get_proc_signal (&data.proc_signal, 1);
+
+ fprintf (stderr, "Proc_Signal INIT %5u (0x%08lx): "
+ "%d %d %d %d\n", 1, data.proc_signal.flags,
+ data.proc_signal.signal, data.proc_signal.blocked,
+ data.proc_signal.sigignore, data.proc_signal.sigcatch);
+
+ glibtop_get_proc_kernel (&data.proc_kernel, 1);
+
+ fprintf (stderr, "Proc_Kernel INIT %5u (0x%08lx): "
+ "%lu %lu %lu %lu %lu %lu %lu %lu\n", 1,
+ data.proc_kernel.flags, data.proc_kernel.k_flags,
+ data.proc_kernel.min_flt, data.proc_kernel.maj_flt,
+ data.proc_kernel.cmin_flt, data.proc_kernel.cmaj_flt,
+ data.proc_kernel.kstk_esp, data.proc_kernel.kstk_eip,
+ data.proc_kernel.wchan);
+
+ glibtop_get_proc_segment (&data.proc_segment, 1);
+
+ fprintf (stderr, "Proc_Segment INIT %5u (0x%08lx): "
+ "%ld %ld %ld %ld %lu %lu %lu\n", 1, data.proc_segment.flags,
+ data.proc_segment.trs, data.proc_segment.lrs,
+ data.proc_segment.drs, data.proc_segment.dt,
+ data.proc_segment.start_code, data.proc_segment.end_code,
+ data.proc_segment.start_stack);
+
+ exit (0);
+}
diff --git a/examples/second.c b/examples/second.c
new file mode 100644
index 00000000..c3d1b0f5
--- /dev/null
+++ b/examples/second.c
@@ -0,0 +1,140 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ The Gnome Top Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Top Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <glibtop.h>
+#include <glibtop/open.h>
+#include <glibtop/close.h>
+#include <glibtop/xmalloc.h>
+
+#include <glibtop/union.h>
+#include <glibtop/sysdeps.h>
+
+int
+main (int argc, char *argv [])
+{
+ glibtop_union data;
+ glibtop_proclist proclist;
+ glibtop_sysdeps sysdeps;
+ unsigned *ptr, pid, i;
+
+ setlocale (LC_ALL, "");
+ bindtextdomain (PACKAGE, GTOPLOCALEDIR);
+ textdomain (PACKAGE);
+
+ glibtop_init__r (&glibtop_global_server);
+
+ glibtop_get_sysdeps (&sysdeps);
+
+ fprintf (stderr, "Sysdeps (0x%08lx): %lu, %lu, %lu, %lu, %lu, "
+ "%lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu\n",
+ sysdeps.flags, sysdeps.cpu, sysdeps.mem, sysdeps.swap,
+ sysdeps.uptime, sysdeps.loadavg, sysdeps.shm_limits,
+ sysdeps.msg_limits, sysdeps.sem_limits,
+ sysdeps.proclist, sysdeps.proc_state,
+ sysdeps.proc_uid, sysdeps.proc_mem,
+ sysdeps.proc_time, sysdeps.proc_signal,
+ sysdeps.proc_kernel, sysdeps.proc_segment);
+
+ fprintf (stderr, "\n");
+
+ ptr = glibtop_get_proclist (&proclist);
+
+ fprintf (stderr, "Proclist (0x%08lx): %ld, %ld, %ld\n",
+ proclist.flags, proclist.number, proclist.size,
+ proclist.total);
+
+ if (!ptr) exit (1);
+
+ for (i = 0; i < proclist.number; i++) {
+
+ pid = ptr [i];
+
+ fprintf (stderr, "\n");
+
+ glibtop_get_proc_state (&data.proc_state, pid);
+
+ fprintf (stderr, "Proc_State PID %5u (0x%08lx): "
+ "'%s', %c, %u, %u\n", pid, data.proc_state.flags,
+ data.proc_state.cmd, data.proc_state.state,
+ data.proc_state.uid, data.proc_state.gid);
+
+ glibtop_get_proc_uid (&data.proc_uid, pid);
+
+ fprintf (stderr, "Proc_Uid PID %5u (0x%08lx): "
+ "%d %d %d %d %d %d %d %d %d %d %d %d\n",
+ pid, data.proc_uid.flags, data.proc_uid.uid,
+ data.proc_uid.euid, data.proc_uid.gid,
+ data.proc_uid.egid, data.proc_uid.pid,
+ data.proc_uid.ppid, data.proc_uid.pgrp,
+ data.proc_uid.session, data.proc_uid.tty,
+ data.proc_uid.tpgid, data.proc_uid.priority,
+ data.proc_uid.nice);
+
+ glibtop_get_proc_mem (&data.proc_mem, pid);
+
+ fprintf (stderr, "Proc_Mem PID %5u (0x%08lx): "
+ "%ld %ld %ld %ld %ld %ld\n", pid, data.proc_mem.flags,
+ data.proc_mem.size, data.proc_mem.vsize,
+ data.proc_mem.resident, data.proc_mem.share,
+ data.proc_mem.rss, data.proc_mem.rss_rlim);
+
+ glibtop_get_proc_time (&data.proc_time, pid);
+
+ fprintf (stderr, "Proc_Time PID %5u (0x%08lx): "
+ "%ld %ld %ld %ld %ld %ld %ld\n", pid, data.proc_time.flags,
+ data.proc_time.start_time, data.proc_time.utime,
+ data.proc_time.stime, data.proc_time.cutime,
+ data.proc_time.cstime, data.proc_time.timeout,
+ data.proc_time.it_real_value);
+
+ glibtop_get_proc_signal (&data.proc_signal, pid);
+
+ fprintf (stderr, "Proc_Signal PID %5u (0x%08lx): "
+ "%d %d %d %d\n", pid, data.proc_signal.flags,
+ data.proc_signal.signal, data.proc_signal.blocked,
+ data.proc_signal.sigignore, data.proc_signal.sigcatch);
+
+ glibtop_get_proc_kernel (&data.proc_kernel, pid);
+
+ fprintf (stderr, "Proc_Kernel PID %5u (0x%08lx): "
+ "%lu %lu %lu %lu %lu %lu %lu %lu\n", pid,
+ data.proc_kernel.flags, data.proc_kernel.k_flags,
+ data.proc_kernel.min_flt, data.proc_kernel.maj_flt,
+ data.proc_kernel.cmin_flt, data.proc_kernel.cmaj_flt,
+ data.proc_kernel.kstk_esp, data.proc_kernel.kstk_eip,
+ data.proc_kernel.wchan);
+
+ glibtop_get_proc_segment (&data.proc_segment, pid);
+
+ fprintf (stderr, "Proc_Segment PID %5u (0x%08lx): "
+ "%ld %ld %ld %ld %lu %lu %lu\n", pid, data.proc_segment.flags,
+ data.proc_segment.trs, data.proc_segment.lrs,
+ data.proc_segment.drs, data.proc_segment.dt,
+ data.proc_segment.start_code, data.proc_segment.end_code,
+ data.proc_segment.start_stack);
+
+ fprintf (stderr, "\n");
+ }
+
+ glibtop_free (ptr);
+
+ exit (0);
+}
diff --git a/examples/third.c b/examples/third.c
new file mode 100644
index 00000000..d4160425
--- /dev/null
+++ b/examples/third.c
@@ -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/open.h>
+#include <glibtop/close.h>
+#include <glibtop/xmalloc.h>
+
+#include <glibtop/union.h>
+#include <glibtop/sysdeps.h>
+
+void main_prog(int argc, char *argv[]);
+
+int
+main (int argc, char *argv[])
+{
+ setlocale (LC_ALL, "");
+ bindtextdomain (PACKAGE, GTOPLOCALEDIR);
+ textdomain (PACKAGE);
+
+ gh_enter (argc, argv, main_prog);
+ exit (0);
+}
+
+void
+main_prog (int argc, char *argv[])
+{
+ glibtop_boot_guile ();
+ glibtop_boot_guile_names ();
+
+ gh_repl (argc, argv);
+}
diff --git a/examples/third.scm b/examples/third.scm
new file mode 100644
index 00000000..2de3e006
--- /dev/null
+++ b/examples/third.scm
@@ -0,0 +1,10 @@
+(display (get-cpu)) (newline)
+(display (get-mem)) (newline)
+(display (get-swap)) (newline)
+(display (get-uptime)) (newline)
+(display (get-loadavg)) (newline)
+(display (get-shm_limits)) (newline)
+(display (get-msg_limits)) (newline)
+(display (get-sem_limits)) (newline)
+(display (get-sysdeps)) (newline)
+(display (get-proclist)) (newline)
diff --git a/glibtop.h b/glibtop.h
new file mode 100644
index 00000000..01309bf8
--- /dev/null
+++ b/glibtop.h
@@ -0,0 +1,72 @@
+/* $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_H__
+#define __GLIBTOP_H__
+
+#include <glibtop/global.h>
+
+#ifdef HAVE_GLIBTOP_MACHINE_H
+#include <glibtop_machine.h>
+#endif
+
+typedef struct _glibtop glibtop;
+
+struct _glibtop
+{
+ int fd; /* Server file descriptor */
+#ifdef HAVE_GLIBTOP_MACHINE_H
+ glibtop_machine machine; /* Machine dependent data */
+#endif
+ int input [2]; /* Pipe client <- server */
+ int output [2]; /* Pipe client -> server */
+ unsigned long os_version_code; /* Version code of the operating system */
+ const char *name; /* Program name for error messages */
+ pid_t pid; /* PID of the server */
+};
+
+extern glibtop *glibtop_global_server;
+
+#define glibtop_init() glibtop_init__r(&glibtop_global_server);
+
+extern glibtop *glibtop_init__r __P((glibtop **));
+
+#ifdef HAVE_GUILE
+
+/* You need to link with -lgtop_guile to get this stuff here. */
+
+extern void glibtop_boot_guile __P((void));
+
+#endif
+
+#ifdef GLIBTOP_GUILE_NAMES
+
+/* You need to link with -lgtop_guile_names to get this stuff here. */
+
+extern void glibtop_boot_guile_names __P((void));
+
+#ifndef GLIBTOP_NAMES
+#define GLIBTOP_NAMES
+#endif
+
+#endif
+
+#endif
diff --git a/gtopConf.sh.in b/gtopConf.sh.in
new file mode 100644
index 00000000..a7044717
--- /dev/null
+++ b/gtopConf.sh.in
@@ -0,0 +1,17 @@
+#
+# Configuration of the libgtop package
+#
+
+GTOP_LIBDIR="@GTOP_LIBDIR@"
+GTOP_INCLUDEDIR="@GTOP_INCLUDEDIR@"
+
+GTOP_LIBS="@GTOP_LIBS@"
+GTOP_INCS="@GTOP_INCS@"
+
+GTOP_BINDIR="@GTOP_BINDIR@"
+GTOP_SERVER="@GTOP_SERVER@"
+
+GTOP_SYSDEPS_DIR="@GTOP_SYSDEPS_DIR@"
+GTOP_NEED_SERVER="@GTOP_NEED_SERVER@"
+GTOP_USE_MACHINE_H="@GTOP_USE_MACHINE_H@"
+
diff --git a/guile/header.scm b/guile/header.scm
new file mode 100644
index 00000000..d3fa5ece
--- /dev/null
+++ b/guile/header.scm
@@ -0,0 +1,440 @@
+;; $Id$
+
+(define cpu-type '(("name" . "cpu")
+ ("label" . "CPU Usage")
+ ("fields" . (list
+ (("name" . "total")
+ ("label" . "Total CPU Usage")
+ ("type" . "unsigned long"))
+ (("name" . "user")
+ ("type" . "unsigned long"))
+ (("name" . "nice")
+ ("type" . "unsigned long"))
+ (("name" . "sys")
+ ("type" . "unsigned long"))
+ (("name" . "idle")
+ ("type" . "unsigned long"))
+ (("name" . "name")
+ ("type" . "const char")
+ ("pointer" . #t))
+ (("name" . "test"))
+ )
+ )
+ )
+ )
+
+(define main-function
+ (lambda (definition)
+ (letrec ((default-type "unsigned long")
+ (struct-label-comments #t)
+ (struct-name-comments #f)
+ (default-name-tabs-first 3)
+ (default-name-tabs 4)
+ (default-type-tabs 2)
+ (default-comment-tabs 5)
+ (default-definition-tabs 3)
+ (default-definition-value-tabs 2)
+ (default-max-line-length 60)
+ ;; set default values for unspecified fields
+ (check-field-definition
+ (lambda (fields)
+ (let ((newlist (list)))
+ (for-each
+ (lambda (field)
+ (if (not (assoc-ref field "type"))
+ (set! field (assoc-set! field "type" default-type)))
+ (if (assoc-ref field "label")
+ (set! field (assoc-set! field "has-label" #t))
+ (begin
+ (set! field (assoc-set! field "label" (assoc-ref field "name")))
+ (set! field (assoc-set! field "has-label" #f))
+ )
+ )
+ (set! newlist (append newlist (list field)))
+ )
+ (cdr fields))
+ (set-cdr! fields newlist)
+ )
+ )
+ )
+ ;; number fields sequentially
+ (make-field-numbers
+ (lambda (fields)
+ (let ((pos 0) (newlist (list)))
+ (for-each
+ (lambda (field)
+ (set! field (assoc-set! field "number" pos))
+ (set! newlist (append newlist (list field)))
+ (set! pos (+ pos 1))
+ )
+ (cdr fields))
+ (set-cdr! fields newlist)
+ (set! definition (assoc-set! definition "max-fields" pos))
+ )
+ )
+ )
+ ;; pad string with up to 'tabs' tabs
+ (tabify-string
+ (lambda (string tabs)
+ (let ((length (string-length string))
+ (tlength (* tabs 8)))
+ (if (> tlength length)
+ (let* ((diff (- tlength length))
+ (count (quotient (+ diff 7) 8)))
+ (string-append string
+ (make-string count #\tab))
+ )
+ (string-append string
+ #\space)
+ )
+ )
+ )
+ )
+ ;; pad string with spaces
+ (spacify-string
+ (lambda (string tabs)
+ (let ((length (string-length string))
+ (tlength (* tabs 8)))
+ (if (> tlength length)
+ (string-append string
+ (make-string (- tlength length) #\space))
+ (string-append string
+ #\space)
+ )
+ )
+ )
+ )
+ ;; creates comment string
+ (make-comment-string
+ (lambda (comment)
+ (if comment
+ (string "/* "
+ (spacify-string comment
+ default-comment-tabs)
+ " */")
+ (string)
+ )
+ )
+ )
+ ;; create constant for entry (eg. GLIBTOP_CPU_TOTAL)
+ (entry-constant-name
+ (lambda (name)
+ (string-upcase! (string "GLIBTOP_"
+ (assoc-ref definition "name")
+ "_"
+ name
+ )
+ )
+ )
+ )
+ ;; create text that is displayed as comment along with entry
+ (entry-comment-text
+ (lambda (name label)
+ (if label
+ (if struct-label-comments label #f)
+ (if struct-name-comments (entry-constant-name name) #f)
+ )
+ )
+ )
+ ;; starts struct definition
+ (make-struct-definition-head
+ (lambda ()
+ (let* ((class (assoc-ref definition "name"))
+ )
+ (string "struct _glibtop_" class "\n"
+ "{\n"
+ )
+ )
+ )
+ )
+ ;; terminates struct definition
+ (make-struct-definition-tail
+ (lambda ()
+ (string "};\n\n")
+ )
+ )
+ ;; generate struct definition body
+ (make-struct-definition-body
+ (lambda (fields)
+ (letrec ((output (string))
+ (is-first-entry #t)
+ (current-type #f)
+ (current-name #f)
+ (current-label #f)
+ (current-pointer #f)
+ ;; close entry (other = next entry is of other type)
+ (entry-end
+ (lambda (other)
+ (let ((old-first is-first-entry))
+ (set! is-first-entry other)
+ (if current-type
+ (string (tabify-string (string (string (if current-pointer "*" ""))
+ current-name
+ (string (if other ";" ","))
+ )
+ (if old-first
+ default-name-tabs-first
+ default-name-tabs
+ )
+ )
+ (make-comment-string (entry-comment-text
+ current-name current-label))
+ "\n")
+ (string)
+ )
+ )
+ )
+ )
+ ;; start new entry
+ (entry-start
+ (lambda (name type)
+ (if current-type
+ (if (equal? current-type type)
+ (string (entry-end #f) "\t\t")
+ (string (entry-end #t) "\t"
+ (tabify-string type default-type-tabs)
+ )
+ )
+ (string "\t"
+ (tabify-string type default-type-tabs)
+ )
+ )
+ )
+ )
+ )
+ ;; main function
+ (for-each
+ (lambda (field)
+ (let ((name (assoc-ref field "name"))
+ (type (assoc-ref field "type"))
+ (pointer (assoc-ref field "pointer"))
+ (label (if (assoc-ref field "has-label")
+ (assoc-ref field "label")
+ #f)
+ )
+ )
+ (set! output (string-append output
+ (string (entry-start name type))
+ )
+ )
+ ;; save current data
+ (set! current-type type)
+ (set! current-name name)
+ (set! current-label label)
+ (set! current-pointer pointer)
+ )
+ )
+ (cdr fields))
+ ;; close last entry
+ (string-append output (entry-end #t))
+ )
+ )
+ )
+ ;; display complete struct definition
+ (make-struct-definition
+ (lambda (fields)
+ (string-append (make-struct-definition-head)
+ (make-struct-definition-body fields)
+ (make-struct-definition-tail)
+ )
+ )
+ )
+ ;; make constant definition
+ (make-const-definition
+ (lambda (name value comment)
+ (let* ((nstring (string-upcase! (string "GLIBTOP_" name)))
+ (tabname (tabify-string nstring default-definition-tabs))
+ (tabvalue (if comment
+ (tabify-string (string value) default-definition-value-tabs)
+ (string value))
+ )
+ (ctext (make-comment-string comment))
+ (line (string "#define " tabname tabvalue ctext "\n"))
+ )
+ line)
+ )
+ )
+ ;; creates constant definitions
+ (make-struct-constants
+ (lambda (fields)
+ (let ((class (assoc-ref definition "name"))
+ (output (string))
+ )
+ (for-each
+ (lambda (field)
+ (let* ((name (assoc-ref field "name"))
+ (number (assoc-ref field "number"))
+ (key (string class "_" name))
+ (value (number->string number))
+ (label (if (assoc-ref field "has-label")
+ (assoc-ref field "label")
+ #f)
+ )
+ (line (make-const-definition key
+ value
+ (entry-comment-text name label)
+ )
+ )
+ )
+ (set! output (string-append output line))
+ )
+ )
+ (cdr fields))
+ output)
+ )
+ )
+ ;; creates definition of maximum constant
+ (make-struct-max-constant
+ (lambda ()
+ (let* ((class (assoc-ref definition "name"))
+ (max (assoc-ref definition "max-fields"))
+ )
+ (make-const-definition (string "MAX_" class)
+ (number->string max)
+ #f)
+ )
+ )
+ )
+ ;; adds new list element to string, inserting newline if necessary
+ (add-to-string
+ (lambda (output line element separator indent max-length)
+ (let* ((slen (string-length line))
+ (elen (string-length element))
+ (tlen (+ slen elen))
+ (bsep (if separator
+ (string separator " ")
+ (string)
+ )
+ )
+ (nsep (string (if separator separator "") "\n"))
+ )
+ (if (and (> slen 0) (> tlen max-length))
+ (begin
+ (set! output (string-append output line nsep))
+ (set! line (string indent element))
+ )
+ (set! line (string-append line bsep element))
+ )
+ (list output line)
+ )
+ )
+ )
+ ;; create general list definition
+ (make-general-list-definition
+ (lambda (fields name symbol line-length make-element-string)
+ (letrec ((class (assoc-ref definition "name"))
+ (make-general-list-definition-head
+ (lambda ()
+ (string "const char *"
+ "glibtop_"
+ symbol
+ "_"
+ class
+ " "
+ "[GLIBTOP_MAX_"
+ (string-upcase! (string class))
+ "] = \n{ "
+ )
+ )
+ )
+ (make-general-list-definition-tail
+ (lambda ()
+ (string "\n};\n")
+ )
+ )
+ (make-general-list-definition-body
+ (lambda ()
+ (let* ((first #t) (output (string)) (line (string)))
+ (for-each
+ (lambda (field)
+ (let* ((element (assoc-ref field name))
+ (olist (add-to-string output line
+ (make-element-string element)
+ (if first #f ",")
+ " "
+ line-length))
+ )
+ (set! output (car olist))
+ (set! line (car (cdr olist)))
+ (set! first #f)
+ )
+ )
+ (cdr fields))
+ (set! output (string-append output line))
+ output)
+ )
+ )
+ )
+ ;; main function
+ (string-append (make-general-list-definition-head)
+ (make-general-list-definition-body)
+ (make-general-list-definition-tail)
+ )
+ )
+ )
+ )
+ ;; create name list definition
+ (make-name-list-definition
+ (lambda (fields)
+ (make-general-list-definition fields
+ "name"
+ "names"
+ default-max-line-length
+ (lambda (x)
+ (string #\" x #\")
+ )
+ )
+ )
+ )
+ ;; create label list definition
+ (make-label-list-definition
+ (lambda (fields)
+ (make-general-list-definition fields
+ "label"
+ "labels"
+ 0
+ (lambda (x)
+ (string "gettext_noop (" #\" x #\" ")")
+ )
+ )
+ )
+ )
+ ;; create description list definition
+ (make-description-list-definition
+ (lambda (fields)
+ (make-general-list-definition fields
+ "description"
+ "descriptions"
+ default-max-line-length
+ (lambda (x)
+ (if x
+ (string "gettext_noop (" #\" x #\" ")")
+ (string "NULL")
+ )
+ )
+ )
+ )
+ )
+ )
+ ;; start of main function
+ (let ((fielddef (assoc-ref definition "fields")))
+ (display fielddef) (newline) (newline)
+ (check-field-definition fielddef)
+ (make-field-numbers fielddef)
+ (display fielddef) (newline) (newline)
+ (display (make-struct-definition fielddef))
+ (display (make-struct-constants fielddef)) (newline)
+ (display (make-struct-max-constant)) (newline) (newline)
+ (display (make-name-list-definition fielddef)) (newline)
+ (display (make-label-list-definition fielddef)) (newline)
+ (display (make-description-list-definition fielddef)) (newline)
+ )
+ )
+ )
+ )
+
+(begin
+ (main-function cpu-type)
+ (newline)
+ )
+
diff --git a/guile/make-header.scm b/guile/make-header.scm
new file mode 100644
index 00000000..ec51216b
--- /dev/null
+++ b/guile/make-header.scm
@@ -0,0 +1,195 @@
+(define cpu-type '(("name" . "cpu")
+ ("label" . "CPU Usage")
+ ("fields" . (("unsigned long" ("total" "Total CPU Usage")
+ ("user") ("nice") ("sys") ("idle"))
+ ("const char" ("name"))
+ )
+ )
+ )
+ )
+
+;; computes constant for struct field (eg. GLIBTOP_CPU_TOTAL)
+
+(define field-name-constant
+ (lambda (name field)
+ (string "GLIBTOP_"
+ (string-upcase! (string name))
+ "_"
+ (string-upcase! (string field)))
+ )
+ )
+
+;; computes structure name (eg. glibtop_cpu)
+
+(define make-struct-name
+ (lambda (type)
+ (string "glibtop_" (assoc-ref type "name"))
+ )
+ )
+
+(define tab-pad-string
+ (lambda (string tabs)
+ (string-append string (make-string (- (* tabs 8) (string-length string)) #\space))
+ )
+ )
+
+(define make-field-list
+ (lambda (name type fields)
+ (let* ((output (string)) (pos 1))
+ (map
+ (lambda (x)
+ (let* ((sep (if (= pos (length fields)) ";" ","))
+ (start (if (= pos 1)
+ (string "\t"
+ (tab-pad-string (string type) 2))
+ (string "\t\t"))
+ )
+ (comment (string (if (= pos 1) "" "\t") "/* "
+ (tab-pad-string (field-name-constant name (car x)) 3)
+ " */"))
+ (field (tab-pad-string (string-append (string (car x)) sep) 2))
+ )
+ (set! pos (+ pos 1))
+ (string-append start field comment "\n")
+ )
+ )
+ fields)
+ )
+ )
+ )
+
+(define make-struct-body
+ (lambda (type)
+ (let* ((name (assoc-ref type "name"))
+ (data (assoc-ref type "fields"))
+ (output (string))
+ )
+ (for-each
+ (lambda (y)
+ (for-each
+ (lambda (z)
+ (set! output (string-append output z))
+ )
+ y)
+ )
+ (map
+ (lambda (x) (make-field-list name (car x) (cdr x)))
+ data)
+ )
+ output)
+ )
+ )
+
+(define make-struct
+ (lambda (type)
+ (let* ((name (assoc-ref type "name"))
+ (data (assoc-ref type "fields"))
+ (output (string-append
+ (tab-pad-string
+ (string "typedef struct _glibtop_" name)
+ 5)
+ (string "glibtop_" name ";\n\n"
+ "struct glibtop_" name "\n{\n\t"
+ "unsigned long\tflags;\n")
+ )
+ )
+ )
+ (string-append output (make-struct-body type) "};\n")
+ )
+ )
+ )
+
+(define make-field-name-list
+ (lambda (type)
+ (let* ((name (assoc-ref type "name"))
+ (data (assoc-ref type "fields"))
+ (return (list))
+ )
+ (map
+ (lambda (x)
+ (map
+ (lambda (y) (set! return (append return (list (car y)))))
+ (cdr x)
+ )
+ )
+ data)
+ return)
+ )
+ )
+
+(define make-field-constants
+ (lambda (type)
+ (let* ((name (assoc-ref type "name"))
+ (data (make-field-name-list type))
+ (output (string
+ (tab-pad-string
+ (string "#define GLIBTOP_MAX_"
+ (string-upcase! (string name))
+ ) 5)
+ (number->string (length data))
+ "\n\n"
+ )
+ )
+ (pos 0)
+ )
+ (for-each
+ (lambda (x)
+ (set! output (string-append output (string
+ (tab-pad-string
+ (string "#define GLIBTOP_"
+ (string-upcase! (string name))
+ "_"
+ (string-upcase! (string x))
+ ) 5)
+ (number->string pos)
+ "\n"
+ )
+ )
+ )
+ (set! pos (+ pos 1))
+ )
+ data)
+ output)
+ )
+ )
+
+(define make-extern-defs
+ (lambda (type)
+ (let* ((name (assoc-ref type "name"))
+ )
+ (string
+ (tab-pad-string (string "extern void glibtop_get_" name) 6)
+ "__P(glibtop *, glibtop_" name " *);\n\n"
+ "#ifdef HAVE_GUILE\n\n"
+ "/* You need to link with -lgtop_guile to get this stuff here. */\n\n"
+ (tab-pad-string (string "extern SCM glibtop_get_" name) 6)
+ "__P(void);\n\n"
+ "#endif /* HAVE_GUILE */\n\n"
+ "#ifdef GLIBTOP_GUILE_NAMES\n\n"
+ "/* You need to link with -lgtop_guile_names to get this stuff here. */\n\n"
+ (tab-pad-string (string "extern SCM glibtop_guile_names_" name) 6)
+ "__P(void);\n"
+ (tab-pad-string (string "extern SCM glibtop_guile_labels_" name) 6)
+ "__P(void);\n"
+ (tab-pad-string (string "extern SCM glibtop_guile_descriptions_" name) 6)
+ "__P(void);\n\n"
+ "#endif /* GLIBTOP_GUILE_NAMES */\n\n"
+ "#ifdef GLIBTOP_NAMES\n\n"
+ "/* You need to link with -lgtop_names to get this stuff here. */\n\n"
+ (tab-pad-string (string "extern const char *glibtop_names_" name) 6)
+ "[];\n"
+ (tab-pad-string (string "extern const char *glibtop_labels_" name) 6)
+ "[];\n"
+ (tab-pad-string (string "extern const char *glibtop_descriptions_" name) 6)
+ "[];\n\n"
+ "#endif /* GLIBTOP_NAMES */\n\n")
+ )
+ )
+ )
+
+(begin
+ (display (make-field-constants cpu-type)) (newline)
+ (display (make-struct cpu-type)) (newline)
+ (display (make-extern-defs cpu-type)) (newline)
+ )
+
diff --git a/include/glibtop/close.h b/include/glibtop/close.h
new file mode 100644
index 00000000..d57ccd38
--- /dev/null
+++ b/include/glibtop/close.h
@@ -0,0 +1,33 @@
+/* $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_CLOSE_H__
+#define __GLIBTOP_CLOSE_H__
+
+#include <glibtop.h>
+
+__BEGIN_DECLS
+
+extern void glibtop_close __P((glibtop *));
+
+__END_DECLS
+
+#endif
diff --git a/include/glibtop/command.h b/include/glibtop/command.h
new file mode 100644
index 00000000..2afcd582
--- /dev/null
+++ b/include/glibtop/command.h
@@ -0,0 +1,67 @@
+/* $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_COMMAND_H__
+#define __GLIBTOP_COMMAND_H__
+
+#include <glibtop.h>
+#include <glibtop/sysdeps.h>
+
+__BEGIN_DECLS
+
+#define GLIBTOP_CMND_QUIT 0
+#define GLIBTOP_CMND_SYSDEPS 1
+#define GLIBTOP_CMND_CPU 2
+#define GLIBTOP_CMND_MEM 3
+#define GLIBTOP_CMND_SWAP 4
+#define GLIBTOP_CMND_UPTIME 5
+#define GLIBTOP_CMND_LOADAVG 6
+#define GLIBTOP_CMND_SHM_LIMITS 7
+#define GLIBTOP_CMND_MSG_LIMITS 8
+#define GLIBTOP_CMND_SEM_LIMITS 9
+#define GLIBTOP_CMND_PROCLIST 10
+
+#define GLIBTOP_CMND_PROC_STATE 11
+#define GLIBTOP_CMND_PROC_UID 12
+#define GLIBTOP_CMND_PROC_MEM 13
+#define GLIBTOP_CMND_PROC_TIME 14
+#define GLIBTOP_CMND_PROC_SIGNAL 15
+#define GLIBTOP_CMND_PROC_KERNEL 16
+#define GLIBTOP_CMND_PROC_SEGMENT 17
+
+#define GLIBTOP_MAX_CMND 18
+
+typedef struct _glibtop_command glibtop_command;
+
+struct _glibtop_command
+{
+ glibtop server;
+ unsigned command;
+ size_t size;
+};
+
+#define glibtop_call(p1, p2, p3, p4) glibtop_call__r(glibtop_global_server, p1, p2, p3, p4)
+
+extern void *glibtop_call__r __P((glibtop *, unsigned, size_t, void *, size_t, void *));
+
+__END_DECLS
+
+#endif
diff --git a/include/glibtop/cpu.h b/include/glibtop/cpu.h
new file mode 100644
index 00000000..0d1b77ec
--- /dev/null
+++ b/include/glibtop/cpu.h
@@ -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. */
+
+#ifndef __GLIBTOP_CPU_H__
+#define __GLIBTOP_CPU_H__
+
+#include <glibtop.h>
+#include <glibtop/global.h>
+
+__BEGIN_DECLS
+
+#define GLIBTOP_CPU_TOTAL 0
+#define GLIBTOP_CPU_USER 1
+#define GLIBTOP_CPU_NICE 2
+#define GLIBTOP_CPU_SYS 3
+#define GLIBTOP_CPU_IDLE 4
+#define GLIBTOP_CPU_FREQUENCY 5
+
+#define GLIBTOP_MAX_CPU 6
+
+typedef struct _glibtop_cpu glibtop_cpu;
+
+struct _glibtop_cpu
+{
+ unsigned long flags,
+ total, /* GLIBTOP_CPU_TOTAL */
+ user, /* GLIBTOP_CPU_USER */
+ nice, /* GLIBTOP_CPU_NICE */
+ sys, /* GLIBTOP_CPU_SYS */
+ idle, /* GLIBTOP_CPU_IDLE */
+ frequency; /* GLIBTOP_CPU_FREQUENCY */
+};
+
+#define glibtop_get_cpu(cpu) glibtop_get_cpu__r(glibtop_global_server, cpu)
+
+extern void glibtop_get_cpu__r __P((glibtop *, glibtop_cpu *));
+
+#ifdef HAVE_GUILE
+
+/* You need to link with -lgtop_guile to get this stuff here. */
+
+extern SCM glibtop_guile_get_cpu __P((void));
+
+#endif
+
+#ifdef GLIBTOP_GUILE_NAMES
+
+/* You need to link with -lgtop_guile_names to get this stuff here. */
+
+extern SCM glibtop_guile_names_cpu __P((void));
+extern SCM glibtop_guile_types_cpu __P((void));
+extern SCM glibtop_guile_labels_cpu __P((void));
+extern SCM glibtop_guile_descriptions_cpu __P((void));
+
+#endif
+
+#ifdef GLIBTOP_NAMES
+
+/* You need to link with -lgtop_names to get this stuff here. */
+
+extern const char *glibtop_names_cpu [];
+extern const char *glibtop_types_cpu [];
+extern const char *glibtop_labels_cpu [];
+extern const char *glibtop_descriptions_cpu [];
+
+#endif
+
+__END_DECLS
+
+#endif
diff --git a/include/glibtop/error.h b/include/glibtop/error.h
new file mode 100644
index 00000000..94e14ba9
--- /dev/null
+++ b/include/glibtop/error.h
@@ -0,0 +1,35 @@
+/* $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_ERROR_H__
+#define __GLIBTOP_ERROR_H__
+
+#include <glibtop.h>
+
+__BEGIN_DECLS
+
+#define glibtop_error(p1, args...) glibtop_error__r(glibtop_global_server , p1 , ## args)
+
+extern void glibtop_error__r __P((glibtop *, char *, ...));
+
+__END_DECLS
+
+#endif
diff --git a/include/glibtop/global.h b/include/glibtop/global.h
new file mode 100644
index 00000000..d1609f35
--- /dev/null
+++ b/include/glibtop/global.h
@@ -0,0 +1,93 @@
+/* $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_GLOBAL_H__
+#define __GLIBTOP_GLOBAL_H__
+
+#include <config.h>
+
+/* __BEGIN_DECLS should be used at the beginning of your declarations,
+ so that C++ compilers don't mangle their names. Use __END_DECLS at
+ the end of C declarations. */
+
+#undef __BEGIN_DECLS
+#undef __END_DECLS
+#ifdef __cplusplus
+# define __BEGIN_DECLS extern "C" {
+# define __END_DECLS }
+#else
+# define __BEGIN_DECLS /* empty */
+# define __END_DECLS /* empty */
+#endif
+
+/* __P is a macro used to wrap function prototypes, so that compilers
+ that don't understand ANSI C prototypes still work, and ANSI C
+ compilers can issue warnings about type mismatches. */
+
+#undef __P
+#if defined (__STDC__) || defined (_AIX) \
+|| (defined (__mips) && defined (_SYSTYPE_SVR4)) \
+ || defined(WIN32) || defined(__cplusplus)
+# define __P(protos) protos
+#else
+# define __P(protos) ()
+#endif
+
+#ifdef HAVE_GUILE
+#include <guile/gh.h>
+#endif
+
+#if (defined HAVE_LIBINTL_H) || (defined HAVE_GETTEXT)
+#include <libintl.h>
+#else
+#include <libgettext.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <stdarg.h>
+#include <unistd.h>
+
+#ifdef HAVE_MEMORY_H
+#include <memory.h>
+#endif
+
+#include <string.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <signal.h>
+#include <errno.h>
+
+__BEGIN_DECLS
+
+#ifndef _
+#define _(String) gettext (String)
+#define N_(String) (String)
+#endif
+
+#ifndef HAVE_STRERROR
+extern char *strerror __P((int));
+#endif
+
+__END_DECLS
+
+#endif
diff --git a/include/glibtop/loadavg.h b/include/glibtop/loadavg.h
new file mode 100644
index 00000000..d33b589c
--- /dev/null
+++ b/include/glibtop/loadavg.h
@@ -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. */
+
+#ifndef __GLIBTOP_LOADAVG_H__
+#define __GLIBTOP_LOADAVG_H__
+
+#include <glibtop.h>
+#include <glibtop/global.h>
+
+__BEGIN_DECLS
+
+#define GLIBTOP_LOADAVG_LOADAVG 0
+
+#define GLIBTOP_MAX_LOADAVG 1
+
+typedef struct _glibtop_loadavg glibtop_loadavg;
+
+struct _glibtop_loadavg
+{
+ unsigned long flags;
+ double loadavg [3]; /* GLIBTOP_LOADAVG_LOADAVG */
+};
+
+#define glibtop_get_loadavg(loadavg) glibtop_get_loadavg__r(glibtop_global_server, loadavg)
+
+extern void glibtop_get_loadavg__r __P((glibtop *, glibtop_loadavg *));
+
+#ifdef HAVE_GUILE
+
+/* You need to link with -lgtop_guile to get this stuff here. */
+
+extern SCM glibtop_guile_get_loadavg __P((void));
+
+#endif
+
+#ifdef GLIBTOP_GUILE_NAMES
+
+/* You need to link with -lgtop_guile_names to get this stuff here. */
+
+extern SCM glibtop_guile_names_loadavg __P((void));
+extern SCM glibtop_guile_types_loadavg __P((void));
+extern SCM glibtop_guile_labels_loadavg __P((void));
+extern SCM glibtop_guile_descriptions_loadavg __P((void));
+
+#endif
+
+#ifdef GLIBTOP_NAMES
+
+/* You need to link with -lgtop_names to get this stuff here. */
+
+extern const char *glibtop_names_loadavg [];
+extern const char *glibtop_types_loadavg [];
+extern const char *glibtop_labels_loadavg [];
+extern const char *glibtop_descriptions_loadavg [];
+
+#endif
+
+__END_DECLS
+
+#endif
diff --git a/include/glibtop/mem.h b/include/glibtop/mem.h
new file mode 100644
index 00000000..a2eaca95
--- /dev/null
+++ b/include/glibtop/mem.h
@@ -0,0 +1,90 @@
+/* $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_MEM_H__
+#define __GLIBTOP_MEM_H__
+
+#include <glibtop.h>
+#include <glibtop/global.h>
+
+__BEGIN_DECLS
+
+#define GLIBTOP_MEM_TOTAL 0
+#define GLIBTOP_MEM_USED 1
+#define GLIBTOP_MEM_FREE 2
+#define GLIBTOP_MEM_SHARED 3
+#define GLIBTOP_MEM_BUFFER 4
+#define GLIBTOP_MEM_CACHED 5
+#define GLIBTOP_MEM_USER 6
+
+#define GLIBTOP_MAX_MEM 7
+
+typedef struct _glibtop_mem glibtop_mem;
+
+struct _glibtop_mem
+{
+ unsigned long flags,
+ total, /* GLIBTOP_MEM_TOTAL */
+ used, /* GLIBTOP_MEM_USED */
+ free, /* GLIBTOP_MEM_FREE */
+ shared, /* GLIBTOP_MEM_SHARED */
+ buffer, /* GLIBTOP_MEM_BUFFER */
+ cached, /* GLIBTOP_MEM_CACHED */
+ user; /* GLIBTOP_MEM_USER */
+};
+
+#define glibtop_get_mem(mem) glibtop_get_mem__r(glibtop_global_server, mem)
+
+extern void glibtop_get_mem__r __P((glibtop *, glibtop_mem *));
+
+#ifdef HAVE_GUILE
+
+/* You need to link with -lgtop_guile to get this stuff here. */
+
+extern SCM glibtop_guile_get_mem __P((void));
+
+#endif
+
+#ifdef GLIBTOP_GUILE_NAMES
+
+/* You need to link with -lgtop_guile_names to get this stuff here. */
+
+extern SCM glibtop_guile_names_mem __P((void));
+extern SCM glibtop_guile_types_mem __P((void));
+extern SCM glibtop_guile_labels_mem __P((void));
+extern SCM glibtop_guile_descriptions_mem __P((void));
+
+#endif
+
+#ifdef GLIBTOP_NAMES
+
+/* You need to link with -lgtop_names to get this stuff here. */
+
+extern const char *glibtop_names_mem [];
+extern const char *glibtop_types_mem [];
+extern const char *glibtop_labels_mem [];
+extern const char *glibtop_descriptions_mem [];
+
+#endif
+
+__END_DECLS
+
+#endif
diff --git a/include/glibtop/msg_limits.h b/include/glibtop/msg_limits.h
new file mode 100644
index 00000000..a45b8ba7
--- /dev/null
+++ b/include/glibtop/msg_limits.h
@@ -0,0 +1,90 @@
+/* $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_MSG_LIMITS_H__
+#define __GLIBTOP_MSG_LIMITS_H__
+
+#include <glibtop.h>
+#include <glibtop/global.h>
+
+__BEGIN_DECLS
+
+#define GLIBTOP_IPC_MSGPOOL 0
+#define GLIBTOP_IPC_MSGMAP 1
+#define GLIBTOP_IPC_MSGMAX 2
+#define GLIBTOP_IPC_MSGMNB 3
+#define GLIBTOP_IPC_MSGMNI 4
+#define GLIBTOP_IPC_MSGSSZ 5
+#define GLIBTOP_IPC_MSGTQL 6
+
+#define GLIBTOP_MAX_MSG_LIMITS 7
+
+typedef struct _glibtop_msg_limits glibtop_msg_limits;
+
+struct _glibtop_msg_limits
+{
+ unsigned long flags,
+ msgpool, /* GLIBTOP_IPC_MSGPOOL */
+ msgmap, /* GLIBTOP_IPC_MSGMAP */
+ msgmax, /* GLIBTOP_IPC_MSGMAX */
+ msgmnb, /* GLIBTOP_IPC_MSGMNB */
+ msgmni, /* GLIBTOP_IPC_MSGMNI */
+ msgssz, /* GLIBTOP_IPC_MSGSSZ */
+ msgtql; /* GLIBTOP_IPC_MSGTQL */
+};
+
+#define glibtop_get_msg_limits(msg) glibtop_get_msg_limits__r(glibtop_global_server, msg)
+
+extern void glibtop_get_msg_limits__r __P((glibtop *, glibtop_msg_limits *));
+
+#ifdef HAVE_GUILE
+
+/* You need to link with -lgtop_guile to get this stuff here. */
+
+extern SCM glibtop_guile_get_msg_limits __P((void));
+
+#endif
+
+#ifdef GLIBTOP_GUILE_NAMES
+
+/* You need to link with -lgtop_guile_names to get this stuff here. */
+
+extern SCM glibtop_guile_names_msg_limits __P((void));
+extern SCM glibtop_guile_types_msg_limits __P((void));
+extern SCM glibtop_guile_labels_msg_limits __P((void));
+extern SCM glibtop_guile_descriptions_msg_limits __P((void));
+
+#endif
+
+#ifdef GLIBTOP_NAMES
+
+/* You need to link with -lgtop_names to get this stuff here. */
+
+extern const char *glibtop_names_msg_limits [];
+extern const char *glibtop_types_msg_limits [];
+extern const char *glibtop_labels_msg_limits [];
+extern const char *glibtop_descriptions_msg_limits [];
+
+#endif
+
+__END_DECLS
+
+#endif
diff --git a/include/glibtop/open.h b/include/glibtop/open.h
new file mode 100644
index 00000000..8be5a9ae
--- /dev/null
+++ b/include/glibtop/open.h
@@ -0,0 +1,33 @@
+/* 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_OPEN_H__
+#define __GLIBTOP_OPEN_H__
+
+#include <glibtop.h>
+#include <glibtop/read.h>
+#include <glibtop/error.h>
+
+__BEGIN_DECLS
+
+extern void glibtop_open __P((glibtop *, const char *));
+
+__END_DECLS
+
+#endif
diff --git a/include/glibtop/output.h b/include/glibtop/output.h
new file mode 100644
index 00000000..293a967d
--- /dev/null
+++ b/include/glibtop/output.h
@@ -0,0 +1,33 @@
+/* $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_OUTPUT_H__
+#define __GLIBTOP_OUTPUT_H__
+
+#include <glibtop/global.h>
+
+__BEGIN_DECLS
+
+extern void glibtop_output __P((size_t, const void *));
+
+__END_DECLS
+
+#endif
diff --git a/include/glibtop/prockernel.h b/include/glibtop/prockernel.h
new file mode 100644
index 00000000..90a43b65
--- /dev/null
+++ b/include/glibtop/prockernel.h
@@ -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. */
+
+#ifndef __GLIBTOP_PROCKERNEL_H__
+#define __GLIBTOP_PROCKERNEL_H__
+
+#include <glibtop.h>
+#include <glibtop/global.h>
+
+__BEGIN_DECLS
+
+#define GLIBTOP_PROC_KERNEL_K_FLAGS 0
+#define GLIBTOP_PROC_KERNEL_MIN_FLT 1
+#define GLIBTOP_PROC_KERNEL_MAJ_FLT 2
+#define GLIBTOP_PROC_KERNEL_CMIN_FLT 3
+#define GLIBTOP_PROC_KERNEL_CMAJ_FLT 4
+#define GLIBTOP_PROC_KERNEL_KSTK_ESP 5
+#define GLIBTOP_PROC_KERNEL_KSTK_EIP 6
+#define GLIBTOP_PROC_KERNEL_WCHAN 7
+
+#define GLIBTOP_MAX_PROC_KERNEL 8
+
+typedef struct _glibtop_proc_kernel glibtop_proc_kernel;
+
+/* Kernel stuff */
+
+struct _glibtop_proc_kernel
+{
+ unsigned long flags;
+ unsigned long k_flags, /* kernel flags for the process */
+ min_flt, /* number of minor page faults since
+ * process start */
+ maj_flt, /* number of major page faults since
+ * process start */
+ cmin_flt, /* cumulative min_flt of process and
+ * child processes */
+ cmaj_flt, /* cumulative maj_flt of process and
+ * child processes */
+ kstk_esp, /* kernel stack pointer */
+ kstk_eip, /* kernel stack pointer */
+ wchan; /* address of kernel wait channel
+ * proc is sleeping in */
+};
+
+#define glibtop_get_proc_kernel(p1, p2) glibtop_get_proc_kernel__r(glibtop_global_server, p1, p2)
+
+extern void glibtop_get_proc_kernel__r __P((glibtop *, glibtop_proc_kernel *, pid_t));
+
+#ifdef HAVE_GUILE
+
+/* You need to link with -lgtop_guile to get this stuff here. */
+
+extern SCM glibtop_guile_get_proc_kernel __P((SCM));
+
+#endif
+
+#ifdef GLIBTOP_GUILE_NAMES
+
+/* You need to link with -lgtop_guile_names to get this stuff here. */
+
+extern SCM glibtop_guile_types_proc_kernel __P((void));
+extern SCM glibtop_guile_names_proc_kernel __P((void));
+extern SCM glibtop_guile_labels_proc_kernel __P((void));
+extern SCM glibtop_guile_descriptions_proc_kernel __P((void));
+
+#endif
+
+#ifdef GLIBTOP_NAMES
+
+/* You need to link with -lgtop_names to get this stuff here. */
+
+extern const char *glibtop_types_proc_kernel [];
+extern const char *glibtop_names_proc_kernel [];
+extern const char *glibtop_labels_proc_kernel [];
+extern const char *glibtop_descriptions_proc_kernel [];
+
+#endif
+
+__END_DECLS
+
+#endif
diff --git a/include/glibtop/proclist.h b/include/glibtop/proclist.h
new file mode 100644
index 00000000..d163b828
--- /dev/null
+++ b/include/glibtop/proclist.h
@@ -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. */
+
+#ifndef __GLIBTOP_PROCLIST_H__
+#define __GLIBTOP_PROCLIST_H__
+
+#include <glibtop.h>
+#include <glibtop/global.h>
+
+__BEGIN_DECLS
+
+#define GLIBTOP_PROCLIST_NUMBER 0
+#define GLIBTOP_PROCLIST_TOTAL 1
+#define GLIBTOP_PROCLIST_SIZE 2
+
+#define GLIBTOP_MAX_PROCLIST 3
+
+typedef struct _glibtop_proclist glibtop_proclist;
+
+struct _glibtop_proclist
+{
+ unsigned long flags,
+ number, /* GLIBTOP_PROCLIST_NUMBER */
+ total, /* GLIBTOP_PROCLIST_TOTAL */
+ size; /* GLIBTOP_PROCLIST_SIZE */
+};
+
+#define glibtop_get_proclist(proclist) glibtop_get_proclist__r(glibtop_global_server, proclist)
+
+extern unsigned *glibtop_get_proclist__r __P((glibtop *, glibtop_proclist *));
+
+#ifdef HAVE_GUILE
+
+/* You need to link with -lgtop_guile to get this stuff here. */
+
+extern SCM glibtop_guile_get_proclist __P((void));
+
+#endif
+
+#ifdef GLIBTOP_GUILE_NAMES
+
+/* You need to link with -lgtop_guile_names to get this stuff here. */
+
+extern SCM glibtop_guile_names_proclist __P((void));
+extern SCM glibtop_guile_types_proclist __P((void));
+extern SCM glibtop_guile_labels_proclist __P((void));
+extern SCM glibtop_guile_descriptions_proclist __P((void));
+
+#endif
+
+#ifdef GLIBTOP_NAMES
+
+/* You need to link with -lgtop_names to get this stuff here. */
+
+extern const char *glibtop_names_proclist [];
+extern const char *glibtop_types_proclist [];
+extern const char *glibtop_labels_proclist [];
+extern const char *glibtop_descriptions_proclist [];
+
+#endif
+
+__END_DECLS
+
+#endif
diff --git a/include/glibtop/procmem.h b/include/glibtop/procmem.h
new file mode 100644
index 00000000..bcca778a
--- /dev/null
+++ b/include/glibtop/procmem.h
@@ -0,0 +1,92 @@
+/* $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_PROCMEM_H__
+#define __GLIBTOP_PROCMEM_H__
+
+#include <glibtop.h>
+#include <glibtop/global.h>
+
+__BEGIN_DECLS
+
+#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
+
+#define GLIBTOP_MAX_PROC_MEM 6
+
+typedef struct _glibtop_proc_mem glibtop_proc_mem;
+
+/* Memory section */
+
+struct _glibtop_proc_mem
+{
+ unsigned long flags;
+ long size, /* total # of pages of memory */
+ vsize, /* number of pages of virtual memory ... */
+ resident, /* number of resident set
+ * (non-swapped) pages (4k) */
+ share, /* number of pages of shared (mmap'd) memory */
+ rss, /* resident set size */
+ rss_rlim; /* current limit (in bytes) of the rss
+ * of the process; usually 2,147,483,647 */
+};
+
+#define glibtop_get_proc_mem(p1, p2) glibtop_get_proc_mem__r(glibtop_global_server, p1, p2)
+
+extern void glibtop_get_proc_mem__r __P((glibtop *, glibtop_proc_mem *, pid_t));
+
+#ifdef HAVE_GUILE
+
+/* You need to link with -lgtop_guile to get this stuff here. */
+
+extern SCM glibtop_guile_get_proc_mem __P((SCM));
+
+#endif
+
+#ifdef GLIBTOP_GUILE_NAMES
+
+/* You need to link with -lgtop_guile_names to get this stuff here. */
+
+extern SCM glibtop_guile_types_proc_mem __P((void));
+extern SCM glibtop_guile_names_proc_mem __P((void));
+extern SCM glibtop_guile_labels_proc_mem __P((void));
+extern SCM glibtop_guile_descriptions_proc_mem __P((void));
+
+#endif
+
+#ifdef GLIBTOP_NAMES
+
+/* You need to link with -lgtop_names to get this stuff here. */
+
+extern const char *glibtop_names_proc_mem [];
+extern const char *glibtop_types_proc_mem [];
+extern const char *glibtop_labels_proc_mem [];
+extern const char *glibtop_descriptions_proc_mem [];
+
+#endif
+
+__END_DECLS
+
+#endif
diff --git a/include/glibtop/procsegment.h b/include/glibtop/procsegment.h
new file mode 100644
index 00000000..b52f5bbf
--- /dev/null
+++ b/include/glibtop/procsegment.h
@@ -0,0 +1,93 @@
+/* $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_PROCSEGMENT_H__
+#define __GLIBTOP_PROCSEGMENT_H__
+
+#include <glibtop.h>
+#include <glibtop/global.h>
+
+__BEGIN_DECLS
+
+#define GLIBTOP_PROC_SEGMENT_TRS 0
+#define GLIBTOP_PROC_SEGMENT_LRS 1
+#define GLIBTOP_PROC_SEGMENT_DRS 2
+#define GLIBTOP_PROC_SEGMENT_DT 3
+#define GLIBTOP_PROC_SEGMENT_START_CODE 4
+#define GLIBTOP_PROC_SEGMENT_END_CODE 5
+#define GLIBTOP_PROC_SEGMENT_START_STACK 6
+
+#define GLIBTOP_MAX_PROC_SEGMENT 7
+
+typedef struct _glibtop_proc_segment glibtop_proc_segment;
+
+/* Segment stuff */
+
+struct _glibtop_proc_segment
+{
+ unsigned long flags;
+ long trs, /* text resident set size */
+ lrs, /* shared-lib resident set size */
+ drs, /* data resident set size */
+ dt; /* dirty pages */
+ unsigned long start_code,
+ /* address of beginning of code segment */
+ end_code, /* address of end of code segment */
+ start_stack; /* address of the bottom of stack segment */
+};
+
+#define glibtop_get_proc_segment(p1, p2) glibtop_get_proc_segment__r(glibtop_global_server, p1, p2)
+
+extern void glibtop_get_proc_segment__r __P((glibtop *, glibtop_proc_segment *, pid_t));
+
+#ifdef HAVE_GUILE
+
+/* You need to link with -lgtop_guile to get this stuff here. */
+
+extern SCM glibtop_guile_get_proc_segment __P((SCM));
+
+#endif
+
+#ifdef GLIBTOP_GUILE_NAMES
+
+/* You need to link with -lgtop_guile_names to get this stuff here. */
+
+extern SCM glibtop_guile_names_proc_segment __P((void));
+extern SCM glibtop_guile_types_proc_segment __P((void));
+extern SCM glibtop_guile_labels_proc_segment __P((void));
+extern SCM glibtop_guile_descriptions_proc_segment __P((void));
+
+#endif
+
+#ifdef GLIBTOP_NAMES
+
+/* You need to link with -lgtop_names to get this stuff here. */
+
+extern const char *glibtop_types_proc_segment [];
+extern const char *glibtop_names_proc_segment [];
+extern const char *glibtop_labels_proc_segment [];
+extern const char *glibtop_descriptions_proc_segment [];
+
+#endif
+
+__END_DECLS
+
+#endif
diff --git a/include/glibtop/procsignal.h b/include/glibtop/procsignal.h
new file mode 100644
index 00000000..dda8a5bf
--- /dev/null
+++ b/include/glibtop/procsignal.h
@@ -0,0 +1,86 @@
+/* $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_PROCSIGNAL_H__
+#define __GLIBTOP_PROCSIGNAL_H__
+
+#include <glibtop.h>
+#include <glibtop/global.h>
+
+__BEGIN_DECLS
+
+#define GLIBTOP_PROC_SIGNAL_SIGNAL 0
+#define GLIBTOP_PROC_SIGNAL_BLOCKED 1
+#define GLIBTOP_PROC_SIGNAL_SIGIGNORE 2
+#define GLIBTOP_PROC_SIGNAL_SIGCATCH 3
+
+#define GLIBTOP_MAX_PROC_SIGNAL 4
+
+typedef struct _glibtop_proc_signal glibtop_proc_signal;
+
+/* Signals section */
+
+struct _glibtop_proc_signal
+{
+ unsigned long flags;
+ int signal, /* mask of pending signals */
+ blocked, /* mask of blocked signals */
+ sigignore, /* mask of ignored signals */
+ sigcatch; /* mask of caught signals */
+};
+
+#define glibtop_get_proc_signal(p1, p2) glibtop_get_proc_signal__r(glibtop_global_server, p1, p2)
+
+extern void glibtop_get_proc_signal__r __P((glibtop *, glibtop_proc_signal *, pid_t));
+
+#ifdef HAVE_GUILE
+
+/* You need to link with -lgtop_guile to get this stuff here. */
+
+extern SCM glibtop_guile_get_proc_signal __P((SCM));
+
+#endif
+
+#ifdef GLIBTOP_GUILE_NAMES
+
+/* You need to link with -lgtop_guile_names to get this stuff here. */
+
+extern SCM glibtop_guile_names_proc_signal __P((void));
+extern SCM glibtop_guile_types_proc_signal __P((void));
+extern SCM glibtop_guile_labels_proc_signal __P((void));
+extern SCM glibtop_guile_descriptions_proc_signal __P((void));
+
+#endif
+
+#ifdef GLIBTOP_NAMES
+
+/* You need to link with -lgtop_names to get this stuff here. */
+
+extern const char *glibtop_names_proc_signal [];
+extern const char *glibtop_types_proc_signal [];
+extern const char *glibtop_labels_proc_signal [];
+extern const char *glibtop_descriptions_proc_signal [];
+
+#endif
+
+__END_DECLS
+
+#endif
diff --git a/include/glibtop/procstate.h b/include/glibtop/procstate.h
new file mode 100644
index 00000000..c03f20d0
--- /dev/null
+++ b/include/glibtop/procstate.h
@@ -0,0 +1,93 @@
+/* $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_PROCSTATE_H__
+#define __GLIBTOP_PROCSTATE_H__
+
+#include <glibtop.h>
+#include <glibtop/global.h>
+
+__BEGIN_DECLS
+
+#define GLIBTOP_PROC_STATE_CMD 0
+#define GLIBTOP_PROC_STATE_STATE 1
+#define GLIBTOP_PROC_STATE_UID 2
+#define GLIBTOP_PROC_STATE_GID 3
+
+#define GLIBTOP_MAX_PROC_STATE 4
+
+typedef struct _glibtop_proc_state glibtop_proc_state;
+
+/* Name and status */
+
+struct _glibtop_proc_state
+{
+ unsigned long flags;
+ char cmd[40], /* basename of executable file in
+ * call to exec(2) */
+ state; /* single-char code for process state
+ * (S=sleeping) */
+ /* NOTE: when porting the library, TRY HARD to implement the
+ * following two fields. */
+ /* IMPORTANT NOTICE: For security reasons, it is extremely important
+ * only to set the flags value for those two
+ * fields if their values are corrent ! */
+ int uid, /* UID of process */
+ gid; /* GID of process */
+};
+
+#define glibtop_get_proc_state(p1, p2) glibtop_get_proc_state__r(glibtop_global_server, p1, p2)
+
+extern void glibtop_get_proc_state__r __P((glibtop *, glibtop_proc_state *, pid_t));
+
+#ifdef HAVE_GUILE
+
+/* You need to link with -lgtop_guile to get this stuff here. */
+
+extern SCM glibtop_guile_get_proc_state __P((SCM));
+
+#endif
+
+#ifdef GLIBTOP_GUILE_NAMES
+
+/* You need to link with -lgtop_guile_names to get this stuff here. */
+
+extern SCM glibtop_guile_names_proc_state __P((void));
+extern SCM glibtop_guile_types_proc_state __P((void));
+extern SCM glibtop_guile_labels_proc_state __P((void));
+extern SCM glibtop_guile_descriptions_proc_state __P((void));
+
+#endif
+
+#ifdef GLIBTOP_NAMES
+
+/* You need to link with -lgtop_names to get this stuff here. */
+
+extern const char *glibtop_names_proc_state [];
+extern const char *glibtop_types_proc_state [];
+extern const char *glibtop_labels_proc_state [];
+extern const char *glibtop_descriptions_proc_state [];
+
+#endif
+
+__END_DECLS
+
+#endif
diff --git a/include/glibtop/proctime.h b/include/glibtop/proctime.h
new file mode 100644
index 00000000..50d08c17
--- /dev/null
+++ b/include/glibtop/proctime.h
@@ -0,0 +1,98 @@
+/* $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_PROCTIME_H__
+#define __GLIBTOP_PROCTIME_H__
+
+#include <glibtop.h>
+#include <glibtop/global.h>
+
+__BEGIN_DECLS
+
+#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
+
+#define GLIBTOP_MAX_PROC_TIME 7
+
+typedef struct _glibtop_proc_time glibtop_proc_time;
+
+/* Time section */
+
+struct _glibtop_proc_time
+{
+ unsigned long flags;
+ long start_time, /* start time of process --
+ * seconds since 1-1-70 */
+ utime, /* user-mode CPU time accumulated by process */
+ stime, /* kernel-mode CPU time accumulated by process */
+ cutime, /* cumulative utime of process and
+ * reaped children */
+ cstime, /* cumulative stime of process and
+ * reaped children */
+ timeout, /* The time (in jiffies) of the process's
+ * next timeout */
+ it_real_value; /* The time (in jiffies) before the
+ * next SIGALRM is sent to the process
+ * due to an interval timer. */
+};
+
+#define glibtop_get_proc_time(p1, p2) glibtop_get_proc_time__r(glibtop_global_server, p1, p2)
+
+extern void glibtop_get_proc_time__r __P((glibtop *, glibtop_proc_time *, pid_t));
+
+#ifdef HAVE_GUILE
+
+/* You need to link with -lgtop_guile to get this stuff here. */
+
+extern SCM glibtop_guile_get_proc_time __P((SCM));
+
+#endif
+
+#ifdef GLIBTOP_GUILE_NAMES
+
+/* You need to link with -lgtop_guile_names to get this stuff here. */
+
+extern SCM glibtop_guile_names_proc_time __P((void));
+extern SCM glibtop_guile_types_proc_time __P((void));
+extern SCM glibtop_guile_labels_proc_time __P((void));
+extern SCM glibtop_guile_descriptions_proc_time __P((void));
+
+#endif
+
+#ifdef GLIBTOP_NAMES
+
+/* You need to link with -lgtop_names to get this stuff here. */
+
+extern const char *glibtop_names_proc_time [];
+extern const char *glibtop_types_proc_time [];
+extern const char *glibtop_labels_proc_time [];
+extern const char *glibtop_descriptions_proc_time [];
+
+#endif
+
+__END_DECLS
+
+#endif
diff --git a/include/glibtop/procuid.h b/include/glibtop/procuid.h
new file mode 100644
index 00000000..decb9c25
--- /dev/null
+++ b/include/glibtop/procuid.h
@@ -0,0 +1,102 @@
+/* $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_PROCUID_H__
+#define __GLIBTOP_PROCUID_H__
+
+#include <glibtop.h>
+#include <glibtop/global.h>
+
+__BEGIN_DECLS
+
+#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
+
+#define GLIBTOP_MAX_PROC_UID 12
+
+typedef struct _glibtop_proc_uid glibtop_proc_uid;
+
+/* User, Group, Terminal and session */
+
+struct _glibtop_proc_uid
+{
+ unsigned long flags;
+ int uid, /* user id */
+ euid, /* effective user id */
+ gid, /* group id */
+ egid, /* effective group id */
+ pid, /* process id */
+ ppid, /* pid of parent process */
+ pgrp, /* process group id */
+ session, /* session id */
+ tty, /* full device number of controlling terminal */
+ tpgid, /* terminal process group id */
+ priority, /* kernel scheduling priority */
+ nice; /* standard unix nice level of process */
+};
+
+#define glibtop_get_proc_uid(p1, p2) glibtop_get_proc_uid__r(glibtop_global_server, p1, p2)
+
+extern void glibtop_get_proc_uid__r __P((glibtop *, glibtop_proc_uid *, pid_t));
+
+#ifdef HAVE_GUILE
+
+/* You need to link with -lgtop_guile to get this stuff here. */
+
+extern SCM glibtop_guile_get_proc_uid __P((SCM));
+
+#endif
+
+#ifdef GLIBTOP_GUILE_NAMES
+
+/* You need to link with -lgtop_guile_names to get this stuff here. */
+
+extern SCM glibtop_guile_names_proc_uid __P((void));
+extern SCM glibtop_guile_types_proc_uid __P((void));
+extern SCM glibtop_guile_labels_proc_uid __P((void));
+extern SCM glibtop_guile_descriptions_proc_uid __P((void));
+
+#endif
+
+#ifdef GLIBTOP_NAMES
+
+/* You need to link with -lgtop_names to get this stuff here. */
+
+extern const char *glibtop_names_proc_uid [];
+extern const char *glibtop_types_proc_uid [];
+extern const char *glibtop_labels_proc_uid [];
+extern const char *glibtop_descriptions_proc_uid [];
+
+#endif
+
+__END_DECLS
+
+#endif
diff --git a/include/glibtop/read.h b/include/glibtop/read.h
new file mode 100644
index 00000000..ef9a3ea0
--- /dev/null
+++ b/include/glibtop/read.h
@@ -0,0 +1,36 @@
+/* $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_READ_H__
+#define __GLIBTOP_READ_H__
+
+#include <glibtop.h>
+#include <glibtop/error.h>
+
+__BEGIN_DECLS
+
+#define glibtop_read(p1, p2) glibtop_read(glibtop_global_server, p1, p2)
+
+extern void glibtop_read__r __P((glibtop *, size_t, void *));
+
+__END_DECLS
+
+#endif
diff --git a/include/glibtop/read_data.h b/include/glibtop/read_data.h
new file mode 100644
index 00000000..f0c54294
--- /dev/null
+++ b/include/glibtop/read_data.h
@@ -0,0 +1,36 @@
+/* $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_READ_DATA_H__
+#define __GLIBTOP_READ_DATA_H__
+
+#include <glibtop.h>
+#include <glibtop/error.h>
+
+__BEGIN_DECLS
+
+#define glibtop_read_data() glibtop_read_data__r(glibtop_global_server)
+
+extern void *glibtop_read_data__r __P((glibtop *));
+
+__END_DECLS
+
+#endif
diff --git a/include/glibtop/sem_limits.h b/include/glibtop/sem_limits.h
new file mode 100644
index 00000000..283f0029
--- /dev/null
+++ b/include/glibtop/sem_limits.h
@@ -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. */
+
+#ifndef __GLIBTOP_SEM_LIMITS_H__
+#define __GLIBTOP_SEM_LIMITS_H__
+
+#include <glibtop.h>
+#include <glibtop/global.h>
+
+__BEGIN_DECLS
+
+#define GLIBTOP_IPC_SEMMAP 0
+#define GLIBTOP_IPC_SEMMNI 1
+#define GLIBTOP_IPC_SEMMNS 2
+#define GLIBTOP_IPC_SEMMNU 3
+#define GLIBTOP_IPC_SEMMSL 4
+#define GLIBTOP_IPC_SEMOPM 5
+#define GLIBTOP_IPC_SEMUME 6
+#define GLIBTOP_IPC_SEMUSZ 7
+#define GLIBTOP_IPC_SEMVMX 8
+#define GLIBTOP_IPC_SEMAEM 9
+
+#define GLIBTOP_MAX_SEM_LIMITS 10
+
+typedef struct _glibtop_sem_limits glibtop_sem_limits;
+
+struct _glibtop_sem_limits
+{
+ unsigned long flags,
+ semmap, /* GLIBTOP_IPC_SEMMAP */
+ semmni, /* GLIBTOP_IPC_SEMMNI */
+ semmns, /* GLIBTOP_IPC_SEMMNS */
+ semmnu, /* GLIBTOP_IPC_SEMMNU */
+ semmsl, /* GLIBTOP_IPC_SEMMSL */
+ semopm, /* GLIBTOP_IPC_SEMOPM */
+ semume, /* GLIBTOP_IPC_SEMUME */
+ semusz, /* GLIBTOP_IPC_SEMUSZ */
+ semvmx, /* GLIBTOP_IPC_SEMVMX */
+ semaem; /* GLIBTOP_IPC_SEMAEM */
+};
+
+#define glibtop_get_sem_limits(sem) glibtop_get_sem_limits__r(glibtop_global_server, sem)
+
+extern void glibtop_get_sem_limits__r __P((glibtop *, glibtop_sem_limits *));
+
+#ifdef HAVE_GUILE
+
+/* You need to link with -lgtop_guile to get this stuff here. */
+
+extern SCM glibtop_guile_get_sem_limits __P((void));
+
+#endif
+
+#ifdef GLIBTOP_GUILE_NAMES
+
+/* You need to link with -lgtop_guile_names to get this stuff here. */
+
+extern SCM glibtop_guile_names_sem_limits __P((void));
+extern SCM glibtop_guile_types_sem_limits __P((void));
+extern SCM glibtop_guile_labels_sem_limits __P((void));
+extern SCM glibtop_guile_descriptions_sem_limits __P((void));
+
+#endif
+
+#ifdef GLIBTOP_NAMES
+
+/* You need to link with -lgtop_names to get this stuff here. */
+
+extern const char *glibtop_names_sem_limits [];
+extern const char *glibtop_types_sem_limits [];
+extern const char *glibtop_labels_sem_limits [];
+extern const char *glibtop_descriptions_sem_limits [];
+
+#endif
+
+__END_DECLS
+
+#endif
diff --git a/include/glibtop/shm_limits.h b/include/glibtop/shm_limits.h
new file mode 100644
index 00000000..db4a926d
--- /dev/null
+++ b/include/glibtop/shm_limits.h
@@ -0,0 +1,86 @@
+/* $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_SHM_LIMITS_H__
+#define __GLIBTOP_SHM_LIMITS_H__
+
+#include <glibtop.h>
+#include <glibtop/global.h>
+
+__BEGIN_DECLS
+
+#define GLIBTOP_IPC_SHMMAX 0
+#define GLIBTOP_IPC_SHMMIN 1
+#define GLIBTOP_IPC_SHMMNI 2
+#define GLIBTOP_IPC_SHMSEG 3
+#define GLIBTOP_IPC_SHMALL 4
+
+#define GLIBTOP_MAX_SHM_LIMITS 5
+
+typedef struct _glibtop_shm_limits glibtop_shm_limits;
+
+struct _glibtop_shm_limits
+{
+ unsigned long flags,
+ shmmax, /* GLIBTOP_IPC_SHMMAX */
+ shmmin, /* GLIBTOP_IPC_SHMMIN */
+ shmmni, /* GLIBTOP_IPC_SHMMNI */
+ shmseg, /* GLIBTOP_IPC_SHMSEG */
+ shmall; /* GLIBTOP_IPC_SHMALL */
+};
+
+#define glibtop_get_shm_limits(shm) glibtop_get_shm_limits__r(glibtop_global_server, shm)
+
+extern void glibtop_get_shm_limits__r __P((glibtop *, glibtop_shm_limits *));
+
+#ifdef HAVE_GUILE
+
+/* You need to link with -lgtop_guile to get this stuff here. */
+
+extern SCM glibtop_guile_get_shm_limits __P((void));
+
+#endif
+
+#ifdef GLIBTOP_GUILE_NAMES
+
+/* You need to link with -lgtop_guile_names to get this stuff here. */
+
+extern SCM glibtop_guile_names_shm_limits __P((void));
+extern SCM glibtop_guile_types_shm_limits __P((void));
+extern SCM glibtop_guile_labels_shm_limits __P((void));
+extern SCM glibtop_guile_descriptions_shm_limits __P((void));
+
+#endif
+
+#ifdef GLIBTOP_NAMES
+
+/* You need to link with -lgtop_names to get this stuff here. */
+
+extern const char *glibtop_names_shm_limits [];
+extern const char *glibtop_types_shm_limits [];
+extern const char *glibtop_labels_shm_limits [];
+extern const char *glibtop_descriptions_shm_limits [];
+
+#endif
+
+__END_DECLS
+
+#endif
diff --git a/include/glibtop/swap.h b/include/glibtop/swap.h
new file mode 100644
index 00000000..dd42ac30
--- /dev/null
+++ b/include/glibtop/swap.h
@@ -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. */
+
+#ifndef __GLIBTOP_SWAP_H__
+#define __GLIBTOP_SWAP_H__
+
+#include <glibtop.h>
+#include <glibtop/global.h>
+
+__BEGIN_DECLS
+
+#define GLIBTOP_SWAP_TOTAL 0
+#define GLIBTOP_SWAP_USED 1
+#define GLIBTOP_SWAP_FREE 2
+
+#define GLIBTOP_MAX_SWAP 3
+
+typedef struct _glibtop_swap glibtop_swap;
+
+struct _glibtop_swap
+{
+ unsigned long flags,
+ total, /* GLIBTOP_SWAP_TOTAL */
+ used, /* GLIBTOP_SWAP_USED */
+ free; /* GLIBTOP_SWAP_FREE */
+};
+
+#define glibtop_get_swap(swap) glibtop_get_swap__r(glibtop_global_server, swap)
+
+extern void glibtop_get_swap__r __P((glibtop *, glibtop_swap *));
+
+#ifdef HAVE_GUILE
+
+/* You need to link with -lgtop_guile to get this stuff here. */
+
+extern SCM glibtop_guile_get_swap __P((void));
+
+#endif
+
+#ifdef GLIBTOP_GUILE_NAMES
+
+/* You need to link with -lgtop_guile_names to get this stuff here. */
+
+extern SCM glibtop_guile_names_swap __P((void));
+extern SCM glibtop_guile_types_swap __P((void));
+extern SCM glibtop_guile_labels_swap __P((void));
+extern SCM glibtop_guile_descriptions_swap __P((void));
+
+#endif
+
+#ifdef GLIBTOP_NAMES
+
+/* You need to link with -lgtop_names to get this stuff here. */
+
+extern const char *glibtop_names_swap [];
+extern const char *glibtop_types_swap [];
+extern const char *glibtop_labels_swap [];
+extern const char *glibtop_descriptions_swap [];
+
+#endif
+
+__END_DECLS
+
+#endif
diff --git a/include/glibtop/sysdeps.h b/include/glibtop/sysdeps.h
new file mode 100644
index 00000000..b7eec5cb
--- /dev/null
+++ b/include/glibtop/sysdeps.h
@@ -0,0 +1,108 @@
+/* $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_SYSDEPS_H__
+#define __GLIBTOP_SYSDEPS_H__
+
+#include <glibtop.h>
+#include <glibtop/union.h>
+
+__BEGIN_DECLS
+
+#define GLIBTOP_SYSDEPS_CPU 0
+#define GLIBTOP_SYSDEPS_MEM 1
+#define GLIBTOP_SYSDEPS_SWAP 2
+#define GLIBTOP_SYSDEPS_UPTIME 3
+#define GLIBTOP_SYSDEPS_LOADAVG 4
+#define GLIBTOP_SYSDEPS_SHM_LIMITS 5
+#define GLIBTOP_SYSDEPS_MSG_LIMITS 6
+#define GLIBTOP_SYSDEPS_SEM_LIMITS 7
+#define GLIBTOP_SYSDEPS_PROCLIST 8
+#define GLIBTOP_SYSDEPS_PROC_STATE 9
+#define GLIBTOP_SYSDEPS_PROC_UID 10
+#define GLIBTOP_SYSDEPS_PROC_MEM 11
+#define GLIBTOP_SYSDEPS_PROC_TIME 12
+#define GLIBTOP_SYSDEPS_PROC_SIGNAL 13
+#define GLIBTOP_SYSDEPS_PROC_KERNEL 14
+#define GLIBTOP_SYSDEPS_PROC_SEGMENT 15
+
+#define GLIBTOP_MAX_SYSDEPS 16
+
+typedef struct _glibtop_sysdeps glibtop_sysdeps;
+
+struct _glibtop_sysdeps
+{
+ unsigned long flags,
+ cpu, /* glibtop_cpu */
+ mem, /* glibtop_mem */
+ swap, /* glibtop_swap */
+ uptime, /* glibtop_uptime */
+ loadavg, /* glibtop_loadavg */
+ shm_limits, /* glibtop_shm_limits */
+ msg_limits, /* glibtop_msg_limits */
+ sem_limits, /* glibtop_sem_limits */
+ proclist, /* glibtop_proclist */
+ proc_state, /* glibtop_proc_state */
+ proc_uid, /* glibtop_proc_uid */
+ proc_mem, /* glibtop_proc_mem */
+ proc_time, /* glibtop_proc_time */
+ proc_signal, /* glibtop_proc_signal */
+ proc_kernel, /* glibtop_proc_kernel */
+ proc_segment; /* glibtop_proc_segment */
+};
+
+#define glibtop_get_sysdeps(sysdeps) glibtop_get_sysdeps__r(glibtop_global_server,sysdeps)
+
+extern void glibtop_get_sysdeps__r __P((glibtop *, glibtop_sysdeps *));
+
+#ifdef HAVE_GUILE
+
+/* You need to link with -lgtop_guile to get this stuff here. */
+
+extern SCM glibtop_guile_get_sysdeps __P((void));
+
+#endif
+
+#ifdef GLIBTOP_GUILE_NAMES
+
+/* You need to link with -lgtop_guile_names to get this stuff here. */
+
+extern SCM glibtop_guile_names_sysdeps __P((void));
+extern SCM glibtop_guile_types_sysdeps __P((void));
+extern SCM glibtop_guile_labels_sysdeps __P((void));
+extern SCM glibtop_guile_descriptions_sysdeps __P((void));
+
+#endif
+
+#ifdef GLIBTOP_NAMES
+
+/* You need to link with -lgtop_names to get this stuff here. */
+
+extern const char *glibtop_names_sysdeps [];
+extern const char *glibtop_types_sysdeps [];
+extern const char *glibtop_labels_sysdeps [];
+extern const char *glibtop_descriptions_sysdeps [];
+
+#endif
+
+__END_DECLS
+
+#endif
diff --git a/include/glibtop/union.h b/include/glibtop/union.h
new file mode 100644
index 00000000..fb3b6aff
--- /dev/null
+++ b/include/glibtop/union.h
@@ -0,0 +1,69 @@
+/* $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_UNION_H__
+#define __GLIBTOP_UNION_H__
+
+#include <glibtop/cpu.h>
+#include <glibtop/mem.h>
+#include <glibtop/swap.h>
+#include <glibtop/uptime.h>
+#include <glibtop/loadavg.h>
+#include <glibtop/shm_limits.h>
+#include <glibtop/msg_limits.h>
+#include <glibtop/sem_limits.h>
+#include <glibtop/proclist.h>
+
+#include <glibtop/procstate.h>
+#include <glibtop/procuid.h>
+#include <glibtop/procmem.h>
+#include <glibtop/proctime.h>
+#include <glibtop/procsignal.h>
+#include <glibtop/prockernel.h>
+#include <glibtop/procsegment.h>
+
+__BEGIN_DECLS
+
+typedef union _glibtop_union glibtop_union;
+
+union _glibtop_union
+{
+ glibtop_cpu cpu;
+ glibtop_mem mem;
+ glibtop_swap swap;
+ glibtop_uptime uptime;
+ glibtop_loadavg loadavg;
+ glibtop_shm_limits shm_limits;
+ glibtop_msg_limits msg_limits;
+ glibtop_sem_limits sem_limits;
+ glibtop_proclist proclist;
+ glibtop_proc_state proc_state;
+ glibtop_proc_uid proc_uid;
+ glibtop_proc_mem proc_mem;
+ glibtop_proc_time proc_time;
+ glibtop_proc_signal proc_signal;
+ glibtop_proc_kernel proc_kernel;
+ glibtop_proc_segment proc_segment;
+};
+
+__END_DECLS
+
+#endif
diff --git a/include/glibtop/uptime.h b/include/glibtop/uptime.h
new file mode 100644
index 00000000..10815ecb
--- /dev/null
+++ b/include/glibtop/uptime.h
@@ -0,0 +1,80 @@
+/* $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_UPTIME_H__
+#define __GLIBTOP_UPTIME_H__
+
+#include <glibtop.h>
+#include <glibtop/global.h>
+
+__BEGIN_DECLS
+
+#define GLIBTOP_UPTIME_UPTIME 0
+#define GLIBTOP_UPTIME_IDLETIME 1
+
+#define GLIBTOP_MAX_UPTIME 2
+
+typedef struct _glibtop_uptime glibtop_uptime;
+
+struct _glibtop_uptime
+{
+ unsigned long flags;
+ double uptime, /* GLIBTOP_UPTIME_UPTIME */
+ idletime; /* GLIBTOP_UPTIME_IDLETIME */
+};
+
+#define glibtop_get_uptime(uptime) glibtop_get_uptime__r(glibtop_global_server, uptime)
+
+extern void glibtop_get_uptime__r __P((glibtop *, glibtop_uptime *));
+
+#ifdef HAVE_GUILE
+
+/* You need to link with -lgtop_guile to get this stuff here. */
+
+extern SCM glibtop_guile_get_uptime __P((void));
+
+#endif
+
+#ifdef GLIBTOP_GUILE_NAMES
+
+/* You need to link with -lgtop_guile_names to get this stuff here. */
+
+extern SCM glibtop_guile_names_uptime __P((void));
+extern SCM glibtop_guile_types_uptime __P((void));
+extern SCM glibtop_guile_labels_uptime __P((void));
+extern SCM glibtop_guile_descriptions_uptime __P((void));
+
+#endif
+
+#ifdef GLIBTOP_NAMES
+
+/* You need to link with -lgtop_names to get this stuff here. */
+
+extern const char *glibtop_names_uptime [];
+extern const char *glibtop_types_uptime [];
+extern const char *glibtop_labels_uptime [];
+extern const char *glibtop_descriptions_uptime [];
+
+#endif
+
+__END_DECLS
+
+#endif
diff --git a/include/glibtop/version.h b/include/glibtop/version.h
new file mode 100644
index 00000000..5676b997
--- /dev/null
+++ b/include/glibtop/version.h
@@ -0,0 +1,31 @@
+/* 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_VERSION_H__
+#define __GLIBTOP_VERSION_H__
+
+#include <glibtop/output.h>
+
+__BEGIN_DECLS
+
+extern void glibtop_version __P((void));
+
+__END_DECLS
+
+#endif
diff --git a/include/glibtop/write.h b/include/glibtop/write.h
new file mode 100644
index 00000000..e7acb1fc
--- /dev/null
+++ b/include/glibtop/write.h
@@ -0,0 +1,36 @@
+/* $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_WRITE_H__
+#define __GLIBTOP_WRITE_H__
+
+#include <glibtop.h>
+#include <glibtop/error.h>
+
+__BEGIN_DECLS
+
+#define glibtop_write(p1, p2) glibtop_write(glibtop_global_server, p1, p2)
+
+extern void glibtop_write__r __P((glibtop *, size_t, void *));
+
+__END_DECLS
+
+#endif
diff --git a/include/glibtop/xmalloc.h b/include/glibtop/xmalloc.h
new file mode 100644
index 00000000..14a6709c
--- /dev/null
+++ b/include/glibtop/xmalloc.h
@@ -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. */
+
+#ifndef __GLIBTOP_XMALLOC_H__
+#define __GLIBTOP_XMALLOC_H__
+
+#include <glibtop.h>
+#include <glibtop/error.h>
+
+__BEGIN_DECLS
+
+#define glibtop_malloc(p1) glibtop_malloc__r(glibtop_global_server, p1)
+#define glibtop_calloc(p1, p2) glibtop_calloc__r(glibtop_global_server, p1, p2)
+#define glibtop_realloc(p1, p2) glibtop_realloc__r(glibtop_global_server, p1, p2)
+#define glibtop_free(p1) glibtop_free__r(glibtop_global_server, p1)
+
+extern void *glibtop_malloc__r __P((glibtop *, size_t));
+extern void *glibtop_calloc__r __P((glibtop *, size_t, size_t));
+extern void *glibtop_realloc__r __P((glibtop *, void *, size_t));
+extern void glibtop_free__r __P((glibtop *, void *));
+
+__END_DECLS
+
+#endif
diff --git a/lib/.cvsignore b/lib/.cvsignore
new file mode 100644
index 00000000..221fbc2f
--- /dev/null
+++ b/lib/.cvsignore
@@ -0,0 +1,34 @@
+.deps
+.libs
+Makefile
+Makefile.in
+close.lo
+command.lo
+cpu.lo
+error.lo
+init.lo
+ipc_limits.lo
+libgtop.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
+read.lo
+read_data.lo
+sem_limits.lo
+shm_limits.lo
+so_locations
+swap.lo
+sysinfo.lo
+uptime.lo
+write.lo
+xmalloc.lo
diff --git a/lib/Makefile.am b/lib/Makefile.am
new file mode 100644
index 00000000..5477b586
--- /dev/null
+++ b/lib/Makefile.am
@@ -0,0 +1,15 @@
+LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
+
+INCLUDES = @GTOP_INCS@
+
+CFLAGS = -Wall -W @CFLAGS@ -DGTOP_SERVER=\""@GTOP_SERVER@"\"
+
+lib_LTLIBRARIES = libgtop.la
+
+libgtop_la_SOURCES = init.c open.c close.c read.c read_data.c \
+ write.c command.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
+
diff --git a/lib/close.c b/lib/close.c
new file mode 100644
index 00000000..8f85c512
--- /dev/null
+++ b/lib/close.c
@@ -0,0 +1,32 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <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)
+{
+ kill (server->pid, SIGKILL);
+ close (server->input [0]);
+ close (server->output [1]);
+}
diff --git a/lib/command.c b/lib/command.c
new file mode 100644
index 00000000..03df4375
--- /dev/null
+++ b/lib/command.c
@@ -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 <glibtop/read.h>
+#include <glibtop/write.h>
+#include <glibtop/read_data.h>
+
+#include <glibtop/command.h>
+#include <glibtop/xmalloc.h>
+
+void *
+glibtop_call__r (glibtop *server, unsigned command, size_t send_size, void *send_buf,
+ size_t recv_size, void *recv_buf)
+{
+ glibtop_command *cmnd;
+ void *ptr;
+
+ glibtop_init__r (&server);
+
+ cmnd = glibtop_calloc__r (server, 1, sizeof (glibtop_command));
+
+ memcpy (&cmnd->server, server, sizeof (glibtop));
+
+ cmnd->command = command;
+ cmnd->size = send_size;
+
+ glibtop_write__r (server, sizeof (glibtop_command), cmnd);
+ glibtop_write__r (server, send_size, send_buf);
+ glibtop_read__r (server, recv_size, recv_buf);
+
+ ptr = glibtop_read_data__r (server);
+
+ glibtop_free__r (server, cmnd);
+
+ return ptr;
+}
diff --git a/lib/cpu.c b/lib/cpu.c
new file mode 100644
index 00000000..253f1114
--- /dev/null
+++ b/lib/cpu.c
@@ -0,0 +1,32 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <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>
+#include <glibtop/command.h>
+
+/* Provides information about cpu usage. */
+
+void
+glibtop_get_cpu__r (glibtop *server, glibtop_cpu *buf)
+{
+ glibtop_init__r (&server);
+ glibtop_call__r (server, GLIBTOP_CMND_CPU, 0, NULL, sizeof (glibtop_cpu), buf);
+}
diff --git a/lib/init.c b/lib/init.c
new file mode 100644
index 00000000..f6a9a506
--- /dev/null
+++ b/lib/init.c
@@ -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;
+}
diff --git a/lib/loadavg.c b/lib/loadavg.c
new file mode 100644
index 00000000..8671bfe8
--- /dev/null
+++ b/lib/loadavg.c
@@ -0,0 +1,33 @@
+/* $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>
+#include <glibtop/command.h>
+
+/* Provides load averange. */
+
+void
+glibtop_get_loadavg__r (glibtop *server, glibtop_loadavg *buf)
+{
+ glibtop_init__r (&server);
+ glibtop_call__r (server, GLIBTOP_CMND_LOADAVG, 0, NULL, sizeof (glibtop_loadavg), buf);
+}
diff --git a/lib/mem.c b/lib/mem.c
new file mode 100644
index 00000000..ad760c4b
--- /dev/null
+++ b/lib/mem.c
@@ -0,0 +1,32 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <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>
+#include <glibtop/command.h>
+
+/* Provides information about memory usage. */
+
+void
+glibtop_get_mem__r (glibtop *server, glibtop_mem *buf)
+{
+ glibtop_init__r (&server);
+ glibtop_call__r (server, GLIBTOP_CMND_MEM, 0, NULL, sizeof (glibtop_mem), buf);
+}
diff --git a/lib/msg_limits.c b/lib/msg_limits.c
new file mode 100644
index 00000000..a8c6760a
--- /dev/null
+++ b/lib/msg_limits.c
@@ -0,0 +1,32 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <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 <glibtop/command.h>
+
+/* Provides information about sysv ipc limits. */
+
+void
+glibtop_get_msg_limits__r (glibtop *server, glibtop_msg_limits *buf)
+{
+ glibtop_init__r (&server);
+ glibtop_call__r (server, GLIBTOP_CMND_MSG_LIMITS, 0, NULL, sizeof (glibtop_msg_limits), buf);
+}
diff --git a/lib/open.c b/lib/open.c
new file mode 100644
index 00000000..7b36a871
--- /dev/null
+++ b/lib/open.c
@@ -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/open.h>
+
+/* Opens pipe to gtop server. Returns 0 on success and -1 on error. */
+
+void
+glibtop_open (glibtop *server, const char *program_name)
+{
+ char version [BUFSIZ], buffer [BUFSIZ];
+
+ memset (server, 0, sizeof (glibtop));
+
+ server->name = program_name;
+
+ if (pipe (server->input) || pipe (server->output))
+ glibtop_error__r (server, _("cannot make a pipe: %s\n"), strerror (errno));
+
+ server->pid = fork ();
+
+ if (server->pid < 0) {
+ glibtop_error__r (server, _("%s: fork failed: %s\n"), strerror (errno));
+ } else if (server->pid == 0) {
+ close (0); close (1); /* close (2); */
+ close (server->input [0]); close (server->output [1]);
+ dup2 (server->input [1], 1); /* dup2 (server->input [1], 2); */
+ dup2 (server->output [0], 0);
+ execl (GTOP_SERVER, NULL);
+ _exit (2);
+ }
+
+ close (server->input [1]);
+ close (server->output [0]);
+
+ sprintf (version, "%s server %s ready.\n", PACKAGE, VERSION);
+
+ glibtop_read__r (server, strlen (version), buffer);
+
+ if (memcmp (version, buffer, strlen (version)))
+ glibtop_error__r (server, _("server version is not %s"), VERSION);
+}
diff --git a/lib/prockernel.c b/lib/prockernel.c
new file mode 100644
index 00000000..9dd9fccb
--- /dev/null
+++ b/lib/prockernel.c
@@ -0,0 +1,35 @@
+/* $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 <glibtop/command.h>
+
+/* Provides detailed information about a process. */
+
+void
+glibtop_get_proc_kernel__r (glibtop *server, glibtop_proc_kernel *buf,
+ pid_t pid)
+{
+ glibtop_init__r (&server);
+ glibtop_call__r (server, GLIBTOP_CMND_PROC_KERNEL, sizeof (pid_t),
+ &pid, sizeof (glibtop_proc_kernel), buf);
+}
diff --git a/lib/proclist.c b/lib/proclist.c
new file mode 100644
index 00000000..deae7ce2
--- /dev/null
+++ b/lib/proclist.c
@@ -0,0 +1,32 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <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>
+#include <glibtop/command.h>
+
+/* Fetch list of currently running processes. */
+
+unsigned *
+glibtop_get_proclist__r (glibtop *server, glibtop_proclist *buf)
+{
+ glibtop_init__r (&server);
+ return glibtop_call__r (server, GLIBTOP_CMND_PROCLIST, 0, NULL, sizeof (glibtop_proclist), buf);
+}
diff --git a/lib/procmem.c b/lib/procmem.c
new file mode 100644
index 00000000..5f4e8991
--- /dev/null
+++ b/lib/procmem.c
@@ -0,0 +1,35 @@
+/* $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 <glibtop/command.h>
+
+/* Provides detailed information about a process. */
+
+void
+glibtop_get_proc_mem__r (glibtop *server, glibtop_proc_mem *buf,
+ pid_t pid)
+{
+ glibtop_init__r (&server);
+ glibtop_call__r (server, GLIBTOP_CMND_PROC_MEM, sizeof (pid_t),
+ &pid, sizeof (glibtop_proc_mem), buf);
+}
diff --git a/lib/procsegment.c b/lib/procsegment.c
new file mode 100644
index 00000000..ee10a5d8
--- /dev/null
+++ b/lib/procsegment.c
@@ -0,0 +1,35 @@
+/* $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 <glibtop/command.h>
+
+/* Provides detailed information about a process. */
+
+void
+glibtop_get_proc_segment__r (glibtop *server, glibtop_proc_segment *buf,
+ pid_t pid)
+{
+ glibtop_init__r (&server);
+ glibtop_call__r (server, GLIBTOP_CMND_PROC_SEGMENT, sizeof (pid_t),
+ &pid, sizeof (glibtop_proc_segment), buf);
+}
diff --git a/lib/procsignal.c b/lib/procsignal.c
new file mode 100644
index 00000000..d0ae5468
--- /dev/null
+++ b/lib/procsignal.c
@@ -0,0 +1,35 @@
+/* $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 <glibtop/command.h>
+
+/* Provides detailed information about a process. */
+
+void
+glibtop_get_proc_signal__r (glibtop *server, glibtop_proc_signal *buf,
+ pid_t pid)
+{
+ glibtop_init__r (&server);
+ glibtop_call__r (server, GLIBTOP_CMND_PROC_SIGNAL, sizeof (pid_t),
+ &pid, sizeof (glibtop_proc_signal), buf);
+}
diff --git a/lib/procstate.c b/lib/procstate.c
new file mode 100644
index 00000000..557bfd85
--- /dev/null
+++ b/lib/procstate.c
@@ -0,0 +1,35 @@
+/* $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 <glibtop/command.h>
+
+/* Provides detailed information about a process. */
+
+void
+glibtop_get_proc_state__r (glibtop *server, glibtop_proc_state *buf,
+ pid_t pid)
+{
+ glibtop_init__r (&server);
+ glibtop_call__r (server, GLIBTOP_CMND_PROC_STATE, sizeof (pid_t),
+ &pid, sizeof (glibtop_proc_state), buf);
+}
diff --git a/lib/proctime.c b/lib/proctime.c
new file mode 100644
index 00000000..a6ab8c28
--- /dev/null
+++ b/lib/proctime.c
@@ -0,0 +1,35 @@
+/* $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 <glibtop/command.h>
+
+/* Provides detailed information about a process. */
+
+void
+glibtop_get_proc_time__r (glibtop *server, glibtop_proc_time *buf,
+ pid_t pid)
+{
+ glibtop_init__r (&server);
+ glibtop_call__r (server, GLIBTOP_CMND_PROC_TIME, sizeof (pid_t),
+ &pid, sizeof (glibtop_proc_time), buf);
+}
diff --git a/lib/procuid.c b/lib/procuid.c
new file mode 100644
index 00000000..6c06ba19
--- /dev/null
+++ b/lib/procuid.c
@@ -0,0 +1,35 @@
+/* $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 <glibtop/command.h>
+
+/* Provides detailed information about a process. */
+
+void
+glibtop_get_proc_uid__r (glibtop *server, glibtop_proc_uid *buf,
+ pid_t pid)
+{
+ glibtop_init__r (&server);
+ glibtop_call__r (server, GLIBTOP_CMND_PROC_UID, sizeof (pid_t),
+ &pid, sizeof (glibtop_proc_uid), buf);
+}
diff --git a/lib/read.c b/lib/read.c
new file mode 100644
index 00000000..f05a617d
--- /dev/null
+++ b/lib/read.c
@@ -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/read.h>
+
+/* Reads some data from server. */
+
+void
+glibtop_read__r (glibtop *server, size_t size, void *buf)
+{
+ size_t ssize;
+
+ glibtop_init__r (&server);
+
+ if (read (server->input [0], &ssize, sizeof (size_t)) < 0)
+ glibtop_error__r (server, _("read size: %s"), strerror (errno));
+
+ if (size != ssize)
+ glibtop_error__r (server, _("got %d bytes but requested %d"), ssize, size);
+
+ if (read (server->input [0], buf, size) < 0)
+ glibtop_error__r (server, _("read %d bytes: %s"), size, strerror (errno));
+}
diff --git a/lib/read_data.c b/lib/read_data.c
new file mode 100644
index 00000000..e6012585
--- /dev/null
+++ b/lib/read_data.c
@@ -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/xmalloc.h>
+#include <glibtop/read_data.h>
+
+/* Reads some data from server. */
+
+void *
+glibtop_read_data__r (glibtop *server)
+{
+ size_t size;
+ void *ptr;
+
+ glibtop_init__r (&server);
+
+ if (read (server->input [0], &size, sizeof (size_t)) < 0)
+ glibtop_error__r (server, _("read data size: %s"), strerror (errno));
+
+ if (!size) return NULL;
+
+ fprintf (stderr, "Server has %d bytes of data.\n", size);
+
+ ptr = glibtop_malloc__r (server, size);
+
+ if (read (server->input [0], ptr, size) < 0)
+ glibtop_error__r (server, _("read data %d bytes: %s"), size, strerror (errno));
+
+ return ptr;
+}
diff --git a/lib/sem_limits.c b/lib/sem_limits.c
new file mode 100644
index 00000000..2be994e9
--- /dev/null
+++ b/lib/sem_limits.c
@@ -0,0 +1,32 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <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 <glibtop/command.h>
+
+/* Provides information about sysv ipc limits. */
+
+void
+glibtop_get_sem_limits__r (glibtop *server, glibtop_sem_limits *buf)
+{
+ glibtop_init__r (&server);
+ glibtop_call__r (server, GLIBTOP_CMND_SEM_LIMITS, 0, NULL, sizeof (glibtop_sem_limits), buf);
+}
diff --git a/lib/shm_limits.c b/lib/shm_limits.c
new file mode 100644
index 00000000..24e3447d
--- /dev/null
+++ b/lib/shm_limits.c
@@ -0,0 +1,32 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <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 <glibtop/command.h>
+
+/* Provides information about sysv ipc limits. */
+
+void
+glibtop_get_shm_limits__r (glibtop *server, glibtop_shm_limits *buf)
+{
+ glibtop_init__r (&server);
+ glibtop_call__r (server, GLIBTOP_CMND_SHM_LIMITS, 0, NULL, sizeof (glibtop_shm_limits), buf);
+}
diff --git a/lib/swap.c b/lib/swap.c
new file mode 100644
index 00000000..2a88bc30
--- /dev/null
+++ b/lib/swap.c
@@ -0,0 +1,32 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <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>
+#include <glibtop/command.h>
+
+/* Provides information about swap usage. */
+
+void
+glibtop_get_swap__r (glibtop *server, glibtop_swap *buf)
+{
+ glibtop_init__r (&server);
+ glibtop_call__r (server, GLIBTOP_CMND_SWAP, 0, NULL, sizeof (glibtop_swap), buf);
+}
diff --git a/lib/sysdeps.c b/lib/sysdeps.c
new file mode 100644
index 00000000..94ed2ac2
--- /dev/null
+++ b/lib/sysdeps.c
@@ -0,0 +1,32 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <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/sysdeps.h>
+#include <glibtop/command.h>
+
+/* Checks which features are implemented. */
+
+void
+glibtop_get_sysdeps__r (glibtop *server, glibtop_sysdeps *buf)
+{
+ glibtop_init__r (&server);
+ glibtop_call__r (server, GLIBTOP_CMND_SYSDEPS, 0, NULL, sizeof (glibtop_sysdeps), buf);
+}
diff --git a/lib/uptime.c b/lib/uptime.c
new file mode 100644
index 00000000..9a316433
--- /dev/null
+++ b/lib/uptime.c
@@ -0,0 +1,33 @@
+/* $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>
+#include <glibtop/command.h>
+
+/* Provides uptime and idle time. */
+
+void
+glibtop_get_uptime__r (glibtop *server, glibtop_uptime *buf)
+{
+ glibtop_init__r (&server);
+ glibtop_call__r (server, GLIBTOP_CMND_UPTIME, 0, NULL, sizeof (glibtop_uptime), buf);
+}
diff --git a/lib/write.c b/lib/write.c
new file mode 100644
index 00000000..93b7581a
--- /dev/null
+++ b/lib/write.c
@@ -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/write.h>
+
+/* Writes some data to server. */
+
+void
+glibtop_write__r (glibtop *server, size_t size, void *buf)
+{
+ glibtop_init__r (&server);
+
+ if (write (server->output [1], &size, sizeof (size_t)) < 0)
+ glibtop_error__r (server, _("write size: %s"), strerror (errno));
+
+ if (!size) return;
+
+ if (write (server->output [1], buf, size) < 0)
+ glibtop_error__r (server, _("write %d bytes: %s"), size, strerror (errno));
+}
diff --git a/libgtop-mirror.sh b/libgtop-mirror.sh
new file mode 100755
index 00000000..385ad0b1
--- /dev/null
+++ b/libgtop-mirror.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+AUTODIR=/home/norwegen/auto
+CVSROOT=/pub/master/home-of-linux
+CVSHOST=cvs:
+MODULE=libgtop
+
+rm -rf $AUTODIR || exit 1
+mkdir $AUTODIR || exit 1
+cd $AUTODIR || exit 1
+
+echo "Making cpio archive out of $CVSROOT/$MODULE ..."
+
+find $CVSROOT/$MODULE | cpio -o --format=crc | gzip -9f > $MODULE-current-cvs.cpio.gz || exit 1
+
+echo "Checking out $MODULE"
+
+cvs -d $CVSHOST$CVSROOT co $MODULE || exit 1
+
+echo "Making cpio archive out of checked out sources ..."
+
+find $MODULE | cpio -o --format=crc | gzip -9f > $MODULE-current.cpio.gz || exit 1
+
+for file in README LIESMICH NEWS ChangeLog ; do
+ if [ -s $MODULE/$file ] ; then
+ cp $MODULE/$file . || exit 1
+ fi
+done
+
+tar cvf - $MODULE | gzip -9f > $MODULE-current.tar.gz || exit 1
+
+find $MODULE/doc -maxdepth 1 -type f -exec cp {} . \;
+
+# echo "Making documentation ..."
+# jade -D /usr/lib/sgml/jade_dsl -d libgtop.dsl -t sgml -V %no-make-index% libgtop.sgml > /dev/null || exit 1
+
+# echo "Making TeX documentation ..."
+# jade -D /usr/lib/sgml/jade_dsl -D /usr/lib/sgml/stylesheets -d docbook.dsl -t tex libgtop.sgml || exit 1
+# jadetex libgtop.tex || exit 1
+# jadetex libgtop.tex || exit 1
+# dvips libgtop || exit 1
+
+echo "Cleaning up ..."
+
+rm -rf $MODULE
+
+echo "Done."
diff --git a/po/.cvsignore b/po/.cvsignore
new file mode 100644
index 00000000..fdccedaf
--- /dev/null
+++ b/po/.cvsignore
@@ -0,0 +1,5 @@
+Makefile
+Makefile.in
+POTFILES
+cat-id-tbl.c
+libgtop.pot
diff --git a/po/POTFILES.in b/po/POTFILES.in
new file mode 100644
index 00000000..be5e228f
--- /dev/null
+++ b/po/POTFILES.in
@@ -0,0 +1,78 @@
+lib/close.c
+lib/command.c
+lib/cpu.c
+lib/mem.c
+lib/open.c
+lib/read.c
+lib/swap.c
+lib/write.c
+lib/sysdeps.c
+lib/uptime.c
+lib/loadavg.c
+lib/shm_limits.c
+lib/msg_limits.c
+lib/sem_limits.c
+lib/proclist.c
+lib/read_data.c
+acconfig.h
+glibtop.h
+include/glibtop/command.h
+include/glibtop/close.h
+include/glibtop/global.h
+include/glibtop/cpu.h
+include/glibtop/error.h
+include/glibtop/shm_limits.h
+include/glibtop/uptime.h
+include/glibtop/output.h
+include/glibtop/mem.h
+include/glibtop/open.h
+include/glibtop/sysdeps.h
+include/glibtop/union.h
+include/glibtop/read.h
+include/glibtop/swap.h
+include/glibtop/loadavg.h
+include/glibtop/version.h
+include/glibtop/write.h
+include/glibtop/xmalloc.h
+include/glibtop/msg_limits.h
+include/glibtop/proclist.h
+include/glibtop/sem_limits.h
+include/glibtop/read_data.h
+src/server/main.c
+src/server/output.c
+src/server/version.c
+sysdeps/linux/close.c
+sysdeps/linux/cpu.c
+sysdeps/linux/mem.c
+sysdeps/linux/open.c
+sysdeps/linux/swap.c
+sysdeps/linux/shm_limits.c
+sysdeps/linux/msg_limits.c
+sysdeps/linux/uptime.c
+sysdeps/linux/loadavg.c
+sysdeps/linux/sem_limits.c
+sysdeps/linux/proclist.c
+sysdeps/stub/proclist.c
+sysdeps/stub/close.c
+sysdeps/stub/cpu.c
+sysdeps/stub/mem.c
+sysdeps/stub/open.c
+sysdeps/stub/swap.c
+sysdeps/stub/loadavg.c
+sysdeps/stub/uptime.c
+sysdeps/stub/shm_limits.c
+sysdeps/stub/msg_limits.c
+sysdeps/stub/sem_limits.c
+sysdeps/common/sysdeps.c
+sysdeps/common/xmalloc.c
+sysdeps/common/error.c
+sysdeps/names/sysdeps.c
+sysdeps/names/cpu.c
+sysdeps/names/loadavg.c
+sysdeps/names/mem.c
+sysdeps/names/swap.c
+sysdeps/names/uptime.c
+sysdeps/names/shm_limits.c
+sysdeps/names/msg_limits.c
+sysdeps/names/sem_limits.c
+sysdeps/names/proclist.c
diff --git a/po/stamp-cat-id b/po/stamp-cat-id
new file mode 100644
index 00000000..9788f702
--- /dev/null
+++ b/po/stamp-cat-id
@@ -0,0 +1 @@
+timestamp
diff --git a/src/.cvsignore b/src/.cvsignore
new file mode 100644
index 00000000..282522db
--- /dev/null
+++ b/src/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 00000000..b0e22324
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = server
diff --git a/src/server/.cvsignore b/src/server/.cvsignore
new file mode 100644
index 00000000..2164d8f4
--- /dev/null
+++ b/src/server/.cvsignore
@@ -0,0 +1,5 @@
+.deps
+.libs
+Makefile
+Makefile.in
+gtop_server
diff --git a/src/server/Makefile.am b/src/server/Makefile.am
new file mode 100644
index 00000000..6fe258f4
--- /dev/null
+++ b/src/server/Makefile.am
@@ -0,0 +1,14 @@
+LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
+
+INCLUDES = @GTOP_INCS@
+
+CFLAGS = -Wall -W @CFLAGS@
+
+bin_PROGRAMS = gtop_server
+
+gtop_server_SOURCES = main.c output.c version.c
+gtop_server_LDADD = $(top_builddir)/sysdeps/common/libgtop_common.la \
+ $(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
+ @INTLLIBS@ @LIBSUPPORT@
+gtop_server_LDFLAGS = -static
+
diff --git a/src/server/main.c b/src/server/main.c
new file mode 100644
index 00000000..93332f12
--- /dev/null
+++ b/src/server/main.c
@@ -0,0 +1,258 @@
+/* $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/command.h>
+#include <glibtop/version.h>
+#include <glibtop/xmalloc.h>
+#include <glibtop/union.h>
+#include <glibtop/open.h>
+
+#include <fcntl.h>
+
+#if defined(HAVE_GETDTABLESIZE)
+#define GET_MAX_FDS() getdtablesize()
+#else
+/* Fallthrough case - please add other #elif cases above
+ for different OS's as necessary */
+#define GET_MAX_FDS() 256
+#endif
+
+int main(int argc, char *argv[])
+{
+ pid_t pid;
+ int fd, max_fd, nread;
+ size_t size, dsize;
+ char parameter [BUFSIZ];
+ glibtop_union data;
+ glibtop_command cmnd;
+ glibtop_sysdeps sysdeps;
+ glibtop server;
+ void *ptr;
+
+ /* !!! WE ARE ROOT HERE - CHANGE WITH CAUTION !!! */
+
+ int uid, euid, gid, egid;
+
+ uid = getuid (); euid = geteuid ();
+ gid = getgid (); egid = getegid ();
+
+ if (setreuid (euid, uid)) _exit (1);
+
+ if (setregid (egid, gid)) _exit (1);
+
+ /* !!! END OF SUID ROOT PART !!! */
+
+ /* For security reasons, we temporarily drop our priviledges
+ * before doing the gettext stuff. */
+
+ setlocale (LC_ALL, "");
+ bindtextdomain (PACKAGE, GTOPLOCALEDIR);
+ textdomain (PACKAGE);
+
+ glibtop_version ();
+
+ /* !!! WE ARE ROOT HERE - CHANGE WITH CAUTION !!! */
+
+ setreuid (uid, euid); setreuid (gid, egid);
+
+ glibtop_open (&server, argv [0]);
+
+ if (setreuid (euid, uid)) _exit (1);
+
+ if (setregid (egid, gid)) _exit (1);
+
+ /* !!! END OF SUID ROOT PART !!! */
+
+ /* close all file descriptors except ones used by the pipes (0 and 1). */
+ max_fd = GET_MAX_FDS();
+ for(fd = 3 /* The first fd after the pipes */; fd < max_fd; fd++)
+ close(fd);
+
+ while(1) {
+ /* block on read from client */
+ /* fprintf (stderr, "waiting for input ...\n"); */
+ nread = read (0, &size, sizeof (size_t));
+
+ /* will return 0 if parent exits. */
+
+ if (nread == 0)
+ _exit(0);
+
+ if (nread != sizeof (size_t))
+ _exit(1);
+
+ if (size != sizeof (glibtop_command))
+ _exit(2);
+
+ nread = read (0, &cmnd, size);
+
+ /* will return 0 if parent exits. */
+
+ if (nread == 0)
+ _exit(0);
+
+ if (nread < 0)
+ _exit(1);
+
+ nread = read (0, &dsize, sizeof (size_t));
+
+ /* will return 0 if parent exits. */
+
+ if (nread == 0)
+ _exit(0);
+
+ if (nread < 0)
+ _exit(1);
+
+ if (dsize >= BUFSIZ)
+ _exit(3);
+
+ memset (parameter, 0, sizeof (parameter));
+
+ if (dsize) {
+ nread = read (0, parameter, dsize);
+
+ /* will return 0 if parent exits. */
+
+ if (nread == 0)
+ _exit(0);
+
+ if (nread < 0)
+ _exit(1);
+ }
+
+ switch (cmnd.command) {
+ case GLIBTOP_CMND_SYSDEPS:
+ glibtop_get_sysdeps__r (&server, &sysdeps);
+ glibtop_output (sizeof (glibtop_sysdeps), &sysdeps);
+ glibtop_output (0, NULL);
+ break;
+ case GLIBTOP_CMND_CPU:
+ glibtop_get_cpu__r (&server, &data.cpu);
+ glibtop_output (sizeof (glibtop_cpu), &data.cpu);
+ glibtop_output (0, NULL);
+ break;
+ case GLIBTOP_CMND_MEM:
+ glibtop_get_mem__r (&server, &data.mem);
+ glibtop_output (sizeof (glibtop_mem), &data.mem);
+ glibtop_output (0, NULL);
+ break;
+ case GLIBTOP_CMND_SWAP:
+ glibtop_get_swap__r (&server, &data.swap);
+ glibtop_output (sizeof (glibtop_swap), &data.swap);
+ glibtop_output (0, NULL);
+ break;
+ case GLIBTOP_CMND_UPTIME:
+ glibtop_get_uptime__r (&server, &data.uptime);
+ glibtop_output (sizeof (glibtop_uptime), &data.uptime);
+ glibtop_output (0, NULL);
+ break;
+ case GLIBTOP_CMND_LOADAVG:
+ glibtop_get_loadavg__r (&server, &data.loadavg);
+ glibtop_output (sizeof (glibtop_loadavg), &data.loadavg);
+ glibtop_output (0, NULL);
+ break;
+ case GLIBTOP_CMND_SHM_LIMITS:
+ glibtop_get_shm_limits__r (&server, &data.shm_limits);
+ glibtop_output (sizeof (glibtop_shm_limits),
+ &data.shm_limits);
+ glibtop_output (0, NULL);
+ break;
+ case GLIBTOP_CMND_MSG_LIMITS:
+ glibtop_get_msg_limits__r (&server, &data.msg_limits);
+ glibtop_output (sizeof (glibtop_msg_limits),
+ &data.msg_limits);
+ glibtop_output (0, NULL);
+ break;
+ case GLIBTOP_CMND_SEM_LIMITS:
+ glibtop_get_sem_limits__r (&server, &data.sem_limits);
+ glibtop_output (sizeof (glibtop_sem_limits),
+ &data.sem_limits);
+ glibtop_output (0, NULL);
+ break;
+ case GLIBTOP_CMND_PROCLIST:
+ ptr = glibtop_get_proclist__r (&server, &data.proclist);
+ glibtop_output (sizeof (glibtop_proclist),
+ &data.proclist);
+ glibtop_output (data.proclist.total, ptr);
+ glibtop_free__r (&server, ptr);
+ break;
+ case GLIBTOP_CMND_PROC_STATE:
+ memcpy (&pid, parameter, sizeof (pid_t));
+ glibtop_get_proc_state__r
+ (&server, &data.proc_state, pid);
+ glibtop_output (sizeof (glibtop_proc_state),
+ &data.proc_state);
+ glibtop_output (0, NULL);
+ break;
+ case GLIBTOP_CMND_PROC_UID:
+ memcpy (&pid, parameter, sizeof (pid_t));
+ glibtop_get_proc_uid__r
+ (&server, &data.proc_uid, pid);
+ glibtop_output (sizeof (glibtop_proc_uid),
+ &data.proc_uid);
+ glibtop_output (0, NULL);
+ break;
+ case GLIBTOP_CMND_PROC_MEM:
+ memcpy (&pid, parameter, sizeof (pid_t));
+ glibtop_get_proc_mem__r
+ (&server, &data.proc_mem, pid);
+ glibtop_output (sizeof (glibtop_proc_mem),
+ &data.proc_mem);
+ glibtop_output (0, NULL);
+ break;
+ case GLIBTOP_CMND_PROC_TIME:
+ memcpy (&pid, parameter, sizeof (pid_t));
+ glibtop_get_proc_time__r
+ (&server, &data.proc_time, pid);
+ glibtop_output (sizeof (glibtop_proc_time),
+ &data.proc_time);
+ glibtop_output (0, NULL);
+ break;
+ case GLIBTOP_CMND_PROC_SIGNAL:
+ memcpy (&pid, parameter, sizeof (pid_t));
+ glibtop_get_proc_signal__r
+ (&server, &data.proc_signal, pid);
+ glibtop_output (sizeof (glibtop_proc_signal),
+ &data.proc_signal);
+ glibtop_output (0, NULL);
+ break;
+ case GLIBTOP_CMND_PROC_KERNEL:
+ memcpy (&pid, parameter, sizeof (pid_t));
+ glibtop_get_proc_kernel__r
+ (&server, &data.proc_kernel, pid);
+ glibtop_output (sizeof (glibtop_proc_kernel),
+ &data.proc_kernel);
+ glibtop_output (0, NULL);
+ break;
+ case GLIBTOP_CMND_PROC_SEGMENT:
+ memcpy (&pid, parameter, sizeof (pid_t));
+ glibtop_get_proc_segment__r
+ (&server, &data.proc_segment, pid);
+ glibtop_output (sizeof (glibtop_proc_segment),
+ &data.proc_segment);
+ glibtop_output (0, NULL);
+ break;
+
+ }
+ }
+ _exit(0);
+}
diff --git a/src/server/output.c b/src/server/output.c
new file mode 100644
index 00000000..9fa98655
--- /dev/null
+++ b/src/server/output.c
@@ -0,0 +1,31 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <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/output.h>
+
+void
+glibtop_output (size_t size, const void *buf)
+{
+ if (write (1, &size, sizeof (size_t)) < 0)
+ _exit (2);
+ if (write (1, buf, size) < 0)
+ _exit (2);
+}
diff --git a/src/server/version.c b/src/server/version.c
new file mode 100644
index 00000000..3e21f55a
--- /dev/null
+++ b/src/server/version.c
@@ -0,0 +1,31 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <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/version.h>
+
+void
+glibtop_version (void)
+{
+ char buffer [BUFSIZ];
+
+ sprintf (buffer, "%s server %s ready.\n", PACKAGE, VERSION);
+ glibtop_output (strlen (buffer), buffer);
+}
diff --git a/stamp-h.in b/stamp-h.in
new file mode 100644
index 00000000..9788f702
--- /dev/null
+++ b/stamp-h.in
@@ -0,0 +1 @@
+timestamp
diff --git a/sysdeps/.cvsignore b/sysdeps/.cvsignore
new file mode 100644
index 00000000..282522db
--- /dev/null
+++ b/sysdeps/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/sysdeps/Makefile.am b/sysdeps/Makefile.am
new file mode 100644
index 00000000..b80ead9c
--- /dev/null
+++ b/sysdeps/Makefile.am
@@ -0,0 +1,7 @@
+if GUILE
+guile_SUBDIRS = guile
+else
+guile_SUBDIRS =
+endif
+
+SUBDIRS = @sysdeps_dir@ common names $(guile_SUBDIRS)
diff --git a/sysdeps/common/.cvsignore b/sysdeps/common/.cvsignore
new file mode 100644
index 00000000..501b8d5f
--- /dev/null
+++ b/sysdeps/common/.cvsignore
@@ -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
diff --git a/sysdeps/common/Makefile.am b/sysdeps/common/Makefile.am
new file mode 100644
index 00000000..3fd5e649
--- /dev/null
+++ b/sysdeps/common/Makefile.am
@@ -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
+
diff --git a/sysdeps/common/error.c b/sysdeps/common/error.c
new file mode 100644
index 00000000..6f1f1963
--- /dev/null
+++ b/sysdeps/common/error.c
@@ -0,0 +1,39 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <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);
+}
diff --git a/sysdeps/common/sysdeps.c b/sysdeps/common/sysdeps.c
new file mode 100644
index 00000000..1155bbc8
--- /dev/null
+++ b/sysdeps/common/sysdeps.c
@@ -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;
+}
diff --git a/sysdeps/common/xmalloc.c b/sysdeps/common/xmalloc.c
new file mode 100644
index 00000000..66458a18
--- /dev/null
+++ b/sysdeps/common/xmalloc.c
@@ -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);
+}
diff --git a/sysdeps/guile/.cvsignore b/sysdeps/guile/.cvsignore
new file mode 100644
index 00000000..3956f7f4
--- /dev/null
+++ b/sysdeps/guile/.cvsignore
@@ -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
diff --git a/sysdeps/guile/Makefile.am b/sysdeps/guile/Makefile.am
new file mode 100644
index 00000000..c0972cc3
--- /dev/null
+++ b/sysdeps/guile/Makefile.am
@@ -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
diff --git a/sysdeps/guile/boot.c b/sysdeps/guile/boot.c
new file mode 100644
index 00000000..fbd86941
--- /dev/null
+++ b/sysdeps/guile/boot.c
@@ -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);
+
+}
diff --git a/sysdeps/guile/cpu.c b/sysdeps/guile/cpu.c
new file mode 100644
index 00000000..707b4af7
--- /dev/null
+++ b/sysdeps/guile/cpu.c
@@ -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);
+}
diff --git a/sysdeps/guile/loadavg.c b/sysdeps/guile/loadavg.c
new file mode 100644
index 00000000..1ace95ff
--- /dev/null
+++ b/sysdeps/guile/loadavg.c
@@ -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);
+}
diff --git a/sysdeps/guile/mem.c b/sysdeps/guile/mem.c
new file mode 100644
index 00000000..4b489579
--- /dev/null
+++ b/sysdeps/guile/mem.c
@@ -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);
+}
diff --git a/sysdeps/guile/msg_limits.c b/sysdeps/guile/msg_limits.c
new file mode 100644
index 00000000..35e88593
--- /dev/null
+++ b/sysdeps/guile/msg_limits.c
@@ -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);
+}
diff --git a/sysdeps/guile/names/.cvsignore b/sysdeps/guile/names/.cvsignore
new file mode 100644
index 00000000..e5baa455
--- /dev/null
+++ b/sysdeps/guile/names/.cvsignore
@@ -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
diff --git a/sysdeps/guile/names/Makefile.am b/sysdeps/guile/names/Makefile.am
new file mode 100644
index 00000000..440bb955
--- /dev/null
+++ b/sysdeps/guile/names/Makefile.am
@@ -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
+
diff --git a/sysdeps/guile/names/boot.c b/sysdeps/guile/names/boot.c
new file mode 100644
index 00000000..ec96ac22
--- /dev/null
+++ b/sysdeps/guile/names/boot.c
@@ -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);
+}
diff --git a/sysdeps/guile/names/cpu.c b/sysdeps/guile/names/cpu.c
new file mode 100644
index 00000000..ac08cb56
--- /dev/null
+++ b/sysdeps/guile/names/cpu.c
@@ -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;
+}
diff --git a/sysdeps/guile/names/loadavg.c b/sysdeps/guile/names/loadavg.c
new file mode 100644
index 00000000..fe4b589d
--- /dev/null
+++ b/sysdeps/guile/names/loadavg.c
@@ -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;
+}
diff --git a/sysdeps/guile/names/mem.c b/sysdeps/guile/names/mem.c
new file mode 100644
index 00000000..afc4e7a9
--- /dev/null
+++ b/sysdeps/guile/names/mem.c
@@ -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;
+}
diff --git a/sysdeps/guile/names/msg_limits.c b/sysdeps/guile/names/msg_limits.c
new file mode 100644
index 00000000..f978eabc
--- /dev/null
+++ b/sysdeps/guile/names/msg_limits.c
@@ -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;
+}
diff --git a/sysdeps/guile/names/prockernel.c b/sysdeps/guile/names/prockernel.c
new file mode 100644
index 00000000..0de1d334
--- /dev/null
+++ b/sysdeps/guile/names/prockernel.c
@@ -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;
+}
diff --git a/sysdeps/guile/names/proclist.c b/sysdeps/guile/names/proclist.c
new file mode 100644
index 00000000..34240142
--- /dev/null
+++ b/sysdeps/guile/names/proclist.c
@@ -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;
+}
diff --git a/sysdeps/guile/names/procmem.c b/sysdeps/guile/names/procmem.c
new file mode 100644
index 00000000..58ad25dd
--- /dev/null
+++ b/sysdeps/guile/names/procmem.c
@@ -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;
+}
diff --git a/sysdeps/guile/names/procsegment.c b/sysdeps/guile/names/procsegment.c
new file mode 100644
index 00000000..7ed42171
--- /dev/null
+++ b/sysdeps/guile/names/procsegment.c
@@ -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;
+}
diff --git a/sysdeps/guile/names/procsignal.c b/sysdeps/guile/names/procsignal.c
new file mode 100644
index 00000000..97df5373
--- /dev/null
+++ b/sysdeps/guile/names/procsignal.c
@@ -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;
+}
diff --git a/sysdeps/guile/names/procstate.c b/sysdeps/guile/names/procstate.c
new file mode 100644
index 00000000..7ba88645
--- /dev/null
+++ b/sysdeps/guile/names/procstate.c
@@ -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;
+}
diff --git a/sysdeps/guile/names/proctime.c b/sysdeps/guile/names/proctime.c
new file mode 100644
index 00000000..b0ad5e60
--- /dev/null
+++ b/sysdeps/guile/names/proctime.c
@@ -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;
+}
diff --git a/sysdeps/guile/names/procuid.c b/sysdeps/guile/names/procuid.c
new file mode 100644
index 00000000..0746f8a8
--- /dev/null
+++ b/sysdeps/guile/names/procuid.c
@@ -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;
+}
diff --git a/sysdeps/guile/names/sem_limits.c b/sysdeps/guile/names/sem_limits.c
new file mode 100644
index 00000000..397ddebd
--- /dev/null
+++ b/sysdeps/guile/names/sem_limits.c
@@ -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;
+}
diff --git a/sysdeps/guile/names/shm_limits.c b/sysdeps/guile/names/shm_limits.c
new file mode 100644
index 00000000..32ea693b
--- /dev/null
+++ b/sysdeps/guile/names/shm_limits.c
@@ -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;
+}
diff --git a/sysdeps/guile/names/swap.c b/sysdeps/guile/names/swap.c
new file mode 100644
index 00000000..e5d477d4
--- /dev/null
+++ b/sysdeps/guile/names/swap.c
@@ -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;
+}
diff --git a/sysdeps/guile/names/sysdeps.c b/sysdeps/guile/names/sysdeps.c
new file mode 100644
index 00000000..20e4c184
--- /dev/null
+++ b/sysdeps/guile/names/sysdeps.c
@@ -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;
+}
diff --git a/sysdeps/guile/names/uptime.c b/sysdeps/guile/names/uptime.c
new file mode 100644
index 00000000..6bf65203
--- /dev/null
+++ b/sysdeps/guile/names/uptime.c
@@ -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;
+}
diff --git a/sysdeps/guile/prockernel.c b/sysdeps/guile/prockernel.c
new file mode 100644
index 00000000..6702467c
--- /dev/null
+++ b/sysdeps/guile/prockernel.c
@@ -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);
+}
diff --git a/sysdeps/guile/proclist.c b/sysdeps/guile/proclist.c
new file mode 100644
index 00000000..50fa0b0c
--- /dev/null
+++ b/sysdeps/guile/proclist.c
@@ -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;
+}
diff --git a/sysdeps/guile/procmem.c b/sysdeps/guile/procmem.c
new file mode 100644
index 00000000..e1862c3b
--- /dev/null
+++ b/sysdeps/guile/procmem.c
@@ -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);
+}
diff --git a/sysdeps/guile/procsegment.c b/sysdeps/guile/procsegment.c
new file mode 100644
index 00000000..dbc49915
--- /dev/null
+++ b/sysdeps/guile/procsegment.c
@@ -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);
+}
diff --git a/sysdeps/guile/procsignal.c b/sysdeps/guile/procsignal.c
new file mode 100644
index 00000000..9b580c5b
--- /dev/null
+++ b/sysdeps/guile/procsignal.c
@@ -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);
+}
diff --git a/sysdeps/guile/procstate.c b/sysdeps/guile/procstate.c
new file mode 100644
index 00000000..1b51f2ed
--- /dev/null
+++ b/sysdeps/guile/procstate.c
@@ -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);
+}
diff --git a/sysdeps/guile/proctime.c b/sysdeps/guile/proctime.c
new file mode 100644
index 00000000..52a6bfcd
--- /dev/null
+++ b/sysdeps/guile/proctime.c
@@ -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);
+}
diff --git a/sysdeps/guile/procuid.c b/sysdeps/guile/procuid.c
new file mode 100644
index 00000000..96c7033c
--- /dev/null
+++ b/sysdeps/guile/procuid.c
@@ -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);
+}
diff --git a/sysdeps/guile/sem_limits.c b/sysdeps/guile/sem_limits.c
new file mode 100644
index 00000000..ca2b10af
--- /dev/null
+++ b/sysdeps/guile/sem_limits.c
@@ -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);
+}
diff --git a/sysdeps/guile/shm_limits.c b/sysdeps/guile/shm_limits.c
new file mode 100644
index 00000000..e0efd174
--- /dev/null
+++ b/sysdeps/guile/shm_limits.c
@@ -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);
+}
diff --git a/sysdeps/guile/swap.c b/sysdeps/guile/swap.c
new file mode 100644
index 00000000..4ab39ab8
--- /dev/null
+++ b/sysdeps/guile/swap.c
@@ -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);
+}
diff --git a/sysdeps/guile/sysdeps.c b/sysdeps/guile/sysdeps.c
new file mode 100644
index 00000000..90a4b04d
--- /dev/null
+++ b/sysdeps/guile/sysdeps.c
@@ -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);
+}
diff --git a/sysdeps/guile/uptime.c b/sysdeps/guile/uptime.c
new file mode 100644
index 00000000..2425c751
--- /dev/null
+++ b/sysdeps/guile/uptime.c
@@ -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);
+}
diff --git a/sysdeps/linux/.cvsignore b/sysdeps/linux/.cvsignore
new file mode 100644
index 00000000..b851d091
--- /dev/null
+++ b/sysdeps/linux/.cvsignore
@@ -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
diff --git a/sysdeps/linux/Makefile.am b/sysdeps/linux/Makefile.am
new file mode 100644
index 00000000..10a1d6f4
--- /dev/null
+++ b/sysdeps/linux/Makefile.am
@@ -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
diff --git a/sysdeps/linux/close.c b/sysdeps/linux/close.c
new file mode 100644
index 00000000..ff7ebea4
--- /dev/null
+++ b/sysdeps/linux/close.c
@@ -0,0 +1,28 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <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)
+{ }
diff --git a/sysdeps/linux/cpu.c b/sysdeps/linux/cpu.c
new file mode 100644
index 00000000..224ab06b
--- /dev/null
+++ b/sysdeps/linux/cpu.c
@@ -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);
+}
diff --git a/sysdeps/linux/init.c b/sysdeps/linux/init.c
new file mode 100644
index 00000000..f6a9a506
--- /dev/null
+++ b/sysdeps/linux/init.c
@@ -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;
+}
diff --git a/sysdeps/linux/libsysdeps.la b/sysdeps/linux/libsysdeps.la
new file mode 100644
index 00000000..3f600ebb
--- /dev/null
+++ b/sysdeps/linux/libsysdeps.la
@@ -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'
diff --git a/sysdeps/linux/loadavg.c b/sysdeps/linux/loadavg.c
new file mode 100644
index 00000000..8401247c
--- /dev/null
+++ b/sysdeps/linux/loadavg.c
@@ -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);
+}
diff --git a/sysdeps/linux/mem.c b/sysdeps/linux/mem.c
new file mode 100644
index 00000000..80d2ccc3
--- /dev/null
+++ b/sysdeps/linux/mem.c
@@ -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);
+}
diff --git a/sysdeps/linux/msg_limits.c b/sysdeps/linux/msg_limits.c
new file mode 100644
index 00000000..997551af
--- /dev/null
+++ b/sysdeps/linux/msg_limits.c
@@ -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;
+}
diff --git a/sysdeps/linux/open.c b/sysdeps/linux/open.c
new file mode 100644
index 00000000..b2da083a
--- /dev/null
+++ b/sysdeps/linux/open.c
@@ -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;
+}
diff --git a/sysdeps/linux/procdata.c b/sysdeps/linux/procdata.c
new file mode 100644
index 00000000..3fc01fb3
--- /dev/null
+++ b/sysdeps/linux/procdata.c
@@ -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;
+}
diff --git a/sysdeps/linux/prockernel.c b/sysdeps/linux/prockernel.c
new file mode 100644
index 00000000..0bd13c3f
--- /dev/null
+++ b/sysdeps/linux/prockernel.c
@@ -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;
+}
diff --git a/sysdeps/linux/proclist.c b/sysdeps/linux/proclist.c
new file mode 100644
index 00000000..39070689
--- /dev/null
+++ b/sysdeps/linux/proclist.c
@@ -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;
+}
diff --git a/sysdeps/linux/procmem.c b/sysdeps/linux/procmem.c
new file mode 100644
index 00000000..09a2fe83
--- /dev/null
+++ b/sysdeps/linux/procmem.c
@@ -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;
+}
diff --git a/sysdeps/linux/procsegment.c b/sysdeps/linux/procsegment.c
new file mode 100644
index 00000000..479d98e4
--- /dev/null
+++ b/sysdeps/linux/procsegment.c
@@ -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;
+}
diff --git a/sysdeps/linux/procsignal.c b/sysdeps/linux/procsignal.c
new file mode 100644
index 00000000..9bf32b26
--- /dev/null
+++ b/sysdeps/linux/procsignal.c
@@ -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;
+}
diff --git a/sysdeps/linux/procstate.c b/sysdeps/linux/procstate.c
new file mode 100644
index 00000000..76252ba9
--- /dev/null
+++ b/sysdeps/linux/procstate.c
@@ -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;
+}
diff --git a/sysdeps/linux/proctime.c b/sysdeps/linux/proctime.c
new file mode 100644
index 00000000..7c5dbc21
--- /dev/null
+++ b/sysdeps/linux/proctime.c
@@ -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;
+}
diff --git a/sysdeps/linux/procuid.c b/sysdeps/linux/procuid.c
new file mode 100644
index 00000000..d2ebddc3
--- /dev/null
+++ b/sysdeps/linux/procuid.c
@@ -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;
+}
diff --git a/sysdeps/linux/sem_limits.c b/sysdeps/linux/sem_limits.c
new file mode 100644
index 00000000..05d00a2d
--- /dev/null
+++ b/sysdeps/linux/sem_limits.c
@@ -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;
+}
diff --git a/sysdeps/linux/shm_limits.c b/sysdeps/linux/shm_limits.c
new file mode 100644
index 00000000..07a78bc7
--- /dev/null
+++ b/sysdeps/linux/shm_limits.c
@@ -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;
+}
diff --git a/sysdeps/linux/swap.c b/sysdeps/linux/swap.c
new file mode 100644
index 00000000..90572687
--- /dev/null
+++ b/sysdeps/linux/swap.c
@@ -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);
+}
diff --git a/sysdeps/linux/uptime.c b/sysdeps/linux/uptime.c
new file mode 100644
index 00000000..4dabf7be
--- /dev/null
+++ b/sysdeps/linux/uptime.c
@@ -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);
+}
diff --git a/sysdeps/names/.cvsignore b/sysdeps/names/.cvsignore
new file mode 100644
index 00000000..1f6ac7d5
--- /dev/null
+++ b/sysdeps/names/.cvsignore
@@ -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
diff --git a/sysdeps/names/Makefile.am b/sysdeps/names/Makefile.am
new file mode 100644
index 00000000..3cdc9dab
--- /dev/null
+++ b/sysdeps/names/Makefile.am
@@ -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
+
diff --git a/sysdeps/names/cpu.c b/sysdeps/names/cpu.c
new file mode 100644
index 00000000..e33c9f95
--- /dev/null
+++ b/sysdeps/names/cpu.c
@@ -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')")
+};
diff --git a/sysdeps/names/loadavg.c b/sysdeps/names/loadavg.c
new file mode 100644
index 00000000..4e41e621
--- /dev/null
+++ b/sysdeps/names/loadavg.c
@@ -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")
+};
diff --git a/sysdeps/names/mem.c b/sysdeps/names/mem.c
new file mode 100644
index 00000000..258ea38e
--- /dev/null
+++ b/sysdeps/names/mem.c
@@ -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")
+};
diff --git a/sysdeps/names/msg_limits.c b/sysdeps/names/msg_limits.c
new file mode 100644
index 00000000..46dbf7e8
--- /dev/null
+++ b/sysdeps/names/msg_limits.c
@@ -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")
+};
diff --git a/sysdeps/names/procdata.c b/sysdeps/names/procdata.c
new file mode 100644
index 00000000..1729860c
--- /dev/null
+++ b/sysdeps/names/procdata.c
@@ -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
+};
diff --git a/sysdeps/names/prockernel.c b/sysdeps/names/prockernel.c
new file mode 100644
index 00000000..20f4a87b
--- /dev/null
+++ b/sysdeps/names/prockernel.c
@@ -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)")
+};
diff --git a/sysdeps/names/proclist.c b/sysdeps/names/proclist.c
new file mode 100644
index 00000000..d5bf022d
--- /dev/null
+++ b/sysdeps/names/proclist.c
@@ -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")
+};
diff --git a/sysdeps/names/procmem.c b/sysdeps/names/procmem.c
new file mode 100644
index 00000000..920f1a8b
--- /dev/null
+++ b/sysdeps/names/procmem.c
@@ -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).")
+};
diff --git a/sysdeps/names/procsegment.c b/sysdeps/names/procsegment.c
new file mode 100644
index 00000000..85a89304
--- /dev/null
+++ b/sysdeps/names/procsegment.c
@@ -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")
+};
diff --git a/sysdeps/names/procsignal.c b/sysdeps/names/procsignal.c
new file mode 100644
index 00000000..a278e60b
--- /dev/null
+++ b/sysdeps/names/procsignal.c
@@ -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")
+};
diff --git a/sysdeps/names/procstate.c b/sysdeps/names/procstate.c
new file mode 100644
index 00000000..bdd85499
--- /dev/null
+++ b/sysdeps/names/procstate.c
@@ -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")
+};
diff --git a/sysdeps/names/proctime.c b/sysdeps/names/proctime.c
new file mode 100644
index 00000000..f7990b50
--- /dev/null
+++ b/sysdeps/names/proctime.c
@@ -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.")
+};
+
+
diff --git a/sysdeps/names/procuid.c b/sysdeps/names/procuid.c
new file mode 100644
index 00000000..8d50f8bc
--- /dev/null
+++ b/sysdeps/names/procuid.c
@@ -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")
+};
diff --git a/sysdeps/names/sem_limits.c b/sysdeps/names/sem_limits.c
new file mode 100644
index 00000000..a75d9192
--- /dev/null
+++ b/sysdeps/names/sem_limits.c
@@ -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")
+};
diff --git a/sysdeps/names/shm_limits.c b/sysdeps/names/shm_limits.c
new file mode 100644
index 00000000..6786d2dc
--- /dev/null
+++ b/sysdeps/names/shm_limits.c
@@ -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")
+};
diff --git a/sysdeps/names/swap.c b/sysdeps/names/swap.c
new file mode 100644
index 00000000..06c51513
--- /dev/null
+++ b/sysdeps/names/swap.c
@@ -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")
+};
diff --git a/sysdeps/names/sysdeps.c b/sysdeps/names/sysdeps.c
new file mode 100644
index 00000000..3387efd0
--- /dev/null
+++ b/sysdeps/names/sysdeps.c
@@ -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")
+};
diff --git a/sysdeps/names/uptime.c b/sysdeps/names/uptime.c
new file mode 100644
index 00000000..6561c006
--- /dev/null
+++ b/sysdeps/names/uptime.c
@@ -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")
+};
diff --git a/sysdeps/osf1/.cvsignore b/sysdeps/osf1/.cvsignore
new file mode 100644
index 00000000..33eef0e1
--- /dev/null
+++ b/sysdeps/osf1/.cvsignore
@@ -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
diff --git a/sysdeps/osf1/Makefile.am b/sysdeps/osf1/Makefile.am
new file mode 100644
index 00000000..30765601
--- /dev/null
+++ b/sysdeps/osf1/Makefile.am
@@ -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
diff --git a/sysdeps/osf1/close.c b/sysdeps/osf1/close.c
new file mode 100644
index 00000000..ff7ebea4
--- /dev/null
+++ b/sysdeps/osf1/close.c
@@ -0,0 +1,28 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <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)
+{ }
diff --git a/sysdeps/osf1/cpu.c b/sysdeps/osf1/cpu.c
new file mode 100644
index 00000000..cf5245d6
--- /dev/null
+++ b/sysdeps/osf1/cpu.c
@@ -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;
+}
diff --git a/sysdeps/osf1/glibtop_machine.h b/sysdeps/osf1/glibtop_machine.h
new file mode 100644
index 00000000..12c28c60
--- /dev/null
+++ b/sysdeps/osf1/glibtop_machine.h
@@ -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
diff --git a/sysdeps/osf1/init.c b/sysdeps/osf1/init.c
new file mode 100644
index 00000000..f6a9a506
--- /dev/null
+++ b/sysdeps/osf1/init.c
@@ -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;
+}
diff --git a/sysdeps/osf1/mem.c b/sysdeps/osf1/mem.c
new file mode 100644
index 00000000..bd4d6306
--- /dev/null
+++ b/sysdeps/osf1/mem.c
@@ -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;
+}
diff --git a/sysdeps/osf1/msg_limits.c b/sysdeps/osf1/msg_limits.c
new file mode 100644
index 00000000..98993716
--- /dev/null
+++ b/sysdeps/osf1/msg_limits.c
@@ -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;
+}
diff --git a/sysdeps/osf1/open.c b/sysdeps/osf1/open.c
new file mode 100644
index 00000000..540e499b
--- /dev/null
+++ b/sysdeps/osf1/open.c
@@ -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.
+ */
+}
diff --git a/sysdeps/osf1/procdata.c b/sysdeps/osf1/procdata.c
new file mode 100644
index 00000000..4eb64d88
--- /dev/null
+++ b/sysdeps/osf1/procdata.c
@@ -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);
+}
diff --git a/sysdeps/osf1/prockernel.c b/sysdeps/osf1/prockernel.c
new file mode 100644
index 00000000..93f47bb1
--- /dev/null
+++ b/sysdeps/osf1/prockernel.c
@@ -0,0 +1,32 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ The Gnome Top Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Top Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <config.h>
+#include <glibtop/prockernel.h>
+
+/* Provides detailed information about a process. */
+
+void
+glibtop_get_proc_kernel__r (glibtop *server, glibtop_proc_kernel *buf,
+ pid_t pid)
+{
+ memset (buf, 0, sizeof (glibtop_proc_kernel));
+}
diff --git a/sysdeps/osf1/proclist.c b/sysdeps/osf1/proclist.c
new file mode 100644
index 00000000..7659a9df
--- /dev/null
+++ b/sysdeps/osf1/proclist.c
@@ -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 <glibtop.h>
+#include <glibtop/error.h>
+#include <glibtop/xmalloc.h>
+#include <glibtop/proclist.h>
+
+static const unsigned long _glibtop_sysdeps_proclist =
+(1 << GLIBTOP_PROCLIST_TOTAL) + (1 << GLIBTOP_PROCLIST_NUMBER) +
+(1 << GLIBTOP_PROCLIST_SIZE);
+
+/* How many elements are there per proctable entry? */
+
+#define ELEMENTS_PER_ENTRY 8
+
+/* We have a buffer for BLOCK_COUNT pids; when it's full, it is copied
+ * to a newly realloc()ed area. */
+
+#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. */
+
+/* !!! THIS FUNCTION RUNS SUID ROOT - CHANGE WITH CAUTION !!! */
+
+unsigned *
+glibtop_get_proclist__r (glibtop *server, glibtop_proclist *buf)
+{
+ unsigned count = 0, total = 0;
+ unsigned pids [BLOCK_COUNT], *pids_chain = NULL;
+ unsigned pids_size = 0, pids_offset = 0, new_size;
+ struct tbl_procinfo procinfo [8];
+ int entry, max_elements, k;
+
+ glibtop_init ();
+
+ memset (buf, 0, sizeof (glibtop_proclist));
+
+ for (entry = 0; entry < server->machine.proctable_entries;
+ entry += ELEMENTS_PER_ENTRY)
+ {
+
+ /* !!! THE FOLLOWING CODE RUNS SUID ROOT - CHANGE WITH CAUTION !!! */
+
+ setreuid (server->machine.uid, server->machine.euid);
+
+ max_elements = table (TBL_PROCINFO, entry, (char *) &procinfo,
+ ELEMENTS_PER_ENTRY, sizeof (struct tbl_procinfo));
+
+ if (setreuid (server->machine.euid, server->machine.uid))
+ _exit (1);
+
+ /* !!! END OF SUID ROOT PART !!! */
+
+ for (k = 0; k < max_elements; k++)
+ {
+ /* Does this entry contain a real process? */
+
+ if (procinfo [k].pi_status == 0)
+ continue;
+
+ /* The following code is copied from the Linux implementation.
+ * It's safe since we are no longer root at this point here. */
+
+ /* 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++] = procinfo [k].pi_pid;
+
+ total++;
+ }
+ }
+
+ /* count is only zero if an error occured (eg. the server is not suid root). */
+
+ 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;
+}
diff --git a/sysdeps/osf1/procmem.c b/sysdeps/osf1/procmem.c
new file mode 100644
index 00000000..889a4a20
--- /dev/null
+++ b/sysdeps/osf1/procmem.c
@@ -0,0 +1,32 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ The Gnome Top Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Top Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <config.h>
+#include <glibtop/procmem.h>
+
+/* Provides detailed information about a process. */
+
+void
+glibtop_get_proc_mem__r (glibtop *server, glibtop_proc_mem *buf,
+ pid_t pid)
+{
+ memset (buf, 0, sizeof (glibtop_proc_mem));
+}
diff --git a/sysdeps/osf1/procsegment.c b/sysdeps/osf1/procsegment.c
new file mode 100644
index 00000000..c0ffeb17
--- /dev/null
+++ b/sysdeps/osf1/procsegment.c
@@ -0,0 +1,32 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ The Gnome Top Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Top Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <config.h>
+#include <glibtop/procsegment.h>
+
+/* Provides detailed information about a process. */
+
+void
+glibtop_get_proc_segment__r (glibtop *server, glibtop_proc_segment *buf,
+ pid_t pid)
+{
+ memset (buf, 0, sizeof (glibtop_proc_segment));
+}
diff --git a/sysdeps/osf1/procsignal.c b/sysdeps/osf1/procsignal.c
new file mode 100644
index 00000000..6c30ee66
--- /dev/null
+++ b/sysdeps/osf1/procsignal.c
@@ -0,0 +1,32 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ The Gnome Top Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Top Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <config.h>
+#include <glibtop/procsignal.h>
+
+/* Provides detailed information about a process. */
+
+void
+glibtop_get_proc_signal__r (glibtop *server, glibtop_proc_signal *buf,
+ pid_t pid)
+{
+ memset (buf, 0, sizeof (glibtop_proc_signal));
+}
diff --git a/sysdeps/osf1/procstate.c b/sysdeps/osf1/procstate.c
new file mode 100644
index 00000000..b8ad5cec
--- /dev/null
+++ b/sysdeps/osf1/procstate.c
@@ -0,0 +1,32 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ The Gnome Top Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Top Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <config.h>
+#include <glibtop/procstate.h>
+
+/* Provides detailed information about a process. */
+
+void
+glibtop_get_proc_state__r (glibtop *server, glibtop_proc_state *buf,
+ pid_t pid)
+{
+ memset (buf, 0, sizeof (glibtop_proc_state));
+}
diff --git a/sysdeps/osf1/proctime.c b/sysdeps/osf1/proctime.c
new file mode 100644
index 00000000..ec81d2a0
--- /dev/null
+++ b/sysdeps/osf1/proctime.c
@@ -0,0 +1,32 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ The Gnome Top Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Top Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <config.h>
+#include <glibtop/proctime.h>
+
+/* Provides detailed information about a process. */
+
+void
+glibtop_get_proc_time__r (glibtop *server, glibtop_proc_time *buf,
+ pid_t pid)
+{
+ memset (buf, 0, sizeof (glibtop_proc_time));
+}
diff --git a/sysdeps/osf1/procuid.c b/sysdeps/osf1/procuid.c
new file mode 100644
index 00000000..7fbb85fa
--- /dev/null
+++ b/sysdeps/osf1/procuid.c
@@ -0,0 +1,32 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ The Gnome Top Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Top Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <config.h>
+#include <glibtop/procuid.h>
+
+/* Provides detailed information about a process. */
+
+void
+glibtop_get_proc_uid__r (glibtop *server, glibtop_proc_uid *buf,
+ pid_t pid)
+{
+ memset (buf, 0, sizeof (glibtop_proc_uid));
+}
diff --git a/sysdeps/osf1/sem_limits.c b/sysdeps/osf1/sem_limits.c
new file mode 100644
index 00000000..f3a133e0
--- /dev/null
+++ b/sysdeps/osf1/sem_limits.c
@@ -0,0 +1,100 @@
+/* $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/sem_limits.h>
+
+static unsigned long _glibtop_sysdeps_sem_limits =
+(1 << GLIBTOP_IPC_SEMMNI) + (1 << GLIBTOP_IPC_SEMMSL) +
+(1 << GLIBTOP_IPC_SEMOPM) + (1 << GLIBTOP_IPC_SEMVMX) +
+(1 << GLIBTOP_IPC_SEMAEM);
+
+/* Provides information about sysv sem limits. */
+
+void
+glibtop_get_sem_limits__r (glibtop *server, glibtop_sem_limits *buf)
+{
+ int ret, value;
+
+ glibtop_init ();
+
+ memset (buf, 0, sizeof (glibtop_sem_limits));
+
+ ret = table (TBL_SEMINFO, SEMINFO_MNI, (char *) &value, 1,
+ sizeof (value));
+
+ if (ret != 1) return;
+
+ buf->flags += (1 << GLIBTOP_IPC_SEMMNI);
+
+ buf->semmni = value;
+
+
+ ret = table (TBL_SEMINFO, SEMINFO_MSL, (char *) &value, 1,
+ sizeof (value));
+
+ if (ret != 1) return;
+
+ buf->flags += (1 << GLIBTOP_IPC_SEMMSL);
+
+ buf->semmsl = value;
+
+
+ ret = table (TBL_SEMINFO, SEMINFO_OPM, (char *) &value, 1,
+ sizeof (value));
+
+ if (ret != 1) return;
+
+ buf->flags += (1 << GLIBTOP_IPC_SEMOPM);
+
+ buf->semopm = value;
+
+
+ ret = table (TBL_SEMINFO, SEMINFO_UME, (char *) &value, 1,
+ sizeof (value));
+
+ if (ret != 1) return;
+
+ buf->flags += (1 << GLIBTOP_IPC_SEMUME);
+
+ buf->semume = value;
+
+
+ ret = table (TBL_SEMINFO, SEMINFO_VMX, (char *) &value, 1,
+ sizeof (value));
+
+ if (ret != 1) return;
+
+ buf->flags += (1 << GLIBTOP_IPC_SEMVMX);
+
+ buf->semvmx = value;
+
+
+ ret = table (TBL_SEMINFO, SEMINFO_AEM, (char *) &value, 1,
+ sizeof (value));
+
+ if (ret != 1) return;
+
+ buf->flags += (1 << GLIBTOP_IPC_SEMAEM);
+
+ buf->semaem = value;
+}
diff --git a/sysdeps/osf1/shm_limits.c b/sysdeps/osf1/shm_limits.c
new file mode 100644
index 00000000..9173177a
--- /dev/null
+++ b/sysdeps/osf1/shm_limits.c
@@ -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/error.h>
+#include <glibtop/shm_limits.h>
+
+static unsigned long _glibtop_sysdeps_shm_limits =
+(1 << GLIBTOP_IPC_SHMMAX) + (1 << GLIBTOP_IPC_SHMMIN) +
+(1 << GLIBTOP_IPC_SHMMNI) + (1 << GLIBTOP_IPC_SHMSEG);
+
+/* Provides information about sysv ipc limits. */
+
+void
+glibtop_get_shm_limits__r (glibtop *server, glibtop_shm_limits *buf)
+{
+ int ret, value;
+
+ glibtop_init ();
+
+ memset (buf, 0, sizeof (glibtop_shm_limits));
+
+ ret = table (TBL_SHMINFO, SHMINFO_MAX, (char *) &value, 1,
+ sizeof (value));
+
+ if (ret != 1) return;
+
+ buf->flags += (1 << GLIBTOP_IPC_SHMMAX);
+
+ buf->shmmax = value;
+
+
+ ret = table (TBL_SHMINFO, SHMINFO_MIN, (char *) &value, 1,
+ sizeof (value));
+
+ if (ret != 1) return;
+
+ buf->flags += (1 << GLIBTOP_IPC_SHMMIN);
+
+ buf->shmmin = value;
+
+
+ ret = table (TBL_SHMINFO, SHMINFO_MNI, (char *) &value, 1,
+ sizeof (value));
+
+ if (ret != 1) return;
+
+ buf->flags += (1 << GLIBTOP_IPC_SHMMNI);
+
+ buf->shmmni = value;
+
+
+ ret = table (TBL_SHMINFO, SHMINFO_SEG, (char *) &value, 1,
+ sizeof (value));
+
+ if (ret != 1) return;
+
+ buf->flags += (1 << GLIBTOP_IPC_SHMSEG);
+
+ buf->shmseg = value;
+}
diff --git a/sysdeps/osf1/swap.c b/sysdeps/osf1/swap.c
new file mode 100644
index 00000000..c606fa50
--- /dev/null
+++ b/sysdeps/osf1/swap.c
@@ -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 <glibtop.h>
+#include <glibtop/error.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)
+{
+ struct tbl_swapinfo swapinfo;
+ int i;
+
+ glibtop_init ();
+
+ memset (buf, 0, sizeof (glibtop_swap));
+
+ i = 0;
+
+ while (table (TBL_SWAPINFO, i, (char *) &swapinfo, 1,
+ sizeof (struct tbl_swapinfo)) > 0) {
+ buf->total += swapinfo.size * getpagesize ();
+ buf->free += swapinfo.free * getpagesize ();
+ i++;
+ }
+
+ buf->flags = _glibtop_sysdeps_swap;
+
+ buf->used = buf->total - buf->free;
+}
diff --git a/sysdeps/stub/.cvsignore b/sysdeps/stub/.cvsignore
new file mode 100644
index 00000000..ac735171
--- /dev/null
+++ b/sysdeps/stub/.cvsignore
@@ -0,0 +1,27 @@
+.deps
+.libs
+Makefile
+Makefile.in
+close.lo
+cpu.lo
+init.lo
+libgtop_sysdeps.la
+loadavg.c
+loadavg.lo
+mem.lo
+msg_limits.lo
+open.lo
+prockernel.lo
+proclist.lo
+procmem.lo
+procsegment.lo
+procsignal.lo
+procstate.lo
+proctime.lo
+procuid.lo
+sem_limits.lo
+shm_limits.lo
+swap.lo
+sysdeps.lo
+uptime.c
+uptime.lo
diff --git a/sysdeps/stub/Makefile.am b/sysdeps/stub/Makefile.am
new file mode 100644
index 00000000..a1aac013
--- /dev/null
+++ b/sysdeps/stub/Makefile.am
@@ -0,0 +1,14 @@
+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
+
diff --git a/sysdeps/stub/close.c b/sysdeps/stub/close.c
new file mode 100644
index 00000000..ff7ebea4
--- /dev/null
+++ b/sysdeps/stub/close.c
@@ -0,0 +1,28 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <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)
+{ }
diff --git a/sysdeps/stub/cpu.c b/sysdeps/stub/cpu.c
new file mode 100644
index 00000000..cda12977
--- /dev/null
+++ b/sysdeps/stub/cpu.c
@@ -0,0 +1,31 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <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>
+
+/* Provides information about cpu usage. */
+
+void
+glibtop_get_cpu__r (glibtop *server, glibtop_cpu *buf)
+{
+ memset (buf, 0, sizeof (glibtop_cpu));
+}
diff --git a/sysdeps/stub/init.c b/sysdeps/stub/init.c
new file mode 100644
index 00000000..f6a9a506
--- /dev/null
+++ b/sysdeps/stub/init.c
@@ -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;
+}
diff --git a/sysdeps/stub/libsysdeps.la b/sysdeps/stub/libsysdeps.la
new file mode 100644
index 00000000..3f600ebb
--- /dev/null
+++ b/sysdeps/stub/libsysdeps.la
@@ -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'
diff --git a/sysdeps/stub/mem.c b/sysdeps/stub/mem.c
new file mode 100644
index 00000000..0410e2dd
--- /dev/null
+++ b/sysdeps/stub/mem.c
@@ -0,0 +1,31 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ The Gnome Top Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Top Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <config.h>
+#include <glibtop/mem.h>
+
+/* Provides information about memory usage. */
+
+void
+glibtop_get_mem__r (glibtop *server, glibtop_mem *buf)
+{
+ memset (buf, 0, sizeof (glibtop_mem));
+}
diff --git a/sysdeps/stub/msg_limits.c b/sysdeps/stub/msg_limits.c
new file mode 100644
index 00000000..62819042
--- /dev/null
+++ b/sysdeps/stub/msg_limits.c
@@ -0,0 +1,30 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ The Gnome Top Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Top Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <glibtop/msg_limits.h>
+
+/* Provides information about sysv ipc limits. */
+
+void
+glibtop_get_msg_limits__r (glibtop *server, glibtop_msg_limits *buf)
+{
+ memset (buf, 0, sizeof (glibtop_msg_limits));
+}
diff --git a/sysdeps/stub/open.c b/sysdeps/stub/open.c
new file mode 100644
index 00000000..c2d58069
--- /dev/null
+++ b/sysdeps/stub/open.c
@@ -0,0 +1,31 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <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>
+
+/* 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;
+}
diff --git a/sysdeps/stub/prockernel.c b/sysdeps/stub/prockernel.c
new file mode 100644
index 00000000..93f47bb1
--- /dev/null
+++ b/sysdeps/stub/prockernel.c
@@ -0,0 +1,32 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ The Gnome Top Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Top Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <config.h>
+#include <glibtop/prockernel.h>
+
+/* Provides detailed information about a process. */
+
+void
+glibtop_get_proc_kernel__r (glibtop *server, glibtop_proc_kernel *buf,
+ pid_t pid)
+{
+ memset (buf, 0, sizeof (glibtop_proc_kernel));
+}
diff --git a/sysdeps/stub/proclist.c b/sysdeps/stub/proclist.c
new file mode 100644
index 00000000..f3e0b993
--- /dev/null
+++ b/sysdeps/stub/proclist.c
@@ -0,0 +1,39 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ The Gnome Top Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Top Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <config.h>
+#include <glibtop/proclist.h>
+
+#define GLIBTOP_PROCLIST_FLAGS 3
+
+/* Fetch list of currently running processes.
+ *
+ * IMPORTANT NOTE:
+ * On error, this function MUST return NULL and set buf->flags to zero !
+ * On success, it returnes a pointer to a list of buf->number elements
+ * each buf->size big. The total size is stored in buf->total. */
+
+unsigned *
+glibtop_get_proclist__r (glibtop *server, glibtop_proclist *buf)
+{
+ memset (buf, 0, sizeof (glibtop_proclist));
+ return NULL;
+}
diff --git a/sysdeps/stub/procmem.c b/sysdeps/stub/procmem.c
new file mode 100644
index 00000000..889a4a20
--- /dev/null
+++ b/sysdeps/stub/procmem.c
@@ -0,0 +1,32 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ The Gnome Top Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Top Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <config.h>
+#include <glibtop/procmem.h>
+
+/* Provides detailed information about a process. */
+
+void
+glibtop_get_proc_mem__r (glibtop *server, glibtop_proc_mem *buf,
+ pid_t pid)
+{
+ memset (buf, 0, sizeof (glibtop_proc_mem));
+}
diff --git a/sysdeps/stub/procsegment.c b/sysdeps/stub/procsegment.c
new file mode 100644
index 00000000..c0ffeb17
--- /dev/null
+++ b/sysdeps/stub/procsegment.c
@@ -0,0 +1,32 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ The Gnome Top Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Top Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <config.h>
+#include <glibtop/procsegment.h>
+
+/* Provides detailed information about a process. */
+
+void
+glibtop_get_proc_segment__r (glibtop *server, glibtop_proc_segment *buf,
+ pid_t pid)
+{
+ memset (buf, 0, sizeof (glibtop_proc_segment));
+}
diff --git a/sysdeps/stub/procsignal.c b/sysdeps/stub/procsignal.c
new file mode 100644
index 00000000..6c30ee66
--- /dev/null
+++ b/sysdeps/stub/procsignal.c
@@ -0,0 +1,32 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ The Gnome Top Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Top Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <config.h>
+#include <glibtop/procsignal.h>
+
+/* Provides detailed information about a process. */
+
+void
+glibtop_get_proc_signal__r (glibtop *server, glibtop_proc_signal *buf,
+ pid_t pid)
+{
+ memset (buf, 0, sizeof (glibtop_proc_signal));
+}
diff --git a/sysdeps/stub/procstate.c b/sysdeps/stub/procstate.c
new file mode 100644
index 00000000..b8ad5cec
--- /dev/null
+++ b/sysdeps/stub/procstate.c
@@ -0,0 +1,32 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ The Gnome Top Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Top Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <config.h>
+#include <glibtop/procstate.h>
+
+/* Provides detailed information about a process. */
+
+void
+glibtop_get_proc_state__r (glibtop *server, glibtop_proc_state *buf,
+ pid_t pid)
+{
+ memset (buf, 0, sizeof (glibtop_proc_state));
+}
diff --git a/sysdeps/stub/proctime.c b/sysdeps/stub/proctime.c
new file mode 100644
index 00000000..ec81d2a0
--- /dev/null
+++ b/sysdeps/stub/proctime.c
@@ -0,0 +1,32 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ The Gnome Top Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Top Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <config.h>
+#include <glibtop/proctime.h>
+
+/* Provides detailed information about a process. */
+
+void
+glibtop_get_proc_time__r (glibtop *server, glibtop_proc_time *buf,
+ pid_t pid)
+{
+ memset (buf, 0, sizeof (glibtop_proc_time));
+}
diff --git a/sysdeps/stub/procuid.c b/sysdeps/stub/procuid.c
new file mode 100644
index 00000000..7fbb85fa
--- /dev/null
+++ b/sysdeps/stub/procuid.c
@@ -0,0 +1,32 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ The Gnome Top Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Top Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <config.h>
+#include <glibtop/procuid.h>
+
+/* Provides detailed information about a process. */
+
+void
+glibtop_get_proc_uid__r (glibtop *server, glibtop_proc_uid *buf,
+ pid_t pid)
+{
+ memset (buf, 0, sizeof (glibtop_proc_uid));
+}
diff --git a/sysdeps/stub/sem_limits.c b/sysdeps/stub/sem_limits.c
new file mode 100644
index 00000000..3768408b
--- /dev/null
+++ b/sysdeps/stub/sem_limits.c
@@ -0,0 +1,30 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ The Gnome Top Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Top Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <glibtop/sem_limits.h>
+
+/* Provides information about sysv sem limits. */
+
+void
+glibtop_get_sem_limits__r (glibtop *server, glibtop_sem_limits *buf)
+{
+ memset (buf, 0, sizeof (glibtop_sem_limits));
+}
diff --git a/sysdeps/stub/shm_limits.c b/sysdeps/stub/shm_limits.c
new file mode 100644
index 00000000..52e801ba
--- /dev/null
+++ b/sysdeps/stub/shm_limits.c
@@ -0,0 +1,30 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ The Gnome Top Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Top Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <glibtop/shm_limits.h>
+
+/* Provides information about sysv ipc limits. */
+
+void
+glibtop_get_shm_limits__r (glibtop *server, glibtop_shm_limits *buf)
+{
+ memset (buf, 0, sizeof (glibtop_shm_limits));
+}
diff --git a/sysdeps/stub/swap.c b/sysdeps/stub/swap.c
new file mode 100644
index 00000000..8e0d046b
--- /dev/null
+++ b/sysdeps/stub/swap.c
@@ -0,0 +1,31 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ The Gnome Top Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Top Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <config.h>
+#include <glibtop/swap.h>
+
+/* Provides information about swap usage. */
+
+void
+glibtop_get_swap__r (glibtop *server, glibtop_swap *buf)
+{
+ memset (buf, 0, sizeof (glibtop_swap));
+}
diff --git a/sysdeps/sun4/.cvsignore b/sysdeps/sun4/.cvsignore
new file mode 100644
index 00000000..d167e031
--- /dev/null
+++ b/sysdeps/sun4/.cvsignore
@@ -0,0 +1,19 @@
+.deps
+.libs
+Makefile
+Makefile.in
+close.lo
+cpu.lo
+libgtop_sysdeps.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
diff --git a/sysdeps/sun4/Makefile.am b/sysdeps/sun4/Makefile.am
new file mode 100644
index 00000000..60b581f1
--- /dev/null
+++ b/sysdeps/sun4/Makefile.am
@@ -0,0 +1,14 @@
+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 = -lkvm
diff --git a/sysdeps/sun4/close.c b/sysdeps/sun4/close.c
new file mode 100644
index 00000000..ff7ebea4
--- /dev/null
+++ b/sysdeps/sun4/close.c
@@ -0,0 +1,28 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <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)
+{ }
diff --git a/sysdeps/sun4/cpu.c b/sysdeps/sun4/cpu.c
new file mode 100644
index 00000000..cda12977
--- /dev/null
+++ b/sysdeps/sun4/cpu.c
@@ -0,0 +1,31 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <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>
+
+/* Provides information about cpu usage. */
+
+void
+glibtop_get_cpu__r (glibtop *server, glibtop_cpu *buf)
+{
+ memset (buf, 0, sizeof (glibtop_cpu));
+}
diff --git a/sysdeps/sun4/init.c b/sysdeps/sun4/init.c
new file mode 100644
index 00000000..f6a9a506
--- /dev/null
+++ b/sysdeps/sun4/init.c
@@ -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;
+}
diff --git a/sysdeps/sun4/libsysdeps.la b/sysdeps/sun4/libsysdeps.la
new file mode 100644
index 00000000..3f600ebb
--- /dev/null
+++ b/sysdeps/sun4/libsysdeps.la
@@ -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'
diff --git a/sysdeps/sun4/mem.c b/sysdeps/sun4/mem.c
new file mode 100644
index 00000000..0410e2dd
--- /dev/null
+++ b/sysdeps/sun4/mem.c
@@ -0,0 +1,31 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ The Gnome Top Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Top Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <config.h>
+#include <glibtop/mem.h>
+
+/* Provides information about memory usage. */
+
+void
+glibtop_get_mem__r (glibtop *server, glibtop_mem *buf)
+{
+ memset (buf, 0, sizeof (glibtop_mem));
+}
diff --git a/sysdeps/sun4/msg_limits.c b/sysdeps/sun4/msg_limits.c
new file mode 100644
index 00000000..62819042
--- /dev/null
+++ b/sysdeps/sun4/msg_limits.c
@@ -0,0 +1,30 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ The Gnome Top Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Top Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <glibtop/msg_limits.h>
+
+/* Provides information about sysv ipc limits. */
+
+void
+glibtop_get_msg_limits__r (glibtop *server, glibtop_msg_limits *buf)
+{
+ memset (buf, 0, sizeof (glibtop_msg_limits));
+}
diff --git a/sysdeps/sun4/open.c b/sysdeps/sun4/open.c
new file mode 100644
index 00000000..c2d58069
--- /dev/null
+++ b/sysdeps/sun4/open.c
@@ -0,0 +1,31 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <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>
+
+/* 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;
+}
diff --git a/sysdeps/sun4/procdata.c b/sysdeps/sun4/procdata.c
new file mode 100644
index 00000000..b542721d
--- /dev/null
+++ b/sysdeps/sun4/procdata.c
@@ -0,0 +1,31 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <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>
+
+/* Provides detailed information about a process. */
+
+void
+glibtop_get_procdata__r (glibtop *server, glibtop_procdata *buf, pid_t pid)
+{
+ memset (buf, 0, sizeof (glibtop_procdata));
+}
diff --git a/sysdeps/sun4/prockernel.c b/sysdeps/sun4/prockernel.c
new file mode 100644
index 00000000..93f47bb1
--- /dev/null
+++ b/sysdeps/sun4/prockernel.c
@@ -0,0 +1,32 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ The Gnome Top Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Top Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <config.h>
+#include <glibtop/prockernel.h>
+
+/* Provides detailed information about a process. */
+
+void
+glibtop_get_proc_kernel__r (glibtop *server, glibtop_proc_kernel *buf,
+ pid_t pid)
+{
+ memset (buf, 0, sizeof (glibtop_proc_kernel));
+}
diff --git a/sysdeps/sun4/proclist.c b/sysdeps/sun4/proclist.c
new file mode 100644
index 00000000..f3e0b993
--- /dev/null
+++ b/sysdeps/sun4/proclist.c
@@ -0,0 +1,39 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ The Gnome Top Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Top Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <config.h>
+#include <glibtop/proclist.h>
+
+#define GLIBTOP_PROCLIST_FLAGS 3
+
+/* Fetch list of currently running processes.
+ *
+ * IMPORTANT NOTE:
+ * On error, this function MUST return NULL and set buf->flags to zero !
+ * On success, it returnes a pointer to a list of buf->number elements
+ * each buf->size big. The total size is stored in buf->total. */
+
+unsigned *
+glibtop_get_proclist__r (glibtop *server, glibtop_proclist *buf)
+{
+ memset (buf, 0, sizeof (glibtop_proclist));
+ return NULL;
+}
diff --git a/sysdeps/sun4/procmem.c b/sysdeps/sun4/procmem.c
new file mode 100644
index 00000000..889a4a20
--- /dev/null
+++ b/sysdeps/sun4/procmem.c
@@ -0,0 +1,32 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ The Gnome Top Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Top Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <config.h>
+#include <glibtop/procmem.h>
+
+/* Provides detailed information about a process. */
+
+void
+glibtop_get_proc_mem__r (glibtop *server, glibtop_proc_mem *buf,
+ pid_t pid)
+{
+ memset (buf, 0, sizeof (glibtop_proc_mem));
+}
diff --git a/sysdeps/sun4/procsegment.c b/sysdeps/sun4/procsegment.c
new file mode 100644
index 00000000..c0ffeb17
--- /dev/null
+++ b/sysdeps/sun4/procsegment.c
@@ -0,0 +1,32 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ The Gnome Top Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Top Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <config.h>
+#include <glibtop/procsegment.h>
+
+/* Provides detailed information about a process. */
+
+void
+glibtop_get_proc_segment__r (glibtop *server, glibtop_proc_segment *buf,
+ pid_t pid)
+{
+ memset (buf, 0, sizeof (glibtop_proc_segment));
+}
diff --git a/sysdeps/sun4/procsignal.c b/sysdeps/sun4/procsignal.c
new file mode 100644
index 00000000..6c30ee66
--- /dev/null
+++ b/sysdeps/sun4/procsignal.c
@@ -0,0 +1,32 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ The Gnome Top Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Top Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <config.h>
+#include <glibtop/procsignal.h>
+
+/* Provides detailed information about a process. */
+
+void
+glibtop_get_proc_signal__r (glibtop *server, glibtop_proc_signal *buf,
+ pid_t pid)
+{
+ memset (buf, 0, sizeof (glibtop_proc_signal));
+}
diff --git a/sysdeps/sun4/procstate.c b/sysdeps/sun4/procstate.c
new file mode 100644
index 00000000..b8ad5cec
--- /dev/null
+++ b/sysdeps/sun4/procstate.c
@@ -0,0 +1,32 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ The Gnome Top Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Top Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <config.h>
+#include <glibtop/procstate.h>
+
+/* Provides detailed information about a process. */
+
+void
+glibtop_get_proc_state__r (glibtop *server, glibtop_proc_state *buf,
+ pid_t pid)
+{
+ memset (buf, 0, sizeof (glibtop_proc_state));
+}
diff --git a/sysdeps/sun4/proctime.c b/sysdeps/sun4/proctime.c
new file mode 100644
index 00000000..ec81d2a0
--- /dev/null
+++ b/sysdeps/sun4/proctime.c
@@ -0,0 +1,32 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ The Gnome Top Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Top Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <config.h>
+#include <glibtop/proctime.h>
+
+/* Provides detailed information about a process. */
+
+void
+glibtop_get_proc_time__r (glibtop *server, glibtop_proc_time *buf,
+ pid_t pid)
+{
+ memset (buf, 0, sizeof (glibtop_proc_time));
+}
diff --git a/sysdeps/sun4/procuid.c b/sysdeps/sun4/procuid.c
new file mode 100644
index 00000000..7fbb85fa
--- /dev/null
+++ b/sysdeps/sun4/procuid.c
@@ -0,0 +1,32 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ The Gnome Top Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Top Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <config.h>
+#include <glibtop/procuid.h>
+
+/* Provides detailed information about a process. */
+
+void
+glibtop_get_proc_uid__r (glibtop *server, glibtop_proc_uid *buf,
+ pid_t pid)
+{
+ memset (buf, 0, sizeof (glibtop_proc_uid));
+}
diff --git a/sysdeps/sun4/sem_limits.c b/sysdeps/sun4/sem_limits.c
new file mode 100644
index 00000000..3768408b
--- /dev/null
+++ b/sysdeps/sun4/sem_limits.c
@@ -0,0 +1,30 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ The Gnome Top Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Top Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <glibtop/sem_limits.h>
+
+/* Provides information about sysv sem limits. */
+
+void
+glibtop_get_sem_limits__r (glibtop *server, glibtop_sem_limits *buf)
+{
+ memset (buf, 0, sizeof (glibtop_sem_limits));
+}
diff --git a/sysdeps/sun4/shm_limits.c b/sysdeps/sun4/shm_limits.c
new file mode 100644
index 00000000..52e801ba
--- /dev/null
+++ b/sysdeps/sun4/shm_limits.c
@@ -0,0 +1,30 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ The Gnome Top Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Top Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <glibtop/shm_limits.h>
+
+/* Provides information about sysv ipc limits. */
+
+void
+glibtop_get_shm_limits__r (glibtop *server, glibtop_shm_limits *buf)
+{
+ memset (buf, 0, sizeof (glibtop_shm_limits));
+}
diff --git a/sysdeps/sun4/swap.c b/sysdeps/sun4/swap.c
new file mode 100644
index 00000000..8e0d046b
--- /dev/null
+++ b/sysdeps/sun4/swap.c
@@ -0,0 +1,31 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ The Gnome Top Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Top Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <config.h>
+#include <glibtop/swap.h>
+
+/* Provides information about swap usage. */
+
+void
+glibtop_get_swap__r (glibtop *server, glibtop_swap *buf)
+{
+ memset (buf, 0, sizeof (glibtop_swap));
+}