Compare commits

..

15 Commits

Author SHA1 Message Date
Pablo Saratxaga
22a2289d00 updated Catalan file 2001-02-27 19:27:03 +00:00
Pablo Saratxaga
6fae8502b9 Added several po files from CVS HEAD
corrected some po files headers or syntax errors
2001-02-26 14:57:36 +00:00
Christian Rose
f835defa4f Updated Swedish translation. 2001-02-16 02:21:26 +00:00
Stano Visnovsky
bf217abf64 Added sk to ALL_LINGUAS 2001-02-13 11:12:50 +00:00
Stano Visnovsky
b210a6b707 Added Slovak translation from Marcel Telka <marcel@telka.sk> 2001-02-13 11:10:28 +00:00
Yukihiro Nakai
020842ccad ja.po: Update Japanese translation. 2000-10-11 04:14:23 +00:00
Martin Baulig
d25bf7628d Released LibGTop 1.1.2.1 "Hardangervidda goes Paris". 2000-02-16 15:32:52 +00:00
Martin Baulig
18442bf377 Released LibGTop 1.1.2.1 "Hardangervidda goes Paris".
2000-02-16  Martin Baulig  <martin@home-of-linux.org>

	Released LibGTop 1.1.2.1 "Hardangervidda goes Paris".

	* LIBGTOP-VERSION: Set version number to 1.1.2.1 and let the
	tarball be called `libgtop-1.1.2.1-solaris.tar.gz'.
2000-02-16 14:00:23 +00:00
Martin Baulig
f948d8f193 1.1.2.1 :) 2000-02-15 14:19:43 +00:00
Martin Baulig
84965bc3e8 Set version number to 1.1.2.1.
2000-02-15  Martin Baulig  <baulig@Stud.Informatik.Uni-Trier.DE>

	* LIBGTOP-VERSION: Set version number to 1.1.2.1.
2000-02-15 13:05:39 +00:00
Martin Baulig
7880078382 **** Merged from HEAD ****
2000-01-16  Martin Baulig  <martin@home-of-linux.org>

	* LIBGTOP-VERSION (LIBGTOP_VERSION_SUFFIX): Added this so you can
	have your tarballs called `libgtop-1.x.y-snap.tar.gz' or whatever.
	This only affects the `VERSION' variable and thus how the resulting
	tarball will be called, but not `LIBGTOP_VERSION_CODE' etc.

	* Makefile.am: Make `aclocal.m4' also depend on `LIBGTOP-VERSION'
	when in maintainer-mode.
2000-02-15 12:40:37 +00:00
Martin Baulig
1b8d205eb0 **** Merged from LIBGTOP_STABLE_1_0 ****
2000-01-22  Martin Baulig  <martin@home-of-linux.org>

	* procargs.c (glibtop_get_proc_args_s): Set correct `buf->size' and
	`buf->flags' fields when `max_length' was given. Fixes #5183.
2000-01-21 23:28:35 +00:00
Martin Baulig
bc86c09ede **** Merged from HEAD ****
2000-01-20  Martin Baulig  <martin@home-of-linux.org>

	* fsusage.c (adjust_blocks): Use `u_int64_t' arguments and
	return value to avoid long int overflows on machines with large
	disks.

	* fsusage.h (struct fs_usage): Use `u_int64_t' here as well.
2000-01-20 22:05:39 +00:00
Martin Baulig
ad536313f1 Don't dump core when the table of permitted host names contains a NULL
1999-11-28  Martin Baulig  <martin@home-of-linux.org>

	* gnuserv.c (setup_table): Don't dump core when the table of
	permitted host names contains a NULL pointer.
1999-11-28 16:41:26 +00:00
Martin Baulig
caf17330b3 Stat "/proc/<pid>" instead of "/proc/<pid>/state" to get uid' and gid'.
1999-11-28  Martin Baulig  <martin@home-of-linux.org>

	* procstate.c (glibtop_get_procstate_s): Stat "/proc/<pid>" instead
	of "/proc/<pid>/state" to get `uid' and `gid'. Thanks to Jason Becker
	for pointing out that GTop reported wrong uid's.
1999-11-28 11:54:11 +00:00
46 changed files with 41798 additions and 0 deletions

2172
ChangeLog Normal file

File diff suppressed because it is too large Load Diff

29
LIBGTOP-VERSION Normal file
View File

@@ -0,0 +1,29 @@
# Making releases:
# LIBGTOP_MICRO_VERSION += 1;
# LIBGTOP_INTERFACE_AGE += 1;
# LIBGTOP_BINARY_AGE += 1;
# if any functions have been added, set LIBGTOP_INTERFACE_AGE to 0.
# if backwards compatibility has been broken,
# set LIBGTOP_BINARY_AGE and LIBGTOP_INTERFACE_AGE to 0.
#
LIBGTOP_MAJOR_VERSION=1
LIBGTOP_MINOR_VERSION=1
LIBGTOP_MICRO_VERSION=2
# you can set this to `-snap' for instance to create
# a `libgtop-1.x.y-snap.tar.gz' tarball.
LIBGTOP_VERSION_SUFFIX=.1-solaris
LIBGTOP_INTERFACE_AGE=2
LIBGTOP_BINARY_AGE=2
# Increase each time you change the client/server protocol.
LIBGTOP_SERVER_VERSION=50
# Don't change this
LIBGTOP_VERSION=$LIBGTOP_MAJOR_VERSION.$LIBGTOP_MINOR_VERSION.$LIBGTOP_MICRO_VERSION
LIBGTOP_VERSION_CODE=`echo "$LIBGTOP_MAJOR_VERSION 1000000 * $LIBGTOP_MINOR_VERSION 1000 * + $LIBGTOP_MICRO_VERSION + p q" | dc`
# For automake.
VERSION=$LIBGTOP_VERSION$LIBGTOP_VERSION_SUFFIX
PACKAGE=libgtop

100
Makefile.am Normal file
View File

@@ -0,0 +1,100 @@
## Process this file with automake to produce Makefile.in.
if EXAMPLES
examples_SUBDIRS = examples
else
examples_SUBDIRS =
endif
if BUILD_GNOME_SUPPORT
support = support
endif
SUBDIRS = po intl $(support) macros misc include sysdeps lib src \
$(examples_SUBDIRS) doc
include_HEADERS = glibtop.h
configincludedir = $(pkglibdir)/include
EXTRA_DIST = autogen.sh libgtop.spec.in copyright.txt libgtopConf.sh.in \
LIBGTOP-VERSION features.def libgtop-config.in RELNOTES-0.25 \
RELNOTES-1.0 RELNOTES-1.1.x libgtop-sysdeps.m4 README \
libgtop-mirror.sh
configinclude_DATA = \
glibtop-config.h
BUILT_SOURCES = stamp-gc-h #note: not glibtop-config.h
glibtop-config.h: stamp-gc-h
@:
stamp-gc-h: config.status
CONFIG_FILES= CONFIG_HEADERS= CONFIG_OTHER=glibtop-config.h ./config.status
echo timestamp > stamp-gc-h
dist-hook: libgtop.spec
cp libgtop.spec $(distdir)
release:
$(MAKE) dist distdir=$(PACKAGE)-$(VERSION)
## Put `exec' in the name because this should be installed by
## `install-exec', not `install-data'.
confexecdir = $(libdir)
confexec_DATA = $(top_builddir)/libgtopConf.sh \
$(top_builddir)/libgtop-features.def
CLEANFILES=libgtopConf.sh
bin_SCRIPTS = $(top_builddir)/libgtop-config
## to automatically rebuild aclocal.m4 if any of the macros in
## `macros/' change
@MAINT@ include macros/macros.dep
@MAINT@macros/macros.dep: macros/Makefile.am
@MAINT@ cd macros && $(MAKE) macros.dep
@MAINT@$(top_srcdir)/aclocal.m4: libgtop-sysdeps.m4 LIBGTOP-VERSION
## We create libgtopConf.sh here and not from configure because we want
## to get the paths expanded correctly. Macros like srcdir are given
## the value NONE in configure if the user doesn't specify them (this
## is an autoconf feature, not a bug).
libgtopConf.sh: libgtopConf.sh.in Makefile
## Use sed and then mv to avoid problems if the user interrupts.
sed -e 's#\@LIBGTOP_LIBDIR\@#$(libdir)#g' \
-e 's#\@LIBGTOP_INCLUDEDIR\@#$(includedir)#g' \
-e 's#\@LIBGTOP_DATADIR\@#$(datadir)#g' \
-e 's#\@LIBGTOP_EXTRA_LIBS\@#$(LIBGTOP_EXTRA_LIBS)#g' \
-e 's#\@LIBGTOP_LIBS\@#$(LIBGTOP_LIBS)#g' \
-e 's#\@LIBGTOP_INCS\@#$(LIBGTOP_INCS)#g' \
-e 's#\@LIBGTOP_NAMES_LIBS\@#$(LIBGTOP_NAMES_LIBS)#g' \
-e 's#\@LIBGTOP_NAMES_INCS\@#$(LIBGTOP_NAMES_INCS)#g' \
-e 's#\@LIBGTOP_GUILE_LIBS\@#$(LIBGTOP_GUILE_LIBS)#g' \
-e 's#\@LIBGTOP_GUILE_INCS\@#$(LIBGTOP_GUILE_INCS)#g' \
-e 's#\@LIBGTOP_GUILE_NAMES_LIBS\@#$(LIBGTOP_GUILE_NAMES_LIBS)#g' \
-e 's#\@LIBGTOP_GUILE_NAMES_INCS\@#$(LIBGTOP_GUILE_NAMES_INCS)#g' \
-e 's#\@LIBGTOP_BINDIR\@#$(LIBGTOP_BINDIR)#g' \
-e 's#\@LIBGTOP_SERVER\@#$(LIBGTOP_SERVER)#g' \
-e 's#\@LIBGTOP_MAJOR_VERSION\@#$(LIBGTOP_MAJOR_VERSION)#g' \
-e 's#\@LIBGTOP_MINOR_VERSION\@#$(LIBGTOP_MINOR_VERSION)#g' \
-e 's#\@LIBGTOP_MICRO_VERSION\@#$(LIBGTOP_MICRO_VERSION)#g' \
-e 's#\@LIBGTOP_VERSION\@#$(LIBGTOP_VERSION)#g' \
-e 's#\@LIBGTOP_VERSION_CODE\@#$(LIBGTOP_VERSION_CODE)#g' \
-e 's#\@LIBGTOP_SERVER_VERSION\@#$(LIBGTOP_SERVER_VERSION)#g' \
-e 's#\@libgtop_sysdeps_dir\@#$(libgtop_sysdeps_dir)#g' \
-e 's#\@libgtop_need_server\@#$(libgtop_need_server)#g' \
-e 's#\@libgtop_use_machine_h\@#$(libgtop_use_machine_h)#g' \
-e 's#\@libgtop_guile_found\@#$(libgtop_guile_found)#g' \
-e 's#\@libgtop_want_examples\@#$(libgtop_want_examples)#g' \
< $(srcdir)/libgtopConf.sh.in > libgtopConf.tmp \
&& mv libgtopConf.tmp libgtopConf.sh
libgtop-config: libgtop-config.in Makefile
sed -e 's#\@LIBGTOP_LIBDIR\@#$(libdir)#g' \
< $(srcdir)/libgtop-config.in > libgtop-config.tmp \
&& mv libgtop-config.tmp libgtop-config && \
chmod 755 libgtop-config
libgtop-features.def: features.def
@LN_S@ $< $@

