Compare commits

..

7 Commits

Author SHA1 Message Date
Benoît Dejean
da54431af5 Fixed dist.
2007-05-14  Benoît Dejean  <benoit@placenet.org>

        * include/glibtop/Makefile.am:
        * lib/Makefile.am:

        Fixed dist.

svn path=/trunk/; revision=2583
2007-05-14 08:04:19 +00:00
Jorge Gonzalez Gonzalez
ace68aa492 Updated Spanish translation
svn path=/trunk/; revision=2582
2007-05-14 07:33:38 +00:00
Benoît Dejean
eee0cad2b6 Added missing files
svn path=/trunk/; revision=2580
2007-05-13 14:28:50 +00:00
Benoît Dejean
785b30aeb6 Released 2.19.2.
2007-05-13  Benoît Dejean  <benoit@placenet.org>

	* NEWS:
	* configure.in:
	
	Released 2.19.2.

svn path=/trunk/; revision=2579
2007-05-13 13:53:27 +00:00
Benoît Dejean
3eb958dc6c Manual commit from my local git-svn which is broken :/
svn path=/trunk/; revision=2578
2007-05-13 08:20:10 +00:00
Benoît Dejean
cd389851b9 Got rid of InodeDB. This feature was optionnal and i have never heard of
2007-04-27  Benoît Dejean  <benoit@placenet.org>

	Got rid of InodeDB.
	This feature was optionnal and i have never heard of anyone using
	it. I have never touched it so it may be broken since 2.6.

svn path=/trunk/; revision=2573
2007-04-27 17:37:47 +00:00
Felix I
7ee8dae9c5 updated ta translation
svn path=/trunk/; revision=2572
2007-04-27 05:48:21 +00:00
43 changed files with 574 additions and 815 deletions

View File

@@ -1,8 +1,42 @@
2007-05-08 Benoît Dejean <benoit@placenet.org>
2007-05-14 Benoît Dejean <benoit@placenet.org>
* include/glibtop/Makefile.am:
* lib/Makefile.am:
Fixed dist.
2007-05-13 Benoît Dejean <benoit@placenet.org>
* NEWS:
* configure.in:
Released 2.14.9.
Released 2.19.2.
2007-05-10 Benoît Dejean <benoit@placenet.org>
* lib/libgtop.sym:
Added missing *_p symbols.
2007-05-07 Benoît Dejean <benoit@placenet.org>
* configure.in:
* lib/Makefile.am:
* lib/libgtop.sym:
Updated libtool version.
Now uses a symbol list instead of a regex.
2007-05-07 Benoît Dejean <benoit@placenet.org>
* New API to get cwd, root and exe path
of a process. API not frozen yet.
2007-04-27 Benoît Dejean <benoit@placenet.org>
Got rid of InodeDB.
This feature was optionnal and i have never heard of anyone using
it. I have never touched it so it may be broken since 2.6.
2007-04-11 Benoît Dejean <benoit@placenet.org>

9
NEWS
View File

@@ -1,7 +1,10 @@
8 May 2007: Overview of changes in 2.14.9
=========================================
13 May 2007: Overview of changes in 2.19.2
==========================================
* This is the first release of the 2.19.x series.
* Got rid of inodedb (you don't even know what it is ;)
* New unstable API glibtop_get_proc_wd to get working directories of
a process.
* Fixed OpenBSD build. Jasper Lievisse Adriaanse.
* Misc. cleanups.
25 February 2007: Overview of changes in 2.14.8
===============================================

View File

@@ -3,12 +3,12 @@ dnl Configure script for the Gnome library
dnl
m4_define([libgtop_major_version], [2])
m4_define([libgtop_minor_version], [14])
m4_define([libgtop_micro_version], [9])
m4_define([libgtop_minor_version], [19])
m4_define([libgtop_micro_version], [2])
m4_define([libgtop_version], [libgtop_major_version.libgtop_minor_version.libgtop_micro_version])
dnl increment if the interface has additions, changes, removals.
m4_define([libgtop_current], [7])
m4_define([libgtop_current], [8])
dnl increment any time the source changes; set to
dnl 0 if you increment CURRENT
@@ -17,7 +17,7 @@ m4_define([libgtop_revision], [0])
dnl increment if any interfaces have been added; set to 0
dnl if any interfaces have been removed. removal has
dnl precedence over adding, so set to 0 if both happened.
m4_define([libgtop_age], [0])
m4_define([libgtop_age], [1])
# Increase each time you change the client/server protocol.
m4_define([libgtop_server_version], [5])
@@ -87,39 +87,12 @@ AM_CONDITIONAL(CROSS_COMPILING, test "x$cross_compiling" = xyes)
GNOME_LIBGTOP_SYSDEPS
GNOME_LIBGTOP_TYPES
AC_ARG_WITH(libgtop-inodedb,
AS_HELP_STRING([--with-libgtop-inodedb],
[Build the inodedb stuff @<:@default=no@:>@]),
[build_inodedb="$withval"],
[build_inodedb=no])
LIBGTOP_EXTRA_LIBS=
if test x$build_inodedb = xyes ; then
AC_CHECK_LIB(gdbm, gdbm_open, LIBGTOP_EXTRA_LIBS='-lgdbm', build_inodedb=no)
fi
AM_CONDITIONAL(INODEDB, test x$build_inodedb = xyes)
if test x$build_inodedb = xyes ; then
AC_DEFINE(GLIBTOP_INODEDB, 1,
[Define if the libgtop inodedb should be built])
fi
GLIB_REQUIRED=2.6.0
PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_REQUIRED)
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
AC_CHECK_HEADER(popt.h,[POPT=yes],[POPT=no])
AC_MSG_CHECKING(for popt.h)
if test x$POPT = xyes ; then
AC_MSG_RESULT(yes)
else
AC_MSG_ERROR([libgtop requires the popt development libraries])
fi
AC_CHECK_HEADER(ifaddrs.h, [HAVE_IFADDRS_H=yes], [HAVE_IFADDRS_H=no])
if test x$HAVE_IFADDRS_H = xyes ; then
AC_DEFINE(HAVE_IFADDRS_H, 1, [defined if you have ifaddrs.h])
@@ -300,10 +273,6 @@ if test x$libgtop_use_machine_h = xyes ; then
LIBGTOP_INCS="$LIBGTOP_INCS -DHAVE_GLIBTOP_MACHINE_H"
fi
if test x$build_inodedb = xyes ; then
LIBGTOP_INCS="$LIBGTOP_INCS -DGLIBTOP_INODEDB"
fi
if test x$libgtop_smp = xyes ; then
LIBGTOP_INCS="$LIBGTOP_INCS -DHAVE_LIBGTOP_SMP"
fi
@@ -413,7 +382,6 @@ sysdeps/aix/Makefile
sysdeps/bsd/Makefile
src/Makefile
src/daemon/Makefile
src/inodedb/Makefile
lib/Makefile
examples/Makefile
doc/Makefile

View File

@@ -171,7 +171,6 @@ rather than using the server.</para>
<xi:include href="xml/close.xml"/>
<xi:include href="xml/command.xml"/>
<xi:include href="xml/glibtop-server.xml"/>
<xi:include href="xml/inodedb.xml"/>
<xi:include href="xml/netload.xml"/>
<xi:include href="xml/ppp.xml"/>
<xi:include href="xml/shm_limits.xml"/>

View File

@@ -73,24 +73,6 @@ glibtop_server_ref
glibtop_server_unref
</SECTION>
<INCLUDE>glibtop/inodedb.h</INCLUDE>
<SECTION>
<FILE>inodedb</FILE>
<TITLE>Inode DB</TITLE>
GLIBTOP_INODEDB_SYSTEM
GLIBTOP_INODEDB_USER
GLIBTOP_INODEDB_CACHE
GLIBTOP_INODEDB_ALL
glibtop_inodedb
glibtop_inodedb_key
glibtop_inodedb_open
glibtop_inodedb_lookup
glibtop_inodedb_close
glibtop_inodedb_open_s
glibtop_inodedb_lookup_s
glibtop_inodedb_close_s
</SECTION>
<INCLUDE>glibtop/netload.h</INCLUDE>
<SECTION>
<FILE>netload</FILE>

View File

