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 *));
This commit is contained in:
Martin Baulig
1998-10-26 10:39:14 +00:00
parent bdc4e08454
commit 1289b92d06
37 changed files with 550 additions and 15 deletions

View File

@@ -1,3 +1,10 @@
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> 1998-10-26 Martin Baulig <martin@home-of-linux.org>
Added `Command Line Parameters' feature (proc_args). Added `Command Line Parameters' feature (proc_args).

View File

@@ -124,7 +124,7 @@ else
fi fi
if test "x$enable_static" != xno; then 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 else
static_targets="" static_targets=""
fi fi

View File

@@ -1,3 +1,8 @@
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> 1998-10-26 Martin Baulig <martin@home-of-linux.org>
* first.c (glibtop_get_proc_args): Get command line arguments. * first.c (glibtop_get_proc_args): Get command line arguments.

View File

@@ -12,13 +12,14 @@ DEFS = @DEFS@
libgtopdir = $(libexecdir)/libgtop libgtopdir = $(libexecdir)/libgtop
libgtop_PROGRAMS = first second\ libgtop_PROGRAMS = first second\
mountlist procmap \ mountlist procmap netload \
@static_targets@ \ @static_targets@ \
@guile_examples@ @smp_examples@ @guile_examples@ @smp_examples@
EXTRA_PROGRAMS = first_static second_static \ EXTRA_PROGRAMS = first_static second_static \
mountlist_static procmap_static \ mountlist_static procmap_static \
third third_static smp smp_static third third_static smp smp_static \
netload_static
first_SOURCES = first.c first_SOURCES = first.c
first_LDADD = $(top_builddir)/lib/libgtop.la \ 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 \ $(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
@INTLLIBS@ @LIBSUPPORT@ @INTLLIBS@ @LIBSUPPORT@
procmap_static_SOURCES = $(procmap_SOURCES) procmap_static_SOURCES = $(procmap_SOURCES)
procmap_static_LDADD = $(procmap_LDADD) procmap_static_LDADD = $(procmap_LDADD)
procmap_static_LDFLAGS = -static 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 third_guile_names_LIBS = $(top_builddir)/sysdeps/guile/names/libgtop_guile_names.la

90
examples/netload.c Normal file
View File

@@ -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);
}

View File

@@ -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_map_entry *|proc_map|ulong(number,size,total)|pid_t(pid)
glibtop_mountentry *|@mountlist|ulong(number,size,total)|int(all_fs) glibtop_mountentry *|@mountlist|ulong(number,size,total)|int(all_fs)
void|@fsusage|ulong(blocks,bfree,bavail,files,ffree)|string|mount_dir 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) void|ppp|ulong(state,bytes_in,bytes_out)|ushort(device)

View File

@@ -7,4 +7,4 @@ glibtop_HEADERS = close.h loadavg.h prockernel.h procstate.h \
procsegment.h read.h sysdeps.h xmalloc.h global.h \ procsegment.h read.h sysdeps.h xmalloc.h global.h \
procsignal.h read_data.h union.h types.h gnuserv.h \ procsignal.h read_data.h union.h types.h gnuserv.h \
parameter.h mountlist.h fsusage.h procmap.h signal.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

View File

@@ -53,9 +53,10 @@ __BEGIN_DECLS
#define GLIBTOP_CMND_MOUNTLIST 20 #define GLIBTOP_CMND_MOUNTLIST 20
#define GLIBTOP_CMND_FSUSAGE 21 #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 #define _GLIBTOP_PARAM_SIZE 16

88
include/glibtop/netload.h Normal file
View File

@@ -0,0 +1,88 @@
/* $Id$ */
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the Gnome Top Library.
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
The Gnome Top Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The Gnome Top Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#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

View File

@@ -47,9 +47,10 @@ __BEGIN_DECLS
#define GLIBTOP_SYSDEPS_PROC_MAP 18 #define GLIBTOP_SYSDEPS_PROC_MAP 18
#define GLIBTOP_SYSDEPS_MOUNTLIST 19 #define GLIBTOP_SYSDEPS_MOUNTLIST 19
#define GLIBTOP_SYSDEPS_FSUSAGE 20 #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) #define GLIBTOP_SYSDEPS_ALL ((1 << GLIBTOP_MAX_SYSDEPS) - 1)
@@ -83,6 +84,7 @@ struct _glibtop_sysdeps
proc_map, /* glibtop_proc_map */ proc_map, /* glibtop_proc_map */
mountlist, /* glibtop_mountlist */ mountlist, /* glibtop_mountlist */
fsusage, /* glibtop_fsusage */ fsusage, /* glibtop_fsusage */
netload, /* glibtop_netload */
ppp; /* glibtop_ppp */ ppp; /* glibtop_ppp */
}; };