16
NEWS Normal file
View File

@@ -0,0 +1,16 @@
February 16, 2000:
=================
* Released LibGTop 1.1.2.1 "Hardangervidda goes Paris"
This is a bug fixed version of 1.1.2 for Solaris users
of the GUADEC CD.
October 19, 1999:
================
* Released LibGTop 1.1.2 "Hardangervidda"
This is a stable release from the development branch
of LibGTop for Solaris users of October GNOME.

602
configure.in Normal file
View File

@@ -0,0 +1,602 @@
dnl
dnl Configure script for the Gnome library
dnl
AC_INIT(copyright.txt)
AM_CONFIG_HEADER(config.h)
AC_CANONICAL_SYSTEM
dnl This is required at several places
AC_CHECK_PROG(ac_dc_found, dc, yes, no)
if test x$ac_dc_found != xyes ; then
AC_MSG_ERROR([
*** The "dc" utility was not found on your system.
***
*** When using RedHat Linux, you need to install the "bc" package.
***
*** It is now part of the "bc" package, so you should look at
*** ftp://ftp.gnu.org/pub/gnu/bc/ if you want to compile it yourself.
***
*** Other systems and distributions may also have it in their "bc" package,
*** so if there's no "dc" one, please look for "bc".
***])
fi
. $srcdir/LIBGTOP-VERSION
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
AC_SUBST(LIBGTOP_MAJOR_VERSION)
AC_SUBST(LIBGTOP_MINOR_VERSION)
AC_SUBST(LIBGTOP_MICRO_VERSION)
AC_SUBST(LIBGTOP_INTERFACE_AGE)
AC_SUBST(LIBGTOP_BINARY_AGE)
AC_SUBST(LIBGTOP_SERVER_VERSION)
AC_SUBST(LIBGTOP_VERSION)
AC_SUBST(LIBGTOP_VERSION_CODE)
AC_SUBST(LIBGTOP_VERSION_SUFFIX)
# libtool versioning
LT_RELEASE=$LIBGTOP_MAJOR_VERSION.$LIBGTOP_MINOR_VERSION
LT_CURRENT=`expr $LIBGTOP_MICRO_VERSION - $LIBGTOP_INTERFACE_AGE`
LT_REVISION=$LIBGTOP_INTERFACE_AGE
LT_AGE=`expr $LIBGTOP_BINARY_AGE - $LIBGTOP_INTERFACE_AGE`
LT_VERSION_INFO='-version-info ${LT_CURRENT}:${LT_REVISION}:${LT_AGE} -release ${LT_RELEASE}'
AC_SUBST(LT_VERSION_INFO)
AC_SUBST(LT_RELEASE)
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)
AM_ACLOCAL_INCLUDE(. macros)
AC_ISC_POSIX
AC_PROG_CC
AC_STDC_HEADERS
AC_ARG_PROGRAM
dnl We need this at some places.
libgtop_top_builddir=`pwd`
AC_SUBST(libgtop_top_builddir)
dnl We don't use `AC_PROG_AWK' since it checks for mawk first which
dnl does not work for libgtop.
AC_CHECK_PROGS(AWK, gawk awk, )
test -z "$AWK" && AC_MSG_ERROR([Sorry, you need a working awk interpreter.])
dnl Most people should have a working perl interpreter on their system
AC_CHECK_PROGS(PERL, perl5 perl)
test -z "$PERL" && AC_MSG_ERROR([You need to have a working perl interpreter.])
AC_CHECK_TOOL(CC,gcc)
AC_CHECK_TOOL(RANLIB,ranlib)
AC_CHECK_TOOL(AS,as)
AC_CHECK_TOOL(AR,ar)
AC_CHECK_TOOL(NM,nm)
NM=`which $NM`
export CC CXX RANLIB LD AS AR NM
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
export cross_compiling
AM_PROG_LIBTOOL
dnl Let the user enable compiler warnings
GNOME_COMPILE_WARNINGS
GNOME_INIT_HOOK(gnome_found=yes)
if test "x$gnome_found" != xyes; then
if test "x$want_gnome" != xno ; then
AC_MSG_ERROR([
*** GNOME was not found on this system. ***
*** If you want to use LibGTop without GNOME, you need
*** to give configure the --without-gnome parameter.
])
else
AC_DEFINE(WITHOUT_GNOME)
fi
GNOME_SUPPORT_CHECKS
else
if test "x$want_gnome" != xno ; then
AM_CONDITIONAL(BUILD_GNOME_SUPPORT, false)
else
GNOME_SUPPORT_CHECKS
fi
fi
AM_CONDITIONAL(CROSS_COMPILING, test "x$cross_compiling" = xyes)
GNOME_LIBGTOP_SYSDEPS
GNOME_LIBGTOP_TYPES
AC_ARG_WITH(libgtop-guile,
[ --with-libgtop-guile Build the libgtop guile interface (default=no)],
[build_guile="$withval"], [build_guile=yes])
if test x$build_guile != xno ; then
GNOME_CHECK_GUILE
fi
AC_ARG_WITH(libgtop-inodedb,
[ --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)
fi
AC_DEFINE(GLIBTOP_NAMES)
if test x$ac_cv_guile_found = xyes ; then
AC_DEFINE(GLIBTOP_GUILE)
AC_DEFINE(GLIBTOP_GUILE_NAMES)
libgtop_guile_found=yes
guile_examples='third'
guile_static_examples='third_static'
guile_subdirs='guile'
else
libgtop_guile_found=no
guile_examples=
guile_static_examples=
guile_subdirs=
fi
if test x$libgtop_smp = xyes ; then
smp_examples='smp'
smp_static_examples='smp_static'
else
smp_examples=
smp_static_examples=
fi
if test "x$enable_static" != xno; then
static_targets="first_static second_static mountlist_static procmap_static netload_static sysdeps_static timings_static $guile_static_examples $smp_static_examples"
else
static_targets=""
fi
AM_CONDITIONAL(ENABLE_STATIC, test x$enable_static = xyes)
AM_CONDITIONAL(ENABLE_SHARED, test x$enable_static = xyes)
AC_SUBST(static_targets)
AC_SUBST(smp_examples)
AC_SUBST(guile_examples)
AC_SUBST(guile_subdirs)
AM_PROG_LIBTOOL
AM_PATH_GLIB(1.2.0,,AC_MSG_ERROR(GLIB >= 1.2.0 is required for LibGTop))
dnl You need to uncomment the following line if you want to use
dnl libGTop without Gnome.
dnl GNOME_SUPPORT_CHECKS
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_STRUCT_ST_RDEV
AC_HEADER_TIME
AC_STRUCT_TM
AC_TYPE_UID_T
dnl For SunOS
AC_CHECK_TYPE(ssize_t, int)
AC_CHECK_HEADERS(memory.h)
AC_CHECK_HEADERS(string.h strings.h, break)
AC_REPLACE_FUNCS(strerror)
dnl dlopen() and dlsym()
DL_LIB=
AC_CHECK_FUNCS(dlopen,,[
AC_CHECK_LIB(dl, dlopen, DL_LIB="-ldl", [
AC_CHECK_LIB(dld, shl_load, DL_LIB="-ldld", [
AC_CHECK_FUNCS(dlopen, DL_LIB="", DL_LIB="")
])
])
])
oLIBS="$LIBS"
LIBS="$LIBS $DL_LIB"
AC_CHECK_FUNCS(dlerror,,)
LIBS="$oLIBS"
AC_SUBST(DL_LIB)
dnl Solaris
AC_CHECK_LIB(kstat, kstat_open)
AC_CHECK_FUNCS(getloadavg swapctl)
AC_CHECK_HEADERS(procfs.h sys/procfs.h, break)
dnl Some versions of Solaris require -lelf for -lkvm
AC_CHECK_LIB(kvm, kvm_open,[
LIBS="-lkvm $LIBS"
],[AC_MSG_CHECKING(for kvm_open in -lkvm with -lelf)
AC_CACHE_VAL(ac_cv_lib_kvm_with_elf,
[ac_save_LIBS="$LIBS"
LIBS="-lkvm -lelf $LIBS"
AC_TRY_LINK([char kvm_open();], [kvm_open()],
ac_cv_lib_kvm_with_elf=yes, ac_cv_lib_kvm_with_elf=no)
LIBS="$ac_save_LIBS"
])
if test "$ac_cv_lib_kvm_with_elf" = "yes"; then
AC_MSG_RESULT(yes)
LIBS="-lkvm -lelf $LIBS"
else
AC_MSG_RESULT(no)
fi
])
dnl For DEC OSF1
AC_CHECK_LIB(mach, vm_statistics)
dnl For some broken libc5 systems (Debian 1.3)
saved_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -D_GNU_SOURCE"
GCC_NEED_DECLARATION(program_invocation_name, [
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
])
CFLAGS=$saved_CFLAGS
dnl Check for Internet sockets.
AC_CHECK_FUNC(socket,
[AC_CHECK_HEADER(netinet/in.h,
[AC_CHECK_HEADER(arpa/inet.h, [
AC_DEFINE(HAVE_SOCKETS)
AC_MSG_CHECKING("for sun_len member in struct sockaddr_un")
AC_TRY_LINK([
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
],
[static struct sockaddr_un x; x.sun_len = 1;],
[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SOCKADDR_SUN_LEN)],
[AC_MSG_RESULT(no)])])])])
dnl Checks for library functions.
AC_FUNC_ALLOCA
AC_FUNC_MMAP
AC_TYPE_SIGNAL
AC_FUNC_STRFTIME
AC_CHECK_FUNCS(getcwd gettimeofday getwd putenv strdup strtoul uname)
dnl ## all 'es_??' are only needed for format numbers different of 'es'
ALL_LINGUAS="az ca da de es es_DO es_GT es_HN es_MX es_PA es_PE es_SV fi fr ga gl hu ja ko nl no pl pt_BR ru sk sv tr uk zh_CN.GB2312"
AM_GNOME_GETTEXT
AC_PATH_XTRA
dnl For Solaris
dnl Please don't move this before AC_PATH_XTRA
AC_CHECK_FUNC(gethostbyname,,[AC_CHECK_LIB(nsl,gethostbyname)])
AC_CHECK_FUNC(connect,,[AC_CHECK_LIB(socket,connect)])
AC_CHECK_FUNC(inet_aton,,[AC_CHECK_LIB(resolv,inet_aton)])
dnl The construct foo=`echo $w1 $w2 $w3` fails on some systems if $w1 = -e or -n
dnl So we use the following instead.
dnl XE_SPACE(var, words)
define([XE_SPACE],[
T=""
for W in $2; do if test -z "$T"; then T="$W"; else T="$T $W"; fi; done
$1="$T"
])dnl
dnl Autodetect Xauth
dnl -lXau is only used by gnuclient, so use a special variable for Xauth X libs
saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
test -z "$with_xauth" && { AC_CHECK_HEADER(X11/Xauth.h, ,with_xauth=no) }
test -z "$with_xauth" && { AC_CHECK_LIB(Xau, XauGetAuthByAddr,[:],with_xauth=no, $X_LIBS) }
test -z "$with_xauth" && with_xauth=yes
if test "$with_xauth" = "yes"; then
AC_DEFINE(HAVE_XAUTH)
XE_SPACE(libs_xauth, $X_LIBS -lXau)
fi
CPPFLAGS="$saved_CPPFLAGS"
AC_SUBST(libs_xauth)
dnl For diskusage stuff
GNOME_FILEUTILS_CHECKS
dnl Debugging
AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [default=no]],AC_DEFINE(LIBGTOP_ENABLE_DEBUG),)
AC_ARG_ENABLE(fatal-warnings, [ --enable-fatal-warnings make all warnings fatal [debug=no]],AC_DEFINE(LIBGTOP_FATAL_WARNINGS),)
if test "x$gnome_found" = xyes ; then
LIBSUPPORT="$GNOME_LIBDIR -lgnomesupport"
SUPPORTINCS="$GNOME_INCLUDEDIR"
else
LIBSUPPORT='$(top_builddir)/support/libgnomesupport.la'
SUPPORTINCS='-DNEED_GNOMESUPPORT_H -I$(top_builddir)/support -I$(top_srcdir)/support'
fi
dnl Some ugly hack; if '-lgnomesupport' is part of $GNOME_LIBS,
dnl we include it here.
case "$GNOME_LIBS" in
'*-lgnomesupport*' )
LIBSUPPORT="$GNOME_LIBDIR -lgnomesupport"
SUPPORTINCS="$GNOME_INCLUDEDIR" ;;
esac
AC_SUBST(LIBSUPPORT)
AC_SUBST(SUPPORTINCS)
dnl These definitions are expanded in make.
LIBGTOP_LIBS='-L$(libdir)'
LIBGTOP_INCS='-I$(includedir) -I$(pkglibdir)/include'
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
if test x$libgtop_have_sysinfo = xyes ; then
LIBGTOP_INCS="$LIBGTOP_INCS -DHAVE_LIBGTOP_SYSINFO"
fi
LIBGTOP_INCS="$LIBGTOP_INCS $SUPPORTINCS $GLIB_CFLAGS"
LIBGTOP_GUILE_LIBS="$LIBGTOP_LIBS"
LIBGTOP_GUILE_INCS="$LIBGTOP_INCS"
LIBGTOP_BINDIR='$(bindir)'
LIBGTOP_SERVER='$(bindir)/libgtop_server'
sysdeps_dir="$libgtop_sysdeps_dir"
AC_SUBST(sysdeps_dir)
if test x$ac_cv_guile_found = xyes ; then
LIBGTOP_GUILE_LIBS="$LIBGTOP_GUILE_LIBS -lgtop_guile"
libgtop_guile_found=yes
else
libgtop_guile_found=no
fi
AC_SUBST(libgtop_guile_found)
if test -z "$LIBGTOP_EXTRA_LIBS" ; then
LIBGTOP_EXTRA_LIBS="$libs_xauth"
else
LIBGTOP_EXTRA_LIBS="$LIBGTOP_EXTRA_LIBS $libs_xauth"
fi
LIBGTOP_EXTRA_LIBS="$LIBGTOP_EXTRA_LIBS $GLIB_LIBS"
LIBGTOP_LIBS="$LIBGTOP_LIBS -lgtop -lgtop_sysdeps -lgtop_common"
LIBGTOP_GUILE_LIBS="$LIBGTOP_GUILE_LIBS -lgtop -lgtop_sysdeps -lgtop_common"
LIBGTOP_NAMES_LIBS="$LIBGTOP_LIBS -lgtop_names"
LIBGTOP_GUILE_NAMES_LIBS="$LIBGTOP_GUILE_LIBS -lgtop_guile_names -lgtop_names"
LIBGTOP_LIBS="$LIBGTOP_LIBS"
LIBGTOP_NAMES_LIBS="$LIBGTOP_NAMES_LIBS"
LIBGTOP_GUILE_LIBS="$LIBGTOP_GUILE_LIBS"
LIBGTOP_GUILE_NAMES_LIBS="$LIBGTOP_GUILE_NAMES_LIBS"
LIBGTOP_GUILE_LIBS="$LIBGTOP_GUILE_LIBS $GUILE_LIBS"
LIBGTOP_GUILE_INCS="$LIBGTOP_GUILE_INCS $GUILE_INCS -DGLIBTOP_GUILE"
LIBGTOP_NAMES_INCS="$LIBGTOP_INCS -DGLIBTOP_NAMES"
LIBGTOP_GUILE_NAMES_INCS="$LIBGTOP_GUILE_INCS -DGLIBTOP_GUILE_NAMES"
LIBGTOP_GUILE_NAMES_INCS="$LIBGTOP_GUILE_INCS -DGLIBTOP_NAMES"
machine_incs="-I\$(top_srcdir)/sysdeps/$sysdeps_dir"
AC_SUBST(machine_incs)
if test x$libgtop_guile_found = xyes ; then
guile_def="-DGLIBTOP_GUILE -DGLIBTOP_GUILE_NAMES $GUILE_INCS "
else
guile_def=""
fi
INCLUDES="-D_IN_LIBGTOP -D_GNU_SOURCE -DGLIBTOP_NAMES -I\$(top_builddir) -I\$(top_srcdir) -I\$(top_srcdir)/sysdeps/$sysdeps_dir -I\$(top_srcdir)/include -I\$(top_srcdir)/intl $SUPPORTINCS $GLIB_CFLAGS $CFLAGS $X_CFLAGS $guile_def "'-DGTOPLOCALEDIR=\"$(datadir)/locale\" -DLIBGTOP_VERSION=\"'"$LIBGTOP_VERSION"'\" -DLIBGTOP_SERVER_VERSION=\"'"$LIBGTOP_SERVER_VERSION"'\" -DLIBGTOP_VERSION_CODE='$LIBGTOP_VERSION_CODE' -DLIBGTOP_SERVER=\"'"$LIBGTOP_SERVER"'\"'
AC_SUBST(INCLUDES)
AC_SUBST(LIBGTOP_EXTRA_LIBS)
AC_SUBST(LIBGTOP_LIBS)
AC_SUBST(LIBGTOP_INCS)
AC_SUBST(LIBGTOP_NAMES_LIBS)
AC_SUBST(LIBGTOP_NAMES_INCS)
AC_SUBST(LIBGTOP_GUILE_LIBS)
AC_SUBST(LIBGTOP_GUILE_INCS)
AC_SUBST(LIBGTOP_GUILE_NAMES_LIBS)
AC_SUBST(LIBGTOP_GUILE_NAMES_INCS)
AC_SUBST(LIBGTOP_BINDIR)
AC_SUBST(LIBGTOP_SERVER)
if test x$libgtop_need_server = xyes ; then
sysdeps_suid_lib="\$(top_builddir)/sysdeps/\$(sysdeps_dir)/libgtop_sysdeps_suid.la"
server_programs='libgtop_server'
else
sysdeps_suid_lib=
server_programs=
fi
AC_SUBST(sysdeps_suid_lib)
AC_SUBST(server_programs)
dnl The following one is copied from glib/configure.in
AC_OUTPUT_COMMANDS([
## Generate `glibconfig.h' in two cases
## 1. `config.status' is run either explicitly, or via configure.
## Esp. not when it is run in `Makefile' to generate makefiles and
## config.h
## 2. CONFIG_OTHER is set explicitly
##
## Case 1 is difficult. We know that `automake' sets one of
## CONFIG_FILES or CONFIG_HEADERS to empty. This heuristic works
## only when AM_CONFIG_HEADER is set, however.
if test -n "${CONFIG_FILES}" && test -n "${CONFIG_HEADERS}"; then
# Both CONFIG_FILES and CONFIG_HEADERS are non-empty ==> Case 1
CONFIG_OTHER=${CONFIG_OTHER:-glibtop-config.h}
fi
case "$CONFIG_OTHER" in
*glibtop-config.h*)
echo creating glibtop-config.h
outfile=glibtop-config.h-tmp
cat > $outfile <<\_______EOF
/* glibtop-config.h
*
* This is a generated file. Please modify `configure.in'
*/
#ifndef GLIBTOP_CONFIG_H
#define GLIBTOP_CONFIG_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
_______EOF
did_typedefs=no
if test x$glibtop_uint64_t != xyes ; then
did_typedefs=yes
cat >> $outfile <<\_______EOF
#ifndef u_int64_t
typedef unsigned long long int u_int64_t;
#endif
_______EOF
fi
if test x$glibtop_int64_t != xyes ; then
did_typedefs=yes
cat >> $outfile <<\_______EOF
#ifndef int64_t
typedef signed long long int int64_t;
#endif
_______EOF
fi
if test x$did_typedefs = xyes ; then
cat >>$outfile <<_______EOF
/*
* NOTE: If your application checks for "u_int64_t" or "int64_t" in its own
* config.h, you must not include it after any of the LibGTop headers.
*/
_______EOF
fi
cat >>$outfile <<_______EOF
/* Define if we need the LibGTop server. */
_______EOF
if test x$glibtop_need_libgtop = xyes ; then
echo '#define NEED_LIBGTOP 1' >> $outfile
else
echo '#undef NEED_LIBGTOP' >> $outfile
fi
cat >>$outfile <<_______EOF
/* Define if LibGTop has support for multiple processors. */
_______EOF
if test x$glibtop_have_smp = xyes ; then
echo '#define HAVE_LIBGTOP_SMP 1' >> $outfile
else
echo '#undef HAVE_LIBGTOP_SMP' >> $outfile
fi
cat >>$outfile <<_______EOF
/* LibGTop major, minor and micro version. */
#define LIBGTOP_MAJOR_VERSION $libgtop_major_version
#define LIBGTOP_MINOR_VERSION $libgtop_minor_version
#define LIBGTOP_MICRO_VERSION $libgtop_micro_version
/* LibGTop version and numerical version code ("1.234.567" -> 1234567). */
#define LIBGTOP_VERSION "$libgtop_version"
#define LIBGTOP_VERSION_CODE $libgtop_version_code
/* LibGTop server version, increased each time the protocol changes. */
#define LIBGTOP_SERVER_VERSION $libgtop_server_version
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* GLIBCONFIG_H */
_______EOF
if cmp -s $outfile glibtop-config.h; then
echo glibtop-config.h is unchanged
rm -f $outfile
else
mv $outfile glibtop-config.h
fi ;;
esac
],[
glibtop_uint64_t=$ac_cv_type_u_int64_t
glibtop_int64_t=$ac_cv_type_int64_t
libgtop_major_version=$LIBGTOP_MAJOR_VERSION
libgtop_minor_version=$LIBGTOP_MINOR_VERSION
libgtop_micro_version=$LIBGTOP_MICRO_VERSION
libgtop_version_code=$LIBGTOP_VERSION_CODE
libgtop_server_version=$LIBGTOP_SERVER_VERSION
libgtop_version=$LIBGTOP_VERSION
glibtop_need_libgtop=$libgtop_need_server
glibtop_have_smp=$libgtop_smp
])
AC_OUTPUT([
Makefile
libgtop.spec
po/Makefile.in
intl/Makefile
misc/Makefile
include/Makefile
include/glibtop/Makefile
sysdeps/Makefile
sysdeps/common/Makefile
sysdeps/names/Makefile
sysdeps/guile/Makefile
sysdeps/guile/names/Makefile
sysdeps/stub/Makefile
sysdeps/stub_suid/Makefile
sysdeps/sun4/Makefile
sysdeps/osf1/Makefile
sysdeps/linux/Makefile
sysdeps/kernel/Makefile
sysdeps/freebsd/Makefile
sysdeps/solaris/Makefile
src/Makefile
src/daemon/Makefile
src/inodedb/Makefile
lib/Makefile
examples/Makefile
doc/Makefile
support/Makefile
macros/Makefile])

