From cd389851b961691507d80968d64d9e275350a7b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Dejean?= Date: Fri, 27 Apr 2007 17:37:47 +0000 Subject: [PATCH] Got rid of InodeDB. This feature was optionnal and i have never heard of MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2007-04-27 Benoît Dejean 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 --- ChangeLog | 6 ++ configure.in | 30 +----- doc/reference/libgtop-docs.xml | 1 - doc/reference/libgtop-sections.txt | 18 ---- examples/procmap.c | 16 --- gtk-doc.make | 155 ----------------------------- include/glibtop/Makefile.am | 2 +- include/glibtop/inodedb.h | 67 ------------- lib/inodedb.c | 115 --------------------- libgtop.spec.in | 4 +- po/POTFILES.in | 2 - src/Makefile.am | 10 +- src/inodedb/Makefile.am | 14 --- src/inodedb/README.inodedb | 73 -------------- src/inodedb/file_by_inode2.c | 64 ------------ src/inodedb/mkinodedb2.c | 134 ------------------------- sysdeps/common/Makefile.am | 14 +-- sysdeps/common/inodedb.c | 115 --------------------- 18 files changed, 15 insertions(+), 825 deletions(-) delete mode 100644 gtk-doc.make delete mode 100644 include/glibtop/inodedb.h delete mode 100644 lib/inodedb.c delete mode 100644 src/inodedb/Makefile.am delete mode 100644 src/inodedb/README.inodedb delete mode 100644 src/inodedb/file_by_inode2.c delete mode 100644 src/inodedb/mkinodedb2.c delete mode 100644 sysdeps/common/inodedb.c diff --git a/ChangeLog b/ChangeLog index a1e0b859..f596fc22 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-04-27 Benoît Dejean + + 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 * *: diff --git a/configure.in b/configure.in index 69c9940c..3e544364 100644 --- a/configure.in +++ b/configure.in @@ -3,8 +3,8 @@ 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], [1]) m4_define([libgtop_version], [libgtop_major_version.libgtop_minor_version.libgtop_micro_version]) dnl increment if the interface has additions, changes, removals. @@ -12,7 +12,7 @@ m4_define([libgtop_current], [7]) dnl increment any time the source changes; set to dnl 0 if you increment CURRENT -m4_define([libgtop_revision], [0]) +m4_define([libgtop_revision], [1]) dnl increment if any interfaces have been added; set to 0 dnl if any interfaces have been removed. removal has @@ -87,25 +87,6 @@ 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) @@ -300,10 +281,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 +390,6 @@ sysdeps/aix/Makefile sysdeps/bsd/Makefile src/Makefile src/daemon/Makefile -src/inodedb/Makefile lib/Makefile examples/Makefile doc/Makefile diff --git a/doc/reference/libgtop-docs.xml b/doc/reference/libgtop-docs.xml index fb9f7837..63aef34e 100644 --- a/doc/reference/libgtop-docs.xml +++ b/doc/reference/libgtop-docs.xml @@ -171,7 +171,6 @@ rather than using the server. - diff --git a/doc/reference/libgtop-sections.txt b/doc/reference/libgtop-sections.txt index 8e6cc406..0d99d695 100644 --- a/doc/reference/libgtop-sections.txt +++ b/doc/reference/libgtop-sections.txt @@ -73,24 +73,6 @@ glibtop_server_ref glibtop_server_unref -glibtop/inodedb.h -
-inodedb -Inode DB -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 -
- glibtop/netload.h
netload diff --git a/examples/procmap.c b/examples/procmap.c index cde062ef..a3de5bf1 100644 --- a/examples/procmap.c +++ b/examples/procmap.c @@ -35,9 +35,6 @@ #include -#ifdef GLIBTOP_INODEDB -#include -#endif #include #include @@ -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' : '-'; diff --git a/gtk-doc.make b/gtk-doc.make deleted file mode 100644 index eeb23b49..00000000 --- a/gtk-doc.make +++ /dev/null @@ -1,155 +0,0 @@ -# -*- mode: makefile -*- - -#################################### -# Everything below here is generic # -#################################### - -if GTK_DOC_USE_LIBTOOL -GTKDOC_CC = $(LIBTOOL) --mode=compile $(CC) $(INCLUDES) $(AM_CFLAGS) $(CFLAGS) -GTKDOC_LD = $(LIBTOOL) --mode=link $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -else -GTKDOC_CC = $(CC) $(INCLUDES) $(AM_CFLAGS) $(CFLAGS) -GTKDOC_LD = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -endif - -# We set GPATH here; this gives us semantics for GNU make -# which are more like other make's VPATH, when it comes to -# whether a source that is a target of one rule is then -# searched for in VPATH/GPATH. -# -GPATH = $(srcdir) - -TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE) - -EXTRA_DIST = \ - $(content_files) \ - $(HTML_IMAGES) \ - $(DOC_MAIN_SGML_FILE) \ - $(DOC_MODULE)-sections.txt \ - $(DOC_MODULE)-overrides.txt - -DOC_STAMPS=scan-build.stamp tmpl-build.stamp sgml-build.stamp html-build.stamp \ - $(srcdir)/tmpl.stamp $(srcdir)/sgml.stamp $(srcdir)/html.stamp - -SCANOBJ_FILES = \ - $(DOC_MODULE).args \ - $(DOC_MODULE).hierarchy \ - $(DOC_MODULE).interfaces \ - $(DOC_MODULE).prerequisites \ - $(DOC_MODULE).signals - -CLEANFILES = $(SCANOBJ_FILES) $(DOC_MODULE)-unused.txt $(DOC_STAMPS) - -if ENABLE_GTK_DOC -all-local: html-build.stamp -else -all-local: -endif - -docs: html-build.stamp - -#### scan #### - -scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB) - @echo 'gtk-doc: Scanning header files' - @-chmod -R u+w $(srcdir) - if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null 2>&1 ; then \ - CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" CFLAGS="$(GTKDOC_CFLAGS)" LDFLAGS="$(GTKDOC_LIBS)" gtkdoc-scangobj $(SCANGOBJ_OPTIONS) --module=$(DOC_MODULE) --output-dir=$(srcdir) ; \ - else \ - cd $(srcdir) ; \ - for i in $(SCANOBJ_FILES) ; do \ - test -f $$i || touch $$i ; \ - done \ - fi - cd $(srcdir) && \ - gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="$(IGNORE_HFILES)" $(SCAN_OPTIONS) $(EXTRA_HFILES) - touch scan-build.stamp - -$(DOC_MODULE)-decl.txt $(SCANOBJ_FILES): scan-build.stamp - @true - -#### templates #### - -tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt - @echo 'gtk-doc: Rebuilding template files' - @-chmod -R u+w $(srcdir) - cd $(srcdir) && gtkdoc-mktmpl --module=$(DOC_MODULE) $(MKTMPL_OPTIONS) - touch tmpl-build.stamp - -tmpl.stamp: tmpl-build.stamp - @true - -#### xml #### - -sgml-build.stamp: tmpl.stamp $(HFILE_GLOB) $(CFILE_GLOB) $(DOC_MODULE)-sections.txt $(srcdir)/tmpl/*.sgml $(expand_content_files) - @echo 'gtk-doc: Building XML' - @-chmod -R u+w $(srcdir) - cd $(srcdir) && \ - gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --output-format=xml --expand-content-files="$(expand_content_files)" --main-sgml-file=$(DOC_MAIN_SGML_FILE) $(MKDB_OPTIONS) - touch sgml-build.stamp - -sgml.stamp: sgml-build.stamp - @true - -#### html #### - -html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) - @echo 'gtk-doc: Building HTML' - @-chmod -R u+w $(srcdir) - rm -rf $(srcdir)/html - mkdir $(srcdir)/html - cd $(srcdir)/html && gtkdoc-mkhtml $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE) - test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) html ) - @echo 'gtk-doc: Fixing cross-references' - cd $(srcdir) && gtkdoc-fixxref --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS) - touch html-build.stamp - -############## - -clean-local: - rm -f *~ *.bak - rm -rf .libs - -maintainer-clean-local: clean - cd $(srcdir) && rm -rf xml html $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt - -install-data-local: - installfiles=`echo $(srcdir)/html/*`; \ - if test "$$installfiles" = '$(srcdir)/html/*'; \ - then echo '-- Nothing to install' ; \ - else \ - $(mkinstalldirs) $(DESTDIR)$(TARGET_DIR); \ - for i in $$installfiles; do \ - echo '-- Installing '$$i ; \ - $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \ - done; \ - echo '-- Installing $(srcdir)/html/index.sgml' ; \ - $(INSTALL_DATA) $(srcdir)/html/index.sgml $(DESTDIR)$(TARGET_DIR) || :; \ - fi - -uninstall-local: - rm -f $(DESTDIR)$(TARGET_DIR)/* - -# -# Require gtk-doc when making dist -# -if ENABLE_GTK_DOC -dist-check-gtkdoc: -else -dist-check-gtkdoc: - @echo "*** gtk-doc must be installed and enabled in order to make dist" - @false -endif - -dist-hook: dist-check-gtkdoc dist-hook-local - mkdir $(distdir)/tmpl - mkdir $(distdir)/xml - mkdir $(distdir)/html - -cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl - -cp $(srcdir)/xml/*.xml $(distdir)/xml - -cp $(srcdir)/html/* $(distdir)/html - if test -f $(srcdir)/$(DOC_MODULE).types; then \ - cp $(srcdir)/$(DOC_MODULE).types $(distdir)/$(DOC_MODULE).types; \ - fi - -.PHONY : dist-hook-local docs diff --git a/include/glibtop/Makefile.am b/include/glibtop/Makefile.am index 4b1bdb1e..2b4df591 100644 --- a/include/glibtop/Makefile.am +++ b/include/glibtop/Makefile.am @@ -7,7 +7,7 @@ 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 \ netlist.h procopenfiles.h open.h noinst_HEADERS = error.h write.h read_data.h read.h init_hooks.h diff --git a/include/glibtop/inodedb.h b/include/glibtop/inodedb.h deleted file mode 100644 index 7ce5640d..00000000 --- a/include/glibtop/inodedb.h +++ /dev/null @@ -1,67 +0,0 @@ -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 1.0. - - Contributed by Martin Baulig , 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 -#include - -#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 diff --git a/lib/inodedb.c b/lib/inodedb.c deleted file mode 100644 index da8ebe35..00000000 --- a/lib/inodedb.c +++ /dev/null @@ -1,115 +0,0 @@ -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 1.0. - - Contributed by Martin Baulig , 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 -#include -#include -#include - -#include -#include - -#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); -} diff --git a/libgtop.spec.in b/libgtop.spec.in index ce2634b6..5957868e 100644 --- a/libgtop.spec.in +++ b/libgtop.spec.in @@ -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 diff --git a/po/POTFILES.in b/po/POTFILES.in index e9cbb766..d10cb992 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -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 diff --git a/src/Makefile.am b/src/Makefile.am index a4ccf09d..6378b667 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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 diff --git a/src/inodedb/Makefile.am b/src/inodedb/Makefile.am deleted file mode 100644 index 185dd18e..00000000 --- a/src/inodedb/Makefile.am +++ /dev/null @@ -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 diff --git a/src/inodedb/README.inodedb b/src/inodedb/README.inodedb deleted file mode 100644 index 12bb8b13..00000000 --- a/src/inodedb/README.inodedb +++ /dev/null @@ -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//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 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 diff --git a/src/inodedb/file_by_inode2.c b/src/inodedb/file_by_inode2.c deleted file mode 100644 index d7f75e51..00000000 --- a/src/inodedb/file_by_inode2.c +++ /dev/null @@ -1,64 +0,0 @@ -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 1.0. - - Contributed by Martin Baulig , 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 -#include -#include -#include - -#include -#include - -#include - -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); -} diff --git a/src/inodedb/mkinodedb2.c b/src/inodedb/mkinodedb2.c deleted file mode 100644 index f989e5b8..00000000 --- a/src/inodedb/mkinodedb2.c +++ /dev/null @@ -1,134 +0,0 @@ -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 1.0. - - Contributed by Martin Baulig , 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 -#include -#include -#include - -#include -#include - -#include - -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); -} diff --git a/sysdeps/common/Makefile.am b/sysdeps/common/Makefile.am index e1160608..447e6d38 100644 --- a/sysdeps/common/Makefile.am +++ b/sysdeps/common/Makefile.am @@ -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 diff --git a/sysdeps/common/inodedb.c b/sysdeps/common/inodedb.c deleted file mode 100644 index da8ebe35..00000000 --- a/sysdeps/common/inodedb.c +++ /dev/null @@ -1,115 +0,0 @@ -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 1.0. - - Contributed by Martin Baulig , 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 -#include -#include -#include - -#include -#include - -#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); -}