View File

@@ -45,6 +45,7 @@
#include <glibtop/mountlist.h> #include <glibtop/mountlist.h>
#include <glibtop/fsusage.h> #include <glibtop/fsusage.h>
#include <glibtop/netload.h>
#include <glibtop/ppp.h> #include <glibtop/ppp.h>
__BEGIN_DECLS __BEGIN_DECLS
@@ -73,6 +74,7 @@ union _glibtop_union
glibtop_proc_map proc_map; glibtop_proc_map proc_map;
glibtop_mountlist mountlist; glibtop_mountlist mountlist;
glibtop_fsusage fsusage; glibtop_fsusage fsusage;
glibtop_netload netload;
glibtop_ppp ppp; glibtop_ppp ppp;
}; };

View File

@@ -39,6 +39,7 @@ GLIBTOP_SUID_PROC_SIGNAL +
GLIBTOP_SUID_PROC_KERNEL + GLIBTOP_SUID_PROC_KERNEL +
GLIBTOP_SUID_PROC_SEGMENT + GLIBTOP_SUID_PROC_SEGMENT +
GLIBTOP_SUID_PROC_MAP + GLIBTOP_SUID_PROC_MAP +
GLIBTOP_SUID_NETLOAD +
GLIBTOP_SUID_PPP; GLIBTOP_SUID_PPP;
glibtop_init_func_t _glibtop_init_hook_s [] = { 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 #if !GLIBTOP_SUID_PROC_MAP
glibtop_init_proc_map_s, glibtop_init_proc_map_s,
#endif #endif
#if !GLIBTOP_SUID_NETLOAD
glibtop_init_netload_s,
#endif
#if !GLIBTOP_SUID_PPP #if !GLIBTOP_SUID_PPP
glibtop_init_ppp_s, glibtop_init_ppp_s,
#endif #endif

View File

@@ -47,6 +47,7 @@ GLIBTOP_SUID_PROC_KERNEL +
GLIBTOP_SUID_PROC_SEGMENT + GLIBTOP_SUID_PROC_SEGMENT +
GLIBTOP_SUID_PROC_ARGS + GLIBTOP_SUID_PROC_ARGS +
GLIBTOP_SUID_PROC_MAP + GLIBTOP_SUID_PROC_MAP +
GLIBTOP_SUID_NETLOAD +
GLIBTOP_SUID_PPP; GLIBTOP_SUID_PPP;
#include <fcntl.h> #include <fcntl.h>

View File

@@ -26,7 +26,7 @@ handle_slave_connection (int input, int output)
{ {
glibtop *server = glibtop_global_server; glibtop *server = glibtop_global_server;
int64_t *param_ptr; int64_t *param_ptr;
void *ptr; const void *ptr;
unsigned short max_len; unsigned short max_len;
pid_t pid; pid_t pid;
@@ -230,6 +230,12 @@ handle_slave_command (glibtop_command *cmnd, glibtop_response *resp,
resp->offset = _offset_data (proc_segment); resp->offset = _offset_data (proc_segment);
break; break;
#endif #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 #if GLIBTOP_SUID_PPP
case GLIBTOP_CMND_PPP: case GLIBTOP_CMND_PPP:
memcpy (&device, parameter, sizeof (unsigned short)); memcpy (&device, parameter, sizeof (unsigned short));

View File

@@ -77,6 +77,9 @@ glibtop_init_func_t _glibtop_init_hook_p [] = {
#if GLIBTOP_SUID_PROC_MAP #if GLIBTOP_SUID_PROC_MAP
glibtop_init_proc_map_p, glibtop_init_proc_map_p,
#endif #endif
#if GLIBTOP_SUID_NETLOAD
glibtop_init_netload_p,
#endif
#if GLIBTOP_SUID_PPP #if GLIBTOP_SUID_PPP
glibtop_init_ppp_p, glibtop_init_ppp_p,
#endif #endif

View File

@@ -1,3 +1,7 @@
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> 1998-10-26 Martin Baulig <martin@home-of-linux.org>
* procargs.c: New file to get command line arguments. * procargs.c: New file to get command line arguments.

View File

@@ -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 \ uptime.c loadavg.c shm_limits.c msg_limits.c \
sem_limits.c proclist.c procstate.c procuid.c \ sem_limits.c proclist.c procstate.c procuid.c \
proctime.c procmem.c procsignal.c prockernel.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) libgtop_sysdeps_suid_la_LDFLAGS = $(LT_VERSION_INFO)

View File

@@ -42,6 +42,7 @@ __BEGIN_DECLS
#define GLIBTOP_SUID_PROC_SEGMENT (1 << GLIBTOP_SYSDEPS_PROC_SEGMENT) #define GLIBTOP_SUID_PROC_SEGMENT (1 << GLIBTOP_SYSDEPS_PROC_SEGMENT)
#define GLIBTOP_SUID_PROC_ARGS (1 << GLIBTOP_SYSDEPS_PROC_ARGS) #define GLIBTOP_SUID_PROC_ARGS (1 << GLIBTOP_SYSDEPS_PROC_ARGS)
#define GLIBTOP_SUID_PROC_MAP (1 << GLIBTOP_SYSDEPS_PROC_MAP) #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) #define GLIBTOP_SUID_PPP (1 << GLIBTOP_SYSDEPS_PPP)
__END_DECLS __END_DECLS

43
sysdeps/freebsd/netload.c Normal file
View File

@@ -0,0 +1,43 @@
/* $Id$ */
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the Gnome Top Library.
Contributed by Martin Baulig <martin@home-of-linux.org>, 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));
}

View File

@@ -1,3 +1,7 @@
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> 1998-10-26 Martin Baulig <martin@home-of-linux.org>
* procargs.c: New file. Currently empty. * procargs.c: New file. Currently empty.

View File

@@ -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 \ sem_limits.c proclist.c procstate.c procuid.c \
proctime.c procmem.c procsignal.c prockernel.c \ proctime.c procmem.c procsignal.c prockernel.c \
procsegment.c siglist.c procargs.c procmap.c \ procsegment.c siglist.c procargs.c procmap.c \
ppp.c netload.c ppp.c
libgtop_sysdeps_la_LDFLAGS = $(LT_VERSION_INFO) libgtop_sysdeps_la_LDFLAGS = $(LT_VERSION_INFO)

View File

@@ -40,7 +40,10 @@ __BEGIN_DECLS
#define GLIBTOP_SUID_PROC_SIGNAL 0 #define GLIBTOP_SUID_PROC_SIGNAL 0
#define GLIBTOP_SUID_PROC_KERNEL 0 #define GLIBTOP_SUID_PROC_KERNEL 0
#define GLIBTOP_SUID_PROC_SEGMENT 0 #define GLIBTOP_SUID_PROC_SEGMENT 0
#define GLIBTOP_SUID_PROC_ARGS 0
#define GLIBTOP_SUID_PROC_MAP 0 #define GLIBTOP_SUID_PROC_MAP 0
#define GLIBTOP_SUID_NETLOAD 0
#define GLIBTOP_SUID_PPP 0
__END_DECLS __END_DECLS

43
sysdeps/kernel/netload.c Normal file
View File

@@ -0,0 +1,43 @@
/* $Id$ */
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the Gnome Top Library.
Contributed by Martin Baulig <martin@home-of-linux.org>, 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));
}

