summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Baulig <martin@src.gnome.org>1998-06-14 21:32:00 +0000
committerMartin Baulig <martin@src.gnome.org>1998-06-14 21:32:00 +0000
commit8d785595975142f7f9767144814ef525a6586ab7 (patch)
tree9ad6cd1e521392dd9323d04501f1fb23a62c509a
parent2a281d0a53a1ac9a3032204658a3d3f83078a5af (diff)
downloadlibgtop-8d785595975142f7f9767144814ef525a6586ab7.tar.gz
Did some more work on the daemon.
-rw-r--r--examples/Makefile.am8
-rw-r--r--lib/Makefile.am2
-rw-r--r--lib/gnuclient.c39
-rw-r--r--lib/init.c4
-rw-r--r--lib/open.c24
-rw-r--r--lib/read.c35
-rw-r--r--lib/read_data.c31
-rw-r--r--lib/write.c32
-rw-r--r--src/daemon/Makefile.am25
-rw-r--r--src/daemon/gnuserv.c59
-rw-r--r--src/daemon/main.c259
-rw-r--r--src/proxy/Makefile.am2
12 files changed, 443 insertions, 77 deletions
diff --git a/examples/Makefile.am b/examples/Makefile.am
index a79cf4ce..945e8db1 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -16,8 +16,8 @@ bin_PROGRAMS = first first_static second second_static \
EXTRA_PROGRAMS = third third_static
first_SOURCES = first.c
-first_LDADD = $(top_builddir)/sysdeps/common/libgtop_common.la \
- $(top_builddir)/lib/libgtop.la \
+first_LDADD = $(top_builddir)/lib/libgtop.la \
+ $(top_builddir)/sysdeps/common/libgtop_common.la \
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
@INTLLIBS@ @LIBSUPPORT@ @libs_xauth@
@@ -26,8 +26,8 @@ first_static_LDADD = $(first_LDADD)
first_static_LDFLAGS = -static
second_SOURCES = second.c
-second_LDADD = $(top_builddir)/sysdeps/common/libgtop_common.la \
- $(top_builddir)/lib/libgtop.la \
+second_LDADD = $(top_builddir)/lib/libgtop.la \
+ $(top_builddir)/sysdeps/common/libgtop_common.la \
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
@INTLLIBS@ @LIBSUPPORT@ @libs_xauth@
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 9e32e2e8..6f2a9116 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -24,4 +24,4 @@ bin_PROGRAMS = gnuclient
gnuclient_LDADD = $(top_builddir)/sysdeps/common/libgtop_common.la \
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
@INTLLIBS@ @LIBSUPPORT@ @X_LIBS@ -lXau
-gnuclient_LDFLAGS = -static
+gnuclient_LDFLAGS = -static
diff --git a/lib/gnuclient.c b/lib/gnuclient.c
index e23fa8c9..122cc468 100644
--- a/lib/gnuclient.c
+++ b/lib/gnuclient.c
@@ -51,14 +51,9 @@ int
main (int argc, char *argv[])
{
int s; /* socket / msqid to server */
- int connect_type; /* CONN_UNIX, CONN_INTERNET, or
- * CONN_IPC */
+ int connect_type; /* CONN_UNIX, CONN_INTERNET, or CONN_IPC */
#ifdef INTERNET_DOMAIN_SOCKETS
- char *hostarg = NULL; /* remote hostname */
- char thishost[HOSTNAMSZ]; /* this hostname */
- char remotepath[MAXPATHLEN+1]; /* remote pathname */
- int rflg = 0; /* pathname given on cmdline */
- u_short port = 0; /* port to server */
+ char thishost [HOSTNAMSZ]; /* this hostname */
#endif /* INTERNET_DOMAIN_SOCKETS */
#ifdef SYSV_IPC
struct msgbuf *msgp; /* message */
@@ -66,42 +61,12 @@ main (int argc, char *argv[])
glibtop_init ();
-#ifdef INTERNET_DOMAIN_SOCKETS
- memset (remotepath, 0, sizeof (remotepath));
-#endif /* INTERNET_DOMAIN_SOCKETS */
-
-#if defined(INTERNET_DOMAIN_SOCKETS)
- connect_type = glibtop_make_connection (hostarg, port, &s);
-#else
connect_type = glibtop_make_connection (NULL, (u_short) 0, &s);
-#endif
#ifdef INTERNET_DOMAIN_SOCKETS
if (connect_type == (int) CONN_INTERNET)
{
- char *ptr;
gethostname (thishost, HOSTNAMSZ);
- if (!rflg)
- { /* attempt to generate a path
- * to this machine */
- if ((ptr = getenv ("LIBGTOP_NODE")) != NULL)
- /* user specified a path */
- strcpy (remotepath, ptr);
- }
-#if 0 /* This is really bogus... re-enable it if you must have it! */
-#if defined (hp9000s300) || defined (hp9000s800)
- else if (strcmp (thishost,hostarg))
- { /* try /net/thishost */
- strcpy (remotepath, "/net/"); /* (this fails using internet
- addresses) */
- strcat (remotepath, thishost);
- }
-#endif
-#endif
- }
- else
- { /* same machines, no need for path */
- remotepath[0] = '\0'; /* default is the empty path */
}
#endif /* INTERNET_DOMAIN_SOCKETS */
diff --git a/lib/init.c b/lib/init.c
index f0094020..ceefe35e 100644
--- a/lib/init.c
+++ b/lib/init.c
@@ -27,7 +27,7 @@ glibtop *glibtop_global_server = NULL;
glibtop *
glibtop_init_r (glibtop **server, const unsigned long features,
- const unsigned flags)
+ const unsigned flags)
{
if (*server != NULL)
return *server;
@@ -35,7 +35,7 @@ glibtop_init_r (glibtop **server, const unsigned long features,
if (glibtop_global_server == NULL) {
glibtop_global_server = &_glibtop_global_server;
glibtop_open_l (glibtop_global_server, "glibtop",
- features, flags);
+ features, flags);
}
return *server = glibtop_global_server;
diff --git a/lib/open.c b/lib/open.c
index d3501fa4..2411b1c0 100644
--- a/lib/open.c
+++ b/lib/open.c
@@ -25,25 +25,45 @@
#include <glibtop/command.h>
#include <glibtop/xmalloc.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)
+ const unsigned long features, const unsigned flags)
{
char version [BUFSIZ], buffer [BUFSIZ];
char *server_command, *server_rsh, *temp;
char *server_host, *server_user;
glibtop_sysdeps sysdeps;
+ int connect_type;
memset (server, 0, sizeof (glibtop));
server->name = program_name;
/* Is the user allowed to override the server ? */
-
+
if ((flags & GLIBTOP_OPEN_NO_OVERRIDE) == 0) {
+ connect_type = glibtop_make_connection
+ (NULL, (u_short) 0, &server->socket);
+
+#ifdef INTERNET_DOMAIN_SOCKETS
+ if (connect_type == (int) CONN_INTERNET) {
+ fprintf (stderr, "Calling GLITOP_CMND_SYSDEPS ...\n");
+
+ glibtop_call_l (server, GLIBTOP_CMND_SYSDEPS, 0, NULL,
+ sizeof (glibtop_sysdeps), &sysdeps);
+
+ server->features = sysdeps.features;
+
+ fprintf (stderr, "Features: %lu\n", server->features);
+ return;
+ }
+#endif /* INTERNET_DOMAIN_SOCKETS */
+
/* Try to get data from environment. */
temp = getenv ("LIBGTOP_SERVER") ?
diff --git a/lib/read.c b/lib/read.c
index e8b2e623..361bb5a4 100644
--- a/lib/read.c
+++ b/lib/read.c
@@ -27,15 +27,36 @@ void
glibtop_read_l (glibtop *server, size_t size, void *buf)
{
size_t ssize;
+ int ret;
glibtop_init_r (&server, 0, 0);
-
- if (read (server->input [0], &ssize, sizeof (size_t)) < 0)
- glibtop_error_r (server, _("read size: %s"), strerror (errno));
+
+#ifdef DEBUG
+ fprintf (stderr, "LIBRARY: reading %d bytes, should be %d.\n", sizeof (size_t), size);
+#endif
+
+ if (server->socket) {
+ ret = recv (server->socket, &ssize, sizeof (size_t), 0);
+ } else {
+ ret = read (server->input [0], &ssize, sizeof (size_t));
+ }
+
+ if (ret < 0)
+ glibtop_error_io_r (server, _("read size"));
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));
+ glibtop_error_r (server, _("got %d bytes but requested %d (ret = %d)"), ssize, size, ret);
+
+#ifdef DEBUG
+ fprintf (stderr, "LIBRARY: really reading %d bytes.\n", size);
+#endif
+
+ if (server->socket) {
+ ret = recv (server->socket, buf, size, 0);
+ } else {
+ ret = read (server->input [0], buf, size);
+ }
+
+ if (ret < 0)
+ glibtop_error_io_r (server, _("read %d bytes"), size);
}
diff --git a/lib/read_data.c b/lib/read_data.c
index d11b28d9..f7ac86c9 100644
--- a/lib/read_data.c
+++ b/lib/read_data.c
@@ -29,20 +29,39 @@ glibtop_read_data_l (glibtop *server)
{
size_t size;
void *ptr;
+ int ret;
glibtop_init_r (&server, 0, 0);
- if (read (server->input [0], &size, sizeof (size_t)) < 0)
- glibtop_error_r (server, _("read data size: %s"),
- strerror (errno));
+#ifdef DEBUG
+ fprintf (stderr, "LIBRARY: reading %d data bytes.\n", 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 %d data bytes (ret = %d).\n", size, ret);
+#endif
if (!size) return NULL;
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));
+ 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, _("read data %d bytes"));
return ptr;
}
diff --git a/lib/write.c b/lib/write.c
index ac03ecae..f91858ee 100644
--- a/lib/write.c
+++ b/lib/write.c
@@ -26,13 +26,35 @@
void
glibtop_write_l (glibtop *server, size_t size, void *buf)
{
+ int ret;
+
glibtop_init_r (&server, 0, 0);
- if (write (server->output [1], &size, sizeof (size_t)) < 0)
- glibtop_error_r (server, _("write size: %s"), strerror (errno));
+#ifdef DEBUG
+ fprintf (stderr, "LIBRARY: writing %d bytes = %d.\n", sizeof (size_t), size);
+#endif
+
+ if (server->socket) {
+ ret = send (server->socket, &size, sizeof (size_t), 0);
+ } else {
+ ret = write (server->output [1], &size, sizeof (size_t));
+ }
+
+ if (ret < 0)
+ glibtop_error_io_r (server, _("write size"));
if (!size) return;
-
- if (write (server->output [1], buf, size) < 0)
- glibtop_error_r (server, _("write %d bytes: %s"), size, strerror (errno));
+
+#ifdef DEBUG
+ fprintf (stderr, "LIBRARY: really writing %d bytes.\n", size);
+#endif
+
+ if (server->socket) {
+ ret = send (server->socket, buf, size, 0);
+ } else {
+ ret = write (server->output [1], buf, size);
+ }
+
+ if (ret < 0)
+ glibtop_error_io_r (server, _("write %d bytes"), size);
}
diff --git a/src/daemon/Makefile.am b/src/daemon/Makefile.am
new file mode 100644
index 00000000..7ac13ca7
--- /dev/null
+++ b/src/daemon/Makefile.am
@@ -0,0 +1,25 @@
+LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
+
+INCLUDES = -I$(top_builddir) -I$(top_srcdir) @machine_incs@ \
+ -I$(top_srcdir)/include -I$(top_srcdir)/intl @GUILE_INCS@ \
+ -DGTOPLOCALEDIR=\"$(datadir)/locale\" -D_GNU_SOURCE
+
+CFLAGS = -Wall -W @CFLAGS@ -DGTOP_SERVER=\""@LIBGTOP_SERVER@"\"
+
+bin_PROGRAMS = gnuserv
+
+EXTRA_PROGRAMS = gtop_daemon
+
+gnuserv_SOURCES = gnuserv.c main.c
+gnuserv_LDADD = $(top_builddir)/lib/libgtop.la \
+ $(top_builddir)/sysdeps/common/libgtop_common.la \
+ $(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
+ @INTLLIBS@ @LIBSUPPORT@ @X_LIBS@ -lXau
+gnuserv_LDFLAGS = -static
+
+gtop_daemon_SOURCES = main.c inet.c loop.c output.c version.c
+gtop_daemon_LDADD = $(top_builddir)/lib/libgtop.la \
+ $(top_builddir)/sysdeps/common/libgtop_common.la \
+ $(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
+ @INTLLIBS@ @LIBSUPPORT@
+gtop_daemon_LDFLAGS = -static
diff --git a/src/daemon/gnuserv.c b/src/daemon/gnuserv.c
index 9077b023..e5016e7d 100644
--- a/src/daemon/gnuserv.c
+++ b/src/daemon/gnuserv.c
@@ -33,12 +33,17 @@
static char rcsid [] = "!Header: gnuserv.c,v 2.1 95/02/16 11:58:27 arup alpha !";
#endif
+#define DEBUG
+
#include <glibtop/gnuserv.h>
+#include <glibtop/open.h>
#ifdef AIX
#include <sys/select.h>
#endif
+extern void handle_socket_connection __P((int));
+
#if !defined(SYSV_IPC) && !defined(UNIX_DOMAIN_SOCKETS) && !defined(INTERNET_DOMAIN_SOCKETS)
main ()
{
@@ -417,6 +422,10 @@ permitted (u_long host_addr, int fd)
if (timed_read(fd, auth_protocol, AUTH_NAMESZ, AUTH_TIMEOUT, 1) <= 0)
return FALSE;
+#ifdef DEBUG
+ fprintf (stderr, "Client sent authenticatin protocol '%s'\n", auth_protocol);
+#endif
+
if (strcmp (auth_protocol, DEFAUTH_NAME) &&
strcmp (auth_protocol, MCOOKIE_NAME))
{
@@ -425,24 +434,24 @@ permitted (u_long host_addr, int fd)
return FALSE;
}
- if (!strcmp(auth_protocol, MCOOKIE_NAME))
+ if (!strcmp (auth_protocol, MCOOKIE_NAME))
{
/*
* doing magic cookie auth
*/
- if (timed_read(fd, buf, 10, AUTH_TIMEOUT, 1) <= 0)
+ if (timed_read (fd, buf, 10, AUTH_TIMEOUT, 1) <= 0)
return FALSE;
- auth_data_len = atoi(buf);
+ auth_data_len = atoi (buf);
- if (timed_read(fd, buf, auth_data_len, AUTH_TIMEOUT, 0) != auth_data_len)
+ if (timed_read (fd, buf, auth_data_len, AUTH_TIMEOUT, 0) != auth_data_len)
return FALSE;
#ifdef AUTH_MAGIC_COOKIE
if (server_xauth && server_xauth->data &&
- !memcmp(buf, server_xauth->data, auth_data_len))
+ !memcmp (buf, server_xauth->data, auth_data_len))
{
return TRUE;
}
@@ -470,11 +479,19 @@ permitted (u_long host_addr, int fd)
/* First find the hash key */
key = HASH(host_addr) % TABLE_SIZE;
+
+#ifdef DEBUG
+ fprintf (stderr, "Doing GNU_SECURE auth ...\n");
+#endif
/* Now check the chain for that hash key */
- for(entry = permitted_hosts[key]; entry != NULL; entry=entry->next)
+ for(entry = permitted_hosts [key]; entry != NULL; entry = entry->next) {
+#ifdef DEBUG
+ fprintf (stderr, "Trying %ld\n", entry->host_addr);
+#endif
if (host_addr == entry->host_addr)
return(TRUE);
+ }
return(FALSE);
@@ -625,20 +642,34 @@ handle_internet_request (int ls)
size_t addrlen = sizeof(struct sockaddr_in);
struct sockaddr_in peer; /* for peer socket address */
- memset((char *)&peer,0,sizeof(struct sockaddr_in));
+ memset((char *)&peer, 0, sizeof (struct sockaddr_in));
- if ((s = accept(ls,(struct sockaddr *)&peer, (void *) &addrlen)) == -1)
+ if ((s = accept (ls, (struct sockaddr *)&peer, (void *) &addrlen)) == -1)
glibtop_error_io ("accept");
+
+#ifdef DEBUG
+ fprintf (stderr, "Connection was made from %s.\n", inet_ntoa (peer.sin_addr));
+#endif
/* Check that access is allowed - if not return crud to the client */
- if (!permitted(peer.sin_addr.s_addr, s))
+ if (!permitted (peer.sin_addr.s_addr, s))
{
close(s);
- glibtop_warn ("Refused connection from %s", inet_ntoa (peer.sin_addr));
+ glibtop_warn ("Refused connection from %s.", inet_ntoa (peer.sin_addr));
return;
} /* if */
- echo_request(s);
+#ifdef DEBUG
+ fprintf (stderr, "Accepted connection from %s.\n", inet_ntoa (peer.sin_addr));
+#endif
+
+ handle_socket_connection (s);
+
+ close (s);
+
+#ifdef DEBUG
+ fprintf (stderr, "Closed connection to %s.\n", inet_ntoa (peer.sin_addr));
+#endif
} /* handle_internet_request */
#endif /* INTERNET_DOMAIN_SOCKETS */
@@ -746,7 +777,7 @@ main(argc,argv)
struct msgbuf *msgp; /* message buffer */
#endif /* SYSV_IPC */
- glibtop_init ();
+ glibtop_init_r (&glibtop_global_server, 0, GLIBTOP_OPEN_NO_OVERRIDE);
for(chan=3; chan < _NFILE; close(chan++)) /* close unwanted channels */
;
@@ -774,6 +805,10 @@ main(argc,argv)
FD_SET(uls, &rmask);
if (ils >= 0)
FD_SET(ils, &rmask);
+
+#ifdef DEBUG
+ fprintf (stderr, "Server ready and waiting for connections.\n");
+#endif
if (select(max2(fileno(stdin),max2(uls,ils)) + 1, &rmask,
(fd_set *)NULL, (fd_set *)NULL, (struct timeval *)NULL) < 0)
diff --git a/src/daemon/main.c b/src/daemon/main.c
new file mode 100644
index 00000000..050de8bf
--- /dev/null
+++ b/src/daemon/main.c
@@ -0,0 +1,259 @@
+/* $Id$ */
+
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the Gnome Top Library.
+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
+
+ The Gnome Top Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Top Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see 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/gnuserv.h>
+
+#include <glibtop/command.h>
+#include <glibtop/version.h>
+#include <glibtop/xmalloc.h>
+#include <glibtop/union.h>
+#include <glibtop/open.h>
+
+#include <fcntl.h>
+#include <locale.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
+
+static void
+do_output (int s, size_t size, const void *buf)
+{
+#ifdef REAL_DEBUG
+ fprintf (stderr, "Writing %d bytes = %d.\n", sizeof (size_t), size);
+#endif
+
+ if (send (s, &size, sizeof (size_t), 0) < 0)
+ glibtop_warn_io ("send");
+
+ if (!size)
+ return;
+
+#ifdef REAL_DEBUG
+ fprintf (stderr, "Really writing %d bytes.\n", size);
+#endif
+
+ if (send (s, buf, size, 0) < 0)
+ glibtop_warn_io ("send");
+}
+
+void
+handle_socket_connection (int s)
+{
+ pid_t pid;
+ int nread;
+ size_t size, dsize;
+ char parameter [BUFSIZ];
+ struct timeval tv;
+ glibtop_union data;
+ glibtop_command cmnd;
+ glibtop_sysdeps sysdeps;
+ glibtop server;
+ void *ptr;
+
+ tv.tv_sec = 5;
+ tv.tv_usec = 0;
+
+ while(1) {
+ nread = recv (s, &size, sizeof (size_t), 0);
+
+ if (nread < 0) {
+ glibtop_warn_io ("recv");
+ return;
+ }
+
+ if (nread == 0)
+ return;
+
+ if (nread != sizeof (size_t)) {
+ glibtop_warn ("Expected %d bytes but got %d", sizeof (size_t), nread);
+ return;
+ }
+
+ if (size != sizeof (glibtop_command)) {
+ glibtop_warn ("Expected %d bytes but got %d", sizeof (size_t), nread);
+ return;
+ }
+
+ nread = recv (s, &cmnd, size, 0);
+
+ if (nread < 0) {
+ glibtop_warn_io ("recv");
+ return;
+ }
+
+ if (nread == 0)
+ return;
+
+#ifdef REAL_DEBUG
+ fprintf (stderr, "Received command %d from client.\n", cmnd.command);
+#endif
+
+ nread = recv (s, &dsize, sizeof (size_t), 0);
+
+ /* will return 0 if parent exits. */
+
+ if (nread < 0) {
+ glibtop_warn_io ("recv");
+ return;
+ }
+
+ if (nread == 0)
+ return;
+
+ if (dsize >= BUFSIZ) {
+ glibtop_warn ("Client sent %d bytes, but buffer is %d", dsize, BUFSIZ);
+ return;
+ }
+
+ memset (parameter, 0, sizeof (parameter));
+
+ if (dsize) {
+#ifdef REAL_DEBUG
+ fprintf (stderr, "Client has %d bytes of data.\n", dsize);
+#endif
+
+ nread = recv (s, parameter, dsize, 0);
+
+ /* will return 0 if parent exits. */
+
+ if (nread < 0) {
+ glibtop_warn_io ("recv");
+ return;
+ }
+
+ if (nread == 0)
+ return;
+
+ if (nread != (int) dsize) {
+ glibtop_warn ("Expected %d bytes but got %d", dsize, nread);
+ return;
+ }
+ }
+
+ switch (cmnd.command) {
+ case GLIBTOP_CMND_SYSDEPS:
+ sysdeps.features = GLIBTOP_SYSDEPS_ALL;
+ do_output (s, sizeof (glibtop_sysdeps), &sysdeps);
+ do_output (s, 0, NULL);
+ break;
+ case GLIBTOP_CMND_CPU:
+ glibtop_get_cpu_l (&server, &data.cpu);
+ do_output (s, sizeof (glibtop_cpu), &data.cpu);
+ do_output (s, 0, NULL);
+ break;
+ case GLIBTOP_CMND_MEM:
+ glibtop_get_mem_l (&server, &data.mem);
+ do_output (s, sizeof (glibtop_mem), &data.mem);
+ do_output (s, 0, NULL);
+ break;
+ case GLIBTOP_CMND_SWAP:
+ glibtop_get_swap_l (&server, &data.swap);
+ do_output (s, sizeof (glibtop_swap), &data.swap);
+ do_output (s, 0, NULL);
+ break;
+ case GLIBTOP_CMND_UPTIME:
+ glibtop_get_uptime_l (&server, &data.uptime);
+ do_output (s, sizeof (glibtop_uptime), &data.uptime);
+ do_output (s, 0, NULL);
+ break;
+ case GLIBTOP_CMND_LOADAVG:
+ glibtop_get_loadavg_l (&server, &data.loadavg);
+ do_output (s, sizeof (glibtop_loadavg), &data.loadavg);
+ do_output (s, 0, NULL);
+ break;
+ case GLIBTOP_CMND_SHM_LIMITS:
+ glibtop_get_shm_limits_l (&server, &data.shm_limits);
+ do_output (s, sizeof (glibtop_shm_limits), &data.shm_limits);
+ do_output (s, 0, NULL);
+ break;
+ case GLIBTOP_CMND_MSG_LIMITS:
+ glibtop_get_msg_limits_l (&server, &data.msg_limits);
+ do_output (s, sizeof (glibtop_msg_limits), &data.msg_limits);
+ do_output (s, 0, NULL);
+ break;
+ case GLIBTOP_CMND_SEM_LIMITS:
+ glibtop_get_sem_limits_l (&server, &data.sem_limits);
+ do_output (s, sizeof (glibtop_sem_limits), &data.sem_limits);
+ do_output (s, 0, NULL);
+ break;
+ case GLIBTOP_CMND_PROCLIST:
+ ptr = glibtop_get_proclist_l (&server, &data.proclist);
+ do_output (s, sizeof (glibtop_proclist), &data.proclist);
+ do_output (s, 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_l
+ (&server, &data.proc_state, pid);
+ do_output (s, sizeof (glibtop_proc_state), &data.proc_state);
+ do_output (s, 0, NULL);
+ break;
+ case GLIBTOP_CMND_PROC_UID:
+ memcpy (&pid, parameter, sizeof (pid_t));
+ glibtop_get_proc_uid_l
+ (&server, &data.proc_uid, pid);
+ do_output (s, sizeof (glibtop_proc_uid), &data.proc_uid);
+ do_output (s, 0, NULL);
+ break;
+ case GLIBTOP_CMND_PROC_MEM:
+ memcpy (&pid, parameter, sizeof (pid_t));
+ glibtop_get_proc_mem_l
+ (&server, &data.proc_mem, pid);
+ do_output (s, sizeof (glibtop_proc_mem), &data.proc_mem);
+ do_output (s, 0, NULL);
+ break;
+ case GLIBTOP_CMND_PROC_TIME:
+ memcpy (&pid, parameter, sizeof (pid_t));
+ glibtop_get_proc_time_l
+ (&server, &data.proc_time, pid);
+ do_output (s, sizeof (glibtop_proc_time), &data.proc_time);
+ do_output (s, 0, NULL);
+ break;
+ case GLIBTOP_CMND_PROC_SIGNAL:
+ memcpy (&pid, parameter, sizeof (pid_t));
+ glibtop_get_proc_signal_l
+ (&server, &data.proc_signal, pid);
+ do_output (s, sizeof (glibtop_proc_signal), &data.proc_signal);
+ do_output (s, 0, NULL);
+ break;
+ case GLIBTOP_CMND_PROC_KERNEL:
+ memcpy (&pid, parameter, sizeof (pid_t));
+ glibtop_get_proc_kernel_l
+ (&server, &data.proc_kernel, pid);
+ do_output (s, sizeof (glibtop_proc_kernel), &data.proc_kernel);
+ do_output (s, 0, NULL);
+ break;
+ case GLIBTOP_CMND_PROC_SEGMENT:
+ memcpy (&pid, parameter, sizeof (pid_t));
+ glibtop_get_proc_segment_l
+ (&server, &data.proc_segment, pid);
+ do_output (s, sizeof (glibtop_proc_segment), &data.proc_segment);
+ do_output (s, 0, NULL);
+ break;
+ }
+ }
+}
diff --git a/src/proxy/Makefile.am b/src/proxy/Makefile.am
index 66badb1a..c2733c05 100644
--- a/src/proxy/Makefile.am
+++ b/src/proxy/Makefile.am
@@ -12,5 +12,5 @@ gtop_proxy_SOURCES = main.c output.c version.c
gtop_proxy_LDADD = $(top_builddir)/lib/libgtop.la \
$(top_builddir)/sysdeps/common/libgtop_common.la \
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
- @INTLLIBS@ @LIBSUPPORT@
+ @INTLLIBS@ @LIBSUPPORT@ @libs_xauth@
gtop_proxy_LDFLAGS = -static