Compare commits

...

10 Commits

Author SHA1 Message Date
Martin Baulig
8da7cfd032 Use `u_int64_t' arguments and return value to avoid long int overflows on
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 21:42:24 +00:00
Martin Baulig
3fa1063b74 New file. Added sysdeps initialization code from DEC OSF/1.
2000-01-18  Martin Baulig  <martin@home-of-linux.org>

	* lib/sysdeps-init-osf1.c: New file. Added sysdeps initialization
	code from DEC OSF/1.
2000-01-18 16:55:11 +00:00
Martin Baulig
e2d5319441 Only emit code for functions which are really suid/sgid.
2000-01-18  Martin Baulig  <martin@home-of-linux.org>

	* demarshal.pl: Only emit code for functions which are
	really suid/sgid.
2000-01-18 16:50:37 +00:00
Martin Baulig
85a7719f39 Don't attempt to #include the obsolete and already removed <glibtop/gnuserv.h>. 2000-01-18 16:36:45 +00:00
Martin Baulig
490a05d01c Reflect latest interface changes. 2000-01-18 15:55:11 +00:00
Martin Baulig
b54197c2e1 perl -pni -e 's,server->machine,server->_priv->machine,g' *.c *.h 2000-01-18 11:29:44 +00:00
Martin Baulig
86dbeab484 Reflect latest interface changes. 2000-01-18 11:29:44 +00:00
Martin Baulig
15da337d8a perl -pni -e 's,server->machine,server->_priv->machine,g' *.c *.h 2000-01-18 11:29:44 +00:00
Martin Baulig
992e064952 We now use `@LIBGTOP_PACKAGE@' as the translation domain so installed
2000-01-16  Martin Baulig  <martin@home-of-linux.org>

	We now use `@LIBGTOP_PACKAGE@' as the translation domain so
	installed `libgtop-1.1.mo' files won't conflict with the ones
	from LibGTop 1.0 and you can keep both versions installed.

	* po/Makefile.in.in.in: New file. This is a modified version of
	the usual `Makefile.in.in' which is created by gettextize; we
	copy this over `Makefile.in.in' in autogen.sh after gettextize'ing.

	* autogen.sh: Copy `po/Makefile.in.in.in' over `po/Makefile.in.in'
	after running `macros/autogen.sh'.

	* configure.in (LIBGTOP_PACKAGE): AC_SUBST and AC_DEFINE this.

	* include/glibtop/global.h (_): Use `LIBGTOP_PACKAGE' as our
	translation domain.

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-01-16 00:48:08 +00:00
Martin Baulig
26ff5dbd79 Set version number to 1.1.5, binary age 0, interface age 0 and increase
2000-01-15  Martin Baulig  <martin@home-of-linux.org>

	* LIBGTOP-VERSION: Set version number to 1.1.5, binary age 0,
	interface age 0 and increase LIBGTOP_SERVER_VERSION to 53.
2000-01-15 19:51:53 +00:00
32 changed files with 558 additions and 51 deletions

View File

@@ -1,3 +1,41 @@
2000-01-18 Martin Baulig <martin@home-of-linux.org>
* lib/sysdeps-init-osf1.c: New file. Added sysdeps initialization
code from DEC OSF/1.
2000-01-16 Martin Baulig <martin@home-of-linux.org>
We now use `@LIBGTOP_PACKAGE@' as the translation domain so
installed `libgtop-1.1.mo' files won't conflict with the ones
from LibGTop 1.0 and you can keep both versions installed.
* po/Makefile.in.in.in: New file. This is a modified version of
the usual `Makefile.in.in' which is created by gettextize; we
copy this over `Makefile.in.in' in autogen.sh after gettextize'ing.
* autogen.sh: Copy `po/Makefile.in.in.in' over `po/Makefile.in.in'
after running `macros/autogen.sh'.
* configure.in (LIBGTOP_PACKAGE): AC_SUBST and AC_DEFINE this.
* include/glibtop/global.h (_): Use `LIBGTOP_PACKAGE' as our
translation domain.
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-01-15 Martin Baulig <martin@home-of-linux.org>
* LIBGTOP-VERSION: Set version number to 1.1.5, binary age 0,
interface age 0 and increase LIBGTOP_SERVER_VERSION to 53.
2000-01-14 Martin Baulig <martin@home-of-linux.org>
Released LibGTop 1.1.4 "Earthquake".

View File