7
po/.cvsignore Normal file
View File

@@ -0,0 +1,7 @@
Makefile
Makefile.in
POTFILES
cat-id-tbl.c
*.gmo *.mo
libgtop.pot
Makefile.in.in

99
po/ChangeLog Normal file
View File

@@ -0,0 +1,99 @@
2001-02-27 Pablo Saratxaga <pablo@mandrakesoft.com>
* ca.po: Updated Catalan file
2001-02-16 Christian Rose <menthos@menthos.com>
* sv.po: Updated Swedish translation.
2001-02-13 Stanislav Visnovsky <visnovsky@nenya.ms.mff.cuni.cz>
* sk.po: Added Slovak translation from Marcel Telka <marcel@telka.sk>.
2000-10-11 Yukihiro Nakai <nakai@gnome.gr.jp>
* ja.po: Updated Japanese translation.
1999-09-29 Kenneth ll<6C>phaane Christiansen <kenneth@ripen.dk>
* da.po: Updated.
1999-09-27 Rodrigo Stulzer Lopes <rodrigo@conectiva.com.br>
* pt_BR.po: Added.
1999-09-22 Kjartan Maraas <kmaraas@online.no>
* da.po: Added Danish translation from Kenneth
Christiansen <kenneth@ripen.dk>.
1999-08-13 Vincent Renardias <vincent@ldsol.com>
* fr.po: Completed translation.
1999-07-30 Matthias Warkus <mawa@iname.com>
* de.po: Updated and finally checked in.
1999-07-27 Vincent Renardias <vincent@ldsol.com>
* fr.po: updated thanks to Fabrice's patch.
1999-07-11 Kjartan Maraas <kmaraas@online.no>
* no.po: Updated translation.
1999-07-11 Tomas Ogren <stric@ing.umu.se>
* sv.po: Updated
1999-06-08 Kjartan Maraas <kmaraas@online.no>
* no.po: Updated translation.
1999-05-07 Yukihiro Nakai <Nakai@astec.co.jp>
* ja.po: Updated translation
1999-04-18 Tuomas J. Lukka <lukka@iki.fi
* Small addition to fi.po
1999-04-18 Tuomas J. Lukka <lukka@iki.fi
* Add fi.po
1999-04-13 Kjartan Maraas <kmaraas@online.no>
* no.po: Updated translation.
1999-01-27 Kjartan Maraas <kmaraas@fib.hl.no>
* no.po: Updated translation
1998-12-22 Yukihiro Nakai <Nakai@TokyoNet.AD.JP>
* ja.po: New file - added Japanese translation
1998-10-11 Martin Baulig <martin@home-of-linux.org>
* POTFILES.in: Removed `sysdeps/linux/procdata.c'.
1998-10-11 Kjartan Maraas <kmaraas@fib.hl.no>
* no.po: New file - added norwegian translation.
1998-10-07 Martin Baulig <martin@home-of-linux.org>
* de.po: New file - added german translation.
* POTFILES.in: Regenerated.
Sun, 31 May 1998 22:38:59 +0200 Vincent Renardias <vincent@waw.com>
* fr.po: new file - ChangeLog isn't empty anymore _(;
1998-05-21 Martin Baulig <martin@home-of-linux.org>
* ChangeLog: new file - currently empty

26
po/LEEME.es Normal file
View File

@@ -0,0 +1,26 @@
[ This file explains why there are various incomplete es_??.po in adition
to the es.po; that is on purpose ]
Los diferentes archivos para las locales es_DO, es_GT, es_HN, es_MX, es_PA,
es_PE y es_SV; solo existen porque en esos paises se usa una representaci<EFBFBD>n
de los n<EFBFBD>meros diferente de la que se usa en los dem<EFBFBD>s paises de habla
castellan (usan el sistema anglosaj<EFBFBD>n, esdecir 1,000 en vez de 1.000 para
'mil').
Por ello solo es necesario traducir aquellas ocurrencias donde aparezcan
n<EFBFBD>meros; no hace falta perder el tiempo traduciendo en doble lo dem<EFBFBD>s;
el sistema de internacionalizaci<EFBFBD>n de GNU gettext es lo suficientemente
inteligente como para buscar las traducciones en la locale 'es' cuando no
las encuentra en una 'es_XX' m<EFBFBD>s espec<EFBFBD>fica.
Tambi<EFBFBD>n podriase crear un es_ES para traducir aquellos terminos que difieren
en Espa<EFBFBD>a y Am<EFBFBD>rica (ej: computadora/ordenador, archivo/fichero, <EFBFBD>cono/icono),
si alg<EFBFBD>n espa<EFBFBD>ol tiene ganas de encargarse de ello, bienvenido.
Notese que solo es necesario traducir aquellas cadenas de texto para las
cuales se usan terminos diferentes en Espa<EFBFBD>a; no es necesario traducir las
dem<EFBFBD>s, con que est<EFBFBD>n en la traducci<EFBFBD>n general 'es' ya basta.
Pablo Saratxaga
<srtxg@chanae.alphanet.ch>

110
po/POTFILES.in Normal file
View File

@@ -0,0 +1,110 @@
sysdeps/names/cpu.c
sysdeps/names/fsusage.c
sysdeps/names/loadavg.c
sysdeps/names/mem.c
sysdeps/names/mountlist.c
sysdeps/names/msg_limits.c
sysdeps/names/prockernel.c
sysdeps/names/proclist.c
sysdeps/names/procmap.c
sysdeps/names/procmem.c
sysdeps/names/procsegment.c
sysdeps/names/procsignal.c
sysdeps/names/procstate.c
sysdeps/names/proctime.c
sysdeps/names/procuid.c
sysdeps/names/sem_limits.c
sysdeps/names/shm_limits.c
sysdeps/names/swap.c
sysdeps/names/sysdeps.c
sysdeps/names/uptime.c
support/easy-vsnprintf.c
support/error.c
support/error.h
support/getopt.c
lib/close.c
lib/command.c
lib/init.c
lib/open.c
lib/parameter.c
lib/read.c
lib/read_data.c
lib/sysdeps.c
lib/write.c
include/glibtop/close.h
include/glibtop/command.h
include/glibtop/cpu.h
include/glibtop/error.h
include/glibtop/fsusage.h
include/glibtop/global.h
include/glibtop/gnuserv.h
include/glibtop/inodedb.h
include/glibtop/loadavg.h
include/glibtop/mem.h
include/glibtop/mountlist.h
include/glibtop/msg_limits.h
include/glibtop/open.h
include/glibtop/parameter.h
include/glibtop/prockernel.h
include/glibtop/proclist.h
include/glibtop/procmap.h
include/glibtop/procmem.h
include/glibtop/procsegment.h
include/glibtop/procsignal.h
include/glibtop/procstate.h
include/glibtop/proctime.h
include/glibtop/procuid.h
include/glibtop/read.h
include/glibtop/read_data.h
include/glibtop/sem_limits.h
include/glibtop/shm_limits.h
include/glibtop/signal.h
include/glibtop/swap.h
include/glibtop/sysdeps.h
include/glibtop/sysinfo.h
include/glibtop/types.h
include/glibtop/union.h
include/glibtop/uptime.h
include/glibtop/version.h
include/glibtop/write.h
include/glibtop/xmalloc.h
src/inodedb/file_by_inode.c
src/inodedb/mkinodedb.c
src/daemon/gnuserv.c
src/daemon/io.c
src/daemon/main.c
src/daemon/server.c
src/daemon/slave.c
src/daemon/version.c
sysdeps/common/error.c
sysdeps/common/fsusage.c
sysdeps/common/gnuslib.c
sysdeps/common/inodedb.c
sysdeps/common/mountlist.c
sysdeps/common/sysdeps_suid.c
sysdeps/common/xmalloc.c
sysdeps/common/fsusage.h
sysdeps/common/mountlist.h
sysdeps/linux/close.c
sysdeps/linux/cpu.c
sysdeps/linux/loadavg.c
sysdeps/linux/mem.c
sysdeps/linux/msg_limits.c
sysdeps/linux/open.c
sysdeps/linux/prockernel.c
sysdeps/linux/proclist.c
sysdeps/linux/procmap.c
sysdeps/linux/procmem.c
sysdeps/linux/procsegment.c
sysdeps/linux/procsignal.c
sysdeps/linux/procstate.c
sysdeps/linux/proctime.c
sysdeps/linux/procuid.c
sysdeps/linux/sem_limits.c
sysdeps/linux/shm_limits.c
sysdeps/linux/siglist.c
sysdeps/linux/swap.c
sysdeps/linux/sysinfo.c
sysdeps/linux/uptime.c
sysdeps/linux/glibtop_machine.h
sysdeps/linux/glibtop_server.h

1299
po/az.po Normal file

File diff suppressed because it is too large Load Diff

1483
po/ca.po Normal file

File diff suppressed because it is too large Load Diff

1521
po/da.po Normal file

File diff suppressed because it is too large Load Diff

1255
po/de.po Normal file

File diff suppressed because it is too large Load Diff

1247
po/es.po Normal file

File diff suppressed because it is too large Load Diff

1218
po/es_DO.po Normal file

File diff suppressed because it is too large Load Diff

1218
po/es_GT.po Normal file

File diff suppressed because it is too large Load Diff

1218
po/es_HN.po Normal file

File diff suppressed because it is too large Load Diff

1218
po/es_MX.po Normal file

File diff suppressed because it is too large Load Diff

1218
po/es_PA.po Normal file

File diff suppressed because it is too large Load Diff

1218
po/es_PE.po Normal file

File diff suppressed because it is too large Load Diff

1218
po/es_SV.po Normal file

File diff suppressed because it is too large Load Diff

1234
po/fi.po Normal file

File diff suppressed because it is too large Load Diff

1251
po/fr.po Normal file

File diff suppressed because it is too large Load Diff

1240
po/ga.po Normal file

File diff suppressed because it is too large Load Diff

1268
po/gl.po Normal file

File diff suppressed because it is too large Load Diff

1796
po/hu.po Normal file

File diff suppressed because it is too large Load Diff

1236
po/ja.po Normal file

File diff suppressed because it is too large Load Diff

1232
po/ko.po Normal file

File diff suppressed because it is too large Load Diff

1238
po/nl.po Normal file

File diff suppressed because it is too large Load Diff

1234
po/no.po Normal file

File diff suppressed because it is too large Load Diff

1240
po/pl.po Normal file

File diff suppressed because it is too large Load Diff

1270
po/pt_BR.po Normal file

File diff suppressed because it is too large Load Diff

1319
po/ru.po Normal file

File diff suppressed because it is too large Load Diff

1245
po/sk.po Normal file

File diff suppressed because it is too large Load Diff

1
po/stamp-cat-id Normal file
View File

@@ -0,0 +1 @@
timestamp

1383
po/sv.po Normal file

File diff suppressed because it is too large Load Diff

1231
po/tr.po Normal file

File diff suppressed because it is too large Load Diff

1221
po/uk.po Normal file

File diff suppressed because it is too large Load Diff

1261
po/zh_CN.GB2312.po Normal file

File diff suppressed because it is too large Load Diff

96
src/daemon/ChangeLog Normal file
View File

@@ -0,0 +1,96 @@
1999-11-28 Martin Baulig <martin@home-of-linux.org>
* gnuserv.c (setup_table): Don't dump core when the table of
permitted host names contains a NULL pointer.
1999-07-29 Martin Baulig <martin@home-of-linux.org>
* Makefile.am: Link the `libgtop_daemon' and the `libgtop_server'
statically if possible.
1999-05-07 Martin Baulig <martin@home-of-linux.org>
* server.c (main): There's some problem with uname () - some systems
like Solaris or Digital Unix return a nonnegative value on success,
some others like Linux return 0. Since all known systems seem to return
a negative value on failure, we simply check whether the return value is
not negative here.
1999-02-19 Martin Baulig <martin@home-of-linux.org>
* Makefile.am (LIBGTOP_COMPILE_SYSTEM): Hardcoded system name.
(LIBGTOP_COMPILE_RELEASE): Hardcoded system release.
(LIBGTOP_COMPILE_MACHINE): Hardcoded machine type.
* src/daemon/Makefile.am (libgtop_server_SOURCES): Don't use
`@INTLLIBS@' for the server.
* server.c (main): Abort if not running on the system the server
was compiled on.
1999-02-10 Martin Baulig <martin@home-of-linux.org>
* gnuserv.c (program_invocation_*_name): Declare this as `extern'
if necessary.
1998-12-17 Martin Baulig <baulig@merkur.uni-trier.de>
* gnuserv.c: Don't include <gnome-argp.h>.
(program_invocation_name, program_invocation_short_name): Define
this here.
1998-12-09 Martin Baulig <martin@home-of-linux.org>
Larger changes to the daemon:
- Dropped all the unix domain socket stuff - we don't need it for
connections on the local host, here we behave just like any normal
application.
- Added poptimization: use the --help parameter to get usage info
- Made it a real daemon, fork into background and write to syslog.
- It's now possible to invoke the daemon from inetd, you'll get
GNU_SECURE authentication in this case.
- Don't make this executable suid/sgid - if invoked as root it
sets uid/gid to SERVER_UID/SERVER_GID as defined in server_config.h
- Added missing features, so you can now really use this thing.
1998-11-11 Martin Baulig <martin@home-of-linux.org>
* gnuserv.c (main): Set `server->features' directly rather than
calling glibtop_set_parameter_l () since this function no longer
allows to modify the features.
* gnuserv.c, main.c: Use LIBGTOP_ENABLE_DEBUG rather than DEBUG.
1998-11-01 Marc Ewing <marc@tasmanian.redhat.com>
* Makefile.am: Added $(GLIB_LIBS) to libs. Not sure
how it ever built without it.
1998-10-20 Martin Baulig <martin@home-of-linux.org>
* Makefile.am: Added a notice that this file *requires*
libtool 1.2. It may work with 1.1 as well, but that's untested.
1998-10-11 Martin Baulig <martin@home-of-linux.org>
* Makefile.am (install-exec-hook): Always run `libgtop_postinstall',
it's `:' if there's nothing to do since the empty string is no
valid shell syntax here.
1998-10-01 Martin Baulig <martin@home-of-linux.org>
* Makefile.am (install-exec-hook): Use `libgtop_postinstall'
here to make the server suid root or sgid kmem if required.
1998-08-25 Martin Baulig <martin@home-of-linux.org>
* daemon.h (handle_parent_connection): Added prototype.
* write.c, io.c: Added cast to `const void *' in calls to
`write' and `send' to avoid compiler warnings.
* gnuserv.c (handle_signal): Declared static.
(main): Casting return value of `getuid' to `int' in
debugging statement.
* ChangeLog: New file.

