summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile.am22
-rw-r--r--lib/close.c50
-rw-r--r--lib/command.c73
-rw-r--r--lib/error.c173
-rw-r--r--lib/glibtop-server-private.h36
-rw-r--r--lib/glibtop-server.c57
-rw-r--r--lib/init.c249
-rwxr-xr-xlib/lib.pl246
-rw-r--r--lib/libgtop.sym130
-rw-r--r--lib/open.c182
-rw-r--r--lib/parameter.c98
-rw-r--r--lib/read.c58
-rw-r--r--lib/read_data.c76
-rw-r--r--lib/structures.pl104
-rw-r--r--lib/sysdeps.c198
-rw-r--r--lib/write.c54
16 files changed, 0 insertions, 1806 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am
deleted file mode 100644
index c7efd315..00000000
--- a/lib/Makefile.am
+++ /dev/null
@@ -1,22 +0,0 @@
-
-INCLUDES = @INCLUDES@
-
-lib_LTLIBRARIES = libgtop-2.0.la
-
-libgtop_2_0_la_SOURCES = init.c open.c close.c command.c read.c \
- read_data.c write.c lib.c parameter.c \
- sysdeps.c
-
-libgtop_2_0_la_LDFLAGS = $(LT_VERSION_INFO) -export-symbols $(srcdir)/libgtop.sym
-libgtop_2_0_la_LIBADD = $(GLIB_LIBS) $(top_builddir)/sysdeps/common/libgtop_common-2.0.la $(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps-2.0.la $(sysdeps_suid_lib)
-
-BUILT_SOURCES = lib.c
-
-lib.c: lib.pl $(top_builddir)/config.h $(top_srcdir)/features.def
- $(PERL) $(srcdir)/lib.pl < $(top_srcdir)/features.def > lib-t
- mv lib-t lib.c
-
-EXTRA_DIST = lib.pl libgtop.sym
-
-CLEANFILES = lib.c
-
diff --git a/lib/close.c b/lib/close.c
deleted file mode 100644
index a481e2da..00000000
--- a/lib/close.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Copyright (C) 1998-99 Martin Baulig
- This file is part of LibGTop 1.0.
-
- Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
-
- LibGTop is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License,
- or (at your option) any later version.
-
- LibGTop is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- You should have received a copy of the GNU General Public License
- along with LibGTop; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
-#include <config.h>
-#include <glibtop.h>
-#include <glibtop/open.h>
-#include <glibtop/error.h>
-#include <glibtop/close.h>
-#include <glibtop/command.h>
-
-/* Closes server. */
-
-void
-glibtop_close_r (glibtop *server)
-{
- switch (server->method) {
- case GLIBTOP_METHOD_UNIX:
- case GLIBTOP_METHOD_INET:
- glibtop_call_l (server, GLIBTOP_CMND_QUIT,
- 0, NULL, 0, NULL);
-
- if (close (server->socket))
- glibtop_warn_io ("close");
-
- break;
- case GLIBTOP_METHOD_PIPE:
- kill (server->pid, SIGKILL);
- close (server->input [0]);
- close (server->output [1]);
- break;
- }
-}
diff --git a/lib/command.c b/lib/command.c
deleted file mode 100644
index 4c458218..00000000
--- a/lib/command.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/* Copyright (C) 1998-99 Martin Baulig
- This file is part of LibGTop 1.0.
-
- Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
-
- LibGTop is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License,
- or (at your option) any later version.
-
- LibGTop is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- You should have received a copy of the GNU General Public License
- along with LibGTop; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
-#include <config.h>
-#include <glibtop/read.h>
-#include <glibtop/write.h>
-#include <glibtop/read_data.h>
-
-#include <glibtop/command.h>
-
-void *
-glibtop_call_l (glibtop *server, unsigned command, size_t send_size,
- const void *send_buf, size_t recv_size, void *recv_buf)
-{
- glibtop_command cmnd = {0};
- glibtop_response response = {0};
-
- glibtop_init_r (&server, 0, 0);
-
- cmnd.command = command;
-
- /* If send_size is less than _GLIBTOP_PARAM_SIZE (normally 16 Bytes), we
- * send it together with command, so we only need one system call instead
- * of two. */
-
- if (send_size <= _GLIBTOP_PARAM_SIZE) {
- memcpy (cmnd.parameter, send_buf, send_size);
- cmnd.size = send_size;
- } else {
- cmnd.data_size = send_size;
- }
-
- glibtop_write_l (server, sizeof (glibtop_command), &cmnd);
-
- glibtop_read_l (server, sizeof (glibtop_response), &response);
-
-#ifdef DEBUG
- fprintf (stderr, "RESPONSE: %lu - %d\n",
- response.offset, response.data_size);
-#endif
-
- if (recv_buf)
- memcpy (recv_buf, ((char *) &response) + response.offset,
- recv_size);
-
- if (response.data_size) {
- void *ptr = g_malloc (response.data_size);
-
- glibtop_read_l (server, response.data_size, ptr);
-
- return ptr;
- }
-
- return NULL;
-}
diff --git a/lib/error.c b/lib/error.c
deleted file mode 100644
index 4f356564..00000000
--- a/lib/error.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-
-/* Copyright (C) 1998-99 Martin Baulig
- This file is part of LibGTop 1.0.
-
- Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
-
- LibGTop is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License,
- or (at your option) any later version.
-
- LibGTop is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- You should have received a copy of the GNU General Public License
- along with LibGTop; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
-#include <config.h>
-
-#include <glibtop/error.h>
-
-#include <glib/gstrfuncs.h>
-#include <errno.h>
-
-#define DEFAULT_NAME "LibGTop-Server"
-
-/* Prints error message and exits. */
-
-static void
-print_server_name (glibtop_server *server)
-{
- fprintf (stderr, "%s: ", server ?
- (server->name ? server->name : DEFAULT_NAME)
- : DEFAULT_NAME);
-}
-
-void
-glibtop_error_vr (glibtop_server *server, char *format, va_list args)
-{
- print_server_name (server);
- vfprintf (stderr, format, args);
- fprintf (stderr, "\n");
-
-#ifdef LIBGTOP_ENABLE_DEBUG
- abort ();
-#else
- exit (1);
-#endif
-}
-
-void
-glibtop_error_io_vr (glibtop_server *server, char *format, int error, va_list args)
-{
- print_server_name (server);
- vfprintf (stderr, format, args);
- fprintf (stderr, ": %s\n", g_strerror (error));
-
-#ifdef LIBGTOP_ENABLE_DEBUG
- abort ();
-#else
- exit (1);
-#endif
-}
-
-void
-glibtop_warn_vr (glibtop_server *server, char *format, va_list args)
-{
- print_server_name (server);
- vfprintf (stderr, format, args);
- fprintf (stderr, "\n");
-
-#ifdef LIBGTOP_FATAL_WARNINGS
- abort ();
-#endif
-}
-
-void
-glibtop_warn_io_vr (glibtop_server *server, char *format, int error, va_list args)
-{
- print_server_name (server);
- vfprintf (stderr, format, args);
- fprintf (stderr, ": %s\n", g_strerror (error));
-
-#ifdef LIBGTOP_FATAL_WARNINGS
- abort ();
-#endif
-}
-
-void
-glibtop_error_r (glibtop_server *server, char *format, ...)
-{
- va_list args;
-
- va_start (args, format);
- glibtop_error_vr (server, format, args);
- va_end (args);
-}
-
-void
-glibtop_warn_r (glibtop_server *server, char *format, ...)
-{
- va_list args;
-
- va_start (args, format);
- glibtop_warn_vr (server, format, args);
- va_end (args);
-}
-
-void
-glibtop_error_io_r (glibtop_server *server, char *format, ...)
-{
- va_list args;
-
- va_start (args, format);
- glibtop_error_io_vr (server, format, errno, args);
- va_end (args);
-}
-
-void
-glibtop_warn_io_r (glibtop_server *server, char *format, ...)
-{
- va_list args;
-
- va_start (args, format);
- glibtop_warn_io_vr (server, format, errno, args);
- va_end (args);
-}
-
-#ifndef __GNUC__
-
-static void
-glibtop_error (char *format, ...)
-{
- va_list args;
- va_start (args, format);
- glibtop_error_vr (glibtop_global_server, format, args);
- va_end (args);
-}
-
-static void
-glibtop_warn (char *format, ...)
-{
- va_list args;
- va_start (args, format);
- glibtop_warn_vr (glibtop_global_server, format, args);
- va_end (args);
-}
-
-static void
-glibtop_error_io (char *format, ...)
-{
- va_list args;
- va_start (args, format);
- glibtop_error_io_vr (glibtop_global_server, format, errno, args);
- va_end (args);
-}
-
-static void
-glibtop_warn_io (char *format, ...)
-{
- va_list args;
- va_start (args, format);
- glibtop_warn_io_vr (glibtop_global_server, format, errno, args);
- va_end (args);
-}
-
-#endif /* no __GNUC__ */
diff --git a/lib/glibtop-server-private.h b/lib/glibtop-server-private.h
deleted file mode 100644
index 21010c42..00000000
--- a/lib/glibtop-server-private.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-
-/* Copyright (C) 1998-99 Martin Baulig
- This file is part of LibGTop 1.0.
-
- Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
-
- LibGTop is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License,
- or (at your option) any later version.
-
- LibGTop is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- You should have received a copy of the GNU General Public License
- along with LibGTop; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
-#ifndef __GLIBTOP_SERVER_PRIVATE_H__
-#define __GLIBTOP_SERVER_PRIVATE_H__
-
-#include <glib.h>
-
-typedef struct _glibtop_server_private glibtop_server_private;
-
-struct _glibtop_server_private
-{
- GSList *backend_list;
-};
-
-#endif
diff --git a/lib/glibtop-server.c b/lib/glibtop-server.c
deleted file mode 100644
index 17fdf252..00000000
--- a/lib/glibtop-server.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-
-/* Copyright (C) 1998-99 Martin Baulig
- This file is part of LibGTop 2.0.
-
- Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
-
- LibGTop is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License,
- or (at your option) any later version.
-
- LibGTop is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- You should have received a copy of the GNU General Public License
- along with LibGTop; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
-#include <config.h>
-#include <glibtop.h>
-#include <glibtop-server-private.h>
-
-glibtop_server *
-glibtop_server_new (void)
-{
- glibtop_server *retval;
-
- retval = g_new0 (glibtop_server, 1);
- retval->info = g_new0 (glibtop_server_info, 1);
- retval->_priv = g_new0 (glibtop_server_private, 1);
- retval->refcount = 1;
-
- return retval;
-}
-
-void
-glibtop_server_ref (glibtop_server *server)
-{
- server->refcount++;
-}
-
-void
-glibtop_server_unref (glibtop_server *server)
-{
- server->refcount--;
-
- if (server->refcount <= 0) {
- g_free (server->_priv);
- g_free (server->info);
- g_free (server);
- }
-}
diff --git a/lib/init.c b/lib/init.c
deleted file mode 100644
index 678714a5..00000000
--- a/lib/init.c
+++ /dev/null
@@ -1,249 +0,0 @@
-/* Copyright (C) 1998-99 Martin Baulig
- This file is part of LibGTop 1.0.
-
- Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
-
- LibGTop is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License,
- or (at your option) any later version.
-
- LibGTop is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- You should have received a copy of the GNU General Public License
- along with LibGTop; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
-#include <config.h>
-#include <glibtop.h>
-#include <glibtop/error.h>
-#include <glibtop/sysdeps.h>
-#include <glibtop/open.h>
-#include <glibtop/parameter.h>
-#include <glibtop/init_hooks.h>
-
-#ifndef DEFAULT_PORT
-#define DEFAULT_PORT 42800
-#endif
-
-static glibtop _glibtop_global_server = { 0 };
-glibtop *glibtop_global_server = &_glibtop_global_server;
-
-static void
-_init_server (glibtop *server, const unsigned features)
-{
- char *command, *temp;
-
- /* Try to get server command, but don't override if already
- * set via glibtop_set_parameter () */
-
- if (server->server_command == NULL) {
- const char *temp = getenv ("LIBGTOP_SERVER") ?
- getenv ("LIBGTOP_SERVER") : LIBGTOP_SERVER;
-
- server->server_command = g_strdup (temp);
- }
-
- if (server->server_rsh == NULL) {
- const char *temp = getenv ("LIBGTOP_RSH") ?
- getenv ("LIBGTOP_RSH") : "/usr/bin/ssh";
-
- server->server_rsh = g_strdup (temp);
- }
-
- /* Try to get server method, but don't override if already
- * set via glibtop_set_parameter () */
-
- if (server->method) return;
-
- /* If server->command doesn't start with a colon, then it is
- * the full pathname of the server executable. */
-
- if (server->server_command [0] != ':') {
- if (features & glibtop_server_features) {
- /* We really need the server. */
- server->method = GLIBTOP_METHOD_PIPE;
- } else {
- /* Fine. No server is needed, so we call the
- * sysdeps functions directly. */
- server->method = GLIBTOP_METHOD_DIRECT;
- }
-
- return;
- }
-
-
- /* If the first character of 'server_command' is a colon,
- * the first field is the method to connect to the server. */
-
- /* Everything up to the next colon is the method. */
-
- command = g_strdup (server->server_command+1);
- temp = strstr (command, ":");
- if (temp) *temp = 0;
-
- /* Dispatch method. */
-
- if (!strcmp (command, "direct")) {
- /* Use sysdeps dir instead of connecting to server
- * even if using the server would be required on
- * the current system. */
- server->method = GLIBTOP_METHOD_DIRECT;
-
- } else if (!strcmp (command, "inet")) {
-
- server->method = GLIBTOP_METHOD_INET;
-
- /* Connect to internet server. */
-
- if (temp == NULL) {
- /* If no value was set, we use 'localhost'. */
- if (server->server_host == NULL)
- server->server_host = g_strdup ("localhost");
- } else {
- char *temp2 = strstr (temp+1, ":");
- if (temp2) *temp2 = 0;
-
- /* Override default. */
- if (server->server_host)
- g_free ((char *) server->server_host);
-
- server->server_host = g_strdup (temp+1);
-
- temp = temp2;
- }
-
- if (temp == NULL) {
- /* If no value was set, we use DEFAULT_PORT. */
- if (server->server_port == 0)
- server->server_port = DEFAULT_PORT;
- } else {
- char *temp2 = strstr (temp+1, ":");
- if (temp2) *temp2 = 0;
-
- if (sscanf (temp+1, "%ld", &server->server_port) != 1)
- server->server_port = DEFAULT_PORT;
-
- temp = temp2 ? temp2 + 1 : temp2;
- }
-
- } else if (!strcmp (command, "unix")) {
-
- /* Connect to unix domain socket. */
- server->method = GLIBTOP_METHOD_UNIX;
-
- } else if (!strcmp (command, "pipe")) {
-
- /* Open pipe to server. */
- server->method = GLIBTOP_METHOD_PIPE;
-
- } else {
-
- glibtop_error_r (server, "Unknown server method '%s'",
- server->server_command+1);
-
- }
-
- g_free (command);
-}
-
-glibtop *
-glibtop_init_r (glibtop **server_ptr, unsigned long features, unsigned flags)
-{
- glibtop *server;
-
- if (server_ptr == NULL)
- return NULL;
-
- if (*server_ptr == NULL)
- *server_ptr = glibtop_global_server;
-
- server = *server_ptr;
-
- /* Should we do the initialization? */
-
- if (flags & GLIBTOP_INIT_NO_INIT)
- return server;
-
- /* Do the initialization, but only if not already initialized. */
-
- if ((server->flags & _GLIBTOP_INIT_STATE_INIT) == 0) {
- if (flags & GLIBTOP_FEATURES_EXCEPT)
- features = ~features & GLIBTOP_SYSDEPS_ALL;
-
- if (features == 0)
- features = GLIBTOP_SYSDEPS_ALL;
-
- if (flags & GLIBTOP_FEATURES_NO_SERVER) {
- server->method = GLIBTOP_METHOD_DIRECT;
- features = 0;
- }
-
- server->features = features;
-
- _init_server (server, features);
-
- server->flags |= _GLIBTOP_INIT_STATE_INIT;
-
- switch (server->method) {
- case GLIBTOP_METHOD_PIPE:
- case GLIBTOP_METHOD_UNIX:
- if (glibtop_server_features & features)
- break;
-
- server->method = GLIBTOP_METHOD_DIRECT;
- break;
- }
- }
-
- /* Should we open the server? */
-
- if (flags & GLIBTOP_INIT_NO_OPEN)
- return server;
-
- /* Open server, but only if not already opened. */
-
- if ((server->flags & _GLIBTOP_INIT_STATE_OPEN) == 0)
- glibtop_open_l (glibtop_global_server, "glibtop",
- features, flags);
-
- return server;
-}
-
-glibtop *
-glibtop_init_s (glibtop **server_ptr, unsigned long features, unsigned flags)
-{
- glibtop *server;
- const _glibtop_init_func_t *init_fkt;
-
- if (server_ptr == NULL)
- return NULL;
-
- if (*server_ptr == NULL)
- *server_ptr = glibtop_global_server;
-
- server = *server_ptr;
-
- /* Should we do the initialization? */
-
- if (flags & GLIBTOP_INIT_NO_INIT)
- return server;
-
- /* Do the initialization, but only if not already initialized. */
-
- if ((server->flags & _GLIBTOP_INIT_STATE_SYSDEPS) == 0) {
- glibtop_open_s (server, "glibtop", features, flags);
-
- for (init_fkt = _glibtop_init_hook_s; *init_fkt; init_fkt++)
- (*init_fkt) (server);
-
- server->flags |= _GLIBTOP_INIT_STATE_SYSDEPS;
- }
-
- return server;
-}
diff --git a/lib/lib.pl b/lib/lib.pl
deleted file mode 100755
index fe82170f..00000000
--- a/lib/lib.pl
+++ /dev/null
@@ -1,246 +0,0 @@
-#!/usr/bin/perl
-
-$[ = 1; # set array base to 1
-$, = ' '; # set output field separator
-$\ = "\n"; # set output record separator
-
-sub toupper {
- local($_) = @_;
- tr/a-z/A-Z/;
- return $_;
-}
-
-sub tolower {
- local($_) = @_;
- tr/A-Z/a-z/;
- return $_;
-}
-
-print '/* lib.c */';
-print "/* This is a generated file. Please modify `lib.pl' */";
-print '';
-
-print '#include <config.h>';
-print '';
-print '#include <glibtop.h>';
-print '#include <glibtop/error.h>';
-print '#include <glibtop/open.h>';
-print '';
-print '#include <glibtop/sysdeps.h>';
-print '#include <glibtop/union.h>';
-print '#include <glib/gi18n-lib.h>';
-print '';
-print '#include <glibtop/command.h>';
-
-print '';
-print '/* Some required fields are missing. */';
-print '';
-
-print 'static void';
-print '_glibtop_missing_feature (glibtop *server, const char *feature,';
-print "\t\t\t const guint64 present, guint64 *required)";
-print '{';
-print "\tguint64 old_required = *required;\n";
-print "\t/* Return if we have all required fields. */";
-print "\tif ((~present & old_required) == 0)";
-print "\t\treturn;\n";
-print "\tswitch (server->error_method) {";
-print "\tcase GLIBTOP_ERROR_METHOD_WARN_ONCE:";
-print "\t\t*required &= present;";
-print "\tcase GLIBTOP_ERROR_METHOD_WARN:";
-print "\t\tglibtop_warn_r (server,";
-print "\t\t\t\t_(\"glibtop_get_%s (): Client requested \"";
-print "\t\t\t\t \"field mask %05lx, but only have %05lx.\"),";
-print "\t\t\t\t feature, (unsigned long) old_required,";
-print "\t\t\t\t (unsigned long) present);";
-print "\t\tbreak;";
-print "\tcase GLIBTOP_ERROR_METHOD_ABORT:";
-print "\t\tglibtop_error_r (server,";
-print "\t\t\t\t _(\"glibtop_get_%s (): Client requested \"";
-print "\t\t\t\t \"field mask %05lx, but only have %05lx.\"),";
-print "\t\t\t\t feature, (unsigned long) old_required,";
-print "\t\t\t\t (unsigned long) present);";
-print "\t\tbreak;";
-print "\t}";
-print '}';
-
-print '';
-print '/* Library functions. */';
-print '';
-
-$convert{'long'} = 'gint64';
-$convert{'ulong'} = 'guint64';
-$convert{'pid_t'} = 'pid_t';
-$convert{'int'} = 'int';
-$convert{'ushort'} = 'unsigned short';
-$convert{'unsigned'} = 'unsigned';
-
-while (<>) {
- chop; # strip record separator
-
- if (/^[^#]/) {
- &output($_);
- }
-}
-
-sub output {
- local($line) = @_;
- @line_fields = split(/\|/, $line, 9999);
- $retval = $line_fields[1];
- $feature = $line_fields[2];
- $param_def = $line_fields[4];
-
- $orig = $feature;
- $feature =~ s/^@//;
- $space = $feature;
- $space =~ s/./ /g;
-
- print $retval;
- if ($retval !~ /^void$/) {
- $prefix = 'retval = ';
- $prefix_space = ' ';
- }
- else {
- $prefix = '';
- $prefix_space = '';
- }
-
- if ($param_def eq 'string') {
- $call_param = ', ' . $line_fields[5];
- $param_buf = '';
- $buf_set = '';
- $param_decl = ",\n " . $space . ' const char *' .
-
- $line_fields[5];
- $send_ptr = "\n\tconst void *send_ptr = " . $line_fields[5] . ';';
- $send_size = "\n\tconst size_t send_size =\n\t\tstrlen (" .
-
- $line_fields[5] . ') + 1;';
- }
- else {
- $call_param = '';
- $param_decl = '';
- $send_size = '';
- $send_ptr = '';
- $param_buf = '';
- $buf_set = '';
- $nr_params = (@params = split(/:/, $param_def, 9999));
- if ($nr_params) {
- $param_buf = "\n\tstruct {\n";
- }
- for ($param = 1; $param <= $nr_params; $param++) {
- $list = $params[$param];
- $type = $params[$param];
- $type =~ s/\(.*//;
- $list =~ s/^.*\(//;
- $list =~ s/\)$//;
- $count = (@fields = split(/,/, $list, 9999));
-
- if ($count > 0) {
- for ($field = 1; $field <= $count; $field++) {
- $param_buf .= "\t\t$convert{$type} buf_$fields[$field];\n";
- $buf_set .= "\tparam_buf.buf_$fields[$field] = $fields[$field];\n";
- }
- }
-
- for ($field = 1; $field <= $count; $field++) {
- if ($param_decl eq '') {
- $param_decl = ",\n " . $space . ' ';
- }
- else {
- $param_decl = $param_decl . ', ';
- }
- $param_decl = $param_decl . '' . $convert{$type} . ' ' .
-
- $fields[$field];
- $call_param = $call_param . ', ' . $fields[$field];
- if ($send_ptr eq '') {
- $send_ptr = "\n\tconst void *send_ptr = &param_buf;";
- }
- }
- }
- if ($nr_params) {
- $param_buf .= "\t} param_buf;";
- $send_size = "\n\tconst size_t send_size = sizeof param_buf;";
- }
- else {
- $send_size = "\n\tconst size_t send_size = 0;";
- }
- if ($send_ptr eq '') {
- $send_ptr = "\n\tconst void *send_ptr = NULL;";
- }
- }
-
- print 'glibtop_get_' . $feature . '_l (glibtop *server, glibtop_' .
-
- $feature . ' *buf' . $param_decl . ')';
-
- print "{" . $param_buf;
-
- print $send_ptr . '' . $send_size;
- if ($retval !~ /^void$/) {
- print "\t" . $retval . ' retval = (' . $retval . ') 0;';
- }
- print $buf_set;
-
- print "\tglibtop_init_r (&server, (1 << GLIBTOP_SYSDEPS_" .
-
- &toupper($feature) . '), 0);';
-
- print '';
- print "\t/* If neccessary, we ask the server for the requested";
- print "\t * feature. If not, we call the sysdeps function. */";
- print '';
-
- print "\tif ((server->flags & _GLIBTOP_INIT_STATE_SERVER) &&";
- print "\t (server->features & (1 << GLIBTOP_SYSDEPS_" .
-
- &toupper($feature) . ')))';
- print "\t{";
-
- print "\t\t" . $prefix . 'glibtop_call_l (server, GLIBTOP_CMND_' .
-
- &toupper($feature) . ',';
- print "\t\t\t\t" . $prefix_space . 'send_size, send_ptr,';
- print "\t\t\t\t" . $prefix_space . 'sizeof (glibtop_' . $feature .
-
- '), buf);';
-
- print "\t} else {";
-
- if ($orig !~ /^@/) {
- print '#if (!GLIBTOP_SUID_' . &toupper($feature) . ')';
- }
- print "\t\t" . $prefix . 'glibtop_get_' . $feature . '_s (server, buf' .
-
- $call_param . ');';
-
- if ($orig !~ /^@/) {
- print '#else';
- print "\t\terrno = ENOSYS;";
- print "\t\tglibtop_error_io_r (server, \"glibtop_get_" . $feature .
-
- "\");";
- print '#endif';
- }
-
- print "\t}";
-
- print '';
- print "\t/* Make sure that all required fields are present. */";
- print '';
-
- print "\tif (buf->flags & server->required." . $feature . ')';
- print "\t\t_glibtop_missing_feature (server, \"" . $feature .
-
- "\", buf->flags,";
- print "\t\t\t\t\t &server->required." . $feature . ');';
-
- if ($retval !~ /^void$/) {
- print "\n\t/* Now we can return. */";
- print "\n\treturn retval;";
- }
-
- print '}';
- print '';
-}
diff --git a/lib/libgtop.sym b/lib/libgtop.sym
deleted file mode 100644
index 9ba1f337..00000000
--- a/lib/libgtop.sym
+++ /dev/null
@@ -1,130 +0,0 @@
-glibtop_call_l
-glibtop_call_p
-glibtop_close
-glibtop_close_p
-glibtop_close_r
-glibtop_close_s
-glibtop_get_cpu
-glibtop_get_cpu_l
-glibtop_get_cpu_p
-glibtop_get_cpu_s
-glibtop_get_fsusage
-glibtop_get_fsusage_l
-glibtop_get_fsusage_p
-glibtop_get_fsusage_s
-glibtop_get_loadavg
-glibtop_get_loadavg_l
-glibtop_get_loadavg_p
-glibtop_get_loadavg_s
-glibtop_get_mem
-glibtop_get_mem_l
-glibtop_get_mem_p
-glibtop_get_mem_s
-glibtop_get_mountlist
-glibtop_get_mountlist_l
-glibtop_get_mountlist_p
-glibtop_get_mountlist_s
-glibtop_get_msg_limits
-glibtop_get_msg_limits_l
-glibtop_get_msg_limits_p
-glibtop_get_msg_limits_s
-glibtop_get_netlist
-glibtop_get_netlist_l
-glibtop_get_netlist_p
-glibtop_get_netlist_s
-glibtop_get_netload
-glibtop_get_netload_l
-glibtop_get_netload_p
-glibtop_get_netload_s
-glibtop_get_parameter_l
-glibtop_get_parameter_p
-glibtop_get_ppp
-glibtop_get_ppp_l
-glibtop_get_ppp_p
-glibtop_get_ppp_s
-glibtop_get_proc_args
-glibtop_get_proc_args_l
-glibtop_get_proc_args_p
-glibtop_get_proc_args_s
-glibtop_get_proc_argv
-glibtop_get_proc_argv_l
-glibtop_get_proc_argv_p
-glibtop_get_proc_kernel
-glibtop_get_proc_kernel_l
-glibtop_get_proc_kernel_p
-glibtop_get_proc_kernel_s
-glibtop_get_proclist
-glibtop_get_proclist_l
-glibtop_get_proclist_p
-glibtop_get_proclist_s
-glibtop_get_proc_map
-glibtop_get_proc_map_l
-glibtop_get_proc_map_p
-glibtop_get_proc_map_s
-glibtop_get_proc_mem
-glibtop_get_proc_mem_l
-glibtop_get_proc_mem_p
-glibtop_get_proc_mem_s
-glibtop_get_proc_open_files
-glibtop_get_proc_open_files_l
-glibtop_get_proc_open_files_p
-glibtop_get_proc_open_files_s
-glibtop_get_proc_segment
-glibtop_get_proc_segment_l
-glibtop_get_proc_segment_p
-glibtop_get_proc_segment_s
-glibtop_get_proc_signal
-glibtop_get_proc_signal_l
-glibtop_get_proc_signal_p
-glibtop_get_proc_signal_s
-glibtop_get_proc_state
-glibtop_get_proc_state_l
-glibtop_get_proc_state_p
-glibtop_get_proc_state_s
-glibtop_get_proc_time
-glibtop_get_proc_time_l
-glibtop_get_proc_time_p
-glibtop_get_proc_time_s
-glibtop_get_proc_uid
-glibtop_get_proc_uid_l
-glibtop_get_proc_uid_p
-glibtop_get_proc_uid_s
-glibtop_get_proc_wd
-glibtop_get_proc_wd_l
-glibtop_get_proc_wd_p
-glibtop_get_proc_wd_s
-glibtop_get_sem_limits
-glibtop_get_sem_limits_l
-glibtop_get_sem_limits_p
-glibtop_get_sem_limits_s
-glibtop_get_shm_limits
-glibtop_get_shm_limits_l
-glibtop_get_shm_limits_p
-glibtop_get_shm_limits_s
-glibtop_get_swap
-glibtop_get_swap_l
-glibtop_get_swap_p
-glibtop_get_swap_s
-glibtop_get_sysdeps
-glibtop_get_sysdeps_r
-glibtop_get_sysinfo
-glibtop_get_sysinfo_p
-glibtop_get_sysinfo_s
-glibtop_get_uptime
-glibtop_get_uptime_l
-glibtop_get_uptime_p
-glibtop_get_uptime_s
-glibtop_global_server
-glibtop_init
-glibtop_init_p
-glibtop_init_r
-glibtop_init_s
-glibtop_internet_addr
-glibtop_make_connection
-glibtop_open_l
-glibtop_open_p
-glibtop_open_s
-glibtop_server_features
-glibtop_set_parameter_l
-glibtop_set_parameter_p
-glibtop_sys_siglist
diff --git a/lib/open.c b/lib/open.c
deleted file mode 100644
index 9825bc63..00000000
--- a/lib/open.c
+++ /dev/null
@@ -1,182 +0,0 @@
-/* Copyright (C) 1998-99 Martin Baulig
- This file is part of LibGTop 1.0.
-
- Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
-
- LibGTop is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License,
- or (at your option) any later version.
-
- LibGTop is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- You should have received a copy of the GNU General Public License
- along with LibGTop; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
-#include <config.h>
-#include <glibtop.h>
-#include <glibtop/open.h>
-#include <glibtop/read.h>
-#include <glibtop/error.h>
-#include <glibtop/version.h>
-#include <glibtop/sysdeps.h>
-#include <glibtop/command.h>
-
-#include <glibtop/gnuserv.h>
-
-/* Opens pipe to gtop server. Returns 0 on success and -1 on error. */
-
-void
-glibtop_open_l (glibtop *server, const char *program_name,
- const unsigned long features, const unsigned flags)
-{
- int connect_type;
-
- server->name = program_name;
-
- /* It is important to set _GLIBTOP_INIT_STATE_OPEN here when we
- * do recursive calls to glibtop_init_r (). */
-
- server->flags |= _GLIBTOP_INIT_STATE_OPEN;
-
- server->error_method = GLIBTOP_ERROR_METHOD_DEFAULT;
-
-#ifdef DEBUG
- fprintf (stderr, "SIZEOF: %u - %u - %u - %u - %u - %u\n",
- sizeof (glibtop_command), sizeof (glibtop_response),
- sizeof (glibtop_mountentry), sizeof (glibtop_union),
- sizeof (glibtop_sysdeps), sizeof (glibtop_response_union));
-#endif
-
- switch (server->method) {
- case GLIBTOP_METHOD_DIRECT:
- server->features = 0;
- break;
- case GLIBTOP_METHOD_INET:
-#ifdef DEBUG
- fprintf (stderr, "Connecting to '%s' port %ld.\n",
- server->server_host, server->server_port);
-#endif
-
- connect_type = glibtop_make_connection
- (server->server_host, server->server_port,
- &server->socket);
-
-#ifdef DEBUG
- fprintf (stderr, "Connect Type is %d.\n", connect_type);
-#endif
-
- server->flags |= _GLIBTOP_INIT_STATE_SERVER;
-
- server->features = -1;
- break;
- case GLIBTOP_METHOD_UNIX:
-#ifdef DEBUG
- fprintf (stderr, "Connecting to Unix Domain Socket.\n");
-#endif
-
- connect_type = glibtop_make_connection
- ("unix", 0, &server->socket);
-
-#ifdef DEBUG
- fprintf (stderr, "Connect Type is %d.\n", connect_type);
-#endif
-
- server->flags |= _GLIBTOP_INIT_STATE_SERVER;
-
- server->features = -1;
- break;
- case GLIBTOP_METHOD_PIPE:
-#ifdef DEBUG
- fprintf (stderr, "Opening pipe to server (%s).\n",
- LIBGTOP_SERVER);
-#endif
-
- if (pipe (server->input) || pipe (server->output))
- glibtop_error_io_r (server, "cannot make a pipe");
-
- server->pid = fork ();
-
- if (server->pid < 0) {
- glibtop_error_io_r (server, "fork failed");
- } else if (server->pid == 0) {
- close (0); close (1);
- close (server->input [0]); close (server->output [1]);
- dup2 (server->input [1], 1);
- dup2 (server->output [0], 0);
- execl (LIBGTOP_SERVER, "libgtop-server", NULL);
- glibtop_error_io_r (server, "execl (%s)",
- LIBGTOP_SERVER);
- _exit (2);
- }
-
- close (server->input [1]);
- close (server->output [0]);
-
- server->flags |= _GLIBTOP_INIT_STATE_SERVER;
-
- server->features = -1;
- break;
- }
-
- /* If the server has been started, ask it for its features. */
-
- if (server->flags & _GLIBTOP_INIT_STATE_SERVER) {
- char version [BUFSIZ], buffer [BUFSIZ];
- glibtop_sysdeps sysdeps;
- size_t size, nbytes;
-
- /* First check whether the server version is correct. */
-
- sprintf (version, LIBGTOP_VERSION_STRING,
- LIBGTOP_VERSION, LIBGTOP_SERVER_VERSION,
- (guint) sizeof (glibtop_command),
- (guint) sizeof (glibtop_response),
- (guint) sizeof (glibtop_union),
- (guint) sizeof (glibtop_sysdeps));
-
- size = strlen (version) + 1;
-
- glibtop_read_l (server, sizeof (nbytes), &nbytes);
-
- if (nbytes != size)
- glibtop_error_r (server,
- "Requested %u bytes but got %u.",
- size, nbytes);
-
- glibtop_read_l (server, nbytes, buffer);
-
- if (memcmp (version, buffer, size))
- glibtop_error_r (server, "server version is not %s",
- LIBGTOP_VERSION);
-
- /* Now ask it for its features. */
-
- glibtop_call_l (server, GLIBTOP_CMND_SYSDEPS, 0, NULL,
- sizeof (glibtop_sysdeps), &sysdeps);
-
- server->features = sysdeps.features;
-
- memcpy (&server->sysdeps, &sysdeps, sizeof (glibtop_sysdeps));
-
-#ifdef DEBUG
- fprintf (stderr, "Server features are %lu.\n",
- server->features);
-#endif
- }
-
- /* In any case, we call the open functions of our own sysdeps
- * directory. */
-
-#ifdef DEBUG
- fprintf (stderr, "Calling sysdeps open function.\n");
-#endif
-
- glibtop_init_s (&server, features, flags);
-}
diff --git a/lib/parameter.c b/lib/parameter.c
deleted file mode 100644
index 4e996b30..00000000
--- a/lib/parameter.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/* Copyright (C) 1998-99 Martin Baulig
- This file is part of LibGTop 1.0.
-
- Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
-
- LibGTop is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License,
- or (at your option) any later version.
-
- LibGTop is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- You should have received a copy of the GNU General Public License
- along with LibGTop; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
-#include <config.h>
-#include <glibtop.h>
-#include <glibtop/parameter.h>
-#include <glibtop/error.h>
-
-#define _write_data(ptr,size) \
- if ((data_ptr == NULL) || (data_size < size)) return -size; \
- if (ptr == NULL) { char * const p = data_ptr; *p = '\0'; return 1; } \
- memcpy (data_ptr, ptr, size); \
- return size;
-
-#define _check_data(size) \
- if ((data_ptr == NULL) || (data_size != size)) { \
- glibtop_warn_r (server, "glibtop_set_parameter (%u): " \
- "Expected %lu bytes but got %lu.", \
- (unsigned) parameter, (unsigned long) size, (unsigned long) data_size); \
- return; \
- }
-
-#define _strlen(ptr) (ptr ? strlen (ptr) : 0)
-
-size_t
-glibtop_get_parameter_l (glibtop *server, const unsigned parameter,
- void *data_ptr, size_t data_size)
-{
- switch (parameter) {
- case GLIBTOP_PARAM_METHOD:
- _write_data (&server->method,
- sizeof (server->method));
- case GLIBTOP_PARAM_FEATURES:
- _write_data (&server->features,
- sizeof (server->features));
- case GLIBTOP_PARAM_COMMAND:
- _write_data (server->server_command,
- _strlen(server->server_command));
- case GLIBTOP_PARAM_HOST:
- _write_data (server->server_host,
- _strlen(server->server_host));
- case GLIBTOP_PARAM_PORT:
- _write_data (&server->server_port,
- sizeof (server->server_port));
- case GLIBTOP_PARAM_ERROR_METHOD:
- _write_data (&server->error_method,
- sizeof (server->error_method));
- case GLIBTOP_PARAM_REQUIRED:
- _write_data (&server->required,
- sizeof (server->required));
- }
-
- return 0;
-}
-
-void
-glibtop_set_parameter_l (glibtop *server, const unsigned parameter,
- const void *data_ptr, size_t data_size)
-{
- switch (parameter) {
- case GLIBTOP_PARAM_METHOD:
- _check_data (sizeof (server->method));
- memcpy (&server->method, data_ptr, data_size);
- break;
- case GLIBTOP_PARAM_FEATURES:
- /* You should not be allowed to set this field. */
- glibtop_warn_r (server, "glibtop_set_parameter (%u): " \
- "Cannot modify read-only value.",
- parameter);
- break;
- case GLIBTOP_PARAM_ERROR_METHOD:
- _check_data (sizeof (server->error_method));
- memcpy (&server->error_method, data_ptr, data_size);
- break;
- case GLIBTOP_PARAM_REQUIRED:
- _check_data (sizeof (server->required));
- memcpy (&server->required, data_ptr, data_size);
- break;
- }
-}
diff --git a/lib/read.c b/lib/read.c
deleted file mode 100644
index e7bd0fa5..00000000
--- a/lib/read.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/* Copyright (C) 1998-99 Martin Baulig
- This file is part of LibGTop 1.0.
-
- Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
-
- LibGTop is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License,
- or (at your option) any later version.
-
- LibGTop is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- You should have received a copy of the GNU General Public License
- along with LibGTop; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
-#include <config.h>
-#include <errno.h>
-#include <glibtop/read.h>
-#include <glibtop/error.h>
-#include <glib/gi18n-lib.h>
-
-
-
-void
-glibtop_read_l (glibtop *server, size_t size, void *buf)
-{
- int fd;
- glibtop_init_r (&server, 0, 0);
-
-#ifdef DEBUG
- fprintf (stderr, "LIBRARY: really reading %d bytes.\n", (int)size);
-#endif
-
- fd = server->socket ? server->socket : server->input[0];
-
- while (size) {
- ssize_t nread = read(fd, buf, size);
-
- if (nread < 0 && errno == EINTR)
- continue;
-
- if (nread <= 0)
- glibtop_error_io_r(
- server,
- ngettext ("read %d byte",
- "read %d bytes", size),
- (int)size);
-
- size -= nread;
- buf = (char *)buf + nread;
- }
-}
diff --git a/lib/read_data.c b/lib/read_data.c
deleted file mode 100644
index 7e6a4c2d..00000000
--- a/lib/read_data.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/* Copyright (C) 1998-99 Martin Baulig
- This file is part of LibGTop 1.0.
-
- Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
-
- LibGTop is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License,
- or (at your option) any later version.
-
- LibGTop is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- You should have received a copy of the GNU General Public License
- along with LibGTop; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
-#include <config.h>
-
-#include <glibtop/error.h>
-#include <glibtop/read_data.h>
-#include <glib/gi18n-lib.h>
-
-/* Reads some data from server. */
-
-void *
-glibtop_read_data_l (glibtop *server)
-{
- size_t size;
- void *ptr;
- int ret;
-
- glibtop_init_r (&server, 0, 0);
-
-#ifdef DEBUG
- fprintf (stderr, "LIBRARY: reading %lu data bytes.\n",
- (unsigned long) sizeof (size_t));
-#endif
-
- if (server->socket) {
- ret = recv (server->socket, &size, sizeof (size_t), 0);
- } else {
- ret = read (server->input [0], &size, sizeof (size_t));
- }
-
- if (ret < 0)
- glibtop_error_io_r (server, _("read data size"));
-
-#ifdef DEBUG
- fprintf (stderr, "LIBRARY: really reading %lu data bytes (ret = %d).\n",
- (unsigned long) size, ret);
-#endif
-
- if (!size) return NULL;
-
- ptr = g_malloc (size);
-
- if (server->socket) {
- ret = recv (server->socket, ptr, size, 0);
- } else {
- ret = read (server->input [0], ptr, size);
- }
-
- if (ret < 0)
- glibtop_error_io_r (server,
- ngettext ("read %lu byte of data",
- "read %lu bytes of data",
- (unsigned long) size),
- (unsigned long) size);
-
- return ptr;
-}
diff --git a/lib/structures.pl b/lib/structures.pl
deleted file mode 100644
index 976dc560..00000000
--- a/lib/structures.pl
+++ /dev/null
@@ -1,104 +0,0 @@
-#!/usr/bin/perl
-
-die "Usage: $0 features.def structures.def" unless $#ARGV == 2;
-
-$[ = 1; # set array base to 1
-$, = ' '; # set output field separator
-$\ = "\n"; # set output record separator
-
-sub toupper {
- local($_) = @_;
- tr/a-z/A-Z/;
- return $_;
-}
-
-sub tolower {
- local($_) = @_;
- tr/A-Z/a-z/;
- return $_;
-}
-
-$structures{$structure_count++} = 'glibtop';
-
-open FEATURESDEF, $ARGV[1] or
- die "open ($ARGV[1]): $!";
-
-while (<FEATURESDEF>) {
- chop; # strip record separator
-
- if (/^[^\#]/) {
- &parse_features_def ($_);
- }
-}
-
-close FEATURESDEF;
-
-open STRUCTDEF, $ARGV[2] or
- die "open ($ARGV[2]): $!";
-
-while (<STRUCTDEF>) {
- chop; # strip record separator
-
- if (/^[^\#]/) {
- &parse_structure_def ($_);
- }
-}
-
-close STRUCTDEF;
-
-$init_structures_code = sprintf
- (qq[\tscm_glibtop_structure_tags [GLIBTOP_STRUCTURE_GLIBTOP] = scm_make_structure_type\n\t\t("glibtop", sizeof (glibtop));\n]);
-
-for ($nr = 0; $nr < $structure_count; $nr++) {
- $structure = $structures{$nr};
-
- $init_structures_code .= sprintf
- (qq[\tscm_glibtop_structure_tags [GLIBTOP_STRUCTURE_%s] = scm_make_structure_type\n\t\t("%s", sizeof (%s));\n],
- toupper($structure), $structure, $structure);
-}
-
-print qq[/* structures.h */];
-print qq[/* This is a generated file. Please modify \`guile.pl\' */];
-print '';
-print qq[\#ifndef __GLIBTOP_STRUCTURES_H__];
-print qq[\#define __GLIBTOP_STRUCTURES_H__];
-print '';
-print qq[\#include <glibtop.h>];
-print '';
-print qq[G_BEGIN_DECLS];
-print '';
-
-for ($nr = 0; $nr < $structure_count; $nr++) {
- $structure = $structures{$nr};
-
- printf (qq[\#define %-40s\t%d\n], 'GLIBTOP_STRUCTURE_'.&toupper($structure), $nr);
-}
-
-print '';
-printf (qq[\#define %-40s\t%d\n], 'GLIBTOP_MAX_STRUCTURES', $structure_count);
-print '';
-print qq[G_END_DECLS];
-print '';
-print qq[\#endif /* __GLIBTOP_STRUCTURES_H__ */];
-
-sub parse_features_def {
- local($line) = @_;
- @line_fields = split(/\|/, $line, 9999);
- $retval = $line_fields[1];
- $element_def = $line_fields[3];
- $feature = $line_fields[2];
- $param_def = $line_fields[4];
-
- $feature =~ s/^@//;
- $features{$feature} = $feature;
-
- $structures{$structure_count++} = 'glibtop_'.$feature;
-}
-
-sub parse_structure_def {
- local($line) = @_;
- @line_fields = split(/\|/, $line, 9999);
- $name = $line_fields[1];
-
- $structures{$structure_count++} = $name;
-}
diff --git a/lib/sysdeps.c b/lib/sysdeps.c
deleted file mode 100644
index 1540a601..00000000
--- a/lib/sysdeps.c
+++ /dev/null
@@ -1,198 +0,0 @@
-/* Copyright (C) 1998-99 Martin Baulig
- This file is part of LibGTop 1.0.
-
- Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
-
- LibGTop is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License,
- or (at your option) any later version.
-
- LibGTop is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- You should have received a copy of the GNU General Public License
- along with LibGTop; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
-#include <config.h>
-#include <glibtop.h>
-#include <glibtop/union.h>
-#include <glibtop/sysdeps.h>
-#include <glibtop/init_hooks.h>
-
-const unsigned long glibtop_server_features =
-GLIBTOP_SUID_CPU +
-GLIBTOP_SUID_MEM +
-GLIBTOP_SUID_SWAP +
-GLIBTOP_SUID_UPTIME +
-GLIBTOP_SUID_LOADAVG +
-GLIBTOP_SUID_SHM_LIMITS +
-GLIBTOP_SUID_MSG_LIMITS +
-GLIBTOP_SUID_SEM_LIMITS +
-GLIBTOP_SUID_PROCLIST +
-GLIBTOP_SUID_PROC_STATE +
-GLIBTOP_SUID_PROC_UID +
-GLIBTOP_SUID_PROC_MEM +
-GLIBTOP_SUID_PROC_TIME +
-GLIBTOP_SUID_PROC_SIGNAL +
-GLIBTOP_SUID_PROC_KERNEL +
-GLIBTOP_SUID_PROC_SEGMENT +
-GLIBTOP_SUID_PROC_ARGS +
-GLIBTOP_SUID_PROC_MAP +
-GLIBTOP_SUID_NETLOAD +
-GLIBTOP_SUID_NETLIST +
-GLIBTOP_SUID_PROC_WD +
-GLIBTOP_SUID_PPP;
-
-const _glibtop_init_func_t _glibtop_init_hook_s [] = {
-#if !GLIBTOP_SUID_CPU
- _glibtop_init_cpu_s,
-#endif
-#if !GLIBTOP_SUID_MEM
- _glibtop_init_mem_s,
-#endif
-#if !GLIBTOP_SUID_SWAP
- _glibtop_init_swap_s,
-#endif
-#if !GLIBTOP_SUID_UPTIME
- _glibtop_init_uptime_s,
-#endif
-#if !GLIBTOP_SUID_LOADAVG
- _glibtop_init_loadavg_s,
-#endif
-#if !GLIBTOP_SUID_SHM_LIMITS
- _glibtop_init_shm_limits_s,
-#endif
-#if !GLIBTOP_SUID_MSG_LIMITS
- _glibtop_init_msg_limits_s,
-#endif
-#if !GLIBTOP_SUID_SEM_LIMITS
- _glibtop_init_sem_limits_s,
-#endif
-#if !GLIBTOP_SUID_PROCLIST
- _glibtop_init_proclist_s,
-#endif
-#if !GLIBTOP_SUID_PROC_STATE
- _glibtop_init_proc_state_s,
-#endif
-#if !GLIBTOP_SUID_PROC_UID
- _glibtop_init_proc_uid_s,
-#endif
-#if !GLIBTOP_SUID_PROC_MEM
- _glibtop_init_proc_mem_s,
-#endif
-#if !GLIBTOP_SUID_PROC_TIME
- _glibtop_init_proc_time_s,
-#endif
-#if !GLIBTOP_SUID_PROC_SIGNAL
- _glibtop_init_proc_signal_s,
-#endif
-#if !GLIBTOP_SUID_PROC_KERNEL
- _glibtop_init_proc_kernel_s,
-#endif
-#if !GLIBTOP_SUID_PROC_SEGMENT
- _glibtop_init_proc_segment_s,
-#endif
-#if !GLIBTOP_SUID_PROC_ARGS
- _glibtop_init_proc_args_s,
-#endif
-#if !GLIBTOP_SUID_PROC_MAP
- _glibtop_init_proc_map_s,
-#endif
-#if !GLIBTOP_SUID_NETLOAD
- _glibtop_init_netload_s,
-#endif
-#if !GLIBTOP_SUID_NETLIST
- _glibtop_init_netlist_s,
-#endif
-#if !GLIBTOP_SUID_PROC_WD
- _glibtop_init_proc_wd_s,
-#endif
-#if !GLIBTOP_SUID_PPP
- _glibtop_init_ppp_s,
-#endif
- NULL
-};
-
-const _glibtop_init_func_t _glibtop_init_hook_p [] = {
-#if GLIBTOP_SUID_CPU
- _glibtop_init_cpu_p,
-#endif
-#if GLIBTOP_SUID_MEM
- _glibtop_init_mem_p,
-#endif
-#if GLIBTOP_SUID_SWAP
- _glibtop_init_swap_p,
-#endif
-#if GLIBTOP_SUID_UPTIME
- _glibtop_init_uptime_p,
-#endif
-#if GLIBTOP_SUID_LOADAVG
- _glibtop_init_loadavg_p,
-#endif
-#if GLIBTOP_SUID_SHM_LIMITS
- _glibtop_init_shm_limits_p,
-#endif
-#if GLIBTOP_SUID_MSG_LIMITS
- _glibtop_init_msg_limits_p,
-#endif
-#if GLIBTOP_SUID_SEM_LIMITS
- _glibtop_init_sem_limits_p,
-#endif
-#if GLIBTOP_SUID_PROCLIST
- _glibtop_init_proclist_p,
-#endif
-#if GLIBTOP_SUID_PROC_STATE
- _glibtop_init_proc_state_p,
-#endif
-#if GLIBTOP_SUID_PROC_UID
- _glibtop_init_proc_uid_p,
-#endif
-#if GLIBTOP_SUID_PROC_MEM
- _glibtop_init_proc_mem_p,
-#endif
-#if GLIBTOP_SUID_PROC_TIME
- _glibtop_init_proc_time_p,
-#endif
-#if GLIBTOP_SUID_PROC_SIGNAL
- _glibtop_init_proc_signal_p,
-#endif
-#if GLIBTOP_SUID_PROC_KERNEL
- _glibtop_init_proc_kernel_p,
-#endif
-#if GLIBTOP_SUID_PROC_SEGMENT
- _glibtop_init_proc_segment_p,
-#endif
-#if GLIBTOP_SUID_PROC_ARGS
- _glibtop_init_proc_args_p,
-#endif
-#if GLIBTOP_SUID_PROC_MAP
- _glibtop_init_proc_map_p,
-#endif
-#if GLIBTOP_SUID_NETLOAD
- _glibtop_init_netload_p,
-#endif
-#if GLIBTOP_SUID_NETLIST
- _glibtop_init_netlist_p,
-#endif
-#if GLIBTOP_SUID_PROC_WD
- _glibtop_init_proc_wd_p,
-#endif
-#if GLIBTOP_SUID_PPP
- _glibtop_init_ppp_p,
-#endif
- NULL
-};
-
-/* Checks which features are implemented. */
-
-void
-glibtop_get_sysdeps_r (glibtop *server, glibtop_sysdeps *buf)
-{
- *buf = server->sysdeps;
-}
diff --git a/lib/write.c b/lib/write.c
deleted file mode 100644
index 2e407069..00000000
--- a/lib/write.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Copyright (C) 1998-99 Martin Baulig
- This file is part of LibGTop 1.0.
-
- Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
-
- LibGTop is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License,
- or (at your option) any later version.
-
- LibGTop is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- You should have received a copy of the GNU General Public License
- along with LibGTop; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
-#include <config.h>
-#include <errno.h>
-#include <glibtop/write.h>
-#include <glibtop/error.h>
-#include <glib/gi18n-lib.h>
-
-/* Writes some data to server. */
-
-void
-glibtop_write_l (glibtop *server, size_t size, void *buf)
-{
- int ret;
- int fd;
-
- glibtop_init_r (&server, 0, 0);
-
- if (size == 0) return;
-
-#ifdef DEBUG
- fprintf (stderr, "LIBRARY: really writing %d bytes.\n", (int)size);
-#endif
-
- fd = server->socket ? server->socket : server->output[1];
-
- while ((ret = write(fd, buf, size)) < 0 && errno == EINTR)
- ;
-
- if (ret < 0)
- glibtop_error_io_r (server,
- ngettext("wrote %d byte",
- "wrote %d bytes", size),
- (int) size);
-}