View File

@@ -1,3 +1,7 @@
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> 1998-10-26 Martin Baulig <martin@home-of-linux.org>
* procargs.c: New file. Currently empty. * procargs.c: New file. Currently empty.

View File

@@ -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 \ sem_limits.c proclist.c procstate.c procuid.c \
proctime.c procmem.c procsignal.c prockernel.c \ proctime.c procmem.c procsignal.c prockernel.c \
procsegment.c procargs.c procmap.c siglist.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_LIBADD = @GLIB_LIBS@
libgtop_sysdeps_la_LDFLAGS = $(LT_VERSION_INFO) libgtop_sysdeps_la_LDFLAGS = $(LT_VERSION_INFO)

View File

@@ -122,7 +122,10 @@ proc_stat_after_cmd (char *p)
#define GLIBTOP_SUID_PROC_SIGNAL 0 #define GLIBTOP_SUID_PROC_SIGNAL 0
#define GLIBTOP_SUID_PROC_KERNEL 0 #define GLIBTOP_SUID_PROC_KERNEL 0
#define GLIBTOP_SUID_PROC_SEGMENT 0 #define GLIBTOP_SUID_PROC_SEGMENT 0
#define GLIBTOP_SUID_PROC_ARGS 0
#define GLIBTOP_SUID_PROC_MAP 0 #define GLIBTOP_SUID_PROC_MAP 0
#define GLIBTOP_SUID_NETLOAD 0
#define GLIBTOP_SUID_PPP 0
__END_DECLS __END_DECLS

