Commit Graph

33 Commits

Author SHA1 Message Date
Ting-Wei Lan
59d9780eae freebsd: Support GLIBTOP_IF_FLAGS_WIRELESS in netload
The ioctl call used in this patch doesn't seems to be documented. It is
what ifconfig(8) command uses to display the media type, and its usage
can be learned by reading the source code of ifconfig(8).

https://bugzilla.gnome.org/show_bug.cgi?id=770165
2016-08-20 16:46:15 +03:00
Gleb Smirnoff
305701c637 freebsd: Rewrite netload implementation with getifaddrs and ioctl
Instead of using a documented and official API to get information related
to a network interface, the old implementation uses kvm library to access
kernel memory directly, which is not easy to understand and can be easily
broken by changing kernel symbols or structs. Besides, FreeBSD 11 hides
severai required kernel struct definitions from userspace programs, which
causes compilation error because the definition of 'struct ifaddr' is not
available unless _KERNEL is defined.

This patch is primarily authored by Gleb Smirnoff <glebius@FreeBSD.org>,
with other simple modification made by Antoine Brodin <antoine@FreeBSD.org>,
Koop Mast <kwm@FreeBSD.org> and Ting-Wei Lan <lantw@src.gnome.org> applied.
It was first submitted to FreeBSD ports and has been used by FreeBSD users
for more than 18 months on all supported versions of FreeBSD.

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=194187
https://svnweb.freebsd.org/changeset/ports/371082
https://github.com/freebsd/freebsd-ports-gnome/commit/be884cd
https://github.com/freebsd/freebsd-ports-gnome/commit/422a418
https://github.com/freebsd/freebsd-ports-gnome/commit/a4b1913
https://bugzilla.gnome.org/show_bug.cgi?id=770165
2016-08-20 16:46:15 +03:00
Benoit Dejean
0642c2d610 Turn glibtop::machine from a value to a pointer, allocated on init.
This hides the glibtop_machine implementation.
2015-08-08 11:00:57 +02:00
Benoit Dejean
d817bee619 Remove useless/meaningless calls to glibtop_init_[prs]() with sysdeps/{freebsd,linux}. 2015-08-08 10:56:25 +02:00
Benoit Dejean
0099cbb6b4 Rework logic by turning two dark while into fors.
Also, if kvm_read fail, exit rather than looping forever.
2015-07-15 18:39:06 +02:00
Robert Roth
7a3414d002 Update old FSF address.
https://bugzilla.gnome.org/show_bug.cgi?id=721514
2014-08-20 04:44:27 +03:00
Benoît Dejean
aa9fafe5c3 Renamed all glibtop_init_xxx functions to _glibtop_init_xxx so they get
2007-04-11  Benoît Dejean  <benoit@placenet.org>

	* *:
	
	Renamed all glibtop_init_xxx functions
	to _glibtop_init_xxx so they get internal visibility.

	* configure.in:
	
	Bumped version number.

svn path=/trunk/; revision=2569
2007-04-11 17:52:14 +00:00
Benoît Dejean
04a5531a46 Removed noisy $Id$.
2007-02-20  Benoît Dejean  <benoit@placenet.org>

	* *:
	
	Removed noisy $Id$.

svn path=/trunk/; revision=2558
2007-02-19 23:10:10 +00:00
Benoît Dejean
5a15e409cf Huge (k)FreeBSD update. (k)FreeBSD support is freebsd/ Other BSD are in
2007-02-18  Benoît Dejean  <benoit@placenet.org>

	* configure.in:
	* libgtop-sysdeps.m4:
	* sysdeps/Makefile.am:
	
	Huge (k)FreeBSD update.
	(k)FreeBSD support is freebsd/
	Other BSD are in bsd/
	
	Patch by Joe Marcus Clarke  <marcus@freebsd.org>
	Alexander Nedotsukov  <bland@FreeBSD.org>
	
	Closes #407693.

svn path=/trunk/; revision=2557
2007-02-18 01:10:53 +00:00
Benoît Dejean
c6a7459bc9 Various FreeBSD and kFreeBSD updates. Patch by Roy Marples
2007-01-31  Benoît Dejean  <benoit@placenet.org>

	* fsusage.c: (_glibtop_freebsd_get_fsusage_read_write):
	* netload.c: (glibtop_get_netload_p):
	* prockernel.c: (glibtop_get_proc_kernel_p):
	* procmap.c: (glibtop_get_proc_map_p):
	* proctime.c:
	* siglist.c:
	* /libgtop-sysdeps.m4:
	
	Various FreeBSD and kFreeBSD updates.
	Patch by Roy Marples  <uberlord@gentoo.org>.
	Reviewed by Petr Salinger  <Petr.Salinger@seznam.cz>.
	Closes #387200.