@@ -35,9 +35,6 @@
#include <glibtop/procmap.h>
#ifdef GLIBTOP_INODEDB
#include <glibtop/inodedb.h>
#endif
#include <sys/resource.h>
#include <sys/mman.h>
@@ -49,9 +46,6 @@
int
main (int argc, char *argv [])
{
#ifdef GLIBTOP_INODEDB
glibtop_inodedb *inodedb;
#endif
glibtop_proc_map procmap;
glibtop_map_entry *maps;
unsigned method, count, port, i;
@@ -87,10 +81,6 @@ main (int argc, char *argv [])
if ((argc != 2) || (sscanf (argv [1], "%d", (int *) &pid) != 1))
g_error ("Usage: %s pid", argv [0]);
#ifdef GLIBTOP_INODEDB
inodedb = glibtop_inodedb_open (0, 0);
#endif
fprintf (stderr, "Getting memory maps for pid %d.\n\n", (int) pid);
maps = glibtop_get_proc_map (&procmap, pid);
@@ -103,12 +93,6 @@ main (int argc, char *argv [])
if (maps [i].flags & (1L << GLIBTOP_MAP_ENTRY_FILENAME))
filename = maps [i].filename;
#ifdef GLIBTOP_INODEDB
if (inodedb && !filename)
filename = glibtop_inodedb_lookup
(inodedb, maps [i].device, maps [i].inode);
#endif
perm [0] = (maps [i].perm & GLIBTOP_MAP_PERM_READ) ? 'r' : '-';
perm [1] = (maps [i].perm & GLIBTOP_MAP_PERM_WRITE) ? 'w' : '-';
perm [2] = (maps [i].perm & GLIBTOP_MAP_PERM_EXECUTE) ? 'x' : '-';

31
examples/wd.c Normal file
View File

@@ -0,0 +1,31 @@
#include <glibtop.h>
#include <glibtop/procwd.h>
#include <glib.h>
#include <unistd.h>
int main(int argc, char **argv)
{
pid_t pid;
glibtop_proc_wd buf;
char **dirs, **dir;
if (argc < 2 || !(pid = strtoul(argv[1], NULL, 0)))
pid = getpid();
dirs = glibtop_get_proc_wd(&buf, pid);
g_print("Process %u:\n"
" - root: '%s'\n"
" - exe: '%s'\n"
" - working directories:\n",
(unsigned)pid, buf.root, buf.exe);
for (dir = dirs; *dir; ++dir)
g_print(" - '%s'\n", *dir);
g_strfreev(dirs);
return 0;
}

View File

@@ -22,4 +22,5 @@ void|@fsusage|ulong(blocks,bfree,bavail,files,ffree)|string|mount_dir
void|netload|ulong(if_flags,mtu,subnet,address,packets_in,packets_out,packets_total,bytes_in,bytes_out,bytes_total,errors_in,errors_out,errors_total,collisions)|string|interface
void|ppp|ulong(state,bytes_in,bytes_out)|ushort(device)
char **|netlist|unsigned(number)
char **|proc_wd|ulong(number),str(root),str(exe)|pid_t(pid)

View File

@@ -7,7 +7,8 @@ glibtop_HEADERS = close.h loadavg.h prockernel.h procstate.h \
procsegment.h sysdeps.h global.h \
procsignal.h union.h gnuserv.h \
parameter.h mountlist.h fsusage.h procmap.h signal.h \
inodedb.h sysinfo.h ppp.h procargs.h netload.h \
sysinfo.h ppp.h procargs.h netload.h \
procwd.h \
netlist.h procopenfiles.h open.h
noinst_HEADERS = error.h write.h read_data.h read.h init_hooks.h

View File

@@ -57,8 +57,9 @@ G_BEGIN_DECLS
#define GLIBTOP_CMND_PPP 23
#define GLIBTOP_CMND_NETLIST 24
#define GLIBTOP_CMND_PROC_OPEN_FILES 25
#define GLIBTOP_CMND_PROC_WD 26
#define GLIBTOP_MAX_CMND 26
#define GLIBTOP_MAX_CMND 27
#define _GLIBTOP_PARAM_SIZE 16

View File

@@ -1,67 +0,0 @@
/* 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_INODEDB_H__
#define __GLIBTOP_INODEDB_H__
#include <glibtop.h>
#include <gdbm.h>
#define GLIBTOP_INODEDB_SYSTEM 1
#define GLIBTOP_INODEDB_USER 2
#define GLIBTOP_INODEDB_CACHE 4
#define GLIBTOP_INODEDB_ALL 7
G_BEGIN_DECLS
typedef struct _glibtop_inodedb glibtop_inodedb;
typedef struct _glibtop_inodedb_key glibtop_inodedb_key;
struct _glibtop_inodedb_key
{
guint64 device, inode;
};
struct _glibtop_inodedb
{
GDBM_FILE system_dbf, user_dbf;
};
#define glibtop_inodedb_open(p1,p2) glibtop_inodedb_open_s(glibtop_global_server, p1, p2)
#define glibtop_inodedb_lookup(p1,p2,p3) glibtop_inodedb_lookup_s(glibtop_global_server, p1, p2, p3)
#define glibtop_inodedb_close(p1) glibtop_inodedb_close_s(glibtop_global_server)
glibtop_inodedb *
glibtop_inodedb_open_s (glibtop *server, unsigned databases, unsigned long cache_size);
const char *
glibtop_inodedb_lookup_s (glibtop *server,
glibtop_inodedb *inodedb,
guint64 device, guint64 inode);
void
glibtop_inodedb_close_s (glibtop *server, glibtop_inodedb *inodedb);
G_END_DECLS
#endif

69
include/glibtop/procwd.h Normal file
View File

@@ -0,0 +1,69 @@
/* Copyright (C) 2007 Benoît Dejean
This file is part of LibGTop 2.
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_PROCWD_H__
#define __GLIBTOP_PROCWD_H__
#include <glibtop.h>
#include <glibtop/global.h>
G_BEGIN_DECLS
typedef struct _glibtop_proc_wd glibtop_proc_wd;
#define GLIBTOP_PROC_WD_NUMBER 0
#define GLIBTOP_PROC_WD_ROOT 1
#define GLIBTOP_PROC_WD_EXE 2
#define GLIBTOP_PROC_WD_MAX 3
#define GLIBTOP_PROC_WD_ROOT_LEN 215
#define GLIBTOP_PROC_WD_EXE_LEN 215
struct _glibtop_proc_wd
{
guint64 flags;
guint32 number;
char root[GLIBTOP_PROC_WD_ROOT_LEN+1];
char exe[GLIBTOP_PROC_WD_EXE_LEN+1];
};
char ** glibtop_get_proc_wd(glibtop_proc_wd *buf, pid_t pid);
char ** glibtop_get_proc_wd_l(glibtop *server, glibtop_proc_wd *buf, pid_t pid);
#if GLIBTOP_SUID_PROC_WD
#define glibtop_get_proc_wd_r glibtop_get_proc_wd_p
void _glibtop_init_proc_wd_p(glibtop *server);
char ** glibtop_get_proc_wd_p(glibtop *server, glibtop_proc_wd *buf, pid_t pid);
#else
#define glibtop_get_proc_wd_r glibtop_get_proc_wd_s
void _glibtop_init_proc_wd_s(glibtop *server);
char ** glibtop_get_proc_wd_s(glibtop *server, glibtop_proc_wd *buf, pid_t pid);
#endif
G_END_DECLS
#endif

View File

@@ -51,8 +51,9 @@ G_BEGIN_DECLS
#define GLIBTOP_SYSDEPS_PPP 22
#define GLIBTOP_SYSDEPS_NETLIST 23
#define GLIBTOP_SYSDEPS_PROC_OPEN_FILES 24
#define GLIBTOP_SYSDEPS_PROC_WD 25
#define GLIBTOP_MAX_SYSDEPS 25
#define GLIBTOP_MAX_SYSDEPS 26
#define GLIBTOP_SYSDEPS_ALL ((1 << GLIBTOP_MAX_SYSDEPS) - 1)
@@ -86,6 +87,7 @@ struct _glibtop_sysdeps
guint64 netlist; /* glibtop_netlist */
guint64 netload; /* glibtop_netload */
guint64 ppp; /* glibtop_ppp */
guint64 proc_wd; /* glibtop_proc_wd */
};
void glibtop_get_sysdeps (glibtop_sysdeps *buf);