638
src/daemon/gnuserv.c Normal file
View File

@@ -0,0 +1,638 @@
/* -*-C-*-
* Server code for handling requests from clients and forwarding them
* on to the GNU Emacs process.
*
* This file is part of GNU Emacs.
*
* Copying is permitted under those conditions described by the GNU
* General Public License.
*
* Copyright (C) 1989 Free Software Foundation, Inc.
*
* Author: Andy Norman (ange@hplb.hpl.hp.com), based on 'etc/server.c'
* from the 18.52 GNU Emacs distribution.
*
* Please mail bugs and suggestions to the author at the above address.
*/
/* HISTORY
* 11-Nov-1990 bristor@simba
* Added EOT stuff.
*/
/*
* This file incorporates new features added by Bob Weiner <weiner@mot.com>,
* Darrell Kindred <dkindred@cmu.edu> and Arup Mukherjee <arup@cmu.edu>.
* Please see the note at the end of the README file for details.
*
* (If gnuserv came bundled with your emacs, the README file is probably
* ../etc/gnuserv.README relative to the directory containing this file)
*/
#include <glibtop.h>
#include <glibtop/open.h>
#include <glibtop/close.h>
#include <glibtop/command.h>
#include <glibtop/xmalloc.h>
#include <glibtop/parameter.h>
#include "server_config.h"
#include <glibtop/gnuserv.h>
#include <errno.h>
#include <popt-gnome.h>
#include "daemon.h"
#ifdef AIX
#include <sys/select.h>
#endif
#ifdef NEED_DECLARATION_PROGRAM_INVOCATION_NAME
extern char *program_invocation_name, *program_invocation_short_name;
#endif
#ifndef HAVE_PROGRAM_INVOCATION_SHORT_NAME
char *program_invocation_short_name;
#endif
#ifndef HAVE_PROGRAM_INVOCATION_NAME
char *program_invocation_name;
#endif
void handle_parent_connection (int s);
void handle_slave_connection (int input, int output);
#if !defined(INTERNET_DOMAIN_SOCKETS)
#error "Internet Domain sockets are required"
#endif
#ifdef AUTH_MAGIC_COOKIE
#include <X11/X.h>
#include <X11/Xauth.h>
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;
static int changed_uid = 0;
void
syslog_message (int priority, char *format, ...)
{
va_list ap;
char buffer [BUFSIZ];
va_start (ap, format);
vsnprintf (buffer, BUFSIZ-1, format, ap);
va_end (ap);
syslog (priority, buffer);
}
void
syslog_io_message (int priority, char *format, ...)
{
va_list ap;
char buffer [BUFSIZ];
char buffer2 [BUFSIZ];
va_start (ap, format);
vsnprintf (buffer, BUFSIZ-1, format, ap);
va_end (ap);
snprintf (buffer2, BUFSIZ-1, "%s: %s", buffer, strerror (errno));
syslog (priority, buffer2);
}
/*
* timed_read - Read with timeout.
*/
static int
timed_read (int fd, char *buf, int max, int timeout, int one_line)
{
fd_set rmask;
struct timeval tv; /* = {timeout, 0}; */
char c = 0;
int nbytes = 0;
int r;
tv.tv_sec = timeout;
tv.tv_usec = 0;
FD_ZERO (&rmask);
FD_SET (fd, &rmask);
do {
r = select (fd + 1, &rmask, NULL, NULL, &tv);
if (r > 0) {
if (read (fd, &c, 1) == 1) {
*buf++ = c;
++nbytes;
} else {
syslog_io_message (LOG_WARNING, "read error on socket");
return -1;
}
} else if (r == 0) {
syslog_io_message (LOG_WARNING, "read timed out");
return -1;
} else {
syslog_io_message (LOG_WARNING, "error in select");
return -1;
}
} while ((nbytes < max) && !(one_line && (c == '\n')));
--buf;
if (one_line && *buf == '\n') {
*buf = 0;
}
return nbytes;
}
/*
* permitted -- return whether a given host is allowed to connect to the server.
*/
static int
permitted (u_long host_addr, int fd)
{
int i;
char auth_protocol[128];
char buf[1024];
int auth_data_len;
/* Read auth protocol name */
if (timed_read (fd, auth_protocol, AUTH_NAMESZ, AUTH_TIMEOUT, 1) <= 0)
return FALSE;
if (enable_debug)
syslog_message (LOG_DEBUG,
"Client sent authenticatin protocol '%s'.",
auth_protocol);
if (strcmp (auth_protocol, DEFAUTH_NAME) &&
strcmp (auth_protocol, MCOOKIE_NAME)) {
syslog_message (LOG_WARNING,
"Invalid authentication protocol "
"'%s' from client",
auth_protocol);
return FALSE;
}
if (!strcmp (auth_protocol, MCOOKIE_NAME)) {
/*
* doing magic cookie auth
*/
if (timed_read (fd, buf, 10, AUTH_TIMEOUT, 1) <= 0)
return FALSE;
auth_data_len = atoi (buf);
if (timed_read (fd, buf, auth_data_len, AUTH_TIMEOUT, 0) != auth_data_len)
return FALSE;
#ifdef AUTH_MAGIC_COOKIE
if (!invoked_from_inetd && server_xauth && server_xauth->data &&
!memcmp (buf, server_xauth->data, auth_data_len)) {
return TRUE;
}
#else
syslog_message (LOG_WARNING,
"Client tried Xauth, but server is "
"not compiled with Xauth");
#endif
/*
* auth failed, but allow this to fall through to the
* GNU_SECURE protocol....
*/
if (verbose_output) {
if (changed_uid || invoked_from_inetd)
syslog_message (LOG_WARNING,
"Xauth authentication not allowed, "
"trying GNU_SECURE ...");
else
syslog_message (LOG_WARNING,
"Xauth authentication failed, "
"trying GNU_SECURE auth...");
}
}
/* Other auth protocols go here, and should execute only if
* the * auth_protocol name matches. */
/* Now, try the old GNU_SECURE stuff... */
if (enable_debug)
syslog_message (LOG_DEBUG, "Doing GNU_SECURE auth ...");
/* Now check the chain for that hash key */
for (i = 0; i < HOST_TABLE_ENTRIES; i++) {
if (enable_debug)
syslog_message (LOG_DEBUG, "Trying %lx - %lx",
host_addr, permitted_hosts [i]);
if (permitted_hosts [i] == 0L)
return (FALSE);
if (host_addr == permitted_hosts [i])
return (TRUE);
}
return (FALSE);
}
/*
* setup_table -- initialise the table of hosts allowed to contact the server,
* by reading from the file specified by the GNU_SECURE
* environment variable
* Put in the local machine, and, if a security file is specifed,
* add each host that is named in the file.
* Return the number of hosts added.
*/
static int
setup_table (void)
{
char hostname [HOSTNAMSZ], screen [BUFSIZ];
long host_addr;
int i, hosts = 0;
/* Make sure every entry is null */
for (i = 0; i < HOST_TABLE_ENTRIES; i++)
permitted_hosts [i] = 0;
gethostname (hostname, HOSTNAMSZ);
if ((host_addr = glibtop_internet_addr (hostname)) == -1) {
syslog_io_message (LOG_ERR, "Can't resolve '%s'", hostname);
exit (1);
}
#ifdef AUTH_MAGIC_COOKIE
sprintf (screen, "%d", SERVER_PORT);
server_xauth = XauGetAuthByAddr
(FamilyInternet,
sizeof (host_addr), (char *) &host_addr,
strlen (screen), screen,
strlen (MCOOKIE_X_NAME), MCOOKIE_X_NAME);
hosts++;
#endif /* AUTH_MAGIC_COOKIE */
/* Resolv host names from permitted_host_names []. */
for (i = 0; i < HOST_TABLE_ENTRIES; i++) {
if (!permitted_host_names [i])
continue;
if (enable_debug)
syslog_message (LOG_DEBUG, "Resolving %s ...",
permitted_host_names [i]);
permitted_hosts [i] =
glibtop_internet_addr (permitted_host_names [i]);
if ((long) permitted_hosts [i] == -1) {
syslog_io_message (LOG_ERR, "Can't resolve '%s'",
permitted_host_names [i]);
exit (1);
}
}
if (enable_debug)
for (i = 0; i < HOST_TABLE_ENTRIES; i++)
syslog_message (LOG_DEBUG, "Host %s - %lx",
permitted_host_names [i],
permitted_hosts [i]);
hosts += HOST_TABLE_ENTRIES;
return hosts;
} /* setup_table */
/*
* internet_init -- initialize server, returning an internet socket that can
* be listened on.
*/
static int
internet_init (void)
{
int ls; /* socket descriptor */
struct sockaddr_in server; /* for local socket address */
if (setup_table () == 0)
return -1;
/* clear out address structure */
memset ((char *) &server, 0, sizeof (struct sockaddr_in));
/* Set up address structure for the listen socket. */
server.sin_family = AF_INET;
server.sin_addr.s_addr = INADDR_ANY;
/* We use a fixed port given in the config file. */
server.sin_port = htons (SERVER_PORT);
if (verbose_output)
syslog_message (LOG_INFO, "Using port %u.", SERVER_PORT);
/* Create the listen socket. */
if ((ls = socket (AF_INET, SOCK_STREAM, 0)) == -1) {
syslog_io_message (LOG_ERR, "unable to create socket");
exit (1);
}
/* Bind the listen address to the socket. */
if (bind (ls, (struct sockaddr *) &server,
sizeof (struct sockaddr_in)) == -1) {
syslog_io_message (LOG_ERR, "bind");
exit (1);
}
/* Initiate the listen on the socket so remote users * can connect. */
if (listen (ls, 20) == -1) {
syslog_io_message (LOG_ERR, "listen");
exit (1);
}
return (ls);
} /* internet_init */
/*
* handle_internet_request -- accept a request from a client and send the
* information to stdout (the gnu process).
*/
static void
handle_internet_request (int ls)
{
int s;
size_t addrlen = sizeof (struct sockaddr_in);
struct sockaddr_in peer; /* for peer socket address */
pid_t pid;
memset ((char *) &peer, 0, sizeof (struct sockaddr_in));
if ((s = accept (ls, (struct sockaddr *) &peer, (void *) &addrlen)) == -1) {
syslog_io_message (LOG_ERR, "accept");
exit (1);
}
if (verbose_output)
syslog_message (LOG_INFO, "Connection was made from %s port %u.",
inet_ntoa (peer.sin_addr), ntohs (peer.sin_port));
/* Check that access is allowed - if not return crud to the client */
if (!permitted (peer.sin_addr.s_addr, s)) {
close (s);
syslog_message (LOG_CRIT, "Refused connection from %s.",
inet_ntoa (peer.sin_addr));
return;
} /* if */
if (verbose_output)
syslog_message (LOG_INFO, "Accepted connection from %s port %u.",
inet_ntoa (peer.sin_addr), ntohs (peer.sin_port));
pid = fork ();
if (pid == -1) {
syslog_io_message (LOG_ERR, "fork failed");
exit (1);
}
if (pid) {
if (verbose_output)
syslog_message (LOG_INFO, "Child pid is %d.", pid);
return;
}
handle_parent_connection (s);
close (s);
if (verbose_output)
syslog_message (LOG_INFO, "Closed connection to %s port %u.",
inet_ntoa (peer.sin_addr), ntohs (peer.sin_port));
_exit (0);
} /* handle_internet_request */
static void
handle_signal (int sig)
{
if (sig == SIGCHLD)
return;
syslog_message (LOG_ERR, "Catched signal %d.\n", 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 }
};
int
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;
int ils = -1; /* internet domain listen socket */
/* On non-glibc systems, this is not set up for us. */
if (!program_invocation_name) {
char *arg;
program_invocation_name = argv[0];
arg = strrchr (argv[0], '/');
program_invocation_short_name =
arg ? (arg + 1) : program_invocation_name;
}
context = poptGetContext ("libgtop-daemon", argc, argv,
popt_options, 0);
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 (enable_debug)
verbose_output = 1;
if (no_daemon) {
openlog ("libgtop-daemon", LOG_PERROR | LOG_PID, LOG_LOCAL0);
} else {
openlog ("libgtop-daemon", LOG_PID, LOG_LOCAL0);
}
if (!no_daemon && !invoked_from_inetd) {
pid_t pid = fork ();
if (pid == -1) {
syslog_io_message (LOG_ERR, "fork failed");
exit (1);
} else if (pid)
exit (0);
close (0);
setsid ();
}
glibtop_init_r (&glibtop_global_server, 0, GLIBTOP_INIT_NO_INIT);
signal (SIGCHLD, handle_signal);
/* If we are root, completely switch to SERVER_UID and
* SERVER_GID. Otherwise we completely drop any priviledges.
*/
if (enable_debug)
syslog_message (LOG_DEBUG, "Parent ID: (%d, %d) - (%d, %d)",
getuid (), geteuid (), getgid (), getegid ());
if (geteuid () == 0) {
changed_uid = 1;
if (setregid (SERVER_GID, SERVER_GID)) {
syslog_io_message (LOG_ERR, "setregid (SERVER_GID)");
exit (1);
}
if (setreuid (SERVER_UID, SERVER_UID)) {
syslog_io_message (LOG_ERR, "setreuid (SERVER_UID)");
exit (1);
}
} else {
if (setreuid (geteuid (), geteuid ())) {
syslog_io_message (LOG_ERR, "setreuid (euid)");
exit (1);
}
}
if (enable_debug)
syslog_message (LOG_DEBUG, "Parent ID: (%d, %d) - (%d, %d)",
getuid (), geteuid (), getgid (), getegid ());
if (invoked_from_inetd) {
size_t addrlen = sizeof (struct sockaddr_in);
struct sockaddr_in peer;
memset ((char *) &peer, 0, sizeof (struct sockaddr_in));
if (getpeername (0, (struct sockaddr *) &peer, (void *) &addrlen)) {
syslog_io_message (LOG_ERR, "getpeername");
exit (1);
}
if (verbose_output)
syslog_message (LOG_INFO, "Connection was made from %s port %u.",
inet_ntoa (peer.sin_addr), ntohs (peer.sin_port));
/* Check that access is allowed - if not return crud to the client */
if (!permitted (peer.sin_addr.s_addr, 0)) {
close (0);
syslog_message (LOG_CRIT, "Refused connection from %s.",
inet_ntoa (peer.sin_addr));
exit (1);
}
handle_parent_connection (0);
exit (0);
}
/* get a internet domain socket to listen on. */
ils = internet_init ();
if (ils <= 0) {
syslog_message (LOG_ERR, "Unable to get internet domain socket.");
exit (1);
}
glibtop_set_parameter_l (server, GLIBTOP_PARAM_METHOD,
&method, sizeof (method));
server->features = features;
glibtop_init_r (&server, 0, 0);
while (1) {
fd_set rmask;
int status, ret;
while ((ret = wait3 (&status, WNOHANG, NULL)) != 0) {
if ((ret == -1) && (errno == ECHILD))
break;
if ((ret == -1) && ((errno == EAGAIN)))
continue;
if (ret == 0) {
syslog_io_message (LOG_WARNING, "wait3");
continue;
}
if (verbose_output)
syslog_message (LOG_INFO, "Child %d exited.", ret);
}
FD_ZERO (&rmask);
/* Only the child accepts connections from standard
* input made by its parent. */
FD_SET (ils, &rmask);
if (enable_debug)
syslog_message (LOG_DEBUG,
"Server ready and waiting for connections.");
if (select (ils+1, &rmask, (fd_set *) NULL, (fd_set *) NULL,
(struct timeval *) NULL) < 0) {
if (errno == EINTR)
continue;
syslog_io_message (LOG_ERR, "select");
exit (1);
}
if (FD_ISSET (ils, &rmask))
handle_internet_request (ils);
}
return 0;
}