svn path=/trunk/; revision=2550
2007-01-31 21:23:21 +00:00
James Henstridge
aa5ac8fc10 remove unused file.
2005-12-12  James Henstridge  <james@jamesh.id.au>

	* doc/auto-macros.texi.in: remove unused file.

	* doc/libgtop2.texi: don't include auto-macros.texi.

	* doc/Makefile.am: don't build auto-macros.texi, since none of its
	macros are used in the documentation any more.

	* include/glibtop/global.h: don't include <config.h> from headers.

	* .../*.c: make sure <config.h> is the first thing included.

	* acinclude.m4: m4_include() libgtop-sysdeps.m4 rather than
	inlining it.

	* acinclude.m4, libgtop-sysdeps.m4: use third argument to
	AC_DEFINE() to set the comment.

	* configure.in: modernise a bit.

	* acconfig.h: remove file, since it is deprecated

	* autogen.sh: require automake 1.9 instead of 1.4.
2005-12-12 09:38:15 +00:00
Benoît Dejean
2c0f291b3c Fix a bug in netlist where glibtop_netlist.number was never initialized to
* Makefile.am:
	* cpu.c: (glibtop_get_cpu_p):
	* netlist.c: (glibtop_get_netlist_s):
	* netload.c: (glibtop_get_netload_p):
	* procmem.c: (glibtop_get_proc_mem_p):

	Fix a bug in netlist where glibtop_netlist.number was never initialized to 0
	(this resulted in a NULL pointer dereference in the network load feature
	of the multiload applet)

	* Add support for getting interface flags and packet counts even on interfaces
	without IP addresses (needed for the network load feature of the multiload applet)

	* Restore per-process limits in the !FreeBSD or __FreeBSD_version < 500013
	case

	* Add CPU interrupt time as IOWAIT to get support for the cpu load feature of
	the multiload applet.

	Patch from marcus@freebsd.org (Joe Marcus Clarke).
	Closes #168704.
2005-02-28 08:15:59 +00:00
Benoît Dejean
70b0925a82 whitespace clean up.
* *.{c,h} : whitespace clean up.
2004-06-09 18:52:22 +00:00
Benoît Dejean
2f87aa4479 s/strncpy/g_strlcpy/.
* netload.c: (glibtop_get_netload_p):
	* procstate.c: (glibtop_get_proc_state_p):
	* prockernel.c: (glibtop_get_proc_kernel_p): s/strncpy/g_strlcpy/.

	* procargs.c: (glibtop_get_proc_args_p):
	* procmap.c: (glibtop_get_proc_map_p): Cleaned.
2004-06-06 22:03:57 +00:00
Bastien Nocera
4bd9752d52 implement NetBSD support, and some build problems on FreeBSD (Closes:
2004-03-09  Bastien Nocera  <hadess@hadess.net>

	* Makefile.am:
	* cpu.c: (glibtop_init_cpu_p), (glibtop_get_cpu_p):
	* glibtop_machine.h:
	* mem.c:
	* netload.c: (glibtop_get_netload_p):
	* prockernel.c: (glibtop_get_proc_kernel_p):
	* proclist.c: (glibtop_get_proclist_p):
	* procmap.c: (glibtop_get_proc_map_p):
	* procmem.c: (glibtop_get_proc_mem_p):
	* procsignal.c: (glibtop_get_proc_signal_p):
	* procstate.c: (glibtop_get_proc_state_p):
	* proctime.c:
	* procuid.c: (glibtop_get_proc_uid_p):
	* uptime.c: (glibtop_get_uptime_p): implement NetBSD support, and
	some build problems on FreeBSD (Closes: #135674)
2004-03-09 23:13:31 +00:00
Carlos Perelló Marín
4c8ae9e25c Reverted libgtop changes. It's a common module and I should not modify it.
2003-10-19  Carlos Perelló Marín <carlos@gnome.org>

	* support/*: Reverted libgtop changes. It's a common module
	and I should not modify it.
	* Added/removed files. Now the move should be done.
2003-10-19 16:55:56 +00:00
Martin Baulig
7a7c6baf55 Moved all sysdeps code to the new libgtop-backends module.
2001-04-20  Martin Baulig  <baulig@suse.de>

	Moved all sysdeps code to the new libgtop-backends module.

	* sysdeps/freesd/*: Removed.
	* sysdeps/kernel/*: Removed.
	* sysdeps/linux/*: Removed.
	* sysdeps/osf1/*: Removed.
	* sysdeps/solaris/*: Removed.
	* sysdeps/stub/*: Removed.
	* sysdeps/stub_suid/*: Removed.
	* sysdeps/sun4/*: Removed.
2001-04-20 21:06:35 +00:00
Martin Baulig
3fec7a0946 kvm_nlist () returns -1 on error, but a positive return value does not
2000-02-13  Martin Baulig  <martin@home-of-linux.org>

	* *.c: kvm_nlist () returns -1 on error, but a positive return value
	does not necessarily mean failure. Fixes #3302 which was reported by
	Matthias Scheler some time ago.
2000-02-13 15:28:24 +00:00
Martin Baulig
f1a6e1ead8 The indentation in LibGTop was done with the following command:
find . -name \*.[ch] | xargs -i emacs -batch {} \
		-l /gnome/compile/libgtop/misc/format.el -f save-buffer

December 26, 1999
Martin
1999-12-26 14:05:32 +00:00
Martin Baulig
e03b665dd1 s/server->machine/server->_priv->machine/g; 1999-12-23 13:01:57 +00:00
Martin Baulig
1a25c3ade9 New file.
1999-12-12  Martin Baulig  <martin@home-of-linux.org>

	* netinfo.c: New file.

	* interfaces.c: Reflect latest interface changes.
	* netload.c: Likewise.
1999-12-12 16:09:03 +00:00
Martin Baulig
7a9bb6e43d Return 0 on success and -1 on error. 1999-10-24 20:17:42 +00:00
Martin Baulig
a5dd7e9063 This is a very big an possibly breaking commit.
It changes the return values of all sysdeps functions which were
previosly returning void to int.

This is the first step to implement better error handling in LibGTop.

Martin

1999-10-24  Martin Baulig  <martin@home-of-linux.org>

	* include/glibtop/*.h (glibtop_get_*, glibtop_init*): Changed
	the return value of all `glibtop_get_<feature>_* ()' and all
 	`glibtop_init_<feature>_* ()' functions from void to int.

	* features.def: Reflect changes of the return values.
	* sysdeps/*/*.c: Reflect changes of the return values.
