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
This commit is contained in:
committed by
Benoît Dejean
parent
7ee8dae9c5
commit
cd389851b9
@@ -1,3 +1,9 @@
|
|||||||
|
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>
|
2007-04-11 Benoît Dejean <benoit@placenet.org>
|
||||||
|
|
||||||
* *:
|
* *:
|
||||||
|
30
configure.in
30
configure.in
@@ -3,8 +3,8 @@ dnl Configure script for the Gnome library
|
|||||||
dnl
|
dnl
|
||||||
|
|
||||||
m4_define([libgtop_major_version], [2])
|
m4_define([libgtop_major_version], [2])
|
||||||
m4_define([libgtop_minor_version], [14])
|
m4_define([libgtop_minor_version], [19])
|
||||||
m4_define([libgtop_micro_version], [9])
|
m4_define([libgtop_micro_version], [1])
|
||||||
m4_define([libgtop_version], [libgtop_major_version.libgtop_minor_version.libgtop_micro_version])
|
m4_define([libgtop_version], [libgtop_major_version.libgtop_minor_version.libgtop_micro_version])
|
||||||
|
|
||||||
dnl increment if the interface has additions, changes, removals.
|
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 increment any time the source changes; set to
|
||||||
dnl 0 if you increment CURRENT
|
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 increment if any interfaces have been added; set to 0
|
||||||
dnl if any interfaces have been removed. removal has
|
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_SYSDEPS
|
||||||
GNOME_LIBGTOP_TYPES
|
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
|
GLIB_REQUIRED=2.6.0
|
||||||
|
|
||||||
PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_REQUIRED)
|
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"
|
LIBGTOP_INCS="$LIBGTOP_INCS -DHAVE_GLIBTOP_MACHINE_H"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test x$build_inodedb = xyes ; then
|
|
||||||
LIBGTOP_INCS="$LIBGTOP_INCS -DGLIBTOP_INODEDB"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test x$libgtop_smp = xyes ; then
|
if test x$libgtop_smp = xyes ; then
|
||||||
LIBGTOP_INCS="$LIBGTOP_INCS -DHAVE_LIBGTOP_SMP"
|
LIBGTOP_INCS="$LIBGTOP_INCS -DHAVE_LIBGTOP_SMP"
|
||||||
fi
|
fi
|
||||||
@@ -413,7 +390,6 @@ sysdeps/aix/Makefile
|
|||||||
sysdeps/bsd/Makefile
|
sysdeps/bsd/Makefile
|
||||||
src/Makefile
|
src/Makefile
|
||||||
src/daemon/Makefile
|
src/daemon/Makefile
|
||||||
src/inodedb/Makefile
|
|
||||||
lib/Makefile
|
lib/Makefile
|
||||||
examples/Makefile
|
examples/Makefile
|
||||||
doc/Makefile
|
doc/Makefile
|
||||||
|
@@ -171,7 +171,6 @@ rather than using the server.</para>
|
|||||||
<xi:include href="xml/close.xml"/>
|
<xi:include href="xml/close.xml"/>
|
||||||
<xi:include href="xml/command.xml"/>
|
<xi:include href="xml/command.xml"/>
|
||||||
<xi:include href="xml/glibtop-server.xml"/>
|
<xi:include href="xml/glibtop-server.xml"/>
|
||||||
<xi:include href="xml/inodedb.xml"/>
|
|
||||||
<xi:include href="xml/netload.xml"/>
|
<xi:include href="xml/netload.xml"/>
|
||||||
<xi:include href="xml/ppp.xml"/>
|
<xi:include href="xml/ppp.xml"/>
|
||||||
<xi:include href="xml/shm_limits.xml"/>
|
<xi:include href="xml/shm_limits.xml"/>
|
||||||
|
@@ -73,24 +73,6 @@ glibtop_server_ref
|
|||||||
glibtop_server_unref
|
glibtop_server_unref
|
||||||
</SECTION>
|
</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>
|
<INCLUDE>glibtop/netload.h</INCLUDE>
|
||||||
<SECTION>
|
<SECTION>
|
||||||
<FILE>netload</FILE>
|
<FILE>netload</FILE>
|
||||||
|
@@ -35,9 +35,6 @@
|
|||||||
|
|
||||||
#include <glibtop/procmap.h>
|
#include <glibtop/procmap.h>
|
||||||
|
|
||||||
#ifdef GLIBTOP_INODEDB
|
|
||||||
#include <glibtop/inodedb.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
@@ -49,9 +46,6 @@
|
|||||||
int
|
int
|
||||||
main (int argc, char *argv [])
|
main (int argc, char *argv [])
|
||||||
{
|
{
|
||||||
#ifdef GLIBTOP_INODEDB
|
|
||||||
glibtop_inodedb *inodedb;
|
|
||||||
#endif
|
|
||||||
glibtop_proc_map procmap;
|
glibtop_proc_map procmap;
|
||||||
glibtop_map_entry *maps;
|
glibtop_map_entry *maps;
|
||||||
unsigned method, count, port, i;
|
unsigned method, count, port, i;
|
||||||
@@ -87,10 +81,6 @@ main (int argc, char *argv [])
|
|||||||
if ((argc != 2) || (sscanf (argv [1], "%d", (int *) &pid) != 1))
|
if ((argc != 2) || (sscanf (argv [1], "%d", (int *) &pid) != 1))
|
||||||
g_error ("Usage: %s pid", argv [0]);
|
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);
|
fprintf (stderr, "Getting memory maps for pid %d.\n\n", (int) pid);
|
||||||
|
|
||||||
maps = glibtop_get_proc_map (&procmap, 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))
|
if (maps [i].flags & (1L << GLIBTOP_MAP_ENTRY_FILENAME))
|
||||||
filename = maps [i].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 [0] = (maps [i].perm & GLIBTOP_MAP_PERM_READ) ? 'r' : '-';
|
||||||
perm [1] = (maps [i].perm & GLIBTOP_MAP_PERM_WRITE) ? 'w' : '-';
|
perm [1] = (maps [i].perm & GLIBTOP_MAP_PERM_WRITE) ? 'w' : '-';
|
||||||
perm [2] = (maps [i].perm & GLIBTOP_MAP_PERM_EXECUTE) ? 'x' : '-';
|
perm [2] = (maps [i].perm & GLIBTOP_MAP_PERM_EXECUTE) ? 'x' : '-';
|
||||||
|
155
gtk-doc.make
155
gtk-doc.make
@@ -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
|
|
@@ -7,7 +7,7 @@ glibtop_HEADERS = close.h loadavg.h prockernel.h procstate.h \
|
|||||||
procsegment.h sysdeps.h global.h \
|
procsegment.h sysdeps.h global.h \
|
||||||
procsignal.h union.h gnuserv.h \
|
procsignal.h union.h gnuserv.h \
|
||||||
parameter.h mountlist.h fsusage.h procmap.h signal.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
|
netlist.h procopenfiles.h open.h
|
||||||
|
|
||||||
noinst_HEADERS = error.h write.h read_data.h read.h init_hooks.h
|
noinst_HEADERS = error.h write.h read_data.h read.h init_hooks.h
|
||||||
|
@@ -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
|
|
115
lib/inodedb.c
115
lib/inodedb.c
@@ -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);
|
|
||||||
}
|
|
@@ -59,12 +59,12 @@ Examples for LibGTop.
|
|||||||
%build
|
%build
|
||||||
# Needed for snapshot releases.
|
# Needed for snapshot releases.
|
||||||
if [ ! -f configure ]; then
|
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
|
else
|
||||||
%ifarch alpha
|
%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
|
CFLAGS="$RPM_OPT_FLAGS" ./configure --host=alpha-redhat-linux --prefix=%prefix --without-linux-table --with-libgtop-inodedb --with-libgtop-examples --with-libgtop-smp
|
||||||
%else
|
%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
|
%endif
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@@ -15,8 +15,6 @@ src/daemon/main.c
|
|||||||
src/daemon/server.c
|
src/daemon/server.c
|
||||||
src/daemon/slave.c
|
src/daemon/slave.c
|
||||||
src/daemon/version.c
|
src/daemon/version.c
|
||||||
src/inodedb/file_by_inode2.c
|
|
||||||
src/inodedb/mkinodedb2.c
|
|
||||||
sysdeps/linux/siglist.c
|
sysdeps/linux/siglist.c
|
||||||
sysdeps/osf1/siglist.c
|
sysdeps/osf1/siglist.c
|
||||||
sysdeps/sun4/siglist.c
|
sysdeps/sun4/siglist.c
|
||||||
|
@@ -1,16 +1,10 @@
|
|||||||
if INODEDB
|
|
||||||
inodedb_SUBDIRS = inodedb
|
|
||||||
else
|
|
||||||
inodedb_SUBDIRS =
|
|
||||||
endif
|
|
||||||
|
|
||||||
if NEED_LIBGTOP
|
if NEED_LIBGTOP
|
||||||
daemon_SUBDIRS = daemon
|
daemon_SUBDIRS = daemon
|
||||||
else
|
else
|
||||||
daemon_SUBDIRS =
|
daemon_SUBDIRS =
|
||||||
endif
|
endif
|
||||||
|
|
||||||
SUBDIRS = $(daemon_SUBDIRS) $(inodedb_SUBDIRS)
|
SUBDIRS = $(daemon_SUBDIRS)
|
||||||
|
|
||||||
DIST_SUBDIRS = daemon inodedb
|
DIST_SUBDIRS = daemon
|
||||||
|
|
||||||
|
@@ -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
|
|
@@ -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>
|
|
@@ -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);
|
|
||||||
}
|
|
@@ -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);
|
|
||||||
}
|
|
@@ -1,24 +1,13 @@
|
|||||||
|
|
||||||
INCLUDES = @INCLUDES@
|
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
|
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.c \
|
||||||
procargs.c \
|
procargs.c \
|
||||||
default.c \
|
default.c
|
||||||
$(inodedb_SRCLIST)
|
|
||||||
|
|
||||||
# libgtop_common_2_0_la_LDFLAGS = $(LT_VERSION_INFO)
|
# libgtop_common_2_0_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||||
libgtop_common_2_0_la_LIBADD = $(LIBGTOP_EXTRA_LIBS)
|
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)
|
# libgtop_suid_common_2_0_la_LDFLAGS = $(LT_VERSION_INFO)
|
||||||
|
|
||||||
EXTRA_DIST = inodedb.c
|
|
||||||
|
@@ -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);
|
|
||||||
}
|
|
Reference in New Issue
Block a user