Compare commits

...

42 Commits

Author SHA1 Message Date
Martin Baulig
a8b0903fe7 Added $(LIBGTOP_EXTRA_LIBS).
* Makefile.am (libgtop_common_la_LIBADD): Added $(LIBGTOP_EXTRA_LIBS).
1998-09-27 14:25:38 +00:00
Martin Baulig
6eed554232 Do not even check for guile if it is disabled.
1998-09-27  Martin Baulig  <martin@home-of-linux.org>

	* configure.in: Do not even check for guile if it is disabled.
1998-09-27 14:15:47 +00:00
Martin Baulig
c591e6ef33 Updated. 1998-09-27 13:34:37 +00:00
Martin Baulig
a72db75b78 Patch for `make release'. 1998-09-27 13:31:06 +00:00
Martin Baulig
8f3c38219a Set version number to 0.26.2. 1998-09-27 11:32:53 +00:00
Martin Baulig
0d56ca7d04 Applied patch from Frederic Devernay; added `include_HEADERS'. 1998-09-16 10:18:15 +00:00
Martin Baulig
70347bbfe9 Applied patch from Owen Taylor; added $GLIB_CFLAGS. 1998-09-15 19:11:03 +00:00
Martin Baulig
06437c5866 Applied another linuxism patch from Frederic Devernay. 1998-09-15 09:46:49 +00:00
Martin Baulig
72c987735e Applied patch from Frederic Devernay; use `expr' instead of bash
extension to make it follow strictly the Bourne Shell.
1998-09-15 08:06:22 +00:00
Martin Baulig
8e752ed036 Added check for -lresolv and -lnsl for Solaris. 1998-09-14 21:21:10 +00:00
Martin Baulig
36911a1239 *** empty log message *** 1998-09-12 18:06:23 +00:00
Martin Baulig
7cadf4450c New file. This is used in guname to fetch as many information about the
1998-09-12  Martin Baulig  <martin@home-of-linux.org>

	* include/glibtop/sysinfo.h: New file. This is used in guname to
	fetch as many information about the system as possible like detailed
	information about hardware etc.
1998-09-12 17:55:52 +00:00
Martin Baulig
2a2677ea66 New file.
1998-09-12  Martin Baulig  <martin@home-of-linux.org>

	* sysinfo.c: New file.
1998-09-12 17:55:23 +00:00
Martin Baulig
37283cfdad LibGTop now requires glib.
1998-09-12  Martin Baulig  <martin@home-of-linux.org>

	* configure.in (AM_PATH_GLIB): LibGTop now requires glib.
1998-09-12 13:53:59 +00:00
Martin Baulig
b85a419f28 No longer link libgtop_daemon' and libgtop_server' statically. 1998-09-10 12:54:10 +00:00
Martin Baulig
507da6f040 Added SMP support. 1998-09-09 17:29:35 +00:00
Martin Baulig
11daaa2e1c Added SMP support.
1998-09-09  Martin Baulig <baulig@Stud.Informatik.uni-trier.de>

	* proctime.c (glibtop_get_proc_time_s): Added SMP support.
1998-09-09 16:57:13 +00:00
Martin Baulig
0d3113e6b9 Added xcpu_utime' and xcpu_stime'.
1998-09-09  Martin Baulig <baulig@Stud.Informatik.uni-trier.de>

	* include/glibtop/proctime.h (glibtop_proc_time): Added `xcpu_utime' and
	`xcpu_stime'.
1998-09-09 16:51:12 +00:00
Martin Baulig
94d7978b44 Set version to 0.26.1. 1998-09-09 16:25:20 +00:00
Martin Baulig
86de0911cc Added check for `smp_programs'. 1998-09-09 16:23:29 +00:00
Martin Baulig
8279241591 New file. Nice tool to show CPU statistics on SMP systems.
1998-09-09  Martin Baulig <baulig@Stud.Informatik.uni-trier.de>

	* smp.c: New file. Nice tool to show CPU statistics on SMP systems.
1998-09-09 16:22:13 +00:00
Martin Baulig
88c34d1415 *** empty log message *** 1998-09-09 15:32:44 +00:00
Martin Baulig
a331fb8e03 Added `ncpu'. This is zero for single processor systems and the number of
1998-09-09  Martin Baulig <baulig@Stud.Informatik.uni-trier.de>

	* glibtop.h (glibtop): Added `ncpu'. This is zero for single processor
	systems and the number of CPUs otherwise.

	* include/glibtop/cpu.h (glibtop_cpu): Added `xcpu_total', `xcpu_user',
	`xcpu_nice', `xcpu_sys' and `xcpu_idle'.
	(GLIBTOP_NCPU): #define this to 4.
1998-09-09 15:19:24 +00:00
Martin Baulig
9d564134de Initialize `ncpu' on SMP systems.
1998-09-09  Martin Baulig <baulig@Stud.Informatik.uni-trier.de>

	* open.c (glibtop_init_s): Initialize `ncpu' on SMP systems.

	* cpu.c (glibtop_get_cpu_s): Added SMP support.

	* ChangeLog: New file.
1998-09-09 15:17:12 +00:00
Martin Baulig
731b2879f0 Added `HAVE_LIBGTOP_SMP'. 1998-09-09 12:24:02 +00:00
Martin Baulig
2f140e2168 Bug fix. Some awk interpreters seem to have problems with `\w+'. 1998-09-08 21:06:43 +00:00
Martin Baulig
2bf9475dda Make the default to disable guile.
1998-09-08  Martin Baulig  <baulig@merkur.uni-trier.de>

	* configure.in: Make the default to disable guile.
1998-09-08 13:25:36 +00:00
Martin Baulig
6fe6cfdc15 Bug fix. 1998-09-08 13:10:55 +00:00
Martin Baulig
a6584c2f75 Added. This is a numerical constant ("1.234.567" -> 1234567) to be used in
1998-08-30  Martin Baulig  <martin@home-of-linux.org>

	* LIBGTOP-VERSION (LIBGTOP_VERSION_CODE): Added. This is a numerical
	constant ("1.234.567" -> 1234567) to be used in C preprocessor
	conditionals.
1998-08-30 12:44:29 +00:00
Martin Baulig
bdefedae37 Bumped version number to 0.26.0. 1998-08-29 21:12:42 +00:00
Martin Baulig
af50e25023 Added. AC_SUBST. (LT_RELEASE, LT_CURRENT, LT_REVISION, LT_AGE): AC_SUBST.
1998-08-29  Martin Baulig  <martin@home-of-linux.org>

	* LIBGTOP-VERSION (LIBGTOP_INTERFACE_AGE, LIBGTOP_BINARY_AGE): Added.
	* configure.in (LIBGTOP_INTERFACE_AGE, LIBGTOP_BINARY_AGE): AC_SUBST.
	(LT_RELEASE, LT_CURRENT, LT_REVISION, LT_AGE): AC_SUBST.
	(LT_VERSION_INFO): Sets `-version-info' for libtool.

	* */Makefile.am: We now use the correct `-version-info' parameter
	for libtool.
1998-08-29 21:08:52 +00:00
Martin Baulig
abfda54900 This caused too much problems, so I reverted it.
1998-08-25  Martin Baulig  <martin@home-of-linux.org>

        * configure.in (LIBGTOP_EXTRA_LIBS): Added $(LIBSUPPORT).
1998-08-27 15:18:32 +00:00
Martin Baulig
0ea8e591f4 Third argument is now `const void *'.
1998-08-25  Martin Baulig  <martin@home-of-linux.org>

	* include/glibtop/command.h (glibtop_call): Third argument is
	now `const void *'.

	* include/glibtop/xmalloc.h (glibtop_free): Now taking a
	`const void *'.
1998-08-25 08:41:02 +00:00
Martin Baulig
db3d7adbaa New file.
1998-08-25  Martin Baulig  <martin@home-of-linux.org>

	* src/daemon/ChangeLog: New file.

	* sysdeps/sun4/ChangeLog: New file.

	* sysdeps/stub/ChangeLog: New file.

	* configure.in: Added check for `-lsocket'.
	(LIBGTOP_INCS): Added $(SUPPORTINCS).
	(INCLUDES): Added $(SUPPORTINCS).
	(LIBGTOP_EXTRA_LIBS): Added $(LIBSUPPORT).

	* acconfig.h: Added `NEED_DECLARATION_GETHOSTNAME',
	`NEED_DECLARATION_SETREUID', `NEED_DECLARATION_SETREGID'
	and `NEED_DECLARATION_GETPAGESIZE'.

	* includue/glibtop/global.h (<gnomesupport.h>): Include this.

	* lib/init.c (_init_server): Declared `static'.

	* lib/read_data.c: Added cast to `const void *' in calls to
	`recv' and `read' to avoid compiler warnings.
1998-08-25 08:39:14 +00:00
Martin Baulig
f353017948 Fixed some compiler warnings.
1998-08-25  Martin Baulig  <martin@home-of-linux.org>

	* first.c, second.c, procmap.c: Fixed some compiler warnings.
1998-08-25 08:32:45 +00:00
Martin Baulig
f66f7fde8c Added prototype. Added cast to const void *' in calls to write' and
1998-08-25  Martin Baulig  <martin@home-of-linux.org>

	* daemon.h (handle_parent_connection): Added prototype.
	* write.c, io.c: Added cast to `const void *' in calls to
	`write' and `send' to avoid compiler warnings.
	* gnuserv.c (handle_signal): Declared static.
	(main): Casting return value of `getuid' to `int' in
	debugging statement.

	* ChangeLog: New file.
1998-08-25 08:20:04 +00:00
Martin Baulig
9049a19434 Using correct `(1 << GLIBTOP_SYSDPES_*)'. (<glibtop_suid.h>): Include.
1998-08-25  Martin Baulig  <martin@home-of-linux.org>

	* *.c (glibtop_init_p): Using correct `(1 << GLIBTOP_SYSDPES_*)'.
	(<glibtop_suid.h>): Include.

	* glibtop_suid.h: New file.

	* ChangeLog: New file.
1998-08-25 08:10:05 +00:00
Martin Baulig
f7da79ed88 Added initialization functions `glibtop_init_<feature>_s'.
1998-08-24  Martin Baulig  <martin@home-of-linux.org>

	* *.c: Added initialization functions `glibtop_init_<feature>_s'.

	* ChangeLog: New file.
1998-08-24 20:44:46 +00:00
Martin Baulig
9d0aa0fdc1 Using correct (1 << GLIBTOP_SYSDPES_*)'. Removed const' from sysctl ()
1998-08-24  Martin Baulig  <martin@home-of-linux.org>

	* *.c (glibtop_init_p): Using correct `(1 << GLIBTOP_SYSDPES_*)'.
	* cpu.c, mem.c: Removed `const' from sysctl () constants to keep
	compiler happy.

	* procmem.c:  Added missing call to `glibtop_init_p'.

	* prockernel.c: Casting `nwchan' to `unsigned long' since this
	normally has the same size than a pointer. Well, is there a
	FreeBSD for 64bit architectures ?