@@ -8,18 +8,25 @@
#
LIBGTOP_MAJOR_VERSION=1
LIBGTOP_MINOR_VERSION=1
LIBGTOP_MICRO_VERSION=4
LIBGTOP_MICRO_VERSION=5
# you can set this to `-snap' for instance to create
# a `libgtop-1.x.y-snap.tar.gz' tarball.
LIBGTOP_VERSION_SUFFIX=
LIBGTOP_INTERFACE_AGE=0
LIBGTOP_BINARY_AGE=0
# Increase each time you change the client/server protocol.
LIBGTOP_SERVER_VERSION=52
LIBGTOP_SERVER_VERSION=53
# 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
VERSION=$LIBGTOP_VERSION$LIBGTOP_VERSION_SUFFIX
PACKAGE=libgtop
# This is the default translation domain for LibGTop
LIBGTOP_PACKAGE=libgtop-$LIBGTOP_MAJOR_VERSION.$LIBGTOP_MINOR_VERSION

View File

@@ -50,7 +50,7 @@ bin_SCRIPTS = $(top_builddir)/libgtop-config
@MAINT@macros/macros.dep: macros/Makefile.am
@MAINT@ cd macros && $(MAKE) macros.dep
@MAINT@$(top_srcdir)/aclocal.m4: libgtop-sysdeps.m4
@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
@@ -75,6 +75,7 @@ libgtopConf.sh: libgtopConf.sh.in Makefile
-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_PACKAGE\@#$(LIBGTOP_PACKAGE)#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' \

View File

@@ -24,6 +24,7 @@
#undef HAVE_LC_MESSAGES
#undef HAVE_STPCPY
#undef HAVE_STRUCT_OSOCKADDR
#undef LIBGTOP_PACKAGE
#undef PACKAGE
#undef VERSION
#undef HAVE_LIBSM

View File

@@ -15,6 +15,7 @@ PKG_NAME="Gnome Top Library"
}
. $srcdir/macros/autogen.sh
cp -f $srcdir/po/Makefile.in.in.in $srcdir/po/Makefile.in.in
echo ""
echo " *** IMPORTANT *** "

View File

@@ -1,3 +1,8 @@
2000-01-18 Martin Baulig <martin@home-of-linux.org>
* demarshal.pl: Only emit code for functions which are
really suid/sgid.
2000-01-13 Martin Baulig <martin@home-of-linux.org>
* write.c (glibtop_write_i): The buffer which we write is

View File