302
sysdeps/common/fsusage.c Normal file
View File

@@ -0,0 +1,302 @@
/* fsusage.c -- return space usage of mounted filesystems
Copyright (C) 1991, 1992, 1996 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include "fsusage.h"
int statfs ();
#if HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
#if HAVE_SYS_MOUNT_H
# include <sys/mount.h>
#endif
#if HAVE_SYS_VFS_H
# include <sys/vfs.h>
#endif
#if HAVE_SYS_FS_S5PARAM_H /* Fujitsu UXP/V */
# include <sys/fs/s5param.h>
#endif
#if defined (HAVE_SYS_FILSYS_H) && !defined (_CRAY)
# include <sys/filsys.h> /* SVR2 */
#endif
#if HAVE_FCNTL_H
# include <fcntl.h>
#endif
#if HAVE_SYS_STATFS_H
# include <sys/statfs.h>
#endif
#if HAVE_DUSTAT_H /* AIX PS/2 */
# include <sys/dustat.h>
#endif
#if HAVE_SYS_STATVFS_H /* SVR4 */
# include <sys/statvfs.h>
int statvfs ();
#endif
#include <glibtop.h>
#include <glibtop/error.h>
#include <glibtop/fsusage.h>
static int
get_fs_usage (const char *path, const char *disk, struct fs_usage *fsp);
int safe_read ();
/* Return the number of TOSIZE-byte blocks used by
BLOCKS FROMSIZE-byte blocks, rounding away from zero.
TOSIZE must be positive. Return -1 if FROMSIZE is not positive. */
static u_int64_t
adjust_blocks (blocks, fromsize, tosize)
u_int64_t blocks;
int fromsize, tosize;
{
if (tosize <= 0)
abort ();
if (fromsize <= 0)
return -1;
if (fromsize == tosize) /* e.g., from 512 to 512 */
return blocks;
else if (fromsize > tosize) /* e.g., from 2048 to 512 */
return blocks * (u_int64_t)(fromsize / tosize);
else /* e.g., from 256 to 512 */
return (blocks + (blocks < 0 ? -1 : 1)) / (u_int64_t)(tosize / fromsize);
}
/* Fill in the fields of FSP with information about space usage for
the filesystem on which PATH resides.
DISK is the device on which PATH is mounted, for space-getting
methods that need to know it.
Return 0 if successful, -1 if not. When returning -1, ensure that
ERRNO is either a system error value, or zero if DISK is NULL
on a system that requires a non-NULL value. */
static int
get_fs_usage (path, disk, fsp)
const char *path;
const char *disk;
struct fs_usage *fsp;
{
#ifdef STAT_STATFS3_OSF1
# define CONVERT_BLOCKS(B) adjust_blocks ((u_int64_t)(B), fsd.f_fsize, 512)
struct statfs fsd;
if (statfs (path, &fsd, sizeof (struct statfs)) != 0)
return -1;
#endif /* STAT_STATFS3_OSF1 */
#ifdef STAT_STATFS2_FS_DATA /* Ultrix */
# define CONVERT_BLOCKS(B) adjust_blocks ((u_int64_t)(B), 1024, 512)
struct fs_data fsd;
if (statfs (path, &fsd) != 1)
return -1;
fsp->fsu_blocks = CONVERT_BLOCKS (fsd.fd_req.btot);
fsp->fsu_bfree = CONVERT_BLOCKS (fsd.fd_req.bfree);
fsp->fsu_bavail = CONVERT_BLOCKS (fsd.fd_req.bfreen);
fsp->fsu_files = fsd.fd_req.gtot;
fsp->fsu_ffree = fsd.fd_req.gfree;
#endif /* STAT_STATFS2_FS_DATA */
#ifdef STAT_READ_FILSYS /* SVR2 */
# ifndef SUPERBOFF
# define SUPERBOFF (SUPERB * 512)
# endif
# define CONVERT_BLOCKS(B) \
adjust_blocks ((u_int64_t)(B), (fsd.s_type == Fs2b ? 1024 : 512), 512)
struct filsys fsd;
int fd;
if (! disk)
{
errno = 0;
return -1;
}
fd = open (disk, O_RDONLY);
if (fd < 0)
return -1;
lseek (fd, (long) SUPERBOFF, 0);
if (safe_read (fd, (char *) &fsd, sizeof fsd) != sizeof fsd)
{
close (fd);
return -1;
}
close (fd);
fsp->fsu_blocks = CONVERT_BLOCKS (fsd.s_fsize);
fsp->fsu_bfree = CONVERT_BLOCKS (fsd.s_tfree);
fsp->fsu_bavail = CONVERT_BLOCKS (fsd.s_tfree);
fsp->fsu_files = (fsd.s_isize - 2) * INOPB * (fsd.s_type == Fs2b ? 2 : 1);
fsp->fsu_ffree = fsd.s_tinode;
#endif /* STAT_READ_FILSYS */
#ifdef STAT_STATFS2_BSIZE /* 4.3BSD, SunOS 4, HP-UX, AIX */
# define CONVERT_BLOCKS(B) adjust_blocks ((u_int64_t)(B), fsd.f_bsize, 512)
struct statfs fsd;
if (statfs (path, &fsd) < 0)
return -1;
# ifdef STATFS_TRUNCATES_BLOCK_COUNTS
/* In SunOS 4.1.2, 4.1.3, and 4.1.3_U1, the block counts in the
struct statfs are truncated to 2GB. These conditions detect that
truncation, presumably without botching the 4.1.1 case, in which
the values are not truncated. The correct counts are stored in
undocumented spare fields. */
if (fsd.f_blocks == 0x1fffff && fsd.f_spare[0] > 0)
{
fsd.f_blocks = fsd.f_spare[0];
fsd.f_bfree = fsd.f_spare[1];
fsd.f_bavail = fsd.f_spare[2];
}
# endif /* STATFS_TRUNCATES_BLOCK_COUNTS */
#endif /* STAT_STATFS2_BSIZE */
#ifdef STAT_STATFS2_FSIZE /* 4.4BSD */
# define CONVERT_BLOCKS(B) adjust_blocks ((u_int64_t)(B), fsd.f_fsize, 512)
struct statfs fsd;
if (statfs (path, &fsd) < 0)
return -1;
#endif /* STAT_STATFS2_FSIZE */
#ifdef STAT_STATFS4 /* SVR3, Dynix, Irix, AIX */
# if _AIX || defined(_CRAY)
# define CONVERT_BLOCKS(B) adjust_blocks ((u_int64_t)(B), fsd.f_bsize, 512)
# ifdef _CRAY
# define f_bavail f_bfree
# endif
# else
# define CONVERT_BLOCKS(B) (B)
# ifndef _SEQUENT_ /* _SEQUENT_ is DYNIX/ptx */
# ifndef DOLPHIN /* DOLPHIN 3.8.alfa/7.18 has f_bavail */
# define f_bavail f_bfree
# endif
# endif
# endif
struct statfs fsd;
if (statfs (path, &fsd, sizeof fsd, 0) < 0)
return -1;
/* Empirically, the block counts on most SVR3 and SVR3-derived
systems seem to always be in terms of 512-byte blocks,
no matter what value f_bsize has. */
#endif /* STAT_STATFS4 */
#ifdef STAT_STATVFS /* SVR4 */
# define CONVERT_BLOCKS(B) \
adjust_blocks ((u_int64_t)(B), fsd.f_frsize ? fsd.f_frsize : fsd.f_bsize, 512)
struct statvfs fsd;
if (statvfs (path, &fsd) < 0)
return -1;
/* f_frsize isn't guaranteed to be supported. */
#endif /* STAT_STATVFS */
#if !defined(STAT_STATFS2_FS_DATA) && !defined(STAT_READ_FILSYS)
/* !Ultrix && !SVR2 */
fsp->fsu_blocks = CONVERT_BLOCKS (fsd.f_blocks);
fsp->fsu_bfree = CONVERT_BLOCKS (fsd.f_bfree);
fsp->fsu_bavail = CONVERT_BLOCKS (fsd.f_bavail);
fsp->fsu_files = fsd.f_files;
fsp->fsu_ffree = fsd.f_ffree;
#endif /* not STAT_STATFS2_FS_DATA && not STAT_READ_FILSYS */
return 0;
}
#if defined(_AIX) && defined(_I386)
/* AIX PS/2 does not supply statfs. */
int
statfs (path, fsb)
char *path;
struct statfs *fsb;
{
struct stat stats;
struct dustat fsd;
if (stat (path, &stats))
return -1;
if (dustat (stats.st_dev, 0, &fsd, sizeof (fsd)))
return -1;
fsb->f_type = 0;
fsb->f_bsize = fsd.du_bsize;
fsb->f_blocks = fsd.du_fsize - fsd.du_isize;
fsb->f_bfree = fsd.du_tfree;
fsb->f_bavail = fsd.du_tfree;
fsb->f_files = (fsd.du_isize - 2) * fsd.du_inopb;
fsb->f_ffree = fsd.du_tinode;
fsb->f_fsid.val[0] = fsd.du_site;
fsb->f_fsid.val[1] = fsd.du_pckno;
return 0;
}
#endif /* _AIX && _I386 */
void
glibtop_get_fsusage_s (glibtop *server, glibtop_fsusage *buf,
const char *disk)
{
struct fs_usage fsp;
glibtop_init_r (&server, 0, 0);
memset (buf, 0, sizeof (glibtop_fsusage));
memset (&fsp, 0, sizeof (struct fs_usage));
if (get_fs_usage (disk, disk, &fsp))
return;
buf->blocks = fsp.fsu_blocks;
buf->bfree = fsp.fsu_bfree;
buf->bavail = fsp.fsu_bavail;
buf->files = fsp.fsu_files;
buf->ffree = fsp.fsu_ffree;
}

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