1998-08-24 19:55:38 +00:00
Martin Baulig
fb552b8e31 Merged from LIBGTOP_0_25_PATCHES. 1998-08-24 13:09:49 +00:00
Martin Baulig
a0b502df75 Merged from `LIBGTOP_0_25_PATCHES'. 1998-08-23 12:26:32 +00:00
Martin Baulig
5a7f1d7621 Merged from LIBGTOP_0_25_PATCHES. 1998-08-22 17:26:50 +00:00
110 changed files with 1583 additions and 433 deletions

241
ANNOUNCE-0.25 Normal file
View File

@@ -0,0 +1,241 @@
[Posted to the Gnome Mailing List on Fri Aug 21 1998]
About this release:
------------------
LibGTop 0.25 is a stable release.
Of cause it has its bug like any software has, I'm planning
to fix as many bugs as possible in _this_ release and then
re-release it as libgtop-0.26 or even libgtop-0.30.
Especially portings to new operating systems should be made
in this release.
This also means that we can safely use this version of LibGTop
all over the GNOME project.
Currently LibGTop-Apps is still a little bit under development -
especially the LibGTop-Apps GTop does not yet have the full
functionallity of the real GTop.
We should test this extensively and then decide whether to continue
with the `libgtop-apps' module or whether to merge all its code
back into the modules it came from. I'd like to hear some comments
about this from you !
Please look at the release notes below for more details about this
release.
Where to get the sources
------------------------
The sources can be found at:
ftp://ftp.home-of-linux.org/pub/
Tarballs:
libgtop-0.25.0.tar.gz
libgtop-apps-0.25.0.tar.gz
Source RPM:
libgtop-0.25.0-REL.src.rpm
libgtop-apps-0.25.0-REL.src.rpm
Binary RPMS:
libgtop-0.25.0-REL.i386.rpm
libgtop-devel-0.25.0-REL.i386.rpm
libgtop-examples-0.25.0-REL.i386.rpm
libgtop-apps-0.25.0-REL.i386.rpm
There is some little problem with the binary RPMS of `libgtop-apps':
Most of its files will conflict with ones from `gnome-core' and `gnome-utils',
so you'll need to use the `--force' parameter to install it.
Getting the sources from CVS:
----------------------------
You can also fetch the sources from the GNOME CVS tree
(see http://www.gnome.org/ for details).
To get the latest sources:
$ cvs checkout libgtop
$ cvs checkout libgtop-apps
To get the sources of *this* release:
$ cvs checkout -r LIBGTOP_0_25 libgtop
$ cvs checkout -r LIBGTOP_0_25 libgtop-apps
To get the sources of this release with all bug-fixes applied:
$ cvs checkout -r LIBGTOP_0_25_PATCHES libgtop
$ cvs checkout -r LIBGTOP_0_25_PATCHES libgtop-apps
To get a patch to apply to the tarballs to get all bug-fixes:
$ cvs rdiff -r LIBGTOP_0_25 -r LIBGTOP_0_25_PATCHES libgtop
$ cvs rdiff -r LIBGTOP_0_25 -r LIBGTOP_0_25_PATCHES libgtop-apps
[Note for people having write access to the GNOME CVS tree:
Please apply bug fixes to the `LIBGTOP_0_25_PATCHES' branch and
merge them into the main trunk.
After merging, please re-tag the branch `libgtop_0_25_after_merge'.
This will help us to re-release this package when all bugs are
fixed.
]
RELEASE NOTES FOR LIBGTOP 0.25 STABLE
=====================================
OVERVIEW
--------
LibGTop is a library that read information about processes and the running
systems. This information include:
General System Information
cpu - CPU Usage
mem - Memory Usage
swap - Swap Usage (including paging activity)
loadavg - Load average (including nr_running, nr_tasks, last_pid)
uptime - Uptime and Idle time, can be calculated from CPU usage
SYS V IPC Limits:
shm_limits - Shared Memory Limits
msg_limits - Message Queue Limits
sem_limits - Semaphore Set Limits
Process List:
proclist - List of processes
Process information:
proc_state - cmd, state, uid, gid
proc_uid - uid,euid,gid,egid,pid,ppid,pgrp
session,tty,tpgid,priority,nice
proc_mem - size,vsize,resident,share,rss,rss_rlim
proc_time - start_time,rtime,utime,stime,cutime,cstime
timeout,it_real_value,frequency
proc_signal - signal,blocked,sigignore,sigcatch
proc_kernel - k_flags,min_flt,maj_flt,cmin_flt,cmaj_flt
kstk_esp,kstk_eip,nwchan,wchan
proc_segment - text_rss,shlib_rss,data_rss,stack_rss,dirty_size
start_code,end_code,start_stack
Process maps:
proc_map - Process map (/proc/<pid>/maps under Linux)
File system usage:
mountlist - List of currently mounted filesystems
fsusage - File system usage
PORTABILITY:
-----------
LibGtop is designed to be as portable as possible. None of the functions
and retrieved information should be specific to a specific operating
system. So you only need to port the system dependent part of the library
to a new system and all application programs can then use libgtop on this
new system.
CLIENT/SERVER MODEL:
-------------------
Some systems like DEC OSF/1 or BSD require special priviledges for the calling
proces to fetch the required information (SUID root/SGID kmem). To solve this
problem, I designed a client/server model which makes a call to a SUID/SGID
server which fetches the required information whenever it is required. This
server is only called for features that really require priviledges, otherwise
the sysdeps code is called directory (every user can get the CPU usage on
DEC OSF/1, but only root can get information about processes other than the
current one).
There is also some kind of daemon which can be used to fetch information from
remote systems (still experimental). This daemon normally runs as nobody and
calls the SUID/SGID itself when needed.
GNOME APPLETS:
--------------
There are some applets and applications which already use LibGTop. They can
be found in the `libgtop-apps' module in the GNOME CVS tree:
* Applets: cpuload, cpumemusage - they need LibGTop to get their information
on all systems other than Linux.
* Applets: diskusage - just uses the mountlist/fsusage features of LibGTop,
the one in gnome-core also works on other systems.
* Applets: multiload - I enhanced the cpuload applet a little bit, it is
now a multi applet and can display CPU, Memory and
Swap usages.
GTOP:
----
This cool GNOME app has been ported to use LibGTop. It can be found in
`libgtop-apps/gtop' in the GNOME CVS tree.
You can now use nearly the full functionality of GTop on FreeBSD !
PLATTFORM SPECIFIC NOTES FOR LINUX:
==================================
Under Linux, LibGTop should work without problems and read everything
from /proc.
There is also an experimental kernel interface to read this information
directly from the kernel with a system call - but this is still experimental
and not well tested while I made this release.
PLATTFORM SPECIFIC NOTES FOR FREEBSD:
====================================
LibGTop should now work under FreeBSD and give you the full functionality
of GTop.
There are a few caveats:
* You need to manually make the `$(prefix)/bin/libgtop_server' SGID to kmem
after installation and mount the /proc filesystem of FreeBSD
(/proc/<pid>/mem is used withing kvm_uread ()).
* To get the filenames of the process maps displayed in GTop, you need to
configure with the `--with-libgtop-inodedb' option (you need GDBM for this
to work).
* You have then to create an inode database which is used to look up to
filenames. This is done using the `mkinodedb' program which comes along
with libgtop.
See the file src/inodedb/README for details:
The `mkinodedb' program which is build in this directory takes two
command line arguments: the full pathname of the database to be created
and the name of a configuration file consisting of directory and file names
each on a line by itself - see `/etc/ld.so.conf' for an example.
Putting a directory name in this file means all regular files found in this
directory are included in the database, but it will not recursively descend
into subdirectories (for instance, we want everythink in `/usr/lib' but not
every single file in `/usr/lib/sgml'). You can also use filenames to include
a single file.
Have fun,
Martin <martin@home-of-linux.org>

View File

@@ -1,3 +1,90 @@
1998-09-27 Martin Baulig <martin@home-of-linux.org>
* configure.in: Do not even check for guile if it is disabled.
1998-09-12 Martin Baulig <martin@home-of-linux.org>
* include/glibtop/sysinfo.h: New file. This is used in guname to
fetch as many information about the system as possible like detailed
information about hardware etc.
* configure.in (AM_PATH_GLIB): LibGTop now requires glib.
1998-09-09 Martin Baulig <baulig@Stud.Informatik.uni-trier.de>
* include/glibtop/proctime.h (glibtop_proc_time): Added `xcpu_utime'
and `xcpu_stime'.
* sysdeps/linux/ChangeLog: New file.
* glibtop.h (glibtop): Added `ncpu'. This is zero for single processor
systems and the number of CPUs otherwise.
* include/glibtop/cpu.h (glibtop_cpu): Added `xcpu_total', `xcpu_user',
`xcpu_nice', `xcpu_sys' and `xcpu_idle'.
(GLIBTOP_NCPU): #define this to 4.
1998-09-08 Martin Baulig <baulig@merkur.uni-trier.de>
* configure.in: Make the default to disable guile.
1998-08-30 Martin Baulig <martin@home-of-linux.org>
* LIBGTOP-VERSION (LIBGTOP_VERSION_CODE): Added. This is a numerical
constant ("1.234.567" -> 1234567) to be used in C preprocessor
conditionals.
1998-08-29 Martin Baulig <martin@home-of-linux.org>
* LIBGTOP-VERSION (LIBGTOP_INTERFACE_AGE, LIBGTOP_BINARY_AGE): Added.
* configure.in (LIBGTOP_INTERFACE_AGE, LIBGTOP_BINARY_AGE): AC_SUBST.
(LT_RELEASE, LT_CURRENT, LT_REVISION, LT_AGE): AC_SUBST.
(LT_VERSION_INFO): Sets `-version-info' for libtool.
* */Makefile.am: We now use the correct `-version-info' parameter
for libtool.
1998-08-25 Martin Baulig <martin@home-of-linux.org>
* include/glibtop/command.h (glibtop_call): Third argument is
now `const void *'.
* include/glibtop/xmalloc.h (glibtop_free): Now taking a
`const void *'.
1998-08-25 Martin Baulig <martin@home-of-linux.org>
* src/daemon/ChangeLog: New file.
* sysdeps/sun4/ChangeLog: New file.
* sysdeps/stub/ChangeLog: New file.
* configure.in: Added check for `-lsocket'.
(LIBGTOP_INCS): Added $(SUPPORTINCS).
(INCLUDES): Added $(SUPPORTINCS).
* acconfig.h: Added `NEED_DECLARATION_GETHOSTNAME',
`NEED_DECLARATION_SETREUID', `NEED_DECLARATION_SETREGID'
and `NEED_DECLARATION_GETPAGESIZE'.
* includue/glibtop/global.h (<gnomesupport.h>): Include this.
* lib/init.c (_init_server): Declared `static'.
* lib/read_data.c: Added cast to `const void *' in calls to
`recv' and `read' to avoid compiler warnings.
* configure.in (INCLUDES): No longer using installed header files.
1998-08-23 Martin Baulig <martin@home-of-linux.org>
* features.def (mountlist): Using `int(fs_usage)'.
1998-08-21 Martin Baulig <martin@home-of-linux.org>
* ANNOUNCE-0.25: Released LibGTop 0.25 stable.
1998-08-18 Martin Baulig <martin@home-of-linux.org>
* LIBGTOP-VERSION: Set version number to 0.25.0. There is now really

View File

@@ -1,11 +1,25 @@
# Making releases:
# LIBGTOP_MICRO_VERSION += 1;
# LIBGTOP_INTERFACE_AGE += 1;
# LIBGTOP_BINARY_AGE += 1;
# if any functions have been added, set LIBGTOP_INTERFACE_AGE to 0.
# if backwards compatibility has been broken,
# set LIBGTOP_BINARY_AGE and LIBGTOP_INTERFACE_AGE to 0.
#
LIBGTOP_MAJOR_VERSION=0
LIBGTOP_MINOR_VERSION=25
LIBGTOP_MICRO_VERSION=0
LIBGTOP_VERSION=$LIBGTOP_MAJOR_VERSION.$LIBGTOP_MINOR_VERSION.$LIBGTOP_MICRO_VERSION
LIBGTOP_MINOR_VERSION=26
LIBGTOP_MICRO_VERSION=2
LIBGTOP_INTERFACE_AGE=1
LIBGTOP_BINARY_AGE=1
# Increase each time you change the client/server protocol.
LIBGTOP_SERVER_VERSION=1
# Don't change this
LIBGTOP_VERSION=$LIBGTOP_MAJOR_VERSION.$LIBGTOP_MINOR_VERSION.$LIBGTOP_MICRO_VERSION
LIBGTOP_VERSION_CODE=`expr $LIBGTOP_MAJOR_VERSION*1000000+$LIBGTOP_MINOR_VERSION*1000+$LIBGTOP_MICRO_VERSION`
# For automake.
VERSION=$LIBGTOP_VERSION
PACKAGE=libgtop

View File

@@ -25,7 +25,7 @@ EXTRA_DIST = autogen.sh libgtop.spec copyright.txt libgtopConf.sh.in \
perl/MANIFEST perl/Changes libgtop-config.in RELNOTES-0.25
release:
$(MAKE) dist distdir=$(PACKAGE)$(VERSION)
$(MAKE) dist distdir=$(PACKAGE)-$(VERSION)
## Put `exec' in the name because this should be installed by
## `install-exec', not `install-data'.
@@ -66,6 +66,7 @@ libgtopConf.sh: libgtopConf.sh.in Makefile
-e 's,\@LIBGTOP_MINOR_VERSION\@,$(LIBGTOP_MINOR_VERSION),g' \
-e 's,\@LIBGTOP_MICRO_VERSION\@,$(LIBGTOP_MICRO_VERSION),g' \
-e 's,\@LIBGTOP_VERSION\@,$(LIBGTOP_VERSION),g' \
-e 's,\@LIBGTOP_VERSION_CODE\@,$(LIBGTOP_VERSION_CODE),g' \
-e 's,\@LIBGTOP_SERVER_VERSION\@,$(LIBGTOP_SERVER_VERSION),g' \
-e 's,\@libgtop_sysdeps_dir\@,$(libgtop_sysdeps_dir),g' \
-e 's,\@libgtop_need_server\@,$(libgtop_need_server),g' \

View File

@@ -1,3 +1,18 @@
/* Define if gethostname () must be declared. */
#undef NEED_DECLARATION_GETHOSTNAME
/* Define if setreuid () must be declared. */
#undef NEED_DECLARATION_SETREUID
/* Define if setregid () must be declared. */
#undef NEED_DECLARATION_SETREGID
/* Define if getpagesize () must be declared. */
#undef NEED_DECLARATION_GETPAGESIZE
@TOP@
#undef ENABLE_NLS
#undef HAVE_CATGETS
#undef HAVE_GETTEXT
@@ -122,6 +137,7 @@
#undef NEED_LIBGTOP
#undef HAVE_LINUX_TABLE
#undef HAVE_LIBGTOP_SMP
#undef HAVE_XAUTH

View File

@@ -12,8 +12,23 @@ AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
AC_SUBST(LIBGTOP_MAJOR_VERSION)
AC_SUBST(LIBGTOP_MINOR_VERSION)
AC_SUBST(LIBGTOP_MICRO_VERSION)
AC_SUBST(LIBGTOP_INTERFACE_AGE)
AC_SUBST(LIBGTOP_BINARY_AGE)
AC_SUBST(LIBGTOP_SERVER_VERSION)
AC_SUBST(LIBGTOP_VERSION)
AC_SUBST(LIBGTOP_VERSION_CODE)
# libtool versioning
LT_RELEASE=$LIBGTOP_MAJOR_VERSION.$LIBGTOP_MINOR_VERSION
LT_CURRENT=`expr $LIBGTOP_MICRO_VERSION - $LIBGTOP_INTERFACE_AGE`
LT_REVISION=$LIBGTOP_INTERFACE_AGE
LT_AGE=`expr $LIBGTOP_BINARY_AGE - $LIBGTOP_INTERFACE_AGE`
LT_VERSION_INFO='-version-info ${LT_CURRENT}:${LT_REVISION}:${LT_AGE}'
AC_SUBST(LT_VERSION_INFO)
AC_SUBST(LT_RELEASE)
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)
AM_ACLOCAL_INCLUDE(macros)
@@ -57,13 +72,18 @@ fi
GNOME_LIBGTOP_SYSDEPS
GNOME_LIBGTOP_TYPES
GNOME_CHECK_GUILE
dnl For Solaris
AC_CHECK_LIB(resolv, _getnetbyaddr)
AC_CHECK_LIB(socket, socket)
AC_CHECK_LIB(nsl, gethostbyname)
AC_ARG_WITH(libgtop-guile,
[ --with-libgtop-guile Build the libgtop guile interface (default=yes)],
[build_guile="$withval"], [build_guile=yes])
[ --with-libgtop-guile Build the libgtop guile interface (default=no)],
[build_guile="$withval"], [build_guile=no])
test x$build_guile = xno && ac_cv_guile_found=no
if test x$build_guile = xyes ; then
GNOME_CHECK_GUILE
fi
AC_ARG_WITH(libgtop-inodedb,
[ --with-libgtop-inodedb Build the inodedb stuff (default=no)],
@@ -95,12 +115,22 @@ else
guile_subdirs=
fi
if test x$libgtop_smp = xyes ; then
smp_examples='smp smp_static'
else
smp_examples=
fi
AC_SUBST(smp_examples)
AC_SUBST(guile_examples)
AC_SUBST(guile_subdirs)
AM_PROG_LIBTOOL
dnl You need to uncomment the following line if you want to use libgtop without Gnome.
AM_PATH_GLIB
dnl You need to uncomment the following line if you want to use
dnl libGTop without Gnome.
dnl GNOME_SUPPORT_CHECKS
dnl Checks for typedefs, structures, and compiler characteristics.
@@ -177,22 +207,25 @@ GNOME_FILEUTILS_CHECKS
AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [default=no]],AC_DEFINE(GNOME_ENABLE_DEBUG),)
dnl If you want to use libgtop without gnome, uncomment the following paragraph:
dnl LIBSUPPORT=
dnl SUPPORTINCS=
dnl if test "$need_gnome_support" = yes; then
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"
LIBSUPPORT=
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
dnl Some ugly hack; if '-lgnomesupport' is part of $GNOME_LIBS,
dnl we include it here.
case "$GNOME_LIBS" in
'*-lgnomesupport*' )
LIBSUPPORT="$GNOME_LIBDIR -lgnomesupport"
SUPPORTINCS="$GNOME_INCLUDEDIR" ;;
esac
AC_SUBST(LIBSUPPORT)
AC_SUBST(SUPPORTINCS)
@@ -204,6 +237,12 @@ if test x$build_inodedb = xyes ; then
LIBGTOP_INCS="$LIBGTOP_INCS -DGLIBTOP_INODEDB"
fi
if test x$libgtop_have_sysinfo = xyes ; then
LIBGTOP_INCS="$LIBGTOP_INCS -DHAVE_LIBGTOP_SYSINFO"
fi
LIBGTOP_INCS="$LIBGTOP_INCS $SUPPORTINCS $GLIB_CFLAGS"
LIBGTOP_GUILE_LIBS="$LIBGTOP_LIBS"
LIBGTOP_GUILE_INCS="$LIBGTOP_INCS"
LIBGTOP_BINDIR='$(bindir)'
@@ -221,7 +260,7 @@ fi
AC_SUBST(libgtop_guile_found)
if test -z $LIBGTOP_EXTRA_LIBS ; then
if test -z "$LIBGTOP_EXTRA_LIBS" ; then
LIBGTOP_EXTRA_LIBS="$libs_xauth"
else
LIBGTOP_EXTRA_LIBS="$LIBGTOP_EXTRA_LIBS $libs_xauth"
@@ -256,7 +295,7 @@ 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_VERSION=\"'"$LIBGTOP_SERVER_VERSION"'\" -DLIBGTOP_SERVER=\"'"$LIBGTOP_SERVER"'\"'
INCLUDES="-D_IN_LIBGTOP -D_GNU_SOURCE -DGLIBTOP_NAMES -I\$(top_builddir) -I\$(top_srcdir) -I\$(top_srcdir)/sysdeps/$sysdeps_dir -I\$(top_srcdir)/include -I\$(top_srcdir)/intl $SUPPORTINCS $GLIB_CFLAGS -W -Wall -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith $CFLAGS $guile_def "'-DGTOPLOCALEDIR=\"$(datadir)/locale\" -DLIBGTOP_VERSION=\"'"$LIBGTOP_VERSION"'\" -DLIBGTOP_SERVER_VERSION=\"'"$LIBGTOP_SERVER_VERSION"'\" -DLIBGTOP_SERVER=\"'"$LIBGTOP_SERVER"'\"'
AC_SUBST(INCLUDES)
@@ -273,18 +312,6 @@ AC_SUBST(LIBGTOP_GUILE_NAMES_INCS)
AC_SUBST(LIBGTOP_BINDIR)
AC_SUBST(LIBGTOP_SERVER)
LIBSUPPORT=
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"
server_programs='libgtop_server'

