version 2.6.1

* configure.in: version 2.6.1
This commit is contained in:
Benoît Dejean
2004-07-11 21:01:27 +00:00
parent de7fd9e85b
commit c73d0eb3c9
54 changed files with 731 additions and 648 deletions

View File

@@ -34,8 +34,3 @@ libgtop*.tar.gz
*-debstamp
libgtop*.pc
autom4te.cache
COPYING
INSTALL
install-sh
missing
mkinstalldirs

203
ChangeLog
View File

@@ -1,37 +1,6 @@
2004-07-07 Benoît Dejean <tazforever@dlfp.org>
2004-06-13 Benoît Dejean <tazforever@dlfp.org>
* include/glibtop/netinfo.h:
* structures.def:
* sysdeps/names/netinfo.c: Removed netinfo.[ch] that were never used.
2004-07-03 Benoît Dejean <tazforever@dlfp.org>
* sysdeps/names/fsusage.c: Added missing fsusage names.
2004-07-03 Benoît Dejean <tazforever@dlfp.org>
* glibtop.h: Moved foward declaration of glibtop to break circular
#includes dependencies.
2004-06-18 Benoît Dejean <tazforever@dlfp.org>
* include/glibtop/error.h: Also tries C99 __VA_ARGS__ before using
functions.
* include/glibtop/error.h: Moved 8 static error functions to
sysdeps/common/error.c. This is the end of an big useless code
bloat : expect ~8KB of object size reduction.
* include/glibtop/procuid.h: s/int/gint32/g
* lib/errors.c: (glibtop_error_quark):
* lib/read.c: (do_read), (glibtop_read_l):
* lib/read_data.c: (glibtop_read_data_l): Minor cleanups.
* sysdeps/names/netload.c:
* include/glibtop/netload.h: Added IPv6 feature : provides address,
prefix and scope. This breaks the ABI. Not documented yet : check
this file.
* configure.in: version 2.6.1
2004-06-13 Benoît Dejean <tazforever@dlfp.org>
@@ -42,9 +11,11 @@
* include/glibtop/fsusage.h: block_size is now defined as a guint32
instead of a fuzzy gint.
* lib/sysdeps.c: (glibtop_get_sysdeps_r): Small cleanup.
2004-06-12 Benoît Dejean <tazforever@dlfp.org>
* lib/init.c: Added missing initializer.
2004-06-09 Benoît Dejean <TazForEver@dlfp.org>
@@ -55,7 +26,7 @@
* lib/parameter.c:
* support/popt.c: (poptGetContext): Cleaned.
* support/vsnprintf.c: s/strncpy/g_strlcpy
2004-05-28 Benoît Dejean <TazForEver@free.fr>
@@ -168,7 +139,7 @@
2004-03-05 Bastien Nocera <hadess@hadess.net>
* include/glibtop/procmap.h: patch by Benoît Dejean <bnet@ifrance.com>
* include/glibtop/procmap.h: patch by Benoit Dejean <bnet@ifrance.com>
to break the API, I mean, to make it easier to generate Python bindings
(Closes: #129701)
@@ -211,8 +182,8 @@
2004-02-02 Sebastien Bacher <seb128@debian.org>
* sysdeps/linux/mem.c: (glibtop_get_mem_s): patch from
Benoît Dejean <bnet@ifrance.com> to fix libtop_mem.used
* sysdeps/linux/mem.c: (glibtop_get_mem_s): patch from
Benoît Dejean <bnet@ifrance.com> to fix libtop_mem.used
and glibtop_mem.shared values (Closes: #129863).
Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
@@ -582,7 +553,7 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
2003-01-16 Daniel Yacob <locales@geez.org>
* configure.in: added am to ALL_LINGUAS
2003-01-12 Kevin Vandersloot <kfv101@psu.edu>
* configure.in: release 2.0.1
@@ -595,7 +566,7 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
* Framework for AIX support
2002-08-07 Vincent Berger <Vincent.Berger@ext.bull.net>
2002-08-07 Vincent Berger <Vincent.Berger@ext.bull.net>
* support/: Add alloca management for AIX
* configure.in: correct checking for nm
@@ -677,7 +648,7 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
* acininclude.m4: add back the support stuf but make it really
work
* configure.in: bump version number, add back GNOME_SUPPORT
* configure.in: bump version number, add back GNOME_SUPPORT
check since that was causing a build failure
* release 1.90.1
@@ -724,7 +695,7 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
* port stable libgtop to GNOME 2.0. Too much to detail.
pkgconfig is now used. Libs are named libgtop-2.0 etc for
parallel install.
parallel install.
2001-10-17 Abel Chueng <maddog@linux.org.hk>
@@ -870,7 +841,7 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
1999-09-22 Kjartan Maraas <kmaraas@online.no>
* configure.in: Added "da" to ALL_LINGUAS.
1999-09-19 Martin Baulig <martin@home-of-linux.org>
* libgtopConf.sh.in: Added MODULE_VERSION on Miguel's
@@ -1095,7 +1066,7 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
contain all possible features.
* configure.in: LibGTop will now require GLIB >= 1.1.12.
1999-01-05 Martin Baulig <martin@home-of-linux.org>
* configure.in: Make it abort if the `dc' utility is not installed.
@@ -1261,7 +1232,7 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
here.
[NOTE for people porting libgtop:
Please use all 64 bits of the `guint64' and not just 32 - the
signal number (as it is used in calls to kill () ...) should be
a bit-index into this field; if a process ignores for instance
@@ -1442,7 +1413,7 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
* LIBGTOP-VERSION: Set version number to 0.25.0. There is now really
a feature freeze until it's released, bug fixes only ...
* include/glibtop/procmap (glibtop_map_entry): Added `flags' and
`filename' fields.
@@ -1450,7 +1421,7 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
* libgtopConf.sh.in: Likewise.
* libgtopConf.sh.in: Added `LIBGTOP_EXTRA_LIBS'.
* sysdeps/linux/procmap.c: Added implementation.
1998-08-17 Martin Baulig <martin@home-of-linux.org>
@@ -1540,7 +1511,7 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
* LIBGTOP-VERSION: Added `LIBGTOP_SERVER_VERSION'.
* src/daemon/gnuserv.c, lib/open.c: Improved version check between
client and server.
* include/glibtop/output.h: Removed.
* sysdeps/stub_suid: New directory. This is mainly used as example
@@ -1551,7 +1522,7 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
* sysdeps/osf1/*.c (glibtop_init_<no-suid-feature>_s): New functions.
(glibtop_init_<suid-feature>_p): New functions.
1998-08-07 Martin Baulig <martin@home-of-linux.org>
* glibtop.h (_glibtop): New fields `error_method', `sysdeps' and
@@ -1727,7 +1698,7 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
* lib/open.c (glibtop_open_l): Unconditionally calling
`glibtop_init_s' after server initialization.
* lib/lib.awk: Removed references to functions from
`libgtop_sysdeps_suid.la' to avoid undefined symbols.
@@ -1748,20 +1719,20 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
* sysdeps/linux/close.c (glibtop_close_s): Renamed this
function from `glibtop_close_l'.
* sysdeps/osf1/Makefile.am (lib_LTLIBRARIES): Added
`libgtop_sysdeps_suid.la' for the suid server.
* sysdeps/osf1/open_suid.c (glibtop_open_p): New file.
Contains all stuff that was formerly in `open.c'.
* sysdeps/osf1/open.c: Moved everything from here into
the new file `open_suid.c'.
* sysdeps/osf1/open.c (glibtop_open_s): New function.
* sysdeps/osf1/close_suid.c (glibtop_close_p): New file.
* sysdeps/osf1/close.c (glibtop_close_s): New function.
* sysdeps/osf1/*.c: Using the new init, open and close
@@ -1804,7 +1775,7 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
1998-07-18 Martin Baulig <martin@home-of-linux.org>
* lib/{init, open}.c: Added `GLIBTOP_METHOD_PIPE' again.
* src/server/main.c: Removed gettext stuff.
1998-07-17 Martin Baulig <baulig@Stud.Informatik.uni-trier.de>
@@ -1813,10 +1784,10 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
library functions with '_l' prefix instead of directly calling
sysdeps code with '_r' prefix. This is necessary for client/server
mode.
* lib/lib.awk (glibtop_get_*): Now correctly using
`(1 << GLIBTOP_SYSDEPS_*)' instead of `GLIBTOP_SYSDEPS_*'.
* sysdeps/sun4/proclist.c (glibtop_get_proclist_p): Added
implementation of that feature.
@@ -1824,7 +1795,7 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
* sysdeps/sun4/proc_{mem, time, signal, kernel, segment}.c: Added
some basic implementation; this isn't really working yet.
* sysdeps/linux/sem_limits.c: Applied patch from Albert K T Hui
<avatar@deva.net> for glibc 2.1.
@@ -1844,7 +1815,7 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
1998-07-14 Martin Baulig <baulig@Stud.Informatik.uni-trier.de>
* src/daemon/server_config.h.in: Added some comments.
* src/daemon/server_config.pl: New file. This is a script you can use
to create `server_config.h'. It will query you for some configuration
options.
@@ -1869,11 +1840,11 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
* src/daemon/slave.c: New file.
* src/daemon/*.c: Done some more work on the daemon.
* sysdeps/common/gnuslib.c: Removed IPC stuff.
* include/glibtop/gnuserv.h: Removed IPC stuff.
* include/glibtop/command.h (glibtop_response_unit): Added
typedef for `struct _glibtop_response_unit'.
@@ -1903,7 +1874,7 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
* sysdeps/linux/procstate.c: Added missing `fclose'.
* include/glibtop/gnuserv.h (UNIX_DOMAIN_SOCKETS): Defining.
* include/glibtop/open.h (GLIBTOP_METHOD_UNIX): Added.
* lib/init.c: Added new method `GLIBTOP_METHOD_UNIX'.
@@ -1991,12 +1962,12 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
* lib/xmalloc.c (g_strdup): New function.
* lib/gnuclient.c: Removed.
* lib/{command, write, read}.c: Changed client <-> server
interface to make less system calls.
* src/daemon/main.c: Changed server side of interface.
* include/glibtop/command.h (struct _glibtop_response): New
structure to return data from the server to the client.
@@ -2067,7 +2038,7 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
* include/glibtop/sysdeps.h (glibtop_types_sysdeps):
Forgot to change declaration on Jun 6.
* sysdeps/names/sysdeps.c (glibtop_types_sysdeps):
Using numeric constants from `types.h' instead of string
constants; forgot to change this on Jun 6. Added information
@@ -2094,30 +2065,30 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
1998-06-07 Martin Baulig <martin@home-of-linux.org>
* examples/ChangeLog: New file.
* macros/gnome-libgtop-sysdeps.m4: Include
`glibtop_machine.h' for Linux.
* sysdeps/linux/glibtop_machine.h: New file.
* sysdeps/linux/*.c: Performance optimizations. We now use
`open' and `read' instead of `fopen' and `fscanf'.
* *.[ch]: Using single underscore instead of two underscores
for function prefixes (regexp: ``s,__([rspl])\b,_$1,g'') to
avoid ambiguity with mangled C++ names.
1998-06-06 Martin Baulig <martin@home-of-linux.org>
* sysdeps/osf1/glibtop_server.h: New file.
* sysdeps/osf1/*.c: renamed all functions implementing
features that don't need to be suid to '__s'.
* sysdeps/names/procdata.c: Removed that file.
* include/glibtop/*.h (glibtop_types_*): Changed declaration.
* glibtop.h: Added `#include <types.h>'.
* include/glibtop/types.h: New file - numeric constants
@@ -2143,10 +2114,10 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
1998-06-03 Martin Baulig <baulig@merkur.uni-trier.de>
* libgtop.spec: New file.
* Makefile.am (EXTRA_DIST): Added `autogen.sh' and
`libgtop.spec'.
* configure.in (LIBGTOP_INCS): is now identically to
`LIBGTOP_GUILE_INCS'.
@@ -2183,7 +2154,7 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
* NEWS: added more detailed description of today's and
yesterday's changes.
* include/glibtop/*.h: to use the ChangeLog entry from May 28:
'__l' is a function defined in the client part;
'__s' is a function defined in the sysdeps part and
@@ -2216,26 +2187,26 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
* src/server/main.c: we now use the '__p' functions,
but only if the appropriate 'GLIBTOP_SUID_<feature>'
has a non-zero value.
* configure.in (@machine_incs@): always use
* configure.in (@machine_incs@): always use
`-I$(top_srcdir)/sysdeps/@sysdeps_dir@'; it's no
longer conditional.
* examples/Makefile.am: removed the '_linux' examples.
* sysdeps/linux/*.c: renamed all functions implementing
features to '__s'.
* lib/*.c: renamed all functions implementing features
to '__l'; we only emit code for those functions if the
corresponding 'GLIBTOP_SUID_<feature>' has a positive value.
* include/glibtop/*.h: added some new function suffixes:
'__l' is a function defined in the client part;
'__s' is a function defined in the sysdeps part and
'__p' is a function that needs special priviledges.
'__r' is mapped either on '__l' or on '__s'.
* sysdeps/linux/glibtop_server.h: New file -
defines system dependent constants 'GLIBTOP_SUID_<feature>'
being either 'GLIBTOP_SYSDEPS_<feature>'+1 depending upon
@@ -2301,9 +2272,9 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
'libgtop_use_machine_h', 'libgtop_guile_found',
'libgtop_want_names', 'libgtop_want_guile_names',
'libgtop_want_examples'.
* gtopConf.sh.in: renamed to 'libgtopConf.sh.in'.
* acinclude.m4 (AC_LC_SYSDEPS): rewrote that macro -
moved some of the code to 'macros/gnome-libgtop-sysdeps.m4';
renamed variables: look at the ChangeLog entry for the
@@ -2366,7 +2337,7 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
* NEWS: added more detailed description of
today's changes.
* examples/third.c: added required check for
'GLIBGTOP_GUILE_NAMES'.
@@ -2400,20 +2371,20 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
* sysdeps/osf1/procuid.c (glibtop_get_proc_uid__r):
added implementation for DEC OSF/1.
* sysdeps/sun4/uptime.c: forgot to checkin
* sysdeps/sun4/loadavg.c: forgot to checkin
* sysdeps/osf1/uptime.c: forgot to checkin
* sysdeps/osf1/loadavg.c: forgot to checkin
1998-05-19 Martin Baulig <baulig@merkur.uni-trier.de>
* sysdeps/stub/uptime.c: forgot this file all the
time - stub for glibtop_uptime
* sysdeps/stub/loadavg.c: forgot this file all the
time - stub for glibtop_loadavg
@@ -2432,7 +2403,7 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
* include/glibtop: added references to
'glibtop_types_* []' and 'glibtop_guile_types_*'.
* sysdeps/guile/names: added implementations of
'glibtop_types_*' and 'glibtop_description_*'.
@@ -2447,7 +2418,7 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
* sysdeps/guile: all guile functions now return
the 'flags' member as first element of the list.
* include/glibtop/procstate.h (glibtop_proc_state):
* include/glibtop/procstate.h (glibtop_proc_state):
added 'uid' and 'gid' members; the library tries hard
to set those values; it will never set the corresponding
'flags' value unless the values are correct.
@@ -2489,7 +2460,7 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
* sysdeps/guile/sysdeps.c: changes to reflect the
new flags of procdata.
* sysdeps/common/sysdeps.c: changes to reflect the
new flags of procdata.
@@ -2549,9 +2520,9 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
* src/mico/proclist.idl: new file - simple mico interface
* src/version.c: moved to src/server
* src/output.c: moved to src/server
* src/main.c: moved to src/server
1998-04-11 Martin Baulig <martin@home-of-linux.org>
@@ -2621,7 +2592,7 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
this directory
* sysdeps/common/sem_limits.c: moved to sysdeps/names
* sysdeps/common/msg_limits.c: moved to sysdeps/names
* sysdeps/common/sem_limits.c: moved to sysdeps/names
@@ -2655,25 +2626,25 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
some arbitrary data
* lib/proclist.c: new file - library function for glibtop_proclist
* sysdeps/linux/proclist.c: new file - implementation for glibtop_proclist
* sysdeps/stub/proclist.c: new file - stub for glibtop_proclist
* include/glibtop/proclist.h: new file - glibtop_proclist
* include/glibtop/union.h: new file
* lib/read_data.c: new file
* include/glibtop/read_data.h: new file
* sysdeps/common/xmalloc.c: new file - moved here from lib
* sysdeps/common/error.c: new file - moved here from lib
* lib/xmalloc.c: moved to sysdeps/common
* lib/error.c: moved to sysdeps/common
1998-04-05 Martin Baulig <martin@home-of-linux.org>
@@ -2710,9 +2681,9 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
* sysdeps/common/msg_limits.c: new file - limit names
* sysdeps/common/sem_limits.c: new file - limit names
* include/glibtop/shm_limits.h: new file - glibtop_shm_limits
* include/glibtop/msg_limits.h: new file - glibtop_msg_limits
* include/glibtop/sem_limits.h: new file - glibtop_sem_limits
@@ -2737,13 +2708,13 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
* lib/ipc_limits.c: new file - library function for
glibtop_ipc_limits
* sysdeps/linux/ipc_limits.c: new file - implementation for
glibtop_ipc_limits
* sysdeps/stub/ipc_limits.c: new file - stub for
glibtop_ipc_limits
* include/glibtop/ipc_limits.h: new file - glibtop_ipc_limits -
sysv ipc limits
@@ -2751,7 +2722,7 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
* lib/uptime.c: new file - library function for
glibtop_uptime
* lib/loadavg.c: new file - library function for
glibtop_loadavg
@@ -2775,14 +2746,14 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
* sysdeps/stub/sysinfo.c: removed - splitted into
uptime.c and loadavg.c
* src/main.c: added GLIBTOP_CMND_UPTIME and
GLIBTOP_CMND_LOADAVG implementation
* include/glibtop/loadavg.h: new file - glibtop_loadavg
* include/glibtop/uptime.h: new file - glibtop_uptime
* include/glibtop/loadavg.h: removed - splitted into
uptime.h and loadavg.h
@@ -2791,10 +2762,10 @@ Wed Jan 7 02:23:28 2004 Jonathan Blandford <jrb@gnome.org>
* lib/sysdeps.c: new file - library function for glibtop_sysdeps
* sysdeps/linux/sysdeps.c: new file - copied from sysdeps/stub
* sysdeps/stub/sysdeps.c: new file - implementation for glibtop_sysinfo -
this is really the implementation and not just a stub
* src/sysdeps.c: moved to sysdeps/stub - this file is now part
of the library

15
NEWS
View File

@@ -1,3 +1,18 @@
July 11, 2004:
==============
* Released LibGTop 2.6.1
- code cleanups. 5% object size shrinkage.
- glibtop_mountlist()'s all_fs parameter now works.
- glibtop_uptime.boot_time is set on every arch.
- linux SMP support is fixed.
- Replaced unsafe strcpy by g_strlcpy.
March 11, 2004:
===============

View File

@@ -5,7 +5,7 @@
* marshal.pl:
* read_data.c: (glibtop_read_data_i):
* server.c: (handle_slave_connection): fix g_malloc usage on non-Linux
platforms (patch by Benoît Dejean <bnet@ifrance.com>)
platforms (patch by Benoit Dejean <bnet@ifrance.com>)
2003-10-20 Bastien Nocera <hadess@hadess.net>

View File

@@ -8,7 +8,7 @@ AC_CANONICAL_SYSTEM
LIBGTOP_MAJOR_VERSION=2
LIBGTOP_MINOR_VERSION=6
LIBGTOP_MICRO_VERSION=0
LIBGTOP_MICRO_VERSION=1
LIBGTOP_VERSION=$LIBGTOP_MAJOR_VERSION.$LIBGTOP_MINOR_VERSION.$LIBGTOP_MICRO_VERSION
AM_INIT_AUTOMAKE(libgtop, $LIBGTOP_VERSION)
@@ -250,7 +250,7 @@ AC_TYPE_SIGNAL
AC_FUNC_STRFTIME
AC_CHECK_FUNCS(getcwd gettimeofday getwd putenv strdup strtoul uname)
ALL_LINGUAS="am ar az be bg bn ca cs cy da de el en_CA en_GB es et eu fa fi fr ga gl gu he hi hr hu id it ja ko lt lv mi mk ml mn ms nl nn no pa pl pt pt_BR ro ru sk sl sq sr sr@Latn sv ta tr uk vi zh_CN zh_TW"
ALL_LINGUAS="am ar az be bg bn ca cs cy da de el en_CA en_GB es et eu fa fi fr ga gl gu he hi hr hu id it ja ko lt lv mk ml mn ms nl nn no pa pl pt pt_BR ro ru sk sl sq sr sr@Latn sv ta tr uk vi zh_CN zh_TW"
GETTEXT_PACKAGE=libgtop-2.0
AC_SUBST(GETTEXT_PACKAGE)

View File

@@ -8,4 +8,3 @@ auto-macros.texi
version.texi
stamp-vti
*.html *.pdf
mdate-sh

View File

@@ -1,9 +1,3 @@
2004-07-07 Benoît Dejean <tazforever@dlfp.org>
* reference.texi: updated.
Added glibtop_get_proc_argv.
Added glibtop_fsusage.block_size.
2004-03-05 Bastien Nocera <hadess@hadess.net>
* reference.texi: update for new API

View File

@@ -1079,7 +1079,7 @@ Library function @code{glibtop_get_proc_args}:
@example
@cartouche
char *
glibtop_get_proc_args(glibtop_proc_args *buf, pid_t pid,
glibtop_get_proc_args_l (glibtop_proc_args *buf, pid_t pid,
unsigned max_len);
char *
@@ -1110,30 +1110,6 @@ the lenght of this string is returned in the @code{size} field.
Remember to @code{g_free} the returned string to avoid a memory leak.
@strong{New functions}
@example
@cartouche
char **
glibtop_get_proc_argv(glibtop_proc_args *buf, pid_t pid,
unsigned max_len);
char **
glibtop_get_proc_argv_l (glibtop *server, glibtop_proc_args *buf,
pid_t pid, unsigned max_len);
@end cartouche
@end example
Returns a NULL-terminated array of strings with all arguments of
process @code{pid} (up to @code{max_len} characters, use zero to get
all arguments). @code{glibtop_get_proc_argv()} and
@code{glibtop_get_proc_argv_l()} are wrappers to
@code{glibtop_get_proc_args()} and @code{glibtop_get_proc_args_l()}
that return process' arguments like the C @code{argv}.
Remember to @code{g_strfreev} the returned array to avoid a memory
leak.
@page
@node glibtop_proc_map, glibtop_netload, glibtop_proc_args, System Dependent
@subsection Process Memory Maps
@@ -1518,7 +1494,6 @@ struct _glibtop_fsusage
bavail,
files,
ffree;
guint32 block_size;
@};
@end cartouche
@end example
@@ -1534,8 +1509,6 @@ Free blocks available to ordinary users.
Total file nodes.
@item ffree
Free file nodes.
@item block_size
Block size in bytes.
@end table
Blocks are usually 512 bytes.

View File

@@ -1,7 +1,3 @@
2004-07-07 Benoît Dejean <tazforever@dlfp.org>
* procargs.c: Added glibtop_get_proc_argv demo.
2003-12-27 Ole Laursen <olau@hardworking.dk>
* mountlist.c: Updated to display block size too.
@@ -54,7 +50,7 @@
Fri Apr 9 00:14:52 1999 Timur Bakeyev <timur@gnu.org>
* timings.c: Added timersub defenition, to make code compilable on
* timings.c: Added timersub defenition, to make code compilable on
BSDI.
1999-03-24 Martin Baulig <martin@home-of-linux.org>
@@ -120,11 +116,11 @@ Fri Apr 9 00:14:52 1999 Timur Bakeyev <timur@gnu.org>
1998-06-12 Martin Baulig <martin@home-of-linux.org>
* test.scm: New file.
1998-06-07 Martin Baulig <martin@home-of-linux.org>
* Makefile.am (CFLAGS): Disable optimize.
* first.c (PROFILE_COUNT): Number of times each function
should be called. Defaults to 1; to profile the code, you
can increase this when compiling.

View File

@@ -24,9 +24,6 @@
#ifndef __GLIBTOP_H__
#define __GLIBTOP_H__
typedef struct _glibtop glibtop;
#include <glibtop/global.h>
#include <glibtop_server.h>
@@ -40,10 +37,10 @@ typedef struct _glibtop glibtop;
#define GLIBTOP_MOUNTENTRY_LEN 79
#endif
typedef struct _glibtop glibtop;
#include <glibtop/sysdeps.h>
struct _glibtop
{
unsigned flags;

View File

@@ -28,17 +28,60 @@
G_BEGIN_DECLS
#ifndef G_GNUC_UNUSED
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
#define G_GNUC_UNUSED \
__attribute__((unused))
#else /* !__GNUC__ */
#define G_GNUC_UNUSED
#endif /* !__GNUC__ */
#endif /* defined G_GNUC_UNUSED */
void glibtop_error_vr (glibtop *server, char *format, va_list args);
void glibtop_warn_vr (glibtop *server, char *format, va_list args);
void glibtop_error_io_vr (glibtop *server, char *format, int, va_list args);
void glibtop_warn_io_vr (glibtop *server, char *format, int, va_list args);
void G_GNUC_UNUSED glibtop_error_r (glibtop *server, char *format, ...);
void G_GNUC_UNUSED glibtop_warn_r (glibtop *server, char *format, ...);
void G_GNUC_UNUSED glibtop_error_io_r (glibtop *server, char *format, ...);
void G_GNUC_UNUSED glibtop_warn_io_r (glibtop *server, char *format, ...);
static void G_GNUC_UNUSED
glibtop_error_r (glibtop *server, char *format, ...)
{
va_list args;
va_start (args, format);
glibtop_error_vr (server, format, args);
va_end (args);
}
static void G_GNUC_UNUSED
glibtop_warn_r (glibtop *server, char *format, ...)
{
va_list args;
va_start (args, format);
glibtop_warn_vr (server, format, args);
va_end (args);
}
static void G_GNUC_UNUSED
glibtop_error_io_r (glibtop *server, char *format, ...)
{
va_list args;
va_start (args, format);
glibtop_error_io_vr (server, format, errno, args);
va_end (args);
}
static void G_GNUC_UNUSED
glibtop_warn_io_r (glibtop *server, char *format, ...)
{
va_list args;
va_start (args, format);
glibtop_warn_io_vr (server, format, errno, args);
va_end (args);
}
#ifdef __GNUC__
@@ -48,20 +91,43 @@ void G_GNUC_UNUSED glibtop_warn_io_r (glibtop *server, char *format, ...);
#define glibtop_error_io(p1, args...) glibtop_error_io_r(glibtop_global_server , p1 , ## args)
#define glibtop_warn_io(p1, args...) glibtop_warn_io_r(glibtop_global_server , p1 , ## args)
#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#else /* no __GNUC__ */
#define glibtop_error(p1, ...) glibtop_error_r(glibtop_global_server , p1 , __VA_ARGS__)
#define glibtop_warn(p1, ...) glibtop_warn_r(glibtop_global_server , p1 , __VA_ARGS__)
static void
glibtop_error (char *format, ...)
{
va_list args;
va_start (args, format);
glibtop_error_vr (glibtop_global_server, format, args);
va_end (args);
}
#define glibtop_error_io(p1, ...) glibtop_error_io_r(glibtop_global_server , p1 , __VA_ARGS__)
#define glibtop_warn_io(p1, ...) glibtop_warn_io_r(glibtop_global_server , p1 , __VA_ARGS__)
static void
glibtop_warn (char *format, ...)
{
va_list args;
va_start (args, format);
glibtop_warn_vr (glibtop_global_server, format, args);
va_end (args);
}
#else /* no __GNUC__, no C99*/
static void
glibtop_error_io (char *format, ...)
{
va_list args;
va_start (args, format);
glibtop_error_io_vr (glibtop_global_server, format, errno, args);
va_end (args);
}
void glibtop_error (char *format, ...);
void glibtop_warn (char *format, ...);
void glibtop_error_io (char *format, ...);
void glibtop_warn_io (char *format, ...);
static void
glibtop_warn_io (char *format, ...)
{
va_list args;
va_start (args, format);
glibtop_warn_io_vr (glibtop_global_server, format, errno, args);
va_end (args);
}
#endif /* no __GNUC__ */

83
include/glibtop/netinfo.h Normal file
View File

@@ -0,0 +1,83 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* $Id$ */
/* Copyright (C) 1998-99 Martin Baulig
This file is part of LibGTop 1.0.
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
LibGTop is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
LibGTop is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with LibGTop; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __GLIBTOP_NETINFO_H__
#define __GLIBTOP_NETINFO_H__
#include <glibtop.h>
#include <glibtop/global.h>
G_BEGIN_DECLS
#define GLIBTOP_NETINFO_IF_FLAGS 0
#define GLIBTOP_NETINFO_TRANSPORT 1
#define GLIBTOP_NETINFO_MTU 2
#define GLIBTOP_NETINFO_SUBNET 3
#define GLIBTOP_NETINFO_ADDRESS 4
#define GLIBTOP_MAX_NETINFO 5
typedef struct _glibtop_netinfo glibtop_netinfo;
#include <glibtop/interfaces.h>
struct _glibtop_netinfo
{
guint64 flags,
if_flags, /* GLIBTOP_NETINFO_IF_FLAGS */
transport, /* GLIBTOP_NETINFO_TRANSPORT */
mtu; /* GLIBTOP_NETINFO_MTU */
};
#if GLIBTOP_SUID_NETINFO
#define glibtop_get_netinfo_r glibtop_get_netinfo_p
#else
#define glibtop_get_netinfo_r glibtop_get_netinfo_s
#endif
glibtop_ifaddr *glibtop_get_netinfo_l (glibtop_client *client, glibtop_array *array, glibtop_netinfo *buf, const char *interface, guint64 transport);
#if GLIBTOP_SUID_NETINFO
int glibtop_init_netinfo_p (glibtop_server *server, glibtop_closure *closure);
glibtop_ifaddr *glibtop_get_netinfo_p (glibtop_server *server, glibtop_closure *closure, glibtop_array *array, glibtop_netinfo *buf, const char *interface, guint64 transport);
#else
int glibtop_init_netinfo_s (glibtop_server *server, glibtop_closure *closure);
glibtop_ifaddr *glibtop_get_netinfo_s (glibtop_server *server, glibtop_closure *closure, glibtop_array *array, glibtop_netinfo *buf, const char *interface, guint64 transport);
#endif
#ifdef GLIBTOP_NAMES
/* You need to link with -lgtop_names to get this stuff here. */
extern const char *glibtop_names_netinfo [];
extern const unsigned glibtop_types_netinfo [];
extern const char *glibtop_labels_netinfo [];
extern const char *glibtop_descriptions_netinfo [];
#endif
G_END_DECLS
#endif

View File

@@ -43,11 +43,8 @@ G_BEGIN_DECLS
#define GLIBTOP_NETLOAD_ERRORS_OUT 11
#define GLIBTOP_NETLOAD_ERRORS_TOTAL 12
#define GLIBTOP_NETLOAD_COLLISIONS 13
#define GLIBTOP_NETLOAD_ADDRESS6 14
#define GLIBTOP_NETLOAD_PREFIX6 15
#define GLIBTOP_NETLOAD_SCOPE6 16
#define GLIBTOP_MAX_NETLOAD 17
#define GLIBTOP_MAX_NETLOAD 14
typedef struct _glibtop_netload glibtop_netload;
@@ -70,15 +67,6 @@ enum {
GLIBTOP_IF_FLAGS_MULTICAST
};
enum GLIBTOP_IF_IN6_SCOPE
{
GLIBTOP_IF_IN6_SCOPE_UNKNOWN = 0,
GLIBTOP_IF_IN6_SCOPE_LINK = 1,
GLIBTOP_IF_IN6_SCOPE_SITE = 2,
GLIBTOP_IF_IN6_SCOPE_GLOBAL = 4,
GLIBTOP_IF_IN6_SCOPE_HOST = 8
};
struct _glibtop_netload
{
guint64 flags,
@@ -96,10 +84,6 @@ struct _glibtop_netload
errors_out, /* GLIBTOP_NETLOAD_ERRORS_OUT */
errors_total, /* GLIBTOP_NETLOAD_ERRORS_TOTAL */
collisions; /* GLIBTOP_NETLOAD_COLLISIONS */
guint8 address6[16];
guint8 prefix6[16];
guint8 scope6;
};
#define glibtop_get_netload(netload,interface) glibtop_get_netload_l(glibtop_global_server, netload, interface)

View File

@@ -59,7 +59,7 @@ typedef struct _glibtop_proc_uid glibtop_proc_uid;
struct _glibtop_proc_uid
{
guint64 flags;
gint32 uid, /* user id */
int uid, /* user id */
euid, /* effective user id */
gid, /* group id */
egid, /* effective group id */

View File

@@ -5,4 +5,3 @@ Makefile.in
libgtop.la
*.lo
lib.c
error.loT

View File

@@ -32,7 +32,7 @@ GQuark
glibtop_error_quark (void)
{
static GQuark q = 0;
if (G_UNLIKELY(q == 0))
if (q == 0)
q = g_quark_from_static_string ("glibtop-error-quark");
return q;

View File

@@ -31,25 +31,37 @@
static void
do_read (int s, void *ptr, size_t total_size)
{
ssize_t nread;
int nread;
size_t already_read = 0, remaining = total_size;
char *tmp_ptr;
if(!total_size) return;
while (already_read < total_size) {
nread = recv (s, ptr, remaining, 0);
while (total_size && (nread = recv (s, ptr, total_size, 0)) > 0) {
total_size -= nread;
ptr = (char*)ptr + nread;
if (nread == 0) {
close (s);
continue;
}
if (nread <= 0) {
glibtop_error_io ("recv");
return;
}
already_read += nread;
remaining -= nread;
/* (char *) ptr += nread; */
tmp_ptr = ptr;
tmp_ptr += nread;
ptr = tmp_ptr;
}
if(nread == 0)
close (s);
if (nread < 0)
glibtop_error_io ("recv");
}
void
glibtop_read_l (glibtop *server, size_t size, void *buf)
{
int ret = 0;
glibtop_init_r (&server, 0, 0);
#ifdef DEBUG
@@ -59,11 +71,9 @@ glibtop_read_l (glibtop *server, size_t size, void *buf)
if (server->socket) {
do_read (server->socket, buf, size);
} else {
if(read (server->input [0], buf, size) < 0)
glibtop_error_io_r (
server,
ngettext ("read %d byte",
"read %d bytes", size),
size);
ret = read (server->input [0], buf, size);
}
if (ret < 0)
glibtop_error_io_r (server, ngettext ("read %d byte", "read %d bytes", size), size);
}

View File

@@ -42,9 +42,9 @@ glibtop_read_data_l (glibtop *server)
#endif
if (server->socket) {
ret = recv (server->socket, &size, sizeof (size_t), 0);
ret = recv (server->socket, (void *)&size, sizeof (size_t), 0);
} else {
ret = read (server->input [0], &size, sizeof (size_t));
ret = read (server->input [0], (void *)&size, sizeof (size_t));
}
if (ret < 0)

View File

@@ -1,15 +1,7 @@
2004-06-28 Laurent Dhima <laurenti@alblinux.net>
* sq.po: Translation updated.
2004-06-26 John C Barstow <jbowtie@amathaine.com>
* mi.po: Translation added.
2004-05-14 Baris Cicek <baris@teamforce.name.tr>
* tr.po: Updated Turkish Translation
2004-04-16 Iñaki Larrañaga <dooteo@euskalgnu.org>
* eu.po: Added Basque translation.
@@ -37,7 +29,7 @@
2004-03-22 Guntupalli Karunakar <karunakar@freedomink.org>
* pa.po: Punjabi translation by
* pa.po: Punjabi translation by
Amanpreet Singh Alam <amanlinux@netscape.net>.
2004-03-21 Andras Timar <timar@gnome.hu>
@@ -183,7 +175,7 @@
2004-01-02 Sanlig Badral <Badral@openmn.org>
* mn.po: Updated Mongolian translation.
2003-12-14 Francisco Javier F. Serrador <serrador@cvs.gnome.org>
* es.po: Updated Spanish translation.
@@ -243,7 +235,7 @@
2003-10-19 Carlos Perelló Marín <carlos@gnome.org>
* POTFILES.ignore: Removed, we use now POTFILES.skip
2003-10-01 Gustavo Maciel Dias Vieira <gdvieira@zaz.com.br>
* pt_BR.po: Applied revision by Augusta Marques da Silva
@@ -344,19 +336,19 @@
2003-06-04 Paul Duffy <dubhthach@frink.nuigalway.ie>
* ga.po: Updated Irish Translation.
2003-05-25 Abel Cheung <maddog@linux.org.hk>
* he.po: Mark wrong entry as fuzzy (msgfmt check failed).
2003-05-16 Danilo ©egan <dsegan@gmx.net>
* sr.po, sr@Latn.po: Updated Serbian translation by Serbian
* sr.po, sr@Latn.po: Updated Serbian translation by Serbian
team (Prevod.org).
2003-05-10 Danilo Segan <dsegan@gmx.net>
* sr.po, sr@Latn.po: Added Serbian translation by Serbian team
* sr.po, sr@Latn.po: Added Serbian translation by Serbian team
(Prevod.org).
2003-04-20 Abel Cheung <maddog@linux.org.hk>
@@ -436,7 +428,7 @@
2003-01-16 Daniel Yacob <locales@geez.org>
* am.po: Added Amharic translation.
2003-01-16 Pablo Saratxaga <pablo@mandrakesoft.com>
* vi.po: Updated Vietnamese file
@@ -580,7 +572,7 @@
2002-04-23 Kjartan Maraas <kmaraas@gnome.org>
* no.po: Updated Norwegian (bokm?¥l) translation.
2002-04-19 Ole Laursen <olau@hardworking.dk>
* da.po: Updated Danish translation.
@@ -604,7 +596,7 @@
2002-03-25 Duarte Loreto <happyguy_pt@hotmail.com>
* pt.po: Updated Portuguese translation.
* pt.po: Updated Portuguese translation.
2002-03-23 Hasbullah Bin Pit <sebol@ikhlas.com>
@@ -617,7 +609,7 @@
2002-03-06 Kjartan Maraas <kmaraas@gnome.org>
* no.po: Updated Norwegian (bokm?¥l) translation.
2002-03-06 Germ??n Poo-Caama?±o <gpoo@ubiobio.cl>
* es.po: Fixed spanish translation encoding.
@@ -638,7 +630,7 @@
2002-02-12 Kjartan Maraas <kmaraas@gnome.org>
* no.po: Updated Norwegian (bokm?¥l) translation.
2002-02-09 Abel Cheung <maddog@linux.org.hk>
* zh_TW.po: Updated traditional Chinese translation.
@@ -681,7 +673,7 @@
2001-07-16 Kjartan Maraas <kmaraas@gnome.org>
* nn.po: Added Norwegian (nynorsk) translation.
2001-03-25 Fatih Demir <kabalak@gtranslator.org>
* tr.po: %100'ification.
@@ -771,11 +763,11 @@
2000-09-19 Christian Meyer <linux@chrisime.de>
* de.po: Minor fix.
2000-09-19 Christian Meyer <linux@chrisime.de>
* de.po: Updated German translation.
2000-09-10 Christian Meyer <linux@chrisime.de>
* de.po: Updated German translation.
@@ -785,7 +777,7 @@
2000-08-16 Kjartan Maraas <kmaraas@gnome.org>
* no.po: Updated Norwegian translation.
2000-06-25 Takayuki KUSANO <AE5T-KSN@asahi-net.or.jp>
* ja.po: Updated Japanese translation.
@@ -809,7 +801,7 @@
2000-05-17 Kjartan Maraas <kmaraas@online.no>
* no.po: Updated translation.
2000-05-16 Kenneth Christiansen <kenneth@gnome.org>
* POTFILES.in: New strings added
@@ -864,7 +856,7 @@
1999-07-11 Kjartan Maraas <kmaraas@online.no>
* no.po: Updated translation.
1999-07-11 Tomas Ogren <stric@ing.umu.se>
* sv.po: New file
@@ -872,7 +864,7 @@
1999-01-27 Kjartan Maraas <kmaraas@fib.hl.no>
* no.po: Updated translation
1998-12-22 Yukihiro Nakai <Nakai@TokyoNet.AD.JP>
* ja.po: New file - added Japanese translation
@@ -884,7 +876,7 @@
1998-10-11 Kjartan Maraas <kmaraas@fib.hl.no>
* no.po: New file - added norwegian translation.
1998-10-07 Martin Baulig <martin@home-of-linux.org>
* de.po: New file - added german translation.

View File

@@ -37,10 +37,9 @@ msgstr "Nice"
msgid "Sys"
msgstr "Sys"
#. GRUT modified this item
#: examples/smp.c:77
msgid "Idle"
msgstr "Joaktiv"
msgstr "Jo në përdorim"
#: examples/smp.c:79
#, c-format
@@ -402,10 +401,9 @@ msgstr "Madhësia e segmentit të mesazhit"
msgid "Number of system message headers"
msgstr "Numri i headers të mesazheve të sistemit"
#. GRUT modified this item
#: sysdeps/names/netload.c:46 sysdeps/names/netload.c:64
msgid "Interface Flags"
msgstr "Flag-et e interfaqes"
msgstr "Flag e interfaqes"
#: sysdeps/names/netload.c:47
msgid "MTU"
@@ -1250,10 +1248,9 @@ msgstr "Argumentet e rreshtit të komandës së proçesit"
msgid "List of currently mounted filesystems"
msgstr "Lista e file sistemeve aktualisht të montuar"
#. GRUT modified this item
#: sysdeps/names/uptime.c:39
msgid "Uptime"
msgstr "Kohëzgjatja"
msgstr "Uptime"
#: sysdeps/names/uptime.c:40
msgid "Idletime"
@@ -1398,4 +1395,3 @@ msgstr "Sinjal 1 i përcaktuar nga përdoruesi"
#: sysdeps/osf1/siglist.c:58 sysdeps/sun4/siglist.c:58
msgid "User defined signal 2"
msgstr "Sinjal 2 i përcaktuar nga përdoruesi"

View File

@@ -75,7 +75,7 @@
* gnuserv.c (program_invocation_*_name): Declare this as `extern'
if necessary.
1998-12-17 Martin Baulig <baulig@merkur.uni-trier.de>
* gnuserv.c: Don't include <gnome-argp.h>.

View File

@@ -1,5 +1,5 @@
glibtop_map_entry|ulong(flags,start,end,offset,perm,inode,device):string(filename)
glibtop_mountentry|ulong(dev):string(devname,mountdir,type)
glibtop_interface|ulong(flags,if_flags,transport,type,number,instance,num_logical):string(name)
glibtop_sysdeps|ulong(features,pointer_size,cpu,mem,swap,uptime,loadavg,shm_limits,msg_limits,sem_limits,proclist,proc_state,proc_uid,proc_mem,proc_time,proc_signal,proc_kernel,proc_segment,proc_args,proc_map,mountlist,fsusage,interface_names,netload,ppp)
glibtop_sysdeps|ulong(features,pointer_size,cpu,mem,swap,uptime,loadavg,shm_limits,msg_limits,sem_limits,proclist,proc_state,proc_uid,proc_mem,proc_time,proc_signal,proc_kernel,proc_segment,proc_args,proc_map,mountlist,fsusage,interface_names,netinfo,netload,ppp)
glibtop_ifaddr|ulong(flags,transport):ushort(addr_len,address[GLIBTOP_IFADDR_LEN]):ulong(subnet,scope)

View File

@@ -15,7 +15,7 @@
2004-03-09 Bastien Nocera <hadess@hadess.net>
* procargs.c: (glibtop_get_proc_args_s): fix g_malloc usage on non-Linux
platforms (patch by Benoît Dejean <bnet@ifrance.com>)
platforms (patch by Benoit Dejean <bnet@ifrance.com>)
2003-10-21 Bastien Nocera <hadess@hadess.net>

View File

@@ -1,29 +1,14 @@
2004-07-07 Benoît Dejean <tazforever@dlfp.org>
* Makefile.am:
* procargs.c: (split_args0), (glibtop_get_proc_argv_l),
(glibtop_get_proc_argv_p), (glibtop_get_proc_argv_s): Added file to
repository. Provides glibtop_get_proc_argv*() for system dependant
glibtop_get_proc_args*().
2004-06-18 Benoît Dejean <tazforever@dlfp.org>
* error.c: (print_server_name), (glibtop_error_r),
(glibtop_warn_r), (glibtop_error_io_r), (glibtop_warn_io_r),
(glibtop_error), (glibtop_warn), (glibtop_error_io),
(glibtop_warn_io): These functions are now globally defined.
2004-06-12 Benoît Dejean <tazforever@dlfp.org>
* Makefile.am:
* fsusage-frontend.c:
* fsusage.h: Removed files.
* fsusage.c: (glibtop_get_fsusage_s), (statfs): Merged and cleaned.
* fsusage.c: (glibtop_get_fsusage_s), (statfs): Merged and cleaned.
2004-06-12 Benoît Dejean <tazforever@dlfp.org>
* mountlist.c: (xatoi) Removed, replaced by ISO strtoull.
* mountlist.c: (xatoi) Removed, replaced by ISO strtoull.
(fstype_to_string): Cleaned.
(read_filesystem_list) : Changed prototype. Cleaned and secured.
Replaced broken free by g_free.

View File

@@ -16,7 +16,6 @@ noinst_LTLIBRARIES = libgtop_common-2.0.la libgtop_suid_common-2.0.la
libgtop_common_2_0_la_SOURCES = error.c gnuslib.c \
fsusage.c \
mountlist.c mountlist.h \
procargs.c \
$(inodedb_SRCLIST)
libgtop_common_2_0_la_LDFLAGS = $(LT_VERSION_INFO)

View File

@@ -28,7 +28,7 @@
/* Prints error message and exits. */
static void
print_server_name (const glibtop *server)
print_server_name (glibtop *server)
{
fprintf (stderr, "%s: ", server ?
(server->name ? server->name : DEFAULT_NAME)
@@ -86,85 +86,3 @@ glibtop_warn_io_vr (glibtop *server, char *format, int error, va_list args)
abort ();
#endif
}
void G_GNUC_UNUSED
glibtop_error_r (glibtop *server, char *format, ...)
{
va_list args;
va_start (args, format);
glibtop_error_vr (server, format, args);
va_end (args);
}
void G_GNUC_UNUSED
glibtop_warn_r (glibtop *server, char *format, ...)
{
va_list args;
va_start (args, format);
glibtop_warn_vr (server, format, args);
va_end (args);
}
void G_GNUC_UNUSED
glibtop_error_io_r (glibtop *server, char *format, ...)
{
va_list args;
va_start (args, format);
glibtop_error_io_vr (server, format, errno, args);
va_end (args);
}
void G_GNUC_UNUSED
glibtop_warn_io_r (glibtop *server, char *format, ...)
{
va_list args;
va_start (args, format);
glibtop_warn_io_vr (server, format, errno, args);
va_end (args);
}
#ifndef __GNUC__
void
glibtop_error (char *format, ...)
{
va_list args;
va_start (args, format);
glibtop_error_vr (glibtop_global_server, format, args);
va_end (args);
}
void
glibtop_warn (char *format, ...)
{
va_list args;
va_start (args, format);
glibtop_warn_vr (glibtop_global_server, format, args);
va_end (args);
}
void
glibtop_error_io (char *format, ...)
{
va_list args;
va_start (args, format);
glibtop_error_io_vr (glibtop_global_server, format, errno, args);
va_end (args);
}
void
glibtop_warn_io (char *format, ...)
{
va_list args;
va_start (args, format);
glibtop_warn_io_vr (glibtop_global_server, format, errno, args);
va_end (args);
}
#endif /* __GNUC__ */

View File

@@ -0,0 +1,67 @@
/* fsusage-frontend.c -- return space usage of mounted filesystems.
Copyright (C) 2003 Ole Laursen.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* This code is simply a front-end for the actual code in fsusage.[ch] which
is stolen directly from the GNU Coreutils package. */
#if HAVE_CONFIG_H
# include <config.h>
#endif
#if HAVE_CONFIG_H
# include <config.h>
#endif
#if HAVE_INTTYPES_H
# include <inttypes.h>
#else
# if HAVE_STDINT_H
# include <stdint.h>
# endif
#endif
#ifndef UINTMAX_MAX
# define UINTMAX_MAX ((uintmax_t) -1)
#endif
#include "fsusage.h"
#include <glibtop.h>
#include <glibtop/error.h>
#include <glibtop/fsusage.h>
void
glibtop_get_fsusage_s (glibtop *server, glibtop_fsusage *buf,
const char *disk)
{
struct fs_usage fsp;
glibtop_init_r (&server, 0, 0);
memset (buf, 0, sizeof (glibtop_fsusage));
memset (&fsp, 0, sizeof (struct fs_usage));
if (glibtop_private_get_fs_usage (disk, disk, &fsp) != 0)
return;
buf->blocks = fsp.fsu_blocks;
buf->bfree = fsp.fsu_bfree;
buf->bavail = fsp.fsu_bavail;
buf->files = fsp.fsu_files;
buf->ffree = fsp.fsu_ffree;
buf->block_size = fsp.fsu_blocksize;
}

47
sysdeps/common/fsusage.h Normal file
View File

@@ -0,0 +1,47 @@
/* fsusage.h -- declarations for filesystem space usage info
Copyright (C) 1991, 1992, 1997 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Space usage statistics for a filesystem. Blocks are 512-byte. */
#include <glib.h>
#if !defined FSUSAGE_H_
# define FSUSAGE_H_
struct fs_usage
{
int fsu_blocksize; /* Size of a block. */
guint64 fsu_blocks; /* Total blocks. */
guint64 fsu_bfree; /* Free blocks available to superuser. */
guint64 fsu_bavail; /* Free blocks available to non-superuser. */
int fsu_bavail_top_bit_set; /* 1 if fsu_bavail represents a value < 0. */
guint64 fsu_files; /* Total file nodes. */
guint64 fsu_ffree; /* Free file nodes. */
};
# ifndef PARAMS
# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
# endif
int glibtop_private_get_fs_usage PARAMS ((const char *path, const char *disk,
struct fs_usage *fsp));
#endif

View File

@@ -1,12 +1,12 @@
2004-06-07 Benoît Dejean <tazforever@dlfp.org>
* netload.c: (glibtop_get_netload_p):
* procstate.c: (glibtop_get_proc_state_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-05-26 Benoît Dejean <tazforever@dlfp.org>
@@ -40,7 +40,7 @@
* procargs.c: (glibtop_get_proc_args_p):
* procmap.c: (glibtop_get_proc_map_p):
* swap.c: (glibtop_get_swap_p): fix g_malloc usage on non-Linux
platforms (patch by Benoît Dejean <bnet@ifrance.com>)
platforms (patch by Benoit Dejean <bnet@ifrance.com>)
2003-10-21 Bastien Nocera <hadess@hadess.net>
@@ -126,10 +126,10 @@
Tue Jun 15 16:04:10 1999 Timur Bakeyev <mc@bat.ru>
* procuid.c: A fix to a ommitted case, when nor NetBSD, nor
* procuid.c: A fix to a ommitted case, when nor NetBSD, nor
LibGTop >= 1.1.0. This should be investigated closely to cover
more cases....
1999-05-26 Martin Baulig <martin@home-of-linux.org>
More NetBSD 1.4 fixes.
@@ -140,7 +140,7 @@ Tue Jun 15 16:04:10 1999 Timur Bakeyev <mc@bat.ru>
this needs to be tested; I made it conditional to NetBSD 1.4 at
the moment. Please extend the conditionals to any other systems
where this works ...]
* procstate.c: Added `ruid' and `rgid' for LibGTop >= 1.1.0.
* procuid.c: Added `ngroups' and `groups' for LibGTop >= 1.1.0.
@@ -153,7 +153,7 @@ 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-03-19 Martin Baulig <martin@home-of-linux.org>
@@ -191,7 +191,7 @@ Thu Apr 8 23:47:29 1999 Timur Bakeyev <timur@gnu.org>
* prockernel.c, proctime.c: Applied patch from the FreeBSD 2.2.8
ports collection.
* procsignal.c: Applied patch from the NetBSD-current ports
collection.
@@ -206,7 +206,7 @@ Thu Apr 8 23:47:29 1999 Timur Bakeyev <timur@gnu.org>
1998-11-17 Martin Baulig <martin@home-of-linux.org>
* Make it work with FreeBSD 3.0.
1998-11-11 Martin Baulig <martin@home-of-linux.org>
* *.c: It does not work to get information about the swapper task
@@ -240,7 +240,7 @@ Thu Apr 8 23:47:29 1999 Timur Bakeyev <timur@gnu.org>
* procstate.c (glibtop_get_procstate_s): Use correct values for
the `state' field.
* proclist.c (glibtop_get_proclist_p): Honor the GLIBTOP_EXCLUDE_IDLE
and GLIBTOP_EXCLUDE_SYSTEM flags of the `which' parameter.

View File

@@ -11,13 +11,13 @@
* sem_limits.c:
* shm_limits.c:
* swap.c: Added missing const qualifiers.
* uptime.c: (glibtop_get_uptime_s): Cleaned up. Added boot_time.
2004-03-09 Bastien Nocera <hadess@hadess.net>
* proclist.c: (glibtop_get_proclist_s): fix g_malloc usage on non-Linux
platforms (patch by Benoît Dejean <bnet@ifrance.com>)
platforms (patch by Benoit Dejean <bnet@ifrance.com>)
2003-10-21 Bastien Nocera <hadess@hadess.net>

View File

@@ -1,48 +1,3 @@
2004-07-07 Benoît Dejean <tazforever@dlfp.org>
* procargs.c: (glibtop_get_proc_args_s): Fixed. error is now correctly
set to NULL before is's used. Fixed max_len behaviour.
2004-07-03 Benoît Dejean <tazforever@dlfp.org>
* sysinfo.c: (init_sysinfo): Removed useless memset.
2004-07-03 Benoît Dejean <tazforever@dlfp.org>
* glibtop_server.h:
* glibtop_server.c: (try_file_to_buffer), (file_to_buffer): Added. These
functions are commonly used. Misc cleanups.
* cpu.c: (glibtop_get_cpu_s):
* loadavg.c: (glibtop_get_loadavg_s):
* mem.c: (glibtop_get_mem_s):
* open.c: (glibtop_open_s):
* swap.c: (glibtop_get_swap_s):
* sysinfo.c: (init_sysinfo):
* uptime.c: (glibtop_get_uptime_s): Replaced open/read/close by file_to_buffer().
2004-06-18 Benoît Dejean <tazforever@dlfp.org>
* loadavg.c: (glibtop_get_loadavg_s): Whitespace cleanup.
* ppp.c: (get_ISDN_stats), (is_ISDN_on): Replace g_malloc by an
array.
* glibtop_server.c: (get_pageshift):
* glibtop_server.h:
* procmem.c: (glibtop_init_proc_mem_s), (glibtop_get_proc_mem_s):
* procsegment.c: (glibtop_init_proc_segment_s),
(glibtop_get_proc_segment_s): Moved the pageshift calculation to
glibtop_server.[ch]
* procstate.c: (glibtop_get_proc_state_s):
* procuid.c: (glibtop_get_proc_uid_s):
* sysinfo.c: (init_sysinfo): Minor cleanups.
2004-06-18 Benoît Dejean <tazforever@dlfp.org>
* netload.c: (glibtop_get_netload_s): Implemented new IPv6 feature.
2004-06-13 Benoît Dejean <tazforever@dlfp.org>
* procargs.c: (glibtop_get_proc_args_s): Replaced by g_file_get_contents.
@@ -51,8 +6,8 @@
* glibtop_server.h:
* glibtop_server.c: (get_scaled): Cleaned.
(proc_file_to_buffer): Uninlined.
(proc_file_to_buffer): Uninlined.
* sysinfo.c: (init_sysinfo): Re-implemented.
Fixed segfault on SMP.
Stores keys in cpuinfo->labels.
@@ -61,21 +16,21 @@
* Makefile.am:
* glibtop_server.c: Added to repository.
* glibtop_server.h: (get_scaled): Uninlined and moved it to glibtop_server.c.
(skip_token) : Fixed indentation.
(skip_token) : Fixed indentation.
* procmap.c: (glibtop_get_proc_map_s): Big cleanup. Better allocation
algorithm.
* procmem.c:
* procsegment.c: Added missing initializations.
* sem_limits.c:
* shm_limits.c: (glibtop_get_shm_limits_s):
* swap.c:
* uptime.c: Added missing const qualifiers.
* sysinfo.c: (init_sysinfo): Added missing 0 initialization.
Saved 1 gboolean :D.
@@ -108,7 +63,7 @@
* glibtop_server.h:
* open.c:
* procuid.c: Moved LINUX_VERSION macro to glibtop_server.h.
* Changelog: Converted to UTF-8.
2004-05-19 Benoît Dejean <TazForEver@dlfp.org>
@@ -132,7 +87,7 @@
the file (Closes: #126504)
2004-02-02 Sebastien Bacher <seb128@debian.org>
* sysdeps/linux/mem.c: (glibtop_get_mem_s): patch from
Benoît Dejean <bnet@ifrance.com> to fix libtop_mem.used
and glibtop_mem.shared values (Closes: #129863).
@@ -279,7 +234,7 @@
* netload.c (glibtop_get_netload_s): Added implementation
for this function.
The code here is smart enough to use /proc/net/ip_acct if
IP accounting is enabled in the kernel and activated on the
requested device and /proc/net/dev if not.

View File

@@ -54,13 +54,24 @@ void
glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf)
{
char buffer [BUFSIZ], *p;
int fd, len;
int i;
glibtop_init_s (&server, GLIBTOP_SYSDEPS_CPU, 0);
memset (buf, 0, sizeof (glibtop_cpu));
file_to_buffer(server, buffer, FILENAME);
fd = open (FILENAME, O_RDONLY);
if (fd < 0)
glibtop_error_io_r (server, "open (%s)", FILENAME);
len = read (fd, buffer, BUFSIZ-1);
if (len < 0)
glibtop_error_io_r (server, "read (%s)", FILENAME);
close (fd);
buffer [len] = '\0';
/*
* GLOBAL

View File

@@ -1,17 +1,12 @@
#include <glibtop.h>
#include <glibtop/error.h>
#include <glib.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <fcntl.h>
/* gcc warning bug */
unsigned get_pageshift();
unsigned long long
get_scaled(const char *buffer, const char *key)
@@ -33,73 +28,25 @@ get_scaled(const char *buffer, const char *key)
}
/*
* Read functions
*/
enum TRY_FILE_TO_BUFFER
int
proc_file_to_buffer (char *buffer, const char *fmt, pid_t pid)
{
TRY_FILE_TO_BUFFER_OK = 0,
TRY_FILE_TO_BUFFER_OPEN = -1,
TRY_FILE_TO_BUFFER_READ = -2
};
int try_file_to_buffer(char *buffer, const char *format, ...)
{
char path[4096];
char filename [256];
int fd;
ssize_t len;
va_list pa;
va_start(pa, format);
g_snprintf (filename, sizeof filename, fmt, pid);
/* C99 also provides vsnprintf */
g_vsnprintf(path, sizeof path, format, pa);
va_end(pa);
if((fd = open (path, O_RDONLY)) < 0)
return TRY_FILE_TO_BUFFER_OPEN;
fd = open (filename, O_RDONLY);
if (fd < 0) return -1;
len = read (fd, buffer, BUFSIZ-1);
close (fd);
if (len < 0)
return TRY_FILE_TO_BUFFER_READ;
if (len < 0) return -1;
buffer [len] = '\0';
return TRY_FILE_TO_BUFFER_OK;
return 0;
}
void
file_to_buffer(glibtop *server, char *buffer, const char *filename)
{
switch(try_file_to_buffer(buffer, filename))
{
case TRY_FILE_TO_BUFFER_OPEN:
glibtop_error_io_r (server, "open (%s)", filename);
case TRY_FILE_TO_BUFFER_READ:
glibtop_error_io_r (server, "read (%s)", filename);
}
}
#warning "Ignore the following warning"
unsigned get_pageshift()
{
static unsigned pageshift = 0;
if(G_UNLIKELY(!pageshift))
{
register unsigned pagesize = getpagesize();
while( pagesize > 1 )
{
pagesize >>= 1;
pageshift++;
}
}
return pageshift;
}

View File

@@ -21,16 +21,12 @@
Boston, MA 02111-1307, USA.
*/
#ifndef __LINUX__GLIBTOP_SERVER_H__
#define __LINUX__GLIBTOP_SERVER_H__
#ifndef __GLIBTOP_SERVER_H__
#define __GLIBTOP_SERVER_H__
#include <glibtop.h>
#include <glib.h>
#include <fcntl.h>
#include <ctype.h>
#include <string.h>
G_BEGIN_DECLS
@@ -38,10 +34,6 @@ G_BEGIN_DECLS
#define LINUX_VERSION(x,y,z) (0x10000*(x) + 0x100*(y) + z)
unsigned get_pageshift();
static inline char *
skip_token (const char *p)
{
@@ -59,7 +51,6 @@ skip_multiple_token (const char *p, size_t count)
return (char *)p;
}
static inline char *
skip_line (const char *p)
{
@@ -67,29 +58,12 @@ skip_line (const char *p)
return (char *) (*p ? p+1 : p);
}
unsigned long long
get_scaled(const char *buffer, const char *key);
/* aborts on error */
void
file_to_buffer(glibtop *server, char *buffer, const char *filename);
/* return < 0 on error, otherwise 0 on success */
int
try_file_to_buffer(char *buffer, const char *format, ...);
/* some inline functions that wrap proc path
* as fast as macros :)
*/
static inline int
proc_file_to_buffer (char *buffer, const char *fmt, pid_t pid)
{
return try_file_to_buffer(buffer, fmt, pid);
}
proc_file_to_buffer (char *buffer, const char *fmt, pid_t pid);
static inline int
proc_stat_to_buffer (char *buffer, pid_t pid)
@@ -109,13 +83,13 @@ proc_statm_to_buffer (char *buffer, pid_t pid)
return proc_file_to_buffer (buffer, "/proc/%d/statm", pid);
}
static inline char *
proc_stat_after_cmd (char *p)
{
p = strrchr (p, ')');
if (G_LIKELY(p))
*p++ = '\0';
if (!p) return p;
*p++ = '\0';
return p;
}
@@ -144,4 +118,4 @@ proc_stat_after_cmd (char *p)
G_END_DECLS
#endif /* __LINUX__GLIBTOP_SERVER_H__ */
#endif

View File

@@ -49,12 +49,23 @@ void
glibtop_get_loadavg_s (glibtop *server, glibtop_loadavg *buf)
{
char buffer [BUFSIZ], *p, *old;
int fd, len;
glibtop_init_s (&server, GLIBTOP_SYSDEPS_LOADAVG, 0);
memset (buf, 0, sizeof (glibtop_loadavg));
file_to_buffer(server, buffer, FILENAME);
fd = open (FILENAME, O_RDONLY);
if (fd < 0)
glibtop_error_io_r (server, "open (%s)", FILENAME);
len = read (fd, buffer, BUFSIZ-1);
if (len < 0)
glibtop_error_io_r (server, "read (%s)", FILENAME);
close (fd);
buffer [len] = '\0';
buf->loadavg [0] = strtod (buffer, &p);
buf->loadavg [1] = strtod (p, &p);
@@ -62,12 +73,12 @@ glibtop_get_loadavg_s (glibtop *server, glibtop_loadavg *buf)
buf->flags = _glibtop_sysdeps_loadavg;
while (isspace(*p)) p++;
while (isspace(*p)) p++;
/* Older Linux versions don't have the nr_running/nr_tasks fields. */
old = p;
while (*p) {
while (*p) {
if (*p == '/')
break;
if (!isdigit (*p))

View File

@@ -47,10 +47,23 @@ void
glibtop_get_mem_s (glibtop *server, glibtop_mem *buf)
{
char buffer [BUFSIZ];
int fd, len;
glibtop_init_s (&server, GLIBTOP_SYSDEPS_MEM, 0);
file_to_buffer(server, buffer, FILENAME);
memset (buf, 0, sizeof (glibtop_mem));
fd = open (FILENAME, O_RDONLY);
if (fd < 0)
glibtop_error_io_r (server, "open (%s)", FILENAME);
len = read (fd, buffer, BUFSIZ-1);
if (len < 0)
glibtop_error_io_r (server, "read (%s)", FILENAME);
close (fd);
buffer [len] = '\0';
buf->total = get_scaled(buffer, "MemTotal:");
buf->free = get_scaled(buffer, "MemFree:");
@@ -59,6 +72,6 @@ glibtop_get_mem_s (glibtop *server, glibtop_mem *buf)
buf->buffer = get_scaled(buffer, "Buffers:");
buf->cached = get_scaled(buffer, "Cached:");
buf->user = buf->total - buf->free - buf->cached - buf->buffer;
buf->flags = _glibtop_sysdeps_mem;
buf->user = buf->total - buf->free - buf->cached - buf->buffer;
buf->flags = _glibtop_sysdeps_mem;
}

View File

@@ -47,17 +47,6 @@
#include <linux/udp.h>
#endif
/* IPV6 */
#include <ifaddrs.h>
#ifndef IN6_IS_ADDR_GLOBAL
#define IN6_IS_ADDR_GLOBAL(a) \
(((((__const uint8_t *) (a))[0] & 0xff) == 0x3f \
|| (((__const uint8_t *) (a))[0] & 0xff) == 0x20))
#endif
/* IPV6 */
#define _GLIBTOP_IP_FW_ACCTIN 0x1000 /* Account incoming packets only. */
#define _GLIBTOP_IP_FW_ACCTOUT 0x2000 /* Account outgoing packets only. */
@@ -97,11 +86,6 @@ static const unsigned long _glibtop_sysdeps_netload_out =
(1L << GLIBTOP_NETLOAD_PACKETS_OUT) +
(1L << GLIBTOP_NETLOAD_BYTES_OUT);
static const unsigned long _glibtop_sysdeps_netload_6 =
(1L << GLIBTOP_NETLOAD_ADDRESS6) +
(1L << GLIBTOP_NETLOAD_PREFIX6) +
(1L << GLIBTOP_NETLOAD_SCOPE6);
/* Init function. */
void
@@ -330,8 +314,6 @@ glibtop_get_netload_s (glibtop *server, glibtop_netload *buf,
if (strcmp (dev, interface))
continue;
/* Ok, we've found the interface */
/* Only read byte counts if we really have them. */
if (have_bytes) {
@@ -366,56 +348,7 @@ glibtop_get_netload_s (glibtop *server, glibtop_netload *buf,
if (have_bytes)
buf->flags |= _glibtop_sysdeps_netload_bytes;
break; /* finished */
}
fclose (f);
/* IPv6 */
{
struct ifaddrs *ifa0, *ifr6;
getifaddrs (&ifa0);
for (ifr6 = ifa0; ifr6; ifr6 = ifr6->ifa_next) {
if (strcmp (ifr6->ifa_name, interface) == 0
&& ifr6->ifa_addr->sa_family == AF_INET6)
break;
}
if(!ifr6) return;
memcpy(buf->address6,
&((struct sockaddr_in6 *) ifr6->ifa_addr)->sin6_addr,
16);
memcpy(buf->prefix6,
&((struct sockaddr_in6 *) ifr6->ifa_netmask)->sin6_addr,
16);
if (IN6_IS_ADDR_LINKLOCAL (buf->address6))
buf->scope6 = GLIBTOP_IF_IN6_SCOPE_LINK;
else if (IN6_IS_ADDR_SITELOCAL (buf->address6))
buf->scope6 = GLIBTOP_IF_IN6_SCOPE_SITE;
else if (IN6_IS_ADDR_GLOBAL (buf->address6)
|| IN6_IS_ADDR_MC_ORGLOCAL (buf->address6)
|| IN6_IS_ADDR_V4COMPAT (buf->address6)
|| IN6_IS_ADDR_MULTICAST (buf->address6)
|| IN6_IS_ADDR_UNSPECIFIED (buf->address6)
)
buf->scope6 = GLIBTOP_IF_IN6_SCOPE_GLOBAL;
else if (IN6_IS_ADDR_LOOPBACK (buf->address6))
buf->scope6 = GLIBTOP_IF_IN6_SCOPE_HOST;
else
buf->scope6 = GLIBTOP_IF_IN6_SCOPE_UNKNOWN;
buf->flags |= _glibtop_sysdeps_netload_6;
} /* IPV6 */
}

View File

@@ -66,12 +66,23 @@ glibtop_open_s (glibtop *server, const char *program_name,
const unsigned flags)
{
char buffer [BUFSIZ], *p = buffer;
int fd, len;
server->name = program_name;
server->os_version_code = get_linux_version();
file_to_buffer(server, buffer, FILENAME);
fd = open (FILENAME, O_RDONLY);
if (fd < 0)
glibtop_error_io_r (server, "open (%s)", FILENAME);
len = read (fd, buffer, BUFSIZ-1);
if (len < 0)
glibtop_error_io_r (server, "read (%s)", FILENAME);
close (fd);
buffer [len] = '\0';
for (server->ncpu = 0; server->ncpu < GLIBTOP_NCPU; server->ncpu++) {

View File

@@ -52,35 +52,40 @@ glibtop_init_ppp_s (glibtop *server)
server->sysdeps.ppp = _glibtop_sysdeps_ppp;
}
static gboolean
static int
get_ISDN_stats (glibtop *server, int *in, int *out)
{
unsigned long isdn_stats[2 * ISDN_MAX_CHANNELS], *ptr;
int fd;
unsigned long *isdn_stats, *ptr;
int fd, i;
*in = *out = 0;
isdn_stats = g_malloc (ISDN_MAX_CHANNELS * 2 * sizeof (unsigned long));
fd = open ("/dev/isdninfo", O_RDONLY);
if (fd < 0) {
g_free (isdn_stats);
return FALSE;
}
if ((ioctl (fd, IIOCGETCPS, isdn_stats) < 0) && (errno != 0)) {
close(fd);
g_free (isdn_stats);
close (fd);
return FALSE;
}
for (ptr = isdn_stats;
ptr != (isdn_stats + G_N_ELEMENTS(isdn_stats));
/* NOOP */) {
for (i = 0, ptr = isdn_stats; i < ISDN_MAX_CHANNELS; i++) {
*in += *ptr++; *out += *ptr++;
}
g_free (isdn_stats);
close (fd);
return TRUE;
}
static gboolean is_ISDN_on (glibtop *server, int *online)
static int is_ISDN_on (glibtop *server, int *online)
{
FILE *f = 0;
char buffer [BUFSIZ], *p;

View File

@@ -42,11 +42,11 @@ char *
glibtop_get_proc_args_s (glibtop *server, glibtop_proc_args *buf,
pid_t pid, unsigned max_len)
{
char filename[48]; /* magiv */
char filename[48];
char *args;
gsize length;
GError *error = NULL;
GError *error;
glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_ARGS, 0);
@@ -55,14 +55,13 @@ glibtop_get_proc_args_s (glibtop *server, glibtop_proc_args *buf,
sprintf (filename, "/proc/%d/cmdline", pid);
if(!g_file_get_contents(filename, &args, &length, &error)) {
g_error_free(error);
buf->size = 0;
return NULL;
}
if(max_len && max_len < length) {
args = g_realloc(args, max_len);
args[max_len - 1] = '\0';
args = g_realloc(args, max_len+1);
args[max_len] = '\0';
length = max_len;
}

View File

@@ -33,14 +33,34 @@ static const unsigned long _glibtop_sysdeps_proc_mem_statm =
(1L << GLIBTOP_PROC_MEM_SIZE) + (1L << GLIBTOP_PROC_MEM_RESIDENT) +
(1L << GLIBTOP_PROC_MEM_SHARE);
#ifndef LOG1024
#define LOG1024 10
#endif
/* these are for getting the memory statistics */
static int pageshift = 0; /* log base 2 of the pagesize */
/* define pagetok in terms of pageshift */
#define pagetok(size) ((size) << pageshift)
/* Init function. */
void
glibtop_init_proc_mem_s (glibtop *server)
{
register int pagesize;
server->sysdeps.proc_mem = _glibtop_sysdeps_proc_mem |
_glibtop_sysdeps_proc_mem_statm;
/* get the page size with "getpagesize" and calculate pageshift
* from it */
pagesize = getpagesize ();
pageshift = 0;
while (pagesize > 1) {
pageshift++;
pagesize >>= 1;
}
}
/* Provides detailed information about a process. */
@@ -49,7 +69,6 @@ void
glibtop_get_proc_mem_s (glibtop *server, glibtop_proc_mem *buf, pid_t pid)
{
char buffer [BUFSIZ], *p;
const unsigned pageshift = get_pageshift();
glibtop_init_s (&server, GLIBTOP_SYSDEPS_MEM, 0);

View File

@@ -37,13 +37,34 @@ static const unsigned long _glibtop_sysdeps_proc_segment_statm =
(1L << GLIBTOP_PROC_SEGMENT_DATA_RSS) +
(1L << GLIBTOP_PROC_SEGMENT_DIRTY_SIZE);
#ifndef LOG1024
#define LOG1024 10
#endif
/* these are for getting the memory statistics */
static int pageshift = 0; /* log base 2 of the pagesize */
/* define pagetok in terms of pageshift */
#define pagetok(size) ((size) << pageshift)
/* Init function. */
void
glibtop_init_proc_segment_s (glibtop *server)
{
register int pagesize;
server->sysdeps.proc_segment = _glibtop_sysdeps_proc_segment |
_glibtop_sysdeps_proc_segment_statm;
/* get the page size with "getpagesize" and calculate pageshift
* from it */
pagesize = getpagesize ();
pageshift = 0;
while (pagesize > 1) {
pageshift++;
pagesize >>= 1;
}
}
/* Provides detailed information about a process. */
@@ -53,7 +74,6 @@ glibtop_get_proc_segment_s (glibtop *server, glibtop_proc_segment *buf,
pid_t pid)
{
char buffer [BUFSIZ], *p;
const unsigned pageshift = get_pageshift();
glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_SEGMENT, 0);

View File

@@ -83,7 +83,7 @@ glibtop_get_proc_state_s (glibtop *server, glibtop_proc_state *buf, pid_t pid)
buf->state = p [2];
p = skip_token (buffer); p++; /* pid */
if (G_UNLIKELY(*p++ != '('))
if (*p++ != '(')
glibtop_error_r (server, "Bad data in /proc/%d/stat", pid);
g_strlcpy (buf->cmd, p, sizeof buf->cmd);

View File

@@ -117,7 +117,7 @@ glibtop_get_proc_uid_s (glibtop *server, glibtop_proc_uid *buf, pid_t pid)
buf->priority = 2*15 - buf->priority;
buf->nice = 15 - buf->nice;
}
else if (server->os_version_code < LINUX_VERSION(1,1,30) && buf->tty != -1)
if (server->os_version_code < LINUX_VERSION(1,1,30) && buf->tty != -1)
/* when tty wasn't full devno */
buf->tty = 4*0x100 + buf->tty;

View File

@@ -52,12 +52,23 @@ void
glibtop_get_swap_s (glibtop *server, glibtop_swap *buf)
{
char buffer [BUFSIZ], *p;
int fd, len;
glibtop_init_s (&server, GLIBTOP_SYSDEPS_SWAP, 0);
memset (buf, 0, sizeof (glibtop_swap));
file_to_buffer(server, buffer, MEMINFO);
fd = open (MEMINFO, O_RDONLY);
if (fd < 0)
glibtop_error_io_r (server, "open (%s)", MEMINFO);
len = read (fd, buffer, BUFSIZ-1);
if (len < 0)
glibtop_error_io_r (server, "read (%s)", MEMINFO);
close (fd);
buffer [len] = '\0';
/* Kernel 2.6 with multiple lines */
@@ -67,7 +78,17 @@ glibtop_get_swap_s (glibtop *server, glibtop_swap *buf)
buf->flags = _glibtop_sysdeps_swap;
file_to_buffer(server, buffer, PROC_STAT);
fd = open (PROC_STAT, O_RDONLY);
if (fd < 0)
glibtop_error_io_r (server, "open (%s)", PROC_STAT);
len = read (fd, buffer, BUFSIZ-1);
if (len < 0)
glibtop_error_io_r (server, "read (%s)", PROC_STAT);
close (fd);
buffer [len] = '\0';
p = strstr (buffer, "\nswap");
if (p == NULL) return;

View File

@@ -36,13 +36,31 @@ static glibtop_sysinfo sysinfo = { .flags = 0 };
static void
init_sysinfo (glibtop *server)
{
int fd;
ssize_t len;
char buffer [BUFSIZ];
if(G_LIKELY(sysinfo.flags)) return;
if(sysinfo.flags) return;
glibtop_init_s (&server, GLIBTOP_SYSDEPS_CPU, 0);
file_to_buffer(server, buffer, FILENAME);
memset (&sysinfo, 0, sizeof (glibtop_sysinfo));
/* load the file */
fd = open (FILENAME, O_RDONLY);
if (fd < 0)
glibtop_error_io_r (server, "open (%s)", FILENAME);
len = read (fd, buffer, BUFSIZ-1);
if (len < 0)
glibtop_error_io_r (server, "read (%s)", FILENAME);
close (fd);
buffer [len] = '\0';
/* cpuinfo records are seperated by a blank line */
gchar ** const processors = g_strsplit(buffer, "\n\n", 0);
@@ -79,7 +97,8 @@ init_sysinfo (glibtop *server)
/* the last key has no value and has not been added */
if(*p) g_free(*p);
if(*p)
g_free(*p);
/* just g_free instead of g_strvfree because we stole
the memory*/

View File

@@ -45,12 +45,23 @@ void
glibtop_get_uptime_s (glibtop *server, glibtop_uptime *buf)
{
char buffer [BUFSIZ], *p;
int fd, len;
glibtop_init_s (&server, GLIBTOP_SYSDEPS_UPTIME, 0);
memset (buf, 0, sizeof (glibtop_uptime));
file_to_buffer(server, buffer, FILENAME);
fd = open (FILENAME, O_RDONLY);
if (fd < 0)
glibtop_error_io_r (server, "open (%s)", FILENAME);
len = read (fd, buffer, BUFSIZ-1);
if (len < 0)
glibtop_error_io_r (server, "read (%s)", FILENAME);
close (fd);
buffer [len] = '\0';
buf->uptime = strtod (buffer, &p);
buf->idletime = strtod (p, &p);

View File

@@ -26,13 +26,13 @@
const char *glibtop_names_fsusage [GLIBTOP_MAX_FSUSAGE] =
{
"blocks", "bfree", "bavail", "files", "ffree", "block_size"
"blocks", "bfree", "bavail", "files", "ffree"
};
const unsigned glibtop_types_fsusage [GLIBTOP_MAX_FSUSAGE] =
{
GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG,
GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_INT
GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG
};
const char *glibtop_labels_fsusage [GLIBTOP_MAX_FSUSAGE] =
@@ -41,8 +41,7 @@ const char *glibtop_labels_fsusage [GLIBTOP_MAX_FSUSAGE] =
N_("Free blocks"),
N_("Available blocks"),
N_("Total file nodes"),
N_("Free file nodes"),
N_("Block size")
N_("Free file nodes")
};
const char *glibtop_descriptions_fsusage [GLIBTOP_MAX_FSUSAGE] =
@@ -51,6 +50,5 @@ const char *glibtop_descriptions_fsusage [GLIBTOP_MAX_FSUSAGE] =
N_("Free blocks available to the superuser"),
N_("Free blocks available to non-superusers"),
N_("Total file nodes"),
N_("Free file nodes"),
N_("Block size")
N_("Free file nodes")
};

56
sysdeps/names/netinfo.c Normal file
View File

@@ -0,0 +1,56 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* $Id$ */
/* Copyright (C) 1998-99 Martin Baulig
This file is part of LibGTop 1.0.
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
LibGTop is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
LibGTop is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with LibGTop; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <glibtop/netinfo.h>
#include "libgtop-i18n.h"
const char *glibtop_names_netinfo[GLIBTOP_MAX_NETINFO] =
{
"if_flags", "transport", "mtu", "subnet", "address"
};
const unsigned glibtop_types_netinfo[GLIBTOP_MAX_NETINFO] =
{
GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG,
GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG
};
const char *glibtop_labels_netinfo[GLIBTOP_MAX_NETINFO] =
{
N_ ("Interface Flags"),
N_ ("Transport Method"),
N_ ("MTU"),
N_ ("Subnet"),
N_ ("Address"),
};
const char *glibtop_descriptions_netinfo[GLIBTOP_MAX_NETINFO] =
{
N_ ("Interface Flags"),
N_ ("Transport Method"),
N_ ("Maximum Transfer Unit"),
N_ ("Subnet"),
N_ ("Address"),
};

View File

@@ -29,7 +29,7 @@ const char *glibtop_names_netload [GLIBTOP_MAX_NETLOAD] =
"if_flags", "mtu", "subnet", "address", "packets_in",
"packets_out", "packets_total", "bytes_in", "bytes_out",
"bytes_total", "errors_in", "errors_out", "errors_total",
"collisions", "address6", "prefix6", "scope6"
"collisions"
};
const unsigned glibtop_types_netload [GLIBTOP_MAX_NETLOAD] =
@@ -45,8 +45,8 @@ const char *glibtop_labels_netload [GLIBTOP_MAX_NETLOAD] =
{
N_("Interface Flags"),
N_("MTU"),
N_("IPv4 Subnet"),
N_("IPv4 Address"),
N_("Subnet"),
N_("Address"),
N_("Packets In"),
N_("Packets Out"),
N_("Packets Total"),
@@ -56,18 +56,15 @@ const char *glibtop_labels_netload [GLIBTOP_MAX_NETLOAD] =
N_("Errors In"),
N_("Errors Out"),
N_("Errors Total"),
N_("Collisions"),
N_("IPv6 Address"),
N_("IPv6 Prefix"),
N_("IPv6 Scope")
N_("Collisions")
};
const char *glibtop_descriptions_netload [GLIBTOP_MAX_NETLOAD] =
{
N_("Interface Flags"),
N_("Maximum Transfer Unit"),
N_("IPv4 Subnet"),
N_("IPv4 Address"),
N_("Subnet"),
N_("Address"),
N_("Packets In"),
N_("Packets Out"),
N_("Packets Total"),
@@ -77,8 +74,5 @@ const char *glibtop_descriptions_netload [GLIBTOP_MAX_NETLOAD] =
N_("Errors In"),
N_("Errors Out"),
N_("Errors Total"),
N_("Collisions"),
N_("IPv6 Address"),
N_("IPv6 Prefix"),
N_("IPv6 Scope")
N_("Collisions")
};

View File

@@ -8,7 +8,7 @@
* sem_limits.c:
* shm_limits.c:
* swap.c: Added missing const qualifiers.
* uptime.c: (glibtop_get_uptime_s): Cleaned up. Added boot_time.
2003-10-21 Bastien Nocera <hadess@hadess.net>

View File

@@ -16,7 +16,7 @@
* procargs.c: (glibtop_get_proc_args_s):
* procmap.c: (glibtop_get_proc_map_s): fix g_malloc usage on non-Linux
platforms (patch by Benoît Dejean <bnet@ifrance.com>)
platforms (patch by Benoit Dejean <bnet@ifrance.com>)
2003-10-21 Bastien Nocera <hadess@hadess.net>
@@ -184,7 +184,7 @@
1999-05-04 Drazen Kacar <dave@srce.hr>
* glibtop_machine.h: Changed boot time to unsigned long long.
* open.c: Added proper type checking for boot value. There's
no point in saving a few nanoseconds in init function. And
one day it will become 64-bit value.

View File

@@ -28,6 +28,6 @@
1998-08-24 Martin Baulig <martin@home-of-linux.org>
* *.c: Added initialization functions `glibtop_init_<feature>_s'.
* ChangeLog: New file.

View File

@@ -7,7 +7,7 @@
* open.c: (glibtop_open_p):
* proclist.c: (glibtop_get_proclist_p): fix g_malloc usage on non-Linux
platforms (patch by Benoît Dejean <bnet@ifrance.com>)
platforms (patch by Benoit Dejean <bnet@ifrance.com>)
2003-10-21 Bastien Nocera <hadess@hadess.net>