Compare commits
175 Commits
stable_aft
...
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 | ||
|
fe56feb875 | ||
|
5e9d34c91a | ||
|
0e086aef25 | ||
|
540385da7e | ||
|
540cd68691 | ||
|
c41d6e5a77 | ||
|
74ca45f795 | ||
|
5f4131f248 | ||
|
4bfef8c254 | ||
|
f77eba3d57 | ||
|
f18952a9d8 | ||
|
16cb163bb0 | ||
|
f8bdfa9a43 | ||
|
61f887fc67 | ||
|
9fd8936e93 | ||
|
ef693a93bc | ||
|
aa04293fc3 | ||
|
345a657d2c | ||
|
da7d7ff116 | ||
|
c5263a881e | ||
|
49adb94af0 | ||
|
b991ecaf9a | ||
|
2c8ae09776 | ||
|
8ecb7f296e | ||
|
3477d30dc5 | ||
|
f30dfecaf7 | ||
|
8a666eb5a4 | ||
|
61071132bf | ||
|
b177c3930d | ||
|
eb8d28b694 | ||
|
0b4f757b2b | ||
|
2aa20e2060 | ||
|
7d8ff8f72e | ||
|
576dde394a | ||
|
1d7491be0d | ||
|
15cc0113a9 | ||
|
9532dadc2e | ||
|
94715ef718 | ||
|
44bb75cf6e | ||
|
4d2072ce65 | ||
|
eb36f97c50 | ||
|
a76522a990 | ||
|
71187a5e51 | ||
|
b54a5d2dfd | ||
|
134ec106b3 | ||
|
1b90ed4fcc | ||
|
3fcc477b25 | ||
|
81c75477f4 | ||
|
8b025ff2c2 | ||
|
2de9ea5c7d | ||
|
d9e6288b7a | ||
|
8d78559597 | ||
|
2a281d0a53 | ||
|
28dfff5752 | ||
|
7d0d3db11c | ||
|
63c475d400 | ||
|
d334a77447 | ||
|
1b7d7976b1 | ||
|
d7770a12c6 | ||
|
5fef6560bf | ||
|
75605116d0 | ||
|
35943ea8fc | ||
|
e166f54328 | ||
|
c1cc35ac17 | ||
|
0acb497216 | ||
|
58707dac42 | ||
|
8f14d30d11 | ||
|
bde0d74282 | ||
|
026e93121e | ||
|
f87722233a | ||
|
03c5a235ef | ||
|
215ab9f17b | ||
|
794a8efaed | ||
|
b56c327ccc | ||
|
8f43551d68 | ||
|
23cccaf87f | ||
|
c75b77affc | ||
|
7ffc53f45e | ||
|
6ea7e47194 | ||
|
6130f0a4f9 | ||
|
44dcb69c41 | ||
|
13148c632f | ||
|
6fd3c113ec | ||
|
9661c4becc | ||
|
c60d1d5449 | ||
|
eedc64096c | ||
|
cf8068049f | ||
|
5e3d6bdf18 | ||
|
aff6786e71 | ||
|
2408a0731c | ||
|
a3c345e79e | ||
|
b2950457ce | ||
|
9ce768bc4b | ||
|
c9e7e3a862 | ||
|
33eefd46c7 | ||
|
be91463190 | ||
|
28324c38cc | ||
|
4cb95e1477 | ||
|
691cd81192 | ||
|
9c9ad03d60 | ||
|
c84923132a | ||
|
85f31a1707 | ||
|
92ec7c6d33 | ||
|
0a323e5080 | ||
|
222df2c7d6 | ||
|
f92d7f9ee7 | ||
|
de5cf356c9 | ||
|
d3f9cb80d7 | ||
|
fb61de47a0 | ||
|
0727d0911c | ||
|
fbb3070abe | ||
|
402c96e473 | ||
|
44f28a486b | ||
|
4aeb33b2b9 | ||
|
3728e4c34e | ||
|
e71eb0e75b | ||
|
f233a1673f | ||
|
b96843a960 | ||
|
eb69a5547f | ||
|
7f39d62371 | ||
|
6f179a3141 | ||
|
cad4b8f2f5 | ||
|
beb68e2fc4 | ||
|
b4a16ccd89 | ||
|
15e73d9b7d | ||
|
344bdd330f | ||
|
2546fa37eb | ||
|
080dd0850b | ||
|
b7be9a7141 | ||
|
67798e0d7d | ||
|
6de9ad750b | ||
|
68162783dc | ||
|
95b9d824ea | ||
|
7dd0c2eac3 | ||
|
62dda3b782 | ||
|
4e1e1ccb9f |
@@ -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
|
||||||
@@ -24,3 +22,6 @@ stamp-h
|
|||||||
sun4
|
sun4
|
||||||
sun4sol2
|
sun4sol2
|
||||||
support
|
support
|
||||||
|
i386-freebsd
|
||||||
|
alpha-dec-osf3.0
|
||||||
|
i686-pc-linux-gnu-linux
|
||||||
|
673
ChangeLog
673
ChangeLog
@@ -1,3 +1,676 @@
|
|||||||
|
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>
|
||||||
|
|
||||||
|
* lib/{init, open}.c: Added `GLIBTOP_METHOD_PIPE' again.
|
||||||
|
|
||||||
|
* src/server/main.c: Removed gettext stuff.
|
||||||
|
|
||||||
|
1998-07-17 Martin Baulig <baulig@Stud.Informatik.uni-trier.de>
|
||||||
|
|
||||||
|
* sysdeps/common/sysdeps.c (glibtop_get_sysdeps_r): Using
|
||||||
|
library functions with '_l' prefix instead of directly calling
|
||||||
|
sysdeps code with '_r' prefix. This is necessary for client/server
|
||||||
|
mode.
|
||||||
|
|
||||||
|
* lib/lib.awk (glibtop_get_*): Now correctly using
|
||||||
|
`(1 << GLIBTOP_SYSDEPS_*)' instead of `GLIBTOP_SYSDEPS_*'.
|
||||||
|
|
||||||
|
* sysdeps/sun4/proclist.c (glibtop_get_proclist_p): Added
|
||||||
|
implementation of that feature.
|
||||||
|
|
||||||
|
* sysdeps/sun4/proc_{uid, state}.c: Now working quite well.
|
||||||
|
|
||||||
|
* sysdeps/sun4/proc_{mem, time, signal, kernel, segment}.c: Added
|
||||||
|
some basic implementation; this isn't really working yet.
|
||||||
|
|
||||||
|
* sysdeps/linux/sem_limits.c: Applied patch from Albert K T Hui
|
||||||
|
<avatar@deva.net> for glibc 2.1.
|
||||||
|
|
||||||
|
1998-07-15 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
|
* sysdeps/sun4/loadavg.h: New file. Imported from top 3.4.
|
||||||
|
|
||||||
|
* sysdeps/sun4/uptime.c (glibtop_get_uptime_p): Added
|
||||||
|
implementation of that function using glibtop_get_cpu ().
|
||||||
|
|
||||||
|
* sysdeps/sun4/loadavg.c (glibtop_get_loadavg_p): Added
|
||||||
|
implementation of that feature.
|
||||||
|
|
||||||
|
* sysdeps/sun4/{shm_limits.c, msg_limits.c, shm_limits.c}:
|
||||||
|
Added implementation of this features.
|
||||||
|
|
||||||
|
1998-07-14 Martin Baulig <baulig@Stud.Informatik.uni-trier.de>
|
||||||
|
|
||||||
|
* src/daemon/server_config.h.in: Added some comments.
|
||||||
|
|
||||||
|
* src/daemon/server_config.pl: New file. This is a script you can use
|
||||||
|
to create `server_config.h'. It will query you for some configuration
|
||||||
|
options.
|
||||||
|
|
||||||
|
* configure.in (AC_PROG_AWK): Replaced this test with explicit test
|
||||||
|
for `gawk' and `awk' since `mawk' doesn't work.
|
||||||
|
|
||||||
|
1998-07-14 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
|
* src/daemon/gnuserv.c: Doing correct server initialization
|
||||||
|
using `glibtop_set_parameter_l' and `glibtop_init_r'.
|
||||||
|
|
||||||
|
* src/daemon/main.c: Removed call to `glibtop_init_r'.
|
||||||
|
|
||||||
|
* lib/open.c (glibtop_open_l): We now call the open function
|
||||||
|
of the sysdeps directory (glibtop_open_r) for server method
|
||||||
|
`GLIBTOP_METHOD_DIRECT'.
|
||||||
|
|
||||||
|
* sysdeps/{linux, sun4, stub}/open.c: No longer `memset'
|
||||||
|
server to zero.
|
||||||
|
|
||||||
|
* src/daemon/slave.c: New file.
|
||||||
|
|
||||||
|
* src/daemon/*.c: Done some more work on the daemon.
|
||||||
|
|
||||||
|
* sysdeps/common/gnuslib.c: Removed IPC stuff.
|
||||||
|
|
||||||
|
* include/glibtop/gnuserv.h: Removed IPC stuff.
|
||||||
|
|
||||||
|
* include/glibtop/command.h (glibtop_response_unit): Added
|
||||||
|
typedef for `struct _glibtop_response_unit'.
|
||||||
|
|
||||||
|
* lib/Makefile.am: Using `$(top_srcdir)/features.def'
|
||||||
|
instead of `$(top_builddir)/features.def'.
|
||||||
|
|
||||||
|
* sysdeps/guile/Makefile.am: Using `$(top_srcdir)/features.def'
|
||||||
|
instead of `$(top_builddir)/features.def'.
|
||||||
|
|
||||||
|
* sysdeps/guile/names/Makefile.am: Dito.
|
||||||
|
|
||||||
|
* sysdeps/stub/*.c: changed suffix of all functions
|
||||||
|
from '_s' to '_r'; see also ChangeLog entry from Jun 6.
|
||||||
|
|
||||||
|
1998-07-13 Martin Baulig <baulig@merkur.uni-trier.de>
|
||||||
|
|
||||||
|
* src/daemon/server_config.h: Removed from CVS.
|
||||||
|
This is a config file which needs to be edited.
|
||||||
|
|
||||||
|
* src/daemon/server_config.h.in: Added. This is just
|
||||||
|
an example for `server_config.h'.
|
||||||
|
|
||||||
|
1998-07-13 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
|
* glibtop.h: Fixed invocation of `glibtop_close_r'.
|
||||||
|
|
||||||
|
* sysdeps/linux/procstate.c: Added missing `fclose'.
|
||||||
|
|
||||||
|
* include/glibtop/gnuserv.h (UNIX_DOMAIN_SOCKETS): Defining.
|
||||||
|
|
||||||
|
* include/glibtop/open.h (GLIBTOP_METHOD_UNIX): Added.
|
||||||
|
|
||||||
|
* lib/init.c: Added new method `GLIBTOP_METHOD_UNIX'.
|
||||||
|
|
||||||
|
* lib/open.c: Added support for Unix Domain Sockets.
|
||||||
|
|
||||||
|
* lib/close.c: Now closing inet and unix connections.
|
||||||
|
|
||||||
|
* lib/parameter.c (glibtop_set_parameter_l): You can now
|
||||||
|
set the `method' and `features' fields.
|
||||||
|
|
||||||
|
* src/daemon/server_config.h: New file.
|
||||||
|
|
||||||
|
* src/daemon/{gnuserv.c, main.c}: More work on the server.
|
||||||
|
|
||||||
|
1998-07-10 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
|
* src/Makefile.am (SUBDIRS): Removed `proxy'. This directory
|
||||||
|
is considered obsolete and will be removed soon.
|
||||||
|
|
||||||
|
1998-07-06 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
|
* sysdeps/common/mountlist.c: using functions from `xmalloc.c'.
|
||||||
|
|
||||||
|
* sysdeps/common/error.c: all functions now accept NULL as
|
||||||
|
`server' argument.
|
||||||
|
|
||||||
|
* acconfig.h (AFS, MOUNTED_FREAD, MOUNTED_FREAD_FSTYP,
|
||||||
|
MOUNTED_GETFSSTAT, MOUNTED_GETMNT, MOUNTED_GETMNTENT1,
|
||||||
|
MOUNTED_GETMNTENT2, MOUNTED_GETMNTINFO, MOUNTED_LISTMNTENT,
|
||||||
|
MOUNTED_VMOUNT, STAT_STATFS3_OSF1, STAT_READ_FILSYS,
|
||||||
|
STAT_STATFS2_BSIZE, STAT_STATFS2_FSIZE, STAT_STATFS2_FS_DATA,
|
||||||
|
STAT_STATFS4, STAT_STATVFS, STATFS_TRUNCATES_BLOCK_COUNTS):
|
||||||
|
New macros.
|
||||||
|
|
||||||
|
* configure.in: added GNOME_FILEUTILS_CHECKS.
|
||||||
|
|
||||||
|
* sysdeps/common/{fsusage, mountlist}.[ch]:
|
||||||
|
Imported from GNU Fileutils 3.16.
|
||||||
|
|
||||||
|
* sysdeps/common/mountlist.c: using g_malloc, g_realloc and g_strdup.
|
||||||
|
|
||||||
|
1998-07-03 Martin baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
|
* macros/gnome-libgtop-sysdeps.m4: No longer use
|
||||||
|
`glibtop_machine.h' for Linux.
|
||||||
|
|
||||||
|
* sysdeps/linux/glibtop_machine.h: Removed.
|
||||||
|
|
||||||
|
* sysdeps/guile/guile.awk: Using `scm_append'
|
||||||
|
instead of `gh_append'.
|
||||||
|
|
||||||
|
* sysdeps/guile/names/guile-names.awk: dito.
|
||||||
|
|
||||||
|
* sysdeps/linux/*.c: Using code from stable branch again.
|
||||||
|
|
||||||
|
* include/glibtop/parameter.h: New file.
|
||||||
|
|
||||||
|
* lib/parameter.c: New file.
|
||||||
|
|
||||||
|
* lib/{open, init}.c: Done some more work on server
|
||||||
|
initialization
|
||||||
|
|
||||||
|
1998-06-21 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
|
* perl/*: Added perl interface.
|
||||||
|
|
||||||
|
* sysdeps/linux/cpu.c: Bug fix.
|
||||||
|
|
||||||
|
* include/glibtop/global.h: Only including guile header files
|
||||||
|
within libgtop.
|
||||||
|
|
||||||
|
* configure.in (LIGBTOP_LIBS): Added `-lgtop'.
|
||||||
|
|
||||||
|
* Makefile.am: Creating `perl/Makefile.PL' from `perl/Makefile.PL.in'
|
||||||
|
and `perl/Libgtop.xs' using `perl/perl.awk'.
|
||||||
|
|
||||||
|
1998-06-18 Martin Baulig <baulig@taurus.uni-trier.de>
|
||||||
|
|
||||||
|
* sysdeps/linux/*.c: Reverted some stuff from 06-07-1998
|
||||||
|
since it was too buggy.
|
||||||
|
|
||||||
|
* glibtop.h (_glibtop): New field `server_port'.
|
||||||
|
|
||||||
|
* lib/xmalloc.c (glibtop_strdup_r): New function.
|
||||||
|
|
||||||
|
* lib/gnuclient.c: Removed.
|
||||||
|
|
||||||
|
* lib/{command, write, read}.c: Changed client <-> server
|
||||||
|
interface to make less system calls.
|
||||||
|
|
||||||
|
* src/daemon/main.c: Changed server side of interface.
|
||||||
|
|
||||||
|
* include/glibtop/command.h (struct _glibtop_response): New
|
||||||
|
structure to return data from the server to the client.
|
||||||
|
|
||||||
|
1998-06-14 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
|
* glibtop.h (struct _glibtop): Added `socket' field.
|
||||||
|
|
||||||
|
* include/glibtop/gnuserv.h: New file. Imported from xemacs 20.3.
|
||||||
|
|
||||||
|
* sysdeps/common/gnuslib.c: New file. Imported from xemacs 20.3
|
||||||
|
|
||||||
|
* lib/gnuclient.c: New file. Imported from xemacs 20.3
|
||||||
|
|
||||||
|
* sysdeps/daemon/gnuserv.c: New file. Imported from xemacs 20.3
|
||||||
|
|
||||||
|
* sysdeps/daemon: New directory.
|
||||||
|
|
||||||
|
* configure.in (LIBGTOP_LIBS, LIBGTOP_GUILE_LIBS): Added
|
||||||
|
`$X_LIBS -lXau' when we have xauth.
|
||||||
|
|
||||||
|
* acconfig.h (HAVE_XAUTH): New tag.
|
||||||
|
|
||||||
|
* configure.in: Added check for `HAVE_XAUTH'.
|
||||||
|
|
||||||
|
* sysdeps/common/error.c (glibtop_warn_r): New function -
|
||||||
|
same as `glibtop_error_r', but doesn't call `exit'.
|
||||||
|
(glibtop_error_io_r, glibtop_warn_io_r): New functions,
|
||||||
|
display `strerror (errno)' together with message.
|
||||||
|
|
||||||
|
* include/glibtop/global.h (TIME_WITH_SYS_TIME): including
|
||||||
|
correct headers; (HAVE_UNISTD_H): Added conditional.
|
||||||
|
Added `#include <sys/param.h>' and `#include <sys/stat.h>'.
|
||||||
|
|
||||||
|
* acconfig.h (HAVE_LINUX_TABLE): New tag.
|
||||||
|
|
||||||
|
* lib/lib.awk: New file.
|
||||||
|
Creates `lib.c' depending upon `features.def'.
|
||||||
|
|
||||||
|
* lib/<feature>.c: Removed.
|
||||||
|
|
||||||
|
* sysdeps/guile/guile.awk: New file.
|
||||||
|
Creates `guile.c' depending upon `features.def'.
|
||||||
|
|
||||||
|
* sysdeps/guile/*.c: Removed.
|
||||||
|
|
||||||
|
1998-06-13 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
|
* features.def: List of features for `guile-names.awk'.
|
||||||
|
|
||||||
|
* sysdeps/guile/names/guile-names.awk: New file.
|
||||||
|
Creates `guile-names.c' depending upon `features.def'.
|
||||||
|
|
||||||
|
* sysdeps/guile/names/*.c: Removed.
|
||||||
|
|
||||||
|
* kernel: New directory. Contains some kernel code to
|
||||||
|
implement a new system call table () to fetch information
|
||||||
|
directly from the Linux kernel.
|
||||||
|
|
||||||
|
* sysdeps/kernel: New directory. Uses the table () function
|
||||||
|
from the `kernel' directory to fetch things directly from
|
||||||
|
the Linux kernel.
|
||||||
|
|
||||||
|
* sysdeps/Makefile.am (DIST_SUBDIRS): Added `kernel'.
|
||||||
|
|
||||||
|
* configure.in: Removed `build_CC' again.
|
||||||
|
|
||||||
|
1998-06-12 Martin Baulig <baulig@taurus.uni-trier.de>
|
||||||
|
|
||||||
|
* include/glibtop/sysdeps.h (glibtop_types_sysdeps):
|
||||||
|
Forgot to change declaration on Jun 6.
|
||||||
|
|
||||||
|
* sysdeps/names/sysdeps.c (glibtop_types_sysdeps):
|
||||||
|
Using numeric constants from `types.h' instead of string
|
||||||
|
constants; forgot to change this on Jun 6. Added information
|
||||||
|
about new `features' field of `_glibtop_sysdeps'.
|
||||||
|
|
||||||
|
* sysdeps/guile/names/*.c (glibtop_guile_types_*):
|
||||||
|
Using `gh_ulong2scm' instead of `gh_str02scm'.
|
||||||
|
|
||||||
|
* sysdeps/guile/proclist.c: Replaced call to
|
||||||
|
`gh_append2 ()' with `gh_append ()'.
|
||||||
|
|
||||||
|
* sysdeps/guile/names/*.c: dito.
|
||||||
|
|
||||||
|
1998-06-08 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
|
* support: Added again.
|
||||||
|
|
||||||
|
* Makefile.am (SUBDIRS): Added `support' again.
|
||||||
|
|
||||||
|
* configure.in: First, we check for gnome. If it is not
|
||||||
|
found, we run GNOME_SUPPORT_CHECKS; otherwise use
|
||||||
|
`$GNOME_LIBDIR -lgnomesupport'.
|
||||||
|
|
||||||
|
1998-06-07 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
|
* examples/ChangeLog: New file.
|
||||||
|
|
||||||
|
* macros/gnome-libgtop-sysdeps.m4: Include
|
||||||
|
`glibtop_machine.h' for Linux.
|
||||||
|
|
||||||
|
* sysdeps/linux/glibtop_machine.h: New file.
|
||||||
|
|
||||||
|
* sysdeps/linux/*.c: Performance optimizations. We now use
|
||||||
|
`open' and `read' instead of `fopen' and `fscanf'.
|
||||||
|
|
||||||
|
* *.[ch]: Using single underscore instead of two underscores
|
||||||
|
for function prefixes (regexp: ``s,__([rspl])\b,_$1,g'') to
|
||||||
|
avoid ambiguity with mangled C++ names.
|
||||||
|
|
||||||
|
1998-06-06 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
|
* sysdeps/osf1/glibtop_server.h: New file.
|
||||||
|
|
||||||
|
* sysdeps/osf1/*.c: renamed all functions implementing
|
||||||
|
features that don't need to be suid to '__s'.
|
||||||
|
|
||||||
|
* sysdeps/names/procdata.c: Removed that file.
|
||||||
|
|
||||||
|
* include/glibtop/*.h (glibtop_types_*): Changed declaration.
|
||||||
|
|
||||||
|
* glibtop.h: Added `#include <types.h>'.
|
||||||
|
|
||||||
|
* include/glibtop/types.h: New file - numeric constants
|
||||||
|
for `glibtop_types_<feature>'.
|
||||||
|
|
||||||
|
* sysdeps/names/*.c (glibtop_types_*): Using numeric
|
||||||
|
constants from `types.h' instead of string constants.
|
||||||
|
|
||||||
|
1998-06-05 Martin Baulig <baulig@taurus.uni-trier.de>
|
||||||
|
|
||||||
|
* support: removed that directory.
|
||||||
|
|
||||||
|
* configure.in: we check whether '-lgnomesupport' is
|
||||||
|
included in $GNOME_LIBS and add it together with
|
||||||
|
$GNOME_LIBDIR to LIBSUPPORT in this case.
|
||||||
|
|
||||||
|
Gnome (gnome-libs) is now required to build libgtop,
|
||||||
|
added short comment to configure.in how to revert this
|
||||||
|
change.
|
||||||
|
|
||||||
|
* Makefile.am: removed `support' subdir.
|
||||||
|
|
||||||
|
1998-06-03 Martin Baulig <baulig@merkur.uni-trier.de>
|
||||||
|
|
||||||
|
* libgtop.spec: New file.
|
||||||
|
|
||||||
|
* Makefile.am (EXTRA_DIST): Added `autogen.sh' and
|
||||||
|
`libgtop.spec'.
|
||||||
|
|
||||||
|
* configure.in (LIBGTOP_INCS): is now identically to
|
||||||
|
`LIBGTOP_GUILE_INCS'.
|
||||||
|
|
||||||
|
* include/glibtop/global.h: only including intl headers
|
||||||
|
while compiling libgtop.
|
||||||
|
|
||||||
|
1998-06-02 Federico Mena Quintero <federico@nuclecu.unam.mx>
|
||||||
|
|
||||||
|
* src/server/main.c: #include <locale.h>
|
||||||
|
|
||||||
|
1998-06-02 Martin Baulig <baulig@merkur.uni-trier.de>
|
||||||
|
|
||||||
|
* lib/open.c (glibtop_open): renamed to `glibtop_open__l'.
|
||||||
|
|
||||||
|
* sysdeps/linux/open.c (glibtop_open): renamed to
|
||||||
|
`glibtop_open__r'.
|
||||||
|
|
||||||
|
* include/glibtop/open.h (GLIBTOP_OPEN_NO_OVERRIDE):
|
||||||
|
tells `glibtop_open' to use the default server and not
|
||||||
|
to check the environment variables.
|
||||||
|
|
||||||
|
* include/glibtop/sysdeps.h (_glibtop_sysdeps):
|
||||||
|
renamed 'dummy' member to 'features'.
|
||||||
|
|
||||||
|
* src/proxy/*: new directory - proxy server.
|
||||||
|
|
||||||
|
* include/glibtop/command.h (GLIBTOP_CMND_SYSDEPS):
|
||||||
|
added definition here.
|
||||||
|
|
||||||
|
* src/server/main.c (GLIBTOP_CMND_SYSDEPS): new
|
||||||
|
command to get glibtop_server_features.
|
||||||
|
|
||||||
|
1998-06-01 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
|
* NEWS: added more detailed description of today's and
|
||||||
|
yesterday's changes.
|
||||||
|
|
||||||
|
* include/glibtop/*.h: to use the ChangeLog entry from May 28:
|
||||||
|
'__l' is a function defined in the client part;
|
||||||
|
'__s' is a function defined in the sysdeps part and
|
||||||
|
'__p' is a function that needs special priviledges.
|
||||||
|
'__r' is mapped either on '__p' or on '__s'.
|
||||||
|
the function without suffix is mapped on '__l'.
|
||||||
|
|
||||||
|
* sysdeps/common/sysdeps.c: now using '__r' functions,
|
||||||
|
they are #defined either as the '__p' or the '__s' ones.
|
||||||
|
|
||||||
|
* sysdeps/linux/*.c: changed call of 'glibtop_init__r',
|
||||||
|
it now takes two additional arguments.
|
||||||
|
|
||||||
|
* examples/{first.c, second.c}: now using 'glibtop_init'
|
||||||
|
instead of 'glibtop_init__r'.
|
||||||
|
|
||||||
|
* include/glibtop/sysdeps.h: added 'dummy' member so
|
||||||
|
'GLIBTOP_SYSDEPS_<feature>' now start with 1.
|
||||||
|
|
||||||
|
* include/glibtop/*.h: we now #define 'glibtop_get_<feature>'
|
||||||
|
as 'glibtop_get_<feature>__l' and 'glibtop_get_<feature>__r'
|
||||||
|
either as the '__p' or the '__s' function.
|
||||||
|
|
||||||
|
* lib/*.c: removed #if's - we now decide at runtime
|
||||||
|
whether to use the server or to call the appropriate
|
||||||
|
function for the sysdeps directory.
|
||||||
|
|
||||||
|
1998-05-28 Martin Baulig <baulig@merkur.uni-trier.de>
|
||||||
|
|
||||||
|
* src/server/main.c: we now use the '__p' functions,
|
||||||
|
but only if the appropriate 'GLIBTOP_SUID_<feature>'
|
||||||
|
has a non-zero value.
|
||||||
|
|
||||||
|
* configure.in (@machine_incs@): always use
|
||||||
|
`-I$(top_srcdir)/sysdeps/@sysdeps_dir@'; it's no
|
||||||
|
longer conditional.
|
||||||
|
|
||||||
|
* examples/Makefile.am: removed the '_linux' examples.
|
||||||
|
|
||||||
|
* sysdeps/linux/*.c: renamed all functions implementing
|
||||||
|
features to '__s'.
|
||||||
|
|
||||||
|
* lib/*.c: renamed all functions implementing features
|
||||||
|
to '__l'; we only emit code for those functions if the
|
||||||
|
corresponding 'GLIBTOP_SUID_<feature>' has a positive value.
|
||||||
|
|
||||||
|
* include/glibtop/*.h: added some new function suffixes:
|
||||||
|
'__l' is a function defined in the client part;
|
||||||
|
'__s' is a function defined in the sysdeps part and
|
||||||
|
'__p' is a function that needs special priviledges.
|
||||||
|
'__r' is mapped either on '__l' or on '__s'.
|
||||||
|
|
||||||
|
* sysdeps/linux/glibtop_server.h: New file -
|
||||||
|
defines system dependent constants 'GLIBTOP_SUID_<feature>'
|
||||||
|
being either 'GLIBTOP_SYSDEPS_<feature>'+1 depending upon
|
||||||
|
whether or not this feature requires using the server.
|
||||||
|
|
||||||
|
* lib/sysdeps.c: removed that file; it is no longer
|
||||||
|
needed.
|
||||||
|
|
||||||
|
1998-05-25 Martin Baulig <baulig@merkur.uni-trier.de>
|
||||||
|
|
||||||
|
* src/server/main.c: Fixed `broken pipe' error when server
|
||||||
|
is running SUID; accidentally uses setreuid () instead of
|
||||||
|
setregid ().
|
||||||
|
|
||||||
1998-05-24 Martin Baulig <martin@home-of-linux.org>
|
1998-05-24 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
* sysdeps/sun4/{open.c, mem.c, glibtop_machine.h}: added
|
* sysdeps/sun4/{open.c, mem.c, glibtop_machine.h}: added
|
||||||
|
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
|
50
Makefile.am
50
Makefile.am
@@ -1,18 +1,22 @@
|
|||||||
## 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 src lib
|
|
||||||
|
|
||||||
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 support 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
|
||||||
|
|
||||||
EXTRA_DIST = copyright.txt libgtopConf.sh.in
|
EXTRA_DIST = autogen.sh libgtop.spec copyright.txt libgtopConf.sh.in
|
||||||
|
|
||||||
release:
|
release:
|
||||||
$(MAKE) dist distdir=$(PACKAGE)$(VERSION)
|
$(MAKE) dist distdir=$(PACKAGE)$(VERSION)
|
||||||
@@ -22,6 +26,9 @@ release:
|
|||||||
confexecdir=$(libdir)
|
confexecdir=$(libdir)
|
||||||
confexec_DATA = $(top_builddir)/libgtopConf.sh
|
confexec_DATA = $(top_builddir)/libgtopConf.sh
|
||||||
|
|
||||||
|
noinst_DATA = $(top_builddir)/perl/Makefile.PL \
|
||||||
|
$(top_builddir)/perl/Libgtop.xs
|
||||||
|
|
||||||
## to automatically rebuild aclocal.m4 if any of the macros in
|
## to automatically rebuild aclocal.m4 if any of the macros in
|
||||||
## `macros/' change
|
## `macros/' change
|
||||||
@MAINT@include macros/macros.dep
|
@MAINT@include macros/macros.dep
|
||||||
@@ -33,6 +40,31 @@ confexec_DATA = $(top_builddir)/libgtopConf.sh
|
|||||||
## the value NONE in configure if the user doesn't specify them (this
|
## the value NONE in configure if the user doesn't specify them (this
|
||||||
## is an autoconf feature, not a bug).
|
## is an autoconf feature, not a bug).
|
||||||
libgtopConf.sh: libgtopConf.sh.in Makefile
|
libgtopConf.sh: libgtopConf.sh.in Makefile
|
||||||
|
## Use sed and then mv to avoid problems if the user interrupts.
|
||||||
|
sed -e 's,\@LIBGTOP_LIBDIR\@,$(libdir),g' \
|
||||||
|
-e 's,\@LIBGTOP_INCLUDEDIR\@,$(includedir),g' \
|
||||||
|
-e 's,\@LIBGTOP_LIBS\@,$(LIBGTOP_LIBS),g' \
|
||||||
|
-e 's,\@LIBGTOP_INCS\@,$(LIBGTOP_INCS),g' \
|
||||||
|
-e 's,\@LIBGTOP_NAMES_LIBS\@,$(LIBGTOP_NAMES_LIBS),g' \
|
||||||
|
-e 's,\@LIBGTOP_NAMES_INCS\@,$(LIBGTOP_NAMES_INCS),g' \
|
||||||
|
-e 's,\@LIBGTOP_GUILE_LIBS\@,$(LIBGTOP_GUILE_LIBS),g' \
|
||||||
|
-e 's,\@LIBGTOP_GUILE_INCS\@,$(LIBGTOP_GUILE_INCS),g' \
|
||||||
|
-e 's,\@LIBGTOP_GUILE_NAMES_LIBS\@,$(LIBGTOP_GUILE_NAMES_LIBS),g' \
|
||||||
|
-e 's,\@LIBGTOP_GUILE_NAMES_INCS\@,$(LIBGTOP_GUILE_NAMES_INCS),g' \
|
||||||
|
-e 's,\@LIBGTOP_BINDIR\@,$(LIBGTOP_BINDIR),g' \
|
||||||
|
-e 's,\@LIBGTOP_SERVER\@,$(LIBGTOP_SERVER),g' \
|
||||||
|
-e 's,\@LIBGTOP_MAJOR_VERSION\@,$(LIBGTOP_MAJOR_VERSION),g' \
|
||||||
|
-e 's,\@LIBGTOP_MINOR_VERSION\@,$(LIBGTOP_MINOR_VERSION),g' \
|
||||||
|
-e 's,\@LIBGTOP_VERSION\@,$(LIBGTOP_VERSION),g' \
|
||||||
|
-e 's,\@libgtop_sysdeps_dir\@,$(libgtop_sysdeps_dir),g' \
|
||||||
|
-e 's,\@libgtop_need_server\@,$(libgtop_need_server),g' \
|
||||||
|
-e 's,\@libgtop_use_machine_h\@,$(libgtop_use_machine_h),g' \
|
||||||
|
-e 's,\@libgtop_guile_found\@,$(libgtop_guile_found),g' \
|
||||||
|
-e 's,\@libgtop_want_examples\@,$(libgtop_want_examples),g' \
|
||||||
|
< $(srcdir)/libgtopConf.sh.in > libgtopConf.tmp \
|
||||||
|
&& mv libgtopConf.tmp libgtopConf.sh
|
||||||
|
|
||||||
|
perl/Makefile.PL: perl/Makefile.PL.in Makefile
|
||||||
## Use sed and then mv to avoid problems if the user interrupts.
|
## Use sed and then mv to avoid problems if the user interrupts.
|
||||||
sed -e 's,\@LIBGTOP_LIBDIR\@,$(libdir),g' \
|
sed -e 's,\@LIBGTOP_LIBDIR\@,$(libdir),g' \
|
||||||
-e 's,\@LIBGTOP_INCLUDEDIR\@,$(includedir),g' \
|
-e 's,\@LIBGTOP_INCLUDEDIR\@,$(includedir),g' \
|
||||||
@@ -49,5 +81,9 @@ libgtopConf.sh: libgtopConf.sh.in Makefile
|
|||||||
-e 's,\@libgtop_want_names\@,$(libgtop_want_names),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_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)/perl/Makefile.PL.in > perl/Makefile.tmp \
|
||||||
&& mv libgtopConf.tmp libgtopConf.sh
|
&& mv perl/Makefile.tmp perl/Makefile.PL
|
||||||
|
|
||||||
|
perl/Libgtop.xs: perl/perl.awk $(top_builddir)/config.h $(top_srcdir)/features.def
|
||||||
|
$(AWK) -f $(top_srcdir)/perl/perl.awk < $(top_srcdir)/features.def > perl/lgt-t
|
||||||
|
mv perl/lgt-t perl/Libgtop.xs
|
||||||
|
111
NEWS
111
NEWS
@@ -1,5 +1,116 @@
|
|||||||
$Id$
|
$Id$
|
||||||
|
|
||||||
|
Jun/01/1998
|
||||||
|
===========
|
||||||
|
|
||||||
|
* We have some new ``suffix rules'':
|
||||||
|
|
||||||
|
'__l' is a function defined in the client part;
|
||||||
|
'__s' is a function defined in the sysdeps part and
|
||||||
|
'__p' is a function that needs special priviledges.
|
||||||
|
'__r' is mapped either on '__p' or on '__s'.
|
||||||
|
the function without suffix is mapped on '__l'.
|
||||||
|
|
||||||
|
* We now decide at runtime whether or not using the server
|
||||||
|
is required for a particular function. All user programs
|
||||||
|
now call the '__l' function defined in '-lgtop' (in the lib
|
||||||
|
subdir). These functions either use 'glibtop_call__l' to
|
||||||
|
call the server or call the '__r' function.
|
||||||
|
|
||||||
|
* A function in the sysdeps directory now has the '__s' suffix
|
||||||
|
if it do not need any priviledges (and thus can be called directly
|
||||||
|
from client code) and the '__p' suffix otherwise (when it has to
|
||||||
|
be called from the server).
|
||||||
|
|
||||||
|
* If you call one of these functions:
|
||||||
|
|
||||||
|
-> use the '__p' suffix to be sure to get the SUID-safe one
|
||||||
|
(used in the server).
|
||||||
|
-> use the '__s' suffix to be sure to get a function that
|
||||||
|
doesn't need any priviledges.
|
||||||
|
-> use the '__r' suffix otherwise (it is mapped either on the
|
||||||
|
'__p' or on the '__s' one).
|
||||||
|
|
||||||
|
Only use the '__p' and '__s' functions in a 'GLIBTOP_SUID_<feature>'
|
||||||
|
conditional, otherwise you'll get undefined symbols !
|
||||||
|
|
||||||
|
* The server is now started from 'glibtop_init__r', but only when
|
||||||
|
it's really needed; for instance on DEC OSF/1 you only need it
|
||||||
|
for the proc* features - if you program only fetches the CPU usage,
|
||||||
|
now server will be started.
|
||||||
|
|
||||||
|
* Sorry, at the moment everything is a little bit unstable, I'm doing
|
||||||
|
heavy changes. I've just some great ideas which still need some work:
|
||||||
|
|
||||||
|
-> I want to have a SUID server that only implements those features
|
||||||
|
that need to be SUID; everything else uses the sysdeps code directly.
|
||||||
|
|
||||||
|
-> If a program only uses stuff that do not need the server, the
|
||||||
|
server will not be started at all.
|
||||||
|
|
||||||
|
-> I'm working on some kind of proxy server that can be used on a remote
|
||||||
|
host; in feature one can then use the MDI stuff from ghex in gtop to
|
||||||
|
have notebook pages displaying processes from different hosts.
|
||||||
|
|
||||||
|
* Well it is as much unstable that it only works under Linux at the moment.
|
||||||
|
|
||||||
|
1998-06-01 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
|
* sysdeps/common/sysdeps.c: now using '__r' functions,
|
||||||
|
they are #defined either as the '__p' or the '__s' ones.
|
||||||
|
|
||||||
|
* sysdeps/linux/*.c: changed call of 'glibtop_init__r',
|
||||||
|
it now takes two additional arguments.
|
||||||
|
|
||||||
|
* examples/{first.c, second.c}: now using 'glibtop_init'
|
||||||
|
instead of 'glibtop_init__r'.
|
||||||
|
|
||||||
|
* include/glibtop/sysdeps.h: added 'dummy' member so
|
||||||
|
'GLIBTOP_SYSDEPS_<feature>' now start with 1.
|
||||||
|
|
||||||
|
* include/glibtop/*.h: we now #define 'glibtop_get_<feature>'
|
||||||
|
as 'glibtop_get_<feature>__l' and 'glibtop_get_<feature>__r'
|
||||||
|
either as the '__p' or the '__s' function.
|
||||||
|
|
||||||
|
* lib/*.c: removed #if's - we now decide at runtime
|
||||||
|
whether to use the server or to call the appropriate
|
||||||
|
function for the sysdeps directory.
|
||||||
|
|
||||||
|
1998-05-28 Martin Baulig <baulig@merkur.uni-trier.de>
|
||||||
|
|
||||||
|
* src/server/main.c: we now use the '__p' functions,
|
||||||
|
but only if the appropriate 'GLIBTOP_SUID_<feature>'
|
||||||
|
has a non-zero value.
|
||||||
|
|
||||||
|
* configure.in (@machine_incs@): always use
|
||||||
|
`-I$(top_srcdir)/sysdeps/@sysdeps_dir@'; it's no
|
||||||
|
longer conditional.
|
||||||
|
|
||||||
|
* examples/Makefile.am: removed the '_linux' examples.
|
||||||
|
|
||||||
|
* sysdeps/linux/*.c: renamed all functions implementing
|
||||||
|
features to '__s'.
|
||||||
|
|
||||||
|
* lib/*.c: renamed all functions implementing features
|
||||||
|
to '__l'; we only emit code for those functions if the
|
||||||
|
corresponding 'GLIBTOP_SUID_<feature>' has a positive value.
|
||||||
|
|
||||||
|
* include/glibtop/*.h: added some new function suffixes:
|
||||||
|
'__l' is a function defined in the client part;
|
||||||
|
'__s' is a function defined in the sysdeps part and
|
||||||
|
'__p' is a function that needs special priviledges.
|
||||||
|
'__r' is mapped either on '__l' or on '__s'.
|
||||||
|
|
||||||
|
* sysdeps/linux/glibtop_server.h: New file -
|
||||||
|
defines system dependent constants 'GLIBTOP_SUID_<feature>'
|
||||||
|
being either 'GLIBTOP_SYSDEPS_<feature>'+1 depending upon
|
||||||
|
whether or not this feature requires using the server.
|
||||||
|
|
||||||
|
* lib/sysdeps.c: removed that file; it is no longer
|
||||||
|
needed.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
May/21/1998
|
May/21/1998
|
||||||
===========
|
===========
|
||||||
|
|
||||||
|
90
acconfig.h
90
acconfig.h
@@ -12,10 +12,92 @@
|
|||||||
|
|
||||||
/* Do not remove this comments and the empty lines; they are needed */
|
/* Do not remove this comments and the empty lines; they are needed */
|
||||||
#undef HAVE_PROGRAM_INVOCATION_SHORT_NAME
|
#undef HAVE_PROGRAM_INVOCATION_SHORT_NAME
|
||||||
|
/* Define if you have the Andrew File System. */
|
||||||
|
#undef AFS
|
||||||
|
|
||||||
|
/* Define one of the following to indicate how a program can
|
||||||
|
get a list of mounted filesystems. */
|
||||||
|
|
||||||
|
/* Define if there is no specific function for reading the list of
|
||||||
|
mounted filesystems. fread will be used to read /etc/mnttab. [SVR2] */
|
||||||
|
#undef MOUNTED_FREAD
|
||||||
|
|
||||||
|
/* Define if (like SVR2) there is no specific function for reading the
|
||||||
|
list of mounted filesystems, and your system has these header files:
|
||||||
|
<sys/fstyp.h> and <sys/statfs.h>. [SVR3] */
|
||||||
|
#undef MOUNTED_FREAD_FSTYP
|
||||||
|
|
||||||
|
/* Define if there is a function named getfsstat for reading the list
|
||||||
|
of mounted filesystems. [DEC Alpha running OSF/1] */
|
||||||
|
#undef MOUNTED_GETFSSTAT
|
||||||
|
|
||||||
|
/* Define if there is a function named getmnt for reading the list of
|
||||||
|
mounted filesystems. [Ultrix] */
|
||||||
|
#undef MOUNTED_GETMNT
|
||||||
|
|
||||||
|
/* Define if there is a function named getmntent for reading the list
|
||||||
|
of mounted filesystems, and that function takes a single argument.
|
||||||
|
[4.3BSD, SunOS, HP-UX, Dynix, Irix] */
|
||||||
|
#undef MOUNTED_GETMNTENT1
|
||||||
|
|
||||||
|
/* Define if there is a function named getmntent for reading the list of
|
||||||
|
mounted filesystems, and that function takes two arguments. [SVR4] */
|
||||||
|
#undef MOUNTED_GETMNTENT2
|
||||||
|
|
||||||
|
/* Define if there is a function named getmntinfo for reading the list
|
||||||
|
of mounted filesystems. [4.4BSD] */
|
||||||
|
#undef MOUNTED_GETMNTINFO
|
||||||
|
|
||||||
|
/* Define if there is a function named listmntent that can be used to
|
||||||
|
list all mounted filesystems. [UNICOS] */
|
||||||
|
#undef MOUNTED_LISTMNTENT
|
||||||
|
|
||||||
|
/* Define if there is a function named mntctl that can be used to read
|
||||||
|
the list of mounted filesystems, and there is a system header file
|
||||||
|
that declares `struct vmount.' [AIX] */
|
||||||
|
#undef MOUNTED_VMOUNT
|
||||||
|
|
||||||
|
/* Define one of the following to indicate how a program can obtain
|
||||||
|
filesystems usage information. */
|
||||||
|
|
||||||
|
/* Define if statfs takes 3 args. [DEC Alpha running OSF/1] */
|
||||||
|
#undef STAT_STATFS3_OSF1
|
||||||
|
|
||||||
|
/* Define if there is no specific function for reading filesystems usage
|
||||||
|
information and you have the <sys/filsys.h> header file. [SVR2] */
|
||||||
|
#undef STAT_READ_FILSYS
|
||||||
|
|
||||||
|
/* Define if statfs takes 2 args and struct statfs has a field named f_bsize.
|
||||||
|
[4.3BSD, SunOS 4, HP-UX, AIX PS/2] */
|
||||||
|
#undef STAT_STATFS2_BSIZE
|
||||||
|
|
||||||
|
/* Define if statfs takes 2 args and struct statfs has a field named f_fsize.
|
||||||
|
[4.4BSD, NetBSD] */
|
||||||
|
#undef STAT_STATFS2_FSIZE
|
||||||
|
|
||||||
|
/* Define if statfs takes 2 args and the second argument has
|
||||||
|
type struct fs_data. [Ultrix] */
|
||||||
|
#undef STAT_STATFS2_FS_DATA
|
||||||
|
|
||||||
|
/* Define if statfs takes 4 args. [SVR3, Dynix, Irix, Dolphin] */
|
||||||
|
#undef STAT_STATFS4
|
||||||
|
|
||||||
|
/* Define if there is a function named statvfs. [SVR4] */
|
||||||
|
#undef STAT_STATVFS
|
||||||
|
|
||||||
|
/* Define if the block counts reported by statfs may be truncated to 2GB
|
||||||
|
and the correct values may be stored in the f_spare array.
|
||||||
|
[SunOS 4.1.2, 4.1.3, and 4.1.3_U1 are reported to have this problem.
|
||||||
|
SunOS 4.1.1 seems not to be affected.] */
|
||||||
|
#undef STATFS_TRUNCATES_BLOCK_COUNTS
|
||||||
|
|
||||||
|
|
||||||
/* 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
|
||||||
@@ -24,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
|
||||||
|
|
||||||
@@ -33,3 +118,8 @@
|
|||||||
#undef GLIBTOP_EXAMPLES
|
#undef GLIBTOP_EXAMPLES
|
||||||
|
|
||||||
#undef NEED_LIBGTOP
|
#undef NEED_LIBGTOP
|
||||||
|
|
||||||
|
#undef HAVE_LINUX_TABLE
|
||||||
|
|
||||||
|
#undef HAVE_XAUTH
|
||||||
|
|
||||||
|
702
acinclude.m4
702
acinclude.m4
@@ -10,603 +10,86 @@ 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])
|
# progtest.m4 from gettext 0.32
|
||||||
# The way shlib-versions is used to generate soversions.mk uses a
|
######################################################################
|
||||||
# fairly simplistic model for name recognition that can't distinguish
|
# Search path for a program which passes the given test.
|
||||||
# i486-pc-linux-gnu fully from i486-pc-gnu. So we mutate a $host_os
|
# Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||||
# 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)
|
|
||||||
])
|
|
||||||
|
|
||||||
# Like AC_CONFIG_HEADER, but automatically create stamp file.
|
|
||||||
|
|
||||||
AC_DEFUN(AM_CONFIG_HEADER,
|
|
||||||
[AC_PREREQ([2.12])
|
|
||||||
AC_CONFIG_HEADER([$1])
|
|
||||||
dnl When config.status generates a header, we must update the stamp-h file.
|
|
||||||
dnl This file resides in the same directory as the config header
|
|
||||||
dnl that is generated. We must strip everything past the first ":",
|
|
||||||
dnl and everything past the last "/".
|
|
||||||
AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
|
|
||||||
ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
|
|
||||||
<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
|
|
||||||
<<am_indx=1
|
|
||||||
for am_file in <<$1>>; do
|
|
||||||
case " <<$>>CONFIG_HEADERS " in
|
|
||||||
*" <<$>>am_file "*<<)>>
|
|
||||||
echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
am_indx=`expr "<<$>>am_indx" + 1`
|
|
||||||
done<<>>dnl>>)
|
|
||||||
changequote([,]))])
|
|
||||||
|
|
||||||
# Do all the work for Automake. This macro actually does too much --
|
|
||||||
# some checks are only needed if your package does certain things.
|
|
||||||
# But this isn't really a big deal.
|
|
||||||
|
|
||||||
# serial 1
|
|
||||||
|
|
||||||
dnl Usage:
|
|
||||||
dnl AM_INIT_AUTOMAKE(package,version, [no-define])
|
|
||||||
|
|
||||||
AC_DEFUN(AM_INIT_AUTOMAKE,
|
|
||||||
[AC_REQUIRE([AM_PROG_INSTALL])
|
|
||||||
PACKAGE=[$1]
|
|
||||||
AC_SUBST(PACKAGE)
|
|
||||||
VERSION=[$2]
|
|
||||||
AC_SUBST(VERSION)
|
|
||||||
dnl test to see if srcdir already configured
|
|
||||||
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
|
|
||||||
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
|
|
||||||
fi
|
|
||||||
ifelse([$3],,
|
|
||||||
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
|
|
||||||
AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
|
|
||||||
AC_REQUIRE([AM_SANITY_CHECK])
|
|
||||||
AC_REQUIRE([AC_ARG_PROGRAM])
|
|
||||||
dnl FIXME This is truly gross.
|
|
||||||
missing_dir=`cd $ac_aux_dir && pwd`
|
|
||||||
AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
|
|
||||||
AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
|
|
||||||
AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
|
|
||||||
AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
|
|
||||||
AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
|
|
||||||
AC_REQUIRE([AC_PROG_MAKE_SET])])
|
|
||||||
|
|
||||||
|
|
||||||
# serial 1
|
|
||||||
|
|
||||||
AC_DEFUN(AM_PROG_INSTALL,
|
|
||||||
[AC_REQUIRE([AC_PROG_INSTALL])
|
|
||||||
test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
|
|
||||||
AC_SUBST(INSTALL_SCRIPT)dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Check to make sure that the build environment is sane.
|
# This file file be copied and used freely without restrictions. It can
|
||||||
#
|
# be used in projects which are not available under the GNU Public License
|
||||||
|
# but which still want to provide support for the GNU gettext functionality.
|
||||||
AC_DEFUN(AM_SANITY_CHECK,
|
# Please note that the actual code is *not* freely available.
|
||||||
[AC_MSG_CHECKING([whether build environment is sane])
|
|
||||||
# Just in case
|
|
||||||
sleep 1
|
|
||||||
echo timestamp > conftestfile
|
|
||||||
# Do `set' in a subshell so we don't clobber the current shell's
|
|
||||||
# arguments. Must try -L first in case configure is actually a
|
|
||||||
# symlink; some systems play weird games with the mod time of symlinks
|
|
||||||
# (eg FreeBSD returns the mod time of the symlink's containing
|
|
||||||
# directory).
|
|
||||||
if (
|
|
||||||
set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
|
|
||||||
if test "[$]*" = "X"; then
|
|
||||||
# -L didn't work.
|
|
||||||
set X `ls -t $srcdir/configure conftestfile`
|
|
||||||
fi
|
|
||||||
if test "[$]*" != "X $srcdir/configure conftestfile" \
|
|
||||||
&& test "[$]*" != "X conftestfile $srcdir/configure"; then
|
|
||||||
|
|
||||||
# If neither matched, then we have a broken ls. This can happen
|
|
||||||
# if, for instance, CONFIG_SHELL is bash and it inherits a
|
|
||||||
# broken ls alias from the environment. This has actually
|
|
||||||
# happened. Such a system could not be considered "sane".
|
|
||||||
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
|
|
||||||
alias in your environment])
|
|
||||||
fi
|
|
||||||
|
|
||||||
test "[$]2" = conftestfile
|
|
||||||
)
|
|
||||||
then
|
|
||||||
# Ok.
|
|
||||||
:
|
|
||||||
else
|
|
||||||
AC_MSG_ERROR([newly created file is older than distributed files!
|
|
||||||
Check your system clock])
|
|
||||||
fi
|
|
||||||
rm -f conftest*
|
|
||||||
AC_MSG_RESULT(yes)])
|
|
||||||
|
|
||||||
dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
|
|
||||||
dnl The program must properly implement --version.
|
|
||||||
AC_DEFUN(AM_MISSING_PROG,
|
|
||||||
[AC_MSG_CHECKING(for working $2)
|
|
||||||
# Run test in a subshell; some versions of sh will print an error if
|
|
||||||
# an executable is not found, even if stderr is redirected.
|
|
||||||
# Redirect stdin to placate older versions of autoconf. Sigh.
|
|
||||||
if ($2 --version) < /dev/null > /dev/null 2>&1; then
|
|
||||||
$1=$2
|
|
||||||
AC_MSG_RESULT(found)
|
|
||||||
else
|
|
||||||
$1="$3/missing $2"
|
|
||||||
AC_MSG_RESULT(missing)
|
|
||||||
fi
|
|
||||||
AC_SUBST($1)])
|
|
||||||
|
|
||||||
# Add --enable-maintainer-mode option to configure.
|
|
||||||
# From Jim Meyering
|
|
||||||
|
|
||||||
# serial 1
|
# serial 1
|
||||||
|
|
||||||
AC_DEFUN(AM_MAINTAINER_MODE,
|
dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
|
||||||
[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
|
dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
|
||||||
dnl maintainer-mode is disabled by default
|
AC_DEFUN(AM_PATH_PROG_WITH_TEST,
|
||||||
AC_ARG_ENABLE(maintainer-mode,
|
[# Extract the first word of "$2", so it can be a program name with args.
|
||||||
[ --enable-maintainer-mode enable make rules and dependencies not useful
|
set dummy $2; ac_word=[$]2
|
||||||
(and sometimes confusing) to the casual installer],
|
AC_MSG_CHECKING([for $ac_word])
|
||||||
USE_MAINTAINER_MODE=$enableval,
|
AC_CACHE_VAL(ac_cv_path_$1,
|
||||||
USE_MAINTAINER_MODE=no)
|
[case "[$]$1" in
|
||||||
AC_MSG_RESULT($USE_MAINTAINER_MODE)
|
|
||||||
if test $USE_MAINTAINER_MODE = yes; then
|
|
||||||
MAINT=
|
|
||||||
else
|
|
||||||
MAINT='#M#'
|
|
||||||
fi
|
|
||||||
AC_SUBST(MAINT)dnl
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
# aclocal-include.m4
|
|
||||||
#
|
|
||||||
# This macro adds the name macrodir to the set of directories
|
|
||||||
# that `aclocal' searches for macros.
|
|
||||||
|
|
||||||
# serial 1
|
|
||||||
|
|
||||||
dnl AM_ACLOCAL_INCLUDE(macrodir)
|
|
||||||
AC_DEFUN([AM_ACLOCAL_INCLUDE],
|
|
||||||
[ACLOCAL="$ACLOCAL -I $1"])
|
|
||||||
|
|
||||||
dnl
|
|
||||||
dnl GNOME_CHECK_GUILE (failflag)
|
|
||||||
dnl
|
|
||||||
dnl if failflag is "fail" then GNOME_CHECK_GUILE will abort if guile is not found.
|
|
||||||
dnl
|
|
||||||
|
|
||||||
AC_DEFUN([GNOME_CHECK_GUILE],
|
|
||||||
[
|
|
||||||
saved_ldflags="$LDFLAGS"
|
|
||||||
saved_cppflags="$CPPFLAGS"
|
|
||||||
LDFLAGS="$LDFLAGS $GNOME_LIBDIR"
|
|
||||||
|
|
||||||
AC_CHECK_LIB(qthreads,main,[
|
|
||||||
QTTHREADS_LIB="-lqthreads"
|
|
||||||
],[
|
|
||||||
AC_CHECK_LIB(qt, qt_null, QTTHREADS_LIB="-lqt")
|
|
||||||
],$LIBS)
|
|
||||||
AC_SUBST(QTTHREADS_LIB)
|
|
||||||
|
|
||||||
AC_CHECK_LIB(termcap,main,TERMCAP_LIB="-ltermcap")
|
|
||||||
AC_CHECK_LIB(readline,main,READLINE_LIB="-lreadline",,$TERMCAP_LIB)
|
|
||||||
|
|
||||||
AC_SUBST(TERMCAP_LIB)
|
|
||||||
AC_SUBST(READLINE_LIB)
|
|
||||||
|
|
||||||
AC_CHECK_PROG(BUILD_GUILE, build-guile, yes, no)
|
|
||||||
|
|
||||||
if test "x$BUILD_GUILE" = "xyes"; then
|
|
||||||
AC_MSG_CHECKING(whether build-guile works)
|
|
||||||
if test x`build-guile --version >/dev/null 2>&1 || \
|
|
||||||
echo no` = xno; then
|
|
||||||
BUILD_GUILE=no
|
|
||||||
fi
|
|
||||||
AC_MSG_RESULT($BUILD_GUILE)
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_CHECK_LIB(m, sin)
|
|
||||||
|
|
||||||
if test "x$BUILD_GUILE" = "xyes"; then
|
|
||||||
AC_MSG_CHECKING(for guile libraries)
|
|
||||||
GUILE_LIBS="-L`build-guile info libdir` `build-guile link`"
|
|
||||||
AC_MSG_RESULT($GUILE_LIBS)
|
|
||||||
AC_MSG_CHECKING(for guile headers)
|
|
||||||
GUILE_INCS="-I`build-guile info includedir`"
|
|
||||||
AC_MSG_RESULT($GUILE_INCS)
|
|
||||||
else
|
|
||||||
GUILE_LIBS="$GNOME_LIBDIR"
|
|
||||||
GUILE_INCS="$GNOME_INCLUDEDIR"
|
|
||||||
AC_CHECK_LIB(rx, main, GUILE_LIBS="-lrx $GUILE_LIBS")
|
|
||||||
AC_CHECK_LIB(qt, main, GUILE_LIBS="-lqt $GUILE_LIBS")
|
|
||||||
AC_CHECK_LIB(dl, dlopen, GUILE_LIBS="-ldl $GUILE_LIBS")
|
|
||||||
GUILE_LIBS="-lguile $GUILE_LIBS $QTTHREADS_LIB $TERMCAP_LIB $READLINE_LIB"
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_SUBST(GUILE_LIBS)
|
|
||||||
AC_SUBST(GUILE_INCS)
|
|
||||||
|
|
||||||
LDFLAGS="$saved_ldflags $GUILE_LIBS"
|
|
||||||
CPPFLAGS="$saved_cppflags $GUILE_INCS"
|
|
||||||
|
|
||||||
AC_MSG_CHECKING(whether guile works)
|
|
||||||
AC_TRY_LINK([
|
|
||||||
#include <libguile.h>
|
|
||||||
#include <guile/gh.h>
|
|
||||||
],[
|
|
||||||
gh_eval_str("(newline)");
|
|
||||||
scm_boot_guile(0,NULL,NULL,NULL);
|
|
||||||
],[
|
|
||||||
ac_cv_guile_found=yes
|
|
||||||
AC_DEFINE(HAVE_GUILE)
|
|
||||||
],[
|
|
||||||
ac_cv_guile_found=no
|
|
||||||
])
|
|
||||||
AC_MSG_RESULT($ac_cv_guile_found)
|
|
||||||
|
|
||||||
if test x$ac_cv_guile_found = xno ; then
|
|
||||||
if test x$1 = xfail ; then
|
|
||||||
AC_MSG_ERROR(Can not find Guile 1.2 on this system)
|
|
||||||
else
|
|
||||||
AC_MSG_WARN(Can not find Guile 1.2 on this system)
|
|
||||||
fi
|
|
||||||
ac_cv_guile_found=no
|
|
||||||
fi
|
|
||||||
|
|
||||||
LDFLAGS="$saved_ldflags"
|
|
||||||
CPPFLAGS="$saved_cppflags"
|
|
||||||
|
|
||||||
AC_SUBST(GUILE_LIBS)
|
|
||||||
AM_CONDITIONAL(GUILE, test x$ac_cv_guile_found = xyes)
|
|
||||||
])
|
|
||||||
|
|
||||||
# Define a conditional.
|
|
||||||
|
|
||||||
AC_DEFUN(AM_CONDITIONAL,
|
|
||||||
[AC_SUBST($1_TRUE)
|
|
||||||
AC_SUBST($1_FALSE)
|
|
||||||
if $2; then
|
|
||||||
$1_TRUE=
|
|
||||||
$1_FALSE='#'
|
|
||||||
else
|
|
||||||
$1_TRUE='#'
|
|
||||||
$1_FALSE=
|
|
||||||
fi])
|
|
||||||
|
|
||||||
|
|
||||||
dnl AM_PROG_LEX
|
|
||||||
dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT
|
|
||||||
AC_DEFUN(AM_PROG_LEX,
|
|
||||||
[AC_CHECK_PROGS(LEX, flex lex, "$1/missing flex")
|
|
||||||
AC_PROG_LEX
|
|
||||||
AC_DECL_YYTEXT])
|
|
||||||
|
|
||||||
|
|
||||||
# serial 18 AM_PROG_LIBTOOL
|
|
||||||
AC_DEFUN(AM_PROG_LIBTOOL,
|
|
||||||
[AC_REQUIRE([AC_CANONICAL_HOST])
|
|
||||||
AC_REQUIRE([AC_PROG_RANLIB])
|
|
||||||
AC_REQUIRE([AC_PROG_CC])
|
|
||||||
AC_REQUIRE([AM_PROG_LD])
|
|
||||||
AC_REQUIRE([AM_PROG_NM])
|
|
||||||
AC_REQUIRE([AC_PROG_LN_S])
|
|
||||||
|
|
||||||
# Always use our own libtool.
|
|
||||||
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
|
|
||||||
AC_SUBST(LIBTOOL)
|
|
||||||
|
|
||||||
dnl Allow the --disable-shared flag to stop us from building shared libs.
|
|
||||||
AC_ARG_ENABLE(shared,
|
|
||||||
[ --enable-shared build shared libraries [default=yes]],
|
|
||||||
[if test "$enableval" = no; then
|
|
||||||
libtool_enable_shared=no
|
|
||||||
else
|
|
||||||
libtool_enable_shared=yes
|
|
||||||
fi])
|
|
||||||
test -n "$libtool_enable_shared" && enable_shared="$libtool_enable_shared"
|
|
||||||
libtool_shared=
|
|
||||||
test "$enable_shared" = no && libtool_shared=" --disable-shared"
|
|
||||||
|
|
||||||
dnl Allow the --disable-static flag to stop us from building static libs.
|
|
||||||
AC_ARG_ENABLE(static,
|
|
||||||
[ --enable-static build static libraries [default=yes]],
|
|
||||||
[if test "$enableval" = no; then
|
|
||||||
libtool_enable_static=no
|
|
||||||
else
|
|
||||||
libtool_enable_static=yes
|
|
||||||
fi])
|
|
||||||
test -n "$libtool_enable_static" && enable_static="$libtool_enable_static"
|
|
||||||
libtool_static=
|
|
||||||
test "$enable_static" = no && libtool_static=" --disable-static"
|
|
||||||
|
|
||||||
libtool_flags="$libtool_shared$libtool_static"
|
|
||||||
test "$silent" = yes && libtool_flags="$libtool_flags --silent"
|
|
||||||
test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
|
|
||||||
test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
|
|
||||||
|
|
||||||
# Some flags need to be propagated to the compiler or linker for good
|
|
||||||
# libtool support.
|
|
||||||
[case "$host" in
|
|
||||||
*-*-irix6*)
|
|
||||||
ac_save_CFLAGS="$CFLAGS"
|
|
||||||
flag_passed=no
|
|
||||||
for f in -32 -64 -n32 ABI -cckr -mips1 -mips2 -mips3 -mips4; do
|
|
||||||
case "$f" in
|
|
||||||
ABI)
|
|
||||||
test -n "$SGI_ABI" && flag_passed=yes
|
|
||||||
if test "$flag_passed" = no && test "$ac_cv_prog_gcc" = yes; then
|
|
||||||
# Choose the ABI flag according to GCC's specs.
|
|
||||||
if $CC -dumpspecs 2>&1 | sed '/^\*link:$/,/^$/!d' | egrep -e '[ ]-32' >/dev/null; then
|
|
||||||
LD="${LD-ld} -32"
|
|
||||||
else
|
|
||||||
LD="${LD-ld} -n32"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
if echo " $CC $CFLAGS " | egrep -e "[ ]$f[ ]" > /dev/null; then
|
|
||||||
flag_passed=yes
|
|
||||||
LD="${LD-ld} $f"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
CFLAGS="$ac_save_CFLAGS"
|
|
||||||
;;
|
|
||||||
|
|
||||||
*-*-sco3.2v5*)
|
|
||||||
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
|
|
||||||
CFLAGS="$CFLAGS -belf"
|
|
||||||
;;
|
|
||||||
esac]
|
|
||||||
|
|
||||||
# Actually configure libtool. ac_aux_dir is where install-sh is found.
|
|
||||||
CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
|
|
||||||
LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
|
|
||||||
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \
|
|
||||||
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
|
|
||||||
|| AC_MSG_ERROR([libtool configure failed])
|
|
||||||
])
|
|
||||||
|
|
||||||
# AM_PROG_LD - find the path to the GNU or non-GNU linker
|
|
||||||
AC_DEFUN(AM_PROG_LD,
|
|
||||||
[AC_ARG_WITH(gnu-ld,
|
|
||||||
[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
|
|
||||||
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
|
|
||||||
AC_REQUIRE([AC_PROG_CC])
|
|
||||||
ac_prog=ld
|
|
||||||
if test "$ac_cv_prog_gcc" = yes; then
|
|
||||||
# Check if gcc -print-prog-name=ld gives a path.
|
|
||||||
AC_MSG_CHECKING([for ld used by GCC])
|
|
||||||
ac_prog=`($CC -print-prog-name=ld) 2>&5`
|
|
||||||
case "$ac_prog" in
|
|
||||||
# Accept absolute paths.
|
|
||||||
/*)
|
/*)
|
||||||
test -z "$LD" && LD="$ac_prog"
|
ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
|
||||||
;;
|
|
||||||
"")
|
|
||||||
# If it fails, then pretend we aren't using GCC.
|
|
||||||
ac_prog=ld
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
# If it is relative, then search for the first ld in PATH.
|
|
||||||
with_gnu_ld=unknown
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
elif test "$with_gnu_ld" = yes; then
|
|
||||||
AC_MSG_CHECKING([for GNU ld])
|
|
||||||
else
|
|
||||||
AC_MSG_CHECKING([for non-GNU ld])
|
|
||||||
fi
|
|
||||||
AC_CACHE_VAL(ac_cv_path_LD,
|
|
||||||
[if test -z "$LD"; then
|
|
||||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||||
for ac_dir in $PATH; do
|
for ac_dir in ifelse([$5], , $PATH, [$5]); do
|
||||||
test -z "$ac_dir" && ac_dir=.
|
test -z "$ac_dir" && ac_dir=.
|
||||||
if test -f "$ac_dir/$ac_prog"; then
|
if test -f $ac_dir/$ac_word; then
|
||||||
ac_cv_path_LD="$ac_dir/$ac_prog"
|
if [$3]; then
|
||||||
# Check to see if the program is GNU ld. I'd rather use --version,
|
ac_cv_path_$1="$ac_dir/$ac_word"
|
||||||
# but apparently some GNU ld's only accept -v.
|
break
|
||||||
# Break only if it was the GNU/non-GNU ld that we prefer.
|
|
||||||
if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
|
|
||||||
test "$with_gnu_ld" != no && break
|
|
||||||
else
|
|
||||||
test "$with_gnu_ld" != yes && break
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
IFS="$ac_save_ifs"
|
IFS="$ac_save_ifs"
|
||||||
else
|
dnl If no 4th arg is given, leave the cache variable unset,
|
||||||
ac_cv_path_LD="$LD" # Let the user override the test with a path.
|
dnl so AC_PATH_PROGS will keep looking.
|
||||||
fi])
|
ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
|
||||||
LD="$ac_cv_path_LD"
|
])dnl
|
||||||
if test -n "$LD"; then
|
;;
|
||||||
AC_MSG_RESULT($LD)
|
esac])dnl
|
||||||
|
$1="$ac_cv_path_$1"
|
||||||
|
if test -n "[$]$1"; then
|
||||||
|
AC_MSG_RESULT([$]$1)
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT(no)
|
AC_MSG_RESULT(no)
|
||||||
fi
|
fi
|
||||||
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
|
AC_SUBST($1)dnl
|
||||||
AC_SUBST(LD)
|
|
||||||
AM_PROG_LD_GNU
|
|
||||||
])
|
])
|
||||||
|
|
||||||
AC_DEFUN(AM_PROG_LD_GNU,
|
|
||||||
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
|
######################################################################
|
||||||
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
|
# lcmessage.m4 from gettext 0.32
|
||||||
if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
|
######################################################################
|
||||||
ac_cv_prog_gnu_ld=yes
|
# Check whether LC_MESSAGES is available in <locale.h>.
|
||||||
else
|
# Ulrich Drepper <drepper@cygnus.com>, 1995.
|
||||||
ac_cv_prog_gnu_ld=no
|
#
|
||||||
|
# This file file be copied and used freely without restrictions. It can
|
||||||
|
# be used in projects which are not available under the GNU Public License
|
||||||
|
# but which still want to provide support for the GNU gettext functionality.
|
||||||
|
# Please note that the actual code is *not* freely available.
|
||||||
|
|
||||||
|
# serial 1
|
||||||
|
|
||||||
|
AC_DEFUN(AM_LC_MESSAGES,
|
||||||
|
[if test $ac_cv_header_locale_h = yes; then
|
||||||
|
AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
|
||||||
|
[AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
|
||||||
|
am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
|
||||||
|
if test $am_cv_val_LC_MESSAGES = yes; then
|
||||||
|
AC_DEFINE(HAVE_LC_MESSAGES)
|
||||||
|
fi
|
||||||
fi])
|
fi])
|
||||||
])
|
|
||||||
|
|
||||||
# AM_PROG_NM - find the path to a BSD-compatible name lister
|
|
||||||
AC_DEFUN(AM_PROG_NM,
|
|
||||||
[AC_MSG_CHECKING([for BSD-compatible nm])
|
|
||||||
AC_CACHE_VAL(ac_cv_path_NM,
|
|
||||||
[case "$NM" in
|
|
||||||
/*)
|
|
||||||
ac_cv_path_NM="$NM" # Let the user override the test with a path.
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
|
||||||
for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do
|
|
||||||
test -z "$ac_dir" && dir=.
|
|
||||||
if test -f $ac_dir/nm; then
|
|
||||||
# Check to see if the nm accepts a BSD-compat flag.
|
|
||||||
# Adding the `sed 1!d' prevents false positives on HP-UX, which says:
|
|
||||||
# nm: unknown option "B" ignored
|
|
||||||
if ($ac_dir/nm -B /dev/null 2>&1 | sed '1!d'; exit 0) | egrep /dev/null >/dev/null; then
|
|
||||||
ac_cv_path_NM="$ac_dir/nm -B"
|
|
||||||
elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1!d'; exit 0) | egrep /dev/null >/dev/null; then
|
|
||||||
ac_cv_path_NM="$ac_dir/nm -p"
|
|
||||||
else
|
|
||||||
ac_cv_path_NM="$ac_dir/nm"
|
|
||||||
fi
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
IFS="$ac_save_ifs"
|
|
||||||
test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
|
|
||||||
;;
|
|
||||||
esac])
|
|
||||||
NM="$ac_cv_path_NM"
|
|
||||||
AC_MSG_RESULT([$NM])
|
|
||||||
AC_SUBST(NM)
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl LIBGTOP_SUPPORT_CHECKS
|
|
||||||
dnl Check for various support functions needed by the standard
|
|
||||||
dnl Gnome libraries. Sets LIBOBJS, might define some macros,
|
|
||||||
dnl and will set the need_libgtop_support shell variable to "yes"
|
|
||||||
dnl or "no". Also sets up the Automake BUILD_LIBGTOP_SUPPORT
|
|
||||||
dnl conditional.
|
|
||||||
AC_DEFUN([LIBGTOP_SUPPORT_CHECKS],[
|
|
||||||
need_libgtop_support=no
|
|
||||||
save_LIBOBJS="$LIBOBJS"
|
|
||||||
LIBOBJS=
|
|
||||||
|
|
||||||
AC_CACHE_CHECK([for program_invocation_short_name], libgtop_cv_short_name, [
|
|
||||||
AC_TRY_LINK([#include <errno.h>],[
|
|
||||||
char *foo = program_invocation_short_name],
|
|
||||||
libgtop_cv_short_name=yes, libgtop_cv_short_name=no)])
|
|
||||||
if test "$libgtop_cv_short_name" = yes; then
|
|
||||||
AC_DEFINE(HAVE_PROGRAM_INVOCATION_SHORT_NAME)
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_CACHE_CHECK([for program_invocation_name], libgtop_cv_invocation_name, [
|
|
||||||
AC_TRY_LINK([#include <errno.h>],[
|
|
||||||
char *foo = program_invocation_name],
|
|
||||||
libgtop_cv_invocation_name=yes, libgtop_cv_invocation_name=no)])
|
|
||||||
if test "$libgtop_cv_invocation_name" = yes; then
|
|
||||||
AC_DEFINE(HAVE_PROGRAM_INVOCATION_NAME)
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_REPLACE_FUNCS(strtok_r strcasecmp strndup strnlen strerror)
|
|
||||||
|
|
||||||
if test "$LIBOBJS" != ""; then
|
|
||||||
need_libgtop_support=yes
|
|
||||||
fi
|
|
||||||
# Turn our LIBOBJS into libtool objects. This is gross, but it
|
|
||||||
# requires changes to autoconf before it goes away.
|
|
||||||
LTLIBOBJS=`echo "$LIBOBJS" | sed 's/\.o/.lo/g'`
|
|
||||||
AC_SUBST(LTLIBOBJS)
|
|
||||||
|
|
||||||
LIBOBJS="$save_LIBOBJS"
|
|
||||||
AM_CONDITIONAL(BUILD_LIBGTOP_SUPPORT, test "$need_libgtop_support" = yes)
|
|
||||||
])
|
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
# gettext.m4 from gettext 0.32
|
||||||
|
######################################################################
|
||||||
# Macro to add for using GNU gettext.
|
# Macro to add for using GNU gettext.
|
||||||
# Ulrich Drepper <drepper@cygnus.com>, 1995.
|
# Ulrich Drepper <drepper@cygnus.com>, 1995.
|
||||||
#
|
#
|
||||||
@@ -915,72 +398,3 @@ __argz_count __argz_stringify __argz_next])
|
|||||||
sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
|
sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
|
||||||
< $srcdir/po/POTFILES.in > po/POTFILES
|
< $srcdir/po/POTFILES.in > po/POTFILES
|
||||||
])
|
])
|
||||||
|
|
||||||
# Search path for a program which passes the given test.
|
|
||||||
# Ulrich Drepper <drepper@cygnus.com>, 1996.
|
|
||||||
#
|
|
||||||
# This file file be copied and used freely without restrictions. It can
|
|
||||||
# be used in projects which are not available under the GNU Public License
|
|
||||||
# but which still want to provide support for the GNU gettext functionality.
|
|
||||||
# Please note that the actual code is *not* freely available.
|
|
||||||
|
|
||||||
# serial 1
|
|
||||||
|
|
||||||
dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
|
|
||||||
dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
|
|
||||||
AC_DEFUN(AM_PATH_PROG_WITH_TEST,
|
|
||||||
[# Extract the first word of "$2", so it can be a program name with args.
|
|
||||||
set dummy $2; ac_word=[$]2
|
|
||||||
AC_MSG_CHECKING([for $ac_word])
|
|
||||||
AC_CACHE_VAL(ac_cv_path_$1,
|
|
||||||
[case "[$]$1" in
|
|
||||||
/*)
|
|
||||||
ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
|
||||||
for ac_dir in ifelse([$5], , $PATH, [$5]); do
|
|
||||||
test -z "$ac_dir" && ac_dir=.
|
|
||||||
if test -f $ac_dir/$ac_word; then
|
|
||||||
if [$3]; then
|
|
||||||
ac_cv_path_$1="$ac_dir/$ac_word"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
IFS="$ac_save_ifs"
|
|
||||||
dnl If no 4th arg is given, leave the cache variable unset,
|
|
||||||
dnl so AC_PATH_PROGS will keep looking.
|
|
||||||
ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
|
|
||||||
])dnl
|
|
||||||
;;
|
|
||||||
esac])dnl
|
|
||||||
$1="$ac_cv_path_$1"
|
|
||||||
if test -n "[$]$1"; then
|
|
||||||
AC_MSG_RESULT([$]$1)
|
|
||||||
else
|
|
||||||
AC_MSG_RESULT(no)
|
|
||||||
fi
|
|
||||||
AC_SUBST($1)dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
# Check whether LC_MESSAGES is available in <locale.h>.
|
|
||||||
# Ulrich Drepper <drepper@cygnus.com>, 1995.
|
|
||||||
#
|
|
||||||
# This file file be copied and used freely without restrictions. It can
|
|
||||||
# be used in projects which are not available under the GNU Public License
|
|
||||||
# but which still want to provide support for the GNU gettext functionality.
|
|
||||||
# Please note that the actual code is *not* freely available.
|
|
||||||
|
|
||||||
# serial 1
|
|
||||||
|
|
||||||
AC_DEFUN(AM_LC_MESSAGES,
|
|
||||||
[if test $ac_cv_header_locale_h = yes; then
|
|
||||||
AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
|
|
||||||
[AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
|
|
||||||
am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
|
|
||||||
if test $am_cv_val_LC_MESSAGES = yes; then
|
|
||||||
AC_DEFINE(HAVE_LC_MESSAGES)
|
|
||||||
fi
|
|
||||||
fi])
|
|
||||||
|
|
||||||
|
222
configure.in
222
configure.in
@@ -4,19 +4,29 @@ dnl
|
|||||||
|
|
||||||
AC_INIT(copyright.txt)
|
AC_INIT(copyright.txt)
|
||||||
AM_CONFIG_HEADER(config.h)
|
AM_CONFIG_HEADER(config.h)
|
||||||
|
AC_CANONICAL_SYSTEM
|
||||||
|
|
||||||
AM_INIT_AUTOMAKE(libgtop, 0.01)
|
. $srcdir/LIBGTOP-VERSION
|
||||||
|
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
|
||||||
|
|
||||||
AM_MAINTAINER_MODE
|
AC_SUBST(LIBGTOP_MAJOR_VERSION)
|
||||||
|
AC_SUBST(LIBGTOP_MINOR_VERSION)
|
||||||
|
AC_SUBST(LIBGTOP_VERSION)
|
||||||
|
|
||||||
AM_ACLOCAL_INCLUDE(macros)
|
AM_ACLOCAL_INCLUDE(macros)
|
||||||
|
|
||||||
AC_CANONICAL_HOST
|
AC_ISC_POSIX
|
||||||
|
AC_PROG_CC
|
||||||
|
AC_STDC_HEADERS
|
||||||
|
AC_ARG_PROGRAM
|
||||||
|
|
||||||
|
dnl We don't use `AC_PROG_AWK' since it checks for mawk first which
|
||||||
|
dnl does not work for libgtop.
|
||||||
|
AC_CHECK_PROGS(AWK, gawk awk, )
|
||||||
|
test -z "$AWK" && AC_MSG_ERROR([Sorry, you need a working awk interpreter.])
|
||||||
|
|
||||||
AC_CHECK_TOOL(CC,gcc)
|
AC_CHECK_TOOL(CC,gcc)
|
||||||
AC_CHECK_TOOL(CXX,g++)
|
|
||||||
AC_CHECK_TOOL(RANLIB,ranlib)
|
AC_CHECK_TOOL(RANLIB,ranlib)
|
||||||
AC_CHECK_TOOL(LD,ld)
|
|
||||||
AC_CHECK_TOOL(AS,as)
|
AC_CHECK_TOOL(AS,as)
|
||||||
AC_CHECK_TOOL(AR,ar)
|
AC_CHECK_TOOL(AR,ar)
|
||||||
AC_CHECK_TOOL(NM,nm)
|
AC_CHECK_TOOL(NM,nm)
|
||||||
@@ -24,21 +34,36 @@ AC_CHECK_TOOL(NM,nm)
|
|||||||
NM=`which $NM`
|
NM=`which $NM`
|
||||||
export CC CXX RANLIB LD AS AR NM
|
export CC CXX RANLIB LD AS AR NM
|
||||||
|
|
||||||
AC_LC_SYSDEPS
|
AC_PROG_INSTALL
|
||||||
|
AC_PROG_LN_S
|
||||||
|
AC_PROG_MAKE_SET
|
||||||
|
|
||||||
if test x$libgtop_want_guile = xyes ; then
|
export cross_compiling
|
||||||
GNOME_CHECK_GUILE
|
|
||||||
if test x$ac_cv_guile_found = xyes ; then
|
AM_PROG_LIBTOOL
|
||||||
if test x$libgtop_want_names = xyes ; then
|
|
||||||
AC_DEFINE(GLIBTOP_GUILE_NAMES)
|
dnl If you want to use libgtop without gnome, comment the following line out.
|
||||||
|
GNOME_INIT_HOOK(gnome_found=yes)
|
||||||
|
|
||||||
|
if test "x$gnome_found" != xyes; then
|
||||||
|
GNOME_SUPPORT_CHECKS
|
||||||
|
else
|
||||||
|
AM_CONDITIONAL(BUILD_GNOME_SUPPORT, false)
|
||||||
|
AM_CONDITIONAL(CROSS_COMPILING, test "x$cross_compiling" = xyes)
|
||||||
fi
|
fi
|
||||||
guile_examples='third third_static third_linux'
|
|
||||||
|
GNOME_LIBGTOP_SYSDEPS
|
||||||
|
GNOME_LIBGTOP_TYPES
|
||||||
|
|
||||||
|
GNOME_CHECK_GUILE
|
||||||
|
|
||||||
|
if test x$ac_cv_guile_found = xyes ; then
|
||||||
|
AC_DEFINE(GLIBTOP_GUILE_NAMES)
|
||||||
|
libgtop_guile_found=yes
|
||||||
|
guile_examples='third third_static'
|
||||||
guile_subdirs='guile'
|
guile_subdirs='guile'
|
||||||
else
|
else
|
||||||
guile_examples=
|
libgtop_guile_found=no
|
||||||
guile_subdirs=
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
guile_examples=
|
guile_examples=
|
||||||
guile_subdirs=
|
guile_subdirs=
|
||||||
fi
|
fi
|
||||||
@@ -46,21 +71,10 @@ fi
|
|||||||
AC_SUBST(guile_examples)
|
AC_SUBST(guile_examples)
|
||||||
AC_SUBST(guile_subdirs)
|
AC_SUBST(guile_subdirs)
|
||||||
|
|
||||||
AC_ISC_POSIX
|
|
||||||
AC_PROG_CXX
|
|
||||||
AC_PROG_CC
|
|
||||||
AC_PROG_CPP
|
|
||||||
AC_STDC_HEADERS
|
|
||||||
AC_ARG_PROGRAM
|
|
||||||
AM_PROG_LEX
|
|
||||||
AC_PROG_INSTALL
|
|
||||||
AC_PROG_LN_S
|
|
||||||
AC_PROG_MAKE_SET
|
|
||||||
|
|
||||||
export cross_compiling
|
|
||||||
AM_PROG_LIBTOOL
|
AM_PROG_LIBTOOL
|
||||||
|
|
||||||
GNOME_SUPPORT_CHECKS
|
dnl You need to uncomment the following line if you want to use libgtop without Gnome.
|
||||||
|
dnl GNOME_SUPPORT_CHECKS
|
||||||
|
|
||||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||||
AC_C_CONST
|
AC_C_CONST
|
||||||
@@ -83,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
|
||||||
@@ -90,26 +119,58 @@ AC_TYPE_SIGNAL
|
|||||||
AC_FUNC_STRFTIME
|
AC_FUNC_STRFTIME
|
||||||
AC_CHECK_FUNCS(getcwd gettimeofday getwd putenv strdup strtoul uname)
|
AC_CHECK_FUNCS(getcwd gettimeofday getwd putenv strdup strtoul uname)
|
||||||
|
|
||||||
ALL_LINGUAS=""
|
ALL_LINGUAS="fr"
|
||||||
AM_GNU_GETTEXT
|
AM_GNU_GETTEXT
|
||||||
|
|
||||||
CFLAGS="$CFLAGS -D_IN_LIBGTOP"
|
AC_PATH_XTRA
|
||||||
|
|
||||||
AC_SUBST(CFLAGS)
|
dnl The construct foo=`echo $w1 $w2 $w3` fails on some systems if $w1 = -e or -n
|
||||||
AC_SUBST(CPPFLAGS)
|
dnl So we use the following instead.
|
||||||
AC_SUBST(LDFLAGS)
|
dnl XE_SPACE(var, words)
|
||||||
|
define([XE_SPACE],[
|
||||||
|
T=""
|
||||||
|
for W in $2; do if test -z "$T"; then T="$W"; else T="$T $W"; fi; done
|
||||||
|
$1="$T"
|
||||||
|
])dnl
|
||||||
|
|
||||||
|
dnl Autodetect Xauth
|
||||||
|
dnl -lXau is only used by gnuclient, so use a special variable for Xauth X libs
|
||||||
|
test -z "$with_xauth" && test "$window_system" = "none" && with_xauth=no
|
||||||
|
test -z "$with_xauth" && { AC_CHECK_HEADER(X11/Xauth.h, ,with_xauth=no) }
|
||||||
|
test -z "$with_xauth" && { AC_CHECK_LIB(Xau, XauGetAuthByAddr,[:],with_xauth=no, $X_LIBS) }
|
||||||
|
test -z "$with_xauth" && with_xauth=yes
|
||||||
|
if test "$with_xauth" = "yes"; then
|
||||||
|
AC_DEFINE(HAVE_XAUTH)
|
||||||
|
XE_SPACE(libs_xauth, $X_LIBS -lXau)
|
||||||
|
fi
|
||||||
|
AC_SUBST(libs_xauth)
|
||||||
|
|
||||||
|
dnl For diskusage stuff
|
||||||
|
GNOME_FILEUTILS_CHECKS
|
||||||
|
|
||||||
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),)
|
||||||
|
|
||||||
LIBSUPPORT=
|
dnl If you want to use libgtop without gnome, uncomment the following paragraph:
|
||||||
SUPPORTINCS=
|
dnl LIBSUPPORT=
|
||||||
if test "$need_gnome_support" = yes; then
|
dnl SUPPORTINCS=
|
||||||
LIBSUPPORT='$(top_builddir)/support/libgnomesupport.la'
|
dnl if test "$need_gnome_support" = yes; then
|
||||||
SUPPORTINCS='-I$(top_srcdir)/support'
|
dnl LIBSUPPORT='$(top_builddir)/support/libgnomesupport.la'
|
||||||
|
dnl SUPPORTINCS='-I$(top_srcdir)/support'
|
||||||
|
dnl fi
|
||||||
|
dnl AC_SUBST(LIBSUPPORT)
|
||||||
|
dnl AC_SUBST(SUPPORTINCS)
|
||||||
|
|
||||||
|
dnl Some ugly hack; if '-lgnomesupport' is part of $GNOME_LIBS, we include it here.
|
||||||
|
echo "$GNOME_LIBS" | grep -q -e '-lgnomesupport'
|
||||||
|
if test $? = 0 ; then
|
||||||
|
LIBSUPPORT="$GNOME_LIBDIR -lgnomesupport"
|
||||||
|
SUPPORTINCS="$GNOME_INCLUDEDIR"
|
||||||
fi
|
fi
|
||||||
|
AC_SUBST(LIBSUPPORT)
|
||||||
|
AC_SUBST(SUPPORTINCS)
|
||||||
|
|
||||||
dnl These definitions are expanded in make.
|
dnl These definitions are expanded in make.
|
||||||
LIBGTOP_LIBS='-L$(libdir)'
|
LIBGTOP_LIBS='-L$(libdir) -lgtop'
|
||||||
LIBGTOP_INCS='-I$(includedir)'
|
LIBGTOP_INCS='-I$(includedir)'
|
||||||
LIBGTOP_GUILE_LIBS="$LIBGTOP_LIBS"
|
LIBGTOP_GUILE_LIBS="$LIBGTOP_LIBS"
|
||||||
LIBGTOP_GUILE_INCS="$LIBGTOP_INCS"
|
LIBGTOP_GUILE_INCS="$LIBGTOP_INCS"
|
||||||
@@ -128,50 +189,68 @@ 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"
|
LIBGTOP_LIBS="$LIBGTOP_LIBS $libs_xauth"
|
||||||
LIBGTOP_GUILE_LIBS="$LIBGTOP_GUILE_LIBS -lgtop_common"
|
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_LIBS="$LIBGTOP_LIBS -lgtop"
|
|
||||||
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_GUILE_INCS="$LIBGTOP_INCS $GUILE_INCS"
|
|
||||||
LIBGTOP_GUILE_LIBS="$LIBGTOP_GUILE_LIBS $GUILE_LIBS"
|
LIBGTOP_GUILE_LIBS="$LIBGTOP_GUILE_LIBS $GUILE_LIBS"
|
||||||
fi
|
LIBGTOP_GUILE_INCS="$LIBGTOP_GUILE_INCS $GUILE_INCS -DGLIBTOP_GUILE"
|
||||||
|
|
||||||
if test "x$libgtop_use_machine_h" = "xyes" ; then
|
LIBGTOP_NAMES_INCS="$LIBGTOP_INCS -DGLIBTOP_NAMES"
|
||||||
machine_incs='-I$(top_srcdir)/sysdeps/@sysdeps_dir@'
|
LIBGTOP_GUILE_NAMES_INCS="$LIBGTOP_GUILE_INCS -DGLIBTOP_GUILE_NAMES"
|
||||||
fi
|
LIBGTOP_GUILE_NAMES_INCS="$LIBGTOP_GUILE_INCS -DGLIBTOP_NAMES"
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
AC_SUBST(LIBSUPPORT)
|
LIBSUPPORT=
|
||||||
AC_SUBST(SUPPORTINCS)
|
SUPPORTINCS=
|
||||||
|
if test "$need_gnome_support" = yes; then
|
||||||
|
if test "x$gnome_found" = xyes ; then
|
||||||
|
LIBSUPPORT="$GNOME_LIBDIR -lgnomesupport"
|
||||||
|
SUPPORTINCS="$GNOME_INCLUDEDIR"
|
||||||
|
else
|
||||||
|
LIBSUPPORT='$(top_builddir)/support/libgnomesupport.la'
|
||||||
|
SUPPORTINCS='-DNEED_GNOMESUPPORT_H -I$(top_builddir)/support -I$(top_srcdir)/support'
|
||||||
|
fi
|
||||||
|
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
|
||||||
@@ -188,9 +267,14 @@ sysdeps/stub/Makefile
|
|||||||
sysdeps/sun4/Makefile
|
sysdeps/sun4/Makefile
|
||||||
sysdeps/osf1/Makefile
|
sysdeps/osf1/Makefile
|
||||||
sysdeps/linux/Makefile
|
sysdeps/linux/Makefile
|
||||||
|
sysdeps/kernel/Makefile
|
||||||
|
sysdeps/freebsd/Makefile
|
||||||
src/Makefile
|
src/Makefile
|
||||||
src/server/Makefile
|
src/server/Makefile
|
||||||
|
src/daemon/Makefile
|
||||||
lib/Makefile
|
lib/Makefile
|
||||||
|
guile/Makefile
|
||||||
examples/Makefile
|
examples/Makefile
|
||||||
|
perl/Makefile.PL
|
||||||
support/Makefile
|
support/Makefile
|
||||||
macros/Makefile],[sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])
|
macros/Makefile],[sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/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:
|
||||||
|
-->
|
15
examples/ChangeLog
Normal file
15
examples/ChangeLog
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
1998-07-22 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
|
* mountlist.c: New file.
|
||||||
|
|
||||||
|
1998-06-12 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
|
* test.scm: New file.
|
||||||
|
|
||||||
|
1998-06-07 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
|
* Makefile.am (CFLAGS): Disable optimize.
|
||||||
|
|
||||||
|
* first.c (PROFILE_COUNT): Number of times each function
|
||||||
|
should be called. Defaults to 1; to profile the code, you
|
||||||
|
can increase this when compiling.
|
@@ -2,70 +2,58 @@
|
|||||||
|
|
||||||
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@ -O0
|
||||||
-I$(top_srcdir)/include -I$(top_srcdir)/intl @GUILE_INCS@ \
|
|
||||||
-DGTOPLOCALEDIR=\"$(datadir)/locale\" -D_GNU_SOURCE
|
|
||||||
|
|
||||||
CFLAGS = -Wall -W @CFLAGS@
|
|
||||||
|
|
||||||
DEFS = @DEFS@
|
DEFS = @DEFS@
|
||||||
|
|
||||||
bin_PROGRAMS = first first_static first_linux \
|
bin_PROGRAMS = first first_static second second_static \
|
||||||
second second_static second_linux \
|
mountlist mountlist_static \
|
||||||
@guile_examples@
|
@guile_examples@
|
||||||
|
|
||||||
EXTRA_PROGRAMS = third third_static third_linux
|
EXTRA_PROGRAMS = third third_static
|
||||||
|
|
||||||
first_SOURCES = first.c
|
first_SOURCES = first.c
|
||||||
first_LDADD = $(top_builddir)/sysdeps/common/libgtop_common.la \
|
first_LDADD = $(top_builddir)/lib/libgtop.la \
|
||||||
$(top_builddir)/lib/libgtop.la \
|
$(top_builddir)/sysdeps/common/libgtop_common.la \
|
||||||
@INTLLIBS@ @LIBSUPPORT@
|
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
|
||||||
|
@INTLLIBS@ @LIBSUPPORT@ @libs_xauth@
|
||||||
|
|
||||||
first_static_SOURCES = $(first_SOURCES)
|
first_static_SOURCES = $(first_SOURCES)
|
||||||
first_static_LDADD = $(first_LDADD)
|
first_static_LDADD = $(first_LDADD)
|
||||||
first_static_LDFLAGS = -static
|
first_static_LDFLAGS = -static
|
||||||
|
|
||||||
first_linux_SOURCES = $(first_SOURCES)
|
|
||||||
first_linux_LDADD = $(top_builddir)/sysdeps/common/libgtop_common.la \
|
|
||||||
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
|
|
||||||
@INTLLIBS@ @LIBSUPPORT@
|
|
||||||
first_linux_LDFLAGS = -static
|
|
||||||
|
|
||||||
second_SOURCES = second.c
|
second_SOURCES = second.c
|
||||||
second_LDADD = $(top_builddir)/sysdeps/common/libgtop_common.la \
|
second_LDADD = $(top_builddir)/lib/libgtop.la \
|
||||||
$(top_builddir)/lib/libgtop.la \
|
$(top_builddir)/sysdeps/common/libgtop_common.la \
|
||||||
@INTLLIBS@ @LIBSUPPORT@
|
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
|
||||||
|
@INTLLIBS@ @LIBSUPPORT@ @libs_xauth@
|
||||||
|
|
||||||
second_static_SOURCES = $(second_SOURCES)
|
second_static_SOURCES = $(second_SOURCES)
|
||||||
second_static_LDADD = $(second_LDADD)
|
second_static_LDADD = $(second_LDADD)
|
||||||
second_static_LDFLAGS = -static
|
second_static_LDFLAGS = -static
|
||||||
|
|
||||||
second_linux_SOURCES = $(second_SOURCES)
|
|
||||||
second_linux_LDADD = $(top_builddir)/sysdeps/common/libgtop_common.la \
|
|
||||||
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
|
|
||||||
@INTLLIBS@ @LIBSUPPORT@
|
|
||||||
second_linux_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 \
|
||||||
$(third_guile_names_LIBS) $(third_names_LIBS) \
|
$(third_guile_names_LIBS) $(third_names_LIBS) \
|
||||||
$(top_builddir)/sysdeps/common/libgtop_common.la \
|
|
||||||
$(top_builddir)/lib/libgtop.la \
|
$(top_builddir)/lib/libgtop.la \
|
||||||
@GUILE_LIBS@ @INTLLIBS@ @LIBSUPPORT@
|
$(top_builddir)/sysdeps/common/libgtop_common.la \
|
||||||
|
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
|
||||||
|
@GUILE_LIBS@ @INTLLIBS@ @LIBSUPPORT@ @libs_xauth@
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
third_linux_SOURCES = $(third_SOURCES)
|
mountlist_SOURCES = mountlist.c
|
||||||
third_linux_LDADD = $(top_builddir)/sysdeps/guile/libgtop_guile.la \
|
mountlist_LDADD = $(top_builddir)/lib/libgtop.la \
|
||||||
$(third_guile_names_LIBS) $(third_names_LIBS) \
|
|
||||||
$(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 \
|
||||||
@GUILE_LIBS@ @INTLLIBS@ @LIBSUPPORT@
|
@INTLLIBS@ @LIBSUPPORT@ @libs_xauth@
|
||||||
third_linux_LDFLAGS = -static
|
|
||||||
|
mountlist_static_SOURCES= $(mountlist_SOURCES)
|
||||||
|
mountlist_static_LDADD = $(mountlist_LDADD)
|
||||||
|
mountlist_static_LDFLAGS= -static
|
||||||
|
|
||||||
|
177
examples/first.c
177
examples/first.c
@@ -19,76 +19,112 @@
|
|||||||
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 <locale.h>
|
||||||
|
|
||||||
#include <glibtop.h>
|
#include <glibtop.h>
|
||||||
#include <glibtop/open.h>
|
#include <glibtop/open.h>
|
||||||
#include <glibtop/close.h>
|
#include <glibtop/close.h>
|
||||||
#include <glibtop/xmalloc.h>
|
#include <glibtop/xmalloc.h>
|
||||||
|
|
||||||
|
#include <glibtop/parameter.h>
|
||||||
|
|
||||||
#include <glibtop/union.h>
|
#include <glibtop/union.h>
|
||||||
#include <glibtop/sysdeps.h>
|
#include <glibtop/sysdeps.h>
|
||||||
|
|
||||||
|
#ifndef PROFILE_COUNT
|
||||||
|
#define PROFILE_COUNT 1
|
||||||
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char *argv [])
|
main (int argc, char *argv [])
|
||||||
{
|
{
|
||||||
glibtop_union data;
|
glibtop_union data;
|
||||||
glibtop_sysdeps sysdeps;
|
glibtop_sysdeps sysdeps;
|
||||||
unsigned i, *ptr;
|
unsigned c, method, count, port, i, *ptr;
|
||||||
|
char buffer [BUFSIZ];
|
||||||
pid_t pid, ppid;
|
pid_t pid, ppid;
|
||||||
|
|
||||||
|
count = PROFILE_COUNT;
|
||||||
|
|
||||||
setlocale (LC_ALL, "");
|
setlocale (LC_ALL, "");
|
||||||
bindtextdomain (PACKAGE, GTOPLOCALEDIR);
|
bindtextdomain (PACKAGE, GTOPLOCALEDIR);
|
||||||
textdomain (PACKAGE);
|
textdomain (PACKAGE);
|
||||||
|
|
||||||
glibtop_init__r (&glibtop_global_server);
|
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);
|
||||||
|
|
||||||
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_cpu (&data.cpu);
|
glibtop_get_cpu (&data.cpu);
|
||||||
|
|
||||||
fprintf (stderr, "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++)
|
||||||
glibtop_get_mem (&data.mem);
|
glibtop_get_mem (&data.mem);
|
||||||
|
|
||||||
fprintf (stderr, "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);
|
||||||
|
|
||||||
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_swap (&data.swap);
|
glibtop_get_swap (&data.swap);
|
||||||
|
|
||||||
fprintf (stderr, "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++)
|
||||||
glibtop_get_uptime (&data.uptime);
|
glibtop_get_uptime (&data.uptime);
|
||||||
|
|
||||||
fprintf (stderr, "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++)
|
||||||
glibtop_get_loadavg (&data.loadavg);
|
glibtop_get_loadavg (&data.loadavg);
|
||||||
|
|
||||||
fprintf (stderr, "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++)
|
||||||
glibtop_get_shm_limits (&data.shm_limits);
|
glibtop_get_shm_limits (&data.shm_limits);
|
||||||
|
|
||||||
fprintf (stderr, "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);
|
||||||
|
|
||||||
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_msg_limits (&data.msg_limits);
|
glibtop_get_msg_limits (&data.msg_limits);
|
||||||
|
|
||||||
fprintf (stderr, "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,
|
||||||
data.msg_limits.msgssz, data.msg_limits.msgtql);
|
data.msg_limits.msgssz, data.msg_limits.msgtql);
|
||||||
|
|
||||||
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_sem_limits (&data.sem_limits);
|
glibtop_get_sem_limits (&data.sem_limits);
|
||||||
|
|
||||||
fprintf (stderr, "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,
|
||||||
@@ -96,12 +132,12 @@ main (int argc, char *argv [])
|
|||||||
data.sem_limits.semusz, data.sem_limits.semvmx,
|
data.sem_limits.semusz, data.sem_limits.semvmx,
|
||||||
data.sem_limits.semaem);
|
data.sem_limits.semaem);
|
||||||
|
|
||||||
fprintf (stderr, "\n");
|
printf ("\n");
|
||||||
|
|
||||||
glibtop_get_sysdeps (&sysdeps);
|
glibtop_get_sysdeps (&sysdeps);
|
||||||
|
|
||||||
fprintf (stderr, "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,
|
||||||
@@ -110,19 +146,19 @@ main (int argc, char *argv [])
|
|||||||
sysdeps.proc_time, sysdeps.proc_signal,
|
sysdeps.proc_time, sysdeps.proc_signal,
|
||||||
sysdeps.proc_kernel, sysdeps.proc_segment);
|
sysdeps.proc_kernel, sysdeps.proc_segment);
|
||||||
|
|
||||||
fprintf (stderr, "\n");
|
printf ("\n");
|
||||||
|
|
||||||
ptr = glibtop_get_proclist (&data.proclist);
|
ptr = glibtop_get_proclist (&data.proclist);
|
||||||
|
|
||||||
fprintf (stderr, "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);
|
||||||
|
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
fprintf (stderr, "\nProcess: ");
|
printf ("\nProcess: ");
|
||||||
for (i = 0; i < data.proclist.number; i++)
|
for (i = 0; i < data.proclist.number; i++)
|
||||||
fprintf (stderr, "%s%u", i ? ", " : "", ptr [i]);
|
printf ("%s%u", i ? ", " : "", ptr [i]);
|
||||||
fprintf (stderr, "\n");
|
printf ("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
glibtop_free (ptr);
|
glibtop_free (ptr);
|
||||||
@@ -130,18 +166,20 @@ main (int argc, char *argv [])
|
|||||||
pid = getpid ();
|
pid = getpid ();
|
||||||
ppid = getppid ();
|
ppid = getppid ();
|
||||||
|
|
||||||
fprintf (stderr, "\n");
|
printf ("\n");
|
||||||
|
|
||||||
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_state (&data.proc_state, pid);
|
glibtop_get_proc_state (&data.proc_state, pid);
|
||||||
|
|
||||||
fprintf (stderr, "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);
|
||||||
|
|
||||||
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_uid (&data.proc_uid, pid);
|
glibtop_get_proc_uid (&data.proc_uid, pid);
|
||||||
|
|
||||||
fprintf (stderr, "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,
|
||||||
@@ -151,61 +189,68 @@ main (int argc, char *argv [])
|
|||||||
data.proc_uid.tpgid, data.proc_uid.priority,
|
data.proc_uid.tpgid, data.proc_uid.priority,
|
||||||
data.proc_uid.nice);
|
data.proc_uid.nice);
|
||||||
|
|
||||||
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_mem (&data.proc_mem, pid);
|
glibtop_get_proc_mem (&data.proc_mem, pid);
|
||||||
|
|
||||||
fprintf (stderr, "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);
|
||||||
|
|
||||||
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_time (&data.proc_time, pid);
|
glibtop_get_proc_time (&data.proc_time, pid);
|
||||||
|
|
||||||
fprintf (stderr, "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,
|
||||||
data.proc_time.it_real_value);
|
data.proc_time.it_real_value);
|
||||||
|
|
||||||
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_signal (&data.proc_signal, pid);
|
glibtop_get_proc_signal (&data.proc_signal, pid);
|
||||||
|
|
||||||
fprintf (stderr, "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++)
|
||||||
glibtop_get_proc_kernel (&data.proc_kernel, pid);
|
glibtop_get_proc_kernel (&data.proc_kernel, pid);
|
||||||
|
|
||||||
fprintf (stderr, "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,
|
||||||
data.proc_kernel.kstk_esp, data.proc_kernel.kstk_eip,
|
data.proc_kernel.kstk_esp, data.proc_kernel.kstk_eip,
|
||||||
data.proc_kernel.wchan);
|
data.proc_kernel.wchan);
|
||||||
|
|
||||||
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_segment (&data.proc_segment, pid);
|
glibtop_get_proc_segment (&data.proc_segment, pid);
|
||||||
|
|
||||||
fprintf (stderr, "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,
|
||||||
data.proc_segment.start_stack);
|
data.proc_segment.start_stack);
|
||||||
|
|
||||||
fprintf (stderr, "\n");
|
printf ("\n");
|
||||||
|
|
||||||
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_state (&data.proc_state, ppid);
|
glibtop_get_proc_state (&data.proc_state, ppid);
|
||||||
|
|
||||||
fprintf (stderr, "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);
|
||||||
|
|
||||||
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_uid (&data.proc_uid, ppid);
|
glibtop_get_proc_uid (&data.proc_uid, ppid);
|
||||||
|
|
||||||
fprintf (stderr, "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,
|
||||||
@@ -215,61 +260,68 @@ main (int argc, char *argv [])
|
|||||||
data.proc_uid.tpgid, data.proc_uid.priority,
|
data.proc_uid.tpgid, data.proc_uid.priority,
|
||||||
data.proc_uid.nice);
|
data.proc_uid.nice);
|
||||||
|
|
||||||
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_mem (&data.proc_mem, ppid);
|
glibtop_get_proc_mem (&data.proc_mem, ppid);
|
||||||
|
|
||||||
fprintf (stderr, "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);
|
||||||
|
|
||||||
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_time (&data.proc_time, ppid);
|
glibtop_get_proc_time (&data.proc_time, ppid);
|
||||||
|
|
||||||
fprintf (stderr, "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,
|
||||||
data.proc_time.it_real_value);
|
data.proc_time.it_real_value);
|
||||||
|
|
||||||
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_signal (&data.proc_signal, ppid);
|
glibtop_get_proc_signal (&data.proc_signal, ppid);
|
||||||
|
|
||||||
fprintf (stderr, "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++)
|
||||||
glibtop_get_proc_kernel (&data.proc_kernel, ppid);
|
glibtop_get_proc_kernel (&data.proc_kernel, ppid);
|
||||||
|
|
||||||
fprintf (stderr, "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,
|
||||||
data.proc_kernel.kstk_esp, data.proc_kernel.kstk_eip,
|
data.proc_kernel.kstk_esp, data.proc_kernel.kstk_eip,
|
||||||
data.proc_kernel.wchan);
|
data.proc_kernel.wchan);
|
||||||
|
|
||||||
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_segment (&data.proc_segment, ppid);
|
glibtop_get_proc_segment (&data.proc_segment, ppid);
|
||||||
|
|
||||||
fprintf (stderr, "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,
|
||||||
data.proc_segment.start_stack);
|
data.proc_segment.start_stack);
|
||||||
|
|
||||||
fprintf (stderr, "\n");
|
printf ("\n");
|
||||||
|
|
||||||
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_state (&data.proc_state, 1);
|
glibtop_get_proc_state (&data.proc_state, 1);
|
||||||
|
|
||||||
fprintf (stderr, "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);
|
||||||
|
|
||||||
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_uid (&data.proc_uid, 1);
|
glibtop_get_proc_uid (&data.proc_uid, 1);
|
||||||
|
|
||||||
fprintf (stderr, "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,
|
||||||
@@ -279,48 +331,55 @@ main (int argc, char *argv [])
|
|||||||
data.proc_uid.tpgid, data.proc_uid.priority,
|
data.proc_uid.tpgid, data.proc_uid.priority,
|
||||||
data.proc_uid.nice);
|
data.proc_uid.nice);
|
||||||
|
|
||||||
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_mem (&data.proc_mem, 1);
|
glibtop_get_proc_mem (&data.proc_mem, 1);
|
||||||
|
|
||||||
fprintf (stderr, "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);
|
||||||
|
|
||||||
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_time (&data.proc_time, 1);
|
glibtop_get_proc_time (&data.proc_time, 1);
|
||||||
|
|
||||||
fprintf (stderr, "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,
|
||||||
data.proc_time.it_real_value);
|
data.proc_time.it_real_value);
|
||||||
|
|
||||||
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_signal (&data.proc_signal, 1);
|
glibtop_get_proc_signal (&data.proc_signal, 1);
|
||||||
|
|
||||||
fprintf (stderr, "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++)
|
||||||
glibtop_get_proc_kernel (&data.proc_kernel, 1);
|
glibtop_get_proc_kernel (&data.proc_kernel, 1);
|
||||||
|
|
||||||
fprintf (stderr, "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,
|
||||||
data.proc_kernel.kstk_esp, data.proc_kernel.kstk_eip,
|
data.proc_kernel.kstk_esp, data.proc_kernel.kstk_eip,
|
||||||
data.proc_kernel.wchan);
|
data.proc_kernel.wchan);
|
||||||
|
|
||||||
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_segment (&data.proc_segment, 1);
|
glibtop_get_proc_segment (&data.proc_segment, 1);
|
||||||
|
|
||||||
fprintf (stderr, "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,
|
||||||
data.proc_segment.start_stack);
|
data.proc_segment.start_stack);
|
||||||
|
|
||||||
|
glibtop_close ();
|
||||||
|
|
||||||
exit (0);
|
exit (0);
|
||||||
}
|
}
|
||||||
|
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);
|
||||||
|
}
|
@@ -19,6 +19,8 @@
|
|||||||
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 <locale.h>
|
||||||
|
|
||||||
#include <glibtop.h>
|
#include <glibtop.h>
|
||||||
#include <glibtop/open.h>
|
#include <glibtop/open.h>
|
||||||
#include <glibtop/close.h>
|
#include <glibtop/close.h>
|
||||||
@@ -39,12 +41,12 @@ main (int argc, char *argv [])
|
|||||||
bindtextdomain (PACKAGE, GTOPLOCALEDIR);
|
bindtextdomain (PACKAGE, GTOPLOCALEDIR);
|
||||||
textdomain (PACKAGE);
|
textdomain (PACKAGE);
|
||||||
|
|
||||||
glibtop_init__r (&glibtop_global_server);
|
glibtop_init ();
|
||||||
|
|
||||||
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,
|
||||||
@@ -57,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);
|
||||||
|
|
||||||
@@ -71,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,
|
||||||
@@ -90,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,
|
||||||
@@ -107,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,
|
||||||
@@ -124,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,
|
||||||
|
80
examples/test.scm
Normal file
80
examples/test.scm
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
(display (glibtop-names-sysdeps)) (newline)
|
||||||
|
(display (glibtop-labels-sysdeps)) (newline)
|
||||||
|
(display (glibtop-descriptions-sysdeps)) (newline)
|
||||||
|
(display (glibtop-types-sysdeps)) (newline)
|
||||||
|
|
||||||
|
(newline)
|
||||||
|
|
||||||
|
(display (glibtop-names-cpu)) (newline)
|
||||||
|
(display (glibtop-names-mem)) (newline)
|
||||||
|
(display (glibtop-names-swap)) (newline)
|
||||||
|
(display (glibtop-names-uptime)) (newline)
|
||||||
|
(display (glibtop-names-loadavg)) (newline)
|
||||||
|
(display (glibtop-names-shm_limits)) (newline)
|
||||||
|
(display (glibtop-names-msg_limits)) (newline)
|
||||||
|
(display (glibtop-names-sem_limits)) (newline)
|
||||||
|
(display (glibtop-names-proclist)) (newline)
|
||||||
|
(display (glibtop-names-proc_state)) (newline)
|
||||||
|
(display (glibtop-names-proc_uid)) (newline)
|
||||||
|
(display (glibtop-names-proc_mem)) (newline)
|
||||||
|
(display (glibtop-names-proc_time)) (newline)
|
||||||
|
(display (glibtop-names-proc_signal)) (newline)
|
||||||
|
(display (glibtop-names-proc_kernel)) (newline)
|
||||||
|
(display (glibtop-names-proc_segment)) (newline)
|
||||||
|
|
||||||
|
(newline)
|
||||||
|
|
||||||
|
(display (glibtop-labels-cpu)) (newline)
|
||||||
|
(display (glibtop-labels-mem)) (newline)
|
||||||
|
(display (glibtop-labels-swap)) (newline)
|
||||||
|
(display (glibtop-labels-uptime)) (newline)
|
||||||
|
(display (glibtop-labels-loadavg)) (newline)
|
||||||
|
(display (glibtop-labels-shm_limits)) (newline)
|
||||||
|
(display (glibtop-labels-msg_limits)) (newline)
|
||||||
|
(display (glibtop-labels-sem_limits)) (newline)
|
||||||
|
(display (glibtop-labels-proclist)) (newline)
|
||||||
|
(display (glibtop-labels-proc_state)) (newline)
|
||||||
|
(display (glibtop-labels-proc_uid)) (newline)
|
||||||
|
(display (glibtop-labels-proc_mem)) (newline)
|
||||||
|
(display (glibtop-labels-proc_time)) (newline)
|
||||||
|
(display (glibtop-labels-proc_signal)) (newline)
|
||||||
|
(display (glibtop-labels-proc_kernel)) (newline)
|
||||||
|
(display (glibtop-labels-proc_segment)) (newline)
|
||||||
|
|
||||||
|
(newline)
|
||||||
|
|
||||||
|
(display (glibtop-descriptions-cpu)) (newline)
|
||||||
|
(display (glibtop-descriptions-mem)) (newline)
|
||||||
|
(display (glibtop-descriptions-swap)) (newline)
|
||||||
|
(display (glibtop-descriptions-uptime)) (newline)
|
||||||
|
(display (glibtop-descriptions-loadavg)) (newline)
|
||||||
|
(display (glibtop-descriptions-shm_limits)) (newline)
|
||||||
|
(display (glibtop-descriptions-msg_limits)) (newline)
|
||||||
|
(display (glibtop-descriptions-sem_limits)) (newline)
|
||||||
|
(display (glibtop-descriptions-proclist)) (newline)
|
||||||
|
(display (glibtop-descriptions-proc_state)) (newline)
|
||||||
|
(display (glibtop-descriptions-proc_uid)) (newline)
|
||||||
|
(display (glibtop-descriptions-proc_mem)) (newline)
|
||||||
|
(display (glibtop-descriptions-proc_time)) (newline)
|
||||||
|
(display (glibtop-descriptions-proc_signal)) (newline)
|
||||||
|
(display (glibtop-descriptions-proc_kernel)) (newline)
|
||||||
|
(display (glibtop-descriptions-proc_segment)) (newline)
|
||||||
|
|
||||||
|
(newline)
|
||||||
|
|
||||||
|
(display (glibtop-types-cpu)) (newline)
|
||||||
|
(display (glibtop-types-mem)) (newline)
|
||||||
|
(display (glibtop-types-swap)) (newline)
|
||||||
|
(display (glibtop-types-uptime)) (newline)
|
||||||
|
(display (glibtop-types-loadavg)) (newline)
|
||||||
|
(display (glibtop-types-shm_limits)) (newline)
|
||||||
|
(display (glibtop-types-msg_limits)) (newline)
|
||||||
|
(display (glibtop-types-sem_limits)) (newline)
|
||||||
|
(display (glibtop-types-proclist)) (newline)
|
||||||
|
(display (glibtop-types-proc_state)) (newline)
|
||||||
|
(display (glibtop-types-proc_uid)) (newline)
|
||||||
|
(display (glibtop-types-proc_mem)) (newline)
|
||||||
|
(display (glibtop-types-proc_time)) (newline)
|
||||||
|
(display (glibtop-types-proc_signal)) (newline)
|
||||||
|
(display (glibtop-types-proc_kernel)) (newline)
|
||||||
|
(display (glibtop-types-proc_segment)) (newline)
|
@@ -19,6 +19,8 @@
|
|||||||
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 <locale.h>
|
||||||
|
|
||||||
#include <glibtop.h>
|
#include <glibtop.h>
|
||||||
|
|
||||||
#include <glibtop/open.h>
|
#include <glibtop/open.h>
|
||||||
|
@@ -1,10 +0,0 @@
|
|||||||
(display (get-cpu)) (newline)
|
|
||||||
(display (get-mem)) (newline)
|
|
||||||
(display (get-swap)) (newline)
|
|
||||||
(display (get-uptime)) (newline)
|
|
||||||
(display (get-loadavg)) (newline)
|
|
||||||
(display (get-shm_limits)) (newline)
|
|
||||||
(display (get-msg_limits)) (newline)
|
|
||||||
(display (get-sem_limits)) (newline)
|
|
||||||
(display (get-sysdeps)) (newline)
|
|
||||||
(display (get-proclist)) (newline)
|
|
18
features.def
Normal file
18
features.def
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
void|cpu|ulong(total,user,nice,sys,idle,frequency)
|
||||||
|
void|mem|ulong(total,used,free,shared,buffer,cached,user,locked)
|
||||||
|
void|swap|ulong(total,used,free,pagein,pageout)
|
||||||
|
void|uptime|double(uptime,idletime)
|
||||||
|
void|loadavg|double(loadavg[0],loadavg[1],loadavg[2])
|
||||||
|
void|shm_limits|ulong(shmmax,shmmin,shmmni,shmseg,shmall)
|
||||||
|
void|msg_limits|ulong(msgpool,msgmap,msgmax,msgmnb,msgmni,msgssz,msgtql)
|
||||||
|
void|sem_limits|ulong(semmap,semmni,semmns,semmnu,semmsl,semopm,semume,semusz,semvmx,semaem)
|
||||||
|
unsigned *|proclist|ulong(number,size,total)
|
||||||
|
void|proc_state|str(cmd):char(state):ulong(uid,gid)|pid_t|pid
|
||||||
|
void|proc_uid|long(uid,euid,gid,egid,pid,ppid,pgrp,session,tty,tpgid,priority,nice)|pid_t|pid
|
||||||
|
void|proc_mem|long(size,vsize,resident,share,rss,rss_rlim)|pid_t|pid
|
||||||
|
void|proc_time|long(start_time,utime,stime,cutime,cstime,timeout,it_real_value)|pid_t|pid
|
||||||
|
void|proc_signal|ulong(signal,blocked,sigignore,sigcatch)|pid_t|pid
|
||||||
|
void|proc_kernel|ulong(k_flags,min_flt,maj_flt,cmin_flt,cmaj_flt,kstk_esp,kstk_eip,wchan)|pid_t|pid
|
||||||
|
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
|
24
glibtop.h
24
glibtop.h
@@ -24,6 +24,9 @@
|
|||||||
|
|
||||||
#include <glibtop/global.h>
|
#include <glibtop/global.h>
|
||||||
|
|
||||||
|
#include <glibtop_server.h>
|
||||||
|
#include <glibtop/types.h>
|
||||||
|
|
||||||
#ifdef HAVE_GLIBTOP_MACHINE_H
|
#ifdef HAVE_GLIBTOP_MACHINE_H
|
||||||
#include <glibtop_machine.h>
|
#include <glibtop_machine.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -32,24 +35,37 @@ typedef struct _glibtop glibtop;
|
|||||||
|
|
||||||
struct _glibtop
|
struct _glibtop
|
||||||
{
|
{
|
||||||
int fd; /* Server file descriptor */
|
unsigned flags;
|
||||||
|
unsigned method; /* Server Method */
|
||||||
#ifdef HAVE_GLIBTOP_MACHINE_H
|
#ifdef HAVE_GLIBTOP_MACHINE_H
|
||||||
glibtop_machine machine; /* Machine dependent data */
|
glibtop_machine machine; /* Machine dependent data */
|
||||||
#endif
|
#endif
|
||||||
int input [2]; /* Pipe client <- server */
|
int input [2]; /* Pipe client <- server */
|
||||||
int output [2]; /* Pipe client -> server */
|
int output [2]; /* Pipe client -> server */
|
||||||
|
int socket; /* Accepted connection of a socket */
|
||||||
unsigned long os_version_code; /* Version code of the operating system */
|
unsigned long os_version_code; /* Version code of the operating system */
|
||||||
const char *name; /* Program name for error messages */
|
const char *name; /* Program name for error messages */
|
||||||
|
const char *server_command; /* Command used to invoke server */
|
||||||
|
const char *server_host; /* Host the server should run on */
|
||||||
|
const char *server_user; /* Name of the user on the target host */
|
||||||
|
const char *server_rsh; /* Command used to connect to the target host */
|
||||||
|
unsigned long features; /* Server is required for this features */
|
||||||
|
unsigned long server_port; /* Port on which daemon is listening */
|
||||||
pid_t pid; /* PID of the server */
|
pid_t pid; /* PID of the server */
|
||||||
};
|
};
|
||||||
|
|
||||||
extern glibtop *glibtop_global_server;
|
extern glibtop *glibtop_global_server;
|
||||||
|
|
||||||
#define glibtop_init() glibtop_init__r(&glibtop_global_server);
|
extern const unsigned long glibtop_server_features;
|
||||||
|
|
||||||
extern glibtop *glibtop_init__r __P((glibtop **));
|
#define glibtop_init() glibtop_init_r(&glibtop_global_server, 0, 0);
|
||||||
|
|
||||||
#ifdef HAVE_GUILE
|
#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_s __P((glibtop **, const unsigned long, const unsigned));
|
||||||
|
|
||||||
|
#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,14 +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/cpu.h>
|
#include <glibtop.h>
|
||||||
#include <glibtop/command.h>
|
#include <libguile/dynl.h>
|
||||||
|
|
||||||
/* Provides information about cpu usage. */
|
|
||||||
|
|
||||||
void
|
void
|
||||||
glibtop_get_cpu__r (glibtop *server, glibtop_cpu *buf)
|
scm_init_libgtop_libgtop_module (void)
|
||||||
{
|
{
|
||||||
glibtop_init__r (&server);
|
scm_register_module_xxx ("libgtop libgtop", glibtop_boot_guile);
|
||||||
glibtop_call__r (server, GLIBTOP_CMND_CPU, 0, NULL, sizeof (glibtop_cpu), buf);
|
|
||||||
}
|
}
|
@@ -19,14 +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/mem.h>
|
#include <glibtop.h>
|
||||||
#include <glibtop/command.h>
|
#include <libguile/dynl.h>
|
||||||
|
|
||||||
/* Provides information about memory usage. */
|
|
||||||
|
|
||||||
void
|
void
|
||||||
glibtop_get_mem__r (glibtop *server, glibtop_mem *buf)
|
scm_init_libgtop_names_module (void)
|
||||||
{
|
{
|
||||||
glibtop_init__r (&server);
|
scm_register_module_xxx ("libgtop names", glibtop_boot_guile_names);
|
||||||
glibtop_call__r (server, GLIBTOP_CMND_MEM, 0, NULL, sizeof (glibtop_mem), buf);
|
|
||||||
}
|
}
|
@@ -5,4 +5,5 @@ glibtop_HEADERS = close.h loadavg.h prockernel.h procstate.h \
|
|||||||
proctime.h shm_limits.h version.h cpu.h msg_limits.h \
|
proctime.h shm_limits.h version.h cpu.h msg_limits.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
|
output.h procsignal.h read_data.h union.h types.h \
|
||||||
|
parameter.h mountlist.h fsusage.h
|
||||||
|
@@ -26,7 +26,10 @@
|
|||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
extern void glibtop_close __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
|
||||||
|
|
||||||
|
@@ -29,6 +29,7 @@ __BEGIN_DECLS
|
|||||||
|
|
||||||
#define GLIBTOP_CMND_QUIT 0
|
#define GLIBTOP_CMND_QUIT 0
|
||||||
#define GLIBTOP_CMND_SYSDEPS 1
|
#define GLIBTOP_CMND_SYSDEPS 1
|
||||||
|
|
||||||
#define GLIBTOP_CMND_CPU 2
|
#define GLIBTOP_CMND_CPU 2
|
||||||
#define GLIBTOP_CMND_MEM 3
|
#define GLIBTOP_CMND_MEM 3
|
||||||
#define GLIBTOP_CMND_SWAP 4
|
#define GLIBTOP_CMND_SWAP 4
|
||||||
@@ -47,20 +48,42 @@ __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
|
||||||
|
|
||||||
typedef struct _glibtop_command glibtop_command;
|
typedef struct _glibtop_command glibtop_command;
|
||||||
|
|
||||||
|
typedef struct _glibtop_response glibtop_response;
|
||||||
|
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;
|
char parameter [_GLIBTOP_PARAM_SIZE];
|
||||||
};
|
};
|
||||||
|
|
||||||
#define glibtop_call(p1, p2, p3, p4) glibtop_call__r(glibtop_global_server, p1, p2, p3, p4)
|
union _glibtop_response_union
|
||||||
|
{
|
||||||
|
glibtop_union data;
|
||||||
|
glibtop_sysdeps sysdeps;
|
||||||
|
};
|
||||||
|
|
||||||
extern void *glibtop_call__r __P((glibtop *, unsigned, size_t, void *, size_t, void *));
|
struct _glibtop_response
|
||||||
|
{
|
||||||
|
int64_t offset;
|
||||||
|
u_int64_t size, data_size;
|
||||||
|
glibtop_response_union u;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define glibtop_call(p1, p2, p3, p4) glibtop_call_r(glibtop_global_server, p1, p2, p3, p4)
|
||||||
|
|
||||||
|
extern void *glibtop_call_l __P((glibtop *, unsigned, size_t, void *, size_t, void *));
|
||||||
|
extern void *glibtop_call_s __P((glibtop *, unsigned, size_t, void *, size_t, void *));
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
@@ -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 */
|
||||||
@@ -49,11 +49,23 @@ struct _glibtop_cpu
|
|||||||
frequency; /* GLIBTOP_CPU_FREQUENCY */
|
frequency; /* GLIBTOP_CPU_FREQUENCY */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define glibtop_get_cpu(cpu) glibtop_get_cpu__r(glibtop_global_server, cpu)
|
#define glibtop_get_cpu(cpu) glibtop_get_cpu_l(glibtop_global_server, cpu)
|
||||||
|
|
||||||
extern void glibtop_get_cpu__r __P((glibtop *, glibtop_cpu *));
|
#if GLIBTOP_SUID_CPU
|
||||||
|
#define glibtop_get_cpu_r glibtop_get_cpu_p
|
||||||
|
#else
|
||||||
|
#define glibtop_get_cpu_r glibtop_get_cpu_s
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GUILE
|
extern void glibtop_get_cpu_l __P((glibtop *, glibtop_cpu *));
|
||||||
|
|
||||||
|
#if GLIBTOP_SUID_CPU
|
||||||
|
extern void glibtop_get_cpu_p __P((glibtop *, glibtop_cpu *));
|
||||||
|
#else
|
||||||
|
extern void glibtop_get_cpu_s __P((glibtop *, glibtop_cpu *));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#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. */
|
||||||
|
|
||||||
@@ -77,7 +89,7 @@ extern SCM glibtop_guile_descriptions_cpu __P((void));
|
|||||||
/* You need to link with -lgtop_names to get this stuff here. */
|
/* You need to link with -lgtop_names to get this stuff here. */
|
||||||
|
|
||||||
extern const char *glibtop_names_cpu [];
|
extern const char *glibtop_names_cpu [];
|
||||||
extern const char *glibtop_types_cpu [];
|
extern const unsigned glibtop_types_cpu [];
|
||||||
extern const char *glibtop_labels_cpu [];
|
extern const char *glibtop_labels_cpu [];
|
||||||
extern const char *glibtop_descriptions_cpu [];
|
extern const char *glibtop_descriptions_cpu [];
|
||||||
|
|
||||||
|
@@ -26,9 +26,17 @@
|
|||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
#define glibtop_error(p1, args...) glibtop_error__r(glibtop_global_server , p1 , ## args)
|
#define glibtop_error(p1, args...) glibtop_error_r(glibtop_global_server , p1 , ## args)
|
||||||
|
#define glibtop_warn(p1, args...) glibtop_warn_r(glibtop_global_server , p1 , ## args)
|
||||||
|
|
||||||
extern void glibtop_error__r __P((glibtop *, char *, ...));
|
#define glibtop_error_io(p1, args...) glibtop_error_io_r(glibtop_global_server , p1 , ## args)
|
||||||
|
#define glibtop_warn_io(p1, args...) glibtop_warn_io_r(glibtop_global_server , p1 , ## args)
|
||||||
|
|
||||||
|
extern void glibtop_error_r __P((glibtop *, char *, ...));
|
||||||
|
extern void glibtop_warn_r __P((glibtop *, char *, ...));
|
||||||
|
|
||||||
|
extern void glibtop_error_io_r __P((glibtop *, char *, ...));
|
||||||
|
extern void glibtop_warn_io_r __P((glibtop *, char *, ...));
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
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
|
@@ -51,21 +51,42 @@
|
|||||||
# define __P(protos) ()
|
# define __P(protos) ()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GUILE
|
#if TIME_WITH_SYS_TIME
|
||||||
|
# include <sys/time.h>
|
||||||
|
# include <time.h>
|
||||||
|
#else
|
||||||
|
# if HAVE_SYS_TIME_H
|
||||||
|
# include <sys/time.h>
|
||||||
|
# else
|
||||||
|
# include <time.h>
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef WITHOUT_GUILE
|
||||||
|
#undef GLIBTOP_GUILE
|
||||||
|
#undef GLIBTOP_GUILE_NAMES
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GLIBTOP_GUILE
|
||||||
#include <guile/gh.h>
|
#include <guile/gh.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _IN_LIBGTOP
|
||||||
#if (defined HAVE_LIBINTL_H) || (defined HAVE_GETTEXT)
|
#if (defined HAVE_LIBINTL_H) || (defined HAVE_GETTEXT)
|
||||||
#include <libintl.h>
|
#include <libintl.h>
|
||||||
#else
|
#else
|
||||||
#include <libgettext.h>
|
#include <libgettext.h>
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_MEMORY_H
|
#ifdef HAVE_MEMORY_H
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
@@ -73,7 +94,9 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <sys/param.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
158
include/glibtop/gnuserv.h
Normal file
158
include/glibtop/gnuserv.h
Normal file
@@ -0,0 +1,158 @@
|
|||||||
|
/* -*-C-*-
|
||||||
|
|
||||||
|
Header file for the GNU Emacs server and client C code.
|
||||||
|
|
||||||
|
This file is part of GNU Emacs.
|
||||||
|
|
||||||
|
Copying is permitted under those conditions described by the GNU
|
||||||
|
General Public License.
|
||||||
|
|
||||||
|
Copyright (C) 1989 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
Author: Andy Norman (ange@hplb.hpl.hp.com), based on
|
||||||
|
'etc/server.c' and 'etc/emacsclient.c' from the 18.52 GNU
|
||||||
|
Emacs distribution.
|
||||||
|
|
||||||
|
Please mail bugs and suggestions to the author at the above address.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* HISTORY
|
||||||
|
* 11-Nov-1990 bristor@simba
|
||||||
|
* Added EOT stuff.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file incorporates new features added by Bob Weiner <weiner@mot.com>,
|
||||||
|
* Darrell Kindred <dkindred@cmu.edu> and Arup Mukherjee <arup@cmu.edu>.
|
||||||
|
* Please see the note at the end of the README file for details.
|
||||||
|
*
|
||||||
|
* (If gnuserv came bundled with your emacs, the README file is probably
|
||||||
|
* ../etc/gnuserv.README relative to the directory containing this file)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
static char header_rcsid [] = "!Header: gnuserv.h,v 2.4 95/02/16 11:58:11 arup alpha !";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define NO_SHORTNAMES
|
||||||
|
|
||||||
|
#define PATCHLEVEL 2
|
||||||
|
|
||||||
|
#define NO_SHORTNAMES
|
||||||
|
/* gnuserv should not be compiled using SOCKS */
|
||||||
|
#define DO_NOT_SOCKSIFY
|
||||||
|
#include <glibtop.h>
|
||||||
|
#include <glibtop/error.h>
|
||||||
|
#undef read
|
||||||
|
#undef write
|
||||||
|
#undef open
|
||||||
|
#undef close
|
||||||
|
#undef signal
|
||||||
|
|
||||||
|
/* Define the communication method between server and clients:
|
||||||
|
* You can have either or both kinds of sockets, but you can't mix
|
||||||
|
* sockets with sysv ipc
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define INTERNET_DOMAIN_SOCKETS
|
||||||
|
#define UNIX_DOMAIN_SOCKETS
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Define additional authentication protocols to be used. These methods will
|
||||||
|
* be tried before falling back to the default gnuserv protocol (based on
|
||||||
|
* the GNU_SECURE environment variable). Currently, only MIT-MAGIC-COOKIE-1
|
||||||
|
* is also supported.
|
||||||
|
*
|
||||||
|
* Comment out the next line(s) if you don't want to enable the
|
||||||
|
* appropriate authentication protocol.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined (HAVE_XAUTH)
|
||||||
|
#define AUTH_MAGIC_COOKIE
|
||||||
|
#endif /* HAVE_XAUTH */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* stuff related to supporting MIT-MAGIC-COOKIE-1
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define MCOOKIE_SCREEN "42980" /* screen # to use as the gnuserv cookie */
|
||||||
|
#define MCOOKIE_NAME "MAGIC-1" /* authentication protocol name */
|
||||||
|
#define MCOOKIE_X_NAME "MIT-MAGIC-COOKIE-1" /* as needed by X */
|
||||||
|
|
||||||
|
|
||||||
|
#define DEFAUTH_NAME "GNU-SECURE" /* name of default auth protocol */
|
||||||
|
#define AUTH_TIMEOUT 15 /* # seconds to wait for auth data */
|
||||||
|
#define AUTH_NAMESZ 15 /* max allows auth protocol name size */
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Pick a default communication scheme, if none was specified.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(UNIX_DOMAIN_SOCKETS) && !defined(INTERNET_DOMAIN_SOCKETS)
|
||||||
|
|
||||||
|
/* BSD systems use Unix Domain sockets by default */
|
||||||
|
|
||||||
|
#ifdef BSD
|
||||||
|
#define UNIX_DOMAIN_SOCKETS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* No communication method pre-defined */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If you are using SYSV_IPC, you might want to make the buffer size bigger
|
||||||
|
* since it limits the size of requests and responses. Don't make it bigger
|
||||||
|
* than your system's max message size though (usually a couple of k) or else
|
||||||
|
* msgsend will start failing. For sockets, using the system BUFSIZ is usually
|
||||||
|
* what you want.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(INTERNET_DOMAIN_SOCKETS) || defined(UNIX_DOMAIN_SOCKETS)
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#endif /* INTERNET_DOMAIN_SOCKETS || UNIX_DOMAIN_SOCKETS */
|
||||||
|
|
||||||
|
#ifdef INTERNET_DOMAIN_SOCKETS
|
||||||
|
#include <netdb.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#define TABLE_SIZE 101 /* The number of entries in the hash table */
|
||||||
|
#define HASH(host) host /* Rather simplistic hash function */
|
||||||
|
#define DEFAULT_PORT 21490 /* default port number to use is
|
||||||
|
* DEFAULT_PORT + uid */
|
||||||
|
#endif /* INTERNET_DOMAIN_SOCKETS */
|
||||||
|
|
||||||
|
#ifdef UNIX_DOMAIN_SOCKETS
|
||||||
|
#include <sys/un.h>
|
||||||
|
#define HIDE_UNIX_SOCKET /* put the unix socket in a protected dir */
|
||||||
|
#endif /* UNIX_DOMAIN_SOCKETS */
|
||||||
|
|
||||||
|
#define HOSTNAMSZ 255 /* max size of a hostname */
|
||||||
|
#define REPLYSIZ 300 /* max size of reply from server to client */
|
||||||
|
#undef FALSE
|
||||||
|
#define FALSE 0
|
||||||
|
#undef TRUE
|
||||||
|
#define TRUE 1
|
||||||
|
|
||||||
|
/* The casts shut Sun's compiler up and are safe in the context these
|
||||||
|
are actually used. */
|
||||||
|
#define max2(x,y) (((int) (x) > (int) (y)) ? (x) : (y))
|
||||||
|
#define min2(x,y) (((int) (x) < (int) (y)) ? (x) : (y))
|
||||||
|
|
||||||
|
#ifndef _NFILE /* rough guess at maximum number of open files */
|
||||||
|
#define _NFILE 20
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define EOT_STR "\004"
|
||||||
|
#define EOT_CHR '\004'
|
||||||
|
|
||||||
|
/* connection types */
|
||||||
|
#define CONN_UNIX 0
|
||||||
|
#define CONN_INTERNET 1
|
||||||
|
#define CONN_IPC 2
|
||||||
|
|
||||||
|
/* function declarations */
|
||||||
|
extern int glibtop_make_connection __P((const char *, int, int *));
|
||||||
|
|
||||||
|
#ifdef INTERNET_DOMAIN_SOCKETS
|
||||||
|
extern long glibtop_internet_addr __P((const char *));
|
||||||
|
#endif
|
@@ -35,15 +35,27 @@ 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 */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define glibtop_get_loadavg(loadavg) glibtop_get_loadavg__r(glibtop_global_server, loadavg)
|
#define glibtop_get_loadavg(loadavg) glibtop_get_loadavg_l(glibtop_global_server, loadavg)
|
||||||
|
|
||||||
extern void glibtop_get_loadavg__r __P((glibtop *, glibtop_loadavg *));
|
#if GLIBTOP_SUID_LOADAVG
|
||||||
|
#define glibtop_get_loadavg_r glibtop_get_loadavg_p
|
||||||
|
#else
|
||||||
|
#define glibtop_get_loadavg_r glibtop_get_loadavg_s
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GUILE
|
extern void glibtop_get_loadavg_l __P((glibtop *, glibtop_loadavg *));
|
||||||
|
|
||||||
|
#if GLIBTOP_SUID_LOADAVG
|
||||||
|
extern void glibtop_get_loadavg_p __P((glibtop *, glibtop_loadavg *));
|
||||||
|
#else
|
||||||
|
extern void glibtop_get_loadavg_s __P((glibtop *, glibtop_loadavg *));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#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. */
|
||||||
|
|
||||||
@@ -67,7 +79,7 @@ extern SCM glibtop_guile_descriptions_loadavg __P((void));
|
|||||||
/* You need to link with -lgtop_names to get this stuff here. */
|
/* You need to link with -lgtop_names to get this stuff here. */
|
||||||
|
|
||||||
extern const char *glibtop_names_loadavg [];
|
extern const char *glibtop_names_loadavg [];
|
||||||
extern const char *glibtop_types_loadavg [];
|
extern const unsigned glibtop_types_loadavg [];
|
||||||
extern const char *glibtop_labels_loadavg [];
|
extern const char *glibtop_labels_loadavg [];
|
||||||
extern const char *glibtop_descriptions_loadavg [];
|
extern const char *glibtop_descriptions_loadavg [];
|
||||||
|
|
||||||
|
@@ -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 */
|
||||||
@@ -53,11 +53,23 @@ struct _glibtop_mem
|
|||||||
locked; /* GLIBTOP_MEM_LOCKED */
|
locked; /* GLIBTOP_MEM_LOCKED */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define glibtop_get_mem(mem) glibtop_get_mem__r(glibtop_global_server, mem)
|
#define glibtop_get_mem(mem) glibtop_get_mem_l(glibtop_global_server, mem)
|
||||||
|
|
||||||
extern void glibtop_get_mem__r __P((glibtop *, glibtop_mem *));
|
#if GLIBTOP_SUID_MEM
|
||||||
|
#define glibtop_get_mem_r glibtop_get_mem_p
|
||||||
|
#else
|
||||||
|
#define glibtop_get_mem_r glibtop_get_mem_s
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GUILE
|
extern void glibtop_get_mem_l __P((glibtop *, glibtop_mem *));
|
||||||
|
|
||||||
|
#if GLIBTOP_SUID_MEM
|
||||||
|
extern void glibtop_get_mem_p __P((glibtop *, glibtop_mem *));
|
||||||
|
#else
|
||||||
|
extern void glibtop_get_mem_s __P((glibtop *, glibtop_mem *));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#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. */
|
||||||
|
|
||||||
@@ -81,7 +93,7 @@ extern SCM glibtop_guile_descriptions_mem __P((void));
|
|||||||
/* You need to link with -lgtop_names to get this stuff here. */
|
/* You need to link with -lgtop_names to get this stuff here. */
|
||||||
|
|
||||||
extern const char *glibtop_names_mem [];
|
extern const char *glibtop_names_mem [];
|
||||||
extern const char *glibtop_types_mem [];
|
extern const unsigned glibtop_types_mem [];
|
||||||
extern const char *glibtop_labels_mem [];
|
extern const char *glibtop_labels_mem [];
|
||||||
extern const char *glibtop_descriptions_mem [];
|
extern const char *glibtop_descriptions_mem [];
|
||||||
|
|
||||||
|
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 */
|
||||||
@@ -51,11 +51,23 @@ struct _glibtop_msg_limits
|
|||||||
msgtql; /* GLIBTOP_IPC_MSGTQL */
|
msgtql; /* GLIBTOP_IPC_MSGTQL */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define glibtop_get_msg_limits(msg) glibtop_get_msg_limits__r(glibtop_global_server, msg)
|
#define glibtop_get_msg_limits(msg) glibtop_get_msg_limits_l(glibtop_global_server, msg)
|
||||||
|
|
||||||
extern void glibtop_get_msg_limits__r __P((glibtop *, glibtop_msg_limits *));
|
#if GLIBTOP_SUID_MSG_LIMITS
|
||||||
|
#define glibtop_get_msg_limits_r glibtop_get_msg_limits_p
|
||||||
|
#else
|
||||||
|
#define glibtop_get_msg_limits_r glibtop_get_msg_limits_s
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GUILE
|
extern void glibtop_get_msg_limits_l __P((glibtop *, glibtop_msg_limits *));
|
||||||
|
|
||||||
|
#if GLIBTOP_SUID_MSG_LIMITS
|
||||||
|
extern void glibtop_get_msg_limits_p __P((glibtop *, glibtop_msg_limits *));
|
||||||
|
#else
|
||||||
|
extern void glibtop_get_msg_limits_s __P((glibtop *, glibtop_msg_limits *));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#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. */
|
||||||
|
|
||||||
@@ -79,7 +91,7 @@ extern SCM glibtop_guile_descriptions_msg_limits __P((void));
|
|||||||
/* You need to link with -lgtop_names to get this stuff here. */
|
/* You need to link with -lgtop_names to get this stuff here. */
|
||||||
|
|
||||||
extern const char *glibtop_names_msg_limits [];
|
extern const char *glibtop_names_msg_limits [];
|
||||||
extern const char *glibtop_types_msg_limits [];
|
extern const unsigned glibtop_types_msg_limits [];
|
||||||
extern const char *glibtop_labels_msg_limits [];
|
extern const char *glibtop_labels_msg_limits [];
|
||||||
extern const char *glibtop_descriptions_msg_limits [];
|
extern const char *glibtop_descriptions_msg_limits [];
|
||||||
|
|
||||||
|
@@ -26,7 +26,25 @@
|
|||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
extern void glibtop_open __P((glibtop *, const char *));
|
#define _GLIBTOP_INIT_STATE_INIT 0x10000
|
||||||
|
#define _GLIBTOP_INIT_STATE_OPEN 0x20000
|
||||||
|
#define _GLIBTOP_INIT_STATE_SERVER 0x40000
|
||||||
|
|
||||||
|
#define GLIBTOP_INIT_NO_OPEN 1
|
||||||
|
#define GLIBTOP_INIT_NO_INIT 2
|
||||||
|
|
||||||
|
#define GLIBTOP_FEATURES_NO_SERVER 4
|
||||||
|
#define GLIBTOP_FEATURES_EXCEPT 8
|
||||||
|
|
||||||
|
#define GLIBTOP_METHOD_DIRECT 1
|
||||||
|
#define GLIBTOP_METHOD_PIPE 2
|
||||||
|
#define GLIBTOP_METHOD_INET 3
|
||||||
|
#define GLIBTOP_METHOD_UNIX 4
|
||||||
|
|
||||||
|
extern void glibtop_open_l __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
|
||||||
|
|
||||||
|
@@ -1,5 +1,3 @@
|
|||||||
/* $Id$ */
|
|
||||||
|
|
||||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the Gnome Top Library.
|
This file is part of the Gnome Top Library.
|
||||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||||
@@ -19,22 +17,26 @@
|
|||||||
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. */
|
||||||
|
|
||||||
|
#ifndef __GLIBTOP_PARAMETER_H__
|
||||||
|
#define __GLIBTOP_PARAMETER_H__
|
||||||
|
|
||||||
#include <glibtop.h>
|
#include <glibtop.h>
|
||||||
#include <glibtop/open.h>
|
#include <glibtop/open.h>
|
||||||
|
|
||||||
static glibtop _glibtop_global_server;
|
__BEGIN_DECLS
|
||||||
glibtop *glibtop_global_server = NULL;
|
|
||||||
|
|
||||||
glibtop *
|
#define GLIBTOP_PARAM_METHOD 1
|
||||||
glibtop_init__r (glibtop **server)
|
#define GLIBTOP_PARAM_FEATURES 2
|
||||||
{
|
#define GLIBTOP_PARAM_COMMAND 3
|
||||||
if (*server != NULL)
|
#define GLIBTOP_PARAM_HOST 4
|
||||||
return *server;
|
#define GLIBTOP_PARAM_PORT 5
|
||||||
|
|
||||||
if (glibtop_global_server == NULL) {
|
#define glibtop_get_parameter(p1,p2,p3) glibtop_get_parameter_l(glibtop_global_server,p1,p2,p3)
|
||||||
glibtop_global_server = &_glibtop_global_server;
|
#define glibtop_set_parameter(p1,p2,p3) glibtop_set_parameter_l(glibtop_global_server,p1,p2,p3)
|
||||||
glibtop_open (glibtop_global_server, "glibtop");
|
|
||||||
}
|
|
||||||
|
|
||||||
return *server = glibtop_global_server;
|
extern size_t glibtop_get_parameter_l __P((glibtop *, const unsigned, void *, size_t));
|
||||||
}
|
extern void glibtop_set_parameter_l __P((glibtop *, const unsigned, const void *, size_t));
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
@@ -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
|
||||||
@@ -60,11 +60,23 @@ struct _glibtop_proc_kernel
|
|||||||
* proc is sleeping in */
|
* proc is sleeping in */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define glibtop_get_proc_kernel(p1, p2) glibtop_get_proc_kernel__r(glibtop_global_server, p1, p2)
|
#define glibtop_get_proc_kernel(p1, p2) glibtop_get_proc_kernel_l(glibtop_global_server, p1, p2)
|
||||||
|
|
||||||
extern void glibtop_get_proc_kernel__r __P((glibtop *, glibtop_proc_kernel *, pid_t));
|
#if GLIBTOP_SUID_PROC_KERNEL
|
||||||
|
#define glibtop_get_proc_kernel_r glibtop_get_proc_kernel_p
|
||||||
|
#else
|
||||||
|
#define glibtop_get_proc_kernel_r glibtop_get_proc_kernel_s
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GUILE
|
extern void glibtop_get_proc_kernel_l __P((glibtop *, glibtop_proc_kernel *, pid_t));
|
||||||
|
|
||||||
|
#if GLIBTOP_SUID_PROC_KERNEL
|
||||||
|
extern void glibtop_get_proc_kernel_p __P((glibtop *, glibtop_proc_kernel *, pid_t));
|
||||||
|
#else
|
||||||
|
extern void glibtop_get_proc_kernel_s __P((glibtop *, glibtop_proc_kernel *, pid_t));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#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. */
|
||||||
|
|
||||||
@@ -87,8 +99,8 @@ extern SCM glibtop_guile_descriptions_proc_kernel __P((void));
|
|||||||
|
|
||||||
/* You need to link with -lgtop_names to get this stuff here. */
|
/* You need to link with -lgtop_names to get this stuff here. */
|
||||||
|
|
||||||
extern const char *glibtop_types_proc_kernel [];
|
|
||||||
extern const char *glibtop_names_proc_kernel [];
|
extern const char *glibtop_names_proc_kernel [];
|
||||||
|
extern const unsigned glibtop_types_proc_kernel [];
|
||||||
extern const char *glibtop_labels_proc_kernel [];
|
extern const char *glibtop_labels_proc_kernel [];
|
||||||
extern const char *glibtop_descriptions_proc_kernel [];
|
extern const char *glibtop_descriptions_proc_kernel [];
|
||||||
|
|
||||||
|
@@ -37,17 +37,29 @@ 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 */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define glibtop_get_proclist(proclist) glibtop_get_proclist__r(glibtop_global_server, proclist)
|
#define glibtop_get_proclist(proclist) glibtop_get_proclist_l(glibtop_global_server, proclist)
|
||||||
|
|
||||||
extern unsigned *glibtop_get_proclist__r __P((glibtop *, glibtop_proclist *));
|
#if GLIBTOP_SUID_PROCLIST
|
||||||
|
#define glibtop_get_proclist_r glibtop_get_proclist_p
|
||||||
|
#else
|
||||||
|
#define glibtop_get_proclist_r glibtop_get_proclist_s
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GUILE
|
extern unsigned *glibtop_get_proclist_l __P((glibtop *, glibtop_proclist *));
|
||||||
|
|
||||||
|
#if GLIBTOP_SUID_PROCLIST
|
||||||
|
extern unsigned *glibtop_get_proclist_p __P((glibtop *, glibtop_proclist *));
|
||||||
|
#else
|
||||||
|
extern unsigned *glibtop_get_proclist_s __P((glibtop *, glibtop_proclist *));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#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. */
|
||||||
|
|
||||||
@@ -71,7 +83,7 @@ extern SCM glibtop_guile_descriptions_proclist __P((void));
|
|||||||
/* You need to link with -lgtop_names to get this stuff here. */
|
/* You need to link with -lgtop_names to get this stuff here. */
|
||||||
|
|
||||||
extern const char *glibtop_names_proclist [];
|
extern const char *glibtop_names_proclist [];
|
||||||
extern const char *glibtop_types_proclist [];
|
extern const unsigned glibtop_types_proclist [];
|
||||||
extern const char *glibtop_labels_proclist [];
|
extern const char *glibtop_labels_proclist [];
|
||||||
extern const char *glibtop_descriptions_proclist [];
|
extern const char *glibtop_descriptions_proclist [];
|
||||||
|
|
||||||
|
@@ -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) */
|
||||||
@@ -53,11 +53,23 @@ struct _glibtop_proc_mem
|
|||||||
* of the process; usually 2,147,483,647 */
|
* of the process; usually 2,147,483,647 */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define glibtop_get_proc_mem(p1, p2) glibtop_get_proc_mem__r(glibtop_global_server, p1, p2)
|
#define glibtop_get_proc_mem(p1, p2) glibtop_get_proc_mem_l(glibtop_global_server, p1, p2)
|
||||||
|
|
||||||
extern void glibtop_get_proc_mem__r __P((glibtop *, glibtop_proc_mem *, pid_t));
|
#if GLIBTOP_SUID_PROC_MEM
|
||||||
|
#define glibtop_get_proc_mem_r glibtop_get_proc_mem_p
|
||||||
|
#else
|
||||||
|
#define glibtop_get_proc_mem_r glibtop_get_proc_mem_s
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GUILE
|
extern void glibtop_get_proc_mem_l __P((glibtop *, glibtop_proc_mem *, pid_t));
|
||||||
|
|
||||||
|
#if GLIBTOP_SUID_PROC_MEM
|
||||||
|
extern void glibtop_get_proc_mem_p __P((glibtop *, glibtop_proc_mem *, pid_t));
|
||||||
|
#else
|
||||||
|
extern void glibtop_get_proc_mem_s __P((glibtop *, glibtop_proc_mem *, pid_t));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#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. */
|
||||||
|
|
||||||
@@ -81,7 +93,7 @@ extern SCM glibtop_guile_descriptions_proc_mem __P((void));
|
|||||||
/* You need to link with -lgtop_names to get this stuff here. */
|
/* You need to link with -lgtop_names to get this stuff here. */
|
||||||
|
|
||||||
extern const char *glibtop_names_proc_mem [];
|
extern const char *glibtop_names_proc_mem [];
|
||||||
extern const char *glibtop_types_proc_mem [];
|
extern const unsigned glibtop_types_proc_mem [];
|
||||||
extern const char *glibtop_labels_proc_mem [];
|
extern const char *glibtop_labels_proc_mem [];
|
||||||
extern const char *glibtop_descriptions_proc_mem [];
|
extern const char *glibtop_descriptions_proc_mem [];
|
||||||
|
|
||||||
|
@@ -43,22 +43,34 @@ 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 */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define glibtop_get_proc_segment(p1, p2) glibtop_get_proc_segment__r(glibtop_global_server, p1, p2)
|
#define glibtop_get_proc_segment(p1, p2) glibtop_get_proc_segment_l(glibtop_global_server, p1, p2)
|
||||||
|
|
||||||
extern void glibtop_get_proc_segment__r __P((glibtop *, glibtop_proc_segment *, pid_t));
|
#if GLIBTOP_SUID_PROC_SEGMENT
|
||||||
|
#define glibtop_get_proc_segment_r glibtop_get_proc_segment_p
|
||||||
|
#else
|
||||||
|
#define glibtop_get_proc_segment_r glibtop_get_proc_segment_s
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GUILE
|
extern void glibtop_get_proc_segment_l __P((glibtop *, glibtop_proc_segment *, pid_t));
|
||||||
|
|
||||||
|
#if GLIBTOP_SUID_PROC_SEGMENT
|
||||||
|
extern void glibtop_get_proc_segment_p __P((glibtop *, glibtop_proc_segment *, pid_t));
|
||||||
|
#else
|
||||||
|
extern void glibtop_get_proc_segment_s __P((glibtop *, glibtop_proc_segment *, pid_t));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#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. */
|
||||||
|
|
||||||
@@ -81,8 +93,8 @@ extern SCM glibtop_guile_descriptions_proc_segment __P((void));
|
|||||||
|
|
||||||
/* You need to link with -lgtop_names to get this stuff here. */
|
/* You need to link with -lgtop_names to get this stuff here. */
|
||||||
|
|
||||||
extern const char *glibtop_types_proc_segment [];
|
|
||||||
extern const char *glibtop_names_proc_segment [];
|
extern const char *glibtop_names_proc_segment [];
|
||||||
|
extern const unsigned glibtop_types_proc_segment [];
|
||||||
extern const char *glibtop_labels_proc_segment [];
|
extern const char *glibtop_labels_proc_segment [];
|
||||||
extern const char *glibtop_descriptions_proc_segment [];
|
extern const char *glibtop_descriptions_proc_segment [];
|
||||||
|
|
||||||
|
@@ -40,18 +40,30 @@ 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__r(glibtop_global_server, p1, p2)
|
#define glibtop_get_proc_signal(p1, p2) glibtop_get_proc_signal_l(glibtop_global_server, p1, p2)
|
||||||
|
|
||||||
extern void glibtop_get_proc_signal__r __P((glibtop *, glibtop_proc_signal *, pid_t));
|
#if GLIBTOP_SUID_PROC_SIGNAL
|
||||||
|
#define glibtop_get_proc_signal_r glibtop_get_proc_signal_p
|
||||||
|
#else
|
||||||
|
#define glibtop_get_proc_signal_r glibtop_get_proc_signal_s
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GUILE
|
extern void glibtop_get_proc_signal_l __P((glibtop *, glibtop_proc_signal *, pid_t));
|
||||||
|
|
||||||
|
#if GLIBTOP_SUID_PROC_SIGNAL
|
||||||
|
extern void glibtop_get_proc_signal_p __P((glibtop *, glibtop_proc_signal *, pid_t));
|
||||||
|
#else
|
||||||
|
extern void glibtop_get_proc_signal_s __P((glibtop *, glibtop_proc_signal *, pid_t));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#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. */
|
||||||
|
|
||||||
@@ -75,7 +87,7 @@ extern SCM glibtop_guile_descriptions_proc_signal __P((void));
|
|||||||
/* You need to link with -lgtop_names to get this stuff here. */
|
/* You need to link with -lgtop_names to get this stuff here. */
|
||||||
|
|
||||||
extern const char *glibtop_names_proc_signal [];
|
extern const char *glibtop_names_proc_signal [];
|
||||||
extern const char *glibtop_types_proc_signal [];
|
extern const unsigned glibtop_types_proc_signal [];
|
||||||
extern const char *glibtop_labels_proc_signal [];
|
extern const char *glibtop_labels_proc_signal [];
|
||||||
extern const char *glibtop_descriptions_proc_signal [];
|
extern const char *glibtop_descriptions_proc_signal [];
|
||||||
|
|
||||||
|
@@ -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
|
||||||
@@ -54,11 +54,23 @@ struct _glibtop_proc_state
|
|||||||
gid; /* GID of process */
|
gid; /* GID of process */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define glibtop_get_proc_state(p1, p2) glibtop_get_proc_state__r(glibtop_global_server, p1, p2)
|
#define glibtop_get_proc_state(p1, p2) glibtop_get_proc_state_l(glibtop_global_server, p1, p2)
|
||||||
|
|
||||||
extern void glibtop_get_proc_state__r __P((glibtop *, glibtop_proc_state *, pid_t));
|
#if GLIBTOP_SUID_PROC_STATE
|
||||||
|
#define glibtop_get_proc_state_r glibtop_get_proc_state_p
|
||||||
|
#else
|
||||||
|
#define glibtop_get_proc_state_r glibtop_get_proc_state_s
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GUILE
|
extern void glibtop_get_proc_state_l __P((glibtop *, glibtop_proc_state *, pid_t));
|
||||||
|
|
||||||
|
#if GLIBTOP_SUID_PROC_STATE
|
||||||
|
extern void glibtop_get_proc_state_p __P((glibtop *, glibtop_proc_state *, pid_t));
|
||||||
|
#else
|
||||||
|
extern void glibtop_get_proc_state_s __P((glibtop *, glibtop_proc_state *, pid_t));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#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. */
|
||||||
|
|
||||||
@@ -82,7 +94,7 @@ extern SCM glibtop_guile_descriptions_proc_state __P((void));
|
|||||||
/* You need to link with -lgtop_names to get this stuff here. */
|
/* You need to link with -lgtop_names to get this stuff here. */
|
||||||
|
|
||||||
extern const char *glibtop_names_proc_state [];
|
extern const char *glibtop_names_proc_state [];
|
||||||
extern const char *glibtop_types_proc_state [];
|
extern const unsigned glibtop_types_proc_state [];
|
||||||
extern const char *glibtop_labels_proc_state [];
|
extern const char *glibtop_labels_proc_state [];
|
||||||
extern const char *glibtop_descriptions_proc_state [];
|
extern const char *glibtop_descriptions_proc_state [];
|
||||||
|
|
||||||
|
@@ -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 */
|
||||||
@@ -59,11 +59,23 @@ struct _glibtop_proc_time
|
|||||||
* due to an interval timer. */
|
* due to an interval timer. */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define glibtop_get_proc_time(p1, p2) glibtop_get_proc_time__r(glibtop_global_server, p1, p2)
|
#define glibtop_get_proc_time(p1, p2) glibtop_get_proc_time_l(glibtop_global_server, p1, p2)
|
||||||
|
|
||||||
extern void glibtop_get_proc_time__r __P((glibtop *, glibtop_proc_time *, pid_t));
|
#if GLIBTOP_SUID_PROC_TIME
|
||||||
|
#define glibtop_get_proc_time_r glibtop_get_proc_time_p
|
||||||
|
#else
|
||||||
|
#define glibtop_get_proc_time_r glibtop_get_proc_time_s
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GUILE
|
extern void glibtop_get_proc_time_l __P((glibtop *, glibtop_proc_time *, pid_t));
|
||||||
|
|
||||||
|
#if GLIBTOP_SUID_PROC_TIME
|
||||||
|
extern void glibtop_get_proc_time_p __P((glibtop *, glibtop_proc_time *, pid_t));
|
||||||
|
#else
|
||||||
|
extern void glibtop_get_proc_time_s __P((glibtop *, glibtop_proc_time *, pid_t));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#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. */
|
||||||
|
|
||||||
@@ -87,7 +99,7 @@ extern SCM glibtop_guile_descriptions_proc_time __P((void));
|
|||||||
/* You need to link with -lgtop_names to get this stuff here. */
|
/* You need to link with -lgtop_names to get this stuff here. */
|
||||||
|
|
||||||
extern const char *glibtop_names_proc_time [];
|
extern const char *glibtop_names_proc_time [];
|
||||||
extern const char *glibtop_types_proc_time [];
|
extern const unsigned glibtop_types_proc_time [];
|
||||||
extern const char *glibtop_labels_proc_time [];
|
extern const char *glibtop_labels_proc_time [];
|
||||||
extern const char *glibtop_descriptions_proc_time [];
|
extern const char *glibtop_descriptions_proc_time [];
|
||||||
|
|
||||||
|
@@ -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 */
|
||||||
@@ -63,11 +63,23 @@ struct _glibtop_proc_uid
|
|||||||
nice; /* standard unix nice level of process */
|
nice; /* standard unix nice level of process */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define glibtop_get_proc_uid(p1, p2) glibtop_get_proc_uid__r(glibtop_global_server, p1, p2)
|
#define glibtop_get_proc_uid(p1, p2) glibtop_get_proc_uid_l(glibtop_global_server, p1, p2)
|
||||||
|
|
||||||
extern void glibtop_get_proc_uid__r __P((glibtop *, glibtop_proc_uid *, pid_t));
|
#if GLIBTOP_SUID_PROC_UID
|
||||||
|
#define glibtop_get_proc_uid_r glibtop_get_proc_uid_p
|
||||||
|
#else
|
||||||
|
#define glibtop_get_proc_uid_r glibtop_get_proc_uid_s
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GUILE
|
extern void glibtop_get_proc_uid_l __P((glibtop *, glibtop_proc_uid *, pid_t));
|
||||||
|
|
||||||
|
#if GLIBTOP_SUID_PROC_UID
|
||||||
|
extern void glibtop_get_proc_uid_p __P((glibtop *, glibtop_proc_uid *, pid_t));
|
||||||
|
#else
|
||||||
|
extern void glibtop_get_proc_uid_s __P((glibtop *, glibtop_proc_uid *, pid_t));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#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. */
|
||||||
|
|
||||||
@@ -91,7 +103,7 @@ extern SCM glibtop_guile_descriptions_proc_uid __P((void));
|
|||||||
/* You need to link with -lgtop_names to get this stuff here. */
|
/* You need to link with -lgtop_names to get this stuff here. */
|
||||||
|
|
||||||
extern const char *glibtop_names_proc_uid [];
|
extern const char *glibtop_names_proc_uid [];
|
||||||
extern const char *glibtop_types_proc_uid [];
|
extern const unsigned glibtop_types_proc_uid [];
|
||||||
extern const char *glibtop_labels_proc_uid [];
|
extern const char *glibtop_labels_proc_uid [];
|
||||||
extern const char *glibtop_descriptions_proc_uid [];
|
extern const char *glibtop_descriptions_proc_uid [];
|
||||||
|
|
||||||
|
@@ -29,7 +29,8 @@ __BEGIN_DECLS
|
|||||||
|
|
||||||
#define glibtop_read(p1, p2) glibtop_read(glibtop_global_server, p1, p2)
|
#define glibtop_read(p1, p2) glibtop_read(glibtop_global_server, p1, p2)
|
||||||
|
|
||||||
extern void glibtop_read__r __P((glibtop *, size_t, void *));
|
extern void glibtop_read_l __P((glibtop *, size_t, void *));
|
||||||
|
extern void glibtop_read_s __P((glibtop *, size_t, void *));
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
@@ -27,9 +27,10 @@
|
|||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
#define glibtop_read_data() glibtop_read_data__r(glibtop_global_server)
|
#define glibtop_read_data() glibtop_read_data_r(glibtop_global_server)
|
||||||
|
|
||||||
extern void *glibtop_read_data__r __P((glibtop *));
|
extern void *glibtop_read_data_l __P((glibtop *));
|
||||||
|
extern void *glibtop_read_data_s __P((glibtop *));
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
@@ -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 */
|
||||||
@@ -57,11 +57,23 @@ struct _glibtop_sem_limits
|
|||||||
semaem; /* GLIBTOP_IPC_SEMAEM */
|
semaem; /* GLIBTOP_IPC_SEMAEM */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define glibtop_get_sem_limits(sem) glibtop_get_sem_limits__r(glibtop_global_server, sem)
|
#define glibtop_get_sem_limits(sem) glibtop_get_sem_limits_l(glibtop_global_server, sem)
|
||||||
|
|
||||||
extern void glibtop_get_sem_limits__r __P((glibtop *, glibtop_sem_limits *));
|
#if GLIBTOP_SUID_SEM_LIMITS
|
||||||
|
#define glibtop_get_sem_limits_r glibtop_get_sem_limits_p
|
||||||
|
#else
|
||||||
|
#define glibtop_get_sem_limits_r glibtop_get_sem_limits_s
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GUILE
|
extern void glibtop_get_sem_limits_l __P((glibtop *, glibtop_sem_limits *));
|
||||||
|
|
||||||
|
#if GLIBTOP_SUID_SEM_LIMITS
|
||||||
|
extern void glibtop_get_sem_limits_p __P((glibtop *, glibtop_sem_limits *));
|
||||||
|
#else
|
||||||
|
extern void glibtop_get_sem_limits_s __P((glibtop *, glibtop_sem_limits *));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#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. */
|
||||||
|
|
||||||
@@ -85,7 +97,7 @@ extern SCM glibtop_guile_descriptions_sem_limits __P((void));
|
|||||||
/* You need to link with -lgtop_names to get this stuff here. */
|
/* You need to link with -lgtop_names to get this stuff here. */
|
||||||
|
|
||||||
extern const char *glibtop_names_sem_limits [];
|
extern const char *glibtop_names_sem_limits [];
|
||||||
extern const char *glibtop_types_sem_limits [];
|
extern const unsigned glibtop_types_sem_limits [];
|
||||||
extern const char *glibtop_labels_sem_limits [];
|
extern const char *glibtop_labels_sem_limits [];
|
||||||
extern const char *glibtop_descriptions_sem_limits [];
|
extern const char *glibtop_descriptions_sem_limits [];
|
||||||
|
|
||||||
|
@@ -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 */
|
||||||
@@ -47,11 +47,23 @@ struct _glibtop_shm_limits
|
|||||||
shmall; /* GLIBTOP_IPC_SHMALL */
|
shmall; /* GLIBTOP_IPC_SHMALL */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define glibtop_get_shm_limits(shm) glibtop_get_shm_limits__r(glibtop_global_server, shm)
|
#define glibtop_get_shm_limits(shm) glibtop_get_shm_limits_l(glibtop_global_server, shm)
|
||||||
|
|
||||||
extern void glibtop_get_shm_limits__r __P((glibtop *, glibtop_shm_limits *));
|
#if GLIBTOP_SUID_SHM_LIMITS
|
||||||
|
#define glibtop_get_shm_limits_r glibtop_get_shm_limits_p
|
||||||
|
#else
|
||||||
|
#define glibtop_get_shm_limits_r glibtop_get_shm_limits_s
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GUILE
|
extern void glibtop_get_shm_limits_l __P((glibtop *, glibtop_shm_limits *));
|
||||||
|
|
||||||
|
#if GLIBTOP_SUID_SHM_LIMITS
|
||||||
|
extern void glibtop_get_shm_limits_p __P((glibtop *, glibtop_shm_limits *));
|
||||||
|
#else
|
||||||
|
extern void glibtop_get_shm_limits_s __P((glibtop *, glibtop_shm_limits *));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#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. */
|
||||||
|
|
||||||
@@ -75,7 +87,7 @@ extern SCM glibtop_guile_descriptions_shm_limits __P((void));
|
|||||||
/* You need to link with -lgtop_names to get this stuff here. */
|
/* You need to link with -lgtop_names to get this stuff here. */
|
||||||
|
|
||||||
extern const char *glibtop_names_shm_limits [];
|
extern const char *glibtop_names_shm_limits [];
|
||||||
extern const char *glibtop_types_shm_limits [];
|
extern const unsigned glibtop_types_shm_limits [];
|
||||||
extern const char *glibtop_labels_shm_limits [];
|
extern const char *glibtop_labels_shm_limits [];
|
||||||
extern const char *glibtop_descriptions_shm_limits [];
|
extern const char *glibtop_descriptions_shm_limits [];
|
||||||
|
|
||||||
|
@@ -19,20 +19,27 @@
|
|||||||
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. */
|
||||||
|
|
||||||
|
#ifndef __GLIBTOP_SIGNAL_H__
|
||||||
|
#define __GLIBTOP_SIGNAL_H__
|
||||||
|
|
||||||
#include <glibtop.h>
|
#include <glibtop.h>
|
||||||
#include <glibtop/swap.h>
|
|
||||||
|
|
||||||
#include <guile/gh.h>
|
#ifdef HAVE_SYS_SIGNAL_H
|
||||||
|
#include <sys/signal.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
SCM glibtop_guile_get_swap (void)
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
typedef struct _glibtop_signame glibtop_signame;
|
||||||
|
|
||||||
|
struct _glibtop_signame
|
||||||
{
|
{
|
||||||
glibtop_swap swap;
|
const int number;
|
||||||
|
const char *name, *label;
|
||||||
|
};
|
||||||
|
|
||||||
glibtop_get_swap (&swap);
|
extern const glibtop_signame glibtop_sys_siglist [];
|
||||||
|
|
||||||
return gh_list (gh_ulong2scm (swap.flags),
|
__END_DECLS
|
||||||
gh_ulong2scm (swap.total),
|
|
||||||
gh_ulong2scm (swap.used),
|
#endif
|
||||||
gh_ulong2scm (swap.free),
|
|
||||||
SCM_UNDEFINED);
|
|
||||||
}
|
|
@@ -30,24 +30,40 @@ __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__r(glibtop_global_server, swap)
|
#define glibtop_get_swap(swap) glibtop_get_swap_l(glibtop_global_server, swap)
|
||||||
|
|
||||||
extern void glibtop_get_swap__r __P((glibtop *, glibtop_swap *));
|
#if GLIBTOP_SUID_SWAP
|
||||||
|
#define glibtop_get_swap_r glibtop_get_swap_p
|
||||||
|
#else
|
||||||
|
#define glibtop_get_swap_r glibtop_get_swap_s
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GUILE
|
extern void glibtop_get_swap_l __P((glibtop *, glibtop_swap *));
|
||||||
|
|
||||||
|
#if GLIBTOP_SUID_SWAP
|
||||||
|
extern void glibtop_get_swap_p __P((glibtop *, glibtop_swap *));
|
||||||
|
#else
|
||||||
|
extern void glibtop_get_swap_s __P((glibtop *, glibtop_swap *));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#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. */
|
||||||
|
|
||||||
@@ -71,7 +87,7 @@ extern SCM glibtop_guile_descriptions_swap __P((void));
|
|||||||
/* You need to link with -lgtop_names to get this stuff here. */
|
/* You need to link with -lgtop_names to get this stuff here. */
|
||||||
|
|
||||||
extern const char *glibtop_names_swap [];
|
extern const char *glibtop_names_swap [];
|
||||||
extern const char *glibtop_types_swap [];
|
extern const unsigned glibtop_types_swap [];
|
||||||
extern const char *glibtop_labels_swap [];
|
extern const char *glibtop_labels_swap [];
|
||||||
extern const char *glibtop_descriptions_swap [];
|
extern const char *glibtop_descriptions_swap [];
|
||||||
|
|
||||||
|
@@ -27,30 +27,36 @@
|
|||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
#define GLIBTOP_SYSDEPS_CPU 0
|
#define GLIBTOP_SYSDEPS_FEATURES 0
|
||||||
#define GLIBTOP_SYSDEPS_MEM 1
|
#define GLIBTOP_SYSDEPS_CPU 1
|
||||||
#define GLIBTOP_SYSDEPS_SWAP 2
|
#define GLIBTOP_SYSDEPS_MEM 2
|
||||||
#define GLIBTOP_SYSDEPS_UPTIME 3
|
#define GLIBTOP_SYSDEPS_SWAP 3
|
||||||
#define GLIBTOP_SYSDEPS_LOADAVG 4
|
#define GLIBTOP_SYSDEPS_UPTIME 4
|
||||||
#define GLIBTOP_SYSDEPS_SHM_LIMITS 5
|
#define GLIBTOP_SYSDEPS_LOADAVG 5
|
||||||
#define GLIBTOP_SYSDEPS_MSG_LIMITS 6
|
#define GLIBTOP_SYSDEPS_SHM_LIMITS 6
|
||||||
#define GLIBTOP_SYSDEPS_SEM_LIMITS 7
|
#define GLIBTOP_SYSDEPS_MSG_LIMITS 7
|
||||||
#define GLIBTOP_SYSDEPS_PROCLIST 8
|
#define GLIBTOP_SYSDEPS_SEM_LIMITS 8
|
||||||
#define GLIBTOP_SYSDEPS_PROC_STATE 9
|
#define GLIBTOP_SYSDEPS_PROCLIST 9
|
||||||
#define GLIBTOP_SYSDEPS_PROC_UID 10
|
#define GLIBTOP_SYSDEPS_PROC_STATE 10
|
||||||
#define GLIBTOP_SYSDEPS_PROC_MEM 11
|
#define GLIBTOP_SYSDEPS_PROC_UID 11
|
||||||
#define GLIBTOP_SYSDEPS_PROC_TIME 12
|
#define GLIBTOP_SYSDEPS_PROC_MEM 12
|
||||||
#define GLIBTOP_SYSDEPS_PROC_SIGNAL 13
|
#define GLIBTOP_SYSDEPS_PROC_TIME 13
|
||||||
#define GLIBTOP_SYSDEPS_PROC_KERNEL 14
|
#define GLIBTOP_SYSDEPS_PROC_SIGNAL 14
|
||||||
#define GLIBTOP_SYSDEPS_PROC_SEGMENT 15
|
#define GLIBTOP_SYSDEPS_PROC_KERNEL 15
|
||||||
|
#define GLIBTOP_SYSDEPS_PROC_SEGMENT 16
|
||||||
|
#define GLIBTOP_SYSDEPS_MOUNTLIST 17
|
||||||
|
#define GLIBTOP_SYSDEPS_FSUSAGE 18
|
||||||
|
|
||||||
#define GLIBTOP_MAX_SYSDEPS 16
|
#define GLIBTOP_MAX_SYSDEPS 19
|
||||||
|
|
||||||
|
#define GLIBTOP_SYSDEPS_ALL ((1 << GLIBTOP_MAX_SYSDEPS) - 1)
|
||||||
|
|
||||||
typedef struct _glibtop_sysdeps glibtop_sysdeps;
|
typedef struct _glibtop_sysdeps glibtop_sysdeps;
|
||||||
|
|
||||||
struct _glibtop_sysdeps
|
struct _glibtop_sysdeps
|
||||||
{
|
{
|
||||||
unsigned long flags,
|
u_int64_t flags,
|
||||||
|
features, /* server features */
|
||||||
cpu, /* glibtop_cpu */
|
cpu, /* glibtop_cpu */
|
||||||
mem, /* glibtop_mem */
|
mem, /* glibtop_mem */
|
||||||
swap, /* glibtop_swap */
|
swap, /* glibtop_swap */
|
||||||
@@ -66,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. */
|
||||||
|
|
||||||
@@ -97,7 +105,7 @@ extern SCM glibtop_guile_descriptions_sysdeps __P((void));
|
|||||||
/* You need to link with -lgtop_names to get this stuff here. */
|
/* You need to link with -lgtop_names to get this stuff here. */
|
||||||
|
|
||||||
extern const char *glibtop_names_sysdeps [];
|
extern const char *glibtop_names_sysdeps [];
|
||||||
extern const char *glibtop_types_sysdeps [];
|
extern const unsigned glibtop_types_sysdeps [];
|
||||||
extern const char *glibtop_labels_sysdeps [];
|
extern const char *glibtop_labels_sysdeps [];
|
||||||
extern const char *glibtop_descriptions_sysdeps [];
|
extern const char *glibtop_descriptions_sysdeps [];
|
||||||
|
|
||||||
|
36
include/glibtop/types.h
Normal file
36
include/glibtop/types.h
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
/* $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_TYPES_H__
|
||||||
|
#define __GLIBTOP_TYPES_H__
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
#define GLIBTOP_TYPE_LONG 1
|
||||||
|
#define GLIBTOP_TYPE_ULONG 2
|
||||||
|
#define GLIBTOP_TYPE_DOUBLE 3
|
||||||
|
#define GLIBTOP_TYPE_INT 4
|
||||||
|
#define GLIBTOP_TYPE_CHAR 5
|
||||||
|
#define GLIBTOP_TYPE_STRING 6
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif
|
@@ -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,16 +36,28 @@ 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 */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define glibtop_get_uptime(uptime) glibtop_get_uptime__r(glibtop_global_server, uptime)
|
#define glibtop_get_uptime(uptime) glibtop_get_uptime_l(glibtop_global_server, uptime)
|
||||||
|
|
||||||
extern void glibtop_get_uptime__r __P((glibtop *, glibtop_uptime *));
|
#if GLIBTOP_SUID_UPTIME
|
||||||
|
#define glibtop_get_uptime_r glibtop_get_uptime_p
|
||||||
|
#else
|
||||||
|
#define glibtop_get_uptime_r glibtop_get_uptime_s
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GUILE
|
extern void glibtop_get_uptime_l __P((glibtop *, glibtop_uptime *));
|
||||||
|
|
||||||
|
#if GLIBTOP_SUID_UPTIME
|
||||||
|
extern void glibtop_get_uptime_p __P((glibtop *, glibtop_uptime *));
|
||||||
|
#else
|
||||||
|
extern void glibtop_get_uptime_s __P((glibtop *, glibtop_uptime *));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#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. */
|
||||||
|
|
||||||
@@ -69,7 +81,7 @@ extern SCM glibtop_guile_descriptions_uptime __P((void));
|
|||||||
/* You need to link with -lgtop_names to get this stuff here. */
|
/* You need to link with -lgtop_names to get this stuff here. */
|
||||||
|
|
||||||
extern const char *glibtop_names_uptime [];
|
extern const char *glibtop_names_uptime [];
|
||||||
extern const char *glibtop_types_uptime [];
|
extern const unsigned glibtop_types_uptime [];
|
||||||
extern const char *glibtop_labels_uptime [];
|
extern const char *glibtop_labels_uptime [];
|
||||||
extern const char *glibtop_descriptions_uptime [];
|
extern const char *glibtop_descriptions_uptime [];
|
||||||
|
|
||||||
|
@@ -29,7 +29,8 @@ __BEGIN_DECLS
|
|||||||
|
|
||||||
#define glibtop_write(p1, p2) glibtop_write(glibtop_global_server, p1, p2)
|
#define glibtop_write(p1, p2) glibtop_write(glibtop_global_server, p1, p2)
|
||||||
|
|
||||||
extern void glibtop_write__r __P((glibtop *, size_t, void *));
|
extern void glibtop_write_l __P((glibtop *, size_t, void *));
|
||||||
|
extern void glibtop_write_s __P((glibtop *, size_t, void *));
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
@@ -27,15 +27,17 @@
|
|||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
#define glibtop_malloc(p1) glibtop_malloc__r(glibtop_global_server, p1)
|
#define glibtop_malloc(p1) glibtop_malloc_r(glibtop_global_server, p1)
|
||||||
#define glibtop_calloc(p1, p2) glibtop_calloc__r(glibtop_global_server, p1, p2)
|
#define glibtop_calloc(p1, p2) glibtop_calloc_r(glibtop_global_server, p1, p2)
|
||||||
#define glibtop_realloc(p1, p2) glibtop_realloc__r(glibtop_global_server, p1, p2)
|
#define glibtop_realloc(p1, p2) glibtop_realloc_r(glibtop_global_server, p1, p2)
|
||||||
#define glibtop_free(p1) glibtop_free__r(glibtop_global_server, p1)
|
#define glibtop_strdup(p2) glibtop_strdup_r(glibtop_global_server, p1)
|
||||||
|
#define glibtop_free(p1) glibtop_free_r(glibtop_global_server, p1)
|
||||||
|
|
||||||
extern void *glibtop_malloc__r __P((glibtop *, size_t));
|
extern void *glibtop_malloc_r __P((glibtop *, size_t));
|
||||||
extern void *glibtop_calloc__r __P((glibtop *, size_t, size_t));
|
extern void *glibtop_calloc_r __P((glibtop *, size_t, size_t));
|
||||||
extern void *glibtop_realloc__r __P((glibtop *, void *, size_t));
|
extern void *glibtop_realloc_r __P((glibtop *, void *, size_t));
|
||||||
extern void glibtop_free__r __P((glibtop *, void *));
|
extern char *glibtop_strdup_r __P((glibtop *, const char *));
|
||||||
|
extern void glibtop_free_r __P((glibtop *, void *));
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
14
kernel/ChangeLog
Normal file
14
kernel/ChangeLog
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
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>
|
||||||
|
|
||||||
|
* README: Added README.
|
||||||
|
|
||||||
|
* kernel.patch: Patch for the Linux kernel to add the
|
||||||
|
new system call.
|
168
kernel/table.h
Normal file
168
kernel/table.h
Normal file
@@ -0,0 +1,168 @@
|
|||||||
|
#ifndef _LINUX_TABLE_H
|
||||||
|
#define _LINUX_TABLE_H
|
||||||
|
|
||||||
|
#ifdef _KERNEL
|
||||||
|
#include <linux/types.h>
|
||||||
|
#else
|
||||||
|
#define NR_TASKS 512
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define TABLE_VERSION 0
|
||||||
|
#define TABLE_CPU 1
|
||||||
|
#define TABLE_MEM 2
|
||||||
|
#define TABLE_SWAP 3
|
||||||
|
#define TABLE_LOADAVG 4
|
||||||
|
#define TABLE_UPTIME 5
|
||||||
|
#define TABLE_PROCLIST 6
|
||||||
|
#define TABLE_PROC_UID 7
|
||||||
|
#define TABLE_PROC_MEM 8
|
||||||
|
#define TABLE_PROC_SEGMENT 9
|
||||||
|
#define TABLE_PROC_TIME 10
|
||||||
|
#define TABLE_PROC_STATE 11
|
||||||
|
#define TABLE_PROC_SIGNAL 12
|
||||||
|
#define TABLE_PROC_KERNEL 13
|
||||||
|
|
||||||
|
/* CPU Usage (in jiffies = 1/100th seconds) */
|
||||||
|
|
||||||
|
struct table_cpu
|
||||||
|
{
|
||||||
|
unsigned long total; /* Total CPU Time */
|
||||||
|
unsigned long user; /* CPU Time in User Mode */
|
||||||
|
unsigned long nice; /* CPU Time in User Mode (nice) */
|
||||||
|
unsigned long sys; /* CPU Time in System Mode */
|
||||||
|
unsigned long idle; /* CPU Time in the Idle Task */
|
||||||
|
unsigned long frequency; /* Tick frequency */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Memory Usage (in bytes) */
|
||||||
|
|
||||||
|
struct table_mem
|
||||||
|
{
|
||||||
|
unsigned long total; /* Total physical memory */
|
||||||
|
unsigned long used; /* Used memory size */
|
||||||
|
unsigned long free; /* Free memory size */
|
||||||
|
unsigned long shared; /* Shared memory size */
|
||||||
|
unsigned long buffer; /* Size of buffers */
|
||||||
|
unsigned long cached; /* Size of cached memory */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Swap Space (in bytes) */
|
||||||
|
|
||||||
|
struct table_swap
|
||||||
|
{
|
||||||
|
unsigned long total; /* Total swap space */
|
||||||
|
unsigned long used; /* Used 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 */
|
||||||
|
|
||||||
|
struct table_loadavg
|
||||||
|
{
|
||||||
|
double loadavg [3];
|
||||||
|
unsigned nr_running;
|
||||||
|
unsigned nr_tasks;
|
||||||
|
unsigned last_pid;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Uptime */
|
||||||
|
|
||||||
|
struct table_uptime
|
||||||
|
{
|
||||||
|
unsigned long uptime;
|
||||||
|
unsigned long idle;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Process list. */
|
||||||
|
|
||||||
|
struct table_proclist
|
||||||
|
{
|
||||||
|
int nr_running, nr_tasks, last_pid;
|
||||||
|
unsigned pids [NR_TASKS];
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Information about processes. */
|
||||||
|
|
||||||
|
struct table_proc_state
|
||||||
|
{
|
||||||
|
long state;
|
||||||
|
unsigned long flags;
|
||||||
|
char comm[16];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct table_proc_uid
|
||||||
|
{
|
||||||
|
int uid, euid, suid, fsuid;
|
||||||
|
int gid, egid, sgid, fsgid;
|
||||||
|
int pid, pgrp, ppid;
|
||||||
|
int session;
|
||||||
|
unsigned int tty;
|
||||||
|
int tpgid;
|
||||||
|
long priority;
|
||||||
|
long counter;
|
||||||
|
long def_priority;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct table_proc_mem
|
||||||
|
{
|
||||||
|
unsigned long context;
|
||||||
|
unsigned long start_code, end_code, start_data, end_data;
|
||||||
|
unsigned long start_brk, brk, start_stack, start_mmap;
|
||||||
|
unsigned long arg_start, arg_end, env_start, env_end;
|
||||||
|
unsigned long rss, rlim, total_vm, locked_vm;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct table_proc_segment
|
||||||
|
{
|
||||||
|
unsigned long vsize;
|
||||||
|
int size, resident, shared;
|
||||||
|
int trs, lrs, drs, dt;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct table_proc_time
|
||||||
|
{
|
||||||
|
long utime, stime, cutime, cstime, start_time;
|
||||||
|
unsigned long timeout, policy, rt_priority;
|
||||||
|
unsigned long it_real_value, it_prof_value, it_virt_value;
|
||||||
|
unsigned long it_real_incr, it_prof_incr, it_virt_incr;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct table_proc_signal
|
||||||
|
{
|
||||||
|
unsigned long long signal,
|
||||||
|
blocked, /* bitmap of masked signals */
|
||||||
|
ignored, /* mask of ignored signals */
|
||||||
|
caught; /* mask of caught signals */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct table_proc_kernel
|
||||||
|
{
|
||||||
|
unsigned long keip, kesp, wchan;
|
||||||
|
unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt;
|
||||||
|
unsigned long nswap, cnswap;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Union */
|
||||||
|
|
||||||
|
union table
|
||||||
|
{
|
||||||
|
struct table_cpu cpu;
|
||||||
|
struct table_mem mem;
|
||||||
|
struct table_swap swap;
|
||||||
|
struct table_loadavg loadavg;
|
||||||
|
struct table_uptime uptime;
|
||||||
|
struct table_proclist proclist;
|
||||||
|
struct table_proc_uid proc_uid;
|
||||||
|
struct table_proc_mem proc_mem;
|
||||||
|
struct table_proc_segment proc_segment;
|
||||||
|
struct table_proc_time proc_time;
|
||||||
|
struct table_proc_state proc_state;
|
||||||
|
struct table_proc_signal proc_signal;
|
||||||
|
struct table_proc_kernel proc_kernel;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* _LINUX_IPC_H */
|
||||||
|
|
||||||
|
|
13
kernel/table20/Makefile
Normal file
13
kernel/table20/Makefile
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#
|
||||||
|
# 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
|
||||||
|
O_OBJS := main.o
|
||||||
|
|
||||||
|
include $(TOPDIR)/Rules.make
|
21
kernel/table20/README
Normal file
21
kernel/table20/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
|
51
kernel/table20/kernel.patch
Normal file
51
kernel/table20/kernel.patch
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
diff -ur linux-2.0.32/Makefile linux-hacked/Makefile
|
||||||
|
--- linux-2.0.32/Makefile Fri Nov 7 19:51:05 1997
|
||||||
|
+++ linux-hacked/Makefile Thu Jun 11 20:41:12 1998
|
||||||
|
@@ -87,7 +87,7 @@
|
||||||
|
# standard CFLAGS
|
||||||
|
#
|
||||||
|
|
||||||
|
-CFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -fno-strength-reduce
|
||||||
|
+CFLAGS = -Wall -Wstrict-prototypes -g -O2 -fomit-frame-pointer -fno-strength-reduce
|
||||||
|
|
||||||
|
ifdef CONFIG_CPP
|
||||||
|
CFLAGS := $(CFLAGS) -x c++
|
||||||
|
@@ -113,12 +113,12 @@
|
||||||
|
# Include the make variables (CC, etc...)
|
||||||
|
#
|
||||||
|
|
||||||
|
-ARCHIVES =kernel/kernel.o mm/mm.o fs/fs.o ipc/ipc.o net/network.a
|
||||||
|
+ARCHIVES =kernel/kernel.o mm/mm.o fs/fs.o ipc/ipc.o net/network.a table/table.o
|
||||||
|
FILESYSTEMS =fs/filesystems.a
|
||||||
|
DRIVERS =drivers/block/block.a \
|
||||||
|
drivers/char/char.a
|
||||||
|
LIBS =$(TOPDIR)/lib/lib.a
|
||||||
|
-SUBDIRS =kernel drivers mm fs net ipc lib
|
||||||
|
+SUBDIRS =kernel drivers mm fs net ipc lib table
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ISDN),y)
|
||||||
|
DRIVERS := $(DRIVERS) drivers/isdn/isdn.a
|
||||||
|
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-hacked/arch/i386/kernel/entry.S Thu Jun 11 21:37:20 1998
|
||||||
|
@@ -699,4 +699,8 @@
|
||||||
|
.long SYMBOL_NAME(sys_mremap)
|
||||||
|
.long 0,0
|
||||||
|
.long SYMBOL_NAME(sys_vm86)
|
||||||
|
- .space (NR_syscalls-166)*4
|
||||||
|
+ .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)
|
||||||
|
+ .space (NR_syscalls-188)*4
|
||||||
|
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-hacked/include/asm-i386/unistd.h Thu Jun 11 21:37:03 1998
|
||||||
|
@@ -169,6 +169,7 @@
|
||||||
|
#define __NR_sched_rr_get_interval 161
|
||||||
|
#define __NR_nanosleep 162
|
||||||
|
#define __NR_mremap 163
|
||||||
|
+#define __NR_table 188
|
||||||
|
|
||||||
|
/* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */
|
||||||
|
#define _syscall0(type,name) \
|
439
kernel/table20/main.c
Normal file
439
kernel/table20/main.c
Normal file
@@ -0,0 +1,439 @@
|
|||||||
|
/*
|
||||||
|
* 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 <asm/segment.h>
|
||||||
|
#include <asm/pgtable.h>
|
||||||
|
#include <asm/io.h>
|
||||||
|
|
||||||
|
#include <linux/table.h>
|
||||||
|
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
|
#if defined(__i386__)
|
||||||
|
# define KSTK_EIP(tsk) (((unsigned long *)tsk->kernel_stack_page)[1019])
|
||||||
|
# define KSTK_ESP(tsk) (((unsigned long *)tsk->kernel_stack_page)[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 *)(tsk->kernel_stack_page + PT_REG(pc)))
|
||||||
|
# define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->tss.usp)
|
||||||
|
#elif defined(__sparc__)
|
||||||
|
# define PT_REG(reg) (PAGE_SIZE - sizeof(struct pt_regs) \
|
||||||
|
+ (long)&((struct pt_regs *)0)->reg)
|
||||||
|
# define KSTK_EIP(tsk) (*(unsigned long *)(tsk->kernel_stack_page + PT_REG(pc)))
|
||||||
|
# define KSTK_ESP(tsk) (*(unsigned long *)(tsk->kernel_stack_page + PT_REG(u_regs[UREG_FP])))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static struct task_struct *
|
||||||
|
get_task (pid_t pid)
|
||||||
|
{
|
||||||
|
struct task_struct ** p;
|
||||||
|
|
||||||
|
p = task;
|
||||||
|
while (++p < task+NR_TASKS) {
|
||||||
|
if (*p && (*p)->pid == pid)
|
||||||
|
return *p;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 (pte_page(page) >= high_memory)
|
||||||
|
continue;
|
||||||
|
if (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++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 = p->kernel_stack_page;
|
||||||
|
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 < (unsigned long) interruptible_sleep_on
|
||||||
|
|| eip >= (unsigned long) add_timer)
|
||||||
|
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 >= (unsigned long) interruptible_sleep_on && pc < (unsigned long) add_timer) {
|
||||||
|
schedule_frame = ((unsigned long *)p->tss.ksp)[6];
|
||||||
|
return ((unsigned long *)schedule_frame)[12];
|
||||||
|
}
|
||||||
|
return pc;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
asmlinkage int
|
||||||
|
sys_table (int type, union table *buf, const void *param)
|
||||||
|
{
|
||||||
|
union table tbl;
|
||||||
|
struct sysinfo i;
|
||||||
|
struct task_struct *tsk = NULL;
|
||||||
|
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;
|
||||||
|
memcpy_fromfs (&pid, param, sizeof (pid_t));
|
||||||
|
|
||||||
|
tsk = get_task (pid);
|
||||||
|
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;
|
||||||
|
tbl.swap.pagein = kstat.pswpin;
|
||||||
|
tbl.swap.pageout = kstat.pswpout;
|
||||||
|
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]->utime + task[0]->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:
|
||||||
|
tbl.proc_signal.signal = tsk->signal;
|
||||||
|
tbl.proc_signal.blocked = tsk->blocked;
|
||||||
|
|
||||||
|
if (tsk->sig) {
|
||||||
|
struct sigaction * action = tsk->sig->action;
|
||||||
|
unsigned long sig_ign = 0, sig_caught = 0;
|
||||||
|
unsigned long bit = 1;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < 32; i++) {
|
||||||
|
switch((unsigned long) action->sa_handler) {
|
||||||
|
case 0:
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
sig_ign |= bit;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
sig_caught |= bit;
|
||||||
|
}
|
||||||
|
bit <<= 1;
|
||||||
|
action++;
|
||||||
|
}
|
||||||
|
|
||||||
|
tbl.proc_signal.ignored = sig_ign;
|
||||||
|
tbl.proc_signal.caught = sig_caught;
|
||||||
|
} else {
|
||||||
|
tbl.proc_signal.ignored = 0;
|
||||||
|
tbl.proc_signal.caught = 0;
|
||||||
|
}
|
||||||
|
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->start_mmap;
|
||||||
|
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->utime;
|
||||||
|
tbl.proc_time.stime = tsk->stime;
|
||||||
|
tbl.proc_time.cutime = tsk->cutime;
|
||||||
|
tbl.proc_time.cstime = tsk->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 = tsk->kernel_stack_page ? KSTK_EIP(tsk) : 0;
|
||||||
|
tbl.proc_kernel.keip = tsk->kernel_stack_page ? KSTK_ESP(tsk) : 0;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
memcpy_tofs (buf, &tbl, sizeof (union table));
|
||||||
|
return 0;
|
||||||
|
}
|
1
kernel/table20/version.h
Normal file
1
kernel/table20/version.h
Normal file
@@ -0,0 +1 @@
|
|||||||
|
#define _TABLE_VERSION 1
|
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
|
@@ -32,3 +32,4 @@ sysinfo.lo
|
|||||||
uptime.lo
|
uptime.lo
|
||||||
write.lo
|
write.lo
|
||||||
xmalloc.lo
|
xmalloc.lo
|
||||||
|
lib.c
|
||||||
|
@@ -1,17 +1,20 @@
|
|||||||
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 read.c read_data.c \
|
libgtop_la_SOURCES = init.c open.c close.c command.c read.c \
|
||||||
write.c command.c cpu.c mem.c swap.c uptime.c \
|
read_data.c write.c lib.c parameter.c \
|
||||||
loadavg.c shm_limits.c msg_limits.c \
|
sysdeps.c
|
||||||
sem_limits.c proclist.c procstate.c procuid.c \
|
|
||||||
proctime.c procmem.c procsignal.c prockernel.c \
|
BUILT_SOURCES = lib.c
|
||||||
procsegment.c
|
|
||||||
|
lib.c: lib.awk $(top_builddir)/config.h $(top_srcdir)/features.def
|
||||||
|
$(AWK) -f $(srcdir)/lib.awk < $(top_srcdir)/features.def > lib-t
|
||||||
|
mv lib-t lib.c
|
||||||
|
|
||||||
|
EXTRA_DIST = lib.awk
|
||||||
|
|
||||||
|
CLEANFILES = lib.c
|
||||||
|
|
||||||
|
20
lib/close.c
20
lib/close.c
@@ -19,14 +19,30 @@
|
|||||||
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 <glibtop/open.h>
|
||||||
#include <glibtop/close.h>
|
#include <glibtop/close.h>
|
||||||
|
#include <glibtop/command.h>
|
||||||
|
|
||||||
/* Closes pipe to gtop server. */
|
/* Closes server. */
|
||||||
|
|
||||||
void
|
void
|
||||||
glibtop_close (glibtop *server)
|
glibtop_close_r (glibtop *server)
|
||||||
{
|
{
|
||||||
|
switch (server->method) {
|
||||||
|
case GLIBTOP_METHOD_UNIX:
|
||||||
|
case GLIBTOP_METHOD_INET:
|
||||||
|
glibtop_call_l (server, GLIBTOP_CMND_QUIT,
|
||||||
|
0, NULL, 0, NULL);
|
||||||
|
|
||||||
|
if (close (server->socket))
|
||||||
|
glibtop_warn_io ("close");
|
||||||
|
|
||||||
|
break;
|
||||||
|
case GLIBTOP_METHOD_PIPE:
|
||||||
kill (server->pid, SIGKILL);
|
kill (server->pid, SIGKILL);
|
||||||
close (server->input [0]);
|
close (server->input [0]);
|
||||||
close (server->output [1]);
|
close (server->output [1]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -27,28 +27,49 @@
|
|||||||
#include <glibtop/xmalloc.h>
|
#include <glibtop/xmalloc.h>
|
||||||
|
|
||||||
void *
|
void *
|
||||||
glibtop_call__r (glibtop *server, unsigned command, size_t send_size, void *send_buf,
|
glibtop_call_l (glibtop *server, unsigned command, size_t send_size,
|
||||||
size_t recv_size, void *recv_buf)
|
void *send_buf, size_t recv_size, void *recv_buf)
|
||||||
{
|
{
|
||||||
glibtop_command *cmnd;
|
glibtop_command cmnd;
|
||||||
void *ptr;
|
glibtop_response response;
|
||||||
|
|
||||||
glibtop_init__r (&server);
|
glibtop_init_r (&server, 0, 0);
|
||||||
|
|
||||||
cmnd = glibtop_calloc__r (server, 1, 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
|
||||||
cmnd->size = send_size;
|
* send it together with command, so we only need one system call instead
|
||||||
|
* of two. */
|
||||||
|
|
||||||
glibtop_write__r (server, sizeof (glibtop_command), cmnd);
|
if (send_size <= _GLIBTOP_PARAM_SIZE) {
|
||||||
glibtop_write__r (server, send_size, send_buf);
|
memcpy (cmnd.parameter, send_buf, send_size);
|
||||||
glibtop_read__r (server, recv_size, recv_buf);
|
cmnd.size = send_size;
|
||||||
|
} else {
|
||||||
|
cmnd.data_size = send_size;
|
||||||
|
}
|
||||||
|
|
||||||
ptr = glibtop_read_data__r (server);
|
glibtop_write_l (server, sizeof (glibtop_command), &cmnd);
|
||||||
|
|
||||||
glibtop_free__r (server, cmnd);
|
glibtop_read_l (server, sizeof (glibtop_response), &response);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
fprintf (stderr, "RESPONSE: %lu - %d\n",
|
||||||
|
response.offset, response.data_size);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (recv_buf)
|
||||||
|
memcpy (recv_buf, ((char *) &response) + response.offset,
|
||||||
|
recv_size);
|
||||||
|
|
||||||
|
if (response.data_size) {
|
||||||
|
void *ptr = glibtop_malloc_r (server, response.data_size);
|
||||||
|
|
||||||
|
glibtop_read_l (server, response.data_size, ptr);
|
||||||
|
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
179
lib/init.c
179
lib/init.c
@@ -20,20 +20,191 @@
|
|||||||
Boston, MA 02111-1307, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <glibtop.h>
|
#include <glibtop.h>
|
||||||
#include <glibtop/open.h>
|
#include <glibtop/xmalloc.h>
|
||||||
|
#include <glibtop/parameter.h>
|
||||||
|
|
||||||
|
#ifndef DEFAULT_PORT
|
||||||
|
#define DEFAULT_PORT 42800
|
||||||
|
#endif
|
||||||
|
|
||||||
static glibtop _glibtop_global_server;
|
static glibtop _glibtop_global_server;
|
||||||
glibtop *glibtop_global_server = NULL;
|
glibtop *glibtop_global_server = &_glibtop_global_server;
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
_init_server (glibtop *server, const unsigned features)
|
||||||
|
{
|
||||||
|
char *command, *temp;
|
||||||
|
|
||||||
|
/* Try to get server command, but don't override if already
|
||||||
|
* set via glibtop_set_parameter () */
|
||||||
|
|
||||||
|
if (server->server_command == NULL) {
|
||||||
|
const char *temp = getenv ("LIBGTOP_SERVER") ?
|
||||||
|
getenv ("LIBGTOP_SERVER") : LIBGTOP_SERVER;
|
||||||
|
|
||||||
|
server->server_command = glibtop_strdup_r (server, temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (server->server_rsh == NULL) {
|
||||||
|
const char *temp = getenv ("LIBGTOP_RSH") ?
|
||||||
|
getenv ("LIBGTOP_RSH") : "/usr/bin/ssh";
|
||||||
|
|
||||||
|
server->server_rsh = glibtop_strdup_r (server, temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Try to get server method, but don't override if already
|
||||||
|
* set via glibtop_set_parameter () */
|
||||||
|
|
||||||
|
if (server->method) return;
|
||||||
|
|
||||||
|
/* If server->command doesn't start with a colon, then it is
|
||||||
|
* the full pathname of the server executable. */
|
||||||
|
|
||||||
|
if (server->server_command [0] != ':') {
|
||||||
|
if (features & glibtop_server_features) {
|
||||||
|
/* We really need the server. */
|
||||||
|
server->method = GLIBTOP_METHOD_PIPE;
|
||||||
|
} else {
|
||||||
|
/* Fine. No server is needed, so we call the
|
||||||
|
* sysdeps functions directly. */
|
||||||
|
server->method = GLIBTOP_METHOD_DIRECT;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* If the first character of 'server_command' is a colon,
|
||||||
|
* the first field is the method to connect to the server. */
|
||||||
|
|
||||||
|
/* Everything up to the next colon is the method. */
|
||||||
|
|
||||||
|
command = glibtop_strdup_r (server, server->server_command+1);
|
||||||
|
temp = strstr (command, ":");
|
||||||
|
if (temp) *temp = 0;
|
||||||
|
|
||||||
|
/* Dispatch method. */
|
||||||
|
|
||||||
|
if (!strcmp (command, "direct")) {
|
||||||
|
/* Use sysdeps dir instead of connecting to server
|
||||||
|
* even if using the server would be required on
|
||||||
|
* the current system. */
|
||||||
|
server->method = GLIBTOP_METHOD_DIRECT;
|
||||||
|
|
||||||
|
} else if (!strcmp (command, "inet")) {
|
||||||
|
|
||||||
|
server->method = GLIBTOP_METHOD_INET;
|
||||||
|
|
||||||
|
/* Connect to internet server. */
|
||||||
|
|
||||||
|
if (temp == NULL) {
|
||||||
|
/* If no value was set, we use 'localhost'. */
|
||||||
|
if (server->server_host == NULL)
|
||||||
|
server->server_host = glibtop_strdup_r
|
||||||
|
(server, "localhost");
|
||||||
|
} else {
|
||||||
|
char *temp2 = strstr (temp+1, ":");
|
||||||
|
if (temp2) *temp2 = 0;
|
||||||
|
|
||||||
|
/* Override default. */
|
||||||
|
if (server->server_host)
|
||||||
|
glibtop_free_r (server, (char *) server->server_host);
|
||||||
|
|
||||||
|
server->server_host = glibtop_strdup_r
|
||||||
|
(server, temp+1);
|
||||||
|
|
||||||
|
temp = temp2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (temp == NULL) {
|
||||||
|
/* If no value was set, we use DEFAULT_PORT. */
|
||||||
|
if (server->server_port == 0)
|
||||||
|
server->server_port = DEFAULT_PORT;
|
||||||
|
} else {
|
||||||
|
char *temp2 = strstr (temp+1, ":");
|
||||||
|
if (temp2) *temp2 = 0;
|
||||||
|
|
||||||
|
if (sscanf (temp+1, "%ld", &server->server_port) != 1)
|
||||||
|
server->server_port = DEFAULT_PORT;
|
||||||
|
|
||||||
|
temp = temp2 ? temp2 + 1 : temp2;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (!strcmp (command, "unix")) {
|
||||||
|
|
||||||
|
/* Connect to unix domain socket. */
|
||||||
|
server->method = GLIBTOP_METHOD_UNIX;
|
||||||
|
|
||||||
|
} else if (!strcmp (command, "pipe")) {
|
||||||
|
|
||||||
|
/* Open pipe to server. */
|
||||||
|
server->method = GLIBTOP_METHOD_PIPE;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
glibtop_error_r (server, "Unknown server method '%s'",
|
||||||
|
server->server_command+1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
glibtop_free_r (server, command);
|
||||||
|
}
|
||||||
|
|
||||||
glibtop *
|
glibtop *
|
||||||
glibtop_init__r (glibtop **server)
|
glibtop_init_r (glibtop **server_ptr, const unsigned long features,
|
||||||
|
const unsigned flags)
|
||||||
|
{
|
||||||
|
glibtop *server;
|
||||||
|
|
||||||
|
if (server_ptr == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (*server_ptr == NULL)
|
||||||
|
*server_ptr = glibtop_global_server;
|
||||||
|
|
||||||
|
server = *server_ptr;
|
||||||
|
|
||||||
|
/* Should we do the initialization? */
|
||||||
|
|
||||||
|
if (flags & GLIBTOP_INIT_NO_INIT)
|
||||||
|
return server;
|
||||||
|
|
||||||
|
/* Do the initialization, but only if not already initialized. */
|
||||||
|
|
||||||
|
if ((server->flags & _GLIBTOP_INIT_STATE_INIT) == 0) {
|
||||||
|
_init_server (server, features);
|
||||||
|
|
||||||
|
server->flags |= _GLIBTOP_INIT_STATE_INIT;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Should we open the server? */
|
||||||
|
|
||||||
|
if (flags & GLIBTOP_INIT_NO_OPEN)
|
||||||
|
return server;
|
||||||
|
|
||||||
|
/* Open server, but only if not already opened. */
|
||||||
|
|
||||||
|
if ((server->flags & _GLIBTOP_INIT_STATE_OPEN) == 0)
|
||||||
|
glibtop_open_l (glibtop_global_server, "glibtop",
|
||||||
|
features, flags);
|
||||||
|
|
||||||
|
return server;
|
||||||
|
}
|
||||||
|
|
||||||
|
glibtop *
|
||||||
|
glibtop_init_s (glibtop **server, const unsigned long features,
|
||||||
|
const unsigned flags)
|
||||||
{
|
{
|
||||||
if (*server != NULL)
|
if (*server != NULL)
|
||||||
return *server;
|
return *server;
|
||||||
|
|
||||||
|
fprintf (stderr, "DEBUG: %s (%d)\n", __FILE__, __LINE__);
|
||||||
|
|
||||||
if (glibtop_global_server == NULL) {
|
if (glibtop_global_server == NULL) {
|
||||||
glibtop_global_server = &_glibtop_global_server;
|
glibtop_global_server = &_glibtop_global_server;
|
||||||
glibtop_open (glibtop_global_server, "glibtop");
|
glibtop_open_s (glibtop_global_server, "glibtop",
|
||||||
|
features, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
return *server = glibtop_global_server;
|
return *server = glibtop_global_server;
|
||||||
|
97
lib/lib.awk
Normal file
97
lib/lib.awk
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
BEGIN {
|
||||||
|
print "/* lib.c */";
|
||||||
|
print "/* This is a generated file. Please modify `lib.awk' */";
|
||||||
|
print "";
|
||||||
|
|
||||||
|
print "#include <glibtop.h>";
|
||||||
|
print "#include <glibtop/open.h>";
|
||||||
|
print "#include <glibtop/sysdeps.h>";
|
||||||
|
print "#include <glibtop/command.h>";
|
||||||
|
|
||||||
|
print "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function output(line) {
|
||||||
|
split (line, line_fields, /\|/);
|
||||||
|
retval = line_fields[1];
|
||||||
|
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 {
|
||||||
|
if (param_size == "")
|
||||||
|
param_size = "sizeof ("param_typ")";
|
||||||
|
|
||||||
|
if (param_typ ~ /*/)
|
||||||
|
param_ptr = param;
|
||||||
|
else
|
||||||
|
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 "{";
|
||||||
|
print "\tglibtop_init_r (&server, (1 << GLIBTOP_SYSDEPS_"toupper(feature)"), 0);";
|
||||||
|
print "";
|
||||||
|
print "\tif ((server->flags & _GLIBTOP_INIT_STATE_SERVER) &&";
|
||||||
|
print "\t (server->features & (1 << GLIBTOP_SYSDEPS_"toupper(feature)")))";
|
||||||
|
print "\t{";
|
||||||
|
|
||||||
|
if (param == "")
|
||||||
|
print "\t\t"prefix"glibtop_call_l (server, GLIBTOP_CMND_"toupper(feature)", 0, NULL,";
|
||||||
|
else
|
||||||
|
print "\t\t"prefix"glibtop_call_l (server, GLIBTOP_CMND_"toupper(feature)",";
|
||||||
|
|
||||||
|
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 "}";
|
||||||
|
print "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/^[^#]/ { output($0) }
|
||||||
|
|
137
lib/open.c
137
lib/open.c
@@ -19,42 +19,157 @@
|
|||||||
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 <glibtop/open.h>
|
#include <glibtop/open.h>
|
||||||
|
#include <glibtop/sysdeps.h>
|
||||||
|
#include <glibtop/command.h>
|
||||||
|
#include <glibtop/xmalloc.h>
|
||||||
|
|
||||||
|
#include <glibtop/gnuserv.h>
|
||||||
|
|
||||||
/* Opens pipe to gtop server. Returns 0 on success and -1 on error. */
|
/* Opens pipe to gtop server. Returns 0 on success and -1 on error. */
|
||||||
|
|
||||||
void
|
void
|
||||||
glibtop_open (glibtop *server, const char *program_name)
|
glibtop_open_l (glibtop *server, const char *program_name,
|
||||||
|
const unsigned long features, const unsigned flags)
|
||||||
{
|
{
|
||||||
char version [BUFSIZ], buffer [BUFSIZ];
|
char version [BUFSIZ], buffer [BUFSIZ];
|
||||||
|
int connect_type;
|
||||||
memset (server, 0, sizeof (glibtop));
|
unsigned nbytes;
|
||||||
|
|
||||||
server->name = program_name;
|
server->name = program_name;
|
||||||
|
|
||||||
|
/* It is important to set _GLIBTOP_INIT_STATE_OPEN here when we
|
||||||
|
* do recursive calls to glibtop_init_r (). */
|
||||||
|
|
||||||
|
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) {
|
||||||
|
case GLIBTOP_METHOD_DIRECT:
|
||||||
|
server->features = 0;
|
||||||
|
break;
|
||||||
|
case GLIBTOP_METHOD_INET:
|
||||||
|
fprintf (stderr, "Connecting to '%s' port %ld.\n",
|
||||||
|
server->server_host, server->server_port);
|
||||||
|
|
||||||
|
connect_type = glibtop_make_connection
|
||||||
|
(server->server_host, server->server_port,
|
||||||
|
&server->socket);
|
||||||
|
|
||||||
|
fprintf (stderr, "Connect Type is %d.\n", connect_type);
|
||||||
|
|
||||||
|
server->flags |= _GLIBTOP_INIT_STATE_SERVER;
|
||||||
|
|
||||||
|
server->features = -1;
|
||||||
|
break;
|
||||||
|
case GLIBTOP_METHOD_UNIX:
|
||||||
|
fprintf (stderr, "Connecting to Unix Domain Socket.\n");
|
||||||
|
|
||||||
|
connect_type = glibtop_make_connection
|
||||||
|
("unix", 0, &server->socket);
|
||||||
|
|
||||||
|
fprintf (stderr, "Connect Type is %d.\n", connect_type);
|
||||||
|
|
||||||
|
server->flags |= _GLIBTOP_INIT_STATE_SERVER;
|
||||||
|
|
||||||
|
server->features = -1;
|
||||||
|
break;
|
||||||
|
case GLIBTOP_METHOD_PIPE:
|
||||||
|
fprintf (stderr, "Opening pipe to server (%s).\n",
|
||||||
|
LIBGTOP_SERVER);
|
||||||
|
|
||||||
if (pipe (server->input) || pipe (server->output))
|
if (pipe (server->input) || pipe (server->output))
|
||||||
glibtop_error__r (server, _("cannot make a pipe: %s\n"), strerror (errno));
|
glibtop_error_io_r (server, "cannot make a pipe");
|
||||||
|
|
||||||
server->pid = fork ();
|
server->pid = fork ();
|
||||||
|
|
||||||
if (server->pid < 0) {
|
if (server->pid < 0) {
|
||||||
glibtop_error__r (server, _("%s: fork failed: %s\n"), strerror (errno));
|
glibtop_error_io_r (server, "fork failed");
|
||||||
} else if (server->pid == 0) {
|
} else if (server->pid == 0) {
|
||||||
close (0); close (1); /* close (2); */
|
close (0); close (1);
|
||||||
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], 2); */
|
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)",
|
||||||
|
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__r (server, strlen (version), buffer);
|
glibtop_read_l (server, sizeof (nbytes), &nbytes);
|
||||||
|
|
||||||
|
if (nbytes != strlen (version))
|
||||||
|
glibtop_error_r (server, "Requested %u bytes but got %u",
|
||||||
|
strlen (version), nbytes);
|
||||||
|
|
||||||
|
glibtop_read_l (server, nbytes, buffer);
|
||||||
|
|
||||||
if (memcmp (version, buffer, strlen (version)))
|
if (memcmp (version, buffer, strlen (version)))
|
||||||
glibtop_error__r (server, _("server version is not %s"), VERSION);
|
glibtop_error_r (server, "server version is not %s",
|
||||||
|
LIBGTOP_VERSION);
|
||||||
|
|
||||||
|
server->flags |= _GLIBTOP_INIT_STATE_SERVER;
|
||||||
|
|
||||||
|
server->features = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If the server has been started, ask it for its features. */
|
||||||
|
|
||||||
|
if (server->flags & _GLIBTOP_INIT_STATE_SERVER) {
|
||||||
|
glibtop_sysdeps sysdeps;
|
||||||
|
|
||||||
|
glibtop_call_l (server, GLIBTOP_CMND_SYSDEPS, 0, NULL,
|
||||||
|
sizeof (glibtop_sysdeps), &sysdeps);
|
||||||
|
|
||||||
|
server->features = sysdeps.features;
|
||||||
|
|
||||||
|
fprintf (stderr, "Server features are %lu.\n",
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
|
80
lib/parameter.c
Normal file
80
lib/parameter.c
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
/* $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.h>
|
||||||
|
#include <glibtop/parameter.h>
|
||||||
|
|
||||||
|
#define _write_data(ptr,size) \
|
||||||
|
if ((data_ptr == NULL) || (data_size < size)) return -size; \
|
||||||
|
if (ptr == NULL) { strcpy (data_ptr, ""); return 1; } \
|
||||||
|
memcpy (data_ptr, ptr, size); \
|
||||||
|
return size;
|
||||||
|
|
||||||
|
#define _check_data(size) \
|
||||||
|
if ((data_ptr == NULL) || (data_size != size)) { \
|
||||||
|
glibtop_error_r (server, "glibtop_set_parameter (%d): " \
|
||||||
|
"Expected %lu bytes but got %lu.", \
|
||||||
|
parameter, size, data_size); \
|
||||||
|
return; \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define _strlen(ptr) (ptr ? strlen (ptr) : 0)
|
||||||
|
|
||||||
|
size_t
|
||||||
|
glibtop_get_parameter_l (glibtop *server, const unsigned parameter,
|
||||||
|
void *data_ptr, size_t data_size)
|
||||||
|
{
|
||||||
|
switch (parameter) {
|
||||||
|
case GLIBTOP_PARAM_METHOD:
|
||||||
|
_write_data (&server->method,
|
||||||
|
sizeof (server->method));
|
||||||
|
case GLIBTOP_PARAM_FEATURES:
|
||||||
|
_write_data (&server->features,
|
||||||
|
sizeof (server->features));
|
||||||
|
case GLIBTOP_PARAM_COMMAND:
|
||||||
|
_write_data (server->server_command,
|
||||||
|
_strlen(server->server_command));
|
||||||
|
case GLIBTOP_PARAM_HOST:
|
||||||
|
_write_data (server->server_host,
|
||||||
|
_strlen(server->server_host));
|
||||||
|
case GLIBTOP_PARAM_PORT:
|
||||||
|
_write_data (&server->server_port,
|
||||||
|
sizeof (server->server_port));
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
glibtop_set_parameter_l (glibtop *server, const unsigned parameter,
|
||||||
|
const void *data_ptr, size_t data_size)
|
||||||
|
{
|
||||||
|
switch (parameter) {
|
||||||
|
case GLIBTOP_PARAM_METHOD:
|
||||||
|
_check_data (sizeof (server->method));
|
||||||
|
memcpy (&server->method, data_ptr, data_size);
|
||||||
|
break;
|
||||||
|
case GLIBTOP_PARAM_FEATURES:
|
||||||
|
_check_data (sizeof (server->features));
|
||||||
|
memcpy (&server->features, data_ptr, data_size);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
@@ -1,35 +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.h>
|
|
||||||
#include <glibtop/prockernel.h>
|
|
||||||
#include <glibtop/command.h>
|
|
||||||
|
|
||||||
/* Provides detailed information about a process. */
|
|
||||||
|
|
||||||
void
|
|
||||||
glibtop_get_proc_kernel__r (glibtop *server, glibtop_proc_kernel *buf,
|
|
||||||
pid_t pid)
|
|
||||||
{
|
|
||||||
glibtop_init__r (&server);
|
|
||||||
glibtop_call__r (server, GLIBTOP_CMND_PROC_KERNEL, sizeof (pid_t),
|
|
||||||
&pid, sizeof (glibtop_proc_kernel), buf);
|
|
||||||
}
|
|
@@ -1,32 +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/proclist.h>
|
|
||||||
#include <glibtop/command.h>
|
|
||||||
|
|
||||||
/* Fetch list of currently running processes. */
|
|
||||||
|
|
||||||
unsigned *
|
|
||||||
glibtop_get_proclist__r (glibtop *server, glibtop_proclist *buf)
|
|
||||||
{
|
|
||||||
glibtop_init__r (&server);
|
|
||||||
return glibtop_call__r (server, GLIBTOP_CMND_PROCLIST, 0, NULL, sizeof (glibtop_proclist), buf);
|
|
||||||
}
|
|
53
lib/read.c
53
lib/read.c
@@ -23,19 +23,48 @@
|
|||||||
|
|
||||||
/* Reads some data from server. */
|
/* Reads some data from server. */
|
||||||
|
|
||||||
void
|
static void
|
||||||
glibtop_read__r (glibtop *server, size_t size, void *buf)
|
do_read (int s, void *ptr, size_t total_size)
|
||||||
{
|
{
|
||||||
size_t ssize;
|
int nread;
|
||||||
|
size_t already_read = 0, remaining = total_size;
|
||||||
|
|
||||||
glibtop_init__r (&server);
|
while (already_read < total_size) {
|
||||||
|
nread = recv (s, ptr, remaining, 0);
|
||||||
|
|
||||||
if (read (server->input [0], &ssize, sizeof (size_t)) < 0)
|
if (nread == 0) {
|
||||||
glibtop_error__r (server, _("read size: %s"), strerror (errno));
|
close (s);
|
||||||
|
continue;
|
||||||
if (size != ssize)
|
}
|
||||||
glibtop_error__r (server, _("got %d bytes but requested %d"), ssize, size);
|
|
||||||
|
if (nread <= 0) {
|
||||||
if (read (server->input [0], buf, size) < 0)
|
glibtop_error_io ("recv");
|
||||||
glibtop_error__r (server, _("read %d bytes: %s"), size, strerror (errno));
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
already_read += nread;
|
||||||
|
remaining -= nread;
|
||||||
|
(char *) ptr += nread;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
glibtop_read_l (glibtop *server, size_t size, void *buf)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
glibtop_init_r (&server, 0, 0);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
fprintf (stderr, "LIBRARY: really reading %d bytes.\n", size);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (server->socket) {
|
||||||
|
do_read (server->socket, buf, size);
|
||||||
|
} else {
|
||||||
|
ret = read (server->input [0], buf, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ret < 0)
|
||||||
|
glibtop_error_io_r (server, _("read %d bytes"), size);
|
||||||
}
|
}
|
||||||
|
@@ -25,24 +25,43 @@
|
|||||||
/* Reads some data from server. */
|
/* Reads some data from server. */
|
||||||
|
|
||||||
void *
|
void *
|
||||||
glibtop_read_data__r (glibtop *server)
|
glibtop_read_data_l (glibtop *server)
|
||||||
{
|
{
|
||||||
size_t size;
|
size_t size;
|
||||||
void *ptr;
|
void *ptr;
|
||||||
|
int ret;
|
||||||
|
|
||||||
glibtop_init__r (&server);
|
glibtop_init_r (&server, 0, 0);
|
||||||
|
|
||||||
if (read (server->input [0], &size, sizeof (size_t)) < 0)
|
#ifdef DEBUG
|
||||||
glibtop_error__r (server, _("read data size: %s"), strerror (errno));
|
fprintf (stderr, "LIBRARY: reading %d data bytes.\n", sizeof (size_t));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (server->socket) {
|
||||||
|
ret = recv (server->socket, &size, sizeof (size_t), 0);
|
||||||
|
} else {
|
||||||
|
ret = read (server->input [0], &size, sizeof (size_t));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ret < 0)
|
||||||
|
glibtop_error_io_r (server, _("read data size"));
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
fprintf (stderr, "LIBRARY: really reading %d data bytes (ret = %d).\n", size, ret);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!size) return NULL;
|
if (!size) return NULL;
|
||||||
|
|
||||||
fprintf (stderr, "Server has %d bytes of data.\n", size);
|
ptr = glibtop_malloc_r (server, size);
|
||||||
|
|
||||||
ptr = glibtop_malloc__r (server, size);
|
if (server->socket) {
|
||||||
|
ret = recv (server->socket, ptr, size, 0);
|
||||||
|
} else {
|
||||||
|
ret = read (server->input [0], ptr, size);
|
||||||
|
}
|
||||||
|
|
||||||
if (read (server->input [0], ptr, size) < 0)
|
if (ret < 0)
|
||||||
glibtop_error__r (server, _("read data %d bytes: %s"), size, strerror (errno));
|
glibtop_error_io_r (server, _("read data %d bytes"));
|
||||||
|
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,3 @@
|
|||||||
/* $Id$ */
|
|
||||||
|
|
||||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
This file is part of the Gnome Top Library.
|
This file is part of the Gnome Top Library.
|
||||||
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
|
||||||
@@ -19,14 +17,84 @@
|
|||||||
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 <glibtop/union.h>
|
||||||
#include <glibtop/sysdeps.h>
|
#include <glibtop/sysdeps.h>
|
||||||
#include <glibtop/command.h>
|
|
||||||
|
const unsigned long glibtop_server_features =
|
||||||
|
GLIBTOP_SUID_CPU +
|
||||||
|
GLIBTOP_SUID_MEM +
|
||||||
|
GLIBTOP_SUID_SWAP +
|
||||||
|
GLIBTOP_SUID_UPTIME +
|
||||||
|
GLIBTOP_SUID_LOADAVG +
|
||||||
|
GLIBTOP_SUID_SHM_LIMITS +
|
||||||
|
GLIBTOP_SUID_MSG_LIMITS +
|
||||||
|
GLIBTOP_SUID_SEM_LIMITS +
|
||||||
|
GLIBTOP_SUID_PROCLIST +
|
||||||
|
GLIBTOP_SUID_PROC_STATE +
|
||||||
|
GLIBTOP_SUID_PROC_UID +
|
||||||
|
GLIBTOP_SUID_PROC_MEM +
|
||||||
|
GLIBTOP_SUID_PROC_TIME +
|
||||||
|
GLIBTOP_SUID_PROC_SIGNAL +
|
||||||
|
GLIBTOP_SUID_PROC_KERNEL +
|
||||||
|
GLIBTOP_SUID_PROC_SEGMENT;
|
||||||
|
|
||||||
/* Checks which features are implemented. */
|
/* Checks which features are implemented. */
|
||||||
|
|
||||||
void
|
void
|
||||||
glibtop_get_sysdeps__r (glibtop *server, glibtop_sysdeps *buf)
|
glibtop_get_sysdeps_r (glibtop *server, glibtop_sysdeps *buf)
|
||||||
{
|
{
|
||||||
glibtop_init__r (&server);
|
glibtop_union data;
|
||||||
glibtop_call__r (server, GLIBTOP_CMND_SYSDEPS, 0, NULL, sizeof (glibtop_sysdeps), buf);
|
|
||||||
|
memset (buf, 0, sizeof (glibtop_sysdeps));
|
||||||
|
|
||||||
|
buf->features = glibtop_server_features;
|
||||||
|
|
||||||
|
/* Call all system dependent functions to check which values
|
||||||
|
* they return. */
|
||||||
|
|
||||||
|
glibtop_get_cpu_l (server, &data.cpu);
|
||||||
|
buf->cpu = data.cpu.flags;
|
||||||
|
|
||||||
|
glibtop_get_mem_l (server, &data.mem);
|
||||||
|
buf->mem = data.mem.flags;
|
||||||
|
|
||||||
|
glibtop_get_swap_l (server, &data.swap);
|
||||||
|
buf->swap = data.swap.flags;
|
||||||
|
|
||||||
|
glibtop_get_uptime_l (server, &data.uptime);
|
||||||
|
buf->uptime = data.uptime.flags;
|
||||||
|
|
||||||
|
glibtop_get_loadavg_l (server, &data.loadavg);
|
||||||
|
buf->loadavg = data.loadavg.flags;
|
||||||
|
|
||||||
|
glibtop_get_shm_limits_l (server, &data.shm_limits);
|
||||||
|
buf->shm_limits = data.shm_limits.flags;
|
||||||
|
|
||||||
|
glibtop_get_msg_limits_l (server, &data.msg_limits);
|
||||||
|
buf->msg_limits = data.msg_limits.flags;
|
||||||
|
|
||||||
|
glibtop_get_sem_limits_l (server, &data.sem_limits);
|
||||||
|
buf->sem_limits = data.sem_limits.flags;
|
||||||
|
|
||||||
|
glibtop_get_proclist_l (server, &data.proclist);
|
||||||
|
buf->proclist = data.proclist.flags;
|
||||||
|
|
||||||
|
glibtop_get_proc_state_l (server, &data.proc_state, 0);
|
||||||
|
buf->proc_state = data.proc_state.flags;
|
||||||
|
|
||||||
|
glibtop_get_proc_uid_l (server, &data.proc_uid, 0);
|
||||||
|
buf->proc_uid = data.proc_uid.flags;
|
||||||
|
|
||||||
|
glibtop_get_proc_mem_l (server, &data.proc_mem, 0);
|
||||||
|
buf->proc_mem = data.proc_mem.flags;
|
||||||
|
|
||||||
|
glibtop_get_proc_time_l (server, &data.proc_time, 0);
|
||||||
|
buf->proc_time = data.proc_time.flags;
|
||||||
|
|
||||||
|
glibtop_get_proc_kernel_l (server, &data.proc_kernel, 0);
|
||||||
|
buf->proc_kernel = data.proc_kernel.flags;
|
||||||
|
|
||||||
|
glibtop_get_proc_segment_l (server, &data.proc_segment, 0);
|
||||||
|
buf->proc_segment = data.proc_segment.flags;
|
||||||
}
|
}
|
||||||
|
23
lib/write.c
23
lib/write.c
@@ -24,15 +24,24 @@
|
|||||||
/* Writes some data to server. */
|
/* Writes some data to server. */
|
||||||
|
|
||||||
void
|
void
|
||||||
glibtop_write__r (glibtop *server, size_t size, void *buf)
|
glibtop_write_l (glibtop *server, size_t size, void *buf)
|
||||||
{
|
{
|
||||||
glibtop_init__r (&server);
|
int ret;
|
||||||
|
|
||||||
if (write (server->output [1], &size, sizeof (size_t)) < 0)
|
glibtop_init_r (&server, 0, 0);
|
||||||
glibtop_error__r (server, _("write size: %s"), strerror (errno));
|
|
||||||
|
|
||||||
if (!size) return;
|
if (size == 0) return;
|
||||||
|
|
||||||
if (write (server->output [1], buf, size) < 0)
|
#ifdef DEBUG
|
||||||
glibtop_error__r (server, _("write %d bytes: %s"), size, strerror (errno));
|
fprintf (stderr, "LIBRARY: really writing %d bytes.\n", size);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (server->socket) {
|
||||||
|
ret = send (server->socket, buf, size, 0);
|
||||||
|
} else {
|
||||||
|
ret = write (server->output [1], buf, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ret < 0)
|
||||||
|
glibtop_error_io_r (server, _("write %d bytes"), size);
|
||||||
}
|
}
|
||||||
|
81
libgtop.spec
Normal file
81
libgtop.spec
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
# Note that this is NOT a relocatable package
|
||||||
|
%define ver 0.01
|
||||||
|
%define rel SNAP
|
||||||
|
%define prefix /usr
|
||||||
|
|
||||||
|
Summary: libgtop library
|
||||||
|
Name: libgtop
|
||||||
|
Version: %ver
|
||||||
|
Release: %rel
|
||||||
|
Copyright: LGPL
|
||||||
|
Group: X11/Libraries
|
||||||
|
Source: ftp://ftp.gnome.org/pub/libgtop-%{ver}.tar.gz
|
||||||
|
BuildRoot: /tmp/libgtop-root
|
||||||
|
Packager: Michael Fulbright <msf@redhat.com>
|
||||||
|
URL: http://www.gnome.org
|
||||||
|
Prereq: /sbin/install-info
|
||||||
|
Docdir: %{prefix}/doc
|
||||||
|
|
||||||
|
%description
|
||||||
|
|
||||||
|
A library that fetches
|
||||||
|
information about the running system such as cpu and memory usage,
|
||||||
|
active processes etc. On Linux systems, these information are taken
|
||||||
|
directly from the /proc filesystem.
|
||||||
|
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
|
||||||
|
* Tue Jun 2 1998 Michael Fulbright <msf@redhat.com>
|
||||||
|
|
||||||
|
- first version of the RPM
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%setup
|
||||||
|
|
||||||
|
%build
|
||||||
|
# Needed for snapshot releases.
|
||||||
|
if [ ! -f configure ]; then
|
||||||
|
CFLAGS="$RPM_OPT_FLAGS" ./autogen.sh --prefix=%prefix --disable-libgtop-examples
|
||||||
|
else
|
||||||
|
CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%prefix --disable-libgtop-examples
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$SMP" != "" ]; then
|
||||||
|
(make "MAKE=make -k -j $SMP"; exit 0)
|
||||||
|
make
|
||||||
|
else
|
||||||
|
make
|
||||||
|
fi
|
||||||
|
|
||||||
|
%install
|
||||||
|
rm -rf $RPM_BUILD_ROOT
|
||||||
|
|
||||||
|
make prefix=$RPM_BUILD_ROOT%{prefix} install
|
||||||
|
|
||||||
|
#
|
||||||
|
# msf - remove these as they are really supposed to come from gnome-libs
|
||||||
|
#
|
||||||
|
rm -f $RPM_BUILD_ROOT/%{prefix}/lib/libgnomesupport.a
|
||||||
|
rm -f $RPM_BUILD_ROOT/%{prefix}/lib/libgnomesupport.la
|
||||||
|
rm -f $RPM_BUILD_ROOT/%{prefix}/lib/libgnomesupport.so.0
|
||||||
|
rm -f $RPM_BUILD_ROOT/%{prefix}/lib/libgnomesupport.so.0.0.0
|
||||||
|
|
||||||
|
rm -fr $RPM_BUILD_ROOT/%{prefix}/include/libgtop
|
||||||
|
|
||||||
|
%clean
|
||||||
|
#rm -rf $RPM_BUILD_ROOT
|
||||||
|
|
||||||
|
%post -p /sbin/ldconfig
|
||||||
|
|
||||||
|
%postun -p /sbin/ldconfig
|
||||||
|
|
||||||
|
%files
|
||||||
|
%defattr(-, root, root)
|
||||||
|
|
||||||
|
%doc ANNOUNCE AUTHORS ChangeLog NEWS README README.LATEST copyright.txt doc
|
||||||
|
%{prefix}/bin/*
|
||||||
|
%{prefix}/lib/lib*.so.*
|
||||||
|
%{prefix}/lib/libgtopConf.sh
|
||||||
|
%{prefix}/lib/*a
|
||||||
|
%{prefix}/include/*
|
@@ -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@"
|
||||||
|
111
libproc/Makefile
Normal file
111
libproc/Makefile
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
# Auto-adaptive C library Makefile adapted for libproc, Chuck Blake.
|
||||||
|
# Assumptions are basically that all the .c files in the CWD are modules
|
||||||
|
# for the library and that all .h files are the interface to the library.
|
||||||
|
|
||||||
|
# PROJECT SPECIFIC MACROS
|
||||||
|
NAME = proc
|
||||||
|
|
||||||
|
# INSTALLATION OPTIONS
|
||||||
|
TOPDIR = /usr
|
||||||
|
HDRDIR = $(TOPDIR)/include/$(NAME)# where to put .h files
|
||||||
|
LIBDIR = $(TOPDIR)/lib# where to put library files
|
||||||
|
SHLIBDIR = /lib# where to put shared library files
|
||||||
|
HDROWN = -o root -g root # owner of header files
|
||||||
|
LIBOWN = -o root -g root # owner of library files
|
||||||
|
INSTALL = install
|
||||||
|
|
||||||
|
# COMPILATION OPTIONS
|
||||||
|
CC = gcc -O2 -D_GNU_SOURCE #-ggdb # easy to command-line override
|
||||||
|
CFLAGS = -I.. -Wall
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------#
|
||||||
|
# The rest is the auto-magic section -- highly GNU make dependent #
|
||||||
|
# You should never need to edit this. #
|
||||||
|
# ----------------------------------------------------------------#
|
||||||
|
|
||||||
|
VC_SUF = ,v
|
||||||
|
VC_PFX = RCS/
|
||||||
|
RCSFILES = $(patsubst $(VC_PFX)%$(VC_SUF),%,$(wildcard $(VC_PFX)*$(VC_SUF)))
|
||||||
|
|
||||||
|
# We take the union of RCS files and other files in CWD so that new files do
|
||||||
|
# not need to alter this makefile. 'sort' removes duplicates. This allows the
|
||||||
|
# convenience of compiling and testing new files before the initial check-in.
|
||||||
|
|
||||||
|
SRC = $(sort $(wildcard *.c) $(filter %.c,$(RCSFILES)))
|
||||||
|
HDR = $(sort $(wildcard *.h) $(filter %.h,$(RCSFILES)))
|
||||||
|
|
||||||
|
OBJ = $(SRC:.c=.o)
|
||||||
|
SONAME = lib$(NAME).so.$(LIBVERSION)
|
||||||
|
|
||||||
|
ifeq ($(SHARED),1)
|
||||||
|
CFLAGS += -fpic
|
||||||
|
all: lib$(NAME).a $(SONAME)
|
||||||
|
else
|
||||||
|
all: lib$(NAME).a
|
||||||
|
endif
|
||||||
|
|
||||||
|
lib$(NAME).a: $(OBJ)
|
||||||
|
$(AR) rcs $@ $^
|
||||||
|
|
||||||
|
$(SONAME): $(OBJ)
|
||||||
|
gcc -Wl,-shared -Wl,-soname,$(SONAME) -o $@ $^ -lc
|
||||||
|
ln -sf $(SONAME) lib$(NAME).so
|
||||||
|
|
||||||
|
# AUTOMATIC DEPENDENCY GENERATION -- GCC AND GNUMAKE DEPENDENT
|
||||||
|
|
||||||
|
.depend:
|
||||||
|
$(strip $(CC) $(CFLAGS) -MM -MG $(SRC) > .depend)
|
||||||
|
include .depend
|
||||||
|
|
||||||
|
# INSTALLATION
|
||||||
|
|
||||||
|
install: all
|
||||||
|
if ! [ -d $(HDRDIR) ] ; then mkdir $(HDRDIR) ; fi
|
||||||
|
$(INSTALL) $(HDROWN) $(HDR) $(TOPDIR)/include/$(NAME)
|
||||||
|
$(INSTALL) $(LIBOWN) lib$(NAME).a $(LIBDIR)
|
||||||
|
ifeq ($(SHARED),1)
|
||||||
|
$(INSTALL) $(LIBOWN) $(SONAME) $(SHLIBDIR)
|
||||||
|
ln -sf $(SHLIBDIR)/$(SONAME) $(SHLIBDIR)/lib$(NAME).so
|
||||||
|
ldconfig
|
||||||
|
endif
|
||||||
|
|
||||||
|
# VARIOUS SHORT CUT TARGETS
|
||||||
|
.PHONY: all install dep clean distclean checkout checkclean
|
||||||
|
|
||||||
|
dep: .depend
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(RM) lib$(NAME).* *.o
|
||||||
|
|
||||||
|
distclean: clean
|
||||||
|
$(RM) .depend signames.h
|
||||||
|
|
||||||
|
checkout:
|
||||||
|
$(CO) $(RCSFILES)
|
||||||
|
|
||||||
|
checkclean:
|
||||||
|
$(RM) $(RCSFILES)
|
||||||
|
|
||||||
|
# CUSTOM c -> o rule so that command-line has minimal whitespace
|
||||||
|
|
||||||
|
%.o : %.c
|
||||||
|
$(strip $(CC) $(CFLAGS) -c $<)
|
||||||
|
|
||||||
|
# PROJECT SPECIFIC DEPENDENCIES/BUILD RULES
|
||||||
|
|
||||||
|
|
||||||
|
version.o: version.c version.h
|
||||||
|
ifdef MINORVERSION
|
||||||
|
$(strip $(CC) $(CFLAGS) -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -DMINORVERSION=\"$(MINORVERSION)\" -c version.c)
|
||||||
|
else
|
||||||
|
$(strip $(CC) $(CFLAGS) -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -c version.c)
|
||||||
|
endif
|
||||||
|
|
||||||
|
signals.o : signames.h
|
||||||
|
|
||||||
|
signames.h ../proc/signames.h : /usr/include/signal.h
|
||||||
|
/lib/cpp -dM </usr/include/signal.h | \
|
||||||
|
tr -s '\t ' ' ' | sort -n +2 | sed \
|
||||||
|
's:#define SIG\([A-Z]\+[0-9]*\) \([0-9]\+\) *\(\|/\*.*\)$$:{\
|
||||||
|
\2,"\1" },:p;d' > signames.h
|
||||||
|
|
49
libproc/alloc.c
Normal file
49
libproc/alloc.c
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
/***********************************************************************\
|
||||||
|
* Copyright (C) 1992 by Michael K. Johnson, johnsonm@sunsite.unc.edu *
|
||||||
|
* *
|
||||||
|
* This file is placed under the conditions of the GNU public *
|
||||||
|
* license, version 2, or any later version. See file COPYING *
|
||||||
|
* for information on distribution conditions. *
|
||||||
|
\***********************************************************************/
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
void *xcalloc(void *pointer, int size) {
|
||||||
|
void * ret;
|
||||||
|
if (pointer)
|
||||||
|
free(pointer);
|
||||||
|
if (!(ret = calloc(1, size))) {
|
||||||
|
fprintf(stderr, "xcalloc: allocation error, size = %d\n", size);
|
||||||
|
exit(1);
|
||||||
|
} else {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void *xmalloc(unsigned int size) {
|
||||||
|
void *p;
|
||||||
|
|
||||||
|
if (size == 0)
|
||||||
|
++size;
|
||||||
|
p = malloc(size);
|
||||||
|
if (!p) {
|
||||||
|
fprintf(stderr, "xmalloc: malloc(%d) failed", size);
|
||||||
|
perror(NULL);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
return(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
void *xrealloc(void *oldp, unsigned int size) {
|
||||||
|
void *p;
|
||||||
|
|
||||||
|
if (size == 0)
|
||||||
|
++size;
|
||||||
|
p = realloc(oldp, size);
|
||||||
|
if (!p) {
|
||||||
|
fprintf(stderr, "xrealloc: realloc(%d) failed", size);
|
||||||
|
perror(NULL);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
return(p);
|
||||||
|
}
|
307
libproc/compare.c
Normal file
307
libproc/compare.c
Normal file
@@ -0,0 +1,307 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* Copyright 1994 Charles Blake and Michael K. Johnson
|
||||||
|
* This file is a part of procps, which is distributable
|
||||||
|
* under the conditions of the GNU Public License. See the
|
||||||
|
* file COPYING for details.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <string.h> /* for strcmp */
|
||||||
|
#include <stdio.h> /* for parse error output */
|
||||||
|
#include "readproc.h" /* for proc_t */
|
||||||
|
#include "tree.h" /* for struct tree_node */
|
||||||
|
|
||||||
|
/*
|
||||||
|
This module was written by Charles Blake for procps.
|
||||||
|
|
||||||
|
mult_lvl_cmp:
|
||||||
|
slick general purpose multi-level compare function I invented.
|
||||||
|
sort_depth:
|
||||||
|
the number of levels of functions *to use*. This means many more levels
|
||||||
|
can be defined than mult_lvl_cmp tres out. If this is 1 then mult_lvl_cmp
|
||||||
|
is just a trivial wrapper around (*sort_function[0]).
|
||||||
|
sort_direction:
|
||||||
|
multiplicative factor for the output of cmp_whatever.
|
||||||
|
1 ==> default order, -1 ==> reverse order, 0 ==> forced equality
|
||||||
|
The 0 bit is the neat part. Since a value of zero is the code for equality
|
||||||
|
multiplying the output of cmp_foo(a,b) forces a==b to be true. This is a
|
||||||
|
convenient way to turn sorting off in middle levels of a multi-level sort.
|
||||||
|
If time is a problem, reforming the whole sort_function array to not include
|
||||||
|
these unsorted middle levels will be faster since then cmp_foo won't even
|
||||||
|
be called. It might simplify some code depending upon how you organize it.
|
||||||
|
sort_function[]:
|
||||||
|
array of function pointers that points to our family of comparison functions
|
||||||
|
(I have named them cmp_* but mult_lvl_cmp doesn't care what they're named).
|
||||||
|
This may be declared and initialized like so:
|
||||||
|
int (*sort_function[])(void* a, void* b)={&cmp_foo, &cmp_bar, &cmp_hiho};
|
||||||
|
You could also use my command line '-O' parser below.
|
||||||
|
|
||||||
|
Note that we only descend levels until the order is determined. If we descend
|
||||||
|
all levels, that means that the items are equal at all levels, so we return 0.
|
||||||
|
Otherwise we return whatever the level's cmp_foo function would have returned.
|
||||||
|
This allows whatever default behavior you want for cmp_foo. sort_direction[]
|
||||||
|
reverses this default behavior, but mult_lvl_cmp doesn't decide that ascending
|
||||||
|
or descending is the default. That is the job of your cmp_foo's.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* the only reason these are global is because qsort(3) likes it that way.
|
||||||
|
It's also a little more efficient if mult_lvl_cmp() is called many times.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef int (*cmp_t)(void*,void*); /* for function pointer casts */
|
||||||
|
|
||||||
|
int sort_depth = 0;
|
||||||
|
int sort_direction[10]; /* storage for 10 levels, but 4 would be plenty!*/
|
||||||
|
int (*sort_function[10])(void* a, void* b);
|
||||||
|
|
||||||
|
int mult_lvl_cmp(void* a, void* b) {
|
||||||
|
int i, cmp_val;
|
||||||
|
for(i = 0; i < sort_depth; i++) {
|
||||||
|
cmp_val = sort_direction[i] * (*sort_function[i])(a,b);
|
||||||
|
if (cmp_val != 0)
|
||||||
|
return cmp_val;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int node_mult_lvl_cmp(void* a, void* b) {
|
||||||
|
int i, cmp_val;
|
||||||
|
for(i = 0; i < sort_depth; i++) {
|
||||||
|
cmp_val = sort_direction[i] * (*sort_function[i])(&(((struct tree_node *)a)->proc),&(((struct tree_node *)b)->proc));
|
||||||
|
if (cmp_val != 0)
|
||||||
|
return cmp_val;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* qsort(3) compliant comparison functions for all members of the ps_proc
|
||||||
|
structure (in the same order in which they appear in the proc_t declaration)
|
||||||
|
return is {-1,0,1} as {a<b, a==b, a>b}
|
||||||
|
default ordering is ascending for all members. (flip 1,-1 to reverse)
|
||||||
|
*/
|
||||||
|
/* pre-processor macros to cut down on source size (and typing!)
|
||||||
|
Note the use of the string concatenation operator ##
|
||||||
|
*/
|
||||||
|
#define CMP_STR(NAME) \
|
||||||
|
int cmp_ ## NAME(proc_t** P, proc_t** Q) { \
|
||||||
|
return strcmp((*P)-> ## NAME, (*Q)-> ## NAME); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define CMP_INT(NAME) \
|
||||||
|
int cmp_ ## NAME (proc_t** P, proc_t** Q) { \
|
||||||
|
if ((*P)-> ## NAME < (*Q)-> ## NAME) return -1; \
|
||||||
|
if ((*P)-> ## NAME > (*Q)-> ## NAME) return 1; \
|
||||||
|
return 0; \
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Define the (46!) cmp_ functions with the above macros for every element
|
||||||
|
of proc_t. If the binary gets too big, we could nuke inessentials.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* CMP_STR(cmdline) */
|
||||||
|
CMP_STR(user)
|
||||||
|
CMP_STR(cmd)
|
||||||
|
/* CMP_INT(state) */
|
||||||
|
/* CMP_STR(ttyc) */
|
||||||
|
CMP_INT(uid)
|
||||||
|
CMP_INT(pid)
|
||||||
|
CMP_INT(ppid)
|
||||||
|
CMP_INT(pgrp)
|
||||||
|
CMP_INT(session)
|
||||||
|
CMP_INT(tty)
|
||||||
|
CMP_INT(tpgid)
|
||||||
|
CMP_INT(utime)
|
||||||
|
CMP_INT(stime)
|
||||||
|
CMP_INT(cutime)
|
||||||
|
CMP_INT(cstime)
|
||||||
|
/* CMP_INT(priority) */
|
||||||
|
CMP_INT(nice)
|
||||||
|
CMP_INT(start_time)
|
||||||
|
/* CMP_INT(signal) */
|
||||||
|
/* CMP_INT(blocked) */
|
||||||
|
/* CMP_INT(sigignore) */
|
||||||
|
/* CMP_INT(sigcatch) */
|
||||||
|
CMP_INT(flags)
|
||||||
|
CMP_INT(min_flt)
|
||||||
|
CMP_INT(cmin_flt)
|
||||||
|
CMP_INT(maj_flt)
|
||||||
|
CMP_INT(cmaj_flt)
|
||||||
|
/* CMP_INT(timeout) */
|
||||||
|
CMP_INT(vsize)
|
||||||
|
CMP_INT(rss)
|
||||||
|
/* CMP_INT(rss_rlim) */
|
||||||
|
/* CMP_INT(start_code) */
|
||||||
|
/* CMP_INT(end_code) */
|
||||||
|
/* CMP_INT(start_stack) */
|
||||||
|
/* CMP_INT(kstk_esp) */
|
||||||
|
/* CMP_INT(kstk_eip) */
|
||||||
|
/* CMP_INT(wchan) */
|
||||||
|
CMP_INT(pcpu)
|
||||||
|
CMP_INT(size)
|
||||||
|
CMP_INT(resident)
|
||||||
|
CMP_INT(share)
|
||||||
|
/* CMP_INT(trs) */
|
||||||
|
/* CMP_INT(lrs) */
|
||||||
|
/* CMP_INT(drs) */
|
||||||
|
/* CMP_INT(dt) */
|
||||||
|
|
||||||
|
/* define user interface to sort keys. Fairly self-explanatory. */
|
||||||
|
|
||||||
|
struct cmp_fun_struct {
|
||||||
|
char letter; /* single option-letter for key */
|
||||||
|
char name[15]; /* long option name for key */
|
||||||
|
int (*fun)(proc_t**, proc_t**); /* pointer to cmp_key */
|
||||||
|
} cmp[] = {
|
||||||
|
/* { '?', "cmdline", &cmp_cmdline }, */
|
||||||
|
{ 'u', "user", &cmp_user },
|
||||||
|
{ 'c', "cmd", &cmp_cmd },
|
||||||
|
/* { '?', "state", &cmp_state }, */
|
||||||
|
/* { '?', "ttyc", &cmp_ttyc }, */
|
||||||
|
{ 'U', "uid", &cmp_uid },
|
||||||
|
{ 'p', "pid", &cmp_pid },
|
||||||
|
{ 'P', "ppid", &cmp_ppid },
|
||||||
|
{ 'g', "pgrp", &cmp_pgrp },
|
||||||
|
{ 'o', "session", &cmp_session },
|
||||||
|
{ 't', "tty", &cmp_tty },
|
||||||
|
{ 'G', "tpgid", &cmp_tpgid },
|
||||||
|
{ 'k', "utime", &cmp_utime },
|
||||||
|
{ 'K', "stime", &cmp_stime },
|
||||||
|
{ 'j', "cutime", &cmp_cutime },
|
||||||
|
{ 'J', "cstime", &cmp_cstime },
|
||||||
|
/* { '?', "counter", &cmp_counter }, */
|
||||||
|
{ 'y', "priority", &cmp_nice },
|
||||||
|
{ 'T', "start_time", &cmp_start_time },
|
||||||
|
/* { '?', "signal", &cmp_signal }, */
|
||||||
|
/* { '?', "blocked", &cmp_blocked }, */
|
||||||
|
/* { '?', "sigignore", &cmp_sigignore }, */
|
||||||
|
/* { '?', "sigcatch", &cmp_sigcatch }, */
|
||||||
|
{ 'f', "flags", &cmp_flags },
|
||||||
|
{ 'm', "min_flt", &cmp_min_flt },
|
||||||
|
{ 'n', "cmin_flt", &cmp_cmin_flt },
|
||||||
|
{ 'M', "maj_flt", &cmp_maj_flt },
|
||||||
|
{ 'N', "cmaj_flt", &cmp_cmaj_flt },
|
||||||
|
/* { 'C', "timeout", &cmp_timeout }, */
|
||||||
|
{ 'v', "vsize", &cmp_vsize },
|
||||||
|
{ 'r', "rss", &cmp_rss },
|
||||||
|
/* { '?', "rss_rlim", &cmp_rss_rlim }, */
|
||||||
|
/* { '?', "start_code", &cmp_start_code }, */
|
||||||
|
/* { '?', "end_code", &cmp_end_code }, */
|
||||||
|
/* { '?', "start_stack", &cmp_start_stack }, */
|
||||||
|
/* { '?', "kstk_esp", &cmp_kstk_esp }, */
|
||||||
|
/* { '?', "kstk_eip", &cmp_kstk_eip }, */
|
||||||
|
/* { '?', "wchan", &cmp_wchan }, */
|
||||||
|
{ 'C', "pcpu", &cmp_pcpu },
|
||||||
|
{ 's', "size", &cmp_size },
|
||||||
|
{ 'R', "resident", &cmp_resident },
|
||||||
|
{ 'S', "share", &cmp_share },
|
||||||
|
/* { '?', "trs", &cmp_trs }, */
|
||||||
|
/* { '?', "lrs", &cmp_lrs }, */
|
||||||
|
/* { '?', "drs", &cmp_drs }, */
|
||||||
|
/* { '?', "dt", &cmp_dt }, */
|
||||||
|
{ '\0',"terminator", NULL }
|
||||||
|
};
|
||||||
|
|
||||||
|
void dump_keys(void) {
|
||||||
|
int i;
|
||||||
|
for(i=0; cmp[i].letter; i++)
|
||||||
|
fprintf(stderr, "%s-O%c , --sort:%-15.15s%s",
|
||||||
|
i%2?"":" ",
|
||||||
|
cmp[i].letter, cmp[i].name,
|
||||||
|
i%2?"\n":"");
|
||||||
|
if (i%2)
|
||||||
|
fprintf(stderr, "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* command line option parsing. Assign sort_{depth,direction[],function[]}
|
||||||
|
based upon a string of the form:
|
||||||
|
[+-]a[+-]b[+-]c...
|
||||||
|
with a,b,c,... being letter flags corresponding to a particular sort
|
||||||
|
key and the optional '-' specifying a reverse sort on that key. + doesn't
|
||||||
|
mean anything, but it keeps things looking balanced...
|
||||||
|
*/
|
||||||
|
int parse_sort_opt(char* opt) {
|
||||||
|
int i, next_dir=1;
|
||||||
|
for(; *opt ; ++opt) {
|
||||||
|
if (*opt == '-' || *opt == '+') {
|
||||||
|
if (*opt == '-')
|
||||||
|
next_dir = -1;
|
||||||
|
opt++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for (i = 0; cmp[i].letter; i++)
|
||||||
|
if (*opt == cmp[i].letter)
|
||||||
|
break;
|
||||||
|
if (!cmp[i].letter) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"ps: no such sort key -- %c. Possibilities are:\n", *opt);
|
||||||
|
dump_keys();
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
#ifdef DEBUG
|
||||||
|
fprintf(stderr,
|
||||||
|
"sort level %d: key %s, direction % d\n",
|
||||||
|
sort_depth, cmp[i].name, next_dir);
|
||||||
|
#endif
|
||||||
|
sort_function[sort_depth] = (cmp_t)cmp[i].fun;
|
||||||
|
sort_direction[sort_depth++] = next_dir;
|
||||||
|
next_dir = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int parse_long_sort(char* opt) {
|
||||||
|
char* comma;
|
||||||
|
int i, more_keys, next_dir=1;
|
||||||
|
do {
|
||||||
|
if (*opt == '-' || *opt == '+') {
|
||||||
|
if (*opt == '-')
|
||||||
|
next_dir = -1;
|
||||||
|
more_keys = 1;
|
||||||
|
opt++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
more_keys = ((comma=index(opt,',')) != NULL);
|
||||||
|
/* keys are ',' delimited */
|
||||||
|
if (more_keys)
|
||||||
|
*comma='\0'; /* terminate for strcmp() */
|
||||||
|
for(i = 0; cmp[i].letter; ++i)
|
||||||
|
if (strcmp(opt, cmp[i].name) == 0)
|
||||||
|
break;
|
||||||
|
if (!cmp[i].letter) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"ps: no such sort key -- %s. Possibilities are:\n", opt);
|
||||||
|
dump_keys();
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
#ifdef DEBUG
|
||||||
|
fprintf(stderr,
|
||||||
|
"sort level %d: key %s, direction % d\n",
|
||||||
|
sort_depth, cmp[i].name, next_dir);
|
||||||
|
#endif
|
||||||
|
sort_function[sort_depth] = (cmp_t)cmp[i].fun;
|
||||||
|
sort_direction[sort_depth++] = next_dir;
|
||||||
|
next_dir = 1;
|
||||||
|
}
|
||||||
|
opt = comma + 1; /* do next loop on next key, if more keys, else done*/
|
||||||
|
} while (more_keys);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void reset_sort_options (void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
sort_depth=0;
|
||||||
|
for (i=0;i<10;i++){
|
||||||
|
sort_direction[i]=0;
|
||||||
|
sort_function[i]=(cmp_t)NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void register_sort_function (int dir, cmp_t func)
|
||||||
|
{
|
||||||
|
sort_function[sort_depth] = func;
|
||||||
|
sort_direction[sort_depth++] = dir;
|
||||||
|
}
|
269
libproc/devname.c
Normal file
269
libproc/devname.c
Normal file
@@ -0,0 +1,269 @@
|
|||||||
|
/* device name <-> number map system optimized for rapid, constant time lookup.
|
||||||
|
Copyright Charles Blake, 1996, see COPYING for details.
|
||||||
|
*/
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/mman.h>
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
#define __KERNEL__
|
||||||
|
#include <linux/kdev_t.h>
|
||||||
|
#undef __KERNEL__
|
||||||
|
|
||||||
|
#define DEVDIR "/dev"
|
||||||
|
#define DEVTAB "psdevtab"
|
||||||
|
static char *devtab_paths[] = {
|
||||||
|
"/etc/" DEVTAB,
|
||||||
|
"%s/." DEVTAB,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
#define DEVINITIALMODE 0664
|
||||||
|
#define DEV_MAX_PATH (5+256)
|
||||||
|
#define DEV_NAME_MAX 8
|
||||||
|
|
||||||
|
static dev_t major[] = { 2, 3, 4, 5, 19, 20, 22, 23, 24, 25, 32, 33,
|
||||||
|
46, 47, 48, 49 };
|
||||||
|
#define Nminor 256
|
||||||
|
#define Nmajor (sizeof(major)/sizeof(dev_t))
|
||||||
|
#define Ndev (Nmajor*Nminor)
|
||||||
|
#define Ndevtab (Ndev*DEV_NAME_MAX)
|
||||||
|
|
||||||
|
static char* devtab; /* the memory buffer holding all the name strings */
|
||||||
|
|
||||||
|
/* This macro evaluates to the address into the table of the string of
|
||||||
|
DEV_NAME_MAX chars for the device with major m, minor n. */
|
||||||
|
#define TAB(m,n) (devtab + (m)*(Nminor*DEV_NAME_MAX) + (n)*DEV_NAME_MAX)
|
||||||
|
|
||||||
|
static int devtab_initialized = 0;
|
||||||
|
|
||||||
|
static char* name_to_path(char* name); /* forward declarations */
|
||||||
|
static int init_devtab (void);
|
||||||
|
|
||||||
|
/* Device Name -> Number Map
|
||||||
|
many-to-one: -1 on failed match.
|
||||||
|
*/
|
||||||
|
dev_t name_to_dev(char* name) {
|
||||||
|
static struct stat sbuf;
|
||||||
|
return (stat(name_to_path(name), &sbuf) < 0) ? -1 : sbuf.st_rdev;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* find m in a[] assuming a is sorted into ascending order */
|
||||||
|
/* in-line linear search placeholder until more majors warrant binary search */
|
||||||
|
static __inline__ int lookup(dev_t m, dev_t* a, int n) {
|
||||||
|
int k;
|
||||||
|
for(k=0; k < n && a[k] != m; k++)
|
||||||
|
;
|
||||||
|
return (k < n) ? k : -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Device Number -> Name Map
|
||||||
|
one-to-many: first directory order match in DEVDIR, "" on failed match.
|
||||||
|
*/
|
||||||
|
char* dev_to_name(dev_t num) {
|
||||||
|
static char rval[DEV_NAME_MAX+1];
|
||||||
|
dev_t m = MAJOR(num), n = MINOR(num), tmp;
|
||||||
|
if (!devtab_initialized && !init_devtab())
|
||||||
|
return "";
|
||||||
|
if ((tmp = lookup(m, major, Nmajor)) == (dev_t)-1)
|
||||||
|
return "";
|
||||||
|
strncpy(rval, TAB(tmp,n), DEV_NAME_MAX);
|
||||||
|
rval[DEV_NAME_MAX] = '\0';
|
||||||
|
return rval;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int dev_to_devtab(int);
|
||||||
|
|
||||||
|
static int init_devtab(void) {
|
||||||
|
static struct stat sbuf, lbuf;
|
||||||
|
static int fd;
|
||||||
|
char **fmt, path[64], *HOME = getenv("HOME") ? getenv("HOME") : "";
|
||||||
|
for (fmt = devtab_paths; *fmt; fmt++) {
|
||||||
|
snprintf(path, sizeof path, *fmt, HOME);
|
||||||
|
lbuf.st_ino = 0; /* initialize for test later */
|
||||||
|
if (lstat(path, &lbuf) >= 0 && S_ISLNK(lbuf.st_mode))
|
||||||
|
/* don't follow symlinks */
|
||||||
|
continue;
|
||||||
|
if ( (fd = open(path, O_RDONLY)) < 0 /* open DEVTAB file */
|
||||||
|
|| fstat(fd, &sbuf) < 0 /* fstat it */
|
||||||
|
|| (lbuf.st_ino && (sbuf.st_ino != lbuf.st_ino)) /* race */
|
||||||
|
|| sbuf.st_nlink > 1 /* hardlink attack */
|
||||||
|
|| sbuf.st_size != Ndevtab /* make sure it's the right size */
|
||||||
|
|| (devtab = mmap(0, Ndevtab, PROT_READ, MAP_SHARED, fd, 0)) == (caddr_t) -1
|
||||||
|
|| close(fd) == -1)
|
||||||
|
{ /* could not open for read, attempt to fix/create */
|
||||||
|
int oumsk = umask(0);
|
||||||
|
if (devtab)
|
||||||
|
munmap(devtab, Ndevtab);
|
||||||
|
if (((fd = open(path, O_RDWR|O_TRUNC|O_CREAT, DEVINITIALMODE)) == -1 &&
|
||||||
|
(unlink(path), fd = open(path, O_RDWR|O_TRUNC|O_CREAT, DEVINITIALMODE)) == -1)
|
||||||
|
|| !dev_to_devtab(fd)) {
|
||||||
|
close(fd); /* either both opens failed or the constructor failed */
|
||||||
|
unlink(path); /* in case we created but could not fill a file */
|
||||||
|
umask(oumsk);
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
devtab_initialized = 1;
|
||||||
|
close(fd);
|
||||||
|
umask(oumsk);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return devtab_initialized = 1;
|
||||||
|
}
|
||||||
|
return devtab_initialized;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* stat every file in DEVDIR saving its basename in devtab[] if it has
|
||||||
|
a MAJOR(st_rdev) in our list of majors. return 0 on error otherwise 1. */
|
||||||
|
static int dev_to_devtab(int fd) {
|
||||||
|
static struct stat sbuf;
|
||||||
|
int i;
|
||||||
|
dev_t m;
|
||||||
|
struct dirent* ent;
|
||||||
|
DIR* dev;
|
||||||
|
|
||||||
|
if (!(dev = opendir(DEVDIR))) {
|
||||||
|
fprintf(stderr, "%s: %s\nCannot generate device number -> name mapping.\n",
|
||||||
|
DEVDIR, sys_errlist[errno]);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (!(devtab = malloc(Ndevtab))) {
|
||||||
|
fprintf(stderr, "%s: could not allocate memory\n", sys_errlist[errno]);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
memset((void*)devtab, 0, Ndevtab);
|
||||||
|
while ((ent = readdir(dev))) { /* loop over all dirents in DEVDIR */
|
||||||
|
if (lstat(name_to_path(ent->d_name), &sbuf) < 0
|
||||||
|
|| !S_ISCHR(sbuf.st_mode)) /* only look for char special devs */
|
||||||
|
continue; /* due to overloading of majors */
|
||||||
|
m = MAJOR(sbuf.st_rdev); /* copy name to appropriate spot */
|
||||||
|
if ((i = lookup(m, major, Nmajor)) != -1)
|
||||||
|
strncpy(TAB(i,MINOR(sbuf.st_rdev)), ent->d_name, DEV_NAME_MAX);
|
||||||
|
}
|
||||||
|
closedir(dev);
|
||||||
|
if (write(fd, devtab, Ndevtab) != Ndevtab) /* probably no disk space */
|
||||||
|
return 0;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char path[DEV_MAX_PATH];
|
||||||
|
|
||||||
|
static char* name_to_path(char* name) {
|
||||||
|
static char* Path;
|
||||||
|
if (!Path) {
|
||||||
|
strcpy(path, DEVDIR); /* copy DEVDIR */
|
||||||
|
path[sizeof(DEVDIR) - 1] = '/'; /* change NUL to '/' */
|
||||||
|
Path = path + sizeof(DEVDIR); /* put Path at start of basename */
|
||||||
|
}
|
||||||
|
strncpy(Path, name, DEV_MAX_PATH - sizeof(DEVDIR));
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef TEST_DEVNAME
|
||||||
|
int main(int argc, char** argv) { /* usage: cmd [<major> <minor>|<name>] */
|
||||||
|
dev_t tmp;
|
||||||
|
if (argc < 2) {
|
||||||
|
printf("%s: [ maj min... | name ... ]\n", argv[0]);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (argv[1][0] >= '0' && argv[1][0] <= '9')
|
||||||
|
for(argv++ ; argv[0] && argv[1] ; argv+=2)
|
||||||
|
printf("%s\n", dev_to_name(MKDEV( atoi(argv[0]), atoi(argv[1]) )));
|
||||||
|
else
|
||||||
|
for(argv++ ; *argv ; argv++) {
|
||||||
|
tmp = name_to_dev(*argv);
|
||||||
|
printf("%d, %d\n", MAJOR(tmp), MINOR(tmp));
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
/*
|
||||||
|
Using this program on over 700 files in /dev to perform number->name resolution
|
||||||
|
took well under 300 microsecs per device number pair on a Pentium 90. It is
|
||||||
|
somewhat tough to time because once the 3 pages have been mapped in, the time is
|
||||||
|
almost zero. For things like top, this method may even be faster in the long
|
||||||
|
run. Those interested can gprof it for me. This system has the virtue of being
|
||||||
|
nearly perfectly adaptable to individual systems, self updating when /dev
|
||||||
|
changes and pretty darn fast when it hasn't. It will be slow for users without
|
||||||
|
perms to change the psdevtab file, though. So this is what I decided was
|
||||||
|
reasonable. If the process does not have perms to create or update
|
||||||
|
/etc/psdevtab and it is out of date, we try /tmp/psdevtab. If /tmp/psdevtab is
|
||||||
|
either out of date or unreadable (malicious user creates it and chmods it),
|
||||||
|
$HOME/.psdevtab is used. This secondarily allows for per-user naming of ttys,
|
||||||
|
but is really so that at most one user sees only a single delay per /dev
|
||||||
|
modification.
|
||||||
|
|
||||||
|
To do the timings I did something like this with zsh:
|
||||||
|
a=(`ls -l *(%^@/) | awk '{print $5 $6}' | sed 's/,/ /'`);
|
||||||
|
time ./test $a
|
||||||
|
|
||||||
|
Finally, for lack of a better file for these to be in, I have collected the
|
||||||
|
old algorithmic device number <-> device name mappings.
|
||||||
|
Let m = major device number and n = minor device number satisfy:
|
||||||
|
devno = m<<8 + n , m = devno>>8 , n = devno && 0x00FF, and let
|
||||||
|
char L[32]="pqrstuvwxyzABCDEFGHIJKLMNOPQRSTU", H[16]="01234567890abcdef";
|
||||||
|
DEVICE NUMBERS SPECIAL FILE NAMES
|
||||||
|
OLD SYSTEM (64 pseudoterminal devices):
|
||||||
|
m=4:
|
||||||
|
n=0..63: tty + itoa_dec(n+1)
|
||||||
|
n=128..191: pty + L[(n-128)/16] + H[(n-128)%16]
|
||||||
|
n=192..255: tty + L[(n-192)/16] + H[(n-192)%16]
|
||||||
|
NEW SYSTEM (256/512 pseudoterminal devices):
|
||||||
|
m=2, n: pty + L[n/16] + H[n%16]
|
||||||
|
m=3, n: tty + L[n/16] + H[n%16]
|
||||||
|
m=4, n: tty + itoa_dec(n+1)
|
||||||
|
m=49, n: pty + L[16+n/16] + H[n%16]
|
||||||
|
m=50, n: tty + L[16+n/16] + H[n%16]
|
||||||
|
(THE SAME IN EITHER SYSTEM)
|
||||||
|
CALL-UNIX AND CONTROLLING TERMINAL DEVICES
|
||||||
|
m=5:
|
||||||
|
n=0: tty
|
||||||
|
n=64..128: cua + {'0' + (n-64)}
|
||||||
|
CYCLADES MULTIPORT:
|
||||||
|
m=19, n: ttyC + itoa_hex(n)
|
||||||
|
m=20, n: cub + itoa_hex(n) */
|
||||||
|
|
||||||
|
/* Re-implementation of old interface with the new generic functions. */
|
||||||
|
|
||||||
|
/* This does exactly the same thing as name_to_dev only now a full "ttyXX"
|
||||||
|
specification will work as well.
|
||||||
|
*/
|
||||||
|
int tty_to_dev(char *tty) {
|
||||||
|
static char pref_name_1[32] = "tty", *pnam1 = pref_name_1 + 3,
|
||||||
|
pref_name_2[32] = "cu", *pnam2 = pref_name_2 + 2;
|
||||||
|
dev_t num;
|
||||||
|
if ((num = name_to_dev(tty)) != (dev_t) -1) /* try tty straight up */
|
||||||
|
return num;
|
||||||
|
strncpy(pnam1, tty, 32 - 3); /* try with "tty" prepended */
|
||||||
|
if ((num = name_to_dev(pref_name_1)) != (dev_t) -1)
|
||||||
|
return num;
|
||||||
|
strncpy(pnam2, tty, 32 - 2); /* try with "cu" prepended */
|
||||||
|
if ((num = name_to_dev(pref_name_2)) != (dev_t) -1)
|
||||||
|
return num;
|
||||||
|
return -1; /* no match */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* new abstraction that can maybe be generalized a little better. */
|
||||||
|
char* abbrev_of_tty(char *tty) {
|
||||||
|
static char temp[32]; /* return buf: good only until next call */
|
||||||
|
char *pos = strpbrk(tty, "yu"); /* end of (presumed) prefices: tty*, cu* */
|
||||||
|
temp[0] = 0;
|
||||||
|
if (tty && tty[0] && pos && pos[0] && pos[1])
|
||||||
|
sprintf(temp, "%*.*s", 3, 3, pos + 1);
|
||||||
|
else
|
||||||
|
strncpy(temp, " ? ", 31);
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Do in-place modification of the 4-buffer `tty' based upon `dev' */
|
||||||
|
void dev_to_tty(char *tty, int dev) {
|
||||||
|
char* new = abbrev_of_tty(dev_to_name(dev));
|
||||||
|
strncpy(tty, new, 4);
|
||||||
|
}
|
10
libproc/devname.h
Normal file
10
libproc/devname.h
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
dev_t name_to_dev(char* name);
|
||||||
|
char* dev_to_name(dev_t num);
|
||||||
|
|
||||||
|
dev_t tty_to_dev(char *tty);
|
||||||
|
void dev_to_tty(char *tty, int dev);
|
||||||
|
|
||||||
|
char* abbrev_of_tty(char *tty);
|
252
libproc/ksym.c
Normal file
252
libproc/ksym.c
Normal file
@@ -0,0 +1,252 @@
|
|||||||
|
/* kernel address -> symbol with next lower address. Charles Blake, 1996.
|
||||||
|
* Written to obviate the need for psdatabase initialization based upon kernel
|
||||||
|
* binary formats, etc.
|
||||||
|
*
|
||||||
|
* The basic algorithm is an approximate (intervals split vaguely 50-50) binary
|
||||||
|
* search taking advantage of the fact the System.map is already sorted in
|
||||||
|
* ascending order by the kernel makefile. It needs to assume an average symbol
|
||||||
|
* record length to avoid scanning the entire symbol table, but in practice the
|
||||||
|
* search time does not seem to be especially sensitive to this choice.
|
||||||
|
*
|
||||||
|
* The search could be an exact binary search if the lines of System.map were
|
||||||
|
* padded with blanks to the right. awk '{printf "%8s%2s %-21.21s\n",$1,$2,$3}'
|
||||||
|
* would do the trick for this but either makes the file large or truncates
|
||||||
|
* symbols. The approximate method seems to be plenty fast enough, costing
|
||||||
|
* only about as much as one extra fstat() or so per process.
|
||||||
|
*/
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/mman.h>
|
||||||
|
#include <sys/utsname.h>
|
||||||
|
#include "psdata.h"
|
||||||
|
#include "ps.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
|
#define MAX_ADDR_SZ 32
|
||||||
|
static char *sysmap, *sysmap_last, sysmap_fmt[10];
|
||||||
|
static int sysmap_len, sysmap_mean = 32, sysmap_addrsz;
|
||||||
|
|
||||||
|
/* scan backward in a string no further than address beg looking for c */
|
||||||
|
static char *strchrrev(char *a, char *beg, char c) {
|
||||||
|
if (a)
|
||||||
|
while (--a > beg && *a != c) ;
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* return ptr to the beg of approximately the i-th record */
|
||||||
|
static char *addr_str(int i) {
|
||||||
|
char *guess = sysmap + sysmap_mean * i;
|
||||||
|
if (!i) return sysmap;
|
||||||
|
if (guess - sysmap > sysmap_len - 2) guess = sysmap + sysmap_len - 2;
|
||||||
|
for ( ; *guess != '\n' && guess > sysmap; guess--)
|
||||||
|
;
|
||||||
|
return guess + 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* return ptr to symbol string (\n terminated) given beg of record ptr */
|
||||||
|
static char *sym_put(char *buf, int len, char *addrptr) {
|
||||||
|
char *s;
|
||||||
|
while (*addrptr++ != ' ') ;
|
||||||
|
while (*addrptr++ != ' ') ;
|
||||||
|
strncpy(buf, addrptr, len);
|
||||||
|
for (s = buf; s < buf + len; s++)
|
||||||
|
if (*s == '\n')
|
||||||
|
*s = '\0';
|
||||||
|
buf[len - 1] = '\0';
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Try to open and mmap a single symbol table file and initialize globals */
|
||||||
|
int sysmap_mmap(char *path) {
|
||||||
|
int fd;
|
||||||
|
struct stat sbuf;
|
||||||
|
char *p;
|
||||||
|
if (sysmap) /* do nothing if already mapped */
|
||||||
|
return 1;
|
||||||
|
if ((fd = open(path, O_RDONLY)) < 0
|
||||||
|
|| fstat(fd, &sbuf) < 0
|
||||||
|
|| (sysmap = mmap(0, sbuf.st_size,
|
||||||
|
PROT_READ, MAP_SHARED,
|
||||||
|
fd, 0)) == (caddr_t) -1)
|
||||||
|
{
|
||||||
|
close(fd);
|
||||||
|
sysmap = NULL;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
sysmap_len = sbuf.st_size;
|
||||||
|
sysmap_last = strchrrev(sysmap + sysmap_len - 2, sysmap, '\n') + 1;
|
||||||
|
|
||||||
|
/* Now check first line of sysmap for hex numbers in first column. Note:
|
||||||
|
0x/0X prefixes are disallowed, but easily addable. Capitalization is
|
||||||
|
irrelevant because strncasecmp(3) is used below instead of strncmp. */
|
||||||
|
for (p = sysmap; *p != ' '
|
||||||
|
&& ((*p >= '0' && *p <= '9') ||
|
||||||
|
(*p >= 'A' && *p <= 'F') ||
|
||||||
|
(*p >= 'a' && *p <= 'f'))
|
||||||
|
&& p < sysmap + MAX_ADDR_SZ;
|
||||||
|
p++) /* no-op */ ;
|
||||||
|
if (*p != ' ') { /* uh-oh: cannot understand format */
|
||||||
|
fprintf(stderr, "warning: %s not parseable as a System.map.\n", path);
|
||||||
|
munmap(sysmap, sysmap_len);
|
||||||
|
sysmap = NULL;
|
||||||
|
close(fd);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
sysmap_addrsz = p - sysmap;
|
||||||
|
snprintf(sysmap_fmt, sizeof sysmap_fmt, "%%0%dlx", sysmap_addrsz);
|
||||||
|
close(fd);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* kernel address -> name resolver.
|
||||||
|
returned value is only good until the next call to the function.
|
||||||
|
*/
|
||||||
|
char *sysmap_symbol(unsigned long address) {
|
||||||
|
static char rval[128], *pc, addr[MAX_ADDR_SZ];
|
||||||
|
int i, p, n = sysmap_len / (double)sysmap_mean;
|
||||||
|
|
||||||
|
sprintf(addr, sysmap_fmt, address);
|
||||||
|
p = 0; pc = sysmap;
|
||||||
|
while (n) {
|
||||||
|
i = p + (n >> 1);
|
||||||
|
if (strncasecmp(addr, pc = addr_str(i), sysmap_addrsz) > 0)
|
||||||
|
p = i + 1;
|
||||||
|
n >>= 1;
|
||||||
|
}
|
||||||
|
if (pc == sysmap_last) /* scan forward but not past end */
|
||||||
|
return sym_put(rval, sizeof rval, pc);
|
||||||
|
while (strncasecmp(addr, pc, sysmap_addrsz) > 0)
|
||||||
|
pc = strchr(pc, '\n') + 1;
|
||||||
|
if (pc == sysmap) /* scan backward but not past beg */
|
||||||
|
return sym_put(rval, sizeof rval, pc);
|
||||||
|
while (strncasecmp(addr, pc, sysmap_addrsz) < 0)
|
||||||
|
pc = strchrrev(pc - 1, sysmap, '\n') + 1;
|
||||||
|
return sym_put(rval, sizeof rval, pc);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* extern struct nlist *namelist; */
|
||||||
|
struct tbl_s vars, fncs;
|
||||||
|
struct psdb_hdr db_hdr;
|
||||||
|
int psdb = -1;
|
||||||
|
|
||||||
|
int open_psdb(void) {
|
||||||
|
static char *sysmap_paths[] = {
|
||||||
|
"/boot/System.map-%s",
|
||||||
|
"/boot/System.map",
|
||||||
|
"/lib/modules/%s/System.map",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
static char *psdb_paths[] = {
|
||||||
|
"/etc/psdatabase",
|
||||||
|
"/boot/psdatabase-%s",
|
||||||
|
"/boot/psdatabase",
|
||||||
|
"/lib/modules/%s/psdatabase",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
char **fmt, *env, path[64];
|
||||||
|
struct utsname uts;
|
||||||
|
uname(&uts);
|
||||||
|
if ((env = getenv("PS_SYSMAP")) && sysmap_mmap(env))
|
||||||
|
return 0;
|
||||||
|
for (fmt = sysmap_paths; *fmt; fmt++) {
|
||||||
|
snprintf(path, sizeof path, *fmt, uts.release);
|
||||||
|
if (sysmap_mmap(path))
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
for (fmt = psdb_paths; *fmt; fmt++) {
|
||||||
|
snprintf(path, sizeof path, *fmt, uts.release);
|
||||||
|
if ((psdb = open(path, O_RDONLY)) != -1 &&
|
||||||
|
read(psdb, (char*)&db_hdr, sizeof db_hdr) == sizeof db_hdr &&
|
||||||
|
strncmp(db_hdr.magic, procps_version, sizeof(db_hdr.magic)) == 0)
|
||||||
|
/* && version_cmp(kernel,psdatabase) */
|
||||||
|
return 0;
|
||||||
|
if (psdb != -1)
|
||||||
|
fprintf(stderr,
|
||||||
|
"psdatabase has magic no. %*s instead of %*s\n",
|
||||||
|
(int) sizeof db_hdr.magic, db_hdr.magic,
|
||||||
|
(int) sizeof db_hdr.magic, procps_version);
|
||||||
|
close(psdb);
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void close_psdb(void) {
|
||||||
|
if (sysmap)
|
||||||
|
munmap(sysmap, sysmap_len);
|
||||||
|
else if (psdb != -1)
|
||||||
|
close(psdb);
|
||||||
|
psdb = -1;
|
||||||
|
sysmap = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
int read_tbl(struct dbtbl_s *dbtbl, struct tbl_s *tbl) {
|
||||||
|
lseek(psdb, dbtbl->off, SEEK_SET);
|
||||||
|
tbl->tbl = (struct sym_s *) xmalloc(dbtbl->size);
|
||||||
|
if (read(psdb, (char *) tbl->tbl, dbtbl->size) != dbtbl->size) {
|
||||||
|
perror(PSDATABASE);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
tbl->nsym = dbtbl->nsym;
|
||||||
|
tbl->strings = (char *) (tbl->tbl + tbl->nsym);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
char * find_func(unsigned long address) {
|
||||||
|
int n;
|
||||||
|
struct sym_s *p;
|
||||||
|
char *s;
|
||||||
|
|
||||||
|
if (sysmap)
|
||||||
|
return sysmap_symbol(address);
|
||||||
|
if (psdb == -1)
|
||||||
|
return "(no psdb)";
|
||||||
|
if (fncs.tbl == NULL)
|
||||||
|
read_tbl(&db_hdr.fncs, &fncs);
|
||||||
|
p = fncs.tbl;
|
||||||
|
n = fncs.nsym;
|
||||||
|
while (n) {
|
||||||
|
int i = n / 2;
|
||||||
|
if (p[i].addr < address) {
|
||||||
|
p = &p[i+1];
|
||||||
|
if (p->addr > address) {
|
||||||
|
--p;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
--n;
|
||||||
|
}
|
||||||
|
n /= 2;
|
||||||
|
}
|
||||||
|
s = p->name + fncs.strings;
|
||||||
|
return *s=='_' ? s+1 : s;
|
||||||
|
}
|
||||||
|
|
||||||
|
char * wchan(unsigned long address) {
|
||||||
|
static char zero = 0;
|
||||||
|
char *p;
|
||||||
|
|
||||||
|
if (address) {
|
||||||
|
p = find_func(address);
|
||||||
|
if (strncmp(p, "sys_", 4) == 0)
|
||||||
|
p += 4;
|
||||||
|
while (*p == '_' && *p)
|
||||||
|
++p;
|
||||||
|
} else /* 0 address means not in kernel space */
|
||||||
|
p = &zero;
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef SYSMAP_TEST
|
||||||
|
int main(int ac, char** av) {
|
||||||
|
if (ac < 3) {printf("%s System.map lines hexaddr ...\n",av[0]); return 1;}
|
||||||
|
if (!sysmap_mmap(av[1])) return 1;
|
||||||
|
if ((sysmap_mean = atoi(av[2])) <= 0) return 1;
|
||||||
|
for (av += 3; *av; av++)
|
||||||
|
printf("%s %s\n", *av, sysmap_symbol(strtoul(*av, NULL, 16)));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
52
libproc/output.c
Normal file
52
libproc/output.c
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
Some output conversion routines for libproc
|
||||||
|
Copyright (C) 1996, Charles Blake. See COPYING for details.
|
||||||
|
*/
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/* output a string, converting unprintables to octal as we go, and stopping after
|
||||||
|
processing max chars of output (accounting for expansion due to octal rep).
|
||||||
|
*/
|
||||||
|
unsigned print_str(FILE* file, char *s, unsigned max) {
|
||||||
|
int i;
|
||||||
|
for (i=0; s[i] && i < max; i++)
|
||||||
|
if (isprint(s[i]) || s[i] == ' ')
|
||||||
|
fputc(s[i], file);
|
||||||
|
else {
|
||||||
|
if (max - i > 3) {
|
||||||
|
fprintf(file, "\\%03o", s[i]);
|
||||||
|
i += 3; /* 4 printed, but i counts one */
|
||||||
|
} else
|
||||||
|
return max - i;
|
||||||
|
}
|
||||||
|
return max - i;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* output an argv style NULL-terminated string list, converting unprintables
|
||||||
|
to octal as we go, separating items of the list by 'sep' and stopping after
|
||||||
|
processing max chars of output (accounting for expansion due to octal rep).
|
||||||
|
*/
|
||||||
|
unsigned print_strlist(FILE* file, char **strs, char* sep, unsigned max) {
|
||||||
|
int i, n, seplen = strlen(sep);
|
||||||
|
for (n=0; *strs && n < max; strs++) {
|
||||||
|
for (i=0; strs[0][i] && n+i < max; i++)
|
||||||
|
if (isprint(strs[0][i]) || strs[0][i] == ' ')
|
||||||
|
fputc(strs[0][i], file);
|
||||||
|
else {
|
||||||
|
if (max-(n+i) > 3) {
|
||||||
|
fprintf(file, "\\%03o", strs[0][i]);
|
||||||
|
n += 3; /* 4 printed, but i counts one */
|
||||||
|
} else
|
||||||
|
return max - n;
|
||||||
|
}
|
||||||
|
n += i;
|
||||||
|
if (n + seplen < max) {
|
||||||
|
fputs(sep, file);
|
||||||
|
n += seplen;
|
||||||
|
} else
|
||||||
|
return max - n;
|
||||||
|
}
|
||||||
|
return max - n;
|
||||||
|
}
|
30
libproc/ps.h
Normal file
30
libproc/ps.h
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
/* The shadow of the original with only common prototypes now. */
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
/* get definition of HZ */
|
||||||
|
#include <asm/param.h>
|
||||||
|
|
||||||
|
/* get page info */
|
||||||
|
#include <asm/page.h>
|
||||||
|
|
||||||
|
char *wchan(unsigned long);
|
||||||
|
char *find_func(unsigned long address);
|
||||||
|
void *xcalloc(void *pointer, int size);
|
||||||
|
void *xmalloc(unsigned int size);
|
||||||
|
void *xrealloc(void *oldp, unsigned int size);
|
||||||
|
|
||||||
|
int mult_lvl_cmp(void* a, void* b);
|
||||||
|
int node_mult_lvl_cmp(void* a, void* b);
|
||||||
|
void dump_keys(void);
|
||||||
|
|
||||||
|
char *user_from_uid(int uid);
|
||||||
|
|
||||||
|
int open_sysmap(void);
|
||||||
|
int open_psdb(void);
|
||||||
|
void close_psdb(void);
|
||||||
|
void make_fnctbl(void);
|
||||||
|
|
||||||
|
unsigned print_str (FILE* file, char *s, unsigned max);
|
||||||
|
unsigned print_strlist(FILE* file, char **strs, char* sep, unsigned max);
|
||||||
|
unsigned snprint_strlist(char *buf, int max, char **strs, char *sep);
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user