View File

@@ -1,3 +1,11 @@
1998-09-09 Martin Baulig <baulig@Stud.Informatik.uni-trier.de>
* smp.c: New file. Nice tool to show CPU statistics on SMP systems.
1998-08-25 Martin Baulig <martin@home-of-linux.org>
* first.c, second.c, procmap.c: Fixed some compiler warnings.
1998-08-18 Martin Baulig <martin@home-of-linux.org>
* procmap.c: We now display filenames when compiled

View File

@@ -12,9 +12,9 @@ DEFS = @DEFS@
libexec_PROGRAMS = first first_static second second_static \
mountlist mountlist_static \
procmap procmap_static \
@guile_examples@
@guile_examples@ @smp_examples@
EXTRA_PROGRAMS = third third_static
EXTRA_PROGRAMS = third third_static smp smp_static
first_SOURCES = first.c
first_LDADD = $(top_builddir)/lib/libgtop.la \
@@ -74,3 +74,14 @@ mountlist_static_SOURCES= $(mountlist_SOURCES)
mountlist_static_LDADD = $(mountlist_LDADD)
mountlist_static_LDFLAGS= -static
smp_SOURCES = smp.c
smp_LDADD = $(top_builddir)/lib/libgtop.la \
$(top_builddir)/sysdeps/common/libgtop_common.la \
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
@INTLLIBS@ @LIBSUPPORT@ @LIBGTOP_EXTRA_LIBS@
smp_static_SOURCES = $(smp_SOURCES)
smp_static_LDADD = $(smp_LDADD)
smp_static_LDFLAGS = -static

View File

