diff options
author | Martin Baulig <martin@src.gnome.org> | 1998-10-26 10:39:14 +0000 |
---|---|---|
committer | Martin Baulig <martin@src.gnome.org> | 1998-10-26 10:39:14 +0000 |
commit | 1289b92d063f31d7ec3675f0956d86dfcdc63b23 (patch) | |
tree | f3cd9f31c9bbf351c0d3d4cbd5cd935a349b9ca3 | |
parent | bdc4e08454cb6d175f4e6e36e5a63aa46dae09b5 (diff) | |
download | libgtop-1289b92d063f31d7ec3675f0956d86dfcdc63b23.tar.gz |
Added new features to get network load:
typedef struct _glibtop_netload glibtop_netload;
struct _glibtop_netload
{
u_int64_t flags,
mtu, /* GLIBTOP_NETLOAD_MTU */
address, /* GLIBTOP_NETLOAD_ADDRESS */
packets_in, /* GLIBTOP_NETLOAD_PACKETS_IN */
packets_out, /* GLIBTOP_NETLOAD_PACKETS_OUT */
bytes_in, /* GLIBTOP_NETLOAD_BYTES_IN */
bytes_out, /* GLIBTOP_NETLOAD_BYTES_OUT */
errors_in, /* GLIBTOP_NETLOAD_ERRORS_IN */
errors_out, /* GLIBTOP_NETLOAD_ERRORS_OUT */
collisions; /* GLIBTOP_NETLOAD_COLLISIONS */
};
Returns network load of the given interface, it is specified as string
like `isppp' or `ippp0':
extern void glibtop_get_netload_l __P((glibtop *, glibtop_netload *, const char *));
37 files changed, 550 insertions, 15 deletions
@@ -1,5 +1,12 @@ 1998-10-26 Martin Baulig <martin@home-of-linux.org> + Added `Network Load' feature (netload). + + * include/glibtop/netload.h: New file. + * features.def: Added new feature `netload'. + +1998-10-26 Martin Baulig <martin@home-of-linux.org> + Added `Command Line Parameters' feature (proc_args). * include/glibtop/proc_args.h: New file. diff --git a/configure.in b/configure.in index 668d9434..31b3154d 100644 --- a/configure.in +++ b/configure.in @@ -124,7 +124,7 @@ else fi if test "x$enable_static" != xno; then - static_targets="first_static second_static mountlist_static procmap_static $guile_static_example $smp_static_examples" + static_targets="first_static second_static mountlist_static procmap_static netload_static $guile_static_example $smp_static_examples" else static_targets="" fi diff --git a/examples/ChangeLog b/examples/ChangeLog index 0931a08b..ade9ce5a 100644 --- a/examples/ChangeLog +++ b/examples/ChangeLog @@ -1,5 +1,10 @@ 1998-10-26 Martin Baulig <martin@home-of-linux.org> + * netload.c: New file. Gets network load for the interface + given as command line argument. + +1998-10-26 Martin Baulig <martin@home-of-linux.org> + * first.c (glibtop_get_proc_args): Get command line arguments. * second.c: Likewise. diff --git a/examples/Makefile.am b/examples/Makefile.am index f10485c0..f1ada8ec 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -12,13 +12,14 @@ DEFS = @DEFS@ libgtopdir = $(libexecdir)/libgtop libgtop_PROGRAMS = first second\ - mountlist procmap \ + mountlist procmap netload \ @static_targets@ \ @guile_examples@ @smp_examples@ EXTRA_PROGRAMS = first_static second_static \ mountlist_static procmap_static \ - third third_static smp smp_static + third third_static smp smp_static \ + netload_static first_SOURCES = first.c first_LDADD = $(top_builddir)/lib/libgtop.la \ @@ -46,10 +47,22 @@ procmap_LDADD = $(top_builddir)/lib/libgtop.la \ $(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \ @INTLLIBS@ @LIBSUPPORT@ + + procmap_static_SOURCES = $(procmap_SOURCES) procmap_static_LDADD = $(procmap_LDADD) procmap_static_LDFLAGS = -static +netload_SOURCES = netload.c +netload_LDADD = $(top_builddir)/lib/libgtop.la \ + $(top_builddir)/sysdeps/common/libgtop_common.la \ + $(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \ + @INTLLIBS@ @LIBSUPPORT@ + +netload_static_SOURCES = $(netload_SOURCES) +netload_static_LDADD = $(netload_LDADD) +netload_static_LDFLAGS = -static + third_guile_names_LIBS = $(top_builddir)/sysdeps/guile/names/libgtop_guile_names.la diff --git a/examples/netload.c b/examples/netload.c new file mode 100644 index 00000000..641c3012 --- /dev/null +++ b/examples/netload.c @@ -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. */ + +#include <locale.h> + +#include <glibtop.h> +#include <glibtop/open.h> +#include <glibtop/close.h> +#include <glibtop/xmalloc.h> + +#include <glibtop/parameter.h> + +#include <glibtop/netload.h> + +#ifndef PROFILE_COUNT +#define PROFILE_COUNT 1 +#endif + +int +main (int argc, char *argv []) +{ + glibtop_netload netload; + unsigned method, count, port, i; + char buffer [BUFSIZ]; + + count = PROFILE_COUNT; + + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, GTOPLOCALEDIR); + textdomain (PACKAGE); + + glibtop_init_r (&glibtop_global_server, 0, GLIBTOP_INIT_NO_OPEN); + + glibtop_get_parameter (GLIBTOP_PARAM_METHOD, &method, sizeof (method)); + + printf ("Method = %d\n", method); + + count = glibtop_get_parameter (GLIBTOP_PARAM_COMMAND, buffer, BUFSIZ); + buffer [count] = 0; + + printf ("Command = '%s'\n", buffer); + + count = glibtop_get_parameter (GLIBTOP_PARAM_HOST, buffer, BUFSIZ); + buffer [count] = 0; + + glibtop_get_parameter (GLIBTOP_PARAM_PORT, &port, sizeof (port)); + + printf ("Host = '%s' - %u\n\n", buffer, port); + + glibtop_init_r (&glibtop_global_server, 0, 0); + + if (argc != 2) + glibtop_error ("Usage: %s interface", argv [0]); + + glibtop_get_netload (&netload, argv [1]); + + printf ("Network Load (0x%08lx): " + "%lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu\n", + (unsigned long) netload.flags, + (unsigned long) netload.mtu, + (unsigned long) netload.packets_in, + (unsigned long) netload.packets_out, + (unsigned long) netload.bytes_in, + (unsigned long) netload.bytes_out, + (unsigned long) netload.errors_in, + (unsigned long) netload.errors_out, + (unsigned long) netload.collisions); + + glibtop_close (); + + exit (0); +} diff --git a/features.def b/features.def index 6480dac8..188a4370 100644 --- a/features.def +++ b/features.def @@ -18,4 +18,5 @@ const char *|proc_args|ulong(size)|pid_t(pid):unsigned(max_len) glibtop_map_entry *|proc_map|ulong(number,size,total)|pid_t(pid) glibtop_mountentry *|@mountlist|ulong(number,size,total)|int(all_fs) void|@fsusage|ulong(blocks,bfree,bavail,files,ffree)|string|mount_dir +void|netload|ulong(mtu,address,packets_in,packets_out,bytes_in,bytes_out,errors_in,errors_out,collisions)|string|interface void|ppp|ulong(state,bytes_in,bytes_out)|ushort(device) diff --git a/include/glibtop/Makefile.am b/include/glibtop/Makefile.am index 35ef25dd..1b89e905 100644 --- a/include/glibtop/Makefile.am +++ b/include/glibtop/Makefile.am @@ -7,4 +7,4 @@ glibtop_HEADERS = close.h loadavg.h prockernel.h procstate.h \ procsegment.h read.h sysdeps.h xmalloc.h global.h \ procsignal.h read_data.h union.h types.h gnuserv.h \ parameter.h mountlist.h fsusage.h procmap.h signal.h \ - inodedb.h sysinfo.h ppp.h procargs.h + inodedb.h sysinfo.h ppp.h procargs.h netload.h diff --git a/include/glibtop/command.h b/include/glibtop/command.h index 9064e3df..a087e6f8 100644 --- a/include/glibtop/command.h +++ b/include/glibtop/command.h @@ -53,9 +53,10 @@ __BEGIN_DECLS #define GLIBTOP_CMND_MOUNTLIST 20 #define GLIBTOP_CMND_FSUSAGE 21 -#define GLIBTOP_CMND_PPP 22 +#define GLIBTOP_CMND_NETLOAD 22 +#define GLIBTOP_CMND_PPP 23 -#define GLIBTOP_MAX_CMND 23 +#define GLIBTOP_MAX_CMND 24 #define _GLIBTOP_PARAM_SIZE 16 diff --git a/include/glibtop/netload.h b/include/glibtop/netload.h new file mode 100644 index 00000000..2f4de21f --- /dev/null +++ b/include/glibtop/netload.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_NETLOAD_H__ +#define __GLIBTOP_NETLOAD_H__ + +#include <glibtop.h> +#include <glibtop/global.h> + +__BEGIN_DECLS + +#define GLIBTOP_NETLOAD_MTU 0 +#define GLIBTOP_NETLOAD_PACKETS_IN 1 +#define GLIBTOP_NETLOAD_PACKETS_OUT 2 +#define GLIBTOP_NETLOAD_BYTES_IN 3 +#define GLIBTOP_NETLOAD_BYTES_OUT 4 +#define GLIBTOP_NETLOAD_ERRORS_IN 5 +#define GLIBTOP_NETLOAD_ERRORS_OUT 6 +#define GLIBTOP_NETLOAD_COLLISIONS 7 + +#define GLIBTOP_MAX_NETLOAD 8 + +typedef struct _glibtop_netload glibtop_netload; + +struct _glibtop_netload +{ + u_int64_t flags, + mtu, /* GLIBTOP_NETLOAD_MTU */ + address, /* GLIBTOP_NETLOAD_ADDRESS */ + packets_in, /* GLIBTOP_NETLOAD_PACKETS_IN */ + packets_out, /* GLIBTOP_NETLOAD_PACKETS_OUT */ + bytes_in, /* GLIBTOP_NETLOAD_BYTES_IN */ + bytes_out, /* GLIBTOP_NETLOAD_BYTES_OUT */ + errors_in, /* GLIBTOP_NETLOAD_ERRORS_IN */ + errors_out, /* GLIBTOP_NETLOAD_ERRORS_OUT */ + collisions; /* GLIBTOP_NETLOAD_COLLISIONS */ +}; + +#define glibtop_get_netload(netload,interface) glibtop_get_netload_l(glibtop_global_server, netload, interface) + +#if GLIBTOP_SUID_NETLOAD +#define glibtop_get_netload_r glibtop_get_netload_p +#else +#define glibtop_get_netload_r glibtop_get_netload_s +#endif + +extern void glibtop_get_netload_l __P((glibtop *, glibtop_netload *, const char *)); + +#if GLIBTOP_SUID_NETLOAD +extern void glibtop_init_netload_p __P((glibtop *)); +extern void glibtop_get_netload_p __P((glibtop *, glibtop_netload *, const char *)); +#else +extern void glibtop_init_netload_s __P((glibtop *)); +extern void glibtop_get_netload_s __P((glibtop *, glibtop_netload *, const char *)); +#endif + +#ifdef GLIBTOP_NAMES + +/* You need to link with -lgtop_names to get this stuff here. */ + +extern const char *glibtop_names_netload []; +extern const unsigned glibtop_types_netload []; +extern const char *glibtop_labels_netload []; +extern const char *glibtop_descriptions_netload []; + +#endif + +__END_DECLS + +#endif diff --git a/include/glibtop/sysdeps.h b/include/glibtop/sysdeps.h index 9ec277b9..c0461b7c 100644 --- a/include/glibtop/sysdeps.h +++ b/include/glibtop/sysdeps.h @@ -47,9 +47,10 @@ __BEGIN_DECLS #define GLIBTOP_SYSDEPS_PROC_MAP 18 #define GLIBTOP_SYSDEPS_MOUNTLIST 19 #define GLIBTOP_SYSDEPS_FSUSAGE 20 -#define GLIBTOP_SYSDEPS_PPP 21 +#define GLIBTOP_SYSDEPS_NETLOAD 21 +#define GLIBTOP_SYSDEPS_PPP 22 -#define GLIBTOP_MAX_SYSDEPS 22 +#define GLIBTOP_MAX_SYSDEPS 23 #define GLIBTOP_SYSDEPS_ALL ((1 << GLIBTOP_MAX_SYSDEPS) - 1) @@ -83,6 +84,7 @@ struct _glibtop_sysdeps proc_map, /* glibtop_proc_map */ mountlist, /* glibtop_mountlist */ fsusage, /* glibtop_fsusage */ + netload, /* glibtop_netload */ ppp; /* glibtop_ppp */ }; diff --git a/include/glibtop/union.h b/include/glibtop/union.h index 68e30e2e..28f4bd41 100644 --- a/include/glibtop/union.h +++ b/include/glibtop/union.h @@ -45,6 +45,7 @@ #include <glibtop/mountlist.h> #include <glibtop/fsusage.h> +#include <glibtop/netload.h> #include <glibtop/ppp.h> __BEGIN_DECLS @@ -73,6 +74,7 @@ union _glibtop_union glibtop_proc_map proc_map; glibtop_mountlist mountlist; glibtop_fsusage fsusage; + glibtop_netload netload; glibtop_ppp ppp; }; diff --git a/lib/sysdeps.c b/lib/sysdeps.c index da147d6a..36d484aa 100644 --- a/lib/sysdeps.c +++ b/lib/sysdeps.c @@ -39,6 +39,7 @@ GLIBTOP_SUID_PROC_SIGNAL + GLIBTOP_SUID_PROC_KERNEL + GLIBTOP_SUID_PROC_SEGMENT + GLIBTOP_SUID_PROC_MAP + +GLIBTOP_SUID_NETLOAD + GLIBTOP_SUID_PPP; glibtop_init_func_t _glibtop_init_hook_s [] = { @@ -96,6 +97,9 @@ glibtop_init_func_t _glibtop_init_hook_s [] = { #if !GLIBTOP_SUID_PROC_MAP glibtop_init_proc_map_s, #endif +#if !GLIBTOP_SUID_NETLOAD + glibtop_init_netload_s, +#endif #if !GLIBTOP_SUID_PPP glibtop_init_ppp_s, #endif diff --git a/src/daemon/server.c b/src/daemon/server.c index aac4cf74..ca2f9a26 100644 --- a/src/daemon/server.c +++ b/src/daemon/server.c @@ -47,6 +47,7 @@ GLIBTOP_SUID_PROC_KERNEL + GLIBTOP_SUID_PROC_SEGMENT + GLIBTOP_SUID_PROC_ARGS + GLIBTOP_SUID_PROC_MAP + +GLIBTOP_SUID_NETLOAD + GLIBTOP_SUID_PPP; #include <fcntl.h> diff --git a/src/daemon/slave.c b/src/daemon/slave.c index bf83c30f..88872544 100644 --- a/src/daemon/slave.c +++ b/src/daemon/slave.c @@ -26,7 +26,7 @@ handle_slave_connection (int input, int output) { glibtop *server = glibtop_global_server; int64_t *param_ptr; - void *ptr; + const void *ptr; unsigned short max_len; pid_t pid; @@ -230,6 +230,12 @@ handle_slave_command (glibtop_command *cmnd, glibtop_response *resp, resp->offset = _offset_data (proc_segment); break; #endif +#if GLIBTOP_SUID_NETLOAD + case GLIBTOP_CMND_NETLOAD: + glibtop_get_netload_p (server, &resp->u.data.netload, parameter); + resp->offset = _offset_data (netload); + break; +#endif #if GLIBTOP_SUID_PPP case GLIBTOP_CMND_PPP: memcpy (&device, parameter, sizeof (unsigned short)); diff --git a/sysdeps/common/sysdeps_suid.c b/sysdeps/common/sysdeps_suid.c index dea87167..f729140b 100644 --- a/sysdeps/common/sysdeps_suid.c +++ b/sysdeps/common/sysdeps_suid.c @@ -77,6 +77,9 @@ glibtop_init_func_t _glibtop_init_hook_p [] = { #if GLIBTOP_SUID_PROC_MAP glibtop_init_proc_map_p, #endif +#if GLIBTOP_SUID_NETLOAD + glibtop_init_netload_p, +#endif #if GLIBTOP_SUID_PPP glibtop_init_ppp_p, #endif diff --git a/sysdeps/freebsd/ChangeLog b/sysdeps/freebsd/ChangeLog index 17bb517a..fe9fc503 100644 --- a/sysdeps/freebsd/ChangeLog +++ b/sysdeps/freebsd/ChangeLog @@ -1,5 +1,9 @@ 1998-10-26 Martin Baulig <martin@home-of-linux.org> + * netload.c: New file. Currently empty. + +1998-10-26 Martin Baulig <martin@home-of-linux.org> + * procargs.c: New file to get command line arguments. 1998-10-25 Martin Baulig <martin@home-of-linux.org> diff --git a/sysdeps/freebsd/Makefile.am b/sysdeps/freebsd/Makefile.am index 0e84b8ff..d4097701 100644 --- a/sysdeps/freebsd/Makefile.am +++ b/sysdeps/freebsd/Makefile.am @@ -10,7 +10,8 @@ libgtop_sysdeps_suid_la_SOURCES = open.c close.c siglist.c cpu.c mem.c swap.c \ uptime.c loadavg.c shm_limits.c msg_limits.c \ sem_limits.c proclist.c procstate.c procuid.c \ proctime.c procmem.c procsignal.c prockernel.c \ - procsegment.c procargs.c procmap.c ppp.c + procsegment.c procargs.c procmap.c netload.c \ + ppp.c libgtop_sysdeps_suid_la_LDFLAGS = $(LT_VERSION_INFO) diff --git a/sysdeps/freebsd/glibtop_server.h b/sysdeps/freebsd/glibtop_server.h index a87a1ffb..ab051092 100644 --- a/sysdeps/freebsd/glibtop_server.h +++ b/sysdeps/freebsd/glibtop_server.h @@ -42,6 +42,7 @@ __BEGIN_DECLS #define GLIBTOP_SUID_PROC_SEGMENT (1 << GLIBTOP_SYSDEPS_PROC_SEGMENT) #define GLIBTOP_SUID_PROC_ARGS (1 << GLIBTOP_SYSDEPS_PROC_ARGS) #define GLIBTOP_SUID_PROC_MAP (1 << GLIBTOP_SYSDEPS_PROC_MAP) +#define GLIBTOP_SUID_NETLOAD (1 << GLIBTOP_SYSDEPS_NETLOAD) #define GLIBTOP_SUID_PPP (1 << GLIBTOP_SYSDEPS_PPP) __END_DECLS diff --git a/sysdeps/freebsd/netload.c b/sysdeps/freebsd/netload.c new file mode 100644 index 00000000..e8ecaa3c --- /dev/null +++ b/sysdeps/freebsd/netload.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>, October 1998. + + The Gnome Top Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Gnome Top Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see 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/netload.h> + +static const unsigned long _glibtop_sysdeps_netload = 0; + +/* Init function. */ + +void +glibtop_init_netload_p (glibtop *server) +{ + server->sysdeps.netload = _glibtop_sysdeps_netload; +} + +/* Provides Network statistics. */ + +void +glibtop_get_netload_p (glibtop *server, glibtop_netload *buf, + const char *interface) +{ + memset (buf, 0, sizeof (glibtop_netload)); +} diff --git a/sysdeps/kernel/ChangeLog b/sysdeps/kernel/ChangeLog index 12c7afd7..bfca82c0 100644 --- a/sysdeps/kernel/ChangeLog +++ b/sysdeps/kernel/ChangeLog @@ -1,5 +1,9 @@ 1998-10-26 Martin Baulig <martin@home-of-linux.org> + * netload.c: New file. Currently empty. + +1998-10-26 Martin Baulig <martin@home-of-linux.org> + * procargs.c: New file. Currently empty. 1998-10-25 Martin Baulig <martin@home-of-linux.org> diff --git a/sysdeps/kernel/Makefile.am b/sysdeps/kernel/Makefile.am index 2c17a4c1..e3cb860f 100644 --- a/sysdeps/kernel/Makefile.am +++ b/sysdeps/kernel/Makefile.am @@ -9,7 +9,7 @@ libgtop_sysdeps_la_SOURCES = open.c close.c kernel.s cpu.c mem.c swap.c \ sem_limits.c proclist.c procstate.c procuid.c \ proctime.c procmem.c procsignal.c prockernel.c \ procsegment.c siglist.c procargs.c procmap.c \ - ppp.c + netload.c ppp.c libgtop_sysdeps_la_LDFLAGS = $(LT_VERSION_INFO) diff --git a/sysdeps/kernel/glibtop_server.h b/sysdeps/kernel/glibtop_server.h index 23664c12..48485001 100644 --- a/sysdeps/kernel/glibtop_server.h +++ b/sysdeps/kernel/glibtop_server.h @@ -40,7 +40,10 @@ __BEGIN_DECLS #define GLIBTOP_SUID_PROC_SIGNAL 0 #define GLIBTOP_SUID_PROC_KERNEL 0 #define GLIBTOP_SUID_PROC_SEGMENT 0 +#define GLIBTOP_SUID_PROC_ARGS 0 #define GLIBTOP_SUID_PROC_MAP 0 +#define GLIBTOP_SUID_NETLOAD 0 +#define GLIBTOP_SUID_PPP 0 __END_DECLS diff --git a/sysdeps/kernel/netload.c b/sysdeps/kernel/netload.c new file mode 100644 index 00000000..cbaac4f5 --- /dev/null +++ b/sysdeps/kernel/netload.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>, October 1998. + + The Gnome Top Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Gnome Top Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see 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/netload.h> + +static const unsigned long _glibtop_sysdeps_netload = 0; + +/* Init function. */ + +void +glibtop_init_netload_s (glibtop *server) +{ + server->sysdeps.netload = _glibtop_sysdeps_netload; +} + +/* Provides network statistics. */ + +void +glibtop_get_netload_s (glibtop *server, glibtop_netload *buf, + const char *interface) +{ + memset (buf, 0, sizeof (glibtop_netload)); +} diff --git a/sysdeps/linux/ChangeLog b/sysdeps/linux/ChangeLog index 86efa045..b5965e85 100644 --- a/sysdeps/linux/ChangeLog +++ b/sysdeps/linux/ChangeLog @@ -1,5 +1,9 @@ 1998-10-26 Martin Baulig <martin@home-of-linux.org> + * netload.c: New file. Currently empty. + +1998-10-26 Martin Baulig <martin@home-of-linux.org> + * procargs.c: New file. Currently empty. 1998-10-25 Martin Baulig <martin@home-of-linux.org> diff --git a/sysdeps/linux/Makefile.am b/sysdeps/linux/Makefile.am index fa236d69..04b2c36d 100644 --- a/sysdeps/linux/Makefile.am +++ b/sysdeps/linux/Makefile.am @@ -9,7 +9,7 @@ libgtop_sysdeps_la_SOURCES = open.c close.c cpu.c mem.c swap.c \ sem_limits.c proclist.c procstate.c procuid.c \ proctime.c procmem.c procsignal.c prockernel.c \ procsegment.c procargs.c procmap.c siglist.c \ - sysinfo.c ppp.c + sysinfo.c netload.c ppp.c libgtop_sysdeps_la_LIBADD = @GLIB_LIBS@ libgtop_sysdeps_la_LDFLAGS = $(LT_VERSION_INFO) diff --git a/sysdeps/linux/glibtop_server.h b/sysdeps/linux/glibtop_server.h index 67bd9d38..ed03578e 100644 --- a/sysdeps/linux/glibtop_server.h +++ b/sysdeps/linux/glibtop_server.h @@ -122,7 +122,10 @@ proc_stat_after_cmd (char *p) #define GLIBTOP_SUID_PROC_SIGNAL 0 #define GLIBTOP_SUID_PROC_KERNEL 0 #define GLIBTOP_SUID_PROC_SEGMENT 0 +#define GLIBTOP_SUID_PROC_ARGS 0 #define GLIBTOP_SUID_PROC_MAP 0 +#define GLIBTOP_SUID_NETLOAD 0 +#define GLIBTOP_SUID_PPP 0 __END_DECLS diff --git a/sysdeps/linux/netload.c b/sysdeps/linux/netload.c new file mode 100644 index 00000000..cbaac4f5 --- /dev/null +++ b/sysdeps/linux/netload.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>, October 1998. + + The Gnome Top Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Gnome Top Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see 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/netload.h> + +static const unsigned long _glibtop_sysdeps_netload = 0; + +/* Init function. */ + +void +glibtop_init_netload_s (glibtop *server) +{ + server->sysdeps.netload = _glibtop_sysdeps_netload; +} + +/* Provides network statistics. */ + +void +glibtop_get_netload_s (glibtop *server, glibtop_netload *buf, + const char *interface) +{ + memset (buf, 0, sizeof (glibtop_netload)); +} diff --git a/sysdeps/names/Makefile.am b/sysdeps/names/Makefile.am index 93969ff4..2039573d 100644 --- a/sysdeps/names/Makefile.am +++ b/sysdeps/names/Makefile.am @@ -9,7 +9,8 @@ libgtop_names_la_SOURCES = cpu.c mem.c swap.c uptime.c loadavg.c \ proclist.c sysdeps.c procstate.c procuid.c \ proctime.c procmem.c procsignal.c \ prockernel.c procsegment.c fsusage.c \ - mountlist.c procargs.c procmap.c ppp.c + mountlist.c procargs.c procmap.c netload.c \ + ppp.c libgtop_names_la_LDFLAGS = $(LT_VERSION_INFO) diff --git a/sysdeps/names/netload.c b/sysdeps/names/netload.c new file mode 100644 index 00000000..4dc75dd4 --- /dev/null +++ b/sysdeps/names/netload.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/netload.h> + +const char *glibtop_names_netload [GLIBTOP_MAX_NETLOAD] = +{ + "mtu", "packets_in", "packets_out", "bytes_in", "bytes_out", + "errors_in", "errors_out", "collisions" +}; + +const unsigned glibtop_types_netload [GLIBTOP_MAX_NETLOAD] = +{ + GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, + GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, + GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG +}; + +const char *glibtop_labels_netload [GLIBTOP_MAX_NETLOAD] = +{ + N_("MTU"), + N_("Packets In"), + N_("Packets Out"), + N_("Bytes In"), + N_("Bytes Out"), + N_("Errors In"), + N_("Errors Out"), + N_("Collisions") +}; + +const char *glibtop_descriptions_netload [GLIBTOP_MAX_NETLOAD] = +{ + N_("Maximum Transfer Unit"), + N_("Packets In"), + N_("Packets Out"), + N_("Bytes In"), + N_("Bytes Out"), + N_("Errors In"), + N_("Errors Out"), + N_("Collisions") +}; diff --git a/sysdeps/stub/ChangeLog b/sysdeps/stub/ChangeLog index b2166344..16470426 100644 --- a/sysdeps/stub/ChangeLog +++ b/sysdeps/stub/ChangeLog @@ -1,5 +1,9 @@ 1998-10-26 Martin Baulig <martin@home-of-linux.org> + * netload.c: New file. + +1998-10-26 Martin Baulig <martin@home-of-linux.org> + * procargs.c: New file. 1998-10-25 Martin Baulig <martin@home-of-linux.org> diff --git a/sysdeps/stub/Makefile.am b/sysdeps/stub/Makefile.am index 549444f0..2f82cd78 100644 --- a/sysdeps/stub/Makefile.am +++ b/sysdeps/stub/Makefile.am @@ -8,7 +8,8 @@ libgtop_sysdeps_la_SOURCES = open.c close.c siglist.c cpu.c mem.c swap.c \ uptime.c loadavg.c shm_limits.c msg_limits.c \ sem_limits.c proclist.c procstate.c procuid.c \ proctime.c procmem.c procsignal.c prockernel.c \ - procsegment.c procargs.c procmap.c ppp.c + procsegment.c procargs.c procmap.c netload.c \ + ppp.c libgtop_sysdeps_la_LDFLAGS = $(LT_VERSION_INFO) diff --git a/sysdeps/stub/glibtop_server.h b/sysdeps/stub/glibtop_server.h index 23664c12..48485001 100644 --- a/sysdeps/stub/glibtop_server.h +++ b/sysdeps/stub/glibtop_server.h @@ -40,7 +40,10 @@ __BEGIN_DECLS #define GLIBTOP_SUID_PROC_SIGNAL 0 #define GLIBTOP_SUID_PROC_KERNEL 0 #define GLIBTOP_SUID_PROC_SEGMENT 0 +#define GLIBTOP_SUID_PROC_ARGS 0 #define GLIBTOP_SUID_PROC_MAP 0 +#define GLIBTOP_SUID_NETLOAD 0 +#define GLIBTOP_SUID_PPP 0 __END_DECLS diff --git a/sysdeps/stub/netload.c b/sysdeps/stub/netload.c new file mode 100644 index 00000000..cbaac4f5 --- /dev/null +++ b/sysdeps/stub/netload.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>, October 1998. + + The Gnome Top Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Gnome Top Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see 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/netload.h> + +static const unsigned long _glibtop_sysdeps_netload = 0; + +/* Init function. */ + +void +glibtop_init_netload_s (glibtop *server) +{ + server->sysdeps.netload = _glibtop_sysdeps_netload; +} + +/* Provides network statistics. */ + +void +glibtop_get_netload_s (glibtop *server, glibtop_netload *buf, + const char *interface) +{ + memset (buf, 0, sizeof (glibtop_netload)); +} diff --git a/sysdeps/stub_suid/ChangeLog b/sysdeps/stub_suid/ChangeLog index e66eacd2..0017acbd 100644 --- a/sysdeps/stub_suid/ChangeLog +++ b/sysdeps/stub_suid/ChangeLog @@ -1,5 +1,9 @@ 1998-10-26 Martin Baulig <martin@home-of-linux.org> + * netload.c: New file. + +1998-10-26 Martin Baulig <martin@home-of-linux.org> + * procargs.c: New file. * procmap.c: New file. diff --git a/sysdeps/stub_suid/Makefile.am b/sysdeps/stub_suid/Makefile.am index 55ef0c2d..eeb9f146 100644 --- a/sysdeps/stub_suid/Makefile.am +++ b/sysdeps/stub_suid/Makefile.am @@ -12,7 +12,8 @@ libgtop_sysdeps_suid_la_SOURCES = open.c close.c siglist.c cpu.c mem.c swap.c \ uptime.c loadavg.c shm_limits.c msg_limits.c \ sem_limits.c proclist.c procstate.c procuid.c \ proctime.c procmem.c procsignal.c prockernel.c \ - procsegment.c procargs.c procmap.c ppp.c + procsegment.c procargs.c procmap.c netload.c \ + ppp.c libgtop_sysdeps_suid_la_LDFLAGS = $(LT_VERSION_INFO) diff --git a/sysdeps/stub_suid/glibtop_server.h b/sysdeps/stub_suid/glibtop_server.h index 4b37edfc..ab051092 100644 --- a/sysdeps/stub_suid/glibtop_server.h +++ b/sysdeps/stub_suid/glibtop_server.h @@ -40,6 +40,10 @@ __BEGIN_DECLS #define GLIBTOP_SUID_PROC_SIGNAL (1 << GLIBTOP_SYSDEPS_PROC_SIGNAL) #define GLIBTOP_SUID_PROC_KERNEL (1 << GLIBTOP_SYSDEPS_PROC_KERNEL) #define GLIBTOP_SUID_PROC_SEGMENT (1 << GLIBTOP_SYSDEPS_PROC_SEGMENT) +#define GLIBTOP_SUID_PROC_ARGS (1 << GLIBTOP_SYSDEPS_PROC_ARGS) +#define GLIBTOP_SUID_PROC_MAP (1 << GLIBTOP_SYSDEPS_PROC_MAP) +#define GLIBTOP_SUID_NETLOAD (1 << GLIBTOP_SYSDEPS_NETLOAD) +#define GLIBTOP_SUID_PPP (1 << GLIBTOP_SYSDEPS_PPP) __END_DECLS diff --git a/sysdeps/stub_suid/netload.c b/sysdeps/stub_suid/netload.c new file mode 100644 index 00000000..e8ecaa3c --- /dev/null +++ b/sysdeps/stub_suid/netload.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>, October 1998. + + The Gnome Top Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Gnome Top Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see 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/netload.h> + +static const unsigned long _glibtop_sysdeps_netload = 0; + +/* Init function. */ + +void +glibtop_init_netload_p (glibtop *server) +{ + server->sysdeps.netload = _glibtop_sysdeps_netload; +} + +/* Provides Network statistics. */ + +void +glibtop_get_netload_p (glibtop *server, glibtop_netload *buf, + const char *interface) +{ + memset (buf, 0, sizeof (glibtop_netload)); +} |