Compare commits

..

15 Commits

Author SHA1 Message Date
Martin Baulig
22699667aa Bumped version number to 0.25.1. 1998-08-29 21:11:48 +00:00
Martin Baulig
2565ce18ce 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.
1998-08-29 21:05:01 +00:00
Martin Baulig
c3bac0b4f6 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-25 11:48:16 +00:00
Martin Baulig
e60200e8de 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:30:41 +00:00
Martin Baulig
bcadc03194 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:19:12 +00:00
Martin Baulig
13e68dbd2b *** empty log message *** 1998-08-25 08:08:53 +00:00
Martin Baulig
8e540b8fc0 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:03:52 +00:00
Martin Baulig
4789169c80 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:40:29 +00:00
Martin Baulig
a894d550a1 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:51:39 +00:00
Martin Baulig
b41bcfdfb1 No longer using installed header files.
1998-08-24  Martin Baulig  <martin@home-of-linux.org>

	* configure.in (INCLUDES): No longer using installed header files.
1998-08-24 13:06:17 +00:00
Martin Baulig
4ea818875b Using `int(fs_usage)'.
1998-08-23  Martin Baulig  <martin@home-of-linux.org>

	* features.def (mountlist): Using `int(fs_usage)'.
1998-08-23 12:21:04 +00:00
Martin Baulig
d1120fe35d *** empty log message *** 1998-08-23 12:15:06 +00:00
Martin Baulig
04f157c378 Added glibtop_suid.h' to the include_HEADERS'. 1998-08-22 17:24:42 +00:00
Martin Baulig
6db51362bf Released LibGTop 0.25 stable.
1998-08-21  Martin Baulig  <martin@home-of-linux.org>

	* ANNOUNCE-0.25: Released LibGTop 0.25 stable.
1998-08-22 17:23:19 +00:00
Martin Baulig
86abb41ef6 Updated documentation. 1998-08-21 21:43:19 +00:00
77 changed files with 884 additions and 178 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,43 @@
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.
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,6 +1,18 @@
# 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_MICRO_VERSION=1
LIBGTOP_INTERFACE_AGE=0
LIBGTOP_BINARY_AGE=0
LIBGTOP_VERSION=$LIBGTOP_MAJOR_VERSION.$LIBGTOP_MINOR_VERSION.$LIBGTOP_MICRO_VERSION
# Increase each time you change the client/server protocol.

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

View File

@@ -12,9 +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)
# 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)
AC_ISC_POSIX
@@ -59,6 +73,9 @@ GNOME_LIBGTOP_TYPES
GNOME_CHECK_GUILE
dnl For Solaris
AC_CHECK_LIB(socket, socket)
AC_ARG_WITH(libgtop-guile,
[ --with-libgtop-guile Build the libgtop guile interface (default=yes)],
[build_guile="$withval"], [build_guile=yes])
@@ -177,17 +194,20 @@ 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)
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, we include it here.
dnl Some ugly hack; if '-lgnomesupport' is part of $GNOME_LIBS,
dnl we include it here.
echo "$GNOME_LIBS" | grep -q -e '-lgnomesupport'
if test $? = 0 ; then
LIBSUPPORT="$GNOME_LIBDIR -lgnomesupport"
@@ -204,6 +224,8 @@ if test x$build_inodedb = xyes ; then
LIBGTOP_INCS="$LIBGTOP_INCS -DGLIBTOP_INODEDB"
fi
LIBGTOP_INCS="$LIBGTOP_INCS $SUPPORTINCS"
LIBGTOP_GUILE_LIBS="$LIBGTOP_LIBS"
LIBGTOP_GUILE_INCS="$LIBGTOP_INCS"
LIBGTOP_BINDIR='$(bindir)'
@@ -256,7 +278,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 -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 +295,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,7 @@
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

@@ -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

@@ -38,16 +38,17 @@ output (pid_t pid)
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 +59,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 +71,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 +85,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 +100,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 +110,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,

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

@@ -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

@@ -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

@@ -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

@@ -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.25.1
%define rel SNAP
%define prefix /usr

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

@@ -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");
}
}

73
src/inodedb/README Normal file
View File