@@ -44,8 +44,6 @@ main (int argc, char *argv [])
glibtop_sysdeps sysdeps;
unsigned c, method, count, port, i, *ptr;
char buffer [BUFSIZ];
struct rlimit rlim;
struct rusage ru;
pid_t pid, ppid;
count = PROFILE_COUNT;
@@ -223,16 +221,17 @@ main (int argc, char *argv [])
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_state (&data.proc_state, pid);
printf ("Proc_State PID %5u (0x%08lx): '%s', %c, %u, %u\n", pid,
(unsigned long) data.proc_state.flags,
printf ("Proc_State PID %5d (0x%08lx): '%s', %c, %lu, %lu\n",
(int) pid, (unsigned long) data.proc_state.flags,
data.proc_state.cmd, data.proc_state.state,
data.proc_state.uid, data.proc_state.gid);
(unsigned long) data.proc_state.uid,
(unsigned long) data.proc_state.gid);
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_uid (&data.proc_uid, pid);
printf ("Proc_Uid PID %5u (0x%08lx): "
"%d %d %d %d %d %d %d %d %d %d %d %d\n", pid,
printf ("Proc_Uid PID %5d (0x%08lx): "
"%d %d %d %d %d %d %d %d %d %d %d %d\n", (int) pid,
(unsigned long) data.proc_uid.flags,
data.proc_uid.uid, data.proc_uid.euid,
data.proc_uid.gid, data.proc_uid.egid,
@@ -244,15 +243,8 @@ main (int argc, char *argv [])
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_mem (&data.proc_mem, pid);
getrlimit (RLIMIT_RSS, &rlim);
fprintf (stderr, "GETRLIM: %lu - %lu - %lu\n",
(unsigned long) rlim.rlim_cur,
(unsigned long) rlim.rlim_max,
(unsigned long) ((1 << 63) - 1));
printf ("Proc_Mem PID %5u (0x%08lx): "
"%lu %lu %lu %lu %lu %lu\n", pid,
printf ("Proc_Mem PID %5d (0x%08lx): "
"%lu %lu %lu %lu %lu %lu\n", (int) pid,
(unsigned long) data.proc_mem.flags,
(unsigned long) data.proc_mem.size,
(unsigned long) data.proc_mem.vsize,
@@ -264,8 +256,8 @@ main (int argc, char *argv [])
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_segment (&data.proc_segment, pid);
printf ("Proc_Segment PID %5u (0x%08lx): "
"%lu %lu %lu %lu %lu %lu %lu %lu\n", pid,
printf ("Proc_Segment PID %5d (0x%08lx): "
"%lu %lu %lu %lu %lu %lu %lu %lu\n", (int) pid,
(unsigned long) data.proc_segment.flags,
(unsigned long) data.proc_segment.text_rss,
(unsigned long) data.proc_segment.shlib_rss,
@@ -276,17 +268,11 @@ main (int argc, char *argv [])
(unsigned long) data.proc_segment.end_code,
(unsigned long) data.proc_segment.start_stack);
getrusage (RUSAGE_SELF, &ru);
fprintf (stderr, "GETRUSAGE: (%ld, %ld) - (%ld, %ld)\n",
ru.ru_utime.tv_sec, ru.ru_utime.tv_usec,
ru.ru_stime.tv_sec, ru.ru_stime.tv_usec);
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_time (&data.proc_time, pid);
printf ("Proc_Time PID %5u (0x%08lx): "
"%lu %lu %lu %lu %lu %lu %lu %lu %lu\n", pid,
printf ("Proc_Time PID %5d (0x%08lx): "
"%lu %lu %lu %lu %lu %lu %lu %lu %lu\n", (int) pid,
(unsigned long) data.proc_time.flags,
(unsigned long) data.proc_time.start_time,
(unsigned long) data.proc_time.rtime,
@@ -301,8 +287,8 @@ main (int argc, char *argv [])
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_signal (&data.proc_signal, pid);
printf ("Proc_Signal PID %5u (0x%08lx): "
"%lu %lu %lu %lu\n", pid,
printf ("Proc_Signal PID %5d (0x%08lx): "
"%lu %lu %lu %lu\n", (int) pid,
(unsigned long) data.proc_signal.flags,
(unsigned long) data.proc_signal.signal,
(unsigned long) data.proc_signal.blocked,
@@ -312,8 +298,8 @@ main (int argc, char *argv [])
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_kernel (&data.proc_kernel, pid);
printf ("Proc_Kernel PID %5u (0x%08lx): "
"%lu %lu %lu %lu %lu %lu %lu %lu (%s)\n", pid,
printf ("Proc_Kernel PID %5d (0x%08lx): "
"%lu %lu %lu %lu %lu %lu %lu %lu (%s)\n", (int) pid,
(unsigned long) data.proc_kernel.flags,
(unsigned long) data.proc_kernel.k_flags,
(unsigned long) data.proc_kernel.min_flt,
@@ -330,16 +316,17 @@ main (int argc, char *argv [])
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_state (&data.proc_state, ppid);
printf ("Proc_State PPID %5u (0x%08lx): '%s', %c, %u, %u\n", ppid,
(unsigned long) data.proc_state.flags,
printf ("Proc_State PPID %5d (0x%08lx): '%s', %c, %lu, %lu\n",
(int) ppid, (unsigned long) data.proc_state.flags,
data.proc_state.cmd, data.proc_state.state,
data.proc_state.uid, data.proc_state.gid);
(unsigned long) data.proc_state.uid,
(unsigned long) data.proc_state.gid);
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_uid (&data.proc_uid, ppid);
printf ("Proc_Uid PPID %5u (0x%08lx): "
"%d %d %d %d %d %d %d %d %d %d %d %d\n", ppid,
printf ("Proc_Uid PPID %5d (0x%08lx): "
"%d %d %d %d %d %d %d %d %d %d %d %d\n", (int) ppid,
(unsigned long) data.proc_uid.flags,
data.proc_uid.uid, data.proc_uid.euid,
data.proc_uid.gid, data.proc_uid.egid,
@@ -351,8 +338,8 @@ main (int argc, char *argv [])
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_mem (&data.proc_mem, ppid);
printf ("Proc_Mem PPID %5u (0x%08lx): "
"%lu %lu %lu %lu %lu %lu\n", ppid,
printf ("Proc_Mem PPID %5d (0x%08lx): "
"%lu %lu %lu %lu %lu %lu\n", (int) ppid,
(unsigned long) data.proc_mem.flags,
(unsigned long) data.proc_mem.size,
(unsigned long) data.proc_mem.vsize,
@@ -364,8 +351,8 @@ main (int argc, char *argv [])
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_segment (&data.proc_segment, ppid);
printf ("Proc_Segment PPID %5u (0x%08lx): "
"%lu %lu %lu %lu %lu %lu %lu %lu\n", ppid,
printf ("Proc_Segment PPID %5d (0x%08lx): "
"%lu %lu %lu %lu %lu %lu %lu %lu\n", (int) ppid,
(unsigned long) data.proc_segment.flags,
(unsigned long) data.proc_segment.text_rss,
(unsigned long) data.proc_segment.shlib_rss,
@@ -379,8 +366,8 @@ main (int argc, char *argv [])
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_time (&data.proc_time, ppid);
printf ("Proc_Time PPID %5u (0x%08lx): "
"%lu %lu %lu %lu %lu %lu %lu %lu %lu\n", ppid,
printf ("Proc_Time PPID %5d (0x%08lx): "
"%lu %lu %lu %lu %lu %lu %lu %lu %lu\n", (int) ppid,
(unsigned long) data.proc_time.flags,
(unsigned long) data.proc_time.start_time,
(unsigned long) data.proc_time.rtime,
@@ -395,8 +382,8 @@ main (int argc, char *argv [])
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_signal (&data.proc_signal, ppid);
printf ("Proc_Signal PPID %5u (0x%08lx): %lu %lu %lu %lu\n", ppid,
(unsigned long) data.proc_signal.flags,
printf ("Proc_Signal PPID %5d (0x%08lx): %lu %lu %lu %lu\n",
(int) ppid, (unsigned long) data.proc_signal.flags,
(unsigned long) data.proc_signal.signal,
(unsigned long) data.proc_signal.blocked,
(unsigned long) data.proc_signal.sigignore,
@@ -405,8 +392,8 @@ main (int argc, char *argv [])
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_kernel (&data.proc_kernel, ppid);
printf ("Proc_Kernel PPID %5u (0x%08lx): "
"%lu %lu %lu %lu %lu %lu %lu %lu (%s)\n", ppid,
printf ("Proc_Kernel PPID %5d (0x%08lx): "
"%lu %lu %lu %lu %lu %lu %lu %lu (%s)\n", (int) ppid,
(unsigned long) data.proc_kernel.flags,
(unsigned long) data.proc_kernel.k_flags,
(unsigned long) data.proc_kernel.min_flt,
@@ -423,15 +410,16 @@ main (int argc, char *argv [])
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_state (&data.proc_state, 1);
printf ("Proc_State INIT %5u (0x%08lx): '%s', %c, %u, %u\n", 1,
printf ("Proc_State INIT %5d (0x%08lx): '%s', %c, %lu, %lu\n", 1,
(unsigned long) data.proc_state.flags,
data.proc_state.cmd, data.proc_state.state,
data.proc_state.uid, data.proc_state.gid);
(unsigned long) data.proc_state.uid,
(unsigned long) data.proc_state.gid);
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_uid (&data.proc_uid, 1);
printf ("Proc_Uid INIT %5u (0x%08lx): "
printf ("Proc_Uid INIT %5d (0x%08lx): "
"%d %d %d %d %d %d %d %d %d %d %d %d\n", 1,
(unsigned long) data.proc_uid.flags,
data.proc_uid.uid, data.proc_uid.euid,
@@ -444,7 +432,7 @@ main (int argc, char *argv [])
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_mem (&data.proc_mem, 1);
printf ("Proc_Mem INIT %5u (0x%08lx): "
printf ("Proc_Mem INIT %5d (0x%08lx): "
"%lu %lu %lu %lu %lu %lu\n", 1,
(unsigned long) data.proc_mem.flags,
(unsigned long) data.proc_mem.size,
@@ -457,7 +445,7 @@ main (int argc, char *argv [])
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_segment (&data.proc_segment, 1);
printf ("Proc_Segment INIT %5u (0x%08lx): "
printf ("Proc_Segment INIT %5d (0x%08lx): "
"%lu %lu %lu %lu %lu %lu %lu %lu\n", 1,
(unsigned long) data.proc_segment.flags,
(unsigned long) data.proc_segment.text_rss,
@@ -472,7 +460,7 @@ main (int argc, char *argv [])
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_time (&data.proc_time, 1);
printf ("Proc_Time INIT %5u (0x%08lx): "
printf ("Proc_Time INIT %5d (0x%08lx): "
"%lu %lu %lu %lu %lu %lu %lu %lu %lu\n", 1,
(unsigned long) data.proc_time.flags,
(unsigned long) data.proc_time.start_time,
@@ -488,7 +476,7 @@ main (int argc, char *argv [])
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_signal (&data.proc_signal, 1);
printf ("Proc_Signal INIT %5u (0x%08lx): "
printf ("Proc_Signal INIT %5d (0x%08lx): "
"%lu %lu %lu %lu\n", 1,
(unsigned long) data.proc_signal.flags,
(unsigned long) data.proc_signal.signal,
@@ -499,7 +487,7 @@ main (int argc, char *argv [])
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_kernel (&data.proc_kernel, 1);
printf ("Proc_Kernel INIT %5u (0x%08lx): "
printf ("Proc_Kernel INIT %5d (0x%08lx): "
"%lu %lu %lu %lu %lu %lu %lu %lu (%s)\n", 1,
(unsigned long) data.proc_kernel.flags,
(unsigned long) data.proc_kernel.k_flags,

View File

@@ -79,14 +79,14 @@ main (int argc, char *argv [])
glibtop_init_r (&glibtop_global_server, 0, 0);
if ((argc != 2) || (sscanf (argv [1], "%d", &pid) != 1))
if ((argc != 2) || (sscanf (argv [1], "%d", (int *) &pid) != 1))
glibtop_error ("Usage: %s pid", argv [0]);
#ifdef GLIBTOP_INODEDB
inodedb = glibtop_inodedb_open (0, 0);
#endif
fprintf (stderr, "Getting memory maps for pid %d.\n\n", pid);
fprintf (stderr, "Getting memory maps for pid %d.\n\n", (int) pid);
maps = glibtop_get_proc_map (&procmap, pid);

View File

@@ -29,25 +29,36 @@
#include <glibtop/union.h>
#include <glibtop/sysdeps.h>
#include <math.h>
static void
output (pid_t pid)
{
glibtop_union data;
#if HAVE_LIBGTOP_SMP
unsigned long total;
double p_total, p_utime, p_stime;
double b_total, b_utime, b_stime;
double s_total, s_utime, s_stime;
double my_utime, my_stime;
int ncpu, i;
#endif
printf ("\n");
glibtop_get_proc_state (&data.proc_state, pid);
printf ("Proc_State PID %5u (0x%08lx): "
"'%s', %c, %u, %u\n", pid,
printf ("Proc_State PID %5d (0x%08lx): "
"'%s', %c, %lu, %lu\n", (int) pid,
(unsigned long) data.proc_state.flags,
data.proc_state.cmd, data.proc_state.state,
data.proc_state.uid, data.proc_state.gid);
(unsigned long) data.proc_state.uid,
(unsigned long) data.proc_state.gid);
glibtop_get_proc_uid (&data.proc_uid, pid);
printf ("Proc_Uid PID %5u (0x%08lx): "
"%d %d %d %d %d %d %d %d %d %d %d %d\n", pid,
printf ("Proc_Uid PID %5d (0x%08lx): "
"%d %d %d %d %d %d %d %d %d %d %d %d\n", (int) pid,
(unsigned long) data.proc_uid.flags,
data.proc_uid.uid, data.proc_uid.euid,
data.proc_uid.gid, data.proc_uid.egid,
@@ -58,8 +69,8 @@ output (pid_t pid)
glibtop_get_proc_mem (&data.proc_mem, pid);
printf ("Proc_Mem PID %5u (0x%08lx): "
"%lu %lu %lu %lu %lu %lu\n", pid,
printf ("Proc_Mem PID %5d (0x%08lx): "
"%lu %lu %lu %lu %lu %lu\n", (int) pid,
(unsigned long) data.proc_mem.flags,
(unsigned long) data.proc_mem.size,
(unsigned long) data.proc_mem.vsize,
@@ -70,8 +81,8 @@ output (pid_t pid)
glibtop_get_proc_segment (&data.proc_segment, pid);
printf ("Proc_Segment PID %5u (0x%08lx): "
"%lu %lu %lu %lu %lu %lu %lu %lu\n", pid,
printf ("Proc_Segment PID %5d (0x%08lx): "
"%lu %lu %lu %lu %lu %lu %lu %lu\n", (int) pid,
(unsigned long) data.proc_segment.flags,
(unsigned long) data.proc_segment.text_rss,
(unsigned long) data.proc_segment.shlib_rss,
@@ -84,8 +95,8 @@ output (pid_t pid)
glibtop_get_proc_time (&data.proc_time, pid);
printf ("Proc_Time PID %5u (0x%08lx): "
"%lu %lu %lu %lu %lu %lu %lu %lu %lu\n", pid,
printf ("Proc_Time PID %5d (0x%08lx): "
"%lu %lu %lu %lu %lu %lu %lu %lu %lu\n", (int) pid,
(unsigned long) data.proc_time.flags,
(unsigned long) data.proc_time.start_time,
(unsigned long) data.proc_time.rtime,
@@ -99,8 +110,8 @@ output (pid_t pid)
glibtop_get_proc_signal (&data.proc_signal, pid);
printf ("Proc_Signal PID %5u (0x%08lx): "
"%lu %lu %lu %lu\n", pid,
printf ("Proc_Signal PID %5d (0x%08lx): "
"%lu %lu %lu %lu\n", (int) pid,
(unsigned long) data.proc_signal.flags,
(unsigned long) data.proc_signal.signal,
(unsigned long) data.proc_signal.blocked,
@@ -109,8 +120,8 @@ output (pid_t pid)
glibtop_get_proc_kernel (&data.proc_kernel, pid);
printf ("Proc_Kernel PID %5u (0x%08lx): "
"%lu %lu %lu %lu %lu %lu %lu %lu (%s)\n", pid,
printf ("Proc_Kernel PID %5d (0x%08lx): "
"%lu %lu %lu %lu %lu %lu %lu %lu (%s)\n", (int) pid,
(unsigned long) data.proc_kernel.flags,
(unsigned long) data.proc_kernel.k_flags,
(unsigned long) data.proc_kernel.min_flt,
@@ -123,6 +134,81 @@ output (pid_t pid)
data.proc_kernel.wchan);
printf ("\n");
#if HAVE_LIBGTOP_SMP
ncpu = glibtop_global_server->ncpu;
glibtop_get_proc_time (&data.proc_time, pid);
total = (unsigned long) data.proc_time.utime +
(unsigned long) data.proc_time.stime;
p_total = total ? (double) total : 1.0;
p_utime = (double) data.proc_time.utime * 100.0 / p_total;
p_stime = (double) data.proc_time.stime * 100.0 / p_total;
b_total = p_total / ncpu;
b_utime = (double) data.proc_time.utime / ncpu;
b_stime = (double) data.proc_time.stime / ncpu;
s_total = 0.0; s_utime = 0.0; s_stime = 0.0;
printf ("Proc_Time PID %5d (0x%08lx): %12lu %12lu %12lu\n", (int) pid,
(unsigned long) data.proc_time.flags, total,
(unsigned long) data.proc_time.utime,
(unsigned long) data.proc_time.stime);
for (i = 0; i < ncpu; i++) {
unsigned long this_total;
this_total = (unsigned long) data.proc_time.xcpu_utime [i] +
(unsigned long) data.proc_time.xcpu_stime [i];
printf ("CPU %3d PID %5d (0x%08lx): %12lu %12lu %12lu\n", i,
(int) pid, (unsigned long) data.proc_time.flags, this_total,
(unsigned long) data.proc_time.xcpu_utime [i],
(unsigned long) data.proc_time.xcpu_stime [i]);
s_total += fabs (((double) this_total) - b_total);
s_utime += fabs (((double) data.proc_time.xcpu_utime [i]) - b_utime);
s_stime += fabs (((double) data.proc_time.xcpu_stime [i]) - b_stime);
}
printf ("\n");
printf ("Proc_Time PID %5d (0x%08lx): %12.3f %12.3f %12.3f\n", (int) pid,
(unsigned long) data.proc_time.flags, 100.0, p_utime, p_stime);
for (i = 0; i < ncpu; i++) {
double this_p_total, this_p_utime, this_p_stime;
unsigned long this_total;
this_total = (unsigned long) data.proc_time.xcpu_utime [i] +
(unsigned long) data.proc_time.xcpu_stime [i];
this_p_total = (double) this_total * 100.0 / p_total;
this_p_utime = (double) data.proc_time.xcpu_utime [i] * 100.0 / p_total;
this_p_stime = (double) data.proc_time.xcpu_stime [i] * 100.0 / p_total;
printf ("CPU %3d PID %5d (0x%08lx): %12.3f %12.3f %12.3f\n", i,
(int) pid, (unsigned long) data.proc_time.flags,
this_p_total, this_p_utime, this_p_stime);
}
printf ("\n");
my_utime = (unsigned long) data.proc_time.utime ?
(double) data.proc_time.utime : 1.0;
my_stime = (unsigned long) data.proc_time.stime ?
(double) data.proc_time.stime : 1.0;
printf ("SPIN: %31s %12.3f %12.3f %12.3f\n", "", s_total * 100.0 / p_total,
s_utime * 100.0 / my_utime, s_stime * 100.0 / my_stime);
printf ("\n");
#endif
}
int
@@ -189,3 +275,6 @@ main (int argc, char *argv [])
exit (0);
}

124
examples/smp.c Normal file
View File

@@ -0,0 +1,124 @@
/* $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>, September 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/cpu.h>
#include <glibtop/xmalloc.h>
#include <math.h>
int
main (int argc, char *argv [])
{
glibtop_cpu cpu;
unsigned long frequency;
double total, user, nice, sys, idle;
double b_total, b_user, b_nice, b_sys, b_idle;
double s_total, s_user, s_nice, s_sys, s_idle;
char separator [BUFSIZ], buffer [BUFSIZ];
int ncpu, i;
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, GTOPLOCALEDIR);
textdomain (PACKAGE);
glibtop_get_cpu (&cpu);
ncpu = glibtop_global_server->ncpu ? glibtop_global_server->ncpu : 1;
frequency = (unsigned long) cpu.frequency;
total = ((unsigned long) cpu.total) ? ((double) cpu.total) : 1.0;
user = ((unsigned long) cpu.user) ? ((double) cpu.user) : 1.0;
nice = ((unsigned long) cpu.nice) ? ((double) cpu.nice) : 1.0;
sys = ((unsigned long) cpu.sys) ? ((double) cpu.sys) : 1.0;
idle = ((unsigned long) cpu.idle) ? ((double) cpu.idle) : 1.0;
s_total = s_user = s_nice = s_sys = s_idle = 0.0;
b_total = total / ncpu;
b_user = user / ncpu;
b_nice = nice / ncpu;
b_sys = sys / ncpu;
b_idle = idle / ncpu;
memset (separator, '-', 91);
separator [92] = '\0';
sprintf (buffer, _("Ticks (%d per second):"), frequency);
printf ("\n\n%-26s %12s %12s %12s %12s %12s\n%s\n", buffer,
_("Total"), _("User"), _("Nice"), _("Sys"), _("Idle"), separator);
printf (_("CPU (0x%08lx): %12.0f %12.0f %12.0f %12.0f %12.0f\n\n"),
(unsigned long) cpu.flags, total, user, nice, sys, idle);
for (i = 0; i < glibtop_global_server->ncpu; i++) {
printf (_("CPU %3d (0x%08lx): %12lu %12lu %12lu %12lu %12lu\n"), i,
(unsigned long) cpu.flags,
(unsigned long) cpu.xcpu_total [i],
(unsigned long) cpu.xcpu_user [i],
(unsigned long) cpu.xcpu_nice [i],
(unsigned long) cpu.xcpu_sys [i],
(unsigned long) cpu.xcpu_idle [i]);
s_total += fabs (((double) cpu.xcpu_total [i]) - b_total);
s_user += fabs (((double) cpu.xcpu_user [i]) - b_user);
s_nice += fabs (((double) cpu.xcpu_nice [i]) - b_nice);
s_sys += fabs (((double) cpu.xcpu_sys [i]) - b_sys);
s_idle += fabs (((double) cpu.xcpu_idle [i]) - b_idle);
}
printf ("%s\n\n\n", separator);
printf ("%-26s %12s %12s %12s %12s %12s\n%s\n", _("Percent:"),
_("Total (%)"), _("User (%)"), _("Nice (%)"), _("Sys (%)"),
_("Idle (%)"), separator);
printf (_("CPU (0x%08lx): %12.3f %12.3f %12.3f %12.3f %12.3f\n\n"),
(unsigned long) cpu.flags, (double) total * 100.0 / total,
(double) user * 100.0 / total,
(double) nice * 100.0 / total,
(double) sys * 100.0 / total,
(double) idle * 100.0 / total);
for (i = 0; i < glibtop_global_server->ncpu; i++) {
double p_total, p_user, p_nice, p_sys, p_idle;
p_total = ((double) cpu.xcpu_total [i]) * 100.0 / total;
p_user = ((double) cpu.xcpu_user [i]) * 100.0 / user;
p_nice = ((double) cpu.xcpu_nice [i]) * 100.0 / nice;
p_sys = ((double) cpu.xcpu_sys [i]) * 100.0 / sys;
p_idle = ((double) cpu.xcpu_idle [i]) * 100.0 / idle;
printf (_("CPU %3d (0x%08lx): %12.3f %12.3f %12.3f %12.3f %12.3f\n"),
i, (unsigned long) cpu.flags, p_total, p_user, p_nice,
p_sys, p_idle);
}
printf ("%s\n%-26s %12.3f %12.3f %12.3f %12.3f %12.3f\n\n", separator,
_("Spin:"), s_total * 100.0 / total, s_user * 100.0 / user,
s_nice * 100.0 / nice, s_sys * 100.0 / sys, s_idle * 100.0 / idle);
exit (0);
}

View File

@@ -15,5 +15,5 @@ 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,nwchan):str(wchan)|pid_t(pid)
void|proc_segment|ulong(text_rss,shlib_rss,data_rss,stack_rss,dirty_size,start_code,end_code,start_stack)|pid_t(pid)
glibtop_map_entry *|proc_map|ulong(number,size,total)|pid_t(pid)
glibtop_mountentry *|@mountlist|ulong(number,size,total)|pid_t(all_fs)
glibtop_mountentry *|@mountlist|ulong(number,size,total)|int(all_fs)
void|@fsusage|ulong(blocks,bfree,bavail,files,ffree)|string|mount_dir

View File

@@ -50,6 +50,7 @@ struct _glibtop
int input [2]; /* Pipe client <- server */
int output [2]; /* Pipe client -> server */
int socket; /* Accepted connection of a socket */
int ncpu; /* Number of CPUs, zero if single-processor */
unsigned long os_version_code; /* Version code of the operating system */
const char *name; /* Program name for error messages */
const char *server_command; /* Command used to invoke server */

View File

@@ -32,7 +32,7 @@ function output(line) {
list = params[param];
type = params[param];
sub(/\(.*/, "", type);
sub(/^\w+\(/, "", list); sub(/\)$/, "", list);
sub(/^.*\(/, "", list); sub(/\)$/, "", list);
string = string" (\""type"\"";

View File

@@ -385,6 +385,9 @@ typedef struct _glibtop_loadavg glibtop_loadavg;
struct _glibtop_loadavg
{
u_int64_t flags;
u_int64_t nr_running, /* GLIBTOP_LOADAVG_NR_RUNNING */
nr_tasks, /* GLIBTOP_LOADAVG_NR_TASKS */
last_pid; /* GLIBTOP_LOADAVG_LAST_PID */
double loadavg [3]; /* GLIBTOP_LOADAVG_LOADAVG [3] */
};
</literallayout>
@@ -400,6 +403,27 @@ struct _glibtop_loadavg
<para>
Number of jobs running simultaneously averaged over 1, 5 and 15 minutes
<varlistentry>
<term><parameter>nr_running</parameter></term>
<listitem>
<para>
Number of tasks currently running
<varlistentry>
<term><parameter>nr_tasks</parameter></term>
<listitem>
<para>
Total number of tasks
<varlistentry>
<term><parameter>last_pid</parameter></term>
<listitem>
<para>
Last PID
</variablelist>
&include-loadavg.sgml;

View File

@@ -7,4 +7,4 @@ glibtop_HEADERS = close.h loadavg.h prockernel.h procstate.h \
procsegment.h read.h sysdeps.h xmalloc.h global.h \
procsignal.h read_data.h union.h types.h gnuserv.h \
parameter.h mountlist.h fsusage.h procmap.h signal.h \
inodedb.h
inodedb.h sysinfo.h

View File

@@ -84,8 +84,8 @@ struct _glibtop_response
#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 *));
extern void *glibtop_call_l __P((glibtop *, unsigned, size_t, const void *, size_t, void *));
extern void *glibtop_call_s __P((glibtop *, unsigned, size_t, const void *, size_t, void *));
__END_DECLS

View File

@@ -34,19 +34,33 @@ __BEGIN_DECLS
#define GLIBTOP_CPU_IDLE 4
#define GLIBTOP_CPU_FREQUENCY 5
#define GLIBTOP_MAX_CPU 6
#define GLIBTOP_XCPU_TOTAL 6
#define GLIBTOP_XCPU_USER 7
#define GLIBTOP_XCPU_NICE 8
#define GLIBTOP_XCPU_SYS 9
#define GLIBTOP_XCPU_IDLE 10
#define GLIBTOP_MAX_CPU 11
/* Nobody should really be using more than 4 processors. */
#define GLIBTOP_NCPU 4
typedef struct _glibtop_cpu glibtop_cpu;
struct _glibtop_cpu
{
u_int64_t flags,
total, /* GLIBTOP_CPU_TOTAL */
user, /* GLIBTOP_CPU_USER */
nice, /* GLIBTOP_CPU_NICE */
sys, /* GLIBTOP_CPU_SYS */
idle, /* GLIBTOP_CPU_IDLE */
frequency; /* GLIBTOP_CPU_FREQUENCY */
total, /* GLIBTOP_CPU_TOTAL */
user, /* GLIBTOP_CPU_USER */
nice, /* GLIBTOP_CPU_NICE */
sys, /* GLIBTOP_CPU_SYS */
idle, /* GLIBTOP_CPU_IDLE */
frequency, /* GLIBTOP_CPU_FREQUENCY */
xcpu_total [GLIBTOP_NCPU], /* GLIBTOP_XCPU_TOTAL */
xcpu_user [GLIBTOP_NCPU], /* GLIBTOP_XCPU_USER */
xcpu_nice [GLIBTOP_NCPU], /* GLIBTOP_XCPU_NICE */
xcpu_sys [GLIBTOP_NCPU], /* GLIBTOP_XCPU_SYS */
xcpu_idle [GLIBTOP_NCPU]; /* GLIBTOP_XCPU_IDLE */
};
#define glibtop_get_cpu(cpu) glibtop_get_cpu_l(glibtop_global_server, cpu)

View File

@@ -62,6 +62,10 @@
# endif
#endif
#ifdef NEED_GNOMESUPPORT_H
#include <gnomesupport.h>
#endif
#ifdef WITHOUT_GUILE
#undef GLIBTOP_GUILE
#undef GLIBTOP_GUILE_NAMES

View File

@@ -23,6 +23,7 @@
#define __GLIBTOP_PROCTIME_H__
#include <glibtop.h>
#include <glibtop/cpu.h>
#include <glibtop/global.h>
__BEGIN_DECLS
@@ -36,8 +37,10 @@ __BEGIN_DECLS
#define GLIBTOP_PROC_TIME_TIMEOUT 6
#define GLIBTOP_PROC_TIME_IT_REAL_VALUE 7
#define GLIBTOP_PROC_TIME_FREQUENCY 8
#define GLIBTOP_PROC_TIME_XCPU_UTIME 9
#define GLIBTOP_PROC_TIME_XCPU_STIME 10
#define GLIBTOP_MAX_PROC_TIME 9
#define GLIBTOP_MAX_PROC_TIME 11
typedef struct _glibtop_proc_time glibtop_proc_time;
@@ -60,7 +63,9 @@ struct _glibtop_proc_time
it_real_value, /* The time (in jiffies) before the
* next SIGALRM is sent to the process
* due to an interval timer. */
frequency; /* Tick frequency. */
frequency, /* Tick frequency. */
xcpu_utime [GLIBTOP_NCPU], /* utime and stime for all CPUs on */
xcpu_stime [GLIBTOP_NCPU]; /* SMP machines. */
};
#define glibtop_get_proc_time(p1, p2) glibtop_get_proc_time_l(glibtop_global_server, p1, p2)

62
include/glibtop/sysinfo.h Normal file
View File

@@ -0,0 +1,62 @@
/* $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_SYSINFO_H__
#define __GLIBTOP_SYSINFO_H__
#include <glibtop.h>
#include <glibtop/cpu.h>
#include <glibtop/global.h>
#include <glib.h>
__BEGIN_DECLS
#define GLIBTOP_SYSINFO_CPUINFO 0
#define GLIBTOP_MAX_SYSINFO 1
typedef struct _glibtop_sysinfo glibtop_sysinfo;
typedef struct _glibtop_entry glibtop_entry;
struct _glibtop_entry
{
GPtrArray *labels;
GHashTable *values;
GHashTable *descriptions;
};
struct _glibtop_sysinfo
{
u_int64_t flags, ncpu;
glibtop_entry cpuinfo [GLIBTOP_NCPU];
};
#define glibtop_get_sysinfo() glibtop_get_sysinfo_s(glibtop_global_server)
#define glibtop_get_sysinfo_r glibtop_get_sysinfo_s
extern glibtop_sysinfo * glibtop_get_sysinfo_s __P((glibtop *));
__END_DECLS
#endif

View File

@@ -37,7 +37,7 @@ extern void *glibtop_malloc_r __P((glibtop *, size_t));
extern void *glibtop_calloc_r __P((glibtop *, size_t, size_t));
extern void *glibtop_realloc_r __P((glibtop *, void *, size_t));
extern char *glibtop_strdup_r __P((glibtop *, const char *));
extern void glibtop_free_r __P((glibtop *, void *));
extern void glibtop_free_r __P((glibtop *, const void *));
__END_DECLS

View File

@@ -8,6 +8,8 @@ libgtop_la_SOURCES = init.c open.c close.c command.c read.c \
read_data.c write.c lib.c parameter.c \
sysdeps.c
libgtop_la_LDFLAGS = $(LT_VERSION_INFO)
BUILT_SOURCES = lib.c
lib.c: lib.awk $(top_builddir)/config.h $(top_srcdir)/features.def

View File

@@ -28,7 +28,7 @@
void *
glibtop_call_l (glibtop *server, unsigned command, size_t send_size,
void *send_buf, size_t recv_size, void *recv_buf)
const void *send_buf, size_t recv_size, void *recv_buf)
{
glibtop_command cmnd;
glibtop_response response;

View File

@@ -31,7 +31,7 @@
static glibtop _glibtop_global_server;
glibtop *glibtop_global_server = &_glibtop_global_server;
void
static void
_init_server (glibtop *server, const unsigned features)
{
char *command, *temp;

View File

@@ -68,7 +68,7 @@ function output(line) {
if (param_def == "string") {
call_param = ", "line_fields[5];
param_decl = ",\n "space" const char *"line_fields[5];
send_ptr = "\n\tvoid *send_ptr = "line_fields[5]";";
send_ptr = "\n\tconst void *send_ptr = "line_fields[5]";";
send_size = "\n\tconst size_t send_size =\n\t\tstrlen ("line_fields[5]") + 1;";
} else {
call_param = "";
@@ -80,7 +80,7 @@ function output(line) {
list = params[param];
type = params[param];
sub(/\(.*/, "", type);
sub(/^\w+\(/, "", list); sub(/\)$/, "", list);
sub(/^.*\(/, "", list); sub(/\)$/, "", list);
count = split (list, fields, /,/);
for (field = 1; field <= count; field++) {
if (param_decl == "")
@@ -90,7 +90,7 @@ function output(line) {
param_decl = param_decl""convert[type]" "fields[field];
call_param = call_param", "fields[field];
if (send_ptr == "")
send_ptr = "\n\tvoid *send_ptr = &"fields[field]";";
send_ptr = "\n\tconst void *send_ptr = &"fields[field]";";
if (send_size == "")
send_size = "\n\tconst size_t send_size =\n\t\t";
else
@@ -103,14 +103,14 @@ function output(line) {
else
send_size = "\n\tconst size_t send_size = 0;";
if (send_ptr == "")
send_ptr = "\n\tvoid *send_ptr = NULL;";
send_ptr = "\n\tconst void *send_ptr = NULL;";
}
print "glibtop_get_"feature"_l (glibtop *server, glibtop_"feature" *buf"param_decl")";
print "{"send_ptr""send_size;
if (retval !~ /^void$/)
print "\t"retval" retval;";
print "\t"retval" retval = ("retval") 0;";
print "";
print "\tglibtop_init_r (&server, (1 << GLIBTOP_SYSDEPS_"toupper(feature)"), 0);";

View File

@@ -27,7 +27,7 @@
void *
glibtop_read_data_l (glibtop *server)
{
size_t size;
size_t size;
void *ptr;
int ret;
@@ -38,9 +38,9 @@ glibtop_read_data_l (glibtop *server)
#endif
if (server->socket) {
ret = recv (server->socket, &size, sizeof (size_t), 0);
ret = recv (server->socket, (void *)&size, sizeof (size_t), 0);
} else {
ret = read (server->input [0], &size, sizeof (size_t));
ret = read (server->input [0], (void *)&size, sizeof (size_t));
}
if (ret < 0)

View File

@@ -1,5 +1,5 @@
# Note that this is NOT a relocatable package
%define ver 0.25.0
%define ver 0.26.2
%define rel SNAP
%define prefix /usr

View File

@@ -25,7 +25,9 @@ LIBGTOP_SERVER="@LIBGTOP_SERVER@"
LIBGTOP_MAJOR_VERSION="@LIBGTOP_MAJOR_VERSION@"
LIBGTOP_MINOR_VERSION="@LIBGTOP_MINOR_VERSION@"
LIBGTOP_MICRO_VERSION="@LIBGTOP_MICRO_VERSION@"
LIBGTOP_VERSION="@LIBGTOP_VERSION@"
LIBGTOP_VERSION_CODE="@LIBGTOP_VERSION_CODE@"
LIBGTOP_SERVER_VERSION="@LIBGTOP_SERVER_VERSION@"

326
po/fr.po
View File

@@ -13,50 +13,6 @@ msgstr ""
"Content-Type: text/plain; charset=iso-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
#: lib/read.c:69
msgid "read %d bytes"
msgstr ""
#: lib/read_data.c:47
msgid "read data size"
msgstr ""
#: lib/read_data.c:64
msgid "read data %d bytes"
msgstr ""
#: lib/write.c:46
msgid "write %d bytes"
msgstr ""
#: sysdeps/names/loadavg.c:37
msgid "Load Average"
msgstr "Charge Moyenne"
#: sysdeps/names/loadavg.c:38
msgid "Running Tasks"
msgstr ""
#: sysdeps/names/loadavg.c:39
msgid "Number of Tasks"
msgstr ""
#: sysdeps/names/loadavg.c:40 sysdeps/names/loadavg.c:48
msgid "Last PID"
msgstr ""
#: sysdeps/names/loadavg.c:45
msgid "Number of jobs running simultaneously averaged over 1, 5 and 15 minutes"
msgstr "Nombre de processus tournant simultannement en moyenne sur 1, 5 et 15 minutes"
#: sysdeps/names/loadavg.c:46
msgid "Number of tasks currently running"
msgstr ""
#: sysdeps/names/loadavg.c:47
msgid "Total number of tasks"
msgstr ""
#: sysdeps/names/cpu.c:37
msgid "Total CPU Time"
msgstr "Temps CPU Total"
@@ -105,33 +61,61 @@ msgstr ""
msgid "All of the above values are in jiffies (1/100ths of a second) unless otherwise stated in this field (i.e. 'frequency != 100')"
msgstr ""
#: sysdeps/names/msg_limits.c:38 sysdeps/names/msg_limits.c:49
msgid "Size in kilobytes of message pool"
msgstr "Taille en kilo-octets du pool de messages"
#: sysdeps/names/msg_limits.c:39 sysdeps/names/msg_limits.c:50
msgid "Number of entries in message map"
#: sysdeps/names/fsusage.c:37 sysdeps/names/fsusage.c:46
msgid "Total blocks"
msgstr ""
#: sysdeps/names/msg_limits.c:40 sysdeps/names/msg_limits.c:51
msgid "Max size of message"
msgstr "Taille maximum des messages"
#: sysdeps/names/fsusage.c:38
msgid "Free blocks"
msgstr ""
#: sysdeps/names/msg_limits.c:41 sysdeps/names/msg_limits.c:52
msgid "Default max size of queue"
msgstr "Taille maximum par d\351faut de la queue"
#: sysdeps/names/fsusage.c:39
msgid "Available blocks"
msgstr ""
#: sysdeps/names/msg_limits.c:42 sysdeps/names/msg_limits.c:53
msgid "Max queues system wide"
msgstr "Nombre maximum de queues dans le syst\350me"
#: sysdeps/names/fsusage.c:40 sysdeps/names/fsusage.c:49
msgid "Total file nodes"
msgstr ""
#: sysdeps/names/msg_limits.c:43 sysdeps/names/msg_limits.c:54
msgid "Message segment size"
msgstr "Taille des segments de messages"
#: sysdeps/names/fsusage.c:41 sysdeps/names/fsusage.c:50
msgid "Free file nodes"
msgstr ""
#: sysdeps/names/msg_limits.c:44 sysdeps/names/msg_limits.c:55
msgid "Number of system message headers"
msgstr "Nombre d'entetes de messages syst\350me"
#: sysdeps/names/fsusage.c:47
msgid "Free blocks available to the superuser"
msgstr ""
#: sysdeps/names/fsusage.c:48
msgid "Free blocks available to non-superusers"
msgstr ""
#: sysdeps/names/loadavg.c:37
msgid "Load Average"
msgstr "Charge Moyenne"
#: sysdeps/names/loadavg.c:38
msgid "Running Tasks"
msgstr ""
#: sysdeps/names/loadavg.c:39
msgid "Number of Tasks"
msgstr ""
#: sysdeps/names/loadavg.c:40 sysdeps/names/loadavg.c:48
msgid "Last PID"
msgstr ""
#: sysdeps/names/loadavg.c:45
msgid "Number of jobs running simultaneously averaged over 1, 5 and 15 minutes"
msgstr "Nombre de processus tournant simultannement en moyenne sur 1, 5 et 15 minutes"
#: sysdeps/names/loadavg.c:46
msgid "Number of tasks currently running"
msgstr ""
#: sysdeps/names/loadavg.c:47
msgid "Total number of tasks"
msgstr ""
#: sysdeps/names/mem.c:39
msgid "Total Memory"
@@ -197,6 +181,46 @@ msgstr "M\351moire utilis\351e par les processus utilisateurs en Ko"
msgid "Memory in locked pages in kB"
msgstr "M\351moire dans les pages v\351rouill\351es en Ko"
#: sysdeps/names/mountlist.c:36 sysdeps/names/mountlist.c:43 sysdeps/names/proclist.c:36 sysdeps/names/proclist.c:43 sysdeps/names/procmap.c:36 sysdeps/names/procmap.c:43
msgid "Number of list elements"
msgstr ""
#: sysdeps/names/mountlist.c:37 sysdeps/names/mountlist.c:44 sysdeps/names/proclist.c:37 sysdeps/names/proclist.c:44 sysdeps/names/procmap.c:37 sysdeps/names/procmap.c:44
msgid "Total size of list"
msgstr "Taille totalle de la liste"
#: sysdeps/names/mountlist.c:38 sysdeps/names/mountlist.c:45 sysdeps/names/proclist.c:38 sysdeps/names/proclist.c:45 sysdeps/names/procmap.c:38 sysdeps/names/procmap.c:45
msgid "Size of a single list element"
msgstr ""
#: sysdeps/names/msg_limits.c:38 sysdeps/names/msg_limits.c:49
msgid "Size in kilobytes of message pool"
msgstr "Taille en kilo-octets du pool de messages"
#: sysdeps/names/msg_limits.c:39 sysdeps/names/msg_limits.c:50
msgid "Number of entries in message map"
msgstr ""
#: sysdeps/names/msg_limits.c:40 sysdeps/names/msg_limits.c:51
msgid "Max size of message"
msgstr "Taille maximum des messages"
#: sysdeps/names/msg_limits.c:41 sysdeps/names/msg_limits.c:52
msgid "Default max size of queue"
msgstr "Taille maximum par d\351faut de la queue"
#: sysdeps/names/msg_limits.c:42 sysdeps/names/msg_limits.c:53
msgid "Max queues system wide"
msgstr "Nombre maximum de queues dans le syst\350me"
#: sysdeps/names/msg_limits.c:43 sysdeps/names/msg_limits.c:54
msgid "Message segment size"
msgstr "Taille des segments de messages"
#: sysdeps/names/msg_limits.c:44 sysdeps/names/msg_limits.c:55
msgid "Number of system message headers"
msgstr "Nombre d'entetes de messages syst\350me"
#: sysdeps/names/prockernel.c:40
msgid "K_Flags"
msgstr ""
@@ -282,18 +306,6 @@ msgstr ""
msgid "This is the textual name of the `nwchan' field."
msgstr ""
#: sysdeps/names/proclist.c:36 sysdeps/names/proclist.c:43
msgid "Number of list elements"
msgstr ""
#: sysdeps/names/proclist.c:37 sysdeps/names/proclist.c:44
msgid "Total size of list"
msgstr "Taille totalle de la liste"
#: sysdeps/names/proclist.c:38 sysdeps/names/proclist.c:45
msgid "Size of a single list element"
msgstr ""
#: sysdeps/names/procmem.c:45
msgid "Size"
msgstr ""
@@ -726,22 +738,6 @@ msgstr ""
msgid "Total number of swap pages that have been brought out since system boot"
msgstr ""
#: sysdeps/names/uptime.c:36
msgid "Uptime"
msgstr "Uptime"
#: sysdeps/names/uptime.c:37
msgid "Idletime"
msgstr "Idletime"
#: sysdeps/names/uptime.c:42
msgid "Time in seconds since system boot"
msgstr "Temps en secondes depuis le d\351marrage du syst\350me"
#: sysdeps/names/uptime.c:43
msgid "Time in seconds the system spent in the idle task since system boot"
msgstr "Temps en secondes pass\351 dans le processus inactif depuis le d\351marrage du syst\350me"
#: sysdeps/names/sysdeps.c:46 sysdeps/names/sysdeps.c:70
msgid "Server Features"
msgstr ""
@@ -826,128 +822,36 @@ msgstr ""
msgid "List of currently mounted filesystems"
msgstr ""
#: sysdeps/osf1/siglist.c:26
msgid "Hangup"
#: sysdeps/names/uptime.c:36
msgid "Uptime"
msgstr "Uptime"
#: sysdeps/names/uptime.c:37
msgid "Idletime"
msgstr "Idletime"
#: sysdeps/names/uptime.c:42
msgid "Time in seconds since system boot"
msgstr "Temps en secondes depuis le d\351marrage du syst\350me"
#: sysdeps/names/uptime.c:43
msgid "Time in seconds the system spent in the idle task since system boot"
msgstr "Temps en secondes pass\351 dans le processus inactif depuis le d\351marrage du syst\350me"
#: lib/read.c:69
msgid "read %d bytes"
msgstr ""
#: sysdeps/osf1/siglist.c:27
msgid "Interrupt"
#: lib/read_data.c:47
msgid "read data size"
msgstr ""
#: sysdeps/osf1/siglist.c:28
msgid "Quit"
#: lib/read_data.c:64
msgid "read data %d bytes"
msgstr ""
#: sysdeps/osf1/siglist.c:29
msgid "Illegal instruction"
msgstr ""
#: sysdeps/osf1/siglist.c:30
msgid "Trace trap"
msgstr ""
#: sysdeps/osf1/siglist.c:31
msgid "Abort"
msgstr ""
#: sysdeps/osf1/siglist.c:32
msgid "EMT error"
msgstr ""
#: sysdeps/osf1/siglist.c:33
msgid "Floating-point exception"
msgstr ""
#: sysdeps/osf1/siglist.c:34
msgid "Kill"
msgstr ""
#: sysdeps/osf1/siglist.c:35
msgid "Bus error"
msgstr ""
#: sysdeps/osf1/siglist.c:36
msgid "Segmentation violation"
msgstr ""
#: sysdeps/osf1/siglist.c:37
msgid "Bad argument to system call"
msgstr ""
#: sysdeps/osf1/siglist.c:38
msgid "Broken pipe"
msgstr ""
#: sysdeps/osf1/siglist.c:39
msgid "Alarm clock"
msgstr ""
#: sysdeps/osf1/siglist.c:40
msgid "Termination"
msgstr ""
#: sysdeps/osf1/siglist.c:41
msgid "Urgent condition on socket"
msgstr ""
#: sysdeps/osf1/siglist.c:42
msgid "Stop"
msgstr ""
#: sysdeps/osf1/siglist.c:43
msgid "Keyboard stop"
msgstr ""
#: sysdeps/osf1/siglist.c:44
msgid "Continue"
msgstr ""
#: sysdeps/osf1/siglist.c:45
msgid "Child status has changed"
msgstr ""
#: sysdeps/osf1/siglist.c:46
msgid "Background read from tty"
msgstr ""
#: sysdeps/osf1/siglist.c:47
msgid "Background write to tty"
msgstr ""
#: sysdeps/osf1/siglist.c:48
msgid "I/O now possible"
msgstr ""
#: sysdeps/osf1/siglist.c:49
msgid "CPU limit exceeded"
msgstr ""
#: sysdeps/osf1/siglist.c:50
msgid "File size limit exceeded"
msgstr ""
#: sysdeps/osf1/siglist.c:51
msgid "Virtual alarm clock"
msgstr ""
#: sysdeps/osf1/siglist.c:52
msgid "Profiling alarm clock"
msgstr ""
#: sysdeps/osf1/siglist.c:53
msgid "Window size change"
msgstr ""
#: sysdeps/osf1/siglist.c:54
msgid "Information request"
msgstr ""
#: sysdeps/osf1/siglist.c:55
msgid "User defined signal 1"
msgstr ""
#: sysdeps/osf1/siglist.c:56
msgid "User defined signal 2"
#: lib/write.c:46
msgid "write %d bytes"
msgstr ""
#: support/argp-help.c:185
@@ -1018,6 +922,10 @@ msgstr ""
msgid "(PROGRAM ERROR) Option should have been recognized!?"
msgstr ""
#: support/error.c:109
msgid "Unknown system error"
msgstr ""
#: support/getopt.c:669
msgid "%s: option `%s' is ambiguous\n"
msgstr ""

11
src/daemon/ChangeLog Normal file
View File

@@ -0,0 +1,11 @@
1998-08-25 Martin Baulig <martin@home-of-linux.org>
* daemon.h (handle_parent_connection): Added prototype.
* write.c, io.c: Added cast to `const void *' in calls to
`write' and `send' to avoid compiler warnings.
* gnuserv.c (handle_signal): Declared static.
(main): Casting return value of `getuid' to `int' in
debugging statement.
* ChangeLog: New file.

View File

@@ -23,12 +23,10 @@ libgtop_daemon_LDADD = $(top_builddir)/lib/libgtop.la \
@sysdeps_suid_lib@ \
$(suid_sysdeps) $(suid_common)\
@INTLLIBS@ @LIBSUPPORT@ @X_LIBS@ -lXau
libgtop_daemon_LDFLAGS = -static
libgtop_server_SOURCES = server.c slave.c io.c version.c daemon.h
libgtop_server_LDADD = $(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps_suid.la \
$(top_builddir)/sysdeps/common/libgtop_suid_common.la \
@LIBSUPPORT@
libgtop_server_LDFLAGS = -static
EXTRA_DIST = server_config.h.in server_config.pl

View File

@@ -50,6 +50,7 @@ __BEGIN_DECLS
#define MSG_BUFSZ sizeof (struct _glibtop_ipc_message)
#define MSG_MSGSZ (MSG_BUFSZ - sizeof (long))
extern void handle_parent_connection __P((int));
extern void handle_slave_connection __P((int, int));
extern void handle_slave_command __P((glibtop_command *, glibtop_response *, const void *));

View File

@@ -43,6 +43,7 @@
#include <fcntl.h>
#include <sys/wait.h>
#include <sys/socket.h>
#ifdef AIX
#include <sys/select.h>
@@ -480,7 +481,7 @@ handle_unix_request (int ls)
#endif /* UNIX_DOMAIN_SOCKETS */
void
static void
handle_signal (int sig)
{
fprintf (stderr, "Catched signal %d.\n", sig);
@@ -521,8 +522,11 @@ main (int argc, char *argv [])
/* Temporarily drop our priviledges. */
#ifdef DEBUG
fprintf (stderr, "Child ID: (%d, %d) - (%d, %d)\n",
getuid (), geteuid (), getgid (), getegid ());
(int) getuid (), (int) geteuid (),
(int) getgid (), (int) getegid ());
#endif
if (setreuid (geteuid (), getuid ()))
glibtop_error_io ("setreuid (euid <-> uid)");
@@ -530,8 +534,11 @@ main (int argc, char *argv [])
if (setregid (getegid (), getgid ()))
glibtop_error_io ("setregid (egid <-> gid)");
#ifdef DEBUG
fprintf (stderr, "Child ID: (%d, %d) - (%d, %d)\n",
getuid (), geteuid (), getgid (), getegid ());
(int) getuid (), (int) geteuid (),
(int) getgid (), (int) getegid ());
#endif
#ifdef UNIX_DOMAIN_SOCKETS
/* get a unix domain socket to listen on. */

View File

@@ -34,10 +34,10 @@ do_output (int s, glibtop_response *resp, off_t offset,
resp->data_size = data_size;
if (s == 0) {
if (write (1, resp, sizeof (glibtop_response)) < 0)
if (write (1, (const void *) resp, sizeof (glibtop_response)) < 0)
glibtop_warn_io ("write");
} else {
if (send (s, resp, sizeof (glibtop_response), 0) < 0)
if (send (s, (const void *) resp, sizeof (glibtop_response), 0) < 0)
glibtop_warn_io ("send");
}

View File

@@ -41,18 +41,18 @@ glibtop_send_version (glibtop *server, int fd)
fprintf (stderr, "SERVER ID: |%s|\n", buffer);
if (fd == 0) {
if (write (1, &size, sizeof (size)) < 0)
if (write (1, (const void *) &size, sizeof (size)) < 0)
glibtop_warn_io_r (server, "write");
} else {
if (send (fd, &size, sizeof (size), 0) < 0)
if (send (fd, (const void *) &size, sizeof (size), 0) < 0)
glibtop_warn_io_r (server, "send");
}
if (fd == 0) {
if (write (1, buffer, size) < 0)
if (write (1, (const void *) buffer, size) < 0)
glibtop_warn_io_r (server, "write");
} else {
if (send (fd, buffer, size, 0) < 0)
if (send (fd, (const void *) buffer, size, 0) < 0)
glibtop_warn_io_r (server, "send");
}
}

View File

@@ -16,6 +16,11 @@ libgtop_common_la_SOURCES = xmalloc.c error.c gnuslib.c \
fsusage.c fsusage.h mountlist.c mountlist.h \
$(inodedb_SRCLIST)
libgtop_common_la_LDFLAGS = $(LT_VERSION_INFO)
libgtop_common_la_LIBADD = $(LIBGTOP_EXTRA_LIBS)
libgtop_suid_common_la_SOURCES = xmalloc.c error.c sysdeps_suid.c
libgtop_suid_common_la_LDFLAGS = $(LT_VERSION_INFO)
EXTRA_DIST = inodedb.c

View File

@@ -64,7 +64,7 @@ glibtop_strdup_r (glibtop *server, const char *string)
}
void
glibtop_free_r (glibtop *server, void *ptr)
glibtop_free_r (glibtop *server, const void *ptr)
{
if (ptr) free (ptr);
if (ptr) free ((void *) ptr);
}

View File

@@ -1,3 +1,15 @@
1998-08-24 Martin Baulig <martin@home-of-linux.org>
* *.c (glibtop_init_p): Using correct `(1 << GLIBTOP_SYSDPES_*)'.
* cpu.c, mem.c: Removed `const' from sysctl () constants to keep
compiler happy.
* procmem.c: Added missing call to `glibtop_init_p'.
* prockernel.c: Casting `nwchan' to `unsigned long' since this
normally has the same size than a pointer. Well, is there a
FreeBSD for 64bit architectures ?
1998-08-08 Martin Baulig <martin@home-of-linux.org>
* swap.c: Added swap usage based upton the source code

View File

@@ -8,10 +8,16 @@ lib_LTLIBRARIES = libgtop_sysdeps.la libgtop_sysdeps_suid.la
libgtop_sysdeps_la_SOURCES = nosuid.c siglist.c
libgtop_sysdeps_la_LDFLAGS = $(LT_VERSION_INFO)
libgtop_sysdeps_suid_la_SOURCES = open.c close.c siglist.c cpu.c mem.c swap.c \
uptime.c loadavg.c shm_limits.c msg_limits.c \
sem_limits.c proclist.c procstate.c procuid.c \
proctime.c procmem.c procsignal.c prockernel.c \
procsegment.c procmap.c
include_HEADERS = glibtop_server.h glibtop_machine.h
libgtop_sysdeps_suid_la_LDFLAGS = $(LT_VERSION_INFO)
include_HEADERS = glibtop_server.h glibtop_machine.h \
glibtop_suid.h

View File

@@ -37,8 +37,8 @@ static struct nlist nlst [] = {
};
/* MIB array for sysctl */
static const int mib_length=2;
static const int mib [] = { CTL_KERN, KERN_CLOCKRATE };
static int mib_length=2;
static int mib [] = { CTL_KERN, KERN_CLOCKRATE };
/* Init function. */
@@ -61,7 +61,7 @@ glibtop_get_cpu_p (glibtop *server, glibtop_cpu *buf)
struct clockinfo ci;
size_t length;
glibtop_init_p (server, GLIBTOP_SYSDEPS_CPU, 0);
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_CPU), 0);
memset (buf, 0, sizeof (glibtop_cpu));

View File

@@ -44,7 +44,7 @@ glibtop_get_loadavg_p (glibtop *server, glibtop_loadavg *buf)
double ldavg[3];
int i;
glibtop_init_p (server, GLIBTOP_SYSDEPS_LOADAVG, 0);
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_LOADAVG), 0);
memset (buf, 0, sizeof (glibtop_loadavg));

View File

@@ -53,8 +53,8 @@ static struct nlist nlst [] = {
};
/* MIB array for sysctl */
static const int mib_length=2;
static const int mib [] = { CTL_VM, VM_METER };
static int mib_length=2;
static int mib [] = { CTL_VM, VM_METER };
/* Init function. */
@@ -89,7 +89,7 @@ glibtop_get_mem_p (glibtop *server, glibtop_mem *buf)
struct vmmeter vmm;
int bufspace;
glibtop_init_p (server, GLIBTOP_SYSDEPS_MEM, 0);
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_MEM), 0);
memset (buf, 0, sizeof (glibtop_mem));

View File

@@ -68,7 +68,7 @@ glibtop_init_msg_limits_p (glibtop *server)
void
glibtop_get_msg_limits_p (glibtop *server, glibtop_msg_limits *buf)
{
glibtop_init_p (server, GLIBTOP_SYSDEPS_MSG_LIMITS, 0);
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_MSG_LIMITS), 0);
memset (buf, 0, sizeof (glibtop_msg_limits));

View File

@@ -71,7 +71,7 @@ glibtop_get_proc_kernel_p (glibtop *server,
struct pcb pcb;
int f, count;
glibtop_init_p (server, GLIBTOP_SYSDEPS_PROC_KERNEL, 0);
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_KERNEL), 0);
memset (buf, 0, sizeof (glibtop_proc_kernel));
@@ -130,7 +130,7 @@ glibtop_get_proc_kernel_p (glibtop *server,
glibtop_suid_leave (server);
buf->nwchan = (u_int64_t) pinfo [0].kp_proc.p_wchan &~ KERNBASE;
buf->nwchan = (unsigned long) pinfo [0].kp_proc.p_wchan &~ KERNBASE;
if (pinfo [0].kp_proc.p_wchan && pinfo [0].kp_proc.p_wmesg) {
strncpy (buf->wchan, pinfo [0].kp_eproc.e_wmesg,

View File

@@ -65,7 +65,7 @@ glibtop_get_proclist_p (glibtop *server, glibtop_proclist *buf,
int count;
int i;
glibtop_init_p (server, GLIBTOP_SYSDEPS_PROCLIST, 0);
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROCLIST), 0);
memset (buf, 0, sizeof (glibtop_proclist));

View File

@@ -97,6 +97,10 @@ glibtop_get_proc_mem_p (glibtop *server, glibtop_proc_mem *buf,
struct inode inode;
int count;
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_MEM), 0);
memset (buf, 0, sizeof (glibtop_proc_mem));
glibtop_suid_enter (server);
/* Get the process data */

View File

@@ -49,7 +49,7 @@ glibtop_get_proc_segment_p (glibtop *server,
struct kinfo_proc *pinfo;
int *count;
glibtop_init_p (server, GLIBTOP_SYSDEPS_PROC_SEGMENT, 0);
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_SEGMENT), 0);
memset (buf, 0, sizeof (glibtop_proc_segment));

View File

@@ -47,7 +47,7 @@ glibtop_get_proc_signal_p (glibtop *server,
struct kinfo_proc *pinfo;
int count = 0;
glibtop_init_p (server, GLIBTOP_SYSDEPS_PROC_SIGNAL, 0);
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_SIGNAL), 0);
memset (buf, 0, sizeof (glibtop_proc_signal));

View File

@@ -49,7 +49,7 @@ glibtop_get_proc_state_p (glibtop *server,
struct kinfo_proc *pinfo;
int count = 0;
glibtop_init_p (server, GLIBTOP_SYSDEPS_PROC_STATE, 0);
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_STATE), 0);
memset (buf, 0, sizeof (glibtop_proc_state));

View File

@@ -109,7 +109,7 @@ glibtop_get_proc_time_p (glibtop *server, glibtop_proc_time *buf,
int f, count;
quad_t totusec;
glibtop_init_p (server, GLIBTOP_SYSDEPS_PROC_TIME, 0);
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_TIME), 0);
memset (buf, 0, sizeof (glibtop_proc_time));

View File

@@ -49,7 +49,7 @@ glibtop_get_proc_uid_p (glibtop *server, glibtop_proc_uid *buf,
struct kinfo_proc *pinfo;
int count = 0;
glibtop_init_p (server, GLIBTOP_SYSDEPS_PROC_UID, 0);
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_UID), 0);
memset (buf, 0, sizeof (glibtop_proc_uid));

View File

@@ -70,7 +70,7 @@ glibtop_init_sem_limits_p (glibtop *server)
void
glibtop_get_sem_limits_p (glibtop *server, glibtop_sem_limits *buf)
{
glibtop_init_p (server, GLIBTOP_SYSDEPS_SEM_LIMITS, 0);
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_SEM_LIMITS), 0);
memset (buf, 0, sizeof (glibtop_sem_limits));

View File

@@ -68,7 +68,7 @@ glibtop_init_shm_limits_p (glibtop *server)
void
glibtop_get_shm_limits_p (glibtop *server, glibtop_shm_limits *buf)
{
glibtop_init_p (server, GLIBTOP_SYSDEPS_SHM_LIMITS, 0);
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_SHM_LIMITS), 0);
memset (buf, 0, sizeof (glibtop_shm_limits));

View File

@@ -88,7 +88,7 @@ glibtop_get_swap_p (glibtop *server, glibtop_swap *buf)
static int swappgsin = -1;
static int swappgsout = -1;
glibtop_init_p (server, GLIBTOP_SYSDEPS_SWAP, 0);
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_SWAP), 0);
memset (buf, 0, sizeof (glibtop_swap));

View File

@@ -49,7 +49,7 @@ glibtop_get_uptime_p (glibtop *server, glibtop_uptime *buf)
{
glibtop_cpu cpu;
glibtop_init_p (server, GLIBTOP_SYSDEPS_UPTIME, 0);
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_UPTIME), 0);
memset (buf, 0, sizeof (glibtop_uptime));

View File

@@ -8,6 +8,8 @@ lib_LTLIBRARIES = libgtop_guile.la
libgtop_guile_la_SOURCES = guile.c
libgtop_guile_la_LDFLAGS = $(LT_VERSION_INFO)
BUILT_SOURCES = guile.c
guile.c: guile.awk $(top_builddir)/config.h $(top_srcdir)/features.def

View File

@@ -48,7 +48,7 @@ function make_output(line) {
list = params[param];
type = params[param];
sub(/\(.*/, "", type);
sub(/^\w+\(/, "", list); sub(/\)$/, "", list);
sub(/^.*\(/, "", list); sub(/\)$/, "", list);
count = split (list, fields, /,/);
total_nr_params = total_nr_params + count;
for (field = 1; field <= count; field++) {
@@ -87,7 +87,7 @@ function make_output(line) {
list = elements[element];
type = elements[element];
sub(/\(.*/, "", type);
sub(/^\w+\(/, "", list); sub(/\)$/, "", list);
sub(/^.*\(/, "", list); sub(/\)$/, "", list);
count = split (list, fields, /,/);
for (field = 1; field <= count; field++) {
output = output""convert[type]" ("feature"."fields[field]"),\n\t\t\t";

View File

@@ -6,6 +6,8 @@ lib_LTLIBRARIES = libgtop_guile_names.la
libgtop_guile_names_la_SOURCES = guile-names.c
libgtop_guile_names_la_LDFLAGS = $(LT_VERSION_INFO)
BUILT_SOURCES = guile-names.c
guile-names.c: guile-names.awk $(top_builddir)/config.h $(top_srcdir)/features.def

View File

@@ -10,6 +10,8 @@ libgtop_sysdeps_la_SOURCES = open.c close.c kernel.s cpu.c mem.c swap.c \
proctime.c procmem.c procsignal.c prockernel.c \
procsegment.c siglist.c procmap.c
libgtop_sysdeps_la_LDFLAGS = $(LT_VERSION_INFO)
include_HEADERS = glibtop_server.h
kernel.o kernel.lo: $(srcdir)/kernel.s

14
sysdeps/linux/ChangeLog Normal file
View File

@@ -0,0 +1,14 @@
1998-09-12 Martin Baulig <martin@home-of-linux.org>
* sysinfo.c: New file.
1998-09-09 Martin Baulig <baulig@Stud.Informatik.uni-trier.de>
* proctime.c (glibtop_get_proc_time_s): Added SMP support.
* open.c (glibtop_init_s): Initialize `ncpu' on SMP systems.
* cpu.c (glibtop_get_cpu_s): Added SMP support.
* ChangeLog: New file.

View File

@@ -8,6 +8,9 @@ libgtop_sysdeps_la_SOURCES = open.c close.c cpu.c mem.c swap.c \
uptime.c loadavg.c shm_limits.c msg_limits.c \
sem_limits.c proclist.c procstate.c procuid.c \
proctime.c procmem.c procsignal.c prockernel.c \
procsegment.c procmap.c siglist.c
procsegment.c procmap.c siglist.c sysinfo.c
libgtop_sysdeps_la_LIBADD = @GLIB_LIBS@
libgtop_sysdeps_la_LDFLAGS = $(LT_VERSION_INFO)
include_HEADERS = glibtop_server.h glibtop_machine.h

View File

@@ -28,12 +28,21 @@ static const unsigned long _glibtop_sysdeps_cpu =
(1 << GLIBTOP_CPU_NICE) + (1 << GLIBTOP_CPU_SYS) +
(1 << GLIBTOP_CPU_IDLE) + (1 << GLIBTOP_CPU_FREQUENCY);
static const unsigned long _glibtop_sysdeps_cpu_smp =
(1 << GLIBTOP_XCPU_TOTAL) + (1 << GLIBTOP_XCPU_USER) +
(1 << GLIBTOP_XCPU_NICE) + (1 << GLIBTOP_XCPU_SYS) +
(1 << GLIBTOP_XCPU_IDLE);
/* Init function. */
void
glibtop_init_cpu_s (glibtop *server)
{
#if HAVE_LIBGTOP_SMP
server->sysdeps.cpu = _glibtop_sysdeps_cpu | _glibtop_sysdeps_cpu_smp;
#else
server->sysdeps.cpu = _glibtop_sysdeps_cpu;
#endif
}
/* Provides information about cpu usage. */
@@ -44,14 +53,12 @@ void
glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf)
{
char buffer [BUFSIZ], *p;
int fd, len;
int fd, len, i;
glibtop_init_s (&server, GLIBTOP_SYSDEPS_CPU, 0);
memset (buf, 0, sizeof (glibtop_cpu));
buf->flags = _glibtop_sysdeps_cpu;
fd = open (FILENAME, O_RDONLY);
if (fd < 0)
glibtop_error_io_r (server, "open (%s)", FILENAME);
@@ -74,4 +81,23 @@ glibtop_get_cpu_s (glibtop *server, glibtop_cpu *buf)
buf->total = buf->user + buf->nice + buf->sys + buf->idle;
buf->frequency = 100;
buf->flags = _glibtop_sysdeps_cpu;
#if HAVE_LIBGTOP_SMP
for (i = 0; i < GLIBTOP_NCPU; i++) {
if (strncmp (p+1, "cpu", 3) || !isdigit (p [4]))
break;
p += 6;
buf->xcpu_user [i] = strtoul (p, &p, 0);
buf->xcpu_nice [i] = strtoul (p, &p, 0);
buf->xcpu_sys [i] = strtoul (p, &p, 0);
buf->xcpu_idle [i] = strtoul (p, &p, 0);
buf->xcpu_total [i] = buf->xcpu_user [i] + buf->xcpu_nice [i] +
buf->xcpu_sys [i] + buf->xcpu_idle [i];
}
buf->flags |= _glibtop_sysdeps_cpu_smp;
#endif
}

View File

@@ -19,6 +19,8 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <glibtop.h>
#include <glibtop/cpu.h>
#include <glibtop/open.h>
/* =====================================================
@@ -50,12 +52,52 @@ static void set_linux_version(void) {
/* Opens pipe to gtop server. Returns 0 on success and -1 on error. */
#define FILENAME "/proc/stat"
void
glibtop_open_s (glibtop *server, const char *program_name,
const unsigned long features, const unsigned flags)
{
#ifdef HAVE_LIBGTOP_SMP
char buffer [BUFSIZ], *p;
int fd, len, i;
#endif
server->name = program_name;
set_linux_version ();
server->os_version_code = (unsigned long) linux_version_code;
server->ncpu = 0;
#ifdef HAVE_LIBGTOP_SMP
fd = open (FILENAME, O_RDONLY);
if (fd < 0)
glibtop_error_io_r (server, "open (%s)", FILENAME);
len = read (fd, buffer, BUFSIZ-1);
if (len < 0)
glibtop_error_io_r (server, "read (%s)", FILENAME);
close (fd);
buffer [len] = '\0';
p = skip_multiple_token (buffer, 5) + 1;
for (i = 0; i < GLIBTOP_NCPU; i++) {
if (strncmp (p, "cpu", 3) || !isdigit (p [3]))
break;
server->ncpu++;
p = skip_multiple_token (p, 5) + 1;
}
#if DEBUG
printf ("\nThis machine has %d CPUs.\n\n", server->ncpu);
#endif
#endif
}

View File

@@ -30,12 +30,20 @@ static const unsigned long _glibtop_sysdeps_proc_time =
(1 << GLIBTOP_PROC_TIME_TIMEOUT) + (1 << GLIBTOP_PROC_TIME_IT_REAL_VALUE) +
(1 << GLIBTOP_PROC_TIME_START_TIME);
static const unsigned long _glibtop_sysdeps_proc_time_smp =
(1 << GLIBTOP_PROC_TIME_XCPU_UTIME) + (1 << GLIBTOP_PROC_TIME_XCPU_STIME);
/* Init function. */
void
glibtop_init_proc_time_s (glibtop *server)
{
#if HAVE_LIBGTOP_SMP
server->sysdeps.proc_time = _glibtop_sysdeps_proc_time |
_glibtop_sysdeps_proc_time_smp;
#else
server->sysdeps.proc_time = _glibtop_sysdeps_proc_time;
#endif
}
/* Provides detailed information about a process. */
@@ -44,6 +52,7 @@ void
glibtop_get_proc_time_s (glibtop *server, glibtop_proc_time *buf, pid_t pid)
{
char buffer [BUFSIZ], *p;
int i;
glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_TIME, 0);
@@ -73,4 +82,24 @@ glibtop_get_proc_time_s (glibtop *server, glibtop_proc_time *buf, pid_t pid)
buf->frequency = 100;
buf->flags = _glibtop_sysdeps_proc_time;
#if HAVE_LIBGTOP_SMP
if (proc_file_to_buffer (buffer, "/proc/%d/cpu", pid))
return;
p = skip_token (buffer);
buf->utime = strtoul (p, &p, 0);
buf->stime = strtoul (p, &p, 0);
for (i = 0; i < GLIBTOP_NCPU; i++) {
if (strncmp (p+1, "cpu", 3) || !isdigit (p [4]))
break;
p += 6;
buf->xcpu_utime [i] = strtoul (p, &p, 0);
buf->xcpu_stime [i] = strtoul (p, &p, 0);
}
buf->flags |= _glibtop_sysdeps_proc_time_smp;
#endif
}

86
sysdeps/linux/sysinfo.c Normal file
View File

@@ -0,0 +1,86 @@
/* $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 <config.h>
#include <glibtop/cpu.h>
#include <glibtop/sysinfo.h>
static const unsigned long _glibtop_sysdeps_sysinfo =
(1 << GLIBTOP_SYSINFO_CPUINFO);
static glibtop_sysinfo sysinfo;
static void
init_sysinfo (glibtop *server)
{
char buffer [BUFSIZ];
static int init = 0;
glibtop_entry *cpuinfo = NULL;
FILE *f;
if (init) return;
init = TRUE;
glibtop_init_s (&server, GLIBTOP_SYSDEPS_CPU, 0);
memset (&sysinfo, 0, sizeof (glibtop_sysinfo));
g_return_if_fail (f = fopen ("/proc/cpuinfo", "r"));
while (fgets (buffer, BUFSIZ, f)) {
char *p, *key, *value;
if (cpuinfo == NULL) {
cpuinfo = &sysinfo.cpuinfo [sysinfo.ncpu++];
cpuinfo->labels = g_ptr_array_new ();
cpuinfo->values = g_hash_table_new (NULL, NULL);
if (sysinfo.ncpu > GLIBTOP_NCPU)
sysinfo.ncpu = GLIBTOP_NCPU;
}
p = skip_token (buffer); *p = '\0';
p = skip_token (p+1)+1;
p [strlen (p) ? strlen (p)-1 : 0] = '\0';
key = g_strdup (buffer);
value = g_strdup (p);
g_ptr_array_add (cpuinfo->labels, key);
g_hash_table_insert (cpuinfo->values, key, value);
}
fclose (f);
sysinfo.flags = _glibtop_sysdeps_sysinfo;
}
glibtop_sysinfo *
glibtop_get_sysinfo_s (glibtop *server)
{
init_sysinfo (server);
return &sysinfo;
}

View File

@@ -10,3 +10,6 @@ libgtop_names_la_SOURCES = cpu.c mem.c swap.c uptime.c loadavg.c \
proctime.c procmem.c procsignal.c \
prockernel.c procsegment.c fsusage.c \
mountlist.c procmap.c
libgtop_names_la_LDFLAGS = $(LT_VERSION_INFO)

View File

@@ -7,11 +7,13 @@ lib_LTLIBRARIES = libgtop_sysdeps.la libgtop_sysdeps_suid.la
libgtop_sysdeps_la_SOURCES = open.c close.c siglist.c cpu.c mem.c swap.c \
uptime.c loadavg.c shm_limits.c msg_limits.c \
sem_limits.c
libgtop_sysdeps_la_LDFLAGS = $(LT_VERSION_INFO)
libgtop_sysdeps_la_LIBADD = -lmach
libgtop_sysdeps_suid_la_SOURCES = open_suid.c close_suid.c proclist.c \
procstate.c procuid.c proctime.c procmem.c \
procsignal.c prockernel.c procsegment.c
libgtop_sysdeps_suid_la_LDFLAGS = $(LT_VERSION_INFO)
libgtop_sysdeps_suid_la_LIBADD = -lmach
include_HEADERS = glibtop_server.h glibtop_machine.h

6
sysdeps/stub/ChangeLog Normal file
View File

@@ -0,0 +1,6 @@
1998-08-24 Martin Baulig <martin@home-of-linux.org>
* *.c: Added initialization functions `glibtop_init_<feature>_s'.
* ChangeLog: New file.

View File

@@ -10,3 +10,7 @@ libgtop_sysdeps_la_SOURCES = open.c close.c siglist.c cpu.c mem.c swap.c \
proctime.c procmem.c procsignal.c prockernel.c \
procsegment.c procmap.c
libgtop_sysdeps_la_LDFLAGS = $(LT_VERSION_INFO)
include_HEADERS = glibtop_server.h

View File

@@ -19,9 +19,19 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <config.h>
#include <glibtop.h>
#include <glibtop/cpu.h>
static const unsigned long _glibtop_sysdeps_cpu = 0;
/* Init function. */
void
glibtop_init_cpu_s (glibtop *server)
{
server->sysdeps.cpu = _glibtop_sysdeps_cpu;
}
/* Provides information about cpu usage. */
void

View File

@@ -40,6 +40,7 @@ __BEGIN_DECLS
#define GLIBTOP_SUID_PROC_SIGNAL 0
#define GLIBTOP_SUID_PROC_KERNEL 0
#define GLIBTOP_SUID_PROC_SEGMENT 0
#define GLIBTOP_SUID_PROC_MAP 0
__END_DECLS

View File

@@ -19,9 +19,19 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <config.h>
#include <glibtop.h>
#include <glibtop/loadavg.h>
static const unsigned long _glibtop_sysdeps_loadavg = 0;
/* Init function. */
void
glibtop_init_loadavg_s (glibtop *server)
{
server->sysdeps.loadavg = _glibtop_sysdeps_loadavg;
}
/* Provides load averange. */
void

View File

@@ -19,9 +19,19 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <config.h>
#include <glibtop.h>
#include <glibtop/mem.h>
static const unsigned long _glibtop_sysdeps_mem = 0;
/* Init function. */
void
glibtop_init_mem_s (glibtop *server)
{
server->sysdeps.mem = _glibtop_sysdeps_mem;
}
/* Provides information about memory usage. */
void

View File

@@ -19,8 +19,19 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <glibtop.h>
#include <glibtop/msg_limits.h>
static const unsigned long _glibtop_sysdeps_msg_limits = 0;
/* Init function. */
void
glibtop_init_msg_limits_s (glibtop *server)
{
server->sysdeps.msg_limits = _glibtop_sysdeps_msg_limits;
}
/* Provides information about sysv ipc limits. */
void

View File

@@ -19,9 +19,19 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <config.h>
#include <glibtop.h>
#include <glibtop/prockernel.h>
static const unsigned long _glibtop_sysdeps_proc_kernel = 0;
/* Init function. */
void
glibtop_init_proc_kernel_s (glibtop *server)
{
server->sysdeps.proc_kernel = _glibtop_sysdeps_proc_kernel;
}
/* Provides detailed information about a process. */
void

View File

@@ -19,11 +19,21 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <config.h>
#include <glibtop.h>
#include <glibtop/proclist.h>
#define GLIBTOP_PROCLIST_FLAGS 3
static const unsigned long _glibtop_sysdeps_proclist = 0;
/* Init function. */
void
glibtop_init_proclist_s (glibtop *server)
{
server->sysdeps.proclist = _glibtop_sysdeps_proclist;
}
/* Fetch list of currently running processes.
*
* IMPORTANT NOTE:
@@ -32,7 +42,8 @@
* each buf->size big. The total size is stored in buf->total. */
unsigned *
glibtop_get_proclist_s (glibtop *server, glibtop_proclist *buf)
glibtop_get_proclist_s (glibtop *server, glibtop_proclist *buf,
int64_t which, int64_t arg)
{
memset (buf, 0, sizeof (glibtop_proclist));
return NULL;

View File

@@ -19,9 +19,19 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <config.h>
#include <glibtop.h>
#include <glibtop/procmem.h>
static const unsigned long _glibtop_sysdeps_proc_mem = 0;
/* Init function. */
void
glibtop_init_proc_mem_s (glibtop *server)
{
server->sysdeps.proc_mem = _glibtop_sysdeps_proc_mem;
}
/* Provides detailed information about a process. */
void

View File

@@ -19,9 +19,19 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <config.h>
#include <glibtop.h>
#include <glibtop/procsegment.h>
static const unsigned long _glibtop_sysdeps_proc_segment = 0;
/* Init function. */
void
glibtop_init_proc_segment_s (glibtop *server)
{
server->sysdeps.proc_segment = _glibtop_sysdeps_proc_segment;
}
/* Provides detailed information about a process. */
void

View File

@@ -19,9 +19,19 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <config.h>
#include <glibtop.h>
#include <glibtop/procsignal.h>
static const unsigned long _glibtop_sysdeps_proc_signal = 0;
/* Init function. */
void
glibtop_init_proc_signal_s (glibtop *server)
{
server->sysdeps.proc_signal = _glibtop_sysdeps_proc_signal;
}
/* Provides detailed information about a process. */
void

View File

@@ -19,9 +19,19 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <config.h>
#include <glibtop.h>
#include <glibtop/procstate.h>
static const unsigned long _glibtop_sysdeps_proc_state = 0;
/* Init function. */
void
glibtop_init_proc_state_s (glibtop *server)
{
server->sysdeps.proc_state = _glibtop_sysdeps_proc_state;
}
/* Provides detailed information about a process. */
void

View File

@@ -19,9 +19,19 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <config.h>
#include <glibtop.h>
#include <glibtop/proctime.h>
static const unsigned long _glibtop_sysdeps_proc_time = 0;
/* Init function. */
void
glibtop_init_proc_time_s (glibtop *server)
{
server->sysdeps.proc_time = _glibtop_sysdeps_proc_time;
}
/* Provides detailed information about a process. */
void

View File

@@ -19,9 +19,19 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <config.h>
#include <glibtop.h>
#include <glibtop/procuid.h>
static const unsigned long _glibtop_sysdeps_proc_uid = 0;
/* Init function. */
void
glibtop_init_proc_uid_s (glibtop *server)
{
server->sysdeps.proc_uid = _glibtop_sysdeps_proc_uid;
}
/* Provides detailed information about a process. */
void

View File

@@ -19,8 +19,19 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <glibtop.h>
#include <glibtop/sem_limits.h>
static const unsigned long _glibtop_sysdeps_sem_limits = 0;
/* Init function. */
void
glibtop_init_sem_limits_s (glibtop *server)
{
server->sysdeps.sem_limits = _glibtop_sysdeps_sem_limits;
}
/* Provides information about sysv sem limits. */
void

View File

@@ -19,8 +19,19 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <glibtop.h>
#include <glibtop/shm_limits.h>
static const unsigned long _glibtop_sysdeps_shm_limits = 0;
/* Init function. */
void
glibtop_init_shm_limits_s (glibtop *server)
{
server->sysdeps.shm_limits = _glibtop_sysdeps_shm_limits;
}
/* Provides information about sysv ipc limits. */
void

View File

@@ -19,9 +19,19 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <config.h>
#include <glibtop.h>
#include <glibtop/swap.h>
static const unsigned long _glibtop_sysdeps_swap = 0;
/* Init function. */
void
glibtop_init_swap_s (glibtop *server)
{
server->sysdeps.swap = _glibtop_sysdeps_swap;
}
/* Provides information about swap usage. */
void

View File

@@ -19,9 +19,19 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <config.h>
#include <glibtop.h>
#include <glibtop/uptime.h>
static const unsigned long _glibtop_sysdeps_uptime = 0;
/* Init function. */
void
glibtop_init_uptime_s (glibtop *server)
{
server->sysdeps.uptime = _glibtop_sysdeps_uptime;
}
/* Provides uptime and idle time. */
void

View File

@@ -6,10 +6,14 @@ lib_LTLIBRARIES = libgtop_sysdeps.la libgtop_sysdeps_suid.la
libgtop_sysdeps_la_SOURCES = nosuid.c siglist.c
libgtop_sysdeps_la_LDFLAGS = $(LT_VERSION_INFO)
libgtop_sysdeps_suid_la_SOURCES = open.c close.c siglist.c cpu.c mem.c swap.c \
uptime.c loadavg.c shm_limits.c msg_limits.c \
sem_limits.c proclist.c procstate.c procuid.c \
proctime.c procmem.c procsignal.c prockernel.c \
procsegment.c
libgtop_sysdeps_suid_la_LDFLAGS = $(LT_VERSION_INFO)
include_HEADERS = glibtop_server.h glibtop_machine.h

9
sysdeps/sun4/ChangeLog Normal file
View File

@@ -0,0 +1,9 @@
1998-08-25 Martin Baulig <martin@home-of-linux.org>
* *.c (glibtop_init_p): Using correct `(1 << GLIBTOP_SYSDPES_*)'.
(<glibtop_suid.h>): Include.
* glibtop_suid.h: New file.
* ChangeLog: New file.

View File

@@ -5,6 +5,7 @@ CFLAGS = -Wall -W @CFLAGS@
lib_LTLIBRARIES = libgtop_sysdeps.la libgtop_sysdeps_suid.la
libgtop_sysdeps_la_SOURCES = nosuid.c siglist.c
libgtop_sysdeps_la_LDFLAGS = $(LT_VERSION_INFO)
libgtop_sysdeps_la_LIBADD = -lkvm
libgtop_sysdeps_suid_la_SOURCES = open.c close.c cpu.c mem.c swap.c \
@@ -12,6 +13,7 @@ libgtop_sysdeps_suid_la_SOURCES = open.c close.c cpu.c mem.c swap.c \
sem_limits.c proclist.c procstate.c procuid.c \
proctime.c procmem.c procsignal.c prockernel.c \
procsegment.c
libgtop_sysdeps_suid_la_LDFLAGS = $(LT_VERSION_INFO)
libgtop_sysdeps_suid_la_LIBADD = -lkvm
include_HEADERS = glibtop_server.h glibtop_machine.h

View File

@@ -22,6 +22,8 @@
#include <glibtop.h>
#include <glibtop/cpu.h>
#include <glibtop_suid.h>
static const unsigned long _glibtop_sysdeps_cpu =
(1 << GLIBTOP_CPU_TOTAL) + (1 << GLIBTOP_CPU_USER) +
(1 << GLIBTOP_CPU_NICE) + (1 << GLIBTOP_CPU_SYS) +
@@ -35,13 +37,13 @@ glibtop_get_cpu_p (glibtop *server, glibtop_cpu *buf)
long cp_time [CPUSTATES], mp_time [NCPU][CPUSTATES];
int i;
glibtop_init_p (&server, 0, 0);
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_CPU), 0);
memset (buf, 0, sizeof (glibtop_cpu));
/* !!! THE FOLLOWING CODE RUNS SGID KMEM - CHANGE WITH CAUTION !!! */
setregid (server->machine.gid, server->machine.egid);
glibtop_suid_enter (server);
/* get the cp_time array */
@@ -58,17 +60,17 @@ glibtop_get_cpu_p (glibtop *server, glibtop_cpu *buf)
_glibtop_nlist [X_MP_TIME].n_name);
}
#endif
if (setregid (server->machine.egid, server->machine.gid))
_exit (1);
glibtop_suid_leave (server);
/* !!! END OF SUID ROOT PART !!! */
#ifdef MULTIPROCESSOR
/* If we have multiple processors, we add the times for each of them and set
frequency to 100 times the number of the processors. */
/* If we have multiple processors, we add the times for each of them
* and set frequency to 100 times the number of the processors. */
/* [FIXME]: I had no machine with more than one processor to test this code !!! */
/* [FIXME]: I had no machine with more than one processor to test
* this code !!! */
if (server->machine.ncpu > 1) {
for (i = 0; i < server->machine.ncpu; i++) {

View File

@@ -40,6 +40,7 @@ __BEGIN_DECLS
#define GLIBTOP_SUID_PROC_SIGNAL (1 << GLIBTOP_SYSDEPS_PROC_SIGNAL)
#define GLIBTOP_SUID_PROC_KERNEL (1 << GLIBTOP_SYSDEPS_PROC_KERNEL)
#define GLIBTOP_SUID_PROC_SEGMENT (1 << GLIBTOP_SYSDEPS_PROC_SEGMENT)
#define GLIBTOP_SUID_PROC_MAP (1 << GLIBTOP_SYSDEPS_PROC_MAP)
__END_DECLS

View File

@@ -0,0 +1,42 @@
/* $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_SUID_H__
#define __GLIBTOP_SUID_H__
__BEGIN_DECLS
static inline void glibtop_suid_enter (glibtop *server) {
setregid (server->machine.gid, server->machine.egid);
};
static inline void glibtop_suid_leave (glibtop *server) {
if (setregid (server->machine.egid, server->machine.gid))
_exit (1);
};
extern void glibtop_init_p __P((glibtop *, const unsigned long, const unsigned));
extern void glibtop_open_p __P((glibtop *, const char *, const unsigned long, const unsigned));
__END_DECLS
#endif

View File

@@ -22,6 +22,8 @@
#include <glibtop.h>
#include <glibtop/loadavg.h>
#include <glibtop_suid.h>
static const unsigned long _glibtop_sysdeps_loadavg =
(1 << GLIBTOP_LOADAVG_LOADAVG);
@@ -33,7 +35,7 @@ glibtop_get_loadavg_p (glibtop *server, glibtop_loadavg *buf)
load_avg avenrun [3];
int i;
glibtop_init_p (&server, 0, 0);
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_LOADAVG), 0);
memset (buf, 0, sizeof (glibtop_loadavg));

View File

@@ -22,6 +22,8 @@
#include <glibtop.h>
#include <glibtop/mem.h>
#include <glibtop_suid.h>
static const unsigned long _glibtop_sysdeps_mem =
(1 << GLIBTOP_MEM_TOTAL) + (1 << GLIBTOP_MEM_USED) +
(1 << GLIBTOP_MEM_FREE) + (1 << GLIBTOP_MEM_LOCKED);
@@ -35,13 +37,13 @@ static const unsigned long _glibtop_sysdeps_mem =
void
glibtop_get_mem_p (glibtop *server, glibtop_mem *buf)
{
glibtop_init_p (&server, 0, 0);
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_MEM), 0);
memset (buf, 0, sizeof (glibtop_mem));
/* !!! THE FOLLOWING CODE RUNS SGID KMEM - CHANGE WITH CAUTION !!! */
setregid (server->machine.gid, server->machine.egid);
glibtop_suid_enter (server);
/* get the array of physpage descriptors */
@@ -49,9 +51,8 @@ glibtop_get_mem_p (glibtop *server, glibtop_mem *buf)
(int *) server->machine.physpage,
server->machine.bytesize,
"array _page");
if (setregid (server->machine.egid, server->machine.gid))
_exit (1);
glibtop_suid_leave (server);
/* !!! END OF SGID KMEM PART !!! */

View File

@@ -22,6 +22,8 @@
#include <glibtop.h>
#include <glibtop/msg_limits.h>
#include <glibtop_suid.h>
/* #define KERNEL to get declaration of `struct msginfo'. */
#define KERNEL
@@ -41,7 +43,7 @@ glibtop_get_msg_limits_p (glibtop *server, glibtop_msg_limits *buf)
{
struct msginfo msginfo;
glibtop_init_p (&server, 0, 0);
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_MSG_LIMITS), 0);
memset (buf, 0, sizeof (glibtop_msg_limits));

View File

@@ -21,6 +21,7 @@
#include <glibtop.h>
#include <glibtop/open.h>
#include <glibtop/close.h>
void
glibtop_open_s (glibtop *server, const char *program_name,

View File

@@ -22,6 +22,8 @@
#include <glibtop.h>
#include <glibtop/prockernel.h>
#include <glibtop_suid.h>
static const unsigned long _glibtop_sysdeps_proc_kernel =
(1 << GLIBTOP_PROC_KERNEL_K_FLAGS) + (1 << GLIBTOP_PROC_KERNEL_WCHAN);
@@ -33,7 +35,7 @@ glibtop_get_proc_kernel_p (glibtop *server, glibtop_proc_kernel *buf,
{
struct proc *pp;
glibtop_init_p (&server, 0, 0);
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_KERNEL), 0);
memset (buf, 0, sizeof (glibtop_proc_kernel));
@@ -50,7 +52,7 @@ glibtop_get_proc_kernel_p (glibtop *server, glibtop_proc_kernel *buf,
/* Fill in data fields. */
buf->k_flags = pp->p_flag;
buf->wchan = pp->p_wchan;
buf->nwchan = (unsigned long) pp->p_wchan;
buf->flags = _glibtop_sysdeps_proc_kernel;
}

View File

@@ -23,6 +23,8 @@
#include <glibtop/xmalloc.h>
#include <glibtop/proclist.h>
#include <glibtop_suid.h>
static const unsigned long _glibtop_sysdeps_proclist =
(1 << GLIBTOP_PROCLIST_TOTAL) + (1 << GLIBTOP_PROCLIST_NUMBER) +
(1 << GLIBTOP_PROCLIST_SIZE);
@@ -35,14 +37,15 @@ static const unsigned long _glibtop_sysdeps_proclist =
* each buf->size big. The total size is stored in buf->total. */
unsigned *
glibtop_get_proclist_p (glibtop *server, glibtop_proclist *buf)
glibtop_get_proclist_p (glibtop *server, glibtop_proclist *buf,
int64_t which, int64_t arg)
{
register struct proc *pp;
register int i, nproc = 0;
unsigned *proc_list = NULL;
size_t proc_size;
glibtop_init_p (&server, 0, 0);
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROCLIST), 0);
memset (buf, 0, sizeof (glibtop_proclist));

Some files were not shown because too many files have changed in this diff Show More