43
sysdeps/linux/netload.c Normal file
View File

@@ -0,0 +1,43 @@
/* $Id$ */
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the Gnome Top Library.
Contributed by Martin Baulig <martin@home-of-linux.org>, 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));
}

View File

@@ -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 \ proclist.c sysdeps.c procstate.c procuid.c \
proctime.c procmem.c procsignal.c \ proctime.c procmem.c procsignal.c \
prockernel.c procsegment.c fsusage.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) libgtop_names_la_LDFLAGS = $(LT_VERSION_INFO)

59
sysdeps/names/netload.c Normal file
View File

@@ -0,0 +1,59 @@
/* $Id$ */
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the Gnome Top Library.
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
The Gnome Top Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The Gnome Top Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <glibtop/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")
};

View File

@@ -1,3 +1,7 @@
1998-10-26 Martin Baulig <martin@home-of-linux.org>
* netload.c: New file.
1998-10-26 Martin Baulig <martin@home-of-linux.org> 1998-10-26 Martin Baulig <martin@home-of-linux.org>
* procargs.c: New file. * procargs.c: New file.

View File

@@ -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 \ uptime.c loadavg.c shm_limits.c msg_limits.c \
sem_limits.c proclist.c procstate.c procuid.c \ sem_limits.c proclist.c procstate.c procuid.c \
proctime.c procmem.c procsignal.c prockernel.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) libgtop_sysdeps_la_LDFLAGS = $(LT_VERSION_INFO)

View File

@@ -40,7 +40,10 @@ __BEGIN_DECLS
#define GLIBTOP_SUID_PROC_SIGNAL 0 #define GLIBTOP_SUID_PROC_SIGNAL 0
#define GLIBTOP_SUID_PROC_KERNEL 0 #define GLIBTOP_SUID_PROC_KERNEL 0
#define GLIBTOP_SUID_PROC_SEGMENT 0 #define GLIBTOP_SUID_PROC_SEGMENT 0
#define GLIBTOP_SUID_PROC_ARGS 0
#define GLIBTOP_SUID_PROC_MAP 0 #define GLIBTOP_SUID_PROC_MAP 0
#define GLIBTOP_SUID_NETLOAD 0
#define GLIBTOP_SUID_PPP 0
__END_DECLS __END_DECLS

43
sysdeps/stub/netload.c Normal file
View File

@@ -0,0 +1,43 @@
/* $Id$ */
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the Gnome Top Library.
Contributed by Martin Baulig <martin@home-of-linux.org>, 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));
}

View File

@@ -1,3 +1,7 @@
1998-10-26 Martin Baulig <martin@home-of-linux.org>
* netload.c: New file.
1998-10-26 Martin Baulig <martin@home-of-linux.org> 1998-10-26 Martin Baulig <martin@home-of-linux.org>
* procargs.c: New file. * procargs.c: New file.

View File

@@ -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 \ uptime.c loadavg.c shm_limits.c msg_limits.c \
sem_limits.c proclist.c procstate.c procuid.c \ sem_limits.c proclist.c procstate.c procuid.c \
proctime.c procmem.c procsignal.c prockernel.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) libgtop_sysdeps_suid_la_LDFLAGS = $(LT_VERSION_INFO)

View File

@@ -40,6 +40,10 @@ __BEGIN_DECLS
#define GLIBTOP_SUID_PROC_SIGNAL (1 << GLIBTOP_SYSDEPS_PROC_SIGNAL) #define GLIBTOP_SUID_PROC_SIGNAL (1 << GLIBTOP_SYSDEPS_PROC_SIGNAL)
#define GLIBTOP_SUID_PROC_KERNEL (1 << GLIBTOP_SYSDEPS_PROC_KERNEL) #define GLIBTOP_SUID_PROC_KERNEL (1 << GLIBTOP_SYSDEPS_PROC_KERNEL)
#define GLIBTOP_SUID_PROC_SEGMENT (1 << GLIBTOP_SYSDEPS_PROC_SEGMENT) #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 __END_DECLS

View File

@@ -0,0 +1,43 @@
/* $Id$ */
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the Gnome Top Library.
Contributed by Martin Baulig <martin@home-of-linux.org>, 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));
}