Compare commits
39 Commits
procps_1_2
...
freebsd_0_
Author | SHA1 | Date | |
---|---|---|---|
|
79f5a9c667 | ||
|
864867aeeb | ||
|
8750ff351e | ||
|
bfcc8c3944 | ||
|
bf19661382 | ||
|
20016762a6 | ||
|
0a7bd78704 | ||
|
2e454140f1 | ||
|
fc506344ea | ||
|
e7f5588ee9 | ||
|
b55ee6117f | ||
|
902b6a8f16 | ||
|
d18a6cf2ce | ||
|
8ced0f5889 | ||
|
a33b97ef9d | ||
|
3c3118521d | ||
|
f07551a43d | ||
|
37eb76e767 | ||
|
e2196888ca | ||
|
8b9b984701 | ||
|
aa6d16e47b | ||
|
f3f051ecba | ||
|
51c5c3ac22 | ||
|
61c262dd7e | ||
|
954a78f200 | ||
|
a90bffbbf6 | ||
|
6bf243c901 | ||
|
dd5c4a716b | ||
|
0dc0c2d7f0 | ||
|
a584809b1c | ||
|
5e97af535f | ||
|
7efcda3082 | ||
|
5a1fa089f3 | ||
|
a129a83c45 | ||
|
65fbcf1ea3 | ||
|
d145edb435 | ||
|
fc2d1f07c3 | ||
|
694ad7adb7 | ||
|
d8a7175820 |
@@ -1,8 +1,6 @@
|
|||||||
Makefile
|
Makefile
|
||||||
Makefile.in
|
Makefile.in
|
||||||
aclocal.m4
|
aclocal.m4
|
||||||
alpha-dec-osf1
|
|
||||||
autoh31167
|
|
||||||
config.cache
|
config.cache
|
||||||
config.h
|
config.h
|
||||||
config.h.in
|
config.h.in
|
||||||
@@ -25,3 +23,5 @@ sun4
|
|||||||
sun4sol2
|
sun4sol2
|
||||||
support
|
support
|
||||||
i386-freebsd
|
i386-freebsd
|
||||||
|
alpha-dec-osf3.0
|
||||||
|
i686-pc-linux-gnu-linux
|
||||||
|
224
ChangeLog
224
ChangeLog
@@ -1,3 +1,227 @@
|
|||||||
|
1998-08-06 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
|
* configure.in (HAVE_SOCKETS, HAVE_SOCKADDR_SUN_LEN): New checks.
|
||||||
|
|
||||||
|
* include/glibtop/*.h: Using `GLIBTOP_GUILE' instead of `HAVE_GUILE'
|
||||||
|
so one should be able to use libgtop without guile in an application
|
||||||
|
even if guile is installed.
|
||||||
|
|
||||||
|
* sysdeps/common/mountlist.c: Fixed some `xstrdup' problems.
|
||||||
|
|
||||||
|
* lib/open.c: Now correctly reading server features for
|
||||||
|
`GLIBTOP_METHOD_PIPE'.
|
||||||
|
|
||||||
|
* sysdeps/freebsd: New directory.
|
||||||
|
|
||||||
|
1998-08-01 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
|
* include/glibtop/swap.h (glibtop_swap): Added `pagein' and `pageout'.
|
||||||
|
|
||||||
|
* kernel/table20/table.h: Removed.
|
||||||
|
* kernel/table21/table.h: Removed.
|
||||||
|
* kernel/table.h: Added. Things are now binary compatible between
|
||||||
|
both kernel versions.
|
||||||
|
|
||||||
|
1998-07-30 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
|
* acconfig.h (u_int64_t, int64_t): Added.
|
||||||
|
|
||||||
|
* lib/lib.awk: Using correct `(1 << GLIBTOP_SYSDEPS_<feature>)'
|
||||||
|
in call to `glibtop_init_r'.
|
||||||
|
|
||||||
|
* configure.in (GNOME_LIBGTOP_TYPES): New check.
|
||||||
|
|
||||||
|
* include/glibtop/*.h: Using `u_int64_t' instead of `unsigned long'
|
||||||
|
and `long' to avoid problems when client is on a 32bit system and
|
||||||
|
the server on a 64bit system.
|
||||||
|
|
||||||
|
* sysdeps/common/gnuslib.c: Using `0xffffffff' instead of -1
|
||||||
|
as error code for inet_addr () since on 64bit systems,
|
||||||
|
`inet_addr (some_error) != (INET_ADDR) -1'.
|
||||||
|
|
||||||
|
* configure.in: Only defining guile stuff if
|
||||||
|
we really have guile.
|
||||||
|
|
||||||
|
1998-07-29 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
|
* guile/ChangeLog: New file.
|
||||||
|
|
||||||
|
* features.def: New format - now includes type of return value
|
||||||
|
and parameters.
|
||||||
|
|
||||||
|
* lib/lib.awk: Changed to use new `features.def'.
|
||||||
|
* sysdeps/guile/guile.awk: Dito;
|
||||||
|
* sysdeps/guile/names/guile-names.awk: Dito.
|
||||||
|
|
||||||
|
* libgtopConf.sh.in: Added
|
||||||
|
`LIBGTOP_NAMES_LIBS', `LIBGTOP_NAMES_INCS',
|
||||||
|
`LIBGTOP_GUILE_NAMES_LIBS', `LIBGTOP_GUILE_NAMES_INCS',
|
||||||
|
`LIBGTOP_MAJOR_VERSION', `LIBGTOP_MINOR_VERSION'
|
||||||
|
`LIBGTOP_VERSION', `libgtop_sysdeps_dir'.
|
||||||
|
|
||||||
|
* acinclude.m4 (AC_LC_SYSDEPS): Removed since this has been
|
||||||
|
replaced with `GNOME_LIBGTOP_SYSDEPS' long ago.
|
||||||
|
|
||||||
|
* LIBGTOP-VERSION: New file.
|
||||||
|
|
||||||
|
* */Makefile.am (INCLUDES): Removed; now defined in `configure.in'.
|
||||||
|
|
||||||
|
* sysdeps/names/mountlist.c: New file.
|
||||||
|
|
||||||
|
* lib/{init, open}.c (GTOP_SERVER): Renamed to `LIBGTOP_SERVER'.
|
||||||
|
|
||||||
|
* configure.in (INCLUDES): Added definition.
|
||||||
|
(libgtop_want_names): Always true; `libgtop_names.la' is now
|
||||||
|
always created since some other programs rely upon it - but
|
||||||
|
have to use `LIBGTOP_NAMES_LIBS' and `LIBGTOP_NAMES_INCS' to
|
||||||
|
use it in your application.
|
||||||
|
(libgtop_want_guile_names): Always true; but you have to use
|
||||||
|
`LIBGTOP_GUILE_NAMES_LIBS' and `LIBGTOP_GUILE_NAMES_INCS' to
|
||||||
|
use it in your application.
|
||||||
|
(LIBGTOP_LIBS): Removed `-lgtop_names' and `-lgtop_guile_names'.
|
||||||
|
(LIBGTOP_NAMES_LIBS): New variable. Use it to link your
|
||||||
|
application with the names interface.
|
||||||
|
(LIBGTOP_NAMES_INCS): New variable. Also #defines `GLIBTOP_NAMES'
|
||||||
|
which is now required if your application wants to use the names
|
||||||
|
interface.
|
||||||
|
(LIBGTOP_GUILE_NAMES_LIBS): New variable. Use it to link your
|
||||||
|
application with the guile names interface.
|
||||||
|
(LIBGTOP_GUILE_NAMES_INCS): New variable. Also #defines
|
||||||
|
`GLIBTOP_NAMES' and `GLIBTOP_GUILE_NAMES' which are now required
|
||||||
|
if your application wants to use the guile names interface.
|
||||||
|
|
||||||
|
1998-07-24 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
|
* sysdeps/common/mountlist.c (glibtop_get_mountlist_s):
|
||||||
|
Added `all_fs' parameter.
|
||||||
|
|
||||||
|
* sysdeps/{kernel, linux}/*.c: Replaced `glibtop_init_r' with
|
||||||
|
`glibtop_init_s'.
|
||||||
|
|
||||||
|
* sysdeps/sun4/open.c (glibtop_init_p): Removed `program_name'
|
||||||
|
parameter.
|
||||||
|
|
||||||
|
* sysdeps/osf1/glibtop_suid.h: New file.
|
||||||
|
|
||||||
|
* sysdeps/osf1/glibtop_server.h: Now correctly using
|
||||||
|
`(1 << GLIBTOP_SYSDEPS_*)' instead of `GLIBTOP_SYSDEPS_*'.
|
||||||
|
|
||||||
|
* sysdeps/osf1/open_suid.c (glibtop_init_p): New function.
|
||||||
|
|
||||||
|
* sysdeps/osf1/proc*.c: Done some more work here.
|
||||||
|
|
||||||
|
1998-07-23 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
|
* include/glibtop/procsignal.h (glibtop_proc_signal):
|
||||||
|
Changed type for `signal', `blocked', `sigignore' and
|
||||||
|
`sigcatch' to `unsigned long long'.
|
||||||
|
|
||||||
|
1998-07-22 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
|
* include/glibtop/fsusage.h: New file.
|
||||||
|
|
||||||
|
* features.def: Added new feature `fsusage'.
|
||||||
|
|
||||||
|
* sysdeps/common/fsusage.c (glibtop_get_fsusage_s): New function.
|
||||||
|
(get_fs_usage): Declared as `static'.
|
||||||
|
|
||||||
|
* sysdeps/names/fsusage.c: New file.
|
||||||
|
|
||||||
|
* include/glibtop/mountlist.h: New file.
|
||||||
|
|
||||||
|
* features.def: Added new feature `mountlist'.
|
||||||
|
|
||||||
|
* sysdeps/common/mountlist.c (glibtop_get_mountlist_s): New function.
|
||||||
|
(read_filesystem_list): Declared as `static'.
|
||||||
|
|
||||||
|
* sysdeps/common/Makefile.am (libgtop_common_la_SOURCES):
|
||||||
|
Added `fsusage.[ch]' and `mountlist.[ch]'.
|
||||||
|
|
||||||
|
* include/glibtop/signal.h: New file.
|
||||||
|
|
||||||
|
* sysdeps/{kernel, linux, osf1, sun4, stub}/siglist.c: New files.
|
||||||
|
|
||||||
|
1998-07-22 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
|
* lib/init.c (glibtop_init_s): Added this init function of
|
||||||
|
the sysdeps directory `libgtop_sysdeps.la'.
|
||||||
|
|
||||||
|
* lib/open.c (glibtop_open_l): Unconditionally calling
|
||||||
|
`glibtop_init_s' after server initialization.
|
||||||
|
|
||||||
|
* lib/lib.awk: Removed references to functions from
|
||||||
|
`libgtop_sysdeps_suid.la' to avoid undefined symbols.
|
||||||
|
|
||||||
|
* sysdeps/stub/open.c (glibtop_open_s): Renamed this
|
||||||
|
function from `glibtop_open_r'.
|
||||||
|
|
||||||
|
* sysdeps/stub/close.c (glibtop_close_s): Renamed this
|
||||||
|
function from `glibtop_close_l'.
|
||||||
|
|
||||||
|
* sysdeps/kernel/open.c (glibtop_open_s): Renamed this
|
||||||
|
function from `glibtop_open_r'.
|
||||||
|
|
||||||
|
* sysdeps/kernel/close.c (glibtop_close_s): Renamed this
|
||||||
|
function from `glibtop_close_l'.
|
||||||
|
|
||||||
|
* sysdeps/linux/open.c (glibtop_open_s): Renamed this
|
||||||
|
function from `glibtop_open_r'.
|
||||||
|
|
||||||
|
* sysdeps/linux/close.c (glibtop_close_s): Renamed this
|
||||||
|
function from `glibtop_close_l'.
|
||||||
|
|
||||||
|
* sysdeps/osf1/Makefile.am (lib_LTLIBRARIES): Added
|
||||||
|
`libgtop_sysdeps_suid.la' for the suid server.
|
||||||
|
|
||||||
|
* sysdeps/osf1/open_suid.c (glibtop_open_p): New file.
|
||||||
|
Contains all stuff that was formerly in `open.c'.
|
||||||
|
|
||||||
|
* sysdeps/osf1/open.c: Moved everything from here into
|
||||||
|
the new file `open_suid.c'.
|
||||||
|
|
||||||
|
* sysdeps/osf1/open.c (glibtop_open_s): New function.
|
||||||
|
|
||||||
|
* sysdeps/osf1/close_suid.c (glibtop_close_p): New file.
|
||||||
|
|
||||||
|
* sysdeps/osf1/close.c (glibtop_close_s): New function.
|
||||||
|
|
||||||
|
* sysdeps/osf1/*.c: Using the new init, open and close
|
||||||
|
functions.
|
||||||
|
|
||||||
|
* sysdeps/sun4/Makefile.am (lib_LTLIBRARIES): Added
|
||||||
|
`libgtop_sysdeps_suid.la' for the suid server.
|
||||||
|
|
||||||
|
* sysdeps/sun4/nosuid.c (glibtop_open_s, glibtop_close_s): New file
|
||||||
|
|
||||||
|
* sysdeps/sun4/*.c: All functions now have the `_p' suffix.
|
||||||
|
|
||||||
|
* sysdeps/common/Makefile.am (lib_LTLIBRARIES): Added
|
||||||
|
`libgtop_suid_common.la' which only contains stuff that is
|
||||||
|
needed in the suid parts.
|
||||||
|
|
||||||
|
* sysdeps/common/xmalloc.c: Using `glibtop_error_io_r' instead
|
||||||
|
of `glibtop_error_r'.
|
||||||
|
|
||||||
|
* sysdeps/{kernel, linux, osf1, sun4, stub}/init.c: Removed.
|
||||||
|
`glibtop_init_s' has been moved into `lib/init.c' since it's the
|
||||||
|
same in all the sysdeps directories.
|
||||||
|
|
||||||
|
* src/server/main.c: It is now an error to request a feature that
|
||||||
|
does not need the suid server.
|
||||||
|
|
||||||
|
* src/proxy: Removed.
|
||||||
|
|
||||||
|
1998-07-21 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
|
* doc/ChangeLog: New file.
|
||||||
|
|
||||||
|
* sysdeps/kernel/*.c: Using `glibtop_error_io_r' instead
|
||||||
|
of `glibtop_error_r'.
|
||||||
|
|
||||||
|
* sysdeps/kernel/proclist.c: Now using the table () function, too.
|
||||||
|
This means that currently the table () function can fetch all
|
||||||
|
information for libgtop and you can even unmount /proc !
|
||||||
|
|
||||||
1998-07-18 Martin Baulig <martin@home-of-linux.org>
|
1998-07-18 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
* lib/{init, open}.c: Added `GLIBTOP_METHOD_PIPE' again.
|
* lib/{init, open}.c: Added `GLIBTOP_METHOD_PIPE' again.
|
||||||
|
7
LIBGTOP-VERSION
Normal file
7
LIBGTOP-VERSION
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
LIBGTOP_MAJOR_VERSION=0
|
||||||
|
LIBGTOP_MINOR_VERSION=2a
|
||||||
|
LIBGTOP_VERSION=$LIBGTOP_MAJOR_VERSION.$LIBGTOP_MINOR_VERSION
|
||||||
|
|
||||||
|
# For automake.
|
||||||
|
VERSION=$LIBGTOP_VERSION
|
||||||
|
PACKAGE=libgtop
|
23
Makefile.am
23
Makefile.am
@@ -1,14 +1,18 @@
|
|||||||
## Process this file with automake to produce Makefile.in.
|
## Process this file with automake to produce Makefile.in.
|
||||||
|
|
||||||
if GLIBTOP_EXAMPLES
|
examples_SUBDIRS = examples
|
||||||
examples_SUBDIRS = examples
|
|
||||||
|
if GUILE
|
||||||
|
guile_SUBDIRS = guile
|
||||||
|
else
|
||||||
|
guile_SUBDIRS =
|
||||||
endif
|
endif
|
||||||
|
|
||||||
built_SUBDIRS = include sysdeps lib src
|
|
||||||
|
|
||||||
SUBDIRS = po intl support macros $(built_SUBDIRS) $(examples_SUBDIRS)
|
SUBDIRS = po intl support macros include sysdeps lib src \
|
||||||
|
$(guile_subdirs) $(examples_SUBDIRS)
|
||||||
|
|
||||||
DIST_SUBDIRS = po intl macros include sysdeps src lib examples
|
DIST_SUBDIRS = po intl macros include sysdeps src lib guile examples
|
||||||
|
|
||||||
include_HEADERS = glibtop.h
|
include_HEADERS = glibtop.h
|
||||||
|
|
||||||
@@ -41,16 +45,21 @@ libgtopConf.sh: libgtopConf.sh.in Makefile
|
|||||||
-e 's,\@LIBGTOP_INCLUDEDIR\@,$(includedir),g' \
|
-e 's,\@LIBGTOP_INCLUDEDIR\@,$(includedir),g' \
|
||||||
-e 's,\@LIBGTOP_LIBS\@,$(LIBGTOP_LIBS),g' \
|
-e 's,\@LIBGTOP_LIBS\@,$(LIBGTOP_LIBS),g' \
|
||||||
-e 's,\@LIBGTOP_INCS\@,$(LIBGTOP_INCS),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_LIBS\@,$(LIBGTOP_GUILE_LIBS),g' \
|
||||||
-e 's,\@LIBGTOP_GUILE_INCS\@,$(LIBGTOP_GUILE_INCS),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_BINDIR\@,$(LIBGTOP_BINDIR),g' \
|
||||||
-e 's,\@LIBGTOP_SERVER\@,$(LIBGTOP_SERVER),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_VERSION\@,$(LIBGTOP_VERSION),g' \
|
||||||
-e 's,\@libgtop_sysdeps_dir\@,$(libgtop_sysdeps_dir),g' \
|
-e 's,\@libgtop_sysdeps_dir\@,$(libgtop_sysdeps_dir),g' \
|
||||||
-e 's,\@libgtop_need_server\@,$(libgtop_need_server),g' \
|
-e 's,\@libgtop_need_server\@,$(libgtop_need_server),g' \
|
||||||
-e 's,\@libgtop_use_machine_h\@,$(libgtop_use_machine_h),g' \
|
-e 's,\@libgtop_use_machine_h\@,$(libgtop_use_machine_h),g' \
|
||||||
-e 's,\@libgtop_guile_found\@,$(libgtop_guile_found),g' \
|
-e 's,\@libgtop_guile_found\@,$(libgtop_guile_found),g' \
|
||||||
-e 's,\@libgtop_want_names\@,$(libgtop_want_names),g' \
|
|
||||||
-e 's,\@libgtop_want_guile_names\@,$(libgtop_want_guile_names),g' \
|
|
||||||
-e 's,\@libgtop_want_examples\@,$(libgtop_want_examples),g' \
|
-e 's,\@libgtop_want_examples\@,$(libgtop_want_examples),g' \
|
||||||
< $(srcdir)/libgtopConf.sh.in > libgtopConf.tmp \
|
< $(srcdir)/libgtopConf.sh.in > libgtopConf.tmp \
|
||||||
&& mv libgtopConf.tmp libgtopConf.sh
|
&& mv libgtopConf.tmp libgtopConf.sh
|
||||||
|
@@ -95,6 +95,9 @@
|
|||||||
/* to fix a bug in autoheader on DEC OSF1. */
|
/* to fix a bug in autoheader on DEC OSF1. */
|
||||||
#undef HAVE_PROGRAM_INVOCATION_NAME
|
#undef HAVE_PROGRAM_INVOCATION_NAME
|
||||||
|
|
||||||
|
#undef HAVE_SOCKETS
|
||||||
|
#undef HAVE_SOCKADDR_SUN_LEN
|
||||||
|
|
||||||
#undef HAVE_LIBJPEG
|
#undef HAVE_LIBJPEG
|
||||||
#undef HAVE_LIBGIF
|
#undef HAVE_LIBGIF
|
||||||
#undef HAVE_LIBTIFF
|
#undef HAVE_LIBTIFF
|
||||||
@@ -103,7 +106,10 @@
|
|||||||
#undef GNOME_ENABLE_DEBUG
|
#undef GNOME_ENABLE_DEBUG
|
||||||
#undef HAVE_GMP2_INCLUDE_DIR
|
#undef HAVE_GMP2_INCLUDE_DIR
|
||||||
#undef HAVE_GUILE
|
#undef HAVE_GUILE
|
||||||
|
|
||||||
#undef ssize_t
|
#undef ssize_t
|
||||||
|
#undef u_int64_t
|
||||||
|
#undef int64_t
|
||||||
|
|
||||||
#undef HAVE_GLIBTOP_MACHINE_H
|
#undef HAVE_GLIBTOP_MACHINE_H
|
||||||
|
|
||||||
@@ -116,3 +122,4 @@
|
|||||||
#undef HAVE_LINUX_TABLE
|
#undef HAVE_LINUX_TABLE
|
||||||
|
|
||||||
#undef HAVE_XAUTH
|
#undef HAVE_XAUTH
|
||||||
|
|
||||||
|
91
acinclude.m4
91
acinclude.m4
@@ -10,97 +10,6 @@ dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
|||||||
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
dnl PARTICULAR PURPOSE.
|
dnl PARTICULAR PURPOSE.
|
||||||
|
|
||||||
AC_DEFUN([AC_LC_CANONICAL_HOST],[
|
|
||||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
|
||||||
# The way shlib-versions is used to generate soversions.mk uses a
|
|
||||||
# fairly simplistic model for name recognition that can't distinguish
|
|
||||||
# i486-pc-linux-gnu fully from i486-pc-gnu. So we mutate a $host_os
|
|
||||||
# of `gnu*' here to be `gnu-gnu*' just so that shlib-versions can
|
|
||||||
# tell. This doesn't get used much beyond that, so it's fairly safe.
|
|
||||||
case "$host_os" in
|
|
||||||
linux*)
|
|
||||||
;;
|
|
||||||
gnu*)
|
|
||||||
host_os=`echo $host_os | sed -e 's/gnu/gnu-gnu/'`
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
AC_DEFUN([AC_LC_SYSDEPS],[
|
|
||||||
AC_REQUIRE([AC_LC_CANONICAL_HOST])
|
|
||||||
AC_REQUIRE([GNOME_LIBGTOP_SYSDEPS])
|
|
||||||
|
|
||||||
AC_MSG_CHECKING(whether we need the gtop_server)
|
|
||||||
|
|
||||||
AC_ARG_ENABLE(libgtop-server,
|
|
||||||
[ --enable-libgtop-server use gtop_server [default=auto]],
|
|
||||||
[if test "x$enableval" = "xyes" ; then
|
|
||||||
libgtop_need_server=yes
|
|
||||||
elif test "x$enableval" = "xno" ; then
|
|
||||||
libgtop_need_server=no
|
|
||||||
fi])
|
|
||||||
|
|
||||||
AC_MSG_RESULT($libgtop_need_server)
|
|
||||||
|
|
||||||
AC_MSG_CHECKING(whether building of libgtop names is requested)
|
|
||||||
|
|
||||||
AC_ARG_ENABLE(libgtop-names,
|
|
||||||
[ --enable-libgtop-names enable building of 'names' subdirs [default=yes]],
|
|
||||||
[if test "x$enableval" = "xyes" ; then
|
|
||||||
libgtop_want_names=yes
|
|
||||||
else
|
|
||||||
libgtop_want_names=$enableval
|
|
||||||
fi],[libgtop_want_names=yes])
|
|
||||||
|
|
||||||
AC_MSG_RESULT($libgtop_want_names)
|
|
||||||
|
|
||||||
if test x$libgtop_want_names = xyes ; then
|
|
||||||
AC_DEFINE(GLIBTOP_NAMES)
|
|
||||||
fi
|
|
||||||
|
|
||||||
AM_CONDITIONAL(GLIBTOP_NAMES, test x$libgtop_want_names = xyes)
|
|
||||||
|
|
||||||
AC_MSG_CHECKING(whether building of the guile interface is requested)
|
|
||||||
|
|
||||||
AC_ARG_ENABLE(libgtop-guile,
|
|
||||||
[ --enable-libgtop-guile enable building of the guile interface [default=yes]],
|
|
||||||
[if test "x$enableval" = "xyes" ; then
|
|
||||||
libgtop_want_guile=yes
|
|
||||||
else
|
|
||||||
libgtop_want_guile=$enableval
|
|
||||||
fi],[libgtop_want_guile=yes])
|
|
||||||
|
|
||||||
AC_MSG_RESULT($libgtop_want_guile)
|
|
||||||
|
|
||||||
AC_MSG_CHECKING(whether building of the examples is requested)
|
|
||||||
|
|
||||||
AC_ARG_ENABLE(libgtop-examples,
|
|
||||||
[ --disable-libgtop-examples disable building of the examples],
|
|
||||||
[if test "x$enableval" = "xyes" ; then
|
|
||||||
libgtop_want_examples=yes
|
|
||||||
else
|
|
||||||
libgtop_want_examples=$enableval
|
|
||||||
fi],[libgtop_want_examples=yes])
|
|
||||||
|
|
||||||
AC_MSG_RESULT($libgtop_want_examples)
|
|
||||||
|
|
||||||
if test x$libgtop_want_examples = xyes ; then
|
|
||||||
AC_DEFINE(GLIBTOP_EXAMPLES)
|
|
||||||
fi
|
|
||||||
|
|
||||||
AM_CONDITIONAL(GLIBTOP_EXAMPLES, test x$libgtop_want_examples = xyes)
|
|
||||||
|
|
||||||
if test x$libgtop_use_machine_h = xyes ; then
|
|
||||||
machine_incs="-I\$(top_srcdir)/sysdeps/$sysdeps_dir"
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_SUBST(machine_incs)
|
|
||||||
AC_SUBST(libgtop_want_names)
|
|
||||||
AC_SUBST(libgtop_want_guile)
|
|
||||||
AC_SUBST(libgtop_want_examples)
|
|
||||||
])
|
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
# progtest.m4 from gettext 0.32
|
# progtest.m4 from gettext 0.32
|
||||||
######################################################################
|
######################################################################
|
||||||
|
116
configure.in
116
configure.in
@@ -6,7 +6,12 @@ AC_INIT(copyright.txt)
|
|||||||
AM_CONFIG_HEADER(config.h)
|
AM_CONFIG_HEADER(config.h)
|
||||||
AC_CANONICAL_SYSTEM
|
AC_CANONICAL_SYSTEM
|
||||||
|
|
||||||
AM_INIT_AUTOMAKE(libgtop, 0.01)
|
. $srcdir/LIBGTOP-VERSION
|
||||||
|
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
|
||||||
|
|
||||||
|
AC_SUBST(LIBGTOP_MAJOR_VERSION)
|
||||||
|
AC_SUBST(LIBGTOP_MINOR_VERSION)
|
||||||
|
AC_SUBST(LIBGTOP_VERSION)
|
||||||
|
|
||||||
AM_ACLOCAL_INCLUDE(macros)
|
AM_ACLOCAL_INCLUDE(macros)
|
||||||
|
|
||||||
@@ -47,21 +52,18 @@ else
|
|||||||
AM_CONDITIONAL(CROSS_COMPILING, test "x$cross_compiling" = xyes)
|
AM_CONDITIONAL(CROSS_COMPILING, test "x$cross_compiling" = xyes)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_LC_SYSDEPS
|
GNOME_LIBGTOP_SYSDEPS
|
||||||
|
GNOME_LIBGTOP_TYPES
|
||||||
|
|
||||||
if test x$libgtop_want_guile = xyes ; then
|
GNOME_CHECK_GUILE
|
||||||
GNOME_CHECK_GUILE
|
|
||||||
if test x$ac_cv_guile_found = xyes ; then
|
if test x$ac_cv_guile_found = xyes ; then
|
||||||
if test x$libgtop_want_names = xyes ; then
|
AC_DEFINE(GLIBTOP_GUILE_NAMES)
|
||||||
AC_DEFINE(GLIBTOP_GUILE_NAMES)
|
libgtop_guile_found=yes
|
||||||
fi
|
guile_examples='third third_static'
|
||||||
guile_examples='third third_static'
|
guile_subdirs='guile'
|
||||||
guile_subdirs='guile'
|
|
||||||
else
|
|
||||||
guile_examples=
|
|
||||||
guile_subdirs=
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
|
libgtop_guile_found=no
|
||||||
guile_examples=
|
guile_examples=
|
||||||
guile_subdirs=
|
guile_subdirs=
|
||||||
fi
|
fi
|
||||||
@@ -95,6 +97,21 @@ AC_CHECK_LIB(kvm, kvm_open)
|
|||||||
dnl For DEC OSF1
|
dnl For DEC OSF1
|
||||||
AC_CHECK_LIB(mach, vm_statistics)
|
AC_CHECK_LIB(mach, vm_statistics)
|
||||||
|
|
||||||
|
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.
|
dnl Checks for library functions.
|
||||||
AC_FUNC_ALLOCA
|
AC_FUNC_ALLOCA
|
||||||
AC_FUNC_MMAP
|
AC_FUNC_MMAP
|
||||||
@@ -131,12 +148,6 @@ AC_SUBST(libs_xauth)
|
|||||||
dnl For diskusage stuff
|
dnl For diskusage stuff
|
||||||
GNOME_FILEUTILS_CHECKS
|
GNOME_FILEUTILS_CHECKS
|
||||||
|
|
||||||
CFLAGS="$CFLAGS -D_IN_LIBGTOP"
|
|
||||||
|
|
||||||
AC_SUBST(CFLAGS)
|
|
||||||
AC_SUBST(CPPFLAGS)
|
|
||||||
AC_SUBST(LDFLAGS)
|
|
||||||
|
|
||||||
AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [default=no]],AC_DEFINE(GNOME_ENABLE_DEBUG),)
|
AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [default=no]],AC_DEFINE(GNOME_ENABLE_DEBUG),)
|
||||||
|
|
||||||
dnl If you want to use libgtop without gnome, uncomment the following paragraph:
|
dnl If you want to use libgtop without gnome, uncomment the following paragraph:
|
||||||
@@ -178,44 +189,47 @@ fi
|
|||||||
|
|
||||||
AC_SUBST(libgtop_guile_found)
|
AC_SUBST(libgtop_guile_found)
|
||||||
|
|
||||||
if test x$libgtop_want_names = xyes ; then
|
LIBGTOP_LIBS="$LIBGTOP_LIBS -lgtop_common -lgtop_sysdeps"
|
||||||
if test x$ac_cv_guile_found = xyes ; then
|
LIBGTOP_GUILE_LIBS="$LIBGTOP_GUILE_LIBS -lgtop_common -lgtop_sysdeps"
|
||||||
LIBGTOP_GUILE_LIBS="$LIBGTOP_GUILE_LIBS -lgtop_guile_names"
|
|
||||||
libgtop_want_guile_names=yes
|
|
||||||
else
|
|
||||||
libgtop_want_guile_names=no
|
|
||||||
fi
|
|
||||||
LIBGTOP_LIBS="$LIBGTOP_LIBS -lgtop_names"
|
|
||||||
LIBGTOP_GUILE_LIBS="$LIBGTOP_GUILE_LIBS -lgtop_names"
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_SUBST(libgtop_want_guile_names)
|
LIBGTOP_NAMES_LIBS="$LIBGTOP_LIBS -lgtop_names"
|
||||||
|
LIBGTOP_GUILE_NAMES_LIBS="$LIBGTOP_GUILE_LIBS -lgtop_guile_names"
|
||||||
|
LIBGTOP_GUILE_NAMES_LIBS="$LIBGTOP_GUILE_LIBS -lgtop_names"
|
||||||
|
|
||||||
LIBGTOP_LIBS="$LIBGTOP_LIBS -lgtop_common $libs_xauth"
|
LIBGTOP_LIBS="$LIBGTOP_LIBS $libs_xauth"
|
||||||
LIBGTOP_GUILE_LIBS="$LIBGTOP_GUILE_LIBS -lgtop_common $libs_xauth"
|
LIBGTOP_NAMES_LIBS="$LIBGTOP_NAMES_LIBS $libs_xauth"
|
||||||
|
LIBGTOP_GUILE_LIBS="$LIBGTOP_GUILE_LIBS $libs_xauth"
|
||||||
|
LIBGTOP_GUILE_NAMES_LIBS="$LIBGTOP_GUILE_NAMES_LIBS $libs_xauth"
|
||||||
|
|
||||||
if test "x$need_server" = "xyes" ; then
|
LIBGTOP_GUILE_LIBS="$LIBGTOP_GUILE_LIBS $GUILE_LIBS"
|
||||||
LIBGTOP_LIBS="$LIBGTOP_LIBS -lgtop"
|
LIBGTOP_GUILE_INCS="$LIBGTOP_GUILE_INCS $GUILE_INCS -DGLIBTOP_GUILE"
|
||||||
LIBGTOP_GUILE_LIBS="$LIBGTOP_GUILE_LIBS -lgtop"
|
|
||||||
else
|
|
||||||
LIBGTOP_LIBS="$LIBGTOP_LIBS -lgtop_sysdeps"
|
|
||||||
LIBGTOP_GUILE_LIBS="$LIBGTOP_GUILE_LIBS -lgtop_sysdeps"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test "x$ac_cv_guile_found" = "xyes" ; then
|
LIBGTOP_NAMES_INCS="$LIBGTOP_INCS -DGLIBTOP_NAMES"
|
||||||
LIBGTOP_INCS="$LIBGTOP_INCS $GUILE_INCS"
|
LIBGTOP_GUILE_NAMES_INCS="$LIBGTOP_GUILE_INCS -DGLIBTOP_GUILE_NAMES"
|
||||||
LIBGTOP_GUILE_INCS="$LIBGTOP_INCS $GUILE_INCS"
|
LIBGTOP_GUILE_NAMES_INCS="$LIBGTOP_GUILE_INCS -DGLIBTOP_NAMES"
|
||||||
LIBGTOP_GUILE_LIBS="$LIBGTOP_GUILE_LIBS $GUILE_LIBS"
|
|
||||||
fi
|
|
||||||
|
|
||||||
machine_incs='-I$(top_srcdir)/sysdeps/@sysdeps_dir@'
|
machine_incs="-I\$(top_srcdir)/sysdeps/$sysdeps_dir"
|
||||||
|
|
||||||
AC_SUBST(machine_incs)
|
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="$CFLAGS -D_IN_LIBGTOP -D_GNU_SOURCE -DGLIBTOP_NAMES $guile_def -I\$(top_builddir) -I\$(top_srcdir) -I\$(top_srcdir)/sysdeps/$sysdeps_dir -I\$(top_srcdir)/include -I\$(top_srcdir)/intl "'-DGTOPLOCALEDIR=\"$(datadir)/locale\" -DLIBGTOP_VERSION=\"'"$LIBGTOP_VERSION"'\" -DLIBGTOP_SERVER=\"'"$LIBGTOP_SERVER"'\"'
|
||||||
|
|
||||||
|
AC_SUBST(INCLUDES)
|
||||||
|
|
||||||
AC_SUBST(LIBGTOP_LIBS)
|
AC_SUBST(LIBGTOP_LIBS)
|
||||||
AC_SUBST(LIBGTOP_INCS)
|
AC_SUBST(LIBGTOP_INCS)
|
||||||
|
AC_SUBST(LIBGTOP_NAMES_LIBS)
|
||||||
|
AC_SUBST(LIBGTOP_NAMES_INCS)
|
||||||
AC_SUBST(LIBGTOP_GUILE_LIBS)
|
AC_SUBST(LIBGTOP_GUILE_LIBS)
|
||||||
AC_SUBST(LIBGTOP_GUILE_INCS)
|
AC_SUBST(LIBGTOP_GUILE_INCS)
|
||||||
|
AC_SUBST(LIBGTOP_GUILE_NAMES_LIBS)
|
||||||
|
AC_SUBST(LIBGTOP_GUILE_NAMES_INCS)
|
||||||
AC_SUBST(LIBGTOP_BINDIR)
|
AC_SUBST(LIBGTOP_BINDIR)
|
||||||
AC_SUBST(LIBGTOP_SERVER)
|
AC_SUBST(LIBGTOP_SERVER)
|
||||||
|
|
||||||
@@ -231,6 +245,13 @@ if test "$need_gnome_support" = yes; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test x$libgtop_need_server = xyes ; then
|
||||||
|
sysdeps_suid_lib="\$(top_builddir)/sysdeps/\$(sysdeps_dir)/libgtop_sysdeps_suid.la"
|
||||||
|
else
|
||||||
|
sysdeps_suid_lib=
|
||||||
|
fi
|
||||||
|
AC_SUBST(sysdeps_suid_lib)
|
||||||
|
|
||||||
AC_OUTPUT([
|
AC_OUTPUT([
|
||||||
Makefile
|
Makefile
|
||||||
po/Makefile.in
|
po/Makefile.in
|
||||||
@@ -247,11 +268,12 @@ sysdeps/sun4/Makefile
|
|||||||
sysdeps/osf1/Makefile
|
sysdeps/osf1/Makefile
|
||||||
sysdeps/linux/Makefile
|
sysdeps/linux/Makefile
|
||||||
sysdeps/kernel/Makefile
|
sysdeps/kernel/Makefile
|
||||||
|
sysdeps/freebsd/Makefile
|
||||||
src/Makefile
|
src/Makefile
|
||||||
src/server/Makefile
|
src/server/Makefile
|
||||||
src/proxy/Makefile
|
|
||||||
src/daemon/Makefile
|
src/daemon/Makefile
|
||||||
lib/Makefile
|
lib/Makefile
|
||||||
|
guile/Makefile
|
||||||
examples/Makefile
|
examples/Makefile
|
||||||
perl/Makefile.PL
|
perl/Makefile.PL
|
||||||
support/Makefile
|
support/Makefile
|
||||||
|
@@ -1,22 +1,10 @@
|
|||||||
*.shml
|
*.shml
|
||||||
|
*.ced
|
||||||
.timestamp
|
.timestamp
|
||||||
.timestamp2
|
.timestamp2
|
||||||
.timestamp3
|
.timestamp3
|
||||||
dbtohtml-1.shtml
|
.timestamp4
|
||||||
dbtohtml-2.shtml
|
|
||||||
dbtohtml-3.shtml
|
|
||||||
dbtohtml.shtml
|
|
||||||
gnome-hackers
|
gnome-hackers
|
||||||
gnome-hackers.ced
|
|
||||||
libgtop
|
libgtop
|
||||||
libgtop-1.shtml
|
|
||||||
libgtop-2.shtml
|
|
||||||
libgtop-3.shtml
|
|
||||||
libgtop-4.shtml
|
|
||||||
libgtop-5.shtml
|
|
||||||
libgtop-INDEX.shtml
|
|
||||||
libgtop-ref
|
libgtop-ref
|
||||||
libgtop-ref.ced
|
table
|
||||||
libgtop.ced
|
|
||||||
libgtop.fot
|
|
||||||
libgtop.shtml
|
|
||||||
|
8
doc/ChangeLog
Normal file
8
doc/ChangeLog
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
1998-07-21 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
|
* gnome-hackers.sgml: Added note that this file is
|
||||||
|
currently out of date and a link to the documentation
|
||||||
|
of the table () function.
|
||||||
|
|
||||||
|
* table.sgml: New file - basic documentation for the
|
||||||
|
table () system call.
|
29
doc/Makefile
29
doc/Makefile
@@ -1,22 +1,37 @@
|
|||||||
all: .timestamp .timestamp2 .timestamp3
|
all: .timestamp .timestamp2 .timestamp3 .timestamp4
|
||||||
|
|
||||||
|
clean:
|
||||||
|
-rm -f .timestamp*
|
||||||
|
-rm -rf libgtop gnome-hackers libgtop-ref table
|
||||||
|
|
||||||
.timestamp: libgtop.sgml
|
.timestamp: libgtop.sgml
|
||||||
rm -rf libgtop
|
-rm -rf libgtop
|
||||||
mkdir libgtop
|
mkdir libgtop
|
||||||
jade -D /usr/lib/sgml/jade_dsl -d libgtop.dsl -t sgml \
|
-rm -f .timestamp
|
||||||
|
jade -D /usr/lib/sgml -d libgtop.dsl -t sgml \
|
||||||
-V %no-make-index% libgtop.sgml > /dev/null && \
|
-V %no-make-index% libgtop.sgml > /dev/null && \
|
||||||
touch .timestamp
|
touch .timestamp
|
||||||
|
|
||||||
.timestamp2: gnome-hackers.sgml
|
.timestamp2: gnome-hackers.sgml
|
||||||
rm -rf gnome-hackers
|
-rm -rf gnome-hackers
|
||||||
mkdir gnome-hackers
|
mkdir gnome-hackers
|
||||||
jade -D /usr/lib/sgml/jade_dsl -d gnome-hackers.dsl -t sgml \
|
-rm -f .timestamp2
|
||||||
|
jade -D /usr/lib/sgml -d gnome-hackers.dsl -t sgml \
|
||||||
-V %no-make-index% gnome-hackers.sgml > /dev/null && \
|
-V %no-make-index% gnome-hackers.sgml > /dev/null && \
|
||||||
touch .timestamp2
|
touch .timestamp2
|
||||||
|
|
||||||
.timestamp3: libgtop-ref.sgml ../guile/reference.sgml
|
.timestamp3: libgtop-ref.sgml ../guile/reference.sgml
|
||||||
rm -rf libgtop-ref
|
-rm -rf libgtop-ref
|
||||||
mkdir libgtop-ref
|
mkdir libgtop-ref
|
||||||
jade -D /usr/lib/sgml/jade_dsl -d libgtop-ref.dsl -t sgml \
|
-rm -f .timestamp3
|
||||||
|
jade -D /usr/lib/sgml -d libgtop-ref.dsl -t sgml \
|
||||||
-V %no-make-index% libgtop-ref.sgml > /dev/null && \
|
-V %no-make-index% libgtop-ref.sgml > /dev/null && \
|
||||||
touch .timestamp3
|
touch .timestamp3
|
||||||
|
|
||||||
|
.timestamp4: table.sgml
|
||||||
|
-rm -rf table
|
||||||
|
mkdir table
|
||||||
|
-rm -f .timestamp4
|
||||||
|
jade -D /usr/lib/sgml -d table.dsl -t sgml \
|
||||||
|
-V %no-make-index% table.sgml > /dev/null && \
|
||||||
|
touch .timestamp4
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
<!doctype book PUBLIC "-//Davenport//DTD DocBook V3.0//EN" [
|
<!doctype book PUBLIC "-//Davenport//DTD DocBook V3.0//EN" [
|
||||||
<!entity libgtopConf.sh SYSTEM "../libgtopConf.sh" >
|
<!entity libgtopConf.sh SYSTEM "../libgtopConf.sh" >
|
||||||
|
<!entity home-of-linux "http://www.home-of-linux.org/">
|
||||||
]>
|
]>
|
||||||
<book>
|
<book>
|
||||||
<bookinfo>
|
<bookinfo>
|
||||||
@@ -51,6 +52,8 @@
|
|||||||
</legalnotice>
|
</legalnotice>
|
||||||
|
|
||||||
<abstract>
|
<abstract>
|
||||||
|
<para>
|
||||||
|
<literal>$Id$</literal>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
This is a short introduction in how to use
|
This is a short introduction in how to use
|
||||||
@@ -59,6 +62,24 @@
|
|||||||
takes and the information stored in the automatically generated
|
takes and the information stored in the automatically generated
|
||||||
<filename>libgtopConf.sh</filename> configuration script.
|
<filename>libgtopConf.sh</filename> configuration script.
|
||||||
|
|
||||||
|
<note>
|
||||||
|
<para>
|
||||||
|
This document is currently out of date.
|
||||||
|
</note>
|
||||||
|
|
||||||
|
<note>
|
||||||
|
<para>
|
||||||
|
Documentation about the new <function>table ()</function>
|
||||||
|
function can be found here:
|
||||||
|
|
||||||
|
<itemizedlist>
|
||||||
|
<listitem><para>
|
||||||
|
<ulink url="&home-of-linux;kernel/table/">
|
||||||
|
&home-of-linux;kernel/table/
|
||||||
|
</ulink>
|
||||||
|
</itemizedlist>
|
||||||
|
</note>
|
||||||
|
|
||||||
</abstract>
|
</abstract>
|
||||||
|
|
||||||
</bookinfo>
|
</bookinfo>
|
||||||
@@ -391,3 +412,10 @@
|
|||||||
|
|
||||||
|
|
||||||
</book>
|
</book>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Local Variables:
|
||||||
|
mode: sgml
|
||||||
|
sgml-indent-data: t
|
||||||
|
End:
|
||||||
|
-->
|
||||||
|
161
doc/table.announce.txt
Normal file
161
doc/table.announce.txt
Normal file
@@ -0,0 +1,161 @@
|
|||||||
|
Path: news.uni-stuttgart.de!fu-berlin.de!taurus.uni-trier.DE!baulig
|
||||||
|
From: Martin Baulig <baulig@merkur.uni-trier.de>
|
||||||
|
Newsgroups: comp.os.linux.development.system
|
||||||
|
Subject: RFC: New system call for /proc information ?
|
||||||
|
Date: 07 Jun 1998 20:22:47 +0200
|
||||||
|
Lines: 143
|
||||||
|
Sender: baulig@Taurus.uni-trier.de
|
||||||
|
Message-ID: <of7zpfprs08.fsf@Taurus.uni-trier.de>
|
||||||
|
NNTP-Posting-Host: taurus.uni-trier.de (136.199.14.201)
|
||||||
|
Mime-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=iso-8859-1
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
NNTP-Posting-User: baulig
|
||||||
|
X-Access: 16 1542 1543
|
||||||
|
X-Trace: fu-berlin.de 897243777 29527 baulig 136.199.14.201
|
||||||
|
X-Newsreader: Gnus v5.6.11/XEmacs 20.3 - "Vatican City"
|
||||||
|
Xref: news.uni-stuttgart.de comp.os.linux.development.system:73539
|
||||||
|
|
||||||
|
[Posted to the Gnome Mailing List and to comp.os.linux.development.system]
|
||||||
|
|
||||||
|
Request for Comments:
|
||||||
|
====================
|
||||||
|
|
||||||
|
Should we have a new system call under Linux which fetches information
|
||||||
|
from the /proc filesytem similar to the table() function of DEC OSF/1 ?
|
||||||
|
|
||||||
|
The whole story:
|
||||||
|
===============
|
||||||
|
|
||||||
|
I am currently working on libgtop, a library that fetches information
|
||||||
|
from the proc filesystem for user processes. This library uses a suid
|
||||||
|
server on system where this is required. On Linux, the information are
|
||||||
|
fetched directly from the proc filesystem.
|
||||||
|
|
||||||
|
Now, I made some profilings (fetches 50000 times cpu, memory, swap,
|
||||||
|
uptime and loadavg):
|
||||||
|
|
||||||
|
Each sample counts as 0.01 seconds.
|
||||||
|
% cumulative self self total
|
||||||
|
time seconds seconds calls ns/call ns/call name
|
||||||
|
91.86 348.03 348.03 read
|
||||||
|
3.07 359.67 11.64 open
|
||||||
|
0.67 362.22 2.55 close
|
||||||
|
0.16 363.55 0.62 memset
|
||||||
|
0.16 364.14 0.59 __ipc
|
||||||
|
0.03 368.84 0.12 vsscanf (iovsscanf.c:31)
|
||||||
|
0.01 374.49 0.05 sscanf (sscanf.c:28)
|
||||||
|
0.00 378.71 0.01 semctl (semctl.c:32)
|
||||||
|
0.00 378.73 0.01 shmctl (shmctl.c:30)
|
||||||
|
|
||||||
|
granularity: each sample hit covers 4 byte(s) for 0.00% of 378.88 seconds
|
||||||
|
|
||||||
|
index % time self children called name
|
||||||
|
[1] 91.9 348.03 0.00 read [1]
|
||||||
|
-----------------------------------------------
|
||||||
|
[2] 3.1 11.64 0.00 open [2]
|
||||||
|
-----------------------------------------------
|
||||||
|
[3] 0.7 2.55 0.00 close [3]
|
||||||
|
-----------------------------------------------
|
||||||
|
[5] 0.2 0.62 0.00 memset [5]
|
||||||
|
-----------------------------------------------
|
||||||
|
[6] 0.2 0.59 0.00 __ipc [6]
|
||||||
|
-----------------------------------------------
|
||||||
|
[35] 0.0 0.12 0.00 vsscanf (iovsscanf.c:31) [35]
|
||||||
|
-----------------------------------------------
|
||||||
|
[96] 0.0 0.05 0.00 sscanf (sscanf.c:28) [96]
|
||||||
|
-----------------------------------------------
|
||||||
|
|
||||||
|
You see, it spends a lot of time in read() which is only used to read the
|
||||||
|
data from the files in /proc. Well, basically one can say that these
|
||||||
|
timings are not so bad, normally a process periodically fetches those
|
||||||
|
information say 10 times a seconds which makes 36000 invocations per
|
||||||
|
hour.
|
||||||
|
|
||||||
|
This will make a total of about 250 seconds per hour or on even say:
|
||||||
|
|
||||||
|
``a program fetching those information at a frequency of 10 will take
|
||||||
|
about 7 % of each hour just for reading files from /proc''.
|
||||||
|
|
||||||
|
Now look at timings of __ipc, they're about 350 times better 'cause this
|
||||||
|
is done using system calls.
|
||||||
|
|
||||||
|
So far so good, now look at how this is done on the DEC OSF/1 port of the
|
||||||
|
library (the following code is part of libgtop - GPL/LGPL):
|
||||||
|
|
||||||
|
CPU usage:
|
||||||
|
{
|
||||||
|
struct tbl_sysinfo sysinfo;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = table (TBL_SYSINFO, 0, (char *) &sysinfo, 1,
|
||||||
|
sizeof (struct tbl_sysinfo));
|
||||||
|
|
||||||
|
buf->user = sysinfo.si_user;
|
||||||
|
buf->nice = sysinfo.si_nice;
|
||||||
|
buf->sys = sysinfo.si_sys;
|
||||||
|
buf->idle = sysinfo.si_idle;
|
||||||
|
}
|
||||||
|
|
||||||
|
Well, the table() command of DEC OSF/1 has may disadvantages, too - such
|
||||||
|
as requiring to be root to fetch any information about processes (well, for
|
||||||
|
each process that is not the current one).
|
||||||
|
|
||||||
|
But this works using system calls rather that reading and parsing files
|
||||||
|
and should be about as fast as getting the IPC information on Linux.
|
||||||
|
|
||||||
|
Under Linux, the current trend seems to be to move anything into the /proc
|
||||||
|
filesystem, but if you look at the timings, wouldn't it be better to also
|
||||||
|
implement a system call interface ?
|
||||||
|
|
||||||
|
Don't understand me wrong:
|
||||||
|
=========================
|
||||||
|
|
||||||
|
I *do not want* to *replace* the /proc filesystem - it's an excellent
|
||||||
|
idea to be able to fetch all information on the command line without
|
||||||
|
any program just a simple 'cat' - I want to *add* a *new* system call
|
||||||
|
to allow programmers to fetch those information faster that reading
|
||||||
|
from /proc.
|
||||||
|
|
||||||
|
To come to the point:
|
||||||
|
=====================
|
||||||
|
|
||||||
|
Is there any public interest in having a new system call under Linux
|
||||||
|
which can be used to fetch all information that are currently in the
|
||||||
|
/proc filesystem.
|
||||||
|
|
||||||
|
Basically, this system would be defined like this:
|
||||||
|
|
||||||
|
asmlinkage int
|
||||||
|
sys_table (int command, struct sysinfo_table *buf)
|
||||||
|
|
||||||
|
and be invoked like this:
|
||||||
|
|
||||||
|
#include <sys/table.h>
|
||||||
|
|
||||||
|
{
|
||||||
|
struct sysinfo_cpu cpu;
|
||||||
|
struct sysinfo_mem mem;
|
||||||
|
|
||||||
|
ret = table (TABLE_CPU, &cpu);
|
||||||
|
if (ret == -1) return; /* or invoke any error handler */
|
||||||
|
|
||||||
|
ret = table (TABLE_MEM, &mem);
|
||||||
|
if (ret == -1) return;
|
||||||
|
}
|
||||||
|
|
||||||
|
What do you think, folks. Should we have such a system call under Linux ?
|
||||||
|
I can do the implementation of this system call, but I want to have some
|
||||||
|
feedback first.
|
||||||
|
|
||||||
|
Martin
|
||||||
|
|
||||||
|
--
|
||||||
|
-----------------------------------------------------------------
|
||||||
|
Martin Baulig - Angewandte Mathematik - Universitaet Trier
|
||||||
|
|
||||||
|
baulig@castor.uni-trier.de, http://www.home-of-linux.com/
|
||||||
|
Key: 1024-bit key with ID C8178435 created 1997/01/24
|
||||||
|
ID: 67 C1 84 A0 47 F5 11 C5 5F 68 4C 84 99 05 C3 92
|
||||||
|
Finger me for public key or fetch finger.txt from the url above
|
||||||
|
------------------------------------------------------------------
|
12
doc/table.dsl
Normal file
12
doc/table.dsl
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<!doctype style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
|
||||||
|
<!ENTITY dbtohtml.dsl SYSTEM "dbtohtml.dsl" CDATA DSSSL >
|
||||||
|
]>
|
||||||
|
|
||||||
|
<style-specification id="tabledbotohtml" use="dbtohtml">
|
||||||
|
|
||||||
|
(define %output-basename% "table")
|
||||||
|
(define %output-directory% "table")
|
||||||
|
|
||||||
|
</style-specification>
|
||||||
|
|
||||||
|
<external-specification id="dbtohtml" document="dbtohtml.dsl">
|
193
doc/table.sgml
Normal file
193
doc/table.sgml
Normal file
@@ -0,0 +1,193 @@
|
|||||||
|
<!-- $Id$ -->
|
||||||
|
|
||||||
|
<!doctype book PUBLIC "-//Davenport//DTD DocBook V3.0//EN" [
|
||||||
|
<!entity libgtopConf.sh SYSTEM "../libgtopConf.sh" >
|
||||||
|
<!entity home-of-linux "http://www.home-of-linux.org/">
|
||||||
|
<!entity table-announce-first "&home-of-linux;kernel/table/ANNOUNCE.FIRST">
|
||||||
|
<!entity table20-tgz "&home-of-linux;kernel/table/table20.tgz">
|
||||||
|
<!entity table21-tgz "&home-of-linux;kernel/table/table21.tgz">
|
||||||
|
<!entity news-c-o-l-d-s "comp.os.linux.development.system">
|
||||||
|
<!entity libgtop "<productname>libgtop</productname>">
|
||||||
|
<!entity table "<function>table ()</function>">
|
||||||
|
]>
|
||||||
|
<book>
|
||||||
|
<bookinfo>
|
||||||
|
<title>The &table; system call under Linux</title>
|
||||||
|
<authorgroup>
|
||||||
|
<author>
|
||||||
|
<firstname>Martin</firstname>
|
||||||
|
<surname>Baulig</surname>
|
||||||
|
<affiliation>
|
||||||
|
<address>
|
||||||
|
<email>martin@home-of-linux.org</email>
|
||||||
|
</address>
|
||||||
|
</affiliation>
|
||||||
|
</author>
|
||||||
|
</authorgroup>
|
||||||
|
<copyright>
|
||||||
|
<year>1998</year>
|
||||||
|
<holder>Martin Baulig</holder>
|
||||||
|
</copyright>
|
||||||
|
|
||||||
|
<legalnotice>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
This documentation 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.
|
||||||
|
|
||||||
|
<para>
|
||||||
|
This library 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.
|
||||||
|
|
||||||
|
<para>
|
||||||
|
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
|
||||||
|
|
||||||
|
<para>
|
||||||
|
For more details see the file COPYING in the source
|
||||||
|
distribution of LibGTop.</para>
|
||||||
|
|
||||||
|
</legalnotice>
|
||||||
|
|
||||||
|
<abstract>
|
||||||
|
<para>
|
||||||
|
<literal>$Id$</literal>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
Under <productname>Linux</productname>, reading from
|
||||||
|
<filename>/proc</filename> is somehow slow because the data
|
||||||
|
needs to be converted into a stringified representation from
|
||||||
|
the kernel and to be parsed from the application program to
|
||||||
|
get the original data back.
|
||||||
|
|
||||||
|
While doing the <productname>DEC OSF/1</productname> port of
|
||||||
|
&libgtop; I got the idea to add something similar to the &table;
|
||||||
|
function there to the Linux kernel.
|
||||||
|
|
||||||
|
This is what this document is about.
|
||||||
|
</abstract>
|
||||||
|
|
||||||
|
</bookinfo>
|
||||||
|
|
||||||
|
<toc></toc>
|
||||||
|
|
||||||
|
<chapter id="why-not-sysctl">
|
||||||
|
<title>Why not <function>sysctl</function>?</title>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
Some weeks ago, I posted the initial proposal of the project to
|
||||||
|
<ulink url="news:&news-c-o-l-d-s;">&news-c-o-l-d-s;</ulink> with
|
||||||
|
Message-ID <literal><of7zpfprs08.fsf@Taurus.uni-trier.de></literal>.
|
||||||
|
|
||||||
|
<para>
|
||||||
|
You can also read this article at my site:
|
||||||
|
|
||||||
|
<itemizedlist>
|
||||||
|
<listitem><para>
|
||||||
|
<ulink url="&table-announce-first;">&table-announce-first;</ulink>
|
||||||
|
</itemizedlist>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
Some people told me to include all the stuff into
|
||||||
|
<function>sysctl</function> instead of inventing a new system call.
|
||||||
|
|
||||||
|
<para>
|
||||||
|
Basically this is a good idea, but the main problem with
|
||||||
|
<function>sysctl</function> is that this should be applied to standard
|
||||||
|
kernels and not just as a short patch. Well, AFAIK something similar
|
||||||
|
is on the "wish list" for 2.2er kernels - but of cause it'll need some
|
||||||
|
time until we have a real replacement of the <filename>/proc</filename>
|
||||||
|
filesystem in <function>sysctl</function>.
|
||||||
|
|
||||||
|
<para>
|
||||||
|
If someone thinks that this absolutely should be included in
|
||||||
|
<function>sysctl</function>: think about some kind of interface,
|
||||||
|
discuss it with the kernel developers, ...
|
||||||
|
|
||||||
|
<chapter id="about-table">
|
||||||
|
<title>About the &table; function</title>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
Using the &table; function will not affect any existing kernel
|
||||||
|
structures and can be done independent from kernel development.
|
||||||
|
|
||||||
|
<para>
|
||||||
|
So it can easily be used in &libgtop; until we have something
|
||||||
|
simliar in standard kernels.
|
||||||
|
|
||||||
|
<para>
|
||||||
|
If you want to use the &table; function in your own programs, be
|
||||||
|
aware that it is just intended to be some kind of quick solution
|
||||||
|
for &libgtop; until there's something better in standard kernels.
|
||||||
|
|
||||||
|
<chapter id="how-to-use">
|
||||||
|
<title>How to use the &table; function in &libgtop;</title>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
The source code of the &table; function is distributed together with
|
||||||
|
&libgtop;. It can be found in the <filename>kernel/table20</filename>
|
||||||
|
directory for 2.0.xx kernels and in the <filename>kernel/table21</filename>
|
||||||
|
directory for 2.1.xx kernels.
|
||||||
|
|
||||||
|
<para>
|
||||||
|
You can also download it from my site:
|
||||||
|
|
||||||
|
<itemizedlist>
|
||||||
|
<listitem><para>
|
||||||
|
<ulink url="&table20-tgz;">&table20-tgz</ulink>
|
||||||
|
(for kernel 2.0.xx)
|
||||||
|
<listitem><para>
|
||||||
|
<ulink url="&table21-tgz;">&table21-tgz</ulink>
|
||||||
|
(for kernel 2.1.xx)
|
||||||
|
</itemizedlist>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
Copy the contents of the appropriate directory to
|
||||||
|
<filename>/usr/src/linux/table</filename>, apply the
|
||||||
|
patch to the kernel and re-configure &libgtop;.
|
||||||
|
|
||||||
|
<para>
|
||||||
|
After that, you can unmount <filename>/proc</filename> and
|
||||||
|
&libgtop; will still work !
|
||||||
|
|
||||||
|
<note>
|
||||||
|
<para>
|
||||||
|
Maybe one could consider this as a bug, but currently there
|
||||||
|
isn't a configuration option to disable the &table; function
|
||||||
|
once you applied the patch ...
|
||||||
|
</note>
|
||||||
|
|
||||||
|
<note>
|
||||||
|
<para>
|
||||||
|
Currently I'm working on the 2.1.x version to implement some
|
||||||
|
features newer kernels have - so the 2.0.x version may not
|
||||||
|
have all features the 2.1.x one has.
|
||||||
|
</note>
|
||||||
|
|
||||||
|
<note>
|
||||||
|
<para>
|
||||||
|
The 2.1.x version of the &table; function is implemented
|
||||||
|
as a kernel module. You have to do a
|
||||||
|
<command>insmod table/module.o</command> manually to use it.
|
||||||
|
|
||||||
|
<para>
|
||||||
|
This has the advantage that you don't need to reboot if you
|
||||||
|
want to play around with the code a little bit.
|
||||||
|
</note>
|
||||||
|
|
||||||
|
</book>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Local Variables:
|
||||||
|
mode: sgml
|
||||||
|
sgml-indent-data: t
|
||||||
|
End:
|
||||||
|
-->
|
@@ -1,3 +1,7 @@
|
|||||||
|
1998-07-22 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
|
* mountlist.c: New file.
|
||||||
|
|
||||||
1998-06-12 Martin Baulig <martin@home-of-linux.org>
|
1998-06-12 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
* test.scm: New file.
|
* test.scm: New file.
|
||||||
|
@@ -2,15 +2,12 @@
|
|||||||
|
|
||||||
LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
|
LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
|
||||||
|
|
||||||
INCLUDES = -I$(top_builddir) -I$(top_srcdir) @machine_incs@ \
|
|
||||||
-I$(top_srcdir)/include -I$(top_srcdir)/intl @GUILE_INCS@ \
|
|
||||||
-DGTOPLOCALEDIR=\"$(datadir)/locale\" -D_GNU_SOURCE
|
|
||||||
|
|
||||||
CFLAGS = -Wall -W @CFLAGS@ -O0
|
CFLAGS = -Wall -W @CFLAGS@ -O0
|
||||||
|
|
||||||
DEFS = @DEFS@
|
DEFS = @DEFS@
|
||||||
|
|
||||||
bin_PROGRAMS = first first_static second second_static \
|
bin_PROGRAMS = first first_static second second_static \
|
||||||
|
mountlist mountlist_static \
|
||||||
@guile_examples@
|
@guile_examples@
|
||||||
|
|
||||||
EXTRA_PROGRAMS = third third_static
|
EXTRA_PROGRAMS = third third_static
|
||||||
@@ -35,10 +32,8 @@ second_static_SOURCES = $(second_SOURCES)
|
|||||||
second_static_LDADD = $(second_LDADD)
|
second_static_LDADD = $(second_LDADD)
|
||||||
second_static_LDFLAGS = -static
|
second_static_LDFLAGS = -static
|
||||||
|
|
||||||
if GLIBTOP_NAMES
|
|
||||||
third_guile_names_LIBS = $(top_builddir)/sysdeps/guile/names/libgtop_guile_names.la
|
third_guile_names_LIBS = $(top_builddir)/sysdeps/guile/names/libgtop_guile_names.la
|
||||||
third_names_LIBS = $(top_builddir)/sysdeps/names/libgtop_names.la
|
third_names_LIBS = $(top_builddir)/sysdeps/names/libgtop_names.la
|
||||||
endif
|
|
||||||
|
|
||||||
third_SOURCES = third.c
|
third_SOURCES = third.c
|
||||||
third_LDADD = $(top_builddir)/sysdeps/guile/libgtop_guile.la \
|
third_LDADD = $(top_builddir)/sysdeps/guile/libgtop_guile.la \
|
||||||
@@ -51,3 +46,14 @@ third_LDADD = $(top_builddir)/sysdeps/guile/libgtop_guile.la \
|
|||||||
third_static_SOURCES = $(third_SOURCES)
|
third_static_SOURCES = $(third_SOURCES)
|
||||||
third_static_LDADD = $(third_LDADD)
|
third_static_LDADD = $(third_LDADD)
|
||||||
third_static_LDFLAGS = -static
|
third_static_LDFLAGS = -static
|
||||||
|
|
||||||
|
mountlist_SOURCES = mountlist.c
|
||||||
|
mountlist_LDADD = $(top_builddir)/lib/libgtop.la \
|
||||||
|
$(top_builddir)/sysdeps/common/libgtop_common.la \
|
||||||
|
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
|
||||||
|
@INTLLIBS@ @LIBSUPPORT@ @libs_xauth@
|
||||||
|
|
||||||
|
mountlist_static_SOURCES= $(mountlist_SOURCES)
|
||||||
|
mountlist_static_LDADD = $(mountlist_LDADD)
|
||||||
|
mountlist_static_LDFLAGS= -static
|
||||||
|
|
||||||
|
@@ -71,14 +71,14 @@ main (int argc, char *argv [])
|
|||||||
for (c = 0; c < PROFILE_COUNT; c++)
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_cpu (&data.cpu);
|
glibtop_get_cpu (&data.cpu);
|
||||||
|
|
||||||
printf ("CPU (0x%08lx): %lu, %lu, %lu, %lu, %lu, %lu\n",
|
printf ("CPU (0x%08Lx): %Lu, %Lu, %Lu, %Lu, %Lu, %Lu\n",
|
||||||
data.cpu.flags, data.cpu.total, data.cpu.user, data.cpu.nice,
|
data.cpu.flags, data.cpu.total, data.cpu.user, data.cpu.nice,
|
||||||
data.cpu.sys, data.cpu.idle, data.cpu.frequency);
|
data.cpu.sys, data.cpu.idle, data.cpu.frequency);
|
||||||
|
|
||||||
for (c = 0; c < PROFILE_COUNT; c++)
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_mem (&data.mem);
|
glibtop_get_mem (&data.mem);
|
||||||
|
|
||||||
printf ("Memory (0x%08lx): %lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu\n",
|
printf ("Memory (0x%08Lx): %Lu, %Lu, %Lu, %Lu, %Lu, %Lu, %Lu, %Lu\n",
|
||||||
data.mem.flags, data.mem.total, data.mem.used, data.mem.free,
|
data.mem.flags, data.mem.total, data.mem.used, data.mem.free,
|
||||||
data.mem.shared, data.mem.buffer, data.mem.cached,
|
data.mem.shared, data.mem.buffer, data.mem.cached,
|
||||||
data.mem.user, data.mem.locked);
|
data.mem.user, data.mem.locked);
|
||||||
@@ -86,26 +86,27 @@ main (int argc, char *argv [])
|
|||||||
for (c = 0; c < PROFILE_COUNT; c++)
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_swap (&data.swap);
|
glibtop_get_swap (&data.swap);
|
||||||
|
|
||||||
printf ("Swap (0x%08lx): %lu, %lu, %lu\n", data.swap.flags,
|
printf ("Swap (0x%08Lx): %Lu, %Lu, %Lu, %Lu, %Lu\n",
|
||||||
data.swap.total, data.swap.used, data.swap.free);
|
data.swap.flags, data.swap.total, data.swap.used,
|
||||||
|
data.swap.free, data.swap.pagein, data.swap.pageout);
|
||||||
|
|
||||||
for (c = 0; c < PROFILE_COUNT; c++)
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_uptime (&data.uptime);
|
glibtop_get_uptime (&data.uptime);
|
||||||
|
|
||||||
printf ("Uptime (0x%08lx): %f, %f\n", data.uptime.flags,
|
printf ("Uptime (0x%08Lx): %f, %f\n", data.uptime.flags,
|
||||||
data.uptime.uptime, data.uptime.idletime);
|
data.uptime.uptime, data.uptime.idletime);
|
||||||
|
|
||||||
for (c = 0; c < PROFILE_COUNT; c++)
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_loadavg (&data.loadavg);
|
glibtop_get_loadavg (&data.loadavg);
|
||||||
|
|
||||||
printf ("Loadavg (0x%08lx): %f, %f, %f\n", data.loadavg.flags,
|
printf ("Loadavg (0x%08Lx): %f, %f, %f\n", data.loadavg.flags,
|
||||||
data.loadavg.loadavg [0], data.loadavg.loadavg [1],
|
data.loadavg.loadavg [0], data.loadavg.loadavg [1],
|
||||||
data.loadavg.loadavg [2]);
|
data.loadavg.loadavg [2]);
|
||||||
|
|
||||||
for (c = 0; c < PROFILE_COUNT; c++)
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_shm_limits (&data.shm_limits);
|
glibtop_get_shm_limits (&data.shm_limits);
|
||||||
|
|
||||||
printf ("Shm Limits (0x%08lx): %ld, %ld, %ld, %ld, %ld\n",
|
printf ("Shm Limits (0x%08Lx): %Lu, %Lu, %Lu, %Lu, %Lu\n",
|
||||||
data.shm_limits.flags, data.shm_limits.shmmax,
|
data.shm_limits.flags, data.shm_limits.shmmax,
|
||||||
data.shm_limits.shmmin, data.shm_limits.shmmni,
|
data.shm_limits.shmmin, data.shm_limits.shmmni,
|
||||||
data.shm_limits.shmseg, data.shm_limits.shmall);
|
data.shm_limits.shmseg, data.shm_limits.shmall);
|
||||||
@@ -113,7 +114,7 @@ main (int argc, char *argv [])
|
|||||||
for (c = 0; c < PROFILE_COUNT; c++)
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_msg_limits (&data.msg_limits);
|
glibtop_get_msg_limits (&data.msg_limits);
|
||||||
|
|
||||||
printf ("Msg Limits (0x%08lx): %ld, %ld, %ld, %ld, %ld, %ld, %ld\n",
|
printf ("Msg Limits (0x%08Lx): %Lu, %Lu, %Lu, %Lu, %Lu, %Lu, %Lu\n",
|
||||||
data.msg_limits.flags, data.msg_limits.msgpool,
|
data.msg_limits.flags, data.msg_limits.msgpool,
|
||||||
data.msg_limits.msgmap, data.msg_limits.msgmax,
|
data.msg_limits.msgmap, data.msg_limits.msgmax,
|
||||||
data.msg_limits.msgmnb, data.msg_limits.msgmni,
|
data.msg_limits.msgmnb, data.msg_limits.msgmni,
|
||||||
@@ -122,8 +123,8 @@ main (int argc, char *argv [])
|
|||||||
for (c = 0; c < PROFILE_COUNT; c++)
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_sem_limits (&data.sem_limits);
|
glibtop_get_sem_limits (&data.sem_limits);
|
||||||
|
|
||||||
printf ("Sem Limits (0x%08lx): "
|
printf ("Sem Limits (0x%08Lx): "
|
||||||
"%ld, %ld, %ld, %ld, %ld, %ld, %ld, %ld, %ld, %ld\n",
|
"%Lu, %Lu, %Lu, %Lu, %Lu, %Lu, %Lu, %Lu, %Lu, %Lu\n",
|
||||||
data.sem_limits.flags, data.sem_limits.semmap,
|
data.sem_limits.flags, data.sem_limits.semmap,
|
||||||
data.sem_limits.semmni, data.sem_limits.semmns,
|
data.sem_limits.semmni, data.sem_limits.semmns,
|
||||||
data.sem_limits.semmnu, data.sem_limits.semmsl,
|
data.sem_limits.semmnu, data.sem_limits.semmsl,
|
||||||
@@ -135,8 +136,8 @@ main (int argc, char *argv [])
|
|||||||
|
|
||||||
glibtop_get_sysdeps (&sysdeps);
|
glibtop_get_sysdeps (&sysdeps);
|
||||||
|
|
||||||
printf ("Sysdeps (0x%08lx): %lu, %lu, %lu, %lu, %lu, "
|
printf ("Sysdeps (0x%08Lx): %Lu, %Lu, %Lu, %Lu, %Lu, "
|
||||||
"%lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu\n",
|
"%Lu, %Lu, %Lu, %Lu, %Lu, %Lu, %Lu, %Lu, %Lu, %Lu, %Lu\n",
|
||||||
sysdeps.flags, sysdeps.cpu, sysdeps.mem, sysdeps.swap,
|
sysdeps.flags, sysdeps.cpu, sysdeps.mem, sysdeps.swap,
|
||||||
sysdeps.uptime, sysdeps.loadavg, sysdeps.shm_limits,
|
sysdeps.uptime, sysdeps.loadavg, sysdeps.shm_limits,
|
||||||
sysdeps.msg_limits, sysdeps.sem_limits,
|
sysdeps.msg_limits, sysdeps.sem_limits,
|
||||||
@@ -149,7 +150,7 @@ main (int argc, char *argv [])
|
|||||||
|
|
||||||
ptr = glibtop_get_proclist (&data.proclist);
|
ptr = glibtop_get_proclist (&data.proclist);
|
||||||
|
|
||||||
printf ("Proclist (0x%08lx): %ld, %ld, %ld\n",
|
printf ("Proclist (0x%08Lx): %Lu, %Lu, %Lu\n",
|
||||||
data.proclist.flags, data.proclist.number,
|
data.proclist.flags, data.proclist.number,
|
||||||
data.proclist.size, data.proclist.total);
|
data.proclist.size, data.proclist.total);
|
||||||
|
|
||||||
@@ -170,7 +171,7 @@ main (int argc, char *argv [])
|
|||||||
for (c = 0; c < PROFILE_COUNT; c++)
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_state (&data.proc_state, pid);
|
glibtop_get_proc_state (&data.proc_state, pid);
|
||||||
|
|
||||||
printf ("Proc_State PID %5u (0x%08lx): '%s', %c, %u, %u\n",
|
printf ("Proc_State PID %5u (0x%08Lx): '%s', %c, %u, %u\n",
|
||||||
pid, data.proc_state.flags, data.proc_state.cmd,
|
pid, data.proc_state.flags, data.proc_state.cmd,
|
||||||
data.proc_state.state, data.proc_state.uid,
|
data.proc_state.state, data.proc_state.uid,
|
||||||
data.proc_state.gid);
|
data.proc_state.gid);
|
||||||
@@ -178,7 +179,7 @@ main (int argc, char *argv [])
|
|||||||
for (c = 0; c < PROFILE_COUNT; c++)
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_uid (&data.proc_uid, pid);
|
glibtop_get_proc_uid (&data.proc_uid, pid);
|
||||||
|
|
||||||
printf ("Proc_Uid PID %5u (0x%08lx): "
|
printf ("Proc_Uid PID %5u (0x%08Lx): "
|
||||||
"%d %d %d %d %d %d %d %d %d %d %d %d\n",
|
"%d %d %d %d %d %d %d %d %d %d %d %d\n",
|
||||||
pid, data.proc_uid.flags, data.proc_uid.uid,
|
pid, data.proc_uid.flags, data.proc_uid.uid,
|
||||||
data.proc_uid.euid, data.proc_uid.gid,
|
data.proc_uid.euid, data.proc_uid.gid,
|
||||||
@@ -191,8 +192,8 @@ main (int argc, char *argv [])
|
|||||||
for (c = 0; c < PROFILE_COUNT; c++)
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_mem (&data.proc_mem, pid);
|
glibtop_get_proc_mem (&data.proc_mem, pid);
|
||||||
|
|
||||||
printf ("Proc_Mem PID %5u (0x%08lx): "
|
printf ("Proc_Mem PID %5u (0x%08Lx): "
|
||||||
"%ld %ld %ld %ld %ld %ld\n", pid, data.proc_mem.flags,
|
"%Lu %Lu %Lu %Lu %Lu %Lu\n", pid, data.proc_mem.flags,
|
||||||
data.proc_mem.size, data.proc_mem.vsize,
|
data.proc_mem.size, data.proc_mem.vsize,
|
||||||
data.proc_mem.resident, data.proc_mem.share,
|
data.proc_mem.resident, data.proc_mem.share,
|
||||||
data.proc_mem.rss, data.proc_mem.rss_rlim);
|
data.proc_mem.rss, data.proc_mem.rss_rlim);
|
||||||
@@ -200,8 +201,8 @@ main (int argc, char *argv [])
|
|||||||
for (c = 0; c < PROFILE_COUNT; c++)
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_time (&data.proc_time, pid);
|
glibtop_get_proc_time (&data.proc_time, pid);
|
||||||
|
|
||||||
printf ("Proc_Time PID %5u (0x%08lx): "
|
printf ("Proc_Time PID %5u (0x%08Lx): "
|
||||||
"%ld %ld %ld %ld %ld %ld %ld\n", pid, data.proc_time.flags,
|
"%Lu %Lu %Lu %Lu %Lu %Lu %Lu\n", pid, data.proc_time.flags,
|
||||||
data.proc_time.start_time, data.proc_time.utime,
|
data.proc_time.start_time, data.proc_time.utime,
|
||||||
data.proc_time.stime, data.proc_time.cutime,
|
data.proc_time.stime, data.proc_time.cutime,
|
||||||
data.proc_time.cstime, data.proc_time.timeout,
|
data.proc_time.cstime, data.proc_time.timeout,
|
||||||
@@ -210,16 +211,16 @@ main (int argc, char *argv [])
|
|||||||
for (c = 0; c < PROFILE_COUNT; c++)
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_signal (&data.proc_signal, pid);
|
glibtop_get_proc_signal (&data.proc_signal, pid);
|
||||||
|
|
||||||
printf ("Proc_Signal PID %5u (0x%08lx): "
|
printf ("Proc_Signal PID %5u (0x%08Lx): "
|
||||||
"%d %d %d %d\n", pid, data.proc_signal.flags,
|
"%Lu %Lu %Lu %Lu\n", pid, data.proc_signal.flags,
|
||||||
data.proc_signal.signal, data.proc_signal.blocked,
|
data.proc_signal.signal, data.proc_signal.blocked,
|
||||||
data.proc_signal.sigignore, data.proc_signal.sigcatch);
|
data.proc_signal.sigignore, data.proc_signal.sigcatch);
|
||||||
|
|
||||||
for (c = 0; c < PROFILE_COUNT; c++)
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_kernel (&data.proc_kernel, pid);
|
glibtop_get_proc_kernel (&data.proc_kernel, pid);
|
||||||
|
|
||||||
printf ("Proc_Kernel PID %5u (0x%08lx): "
|
printf ("Proc_Kernel PID %5u (0x%08Lx): "
|
||||||
"%lu %lu %lu %lu %lu %lu %lu %lu\n", pid,
|
"%Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu\n", pid,
|
||||||
data.proc_kernel.flags, data.proc_kernel.k_flags,
|
data.proc_kernel.flags, data.proc_kernel.k_flags,
|
||||||
data.proc_kernel.min_flt, data.proc_kernel.maj_flt,
|
data.proc_kernel.min_flt, data.proc_kernel.maj_flt,
|
||||||
data.proc_kernel.cmin_flt, data.proc_kernel.cmaj_flt,
|
data.proc_kernel.cmin_flt, data.proc_kernel.cmaj_flt,
|
||||||
@@ -229,8 +230,8 @@ main (int argc, char *argv [])
|
|||||||
for (c = 0; c < PROFILE_COUNT; c++)
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_segment (&data.proc_segment, pid);
|
glibtop_get_proc_segment (&data.proc_segment, pid);
|
||||||
|
|
||||||
printf ("Proc_Segment PID %5u (0x%08lx): "
|
printf ("Proc_Segment PID %5u (0x%08Lx): "
|
||||||
"%ld %ld %ld %ld %lu %lu %lu\n", pid, data.proc_segment.flags,
|
"%Lu %Lu %Lu %Lu %Lu %Lu %Lu\n", pid, data.proc_segment.flags,
|
||||||
data.proc_segment.trs, data.proc_segment.lrs,
|
data.proc_segment.trs, data.proc_segment.lrs,
|
||||||
data.proc_segment.drs, data.proc_segment.dt,
|
data.proc_segment.drs, data.proc_segment.dt,
|
||||||
data.proc_segment.start_code, data.proc_segment.end_code,
|
data.proc_segment.start_code, data.proc_segment.end_code,
|
||||||
@@ -241,7 +242,7 @@ main (int argc, char *argv [])
|
|||||||
for (c = 0; c < PROFILE_COUNT; c++)
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_state (&data.proc_state, ppid);
|
glibtop_get_proc_state (&data.proc_state, ppid);
|
||||||
|
|
||||||
printf ("Proc_State PPID %5u (0x%08lx): '%s', %c, %u, %u\n",
|
printf ("Proc_State PPID %5u (0x%08Lx): '%s', %c, %u, %u\n",
|
||||||
ppid, data.proc_state.flags, data.proc_state.cmd,
|
ppid, data.proc_state.flags, data.proc_state.cmd,
|
||||||
data.proc_state.state, data.proc_state.uid,
|
data.proc_state.state, data.proc_state.uid,
|
||||||
data.proc_state.gid);
|
data.proc_state.gid);
|
||||||
@@ -249,7 +250,7 @@ main (int argc, char *argv [])
|
|||||||
for (c = 0; c < PROFILE_COUNT; c++)
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_uid (&data.proc_uid, ppid);
|
glibtop_get_proc_uid (&data.proc_uid, ppid);
|
||||||
|
|
||||||
printf ("Proc_Uid PPID %5u (0x%08lx): "
|
printf ("Proc_Uid PPID %5u (0x%08Lx): "
|
||||||
"%d %d %d %d %d %d %d %d %d %d %d %d\n",
|
"%d %d %d %d %d %d %d %d %d %d %d %d\n",
|
||||||
ppid, data.proc_uid.flags, data.proc_uid.uid,
|
ppid, data.proc_uid.flags, data.proc_uid.uid,
|
||||||
data.proc_uid.euid, data.proc_uid.gid,
|
data.proc_uid.euid, data.proc_uid.gid,
|
||||||
@@ -262,8 +263,8 @@ main (int argc, char *argv [])
|
|||||||
for (c = 0; c < PROFILE_COUNT; c++)
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_mem (&data.proc_mem, ppid);
|
glibtop_get_proc_mem (&data.proc_mem, ppid);
|
||||||
|
|
||||||
printf ("Proc_Mem PPID %5u (0x%08lx): "
|
printf ("Proc_Mem PPID %5u (0x%08Lx): "
|
||||||
"%ld %ld %ld %ld %ld %ld\n", ppid, data.proc_mem.flags,
|
"%Lu %Lu %Lu %Lu %Lu %Lu\n", ppid, data.proc_mem.flags,
|
||||||
data.proc_mem.size, data.proc_mem.vsize,
|
data.proc_mem.size, data.proc_mem.vsize,
|
||||||
data.proc_mem.resident, data.proc_mem.share,
|
data.proc_mem.resident, data.proc_mem.share,
|
||||||
data.proc_mem.rss, data.proc_mem.rss_rlim);
|
data.proc_mem.rss, data.proc_mem.rss_rlim);
|
||||||
@@ -271,8 +272,8 @@ main (int argc, char *argv [])
|
|||||||
for (c = 0; c < PROFILE_COUNT; c++)
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_time (&data.proc_time, ppid);
|
glibtop_get_proc_time (&data.proc_time, ppid);
|
||||||
|
|
||||||
printf ("Proc_Time PPID %5u (0x%08lx): "
|
printf ("Proc_Time PPID %5u (0x%08Lx): "
|
||||||
"%ld %ld %ld %ld %ld %ld %ld\n", ppid, data.proc_time.flags,
|
"%Lu %Lu %Lu %Lu %Lu %Lu %Lu\n", ppid, data.proc_time.flags,
|
||||||
data.proc_time.start_time, data.proc_time.utime,
|
data.proc_time.start_time, data.proc_time.utime,
|
||||||
data.proc_time.stime, data.proc_time.cutime,
|
data.proc_time.stime, data.proc_time.cutime,
|
||||||
data.proc_time.cstime, data.proc_time.timeout,
|
data.proc_time.cstime, data.proc_time.timeout,
|
||||||
@@ -281,16 +282,16 @@ main (int argc, char *argv [])
|
|||||||
for (c = 0; c < PROFILE_COUNT; c++)
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_signal (&data.proc_signal, ppid);
|
glibtop_get_proc_signal (&data.proc_signal, ppid);
|
||||||
|
|
||||||
printf ("Proc_Signal PPID %5u (0x%08lx): "
|
printf ("Proc_Signal PPID %5u (0x%08Lx): "
|
||||||
"%d %d %d %d\n", ppid, data.proc_signal.flags,
|
"%Lu %Lu %Lu %Lu\n", ppid, data.proc_signal.flags,
|
||||||
data.proc_signal.signal, data.proc_signal.blocked,
|
data.proc_signal.signal, data.proc_signal.blocked,
|
||||||
data.proc_signal.sigignore, data.proc_signal.sigcatch);
|
data.proc_signal.sigignore, data.proc_signal.sigcatch);
|
||||||
|
|
||||||
for (c = 0; c < PROFILE_COUNT; c++)
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_kernel (&data.proc_kernel, ppid);
|
glibtop_get_proc_kernel (&data.proc_kernel, ppid);
|
||||||
|
|
||||||
printf ("Proc_Kernel PPID %5u (0x%08lx): "
|
printf ("Proc_Kernel PPID %5u (0x%08Lx): "
|
||||||
"%lu %lu %lu %lu %lu %lu %lu %lu\n", ppid,
|
"%Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu\n", ppid,
|
||||||
data.proc_kernel.flags, data.proc_kernel.k_flags,
|
data.proc_kernel.flags, data.proc_kernel.k_flags,
|
||||||
data.proc_kernel.min_flt, data.proc_kernel.maj_flt,
|
data.proc_kernel.min_flt, data.proc_kernel.maj_flt,
|
||||||
data.proc_kernel.cmin_flt, data.proc_kernel.cmaj_flt,
|
data.proc_kernel.cmin_flt, data.proc_kernel.cmaj_flt,
|
||||||
@@ -300,8 +301,8 @@ main (int argc, char *argv [])
|
|||||||
for (c = 0; c < PROFILE_COUNT; c++)
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_segment (&data.proc_segment, ppid);
|
glibtop_get_proc_segment (&data.proc_segment, ppid);
|
||||||
|
|
||||||
printf ("Proc_Segment PPID %5u (0x%08lx): "
|
printf ("Proc_Segment PPID %5u (0x%08Lx): "
|
||||||
"%ld %ld %ld %ld %lu %lu %lu\n", ppid, data.proc_segment.flags,
|
"%Lu %Lu %Lu %Lu %Lu %Lu %Lu\n", ppid, data.proc_segment.flags,
|
||||||
data.proc_segment.trs, data.proc_segment.lrs,
|
data.proc_segment.trs, data.proc_segment.lrs,
|
||||||
data.proc_segment.drs, data.proc_segment.dt,
|
data.proc_segment.drs, data.proc_segment.dt,
|
||||||
data.proc_segment.start_code, data.proc_segment.end_code,
|
data.proc_segment.start_code, data.proc_segment.end_code,
|
||||||
@@ -312,7 +313,7 @@ main (int argc, char *argv [])
|
|||||||
for (c = 0; c < PROFILE_COUNT; c++)
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_state (&data.proc_state, 1);
|
glibtop_get_proc_state (&data.proc_state, 1);
|
||||||
|
|
||||||
printf ("Proc_State INIT %5u (0x%08lx): '%s', %c, %u, %u\n",
|
printf ("Proc_State INIT %5u (0x%08Lx): '%s', %c, %u, %u\n",
|
||||||
1, data.proc_state.flags, data.proc_state.cmd,
|
1, data.proc_state.flags, data.proc_state.cmd,
|
||||||
data.proc_state.state, data.proc_state.uid,
|
data.proc_state.state, data.proc_state.uid,
|
||||||
data.proc_state.gid);
|
data.proc_state.gid);
|
||||||
@@ -320,7 +321,7 @@ main (int argc, char *argv [])
|
|||||||
for (c = 0; c < PROFILE_COUNT; c++)
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_uid (&data.proc_uid, 1);
|
glibtop_get_proc_uid (&data.proc_uid, 1);
|
||||||
|
|
||||||
printf ("Proc_Uid INIT %5u (0x%08lx): "
|
printf ("Proc_Uid INIT %5u (0x%08Lx): "
|
||||||
"%d %d %d %d %d %d %d %d %d %d %d %d\n",
|
"%d %d %d %d %d %d %d %d %d %d %d %d\n",
|
||||||
1, data.proc_uid.flags, data.proc_uid.uid,
|
1, data.proc_uid.flags, data.proc_uid.uid,
|
||||||
data.proc_uid.euid, data.proc_uid.gid,
|
data.proc_uid.euid, data.proc_uid.gid,
|
||||||
@@ -333,8 +334,8 @@ main (int argc, char *argv [])
|
|||||||
for (c = 0; c < PROFILE_COUNT; c++)
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_mem (&data.proc_mem, 1);
|
glibtop_get_proc_mem (&data.proc_mem, 1);
|
||||||
|
|
||||||
printf ("Proc_Mem INIT %5u (0x%08lx): "
|
printf ("Proc_Mem INIT %5u (0x%08Lx): "
|
||||||
"%ld %ld %ld %ld %ld %ld\n", 1, data.proc_mem.flags,
|
"%Lu %Lu %Lu %Lu %Lu %Lu\n", 1, data.proc_mem.flags,
|
||||||
data.proc_mem.size, data.proc_mem.vsize,
|
data.proc_mem.size, data.proc_mem.vsize,
|
||||||
data.proc_mem.resident, data.proc_mem.share,
|
data.proc_mem.resident, data.proc_mem.share,
|
||||||
data.proc_mem.rss, data.proc_mem.rss_rlim);
|
data.proc_mem.rss, data.proc_mem.rss_rlim);
|
||||||
@@ -342,8 +343,8 @@ main (int argc, char *argv [])
|
|||||||
for (c = 0; c < PROFILE_COUNT; c++)
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_time (&data.proc_time, 1);
|
glibtop_get_proc_time (&data.proc_time, 1);
|
||||||
|
|
||||||
printf ("Proc_Time INIT %5u (0x%08lx): "
|
printf ("Proc_Time INIT %5u (0x%08Lx): "
|
||||||
"%ld %ld %ld %ld %ld %ld %ld\n", 1, data.proc_time.flags,
|
"%Lu %Lu %Lu %Lu %Lu %Lu %Lu\n", 1, data.proc_time.flags,
|
||||||
data.proc_time.start_time, data.proc_time.utime,
|
data.proc_time.start_time, data.proc_time.utime,
|
||||||
data.proc_time.stime, data.proc_time.cutime,
|
data.proc_time.stime, data.proc_time.cutime,
|
||||||
data.proc_time.cstime, data.proc_time.timeout,
|
data.proc_time.cstime, data.proc_time.timeout,
|
||||||
@@ -352,16 +353,16 @@ main (int argc, char *argv [])
|
|||||||
for (c = 0; c < PROFILE_COUNT; c++)
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_signal (&data.proc_signal, 1);
|
glibtop_get_proc_signal (&data.proc_signal, 1);
|
||||||
|
|
||||||
printf ("Proc_Signal INIT %5u (0x%08lx): "
|
printf ("Proc_Signal INIT %5u (0x%08Lx): "
|
||||||
"%d %d %d %d\n", 1, data.proc_signal.flags,
|
"%Lu %Lu %Lu %Lu\n", 1, data.proc_signal.flags,
|
||||||
data.proc_signal.signal, data.proc_signal.blocked,
|
data.proc_signal.signal, data.proc_signal.blocked,
|
||||||
data.proc_signal.sigignore, data.proc_signal.sigcatch);
|
data.proc_signal.sigignore, data.proc_signal.sigcatch);
|
||||||
|
|
||||||
for (c = 0; c < PROFILE_COUNT; c++)
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_kernel (&data.proc_kernel, 1);
|
glibtop_get_proc_kernel (&data.proc_kernel, 1);
|
||||||
|
|
||||||
printf ("Proc_Kernel INIT %5u (0x%08lx): "
|
printf ("Proc_Kernel INIT %5u (0x%08Lx): "
|
||||||
"%lu %lu %lu %lu %lu %lu %lu %lu\n", 1,
|
"%Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu\n", 1,
|
||||||
data.proc_kernel.flags, data.proc_kernel.k_flags,
|
data.proc_kernel.flags, data.proc_kernel.k_flags,
|
||||||
data.proc_kernel.min_flt, data.proc_kernel.maj_flt,
|
data.proc_kernel.min_flt, data.proc_kernel.maj_flt,
|
||||||
data.proc_kernel.cmin_flt, data.proc_kernel.cmaj_flt,
|
data.proc_kernel.cmin_flt, data.proc_kernel.cmaj_flt,
|
||||||
@@ -371,8 +372,8 @@ main (int argc, char *argv [])
|
|||||||
for (c = 0; c < PROFILE_COUNT; c++)
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_segment (&data.proc_segment, 1);
|
glibtop_get_proc_segment (&data.proc_segment, 1);
|
||||||
|
|
||||||
printf ("Proc_Segment INIT %5u (0x%08lx): "
|
printf ("Proc_Segment INIT %5u (0x%08Lx): "
|
||||||
"%ld %ld %ld %ld %lu %lu %lu\n", 1, data.proc_segment.flags,
|
"%Lu %Lu %Lu %Lu %Lu %Lu %Lu\n", 1, data.proc_segment.flags,
|
||||||
data.proc_segment.trs, data.proc_segment.lrs,
|
data.proc_segment.trs, data.proc_segment.lrs,
|
||||||
data.proc_segment.drs, data.proc_segment.dt,
|
data.proc_segment.drs, data.proc_segment.dt,
|
||||||
data.proc_segment.start_code, data.proc_segment.end_code,
|
data.proc_segment.start_code, data.proc_segment.end_code,
|
||||||
|
111
examples/mountlist.c
Normal file
111
examples/mountlist.c
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
/* $Id$ */
|
||||||
|
|
||||||
|
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
|
This file is part of the Gnome Top Library.
|
||||||
|
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||||
|
|
||||||
|
The Gnome Top Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The Gnome Top Library 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
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#include <locale.h>
|
||||||
|
|
||||||
|
#include <glibtop.h>
|
||||||
|
#include <glibtop/open.h>
|
||||||
|
#include <glibtop/close.h>
|
||||||
|
#include <glibtop/xmalloc.h>
|
||||||
|
|
||||||
|
#include <glibtop/parameter.h>
|
||||||
|
|
||||||
|
#include <glibtop/mountlist.h>
|
||||||
|
#include <glibtop/fsusage.h>
|
||||||
|
|
||||||
|
#ifndef PROFILE_COUNT
|
||||||
|
#define PROFILE_COUNT 1000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int
|
||||||
|
main (int argc, char *argv [])
|
||||||
|
{
|
||||||
|
glibtop_fsusage fsusage;
|
||||||
|
glibtop_mountlist mount_list;
|
||||||
|
glibtop_mountentry *mount_entries;
|
||||||
|
unsigned c, index, method, count, port;
|
||||||
|
char buffer [BUFSIZ];
|
||||||
|
|
||||||
|
setlocale (LC_ALL, "");
|
||||||
|
bindtextdomain (PACKAGE, GTOPLOCALEDIR);
|
||||||
|
textdomain (PACKAGE);
|
||||||
|
|
||||||
|
glibtop_init_r (&glibtop_global_server, 0, GLIBTOP_INIT_NO_OPEN);
|
||||||
|
|
||||||
|
glibtop_get_parameter (GLIBTOP_PARAM_METHOD, &method, sizeof (method));
|
||||||
|
|
||||||
|
printf ("Method = %d\n", method);
|
||||||
|
|
||||||
|
count = glibtop_get_parameter (GLIBTOP_PARAM_COMMAND, buffer, BUFSIZ);
|
||||||
|
buffer [count] = 0;
|
||||||
|
|
||||||
|
printf ("Command = '%s'\n", buffer);
|
||||||
|
|
||||||
|
count = glibtop_get_parameter (GLIBTOP_PARAM_HOST, buffer, BUFSIZ);
|
||||||
|
buffer [count] = 0;
|
||||||
|
|
||||||
|
glibtop_get_parameter (GLIBTOP_PARAM_PORT, &port, sizeof (port));
|
||||||
|
|
||||||
|
printf ("Host = '%s' - %u\n\n", buffer, port);
|
||||||
|
|
||||||
|
printf ("sbrk (0) = %p\n\n", sbrk (0));
|
||||||
|
|
||||||
|
for (c = 0; c < PROFILE_COUNT; c++) {
|
||||||
|
mount_entries = glibtop_get_mountlist (&mount_list, 1);
|
||||||
|
|
||||||
|
glibtop_free (mount_entries);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf ("sbrk (0) = %p\n\n", sbrk (0));
|
||||||
|
|
||||||
|
mount_entries = glibtop_get_mountlist (&mount_list, 1);
|
||||||
|
|
||||||
|
if (mount_entries == NULL)
|
||||||
|
_exit (1);
|
||||||
|
|
||||||
|
for (index = 0; index < mount_list.number; index++)
|
||||||
|
printf ("Mount_Entry: %-30s %-10s %-20s\n",
|
||||||
|
mount_entries [index].mountdir,
|
||||||
|
mount_entries [index].type,
|
||||||
|
mount_entries [index].devname);
|
||||||
|
|
||||||
|
printf ("\n\n%-23s %9s %9s %9s %9s %9s\n\n",
|
||||||
|
"", "Blocks", "Free", "Avail", "Files", "Free");
|
||||||
|
|
||||||
|
for (index = 0; index < mount_list.number; index++) {
|
||||||
|
glibtop_get_fsusage (&fsusage,
|
||||||
|
mount_entries [index].mountdir);
|
||||||
|
|
||||||
|
printf ("Usage: %-16s %9Lu %9Lu %9Lu %9Lu %9Lu\n",
|
||||||
|
mount_entries [index].mountdir,
|
||||||
|
fsusage.blocks, fsusage.bfree,
|
||||||
|
fsusage.bavail, fsusage.files,
|
||||||
|
fsusage.ffree);
|
||||||
|
}
|
||||||
|
|
||||||
|
glibtop_free (mount_entries);
|
||||||
|
|
||||||
|
printf ("\nsbrk (0) = %p\n\n", sbrk (0));
|
||||||
|
|
||||||
|
glibtop_close ();
|
||||||
|
|
||||||
|
exit (0);
|
||||||
|
}
|
@@ -45,8 +45,8 @@ main (int argc, char *argv [])
|
|||||||
|
|
||||||
glibtop_get_sysdeps (&sysdeps);
|
glibtop_get_sysdeps (&sysdeps);
|
||||||
|
|
||||||
fprintf (stderr, "Sysdeps (0x%08lx): %lu, %lu, %lu, %lu, %lu, "
|
fprintf (stderr, "Sysdeps (0x%08Lx): %Lu, %Lu, %Lu, %Lu, %Lu, "
|
||||||
"%lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu, %lu\n",
|
"%Lu, %Lu, %Lu, %Lu, %Lu, %Lu, %Lu, %Lu, %Lu, %Lu, %Lu\n",
|
||||||
sysdeps.flags, sysdeps.cpu, sysdeps.mem, sysdeps.swap,
|
sysdeps.flags, sysdeps.cpu, sysdeps.mem, sysdeps.swap,
|
||||||
sysdeps.uptime, sysdeps.loadavg, sysdeps.shm_limits,
|
sysdeps.uptime, sysdeps.loadavg, sysdeps.shm_limits,
|
||||||
sysdeps.msg_limits, sysdeps.sem_limits,
|
sysdeps.msg_limits, sysdeps.sem_limits,
|
||||||
@@ -59,7 +59,7 @@ main (int argc, char *argv [])
|
|||||||
|
|
||||||
ptr = glibtop_get_proclist (&proclist);
|
ptr = glibtop_get_proclist (&proclist);
|
||||||
|
|
||||||
fprintf (stderr, "Proclist (0x%08lx): %ld, %ld, %ld\n",
|
fprintf (stderr, "Proclist (0x%08Lx): %Ld, %Ld, %Ld\n",
|
||||||
proclist.flags, proclist.number, proclist.size,
|
proclist.flags, proclist.number, proclist.size,
|
||||||
proclist.total);
|
proclist.total);
|
||||||
|
|
||||||
@@ -73,14 +73,14 @@ main (int argc, char *argv [])
|
|||||||
|
|
||||||
glibtop_get_proc_state (&data.proc_state, pid);
|
glibtop_get_proc_state (&data.proc_state, pid);
|
||||||
|
|
||||||
fprintf (stderr, "Proc_State PID %5u (0x%08lx): "
|
fprintf (stderr, "Proc_State PID %5u (0x%08Lx): "
|
||||||
"'%s', %c, %u, %u\n", pid, data.proc_state.flags,
|
"'%s', %c, %u, %u\n", pid, data.proc_state.flags,
|
||||||
data.proc_state.cmd, data.proc_state.state,
|
data.proc_state.cmd, data.proc_state.state,
|
||||||
data.proc_state.uid, data.proc_state.gid);
|
data.proc_state.uid, data.proc_state.gid);
|
||||||
|
|
||||||
glibtop_get_proc_uid (&data.proc_uid, pid);
|
glibtop_get_proc_uid (&data.proc_uid, pid);
|
||||||
|
|
||||||
fprintf (stderr, "Proc_Uid PID %5u (0x%08lx): "
|
fprintf (stderr, "Proc_Uid PID %5u (0x%08Lx): "
|
||||||
"%d %d %d %d %d %d %d %d %d %d %d %d\n",
|
"%d %d %d %d %d %d %d %d %d %d %d %d\n",
|
||||||
pid, data.proc_uid.flags, data.proc_uid.uid,
|
pid, data.proc_uid.flags, data.proc_uid.uid,
|
||||||
data.proc_uid.euid, data.proc_uid.gid,
|
data.proc_uid.euid, data.proc_uid.gid,
|
||||||
@@ -92,16 +92,16 @@ main (int argc, char *argv [])
|
|||||||
|
|
||||||
glibtop_get_proc_mem (&data.proc_mem, pid);
|
glibtop_get_proc_mem (&data.proc_mem, pid);
|
||||||
|
|
||||||
fprintf (stderr, "Proc_Mem PID %5u (0x%08lx): "
|
fprintf (stderr, "Proc_Mem PID %5u (0x%08Lx): "
|
||||||
"%ld %ld %ld %ld %ld %ld\n", pid, data.proc_mem.flags,
|
"%Ld %Ld %Ld %Ld %Ld %Ld\n", pid, data.proc_mem.flags,
|
||||||
data.proc_mem.size, data.proc_mem.vsize,
|
data.proc_mem.size, data.proc_mem.vsize,
|
||||||
data.proc_mem.resident, data.proc_mem.share,
|
data.proc_mem.resident, data.proc_mem.share,
|
||||||
data.proc_mem.rss, data.proc_mem.rss_rlim);
|
data.proc_mem.rss, data.proc_mem.rss_rlim);
|
||||||
|
|
||||||
glibtop_get_proc_time (&data.proc_time, pid);
|
glibtop_get_proc_time (&data.proc_time, pid);
|
||||||
|
|
||||||
fprintf (stderr, "Proc_Time PID %5u (0x%08lx): "
|
fprintf (stderr, "Proc_Time PID %5u (0x%08Lx): "
|
||||||
"%ld %ld %ld %ld %ld %ld %ld\n", pid, data.proc_time.flags,
|
"%Ld %Ld %Ld %Ld %Ld %Ld %Ld\n", pid, data.proc_time.flags,
|
||||||
data.proc_time.start_time, data.proc_time.utime,
|
data.proc_time.start_time, data.proc_time.utime,
|
||||||
data.proc_time.stime, data.proc_time.cutime,
|
data.proc_time.stime, data.proc_time.cutime,
|
||||||
data.proc_time.cstime, data.proc_time.timeout,
|
data.proc_time.cstime, data.proc_time.timeout,
|
||||||
@@ -109,15 +109,15 @@ main (int argc, char *argv [])
|
|||||||
|
|
||||||
glibtop_get_proc_signal (&data.proc_signal, pid);
|
glibtop_get_proc_signal (&data.proc_signal, pid);
|
||||||
|
|
||||||
fprintf (stderr, "Proc_Signal PID %5u (0x%08lx): "
|
fprintf (stderr, "Proc_Signal PID %5u (0x%08Lx): "
|
||||||
"%d %d %d %d\n", pid, data.proc_signal.flags,
|
"%Lu %Lu %Lu %Lu\n", pid, data.proc_signal.flags,
|
||||||
data.proc_signal.signal, data.proc_signal.blocked,
|
data.proc_signal.signal, data.proc_signal.blocked,
|
||||||
data.proc_signal.sigignore, data.proc_signal.sigcatch);
|
data.proc_signal.sigignore, data.proc_signal.sigcatch);
|
||||||
|
|
||||||
glibtop_get_proc_kernel (&data.proc_kernel, pid);
|
glibtop_get_proc_kernel (&data.proc_kernel, pid);
|
||||||
|
|
||||||
fprintf (stderr, "Proc_Kernel PID %5u (0x%08lx): "
|
fprintf (stderr, "Proc_Kernel PID %5u (0x%08Lx): "
|
||||||
"%lu %lu %lu %lu %lu %lu %lu %lu\n", pid,
|
"%Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu\n", pid,
|
||||||
data.proc_kernel.flags, data.proc_kernel.k_flags,
|
data.proc_kernel.flags, data.proc_kernel.k_flags,
|
||||||
data.proc_kernel.min_flt, data.proc_kernel.maj_flt,
|
data.proc_kernel.min_flt, data.proc_kernel.maj_flt,
|
||||||
data.proc_kernel.cmin_flt, data.proc_kernel.cmaj_flt,
|
data.proc_kernel.cmin_flt, data.proc_kernel.cmaj_flt,
|
||||||
@@ -126,8 +126,8 @@ main (int argc, char *argv [])
|
|||||||
|
|
||||||
glibtop_get_proc_segment (&data.proc_segment, pid);
|
glibtop_get_proc_segment (&data.proc_segment, pid);
|
||||||
|
|
||||||
fprintf (stderr, "Proc_Segment PID %5u (0x%08lx): "
|
fprintf (stderr, "Proc_Segment PID %5u (0x%08Lx): "
|
||||||
"%ld %ld %ld %ld %lu %lu %lu\n", pid, data.proc_segment.flags,
|
"%Ld %Ld %Ld %Ld %Lu %Lu %Lu\n", pid, data.proc_segment.flags,
|
||||||
data.proc_segment.trs, data.proc_segment.lrs,
|
data.proc_segment.trs, data.proc_segment.lrs,
|
||||||
data.proc_segment.drs, data.proc_segment.dt,
|
data.proc_segment.drs, data.proc_segment.dt,
|
||||||
data.proc_segment.start_code, data.proc_segment.end_code,
|
data.proc_segment.start_code, data.proc_segment.end_code,
|
||||||
|
34
features.def
34
features.def
@@ -1,16 +1,18 @@
|
|||||||
cpu ulong(total,user,nice,sys,idle,frequency)
|
void|cpu|ulong(total,user,nice,sys,idle,frequency)
|
||||||
mem ulong(total,used,free,shared,buffer,cached,user,locked)
|
void|mem|ulong(total,used,free,shared,buffer,cached,user,locked)
|
||||||
swap ulong(total,used,free)
|
void|swap|ulong(total,used,free,pagein,pageout)
|
||||||
uptime double(uptime,idletime)
|
void|uptime|double(uptime,idletime)
|
||||||
loadavg double(loadavg[0],loadavg[1],loadavg[2])
|
void|loadavg|double(loadavg[0],loadavg[1],loadavg[2])
|
||||||
shm_limits ulong(shmmax,shmmin,shmmni,shmseg,shmall)
|
void|shm_limits|ulong(shmmax,shmmin,shmmni,shmseg,shmall)
|
||||||
msg_limits ulong(msgpool,msgmap,msgmax,msgmnb,msgmni,msgssz,msgtql)
|
void|msg_limits|ulong(msgpool,msgmap,msgmax,msgmnb,msgmni,msgssz,msgtql)
|
||||||
sem_limits ulong(semmap,semmni,semmns,semmnu,semmsl,semopm,semume,semusz,semvmx,semaem)
|
void|sem_limits|ulong(semmap,semmni,semmns,semmnu,semmsl,semopm,semume,semusz,semvmx,semaem)
|
||||||
proclist ulong(number,size,total)
|
unsigned *|proclist|ulong(number,size,total)
|
||||||
proc_state str(cmd):char(state):ulong(uid,gid)
|
void|proc_state|str(cmd):char(state):ulong(uid,gid)|pid_t|pid
|
||||||
proc_uid long(uid,euid,gid,egid,pid,ppid,pgrp,session,tty,tpgid,priority,nice)
|
void|proc_uid|long(uid,euid,gid,egid,pid,ppid,pgrp,session,tty,tpgid,priority,nice)|pid_t|pid
|
||||||
proc_mem long(size,vsize,resident,share,rss,rss_rlim)
|
void|proc_mem|long(size,vsize,resident,share,rss,rss_rlim)|pid_t|pid
|
||||||
proc_time long(start_time,utime,stime,cutime,cstime,timeout,it_real_value)
|
void|proc_time|long(start_time,utime,stime,cutime,cstime,timeout,it_real_value)|pid_t|pid
|
||||||
proc_signal long(signal,blocked,sigignore,sigcatch)
|
void|proc_signal|ulong(signal,blocked,sigignore,sigcatch)|pid_t|pid
|
||||||
proc_kernel ulong(k_flags,min_flt,maj_flt,cmin_flt,cmaj_flt,kstk_esp,kstk_eip,wchan)
|
void|proc_kernel|ulong(k_flags,min_flt,maj_flt,cmin_flt,cmaj_flt,kstk_esp,kstk_eip,wchan)|pid_t|pid
|
||||||
proc_segment long(trs,lrs,drs,dt):ulong(start_code,end_code,start_stack)
|
void|proc_segment|long(trs,lrs,drs,dt):ulong(start_code,end_code,start_stack)|pid_t|pid
|
||||||
|
glibtop_mountentry *|@mountlist|ulong(number,size,total)|int|all_fs
|
||||||
|
void|@fsusage|ulong(blocks,bfree,bavail,files,ffree)|const char *|mount_dir|strlen (mount_dir) + 1
|
||||||
|
@@ -63,8 +63,9 @@ extern const unsigned long glibtop_server_features;
|
|||||||
#define glibtop_close() glibtop_close_r(glibtop_global_server);
|
#define glibtop_close() glibtop_close_r(glibtop_global_server);
|
||||||
|
|
||||||
extern glibtop *glibtop_init_r __P((glibtop **, const unsigned long, const unsigned));
|
extern glibtop *glibtop_init_r __P((glibtop **, const unsigned long, const unsigned));
|
||||||
|
extern glibtop *glibtop_init_s __P((glibtop **, const unsigned long, const unsigned));
|
||||||
|
|
||||||
#ifdef HAVE_GUILE
|
#ifdef GLIBTOP_GUILE
|
||||||
|
|
||||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||||
|
|
||||||
|
@@ -1 +1,3 @@
|
|||||||
reference.sgml
|
reference.sgml
|
||||||
|
Makefile.in
|
||||||
|
Makefile
|
||||||
|
9
guile/ChangeLog
Normal file
9
guile/ChangeLog
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
1998-07-29 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
|
* dynamic.c, dynamic_names.c: New files.
|
||||||
|
|
||||||
|
* Makefile.am: New file. Creates `libgtop.so' and
|
||||||
|
`libnames.so' which will be installed in
|
||||||
|
`$(datadir)/guile/libgtop'; just do a
|
||||||
|
`(use-modules (libgtop libgtop) (libgtop names))' in
|
||||||
|
guile to use them.
|
51
guile/Makefile.am
Normal file
51
guile/Makefile.am
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
|
||||||
|
|
||||||
|
CFLAGS = -Wall -W @CFLAGS@
|
||||||
|
|
||||||
|
sitedir = $(datadir)/guile/site
|
||||||
|
libgtopmoduledir = $(datadir)/guile/libgtop
|
||||||
|
|
||||||
|
libgtopmodule_LTLIBRARIES = libgtop.la libnames.la
|
||||||
|
|
||||||
|
libgtop_la_SOURCES = dynamic.c
|
||||||
|
|
||||||
|
libnames_la_SOURCES = dynamic_names.c
|
||||||
|
|
||||||
|
libgtop_la_LIBADD = ../sysdeps/guile/guile.lo \
|
||||||
|
../lib/init.lo \
|
||||||
|
../lib/open.lo \
|
||||||
|
../lib/close.lo \
|
||||||
|
../lib/command.lo \
|
||||||
|
../lib/read.lo \
|
||||||
|
../lib/read_data.lo \
|
||||||
|
../lib/write.lo \
|
||||||
|
../lib/lib.lo \
|
||||||
|
../lib/parameter.lo \
|
||||||
|
../lib/sysdeps.lo \
|
||||||
|
../sysdeps/common/error.lo \
|
||||||
|
../sysdeps/common/fsusage.lo \
|
||||||
|
../sysdeps/common/gnuslib.lo \
|
||||||
|
../sysdeps/common/mountlist.lo \
|
||||||
|
../sysdeps/common/xmalloc.lo \
|
||||||
|
../sysdeps/@sysdeps_dir@/close.lo \
|
||||||
|
../sysdeps/@sysdeps_dir@/proclist.lo \
|
||||||
|
../sysdeps/@sysdeps_dir@/sem_limits.lo \
|
||||||
|
../sysdeps/@sysdeps_dir@/cpu.lo \
|
||||||
|
../sysdeps/@sysdeps_dir@/procmem.lo \
|
||||||
|
../sysdeps/@sysdeps_dir@/shm_limits.lo \
|
||||||
|
../sysdeps/@sysdeps_dir@/loadavg.lo \
|
||||||
|
../sysdeps/@sysdeps_dir@/procsegment.lo \
|
||||||
|
../sysdeps/@sysdeps_dir@/siglist.lo \
|
||||||
|
../sysdeps/@sysdeps_dir@/mem.lo \
|
||||||
|
../sysdeps/@sysdeps_dir@/procsignal.lo \
|
||||||
|
../sysdeps/@sysdeps_dir@/swap.lo \
|
||||||
|
../sysdeps/@sysdeps_dir@/msg_limits.lo \
|
||||||
|
../sysdeps/@sysdeps_dir@/procstate.lo \
|
||||||
|
../sysdeps/@sysdeps_dir@/uptime.lo \
|
||||||
|
../sysdeps/@sysdeps_dir@/open.lo \
|
||||||
|
../sysdeps/@sysdeps_dir@/proctime.lo \
|
||||||
|
../sysdeps/@sysdeps_dir@/prockernel.lo \
|
||||||
|
../sysdeps/@sysdeps_dir@/procuid.lo
|
||||||
|
|
||||||
|
libnames_la_LIBADD = ../sysdeps/guile/names/guile-names.lo
|
||||||
|
|
@@ -19,13 +19,11 @@
|
|||||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Boston, MA 02111-1307, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <glibtop/output.h>
|
#include <glibtop.h>
|
||||||
|
#include <libguile/dynl.h>
|
||||||
|
|
||||||
void
|
void
|
||||||
glibtop_output (size_t size, const void *buf)
|
scm_init_libgtop_libgtop_module (void)
|
||||||
{
|
{
|
||||||
if (write (1, &size, sizeof (size_t)) < 0)
|
scm_register_module_xxx ("libgtop libgtop", glibtop_boot_guile);
|
||||||
_exit (2);
|
|
||||||
if (write (1, buf, size) < 0)
|
|
||||||
_exit (2);
|
|
||||||
}
|
}
|
@@ -19,13 +19,11 @@
|
|||||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Boston, MA 02111-1307, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <glibtop/version.h>
|
#include <glibtop.h>
|
||||||
|
#include <libguile/dynl.h>
|
||||||
|
|
||||||
void
|
void
|
||||||
glibtop_version (void)
|
scm_init_libgtop_names_module (void)
|
||||||
{
|
{
|
||||||
char buffer [BUFSIZ];
|
scm_register_module_xxx ("libgtop names", glibtop_boot_guile_names);
|
||||||
|
|
||||||
sprintf (buffer, "%s server %s ready.\n", PACKAGE, VERSION);
|
|
||||||
glibtop_output (strlen (buffer), buffer);
|
|
||||||
}
|
}
|
@@ -6,4 +6,4 @@ glibtop_HEADERS = close.h loadavg.h prockernel.h procstate.h \
|
|||||||
procmem.h procuid.h swap.h write.h error.h open.h \
|
procmem.h procuid.h swap.h write.h error.h open.h \
|
||||||
procsegment.h read.h sysdeps.h xmalloc.h global.h \
|
procsegment.h read.h sysdeps.h xmalloc.h global.h \
|
||||||
output.h procsignal.h read_data.h union.h types.h \
|
output.h procsignal.h read_data.h union.h types.h \
|
||||||
parameter.h
|
parameter.h mountlist.h fsusage.h
|
||||||
|
@@ -28,6 +28,9 @@ __BEGIN_DECLS
|
|||||||
|
|
||||||
extern void glibtop_close_r __P((glibtop *));
|
extern void glibtop_close_r __P((glibtop *));
|
||||||
|
|
||||||
|
extern void glibtop_close_s __P((glibtop *));
|
||||||
|
extern void glibtop_close_p __P((glibtop *));
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -48,7 +48,10 @@ __BEGIN_DECLS
|
|||||||
#define GLIBTOP_CMND_PROC_KERNEL 16
|
#define GLIBTOP_CMND_PROC_KERNEL 16
|
||||||
#define GLIBTOP_CMND_PROC_SEGMENT 17
|
#define GLIBTOP_CMND_PROC_SEGMENT 17
|
||||||
|
|
||||||
#define GLIBTOP_MAX_CMND 18
|
#define GLIBTOP_CMND_MOUNTLIST 18
|
||||||
|
#define GLIBTOP_CMND_FSUSAGE 19
|
||||||
|
|
||||||
|
#define GLIBTOP_MAX_CMND 20
|
||||||
|
|
||||||
#define _GLIBTOP_PARAM_SIZE 16
|
#define _GLIBTOP_PARAM_SIZE 16
|
||||||
|
|
||||||
@@ -59,9 +62,8 @@ typedef union _glibtop_response_union glibtop_response_union;
|
|||||||
|
|
||||||
struct _glibtop_command
|
struct _glibtop_command
|
||||||
{
|
{
|
||||||
glibtop server;
|
u_int64_t command;
|
||||||
unsigned command;
|
u_int64_t size, data_size;
|
||||||
size_t size, data_size;
|
|
||||||
char parameter [_GLIBTOP_PARAM_SIZE];
|
char parameter [_GLIBTOP_PARAM_SIZE];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -73,8 +75,8 @@ union _glibtop_response_union
|
|||||||
|
|
||||||
struct _glibtop_response
|
struct _glibtop_response
|
||||||
{
|
{
|
||||||
off_t offset;
|
int64_t offset;
|
||||||
size_t size, data_size;
|
u_int64_t size, data_size;
|
||||||
glibtop_response_union u;
|
glibtop_response_union u;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -40,7 +40,7 @@ typedef struct _glibtop_cpu glibtop_cpu;
|
|||||||
|
|
||||||
struct _glibtop_cpu
|
struct _glibtop_cpu
|
||||||
{
|
{
|
||||||
unsigned long flags,
|
u_int64_t flags,
|
||||||
total, /* GLIBTOP_CPU_TOTAL */
|
total, /* GLIBTOP_CPU_TOTAL */
|
||||||
user, /* GLIBTOP_CPU_USER */
|
user, /* GLIBTOP_CPU_USER */
|
||||||
nice, /* GLIBTOP_CPU_NICE */
|
nice, /* GLIBTOP_CPU_NICE */
|
||||||
@@ -65,7 +65,7 @@ extern void glibtop_get_cpu_p __P((glibtop *, glibtop_cpu *));
|
|||||||
extern void glibtop_get_cpu_s __P((glibtop *, glibtop_cpu *));
|
extern void glibtop_get_cpu_s __P((glibtop *, glibtop_cpu *));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GUILE
|
#ifdef GLIBTOP_GUILE
|
||||||
|
|
||||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||||
|
|
||||||
|
90
include/glibtop/fsusage.h
Normal file
90
include/glibtop/fsusage.h
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
/* $Id$ */
|
||||||
|
|
||||||
|
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
|
This file is part of the Gnome Top Library.
|
||||||
|
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||||
|
|
||||||
|
The Gnome Top Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The Gnome Top Library 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
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#ifndef __GLIBTOP_FSUSAGE_H__
|
||||||
|
#define __GLIBTOP_FSUSAGE_H__
|
||||||
|
|
||||||
|
#include <glibtop.h>
|
||||||
|
#include <glibtop/global.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define GLIBTOP_FSUSAGE_BLOCKS 0
|
||||||
|
#define GLIBTOP_FSUSAGE_BFREE 1
|
||||||
|
#define GLIBTOP_FSUSAGE_BAVAIL 2
|
||||||
|
#define GLIBTOP_FSUSAGE_FILES 3
|
||||||
|
#define GLIBTOP_FSUSAGE_FFREE 4
|
||||||
|
|
||||||
|
#define GLIBTOP_MAX_FSUSAGE 5
|
||||||
|
|
||||||
|
typedef struct _glibtop_fsusage glibtop_fsusage;
|
||||||
|
|
||||||
|
struct _glibtop_fsusage
|
||||||
|
{
|
||||||
|
u_int64_t flags,
|
||||||
|
blocks, /* Total blocks. */
|
||||||
|
bfree, /* Free blocks available to superuser. */
|
||||||
|
bavail, /* Free blocks available to non-superuser. */
|
||||||
|
files, /* Total file nodes. */
|
||||||
|
ffree; /* Free file nodes. */
|
||||||
|
};
|
||||||
|
|
||||||
|
#define glibtop_get_fsusage(fsusage,disk) glibtop_get_fsusage_l(glibtop_global_server, fsusage, disk)
|
||||||
|
|
||||||
|
#define glibtop_get_fsusage_r glibtop_get_fsusage_s
|
||||||
|
|
||||||
|
extern void glibtop_get_fsusage_l __P((glibtop *, glibtop_fsusage *, const char *));
|
||||||
|
|
||||||
|
extern void glibtop_get_fsusage_s __P((glibtop *, glibtop_fsusage *, const char *));
|
||||||
|
|
||||||
|
#ifdef GLIBTOP_GUILE
|
||||||
|
|
||||||
|
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||||
|
|
||||||
|
extern SCM glibtop_guile_get_fsusage __P((SCM));
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GLIBTOP_GUILE_NAMES
|
||||||
|
|
||||||
|
/* You need to link with -lgtop_guile_names to get this stuff here. */
|
||||||
|
|
||||||
|
extern SCM glibtop_guile_names_fsusage __P((void));
|
||||||
|
extern SCM glibtop_guile_types_fsusage __P((void));
|
||||||
|
extern SCM glibtop_guile_labels_fsusage __P((void));
|
||||||
|
extern SCM glibtop_guile_descriptions_fsusage __P((void));
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GLIBTOP_NAMES
|
||||||
|
|
||||||
|
/* You need to link with -lgtop_names to get this stuff here. */
|
||||||
|
|
||||||
|
extern const char *glibtop_names_fsusage [];
|
||||||
|
extern const unsigned glibtop_types_fsusage [];
|
||||||
|
extern const char *glibtop_labels_fsusage [];
|
||||||
|
extern const char *glibtop_descriptions_fsusage [];
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
@@ -63,11 +63,11 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WITHOUT_GUILE
|
#ifdef WITHOUT_GUILE
|
||||||
#undef HAVE_GUILE
|
#undef GLIBTOP_GUILE
|
||||||
#undef GLIBTOP_GUILE_NAMES
|
#undef GLIBTOP_GUILE_NAMES
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GUILE
|
#ifdef GLIBTOP_GUILE
|
||||||
#include <guile/gh.h>
|
#include <guile/gh.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -35,7 +35,7 @@ typedef struct _glibtop_loadavg glibtop_loadavg;
|
|||||||
|
|
||||||
struct _glibtop_loadavg
|
struct _glibtop_loadavg
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
u_int64_t flags;
|
||||||
double loadavg [3]; /* GLIBTOP_LOADAVG_LOADAVG */
|
double loadavg [3]; /* GLIBTOP_LOADAVG_LOADAVG */
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ extern void glibtop_get_loadavg_p __P((glibtop *, glibtop_loadavg *));
|
|||||||
extern void glibtop_get_loadavg_s __P((glibtop *, glibtop_loadavg *));
|
extern void glibtop_get_loadavg_s __P((glibtop *, glibtop_loadavg *));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GUILE
|
#ifdef GLIBTOP_GUILE
|
||||||
|
|
||||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||||
|
|
||||||
|
@@ -42,7 +42,7 @@ typedef struct _glibtop_mem glibtop_mem;
|
|||||||
|
|
||||||
struct _glibtop_mem
|
struct _glibtop_mem
|
||||||
{
|
{
|
||||||
unsigned long flags,
|
u_int64_t flags,
|
||||||
total, /* GLIBTOP_MEM_TOTAL */
|
total, /* GLIBTOP_MEM_TOTAL */
|
||||||
used, /* GLIBTOP_MEM_USED */
|
used, /* GLIBTOP_MEM_USED */
|
||||||
free, /* GLIBTOP_MEM_FREE */
|
free, /* GLIBTOP_MEM_FREE */
|
||||||
@@ -69,7 +69,7 @@ extern void glibtop_get_mem_p __P((glibtop *, glibtop_mem *));
|
|||||||
extern void glibtop_get_mem_s __P((glibtop *, glibtop_mem *));
|
extern void glibtop_get_mem_s __P((glibtop *, glibtop_mem *));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GUILE
|
#ifdef GLIBTOP_GUILE
|
||||||
|
|
||||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||||
|
|
||||||
|
98
include/glibtop/mountlist.h
Normal file
98
include/glibtop/mountlist.h
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
/* $Id$ */
|
||||||
|
|
||||||
|
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
|
This file is part of the Gnome Top Library.
|
||||||
|
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||||
|
|
||||||
|
The Gnome Top Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The Gnome Top Library 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
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#ifndef __GLIBTOP_MOUNTLIST_H__
|
||||||
|
#define __GLIBTOP_MOUNTLIST_H__
|
||||||
|
|
||||||
|
#include <glibtop.h>
|
||||||
|
#include <glibtop/global.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define GLIBTOP_MOUNTLIST_NUMBER 0
|
||||||
|
#define GLIBTOP_MOUNTLIST_TOTAL 1
|
||||||
|
#define GLIBTOP_MOUNTLIST_SIZE 2
|
||||||
|
|
||||||
|
#define GLIBTOP_MAX_MOUNTLIST 3
|
||||||
|
|
||||||
|
#define GLIBTOP_MOUNTENTRY_LEN 79
|
||||||
|
|
||||||
|
typedef struct _glibtop_mountentry glibtop_mountentry;
|
||||||
|
|
||||||
|
typedef struct _glibtop_mountlist glibtop_mountlist;
|
||||||
|
|
||||||
|
struct _glibtop_mountentry
|
||||||
|
{
|
||||||
|
u_int64_t dev;
|
||||||
|
char devname [GLIBTOP_MOUNTENTRY_LEN+1];
|
||||||
|
char mountdir [GLIBTOP_MOUNTENTRY_LEN+1];
|
||||||
|
char type [GLIBTOP_MOUNTENTRY_LEN+1];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _glibtop_mountlist
|
||||||
|
{
|
||||||
|
u_int64_t flags,
|
||||||
|
number, /* GLIBTOP_MOUNTLIST_NUMBER */
|
||||||
|
total, /* GLIBTOP_MOUNTLIST_TOTAL */
|
||||||
|
size; /* GLIBTOP_MOUNTLIST_SIZE */
|
||||||
|
};
|
||||||
|
|
||||||
|
#define glibtop_get_mountlist(mountlist,all_fs) glibtop_get_mountlist_l(glibtop_global_server, mountlist, all_fs)
|
||||||
|
|
||||||
|
#define glibtop_get_mountlist_r glibtop_get_mountlist_s
|
||||||
|
|
||||||
|
extern glibtop_mountentry *glibtop_get_mountlist_l __P((glibtop *, glibtop_mountlist *, int));
|
||||||
|
|
||||||
|
extern glibtop_mountentry *glibtop_get_mountlist_s __P((glibtop *, glibtop_mountlist *, int));
|
||||||
|
|
||||||
|
#ifdef GLIBTOP_GUILE
|
||||||
|
|
||||||
|
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||||
|
|
||||||
|
extern SCM glibtop_guile_get_mountlist __P((SCM));
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GLIBTOP_GUILE_NAMES
|
||||||
|
|
||||||
|
/* You need to link with -lgtop_guile_names to get this stuff here. */
|
||||||
|
|
||||||
|
extern SCM glibtop_guile_names_mountlist __P((void));
|
||||||
|
extern SCM glibtop_guile_types_mountlist __P((void));
|
||||||
|
extern SCM glibtop_guile_labels_mountlist __P((void));
|
||||||
|
extern SCM glibtop_guile_descriptions_mountlist __P((void));
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GLIBTOP_NAMES
|
||||||
|
|
||||||
|
/* You need to link with -lgtop_names to get this stuff here. */
|
||||||
|
|
||||||
|
extern const char *glibtop_names_mountlist [];
|
||||||
|
extern const unsigned glibtop_types_mountlist [];
|
||||||
|
extern const char *glibtop_labels_mountlist [];
|
||||||
|
extern const char *glibtop_descriptions_mountlist [];
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
@@ -41,7 +41,7 @@ typedef struct _glibtop_msg_limits glibtop_msg_limits;
|
|||||||
|
|
||||||
struct _glibtop_msg_limits
|
struct _glibtop_msg_limits
|
||||||
{
|
{
|
||||||
unsigned long flags,
|
u_int64_t flags,
|
||||||
msgpool, /* GLIBTOP_IPC_MSGPOOL */
|
msgpool, /* GLIBTOP_IPC_MSGPOOL */
|
||||||
msgmap, /* GLIBTOP_IPC_MSGMAP */
|
msgmap, /* GLIBTOP_IPC_MSGMAP */
|
||||||
msgmax, /* GLIBTOP_IPC_MSGMAX */
|
msgmax, /* GLIBTOP_IPC_MSGMAX */
|
||||||
@@ -67,7 +67,7 @@ extern void glibtop_get_msg_limits_p __P((glibtop *, glibtop_msg_limits *));
|
|||||||
extern void glibtop_get_msg_limits_s __P((glibtop *, glibtop_msg_limits *));
|
extern void glibtop_get_msg_limits_s __P((glibtop *, glibtop_msg_limits *));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GUILE
|
#ifdef GLIBTOP_GUILE
|
||||||
|
|
||||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||||
|
|
||||||
|
@@ -33,7 +33,8 @@ __BEGIN_DECLS
|
|||||||
#define GLIBTOP_INIT_NO_OPEN 1
|
#define GLIBTOP_INIT_NO_OPEN 1
|
||||||
#define GLIBTOP_INIT_NO_INIT 2
|
#define GLIBTOP_INIT_NO_INIT 2
|
||||||
|
|
||||||
#define GLIBTOP_OPEN_NO_OVERRIDE 1
|
#define GLIBTOP_FEATURES_NO_SERVER 4
|
||||||
|
#define GLIBTOP_FEATURES_EXCEPT 8
|
||||||
|
|
||||||
#define GLIBTOP_METHOD_DIRECT 1
|
#define GLIBTOP_METHOD_DIRECT 1
|
||||||
#define GLIBTOP_METHOD_PIPE 2
|
#define GLIBTOP_METHOD_PIPE 2
|
||||||
@@ -42,7 +43,8 @@ __BEGIN_DECLS
|
|||||||
|
|
||||||
extern void glibtop_open_l __P((glibtop *, const char *, const unsigned long, const unsigned));
|
extern void glibtop_open_l __P((glibtop *, const char *, const unsigned long, const unsigned));
|
||||||
|
|
||||||
extern void glibtop_open_r __P((glibtop *, const char *, const unsigned long, const unsigned));
|
extern void glibtop_open_p __P((glibtop *, const char *, const unsigned long, const unsigned));
|
||||||
|
extern void glibtop_open_s __P((glibtop *, const char *, const unsigned long, const unsigned));
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
@@ -44,8 +44,8 @@ typedef struct _glibtop_proc_kernel glibtop_proc_kernel;
|
|||||||
|
|
||||||
struct _glibtop_proc_kernel
|
struct _glibtop_proc_kernel
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
u_int64_t flags;
|
||||||
unsigned long k_flags, /* kernel flags for the process */
|
u_int64_t k_flags, /* kernel flags for the process */
|
||||||
min_flt, /* number of minor page faults since
|
min_flt, /* number of minor page faults since
|
||||||
* process start */
|
* process start */
|
||||||
maj_flt, /* number of major page faults since
|
maj_flt, /* number of major page faults since
|
||||||
@@ -76,7 +76,7 @@ extern void glibtop_get_proc_kernel_p __P((glibtop *, glibtop_proc_kernel *, pid
|
|||||||
extern void glibtop_get_proc_kernel_s __P((glibtop *, glibtop_proc_kernel *, pid_t));
|
extern void glibtop_get_proc_kernel_s __P((glibtop *, glibtop_proc_kernel *, pid_t));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GUILE
|
#ifdef GLIBTOP_GUILE
|
||||||
|
|
||||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||||
|
|
||||||
|
@@ -37,7 +37,7 @@ typedef struct _glibtop_proclist glibtop_proclist;
|
|||||||
|
|
||||||
struct _glibtop_proclist
|
struct _glibtop_proclist
|
||||||
{
|
{
|
||||||
unsigned long flags,
|
u_int64_t flags,
|
||||||
number, /* GLIBTOP_PROCLIST_NUMBER */
|
number, /* GLIBTOP_PROCLIST_NUMBER */
|
||||||
total, /* GLIBTOP_PROCLIST_TOTAL */
|
total, /* GLIBTOP_PROCLIST_TOTAL */
|
||||||
size; /* GLIBTOP_PROCLIST_SIZE */
|
size; /* GLIBTOP_PROCLIST_SIZE */
|
||||||
@@ -59,7 +59,7 @@ extern unsigned *glibtop_get_proclist_p __P((glibtop *, glibtop_proclist *));
|
|||||||
extern unsigned *glibtop_get_proclist_s __P((glibtop *, glibtop_proclist *));
|
extern unsigned *glibtop_get_proclist_s __P((glibtop *, glibtop_proclist *));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GUILE
|
#ifdef GLIBTOP_GUILE
|
||||||
|
|
||||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||||
|
|
||||||
|
@@ -42,8 +42,8 @@ typedef struct _glibtop_proc_mem glibtop_proc_mem;
|
|||||||
|
|
||||||
struct _glibtop_proc_mem
|
struct _glibtop_proc_mem
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
u_int64_t flags,
|
||||||
long size, /* total # of pages of memory */
|
size, /* total # of pages of memory */
|
||||||
vsize, /* number of pages of virtual memory ... */
|
vsize, /* number of pages of virtual memory ... */
|
||||||
resident, /* number of resident set
|
resident, /* number of resident set
|
||||||
* (non-swapped) pages (4k) */
|
* (non-swapped) pages (4k) */
|
||||||
@@ -69,7 +69,7 @@ extern void glibtop_get_proc_mem_p __P((glibtop *, glibtop_proc_mem *, pid_t));
|
|||||||
extern void glibtop_get_proc_mem_s __P((glibtop *, glibtop_proc_mem *, pid_t));
|
extern void glibtop_get_proc_mem_s __P((glibtop *, glibtop_proc_mem *, pid_t));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GUILE
|
#ifdef GLIBTOP_GUILE
|
||||||
|
|
||||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||||
|
|
||||||
|
@@ -43,12 +43,12 @@ typedef struct _glibtop_proc_segment glibtop_proc_segment;
|
|||||||
|
|
||||||
struct _glibtop_proc_segment
|
struct _glibtop_proc_segment
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
u_int64_t flags,
|
||||||
long trs, /* text resident set size */
|
trs, /* text resident set size */
|
||||||
lrs, /* shared-lib resident set size */
|
lrs, /* shared-lib resident set size */
|
||||||
drs, /* data resident set size */
|
drs, /* data resident set size */
|
||||||
dt; /* dirty pages */
|
dt, /* dirty pages */
|
||||||
unsigned long start_code,
|
start_code,
|
||||||
/* address of beginning of code segment */
|
/* address of beginning of code segment */
|
||||||
end_code, /* address of end of code segment */
|
end_code, /* address of end of code segment */
|
||||||
start_stack; /* address of the bottom of stack segment */
|
start_stack; /* address of the bottom of stack segment */
|
||||||
@@ -70,7 +70,7 @@ extern void glibtop_get_proc_segment_p __P((glibtop *, glibtop_proc_segment *, p
|
|||||||
extern void glibtop_get_proc_segment_s __P((glibtop *, glibtop_proc_segment *, pid_t));
|
extern void glibtop_get_proc_segment_s __P((glibtop *, glibtop_proc_segment *, pid_t));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GUILE
|
#ifdef GLIBTOP_GUILE
|
||||||
|
|
||||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||||
|
|
||||||
|
@@ -40,11 +40,11 @@ typedef struct _glibtop_proc_signal glibtop_proc_signal;
|
|||||||
|
|
||||||
struct _glibtop_proc_signal
|
struct _glibtop_proc_signal
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
u_int64_t flags,
|
||||||
int signal, /* mask of pending signals */
|
signal, /* mask of pending signals */
|
||||||
blocked, /* mask of blocked signals */
|
blocked, /* mask of blocked signals */
|
||||||
sigignore, /* mask of ignored signals */
|
sigignore, /* mask of ignored signals */
|
||||||
sigcatch; /* mask of caught signals */
|
sigcatch; /* mask of caught signals */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define glibtop_get_proc_signal(p1, p2) glibtop_get_proc_signal_l(glibtop_global_server, p1, p2)
|
#define glibtop_get_proc_signal(p1, p2) glibtop_get_proc_signal_l(glibtop_global_server, p1, p2)
|
||||||
@@ -63,7 +63,7 @@ extern void glibtop_get_proc_signal_p __P((glibtop *, glibtop_proc_signal *, pid
|
|||||||
extern void glibtop_get_proc_signal_s __P((glibtop *, glibtop_proc_signal *, pid_t));
|
extern void glibtop_get_proc_signal_s __P((glibtop *, glibtop_proc_signal *, pid_t));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GUILE
|
#ifdef GLIBTOP_GUILE
|
||||||
|
|
||||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||||
|
|
||||||
|
@@ -40,7 +40,7 @@ typedef struct _glibtop_proc_state glibtop_proc_state;
|
|||||||
|
|
||||||
struct _glibtop_proc_state
|
struct _glibtop_proc_state
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
u_int64_t flags;
|
||||||
char cmd[40], /* basename of executable file in
|
char cmd[40], /* basename of executable file in
|
||||||
* call to exec(2) */
|
* call to exec(2) */
|
||||||
state; /* single-char code for process state
|
state; /* single-char code for process state
|
||||||
@@ -70,7 +70,7 @@ extern void glibtop_get_proc_state_p __P((glibtop *, glibtop_proc_state *, pid_t
|
|||||||
extern void glibtop_get_proc_state_s __P((glibtop *, glibtop_proc_state *, pid_t));
|
extern void glibtop_get_proc_state_s __P((glibtop *, glibtop_proc_state *, pid_t));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GUILE
|
#ifdef GLIBTOP_GUILE
|
||||||
|
|
||||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||||
|
|
||||||
|
@@ -43,8 +43,8 @@ typedef struct _glibtop_proc_time glibtop_proc_time;
|
|||||||
|
|
||||||
struct _glibtop_proc_time
|
struct _glibtop_proc_time
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
u_int64_t flags,
|
||||||
long start_time, /* start time of process --
|
start_time, /* start time of process --
|
||||||
* seconds since 1-1-70 */
|
* seconds since 1-1-70 */
|
||||||
utime, /* user-mode CPU time accumulated by process */
|
utime, /* user-mode CPU time accumulated by process */
|
||||||
stime, /* kernel-mode CPU time accumulated by process */
|
stime, /* kernel-mode CPU time accumulated by process */
|
||||||
@@ -75,7 +75,7 @@ extern void glibtop_get_proc_time_p __P((glibtop *, glibtop_proc_time *, pid_t))
|
|||||||
extern void glibtop_get_proc_time_s __P((glibtop *, glibtop_proc_time *, pid_t));
|
extern void glibtop_get_proc_time_s __P((glibtop *, glibtop_proc_time *, pid_t));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GUILE
|
#ifdef GLIBTOP_GUILE
|
||||||
|
|
||||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||||
|
|
||||||
|
@@ -48,7 +48,7 @@ typedef struct _glibtop_proc_uid glibtop_proc_uid;
|
|||||||
|
|
||||||
struct _glibtop_proc_uid
|
struct _glibtop_proc_uid
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
u_int64_t flags;
|
||||||
int uid, /* user id */
|
int uid, /* user id */
|
||||||
euid, /* effective user id */
|
euid, /* effective user id */
|
||||||
gid, /* group id */
|
gid, /* group id */
|
||||||
@@ -79,7 +79,7 @@ extern void glibtop_get_proc_uid_p __P((glibtop *, glibtop_proc_uid *, pid_t));
|
|||||||
extern void glibtop_get_proc_uid_s __P((glibtop *, glibtop_proc_uid *, pid_t));
|
extern void glibtop_get_proc_uid_s __P((glibtop *, glibtop_proc_uid *, pid_t));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GUILE
|
#ifdef GLIBTOP_GUILE
|
||||||
|
|
||||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||||
|
|
||||||
|
@@ -44,7 +44,7 @@ typedef struct _glibtop_sem_limits glibtop_sem_limits;
|
|||||||
|
|
||||||
struct _glibtop_sem_limits
|
struct _glibtop_sem_limits
|
||||||
{
|
{
|
||||||
unsigned long flags,
|
u_int64_t flags,
|
||||||
semmap, /* GLIBTOP_IPC_SEMMAP */
|
semmap, /* GLIBTOP_IPC_SEMMAP */
|
||||||
semmni, /* GLIBTOP_IPC_SEMMNI */
|
semmni, /* GLIBTOP_IPC_SEMMNI */
|
||||||
semmns, /* GLIBTOP_IPC_SEMMNS */
|
semmns, /* GLIBTOP_IPC_SEMMNS */
|
||||||
@@ -73,7 +73,7 @@ extern void glibtop_get_sem_limits_p __P((glibtop *, glibtop_sem_limits *));
|
|||||||
extern void glibtop_get_sem_limits_s __P((glibtop *, glibtop_sem_limits *));
|
extern void glibtop_get_sem_limits_s __P((glibtop *, glibtop_sem_limits *));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GUILE
|
#ifdef GLIBTOP_GUILE
|
||||||
|
|
||||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||||
|
|
||||||
|
@@ -39,7 +39,7 @@ typedef struct _glibtop_shm_limits glibtop_shm_limits;
|
|||||||
|
|
||||||
struct _glibtop_shm_limits
|
struct _glibtop_shm_limits
|
||||||
{
|
{
|
||||||
unsigned long flags,
|
u_int64_t flags,
|
||||||
shmmax, /* GLIBTOP_IPC_SHMMAX */
|
shmmax, /* GLIBTOP_IPC_SHMMAX */
|
||||||
shmmin, /* GLIBTOP_IPC_SHMMIN */
|
shmmin, /* GLIBTOP_IPC_SHMMIN */
|
||||||
shmmni, /* GLIBTOP_IPC_SHMMNI */
|
shmmni, /* GLIBTOP_IPC_SHMMNI */
|
||||||
@@ -63,7 +63,7 @@ extern void glibtop_get_shm_limits_p __P((glibtop *, glibtop_shm_limits *));
|
|||||||
extern void glibtop_get_shm_limits_s __P((glibtop *, glibtop_shm_limits *));
|
extern void glibtop_get_shm_limits_s __P((glibtop *, glibtop_shm_limits *));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GUILE
|
#ifdef GLIBTOP_GUILE
|
||||||
|
|
||||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||||
|
|
||||||
|
45
include/glibtop/signal.h
Normal file
45
include/glibtop/signal.h
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
/* $Id$ */
|
||||||
|
|
||||||
|
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
|
This file is part of the Gnome Top Library.
|
||||||
|
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||||
|
|
||||||
|
The Gnome Top Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The Gnome Top Library 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
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#ifndef __GLIBTOP_SIGNAL_H__
|
||||||
|
#define __GLIBTOP_SIGNAL_H__
|
||||||
|
|
||||||
|
#include <glibtop.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_SYS_SIGNAL_H
|
||||||
|
#include <sys/signal.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
typedef struct _glibtop_signame glibtop_signame;
|
||||||
|
|
||||||
|
struct _glibtop_signame
|
||||||
|
{
|
||||||
|
const int number;
|
||||||
|
const char *name, *label;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern const glibtop_signame glibtop_sys_siglist [];
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
@@ -30,17 +30,21 @@ __BEGIN_DECLS
|
|||||||
#define GLIBTOP_SWAP_TOTAL 0
|
#define GLIBTOP_SWAP_TOTAL 0
|
||||||
#define GLIBTOP_SWAP_USED 1
|
#define GLIBTOP_SWAP_USED 1
|
||||||
#define GLIBTOP_SWAP_FREE 2
|
#define GLIBTOP_SWAP_FREE 2
|
||||||
|
#define GLIBTOP_SWAP_PAGEIN 3
|
||||||
|
#define GLIBTOP_SWAP_PAGEOUT 4
|
||||||
|
|
||||||
#define GLIBTOP_MAX_SWAP 3
|
#define GLIBTOP_MAX_SWAP 5
|
||||||
|
|
||||||
typedef struct _glibtop_swap glibtop_swap;
|
typedef struct _glibtop_swap glibtop_swap;
|
||||||
|
|
||||||
struct _glibtop_swap
|
struct _glibtop_swap
|
||||||
{
|
{
|
||||||
unsigned long flags,
|
u_int64_t flags,
|
||||||
total, /* GLIBTOP_SWAP_TOTAL */
|
total, /* GLIBTOP_SWAP_TOTAL */
|
||||||
used, /* GLIBTOP_SWAP_USED */
|
used, /* GLIBTOP_SWAP_USED */
|
||||||
free; /* GLIBTOP_SWAP_FREE */
|
free, /* GLIBTOP_SWAP_FREE */
|
||||||
|
pagein, /* GLIBTOP_SWAP_PAGEIN */
|
||||||
|
pageout; /* GLIBTOP_SWAP_PAGEOUT */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define glibtop_get_swap(swap) glibtop_get_swap_l(glibtop_global_server, swap)
|
#define glibtop_get_swap(swap) glibtop_get_swap_l(glibtop_global_server, swap)
|
||||||
@@ -59,7 +63,7 @@ extern void glibtop_get_swap_p __P((glibtop *, glibtop_swap *));
|
|||||||
extern void glibtop_get_swap_s __P((glibtop *, glibtop_swap *));
|
extern void glibtop_get_swap_s __P((glibtop *, glibtop_swap *));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GUILE
|
#ifdef GLIBTOP_GUILE
|
||||||
|
|
||||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||||
|
|
||||||
|
@@ -44,8 +44,10 @@ __BEGIN_DECLS
|
|||||||
#define GLIBTOP_SYSDEPS_PROC_SIGNAL 14
|
#define GLIBTOP_SYSDEPS_PROC_SIGNAL 14
|
||||||
#define GLIBTOP_SYSDEPS_PROC_KERNEL 15
|
#define GLIBTOP_SYSDEPS_PROC_KERNEL 15
|
||||||
#define GLIBTOP_SYSDEPS_PROC_SEGMENT 16
|
#define GLIBTOP_SYSDEPS_PROC_SEGMENT 16
|
||||||
|
#define GLIBTOP_SYSDEPS_MOUNTLIST 17
|
||||||
|
#define GLIBTOP_SYSDEPS_FSUSAGE 18
|
||||||
|
|
||||||
#define GLIBTOP_MAX_SYSDEPS 17
|
#define GLIBTOP_MAX_SYSDEPS 19
|
||||||
|
|
||||||
#define GLIBTOP_SYSDEPS_ALL ((1 << GLIBTOP_MAX_SYSDEPS) - 1)
|
#define GLIBTOP_SYSDEPS_ALL ((1 << GLIBTOP_MAX_SYSDEPS) - 1)
|
||||||
|
|
||||||
@@ -53,7 +55,7 @@ typedef struct _glibtop_sysdeps glibtop_sysdeps;
|
|||||||
|
|
||||||
struct _glibtop_sysdeps
|
struct _glibtop_sysdeps
|
||||||
{
|
{
|
||||||
unsigned long flags,
|
u_int64_t flags,
|
||||||
features, /* server features */
|
features, /* server features */
|
||||||
cpu, /* glibtop_cpu */
|
cpu, /* glibtop_cpu */
|
||||||
mem, /* glibtop_mem */
|
mem, /* glibtop_mem */
|
||||||
@@ -70,14 +72,16 @@ struct _glibtop_sysdeps
|
|||||||
proc_time, /* glibtop_proc_time */
|
proc_time, /* glibtop_proc_time */
|
||||||
proc_signal, /* glibtop_proc_signal */
|
proc_signal, /* glibtop_proc_signal */
|
||||||
proc_kernel, /* glibtop_proc_kernel */
|
proc_kernel, /* glibtop_proc_kernel */
|
||||||
proc_segment; /* glibtop_proc_segment */
|
proc_segment, /* glibtop_proc_segment */
|
||||||
|
mountlist, /* glibtop_mountlist */
|
||||||
|
fsusage; /* glibtop_fsusage */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define glibtop_get_sysdeps(sysdeps) glibtop_get_sysdeps_r(glibtop_global_server,sysdeps)
|
#define glibtop_get_sysdeps(sysdeps) glibtop_get_sysdeps_r(glibtop_global_server,sysdeps)
|
||||||
|
|
||||||
extern void glibtop_get_sysdeps_r __P((glibtop *, glibtop_sysdeps *));
|
extern void glibtop_get_sysdeps_r __P((glibtop *, glibtop_sysdeps *));
|
||||||
|
|
||||||
#ifdef HAVE_GUILE
|
#ifdef GLIBTOP_GUILE
|
||||||
|
|
||||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||||
|
|
||||||
|
@@ -40,6 +40,9 @@
|
|||||||
#include <glibtop/prockernel.h>
|
#include <glibtop/prockernel.h>
|
||||||
#include <glibtop/procsegment.h>
|
#include <glibtop/procsegment.h>
|
||||||
|
|
||||||
|
#include <glibtop/mountlist.h>
|
||||||
|
#include <glibtop/fsusage.h>
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
typedef union _glibtop_union glibtop_union;
|
typedef union _glibtop_union glibtop_union;
|
||||||
@@ -62,6 +65,8 @@ union _glibtop_union
|
|||||||
glibtop_proc_signal proc_signal;
|
glibtop_proc_signal proc_signal;
|
||||||
glibtop_proc_kernel proc_kernel;
|
glibtop_proc_kernel proc_kernel;
|
||||||
glibtop_proc_segment proc_segment;
|
glibtop_proc_segment proc_segment;
|
||||||
|
glibtop_mountlist mountlist;
|
||||||
|
glibtop_fsusage fsusage;
|
||||||
};
|
};
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
@@ -36,7 +36,7 @@ typedef struct _glibtop_uptime glibtop_uptime;
|
|||||||
|
|
||||||
struct _glibtop_uptime
|
struct _glibtop_uptime
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
u_int64_t flags;
|
||||||
double uptime, /* GLIBTOP_UPTIME_UPTIME */
|
double uptime, /* GLIBTOP_UPTIME_UPTIME */
|
||||||
idletime; /* GLIBTOP_UPTIME_IDLETIME */
|
idletime; /* GLIBTOP_UPTIME_IDLETIME */
|
||||||
};
|
};
|
||||||
@@ -57,7 +57,7 @@ extern void glibtop_get_uptime_p __P((glibtop *, glibtop_uptime *));
|
|||||||
extern void glibtop_get_uptime_s __P((glibtop *, glibtop_uptime *));
|
extern void glibtop_get_uptime_s __P((glibtop *, glibtop_uptime *));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GUILE
|
#ifdef GLIBTOP_GUILE
|
||||||
|
|
||||||
/* You need to link with -lgtop_guile to get this stuff here. */
|
/* You need to link with -lgtop_guile to get this stuff here. */
|
||||||
|
|
||||||
|
@@ -1,3 +1,11 @@
|
|||||||
|
1998-07-21 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
|
* table20: New directory for 2.0.xx kernels.
|
||||||
|
|
||||||
|
* table21: New directory for 2.1.xx kernels.
|
||||||
|
|
||||||
|
* *: Moved into `table20' and `table21'.
|
||||||
|
|
||||||
1998-06-14 Martin Baulig <baulig@taurus.uni-trier.de>
|
1998-06-14 Martin Baulig <baulig@taurus.uni-trier.de>
|
||||||
|
|
||||||
* README: Added README.
|
* README: Added README.
|
||||||
|
@@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#ifdef _KERNEL
|
#ifdef _KERNEL
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
|
#else
|
||||||
|
#define NR_TASKS 512
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define TABLE_VERSION 0
|
#define TABLE_VERSION 0
|
||||||
@@ -11,13 +13,14 @@
|
|||||||
#define TABLE_SWAP 3
|
#define TABLE_SWAP 3
|
||||||
#define TABLE_LOADAVG 4
|
#define TABLE_LOADAVG 4
|
||||||
#define TABLE_UPTIME 5
|
#define TABLE_UPTIME 5
|
||||||
#define TABLE_PROC_UID 6
|
#define TABLE_PROCLIST 6
|
||||||
#define TABLE_PROC_MEM 7
|
#define TABLE_PROC_UID 7
|
||||||
#define TABLE_PROC_SEGMENT 8
|
#define TABLE_PROC_MEM 8
|
||||||
#define TABLE_PROC_TIME 9
|
#define TABLE_PROC_SEGMENT 9
|
||||||
#define TABLE_PROC_STATE 10
|
#define TABLE_PROC_TIME 10
|
||||||
#define TABLE_PROC_SIGNAL 11
|
#define TABLE_PROC_STATE 11
|
||||||
#define TABLE_PROC_KERNEL 12
|
#define TABLE_PROC_SIGNAL 12
|
||||||
|
#define TABLE_PROC_KERNEL 13
|
||||||
|
|
||||||
/* CPU Usage (in jiffies = 1/100th seconds) */
|
/* CPU Usage (in jiffies = 1/100th seconds) */
|
||||||
|
|
||||||
@@ -50,6 +53,8 @@ struct table_swap
|
|||||||
unsigned long total; /* Total swap space */
|
unsigned long total; /* Total swap space */
|
||||||
unsigned long used; /* Used swap space */
|
unsigned long used; /* Used swap space */
|
||||||
unsigned long free; /* Free swap space */
|
unsigned long free; /* Free swap space */
|
||||||
|
unsigned long pagein; /* Total # of pages swapped in */
|
||||||
|
unsigned long pageout; /* Total # of pages swapped out */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Load average */
|
/* Load average */
|
||||||
@@ -70,6 +75,14 @@ struct table_uptime
|
|||||||
unsigned long idle;
|
unsigned long idle;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Process list. */
|
||||||
|
|
||||||
|
struct table_proclist
|
||||||
|
{
|
||||||
|
int nr_running, nr_tasks, last_pid;
|
||||||
|
unsigned pids [NR_TASKS];
|
||||||
|
};
|
||||||
|
|
||||||
/* Information about processes. */
|
/* Information about processes. */
|
||||||
|
|
||||||
struct table_proc_state
|
struct table_proc_state
|
||||||
@@ -118,10 +131,10 @@ struct table_proc_time
|
|||||||
|
|
||||||
struct table_proc_signal
|
struct table_proc_signal
|
||||||
{
|
{
|
||||||
unsigned long signal;
|
unsigned long long signal,
|
||||||
unsigned long blocked; /* bitmap of masked signals */
|
blocked, /* bitmap of masked signals */
|
||||||
unsigned long ignored; /* mask of ignored signals */
|
ignored, /* mask of ignored signals */
|
||||||
unsigned long caught; /* mask of caught signals */
|
caught; /* mask of caught signals */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct table_proc_kernel
|
struct table_proc_kernel
|
||||||
@@ -140,6 +153,7 @@ union table
|
|||||||
struct table_swap swap;
|
struct table_swap swap;
|
||||||
struct table_loadavg loadavg;
|
struct table_loadavg loadavg;
|
||||||
struct table_uptime uptime;
|
struct table_uptime uptime;
|
||||||
|
struct table_proclist proclist;
|
||||||
struct table_proc_uid proc_uid;
|
struct table_proc_uid proc_uid;
|
||||||
struct table_proc_mem proc_mem;
|
struct table_proc_mem proc_mem;
|
||||||
struct table_proc_segment proc_segment;
|
struct table_proc_segment proc_segment;
|
||||||
|
@@ -28,14 +28,16 @@ diff -ur linux-2.0.32/Makefile linux-hacked/Makefile
|
|||||||
diff -ur linux-2.0.32/arch/i386/kernel/entry.S linux-hacked/arch/i386/kernel/entry.S
|
diff -ur linux-2.0.32/arch/i386/kernel/entry.S linux-hacked/arch/i386/kernel/entry.S
|
||||||
--- linux-2.0.32/arch/i386/kernel/entry.S Tue Sep 16 23:42:45 1997
|
--- linux-2.0.32/arch/i386/kernel/entry.S Tue Sep 16 23:42:45 1997
|
||||||
+++ linux-hacked/arch/i386/kernel/entry.S Thu Jun 11 21:37:20 1998
|
+++ linux-hacked/arch/i386/kernel/entry.S Thu Jun 11 21:37:20 1998
|
||||||
@@ -699,4 +699,6 @@
|
@@ -699,4 +699,8 @@
|
||||||
.long SYMBOL_NAME(sys_mremap)
|
.long SYMBOL_NAME(sys_mremap)
|
||||||
.long 0,0
|
.long 0,0
|
||||||
.long SYMBOL_NAME(sys_vm86)
|
.long SYMBOL_NAME(sys_vm86)
|
||||||
- .space (NR_syscalls-166)*4
|
- .space (NR_syscalls-166)*4
|
||||||
+ .long 0
|
+ .long 0,0,0,0 /* 170 */
|
||||||
|
+ .long 0,0,0,0,0,0,0,0,0,0 /* 180 */
|
||||||
|
+ .long 0,0,0,0,0,0,0
|
||||||
+ .long SYMBOL_NAME(sys_table)
|
+ .long SYMBOL_NAME(sys_table)
|
||||||
+ .space (NR_syscalls-168)*4
|
+ .space (NR_syscalls-188)*4
|
||||||
diff -ur linux-2.0.32/include/asm-i386/unistd.h linux-hacked/include/asm-i386/unistd.h
|
diff -ur linux-2.0.32/include/asm-i386/unistd.h linux-hacked/include/asm-i386/unistd.h
|
||||||
--- linux-2.0.32/include/asm-i386/unistd.h Fri Mar 22 07:34:02 1996
|
--- linux-2.0.32/include/asm-i386/unistd.h Fri Mar 22 07:34:02 1996
|
||||||
+++ linux-hacked/include/asm-i386/unistd.h Thu Jun 11 21:37:03 1998
|
+++ linux-hacked/include/asm-i386/unistd.h Thu Jun 11 21:37:03 1998
|
||||||
@@ -43,7 +45,7 @@ diff -ur linux-2.0.32/include/asm-i386/unistd.h linux-hacked/include/asm-i386/un
|
|||||||
#define __NR_sched_rr_get_interval 161
|
#define __NR_sched_rr_get_interval 161
|
||||||
#define __NR_nanosleep 162
|
#define __NR_nanosleep 162
|
||||||
#define __NR_mremap 163
|
#define __NR_mremap 163
|
||||||
+#define __NR_table 168
|
+#define __NR_table 188
|
||||||
|
|
||||||
/* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */
|
/* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */
|
||||||
#define _syscall0(type,name) \
|
#define _syscall0(type,name) \
|
@@ -189,8 +189,8 @@ sys_table (int type, union table *buf, const void *param)
|
|||||||
union table tbl;
|
union table tbl;
|
||||||
struct sysinfo i;
|
struct sysinfo i;
|
||||||
struct task_struct *tsk = NULL;
|
struct task_struct *tsk = NULL;
|
||||||
|
int index, err;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
int err;
|
|
||||||
|
|
||||||
if (type == TABLE_VERSION)
|
if (type == TABLE_VERSION)
|
||||||
return _TABLE_VERSION;
|
return _TABLE_VERSION;
|
||||||
@@ -224,12 +224,23 @@ sys_table (int type, union table *buf, const void *param)
|
|||||||
/* Main function dispatcher */
|
/* Main function dispatcher */
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
case TABLE_PROCLIST:
|
||||||
|
tsk = task [0];
|
||||||
|
for (index = 0; index < nr_tasks; index++) {
|
||||||
|
tbl.proclist.pids [index] = tsk->pid;
|
||||||
|
tsk = tsk->next_task;
|
||||||
|
}
|
||||||
|
tbl.proclist.nr_running = nr_running;
|
||||||
|
tbl.proclist.nr_tasks = nr_tasks;
|
||||||
|
tbl.proclist.last_pid = last_pid;
|
||||||
|
break;
|
||||||
case TABLE_CPU:
|
case TABLE_CPU:
|
||||||
tbl.cpu.total = jiffies;
|
tbl.cpu.total = jiffies;
|
||||||
tbl.cpu.user = kstat.cpu_user;
|
tbl.cpu.user = kstat.cpu_user;
|
||||||
tbl.cpu.nice = kstat.cpu_nice;
|
tbl.cpu.nice = kstat.cpu_nice;
|
||||||
tbl.cpu.sys = kstat.cpu_system;
|
tbl.cpu.sys = kstat.cpu_system;
|
||||||
tbl.cpu.idle = tbl.cpu.total - (tbl.cpu.user + tbl.cpu.nice + tbl.cpu.sys);
|
tbl.cpu.idle = tbl.cpu.total -
|
||||||
|
(tbl.cpu.user + tbl.cpu.nice + tbl.cpu.sys);
|
||||||
tbl.cpu.frequency = HZ;
|
tbl.cpu.frequency = HZ;
|
||||||
break;
|
break;
|
||||||
case TABLE_MEM:
|
case TABLE_MEM:
|
||||||
@@ -246,6 +257,8 @@ sys_table (int type, union table *buf, const void *param)
|
|||||||
tbl.swap.total = i.totalswap;
|
tbl.swap.total = i.totalswap;
|
||||||
tbl.swap.used = i.totalswap - i.freeswap;
|
tbl.swap.used = i.totalswap - i.freeswap;
|
||||||
tbl.swap.free = i.freeswap;
|
tbl.swap.free = i.freeswap;
|
||||||
|
tbl.swap.pagein = kstat.pswpin;
|
||||||
|
tbl.swap.pageout = kstat.pswpout;
|
||||||
break;
|
break;
|
||||||
case TABLE_LOADAVG:
|
case TABLE_LOADAVG:
|
||||||
tbl.loadavg.loadavg [0] = (double) avenrun [0] / (1 << FSHIFT);
|
tbl.loadavg.loadavg [0] = (double) avenrun [0] / (1 << FSHIFT);
|
||||||
@@ -262,7 +275,8 @@ sys_table (int type, union table *buf, const void *param)
|
|||||||
case TABLE_PROC_STATE:
|
case TABLE_PROC_STATE:
|
||||||
tbl.proc_state.state = tsk->state;
|
tbl.proc_state.state = tsk->state;
|
||||||
tbl.proc_state.flags = tsk->flags;
|
tbl.proc_state.flags = tsk->flags;
|
||||||
memcpy (tbl.proc_state.comm, tsk->comm, sizeof (tbl.proc_state.comm));
|
memcpy (tbl.proc_state.comm, tsk->comm,
|
||||||
|
sizeof (tbl.proc_state.comm));
|
||||||
break;
|
break;
|
||||||
case TABLE_PROC_UID:
|
case TABLE_PROC_UID:
|
||||||
tbl.proc_uid.uid = tsk->uid;
|
tbl.proc_uid.uid = tsk->uid;
|
||||||
@@ -280,7 +294,8 @@ sys_table (int type, union table *buf, const void *param)
|
|||||||
tbl.proc_uid.ppid = tsk->p_pptr->pid;
|
tbl.proc_uid.ppid = tsk->p_pptr->pid;
|
||||||
|
|
||||||
tbl.proc_uid.session = tsk->session;
|
tbl.proc_uid.session = tsk->session;
|
||||||
tbl.proc_uid.tty = tsk->tty ? kdev_t_to_nr (tsk->tty->device) : 0;
|
tbl.proc_uid.tty = tsk->tty ?
|
||||||
|
kdev_t_to_nr (tsk->tty->device) : 0;
|
||||||
tbl.proc_uid.tpgid = tsk->tty ? tsk->tty->pgrp : -1;
|
tbl.proc_uid.tpgid = tsk->tty ? tsk->tty->pgrp : -1;
|
||||||
|
|
||||||
tbl.proc_uid.priority = tsk->priority;
|
tbl.proc_uid.priority = tsk->priority;
|
||||||
@@ -337,7 +352,8 @@ sys_table (int type, union table *buf, const void *param)
|
|||||||
tbl.proc_mem.total_vm = tsk->mm->total_vm;
|
tbl.proc_mem.total_vm = tsk->mm->total_vm;
|
||||||
tbl.proc_mem.locked_vm = tsk->mm->locked_vm;
|
tbl.proc_mem.locked_vm = tsk->mm->locked_vm;
|
||||||
}
|
}
|
||||||
tbl.proc_mem.rlim = tsk->rlim ? tsk->rlim[RLIMIT_RSS].rlim_cur : 0;
|
tbl.proc_mem.rlim = tsk->rlim ?
|
||||||
|
tsk->rlim[RLIMIT_RSS].rlim_cur : 0;
|
||||||
break;
|
break;
|
||||||
case TABLE_PROC_SEGMENT:
|
case TABLE_PROC_SEGMENT:
|
||||||
if (tsk->mm && tsk->mm != &init_mm) {
|
if (tsk->mm && tsk->mm != &init_mm) {
|
16
kernel/table21/Makefile
Normal file
16
kernel/table21/Makefile
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#
|
||||||
|
# Makefile for the linux system information tables.
|
||||||
|
#
|
||||||
|
# Note! Dependencies are done automagically by 'make dep', which also
|
||||||
|
# removes any old dependencies. DON'T put your own dependencies here
|
||||||
|
# unless it's something special (ie not a .c file).
|
||||||
|
#
|
||||||
|
# Note 2! The CFLAGS definition is now in the main makefile...
|
||||||
|
|
||||||
|
O_TARGET := table.o
|
||||||
|
OX_OBJS := main.o
|
||||||
|
|
||||||
|
M_TARGET := module.o
|
||||||
|
MX_OBJS := module.o
|
||||||
|
|
||||||
|
include $(TOPDIR)/Rules.make
|
21
kernel/table21/README
Normal file
21
kernel/table21/README
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
This is a new system call `table ()' for the Linux table. It is faster
|
||||||
|
than reading from /proc and can be used to fetch all information required
|
||||||
|
for libgtop until whe have some other function (extended sysctl, ...) in
|
||||||
|
standard kernels.
|
||||||
|
|
||||||
|
I didn't want to change sysctl or some other function myself cause this may
|
||||||
|
cause other applications relying upon those function to fail. This is
|
||||||
|
something for the ``real'' kernel gurus ...
|
||||||
|
|
||||||
|
To use this new system call for libgtop, do the following:
|
||||||
|
|
||||||
|
* Copy this directory to /usr/src/linux/table
|
||||||
|
* Make /usr/src/linux/include/linux/table.h symlink to /usr/src/linux/table/table.h
|
||||||
|
* Apply the patch `kernel.patch' to the kernel, compile, install and reboot
|
||||||
|
* Recompile libgtop (remove `config.cache' and run the `autogen.sh' again).
|
||||||
|
|
||||||
|
If you want to change and/or add something - feel free to do so !
|
||||||
|
|
||||||
|
Have fun,
|
||||||
|
|
||||||
|
Martin
|
61
kernel/table21/main.c
Normal file
61
kernel/table21/main.c
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* linux/table/table_impl.c
|
||||||
|
* Copyright (C) 1998 Martin Baulig
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <linux/types.h>
|
||||||
|
#include <linux/errno.h>
|
||||||
|
#include <linux/sched.h>
|
||||||
|
#include <linux/kernel.h>
|
||||||
|
#include <linux/kernel_stat.h>
|
||||||
|
#include <linux/tty.h>
|
||||||
|
#include <linux/user.h>
|
||||||
|
#include <linux/a.out.h>
|
||||||
|
#include <linux/string.h>
|
||||||
|
#include <linux/mman.h>
|
||||||
|
#include <linux/proc_fs.h>
|
||||||
|
#include <linux/ioport.h>
|
||||||
|
#include <linux/config.h>
|
||||||
|
#include <linux/mm.h>
|
||||||
|
#include <linux/pagemap.h>
|
||||||
|
#include <linux/swap.h>
|
||||||
|
#include <linux/slab.h>
|
||||||
|
#include <linux/smp.h>
|
||||||
|
#include <linux/signal.h>
|
||||||
|
|
||||||
|
#include <asm/uaccess.h>
|
||||||
|
#include <asm/pgtable.h>
|
||||||
|
#include <asm/io.h>
|
||||||
|
|
||||||
|
#include <linux/module.h>
|
||||||
|
#include <linux/table.h>
|
||||||
|
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
|
extern void scheduling_functions_start_here(void);
|
||||||
|
extern void scheduling_functions_end_here(void);
|
||||||
|
|
||||||
|
int (*table_function_ptr) (int, union table *, const void *) = 0;
|
||||||
|
|
||||||
|
EXPORT_SYMBOL(table_function_ptr);
|
||||||
|
|
||||||
|
EXPORT_SYMBOL(nr_running);
|
||||||
|
EXPORT_SYMBOL(pidhash);
|
||||||
|
EXPORT_SYMBOL(task);
|
||||||
|
EXPORT_SYMBOL(si_swapinfo);
|
||||||
|
EXPORT_SYMBOL(scheduling_functions_start_here);
|
||||||
|
EXPORT_SYMBOL(scheduling_functions_end_here);
|
||||||
|
EXPORT_SYMBOL(avenrun);
|
||||||
|
EXPORT_SYMBOL(nr_tasks);
|
||||||
|
EXPORT_SYMBOL(last_pid);
|
||||||
|
EXPORT_SYMBOL(page_cache_size);
|
||||||
|
EXPORT_SYMBOL(init_mm);
|
||||||
|
|
||||||
|
asmlinkage int
|
||||||
|
sys_table (int type, union table *buf, const void *param)
|
||||||
|
{
|
||||||
|
if (table_function_ptr == 0)
|
||||||
|
return -ENOSYS;
|
||||||
|
|
||||||
|
return (*table_function_ptr) (type, buf, param);
|
||||||
|
}
|
551
kernel/table21/module.c
Normal file
551
kernel/table21/module.c
Normal file
@@ -0,0 +1,551 @@
|
|||||||
|
/*
|
||||||
|
* linux/table/table_impl.c
|
||||||
|
* Copyright (C) 1998 Martin Baulig
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <linux/types.h>
|
||||||
|
#include <linux/errno.h>
|
||||||
|
#include <linux/sched.h>
|
||||||
|
#include <linux/kernel.h>
|
||||||
|
#include <linux/kernel_stat.h>
|
||||||
|
#include <linux/tty.h>
|
||||||
|
#include <linux/user.h>
|
||||||
|
#include <linux/a.out.h>
|
||||||
|
#include <linux/string.h>
|
||||||
|
#include <linux/mman.h>
|
||||||
|
#include <linux/proc_fs.h>
|
||||||
|
#include <linux/ioport.h>
|
||||||
|
#include <linux/config.h>
|
||||||
|
#include <linux/mm.h>
|
||||||
|
#include <linux/pagemap.h>
|
||||||
|
#include <linux/swap.h>
|
||||||
|
#include <linux/slab.h>
|
||||||
|
#include <linux/smp.h>
|
||||||
|
#include <linux/signal.h>
|
||||||
|
|
||||||
|
#include <asm/uaccess.h>
|
||||||
|
#include <asm/pgtable.h>
|
||||||
|
#include <asm/io.h>
|
||||||
|
|
||||||
|
#include <linux/module.h>
|
||||||
|
#include <linux/table.h>
|
||||||
|
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
|
extern int (*table_function_ptr) (int, union table *, const void *);
|
||||||
|
|
||||||
|
int table_fkt (int, union table *, const void *);
|
||||||
|
|
||||||
|
EXPORT_NO_SYMBOLS;
|
||||||
|
|
||||||
|
int
|
||||||
|
init_module(void)
|
||||||
|
{
|
||||||
|
printk ("init_module () = %p - %d, %d\n",
|
||||||
|
table_fkt, sizeof (union table), sizeof (sigset_t));
|
||||||
|
table_function_ptr = table_fkt;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
cleanup_module(void)
|
||||||
|
{
|
||||||
|
table_function_ptr = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define LOAD_INT(x) ((x) >> FSHIFT)
|
||||||
|
#define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100)
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG_MALLOC
|
||||||
|
int get_malloc(char * buffer);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void collect_sigign_sigcatch(struct task_struct *p, sigset_t *ign,
|
||||||
|
sigset_t *catch)
|
||||||
|
{
|
||||||
|
struct k_sigaction *k;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
sigemptyset(ign);
|
||||||
|
sigemptyset(catch);
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
printk ("collect_sigign_sigcatch: %p - %p\n",
|
||||||
|
p, p->sig);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (p->sig) {
|
||||||
|
k = p->sig->action;
|
||||||
|
for (i = 1; i <= _NSIG; ++i, ++k) {
|
||||||
|
#if 0
|
||||||
|
printk ("signal: %d - %p (%p, %p)\n",
|
||||||
|
i, k->sa.sa_handler, SIG_IGN, SIG_DFL);
|
||||||
|
#endif
|
||||||
|
if (k->sa.sa_handler == SIG_IGN)
|
||||||
|
sigaddset(ign, i);
|
||||||
|
else if (k->sa.sa_handler != SIG_DFL)
|
||||||
|
sigaddset(catch, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These bracket the sleeping functions..
|
||||||
|
*/
|
||||||
|
extern void scheduling_functions_start_here(void);
|
||||||
|
extern void scheduling_functions_end_here(void);
|
||||||
|
#define first_sched ((unsigned long) scheduling_functions_start_here)
|
||||||
|
#define last_sched ((unsigned long) scheduling_functions_end_here)
|
||||||
|
|
||||||
|
static unsigned long get_wchan(struct task_struct *p)
|
||||||
|
{
|
||||||
|
if (!p || p == current || p->state == TASK_RUNNING)
|
||||||
|
return 0;
|
||||||
|
#if defined(__i386__)
|
||||||
|
{
|
||||||
|
unsigned long ebp, eip;
|
||||||
|
unsigned long stack_page;
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
stack_page = 4096 + (unsigned long)p;
|
||||||
|
if (!stack_page)
|
||||||
|
return 0;
|
||||||
|
ebp = p->tss.ebp;
|
||||||
|
do {
|
||||||
|
if (ebp < stack_page || ebp >= 4092+stack_page)
|
||||||
|
return 0;
|
||||||
|
eip = *(unsigned long *) (ebp+4);
|
||||||
|
if (eip < first_sched || eip >= last_sched)
|
||||||
|
return eip;
|
||||||
|
ebp = *(unsigned long *) ebp;
|
||||||
|
} while (count++ < 16);
|
||||||
|
}
|
||||||
|
#elif defined(__alpha__)
|
||||||
|
/*
|
||||||
|
* This one depends on the frame size of schedule(). Do a
|
||||||
|
* "disass schedule" in gdb to find the frame size. Also, the
|
||||||
|
* code assumes that sleep_on() follows immediately after
|
||||||
|
* interruptible_sleep_on() and that add_timer() follows
|
||||||
|
* immediately after interruptible_sleep(). Ugly, isn't it?
|
||||||
|
* Maybe adding a wchan field to task_struct would be better,
|
||||||
|
* after all...
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
unsigned long schedule_frame;
|
||||||
|
unsigned long pc;
|
||||||
|
|
||||||
|
pc = thread_saved_pc(&p->tss);
|
||||||
|
if (pc >= first_sched && pc < last_sched) {
|
||||||
|
schedule_frame = ((unsigned long *)p->tss.ksp)[6];
|
||||||
|
return ((unsigned long *)schedule_frame)[12];
|
||||||
|
}
|
||||||
|
return pc;
|
||||||
|
}
|
||||||
|
#elif defined(__mc68000__)
|
||||||
|
{
|
||||||
|
unsigned long fp, pc;
|
||||||
|
unsigned long stack_page;
|
||||||
|
int count = 0;
|
||||||
|
extern int sys_pause (void);
|
||||||
|
|
||||||
|
stack_page = p->kernel_stack_page;
|
||||||
|
if (!stack_page)
|
||||||
|
return 0;
|
||||||
|
fp = ((struct switch_stack *)p->tss.ksp)->a6;
|
||||||
|
do {
|
||||||
|
if (fp < stack_page || fp >= 4088+stack_page)
|
||||||
|
return 0;
|
||||||
|
pc = ((unsigned long *)fp)[1];
|
||||||
|
/* FIXME: This depends on the order of these functions. */
|
||||||
|
if (pc < first_sched || pc >= last_sched)
|
||||||
|
return pc;
|
||||||
|
fp = *(unsigned long *) fp;
|
||||||
|
} while (count++ < 16);
|
||||||
|
}
|
||||||
|
#elif defined(__powerpc__)
|
||||||
|
return (p->tss.wchan);
|
||||||
|
#elif defined (CONFIG_ARM)
|
||||||
|
{
|
||||||
|
unsigned long fp, lr;
|
||||||
|
unsigned long stack_page;
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
stack_page = 4096 + (unsigned long)p;
|
||||||
|
fp = get_css_fp (&p->tss);
|
||||||
|
do {
|
||||||
|
if (fp < stack_page || fp > 4092+stack_page)
|
||||||
|
return 0;
|
||||||
|
lr = pc_pointer (((unsigned long *)fp)[-1]);
|
||||||
|
if (lr < first_sched || lr > last_sched)
|
||||||
|
return lr;
|
||||||
|
fp = *(unsigned long *) (fp - 12);
|
||||||
|
} while (count ++ < 16);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(__i386__)
|
||||||
|
# define KSTK_EIP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1019])
|
||||||
|
# define KSTK_ESP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1022])
|
||||||
|
#elif defined(__alpha__)
|
||||||
|
/*
|
||||||
|
* See arch/alpha/kernel/ptrace.c for details.
|
||||||
|
*/
|
||||||
|
# define PT_REG(reg) (PAGE_SIZE - sizeof(struct pt_regs) \
|
||||||
|
+ (long)&((struct pt_regs *)0)->reg)
|
||||||
|
# define KSTK_EIP(tsk) \
|
||||||
|
(*(unsigned long *)(PT_REG(pc) + PAGE_SIZE + (unsigned long)(tsk)))
|
||||||
|
# define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->tss.usp)
|
||||||
|
#elif defined(CONFIG_ARM)
|
||||||
|
# define KSTK_EIP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1022])
|
||||||
|
# define KSTK_ESP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1020])
|
||||||
|
#elif defined(__mc68000__)
|
||||||
|
#define KSTK_EIP(tsk) \
|
||||||
|
({ \
|
||||||
|
unsigned long eip = 0; \
|
||||||
|
if ((tsk)->tss.esp0 > PAGE_SIZE && \
|
||||||
|
MAP_NR((tsk)->tss.esp0) < max_mapnr) \
|
||||||
|
eip = ((struct pt_regs *) (tsk)->tss.esp0)->pc; \
|
||||||
|
eip; })
|
||||||
|
#define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->tss.usp)
|
||||||
|
#elif defined(__powerpc__)
|
||||||
|
#define KSTK_EIP(tsk) ((tsk)->tss.regs->nip)
|
||||||
|
#define KSTK_ESP(tsk) ((tsk)->tss.regs->gpr[1])
|
||||||
|
#elif defined (__sparc_v9__)
|
||||||
|
# define KSTK_EIP(tsk) ((tsk)->tss.kregs->tpc)
|
||||||
|
# define KSTK_ESP(tsk) ((tsk)->tss.kregs->u_regs[UREG_FP])
|
||||||
|
#elif defined(__sparc__)
|
||||||
|
# define KSTK_EIP(tsk) ((tsk)->tss.kregs->pc)
|
||||||
|
# define KSTK_ESP(tsk) ((tsk)->tss.kregs->u_regs[UREG_FP])
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Gcc optimizes away "strlen(x)" for constant x */
|
||||||
|
#define ADDBUF(buffer, string) \
|
||||||
|
do { memcpy(buffer, string, strlen(string)); \
|
||||||
|
buffer += strlen(string); } while (0)
|
||||||
|
|
||||||
|
static inline void statm_pte_range(pmd_t * pmd, unsigned long address, unsigned long size,
|
||||||
|
int * pages, int * shared, int * dirty, int * total)
|
||||||
|
{
|
||||||
|
pte_t * pte;
|
||||||
|
unsigned long end;
|
||||||
|
|
||||||
|
if (pmd_none(*pmd))
|
||||||
|
return;
|
||||||
|
if (pmd_bad(*pmd)) {
|
||||||
|
printk("statm_pte_range: bad pmd (%08lx)\n", pmd_val(*pmd));
|
||||||
|
pmd_clear(pmd);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
pte = pte_offset(pmd, address);
|
||||||
|
address &= ~PMD_MASK;
|
||||||
|
end = address + size;
|
||||||
|
if (end > PMD_SIZE)
|
||||||
|
end = PMD_SIZE;
|
||||||
|
do {
|
||||||
|
pte_t page = *pte;
|
||||||
|
|
||||||
|
address += PAGE_SIZE;
|
||||||
|
pte++;
|
||||||
|
if (pte_none(page))
|
||||||
|
continue;
|
||||||
|
++*total;
|
||||||
|
if (!pte_present(page))
|
||||||
|
continue;
|
||||||
|
++*pages;
|
||||||
|
if (pte_dirty(page))
|
||||||
|
++*dirty;
|
||||||
|
if (MAP_NR(pte_page(page)) >= max_mapnr)
|
||||||
|
continue;
|
||||||
|
if (atomic_read(&mem_map[MAP_NR(pte_page(page))].count) > 1)
|
||||||
|
++*shared;
|
||||||
|
} while (address < end);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void statm_pmd_range(pgd_t * pgd, unsigned long address, unsigned long size,
|
||||||
|
int * pages, int * shared, int * dirty, int * total)
|
||||||
|
{
|
||||||
|
pmd_t * pmd;
|
||||||
|
unsigned long end;
|
||||||
|
|
||||||
|
if (pgd_none(*pgd))
|
||||||
|
return;
|
||||||
|
if (pgd_bad(*pgd)) {
|
||||||
|
printk("statm_pmd_range: bad pgd (%08lx)\n", pgd_val(*pgd));
|
||||||
|
pgd_clear(pgd);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
pmd = pmd_offset(pgd, address);
|
||||||
|
address &= ~PGDIR_MASK;
|
||||||
|
end = address + size;
|
||||||
|
if (end > PGDIR_SIZE)
|
||||||
|
end = PGDIR_SIZE;
|
||||||
|
do {
|
||||||
|
statm_pte_range(pmd, address, end - address, pages, shared, dirty, total);
|
||||||
|
address = (address + PMD_SIZE) & PMD_MASK;
|
||||||
|
pmd++;
|
||||||
|
} while (address < end);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void statm_pgd_range(pgd_t * pgd, unsigned long address, unsigned long end,
|
||||||
|
int * pages, int * shared, int * dirty, int * total)
|
||||||
|
{
|
||||||
|
while (address < end) {
|
||||||
|
statm_pmd_range(pgd, address, end - address, pages, shared, dirty, total);
|
||||||
|
address = (address + PGDIR_SIZE) & PGDIR_MASK;
|
||||||
|
pgd++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
table_fkt (int type, union table *buf, const void *param)
|
||||||
|
{
|
||||||
|
union table tbl;
|
||||||
|
struct sysinfo i;
|
||||||
|
struct task_struct *tsk = NULL;
|
||||||
|
sigset_t sigign, sigcatch;
|
||||||
|
int index, err;
|
||||||
|
pid_t pid;
|
||||||
|
|
||||||
|
if (type == TABLE_VERSION)
|
||||||
|
return _TABLE_VERSION;
|
||||||
|
|
||||||
|
if (!buf)
|
||||||
|
return -EFAULT;
|
||||||
|
|
||||||
|
memset (&tbl, 0, sizeof (union table));
|
||||||
|
|
||||||
|
/* For TABLE_PROC_*, read pid and get task_struct */
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case TABLE_PROC_UID:
|
||||||
|
case TABLE_PROC_MEM:
|
||||||
|
case TABLE_PROC_SEGMENT:
|
||||||
|
case TABLE_PROC_TIME:
|
||||||
|
case TABLE_PROC_STATE:
|
||||||
|
case TABLE_PROC_SIGNAL:
|
||||||
|
case TABLE_PROC_KERNEL:
|
||||||
|
err = verify_area (VERIFY_READ, param, sizeof (pid_t));
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
copy_from_user (&pid, param, sizeof (pid_t));
|
||||||
|
|
||||||
|
read_lock (&tasklist_lock);
|
||||||
|
tsk = find_task_by_pid (pid);
|
||||||
|
/* FIXME!! This should be done after the last use */
|
||||||
|
read_unlock(&tasklist_lock);
|
||||||
|
|
||||||
|
if (tsk == NULL)
|
||||||
|
return -ESRCH;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Main function dispatcher */
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case TABLE_PROCLIST:
|
||||||
|
tsk = task [0];
|
||||||
|
for (index = 0; index < nr_tasks; index++) {
|
||||||
|
tbl.proclist.pids [index] = tsk->pid;
|
||||||
|
tsk = tsk->next_task;
|
||||||
|
}
|
||||||
|
tbl.proclist.nr_running = nr_running;
|
||||||
|
tbl.proclist.nr_tasks = nr_tasks;
|
||||||
|
tbl.proclist.last_pid = last_pid;
|
||||||
|
break;
|
||||||
|
case TABLE_CPU:
|
||||||
|
tbl.cpu.total = jiffies;
|
||||||
|
tbl.cpu.user = kstat.cpu_user;
|
||||||
|
tbl.cpu.nice = kstat.cpu_nice;
|
||||||
|
tbl.cpu.sys = kstat.cpu_system;
|
||||||
|
tbl.cpu.idle = tbl.cpu.total -
|
||||||
|
(tbl.cpu.user + tbl.cpu.nice + tbl.cpu.sys);
|
||||||
|
tbl.cpu.frequency = HZ;
|
||||||
|
break;
|
||||||
|
case TABLE_MEM:
|
||||||
|
si_meminfo (&i);
|
||||||
|
tbl.mem.total = i.totalram;
|
||||||
|
tbl.mem.used = i.totalram - i.freeram;
|
||||||
|
tbl.mem.free = i.freeram;
|
||||||
|
tbl.mem.shared = i.sharedram;
|
||||||
|
tbl.mem.buffer = i.bufferram;
|
||||||
|
tbl.mem.cached = page_cache_size << PAGE_SHIFT;
|
||||||
|
break;
|
||||||
|
case TABLE_SWAP:
|
||||||
|
si_swapinfo (&i);
|
||||||
|
tbl.swap.total = i.totalswap;
|
||||||
|
tbl.swap.used = i.totalswap - i.freeswap;
|
||||||
|
tbl.swap.free = i.freeswap;
|
||||||
|
break;
|
||||||
|
case TABLE_LOADAVG:
|
||||||
|
tbl.loadavg.loadavg [0] = (double) avenrun [0] / (1 << FSHIFT);
|
||||||
|
tbl.loadavg.loadavg [1] = (double) avenrun [1] / (1 << FSHIFT);
|
||||||
|
tbl.loadavg.loadavg [2] = (double) avenrun [2] / (1 << FSHIFT);
|
||||||
|
tbl.loadavg.nr_running = nr_running;
|
||||||
|
tbl.loadavg.nr_tasks = nr_tasks;
|
||||||
|
tbl.loadavg.last_pid = last_pid;
|
||||||
|
break;
|
||||||
|
case TABLE_UPTIME:
|
||||||
|
tbl.uptime.uptime = jiffies;
|
||||||
|
tbl.uptime.idle = task[0]->times.tms_utime +
|
||||||
|
task[0]->times.tms_stime;
|
||||||
|
break;
|
||||||
|
case TABLE_PROC_STATE:
|
||||||
|
tbl.proc_state.state = tsk->state;
|
||||||
|
tbl.proc_state.flags = tsk->flags;
|
||||||
|
memcpy (tbl.proc_state.comm, tsk->comm,
|
||||||
|
sizeof (tbl.proc_state.comm));
|
||||||
|
break;
|
||||||
|
case TABLE_PROC_UID:
|
||||||
|
tbl.proc_uid.uid = tsk->uid;
|
||||||
|
tbl.proc_uid.euid = tsk->euid;
|
||||||
|
tbl.proc_uid.suid = tsk->suid;
|
||||||
|
tbl.proc_uid.fsuid = tsk->fsuid;
|
||||||
|
|
||||||
|
tbl.proc_uid.gid = tsk->gid;
|
||||||
|
tbl.proc_uid.egid = tsk->egid;
|
||||||
|
tbl.proc_uid.sgid = tsk->sgid;
|
||||||
|
tbl.proc_uid.fsgid = tsk->fsgid;
|
||||||
|
|
||||||
|
tbl.proc_uid.pid = tsk->pid;
|
||||||
|
tbl.proc_uid.pgrp = tsk->pgrp;
|
||||||
|
tbl.proc_uid.ppid = tsk->p_pptr->pid;
|
||||||
|
|
||||||
|
tbl.proc_uid.session = tsk->session;
|
||||||
|
tbl.proc_uid.tty = tsk->tty ?
|
||||||
|
kdev_t_to_nr (tsk->tty->device) : 0;
|
||||||
|
tbl.proc_uid.tpgid = tsk->tty ? tsk->tty->pgrp : -1;
|
||||||
|
|
||||||
|
tbl.proc_uid.priority = tsk->priority;
|
||||||
|
tbl.proc_uid.counter = tsk->counter;
|
||||||
|
tbl.proc_uid.def_priority = DEF_PRIORITY;
|
||||||
|
break;
|
||||||
|
case TABLE_PROC_SIGNAL:
|
||||||
|
memcpy (&tbl.proc_signal.signal, &tsk->signal,
|
||||||
|
sizeof (tbl.proc_signal.signal));
|
||||||
|
|
||||||
|
memcpy (&tbl.proc_signal.blocked, &tsk->blocked,
|
||||||
|
sizeof (tbl.proc_signal.blocked));
|
||||||
|
|
||||||
|
collect_sigign_sigcatch (tsk, &sigign, &sigcatch);
|
||||||
|
|
||||||
|
memcpy (&tbl.proc_signal.ignored, &sigign,
|
||||||
|
sizeof (tbl.proc_signal.ignored));
|
||||||
|
|
||||||
|
memcpy (&tbl.proc_signal.caught, &sigcatch,
|
||||||
|
sizeof (tbl.proc_signal.caught));
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
printk ("PROC_SIGNAL: (%lu, %lu) - (%lu, %lu)\n",
|
||||||
|
tbl.proc_signal.ignored.sig [0],
|
||||||
|
tbl.proc_signal.ignored.sig [1],
|
||||||
|
tbl.proc_signal.caught.sig [0],
|
||||||
|
tbl.proc_signal.caught.sig [1]);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case TABLE_PROC_MEM:
|
||||||
|
if (tsk->mm && tsk->mm != &init_mm) {
|
||||||
|
tbl.proc_mem.context = tsk->mm->context;
|
||||||
|
tbl.proc_mem.start_code = tsk->mm->start_code;
|
||||||
|
tbl.proc_mem.end_code = tsk->mm->end_code;
|
||||||
|
tbl.proc_mem.start_data = tsk->mm-> start_data;
|
||||||
|
tbl.proc_mem.end_data = tsk->mm->end_data;
|
||||||
|
tbl.proc_mem.start_brk = tsk->mm->start_brk;
|
||||||
|
tbl.proc_mem.brk = tsk->mm->brk;
|
||||||
|
tbl.proc_mem.start_stack = tsk->mm->start_stack;
|
||||||
|
tbl.proc_mem.start_mmap = tsk->mm->mmap ?
|
||||||
|
tsk->mm->mmap->vm_start : 0;
|
||||||
|
tbl.proc_mem.arg_start = tsk->mm->arg_start;
|
||||||
|
tbl.proc_mem.arg_end = tsk->mm->arg_end;
|
||||||
|
tbl.proc_mem.env_start = tsk->mm->env_start;
|
||||||
|
tbl.proc_mem.env_end = tsk->mm->env_end;
|
||||||
|
tbl.proc_mem.rss = tsk->mm->rss;
|
||||||
|
tbl.proc_mem.total_vm = tsk->mm->total_vm;
|
||||||
|
tbl.proc_mem.locked_vm = tsk->mm->locked_vm;
|
||||||
|
}
|
||||||
|
tbl.proc_mem.rlim = tsk->rlim ? tsk->rlim[RLIMIT_RSS].rlim_cur : 0;
|
||||||
|
break;
|
||||||
|
case TABLE_PROC_SEGMENT:
|
||||||
|
if (tsk->mm && tsk->mm != &init_mm) {
|
||||||
|
unsigned long vsize = 0;
|
||||||
|
int size = 0, resident = 0, share = 0;
|
||||||
|
int trs = 0, lrs = 0, drs = 0, dt = 0;
|
||||||
|
struct vm_area_struct * vma = tsk->mm->mmap;
|
||||||
|
|
||||||
|
while (vma) {
|
||||||
|
pgd_t *pgd = pgd_offset(tsk->mm, vma->vm_start);
|
||||||
|
int pages = 0, shared = 0, dirty = 0, total = 0;
|
||||||
|
|
||||||
|
vsize += vma->vm_end - vma->vm_start;
|
||||||
|
|
||||||
|
statm_pgd_range (pgd, vma->vm_start, vma->vm_end,
|
||||||
|
&pages, &shared, &dirty, &total);
|
||||||
|
resident += pages;
|
||||||
|
share += shared;
|
||||||
|
dt += dirty;
|
||||||
|
size += total;
|
||||||
|
if (vma->vm_flags & VM_EXECUTABLE)
|
||||||
|
trs += pages; /* text */
|
||||||
|
else if (vma->vm_flags & VM_GROWSDOWN)
|
||||||
|
drs += pages; /* stack */
|
||||||
|
else if (vma->vm_end > 0x60000000)
|
||||||
|
lrs += pages; /* library */
|
||||||
|
else
|
||||||
|
drs += pages;
|
||||||
|
vma = vma->vm_next;
|
||||||
|
}
|
||||||
|
|
||||||
|
tbl.proc_segment.vsize = vsize;
|
||||||
|
tbl.proc_segment.size = size;
|
||||||
|
tbl.proc_segment.resident = resident;
|
||||||
|
tbl.proc_segment.shared = share;
|
||||||
|
tbl.proc_segment.trs = trs;
|
||||||
|
tbl.proc_segment.lrs = lrs;
|
||||||
|
tbl.proc_segment.dt = dt;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case TABLE_PROC_TIME:
|
||||||
|
tbl.proc_time.utime = tsk->times.tms_utime;
|
||||||
|
tbl.proc_time.stime = tsk->times.tms_stime;
|
||||||
|
tbl.proc_time.cutime = tsk->times.tms_cutime;
|
||||||
|
tbl.proc_time.cstime = tsk->times.tms_cstime;
|
||||||
|
|
||||||
|
tbl.proc_time.start_time = tsk->start_time;
|
||||||
|
tbl.proc_time.timeout = tsk->timeout;
|
||||||
|
tbl.proc_time.policy = tsk->policy;
|
||||||
|
tbl.proc_time.rt_priority = tsk->rt_priority;
|
||||||
|
|
||||||
|
tbl.proc_time.it_real_value = tsk->it_real_value;
|
||||||
|
tbl.proc_time.it_prof_value = tsk->it_prof_value;
|
||||||
|
tbl.proc_time.it_virt_value = tsk->it_virt_value;
|
||||||
|
tbl.proc_time.it_real_incr = tsk->it_real_incr;
|
||||||
|
tbl.proc_time.it_prof_incr = tsk->it_prof_incr;
|
||||||
|
tbl.proc_time.it_virt_incr = tsk->it_virt_incr;
|
||||||
|
break;
|
||||||
|
case TABLE_PROC_KERNEL:
|
||||||
|
tbl.proc_kernel.min_flt = tsk->min_flt;
|
||||||
|
tbl.proc_kernel.cmin_flt = tsk->cmin_flt;
|
||||||
|
tbl.proc_kernel.maj_flt = tsk->maj_flt;
|
||||||
|
tbl.proc_kernel.cmaj_flt = tsk->cmaj_flt;
|
||||||
|
|
||||||
|
tbl.proc_kernel.kesp = KSTK_EIP(tsk);
|
||||||
|
tbl.proc_kernel.keip = KSTK_ESP(tsk);
|
||||||
|
|
||||||
|
tbl.proc_kernel.nswap = tsk->nswap;
|
||||||
|
tbl.proc_kernel.cnswap = tsk->cnswap;
|
||||||
|
|
||||||
|
tbl.proc_kernel.wchan = get_wchan (tsk);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
err = verify_area (VERIFY_WRITE, buf, sizeof (struct table));
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
copy_to_user (buf, &tbl, sizeof (union table));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
1
kernel/table21/version.h
Normal file
1
kernel/table21/version.h
Normal file
@@ -0,0 +1 @@
|
|||||||
|
#define _TABLE_VERSION 1
|
@@ -1,85 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <linux/unistd.h>
|
|
||||||
#include <linux/table.h>
|
|
||||||
|
|
||||||
#include <syscall.h>
|
|
||||||
|
|
||||||
static inline _syscall3 (int, table, int, type, union table *, tbl, const void *, param);
|
|
||||||
|
|
||||||
int
|
|
||||||
main (void)
|
|
||||||
{
|
|
||||||
union table tbl;
|
|
||||||
unsigned count;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = table (TABLE_VERSION, NULL, NULL);
|
|
||||||
|
|
||||||
if (ret == -1) {
|
|
||||||
fprintf (stderr, "table(%u): %s\n", TABLE_VERSION, sys_errlist [errno]);
|
|
||||||
exit (-errno);
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (stderr, "Table (%u) = %u\n", TABLE_VERSION, ret);
|
|
||||||
|
|
||||||
for (count = 0; count < 5; count++) {
|
|
||||||
ret = table (TABLE_CPU, &tbl, NULL);
|
|
||||||
|
|
||||||
if (ret == -1) {
|
|
||||||
fprintf (stderr, "table(%u): %s\n", TABLE_CPU, sys_errlist [errno]);
|
|
||||||
exit (-errno);
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (stderr, "Table (%u) = %lu, %lu, %lu, %lu, %lu, %lu\n",
|
|
||||||
TABLE_CPU, tbl.cpu.total, tbl.cpu.user, tbl.cpu.nice,
|
|
||||||
tbl.cpu.sys, tbl.cpu.idle, tbl.cpu.frequency);
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = table (TABLE_MEM, &tbl, NULL);
|
|
||||||
|
|
||||||
if (ret == -1) {
|
|
||||||
fprintf (stderr, "table(%u): %s\n", TABLE_MEM, sys_errlist [errno]);
|
|
||||||
exit (-errno);
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (stderr, "Table (%u) = %lu, %lu, %lu, %lu, %lu, %lu\n",
|
|
||||||
TABLE_MEM, tbl.mem.total, tbl.mem.used, tbl.mem.free,
|
|
||||||
tbl.mem.shared, tbl.mem.buffer, tbl.mem.cached);
|
|
||||||
|
|
||||||
ret = table (TABLE_SWAP, &tbl, NULL);
|
|
||||||
|
|
||||||
if (ret == -1) {
|
|
||||||
fprintf (stderr, "table(%u): %s\n", TABLE_SWAP, sys_errlist [errno]);
|
|
||||||
exit (-errno);
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (stderr, "Table (%u) = %lu, %lu, %lu\n",
|
|
||||||
TABLE_SWAP, tbl.swap.total, tbl.swap.used, tbl.swap.free);
|
|
||||||
|
|
||||||
ret = table (TABLE_LOADAVG, &tbl, NULL);
|
|
||||||
|
|
||||||
if (ret == -1) {
|
|
||||||
fprintf (stderr, "table(%u): %s\n", TABLE_LOADAVG, sys_errlist [errno]);
|
|
||||||
exit (-errno);
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (stderr, "Table (%u) = (%lu, %lu, %lu) - %u, %u, %u\n",
|
|
||||||
TABLE_LOADAVG, tbl.loadavg.loadavg [0], tbl.loadavg.loadavg [1],
|
|
||||||
tbl.loadavg.loadavg [2], tbl.loadavg.nr_running,
|
|
||||||
tbl.loadavg.nr_tasks, tbl.loadavg.last_pid);
|
|
||||||
|
|
||||||
ret = table (TABLE_UPTIME, &tbl, NULL);
|
|
||||||
|
|
||||||
if (ret == -1) {
|
|
||||||
fprintf (stderr, "table(%u): %s\n", TABLE_UPTIME, sys_errlist [errno]);
|
|
||||||
exit (-errno);
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (stderr, "Table (%u) = %lu, %lu\n",
|
|
||||||
TABLE_UPTIME, tbl.uptime.uptime, tbl.uptime.idle);
|
|
||||||
|
|
||||||
exit (0);
|
|
||||||
}
|
|
@@ -1,15 +1,12 @@
|
|||||||
LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
|
LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
|
||||||
|
|
||||||
INCLUDES = -I$(top_builddir) -I$(top_srcdir) @machine_incs@ \
|
CFLAGS = -Wall -W @CFLAGS@
|
||||||
-I$(top_srcdir)/include -I$(top_srcdir)/intl @GUILE_INCS@ \
|
|
||||||
-DGTOPLOCALEDIR=\"$(datadir)/locale\" -D_GNU_SOURCE
|
|
||||||
|
|
||||||
CFLAGS = -Wall -W @CFLAGS@ -DGTOP_SERVER=\""@LIBGTOP_SERVER@"\"
|
|
||||||
|
|
||||||
lib_LTLIBRARIES = libgtop.la
|
lib_LTLIBRARIES = libgtop.la
|
||||||
|
|
||||||
libgtop_la_SOURCES = init.c open.c close.c command.c read.c read_data.c \
|
libgtop_la_SOURCES = init.c open.c close.c command.c read.c \
|
||||||
write.c lib.c parameter.c
|
read_data.c write.c lib.c parameter.c \
|
||||||
|
sysdeps.c
|
||||||
|
|
||||||
BUILT_SOURCES = lib.c
|
BUILT_SOURCES = lib.c
|
||||||
|
|
||||||
|
@@ -37,8 +37,6 @@ glibtop_call_l (glibtop *server, unsigned command, size_t send_size,
|
|||||||
|
|
||||||
memset (&cmnd, 0, sizeof (glibtop_command));
|
memset (&cmnd, 0, sizeof (glibtop_command));
|
||||||
|
|
||||||
memcpy (&cmnd.server, server, sizeof (glibtop));
|
|
||||||
|
|
||||||
cmnd.command = command;
|
cmnd.command = command;
|
||||||
|
|
||||||
/* If send_size is less than _GLIBTOP_PARAM_SIZE (normally 16 Bytes), we
|
/* If send_size is less than _GLIBTOP_PARAM_SIZE (normally 16 Bytes), we
|
||||||
|
20
lib/init.c
20
lib/init.c
@@ -41,7 +41,7 @@ _init_server (glibtop *server, const unsigned features)
|
|||||||
|
|
||||||
if (server->server_command == NULL) {
|
if (server->server_command == NULL) {
|
||||||
const char *temp = getenv ("LIBGTOP_SERVER") ?
|
const char *temp = getenv ("LIBGTOP_SERVER") ?
|
||||||
getenv ("LIBGTOP_SERVER") : GTOP_SERVER;
|
getenv ("LIBGTOP_SERVER") : LIBGTOP_SERVER;
|
||||||
|
|
||||||
server->server_command = glibtop_strdup_r (server, temp);
|
server->server_command = glibtop_strdup_r (server, temp);
|
||||||
}
|
}
|
||||||
@@ -191,3 +191,21 @@ glibtop_init_r (glibtop **server_ptr, const unsigned long features,
|
|||||||
|
|
||||||
return server;
|
return server;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glibtop *
|
||||||
|
glibtop_init_s (glibtop **server, const unsigned long features,
|
||||||
|
const unsigned flags)
|
||||||
|
{
|
||||||
|
if (*server != NULL)
|
||||||
|
return *server;
|
||||||
|
|
||||||
|
fprintf (stderr, "DEBUG: %s (%d)\n", __FILE__, __LINE__);
|
||||||
|
|
||||||
|
if (glibtop_global_server == NULL) {
|
||||||
|
glibtop_global_server = &_glibtop_global_server;
|
||||||
|
glibtop_open_s (glibtop_global_server, "glibtop",
|
||||||
|
features, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
return *server = glibtop_global_server;
|
||||||
|
}
|
||||||
|
92
lib/lib.awk
92
lib/lib.awk
@@ -9,47 +9,89 @@ BEGIN {
|
|||||||
print "#include <glibtop/command.h>";
|
print "#include <glibtop/command.h>";
|
||||||
|
|
||||||
print "";
|
print "";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function output(feature) {
|
function output(line) {
|
||||||
if (feature ~ /^proclist$/) {
|
split (line, line_fields, /\|/);
|
||||||
print "unsigned *";
|
retval = line_fields[1];
|
||||||
prefix = "return ";
|
feature = line_fields[2];
|
||||||
|
param_typ = line_fields[4];
|
||||||
|
param = line_fields[5];
|
||||||
|
param_size = line_fields[6];
|
||||||
|
|
||||||
|
if (param_typ == "") {
|
||||||
|
param_size = "0";
|
||||||
|
param_ptr = "NULL";
|
||||||
} else {
|
} else {
|
||||||
prefix = "";
|
if (param_size == "")
|
||||||
print "void";
|
param_size = "sizeof ("param_typ")";
|
||||||
}
|
|
||||||
if (feature ~ /^proc_/) {
|
if (param_typ ~ /*/)
|
||||||
param = ", pid_t pid";
|
param_ptr = param;
|
||||||
} else {
|
else
|
||||||
param = "";
|
param_ptr = "&"param;
|
||||||
|
}
|
||||||
|
|
||||||
|
orig = feature; sub(/^@/,"",feature);
|
||||||
|
space = feature; gsub(/./," ",space);
|
||||||
|
|
||||||
|
print retval;
|
||||||
|
if (retval !~ /^void$/) {
|
||||||
|
prefix = "return ";
|
||||||
|
prefix_space = " ";
|
||||||
|
} else {
|
||||||
|
prefix = "";
|
||||||
|
prefix_space = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (param_typ != "") {
|
||||||
|
print "glibtop_get_"feature"_l (glibtop *server, glibtop_"feature" *buf,";
|
||||||
|
print " "space" "param_typ" "param")";
|
||||||
|
} else {
|
||||||
|
print "glibtop_get_"feature"_l (glibtop *server, glibtop_"feature" *buf)";
|
||||||
}
|
}
|
||||||
|
|
||||||
print "glibtop_get_"feature"_l (glibtop *server, glibtop_"feature" *buf"param")";
|
|
||||||
print "{";
|
print "{";
|
||||||
print "\tglibtop_init_r (&server, GLIBTOP_SYSDEPS_"toupper(feature)", 0);";
|
print "\tglibtop_init_r (&server, (1 << GLIBTOP_SYSDEPS_"toupper(feature)"), 0);";
|
||||||
print "";
|
print "";
|
||||||
print "\tif ((server->flags & _GLIBTOP_INIT_STATE_SERVER) &&";
|
print "\tif ((server->flags & _GLIBTOP_INIT_STATE_SERVER) &&";
|
||||||
print "\t (server->features & (1 << GLIBTOP_SYSDEPS_"toupper(feature)")))";
|
print "\t (server->features & (1 << GLIBTOP_SYSDEPS_"toupper(feature)")))";
|
||||||
print "\t{";
|
print "\t{";
|
||||||
|
|
||||||
if (feature ~ /^proc_/) {
|
if (param == "")
|
||||||
print "\t\t"prefix"glibtop_call_l (server, GLIBTOP_CMND_"toupper(feature)", sizeof (pid_t),";
|
|
||||||
print "\t\t\t\t&pid, sizeof (glibtop_"feature"), buf);";
|
|
||||||
print "\t} else {";
|
|
||||||
print "\t\t"prefix"glibtop_get_"feature"_r (server, buf, pid);";
|
|
||||||
} else {
|
|
||||||
print "\t\t"prefix"glibtop_call_l (server, GLIBTOP_CMND_"toupper(feature)", 0, NULL,";
|
print "\t\t"prefix"glibtop_call_l (server, GLIBTOP_CMND_"toupper(feature)", 0, NULL,";
|
||||||
print "\t\t\t sizeof (glibtop_"feature"), buf);";
|
else
|
||||||
print "\t} else {";
|
print "\t\t"prefix"glibtop_call_l (server, GLIBTOP_CMND_"toupper(feature)",";
|
||||||
print "\t\t"prefix"glibtop_get_"feature"_r (server, buf);";
|
|
||||||
|
if (param == "") {
|
||||||
|
print "\t\t\t\t"prefix_space"sizeof (glibtop_"feature"), buf);";
|
||||||
|
} else {
|
||||||
|
print "\t\t\t\t"prefix_space""param_size", "param_ptr",";
|
||||||
|
print "\t\t\t\t"prefix_space"sizeof (glibtop_"feature"),";
|
||||||
|
print "\t\t\t\t"prefix_space"buf);";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print "\t} else {";
|
||||||
|
|
||||||
|
if (orig !~ /^@/)
|
||||||
|
print "#if (!GLIBTOP_SUID_"toupper(feature)")";
|
||||||
|
|
||||||
|
if (param == "")
|
||||||
|
print "\t\t"prefix"glibtop_get_"feature"_r (server, buf);";
|
||||||
|
else
|
||||||
|
print "\t\t"prefix"glibtop_get_"feature"_r (server, buf, "param");";
|
||||||
|
|
||||||
|
if (orig !~ /^@/) {
|
||||||
|
print "#else";
|
||||||
|
print "\t\terrno = ENOSYS;";
|
||||||
|
print "\t\tglibtop_error_io_r (server, \"glibtop_get_"feature"\");";
|
||||||
|
print "#endif";
|
||||||
|
}
|
||||||
|
|
||||||
print "\t}";
|
print "\t}";
|
||||||
print "}";
|
print "}";
|
||||||
print "";
|
print "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/^(\w+)/ { output($1) }
|
/^[^#]/ { output($0) }
|
||||||
|
|
||||||
|
|
||||||
|
68
lib/open.c
68
lib/open.c
@@ -44,12 +44,41 @@ glibtop_open_l (glibtop *server, const char *program_name,
|
|||||||
|
|
||||||
server->flags |= _GLIBTOP_INIT_STATE_OPEN;
|
server->flags |= _GLIBTOP_INIT_STATE_OPEN;
|
||||||
|
|
||||||
|
if (flags & GLIBTOP_FEATURES_EXCEPT)
|
||||||
|
features = ~features & GLIBTOP_SYSDEPS_ALL;
|
||||||
|
|
||||||
|
if (features == 0)
|
||||||
|
features = GLIBTOP_SYSDEPS_ALL;
|
||||||
|
|
||||||
|
if (flags & GLIBTOP_FEATURES_NO_SERVER) {
|
||||||
|
server->method = GLIBTOP_METHOD_DIRECT;
|
||||||
|
features = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
server->features = features;
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
fprintf (stderr, "SIZEOF: %u - %u - %u - %u - %u - %u\n",
|
||||||
|
sizeof (glibtop_command), sizeof (glibtop_response),
|
||||||
|
sizeof (glibtop_mountentry), sizeof (glibtop_union),
|
||||||
|
sizeof (glibtop_sysdeps), sizeof (glibtop_response_union));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
switch (server->method) {
|
||||||
|
case GLIBTOP_METHOD_PIPE:
|
||||||
|
case GLIBTOP_METHOD_UNIX:
|
||||||
|
if (glibtop_server_features & features)
|
||||||
|
break;
|
||||||
|
|
||||||
|
fprintf (stderr, "Using the server is not required.\n");
|
||||||
|
|
||||||
|
server->method = GLIBTOP_METHOD_DIRECT;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
switch (server->method) {
|
switch (server->method) {
|
||||||
case GLIBTOP_METHOD_DIRECT:
|
case GLIBTOP_METHOD_DIRECT:
|
||||||
fprintf (stderr, "Calling sysdeps open function.\n");
|
server->features = 0;
|
||||||
|
|
||||||
glibtop_open_r (server, program_name, features, flags);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case GLIBTOP_METHOD_INET:
|
case GLIBTOP_METHOD_INET:
|
||||||
fprintf (stderr, "Connecting to '%s' port %ld.\n",
|
fprintf (stderr, "Connecting to '%s' port %ld.\n",
|
||||||
@@ -79,15 +108,7 @@ glibtop_open_l (glibtop *server, const char *program_name,
|
|||||||
break;
|
break;
|
||||||
case GLIBTOP_METHOD_PIPE:
|
case GLIBTOP_METHOD_PIPE:
|
||||||
fprintf (stderr, "Opening pipe to server (%s).\n",
|
fprintf (stderr, "Opening pipe to server (%s).\n",
|
||||||
GTOP_SERVER);
|
LIBGTOP_SERVER);
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (socketpair (AF_UNIX, SOCK_STREAM, 0, server->input))
|
|
||||||
glibtop_error_io_r (server, "socketpair");
|
|
||||||
|
|
||||||
if (socketpair (AF_UNIX, SOCK_STREAM, 0, server->output))
|
|
||||||
glibtop_error_io_r (server, "socketpair");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (pipe (server->input) || pipe (server->output))
|
if (pipe (server->input) || pipe (server->output))
|
||||||
glibtop_error_io_r (server, "cannot make a pipe");
|
glibtop_error_io_r (server, "cannot make a pipe");
|
||||||
@@ -101,15 +122,17 @@ glibtop_open_l (glibtop *server, const char *program_name,
|
|||||||
close (server->input [0]); close (server->output [1]);
|
close (server->input [0]); close (server->output [1]);
|
||||||
dup2 (server->input [1], 1);
|
dup2 (server->input [1], 1);
|
||||||
dup2 (server->output [0], 0);
|
dup2 (server->output [0], 0);
|
||||||
execl (GTOP_SERVER, NULL);
|
execl (LIBGTOP_SERVER, NULL);
|
||||||
glibtop_error_io_r (server, "execl %s", GTOP_SERVER);
|
glibtop_error_io_r (server, "execl (%s)",
|
||||||
|
LIBGTOP_SERVER);
|
||||||
_exit (2);
|
_exit (2);
|
||||||
}
|
}
|
||||||
|
|
||||||
close (server->input [1]);
|
close (server->input [1]);
|
||||||
close (server->output [0]);
|
close (server->output [0]);
|
||||||
|
|
||||||
sprintf (version, "%s server %s ready.\n", PACKAGE, VERSION);
|
sprintf (version, "libgtop server %s ready.\n",
|
||||||
|
LIBGTOP_VERSION);
|
||||||
|
|
||||||
glibtop_read_l (server, sizeof (nbytes), &nbytes);
|
glibtop_read_l (server, sizeof (nbytes), &nbytes);
|
||||||
|
|
||||||
@@ -121,7 +144,11 @@ glibtop_open_l (glibtop *server, const char *program_name,
|
|||||||
|
|
||||||
if (memcmp (version, buffer, strlen (version)))
|
if (memcmp (version, buffer, strlen (version)))
|
||||||
glibtop_error_r (server, "server version is not %s",
|
glibtop_error_r (server, "server version is not %s",
|
||||||
VERSION);
|
LIBGTOP_VERSION);
|
||||||
|
|
||||||
|
server->flags |= _GLIBTOP_INIT_STATE_SERVER;
|
||||||
|
|
||||||
|
server->features = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,4 +165,11 @@ glibtop_open_l (glibtop *server, const char *program_name,
|
|||||||
fprintf (stderr, "Server features are %lu.\n",
|
fprintf (stderr, "Server features are %lu.\n",
|
||||||
server->features);
|
server->features);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* In any case, we call the open functions of our own sysdeps
|
||||||
|
* directory. */
|
||||||
|
|
||||||
|
fprintf (stderr, "Calling sysdeps open function.\n");
|
||||||
|
|
||||||
|
glibtop_open_s (server, program_name, features, flags);
|
||||||
}
|
}
|
||||||
|
@@ -8,18 +8,26 @@ LIBGTOP_INCLUDEDIR="@LIBGTOP_INCLUDEDIR@"
|
|||||||
LIBGTOP_LIBS="@LIBGTOP_LIBS@"
|
LIBGTOP_LIBS="@LIBGTOP_LIBS@"
|
||||||
LIBGTOP_INCS="@LIBGTOP_INCS@"
|
LIBGTOP_INCS="@LIBGTOP_INCS@"
|
||||||
|
|
||||||
|
LIBGTOP_NAMES_LIBS="@LIBGTOP_NAMES_LIBS@"
|
||||||
|
LIBGTOP_NAMES_INCS="@LIBGTOP_NAMES_INCS@"
|
||||||
|
|
||||||
LIBGTOP_GUILE_LIBS="@LIBGTOP_GUILE_LIBS@"
|
LIBGTOP_GUILE_LIBS="@LIBGTOP_GUILE_LIBS@"
|
||||||
LIBGTOP_GUILE_INCS="@LIBGTOP_GUILE_INCS@"
|
LIBGTOP_GUILE_INCS="@LIBGTOP_GUILE_INCS@"
|
||||||
|
|
||||||
|
LIBGTOP_GUILE_NAMES_LIBS="@LIBGTOP_GUILE_NAMES_LIBS@"
|
||||||
|
LIBGTOP_GUILE_NAMES_INCS="@LIBGTOP_GUILE_NAMES_INCS@"
|
||||||
|
|
||||||
LIBGTOP_BINDIR="@LIBGTOP_BINDIR@"
|
LIBGTOP_BINDIR="@LIBGTOP_BINDIR@"
|
||||||
LIBGTOP_SERVER="@LIBGTOP_SERVER@"
|
LIBGTOP_SERVER="@LIBGTOP_SERVER@"
|
||||||
|
|
||||||
|
LIBGTOP_MAJOR_VERSION="@LIBGTOP_MAJOR_VERSION@"
|
||||||
|
LIBGTOP_MINOR_VERSION="@LIBGTOP_MINOR_VERSION@"
|
||||||
|
LIBGTOP_VERSION="@LIBGTOP_VERSION@"
|
||||||
|
|
||||||
libgtop_sysdeps_dir="@libgtop_sysdeps_dir@"
|
libgtop_sysdeps_dir="@libgtop_sysdeps_dir@"
|
||||||
libgtop_need_server="@libgtop_need_server@"
|
libgtop_need_server="@libgtop_need_server@"
|
||||||
libgtop_use_machine_h="@libgtop_use_machine_h@"
|
libgtop_use_machine_h="@libgtop_use_machine_h@"
|
||||||
|
|
||||||
libgtop_guile_found="@libgtop_guile_found@"
|
libgtop_guile_found="@libgtop_guile_found@"
|
||||||
|
|
||||||
libgtop_want_names="@libgtop_want_names@"
|
|
||||||
libgtop_want_guile_names="@libgtop_want_guile_names@"
|
|
||||||
libgtop_want_examples="@libgtop_want_examples@"
|
libgtop_want_examples="@libgtop_want_examples@"
|
||||||
|
@@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
#include <string.h> /* for strcmp */
|
#include <string.h> /* for strcmp */
|
||||||
#include <stdio.h> /* for parse error output */
|
#include <stdio.h> /* for parse error output */
|
||||||
#include "proc/readproc.h" /* for proc_t */
|
#include "readproc.h" /* for proc_t */
|
||||||
#include "proc/tree.h" /* for struct tree_node */
|
#include "tree.h" /* for struct tree_node */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This module was written by Charles Blake for procps.
|
This module was written by Charles Blake for procps.
|
||||||
|
@@ -22,9 +22,9 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
#include "proc/psdata.h"
|
#include "psdata.h"
|
||||||
#include "proc/ps.h"
|
#include "ps.h"
|
||||||
#include "proc/version.h"
|
#include "version.h"
|
||||||
|
|
||||||
#define MAX_ADDR_SZ 32
|
#define MAX_ADDR_SZ 32
|
||||||
static char *sysmap, *sysmap_last, sysmap_fmt[10];
|
static char *sysmap, *sysmap_last, sysmap_fmt[10];
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include "proc/ps.h"
|
#include "ps.h"
|
||||||
|
|
||||||
#define HASHSIZE 16 /* power of 2 */
|
#define HASHSIZE 16 /* power of 2 */
|
||||||
#define HASH(x) ((x) & (HASHSIZE - 1))
|
#define HASH(x) ((x) & (HASHSIZE - 1))
|
||||||
|
@@ -2,10 +2,10 @@
|
|||||||
* New Interface to Process Table -- PROCTAB Stream (a la Directory streams)
|
* New Interface to Process Table -- PROCTAB Stream (a la Directory streams)
|
||||||
* Copyright(C) 1996. Charles L. Blake.
|
* Copyright(C) 1996. Charles L. Blake.
|
||||||
*/
|
*/
|
||||||
#include "proc/version.h"
|
#include "version.h"
|
||||||
#include "proc/readproc.h"
|
#include "readproc.h"
|
||||||
#include "proc/devname.h"
|
#include "devname.h"
|
||||||
#include "proc/ps.h"
|
#include "ps.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "proc/signals.h"
|
#include "signals.h"
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#include "proc/ps.h"
|
#include "ps.h"
|
||||||
#include "proc/readproc.h"
|
#include "readproc.h"
|
||||||
|
|
||||||
char * status(proc_t* task) {
|
char * status(proc_t* task) {
|
||||||
static char buf[4] = " ";
|
static char buf[4] = " ";
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/* File for parsing top-level /proc entities. */
|
/* File for parsing top-level /proc entities. */
|
||||||
#include "proc/sysinfo.h"
|
#include "sysinfo.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "proc/version.h"
|
#include "version.h"
|
||||||
|
|
||||||
#define BAD_OPEN_MESSAGE \
|
#define BAD_OPEN_MESSAGE \
|
||||||
"Error: /proc must be mounted\n" \
|
"Error: /proc must be mounted\n" \
|
||||||
|
@@ -21,8 +21,8 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <utmp.h>
|
#include <utmp.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include "proc/whattime.h"
|
#include "whattime.h"
|
||||||
#include "proc/sysinfo.h"
|
#include "sysinfo.h"
|
||||||
|
|
||||||
static char buf[128];
|
static char buf[128];
|
||||||
double av[3];
|
double av[3];
|
||||||
|
235
po/POTFILES.in
235
po/POTFILES.in
@@ -1,68 +1,205 @@
|
|||||||
lib/close.c
|
|
||||||
lib/command.c
|
lib/command.c
|
||||||
|
lib/close.c
|
||||||
|
lib/init.c
|
||||||
|
lib/sysdeps.c
|
||||||
lib/open.c
|
lib/open.c
|
||||||
lib/read.c
|
lib/read.c
|
||||||
lib/write.c
|
|
||||||
lib/read_data.c
|
lib/read_data.c
|
||||||
acconfig.h
|
lib/parameter.c
|
||||||
glibtop.h
|
lib/write.c
|
||||||
include/glibtop/command.h
|
examples/mountlist.c
|
||||||
|
examples/first.c
|
||||||
|
examples/second.c
|
||||||
|
examples/third.c
|
||||||
include/glibtop/close.h
|
include/glibtop/close.h
|
||||||
include/glibtop/global.h
|
include/glibtop/signal.h
|
||||||
|
include/glibtop/command.h
|
||||||
include/glibtop/cpu.h
|
include/glibtop/cpu.h
|
||||||
|
include/glibtop/global.h
|
||||||
include/glibtop/error.h
|
include/glibtop/error.h
|
||||||
include/glibtop/shm_limits.h
|
|
||||||
include/glibtop/uptime.h
|
|
||||||
include/glibtop/output.h
|
|
||||||
include/glibtop/mem.h
|
|
||||||
include/glibtop/open.h
|
|
||||||
include/glibtop/sysdeps.h
|
|
||||||
include/glibtop/union.h
|
|
||||||
include/glibtop/read.h
|
|
||||||
include/glibtop/swap.h
|
|
||||||
include/glibtop/loadavg.h
|
include/glibtop/loadavg.h
|
||||||
|
include/glibtop/mem.h
|
||||||
|
include/glibtop/msg_limits.h
|
||||||
|
include/glibtop/open.h
|
||||||
|
include/glibtop/output.h
|
||||||
|
include/glibtop/prockernel.h
|
||||||
|
include/glibtop/proclist.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/swap.h
|
||||||
|
include/glibtop/sysdeps.h
|
||||||
|
include/glibtop/types.h
|
||||||
|
include/glibtop/union.h
|
||||||
|
include/glibtop/uptime.h
|
||||||
include/glibtop/version.h
|
include/glibtop/version.h
|
||||||
include/glibtop/write.h
|
include/glibtop/write.h
|
||||||
|
include/glibtop/parameter.h
|
||||||
|
include/glibtop/gnuserv.h
|
||||||
|
include/glibtop/mountlist.h
|
||||||
include/glibtop/xmalloc.h
|
include/glibtop/xmalloc.h
|
||||||
include/glibtop/msg_limits.h
|
src/daemon/main.c
|
||||||
include/glibtop/proclist.h
|
src/daemon/slave.c
|
||||||
include/glibtop/sem_limits.h
|
src/daemon/io.c
|
||||||
include/glibtop/read_data.h
|
src/daemon/server_config.h
|
||||||
src/server/main.c
|
src/daemon/daemon.h
|
||||||
src/server/output.c
|
src/daemon/gnuserv.c
|
||||||
src/server/version.c
|
sysdeps/common/gnuslib.c
|
||||||
|
sysdeps/common/fsusage.c
|
||||||
|
sysdeps/common/fsusage.h
|
||||||
|
sysdeps/common/mountlist.c
|
||||||
|
sysdeps/common/mountlist.h
|
||||||
|
sysdeps/linux/loadavg.c
|
||||||
sysdeps/linux/close.c
|
sysdeps/linux/close.c
|
||||||
sysdeps/linux/cpu.c
|
sysdeps/linux/cpu.c
|
||||||
sysdeps/linux/mem.c
|
|
||||||
sysdeps/linux/open.c
|
|
||||||
sysdeps/linux/swap.c
|
|
||||||
sysdeps/linux/shm_limits.c
|
|
||||||
sysdeps/linux/msg_limits.c
|
sysdeps/linux/msg_limits.c
|
||||||
sysdeps/linux/uptime.c
|
sysdeps/linux/mem.c
|
||||||
sysdeps/linux/loadavg.c
|
sysdeps/linux/procdata.c
|
||||||
sysdeps/linux/sem_limits.c
|
sysdeps/linux/open.c
|
||||||
|
sysdeps/linux/prockernel.c
|
||||||
sysdeps/linux/proclist.c
|
sysdeps/linux/proclist.c
|
||||||
sysdeps/stub/proclist.c
|
sysdeps/linux/procmem.c
|
||||||
sysdeps/stub/close.c
|
sysdeps/linux/procsegment.c
|
||||||
sysdeps/stub/cpu.c
|
sysdeps/linux/procsignal.c
|
||||||
sysdeps/stub/mem.c
|
sysdeps/linux/procstate.c
|
||||||
sysdeps/stub/open.c
|
sysdeps/linux/proctime.c
|
||||||
sysdeps/stub/swap.c
|
sysdeps/linux/procuid.c
|
||||||
sysdeps/stub/loadavg.c
|
sysdeps/linux/sem_limits.c
|
||||||
sysdeps/stub/uptime.c
|
sysdeps/linux/siglist.c
|
||||||
sysdeps/stub/shm_limits.c
|
sysdeps/linux/glibtop_server.h
|
||||||
sysdeps/stub/msg_limits.c
|
sysdeps/linux/swap.c
|
||||||
sysdeps/stub/sem_limits.c
|
sysdeps/linux/uptime.c
|
||||||
sysdeps/common/sysdeps.c
|
sysdeps/linux/glibtop_machine.h
|
||||||
sysdeps/common/xmalloc.c
|
sysdeps/linux/shm_limits.c
|
||||||
sysdeps/common/error.c
|
|
||||||
sysdeps/names/sysdeps.c
|
|
||||||
sysdeps/names/cpu.c
|
|
||||||
sysdeps/names/loadavg.c
|
sysdeps/names/loadavg.c
|
||||||
|
sysdeps/names/cpu.c
|
||||||
|
sysdeps/names/msg_limits.c
|
||||||
sysdeps/names/mem.c
|
sysdeps/names/mem.c
|
||||||
|
sysdeps/names/prockernel.c
|
||||||
|
sysdeps/names/proclist.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/swap.c
|
||||||
sysdeps/names/uptime.c
|
sysdeps/names/uptime.c
|
||||||
sysdeps/names/shm_limits.c
|
sysdeps/names/sysdeps.c
|
||||||
sysdeps/names/msg_limits.c
|
sysdeps/osf1/close.c
|
||||||
sysdeps/names/sem_limits.c
|
sysdeps/osf1/glibtop_machine.h
|
||||||
sysdeps/names/proclist.c
|
sysdeps/osf1/loadavg.c
|
||||||
|
sysdeps/osf1/cpu.c
|
||||||
|
sysdeps/osf1/msg_limits.c
|
||||||
|
sysdeps/osf1/mem.c
|
||||||
|
sysdeps/osf1/procdata.c
|
||||||
|
sysdeps/osf1/open.c
|
||||||
|
sysdeps/osf1/sem_limits.c
|
||||||
|
sysdeps/osf1/shm_limits.c
|
||||||
|
sysdeps/osf1/glibtop_server.h
|
||||||
|
sysdeps/osf1/siglist.c
|
||||||
|
sysdeps/osf1/swap.c
|
||||||
|
sysdeps/osf1/uptime.c
|
||||||
|
sysdeps/stub/loadavg.c
|
||||||
|
sysdeps/stub/close.c
|
||||||
|
sysdeps/stub/cpu.c
|
||||||
|
sysdeps/stub/msg_limits.c
|
||||||
|
sysdeps/stub/mem.c
|
||||||
|
sysdeps/stub/prockernel.c
|
||||||
|
sysdeps/stub/open.c
|
||||||
|
sysdeps/stub/proclist.c
|
||||||
|
sysdeps/stub/procmem.c
|
||||||
|
sysdeps/stub/procsegment.c
|
||||||
|
sysdeps/stub/procsignal.c
|
||||||
|
sysdeps/stub/procstate.c
|
||||||
|
sysdeps/stub/proctime.c
|
||||||
|
sysdeps/stub/procuid.c
|
||||||
|
sysdeps/stub/sem_limits.c
|
||||||
|
sysdeps/stub/swap.c
|
||||||
|
sysdeps/stub/glibtop_server.h
|
||||||
|
sysdeps/stub/shm_limits.c
|
||||||
|
sysdeps/stub/siglist.c
|
||||||
|
sysdeps/stub/uptime.c
|
||||||
|
sysdeps/kernel/loadavg.c
|
||||||
|
sysdeps/kernel/close.c
|
||||||
|
sysdeps/kernel/cpu.c
|
||||||
|
sysdeps/kernel/msg_limits.c
|
||||||
|
sysdeps/kernel/mem.c
|
||||||
|
sysdeps/kernel/procdata.c
|
||||||
|
sysdeps/kernel/open.c
|
||||||
|
sysdeps/kernel/prockernel.c
|
||||||
|
sysdeps/kernel/proclist.c
|
||||||
|
sysdeps/kernel/procmem.c
|
||||||
|
sysdeps/kernel/procsegment.c
|
||||||
|
sysdeps/kernel/procsignal.c
|
||||||
|
sysdeps/kernel/procstate.c
|
||||||
|
sysdeps/kernel/proctime.c
|
||||||
|
sysdeps/kernel/procuid.c
|
||||||
|
sysdeps/kernel/sem_limits.c
|
||||||
|
sysdeps/kernel/kernel.h
|
||||||
|
sysdeps/kernel/glibtop_server.h
|
||||||
|
sysdeps/kernel/swap.c
|
||||||
|
sysdeps/kernel/uptime.c
|
||||||
|
sysdeps/kernel/shm_limits.c
|
||||||
|
sysdeps/kernel/siglist.c
|
||||||
|
intl/bindtextdom.c
|
||||||
|
intl/cat-compat.c
|
||||||
|
intl/dcgettext.c
|
||||||
|
intl/dgettext.c
|
||||||
|
intl/explodename.c
|
||||||
|
intl/gettext.h
|
||||||
|
intl/gettextP.h
|
||||||
|
intl/hash-string.h
|
||||||
|
intl/finddomain.c
|
||||||
|
intl/gettext.c
|
||||||
|
intl/libgettext.h
|
||||||
|
intl/loadinfo.h
|
||||||
|
intl/intl-compat.c
|
||||||
|
intl/l10nflist.c
|
||||||
|
intl/loadmsgcat.c
|
||||||
|
intl/localealias.c
|
||||||
|
intl/textdomain.c
|
||||||
|
support/argp-ba.c
|
||||||
|
support/argp-eexst.c
|
||||||
|
support/argp-fmtstream.c
|
||||||
|
support/argp-fmtstream.h
|
||||||
|
support/argp-fs-xinl.c
|
||||||
|
support/argp-help.c
|
||||||
|
support/argp-namefrob.h
|
||||||
|
support/argp-parse.c
|
||||||
|
support/argp-pv.c
|
||||||
|
support/argp-pvh.c
|
||||||
|
support/argp-test.c
|
||||||
|
support/argp-xinl.c
|
||||||
|
support/argp.h
|
||||||
|
support/easy-vsnprintf.c
|
||||||
|
support/getopt.c
|
||||||
|
support/getopt.h
|
||||||
|
support/getopt1.c
|
||||||
|
support/gnome-argp.c
|
||||||
|
support/gnome-argp.h
|
||||||
|
support/long-options.c
|
||||||
|
support/long-options.h
|
||||||
|
support/scandir.c
|
||||||
|
support/strcasecmp.c
|
||||||
|
support/strerror.c
|
||||||
|
support/strndup.c
|
||||||
|
support/strnlen.c
|
||||||
|
support/strtok_r.c
|
||||||
|
support/vasprintf.c
|
||||||
|
support/vsnprintf.c
|
||||||
|
support/strtod.c
|
||||||
|
support/memmove.c
|
||||||
|
support/mkstemp.c
|
||||||
|
support/strtol.c
|
||||||
|
support/strtoul.c
|
||||||
|
glibtop.h
|
||||||
|
@@ -1 +1,10 @@
|
|||||||
SUBDIRS = server daemon
|
if NEED_LIBGTOP
|
||||||
|
server_SUBDIRS = server
|
||||||
|
else
|
||||||
|
server_SUBDIRS =
|
||||||
|
endif
|
||||||
|
|
||||||
|
SUBDIRS = $(server_SUBDIRS) daemon
|
||||||
|
|
||||||
|
DIST_SUBDIRS = server daemon
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
Makefile.in
|
Makefile.in
|
||||||
Makefile
|
Makefile
|
||||||
gnuserv
|
libgtop_daemon
|
||||||
server_config.h
|
server_config.h
|
||||||
|
server.conf
|
||||||
|
@@ -1,25 +1,22 @@
|
|||||||
LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
|
LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
|
||||||
|
|
||||||
INCLUDES = -I$(top_builddir) -I$(top_srcdir) @machine_incs@ \
|
CFLAGS = -Wall -W @CFLAGS@ \
|
||||||
-I$(top_srcdir)/include -I$(top_srcdir)/intl @GUILE_INCS@ \
|
-DDEBUG -DREAL_DEBUG -D_BSD \
|
||||||
-DGTOPLOCALEDIR=\"$(datadir)/locale\" -D_GNU_SOURCE
|
-DPARENT_DEBUG -DSLAVE_DEBUG \
|
||||||
|
-DGLIBTOP_DAEMON_SLAVE
|
||||||
|
|
||||||
CFLAGS = -Wall -W @CFLAGS@ -DGTOP_SERVER=\""@LIBGTOP_SERVER@"\" -DDEBUG -DREAL_DEBUG
|
bin_PROGRAMS = libgtop_daemon
|
||||||
|
|
||||||
bin_PROGRAMS = gnuserv
|
if NEED_LIBGTOP
|
||||||
|
suid_sysdeps = $(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps_suid.la
|
||||||
|
else
|
||||||
|
suid_sysdeps =
|
||||||
|
endif
|
||||||
|
|
||||||
EXTRA_PROGRAMS = gtop_daemon
|
libgtop_daemon_SOURCES = gnuserv.c slave.c main.c io.c
|
||||||
|
libgtop_daemon_LDADD = $(top_builddir)/lib/libgtop.la \
|
||||||
gnuserv_SOURCES = gnuserv.c main.c slave.c
|
|
||||||
gnuserv_LDADD = $(top_builddir)/lib/libgtop.la \
|
|
||||||
$(top_builddir)/sysdeps/common/libgtop_common.la \
|
$(top_builddir)/sysdeps/common/libgtop_common.la \
|
||||||
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
|
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
|
||||||
|
@sysdeps_suid_lib@ \
|
||||||
@INTLLIBS@ @LIBSUPPORT@ @X_LIBS@ -lXau
|
@INTLLIBS@ @LIBSUPPORT@ @X_LIBS@ -lXau
|
||||||
gnuserv_LDFLAGS = -static
|
libgtop_daemon_LDFLAGS = -static
|
||||||
|
|
||||||
gtop_daemon_SOURCES = main.c inet.c loop.c output.c version.c
|
|
||||||
gtop_daemon_LDADD = $(top_builddir)/lib/libgtop.la \
|
|
||||||
$(top_builddir)/sysdeps/common/libgtop_common.la \
|
|
||||||
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
|
|
||||||
@INTLLIBS@ @LIBSUPPORT@
|
|
||||||
gtop_daemon_LDFLAGS = -static
|
|
||||||
|
61
src/daemon/daemon.h
Normal file
61
src/daemon/daemon.h
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
/* $Id$ */
|
||||||
|
|
||||||
|
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
|
This file is part of the Gnome Top Library.
|
||||||
|
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||||
|
|
||||||
|
The Gnome Top Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The Gnome Top Library 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
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#ifndef __GLIBTOP_DAEMON_H__
|
||||||
|
#define __GLIBTOP_DAEMON_H__
|
||||||
|
|
||||||
|
#include <glibtop.h>
|
||||||
|
#include <glibtop/gnuserv.h>
|
||||||
|
|
||||||
|
#include <glibtop/open.h>
|
||||||
|
#include <glibtop/union.h>
|
||||||
|
#include <glibtop/xmalloc.h>
|
||||||
|
#include <glibtop/version.h>
|
||||||
|
#include <glibtop/command.h>
|
||||||
|
#include <glibtop/parameter.h>
|
||||||
|
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#if defined(HAVE_GETDTABLESIZE)
|
||||||
|
#define GET_MAX_FDS() getdtablesize()
|
||||||
|
#else
|
||||||
|
/* Fallthrough case - please add other #elif cases above
|
||||||
|
for different OS's as necessary */
|
||||||
|
#define GET_MAX_FDS() 256
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define _offset_union(p) ((char *) &resp->u.p - (char *) resp)
|
||||||
|
#define _offset_data(p) _offset_union (data.p)
|
||||||
|
|
||||||
|
#define MSG_BUFSZ sizeof (struct _glibtop_ipc_message)
|
||||||
|
#define MSG_MSGSZ (MSG_BUFSZ - sizeof (long))
|
||||||
|
|
||||||
|
extern void handle_slave_connection __P((int, int));
|
||||||
|
extern void handle_slave_command __P((glibtop_command *, glibtop_response *, const void *));
|
||||||
|
|
||||||
|
extern void do_output __P((int, glibtop_response *, off_t, size_t, const void *));
|
||||||
|
extern int do_read __P((int, void *, size_t));
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
@@ -49,7 +49,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern void handle_parent_connection __P ((int));
|
extern void handle_parent_connection __P ((int));
|
||||||
extern void handle_child_connection __P ((int));
|
extern void handle_slave_connection __P ((int, int));
|
||||||
extern void handle_ipc_connection __P ((int));
|
extern void handle_ipc_connection __P ((int));
|
||||||
|
|
||||||
#if !defined(UNIX_DOMAIN_SOCKETS) && !defined(INTERNET_DOMAIN_SOCKETS)
|
#if !defined(UNIX_DOMAIN_SOCKETS) && !defined(INTERNET_DOMAIN_SOCKETS)
|
||||||
@@ -216,7 +216,7 @@ static int
|
|||||||
setup_table (void)
|
setup_table (void)
|
||||||
{
|
{
|
||||||
char hostname [HOSTNAMSZ];
|
char hostname [HOSTNAMSZ];
|
||||||
u_int host_addr;
|
long host_addr;
|
||||||
int i, hosts = 0;
|
int i, hosts = 0;
|
||||||
|
|
||||||
/* Make sure every entry is null */
|
/* Make sure every entry is null */
|
||||||
@@ -225,7 +225,7 @@ setup_table (void)
|
|||||||
|
|
||||||
gethostname (hostname, HOSTNAMSZ);
|
gethostname (hostname, HOSTNAMSZ);
|
||||||
|
|
||||||
if (((long) host_addr = glibtop_internet_addr (hostname)) == -1)
|
if ((host_addr = glibtop_internet_addr (hostname)) == -1)
|
||||||
glibtop_error ("Can't resolve '%s'", hostname);
|
glibtop_error ("Can't resolve '%s'", hostname);
|
||||||
|
|
||||||
#ifdef AUTH_MAGIC_COOKIE
|
#ifdef AUTH_MAGIC_COOKIE
|
||||||
@@ -326,13 +326,15 @@ handle_internet_request (int ls)
|
|||||||
glibtop_error_io ("accept");
|
glibtop_error_io ("accept");
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf (stderr, "Connection was made from %s.\n", inet_ntoa (peer.sin_addr));
|
fprintf (stderr, "Connection was made from %s.\n",
|
||||||
|
inet_ntoa (peer.sin_addr));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Check that access is allowed - if not return crud to the client */
|
/* Check that access is allowed - if not return crud to the client */
|
||||||
if (!permitted (peer.sin_addr.s_addr, s)) {
|
if (!permitted (peer.sin_addr.s_addr, s)) {
|
||||||
close (s);
|
close (s);
|
||||||
glibtop_warn ("Refused connection from %s.", inet_ntoa (peer.sin_addr));
|
glibtop_warn ("Refused connection from %s.",
|
||||||
|
inet_ntoa (peer.sin_addr));
|
||||||
return;
|
return;
|
||||||
} /* if */
|
} /* if */
|
||||||
|
|
||||||
@@ -453,6 +455,7 @@ handle_unix_request (int ls)
|
|||||||
fprintf (stderr, "Accepted connection on socket %d.\n", s);
|
fprintf (stderr, "Accepted connection on socket %d.\n", s);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef GLIBTOP_DAEMON_SLAVE
|
||||||
pid = fork ();
|
pid = fork ();
|
||||||
|
|
||||||
if (pid == -1)
|
if (pid == -1)
|
||||||
@@ -461,7 +464,8 @@ handle_unix_request (int ls)
|
|||||||
if (pid)
|
if (pid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
handle_child_connection (s);
|
handle_slave_connection (s, s);
|
||||||
|
#endif
|
||||||
|
|
||||||
close (s);
|
close (s);
|
||||||
|
|
||||||
@@ -502,7 +506,11 @@ main (int argc, char *argv [])
|
|||||||
|
|
||||||
signal (SIGCHLD, handle_signal);
|
signal (SIGCHLD, handle_signal);
|
||||||
|
|
||||||
|
#ifdef GLIBTOP_DAEMON_SLAVE
|
||||||
pid = fork ();
|
pid = fork ();
|
||||||
|
#else
|
||||||
|
pid = getpid ();
|
||||||
|
#endif
|
||||||
|
|
||||||
if (pid == -1)
|
if (pid == -1)
|
||||||
glibtop_error_io ("fork failed");
|
glibtop_error_io ("fork failed");
|
||||||
@@ -542,7 +550,11 @@ main (int argc, char *argv [])
|
|||||||
} else {
|
} else {
|
||||||
/* We are the parent. */
|
/* We are the parent. */
|
||||||
|
|
||||||
|
#ifdef GLIBTOP_DAEMON_SLAVE
|
||||||
const unsigned method = GLIBTOP_METHOD_UNIX;
|
const unsigned method = GLIBTOP_METHOD_UNIX;
|
||||||
|
#else
|
||||||
|
const unsigned method = GLIBTOP_METHOD_PIPE;
|
||||||
|
#endif
|
||||||
|
|
||||||
const unsigned long features = GLIBTOP_SYSDEPS_ALL;
|
const unsigned long features = GLIBTOP_SYSDEPS_ALL;
|
||||||
|
|
||||||
@@ -591,6 +603,9 @@ main (int argc, char *argv [])
|
|||||||
getuid (), geteuid (), getgid (), getegid ());
|
getuid (), geteuid (), getgid (), getegid ());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Give our child a little time to start up. */
|
||||||
|
sleep (2);
|
||||||
|
|
||||||
#ifdef INTERNET_DOMAIN_SOCKETS
|
#ifdef INTERNET_DOMAIN_SOCKETS
|
||||||
/* get a internet domain socket to listen on. */
|
/* get a internet domain socket to listen on. */
|
||||||
ils = internet_init ();
|
ils = internet_init ();
|
||||||
@@ -657,8 +672,11 @@ main (int argc, char *argv [])
|
|||||||
handle_internet_request (ils);
|
handle_internet_request (ils);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (FD_ISSET (fileno (stdin), &rmask))
|
#ifdef GLIBTOP_DAEMON_SLAVE
|
||||||
handle_child_connection (fileno (stdin));
|
if ((pid == 0) && FD_ISSET (fileno (stdin), &rmask))
|
||||||
|
handle_slave_connection (fileno (stdin),
|
||||||
|
fileno (stdout));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
82
src/daemon/io.c
Normal file
82
src/daemon/io.c
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
/* $Id$ */
|
||||||
|
|
||||||
|
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
|
This file is part of the Gnome Top Library.
|
||||||
|
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||||
|
|
||||||
|
The Gnome Top Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The Gnome Top Library 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
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#include "daemon.h"
|
||||||
|
|
||||||
|
void
|
||||||
|
do_output (int s, glibtop_response *resp, off_t offset,
|
||||||
|
size_t data_size, const void *data)
|
||||||
|
{
|
||||||
|
#ifdef REAL_DEBUG
|
||||||
|
fprintf (stderr, "Really writing %d bytes at offset %lu.\n",
|
||||||
|
sizeof (glibtop_response), offset);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
resp->offset = offset;
|
||||||
|
resp->data_size = data_size;
|
||||||
|
|
||||||
|
if (send (s, resp, sizeof (glibtop_response), 0) < 0)
|
||||||
|
glibtop_warn_io ("send");
|
||||||
|
|
||||||
|
if (resp->data_size) {
|
||||||
|
#ifdef REAL_DEBUG
|
||||||
|
fprintf (stderr, "Writing %d bytes of data.\n", resp->data_size);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (send (s, data, resp->data_size, 0) , 0)
|
||||||
|
glibtop_warn_io ("send");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
do_read (int s, void *ptr, size_t total_size)
|
||||||
|
{
|
||||||
|
int nread;
|
||||||
|
size_t already_read = 0, remaining = total_size;
|
||||||
|
|
||||||
|
while (already_read < total_size) {
|
||||||
|
if (s)
|
||||||
|
nread = recv (s, ptr, remaining, 0);
|
||||||
|
else
|
||||||
|
nread = read (0, ptr, remaining);
|
||||||
|
|
||||||
|
if ((already_read == 0) && (nread == 0)) {
|
||||||
|
glibtop_warn ("pid %d received eof.", getpid ());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nread <= 0) {
|
||||||
|
glibtop_warn_io ("recv");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
already_read += nread;
|
||||||
|
remaining -= nread;
|
||||||
|
(char *) ptr += nread;
|
||||||
|
|
||||||
|
#ifdef REAL_DEBUG
|
||||||
|
fprintf (stderr, "READ (%d): %d - %d - %d\n",
|
||||||
|
nread, already_read, remaining, total_size);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
return already_read;
|
||||||
|
}
|
@@ -19,99 +19,7 @@
|
|||||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Boston, MA 02111-1307, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <glibtop/gnuserv.h>
|
#include "daemon.h"
|
||||||
|
|
||||||
#include <glibtop/open.h>
|
|
||||||
#include <glibtop/union.h>
|
|
||||||
#include <glibtop/xmalloc.h>
|
|
||||||
#include <glibtop/version.h>
|
|
||||||
#include <glibtop/command.h>
|
|
||||||
#include <glibtop/parameter.h>
|
|
||||||
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <locale.h>
|
|
||||||
|
|
||||||
#undef REAL_DEBUG
|
|
||||||
#define PARENT_DEBUG
|
|
||||||
|
|
||||||
#define MSG_BUFSZ sizeof (struct _glibtop_ipc_message)
|
|
||||||
#define MSG_MSGSZ (MSG_BUFSZ - sizeof (long))
|
|
||||||
|
|
||||||
#if defined(HAVE_GETDTABLESIZE)
|
|
||||||
#define GET_MAX_FDS() getdtablesize()
|
|
||||||
#else
|
|
||||||
/* Fallthrough case - please add other #elif cases above
|
|
||||||
for different OS's as necessary */
|
|
||||||
#define GET_MAX_FDS() 256
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern void handle_slave_command __P((glibtop_command *, glibtop_response *, const void *));
|
|
||||||
|
|
||||||
#define _offset_union(p) ((char *) &resp->u.p - (char *) resp)
|
|
||||||
#define _offset_data(p) _offset_union (data.p)
|
|
||||||
|
|
||||||
static void do_output __P((int, glibtop_response *, off_t, size_t, const void *));
|
|
||||||
static int do_read __P((int, void *, size_t));
|
|
||||||
|
|
||||||
static void
|
|
||||||
do_output (int s, glibtop_response *resp, off_t offset,
|
|
||||||
size_t data_size, const void *data)
|
|
||||||
{
|
|
||||||
#ifdef REAL_DEBUG
|
|
||||||
fprintf (stderr, "Really writing %d bytes at offset %lu.\n",
|
|
||||||
sizeof (glibtop_response), offset);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
resp->offset = offset;
|
|
||||||
resp->data_size = data_size;
|
|
||||||
|
|
||||||
if (send (s, resp, sizeof (glibtop_response), 0) < 0)
|
|
||||||
glibtop_warn_io ("send");
|
|
||||||
|
|
||||||
if (resp->data_size) {
|
|
||||||
#ifdef REAL_DEBUG
|
|
||||||
fprintf (stderr, "Writing %d bytes of data.\n", resp->data_size);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (send (s, data, resp->data_size, 0) , 0)
|
|
||||||
glibtop_warn_io ("send");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
do_read (int s, void *ptr, size_t total_size)
|
|
||||||
{
|
|
||||||
int nread;
|
|
||||||
size_t already_read = 0, remaining = total_size;
|
|
||||||
|
|
||||||
while (already_read < total_size) {
|
|
||||||
if (s)
|
|
||||||
nread = recv (s, ptr, remaining, 0);
|
|
||||||
else
|
|
||||||
nread = read (0, ptr, remaining);
|
|
||||||
|
|
||||||
if ((already_read == 0) && (nread == 0)) {
|
|
||||||
glibtop_warn ("pid %d received eof.", getpid ());
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nread <= 0) {
|
|
||||||
glibtop_warn_io ("recv");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
already_read += nread;
|
|
||||||
remaining -= nread;
|
|
||||||
(char *) ptr += nread;
|
|
||||||
|
|
||||||
#ifdef REAL_DEBUG
|
|
||||||
fprintf (stderr, "READ (%d): %d - %d - %d\n",
|
|
||||||
nread, already_read, remaining, total_size);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
return already_read;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
handle_parent_connection (int s)
|
handle_parent_connection (int s)
|
||||||
@@ -119,20 +27,30 @@ handle_parent_connection (int s)
|
|||||||
glibtop *server = glibtop_global_server;
|
glibtop *server = glibtop_global_server;
|
||||||
glibtop_response _resp, *resp = &_resp;
|
glibtop_response _resp, *resp = &_resp;
|
||||||
glibtop_command _cmnd, *cmnd = &_cmnd;
|
glibtop_command _cmnd, *cmnd = &_cmnd;
|
||||||
|
glibtop_mountentry *mount_list;
|
||||||
char parameter [BUFSIZ];
|
char parameter [BUFSIZ];
|
||||||
|
int all_fs;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
void *ptr;
|
void *ptr;
|
||||||
|
|
||||||
fprintf (stderr, "Parent features = %lu\n", glibtop_server_features);
|
fprintf (stderr, "Parent features = %lu\n", glibtop_server_features);
|
||||||
|
|
||||||
while (do_read (s, &cmnd, sizeof (glibtop_command))) {
|
#ifdef DEBUG
|
||||||
|
fprintf (stderr, "SIZEOF: %u - %u - %u - %u - %u - %u\n",
|
||||||
|
sizeof (glibtop_command), sizeof (glibtop_response),
|
||||||
|
sizeof (glibtop_mountentry), sizeof (glibtop_union),
|
||||||
|
sizeof (glibtop_sysdeps), sizeof (glibtop_response_union));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
while (do_read (s, cmnd, sizeof (glibtop_command))) {
|
||||||
#ifdef PARENT_DEBUG
|
#ifdef PARENT_DEBUG
|
||||||
fprintf (stderr, "Parent (%d) received command %d from client.\n",
|
fprintf (stderr, "Parent (%d) received command %d from client.\n",
|
||||||
getpid (), cmnd->command);
|
getpid (), cmnd->command);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (cmnd->data_size >= BUFSIZ) {
|
if (cmnd->data_size >= BUFSIZ) {
|
||||||
glibtop_warn ("Client sent %d bytes, but buffer is %d", cmnd->size, BUFSIZ);
|
glibtop_warn ("Client sent %d bytes, but buffer is %d",
|
||||||
|
cmnd->data_size, BUFSIZ);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,7 +58,8 @@ handle_parent_connection (int s)
|
|||||||
|
|
||||||
if (cmnd->data_size) {
|
if (cmnd->data_size) {
|
||||||
#ifdef PARENT_DEBUG
|
#ifdef PARENT_DEBUG
|
||||||
fprintf (stderr, "Client has %d bytes of data.\n", cmnd->data_size);
|
fprintf (stderr, "Client has %d bytes of data.\n",
|
||||||
|
cmnd->data_size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
do_read (s, parameter, cmnd->data_size);
|
do_read (s, parameter, cmnd->data_size);
|
||||||
@@ -153,6 +72,7 @@ handle_parent_connection (int s)
|
|||||||
case GLIBTOP_CMND_QUIT:
|
case GLIBTOP_CMND_QUIT:
|
||||||
do_output (s, resp, 0, 0, NULL);
|
do_output (s, resp, 0, 0, NULL);
|
||||||
|
|
||||||
|
#ifdef GLIBTOP_DAEMON_SLAVE
|
||||||
fprintf (stderr, "Sending QUIT command (%d).\n",
|
fprintf (stderr, "Sending QUIT command (%d).\n",
|
||||||
server->socket);
|
server->socket);
|
||||||
|
|
||||||
@@ -163,6 +83,7 @@ handle_parent_connection (int s)
|
|||||||
server->socket);
|
server->socket);
|
||||||
|
|
||||||
close (server->socket);
|
close (server->socket);
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
case GLIBTOP_CMND_SYSDEPS:
|
case GLIBTOP_CMND_SYSDEPS:
|
||||||
resp->u.sysdeps.features = GLIBTOP_SYSDEPS_ALL;
|
resp->u.sysdeps.features = GLIBTOP_SYSDEPS_ALL;
|
||||||
@@ -248,6 +169,20 @@ handle_parent_connection (int s)
|
|||||||
(server, &resp->u.data.proc_segment, pid);
|
(server, &resp->u.data.proc_segment, pid);
|
||||||
do_output (s, resp, _offset_data (proc_segment), 0, NULL);
|
do_output (s, resp, _offset_data (proc_segment), 0, NULL);
|
||||||
break;
|
break;
|
||||||
|
case GLIBTOP_CMND_MOUNTLIST:
|
||||||
|
memcpy (&all_fs, parameter, sizeof (all_fs));
|
||||||
|
mount_list = glibtop_get_mountlist_l
|
||||||
|
(server, &resp->u.data.mountlist, all_fs);
|
||||||
|
do_output (s, resp, _offset_data (mountlist),
|
||||||
|
resp->u.data.mountlist.total, mount_list);
|
||||||
|
glibtop_free_r (server, mount_list);
|
||||||
|
break;
|
||||||
|
case GLIBTOP_CMND_FSUSAGE:
|
||||||
|
glibtop_get_fsusage_l
|
||||||
|
(server, &resp->u.data.fsusage, parameter);
|
||||||
|
do_output (s, resp, _offset_data (fsusage),
|
||||||
|
0, NULL);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
glibtop_warn ("Parent received unknown command %u",
|
glibtop_warn ("Parent received unknown command %u",
|
||||||
cmnd->command);
|
cmnd->command);
|
||||||
@@ -255,57 +190,3 @@ handle_parent_connection (int s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
handle_child_connection (int s)
|
|
||||||
{
|
|
||||||
glibtop *server = glibtop_global_server;
|
|
||||||
glibtop_response _resp, *resp = &_resp;
|
|
||||||
glibtop_command _cmnd, *cmnd = &_cmnd;
|
|
||||||
char parameter [BUFSIZ];
|
|
||||||
void *ptr;
|
|
||||||
|
|
||||||
while (do_read (s, cmnd, sizeof (glibtop_command))) {
|
|
||||||
#ifdef CHILD_DEBUG
|
|
||||||
fprintf (stderr, "Child (%d - %d) received command "
|
|
||||||
"%d from client.\n", getpid (), s, cmnd->command);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (cmnd->data_size >= BUFSIZ) {
|
|
||||||
glibtop_warn ("Client sent %d bytes, but buffer is %d", cmnd->size, BUFSIZ);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
memset (parameter, 0, sizeof (parameter));
|
|
||||||
|
|
||||||
if (cmnd->data_size) {
|
|
||||||
#ifdef CHILD_DEBUG
|
|
||||||
fprintf (stderr, "Client has %d bytes of data.\n", cmnd->data_size);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
do_read (s, parameter, cmnd->data_size);
|
|
||||||
|
|
||||||
} else if (cmnd->size) {
|
|
||||||
memcpy (parameter, cmnd->parameter, cmnd->size);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (cmnd->command) {
|
|
||||||
case GLIBTOP_CMND_QUIT:
|
|
||||||
do_output (s, resp, 0, 0, NULL);
|
|
||||||
return;
|
|
||||||
#if GLIBTOP_SUID_PROCLIST
|
|
||||||
case GLIBTOP_CMND_PROCLIST:
|
|
||||||
ptr = glibtop_get_proclist_p
|
|
||||||
(server, &resp->u.data.proclist);
|
|
||||||
do_output (s, resp, _offset_data (proclist),
|
|
||||||
resp->u.data.proclist.total, ptr);
|
|
||||||
glibtop_free_r (server, ptr);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
default:
|
|
||||||
handle_slave_command (cmnd, resp, parameter);
|
|
||||||
do_output (s, resp, resp->offset, 0, NULL);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@@ -19,17 +19,62 @@
|
|||||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Boston, MA 02111-1307, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <glibtop.h>
|
#include "daemon.h"
|
||||||
#include <glibtop/gnuserv.h>
|
|
||||||
|
|
||||||
#include <glibtop/open.h>
|
void
|
||||||
#include <glibtop/union.h>
|
handle_slave_connection (int input, int output)
|
||||||
|
{
|
||||||
|
glibtop *server = glibtop_global_server;
|
||||||
|
glibtop_response _resp, *resp = &_resp;
|
||||||
|
glibtop_command _cmnd, *cmnd = &_cmnd;
|
||||||
|
char parameter [BUFSIZ];
|
||||||
|
void *ptr;
|
||||||
|
|
||||||
#include <glibtop/command.h>
|
while (do_read (input, cmnd, sizeof (glibtop_command))) {
|
||||||
#include <glibtop/parameter.h>
|
#ifdef SLAVE_DEBUG
|
||||||
|
fprintf (stderr, "Slave %d received command "
|
||||||
|
"%d from client.\n", getpid (), cmnd->command);
|
||||||
|
#endif
|
||||||
|
|
||||||
#define _offset_union(p) ((char *) &resp->u.p - (char *) resp)
|
if (cmnd->data_size >= BUFSIZ)
|
||||||
#define _offset_data(p) _offset_union (data.p)
|
glibtop_error ("Client sent %d bytes, "
|
||||||
|
"but buffer is %d",
|
||||||
|
cmnd->size, BUFSIZ);
|
||||||
|
|
||||||
|
memset (parameter, 0, sizeof (parameter));
|
||||||
|
|
||||||
|
if (cmnd->data_size) {
|
||||||
|
#ifdef SLAVE_DEBUG
|
||||||
|
fprintf (stderr, "Client has %d bytes of data.\n",
|
||||||
|
cmnd->data_size);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
do_read (input, parameter, cmnd->data_size);
|
||||||
|
|
||||||
|
} else if (cmnd->size) {
|
||||||
|
memcpy (parameter, cmnd->parameter, cmnd->size);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (cmnd->command) {
|
||||||
|
case GLIBTOP_CMND_QUIT:
|
||||||
|
do_output (output, resp, 0, 0, NULL);
|
||||||
|
return;
|
||||||
|
#if GLIBTOP_SUID_PROCLIST
|
||||||
|
case GLIBTOP_CMND_PROCLIST:
|
||||||
|
ptr = glibtop_get_proclist_p
|
||||||
|
(server, &resp->u.data.proclist);
|
||||||
|
do_output (output, resp, _offset_data (proclist),
|
||||||
|
resp->u.data.proclist.total, ptr);
|
||||||
|
glibtop_free_r (server, ptr);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
default:
|
||||||
|
handle_slave_command (cmnd, resp, parameter);
|
||||||
|
do_output (output, resp, resp->offset, 0, NULL);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
handle_slave_command (glibtop_command *cmnd, glibtop_response *resp,
|
handle_slave_command (glibtop_command *cmnd, glibtop_response *resp,
|
||||||
|
@@ -1,5 +0,0 @@
|
|||||||
.deps
|
|
||||||
.libs
|
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
gtop_proxy
|
|
@@ -1,16 +0,0 @@
|
|||||||
LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
|
|
||||||
|
|
||||||
INCLUDES = -I$(top_builddir) -I$(top_srcdir) @machine_incs@ \
|
|
||||||
-I$(top_srcdir)/include -I$(top_srcdir)/intl @GUILE_INCS@ \
|
|
||||||
-DGTOPLOCALEDIR=\"$(datadir)/locale\" -D_GNU_SOURCE
|
|
||||||
|
|
||||||
CFLAGS = -Wall -W @CFLAGS@ -DGTOP_SERVER=\""@LIBGTOP_SERVER@"\"
|
|
||||||
|
|
||||||
bin_PROGRAMS = gtop_proxy
|
|
||||||
|
|
||||||
gtop_proxy_SOURCES = main.c output.c version.c
|
|
||||||
gtop_proxy_LDADD = $(top_builddir)/lib/libgtop.la \
|
|
||||||
$(top_builddir)/sysdeps/common/libgtop_common.la \
|
|
||||||
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
|
|
||||||
@INTLLIBS@ @LIBSUPPORT@ @libs_xauth@
|
|
||||||
gtop_proxy_LDFLAGS = -static
|
|
234
src/proxy/main.c
234
src/proxy/main.c
@@ -1,234 +0,0 @@
|
|||||||
/* $Id$ */
|
|
||||||
|
|
||||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
|
||||||
This file is part of the Gnome Top Library.
|
|
||||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
|
||||||
|
|
||||||
The Gnome Top Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Library General Public License as
|
|
||||||
published by the Free Software Foundation; either version 2 of the
|
|
||||||
License, or (at your option) any later version.
|
|
||||||
|
|
||||||
The Gnome Top Library 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
|
|
||||||
Library General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
|
||||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
|
||||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
||||||
Boston, MA 02111-1307, USA. */
|
|
||||||
|
|
||||||
#include <glibtop/command.h>
|
|
||||||
#include <glibtop/version.h>
|
|
||||||
#include <glibtop/xmalloc.h>
|
|
||||||
#include <glibtop/union.h>
|
|
||||||
#include <glibtop/open.h>
|
|
||||||
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <locale.h>
|
|
||||||
|
|
||||||
#if defined(HAVE_GETDTABLESIZE)
|
|
||||||
#define GET_MAX_FDS() getdtablesize()
|
|
||||||
#else
|
|
||||||
/* Fallthrough case - please add other #elif cases above
|
|
||||||
for different OS's as necessary */
|
|
||||||
#define GET_MAX_FDS() 256
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int
|
|
||||||
main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
pid_t pid;
|
|
||||||
int fd, max_fd, nread;
|
|
||||||
size_t size, dsize;
|
|
||||||
char parameter [BUFSIZ];
|
|
||||||
glibtop_union data;
|
|
||||||
glibtop_command cmnd;
|
|
||||||
glibtop_sysdeps sysdeps;
|
|
||||||
glibtop server;
|
|
||||||
void *ptr;
|
|
||||||
|
|
||||||
setlocale (LC_ALL, "");
|
|
||||||
bindtextdomain (PACKAGE, GTOPLOCALEDIR);
|
|
||||||
textdomain (PACKAGE);
|
|
||||||
|
|
||||||
glibtop_version ();
|
|
||||||
|
|
||||||
glibtop_open_l (&server, argv [0], 0, GLIBTOP_OPEN_NO_OVERRIDE);
|
|
||||||
|
|
||||||
/* close all file descriptors except ones used by the pipes (0 and 1). */
|
|
||||||
max_fd = GET_MAX_FDS();
|
|
||||||
for(fd = 3 /* The first fd after the pipes */; fd < max_fd; fd++)
|
|
||||||
close(fd);
|
|
||||||
|
|
||||||
while(1) {
|
|
||||||
/* block on read from client */
|
|
||||||
/* fprintf (stderr, "waiting for input ...\n"); */
|
|
||||||
nread = read (0, &size, sizeof (size_t));
|
|
||||||
|
|
||||||
/* will return 0 if parent exits. */
|
|
||||||
|
|
||||||
if (nread == 0)
|
|
||||||
_exit(0);
|
|
||||||
|
|
||||||
if (nread != sizeof (size_t))
|
|
||||||
_exit(1);
|
|
||||||
|
|
||||||
if (size != sizeof (glibtop_command))
|
|
||||||
_exit(2);
|
|
||||||
|
|
||||||
nread = read (0, &cmnd, size);
|
|
||||||
|
|
||||||
/* will return 0 if parent exits. */
|
|
||||||
|
|
||||||
if (nread == 0)
|
|
||||||
_exit(0);
|
|
||||||
|
|
||||||
if (nread < 0)
|
|
||||||
_exit(1);
|
|
||||||
|
|
||||||
nread = read (0, &dsize, sizeof (size_t));
|
|
||||||
|
|
||||||
/* will return 0 if parent exits. */
|
|
||||||
|
|
||||||
if (nread == 0)
|
|
||||||
_exit(0);
|
|
||||||
|
|
||||||
if (nread < 0)
|
|
||||||
_exit(1);
|
|
||||||
|
|
||||||
if (dsize >= BUFSIZ)
|
|
||||||
_exit(3);
|
|
||||||
|
|
||||||
memset (parameter, 0, sizeof (parameter));
|
|
||||||
|
|
||||||
if (dsize) {
|
|
||||||
nread = read (0, parameter, dsize);
|
|
||||||
|
|
||||||
/* will return 0 if parent exits. */
|
|
||||||
|
|
||||||
if (nread == 0)
|
|
||||||
_exit(0);
|
|
||||||
|
|
||||||
if (nread < 0)
|
|
||||||
_exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (cmnd.command) {
|
|
||||||
case GLIBTOP_CMND_SYSDEPS:
|
|
||||||
sysdeps.features = GLIBTOP_SYSDEPS_ALL;
|
|
||||||
glibtop_output (sizeof (glibtop_sysdeps), &sysdeps);
|
|
||||||
glibtop_output (0, NULL);
|
|
||||||
break;
|
|
||||||
case GLIBTOP_CMND_CPU:
|
|
||||||
glibtop_get_cpu_l (&server, &data.cpu);
|
|
||||||
glibtop_output (sizeof (glibtop_cpu), &data.cpu);
|
|
||||||
glibtop_output (0, NULL);
|
|
||||||
break;
|
|
||||||
case GLIBTOP_CMND_MEM:
|
|
||||||
glibtop_get_mem_l (&server, &data.mem);
|
|
||||||
glibtop_output (sizeof (glibtop_mem), &data.mem);
|
|
||||||
glibtop_output (0, NULL);
|
|
||||||
break;
|
|
||||||
case GLIBTOP_CMND_SWAP:
|
|
||||||
glibtop_get_swap_l (&server, &data.swap);
|
|
||||||
glibtop_output (sizeof (glibtop_swap), &data.swap);
|
|
||||||
glibtop_output (0, NULL);
|
|
||||||
break;
|
|
||||||
case GLIBTOP_CMND_UPTIME:
|
|
||||||
glibtop_get_uptime_l (&server, &data.uptime);
|
|
||||||
glibtop_output (sizeof (glibtop_uptime), &data.uptime);
|
|
||||||
glibtop_output (0, NULL);
|
|
||||||
break;
|
|
||||||
case GLIBTOP_CMND_LOADAVG:
|
|
||||||
glibtop_get_loadavg_l (&server, &data.loadavg);
|
|
||||||
glibtop_output (sizeof (glibtop_loadavg), &data.loadavg);
|
|
||||||
glibtop_output (0, NULL);
|
|
||||||
break;
|
|
||||||
case GLIBTOP_CMND_SHM_LIMITS:
|
|
||||||
glibtop_get_shm_limits_l (&server, &data.shm_limits);
|
|
||||||
glibtop_output (sizeof (glibtop_shm_limits),
|
|
||||||
&data.shm_limits);
|
|
||||||
glibtop_output (0, NULL);
|
|
||||||
break;
|
|
||||||
case GLIBTOP_CMND_MSG_LIMITS:
|
|
||||||
glibtop_get_msg_limits_l (&server, &data.msg_limits);
|
|
||||||
glibtop_output (sizeof (glibtop_msg_limits),
|
|
||||||
&data.msg_limits);
|
|
||||||
glibtop_output (0, NULL);
|
|
||||||
break;
|
|
||||||
case GLIBTOP_CMND_SEM_LIMITS:
|
|
||||||
glibtop_get_sem_limits_l (&server, &data.sem_limits);
|
|
||||||
glibtop_output (sizeof (glibtop_sem_limits),
|
|
||||||
&data.sem_limits);
|
|
||||||
glibtop_output (0, NULL);
|
|
||||||
break;
|
|
||||||
case GLIBTOP_CMND_PROCLIST:
|
|
||||||
ptr = glibtop_get_proclist_l (&server, &data.proclist);
|
|
||||||
glibtop_output (sizeof (glibtop_proclist),
|
|
||||||
&data.proclist);
|
|
||||||
glibtop_output (data.proclist.total, ptr);
|
|
||||||
glibtop_free_r (&server, ptr);
|
|
||||||
break;
|
|
||||||
case GLIBTOP_CMND_PROC_STATE:
|
|
||||||
memcpy (&pid, parameter, sizeof (pid_t));
|
|
||||||
glibtop_get_proc_state_l
|
|
||||||
(&server, &data.proc_state, pid);
|
|
||||||
glibtop_output (sizeof (glibtop_proc_state),
|
|
||||||
&data.proc_state);
|
|
||||||
glibtop_output (0, NULL);
|
|
||||||
break;
|
|
||||||
case GLIBTOP_CMND_PROC_UID:
|
|
||||||
memcpy (&pid, parameter, sizeof (pid_t));
|
|
||||||
glibtop_get_proc_uid_l
|
|
||||||
(&server, &data.proc_uid, pid);
|
|
||||||
glibtop_output (sizeof (glibtop_proc_uid),
|
|
||||||
&data.proc_uid);
|
|
||||||
glibtop_output (0, NULL);
|
|
||||||
break;
|
|
||||||
case GLIBTOP_CMND_PROC_MEM:
|
|
||||||
memcpy (&pid, parameter, sizeof (pid_t));
|
|
||||||
glibtop_get_proc_mem_l
|
|
||||||
(&server, &data.proc_mem, pid);
|
|
||||||
glibtop_output (sizeof (glibtop_proc_mem),
|
|
||||||
&data.proc_mem);
|
|
||||||
glibtop_output (0, NULL);
|
|
||||||
break;
|
|
||||||
case GLIBTOP_CMND_PROC_TIME:
|
|
||||||
memcpy (&pid, parameter, sizeof (pid_t));
|
|
||||||
glibtop_get_proc_time_l
|
|
||||||
(&server, &data.proc_time, pid);
|
|
||||||
glibtop_output (sizeof (glibtop_proc_time),
|
|
||||||
&data.proc_time);
|
|
||||||
glibtop_output (0, NULL);
|
|
||||||
break;
|
|
||||||
case GLIBTOP_CMND_PROC_SIGNAL:
|
|
||||||
memcpy (&pid, parameter, sizeof (pid_t));
|
|
||||||
glibtop_get_proc_signal_l
|
|
||||||
(&server, &data.proc_signal, pid);
|
|
||||||
glibtop_output (sizeof (glibtop_proc_signal),
|
|
||||||
&data.proc_signal);
|
|
||||||
glibtop_output (0, NULL);
|
|
||||||
break;
|
|
||||||
case GLIBTOP_CMND_PROC_KERNEL:
|
|
||||||
memcpy (&pid, parameter, sizeof (pid_t));
|
|
||||||
glibtop_get_proc_kernel_l
|
|
||||||
(&server, &data.proc_kernel, pid);
|
|
||||||
glibtop_output (sizeof (glibtop_proc_kernel),
|
|
||||||
&data.proc_kernel);
|
|
||||||
glibtop_output (0, NULL);
|
|
||||||
break;
|
|
||||||
case GLIBTOP_CMND_PROC_SEGMENT:
|
|
||||||
memcpy (&pid, parameter, sizeof (pid_t));
|
|
||||||
glibtop_get_proc_segment_l
|
|
||||||
(&server, &data.proc_segment, pid);
|
|
||||||
glibtop_output (sizeof (glibtop_proc_segment),
|
|
||||||
&data.proc_segment);
|
|
||||||
glibtop_output (0, NULL);
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_exit(0);
|
|
||||||
}
|
|
@@ -1,16 +1,12 @@
|
|||||||
LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
|
LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
|
||||||
|
|
||||||
INCLUDES = -I$(top_builddir) -I$(top_srcdir) @machine_incs@ \
|
|
||||||
-I$(top_srcdir)/include -I$(top_srcdir)/intl @GUILE_INCS@ \
|
|
||||||
-DGTOPLOCALEDIR=\"$(datadir)/locale\" -D_GNU_SOURCE
|
|
||||||
|
|
||||||
CFLAGS = -Wall -W @CFLAGS@
|
CFLAGS = -Wall -W @CFLAGS@
|
||||||
|
|
||||||
bin_PROGRAMS = gtop_server
|
bin_PROGRAMS = gtop_server
|
||||||
|
|
||||||
gtop_server_SOURCES = main.c output.c version.c
|
gtop_server_SOURCES = main.c output.c version.c
|
||||||
gtop_server_LDADD = $(top_builddir)/sysdeps/common/libgtop_common.la \
|
gtop_server_LDADD = $(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps_suid.la \
|
||||||
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
|
$(top_builddir)/sysdeps/common/libgtop_suid_common.la \
|
||||||
@INTLLIBS@ @LIBSUPPORT@
|
@LIBSUPPORT@
|
||||||
gtop_server_LDFLAGS = -static
|
gtop_server_LDFLAGS = -static
|
||||||
|
|
||||||
|
@@ -57,7 +57,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
glibtop_version ();
|
glibtop_version ();
|
||||||
|
|
||||||
glibtop_open_r (&server, argv [0], 0, 0);
|
glibtop_open_p (&server, argv [0], 0, 0);
|
||||||
|
|
||||||
if (setreuid (euid, uid)) _exit (1);
|
if (setreuid (euid, uid)) _exit (1);
|
||||||
|
|
||||||
@@ -128,147 +128,146 @@ int main(int argc, char *argv[])
|
|||||||
glibtop_output (sizeof (glibtop_sysdeps), &sysdeps);
|
glibtop_output (sizeof (glibtop_sysdeps), &sysdeps);
|
||||||
glibtop_output (0, NULL);
|
glibtop_output (0, NULL);
|
||||||
break;
|
break;
|
||||||
case GLIBTOP_CMND_CPU:
|
|
||||||
#if GLIBTOP_SUID_CPU
|
#if GLIBTOP_SUID_CPU
|
||||||
|
case GLIBTOP_CMND_CPU:
|
||||||
glibtop_get_cpu_p (&server, &data.cpu);
|
glibtop_get_cpu_p (&server, &data.cpu);
|
||||||
#endif
|
|
||||||
glibtop_output (sizeof (glibtop_cpu), &data.cpu);
|
glibtop_output (sizeof (glibtop_cpu), &data.cpu);
|
||||||
glibtop_output (0, NULL);
|
glibtop_output (0, NULL);
|
||||||
break;
|
break;
|
||||||
case GLIBTOP_CMND_MEM:
|
|
||||||
#if GLIBTOP_SUID_MEM
|
|
||||||
glibtop_get_mem_p (&server, &data.mem);
|
|
||||||
#endif
|
#endif
|
||||||
|
#if GLIBTOP_SUID_MEM
|
||||||
|
case GLIBTOP_CMND_MEM:
|
||||||
|
glibtop_get_mem_p (&server, &data.mem);
|
||||||
glibtop_output (sizeof (glibtop_mem), &data.mem);
|
glibtop_output (sizeof (glibtop_mem), &data.mem);
|
||||||
glibtop_output (0, NULL);
|
glibtop_output (0, NULL);
|
||||||
break;
|
break;
|
||||||
case GLIBTOP_CMND_SWAP:
|
|
||||||
#if GLIBTOP_SUID_SWAP
|
|
||||||
glibtop_get_swap_p (&server, &data.swap);
|
|
||||||
#endif
|
#endif
|
||||||
|
#if GLIBTOP_SUID_SWAP
|
||||||
|
case GLIBTOP_CMND_SWAP:
|
||||||
|
glibtop_get_swap_p (&server, &data.swap);
|
||||||
glibtop_output (sizeof (glibtop_swap), &data.swap);
|
glibtop_output (sizeof (glibtop_swap), &data.swap);
|
||||||
glibtop_output (0, NULL);
|
glibtop_output (0, NULL);
|
||||||
break;
|
break;
|
||||||
case GLIBTOP_CMND_UPTIME:
|
|
||||||
#if GLIBTOP_SUID_UPTIME
|
|
||||||
glibtop_get_uptime_p (&server, &data.uptime);
|
|
||||||
#endif
|
#endif
|
||||||
|
#if GLIBTOP_SUID_UPTIME
|
||||||
|
case GLIBTOP_CMND_UPTIME:
|
||||||
|
glibtop_get_uptime_p (&server, &data.uptime);
|
||||||
glibtop_output (sizeof (glibtop_uptime), &data.uptime);
|
glibtop_output (sizeof (glibtop_uptime), &data.uptime);
|
||||||
glibtop_output (0, NULL);
|
glibtop_output (0, NULL);
|
||||||
break;
|
break;
|
||||||
case GLIBTOP_CMND_LOADAVG:
|
|
||||||
#if GLIBTOP_SUID_LOADAVG
|
|
||||||
glibtop_get_loadavg_p (&server, &data.loadavg);
|
|
||||||
#endif
|
#endif
|
||||||
|
#if GLIBTOP_SUID_LOADAVG
|
||||||
|
case GLIBTOP_CMND_LOADAVG:
|
||||||
|
glibtop_get_loadavg_p (&server, &data.loadavg);
|
||||||
glibtop_output (sizeof (glibtop_loadavg), &data.loadavg);
|
glibtop_output (sizeof (glibtop_loadavg), &data.loadavg);
|
||||||
glibtop_output (0, NULL);
|
glibtop_output (0, NULL);
|
||||||
break;
|
break;
|
||||||
case GLIBTOP_CMND_SHM_LIMITS:
|
|
||||||
#if GLIBTOP_SUID_SHM_LIMITS
|
|
||||||
glibtop_get_shm_limits_p (&server, &data.shm_limits);
|
|
||||||
#endif
|
#endif
|
||||||
|
#if GLIBTOP_SUID_SHM_LIMITS
|
||||||
|
case GLIBTOP_CMND_SHM_LIMITS:
|
||||||
|
glibtop_get_shm_limits_p (&server, &data.shm_limits);
|
||||||
glibtop_output (sizeof (glibtop_shm_limits),
|
glibtop_output (sizeof (glibtop_shm_limits),
|
||||||
&data.shm_limits);
|
&data.shm_limits);
|
||||||
glibtop_output (0, NULL);
|
glibtop_output (0, NULL);
|
||||||
break;
|
break;
|
||||||
case GLIBTOP_CMND_MSG_LIMITS:
|
|
||||||
#if GLIBTOP_SUID_MSG_LIMITS
|
|
||||||
glibtop_get_msg_limits_p (&server, &data.msg_limits);
|
|
||||||
#endif
|
#endif
|
||||||
|
#if GLIBTOP_SUID_MSG_LIMITS
|
||||||
|
case GLIBTOP_CMND_MSG_LIMITS:
|
||||||
|
glibtop_get_msg_limits_p (&server, &data.msg_limits);
|
||||||
glibtop_output (sizeof (glibtop_msg_limits),
|
glibtop_output (sizeof (glibtop_msg_limits),
|
||||||
&data.msg_limits);
|
&data.msg_limits);
|
||||||
glibtop_output (0, NULL);
|
glibtop_output (0, NULL);
|
||||||
break;
|
break;
|
||||||
case GLIBTOP_CMND_SEM_LIMITS:
|
|
||||||
#if GLIBTOP_SUID_SEM_LIMITS
|
|
||||||
glibtop_get_sem_limits_p (&server, &data.sem_limits);
|
|
||||||
#endif
|
#endif
|
||||||
|
#if GLIBTOP_SUID_SEM_LIMITS
|
||||||
|
case GLIBTOP_CMND_SEM_LIMITS:
|
||||||
|
glibtop_get_sem_limits_p (&server, &data.sem_limits);
|
||||||
glibtop_output (sizeof (glibtop_sem_limits),
|
glibtop_output (sizeof (glibtop_sem_limits),
|
||||||
&data.sem_limits);
|
&data.sem_limits);
|
||||||
glibtop_output (0, NULL);
|
glibtop_output (0, NULL);
|
||||||
break;
|
break;
|
||||||
case GLIBTOP_CMND_PROCLIST:
|
|
||||||
#if GLIBTOP_SUID_PROCLIST
|
|
||||||
ptr = glibtop_get_proclist_p (&server, &data.proclist);
|
|
||||||
#else
|
|
||||||
ptr = NULL;
|
|
||||||
#endif
|
#endif
|
||||||
|
#if GLIBTOP_SUID_PROCLIST
|
||||||
|
case GLIBTOP_CMND_PROCLIST:
|
||||||
|
ptr = glibtop_get_proclist_p (&server, &data.proclist);
|
||||||
glibtop_output (sizeof (glibtop_proclist),
|
glibtop_output (sizeof (glibtop_proclist),
|
||||||
&data.proclist);
|
&data.proclist);
|
||||||
glibtop_output (data.proclist.total, ptr);
|
glibtop_output (data.proclist.total, ptr);
|
||||||
glibtop_free_r (&server, ptr);
|
if (ptr) free (ptr);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#if GLIBTOP_SUID_PROC_STATE
|
||||||
case GLIBTOP_CMND_PROC_STATE:
|
case GLIBTOP_CMND_PROC_STATE:
|
||||||
memcpy (&pid, parameter, sizeof (pid_t));
|
memcpy (&pid, parameter, sizeof (pid_t));
|
||||||
#if GLIBTOP_SUID_PROC_STATE
|
|
||||||
glibtop_get_proc_state_p
|
glibtop_get_proc_state_p
|
||||||
(&server, &data.proc_state, pid);
|
(&server, &data.proc_state, pid);
|
||||||
#endif
|
|
||||||
glibtop_output (sizeof (glibtop_proc_state),
|
glibtop_output (sizeof (glibtop_proc_state),
|
||||||
&data.proc_state);
|
&data.proc_state);
|
||||||
glibtop_output (0, NULL);
|
glibtop_output (0, NULL);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#if GLIBTOP_SUID_PROC_UID
|
||||||
case GLIBTOP_CMND_PROC_UID:
|
case GLIBTOP_CMND_PROC_UID:
|
||||||
memcpy (&pid, parameter, sizeof (pid_t));
|
memcpy (&pid, parameter, sizeof (pid_t));
|
||||||
#if GLIBTOP_SUID_PROC_UID
|
|
||||||
glibtop_get_proc_uid_p
|
glibtop_get_proc_uid_p
|
||||||
(&server, &data.proc_uid, pid);
|
(&server, &data.proc_uid, pid);
|
||||||
#endif
|
|
||||||
glibtop_output (sizeof (glibtop_proc_uid),
|
glibtop_output (sizeof (glibtop_proc_uid),
|
||||||
&data.proc_uid);
|
&data.proc_uid);
|
||||||
glibtop_output (0, NULL);
|
glibtop_output (0, NULL);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#if GLIBTOP_SUID_PROC_MEM
|
||||||
case GLIBTOP_CMND_PROC_MEM:
|
case GLIBTOP_CMND_PROC_MEM:
|
||||||
memcpy (&pid, parameter, sizeof (pid_t));
|
memcpy (&pid, parameter, sizeof (pid_t));
|
||||||
#if GLIBTOP_SUID_PROC_MEM
|
|
||||||
glibtop_get_proc_mem_p
|
glibtop_get_proc_mem_p
|
||||||
(&server, &data.proc_mem, pid);
|
(&server, &data.proc_mem, pid);
|
||||||
#endif
|
|
||||||
glibtop_output (sizeof (glibtop_proc_mem),
|
glibtop_output (sizeof (glibtop_proc_mem),
|
||||||
&data.proc_mem);
|
&data.proc_mem);
|
||||||
glibtop_output (0, NULL);
|
glibtop_output (0, NULL);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#if GLIBTOP_SUID_PROC_TIME
|
||||||
case GLIBTOP_CMND_PROC_TIME:
|
case GLIBTOP_CMND_PROC_TIME:
|
||||||
memcpy (&pid, parameter, sizeof (pid_t));
|
memcpy (&pid, parameter, sizeof (pid_t));
|
||||||
#if GLIBTOP_SUID_PROC_TIME
|
|
||||||
glibtop_get_proc_time_p
|
glibtop_get_proc_time_p
|
||||||
(&server, &data.proc_time, pid);
|
(&server, &data.proc_time, pid);
|
||||||
#endif
|
|
||||||
glibtop_output (sizeof (glibtop_proc_time),
|
glibtop_output (sizeof (glibtop_proc_time),
|
||||||
&data.proc_time);
|
&data.proc_time);
|
||||||
glibtop_output (0, NULL);
|
glibtop_output (0, NULL);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#if GLIBTOP_SUID_PROC_SIGNAL
|
||||||
case GLIBTOP_CMND_PROC_SIGNAL:
|
case GLIBTOP_CMND_PROC_SIGNAL:
|
||||||
memcpy (&pid, parameter, sizeof (pid_t));
|
memcpy (&pid, parameter, sizeof (pid_t));
|
||||||
#if GLIBTOP_SUID_PROC_SIGNAL
|
|
||||||
glibtop_get_proc_signal_p
|
glibtop_get_proc_signal_p
|
||||||
(&server, &data.proc_signal, pid);
|
(&server, &data.proc_signal, pid);
|
||||||
#endif
|
|
||||||
glibtop_output (sizeof (glibtop_proc_signal),
|
glibtop_output (sizeof (glibtop_proc_signal),
|
||||||
&data.proc_signal);
|
&data.proc_signal);
|
||||||
glibtop_output (0, NULL);
|
glibtop_output (0, NULL);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#if GLIBTOP_SUID_PROC_KERNEL
|
||||||
case GLIBTOP_CMND_PROC_KERNEL:
|
case GLIBTOP_CMND_PROC_KERNEL:
|
||||||
memcpy (&pid, parameter, sizeof (pid_t));
|
memcpy (&pid, parameter, sizeof (pid_t));
|
||||||
#if GLIBTOP_SUID_PROC_KERNEL
|
|
||||||
glibtop_get_proc_kernel_p
|
glibtop_get_proc_kernel_p
|
||||||
(&server, &data.proc_kernel, pid);
|
(&server, &data.proc_kernel, pid);
|
||||||
#endif
|
|
||||||
glibtop_output (sizeof (glibtop_proc_kernel),
|
glibtop_output (sizeof (glibtop_proc_kernel),
|
||||||
&data.proc_kernel);
|
&data.proc_kernel);
|
||||||
glibtop_output (0, NULL);
|
glibtop_output (0, NULL);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#if GLIBTOP_SUID_PROC_SEGMENT
|
||||||
case GLIBTOP_CMND_PROC_SEGMENT:
|
case GLIBTOP_CMND_PROC_SEGMENT:
|
||||||
memcpy (&pid, parameter, sizeof (pid_t));
|
memcpy (&pid, parameter, sizeof (pid_t));
|
||||||
#if GLIBTOP_SUID_PROC_SEGMENT
|
|
||||||
glibtop_get_proc_segment_p
|
glibtop_get_proc_segment_p
|
||||||
(&server, &data.proc_segment, pid);
|
(&server, &data.proc_segment, pid);
|
||||||
#endif
|
|
||||||
glibtop_output (sizeof (glibtop_proc_segment),
|
glibtop_output (sizeof (glibtop_proc_segment),
|
||||||
&data.proc_segment);
|
&data.proc_segment);
|
||||||
glibtop_output (0, NULL);
|
glibtop_output (0, NULL);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
default:
|
||||||
|
_exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_exit(0);
|
_exit(0);
|
||||||
|
@@ -4,12 +4,7 @@ else
|
|||||||
guile_SUBDIRS =
|
guile_SUBDIRS =
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if GLIBTOP_NAMES
|
SUBDIRS = @sysdeps_dir@ common names $(guile_SUBDIRS)
|
||||||
names_SUBDIRS = names
|
|
||||||
else
|
|
||||||
names_SUBDIRS =
|
|
||||||
endif
|
|
||||||
|
|
||||||
SUBDIRS = @sysdeps_dir@ common $(names_SUBDIRS) $(guile_SUBDIRS)
|
DIST_SUBDIRS = common guile linux kernel names osf1 stub sun4 \
|
||||||
|
freebsd
|
||||||
DIST_SUBDIRS = common guile linux kernel names osf1 stub sun4
|
|
||||||
|
@@ -1,11 +1,10 @@
|
|||||||
LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
|
LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
|
||||||
|
|
||||||
INCLUDES = -I$(top_builddir) -I$(top_srcdir) @machine_incs@ \
|
|
||||||
-I$(top_srcdir)/include -I$(top_srcdir)/intl @GUILE_INCS@ \
|
|
||||||
-DGTOPLOCALEDIR=\"$(datadir)/locale\" -D_GNU_SOURCE
|
|
||||||
|
|
||||||
CFLAGS = -Wall -W @CFLAGS@
|
CFLAGS = -Wall -W @CFLAGS@
|
||||||
|
|
||||||
lib_LTLIBRARIES = libgtop_common.la
|
lib_LTLIBRARIES = libgtop_common.la libgtop_suid_common.la
|
||||||
|
|
||||||
libgtop_common_la_SOURCES = sysdeps.c xmalloc.c error.c gnuslib.c
|
libgtop_common_la_SOURCES = xmalloc.c error.c gnuslib.c \
|
||||||
|
fsusage.c fsusage.h mountlist.c mountlist.h
|
||||||
|
|
||||||
|
libgtop_suid_common_la_SOURCES = xmalloc.c error.c
|
||||||
|
@@ -62,6 +62,13 @@ int statfs ();
|
|||||||
int statvfs ();
|
int statvfs ();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <glibtop.h>
|
||||||
|
#include <glibtop/error.h>
|
||||||
|
#include <glibtop/fsusage.h>
|
||||||
|
|
||||||
|
static int get_fs_usage __P ((const char *, const char *,
|
||||||
|
struct fs_usage *));
|
||||||
|
|
||||||
int safe_read ();
|
int safe_read ();
|
||||||
|
|
||||||
/* Return the number of TOSIZE-byte blocks used by
|
/* Return the number of TOSIZE-byte blocks used by
|
||||||
@@ -93,7 +100,7 @@ adjust_blocks (blocks, fromsize, tosize)
|
|||||||
Return 0 if successful, -1 if not. When returning -1, ensure that
|
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
|
ERRNO is either a system error value, or zero if DISK is NULL
|
||||||
on a system that requires a non-NULL value. */
|
on a system that requires a non-NULL value. */
|
||||||
int
|
static int
|
||||||
get_fs_usage (path, disk, fsp)
|
get_fs_usage (path, disk, fsp)
|
||||||
const char *path;
|
const char *path;
|
||||||
const char *disk;
|
const char *disk;
|
||||||
@@ -272,3 +279,23 @@ statfs (path, fsb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif /* _AIX && _I386 */
|
#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));
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
@@ -25,13 +25,3 @@ struct fs_usage
|
|||||||
long fsu_ffree; /* Free file nodes. */
|
long fsu_ffree; /* Free file nodes. */
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef __P
|
|
||||||
#if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
|
|
||||||
#define __P(args) args
|
|
||||||
#else
|
|
||||||
#define __P(args) ()
|
|
||||||
#endif /* GCC. */
|
|
||||||
#endif /* Not __P. */
|
|
||||||
|
|
||||||
int get_fs_usage __P ((const char *path, const char *disk,
|
|
||||||
struct fs_usage *fsp));
|
|
||||||
|
@@ -45,14 +45,14 @@ static int connect_to_internet_server __P((const char *, u_short));
|
|||||||
/* On some systems, e.g. DGUX, inet_addr returns a 'struct in_addr'. */
|
/* On some systems, e.g. DGUX, inet_addr returns a 'struct in_addr'. */
|
||||||
#ifdef HAVE_BROKEN_INET_ADDR
|
#ifdef HAVE_BROKEN_INET_ADDR
|
||||||
#define IN_ADDR struct in_addr
|
#define IN_ADDR struct in_addr
|
||||||
#define NUMERIC_ADDR_ERROR (numeric_addr.s_addr == -1)
|
#define NUMERIC_ADDR_ERROR (numeric_addr.s_addr == 0xffffffff)
|
||||||
#else
|
#else
|
||||||
#if (LONGBITS > 32)
|
#if (LONGBITS > 32)
|
||||||
#define IN_ADDR unsigned int
|
#define IN_ADDR unsigned int
|
||||||
#else
|
#else
|
||||||
#define IN_ADDR unsigned long
|
#define IN_ADDR unsigned long
|
||||||
#endif
|
#endif
|
||||||
#define NUMERIC_ADDR_ERROR (numeric_addr == (IN_ADDR) -1)
|
#define NUMERIC_ADDR_ERROR (numeric_addr == (IN_ADDR) 0xffffffff)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
@@ -36,6 +36,9 @@ void free ();
|
|||||||
|
|
||||||
#include <glibtop.h>
|
#include <glibtop.h>
|
||||||
#include <glibtop/xmalloc.h>
|
#include <glibtop/xmalloc.h>
|
||||||
|
#include <glibtop/mountlist.h>
|
||||||
|
|
||||||
|
static struct mount_entry *read_filesystem_list __P((int, int));
|
||||||
|
|
||||||
#undef xmalloc
|
#undef xmalloc
|
||||||
#undef xrealloc
|
#undef xrealloc
|
||||||
@@ -255,7 +258,7 @@ fstype_to_string (t)
|
|||||||
If ALL_FS is zero, do not return entries for filesystems that
|
If ALL_FS is zero, do not return entries for filesystems that
|
||||||
are automounter (dummy) entries. */
|
are automounter (dummy) entries. */
|
||||||
|
|
||||||
struct mount_entry *
|
static struct mount_entry *
|
||||||
read_filesystem_list (need_fs_type, all_fs)
|
read_filesystem_list (need_fs_type, all_fs)
|
||||||
int need_fs_type, all_fs;
|
int need_fs_type, all_fs;
|
||||||
{
|
{
|
||||||
@@ -357,7 +360,7 @@ read_filesystem_list (need_fs_type, all_fs)
|
|||||||
#ifdef __NetBSD__
|
#ifdef __NetBSD__
|
||||||
me->me_type = xstrdup (fsp->f_fstypename);
|
me->me_type = xstrdup (fsp->f_fstypename);
|
||||||
#else
|
#else
|
||||||
me->me_type = fstype_to_string (fsp->f_type);
|
me->me_type = xstrdup (fstype_to_string (fsp->f_type));
|
||||||
#endif
|
#endif
|
||||||
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
||||||
me->me_next = NULL;
|
me->me_next = NULL;
|
||||||
@@ -382,7 +385,7 @@ read_filesystem_list (need_fs_type, all_fs)
|
|||||||
me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
|
me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
|
||||||
me->me_devname = xstrdup (fsd.fd_req.devname);
|
me->me_devname = xstrdup (fsd.fd_req.devname);
|
||||||
me->me_mountdir = xstrdup (fsd.fd_req.path);
|
me->me_mountdir = xstrdup (fsd.fd_req.path);
|
||||||
me->me_type = gt_names[fsd.fd_req.fstype];
|
me->me_type = xstrdup (gt_names[fsd.fd_req.fstype]);
|
||||||
me->me_dev = fsd.fd_req.dev;
|
me->me_dev = fsd.fd_req.dev;
|
||||||
me->me_next = NULL;
|
me->me_next = NULL;
|
||||||
|
|
||||||
@@ -419,7 +422,7 @@ read_filesystem_list (need_fs_type, all_fs)
|
|||||||
me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
|
me = (struct mount_entry *) xmalloc (sizeof (struct mount_entry));
|
||||||
me->me_devname = xstrdup (stats[counter].f_mntfromname);
|
me->me_devname = xstrdup (stats[counter].f_mntfromname);
|
||||||
me->me_mountdir = xstrdup (stats[counter].f_mntonname);
|
me->me_mountdir = xstrdup (stats[counter].f_mntonname);
|
||||||
me->me_type = mnt_names[stats[counter].f_type];
|
me->me_type = xstrdup (mnt_names[stats[counter].f_type]);
|
||||||
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
||||||
me->me_next = NULL;
|
me->me_next = NULL;
|
||||||
|
|
||||||
@@ -454,7 +457,7 @@ read_filesystem_list (need_fs_type, all_fs)
|
|||||||
#endif
|
#endif
|
||||||
me->me_mountdir = xstrdup (mnt.mt_filsys);
|
me->me_mountdir = xstrdup (mnt.mt_filsys);
|
||||||
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
||||||
me->me_type = "";
|
me->me_type = xstrdup ("");
|
||||||
#ifdef GETFSTYP /* SVR3. */
|
#ifdef GETFSTYP /* SVR3. */
|
||||||
if (need_fs_type)
|
if (need_fs_type)
|
||||||
{
|
{
|
||||||
@@ -584,3 +587,61 @@ read_filesystem_list (need_fs_type, all_fs)
|
|||||||
free (me);
|
free (me);
|
||||||
return mount_list;
|
return mount_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glibtop_mountentry *
|
||||||
|
glibtop_get_mountlist_s (glibtop *server, glibtop_mountlist *buf, int all_fs)
|
||||||
|
{
|
||||||
|
struct mount_entry *me, *tmp, *next;
|
||||||
|
glibtop_mountentry *mount_list;
|
||||||
|
int count;
|
||||||
|
|
||||||
|
glibtop_init_r (&server, 0, 0);
|
||||||
|
|
||||||
|
memset (buf, 0, sizeof (glibtop_mountlist));
|
||||||
|
|
||||||
|
/* Read filesystem list. */
|
||||||
|
|
||||||
|
me = read_filesystem_list (1, all_fs);
|
||||||
|
|
||||||
|
if (me == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
/* Count entries. */
|
||||||
|
|
||||||
|
for (count = 0, tmp = me; tmp; count++, tmp = tmp->me_next)
|
||||||
|
;
|
||||||
|
|
||||||
|
buf->size = sizeof (glibtop_mountentry);
|
||||||
|
buf->number = count;
|
||||||
|
|
||||||
|
buf->total = buf->number * buf->size;
|
||||||
|
|
||||||
|
mount_list = glibtop_malloc_r (server, buf->total);
|
||||||
|
|
||||||
|
/* Write data into mount_list. */
|
||||||
|
|
||||||
|
for (count = 0, tmp = me; tmp; count++, tmp = tmp->me_next) {
|
||||||
|
strncpy (mount_list [count].devname, tmp->me_devname,
|
||||||
|
GLIBTOP_MOUNTENTRY_LEN);
|
||||||
|
strncpy (mount_list [count].mountdir, tmp->me_mountdir,
|
||||||
|
GLIBTOP_MOUNTENTRY_LEN);
|
||||||
|
strncpy (mount_list [count].type, tmp->me_type,
|
||||||
|
GLIBTOP_MOUNTENTRY_LEN);
|
||||||
|
mount_list [count].devname [GLIBTOP_MOUNTENTRY_LEN] = 0;
|
||||||
|
mount_list [count].mountdir [GLIBTOP_MOUNTENTRY_LEN] = 0;
|
||||||
|
mount_list [count].type [GLIBTOP_MOUNTENTRY_LEN] = 0;
|
||||||
|
mount_list [count].dev = tmp->me_dev;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Free memory. */
|
||||||
|
|
||||||
|
for (count = 0, tmp = me; tmp; count++, tmp = next) {
|
||||||
|
next = tmp->me_next;
|
||||||
|
xfree (tmp->me_devname);
|
||||||
|
xfree (tmp->me_mountdir);
|
||||||
|
xfree (tmp->me_type);
|
||||||
|
xfree (tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
return mount_list;
|
||||||
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user