1999-10-24 19:09:32 +00:00
Martin Baulig
6120c5e4a8 Use (1L << feature)' instead of (1 << feature)' to avoid problems
with integer overflows when we add more fields.
1999-05-06 21:35:36 +00:00
Timur Bakeyev
fac354623b Added initial port for BSD/OS (aka BSDI) 2.x and 3.x. 4.x should also(?)
Thu Apr  8 23:47:29 1999  Timur Bakeyev  <timur@gnu.org>

 	* cpu.c, mem.c, netload.c, procargs.c, procstate.c, proctime.c,
 	sem_limits.c, shm_limits.c, swap.c: Added initial port for BSD/OS
	(aka BSDI) 2.x and 3.x. 4.x should also(?) work.

	Still, this port require more close look and extended check.
1999-04-08 20:21:38 +00:00
Martin Baulig
005357e821 Added basic support for BSDI. It compiles without problems on BSDI 2.1 and
1999-03-19  Martin Baulig  <martin@home-of-linux.org>

	Added basic support for BSDI. It compiles without problems on
	BSDI 2.1 and 3.1, but it is *untested* - I'm neither root on
	the machine nor have I access to /dev/kmem, so I don't know
	whether it will work.

	You need to give configure the `--enable-hacker-mode' parameter
	to use the code.

	If someone can verify whether it actually works, please let me
	know.
1999-03-19 10:47:44 +00:00
Martin Baulig
cf611f9157 Set the copyright of LibGTop to the GNU General Public License.
1999-02-22  Martin Baulig  <martin@home-of-linux.org>

	Set the copyright of LibGTop to the GNU General Public License.

	* copyright.txt: Set the year to 1998-99 and pretty-format it a
	little bit. Same in all C source and header files.
1999-02-23 11:47:35 +00:00
Martin Baulig
ce4f660965 Include a copy of the GNU Library General Public License here.
1999-02-22  Martin Baulig  <martin@home-of-linux.org>

	* COPYING.LIB: Include a copy of the GNU Library General
	Public License here.

	* copyright.txt: Set the year to 1998-99 and pretty-format it a
	little bit. Same in all C source and header files.
1999-02-22 16:19:36 +00:00
Martin Baulig
213fb37f26 Oops, misspelled C preprocessor directive ... (it's #elif not #elsif). 1998-12-06 13:02:02 +00:00
Martin Baulig
67a344b9d4 Make it work with NetBSD 1.3.2.
1998-12-05  Martin Baulig  <martin@home-of-linux.org>

	* Make it work with NetBSD 1.3.2.

Well, it compiles without problems but not all features are currently
working; need to look a little bit closer at it.

Ok for now, think I'll install OpenBSD and test it there ...

Martin
1998-12-05 18:52:09 +00:00
Martin Baulig
7a0a779311 Great !!! It's working on my FreeBSD 3.0 machine now ... !!! 1998-11-17 23:15:12 +00:00
Martin Baulig
b70d0570c7 More network load stuff. 1998-10-26 12:21:28 +00:00
Martin Baulig
1289b92d06 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 *));
1998-10-26 10:39:14 +00:00