@@ -0,0 +1,27 @@
/* fsusage.h -- declarations for filesystem space usage info
Copyright (C) 1991, 1992 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Space usage statistics for a filesystem. Blocks are 512-byte. */
struct fs_usage
{
u_int64_t fsu_blocks; /* Total blocks. */
u_int64_t fsu_bfree; /* Free blocks available to superuser. */
u_int64_t fsu_bavail; /* Free blocks available to non-superuser. */
u_int64_t fsu_files; /* Total file nodes. */
u_int64_t fsu_ffree; /* Free file nodes. */
};

127
sysdeps/linux/ChangeLog Normal file
View File

@@ -0,0 +1,127 @@
2000-01-22 Martin Baulig <martin@home-of-linux.org>
* procargs.c (glibtop_get_proc_args_s): Set correct `buf->size' and
`buf->flags' fields when `max_length' was given. Fixes #5183.
1999-11-28 Martin Baulig <martin@home-of-linux.org>
* procstate.c (glibtop_get_procstate_s): Stat "/proc/<pid>" instead
of "/proc/<pid>/state" to get `uid' and `gid'. Thanks to Jason Becker
for pointing out that GTop reported wrong uid's.
1999-09-28 Radek Doulik <rodo@praha.eridan.cz>
* proclist.c (glibtop_get_proclist_s): fixed idle processes filtering
1999-07-29 Martin Baulig <martin@home-of-linux.org>
* proctime.c (glibtop_get_proctime_s): Don't provide `rtime'
any longer since we must not use `rtime = utime + stime'.
1999-02-20 Martin Baulig <martin@home-of-linux.org>
* netload.c: Don't include <linux/ip_fw.h> for libc5 systems
since it is no longer required and makes trouble on Slakware.
1999-01-06 Martin Baulig <martin@home-of-linux.org>
* netload.c (glibtop_get_netload_s): Use `server->os_version_code'
instead of GLIBTOP_LINUX_VERSION_CODE.
1999-01-06 Martin Baulig <martin@home-of-linux.org>
Unconditionally enable SMP support for linux.
* open.c (_glibtop_open_s): Always determine the number of CPUs
we have here, not only when SMP support was enabled.
* cpu.c, proctime.c: Use `server->ncpu' to determine whether to
enable SMP support.
1998-12-28 Martin Baulig <martin@home-of-linux.org>
* netload.c: When using glibc, don't include <netinet/ip_fw.h>
any longer but all headers that were included there; we only
needed this file to get those headers.
1998-12-09 Martin Baulig <martin@home-of-linux.org>
* procargs.c (glibtop_get_proc_args_s): Added implementation
for this function.
1998-12-03 Martin Baulig <martin@home-of-linux.org>
* netload.c: No longer include <linux/version.h>, but use
GLIBTOP_LINUX_VERSION_CODE which is set by configure instead.
Define _GLIBTOP_IP_FW_ACCTIN and _GLIBTOP_IP_FW_ACCTOUT here
and use them instead of IP_FW_F_ACCTIN and IP_FW_F_ACCTOUT.
1998-11-30 Martin Baulig <martin@home-of-linux.org>
* netload.c: Use correct header files both for libc5 and glibc.
With Linux >= 2.1.114 we no longer use IP accounting since it
already has byte counts in /proc/net/dev.
1998-11-22 Martin Baulig <baulig@merkur.uni-trier.de>
* netload.c (glibtop_get_netload_s): Added implementation
for this function.
The code here is smart enough to use /proc/net/ip_acct if
IP accounting is enabled in the kernel and activated on the
requested device and /proc/net/dev if not.
To get separate statistics for received and transmitted
packets you need to use two accounting rules:
ipfwadm -A in -a -P all -W eth0
ipfwadm -A out -a -P all -W eth0
But before you activate IP accounting, please have a look
at /proc/net/dev - if if already contains byte counters,
then don't use IP accounting.
1998-10-28 Martin Baulig <martin@home-of-linux.org>
* ppp.c: Added code for ISDN here.
1998-10-26 Martin Baulig <martin@home-of-linux.org>
* netload.c: New file. Currently empty.
1998-10-26 Martin Baulig <martin@home-of-linux.org>
* procargs.c: New file. Currently empty.
1998-10-25 Martin Baulig <martin@home-of-linux.org>
* ppp.c: New file. Currently empty.
1998-10-11 Martin Baulig <martin@home-of-linux.org>
* procdata.c: Removed this obsolete file.
1998-10-02 Martin Baulig <martin@home-of-linux.org>
* proclist.c (glibtop_init_proclist_s): You can now also use the
`GLIBTOP_EXCLUDE_*' flags for the `which' parameter.
1998-10-01 Martin Baulig <baulig@Stud.Informatik.uni-trier.de>
* proclist.c (glibtop_init_proclist_s): Honor the `which' parameter
to select which processes to fetch.
1998-09-12 Martin Baulig <martin@home-of-linux.org>
* sysinfo.c: New file.
1998-09-09 Martin Baulig <baulig@Stud.Informatik.uni-trier.de>
* proctime.c (glibtop_get_proc_time_s): Added SMP support.
* open.c (glibtop_init_s): Initialize `ncpu' on SMP systems.
* cpu.c (glibtop_get_cpu_s): Added SMP support.
* ChangeLog: New file.

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

