version 2.6.1
* configure.in: version 2.6.1
This commit is contained in:
@@ -34,8 +34,3 @@ libgtop*.tar.gz
|
|||||||
*-debstamp
|
*-debstamp
|
||||||
libgtop*.pc
|
libgtop*.pc
|
||||||
autom4te.cache
|
autom4te.cache
|
||||||
COPYING
|
|
||||||
INSTALL
|
|
||||||
install-sh
|
|
||||||
missing
|
|
||||||
mkinstalldirs
|
|
||||||
|
39
ChangeLog
39
ChangeLog
@@ -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:
|
* configure.in: version 2.6.1
|
||||||
* 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.
|
|
||||||
|
|
||||||
2004-06-13 Benoît Dejean <tazforever@dlfp.org>
|
2004-06-13 Benoît Dejean <tazforever@dlfp.org>
|
||||||
|
|
||||||
@@ -45,6 +14,8 @@
|
|||||||
|
|
||||||
* lib/sysdeps.c: (glibtop_get_sysdeps_r): Small cleanup.
|
* lib/sysdeps.c: (glibtop_get_sysdeps_r): Small cleanup.
|
||||||
|
|
||||||
|
2004-06-12 Benoît Dejean <tazforever@dlfp.org>
|
||||||
|
|
||||||
* lib/init.c: Added missing initializer.
|
* lib/init.c: Added missing initializer.
|
||||||
|
|
||||||
2004-06-09 Benoît Dejean <TazForEver@dlfp.org>
|
2004-06-09 Benoît Dejean <TazForEver@dlfp.org>
|
||||||
@@ -168,7 +139,7 @@
|
|||||||
|
|
||||||
2004-03-05 Bastien Nocera <hadess@hadess.net>
|
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
|
to break the API, I mean, to make it easier to generate Python bindings
|
||||||
(Closes: #129701)
|
(Closes: #129701)
|
||||||
|
|
||||||
|
15
NEWS
15
NEWS
@@ -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:
|
March 11, 2004:
|
||||||
===============
|
===============
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* marshal.pl:
|
* marshal.pl:
|
||||||
* read_data.c: (glibtop_read_data_i):
|
* read_data.c: (glibtop_read_data_i):
|
||||||
* server.c: (handle_slave_connection): fix g_malloc usage on non-Linux
|
* 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>
|
2003-10-20 Bastien Nocera <hadess@hadess.net>
|
||||||
|
|
||||||
|
@@ -8,7 +8,7 @@ AC_CANONICAL_SYSTEM
|
|||||||
|
|
||||||
LIBGTOP_MAJOR_VERSION=2
|
LIBGTOP_MAJOR_VERSION=2
|
||||||
LIBGTOP_MINOR_VERSION=6
|
LIBGTOP_MINOR_VERSION=6
|
||||||
LIBGTOP_MICRO_VERSION=0
|
LIBGTOP_MICRO_VERSION=1
|
||||||
LIBGTOP_VERSION=$LIBGTOP_MAJOR_VERSION.$LIBGTOP_MINOR_VERSION.$LIBGTOP_MICRO_VERSION
|
LIBGTOP_VERSION=$LIBGTOP_MAJOR_VERSION.$LIBGTOP_MINOR_VERSION.$LIBGTOP_MICRO_VERSION
|
||||||
AM_INIT_AUTOMAKE(libgtop, $LIBGTOP_VERSION)
|
AM_INIT_AUTOMAKE(libgtop, $LIBGTOP_VERSION)
|
||||||
|
|
||||||
@@ -250,7 +250,7 @@ AC_TYPE_SIGNAL
|
|||||||
AC_FUNC_STRFTIME
|
AC_FUNC_STRFTIME
|
||||||
AC_CHECK_FUNCS(getcwd gettimeofday getwd putenv strdup strtoul uname)
|
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
|
GETTEXT_PACKAGE=libgtop-2.0
|
||||||
AC_SUBST(GETTEXT_PACKAGE)
|
AC_SUBST(GETTEXT_PACKAGE)
|
||||||
|
@@ -8,4 +8,3 @@ auto-macros.texi
|
|||||||
version.texi
|
version.texi
|
||||||
stamp-vti
|
stamp-vti
|
||||||
*.html *.pdf
|
*.html *.pdf
|
||||||
mdate-sh
|
|
||||||
|
@@ -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>
|
2004-03-05 Bastien Nocera <hadess@hadess.net>
|
||||||
|
|
||||||
* reference.texi: update for new API
|
* reference.texi: update for new API
|
||||||
|
@@ -1079,7 +1079,7 @@ Library function @code{glibtop_get_proc_args}:
|
|||||||
@example
|
@example
|
||||||
@cartouche
|
@cartouche
|
||||||
char *
|
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);
|
unsigned max_len);
|
||||||
|
|
||||||
char *
|
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.
|
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
|
@page
|
||||||
@node glibtop_proc_map, glibtop_netload, glibtop_proc_args, System Dependent
|
@node glibtop_proc_map, glibtop_netload, glibtop_proc_args, System Dependent
|
||||||
@subsection Process Memory Maps
|
@subsection Process Memory Maps
|
||||||
@@ -1518,7 +1494,6 @@ struct _glibtop_fsusage
|
|||||||
bavail,
|
bavail,
|
||||||
files,
|
files,
|
||||||
ffree;
|
ffree;
|
||||||
guint32 block_size;
|
|
||||||
@};
|
@};
|
||||||
@end cartouche
|
@end cartouche
|
||||||
@end example
|
@end example
|
||||||
@@ -1534,8 +1509,6 @@ Free blocks available to ordinary users.
|
|||||||
Total file nodes.
|
Total file nodes.
|
||||||
@item ffree
|
@item ffree
|
||||||
Free file nodes.
|
Free file nodes.
|
||||||
@item block_size
|
|
||||||
Block size in bytes.
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
Blocks are usually 512 bytes.
|
Blocks are usually 512 bytes.
|
||||||
|
@@ -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>
|
2003-12-27 Ole Laursen <olau@hardworking.dk>
|
||||||
|
|
||||||
* mountlist.c: Updated to display block size too.
|
* mountlist.c: Updated to display block size too.
|
||||||
|
@@ -24,9 +24,6 @@
|
|||||||
#ifndef __GLIBTOP_H__
|
#ifndef __GLIBTOP_H__
|
||||||
#define __GLIBTOP_H__
|
#define __GLIBTOP_H__
|
||||||
|
|
||||||
typedef struct _glibtop glibtop;
|
|
||||||
|
|
||||||
|
|
||||||
#include <glibtop/global.h>
|
#include <glibtop/global.h>
|
||||||
|
|
||||||
#include <glibtop_server.h>
|
#include <glibtop_server.h>
|
||||||
@@ -40,10 +37,10 @@ typedef struct _glibtop glibtop;
|
|||||||
#define GLIBTOP_MOUNTENTRY_LEN 79
|
#define GLIBTOP_MOUNTENTRY_LEN 79
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
typedef struct _glibtop glibtop;
|
||||||
|
|
||||||
#include <glibtop/sysdeps.h>
|
#include <glibtop/sysdeps.h>
|
||||||
|
|
||||||
|
|
||||||
struct _glibtop
|
struct _glibtop
|
||||||
{
|
{
|
||||||
unsigned flags;
|
unsigned flags;
|
||||||
|
@@ -28,17 +28,60 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
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_error_vr (glibtop *server, char *format, va_list args);
|
||||||
void glibtop_warn_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_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 glibtop_warn_io_vr (glibtop *server, char *format, int, va_list args);
|
||||||
|
|
||||||
void G_GNUC_UNUSED glibtop_error_r (glibtop *server, char *format, ...);
|
static void G_GNUC_UNUSED
|
||||||
void G_GNUC_UNUSED glibtop_warn_r (glibtop *server, char *format, ...);
|
glibtop_error_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, ...);
|
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__
|
#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_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)
|
#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__)
|
static void
|
||||||
#define glibtop_warn(p1, ...) glibtop_warn_r(glibtop_global_server , p1 , __VA_ARGS__)
|
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__)
|
static void
|
||||||
#define glibtop_warn_io(p1, ...) glibtop_warn_io_r(glibtop_global_server , p1 , __VA_ARGS__)
|
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, ...);
|
static void
|
||||||
void glibtop_warn (char *format, ...);
|
glibtop_warn_io (char *format, ...)
|
||||||
void glibtop_error_io (char *format, ...);
|
{
|
||||||
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__ */
|
#endif /* no __GNUC__ */
|
||||||
|
|
||||||
|
83
include/glibtop/netinfo.h
Normal file
83
include/glibtop/netinfo.h
Normal 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
|
@@ -43,11 +43,8 @@ G_BEGIN_DECLS
|
|||||||
#define GLIBTOP_NETLOAD_ERRORS_OUT 11
|
#define GLIBTOP_NETLOAD_ERRORS_OUT 11
|
||||||
#define GLIBTOP_NETLOAD_ERRORS_TOTAL 12
|
#define GLIBTOP_NETLOAD_ERRORS_TOTAL 12
|
||||||
#define GLIBTOP_NETLOAD_COLLISIONS 13
|
#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;
|
typedef struct _glibtop_netload glibtop_netload;
|
||||||
|
|
||||||
@@ -70,15 +67,6 @@ enum {
|
|||||||
GLIBTOP_IF_FLAGS_MULTICAST
|
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
|
struct _glibtop_netload
|
||||||
{
|
{
|
||||||
guint64 flags,
|
guint64 flags,
|
||||||
@@ -96,10 +84,6 @@ struct _glibtop_netload
|
|||||||
errors_out, /* GLIBTOP_NETLOAD_ERRORS_OUT */
|
errors_out, /* GLIBTOP_NETLOAD_ERRORS_OUT */
|
||||||
errors_total, /* GLIBTOP_NETLOAD_ERRORS_TOTAL */
|
errors_total, /* GLIBTOP_NETLOAD_ERRORS_TOTAL */
|
||||||
collisions; /* GLIBTOP_NETLOAD_COLLISIONS */
|
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)
|
#define glibtop_get_netload(netload,interface) glibtop_get_netload_l(glibtop_global_server, netload, interface)
|
||||||
|
@@ -59,7 +59,7 @@ typedef struct _glibtop_proc_uid glibtop_proc_uid;
|
|||||||
struct _glibtop_proc_uid
|
struct _glibtop_proc_uid
|
||||||
{
|
{
|
||||||
guint64 flags;
|
guint64 flags;
|
||||||
gint32 uid, /* user id */
|
int uid, /* user id */
|
||||||
euid, /* effective user id */
|
euid, /* effective user id */
|
||||||
gid, /* group id */
|
gid, /* group id */
|
||||||
egid, /* effective group id */
|
egid, /* effective group id */
|
||||||
|
@@ -5,4 +5,3 @@ Makefile.in
|
|||||||
libgtop.la
|
libgtop.la
|
||||||
*.lo
|
*.lo
|
||||||
lib.c
|
lib.c
|
||||||
error.loT
|
|
||||||
|
@@ -32,7 +32,7 @@ GQuark
|
|||||||
glibtop_error_quark (void)
|
glibtop_error_quark (void)
|
||||||
{
|
{
|
||||||
static GQuark q = 0;
|
static GQuark q = 0;
|
||||||
if (G_UNLIKELY(q == 0))
|
if (q == 0)
|
||||||
q = g_quark_from_static_string ("glibtop-error-quark");
|
q = g_quark_from_static_string ("glibtop-error-quark");
|
||||||
|
|
||||||
return q;
|
return q;
|
||||||
|
40
lib/read.c
40
lib/read.c
@@ -31,25 +31,37 @@
|
|||||||
static void
|
static void
|
||||||
do_read (int s, void *ptr, size_t total_size)
|
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) {
|
if (nread == 0) {
|
||||||
total_size -= nread;
|
close (s);
|
||||||
ptr = (char*)ptr + nread;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(nread == 0)
|
if (nread <= 0) {
|
||||||
close (s);
|
|
||||||
|
|
||||||
if (nread < 0)
|
|
||||||
glibtop_error_io ("recv");
|
glibtop_error_io ("recv");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
already_read += nread;
|
||||||
|
remaining -= nread;
|
||||||
|
/* (char *) ptr += nread; */
|
||||||
|
tmp_ptr = ptr;
|
||||||
|
tmp_ptr += nread;
|
||||||
|
ptr = tmp_ptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
glibtop_read_l (glibtop *server, size_t size, void *buf)
|
glibtop_read_l (glibtop *server, size_t size, void *buf)
|
||||||
{
|
{
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
glibtop_init_r (&server, 0, 0);
|
glibtop_init_r (&server, 0, 0);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@@ -59,11 +71,9 @@ glibtop_read_l (glibtop *server, size_t size, void *buf)
|
|||||||
if (server->socket) {
|
if (server->socket) {
|
||||||
do_read (server->socket, buf, size);
|
do_read (server->socket, buf, size);
|
||||||
} else {
|
} else {
|
||||||
if(read (server->input [0], buf, size) < 0)
|
ret = read (server->input [0], buf, size);
|
||||||
glibtop_error_io_r (
|
|
||||||
server,
|
|
||||||
ngettext ("read %d byte",
|
|
||||||
"read %d bytes", size),
|
|
||||||
size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ret < 0)
|
||||||
|
glibtop_error_io_r (server, ngettext ("read %d byte", "read %d bytes", size), size);
|
||||||
}
|
}
|
||||||
|
@@ -42,9 +42,9 @@ glibtop_read_data_l (glibtop *server)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (server->socket) {
|
if (server->socket) {
|
||||||
ret = recv (server->socket, &size, sizeof (size_t), 0);
|
ret = recv (server->socket, (void *)&size, sizeof (size_t), 0);
|
||||||
} else {
|
} else {
|
||||||
ret = read (server->input [0], &size, sizeof (size_t));
|
ret = read (server->input [0], (void *)&size, sizeof (size_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
@@ -1,11 +1,3 @@
|
|||||||
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>
|
2004-05-14 Baris Cicek <baris@teamforce.name.tr>
|
||||||
|
|
||||||
* tr.po: Updated Turkish Translation
|
* tr.po: Updated Turkish Translation
|
||||||
|
10
po/sq.po
10
po/sq.po
@@ -37,10 +37,9 @@ msgstr "Nice"
|
|||||||
msgid "Sys"
|
msgid "Sys"
|
||||||
msgstr "Sys"
|
msgstr "Sys"
|
||||||
|
|
||||||
#. GRUT modified this item
|
|
||||||
#: examples/smp.c:77
|
#: examples/smp.c:77
|
||||||
msgid "Idle"
|
msgid "Idle"
|
||||||
msgstr "Joaktiv"
|
msgstr "Jo në përdorim"
|
||||||
|
|
||||||
#: examples/smp.c:79
|
#: examples/smp.c:79
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -402,10 +401,9 @@ msgstr "Madhësia e segmentit të mesazhit"
|
|||||||
msgid "Number of system message headers"
|
msgid "Number of system message headers"
|
||||||
msgstr "Numri i headers të mesazheve të sistemit"
|
msgstr "Numri i headers të mesazheve të sistemit"
|
||||||
|
|
||||||
#. GRUT modified this item
|
|
||||||
#: sysdeps/names/netload.c:46 sysdeps/names/netload.c:64
|
#: sysdeps/names/netload.c:46 sysdeps/names/netload.c:64
|
||||||
msgid "Interface Flags"
|
msgid "Interface Flags"
|
||||||
msgstr "Flag-et e interfaqes"
|
msgstr "Flag e interfaqes"
|
||||||
|
|
||||||
#: sysdeps/names/netload.c:47
|
#: sysdeps/names/netload.c:47
|
||||||
msgid "MTU"
|
msgid "MTU"
|
||||||
@@ -1250,10 +1248,9 @@ msgstr "Argumentet e rreshtit të komandës së proçesit"
|
|||||||
msgid "List of currently mounted filesystems"
|
msgid "List of currently mounted filesystems"
|
||||||
msgstr "Lista e file sistemeve aktualisht të montuar"
|
msgstr "Lista e file sistemeve aktualisht të montuar"
|
||||||
|
|
||||||
#. GRUT modified this item
|
|
||||||
#: sysdeps/names/uptime.c:39
|
#: sysdeps/names/uptime.c:39
|
||||||
msgid "Uptime"
|
msgid "Uptime"
|
||||||
msgstr "Kohëzgjatja"
|
msgstr "Uptime"
|
||||||
|
|
||||||
#: sysdeps/names/uptime.c:40
|
#: sysdeps/names/uptime.c:40
|
||||||
msgid "Idletime"
|
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
|
#: sysdeps/osf1/siglist.c:58 sysdeps/sun4/siglist.c:58
|
||||||
msgid "User defined signal 2"
|
msgid "User defined signal 2"
|
||||||
msgstr "Sinjal 2 i përcaktuar nga përdoruesi"
|
msgstr "Sinjal 2 i përcaktuar nga përdoruesi"
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
glibtop_map_entry|ulong(flags,start,end,offset,perm,inode,device):string(filename)
|
glibtop_map_entry|ulong(flags,start,end,offset,perm,inode,device):string(filename)
|
||||||
glibtop_mountentry|ulong(dev):string(devname,mountdir,type)
|
glibtop_mountentry|ulong(dev):string(devname,mountdir,type)
|
||||||
glibtop_interface|ulong(flags,if_flags,transport,type,number,instance,num_logical):string(name)
|
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)
|
glibtop_ifaddr|ulong(flags,transport):ushort(addr_len,address[GLIBTOP_IFADDR_LEN]):ulong(subnet,scope)
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
2004-03-09 Bastien Nocera <hadess@hadess.net>
|
2004-03-09 Bastien Nocera <hadess@hadess.net>
|
||||||
|
|
||||||
* procargs.c: (glibtop_get_proc_args_s): fix g_malloc usage on non-Linux
|
* 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>
|
2003-10-21 Bastien Nocera <hadess@hadess.net>
|
||||||
|
|
||||||
|
@@ -1,18 +1,3 @@
|
|||||||
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>
|
2004-06-12 Benoît Dejean <tazforever@dlfp.org>
|
||||||
|
|
||||||
* Makefile.am:
|
* Makefile.am:
|
||||||
|
@@ -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 \
|
libgtop_common_2_0_la_SOURCES = error.c gnuslib.c \
|
||||||
fsusage.c \
|
fsusage.c \
|
||||||
mountlist.c mountlist.h \
|
mountlist.c mountlist.h \
|
||||||
procargs.c \
|
|
||||||
$(inodedb_SRCLIST)
|
$(inodedb_SRCLIST)
|
||||||
|
|
||||||
libgtop_common_2_0_la_LDFLAGS = $(LT_VERSION_INFO)
|
libgtop_common_2_0_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
/* Prints error message and exits. */
|
/* Prints error message and exits. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_server_name (const glibtop *server)
|
print_server_name (glibtop *server)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "%s: ", server ?
|
fprintf (stderr, "%s: ", server ?
|
||||||
(server->name ? server->name : DEFAULT_NAME)
|
(server->name ? server->name : DEFAULT_NAME)
|
||||||
@@ -86,85 +86,3 @@ glibtop_warn_io_vr (glibtop *server, char *format, int error, va_list args)
|
|||||||
abort ();
|
abort ();
|
||||||
#endif
|
#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__ */
|
|
||||||
|
67
sysdeps/common/fsusage-frontend.c
Normal file
67
sysdeps/common/fsusage-frontend.c
Normal 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
47
sysdeps/common/fsusage.h
Normal 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
|
@@ -40,7 +40,7 @@
|
|||||||
* procargs.c: (glibtop_get_proc_args_p):
|
* procargs.c: (glibtop_get_proc_args_p):
|
||||||
* procmap.c: (glibtop_get_proc_map_p):
|
* procmap.c: (glibtop_get_proc_map_p):
|
||||||
* swap.c: (glibtop_get_swap_p): fix g_malloc usage on non-Linux
|
* 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>
|
2003-10-21 Bastien Nocera <hadess@hadess.net>
|
||||||
|
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
2004-03-09 Bastien Nocera <hadess@hadess.net>
|
2004-03-09 Bastien Nocera <hadess@hadess.net>
|
||||||
|
|
||||||
* proclist.c: (glibtop_get_proclist_s): fix g_malloc usage on non-Linux
|
* 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>
|
2003-10-21 Bastien Nocera <hadess@hadess.net>
|
||||||
|
|
||||||
|
@@ -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>
|
2004-06-13 Benoît Dejean <tazforever@dlfp.org>
|
||||||
|
|
||||||
* procargs.c: (glibtop_get_proc_args_s): Replaced by g_file_get_contents.
|
* procargs.c: (glibtop_get_proc_args_s): Replaced by g_file_get_contents.
|
||||||
|
@@ -54,13 +54,24 @@ void
|
|||||||
glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf)
|
glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf)
|
||||||
{
|
{
|
||||||
char buffer [BUFSIZ], *p;
|
char buffer [BUFSIZ], *p;
|
||||||
|
int fd, len;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
glibtop_init_s (&server, GLIBTOP_SYSDEPS_CPU, 0);
|
glibtop_init_s (&server, GLIBTOP_SYSDEPS_CPU, 0);
|
||||||
|
|
||||||
memset (buf, 0, sizeof (glibtop_cpu));
|
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
|
* GLOBAL
|
||||||
|
@@ -1,17 +1,12 @@
|
|||||||
#include <glibtop.h>
|
#include <glibtop.h>
|
||||||
#include <glibtop/error.h>
|
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
/* gcc warning bug */
|
|
||||||
unsigned get_pageshift();
|
|
||||||
|
|
||||||
|
|
||||||
unsigned long long
|
unsigned long long
|
||||||
get_scaled(const char *buffer, const char *key)
|
get_scaled(const char *buffer, const char *key)
|
||||||
@@ -33,73 +28,25 @@ get_scaled(const char *buffer, const char *key)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
int
|
||||||
* Read functions
|
proc_file_to_buffer (char *buffer, const char *fmt, pid_t pid)
|
||||||
*/
|
|
||||||
enum TRY_FILE_TO_BUFFER
|
|
||||||
{
|
{
|
||||||
TRY_FILE_TO_BUFFER_OK = 0,
|
char filename [256];
|
||||||
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];
|
|
||||||
int fd;
|
int fd;
|
||||||
ssize_t len;
|
ssize_t len;
|
||||||
va_list pa;
|
|
||||||
|
|
||||||
va_start(pa, format);
|
g_snprintf (filename, sizeof filename, fmt, pid);
|
||||||
|
|
||||||
/* C99 also provides vsnprintf */
|
fd = open (filename, O_RDONLY);
|
||||||
g_vsnprintf(path, sizeof path, format, pa);
|
if (fd < 0) return -1;
|
||||||
|
|
||||||
va_end(pa);
|
|
||||||
|
|
||||||
if((fd = open (path, O_RDONLY)) < 0)
|
|
||||||
return TRY_FILE_TO_BUFFER_OPEN;
|
|
||||||
|
|
||||||
len = read (fd, buffer, BUFSIZ-1);
|
len = read (fd, buffer, BUFSIZ-1);
|
||||||
close (fd);
|
close (fd);
|
||||||
|
|
||||||
if (len < 0)
|
if (len < 0) return -1;
|
||||||
return TRY_FILE_TO_BUFFER_READ;
|
|
||||||
|
|
||||||
buffer [len] = '\0';
|
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;
|
|
||||||
}
|
|
||||||
|
@@ -21,16 +21,12 @@
|
|||||||
Boston, MA 02111-1307, USA.
|
Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __LINUX__GLIBTOP_SERVER_H__
|
#ifndef __GLIBTOP_SERVER_H__
|
||||||
#define __LINUX__GLIBTOP_SERVER_H__
|
#define __GLIBTOP_SERVER_H__
|
||||||
|
|
||||||
#include <glibtop.h>
|
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
@@ -38,10 +34,6 @@ G_BEGIN_DECLS
|
|||||||
|
|
||||||
#define LINUX_VERSION(x,y,z) (0x10000*(x) + 0x100*(y) + z)
|
#define LINUX_VERSION(x,y,z) (0x10000*(x) + 0x100*(y) + z)
|
||||||
|
|
||||||
|
|
||||||
unsigned get_pageshift();
|
|
||||||
|
|
||||||
|
|
||||||
static inline char *
|
static inline char *
|
||||||
skip_token (const char *p)
|
skip_token (const char *p)
|
||||||
{
|
{
|
||||||
@@ -59,7 +51,6 @@ skip_multiple_token (const char *p, size_t count)
|
|||||||
return (char *)p;
|
return (char *)p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline char *
|
static inline char *
|
||||||
skip_line (const char *p)
|
skip_line (const char *p)
|
||||||
{
|
{
|
||||||
@@ -67,29 +58,12 @@ skip_line (const char *p)
|
|||||||
return (char *) (*p ? p+1 : p);
|
return (char *) (*p ? p+1 : p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned long long
|
unsigned long long
|
||||||
get_scaled(const char *buffer, const char *key);
|
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
|
int
|
||||||
try_file_to_buffer(char *buffer, const char *format, ...);
|
proc_file_to_buffer (char *buffer, const char *fmt, pid_t pid);
|
||||||
|
|
||||||
|
|
||||||
/* 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
proc_stat_to_buffer (char *buffer, pid_t pid)
|
proc_stat_to_buffer (char *buffer, pid_t pid)
|
||||||
@@ -109,12 +83,12 @@ proc_statm_to_buffer (char *buffer, pid_t pid)
|
|||||||
return proc_file_to_buffer (buffer, "/proc/%d/statm", pid);
|
return proc_file_to_buffer (buffer, "/proc/%d/statm", pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline char *
|
static inline char *
|
||||||
proc_stat_after_cmd (char *p)
|
proc_stat_after_cmd (char *p)
|
||||||
{
|
{
|
||||||
p = strrchr (p, ')');
|
p = strrchr (p, ')');
|
||||||
if (G_LIKELY(p))
|
if (!p) return p;
|
||||||
|
|
||||||
*p++ = '\0';
|
*p++ = '\0';
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
@@ -144,4 +118,4 @@ proc_stat_after_cmd (char *p)
|
|||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __LINUX__GLIBTOP_SERVER_H__ */
|
#endif
|
||||||
|
@@ -49,12 +49,23 @@ void
|
|||||||
glibtop_get_loadavg_s (glibtop *server, glibtop_loadavg *buf)
|
glibtop_get_loadavg_s (glibtop *server, glibtop_loadavg *buf)
|
||||||
{
|
{
|
||||||
char buffer [BUFSIZ], *p, *old;
|
char buffer [BUFSIZ], *p, *old;
|
||||||
|
int fd, len;
|
||||||
|
|
||||||
glibtop_init_s (&server, GLIBTOP_SYSDEPS_LOADAVG, 0);
|
glibtop_init_s (&server, GLIBTOP_SYSDEPS_LOADAVG, 0);
|
||||||
|
|
||||||
memset (buf, 0, sizeof (glibtop_loadavg));
|
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 [0] = strtod (buffer, &p);
|
||||||
buf->loadavg [1] = strtod (p, &p);
|
buf->loadavg [1] = strtod (p, &p);
|
||||||
|
@@ -47,10 +47,23 @@ void
|
|||||||
glibtop_get_mem_s (glibtop *server, glibtop_mem *buf)
|
glibtop_get_mem_s (glibtop *server, glibtop_mem *buf)
|
||||||
{
|
{
|
||||||
char buffer [BUFSIZ];
|
char buffer [BUFSIZ];
|
||||||
|
int fd, len;
|
||||||
|
|
||||||
glibtop_init_s (&server, GLIBTOP_SYSDEPS_MEM, 0);
|
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->total = get_scaled(buffer, "MemTotal:");
|
||||||
buf->free = get_scaled(buffer, "MemFree:");
|
buf->free = get_scaled(buffer, "MemFree:");
|
||||||
|
@@ -47,17 +47,6 @@
|
|||||||
#include <linux/udp.h>
|
#include <linux/udp.h>
|
||||||
#endif
|
#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_ACCTIN 0x1000 /* Account incoming packets only. */
|
||||||
#define _GLIBTOP_IP_FW_ACCTOUT 0x2000 /* Account outgoing 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_PACKETS_OUT) +
|
||||||
(1L << GLIBTOP_NETLOAD_BYTES_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. */
|
/* Init function. */
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -330,8 +314,6 @@ glibtop_get_netload_s (glibtop *server, glibtop_netload *buf,
|
|||||||
if (strcmp (dev, interface))
|
if (strcmp (dev, interface))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Ok, we've found the interface */
|
|
||||||
|
|
||||||
/* Only read byte counts if we really have them. */
|
/* Only read byte counts if we really have them. */
|
||||||
|
|
||||||
if (have_bytes) {
|
if (have_bytes) {
|
||||||
@@ -366,56 +348,7 @@ glibtop_get_netload_s (glibtop *server, glibtop_netload *buf,
|
|||||||
|
|
||||||
if (have_bytes)
|
if (have_bytes)
|
||||||
buf->flags |= _glibtop_sysdeps_netload_bytes;
|
buf->flags |= _glibtop_sysdeps_netload_bytes;
|
||||||
|
|
||||||
break; /* finished */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose (f);
|
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 */
|
|
||||||
}
|
}
|
||||||
|
@@ -66,12 +66,23 @@ glibtop_open_s (glibtop *server, const char *program_name,
|
|||||||
const unsigned flags)
|
const unsigned flags)
|
||||||
{
|
{
|
||||||
char buffer [BUFSIZ], *p = buffer;
|
char buffer [BUFSIZ], *p = buffer;
|
||||||
|
int fd, len;
|
||||||
|
|
||||||
server->name = program_name;
|
server->name = program_name;
|
||||||
|
|
||||||
server->os_version_code = get_linux_version();
|
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++) {
|
for (server->ncpu = 0; server->ncpu < GLIBTOP_NCPU; server->ncpu++) {
|
||||||
|
|
||||||
|
@@ -52,35 +52,40 @@ glibtop_init_ppp_s (glibtop *server)
|
|||||||
server->sysdeps.ppp = _glibtop_sysdeps_ppp;
|
server->sysdeps.ppp = _glibtop_sysdeps_ppp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static int
|
||||||
get_ISDN_stats (glibtop *server, int *in, int *out)
|
get_ISDN_stats (glibtop *server, int *in, int *out)
|
||||||
{
|
{
|
||||||
unsigned long isdn_stats[2 * ISDN_MAX_CHANNELS], *ptr;
|
unsigned long *isdn_stats, *ptr;
|
||||||
int fd;
|
int fd, i;
|
||||||
|
|
||||||
*in = *out = 0;
|
*in = *out = 0;
|
||||||
|
|
||||||
|
isdn_stats = g_malloc (ISDN_MAX_CHANNELS * 2 * sizeof (unsigned long));
|
||||||
|
|
||||||
fd = open ("/dev/isdninfo", O_RDONLY);
|
fd = open ("/dev/isdninfo", O_RDONLY);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
|
g_free (isdn_stats);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ioctl (fd, IIOCGETCPS, isdn_stats) < 0) && (errno != 0)) {
|
if ((ioctl (fd, IIOCGETCPS, isdn_stats) < 0) && (errno != 0)) {
|
||||||
close(fd);
|
g_free (isdn_stats);
|
||||||
|
close (fd);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ptr = isdn_stats;
|
for (i = 0, ptr = isdn_stats; i < ISDN_MAX_CHANNELS; i++) {
|
||||||
ptr != (isdn_stats + G_N_ELEMENTS(isdn_stats));
|
|
||||||
/* NOOP */) {
|
|
||||||
*in += *ptr++; *out += *ptr++;
|
*in += *ptr++; *out += *ptr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_free (isdn_stats);
|
||||||
close (fd);
|
close (fd);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean is_ISDN_on (glibtop *server, int *online)
|
static int is_ISDN_on (glibtop *server, int *online)
|
||||||
{
|
{
|
||||||
FILE *f = 0;
|
FILE *f = 0;
|
||||||
char buffer [BUFSIZ], *p;
|
char buffer [BUFSIZ], *p;
|
||||||
|
@@ -42,11 +42,11 @@ char *
|
|||||||
glibtop_get_proc_args_s (glibtop *server, glibtop_proc_args *buf,
|
glibtop_get_proc_args_s (glibtop *server, glibtop_proc_args *buf,
|
||||||
pid_t pid, unsigned max_len)
|
pid_t pid, unsigned max_len)
|
||||||
{
|
{
|
||||||
char filename[48]; /* magiv */
|
char filename[48];
|
||||||
|
|
||||||
char *args;
|
char *args;
|
||||||
gsize length;
|
gsize length;
|
||||||
GError *error = NULL;
|
GError *error;
|
||||||
|
|
||||||
glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_ARGS, 0);
|
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);
|
sprintf (filename, "/proc/%d/cmdline", pid);
|
||||||
|
|
||||||
if(!g_file_get_contents(filename, &args, &length, &error)) {
|
if(!g_file_get_contents(filename, &args, &length, &error)) {
|
||||||
g_error_free(error);
|
|
||||||
buf->size = 0;
|
buf->size = 0;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(max_len && max_len < length) {
|
if(max_len && max_len < length) {
|
||||||
args = g_realloc(args, max_len);
|
args = g_realloc(args, max_len+1);
|
||||||
args[max_len - 1] = '\0';
|
args[max_len] = '\0';
|
||||||
length = max_len;
|
length = max_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -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_SIZE) + (1L << GLIBTOP_PROC_MEM_RESIDENT) +
|
||||||
(1L << GLIBTOP_PROC_MEM_SHARE);
|
(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. */
|
/* Init function. */
|
||||||
|
|
||||||
void
|
void
|
||||||
glibtop_init_proc_mem_s (glibtop *server)
|
glibtop_init_proc_mem_s (glibtop *server)
|
||||||
{
|
{
|
||||||
|
register int pagesize;
|
||||||
|
|
||||||
server->sysdeps.proc_mem = _glibtop_sysdeps_proc_mem |
|
server->sysdeps.proc_mem = _glibtop_sysdeps_proc_mem |
|
||||||
_glibtop_sysdeps_proc_mem_statm;
|
_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. */
|
/* 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)
|
glibtop_get_proc_mem_s (glibtop *server, glibtop_proc_mem *buf, pid_t pid)
|
||||||
{
|
{
|
||||||
char buffer [BUFSIZ], *p;
|
char buffer [BUFSIZ], *p;
|
||||||
const unsigned pageshift = get_pageshift();
|
|
||||||
|
|
||||||
glibtop_init_s (&server, GLIBTOP_SYSDEPS_MEM, 0);
|
glibtop_init_s (&server, GLIBTOP_SYSDEPS_MEM, 0);
|
||||||
|
|
||||||
|
@@ -37,13 +37,34 @@ static const unsigned long _glibtop_sysdeps_proc_segment_statm =
|
|||||||
(1L << GLIBTOP_PROC_SEGMENT_DATA_RSS) +
|
(1L << GLIBTOP_PROC_SEGMENT_DATA_RSS) +
|
||||||
(1L << GLIBTOP_PROC_SEGMENT_DIRTY_SIZE);
|
(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. */
|
/* Init function. */
|
||||||
|
|
||||||
void
|
void
|
||||||
glibtop_init_proc_segment_s (glibtop *server)
|
glibtop_init_proc_segment_s (glibtop *server)
|
||||||
{
|
{
|
||||||
|
register int pagesize;
|
||||||
|
|
||||||
server->sysdeps.proc_segment = _glibtop_sysdeps_proc_segment |
|
server->sysdeps.proc_segment = _glibtop_sysdeps_proc_segment |
|
||||||
_glibtop_sysdeps_proc_segment_statm;
|
_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. */
|
/* Provides detailed information about a process. */
|
||||||
@@ -53,7 +74,6 @@ glibtop_get_proc_segment_s (glibtop *server, glibtop_proc_segment *buf,
|
|||||||
pid_t pid)
|
pid_t pid)
|
||||||
{
|
{
|
||||||
char buffer [BUFSIZ], *p;
|
char buffer [BUFSIZ], *p;
|
||||||
const unsigned pageshift = get_pageshift();
|
|
||||||
|
|
||||||
glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_SEGMENT, 0);
|
glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_SEGMENT, 0);
|
||||||
|
|
||||||
|
@@ -83,7 +83,7 @@ glibtop_get_proc_state_s (glibtop *server, glibtop_proc_state *buf, pid_t pid)
|
|||||||
buf->state = p [2];
|
buf->state = p [2];
|
||||||
|
|
||||||
p = skip_token (buffer); p++; /* pid */
|
p = skip_token (buffer); p++; /* pid */
|
||||||
if (G_UNLIKELY(*p++ != '('))
|
if (*p++ != '(')
|
||||||
glibtop_error_r (server, "Bad data in /proc/%d/stat", pid);
|
glibtop_error_r (server, "Bad data in /proc/%d/stat", pid);
|
||||||
|
|
||||||
g_strlcpy (buf->cmd, p, sizeof buf->cmd);
|
g_strlcpy (buf->cmd, p, sizeof buf->cmd);
|
||||||
|
@@ -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->priority = 2*15 - buf->priority;
|
||||||
buf->nice = 15 - buf->nice;
|
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 */
|
/* when tty wasn't full devno */
|
||||||
buf->tty = 4*0x100 + buf->tty;
|
buf->tty = 4*0x100 + buf->tty;
|
||||||
|
|
||||||
|
@@ -52,12 +52,23 @@ void
|
|||||||
glibtop_get_swap_s (glibtop *server, glibtop_swap *buf)
|
glibtop_get_swap_s (glibtop *server, glibtop_swap *buf)
|
||||||
{
|
{
|
||||||
char buffer [BUFSIZ], *p;
|
char buffer [BUFSIZ], *p;
|
||||||
|
int fd, len;
|
||||||
|
|
||||||
glibtop_init_s (&server, GLIBTOP_SYSDEPS_SWAP, 0);
|
glibtop_init_s (&server, GLIBTOP_SYSDEPS_SWAP, 0);
|
||||||
|
|
||||||
memset (buf, 0, sizeof (glibtop_swap));
|
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 */
|
/* Kernel 2.6 with multiple lines */
|
||||||
|
|
||||||
@@ -67,7 +78,17 @@ glibtop_get_swap_s (glibtop *server, glibtop_swap *buf)
|
|||||||
|
|
||||||
buf->flags = _glibtop_sysdeps_swap;
|
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");
|
p = strstr (buffer, "\nswap");
|
||||||
if (p == NULL) return;
|
if (p == NULL) return;
|
||||||
|
@@ -36,13 +36,31 @@ static glibtop_sysinfo sysinfo = { .flags = 0 };
|
|||||||
static void
|
static void
|
||||||
init_sysinfo (glibtop *server)
|
init_sysinfo (glibtop *server)
|
||||||
{
|
{
|
||||||
|
int fd;
|
||||||
|
ssize_t len;
|
||||||
char buffer [BUFSIZ];
|
char buffer [BUFSIZ];
|
||||||
|
|
||||||
if(G_LIKELY(sysinfo.flags)) return;
|
if(sysinfo.flags) return;
|
||||||
|
|
||||||
glibtop_init_s (&server, GLIBTOP_SYSDEPS_CPU, 0);
|
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 */
|
/* cpuinfo records are seperated by a blank line */
|
||||||
gchar ** const processors = g_strsplit(buffer, "\n\n", 0);
|
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 */
|
/* 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
|
/* just g_free instead of g_strvfree because we stole
|
||||||
the memory*/
|
the memory*/
|
||||||
|
@@ -45,12 +45,23 @@ void
|
|||||||
glibtop_get_uptime_s (glibtop *server, glibtop_uptime *buf)
|
glibtop_get_uptime_s (glibtop *server, glibtop_uptime *buf)
|
||||||
{
|
{
|
||||||
char buffer [BUFSIZ], *p;
|
char buffer [BUFSIZ], *p;
|
||||||
|
int fd, len;
|
||||||
|
|
||||||
glibtop_init_s (&server, GLIBTOP_SYSDEPS_UPTIME, 0);
|
glibtop_init_s (&server, GLIBTOP_SYSDEPS_UPTIME, 0);
|
||||||
|
|
||||||
memset (buf, 0, sizeof (glibtop_uptime));
|
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->uptime = strtod (buffer, &p);
|
||||||
buf->idletime = strtod (p, &p);
|
buf->idletime = strtod (p, &p);
|
||||||
|
@@ -26,13 +26,13 @@
|
|||||||
|
|
||||||
const char *glibtop_names_fsusage [GLIBTOP_MAX_FSUSAGE] =
|
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] =
|
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_ULONG,
|
||||||
GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_INT
|
GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *glibtop_labels_fsusage [GLIBTOP_MAX_FSUSAGE] =
|
const char *glibtop_labels_fsusage [GLIBTOP_MAX_FSUSAGE] =
|
||||||
@@ -41,8 +41,7 @@ const char *glibtop_labels_fsusage [GLIBTOP_MAX_FSUSAGE] =
|
|||||||
N_("Free blocks"),
|
N_("Free blocks"),
|
||||||
N_("Available blocks"),
|
N_("Available blocks"),
|
||||||
N_("Total file nodes"),
|
N_("Total file nodes"),
|
||||||
N_("Free file nodes"),
|
N_("Free file nodes")
|
||||||
N_("Block size")
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *glibtop_descriptions_fsusage [GLIBTOP_MAX_FSUSAGE] =
|
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 the superuser"),
|
||||||
N_("Free blocks available to non-superusers"),
|
N_("Free blocks available to non-superusers"),
|
||||||
N_("Total file nodes"),
|
N_("Total file nodes"),
|
||||||
N_("Free file nodes"),
|
N_("Free file nodes")
|
||||||
N_("Block size")
|
|
||||||
};
|
};
|
||||||
|
56
sysdeps/names/netinfo.c
Normal file
56
sysdeps/names/netinfo.c
Normal 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"),
|
||||||
|
};
|
@@ -29,7 +29,7 @@ const char *glibtop_names_netload [GLIBTOP_MAX_NETLOAD] =
|
|||||||
"if_flags", "mtu", "subnet", "address", "packets_in",
|
"if_flags", "mtu", "subnet", "address", "packets_in",
|
||||||
"packets_out", "packets_total", "bytes_in", "bytes_out",
|
"packets_out", "packets_total", "bytes_in", "bytes_out",
|
||||||
"bytes_total", "errors_in", "errors_out", "errors_total",
|
"bytes_total", "errors_in", "errors_out", "errors_total",
|
||||||
"collisions", "address6", "prefix6", "scope6"
|
"collisions"
|
||||||
};
|
};
|
||||||
|
|
||||||
const unsigned glibtop_types_netload [GLIBTOP_MAX_NETLOAD] =
|
const unsigned glibtop_types_netload [GLIBTOP_MAX_NETLOAD] =
|
||||||
@@ -45,8 +45,8 @@ const char *glibtop_labels_netload [GLIBTOP_MAX_NETLOAD] =
|
|||||||
{
|
{
|
||||||
N_("Interface Flags"),
|
N_("Interface Flags"),
|
||||||
N_("MTU"),
|
N_("MTU"),
|
||||||
N_("IPv4 Subnet"),
|
N_("Subnet"),
|
||||||
N_("IPv4 Address"),
|
N_("Address"),
|
||||||
N_("Packets In"),
|
N_("Packets In"),
|
||||||
N_("Packets Out"),
|
N_("Packets Out"),
|
||||||
N_("Packets Total"),
|
N_("Packets Total"),
|
||||||
@@ -56,18 +56,15 @@ const char *glibtop_labels_netload [GLIBTOP_MAX_NETLOAD] =
|
|||||||
N_("Errors In"),
|
N_("Errors In"),
|
||||||
N_("Errors Out"),
|
N_("Errors Out"),
|
||||||
N_("Errors Total"),
|
N_("Errors Total"),
|
||||||
N_("Collisions"),
|
N_("Collisions")
|
||||||
N_("IPv6 Address"),
|
|
||||||
N_("IPv6 Prefix"),
|
|
||||||
N_("IPv6 Scope")
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *glibtop_descriptions_netload [GLIBTOP_MAX_NETLOAD] =
|
const char *glibtop_descriptions_netload [GLIBTOP_MAX_NETLOAD] =
|
||||||
{
|
{
|
||||||
N_("Interface Flags"),
|
N_("Interface Flags"),
|
||||||
N_("Maximum Transfer Unit"),
|
N_("Maximum Transfer Unit"),
|
||||||
N_("IPv4 Subnet"),
|
N_("Subnet"),
|
||||||
N_("IPv4 Address"),
|
N_("Address"),
|
||||||
N_("Packets In"),
|
N_("Packets In"),
|
||||||
N_("Packets Out"),
|
N_("Packets Out"),
|
||||||
N_("Packets Total"),
|
N_("Packets Total"),
|
||||||
@@ -77,8 +74,5 @@ const char *glibtop_descriptions_netload [GLIBTOP_MAX_NETLOAD] =
|
|||||||
N_("Errors In"),
|
N_("Errors In"),
|
||||||
N_("Errors Out"),
|
N_("Errors Out"),
|
||||||
N_("Errors Total"),
|
N_("Errors Total"),
|
||||||
N_("Collisions"),
|
N_("Collisions")
|
||||||
N_("IPv6 Address"),
|
|
||||||
N_("IPv6 Prefix"),
|
|
||||||
N_("IPv6 Scope")
|
|
||||||
};
|
};
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
* procargs.c: (glibtop_get_proc_args_s):
|
* procargs.c: (glibtop_get_proc_args_s):
|
||||||
* procmap.c: (glibtop_get_proc_map_s): fix g_malloc usage on non-Linux
|
* 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>
|
2003-10-21 Bastien Nocera <hadess@hadess.net>
|
||||||
|
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
* open.c: (glibtop_open_p):
|
* open.c: (glibtop_open_p):
|
||||||
* proclist.c: (glibtop_get_proclist_p): fix g_malloc usage on non-Linux
|
* 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>
|
2003-10-21 Bastien Nocera <hadess@hadess.net>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user