@@ -355,6 +355,10 @@ sub output {
$func_decl_code, $local_var_decl_code, $init_local_var_code,
$func_body_code);
$total_code = sprintf ("#if GLIBTOP_SUID_%s\n\n%s\n#endif /* GLIBTOP_SUID_%s */\n\n",
&toupper($feature), $total_code,
&toupper($feature));
print $total_code;
}
@@ -367,8 +371,8 @@ for ($nr = 1; $nr <= $feature_count; $nr++) {
$feature = $features{$nr};
$switch_body_code .= sprintf
(qq[\tcase GLIBTOP_CMND_%s:\n\t\treturn _glibtop_demarshal_%s_i\n\t\t\t(server, backend, send_ptr, send_size,\n\t\t\t data_ptr, data_size,\n\t\t\t recv_buf_ptr, recv_size_ptr,\n\t\t\t recv_data_ptr, recv_data_size_ptr, retval_ptr);\n],
&toupper ($feature), $feature);
(qq[#if GLIBTOP_SUID_%s\n\tcase GLIBTOP_CMND_%s:\n\t\treturn _glibtop_demarshal_%s_i\n\t\t\t(server, backend, send_ptr, send_size,\n\t\t\t data_ptr, data_size,\n\t\t\t recv_buf_ptr, recv_size_ptr,\n\t\t\t recv_data_ptr, recv_data_size_ptr, retval_ptr);\n#endif /* GLIBTOP_SUID_%s */\n],
&toupper ($feature), &toupper ($feature), $feature, &toupper ($feature));
}
$switch_code = sprintf

View File

@@ -28,7 +28,6 @@
#include <glibtop.h>
#include <glibtop/error.h>
#include <glibtop/gnuserv.h>
#include <glibtop/open.h>
#include <glibtop/union.h>

View File

@@ -33,6 +33,10 @@ AC_SUBST(LIBGTOP_BINARY_AGE)
AC_SUBST(LIBGTOP_SERVER_VERSION)
AC_SUBST(LIBGTOP_VERSION)
AC_SUBST(LIBGTOP_VERSION_CODE)
AC_SUBST(LIBGTOP_VERSION_SUFFIX)
AC_SUBST(LIBGTOP_PACKAGE)
AC_DEFINE_UNQUOTED(LIBGTOP_PACKAGE, "$LIBGTOP_PACKAGE")
# libtool versioning
LT_RELEASE=$LIBGTOP_MAJOR_VERSION.$LIBGTOP_MINOR_VERSION

View File

@@ -129,7 +129,7 @@
BEGIN_LIBGTOP_DECLS
#ifndef _
#define _(String) dgettext (PACKAGE, String)
#define _(String) dgettext (LIBGTOP_PACKAGE, String)
#define N_(String) (String)
#endif

40
lib/sysdeps-init-osf1.c Normal file
View File

@@ -0,0 +1,40 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* $Id$ */
/* Copyright (C) 1998-99 Martin Baulig
This file is part of LibGTop 1.0.
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
LibGTop is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
LibGTop is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with LibGTop; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <glibtop.h>
#include <glibtop/open.h>
#include <glibtop/backend.h>
void
_glibtop_open_sysdeps (glibtop *server, const char *program_name,
const unsigned long features, const unsigned flags)
{
glibtop_open_backend_l (server, "glibtop-backend-common",
features, NULL);
glibtop_open_backend_l (server, "glibtop-backend-sysdeps",
features, NULL);
glibtop_open_backend_l (server, "glibtop-backend-server",
features, NULL);
}

View File

@@ -29,6 +29,8 @@ LIBGTOP_VERSION_CODE="@LIBGTOP_VERSION_CODE@"
MODULE_VERSION="libgtop-@LIBGTOP_VERSION@"
LIBGTOP_PACKAGE="@LIBGTOP_PACKAGE@"
LIBGTOP_SERVER_VERSION="@LIBGTOP_SERVER_VERSION@"
libgtop_sysdeps_dir="@libgtop_sysdeps_dir@"

View File

@@ -3,5 +3,5 @@ Makefile.in
POTFILES
cat-id-tbl.c
*.gmo *.mo
libgtop.pot
libgtop-1.1.pot
Makefile.in.in

248
po/Makefile.in.in.in Normal file
View File

@@ -0,0 +1,248 @@
# Makefile for program source directory in GNU NLS utilities package.
# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
#
# This file file be copied and used freely without restrictions. It can
# be used in projects which are not available under the GNU Public License
# but which still want to provide support for the GNU gettext functionality.
# Please note that the actual code is *not* freely available.
PACKAGE = @LIBGTOP_PACKAGE@
VERSION = @VERSION@
SHELL = /bin/sh
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
datadir = $(prefix)/@DATADIRNAME@
localedir = $(datadir)/locale
gnulocaledir = $(prefix)/share/locale
gettextsrcdir = $(prefix)/share/gettext/po
subdir = po
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
MKINSTALLDIRS = $(top_srcdir)/@MKINSTALLDIRS@
CC = @CC@
GENCAT = @GENCAT@
GMSGFMT = PATH=../src:$$PATH @GMSGFMT@
MSGFMT = @MSGFMT@
XGETTEXT = PATH=../src:$$PATH @XGETTEXT@
MSGMERGE = PATH=../src:$$PATH msgmerge
DEFS = @DEFS@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
INCLUDES = -I.. -I$(top_srcdir)/intl
COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
SOURCES = cat-id-tbl.c
POFILES = @POFILES@
GMOFILES = @GMOFILES@
DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \
stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES)
POTFILES = \
CATALOGS = @CATALOGS@
CATOBJEXT = @CATOBJEXT@
INSTOBJEXT = @INSTOBJEXT@
.SUFFIXES:
.SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
.c.o:
$(COMPILE) $<
.po.pox:
$(MAKE) $(PACKAGE).pot
$(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox
.po.mo:
$(MSGFMT) -o $@ $<
.po.gmo:
file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
&& rm -f $$file && $(GMSGFMT) -o $$file $<
.po.cat:
sed -f ../intl/po2msg.sed < $< > $*.msg \
&& rm -f $@ && $(GENCAT) $@ $*.msg
all: all-@USE_NLS@
all-yes: cat-id-tbl.c $(CATALOGS)
all-no:
$(srcdir)/$(PACKAGE).pot: $(POTFILES)
$(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
--add-comments --keyword=_ --keyword=N_ \
--files-from=$(srcdir)/POTFILES.in \
&& test ! -f $(PACKAGE).po \
|| ( rm -f $(srcdir)/$(PACKAGE).pot \
&& mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot )
$(srcdir)/cat-id-tbl.c: stamp-cat-id; @:
$(srcdir)/stamp-cat-id: $(PACKAGE).pot
rm -f cat-id-tbl.tmp
sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \
| sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp
if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \
rm cat-id-tbl.tmp; \
else \
echo cat-id-tbl.c changed; \
rm -f $(srcdir)/cat-id-tbl.c; \
mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \
fi
cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id
install: install-exec install-data
install-exec:
install-data: install-data-@USE_NLS@
install-data-no: all
install-data-yes: all
if test -r "$(MKINSTALLDIRS)"; then \
$(MKINSTALLDIRS) $(datadir); \
else \
$(SHELL) $(top_srcdir)/mkinstalldirs $(datadir); \
fi
@catalogs='$(CATALOGS)'; \
for cat in $$catalogs; do \
cat=`basename $$cat`; \
case "$$cat" in \
*.gmo) destdir=$(gnulocaledir);; \
*) destdir=$(localedir);; \
esac; \
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
dir=$$destdir/$$lang/LC_MESSAGES; \
if test -r "$(MKINSTALLDIRS)"; then \
$(MKINSTALLDIRS) $$dir; \
else \
$(SHELL) $(top_srcdir)/mkinstalldirs $$dir; \
fi; \
if test -r $$cat; then \
$(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \
else \
$(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
echo "installing $(srcdir)/$$cat as" \
"$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
fi; \
if test -r $$cat.m; then \
$(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
else \
if test -r $(srcdir)/$$cat.m ; then \
$(INSTALL_DATA) $(srcdir)/$$cat.m \
$$dir/$(PACKAGE)$(INSTOBJEXT).m; \
echo "installing $(srcdir)/$$cat as" \
"$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
else \
true; \
fi; \
fi; \
done
if test "$(PACKAGE)" = "gettext"; then \
if test -r "$(MKINSTALLDIRS)"; then \
$(MKINSTALLDIRS) $(gettextsrcdir); \
else \
$(SHELL) $(top_srcdir)/mkinstalldirs $(gettextsrcdir); \
fi; \
$(INSTALL_DATA) $(srcdir)/Makefile.in.in \
$(gettextsrcdir)/Makefile.in.in; \
else \
: ; \
fi
# Define this as empty until I found a useful application.
installcheck:
uninstall:
catalogs='$(CATALOGS)'; \
for cat in $$catalogs; do \
cat=`basename $$cat`; \
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
done
rm -f $(gettextsrcdir)/po-Makefile.in.in
check: all
cat-id-tbl.o: ../intl/libgettext.h
dvi info tags TAGS ID:
mostlyclean:
rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp
rm -fr *.o
clean: mostlyclean
distclean: clean
rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
maintainer-clean: distclean
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
rm -f $(GMOFILES)
distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
dist distdir: update-po $(DISTFILES)
dists="$(DISTFILES)"; \
for file in $$dists; do \
ln $(srcdir)/$$file $(distdir) 2> /dev/null \
|| cp -p $(srcdir)/$$file $(distdir); \
done
update-po: Makefile
$(MAKE) $(PACKAGE).pot
PATH=`pwd`/../src:$$PATH; \
cd $(srcdir); \
catalogs='$(CATALOGS)'; \
for cat in $$catalogs; do \
cat=`basename $$cat`; \
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
mv $$lang.po $$lang.old.po; \
echo "$$lang:"; \
if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
rm -f $$lang.old.po; \
else \
echo "msgmerge for $$cat failed!"; \
rm -f $$lang.po; \
mv $$lang.old.po $$lang.po; \
fi; \
done
POTFILES: POTFILES.in
( if test 'x$(srcdir)' != 'x.'; then \
posrcprefix='$(top_srcdir)/'; \
else \
posrcprefix="../"; \
fi; \
rm -f $@-t $@ \
&& (sed -e '/^#/d' -e '/^[ ]*$$/d' \
-e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
| sed -e '$$s/\\$$//') > $@-t \
&& chmod a-w $@-t \
&& mv $@-t $@ )
Makefile: Makefile.in.in ../config.status POTFILES
cd .. \
&& CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
$(SHELL) ./config.status
# Tell versions [3.59,3.63) of GNU make not to export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@@ -1,3 +1,11 @@
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.
1999-10-24 Martin Baulig <martin@home-of-linux.org>
* fsusage.c (_glibtop_sysdeps_fsusage): New static variable.

View File

@@ -82,9 +82,9 @@ int safe_read ();
BLOCKS FROMSIZE-byte blocks, rounding away from zero.
TOSIZE must be positive. Return -1 if FROMSIZE is not positive. */
static long
static u_int64_t
adjust_blocks (blocks, fromsize, tosize)
long blocks;
u_int64_t blocks;
int fromsize, tosize;
{
if (tosize <= 0)
@@ -95,9 +95,9 @@ adjust_blocks (blocks, fromsize, tosize)
if (fromsize == tosize) /* e.g., from 512 to 512 */
return blocks;
else if (fromsize > tosize) /* e.g., from 2048 to 512 */
return blocks * (fromsize / tosize);
return blocks * (u_int64_t)(fromsize / tosize);
else /* e.g., from 256 to 512 */
return (blocks + (blocks < 0 ? -1 : 1)) / (tosize / fromsize);
return (blocks + (blocks < 0 ? -1 : 1)) / (u_int64_t)(tosize / fromsize);
}
/* Fill in the fields of FSP with information about space usage for
@@ -114,7 +114,7 @@ get_fs_usage (path, disk, fsp)
struct fs_usage *fsp;
{
#ifdef STAT_STATFS3_OSF1
# define CONVERT_BLOCKS(B) adjust_blocks ((B), fsd.f_fsize, 512)
# define CONVERT_BLOCKS(B) adjust_blocks ((u_int64_t)(B), fsd.f_fsize, 512)
struct statfs fsd;
@@ -124,7 +124,7 @@ get_fs_usage (path, disk, fsp)
#endif /* STAT_STATFS3_OSF1 */
#ifdef STAT_STATFS2_FS_DATA /* Ultrix */
# define CONVERT_BLOCKS(B) adjust_blocks ((B), 1024, 512)
# define CONVERT_BLOCKS(B) adjust_blocks ((u_int64_t)(B), 1024, 512)
struct fs_data fsd;
@@ -143,7 +143,7 @@ get_fs_usage (path, disk, fsp)
# define SUPERBOFF (SUPERB * 512)
# endif
# define CONVERT_BLOCKS(B) \
adjust_blocks ((B), (fsd.s_type == Fs2b ? 1024 : 512), 512)
adjust_blocks ((u_int64_t)(B), (fsd.s_type == Fs2b ? 1024 : 512), 512)
struct filsys fsd;
int fd;
@@ -173,7 +173,7 @@ get_fs_usage (path, disk, fsp)
#endif /* STAT_READ_FILSYS */
#ifdef STAT_STATFS2_BSIZE /* 4.3BSD, SunOS 4, HP-UX, AIX */
# define CONVERT_BLOCKS(B) adjust_blocks ((B), fsd.f_bsize, 512)
# define CONVERT_BLOCKS(B) adjust_blocks ((u_int64_t)(B), fsd.f_bsize, 512)
struct statfs fsd;
@@ -198,7 +198,7 @@ get_fs_usage (path, disk, fsp)
#endif /* STAT_STATFS2_BSIZE */
#ifdef STAT_STATFS2_FSIZE /* 4.4BSD */
# define CONVERT_BLOCKS(B) adjust_blocks ((B), fsd.f_fsize, 512)
# define CONVERT_BLOCKS(B) adjust_blocks ((u_int64_t)(B), fsd.f_fsize, 512)
struct statfs fsd;
@@ -209,7 +209,7 @@ get_fs_usage (path, disk, fsp)
#ifdef STAT_STATFS4 /* SVR3, Dynix, Irix, AIX */
# if _AIX || defined(_CRAY)
# define CONVERT_BLOCKS(B) adjust_blocks ((B), fsd.f_bsize, 512)
# define CONVERT_BLOCKS(B) adjust_blocks ((u_int64_t)(B), fsd.f_bsize, 512)
# ifdef _CRAY
# define f_bavail f_bfree
# endif
@@ -234,7 +234,7 @@ get_fs_usage (path, disk, fsp)
#ifdef STAT_STATVFS /* SVR4 */
# define CONVERT_BLOCKS(B) \
adjust_blocks ((B), fsd.f_frsize ? fsd.f_frsize : fsd.f_bsize, 512)
adjust_blocks ((u_int64_t)(B), fsd.f_frsize ? fsd.f_frsize : fsd.f_bsize, 512)
struct statvfs fsd;
@@ -296,6 +296,7 @@ glibtop_get_fsusage_s (glibtop *server, glibtop_fsusage *buf,
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 -1;

View File

@@ -20,10 +20,10 @@
/* Space usage statistics for a filesystem. Blocks are 512-byte. */
struct fs_usage
{
long fsu_blocks; /* Total blocks. */
long fsu_bfree; /* Free blocks available to superuser. */
long fsu_bavail; /* Free blocks available to non-superuser. */
long fsu_files; /* Total file nodes. */
long fsu_ffree; /* Free file nodes. */
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. */
};

View File

@@ -13,7 +13,8 @@ libgtop_sysdeps_la_LIBADD = -lmach
libgtop_sysdeps_suid_la_SOURCES = open_suid.c close_suid.c proclist.c \
procstate.c procuid.c proctime.c procmem.c \
procsignal.c prockernel.c procsegment.c \
procmap.c procargs.c netload.c
procmap.c procargs.c netload.c netinfo.c \
interfaces.c
libgtop_sysdeps_suid_la_LDFLAGS = $(LT_VERSION_INFO)
libgtop_sysdeps_suid_la_LIBADD = -lmach

View File

@@ -47,6 +47,8 @@ BEGIN_LIBGTOP_DECLS
#define GLIBTOP_SUID_PROC_MAP (1 << GLIBTOP_SYSDEPS_PROC_MAP)
#define GLIBTOP_SUID_PROC_ARGS (1 << GLIBTOP_SYSDEPS_PROC_ARGS)
#define GLIBTOP_SUID_NETLOAD (1 << GLIBTOP_SYSDEPS_NETLOAD)
#define GLIBTOP_SUID_NETINFO (1 << GLIBTOP_SYSDEPS_NETINFO)
#define GLIBTOP_SUID_INTERFACE_NAMES (1 << GLIBTOP_SYSDEPS_INTERFACE_NAMES)
#define GLIBTOP_SUID_PPP 0
END_LIBGTOP_DECLS

View File

@@ -31,11 +31,11 @@
BEGIN_LIBGTOP_DECLS
static inline void glibtop_suid_enter (glibtop *server) {
setreuid (server->machine.uid, server->machine.euid);
setreuid (server->_priv->machine.uid, server->_priv->machine.euid);
};
static inline void glibtop_suid_leave (glibtop *server) {
if (setreuid (server->machine.euid, server->machine.uid))
if (setreuid (server->_priv->machine.euid, server->_priv->machine.uid))
_exit (1);
};

58
sysdeps/osf1/interfaces.c Normal file
View File

@@ -0,0 +1,58 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* $Id$ */
/* Copyright (C) 1998-99 Martin Baulig
This file is part of LibGTop 1.0.
Contributed by Martin Baulig <martin@home-of-linux.org>, October 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/interfaces.h>
#include <glibtop_suid.h>
static const unsigned long _glibtop_sysdeps_interface_names =
(1L << GLIBTOP_INTERFACE_NAMES_NUMBER) +
(1L << GLIBTOP_INTERFACE_NAMES_SIZE);
/* Init function. */
int
glibtop_init_interface_names_p (glibtop *server)
{
server->sysdeps.interface_names = _glibtop_sysdeps_interface_names;
return 0;
}
/* Provides network statistics. */
glibtop_interface *
glibtop_get_interface_names_p (glibtop *server, glibtop_array *array,
u_int64_t interface, u_int64_t number,
u_int64_t instance, u_int64_t strategy)
{
glibtop_init_p (server, GLIBTOP_SYSDEPS_INTERFACE_NAMES, 0);
memset (array, 0, sizeof (glibtop_array));
return NULL;
}

55
sysdeps/osf1/netinfo.c Normal file
View File

@@ -0,0 +1,55 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* $Id$ */
/* Copyright (C) 1998-99 Martin Baulig
This file is part of LibGTop 1.0.
Contributed by Martin Baulig <martin@home-of-linux.org>, October 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/netinfo.h>
#include <glibtop_suid.h>
static const unsigned long _glibtop_sysdeps_netinfo = 0;
/* Init function. */
int
glibtop_init_netinfo_p (glibtop *server)
{
server->sysdeps.netinfo = _glibtop_sysdeps_netinfo;
return 0;
}
/* Provides Network statistics. */
int
glibtop_get_netinfo_p (glibtop *server, glibtop_netinfo *buf,
const char *interface, unsigned transport)
{
glibtop_init_p (server, GLIBTOP_SYSDEPS_NETINFO, 0);
memset (buf, 0, sizeof (glibtop_netinfo));
return 0;
}

View File

@@ -64,12 +64,12 @@ glibtop_open_p (glibtop *server, const char *program_name,
server->name = program_name;
server->machine.uid = getuid ();
server->machine.euid = geteuid ();
server->machine.gid = getgid ();
server->machine.egid = getegid ();
server->_priv->machine.uid = getuid ();
server->_priv->machine.euid = geteuid ();
server->_priv->machine.gid = getgid ();
server->_priv->machine.egid = getegid ();
server->machine.proctable_entries = table
server->_priv->machine.proctable_entries = table
(TBL_PROCINFO, 0, NULL, INT_MAX, 0);
/* Drop priviledges; we only become root when necessary.
@@ -79,10 +79,10 @@ glibtop_open_p (glibtop *server, const char *program_name,
*/
if (setreuid (server->machine.euid, server->machine.uid))
if (setreuid (server->_priv->machine.euid, server->_priv->machine.uid))
_exit (1);
if (setregid (server->machine.egid, server->machine.gid))
if (setregid (server->_priv->machine.egid, server->_priv->machine.gid))
_exit (1);
/* !!! END OF SUID ROOT PART !!! */

View File

@@ -37,6 +37,8 @@ int
glibtop_init_proc_kernel_p (glibtop *server)
{
server->sysdeps.proc_kernel = _glibtop_sysdeps_proc_kernel;
return 0;
}
/* Provides detailed information about a process. */
@@ -48,4 +50,6 @@ glibtop_get_proc_kernel_p (glibtop *server, glibtop_proc_kernel *buf,
glibtop_init_p (server, GLIBTOP_SYSDEPS_PROC_KERNEL, 0);
memset (buf, 0, sizeof (glibtop_proc_kernel));
return 0;
}

View File

@@ -40,6 +40,8 @@ int
glibtop_init_proclist_p (glibtop *server)
{
server->sysdeps.proclist = _glibtop_sysdeps_proclist;
return 0;
}
/* How many elements are there per proctable entry? */
@@ -81,7 +83,7 @@ glibtop_get_proclist_p (glibtop *server, glibtop_proclist *buf,
memset (buf, 0, sizeof (glibtop_proclist));
for (entry = 0; entry < server->machine.proctable_entries;
for (entry = 0; entry < server->_priv->machine.proctable_entries;
entry += ELEMENTS_PER_ENTRY)
{
/* !!! THE FOLLOWING CODE RUNS SUID ROOT -

View File

@@ -36,13 +36,15 @@ int
glibtop_init_proc_map_p (glibtop *server)
{
server->sysdeps.proc_map = _glibtop_sysdeps_proc_map;
return 0;
}
/* Provides detailed information about a process. */
glibtop_map_entry *
glibtop_get_proc_map_p (glibtop *server, glibtop_proc_map *buf, pid_t pid)
glibtop_get_proc_map_p (glibtop *server, glibtop_array *array, pid_t pid)
{
memset (buf, 0, sizeof (glibtop_proc_map));
memset (array, 0, sizeof (glibtop_array));
return NULL;
}

View File

@@ -47,6 +47,8 @@ int
glibtop_init_proc_mem_p (glibtop *server)
{
server->sysdeps.proc_mem = _glibtop_sysdeps_proc_mem;
return 0;
}
/* Provides detailed information about a process. */
@@ -68,7 +70,7 @@ glibtop_get_proc_mem_p (glibtop *server, glibtop_proc_mem *buf,
ret = task_by_unix_pid (task_self(), pid, &thistask);
if (ret != KERN_SUCCESS) return;
if (ret != KERN_SUCCESS) return -1;
/* Get taskinfo about this task. */
@@ -77,7 +79,7 @@ glibtop_get_proc_mem_p (glibtop *server, glibtop_proc_mem *buf,
ret = task_info (thistask, TASK_BASIC_INFO,
(task_info_t) &taskinfo, &info_count);
if (ret != KERN_SUCCESS) return;
if (ret != KERN_SUCCESS) return -1;
buf->resident = taskinfo.resident_size;
buf->rss = taskinfo.resident_size;
@@ -94,7 +96,7 @@ glibtop_get_proc_mem_p (glibtop *server, glibtop_proc_mem *buf,
/* !!! END OF SUID ROOT PART !!! */
if (ret != 1) return;
if (ret != 1) return -1;
buf->rss_rlim = u.u_rlimit [RLIMIT_RSS].rlim_cur;
@@ -102,4 +104,6 @@ glibtop_get_proc_mem_p (glibtop *server, glibtop_proc_mem *buf,
buf->flags |= (1L << GLIBTOP_PROC_MEM_RSS_RLIM) |
(1L << GLIBTOP_PROC_MEM_SHARE);
return 0;
}

View File

@@ -43,6 +43,8 @@ int
glibtop_init_proc_segment_p (glibtop *server)
{
server->sysdeps.proc_segment = _glibtop_sysdeps_proc_segment;
return 0;
}
/* Provides detailed information about a process. */
@@ -69,7 +71,7 @@ glibtop_get_proc_segment_p (glibtop *server, glibtop_proc_segment *buf,
/* !!! END OF SUID ROOT PART !!! */
if (ret != 1) return;
if (ret != 1) return -1;
buf->start_code = (unsigned long) u.u_text_start;
buf->end_code = (unsigned long) u.u_data_start;
@@ -79,4 +81,6 @@ glibtop_get_proc_segment_p (glibtop *server, glibtop_proc_segment *buf,
buf->data_rss = u.u_dsize;
buf->flags = _glibtop_sysdeps_proc_segment;
return 0;
}

View File

@@ -39,6 +39,8 @@ int
glibtop_init_proc_signal_p (glibtop *server)
{
server->sysdeps.proc_signal = _glibtop_sysdeps_proc_signal;
return 0;
}
/* Provides detailed information about a process. */
@@ -65,7 +67,7 @@ glibtop_get_proc_signal_p (glibtop *server, glibtop_proc_signal *buf,
/* !!! END OF SUID ROOT PART !!! */
if (ret != 1) return;
if (ret != 1) return -1;
buf->signal [0] = procinfo.pi_sig;
buf->blocked [0] = procinfo.pi_sigmask;
@@ -73,4 +75,6 @@ glibtop_get_proc_signal_p (glibtop *server, glibtop_proc_signal *buf,
buf->sigcatch [0] = procinfo.pi_sigcatch;
buf->flags = _glibtop_sysdeps_proc_signal;
return 0;
}

View File

@@ -44,6 +44,8 @@ int
glibtop_init_proc_state_p (glibtop *server)
{
server->sysdeps.proc_state = _glibtop_sysdeps_proc_state;
return 0;
}
/* Provides detailed information about a process. */
@@ -71,16 +73,16 @@ glibtop_get_proc_state_p (glibtop *server, glibtop_proc_state *buf,
/* !!! END OF SUID ROOT PART !!! */
if (ret != 1) return;
if (ret != 1) return -1;
/* Check whether the process actually exists. */
if (procinfo.pi_status == PI_EMPTY) return;
if (procinfo.pi_status == PI_EMPTY) return -1;
/* Check whether it is not a zombie. */
if (procinfo.pi_status == PI_ZOMBIE) {
buf->state = GLIBTOP_PROCESS_ZOMBIE;
buf->flags = (1L << GLIBTOP_PROC_STATE_STATE);
return;
return -1;
}
strncpy (buf->cmd, procinfo.pi_comm, sizeof (buf->cmd)-1);
@@ -130,7 +132,7 @@ glibtop_get_proc_state_p (glibtop *server, glibtop_proc_state *buf,
/* !!! END OF SUID ROOT PART !!! */
if (ret != KERN_SUCCESS) return;
if (ret != KERN_SUCCESS) return -1;
switch (minim_state) {
case TH_STATE_RUNNING:
@@ -154,4 +156,6 @@ glibtop_get_proc_state_p (glibtop *server, glibtop_proc_state *buf,
if (buf->state)
buf->flags |= (1L << GLIBTOP_PROC_STATE_STATE);
return 0;
}

View File

@@ -42,6 +42,8 @@ int
glibtop_init_proc_time_p (glibtop *server)
{
server->sysdeps.proc_time = _glibtop_sysdeps_proc_time;
return 0;
}
/* Provides detailed information about a process. */
@@ -68,7 +70,7 @@ glibtop_get_proc_time_p (glibtop *server, glibtop_proc_time *buf,
/* !!! END OF SUID ROOT PART !!! */
if (ret != 1) return;
if (ret != 1) return -1;
buf->start_time = u.u_start.tv_sec;
@@ -78,4 +80,6 @@ glibtop_get_proc_time_p (glibtop *server, glibtop_proc_time *buf,
buf->cstime = u.u_cru.ru_stime.tv_sec;
buf->flags = _glibtop_sysdeps_proc_time;
return 0;
}

View File

@@ -50,6 +50,8 @@ int
glibtop_init_proc_uid_p (glibtop *server)
{
server->sysdeps.proc_uid = _glibtop_sysdeps_proc_uid;
return 0;
}
int
@@ -76,7 +78,7 @@ glibtop_get_proc_uid_p (glibtop *server, glibtop_proc_uid *buf,
/* !!! END OF SUID ROOT PART !!! */
if (ret != 1) return;
if (ret != 1) return -1;
buf->uid = procinfo.pi_ruid;
buf->euid = procinfo.pi_svuid;
@@ -116,7 +118,7 @@ glibtop_get_proc_uid_p (glibtop *server, glibtop_proc_uid *buf,
/* !!! END OF SUID ROOT PART !!! */
if (ret != KERN_SUCCESS) return;
if (ret != KERN_SUCCESS) return -1;
buf->priority = taskinfo.base_priority;
@@ -126,9 +128,11 @@ glibtop_get_proc_uid_p (glibtop *server, glibtop_proc_uid *buf,
ret = getpriority (PRIO_PROCESS, pid);
if ((ret == -1) && (errno != 0)) return;
if ((ret == -1) && (errno != 0)) return -1;
buf->nice = ret;
buf->flags += (1L << GLIBTOP_PROC_UID_NICE);
return 0;
}