@@ -0,0 +1,98 @@
/* $Id$ */
/* Copyright (C) 1998-99 Martin Baulig
This file is part of LibGTop 1.0.
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
LibGTop is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
LibGTop is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with LibGTop; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <glibtop.h>
#include <glibtop/error.h>
#include <glibtop/xmalloc.h>
#include <glibtop/procargs.h>
static const unsigned long _glibtop_sysdeps_proc_args =
(1L << GLIBTOP_PROC_ARGS_SIZE);
/* Init function. */
void
glibtop_init_proc_args_s (glibtop *server)
{
server->sysdeps.proc_args = _glibtop_sysdeps_proc_args;
}
/* Provides detailed information about a process. */
char *
glibtop_get_proc_args_s (glibtop *server, glibtop_proc_args *buf,
pid_t pid, unsigned max_len)
{
char fn [BUFSIZ], buffer [BUFSIZ];
int cmdline, len, total = 0;
char *retval = NULL;
glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_ARGS, 0);
memset (buf, 0, sizeof (glibtop_proc_args));
sprintf (fn, "/proc/%d/cmdline", pid);
cmdline = open (fn, O_RDONLY);
if (cmdline < 0) return NULL;
if (max_len) {
retval = glibtop_malloc_r (server, max_len+1);
len = read (cmdline, retval, max_len);
if (len < 0) {
glibtop_free_r (server, retval);
return NULL;
}
*(retval+len) = 0;
buf->size = len;
buf->flags = _glibtop_sysdeps_proc_args;
return retval;
}
while (1) {
len = read (cmdline, buffer, BUFSIZ-1);
if (len < 0) {
glibtop_free_r (server, retval);
return NULL;
}
if (len == 0)
break;
retval = glibtop_realloc_r (server, retval, total+len+1);
memcpy (retval+total, buffer, len);
*(retval+total+len) = 0;
total += len;
}
close (cmdline);
buf->size = total;
buf->flags = _glibtop_sysdeps_proc_args;
return retval;
}