View File

@@ -42,6 +42,7 @@
#include <glibtop/procargs.h>
#include <glibtop/procmap.h>
#include <glibtop/procopenfiles.h>
#include <glibtop/procwd.h>
#include <glibtop/mountlist.h>
#include <glibtop/fsusage.h>
@@ -80,6 +81,7 @@ union _glibtop_union
glibtop_netload netload;
glibtop_ppp ppp;
glibtop_proc_open_files proc_open_files;
glibtop_proc_wd proc_wd;
};
G_END_DECLS

View File

@@ -7,7 +7,7 @@ libgtop_2_0_la_SOURCES = init.c open.c close.c command.c read.c \
read_data.c write.c lib.c parameter.c \
sysdeps.c
libgtop_2_0_la_LDFLAGS = $(LT_VERSION_INFO) -export-symbols-regex "^[^_].*"
libgtop_2_0_la_LDFLAGS = $(LT_VERSION_INFO) -export-symbols $(srcdir)/libgtop.sym
libgtop_2_0_la_LIBADD = $(GLIB_LIBS) $(top_builddir)/sysdeps/common/libgtop_common-2.0.la $(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps-2.0.la $(sysdeps_suid_lib)
BUILT_SOURCES = lib.c
@@ -16,7 +16,7 @@ lib.c: lib.pl $(top_builddir)/config.h $(top_srcdir)/features.def
$(PERL) $(srcdir)/lib.pl < $(top_srcdir)/features.def > lib-t
mv lib-t lib.c
EXTRA_DIST = lib.pl
EXTRA_DIST = lib.pl libgtop.sym
CLEANFILES = lib.c

View File

@@ -1,115 +0,0 @@
/* 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 <config.h>
#include <glibtop.h>
#include <glibtop/error.h>
#include <glibtop/inodedb.h>
#include <pwd.h>
#include <gdbm.h>
#ifndef SYSTEM_INODEDB
#define SYSTEM_INODEDB "/usr/var/libgtop/inodedb.db"
#endif
glibtop_inodedb *
glibtop_inodedb_open_s (glibtop *server, unsigned databases,
unsigned long cachesize)
{
glibtop_inodedb *inodedb;
char filename [BUFSIZ];
struct passwd *pwd;
struct stat statb;
if (!databases)
databases = GLIBTOP_INODEDB_ALL;
inodedb = g_malloc (sizeof (glibtop_inodedb));
if (stat (SYSTEM_INODEDB, &statb))
databases &= ~GLIBTOP_INODEDB_SYSTEM;
if (databases & GLIBTOP_INODEDB_SYSTEM) {
inodedb->system_dbf = gdbm_open
(SYSTEM_INODEDB, 0, GDBM_READER, 0, 0);
if (!inodedb->system_dbf)
glibtop_error_io_r
(server, "gdbm_open (%s)", SYSTEM_INODEDB);
}
pwd = getpwuid (getuid ());
if (!pwd) glibtop_error_io_r (server, "getpwuid");
sprintf (filename, "%s/var/libgtop/inodedb.db", pwd->pw_dir);
if (stat (filename, &statb))
databases &= ~GLIBTOP_INODEDB_USER;
if (databases & GLIBTOP_INODEDB_USER) {
inodedb->user_dbf = gdbm_open
(filename, 0, GDBM_READER, 0, 0);
if (!inodedb->user_dbf)
glibtop_error_io_r
(server, "gdbm_open (%s)", filename);
}
return inodedb;
}
const char *
glibtop_inodedb_lookup_s (glibtop *server,
glibtop_inodedb *inodedb,
guint64 device, guint64 inode)
{
glibtop_inodedb_key key;
datum d_key, d_content;
d_key.dptr = (void *) &key;
d_key.dsize = sizeof (key);
key.device = device;
key.inode = inode;
if (inodedb->system_dbf) {
d_content = gdbm_fetch (inodedb->system_dbf, d_key);
if (d_content.dptr) return d_content.dptr;
}
if (inodedb->user_dbf) {
d_content = gdbm_fetch (inodedb->user_dbf, d_key);
if (d_content.dptr) return d_content.dptr;
}
return NULL;
}
void
glibtop_inodedb_close_s (glibtop *server, glibtop_inodedb *inodedb)
{
if (inodedb->system_dbf)
gdbm_close (inodedb->system_dbf);
if (inodedb->user_dbf)
gdbm_close (inodedb->user_dbf);
g_free (inodedb);
}

130
lib/libgtop.sym Normal file
View File

@@ -0,0 +1,130 @@
glibtop_call_l
glibtop_call_p
glibtop_close
glibtop_close_p
glibtop_close_r
glibtop_close_s
glibtop_get_cpu
glibtop_get_cpu_l
glibtop_get_cpu_p
glibtop_get_cpu_s
glibtop_get_fsusage
glibtop_get_fsusage_l
glibtop_get_fsusage_p
glibtop_get_fsusage_s
glibtop_get_loadavg
glibtop_get_loadavg_l
glibtop_get_loadavg_p
glibtop_get_loadavg_s
glibtop_get_mem
glibtop_get_mem_l
glibtop_get_mem_p
glibtop_get_mem_s
glibtop_get_mountlist
glibtop_get_mountlist_l
glibtop_get_mountlist_p
glibtop_get_mountlist_s
glibtop_get_msg_limits
glibtop_get_msg_limits_l
glibtop_get_msg_limits_p
glibtop_get_msg_limits_s
glibtop_get_netlist
glibtop_get_netlist_l
glibtop_get_netlist_p
glibtop_get_netlist_s
glibtop_get_netload
glibtop_get_netload_l
glibtop_get_netload_p
glibtop_get_netload_s
glibtop_get_parameter_l
glibtop_get_parameter_p
glibtop_get_ppp
glibtop_get_ppp_l
glibtop_get_ppp_p
glibtop_get_ppp_s
glibtop_get_proc_args
glibtop_get_proc_args_l
glibtop_get_proc_args_p
glibtop_get_proc_args_s
glibtop_get_proc_argv
glibtop_get_proc_argv_l
glibtop_get_proc_argv_p
glibtop_get_proc_kernel
glibtop_get_proc_kernel_l
glibtop_get_proc_kernel_p
glibtop_get_proc_kernel_s
glibtop_get_proclist
glibtop_get_proclist_l
glibtop_get_proclist_p
glibtop_get_proclist_s
glibtop_get_proc_map
glibtop_get_proc_map_l
glibtop_get_proc_map_p
glibtop_get_proc_map_s
glibtop_get_proc_mem
glibtop_get_proc_mem_l
glibtop_get_proc_mem_p
glibtop_get_proc_mem_s
glibtop_get_proc_open_files
glibtop_get_proc_open_files_l
glibtop_get_proc_open_files_p
glibtop_get_proc_open_files_s
glibtop_get_proc_segment
glibtop_get_proc_segment_l
glibtop_get_proc_segment_p
glibtop_get_proc_segment_s
glibtop_get_proc_signal
glibtop_get_proc_signal_l
glibtop_get_proc_signal_p
glibtop_get_proc_signal_s
glibtop_get_proc_state
glibtop_get_proc_state_l
glibtop_get_proc_state_p
glibtop_get_proc_state_s
glibtop_get_proc_time
glibtop_get_proc_time_l
glibtop_get_proc_time_p
glibtop_get_proc_time_s
glibtop_get_proc_uid
glibtop_get_proc_uid_l
glibtop_get_proc_uid_p
glibtop_get_proc_uid_s
glibtop_get_proc_wd
glibtop_get_proc_wd_l
glibtop_get_proc_wd_p
glibtop_get_proc_wd_s
glibtop_get_sem_limits
glibtop_get_sem_limits_l
glibtop_get_sem_limits_p
glibtop_get_sem_limits_s
glibtop_get_shm_limits
glibtop_get_shm_limits_l
glibtop_get_shm_limits_p
glibtop_get_shm_limits_s
glibtop_get_swap
glibtop_get_swap_l
glibtop_get_swap_p
glibtop_get_swap_s
glibtop_get_sysdeps
glibtop_get_sysdeps_r
glibtop_get_sysinfo
glibtop_get_sysinfo_p
glibtop_get_sysinfo_s
glibtop_get_uptime
glibtop_get_uptime_l
glibtop_get_uptime_p
glibtop_get_uptime_s
glibtop_global_server
glibtop_init
glibtop_init_p
glibtop_init_r
glibtop_init_s
glibtop_internet_addr
glibtop_make_connection
glibtop_open_l
glibtop_open_p
glibtop_open_s
glibtop_server_features
glibtop_set_parameter_l
glibtop_set_parameter_p
glibtop_sys_siglist

View File

@@ -46,6 +46,7 @@ GLIBTOP_SUID_PROC_ARGS +
GLIBTOP_SUID_PROC_MAP +
GLIBTOP_SUID_NETLOAD +
GLIBTOP_SUID_NETLIST +
GLIBTOP_SUID_PROC_WD +
GLIBTOP_SUID_PPP;
const _glibtop_init_func_t _glibtop_init_hook_s [] = {
@@ -109,6 +110,9 @@ const _glibtop_init_func_t _glibtop_init_hook_s [] = {
#if !GLIBTOP_SUID_NETLIST
_glibtop_init_netlist_s,
#endif
#if !GLIBTOP_SUID_PROC_WD
_glibtop_init_proc_wd_s,
#endif
#if !GLIBTOP_SUID_PPP
_glibtop_init_ppp_s,
#endif
@@ -176,6 +180,9 @@ const _glibtop_init_func_t _glibtop_init_hook_p [] = {
#if GLIBTOP_SUID_NETLIST
_glibtop_init_netlist_p,
#endif
#if GLIBTOP_SUID_PROC_WD
_glibtop_init_proc_wd_p,
#endif
#if GLIBTOP_SUID_PPP
_glibtop_init_ppp_p,
#endif

View File

@@ -59,12 +59,12 @@ Examples for LibGTop.
%build
# Needed for snapshot releases.
if [ ! -f configure ]; then
CFLAGS="$RPM_OPT_FLAGS" ./autogen.sh --prefix=%prefix --without-linux-table --with-libgtop-inodedb --with-libgtop-examples --with-libgtop-smp
CFLAGS="$RPM_OPT_FLAGS" ./autogen.sh --prefix=%prefix --without-linux-table --with-libgtop-examples --with-libgtop-smp
else
%ifarch alpha
CFLAGS="$RPM_OPT_FLAGS" ./configure --host=alpha-redhat-linux --prefix=%prefix --without-linux-table --with-libgtop-inodedb --with-libgtop-examples --with-libgtop-smp
%else
CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%prefix --without-linux-table --with-libgtop-inodedb --with-libgtop-examples --with-libgtop-smp
CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%prefix --without-linux-table --with-libgtop-examples --with-libgtop-smp
%endif
fi

View File

@@ -1,3 +1,11 @@
2007-05-14 Jorge Gonzalez <jorgegonz@svn.gnome.org>
* es.po: Updated Spanish translation.
2007-04-27 I Felix <ifelix25@gmail.com>
* ta.po: Updated Tamil Translation.
2007-04-25 Benoît Dejean <benoit@placenet.org>
* ta.po: Updated Tamil translation.

View File

@@ -15,8 +15,6 @@ src/daemon/main.c
src/daemon/server.c
src/daemon/slave.c
src/daemon/version.c
src/inodedb/file_by_inode2.c
src/inodedb/mkinodedb2.c
sysdeps/linux/siglist.c
sysdeps/osf1/siglist.c
sysdeps/sun4/siglist.c

126
po/es.po
View File

@@ -1,217 +1,193 @@
# traducción de es.po al Spanish
# translation of libgtop.libgtop-GNOME-2-0-port.po to Spanish
# Translation into spanish of glibtop
# FIXME: the strings still left empty are the ones I've no idea how
# to translate them; if anyone has a suggestion...
#
# Pablo Saratxaga <srtxg@chanae.alphanet.ch>, 1998-2000.
# Germán Poo Caamaño <gpoo@ubiobio.cl>, 2002.
# Pablo Saratxaga <srtxg@chanae.alphanet.ch>, 2002.
# Juan Manuel García Molina <juanma_gm@wanadoo.es>, 2002.
# Francisco Javier F. Serrador <serrador@arrakis.es>, 2003.
# Francisco Javier F. Serrador <serrador@cvs.gnome.org>, 2004.
#
# Francisco Javier F. Serrador <serrador@cvs.gnome.org>, 2003, 2004.
# Jorge González <jorgegonz@svn.gnome.org>, 2007.
msgid ""
msgstr ""
"Project-Id-Version: es\n"
"Project-Id-Version: libgtop.HEAD.es\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2005-09-25 18:15+0200\n"
"PO-Revision-Date: 2004-12-29 20:29+0100\n"
"Last-Translator: Francisco Javier F. Serrador <serrador@cvs.gnome.org>\n"
"POT-Creation-Date: 2007-05-14 03:41+0100\n"
"PO-Revision-Date: 2007-05-14 09:30+0200\n"
"Last-Translator: Jorge González <jorgegonz@svn.gnome.org>\n"
"Language-Team: Spanish <traductores@es.gnome.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"First-Translator: Pablo Saratxaga <srtxg@chanae.alphanet.ch>\n"
"X-Generator: KBabel 1.3.1\n"
"X-Generator: KBabel 1.11.4\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: lib/read.c:65
#: ../lib/read.c:51
#, c-format
msgid "read %d byte"
msgid_plural "read %d bytes"
msgstr[0] "leído %d byte"
msgstr[1] "leídos %d bytes"
#: lib/read_data.c:53
#: ../lib/read_data.c:51
msgid "read data size"
msgstr "leído tamaño de datos"
#: lib/read_data.c:72
#: ../lib/read_data.c:70
#, c-format
msgid "read %lu byte of data"
msgid_plural "read %lu bytes of data"
msgstr[0] "leído %lu byte de datos"
msgstr[1] "leídos %lu bytes de datos"
#: lib/write.c:52
#: ../lib/write.c:51
#, c-format
msgid "wrote %d byte"
msgid_plural "wrote %d bytes"
msgstr[0] "escrito %d byte"
msgstr[1] "escritos %d bytes"
#: src/daemon/gnuserv.c:460
#: ../src/daemon/gnuserv.c:458
msgid "Enable debugging"
msgstr "Activar depuración"
#: src/daemon/gnuserv.c:460
msgid "DEBUG"
msgstr "DEPURACIÓN"
#: src/daemon/gnuserv.c:462
#: ../src/daemon/gnuserv.c:460
msgid "Enable verbose output"
msgstr "Activa salida detallada"
#: src/daemon/gnuserv.c:462
msgid "VERBOSE"
msgstr "DETALLADO"
#: src/daemon/gnuserv.c:464
#: ../src/daemon/gnuserv.c:462
msgid "Don't fork into background"
msgstr "No se pudo abrir un proceso en segundo plano"
#: src/daemon/gnuserv.c:464
msgid "NO-DAEMON"
msgstr "NO-DAEMON"
#: src/daemon/gnuserv.c:466
#: ../src/daemon/gnuserv.c:464
msgid "Invoked from inetd"
msgstr "Invocado desde inetd"
#: src/daemon/gnuserv.c:466
msgid "INETD"
msgstr "INETD"
#: src/daemon/gnuserv.c:500
#: ../src/daemon/gnuserv.c:498
#, c-format
msgid ""
"Error on option %s: %s.\n"
"Run '%s --help' to see a full list of available command line options.\n"
msgstr ""
"Error con la opción %s: %s.\n"
"Ejecute '%s --help' para ver una lista completa de las opciones "
"disponibles.\n"
msgid "Run '%s --help' to see a full list of available command line options.\n"
msgstr "Ejecute '%s --help' para ver una lista completa de las opciones disponibles.\n"
#: sysdeps/osf1/siglist.c:28 sysdeps/sun4/siglist.c:28
#: ../sysdeps/osf1/siglist.c:27 ../sysdeps/sun4/siglist.c:27
msgid "Hangup"
msgstr "Terminar"
#: sysdeps/osf1/siglist.c:29 sysdeps/sun4/siglist.c:29
#: ../sysdeps/osf1/siglist.c:28 ../sysdeps/sun4/siglist.c:28
msgid "Interrupt"
msgstr "Interrumpir"
#: sysdeps/osf1/siglist.c:30 sysdeps/sun4/siglist.c:30
#: ../sysdeps/osf1/siglist.c:29 ../sysdeps/sun4/siglist.c:29
msgid "Quit"
msgstr "Salir"
#: sysdeps/osf1/siglist.c:31 sysdeps/sun4/siglist.c:31
#: ../sysdeps/osf1/siglist.c:30 ../sysdeps/sun4/siglist.c:30
msgid "Illegal instruction"
msgstr "Instrucción ilegal"
#: sysdeps/osf1/siglist.c:32 sysdeps/sun4/siglist.c:32
#: ../sysdeps/osf1/siglist.c:31 ../sysdeps/sun4/siglist.c:31
msgid "Trace trap"
msgstr "Atrapar traza"
#: sysdeps/osf1/siglist.c:33 sysdeps/sun4/siglist.c:33
#: ../sysdeps/osf1/siglist.c:32 ../sysdeps/sun4/siglist.c:32
msgid "Abort"
msgstr "Abortar"
#: sysdeps/osf1/siglist.c:34 sysdeps/sun4/siglist.c:34
#: ../sysdeps/osf1/siglist.c:33 ../sysdeps/sun4/siglist.c:33
msgid "EMT error"
msgstr "Error EMT"
#: sysdeps/osf1/siglist.c:35 sysdeps/sun4/siglist.c:35
#: ../sysdeps/osf1/siglist.c:34 ../sysdeps/sun4/siglist.c:34
msgid "Floating-point exception"
msgstr "Excepción de coma flotante"
#: sysdeps/osf1/siglist.c:36 sysdeps/sun4/siglist.c:36
#: ../sysdeps/osf1/siglist.c:35 ../sysdeps/sun4/siglist.c:35
msgid "Kill"
msgstr "Matar"
#: sysdeps/osf1/siglist.c:37 sysdeps/sun4/siglist.c:37
#: ../sysdeps/osf1/siglist.c:36 ../sysdeps/sun4/siglist.c:36
msgid "Bus error"
msgstr "Error de bus"
#: sysdeps/osf1/siglist.c:38 sysdeps/sun4/siglist.c:38
#: ../sysdeps/osf1/siglist.c:37 ../sysdeps/sun4/siglist.c:37
msgid "Segmentation violation"
msgstr "Violación de segmento"
#: sysdeps/osf1/siglist.c:39 sysdeps/sun4/siglist.c:39
#: ../sysdeps/osf1/siglist.c:38 ../sysdeps/sun4/siglist.c:38
msgid "Bad argument to system call"
msgstr "Argumento incorrecto en llamada al sistema"
#: sysdeps/osf1/siglist.c:40 sysdeps/sun4/siglist.c:40
#: ../sysdeps/osf1/siglist.c:39 ../sysdeps/sun4/siglist.c:39
msgid "Broken pipe"
msgstr "Tubería rota"
#: sysdeps/osf1/siglist.c:41 sysdeps/sun4/siglist.c:41
#: ../sysdeps/osf1/siglist.c:40 ../sysdeps/sun4/siglist.c:40
msgid "Alarm clock"
msgstr "Alarma de reloj"
#: sysdeps/osf1/siglist.c:42 sysdeps/sun4/siglist.c:42
#: ../sysdeps/osf1/siglist.c:41 ../sysdeps/sun4/siglist.c:41
msgid "Termination"
msgstr "Terminación"
#: sysdeps/osf1/siglist.c:43 sysdeps/sun4/siglist.c:43
#: ../sysdeps/osf1/siglist.c:42 ../sysdeps/sun4/siglist.c:42
msgid "Urgent condition on socket"
msgstr "Condición urgente en socket"
#: sysdeps/osf1/siglist.c:44 sysdeps/sun4/siglist.c:44
#: ../sysdeps/osf1/siglist.c:43 ../sysdeps/sun4/siglist.c:43
msgid "Stop"
msgstr "Parada"
#: sysdeps/osf1/siglist.c:45 sysdeps/sun4/siglist.c:45
#: ../sysdeps/osf1/siglist.c:44 ../sysdeps/sun4/siglist.c:44
msgid "Keyboard stop"
msgstr "Parada de teclado"
#: sysdeps/osf1/siglist.c:46 sysdeps/sun4/siglist.c:46
#: ../sysdeps/osf1/siglist.c:45 ../sysdeps/sun4/siglist.c:45
msgid "Continue"
msgstr "Continuar"
#: sysdeps/osf1/siglist.c:47 sysdeps/sun4/siglist.c:47
#: ../sysdeps/osf1/siglist.c:46 ../sysdeps/sun4/siglist.c:46
msgid "Child status has changed"
msgstr "Cambio de estado de hijo"
#: sysdeps/osf1/siglist.c:48 sysdeps/sun4/siglist.c:48
#: ../sysdeps/osf1/siglist.c:47 ../sysdeps/sun4/siglist.c:47
msgid "Background read from tty"
msgstr "Lectura en segundo plano de tty"
#: sysdeps/osf1/siglist.c:49 sysdeps/sun4/siglist.c:49
#: ../sysdeps/osf1/siglist.c:48 ../sysdeps/sun4/siglist.c:48
msgid "Background write to tty"
msgstr "Escritura en segundo plano a tty"
#: sysdeps/osf1/siglist.c:50 sysdeps/sun4/siglist.c:50
#: ../sysdeps/osf1/siglist.c:49 ../sysdeps/sun4/siglist.c:49
msgid "I/O now possible"
msgstr "E/S ahora posible"
#: sysdeps/osf1/siglist.c:51 sysdeps/sun4/siglist.c:51
#: ../sysdeps/osf1/siglist.c:50 ../sysdeps/sun4/siglist.c:50
msgid "CPU limit exceeded"
msgstr "Excedido límite de CPU"
#: sysdeps/osf1/siglist.c:52 sysdeps/sun4/siglist.c:52
#: ../sysdeps/osf1/siglist.c:51 ../sysdeps/sun4/siglist.c:51
msgid "File size limit exceeded"
msgstr "Tamaño límite de archivo excedido"
#: sysdeps/osf1/siglist.c:53 sysdeps/sun4/siglist.c:53
#: ../sysdeps/osf1/siglist.c:52 ../sysdeps/sun4/siglist.c:52
msgid "Virtual alarm clock"
msgstr "Alarma de reloj virtual"
#: sysdeps/osf1/siglist.c:54 sysdeps/sun4/siglist.c:54
#: ../sysdeps/osf1/siglist.c:53 ../sysdeps/sun4/siglist.c:53
msgid "Profiling alarm clock"
msgstr "Alarma de reloj perfilada"
#: sysdeps/osf1/siglist.c:55 sysdeps/sun4/siglist.c:55
#: ../sysdeps/osf1/siglist.c:54 ../sysdeps/sun4/siglist.c:54
msgid "Window size change"
msgstr "Cambio del tamaño de ventana"
#: sysdeps/osf1/siglist.c:56 sysdeps/sun4/siglist.c:56
#: ../sysdeps/osf1/siglist.c:55 ../sysdeps/sun4/siglist.c:55
msgid "Information request"
msgstr "Solicitud de información"
#: sysdeps/osf1/siglist.c:57 sysdeps/sun4/siglist.c:57
#: ../sysdeps/osf1/siglist.c:56 ../sysdeps/sun4/siglist.c:56
msgid "User defined signal 1"
msgstr "Señal 1 definida por el usuario"
#: sysdeps/osf1/siglist.c:58 sysdeps/sun4/siglist.c:58
#: ../sysdeps/osf1/siglist.c:57 ../sysdeps/sun4/siglist.c:57
msgid "User defined signal 2"
msgstr "Señal 2 definida por el usuario"

View File

@@ -1,4 +1,4 @@
# translation of ta.po to Tamil
# translation of ta.po to
# Tamil translation of Tamil Libgtop 2.4.
# Copyright (C) 2003, 2004,2007 Free Software Foundation, Inc.
# Dinesh Nadarajah <n_dinesh@yahoo.com>, 2003.
@@ -10,14 +10,14 @@ msgstr ""
"Project-Id-Version: ta\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2005-09-25 18:15+0200\n"
"PO-Revision-Date: 2007-04-24 16:28+0530\n"
"Last-Translator: B.Senthil Kumar <senthilb@cdac.in>\n"
"Language-Team: Tamil <tamil-DI@yahoogroups.com>\n"
"PO-Revision-Date: 2007-04-27 11:03+0530\n"
"Last-Translator: \n"
"Language-Team: <en@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"0500\n"
"X-Generator: KBabel 1.3.1\n"
"X-Generator: KBabel 1.11.4\n"
"Plural-Forms: Plural-Forms: nplurals=2; plural=(n != 1);\n"
"\n"
@@ -33,18 +33,18 @@ msgid "read data size"
msgstr "படித்த தகவல் அளவு"
#: lib/read_data.c:72
#, fuzzy, c-format
#, c-format
msgid "read %lu byte of data"
msgid_plural "read %lu bytes of data"
msgstr[0] "%d பைட்கள் படி"
msgstr[1] "%d பைட்கள் படி"
msgstr[0] "தரவின் %lu பைட்டை வாசிக்கவும்"
msgstr[1] "தரவின் %lu பைட்டுக்களை வாசிக்கவும்"
#: lib/write.c:52
#, fuzzy, c-format
#, c-format
msgid "wrote %d byte"
msgid_plural "wrote %d bytes"
msgstr[0] "எழுதிய %d பைட்"
msgstr[1] "எழுதிய %d பைட்"
msgstr[1] "எழுதிய %d பைட்டுகள்"
#: src/daemon/gnuserv.c:460
msgid "Enable debugging"
@@ -210,3 +210,4 @@ msgstr "பயனீட்டாளர் குறித்த சங்கே
#: sysdeps/osf1/siglist.c:58 sysdeps/sun4/siglist.c:58
msgid "User defined signal 2"
msgstr "பயனீட்டாளர் குறித்த சங்கேதம் 2"

View File

@@ -1,16 +1,10 @@
if INODEDB
inodedb_SUBDIRS = inodedb
else
inodedb_SUBDIRS =
endif
if NEED_LIBGTOP
daemon_SUBDIRS = daemon
else
daemon_SUBDIRS =
endif
SUBDIRS = $(daemon_SUBDIRS) $(inodedb_SUBDIRS)
SUBDIRS = $(daemon_SUBDIRS)
DIST_SUBDIRS = daemon inodedb
DIST_SUBDIRS = daemon

View File

@@ -40,11 +40,10 @@ libgtop_daemon2_LDADD = $(top_builddir)/lib/libgtop-2.0.la \
@sysdeps_suid_lib@ \
$(suid_sysdeps) $(suid_common) \
$(LIBGTOP_LIBS) \
-lpopt \
@libs_xauth@
libgtop_server2_SOURCES = server.c slave.c io.c version.c daemon.h
libgtop_server2_LDADD = $(GLIB_LIBS) -lpopt $(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps_suid-2.0.la \
libgtop_server2_LDADD = $(GLIB_LIBS) $(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps_suid-2.0.la \
$(top_builddir)/sysdeps/common/libgtop_suid_common-2.0.la
EXTRA_DIST = server_config.h.in server_config.pl

View File

@@ -69,8 +69,8 @@ int do_read (int s, void *ptr, size_t total_size) G_GNUC_INTERNAL;
void syslog_message (int priority, const char *format, ...) G_GNUC_INTERNAL G_GNUC_PRINTF(2, 3);
void syslog_io_message (int priority, const char *format, ...) G_GNUC_INTERNAL G_GNUC_PRINTF(2, 3);
extern int enable_debug;
extern int verbose_output;
extern gboolean enable_debug;
extern gboolean verbose_output;
G_END_DECLS

View File

@@ -46,7 +46,6 @@
#include <glibtop/gnuserv.h>
#include <errno.h>
#include <popt.h>
#include "daemon.h"
@@ -79,10 +78,10 @@ static Xauth *server_xauth = NULL;
#endif /* AUTH_MAGIC_COOKIE */
int enable_debug = 0;
int verbose_output = 0;
static int no_daemon = 0;
static int invoked_from_inetd = 0;
gboolean enable_debug = FALSE;
gboolean verbose_output = FALSE;
static gboolean no_daemon = FALSE;
static gboolean invoked_from_inetd = FALSE;
static int changed_uid = 0;
void
@@ -454,27 +453,26 @@ handle_signal (int sig)
exit (1);
}
const struct poptOption popt_options [] = {
POPT_AUTOHELP
{ "debug", 'd', POPT_ARG_NONE, &enable_debug, 0,
N_("Enable debugging"), N_("DEBUG") },
{ "verbose", 'v', POPT_ARG_NONE, &verbose_output, 0,
N_("Enable verbose output"), N_("VERBOSE") },
{ "no-daemon", 'f', POPT_ARG_NONE, &no_daemon, 0,
N_("Don't fork into background"), N_("NO-DAEMON") },
{ "inetd", 'i', POPT_ARG_NONE, &invoked_from_inetd, 0,
N_("Invoked from inetd"), N_("INETD") },
{ NULL, '\0', 0, NULL, 0, NULL, NULL }
static const GOptionEntry options [] = {
{ "debug", 'd', 0, G_OPTION_ARG_NONE, &enable_debug,
N_("Enable debugging"), NULL },
{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose_output,
N_("Enable verbose output"), NULL },
{ "no-daemon", 'f', 0, G_OPTION_ARG_NONE, &no_daemon,
N_("Don't fork into background"), NULL },
{ "inetd", 'i', 0, G_OPTION_ARG_NONE, &invoked_from_inetd,
N_("Invoked from inetd"), NULL },
{ NULL }
};
int
main (int argc, const char **argv)
main (int argc, char **argv)
{
const unsigned method = GLIBTOP_METHOD_PIPE;
const unsigned long features = GLIBTOP_SYSDEPS_ALL;
glibtop *server = glibtop_global_server;
poptContext context;
int nextopt;
GOptionContext *goption_context;
GError *error = NULL;
int ils = -1; /* internet domain listen socket */
@@ -488,22 +486,19 @@ main (int argc, const char **argv)
arg ? (arg + 1) : program_invocation_name;
}
context = poptGetContext ("libgtop-daemon", argc, argv,
popt_options, 0);
g_set_prgname (program_invocation_short_name);
goption_context = g_option_context_new (NULL);
g_option_context_add_main_entries (goption_context, options, NULL);
g_option_context_parse (goption_context, &argc, &argv, &error);
g_option_context_free (goption_context);
poptReadDefaultConfig (context, TRUE);
while ((nextopt = poptGetNextOpt (context)) > 0)
/* do nothing */ ;
if(nextopt != -1) {
printf (_("Error on option %s: %s.\n"
"Run '%s --help' to see a full list of "
"available command line options.\n"),
poptBadOption (context, 0),
poptStrerror (nextopt),
argv[0]);
exit(1);
if (error != NULL) {
g_printerr ("%s\n", error->message);
g_error_free (error);
g_printerr (_("Run '%s --help' to see a full list of "
"available command line options.\n"),
program_invocation_name);
exit(1);
}
if (enable_debug)

View File

@@ -150,6 +150,15 @@ handle_parent_connection (int s)
resp->u.data.proc_map.total, ptr);
g_free (ptr);
break;
case GLIBTOP_CMND_PROC_WD:
/* FIXME */
break;
case GLIBTOP_CMND_NETLIST:
/* FIXME */
break;
case GLIBTOP_CMND_PROC_ARGS:
memcpy (&pid, parameter, sizeof (pid_t));
ptr = glibtop_get_proc_args_l (server,

View File

@@ -51,6 +51,8 @@ GLIBTOP_SUID_PROC_SEGMENT +
GLIBTOP_SUID_PROC_ARGS +
GLIBTOP_SUID_PROC_MAP +
GLIBTOP_SUID_NETLOAD +
GLIBTOP_SUID_NETLIST +
GLIBTOP_SUID_PROC_WD +
GLIBTOP_SUID_PPP;
#include <fcntl.h>

View File

@@ -1,14 +0,0 @@
bin_PROGRAMS = mkinodedb2 file_by_inode2
INCLUDES = @INCLUDES@
mkinodedb2_LDADD = $(top_builddir)/sysdeps/common/libgtop_common-2.0.la \
$(top_builddir)/lib/libgtop-2.0.la \
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps-2.0.la
file_by_inode2_LDADD = $(top_builddir)/lib/libgtop-2.0.la \
$(top_builddir)/sysdeps/common/libgtop_common-2.0.la \
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps-2.0.la \
$(top_builddir)/sysdeps/common/libgtop_suid_common-2.0.la
EXTRA_DIST = README.inodedb

View File

@@ -1,73 +0,0 @@
Not all UNIXes provide an easy way to get the filename if you have
the device it is mounted on and its inode.
Well, under Linux we can simply read /proc/<pid>/maps to get the filenames
but I don't see any way to get this under FreeBSD.
In this case you can give configure the optional `--with-libgtop-inodedb'
parameter to build this stuff here.
It uses the GNU database library `gdbm' to find the inode in a database
which is created when libgtop is installed. This should be reasonable
fast since the entire filesystem only needs to be traversed once when
libgtop is installed (and each time you install new software, of cause).
We have two databases:
* First the system administrator may place a system-wide database
in `$(prefix)/var/libgtop/inodedb.db' when installing libgtop.
* Every user can have his/her own one in `~/var/libgtop/inodedb.db'.
This one has precedence over the system wide one.
The `mkinodedb' program which is build in this directory takes two
command line arguments: the full pathname of the database to be created
and the name of a configuration file consisting of directory and file names
each on a line by itself - see `/etc/ld.so.conf' for an example.
Putting a directory name in this file means all regular files found in this
directory are included in the database, but it will not recursively descend
into subdirectories (for instance, we want everythink in `/usr/lib' but not
every single file in `/usr/lib/sgml'). You can also use filenames to include
a single file.
To use this interface in your program, you first have to call
`glibtop_inodedb_open ()':
glibtop_inodedb *
glibtop_inodedb_open (unsigned databases, unsigned long cachesize)
glibtop_inodedb *
glibtop_inodedb_open_s (glibtop *server, unsigned databases,
unsigned long cachesize)
There are some constants defined in <glibtop/inodedb.h> for the `databases'
parameter - you can use zero as default:
#define GLIBTOP_INODEDB_SYSTEM 1
#define GLIBTOP_INODEDB_USER 2
#define GLIBTOP_INODEDB_CACHE 4
The `cachesize' gives the size of a not yet implemented in-memory cache for
looked up entries.
This function will return a pointer of type `glibtop_inodedb *' which you need
to lookup an entry in the database.
To look up an entry, use the `glibtop_inodedb_lookup ()' function:
const char *
glibtop_inodedb_lookup (glibtop_inodedb *inodedb,
guint64 device, guint64 inode)
const char *
glibtop_inodedb_lookup_s (glibtop *server, glibtop_inodedb *inodedb,
guint64 device, guint64 inode)
It will either return a pointer to the filename - which you have to
`g_free ()' once done with it - or NULL on error.
You can use the `file_by_inode' program in this directory to test the
interface - just call it with two command line arguments: the device number
and the inode number.
Martin <martin@home-of-linux.org>

View File

@@ -1,64 +0,0 @@
/* 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 <config.h>
#include <glibtop.h>
#include <glibtop/error.h>
#include <glibtop/inodedb.h>
#include <pwd.h>
#include <dirent.h>
#include <sys/stat.h>
int
main (int argc, const char *argv [])
{
glibtop_inodedb *inodedb;
const char *filename;
unsigned device, inode;
if (argc != 3) {
fprintf (stderr, "Usage: %s device inode\n", argv [0]);
exit (1);
}
if (sscanf (argv [1], "%d", &device) != 1) {
fprintf (stderr, "Usage: %s device inode\n", argv [0]);
exit (1);
}
if (sscanf (argv [2], "%d", &inode) != 1) {
fprintf (stderr, "Usage: %s device inode\n", argv [0]);
exit (1);
}
inodedb = glibtop_inodedb_open (0, 0);
if (!inodedb) exit (1);
filename = glibtop_inodedb_lookup (inodedb, device, inode);
if (!filename) exit (2);
fprintf (stderr, "FILENAME: %d - %d - '%s'\n",
(int) device, (int) inode, filename);
exit (0);
}

View File

@@ -1,134 +0,0 @@
/* 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 <config.h>
#include <glibtop.h>
#include <glibtop/error.h>
#include <glibtop/inodedb.h>
#include <pwd.h>
#include <dirent.h>
#include <sys/stat.h>
int
main (int argc, char *argv [])
{
GDBM_FILE dbf;
char dirname [BUFSIZ];
FILE *f;
if (argc != 3) {
fprintf (stderr, "Usage: %s database filename\n", argv [0]);
exit (1);
}
f = fopen (argv [2], "rt");
if (!f)
glibtop_error_io ("fopen (%s)", argv [2]);
dbf = gdbm_open (argv [1], 512, GDBM_WRCREAT, 0600, 0);
if (!dbf)
glibtop_error_io ("gdbm_open (%s)", argv [1]);
while (fgets (dirname, BUFSIZ-1, f)) {
struct dirent *entry;
struct stat statb;
DIR *directory;
size_t len;
len = strlen (dirname);
if (!len) continue;
if (dirname [len-1] == '\n')
dirname [len-1] = 0;
if (stat (dirname, &statb))
continue;
if (S_ISREG (statb.st_mode)) {
glibtop_inodedb_key key;
datum d_key, d_content;
d_key.dptr = (void *) &key;
d_key.dsize = sizeof (key);
d_content.dptr = dirname;
d_content.dsize = strlen (dirname) + 1;
key.device = (guint64) statb.st_dev;
key.inode = (guint64) statb.st_ino;
if (gdbm_store (dbf, d_key, d_content, GDBM_REPLACE))
glibtop_error_io ("gdbm_store (%s)", dirname);
printf ("%-52s - %8lu - %8lu\n",
dirname, (unsigned long) statb.st_dev,
(unsigned long) statb.st_ino);
continue;
}
if (!S_ISDIR (statb.st_mode))
continue;
directory = opendir (dirname);
if (!directory) continue;
while ((entry = readdir (directory))) {
glibtop_inodedb_key key;
char filename [BUFSIZ];
datum d_key, d_content;
sprintf (filename, "%s/%s", dirname, entry->d_name);
if (stat (filename, &statb))
continue;
if (!S_ISREG (statb.st_mode))
continue;
d_key.dptr = (void *) &key;
d_key.dsize = sizeof (key);
d_content.dptr = filename;
d_content.dsize = strlen (filename) + 1;
key.device = (guint64) statb.st_dev;
key.inode = (guint64) statb.st_ino;
if (gdbm_store (dbf, d_key, d_content, GDBM_REPLACE))
glibtop_error_io ("gdbm_store (%s)", filename);
printf ("%-52s - %8lu - %8lu\n",
filename, (unsigned long) statb.st_dev,
(unsigned long) statb.st_ino);
}
closedir (directory);
}
gdbm_close (dbf);
fclose (f);
exit (0);
}

View File

@@ -1,24 +1,13 @@
INCLUDES = @INCLUDES@
if INODEDB
inodedb_SRCLIST = inodedb.c
inodedb_DEFS = -DSYSTEM_INODEDB=\"$(prefix)/var/libgtop/inodedb.db\"
else
inodedb_SRCLIST =
inodedb_DEFS =
endif
AM_CFLAGS = @CFLAGS@ $(inodedb_DEFS)
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 \
procargs.c \
default.c \
$(inodedb_SRCLIST)
default.c
# libgtop_common_2_0_la_LDFLAGS = $(LT_VERSION_INFO)
libgtop_common_2_0_la_LIBADD = $(LIBGTOP_EXTRA_LIBS)
@@ -27,4 +16,3 @@ libgtop_suid_common_2_0_la_SOURCES = error.c sysdeps_suid.c
# libgtop_suid_common_2_0_la_LDFLAGS = $(LT_VERSION_INFO)
EXTRA_DIST = inodedb.c

View File

@@ -352,5 +352,19 @@ glibtop_get_sysdeps(glibtop_sysdeps *buf)
}
/**
* glibtop_get_proc_wd:
* @buf:
* @pid: Process id to get the user and tty information
*
* Get the root directory and the working directories
*
* Returns: A NULL-terminated list of working directories.
*/
char**
glibtop_get_proc_wd(glibtop_proc_wd *buf, pid_t pid)
{
return glibtop_get_proc_wd_l(glibtop_global_server, buf, pid);
}

View File

@@ -1,115 +0,0 @@
/* 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 <config.h>
#include <glibtop.h>
#include <glibtop/error.h>
#include <glibtop/inodedb.h>
#include <pwd.h>
#include <gdbm.h>
#ifndef SYSTEM_INODEDB
#define SYSTEM_INODEDB "/usr/var/libgtop/inodedb.db"
#endif
glibtop_inodedb *
glibtop_inodedb_open_s (glibtop *server, unsigned databases,
unsigned long cachesize)
{
glibtop_inodedb *inodedb;
char filename [BUFSIZ];
struct passwd *pwd;
struct stat statb;
if (!databases)
databases = GLIBTOP_INODEDB_ALL;
inodedb = g_malloc (sizeof (glibtop_inodedb));
if (stat (SYSTEM_INODEDB, &statb))
databases &= ~GLIBTOP_INODEDB_SYSTEM;
if (databases & GLIBTOP_INODEDB_SYSTEM) {
inodedb->system_dbf = gdbm_open
(SYSTEM_INODEDB, 0, GDBM_READER, 0, 0);
if (!inodedb->system_dbf)
glibtop_error_io_r
(server, "gdbm_open (%s)", SYSTEM_INODEDB);
}
pwd = getpwuid (getuid ());
if (!pwd) glibtop_error_io_r (server, "getpwuid");
sprintf (filename, "%s/var/libgtop/inodedb.db", pwd->pw_dir);
if (stat (filename, &statb))
databases &= ~GLIBTOP_INODEDB_USER;
if (databases & GLIBTOP_INODEDB_USER) {
inodedb->user_dbf = gdbm_open
(filename, 0, GDBM_READER, 0, 0);
if (!inodedb->user_dbf)
glibtop_error_io_r
(server, "gdbm_open (%s)", filename);
}
return inodedb;
}
const char *
glibtop_inodedb_lookup_s (glibtop *server,
glibtop_inodedb *inodedb,
guint64 device, guint64 inode)
{
glibtop_inodedb_key key;
datum d_key, d_content;
d_key.dptr = (void *) &key;
d_key.dsize = sizeof (key);
key.device = device;
key.inode = inode;
if (inodedb->system_dbf) {
d_content = gdbm_fetch (inodedb->system_dbf, d_key);
if (d_content.dptr) return d_content.dptr;
}
if (inodedb->user_dbf) {
d_content = gdbm_fetch (inodedb->user_dbf, d_key);
if (d_content.dptr) return d_content.dptr;
}
return NULL;
}
void
glibtop_inodedb_close_s (glibtop *server, glibtop_inodedb *inodedb)
{
if (inodedb->system_dbf)
gdbm_close (inodedb->system_dbf);
if (inodedb->user_dbf)
gdbm_close (inodedb->user_dbf);
g_free (inodedb);
}

View File

@@ -1,3 +1,29 @@
2007-05-07 Benoît Dejean <benoit@placenet.org>
* procwd.c:
Always set buf->number.
2007-05-07 Benoît Dejean <benoit@placenet.org>
* glibtop_private.c (safe_readlink):
Simplified.
* procopenfiles.c:
Use safe_readlink.
2007-05-07 Benoît Dejean <benoit@placenet.org>
* procwd.c:
Implemented.
* glibtop_private.c (safe_readlink):
New function.
2007-03-13 Benoît Dejean <benoit@placenet.org>
* fsusage.c: (get_sys_path), (linux_2_6_0):

View File

@@ -8,7 +8,7 @@ libgtop_sysdeps_2_0_la_SOURCES = open.c close.c cpu.c mem.c swap.c \
proctime.c procmem.c procsignal.c prockernel.c \
procsegment.c procargs.c procmap.c siglist.c \
sysinfo.c netload.c ppp.c glibtop_private.c \
fsusage.c netlist.c procopenfiles.c
fsusage.c netlist.c procopenfiles.c procwd.c
libgtop_sysdeps_2_0_la_LIBADD = @GLIB_LIBS@

View File

@@ -184,3 +184,20 @@ has_sysfs(void)
return sysfs;
}
gboolean safe_readlink(const char *path, char *buf, size_t bufsiz)
{
ssize_t ret;
ret = readlink(path, buf, bufsiz - 1);
if (ret == -1) {
g_warning("Could not read link %s : %s", path, strerror(errno));
return FALSE;
}
buf[ret] = '\0';
return TRUE;
}

View File

@@ -145,6 +145,8 @@ check_cpu_line_warn(glibtop *server, const char *line, unsigned i)
gboolean
has_sysfs(void) G_GNUC_INTERNAL G_GNUC_CONST;
gboolean safe_readlink(const char *path, char *buf, size_t bufsiz);
G_END_DECLS

View File

@@ -42,6 +42,7 @@
#define GLIBTOP_SUID_PROC_MAP 0
#define GLIBTOP_SUID_NETLOAD 0
#define GLIBTOP_SUID_NETLIST 0
#define GLIBTOP_SUID_PROC_WD 0
#define GLIBTOP_SUID_PPP 0
#define GLIBTOP_SUID_PROC_FILE 0

View File

@@ -204,9 +204,8 @@ glibtop_get_proc_open_files_s (glibtop *server, glibtop_proc_open_files *buf, pi
g_snprintf(fn, sizeof fn, "/proc/%d/fd/%s",
pid, direntry->d_name);
rv = readlink(fn, tgt, sizeof(tgt) - 1);
if(rv < 0) continue;
tgt[rv] = '\0';
if (!safe_readlink(fn, tgt, tgt))
continue;
entry.fd = atoi(direntry->d_name);

98
sysdeps/linux/procwd.c Normal file
View File

@@ -0,0 +1,98 @@
/* Copyright (C) 2007 Benoît Dejean
This file is part of LibGTop 2.
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 <config.h>
#include <glibtop/procwd.h>
#include <glibtop/error.h>
#include <glibtop_private.h>
#include <unistd.h>
#include <dirent.h>
#include <sys/types.h>
void
_glibtop_init_proc_wd_s(glibtop *server)
{
server->sysdeps.proc_wd =
(1 << GLIBTOP_PROC_WD_EXE) +
(1 << GLIBTOP_PROC_WD_ROOT) +
(1 << GLIBTOP_PROC_WD_NUMBER);
}
static gboolean is_in(GPtrArray *array, const char *str)
{
guint i;
for (i = 0; i != array->len; ++i) {
if (strcmp(g_ptr_array_index(array, i), str) == 0)
return TRUE;
}
return FALSE;
}
char**
glibtop_get_proc_wd_s(glibtop *server, glibtop_proc_wd *buf, pid_t pid)
{
GPtrArray *dirs;
char path[80];
char dir[256];
DIR *task;
glibtop_init_s(&server, GLIBTOP_SYSDEPS_PROC_WD, 0);
memset(buf, 0, sizeof(glibtop_proc_wd));
g_snprintf(path, sizeof path, "/proc/%u/root", pid);
if (safe_readlink(path, buf->root, sizeof buf->root))
buf->flags |= (1 << GLIBTOP_PROC_WD_ROOT);
g_snprintf(path, sizeof path, "/proc/%u/exe", pid);
if (safe_readlink(path, buf->exe, sizeof buf->exe))
buf->flags |= (1 << GLIBTOP_PROC_WD_EXE);
dirs = g_ptr_array_sized_new(2);
g_snprintf(path, sizeof path, "/proc/%u/cwd", pid);
if (safe_readlink(path, dir, sizeof dir))
g_ptr_array_add(dirs, g_strdup(dir));
g_snprintf(path, sizeof path, "/proc/%u/task", pid);
if ((task = opendir(path)) != NULL) {
struct dirent *sub;
while ((sub = readdir(task)) != NULL) {
g_snprintf(path, sizeof path, "/proc/%u/task/%s/cwd", pid, sub->d_name);
if (safe_readlink(path, dir, sizeof dir) && !is_in(dirs, dir))
g_ptr_array_add(dirs, g_strdup(dir));
}
closedir(task);
}
buf->number = dirs->len;
buf->flags |= (1 << GLIBTOP_PROC_WD_NUMBER);
g_ptr_array_add(dirs, NULL);
return (char**) g_ptr_array_free(dirs, FALSE);
}