@@ -0,0 +1,73 @@
Not all UNIXes provide an easy way to get the filename if you have
the device it is mounted on and its inode.
Well, under Linux we can simply read /proc/<pid>/maps to get the filenames
but I don't see any way to get this under FreeBSD.
In this case you can give configure the optional `--with-libgtop-inodedb'
parameter to build this stuff here.
It uses the GNU database library `gdbm' to find the inode in a database
which is created when libgtop is installed. This should be reasonable
fast since the entire filesystem only needs to be traversed once when
libgtop is installed (and each time you install new software, of cause).
We have two databases:
* First the system administrator may place a system-wide database
in `$(prefix)/var/libgtop/inodedb.db' when installing libgtop.
* Every user can have his/her own one in `~/var/libgtop/inodedb.db'.
This one has precedence over the system wide one.
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.
To use this interface in your program, you first have to call
`glibtop_inodedb_open ()':
glibtop_inodedb *
glibtop_inodedb_open (unsigned databases, unsigned long cachesize)
glibtop_inodedb *
glibtop_inodedb_open_s (glibtop *server, unsigned databases,
unsigned long cachesize)
There are some constants defined in <glibtop/inodedb.h> for the `databases'
parameter - you can use zero as default:
#define GLIBTOP_INODEDB_SYSTEM 1
#define GLIBTOP_INODEDB_USER 2
#define GLIBTOP_INODEDB_CACHE 4
The `cachesize' gives the size of a not yet implemented in-memory cache for
looked up entries.
This function will return a pointer of type `glibtop_inodedb *' which you need
to lookup an entry in the database.
To look up an entry, use the `glibtop_inodedb_lookup ()' function:
const char *
glibtop_inodedb_lookup (glibtop_inodedb *inodedb,
u_int64_t device, u_int64_t inode)
const char *
glibtop_inodedb_lookup_s (glibtop *server, glibtop_inodedb *inodedb,
u_int64_t device, u_int64_t inode)
It will either return a pointer to the filename - which you have to
`glibtop_free ()' once done with it - or NULL on error.
You can use the `file_by_inode' program in this directory to test the
interface - just call it with two command line arguments: the device number
and the inode number.
Martin <martin@home-of-linux.org>

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

@@ -14,4 +14,6 @@ libgtop_sysdeps_suid_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
include_HEADERS = glibtop_server.h glibtop_machine.h
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));

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

@@ -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

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

@@ -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 */
@@ -59,16 +61,16 @@ glibtop_get_cpu_p (glibtop *server, glibtop_cpu *buf)
}
#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 */
@@ -50,8 +52,7 @@ glibtop_get_mem_p (glibtop *server, glibtop_mem *buf)
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));

View File

@@ -22,6 +22,8 @@
#include <config.h>
#include <glibtop/procmem.h>
#include <glibtop_suid.h>
static const unsigned long _glibtop_sysdeps_proc_mem =
(1 << GLIBTOP_PROC_MEM_SIZE) + (1 << GLIBTOP_PROC_MEM_RSS) +
(1 << GLIBTOP_PROC_MEM_RSS_RLIM);
@@ -34,7 +36,7 @@ glibtop_get_proc_mem_p (glibtop *server, glibtop_proc_mem *buf,
{
struct proc *pp;
glibtop_init_p (&server, 0, 0);
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_MEM), 0);
memset (buf, 0, sizeof (glibtop_proc_mem));

View File

@@ -22,8 +22,11 @@
#include <glibtop.h>
#include <glibtop/procsegment.h>
#include <glibtop_suid.h>
static const unsigned long _glibtop_sysdeps_proc_segment =
(1 << GLIBTOP_PROC_SEGMENT_TRS) + (1 << GLIBTOP_PROC_SEGMENT_DRS);
(1 << GLIBTOP_PROC_SEGMENT_TEXT_RSS) +
(1 << GLIBTOP_PROC_SEGMENT_DATA_RSS);
/* Provides detailed information about a process. */
@@ -33,7 +36,7 @@ glibtop_get_proc_segment_p (glibtop *server, glibtop_proc_segment *buf,
{
struct proc *pp;
glibtop_init_p (&server, 0, 0);
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_SEGMENT), 0);
memset (buf, 0, sizeof (glibtop_proc_segment));
@@ -49,8 +52,8 @@ glibtop_get_proc_segment_p (glibtop *server, glibtop_proc_segment *buf,
/* Fill in data fields. */
buf->trs = pp->p_tsize;
buf->drs = pp->p_dsize;
buf->text_rss = pp->p_tsize;
buf->data_rss = pp->p_dsize;
buf->flags = _glibtop_sysdeps_proc_segment;
}

View File

@@ -22,6 +22,8 @@
#include <glibtop.h>
#include <glibtop/procsignal.h>
#include <glibtop_suid.h>
static const unsigned long _glibtop_sysdeps_proc_signal =
(1 << GLIBTOP_PROC_SIGNAL_SIGNAL) + (1 << GLIBTOP_PROC_SIGNAL_BLOCKED) +
(1 << GLIBTOP_PROC_SIGNAL_SIGIGNORE) + (1 << GLIBTOP_PROC_SIGNAL_SIGCATCH);
@@ -34,7 +36,7 @@ glibtop_get_proc_signal_p (glibtop *server, glibtop_proc_signal *buf,
{
struct proc *pp;
glibtop_init_p (&server, 0, 0);
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_SIGNAL), 0);
memset (buf, 0, sizeof (glibtop_proc_signal));

View File

@@ -22,6 +22,8 @@
#include <glibtop.h>
#include <glibtop/procstate.h>
#include <glibtop_suid.h>
static const unsigned long _glibtop_sysdeps_proc_state =
(1 << GLIBTOP_PROC_STATE_STATE) + (1 << GLIBTOP_PROC_STATE_UID);
@@ -33,7 +35,7 @@ glibtop_get_proc_state_p (glibtop *server, glibtop_proc_state *buf,
{
struct proc *pp;
glibtop_init_p (&server, 0, 0);
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_STATE), 0);
memset (buf, 0, sizeof (glibtop_proc_state));

View File

@@ -22,6 +22,8 @@
#include <glibtop.h>
#include <glibtop/proctime.h>
#include <glibtop_suid.h>
static const unsigned long _glibtop_sysdeps_proc_time =
(1 << GLIBTOP_PROC_TIME_START_TIME) + (1 << GLIBTOP_PROC_TIME_UTIME);
@@ -33,7 +35,7 @@ glibtop_get_proc_time_p (glibtop *server, glibtop_proc_time *buf,
{
struct proc *pp;
glibtop_init_p (&server, 0, 0);
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_TIME), 0);
memset (buf, 0, sizeof (glibtop_proc_time));

View File

@@ -22,6 +22,8 @@
#include <glibtop.h>
#include <glibtop/procuid.h>
#include <glibtop_suid.h>
static const unsigned long _glibtop_sysdeps_proc_uid =
(1 << GLIBTOP_PROC_UID_UID) + (1 << GLIBTOP_PROC_UID_EUID) +
(1 << GLIBTOP_PROC_UID_EGID) + (1 << GLIBTOP_PROC_UID_PID) +
@@ -37,7 +39,7 @@ glibtop_get_proc_uid_p (glibtop *server, glibtop_proc_uid *buf,
{
struct proc *pp;
glibtop_init_p (&server, 0, 0);
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_UID), 0);
memset (buf, 0, sizeof (glibtop_proc_uid));

View File

@@ -22,6 +22,8 @@
#include <glibtop.h>
#include <glibtop/sem_limits.h>
#include <glibtop_suid.h>
/* #define KERNEL to get declaration of `struct seminfo'. */
#define KERNEL
@@ -43,7 +45,7 @@ glibtop_get_sem_limits_p (glibtop *server, glibtop_sem_limits *buf)
{
struct seminfo seminfo;
glibtop_init_p (&server, 0, 0);
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_SEM_LIMITS), 0);
memset (buf, 0, sizeof (glibtop_sem_limits));

View File

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

View File

@@ -22,12 +22,14 @@
#include <glibtop.h>
#include <glibtop/swap.h>
#include <glibtop_suid.h>
/* Provides information about swap usage. */
void
glibtop_get_swap_p (glibtop *server, glibtop_swap *buf)
{
glibtop_init_p (&server, 0, 0);
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_SWAP), 0);
memset (buf, 0, sizeof (glibtop_swap));
}

View File

@@ -23,6 +23,8 @@
#include <glibtop/cpu.h>
#include <glibtop/uptime.h>
#include <glibtop_suid.h>
static const unsigned long _glibtop_sysdeps_uptime =
(1 << GLIBTOP_UPTIME_UPTIME) + (1 << GLIBTOP_UPTIME_IDLETIME);
@@ -33,7 +35,7 @@ glibtop_get_uptime_p (glibtop *server, glibtop_uptime *buf)
{
glibtop_cpu cpu;
glibtop_init_p (&server, 0, 0);
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_UPTIME), 0);
/* Get currect cpu usage. */