118
sysdeps/linux/procstate.c Normal file
View File

@@ -0,0 +1,118 @@
/* $Id$ */
/* Copyright (C) 1998-99 Martin Baulig
This file is part of LibGTop 1.0.
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
LibGTop is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
LibGTop is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with LibGTop; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <glibtop.h>
#include <glibtop/error.h>
#include <glibtop/procstate.h>
#include <sys/stat.h>
static const unsigned long _glibtop_sysdeps_proc_state =
(1L << GLIBTOP_PROC_STATE_CMD);
static const unsigned long _glibtop_sysdeps_proc_state_uid =
(1L << GLIBTOP_PROC_STATE_UID) + (1L << GLIBTOP_PROC_STATE_GID);
/* Init function. */
void
glibtop_init_proc_state_s (glibtop *server)
{
server->sysdeps.proc_state = _glibtop_sysdeps_proc_state |
_glibtop_sysdeps_proc_state_uid;
}
/* Provides detailed information about a process. */
void
glibtop_get_proc_state_s (glibtop *server, glibtop_proc_state *buf, pid_t pid)
{
char buffer [BUFSIZ], state, *p;
struct stat statb;
glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_STATE, 0);
memset (buf, 0, sizeof (glibtop_proc_state));
/* IMPORTANT NOTICE: For security reasons it is extremely important
* that the 'uid' and 'gid' fields have correct
* values; NEVER set their flags values if this
* is not the case !!! */
sprintf (buffer, "/proc/%d", pid);
if (stat (buffer, &statb))
return;
/* For security reasons we use stat () since it is
* more failsafe than parsing the file. */
buf->uid = statb.st_uid;
buf->gid = statb.st_gid;
buf->flags = _glibtop_sysdeps_proc_state_uid;
sprintf (buffer, "/proc/%d", pid);
/* Now we read the remaining fields. */
if (proc_stat_to_buffer (buffer, pid))
return;
p = strrchr (buffer, ')'); *p = '\0';
state = p [2];
p = skip_token (buffer); p++; /* pid */
if (*p++ != '(')
glibtop_error_r (server, "Bad data in /proc/%d/stat", pid);
strncpy (buf->cmd, p, sizeof (buf->cmd)-1);
buf->cmd [sizeof (buf->cmd)-1] = 0;
buf->flags |= _glibtop_sysdeps_proc_state;
switch (state) {
case 'R':
buf->state = GLIBTOP_PROCESS_RUNNING;
break;
case 'S':
buf->state = GLIBTOP_PROCESS_INTERRUPTIBLE;
break;
case 'D':
buf->state = GLIBTOP_PROCESS_UNINTERRUPTIBLE;
break;
case 'Z':
buf->state = GLIBTOP_PROCESS_ZOMBIE;
break;
case 'T':
buf->state = GLIBTOP_PROCESS_STOPPED;
break;
case 'W':
buf->state = GLIBTOP_PROCESS_SWAPPING;
break;
default:
return;
}
buf->flags |= (1L << GLIBTOP_PROC_STATE_STATE);
}