Compare commits

...

26 Commits

Author SHA1 Message Date
Martin Baulig
41062d0262 Released LibGTop 1.0.2. 1999-05-31 13:34:18 +00:00
Martin Baulig
58c882a860 Enable Timur's BSDI port by default. 1999-05-28 00:43:40 +00:00
Martin Baulig
789d156972 1.0.2. 1999-05-28 00:26:38 +00:00
Martin Baulig
19c24da036 **** Merged from HEAD ****
1999-05-07  Martin Baulig  <martin@home-of-linux.org>

	* server.c (main): There's some problem with uname () - some systems
	like Solaris or Digital Unix return a nonnegative value on success,
	some others like Linux return 0. Since all known systems seem to return
	a negative value on failure, we simply check whether the return value is
	not negative here.
1999-05-27 23:30:48 +00:00
Martin Baulig
929a025f53 **** Merged from HEAD ****
Use `(1L << feature)' instead of `(1 << feature)' to avoid problems
with integer overflows when we add more fields.
1999-05-27 23:30:11 +00:00
Martin Baulig
6a7c289305 *** empty log message *** 1999-05-27 23:26:43 +00:00
Martin Baulig
b65a4a7dcb **** Merged from HEAD **** 1999-05-27 23:23:30 +00:00
Martin Baulig
39b2fffe83 **** Merged from HEAD ****
1999-05-07  Martin Baulig  <martin@home-of-linux.org>

	* timings.c (timersub): Renamed this to `libgtop_timersub' and define
	it on all systems.
1999-05-27 23:19:38 +00:00
Martin Baulig
efb913acff **** Merged from HEAD ****
1999-05-28  Martin Baulig  <martin@home-of-linux.org>

	* first.c, second.c, sysdeps.c: Use LibGTop version conditionals
 	so we can more easily merge the code into LIBGTOP_STABLE_1_0.
1999-05-27 22:34:24 +00:00
Martin Baulig
79e756a2f7 **** Merged from HEAD ****
1999-03-17  Martin Baulig  <martin@home-of-linux.org>

	* first.c, second.c: Fixed a bug that caused a core dump when
	the sysdeps code does not return all data.
1999-05-27 21:42:13 +00:00
Martin Baulig
b08968e644 **** Merged from HEAD **** 1999-05-27 21:23:18 +00:00
Martin Baulig
dff497d2fa **** Merged from HEAD ****
Use `(1L << feature)' instead of `(1 << feature)' to avoid problems
with integer overflows when we add more fields.
1999-05-27 19:30:30 +00:00
Martin Baulig
38de742ca4 **** Merged from HEAD ****
Merged everything from HEAD for the upcoming release.
1999-05-27 18:56:53 +00:00
Martin Baulig
e0d3401bc4 Only #include <sys/param.h> when inside LibGTop. 1999-05-27 18:41:50 +00:00
Martin Baulig
aae2b5a94d *** empty log message *** 1999-05-27 18:39:32 +00:00
Martin Baulig
a5bd38fc19 **** Merged from HEAD ****
Use `(1L << feature)' instead of `(1 << feature)' to avoid problems
with integer overflows when we add more fields.
1999-05-27 14:04:16 +00:00
Martin Baulig
931b8f065e Merged from HEAD. 1999-05-26 15:31:35 +00:00
Martin Baulig
f7885e488f Merged this from HEAD.
1999-05-26  Martin Baulig  <martin@home-of-linux.org>

	* configure.in (INCLUDES): Define `LIBGTOP_VERSION_CODE' here so we
	can use version conditionals in the sysdeps code.
1999-05-26 13:19:03 +00:00
Martin Baulig
8122db69ee Merged I4B fixes for NetBSD from the HEAD. 1999-05-25 17:32:08 +00:00
Martin Baulig
ab13d4919d Make that "dc" think a bit more clean. 1999-05-21 08:19:58 +00:00
Martin Baulig
1d955fbf1f *** empty log message *** 1999-05-20 10:10:32 +00:00
Martin Baulig
8af25a2003 Merged the LibGTop Manual from the HEAD.
1999-05-16  Martin Baulig  <martin@home-of-linux.org>

	* doc: Merged the LibGTop Manual from the HEAD.
1999-05-16 13:48:14 +00:00
Martin Baulig
12eb6a25ec Applied a patch from David Kaelbling:
some compilers (like the SGI IRIX 6.x native one) enfore the
  "casts are not lvalues" maxim.
1999-05-06 22:09:26 +00:00
Martin Baulig
77ced087a1 This is the `LIBGTOP_STABLE_1_0' branch in CVS; please do only commit bug
1999-05-03  Martin Baulig  <martin@home-of-linux.org>

	This is the `LIBGTOP_STABLE_1_0' branch in CVS; please do only
	commit bug fixes here.

	* LIBGTOP-VERSION: Set version number to 1.0.2 binary age 1,
	interface age 0.
1999-05-03 20:31:51 +00:00
Martin Baulig
983475d0c1 Minor Alpha fixes. 1999-05-03 20:27:25 +00:00
Martin Baulig
70b65c05e5 Merged a few bug fixes from the HEAD. 1999-05-03 20:06:40 +00:00
139 changed files with 7227 additions and 455 deletions

View File

@@ -1,3 +1,20 @@
1999-05-31 Martin Baulig <martin@home-of-linux.org>
Released LibGTop 1.0.2.
1999-05-26 Martin Baulig <martin@home-of-linux.org>
* configure.in (INCLUDES): Define `LIBGTOP_VERSION_CODE' here so we
can use version conditionals in the sysdeps code.
1999-05-25 Martin Baulig <martin@home-of-linux.org>
* libgtop-sysdeps.m4: Make the I4B check work for NetBSD.
1999-05-16 Martin Baulig <martin@home-of-linux.org>
* doc: Merged the LibGTop Manual from the HEAD.
1999-03-01 Martin Baulig <martin@home-of-linux.org>
Released LibGTop 1.0.1.

View File

@@ -8,10 +8,10 @@
#
LIBGTOP_MAJOR_VERSION=1
LIBGTOP_MINOR_VERSION=0
LIBGTOP_MICRO_VERSION=1
LIBGTOP_MICRO_VERSION=2
LIBGTOP_INTERFACE_AGE=0
LIBGTOP_BINARY_AGE=0
LIBGTOP_INTERFACE_AGE=1
LIBGTOP_BINARY_AGE=1
# Increase each time you change the client/server protocol.
LIBGTOP_SERVER_VERSION=5

View File

@@ -11,7 +11,7 @@ support = support
endif
SUBDIRS = po intl $(support) macros misc include sysdeps lib src \
$(examples_SUBDIRS)
$(examples_SUBDIRS) doc
include_HEADERS = glibtop.h

View File

@@ -13,6 +13,12 @@ AC_MSG_ERROR([
*** The "dc" utility was not found on your system.
***
*** When using RedHat Linux, you need to install the "bc" package.
***
*** It is now part of the "bc" package, so you should look at
*** ftp://ftp.gnu.org/pub/gnu/bc/ if you want to compile it yourself.
***
*** Other systems and distributions may also have it in their "bc" package,
*** so if there's no "dc" one, please look for "bc".
***])
fi
@@ -147,7 +153,7 @@ else
fi
if test "x$enable_static" != xno; then
static_targets="first_static second_static mountlist_static procmap_static netload_static sysdeps_static $guile_static_examples $smp_static_examples"
static_targets="first_static second_static mountlist_static procmap_static netload_static sysdeps_static timings_static $guile_static_examples $smp_static_examples"
else
static_targets=""
fi
@@ -354,7 +360,7 @@ else
guile_def=""
fi
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 $CFLAGS $X_CFLAGS $guile_def "'-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 $CFLAGS $X_CFLAGS $guile_def "'-DGTOPLOCALEDIR=\"$(datadir)/locale\" -DLIBGTOP_VERSION=\"'"$LIBGTOP_VERSION"'\" -DLIBGTOP_SERVER_VERSION=\"'"$LIBGTOP_SERVER_VERSION"'\" -DLIBGTOP_VERSION_CODE='$LIBGTOP_VERSION_CODE' -DLIBGTOP_SERVER=\"'"$LIBGTOP_SERVER"'\"'
AC_SUBST(INCLUDES)
@@ -406,5 +412,6 @@ src/daemon/Makefile
src/inodedb/Makefile
lib/Makefile
examples/Makefile
doc/Makefile
support/Makefile
macros/Makefile])

View File

@@ -11,4 +11,6 @@ third_linux
third_static
second_static
second_linux
smp_static sysdeps_static netload_static procmap_static mountlist_static
smp sysdeps netload procmap mountlist
timings timings_static

View File

@@ -1,3 +1,27 @@
1999-05-28 Martin Baulig <martin@home-of-linux.org>
* first.c, second.c, sysdeps.c: Use LibGTop version conditionals
so we can more easily merge the code into LIBGTOP_STABLE_1_0.
1999-05-07 Martin Baulig <martin@home-of-linux.org>
* timings.c (timersub): Renamed this to `libgtop_timersub' and define
it on all systems.
Fri Apr 9 00:14:52 1999 Timur Bakeyev <timur@gnu.org>
* timings.c: Added timersub defenition, to make code compilable on
BSDI.
1999-03-24 Martin Baulig <martin@home-of-linux.org>
* timings.c: New example.
1999-03-17 Martin Baulig <martin@home-of-linux.org>
* first.c, second.c: Fixed a bug that caused a core dump when
the sysdeps code does not return all data.
1998-11-22 Martin Baulig <baulig@taurus.uni-trier.de>
* netload.c: Call inet_ntoa () to get address and subnet

View File

@@ -12,13 +12,14 @@ DEFS = @DEFS@
libgtopdir = $(libexecdir)/libgtop
libgtop_PROGRAMS = first second\
mountlist procmap netload sysdeps\
mountlist procmap netload sysdeps timings \
@static_targets@ @guile_examples@ @smp_examples@
EXTRA_PROGRAMS = first_static second_static \
mountlist_static procmap_static \
third third_static smp smp_static \
netload_static sysdeps_static
netload_static sysdeps_static \
timings_static
first_SOURCES = first.c
first_LDADD = $(top_builddir)/lib/libgtop.la \
@@ -108,3 +109,13 @@ smp_static_SOURCES = $(smp_SOURCES)
smp_static_LDADD = $(smp_LDADD)
smp_static_LDFLAGS = -static
timings_SOURCES = timings.c
timings_LDADD = $(top_builddir)/lib/libgtop.la \
$(top_builddir)/sysdeps/common/libgtop_common.la \
$(top_builddir)/sysdeps/@sysdeps_dir@/libgtop_sysdeps.la \
@LIBSUPPORT@ @INTLLIBS@
timings_static_SOURCES = $(timings_SOURCES)
timings_static_LDADD = $(timings_LDADD)
timings_static_LDFLAGS = -static

View File

@@ -116,9 +116,16 @@ main (int argc, char *argv [])
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_uptime (&data.uptime);
#if LIBGTOP_VERSION_CODE > 1001000
printf ("Uptime (0x%08lx): %f, %f, %lu\n",
(unsigned long) data.uptime.flags,
data.uptime.uptime, data.uptime.idletime,
(unsigned long) data.uptime.boot_time);
#else
printf ("Uptime (0x%08lx): %f, %f\n",
(unsigned long) data.uptime.flags,
data.uptime.uptime, data.uptime.idletime);
#endif
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_loadavg (&data.loadavg);
@@ -242,15 +249,52 @@ main (int argc, char *argv [])
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_state (&data.proc_state, pid);
#if LIBGTOP_VERSION_CODE > 1001000
printf ("Proc_State PID %5d (0x%08lx): '%s', %u - "
"%u, %u, %u, %u - %u, %u, %u\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,
data.proc_state.ruid, data.proc_state.rgid,
data.proc_state.has_cpu, data.proc_state.processor,
data.proc_state.last_processor);
#else
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,
(unsigned long) data.proc_state.uid,
(unsigned long) data.proc_state.gid);
#endif
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_uid (&data.proc_uid, pid);
#if LIBGTOP_VERSION_CODE > 1001000
printf ("Proc_Uid PID %5d (0x%08lx): "
"%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d - %d",
(int) pid, (unsigned long) data.proc_uid.flags,
data.proc_uid.uid, data.proc_uid.euid,
data.proc_uid.gid, data.proc_uid.egid,
data.proc_uid.suid, data.proc_uid.sgid,
data.proc_uid.fsuid, data.proc_uid.fsgid,
data.proc_uid.pid, data.proc_uid.ppid,
data.proc_uid.pgrp, data.proc_uid.session,
data.proc_uid.tty, data.proc_uid.tpgid,
data.proc_uid.priority, data.proc_uid.nice,
data.proc_uid.ngroups);
if (data.proc_uid.ngroups) {
for (i = 0; i < data.proc_uid.ngroups; i++) {
if (i)
printf (" %d", data.proc_uid.groups [i]);
else
printf (" (%d", data.proc_uid.groups [i]);
}
printf (")");
}
printf ("\n");
#else
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,
@@ -260,6 +304,7 @@ main (int argc, char *argv [])
data.proc_uid.pgrp, data.proc_uid.session,
data.proc_uid.tty, data.proc_uid.tpgid,
data.proc_uid.priority, data.proc_uid.nice);
#endif
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_mem (&data.proc_mem, pid);
@@ -277,6 +322,30 @@ main (int argc, char *argv [])
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_segment (&data.proc_segment, pid);
#if LIBGTOP_VERSION_CODE > 1001000
printf ("Proc_Segment PID %5d (0x%08lx): "
"%lu %lu %lu %lu %lu 0x%lx 0x%lx 0x%lx "
"0x%lx 0x%lx 0x%lx 0x%lx 0x%lx "
"0x%lx 0x%lx 0x%lx 0x%lx\n", (int) pid,
(unsigned long) data.proc_segment.flags,
(unsigned long) data.proc_segment.text_rss,
(unsigned long) data.proc_segment.shlib_rss,
(unsigned long) data.proc_segment.data_rss,
(unsigned long) data.proc_segment.stack_rss,
(unsigned long) data.proc_segment.dirty_size,
(unsigned long) data.proc_segment.start_code,
(unsigned long) data.proc_segment.end_code,
(unsigned long) data.proc_segment.start_data,
(unsigned long) data.proc_segment.end_data,
(unsigned long) data.proc_segment.start_brk,
(unsigned long) data.proc_segment.end_brk,
(unsigned long) data.proc_segment.start_stack,
(unsigned long) data.proc_segment.start_mmap,
(unsigned long) data.proc_segment.arg_start,
(unsigned long) data.proc_segment.arg_end,
(unsigned long) data.proc_segment.env_start,
(unsigned long) data.proc_segment.env_end);
#else
printf ("Proc_Segment PID %5d (0x%08lx): "
"%lu %lu %lu %lu %lu %lu %lu %lu\n", (int) pid,
(unsigned long) data.proc_segment.flags,
@@ -288,6 +357,7 @@ main (int argc, char *argv [])
(unsigned long) data.proc_segment.start_code,
(unsigned long) data.proc_segment.end_code,
(unsigned long) data.proc_segment.start_stack);
#endif
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_time (&data.proc_time, pid);
@@ -308,6 +378,19 @@ main (int argc, char *argv [])
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_signal (&data.proc_signal, pid);
#if LIBGTOP_VERSION_CODE > 1001000
printf ("Proc_Signal PID %5d (0x%08lx): "
"%lx %lx %lx %lx %lx %lx %lx %lx\n", (int) pid,
(unsigned long) data.proc_signal.flags,
(unsigned long) data.proc_signal.signal [0],
(unsigned long) data.proc_signal.signal [1],
(unsigned long) data.proc_signal.blocked [0],
(unsigned long) data.proc_signal.blocked [1],
(unsigned long) data.proc_signal.sigignore [0],
(unsigned long) data.proc_signal.sigignore [1],
(unsigned long) data.proc_signal.sigcatch [0],
(unsigned long) data.proc_signal.sigcatch [1]);
#else
printf ("Proc_Signal PID %5d (0x%08lx): "
"%lu %lu %lu %lu\n", (int) pid,
(unsigned long) data.proc_signal.flags,
@@ -315,12 +398,13 @@ main (int argc, char *argv [])
(unsigned long) data.proc_signal.blocked,
(unsigned long) data.proc_signal.sigignore,
(unsigned long) data.proc_signal.sigcatch);
#endif
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_kernel (&data.proc_kernel, pid);
printf ("Proc_Kernel PID %5d (0x%08lx): "
"%lu %lu %lu %lu %lu %lu %lu %lu (%s)\n", (int) pid,
"%lu %lu %lu %lu %lu 0x%lx 0x%lx 0x%lx (%s)\n", (int) pid,
(unsigned long) data.proc_kernel.flags,
(unsigned long) data.proc_kernel.k_flags,
(unsigned long) data.proc_kernel.min_flt,
@@ -344,7 +428,7 @@ main (int argc, char *argv [])
printf ("Proc_Args PID %5d (0x%08lx): %lu - '%s'\n", (int) pid,
(unsigned long) data.proc_args.flags,
(unsigned long) data.proc_args.size,
args);
args ? args : "");
glibtop_free (args);
@@ -353,15 +437,52 @@ main (int argc, char *argv [])
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_state (&data.proc_state, ppid);
#if LIBGTOP_VERSION_CODE > 1001000
printf ("Proc_State PPID %5d (0x%08lx): '%s', %u - "
"%u, %u, %u, %u - %u, %u, %u\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,
data.proc_state.ruid, data.proc_state.rgid,
data.proc_state.has_cpu, data.proc_state.processor,
data.proc_state.last_processor);
#else
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,
(unsigned long) data.proc_state.uid,
(unsigned long) data.proc_state.gid);
#endif
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_uid (&data.proc_uid, ppid);
#if LIBGTOP_VERSION_CODE > 1001000
printf ("Proc_Uid PPID %5d (0x%08lx): "
"%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d - %d",
(int) ppid, (unsigned long) data.proc_uid.flags,
data.proc_uid.uid, data.proc_uid.euid,
data.proc_uid.gid, data.proc_uid.egid,
data.proc_uid.suid, data.proc_uid.sgid,
data.proc_uid.fsuid, data.proc_uid.fsgid,
data.proc_uid.pid, data.proc_uid.ppid,
data.proc_uid.pgrp, data.proc_uid.session,
data.proc_uid.tty, data.proc_uid.tpgid,
data.proc_uid.priority, data.proc_uid.nice,
data.proc_uid.ngroups);
if (data.proc_uid.ngroups) {
for (i = 0; i < data.proc_uid.ngroups; i++) {
if (i)
printf (" %d", data.proc_uid.groups [i]);
else
printf (" (%d", data.proc_uid.groups [i]);
}
printf (")");
}
printf ("\n");
#else
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,
@@ -371,6 +492,7 @@ main (int argc, char *argv [])
data.proc_uid.pgrp, data.proc_uid.session,
data.proc_uid.tty, data.proc_uid.tpgid,
data.proc_uid.priority, data.proc_uid.nice);
#endif
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_mem (&data.proc_mem, ppid);
@@ -388,6 +510,30 @@ main (int argc, char *argv [])
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_segment (&data.proc_segment, ppid);
#if LIBGTOP_VERSION_CODE > 1001000
printf ("Proc_Segment PPID %5d (0x%08lx): "
"%lu %lu %lu %lu %lu 0x%lx 0x%lx 0x%lx "
"0x%lx 0x%lx 0x%lx 0x%lx 0x%lx "
"0x%lx 0x%lx 0x%lx 0x%lx\n", (int) ppid,
(unsigned long) data.proc_segment.flags,
(unsigned long) data.proc_segment.text_rss,
(unsigned long) data.proc_segment.shlib_rss,
(unsigned long) data.proc_segment.data_rss,
(unsigned long) data.proc_segment.stack_rss,
(unsigned long) data.proc_segment.dirty_size,
(unsigned long) data.proc_segment.start_code,
(unsigned long) data.proc_segment.end_code,
(unsigned long) data.proc_segment.start_data,
(unsigned long) data.proc_segment.end_data,
(unsigned long) data.proc_segment.start_brk,
(unsigned long) data.proc_segment.end_brk,
(unsigned long) data.proc_segment.start_stack,
(unsigned long) data.proc_segment.start_mmap,
(unsigned long) data.proc_segment.arg_start,
(unsigned long) data.proc_segment.arg_end,
(unsigned long) data.proc_segment.env_start,
(unsigned long) data.proc_segment.env_end);
#else
printf ("Proc_Segment PPID %5d (0x%08lx): "
"%lu %lu %lu %lu %lu %lu %lu %lu\n", (int) ppid,
(unsigned long) data.proc_segment.flags,
@@ -399,6 +545,7 @@ main (int argc, char *argv [])
(unsigned long) data.proc_segment.start_code,
(unsigned long) data.proc_segment.end_code,
(unsigned long) data.proc_segment.start_stack);
#endif
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_time (&data.proc_time, ppid);
@@ -419,18 +566,32 @@ main (int argc, char *argv [])
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_signal (&data.proc_signal, ppid);
#if LIBGTOP_VERSION_CODE > 1001000
printf ("Proc_Signal PPID %5d (0x%08lx): "
"%lx %lx %lx %lx %lx %lx %lx %lx\n",
(int) ppid, (unsigned long) data.proc_signal.flags,
(unsigned long) data.proc_signal.signal [0],
(unsigned long) data.proc_signal.signal [1],
(unsigned long) data.proc_signal.blocked [0],
(unsigned long) data.proc_signal.blocked [1],
(unsigned long) data.proc_signal.sigignore [0],
(unsigned long) data.proc_signal.sigignore [1],
(unsigned long) data.proc_signal.sigcatch [0],
(unsigned long) data.proc_signal.sigcatch [1]);
#else
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,
(unsigned long) data.proc_signal.sigcatch);
#endif
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_kernel (&data.proc_kernel, ppid);
printf ("Proc_Kernel PPID %5d (0x%08lx): "
"%lu %lu %lu %lu %lu %lu %lu %lu (%s)\n", (int) ppid,
"%lu %lu %lu %lu %lu 0x%lx 0x%lx 0x%lx (%s)\n", (int) ppid,
(unsigned long) data.proc_kernel.flags,
(unsigned long) data.proc_kernel.k_flags,
(unsigned long) data.proc_kernel.min_flt,
@@ -454,7 +615,7 @@ main (int argc, char *argv [])
printf ("Proc_Args PID %5d (0x%08lx): %lu - '%s'\n", (int) ppid,
(unsigned long) data.proc_args.flags,
(unsigned long) data.proc_args.size,
args);
args ? args : "");
glibtop_free (args);
@@ -463,15 +624,52 @@ main (int argc, char *argv [])
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_state (&data.proc_state, 1);
#if LIBGTOP_VERSION_CODE > 1001000
printf ("Proc_State INIT %5d (0x%08lx): '%s', %u - "
"%u, %u, %u, %u - %u, %u, %u\n", 1,
(unsigned long) data.proc_state.flags,
data.proc_state.cmd, data.proc_state.state,
data.proc_state.uid, data.proc_state.gid,
data.proc_state.ruid, data.proc_state.rgid,
data.proc_state.has_cpu, data.proc_state.processor,
data.proc_state.last_processor);
#else
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,
(unsigned long) data.proc_state.uid,
(unsigned long) data.proc_state.gid);
#endif
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_uid (&data.proc_uid, 1);
#if LIBGTOP_VERSION_CODE > 1001000
printf ("Proc_Uid INIT %5d (0x%08lx): "
"%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d - %d", 1,
(unsigned long) data.proc_uid.flags,
data.proc_uid.uid, data.proc_uid.euid,
data.proc_uid.gid, data.proc_uid.egid,
data.proc_uid.suid, data.proc_uid.sgid,
data.proc_uid.fsuid, data.proc_uid.fsgid,
data.proc_uid.pid, data.proc_uid.ppid,
data.proc_uid.pgrp, data.proc_uid.session,
data.proc_uid.tty, data.proc_uid.tpgid,
data.proc_uid.priority, data.proc_uid.nice,
data.proc_uid.ngroups);
if (data.proc_uid.ngroups) {
for (i = 0; i < data.proc_uid.ngroups; i++) {
if (i)
printf (" %d", data.proc_uid.groups [i]);
else
printf (" (%d", data.proc_uid.groups [i]);
}
printf (")");
}
printf ("\n");
#else
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,
@@ -481,6 +679,7 @@ main (int argc, char *argv [])
data.proc_uid.pgrp, data.proc_uid.session,
data.proc_uid.tty, data.proc_uid.tpgid,
data.proc_uid.priority, data.proc_uid.nice);
#endif
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_mem (&data.proc_mem, 1);
@@ -498,6 +697,30 @@ main (int argc, char *argv [])
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_segment (&data.proc_segment, 1);
#if LIBGTOP_VERSION_CODE > 1001000
printf ("Proc_Segment INIT %5d (0x%08lx): "
"%lu %lu %lu %lu %lu 0x%lx 0x%lx 0x%lx "
"0x%lx 0x%lx 0x%lx 0x%lx 0x%lx "
"0x%lx 0x%lx 0x%lx 0x%lx\n", 1,
(unsigned long) data.proc_segment.flags,
(unsigned long) data.proc_segment.text_rss,
(unsigned long) data.proc_segment.shlib_rss,
(unsigned long) data.proc_segment.data_rss,
(unsigned long) data.proc_segment.stack_rss,
(unsigned long) data.proc_segment.dirty_size,
(unsigned long) data.proc_segment.start_code,
(unsigned long) data.proc_segment.end_code,
(unsigned long) data.proc_segment.start_data,
(unsigned long) data.proc_segment.end_data,
(unsigned long) data.proc_segment.start_brk,
(unsigned long) data.proc_segment.end_brk,
(unsigned long) data.proc_segment.start_stack,
(unsigned long) data.proc_segment.start_mmap,
(unsigned long) data.proc_segment.arg_start,
(unsigned long) data.proc_segment.arg_end,
(unsigned long) data.proc_segment.env_start,
(unsigned long) data.proc_segment.env_end);
#else
printf ("Proc_Segment INIT %5d (0x%08lx): "
"%lu %lu %lu %lu %lu %lu %lu %lu\n", 1,
(unsigned long) data.proc_segment.flags,
@@ -509,6 +732,7 @@ main (int argc, char *argv [])
(unsigned long) data.proc_segment.start_code,
(unsigned long) data.proc_segment.end_code,
(unsigned long) data.proc_segment.start_stack);
#endif
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_time (&data.proc_time, 1);
@@ -529,6 +753,19 @@ main (int argc, char *argv [])
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_signal (&data.proc_signal, 1);
#if LIBGTOP_VERSION_CODE > 1001000
printf ("Proc_Signal INIT %5d (0x%08lx): "
"%lx %lx %lx %lx %lx %lx %lx %lx\n", 1,
(unsigned long) data.proc_signal.flags,
(unsigned long) data.proc_signal.signal [0],
(unsigned long) data.proc_signal.signal [1],
(unsigned long) data.proc_signal.blocked [0],
(unsigned long) data.proc_signal.blocked [1],
(unsigned long) data.proc_signal.sigignore [0],
(unsigned long) data.proc_signal.sigignore [1],
(unsigned long) data.proc_signal.sigcatch [0],
(unsigned long) data.proc_signal.sigcatch [1]);
#else
printf ("Proc_Signal INIT %5d (0x%08lx): "
"%lu %lu %lu %lu\n", 1,
(unsigned long) data.proc_signal.flags,
@@ -536,12 +773,13 @@ main (int argc, char *argv [])
(unsigned long) data.proc_signal.blocked,
(unsigned long) data.proc_signal.sigignore,
(unsigned long) data.proc_signal.sigcatch);
#endif
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_kernel (&data.proc_kernel, 1);
printf ("Proc_Kernel INIT %5d (0x%08lx): "
"%lu %lu %lu %lu %lu %lu %lu %lu (%s)\n", 1,
"%lu %lu %lu %lu %lu 0x%lx 0x%lx 0x%lx (%s)\n", 1,
(unsigned long) data.proc_kernel.flags,
(unsigned long) data.proc_kernel.k_flags,
(unsigned long) data.proc_kernel.min_flt,
@@ -565,7 +803,7 @@ main (int argc, char *argv [])
printf ("Proc_Args PID %5d (0x%08lx): %lu - '%s'\n", 1,
(unsigned long) data.proc_args.flags,
(unsigned long) data.proc_args.size,
args);
args ? args : "");
glibtop_free (args);

View File

@@ -97,7 +97,7 @@ main (int argc, char *argv [])
unsigned device, device_major, device_minor;
char perm [5];
if (maps [i].flags & (1 << GLIBTOP_MAP_ENTRY_FILENAME))
if (maps [i].flags & (1L << GLIBTOP_MAP_ENTRY_FILENAME))
filename = maps [i].filename;
#ifdef GLIBTOP_INODEDB
@@ -116,24 +116,41 @@ main (int argc, char *argv [])
device_minor = (device & 255);
device_major = ((device >> 8) & 255);
if (filename)
fprintf (stderr, "%08lx-%08lx %08lx - "
"%02x:%02x %08lu - %4s - %s\n",
if (filename) {
char *format;
if (sizeof (void*) == 8)
format = "%016lx-%016lx %016lx - "
"%02x:%02x %08lu - %4s - %s\n";
else
format = "%08lx-%08lx %08lx - "
"%02x:%02x %08lu - %4s - %s\n";
fprintf (stderr, format,
(unsigned long) maps [i].start,
(unsigned long) maps [i].end,
(unsigned long) maps [i].offset,
device_major, device_minor,
(unsigned long) maps [i].inode,
perm, filename);
else
fprintf (stderr, "%08lx-%08lx %08lx - "
"%02x:%02x %08lu - %4s\n",
} else {
char * format;
if (sizeof (void*) == 8)
format = "%016lx-%016lx %016lx - "
"%02x:%02x %08lu - %4s\n";
else
format = "%08lx-%08lx %08lx - "
"%02x:%02x %08lu - %4s\n";
fprintf (stderr, format,
(unsigned long) maps [i].start,
(unsigned long) maps [i].end,
(unsigned long) maps [i].offset,
device_major, device_minor,
(unsigned long) maps [i].inode,
perm);
}
if (filename && (filename != maps [i].filename))
glibtop_free (filename);

View File

@@ -53,15 +53,52 @@ output (pid_t pid)
glibtop_get_proc_state (&data.proc_state, pid);
#if LIBGTOP_VERSION_CODE > 1001000
printf ("Proc_State PID %5d (0x%08lx): '%s', %u - "
"%u, %u, %u, %u - %u, %u, %u\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,
data.proc_state.ruid, data.proc_state.rgid,
data.proc_state.has_cpu, data.proc_state.processor,
data.proc_state.last_processor);
#else
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,
(unsigned long) data.proc_state.uid,
(unsigned long) data.proc_state.gid);
#endif
glibtop_get_proc_uid (&data.proc_uid, pid);
#if LIBGTOP_VERSION_CODE > 1001000
printf ("Proc_Uid PID %5d (0x%08lx): "
"%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d - %d",
(int) pid, (unsigned long) data.proc_uid.flags,
data.proc_uid.uid, data.proc_uid.euid,
data.proc_uid.gid, data.proc_uid.egid,
data.proc_uid.suid, data.proc_uid.sgid,
data.proc_uid.fsuid, data.proc_uid.fsgid,
data.proc_uid.pid, data.proc_uid.ppid,
data.proc_uid.pgrp, data.proc_uid.session,
data.proc_uid.tty, data.proc_uid.tpgid,
data.proc_uid.priority, data.proc_uid.nice,
data.proc_uid.ngroups);
if (data.proc_uid.ngroups) {
for (i = 0; i < data.proc_uid.ngroups; i++) {
if (i)
printf (" %d", data.proc_uid.groups [i]);
else
printf (" (%d", data.proc_uid.groups [i]);
}
printf (")");
}
printf ("\n");
#else
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,
@@ -71,6 +108,7 @@ output (pid_t pid)
data.proc_uid.pgrp, data.proc_uid.session,
data.proc_uid.tty, data.proc_uid.tpgid,
data.proc_uid.priority, data.proc_uid.nice);
#endif
glibtop_get_proc_mem (&data.proc_mem, pid);
@@ -86,6 +124,30 @@ output (pid_t pid)
glibtop_get_proc_segment (&data.proc_segment, pid);
#if LIBGTOP_VERSION_CODE > 1001000
printf ("Proc_Segment PID %5d (0x%08lx): "
"%lu %lu %lu %lu %lu 0x%lx 0x%lx 0x%lx "
"0x%lx 0x%lx 0x%lx 0x%lx 0x%lx "
"0x%lx 0x%lx 0x%lx 0x%lx\n", (int) pid,
(unsigned long) data.proc_segment.flags,
(unsigned long) data.proc_segment.text_rss,
(unsigned long) data.proc_segment.shlib_rss,
(unsigned long) data.proc_segment.data_rss,
(unsigned long) data.proc_segment.stack_rss,
(unsigned long) data.proc_segment.dirty_size,
(unsigned long) data.proc_segment.start_code,
(unsigned long) data.proc_segment.end_code,
(unsigned long) data.proc_segment.start_data,
(unsigned long) data.proc_segment.end_data,
(unsigned long) data.proc_segment.start_brk,
(unsigned long) data.proc_segment.end_brk,
(unsigned long) data.proc_segment.start_stack,
(unsigned long) data.proc_segment.start_mmap,
(unsigned long) data.proc_segment.arg_start,
(unsigned long) data.proc_segment.arg_end,
(unsigned long) data.proc_segment.env_start,
(unsigned long) data.proc_segment.env_end);
#else
printf ("Proc_Segment PID %5d (0x%08lx): "
"%lu %lu %lu %lu %lu %lu %lu %lu\n", (int) pid,
(unsigned long) data.proc_segment.flags,
@@ -97,6 +159,7 @@ output (pid_t pid)
(unsigned long) data.proc_segment.start_code,
(unsigned long) data.proc_segment.end_code,
(unsigned long) data.proc_segment.start_stack);
#endif
glibtop_get_proc_time (&data.proc_time, pid);
@@ -115,6 +178,19 @@ output (pid_t pid)
glibtop_get_proc_signal (&data.proc_signal, pid);
#if LIBGTOP_VERSION_CODE > 1001000
printf ("Proc_Signal PID %5d (0x%08lx): "
"%lx %lx %lx %lx %lx %lx %lx %lx\n", (int) pid,
(unsigned long) data.proc_signal.flags,
(unsigned long) data.proc_signal.signal [0],
(unsigned long) data.proc_signal.signal [1],
(unsigned long) data.proc_signal.blocked [0],
(unsigned long) data.proc_signal.blocked [1],
(unsigned long) data.proc_signal.sigignore [0],
(unsigned long) data.proc_signal.sigignore [1],
(unsigned long) data.proc_signal.sigcatch [0],
(unsigned long) data.proc_signal.sigcatch [1]);
#else
printf ("Proc_Signal PID %5d (0x%08lx): "
"%lu %lu %lu %lu\n", (int) pid,
(unsigned long) data.proc_signal.flags,
@@ -122,11 +198,12 @@ output (pid_t pid)
(unsigned long) data.proc_signal.blocked,
(unsigned long) data.proc_signal.sigignore,
(unsigned long) data.proc_signal.sigcatch);
#endif
glibtop_get_proc_kernel (&data.proc_kernel, pid);
printf ("Proc_Kernel PID %5d (0x%08lx): "
"%lu %lu %lu %lu %lu %lu %lu %lu (%s)\n", (int) pid,
"%lu %lu %lu %lu %lu 0x%lx 0x%lx 0x%lx (%s)\n", (int) pid,
(unsigned long) data.proc_kernel.flags,
(unsigned long) data.proc_kernel.k_flags,
(unsigned long) data.proc_kernel.min_flt,
@@ -150,7 +227,7 @@ output (pid_t pid)
printf ("Proc_Args PID %5d (0x%08lx): %lu - '%s'\n", (int) pid,
(unsigned long) data.proc_args.flags,
(unsigned long) data.proc_args.size,
args);
args ? args : "");
glibtop_free (args);

View File

@@ -69,10 +69,13 @@ main (int argc, char *argv [])
glibtop_get_sysdeps (&sysdeps);
#define FEATURE_CHECK(f) ((sysdeps.features & (1 << GLIBTOP_SYSDEPS_##f##)) ? 1 : 0)
#define FEATURE_CHECK(f) ((sysdeps.features & (1L << GLIBTOP_SYSDEPS_##f##)) ? 1 : 0)
printf ("Sysdeps (0x%08lx):\n\n"
"\tfeatures:\t\t0x%08lx\n\n"
#if LIBGTOP_VERSION_CODE > 1001000
"\tpointer_size:\t\t0x%08lx\n\n"
#endif
"\tcpu:\t\t%d\t0x%08lx\n"
"\tmem:\t\t%d\t0x%08lx\n"
"\tswap:\t\t%d\t0x%08lx\n\n"
@@ -97,6 +100,9 @@ main (int argc, char *argv [])
"\tppp:\t\t%d\t0x%08lx\n\n",
(unsigned long) sysdeps.flags,
(unsigned long) sysdeps.features,
#if LIBGTOP_VERSION_CODE > 1001000
(unsigned long) sysdeps.pointer_size,
#endif
FEATURE_CHECK(CPU),
(unsigned long) sysdeps.cpu,
FEATURE_CHECK(MEM),

360
examples/timings.c Normal file
View File

@@ -0,0 +1,360 @@
/* $Id$ */
/* Copyright (C) 1998-99 Martin Baulig
This file is part of LibGTop 1.0.
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
LibGTop is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
LibGTop is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with LibGTop; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <locale.h>
#include <glibtop.h>
#include <glibtop/open.h>
#include <glibtop/close.h>
#include <glibtop/xmalloc.h>
#include <glibtop/parameter.h>
#include <glibtop/union.h>
#include <glibtop/sysdeps.h>
#include <sys/times.h>
#include <sys/resource.h>
#ifndef PROFILE_COUNT
#define PROFILE_COUNT 100000L
#endif
#ifndef PROFILE_COUNT_EXPENSIVE
#define PROFILE_COUNT_EXPENSIVE 10000L
#endif
#define ELAPSED_UTIME ((unsigned long) elapsed_utime.tv_sec * 1000000 + (unsigned long) elapsed_utime.tv_usec)
#define ELAPSED_STIME ((unsigned long) elapsed_stime.tv_sec * 1000000 + (unsigned long) elapsed_stime.tv_usec)
#define libgtop_timeradd(tvp, uvp, vvp) \
do { \
(vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \
(vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec; \
if ((vvp)->tv_usec >= 1000000) { \
(vvp)->tv_sec++; \
(vvp)->tv_usec -= 1000000; \
} \
} while (0)
#define libgtop_timersub(tvp, uvp, vvp) \
do { \
(vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
(vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
if ((vvp)->tv_usec < 0) { \
(vvp)->tv_sec--; \
(vvp)->tv_usec += 1000000; \
} \
} while (0)
int
main (int argc, char *argv [])
{
glibtop_union data;
glibtop_sysdeps sysdeps;
unsigned c, count, port, i, *ptr;
struct rusage total_start, total_end;
struct rusage rusage_start, rusage_end;
struct timeval elapsed_utime, elapsed_stime;
char buffer [BUFSIZ];
pid_t pid, ppid;
char *args;
count = PROFILE_COUNT;
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, GTOPLOCALEDIR);
textdomain (PACKAGE);
printf ("%-12s (%-10s): %7s - %9s - %9s\n",
"Feature", "Flags", "Count", "utime", "stime");
printf ("-------------------------------------------"
"---------------\n");
glibtop_init_r (&glibtop_global_server, 0, 0);
getrusage (RUSAGE_SELF, &total_start);
getrusage (RUSAGE_SELF, &rusage_start);
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_cpu (&data.cpu);
getrusage (RUSAGE_SELF, &rusage_end);
libgtop_timersub (&rusage_end.ru_utime, &rusage_start.ru_utime,
&elapsed_utime);
libgtop_timersub (&rusage_end.ru_stime, &rusage_start.ru_stime,
&elapsed_stime);
printf ("CPU (0x%08lx): %7lu - %9.2Lf - %9.2Lf\n",
(unsigned long) data.cpu.flags, PROFILE_COUNT,
(long double) ELAPSED_UTIME / PROFILE_COUNT,
(long double) ELAPSED_STIME / PROFILE_COUNT);
getrusage (RUSAGE_SELF, &rusage_start);
for (c = 0; c < PROFILE_COUNT_EXPENSIVE; c++)
glibtop_get_mem (&data.mem);
getrusage (RUSAGE_SELF, &rusage_end);
libgtop_timersub (&rusage_end.ru_utime, &rusage_start.ru_utime,
&elapsed_utime);
libgtop_timersub (&rusage_end.ru_stime, &rusage_start.ru_stime,
&elapsed_stime);
printf ("Memory (0x%08lx): %7lu - %9.2Lf - %9.2Lf\n",
(unsigned long) data.mem.flags, PROFILE_COUNT_EXPENSIVE,
(long double) ELAPSED_UTIME / PROFILE_COUNT_EXPENSIVE,
(long double) ELAPSED_STIME / PROFILE_COUNT_EXPENSIVE);
getrusage (RUSAGE_SELF, &rusage_start);
for (c = 0; c < PROFILE_COUNT_EXPENSIVE; c++)
glibtop_get_swap (&data.swap);
getrusage (RUSAGE_SELF, &rusage_end);
libgtop_timersub (&rusage_end.ru_utime, &rusage_start.ru_utime,
&elapsed_utime);
libgtop_timersub (&rusage_end.ru_stime, &rusage_start.ru_stime,
&elapsed_stime);
printf ("Swap (0x%08lx): %7lu - %9.2Lf - %9.2Lf\n",
(unsigned long) data.swap.flags, PROFILE_COUNT_EXPENSIVE,
(long double) ELAPSED_UTIME / PROFILE_COUNT_EXPENSIVE,
(long double) ELAPSED_STIME / PROFILE_COUNT_EXPENSIVE);
getrusage (RUSAGE_SELF, &rusage_start);
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_uptime (&data.uptime);
getrusage (RUSAGE_SELF, &rusage_end);
libgtop_timersub (&rusage_end.ru_utime, &rusage_start.ru_utime,
&elapsed_utime);
libgtop_timersub (&rusage_end.ru_stime, &rusage_start.ru_stime,
&elapsed_stime);
printf ("Uptime (0x%08lx): %7lu - %9.2Lf - %9.2Lf\n",
(unsigned long) data.uptime.flags, PROFILE_COUNT,
(long double) ELAPSED_UTIME / PROFILE_COUNT,
(long double) ELAPSED_STIME / PROFILE_COUNT);
getrusage (RUSAGE_SELF, &rusage_start);
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_loadavg (&data.loadavg);
getrusage (RUSAGE_SELF, &rusage_end);
libgtop_timersub (&rusage_end.ru_utime, &rusage_start.ru_utime,
&elapsed_utime);
libgtop_timersub (&rusage_end.ru_stime, &rusage_start.ru_stime,
&elapsed_stime);
printf ("Loadavg (0x%08lx): %7lu - %9.2Lf - %9.2Lf\n",
(unsigned long) data.loadavg.flags, PROFILE_COUNT,
(long double) ELAPSED_UTIME / PROFILE_COUNT,
(long double) ELAPSED_STIME / PROFILE_COUNT);
printf ("\n");
getrusage (RUSAGE_SELF, &rusage_start);
for (c = 0; c < PROFILE_COUNT_EXPENSIVE; c++) {
ptr = glibtop_get_proclist (&data.proclist, 0, 0);
glibtop_free (ptr);
}
getrusage (RUSAGE_SELF, &rusage_end);
libgtop_timersub (&rusage_end.ru_utime, &rusage_start.ru_utime,
&elapsed_utime);
libgtop_timersub (&rusage_end.ru_stime, &rusage_start.ru_stime,
&elapsed_stime);
printf ("Proclist (0x%08lx): %7lu - %9.2Lf - %9.2Lf\n",
(unsigned long) data.proclist.flags,
PROFILE_COUNT_EXPENSIVE,
(long double) ELAPSED_UTIME / PROFILE_COUNT_EXPENSIVE,
(long double) ELAPSED_STIME / PROFILE_COUNT_EXPENSIVE);
pid = getpid ();
printf ("\n");
getrusage (RUSAGE_SELF, &rusage_start);
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_state (&data.proc_state, pid);
getrusage (RUSAGE_SELF, &rusage_end);
libgtop_timersub (&rusage_end.ru_utime, &rusage_start.ru_utime,
&elapsed_utime);
libgtop_timersub (&rusage_end.ru_stime, &rusage_start.ru_stime,
&elapsed_stime);
printf ("Proc_State (0x%08lx): %7lu - %9.2Lf - %9.2Lf\n",
(unsigned long) data.proc_state.flags, PROFILE_COUNT,
(long double) ELAPSED_UTIME / PROFILE_COUNT,
(long double) ELAPSED_STIME / PROFILE_COUNT);
getrusage (RUSAGE_SELF, &rusage_start);
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_uid (&data.proc_uid, pid);
getrusage (RUSAGE_SELF, &rusage_end);
libgtop_timersub (&rusage_end.ru_utime, &rusage_start.ru_utime,
&elapsed_utime);
libgtop_timersub (&rusage_end.ru_stime, &rusage_start.ru_stime,
&elapsed_stime);
printf ("Proc_Uid (0x%08lx): %7lu - %9.2Lf - %9.2Lf\n",
(unsigned long) data.proc_uid.flags, PROFILE_COUNT,
(long double) ELAPSED_UTIME / PROFILE_COUNT,
(long double) ELAPSED_STIME / PROFILE_COUNT);
getrusage (RUSAGE_SELF, &rusage_start);
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_mem (&data.proc_mem, pid);
getrusage (RUSAGE_SELF, &rusage_end);
libgtop_timersub (&rusage_end.ru_utime, &rusage_start.ru_utime,
&elapsed_utime);
libgtop_timersub (&rusage_end.ru_stime, &rusage_start.ru_stime,
&elapsed_stime);
printf ("Proc_Mem (0x%08lx): %7lu - %9.2Lf - %9.2Lf\n",
(unsigned long) data.proc_mem.flags, PROFILE_COUNT,
(long double) ELAPSED_UTIME / PROFILE_COUNT,
(long double) ELAPSED_STIME / PROFILE_COUNT);
getrusage (RUSAGE_SELF, &rusage_start);
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_segment (&data.proc_segment, pid);
getrusage (RUSAGE_SELF, &rusage_end);
libgtop_timersub (&rusage_end.ru_utime, &rusage_start.ru_utime,
&elapsed_utime);
libgtop_timersub (&rusage_end.ru_stime, &rusage_start.ru_stime,
&elapsed_stime);
printf ("Proc_Segment (0x%08lx): %7lu - %9.2Lf - %9.2Lf\n",
(unsigned long) data.proc_segment.flags, PROFILE_COUNT,
(long double) ELAPSED_UTIME / PROFILE_COUNT,
(long double) ELAPSED_STIME / PROFILE_COUNT);
getrusage (RUSAGE_SELF, &rusage_start);
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_time (&data.proc_time, pid);
getrusage (RUSAGE_SELF, &rusage_end);
libgtop_timersub (&rusage_end.ru_utime, &rusage_start.ru_utime,
&elapsed_utime);
libgtop_timersub (&rusage_end.ru_stime, &rusage_start.ru_stime,
&elapsed_stime);
printf ("Proc_Time (0x%08lx): %7lu - %9.2Lf - %9.2Lf\n",
(unsigned long) data.proc_time.flags, PROFILE_COUNT,
(long double) ELAPSED_UTIME / PROFILE_COUNT,
(long double) ELAPSED_STIME / PROFILE_COUNT);
getrusage (RUSAGE_SELF, &rusage_start);
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_signal (&data.proc_signal, pid);
getrusage (RUSAGE_SELF, &rusage_end);
libgtop_timersub (&rusage_end.ru_utime, &rusage_start.ru_utime,
&elapsed_utime);
libgtop_timersub (&rusage_end.ru_stime, &rusage_start.ru_stime,
&elapsed_stime);
printf ("Proc_Signal (0x%08lx): %7lu - %9.2Lf - %9.2Lf\n",
(unsigned long) data.proc_signal.flags, PROFILE_COUNT,
(long double) ELAPSED_UTIME / PROFILE_COUNT,
(long double) ELAPSED_STIME / PROFILE_COUNT);
getrusage (RUSAGE_SELF, &rusage_start);
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_kernel (&data.proc_kernel, pid);
getrusage (RUSAGE_SELF, &rusage_end);
libgtop_timersub (&rusage_end.ru_utime, &rusage_start.ru_utime,
&elapsed_utime);
libgtop_timersub (&rusage_end.ru_stime, &rusage_start.ru_stime,
&elapsed_stime);
printf ("Proc_Kernel (0x%08lx): %7lu - %9.2Lf - %9.2Lf\n",
(unsigned long) data.proc_kernel.flags, PROFILE_COUNT,
(long double) ELAPSED_UTIME / PROFILE_COUNT,
(long double) ELAPSED_STIME / PROFILE_COUNT);
getrusage (RUSAGE_SELF, &total_end);
libgtop_timersub (&total_end.ru_utime, &total_start.ru_utime,
&elapsed_utime);
libgtop_timersub (&total_end.ru_stime, &total_start.ru_stime,
&elapsed_stime);
printf ("-------------------------------------------"
"---------------\n");
printf ("%-36s %9lu - %9lu\n\n", "TOTAL",
ELAPSED_UTIME, ELAPSED_STIME);
printf ("All timings are in clock ticks "
"(1000000 ticks per second).\n\n");
glibtop_close ();
exit (0);
}

38
include/glibtop/limits.h Normal file
View File

@@ -0,0 +1,38 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* $Id$ */
/* Copyright (C) 1998-99 Martin Baulig
This file is part of LibGTop 1.0.
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
LibGTop is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
LibGTop is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with LibGTop; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __GLIBTOP_LIMITS_H__
#define __GLIBTOP_LIMITS_H__
#include <glibtop/global.h>
BEGIN_LIBGTOP_DECLS
/* Nobody should really be using more than 64 processors. */
#define GLIBTOP_NCPU 64
END_LIBGTOP_DECLS
#endif

1
kernel/sysctl/.cvsignore Normal file
View File

@@ -0,0 +1 @@
*.flags

22
kernel/sysctl/Makefile Normal file
View File

@@ -0,0 +1,22 @@
#
# Makefile for the LibGTop linux sysctl interface.
#
# Note! Dependencies are done automagically by 'make dep', which also
# removes any old dependencies. DON'T put your own dependencies here
# unless it's something special (ie not a .c file).
#
# Note 2! The CFLAGS definition is now in the main makefile...
O_TARGET := kernel.o
ifeq ($(CONFIG_LIBGTOP),y)
O_OJBS := main.o libgtop.o
else
O_OBJS := main.o
endif
OX_OBJS := libgtop_syms.o
ifeq ($(CONFIG_LIBGTOP),m)
M_OBJS := libgtop.o
endif
include $(TOPDIR)/Rules.make

1268
kernel/sysctl/libgtop.c Normal file

File diff suppressed because it is too large Load Diff

242
kernel/sysctl/libgtop.h Normal file
View File

@@ -0,0 +1,242 @@
#ifndef _LINUX_LIBGTOP_H
#define _LINUX_LIBGTOP_H 1
#include <linux/tasks.h>
enum {
LIBGTOP_VERSION = 1,
LIBGTOP_UPDATE_EXPENSIVE,
LIBGTOP_STAT = 101,
LIBGTOP_MEM,
LIBGTOP_SWAP,
LIBGTOP_PROCLIST = 201,
LIBGTOP_PROC_STATE = 211,
LIBGTOP_PROC_KERNEL,
LIBGTOP_PROC_SEGMENT,
LIBGTOP_PROC_MEM,
LIBGTOP_PROC_SIGNAL,
LIBGTOP_PROC_ARGS = 251,
LIBGTOP_PROC_MAPS,
LIBGTOP_NETLOAD = 301
};
enum {
LIBGTOP_PROCLIST_ALL = 0,
LIBGTOP_PROCLIST_PID,
LIBGTOP_PROCLIST_PGRP,
LIBGTOP_PROCLIST_SESSION,
LIBGTOP_PROCLIST_TTY,
LIBGTOP_PROCLIST_UID,
LIBGTOP_PROCLIST_RUID
};
#define LIBGTOP_NSIG 4
#define LIBGTOP_PROCLIST_MASK 15
#define LIBGTOP_MAX_GROUPS 32
#define LIBGTOP_EXCLUDE_IDLE 0x1000
#define LIBGTOP_EXCLUDE_SYSTEM 0x2000
#define LIBGTOP_EXCLUDE_NOTTY 0x4000
#define LIBGTOP_TASK_RUNNING 1
#define LIBGTOP_TASK_INTERRUPTIBLE 2
#define LIBGTOP_TASK_UNINTERRUPTIBLE 4
#define LIBGTOP_TASK_ZOMBIE 8
#define LIBGTOP_TASK_STOPPED 16
#define LIBGTOP_TASK_SWAPPING 32
#define LIBGTOP_VM_READ 0x0001 /* currently active flags */
#define LIBGTOP_VM_WRITE 0x0002
#define LIBGTOP_VM_EXEC 0x0004
#define LIBGTOP_VM_SHARED 0x0008
#define LIBGTOP_VM_MAYREAD 0x0010 /* limits for mprotect() etc */
#define LIBGTOP_VM_MAYWRITE 0x0020
#define LIBGTOP_VM_MAYEXEC 0x0040
#define LIBGTOP_VM_MAYSHARE 0x0080
#define LIBGTOP_VM_GROWSDOWN 0x0100 /* general info on the segment */
#define LIBGTOP_VM_GROWSUP 0x0200
#define LIBGTOP_VM_SHM 0x0400 /* shared memory area, don't swap out */
#define LIBGTOP_VM_DENYWRITE 0x0800 /* ETXTBSY on write attempts.. */
#define LIBGTOP_VM_EXECUTABLE 0x1000
#define LIBGTOP_VM_LOCKED 0x2000
#define LIBGTOP_VM_IO 0x4000 /* Memory mapped I/O or similar */
#define LIBGTOP_MAP_PATH_LEN (PAGE_SIZE - sizeof (libgtop_proc_maps_header_t))
#ifndef min
#define min(a,b) ((a < b) ? a : b)
#endif
typedef struct libgtop_stat libgtop_stat_t;
typedef struct libgtop_cpu libgtop_cpu_t;
typedef struct libgtop_mem libgtop_mem_t;
typedef struct libgtop_swap libgtop_swap_t;
typedef struct libgtop_proclist libgtop_proclist_t;
typedef struct libgtop_proc_state libgtop_proc_state_t;
typedef struct libgtop_proc_kernel libgtop_proc_kernel_t;
typedef struct libgtop_proc_segment libgtop_proc_segment_t;
typedef struct libgtop_proc_mem libgtop_proc_mem_t;
typedef struct libgtop_proc_signal libgtop_proc_signal_t;
typedef struct libgtop_proc_maps_header libgtop_proc_maps_header_t;
typedef struct libgtop_proc_maps libgtop_proc_maps_t;
typedef struct libgtop_netload libgtop_netload_t;
struct libgtop_cpu
{
unsigned long total; /* Total CPU Time */
unsigned long user; /* CPU Time in User Mode */
unsigned long nice; /* CPU Time in User Mode (nice) */
unsigned long sys; /* CPU Time in System Mode */
unsigned long idle; /* CPU Time in the Idle Task */
};
struct libgtop_mem
{
unsigned long totalram; /* Total usable main memory size */
unsigned long freeram; /* Available memory size */
unsigned long sharedram; /* Amount of shared memory */
unsigned long bufferram; /* Memory used by buffers */
unsigned long cachedram;
};
struct libgtop_swap
{
unsigned long totalswap; /* Total swap space size */
unsigned long freeswap; /* swap space still available */
};
struct libgtop_proclist
{
int count;
int nr_running, nr_tasks, last_pid;
unsigned pids [NR_TASKS];
};
struct libgtop_stat
{
int ncpu; /* Number of CPUs */
unsigned long frequency; /* Tick frequency (HZ) */
libgtop_cpu_t cpu; /* CPU statistics */
libgtop_cpu_t xcpu [NR_CPUS]; /* SMP per-CPU statistics */
double loadavg [3]; /* Load average */
unsigned long total_forks; /* Total # of forks */
unsigned int context_swtch; /* Total # of context switches */
unsigned long boot_time; /* Boot time (seconds s. epoch) */
unsigned int pgpgin, pgpgout; /* # of pages paged in/out */
unsigned int pswpin, pswpout; /* # of swap pgs brought in/out */
};
struct libgtop_proc_state
{
long state;
unsigned long flags;
char comm [16];
int uid, euid, suid, fsuid;
int gid, egid, sgid, fsgid;
int pid, pgrp, ppid;
int session;
unsigned int tty;
int tpgid;
long priority, counter, def_priority;
long utime, stime, cutime, cstime, start_time;
long per_cpu_utime [NR_CPUS], per_cpu_stime [NR_CPUS];
int has_cpu, processor, last_processor;
unsigned long context;
unsigned long start_code, end_code, start_data, end_data;
unsigned long start_brk, brk, start_stack, start_mmap;
unsigned long arg_start, arg_end, env_start, env_end;
unsigned long rss, rlim, total_vm, locked_vm;
unsigned long policy, rt_priority;
unsigned long it_real_value, it_prof_value, it_virt_value;
unsigned long it_real_incr, it_prof_incr, it_virt_incr;
unsigned long keip, kesp;
unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt;
unsigned long nswap, cnswap;
int ngroups, groups [LIBGTOP_MAX_GROUPS];
};
struct libgtop_proc_kernel
{
unsigned long wchan;
};
struct libgtop_proc_segment
{
unsigned long vsize, data, exec, stack, lib;
};
struct libgtop_proc_mem
{
libgtop_proc_segment_t segment;
int size, resident, share, trs, lrs, drs, dt;
unsigned long rss, rlim;
};
struct libgtop_proc_signal
{
unsigned long signal [LIBGTOP_NSIG];
unsigned long blocked [LIBGTOP_NSIG];
unsigned long ignore [LIBGTOP_NSIG];
unsigned long catch [LIBGTOP_NSIG];
};
struct libgtop_proc_maps_header
{
unsigned long start, end, offset, perm;
off_t filename_offset;
ino_t inode;
dev_t device;
} __attribute__ ((aligned (64)));
struct libgtop_proc_maps
{
libgtop_proc_maps_header_t header;
char filename [LIBGTOP_MAP_PATH_LEN];
};
struct libgtop_netload
{
unsigned long rx_packets; /* total packets received */
unsigned long tx_packets; /* total packets transmitted */
unsigned long rx_bytes; /* total bytes received */
unsigned long tx_bytes; /* total bytes transmitted */
unsigned long rx_errors; /* bad packets received */
unsigned long tx_errors; /* packet transmit problems */
unsigned long rx_dropped; /* no space in linux buffers */
unsigned long tx_dropped; /* no space available in linux */
unsigned long multicast; /* multicast packets received */
unsigned long collisions;
/* detailed rx_errors: */
unsigned long rx_length_errors;
unsigned long rx_over_errors; /* receiver ring buff overflow */
unsigned long rx_crc_errors; /* recved pkt with crc error */
unsigned long rx_frame_errors; /* recv'd frame alignment error */
unsigned long rx_fifo_errors; /* recv'r fifo overrun */
unsigned long rx_missed_errors; /* receiver missed packet */
/* detailed tx_errors */
unsigned long tx_aborted_errors;
unsigned long tx_carrier_errors;
unsigned long tx_fifo_errors;
unsigned long tx_heartbeat_errors;
unsigned long tx_window_errors;
/* for cslip etc */
unsigned long rx_compressed;
unsigned long tx_compressed;
};
#endif

View File

@@ -0,0 +1,30 @@
/*
* linux/libgtop/libgtop_syms.c
* Copyright (C) 1999 Martin Baulig
*/
#include <linux/config.h>
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/mm.h>
#include <linux/pagemap.h>
#include <linux/swap.h>
extern unsigned long total_forks;
EXPORT_SYMBOL(task);
EXPORT_SYMBOL(init_mm);
EXPORT_SYMBOL(pidhash);
EXPORT_SYMBOL(avenrun);
EXPORT_SYMBOL(nr_running);
EXPORT_SYMBOL(nr_tasks);
EXPORT_SYMBOL(last_pid);
EXPORT_SYMBOL(total_forks);
EXPORT_SYMBOL(si_swapinfo);
extern void scheduling_functions_start_here(void);
extern void scheduling_functions_end_here(void);
EXPORT_SYMBOL(scheduling_functions_start_here);
EXPORT_SYMBOL(scheduling_functions_end_here);

4
kernel/sysctl/main.c Normal file
View File

@@ -0,0 +1,4 @@
/*
* linux/libgtop/main.c
* Copyright (C) 1999 Martin Baulig
*/

81
kernel/sysctl/patch-2.2.1 Normal file
View File

@@ -0,0 +1,81 @@
diff -ru linux-2.2.1/Makefile hacker/Makefile
--- linux-2.2.1/Makefile Sun Jan 31 22:45:42 1999
+++ hacker/Makefile Sun Mar 21 16:10:41 1999
@@ -109,6 +109,7 @@
DRIVERS =drivers/block/block.a \
drivers/char/char.a \
drivers/misc/misc.a
+EXTRAS =
LIBS =$(TOPDIR)/lib/lib.a
SUBDIRS =kernel drivers mm fs net ipc lib
@@ -186,6 +187,11 @@
DRIVERS := $(DRIVERS) drivers/net/irda/irda_drivers.a
endif
+ifdef CONFIG_LIBGTOP
+SUBDIRS := $(SUBDIRS) libgtop
+EXTRAS := $(EXTRAS) libgtop/kernel.o
+endif
+
include arch/$(ARCH)/Makefile
.S.s:
@@ -206,6 +212,7 @@
$(FILESYSTEMS) \
$(NETWORKS) \
$(DRIVERS) \
+ $(EXTRAS) \
$(LIBS) \
--end-group \
-o vmlinux
diff -ru linux-2.2.1/arch/i386/config.in hacker/arch/i386/config.in
--- linux-2.2.1/arch/i386/config.in Sun Jan 31 22:25:25 1999
+++ hacker/arch/i386/config.in Sat Mar 20 18:26:18 1999
@@ -84,6 +84,9 @@
bool 'System V IPC' CONFIG_SYSVIPC
bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT
bool 'Sysctl support' CONFIG_SYSCTL
+if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
+ tristate 'LibGTop support' CONFIG_LIBGTOP
+fi
tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT
tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
diff -ru linux-2.2.1/include/linux/sysctl.h hacker/include/linux/sysctl.h
--- linux-2.2.1/include/linux/sysctl.h Sun Jan 31 22:24:14 1999
+++ hacker/include/linux/sysctl.h Sat Mar 20 19:12:54 1999
@@ -56,7 +56,8 @@
CTL_PROC=4, /* Process info */
CTL_FS=5, /* Filesystems */
CTL_DEBUG=6, /* Debugging */
- CTL_DEV=7 /* Devices */
+ CTL_DEV=7, /* Devices */
+ CTL_LIBGTOP=408 /* LibGTop */
};
diff -ru linux-2.2.1/kernel/sysctl.c hacker/kernel/sysctl.c
--- linux-2.2.1/kernel/sysctl.c Sun Jan 31 22:24:43 1999
+++ hacker/kernel/sysctl.c Sat Mar 20 19:24:34 1999
@@ -82,7 +82,9 @@
static ctl_table fs_table[];
static ctl_table debug_table[];
static ctl_table dev_table[];
-
+#ifdef CONFIG_LIBGTOP
+extern ctl_table libgtop_table[];
+#endif
/* /proc declarations: */
@@ -148,6 +150,9 @@
{CTL_FS, "fs", NULL, 0, 0555, fs_table},
{CTL_DEBUG, "debug", NULL, 0, 0555, debug_table},
{CTL_DEV, "dev", NULL, 0, 0555, dev_table},
+#ifdef CONFIG_LIBGTOP
+ {CTL_LIBGTOP, "libgtop", NULL, 0, 0555, libgtop_table},
+#endif
{0}
};

View File

@@ -36,20 +36,26 @@ print 'static void';
print '_glibtop_missing_feature (glibtop *server, const char *feature,';
print "\t\t\t const u_int64_t present, u_int64_t *required)";
print '{';
print "\tu_int64_t old_required = *required;\n";
print "\t/* Return if we have all required fields. */";
print "\tif ((~present & old_required) == 0)";
print "\t\treturn;\n";
print "\tswitch (server->error_method) {";
print "\tcase GLIBTOP_ERROR_METHOD_WARN_ONCE:";
print "\t\t*required &= present;";
print "\tcase GLIBTOP_ERROR_METHOD_WARN:";
print "\t\tglibtop_warn_r (server,";
print "\t\t\t\t_(\"glibtop_get_%s (): Client requested \"";
print "\t\t\t\t \"field mask %05Lx, but only have %05Lx.\"),";
print "\t\t\t\t feature, required, present);";
print "\t\t\t\t \"field mask %05lx, but only have %05lx.\"),";
print "\t\t\t\t feature, (unsigned long) old_required,";
print "\t\t\t\t (unsigned long) present);";
print "\t\tbreak;";
print "\tcase GLIBTOP_ERROR_METHOD_ABORT:";
print "\t\tglibtop_error_r (server,";
print "\t\t\t\t _(\"glibtop_get_%s (): Client requested \"";
print "\t\t\t\t \"field mask %05x, but only have %05x.\"),";
print "\t\t\t\t feature, required, present);";
print "\t\t\t\t \"field mask %05lx, but only have %05lx.\"),";
print "\t\t\t\t feature, (unsigned long) old_required,";
print "\t\t\t\t (unsigned long) present);";
print "\t\tbreak;";
print "\t}";
print '}';

View File

@@ -30,6 +30,7 @@ do_read (int s, void *ptr, size_t total_size)
{
int nread;
size_t already_read = 0, remaining = total_size;
char *tmp_ptr;
while (already_read < total_size) {
nread = recv (s, ptr, remaining, 0);
@@ -46,7 +47,10 @@ do_read (int s, void *ptr, size_t total_size)
already_read += nread;
remaining -= nread;
(char *) ptr += nread;
/* (char *) ptr += nread; */
tmp_ptr = ptr;
tmp_ptr += nread;
ptr = tmp_ptr;
}
}

View File

@@ -40,6 +40,7 @@ GLIBTOP_SUID_PROC_TIME +
GLIBTOP_SUID_PROC_SIGNAL +
GLIBTOP_SUID_PROC_KERNEL +
GLIBTOP_SUID_PROC_SEGMENT +
GLIBTOP_SUID_PROC_ARGS +
GLIBTOP_SUID_PROC_MAP +
GLIBTOP_SUID_NETLOAD +
GLIBTOP_SUID_PPP;

View File

@@ -118,7 +118,7 @@ AC_DEFUN([GNOME_LIBGTOP_SYSDEPS],[
fi
libgtop_need_server=no
;;
freebsd*|netbsd*|openbsd*)
freebsd*|netbsd*|openbsd*|bsdi*)
libgtop_sysdeps_dir=freebsd
libgtop_use_machine_h=yes
libgtop_need_server=yes
@@ -177,7 +177,7 @@ AC_DEFUN([GNOME_LIBGTOP_SYSDEPS],[
#include <net/netisr.h>
#include <net/route.h>
#ifdef __FreeBSD__
#if (defined __FreeBSD__) || (defined __NetBSD__)
#include <net/if_sppp.h>
#else
#include <i4b/sppp/if_sppp.h>
@@ -203,7 +203,7 @@ AC_DEFUN([GNOME_LIBGTOP_SYSDEPS],[
#include <net/netisr.h>
#include <net/route.h>
#ifdef __FreeBSD__
#if defined(__FreeBSD__) || defined(__NetBSD__)
#include <net/if_sppp.h>
#else
#include <i4b/sppp/if_sppp.h>

View File

@@ -0,0 +1,26 @@
This statistics were made on a PPRO 200 running Linux 2.2.1
reading everything from /proc while the system was idle.
Feature (Flags ): Count - utime - stime
----------------------------------------------------------
CPU (0x000007ff): 100000 - 13.90 - 181.80
Memory (0x0000007f): 10000 - 32.00 - 8061.00
Swap (0x0000001f): 10000 - 46.00 - 8130.00
Uptime (0x00000003): 100000 - 19.60 - 72.20
Loadavg (0x0000000f): 100000 - 32.40 - 77.10
Proclist (0x00000007): 10000 - 2250.00 - 4419.00
Proc_State (0x0000000f): 100000 - 40.70 - 221.00
Proc_Uid (0x00000fff): 100000 - 72.40 - 327.30
Proc_Mem (0x0000003f): 100000 - 65.70 - 283.90
Proc_Segment (0x000000f5): 100000 - 76.50 - 281.10
Proc_Time (0x000001ff): 100000 - 37.00 - 160.90
Proc_Signal (0x0000000f): 100000 - 52.50 - 148.50
Proc_Kernel (0x0000017f): 100000 - 56.70 - 153.50
----------------------------------------------------------
TOTAL 70030000 - 396830000
All timings are in clock ticks (1000000 ticks per second).

View File

@@ -0,0 +1,27 @@
This statistics were made on a PPRO 200 running Linux 2.2.1
(the same machine I made the timings.linux-proc on) with my
new sysctl () based kernel module.
Feature (Flags ): Count - utime - stime
----------------------------------------------------------
CPU (0x0000003f): 100000 - 3.50 - 5.40
Memory (0x0000003f): 10000 - 3.00 - 6.00
Swap (0x0000001f): 10000 - 10.00 - 7.00
Uptime (0x00000003): 100000 - 2.30 - 7.00
Loadavg (0x00000001): 100000 - 3.00 - 5.60
Proclist (0x00000007): 10000 - 13.00 - 46.00
Proc_State (0x0000000d): 100000 - 3.20 - 7.70
Proc_Uid (0x00000fff): 100000 - 3.60 - 7.40
Proc_Mem (0x0000003f): 100000 - 4.10 - 34.30
Proc_Segment (0x000000ff): 100000 - 5.90 - 41.50
Proc_Time (0x0000013d): 100000 - 3.50 - 7.50
Proc_Signal (0x0000000f): 100000 - 2.70 - 8.80
Proc_Kernel (0x000000fe): 100000 - 4.00 - 13.30
----------------------------------------------------------
TOTAL 3840000 - 14440000
All timings are in clock ticks (1000000 ticks per second).

View File

@@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: libgtop VERSION\n"
"POT-Creation-Date: 1999-02-27 22:24+0100\n"
"POT-Creation-Date: 1999-05-28 01:39+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Martin Baulig <martin@home-of-linux.org>\n"
"Language-Team: Martin Baulig <martin@home-of-linux.org>\n"
@@ -1015,7 +1015,7 @@ msgstr ""
msgid "%s: option `-W %s' doesn't allow an argument\n"
msgstr ""
#: lib/read.c:71
#: lib/read.c:75
#, c-format
msgid "read %d bytes"
msgstr ""

View File

@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: glibtop 1.0.0\n"
"POT-Creation-Date: 1999-02-23 13:48+0100\n"
"POT-Creation-Date: 1999-05-28 01:39+0200\n"
"PO-Revision-Date: 1998-12-13 04:38+0100\n"
"Last-Translator: Pablo Saratxaga <srtxg@chanae.alphanet.ch>\n"
"Language-Team: Pablo Saratxaga <srtxg@chanae.alphanet.ch>\n"
@@ -1057,7 +1057,7 @@ msgstr "%s: la opci
msgid "%s: option `-W %s' doesn't allow an argument\n"
msgstr "%s: la opci<63>n `-W %s' no admite argumentos\n"
#: lib/read.c:71
#: lib/read.c:75
#, c-format
msgid "read %d bytes"
msgstr "le<6C>dos %d bytes"

View File

@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 1999-02-27 22:24+0100\n"
"POT-Creation-Date: 1999-05-28 01:39+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -992,7 +992,7 @@ msgstr ""
msgid "%s: option `-W %s' doesn't allow an argument\n"
msgstr ""
#: lib/read.c:71
#: lib/read.c:75
#, c-format
msgid "read %d bytes"
msgstr ""

View File

@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 1999-02-27 22:24+0100\n"
"POT-Creation-Date: 1999-05-28 01:39+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -992,7 +992,7 @@ msgstr ""
msgid "%s: option `-W %s' doesn't allow an argument\n"
msgstr ""
#: lib/read.c:71
#: lib/read.c:75
#, c-format
msgid "read %d bytes"
msgstr ""

View File

@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 1999-02-27 22:24+0100\n"
"POT-Creation-Date: 1999-05-28 01:39+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -992,7 +992,7 @@ msgstr ""
msgid "%s: option `-W %s' doesn't allow an argument\n"
msgstr ""
#: lib/read.c:71
#: lib/read.c:75
#, c-format
msgid "read %d bytes"
msgstr ""

View File

@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 1999-02-27 22:24+0100\n"
"POT-Creation-Date: 1999-05-28 01:39+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -992,7 +992,7 @@ msgstr ""
msgid "%s: option `-W %s' doesn't allow an argument\n"
msgstr ""
#: lib/read.c:71
#: lib/read.c:75
#, c-format
msgid "read %d bytes"
msgstr ""

View File

@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 1999-02-27 22:24+0100\n"
"POT-Creation-Date: 1999-05-28 01:39+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -992,7 +992,7 @@ msgstr ""
msgid "%s: option `-W %s' doesn't allow an argument\n"
msgstr ""
#: lib/read.c:71
#: lib/read.c:75
#, c-format
msgid "read %d bytes"
msgstr ""

View File

@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 1999-02-27 22:24+0100\n"
"POT-Creation-Date: 1999-05-28 01:39+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -992,7 +992,7 @@ msgstr ""
msgid "%s: option `-W %s' doesn't allow an argument\n"
msgstr ""
#: lib/read.c:71
#: lib/read.c:75
#, c-format
msgid "read %d bytes"
msgstr ""

View File

@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 1999-02-27 22:24+0100\n"
"POT-Creation-Date: 1999-05-28 01:39+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -992,7 +992,7 @@ msgstr ""
msgid "%s: option `-W %s' doesn't allow an argument\n"
msgstr ""
#: lib/read.c:71
#: lib/read.c:75
#, c-format
msgid "read %d bytes"
msgstr ""

1227
po/fi.po Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: libgtop VERSION\n"
"POT-Creation-Date: 1999-02-27 22:24+0100\n"
"POT-Creation-Date: 1999-05-28 01:39+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Vincent Renardias <vincent@waw.com>\n"
"Language-Team: Vincent Renardias <vincent@waw.com>\n"
@@ -983,7 +983,7 @@ msgstr ""
msgid "%s: option `-W %s' doesn't allow an argument\n"
msgstr ""
#: lib/read.c:71
#: lib/read.c:75
#, c-format
msgid "read %d bytes"
msgstr ""

View File

@@ -4,7 +4,7 @@
msgid ""
msgstr ""
"Project-Id-Version: libgtop VERSION\n"
"POT-Creation-Date: 1999-02-27 22:24+0100\n"
"POT-Creation-Date: 1999-05-28 01:39+0200\n"
"PO-Revision-Date: 1998-12-11 06:53+09:00\n"
"Last-Translator: Eiichiro ITANI <emu@ceres.dti.ne.jp>\n"
"Language-Team: <gnome@lists.hypercore.co.jp>\n"
@@ -1004,7 +1004,7 @@ msgstr ""
msgid "%s: option `-W %s' doesn't allow an argument\n"
msgstr ""
#: lib/read.c:71
#: lib/read.c:75
#, c-format
msgid "read %d bytes"
msgstr ""

View File

@@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: libgtop VERSION\n"
"POT-Creation-Date: 1999-02-27 22:24+0100\n"
"POT-Creation-Date: 1999-05-28 01:39+0200\n"
"PO-Revision-Date: 1999-02-04 14:31:38+0900\n"
"Last-Translator: Sung-Hyun Nam <namsh@lgic.co.kr>\n"
"Language-Team: Korean <ko@li.org>\n"
@@ -980,7 +980,7 @@ msgstr "%s: `-W %s'
msgid "%s: option `-W %s' doesn't allow an argument\n"
msgstr "%s: `-W %s' <20>ɼ<EFBFBD><C9BC><EFBFBD> <20><><EFBFBD>ڰ<EFBFBD> <20>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>\n"
#: lib/read.c:71
#: lib/read.c:75
#, c-format
msgid "read %d bytes"
msgstr ""

View File

@@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: libgtop 0.99.3\n"
"POT-Creation-Date: 1999-02-27 22:24+0100\n"
"POT-Creation-Date: 1999-05-28 01:39+0200\n"
"PO-Revision-Date: 1999-01-27 23:22+0100\n"
"Last-Translator: Kjartan Maraas <kmaraas@fib.hl.no>\n"
"Language-Team: Norwegian <no@li.org>\n"
@@ -1004,7 +1004,7 @@ msgstr "%s: flagget `-W %s' er flertydig\n"
msgid "%s: option `-W %s' doesn't allow an argument\n"
msgstr "%s: flagget `-W %s' tar ikke argumenter\n"
#: lib/read.c:71
#: lib/read.c:75
#, c-format
msgid "read %d bytes"
msgstr "les %d bytes"

View File

@@ -1,6 +1,7 @@
Makefile.in
Makefile
libgtop_daemon
libgtop_server
server.conf
.libs
.deps

View File

@@ -1,3 +1,11 @@
1999-05-07 Martin Baulig <martin@home-of-linux.org>
* server.c (main): There's some problem with uname () - some systems
like Solaris or Digital Unix return a nonnegative value on success,
some others like Linux return 0. Since all known systems seem to return
a negative value on failure, we simply check whether the return value is
not negative here.
1999-02-19 Martin Baulig <martin@home-of-linux.org>
* Makefile.am (LIBGTOP_COMPILE_SYSTEM): Hardcoded system name.

View File

@@ -62,6 +62,7 @@ int
do_read (int s, void *ptr, size_t total_size)
{
int nread;
char *tmp_ptr;
size_t already_read = 0, remaining = total_size;
while (already_read < total_size) {
@@ -82,7 +83,10 @@ do_read (int s, void *ptr, size_t total_size)
already_read += nread;
remaining -= nread;
(char *) ptr += nread;
/* (char *) ptr += nread; */
tmp_ptr = ptr;
tmp_ptr += nread;
ptr = tmp_ptr;
#ifdef REAL_DEBUG
fprintf (stderr, "READ (%d): %d - %d - %d\n",

View File

@@ -68,7 +68,7 @@ main(int argc, char *argv[])
uid = getuid (); euid = geteuid ();
gid = getgid (); egid = getegid ();
if (uname (&uts)) _exit (1);
if (uname (&uts) < 0) _exit (1);
if (strcmp (uts.sysname, LIBGTOP_COMPILE_SYSTEM) ||
strcmp (uts.release, LIBGTOP_COMPILE_RELEASE) ||

View File

@@ -128,7 +128,7 @@ handle_slave_command (glibtop_command *cmnd, glibtop_response *resp,
sizeof (glibtop_sysdeps));
resp->u.sysdeps.features = glibtop_server_features;
resp->u.sysdeps.flags = glibtop_server_features |
(1 << GLIBTOP_SYSDEPS_FEATURES);
(1L << GLIBTOP_SYSDEPS_FEATURES);
resp->offset = _offset_union (sysdeps);
break;
#if GLIBTOP_SUID_CPU

View File

@@ -2,24 +2,5 @@
.libs
Makefile
Makefile.in
close.lo
cpu.lo
init.lo
libgtop_sysdeps.la
loadavg.lo
mem.lo
msg_limits.lo
open.lo
prockernel.lo
proclist.lo
procmem.lo
procsegment.lo
procsignal.lo
procstate.lo
proctime.lo
procuid.lo
sem_limits.lo
shm_limits.lo
swap.lo
sysdeps.lo
uptime.lo
*.lo
*.la

View File

@@ -1,3 +1,48 @@
1999-05-26 Martin Baulig <martin@home-of-linux.org>
More NetBSD 1.4 fixes.
* mem.c, procmap.c, procmem.c: Make this work with the new UVM code.
[FIXME: This following most likely works on all BSD systems, but
this needs to be tested; I made it conditional to NetBSD 1.4 at
the moment. Please extend the conditionals to any other systems
where this works ...]
* procstate.c: Added `ruid' and `rgid' for LibGTop >= 1.1.0.
* procuid.c: Added `ngroups' and `groups' for LibGTop >= 1.1.0.
1999-05-25 Martin Baulig <martin@home-of-linux.org>
* ppp.c: Make this work on NetBSD.
Thu Apr 8 23:47:29 1999 Timur Bakeyev <timur@gnu.org>
* cpu.c, mem.c, netload.c, procargs.c, procstate.c, proctime.c,
sem_limits.c, shm_limits.c, swap.c: Added initial port for BSD/OS
(aka BSDI) 2.x and 3.x. 4.x should also(?) work.
Still, this port require more close look and extended check.
1999-03-19 Martin Baulig <martin@home-of-linux.org>
Added basic support for BSDI. It compiles without problems on
BSDI 2.1 and 3.1, but it is *untested* - I'm neither root on
the machine nor have I access to /dev/kmem, so I don't know
whether it will work.
You need to give configure the `--enable-hacker-mode' parameter
to use the code.
If someone can verify whether it actually works, please let me
know.
1999-03-18 Martin Baulig <martin@home-of-linux.org>
* ppp.c: Don't use `sppp.pp_phase' if we don't HAVE_I4B_ACCT.
This is an ugly hack until someone tells me which versions have
this field and which not.
1999-02-25 Martin Baulig <martin@home-of-linux.org>
* prockernel.c, proctime.c: Applied patch Stanislav Grozev for

View File

@@ -28,13 +28,17 @@
#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) +
(1 << GLIBTOP_CPU_IDLE) + (1 << GLIBTOP_CPU_FREQUENCY);
(1L << GLIBTOP_CPU_TOTAL) + (1L << GLIBTOP_CPU_USER) +
(1L << GLIBTOP_CPU_NICE) + (1L << GLIBTOP_CPU_SYS) +
(1L << GLIBTOP_CPU_IDLE) + (1L << GLIBTOP_CPU_FREQUENCY);
/* nlist structure for kernel access */
static struct nlist nlst [] = {
#ifdef __bsdi__
{ "_cpustats" },
#else
{ "_cp_time" },
#endif
{ 0 }
};
@@ -66,7 +70,7 @@ glibtop_get_cpu_p (glibtop *server, glibtop_cpu *buf)
struct clockinfo ci;
size_t length;
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_CPU), 0);
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_CPU), 0);
memset (buf, 0, sizeof (glibtop_cpu));

View File

@@ -26,6 +26,10 @@
BEGIN_LIBGTOP_DECLS
#if _IN_LIBGTOP
#include <sys/param.h>
#endif
#define KI_PROC(ki) (&(ki))->kp_proc)
#define KI_EPROC(ki) (&(ki))->kp_eproc)

View File

@@ -28,7 +28,7 @@
#include <glibtop_suid.h>
static const unsigned long _glibtop_sysdeps_loadavg =
(1 << GLIBTOP_LOADAVG_LOADAVG);
(1L << GLIBTOP_LOADAVG_LOADAVG);
/* Init function. */
@@ -46,7 +46,7 @@ glibtop_get_loadavg_p (glibtop *server, glibtop_loadavg *buf)
double ldavg[3];
int i;
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_LOADAVG), 0);
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_LOADAVG), 0);
memset (buf, 0, sizeof (glibtop_loadavg));

View File

@@ -31,14 +31,19 @@
#include <sys/vmmeter.h>
#include <vm/vm_param.h>
static const unsigned long _glibtop_sysdeps_mem =
(1 << GLIBTOP_MEM_TOTAL) + (1 << GLIBTOP_MEM_USED) +
(1 << GLIBTOP_MEM_FREE) + (1 << GLIBTOP_MEM_SHARED) +
(1 << GLIBTOP_MEM_BUFFER) +
#ifdef __FreeBSD__
(1 << GLIBTOP_MEM_CACHED) +
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
#include <uvm/uvm_extern.h>
#endif
(1 << GLIBTOP_MEM_USER) + (1 << GLIBTOP_MEM_LOCKED);
static const unsigned long _glibtop_sysdeps_mem =
(1L << GLIBTOP_MEM_TOTAL) + (1L << GLIBTOP_MEM_USED) +
(1L << GLIBTOP_MEM_FREE) +
(1L << GLIBTOP_MEM_SHARED) +
(1L << GLIBTOP_MEM_BUFFER) +
#ifdef __FreeBSD__
(1L << GLIBTOP_MEM_CACHED) +
#endif
(1L << GLIBTOP_MEM_USER) + (1L << GLIBTOP_MEM_LOCKED);
#ifndef LOG1024
#define LOG1024 10
@@ -52,18 +57,33 @@ static int pageshift; /* log base 2 of the pagesize */
/* nlist structure for kernel access */
static struct nlist nlst [] = {
{ "_cnt" },
#ifdef __FreeBSD__
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
{ "_bufpages" },
{ 0 }
#else
#if defined(__bsdi__)
{ "_bufcachemem" },
#elif defined(__FreeBSD__)
{ "_bufspace" },
#else
{ "_bufpages" },
#endif
{ "_cnt" },
{ 0 }
#endif
};
/* MIB array for sysctl */
/* static int mib_length=2; */
static int mib_length=2;
#ifdef __bsdi__
static int mib [] = { CTL_VM, VM_TOTAL };
#else
static int mib [] = { CTL_VM, VM_METER };
#endif
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
static int mib_uvmexp [] = { CTL_VM, VM_UVMEXP };
#endif
/* Init function. */
@@ -97,12 +117,18 @@ glibtop_get_mem_p (glibtop *server, glibtop_mem *buf)
{
struct vmtotal vmt;
size_t length_vmt;
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
struct uvmexp uvmexp;
size_t length_uvmexp;
#else
struct vmmeter vmm;
#endif
u_int v_used_count;
u_int v_total_count;
u_int v_free_count;
int bufspace;
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_MEM), 0);
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_MEM), 0);
memset (buf, 0, sizeof (glibtop_mem));
@@ -116,18 +142,26 @@ glibtop_get_mem_p (glibtop *server, glibtop_mem *buf)
/* Get the data from sysctl */
length_vmt = sizeof (vmt);
if (sysctl (mib, 2, &vmt, &length_vmt, NULL, 0)) {
glibtop_warn_io_r (server, "sysctl");
glibtop_warn_io_r (server, "sysctl (vmt)");
return;
}
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
length_uvmexp = sizeof (uvmexp);
if (sysctl (mib_uvmexp, 2, &uvmexp, &length_uvmexp, NULL, 0)) {
glibtop_warn_io_r (server, "sysctl (uvmexp)");
return;
}
#else
/* Get the data from kvm_* */
if (kvm_read (server->machine.kd, nlst[0].n_value,
if (kvm_read (server->machine.kd, nlst[1].n_value,
&vmm, sizeof (vmm)) != sizeof (vmm)) {
glibtop_warn_io_r (server, "kvm_read (cnt)");
return;
}
#endif
if (kvm_read (server->machine.kd, nlst[1].n_value,
if (kvm_read (server->machine.kd, nlst[0].n_value,
&bufspace, sizeof (bufspace)) != sizeof (bufspace)) {
glibtop_warn_io_r (server, "kvm_read (bufspace)");
return;
@@ -135,25 +169,43 @@ glibtop_get_mem_p (glibtop *server, glibtop_mem *buf)
/* convert memory stats to Kbytes */
#ifdef __FreeBSD__
#if defined(__FreeBSD__)
v_total_count = vmm.v_page_count;
#else
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
v_total_count = uvmexp.reserve_kernel +
uvmexp.reserve_pagedaemon +
uvmexp.free + uvmexp.wired + uvmexp.active +
uvmexp.inactive;
#else
v_total_count = vmm.v_kernel_pages +
vmm.v_free_count + vmm.v_wire_count +
vmm.v_active_count + vmm.v_inactive_count;
#endif
#endif
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
v_used_count = uvmexp.active + uvmexp.inactive;
v_free_count = uvmexp.free;
#else
v_used_count = vmm.v_active_count + vmm.v_inactive_count;
v_free_count = vmm.v_free_count;
#endif
buf->total = (u_int64_t) pagetok (v_total_count) << LOG1024;
buf->used = (u_int64_t) pagetok (v_used_count) << LOG1024;
buf->free = (u_int64_t) pagetok (vmm.v_free_count) << LOG1024;
buf->free = (u_int64_t) pagetok (v_free_count) << LOG1024;
#ifdef __FreeBSD__
buf->cached = (u_int64_t) pagetok (vmm.v_cache_count) << LOG1024;
#endif
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
buf->locked = (u_int64_t) pagetok (uvmexp.wired) << LOG1024;
#else
buf->locked = (u_int64_t) pagetok (vmm.v_wire_count) << LOG1024;
#endif
buf->shared = (u_int64_t) pagetok (vmt.t_rmshr) << LOG1024;
#if __FreeBSD__

View File

@@ -27,9 +27,26 @@
#include <glibtop_suid.h>
#if (defined __bsdi__) && (_BSDI_VERSION < 199700)
/* Older versions of BSDI don't seem to have this. */
void
glibtop_init_msg_limits_p (glibtop *server)
{ }
void
glibtop_get_msg_limits_p (glibtop *server, glibtop_msg_limits *buf)
{
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_MSG_LIMITS), 0);
memset (buf, 0, sizeof (glibtop_msg_limits));
}
#else
/* #define KERNEL to get declaration of `struct msginfo'. */
#ifdef __FreeBSD__
#if (defined __FreeBSD__) || (defined __bsdi__)
#define KERNEL 1
#else
#define _KERNEL 1
@@ -39,9 +56,9 @@
#include <sys/msg.h>
static const unsigned long _glibtop_sysdeps_msg_limits =
(1 << GLIBTOP_IPC_MSGMAX) + (1 << GLIBTOP_IPC_MSGMNI) +
(1 << GLIBTOP_IPC_MSGMNB) + (1 << GLIBTOP_IPC_MSGTQL) +
(1 << GLIBTOP_IPC_MSGSSZ);
(1L << GLIBTOP_IPC_MSGMAX) + (1L << GLIBTOP_IPC_MSGMNI) +
(1L << GLIBTOP_IPC_MSGMNB) + (1L << GLIBTOP_IPC_MSGTQL) +
(1L << GLIBTOP_IPC_MSGSSZ);
/* The values in this structure never change at runtime, so we only
* read it once during initialization. We have to use the name `_msginfo'
@@ -78,7 +95,7 @@ glibtop_init_msg_limits_p (glibtop *server)
void
glibtop_get_msg_limits_p (glibtop *server, glibtop_msg_limits *buf)
{
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_MSG_LIMITS), 0);
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_MSG_LIMITS), 0);
memset (buf, 0, sizeof (glibtop_msg_limits));
@@ -93,3 +110,6 @@ glibtop_get_msg_limits_p (glibtop *server, glibtop_msg_limits *buf)
buf->flags = _glibtop_sysdeps_msg_limits;
}
#endif /* either a newer BSDI or no BSDI at all. */

View File

@@ -39,20 +39,20 @@
#include <netinet/in_var.h>
static const unsigned long _glibtop_sysdeps_netload =
(1 << GLIBTOP_NETLOAD_IF_FLAGS) +
(1 << GLIBTOP_NETLOAD_MTU) +
(1 << GLIBTOP_NETLOAD_SUBNET) +
(1 << GLIBTOP_NETLOAD_ADDRESS) +
(1 << GLIBTOP_NETLOAD_PACKETS_IN) +
(1 << GLIBTOP_NETLOAD_PACKETS_OUT) +
(1 << GLIBTOP_NETLOAD_PACKETS_TOTAL) +
(1 << GLIBTOP_NETLOAD_BYTES_IN) +
(1 << GLIBTOP_NETLOAD_BYTES_OUT) +
(1 << GLIBTOP_NETLOAD_BYTES_TOTAL) +
(1 << GLIBTOP_NETLOAD_ERRORS_IN) +
(1 << GLIBTOP_NETLOAD_ERRORS_OUT) +
(1 << GLIBTOP_NETLOAD_ERRORS_TOTAL) +
(1 << GLIBTOP_NETLOAD_COLLISIONS);
(1L << GLIBTOP_NETLOAD_IF_FLAGS) +
(1L << GLIBTOP_NETLOAD_MTU) +
(1L << GLIBTOP_NETLOAD_SUBNET) +
(1L << GLIBTOP_NETLOAD_ADDRESS) +
(1L << GLIBTOP_NETLOAD_PACKETS_IN) +
(1L << GLIBTOP_NETLOAD_PACKETS_OUT) +
(1L << GLIBTOP_NETLOAD_PACKETS_TOTAL) +
(1L << GLIBTOP_NETLOAD_BYTES_IN) +
(1L << GLIBTOP_NETLOAD_BYTES_OUT) +
(1L << GLIBTOP_NETLOAD_BYTES_TOTAL) +
(1L << GLIBTOP_NETLOAD_ERRORS_IN) +
(1L << GLIBTOP_NETLOAD_ERRORS_OUT) +
(1L << GLIBTOP_NETLOAD_ERRORS_TOTAL) +
(1L << GLIBTOP_NETLOAD_COLLISIONS);
/* nlist structure for kernel access */
static struct nlist nlst [] = {
@@ -87,7 +87,7 @@ glibtop_get_netload_p (glibtop *server, glibtop_netload *buf,
struct in_ifaddr in;
} ifaddr;
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_NETLOAD), 0);
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_NETLOAD), 0);
memset (buf, 0, sizeof (glibtop_netload));
@@ -107,7 +107,7 @@ glibtop_get_netload_p (glibtop *server, glibtop_netload *buf,
sizeof (ifnet)) != sizeof (ifnet))
glibtop_error_io_r (server, "kvm_read (ifnetaddr)");
#ifdef __FreeBSD__
#if defined(__FreeBSD__) || defined(__bsdi__)
if (kvm_read (server->machine.kd, (u_long) ifnet.if_name,
tname, 16) != 16)
glibtop_error_io_r (server, "kvm_read (if_name)");
@@ -116,9 +116,9 @@ glibtop_get_netload_p (glibtop *server, glibtop_netload *buf,
tname [15] = 0;
#endif
#if (defined __FreeBSD__) && (__FreeBSD_version >= 300000)
#if defined(__FreeBSD__) && (__FreeBSD_version >= 300000)
ifaddraddr = (u_long) ifnet.if_addrhead.tqh_first;
#elif (defined __FreeBSD__)
#elif defined(__FreeBSD__) || defined(__bsdi__)
ifaddraddr = (u_long) ifnet.if_addrlist;
#else
ifaddraddr = (u_long) ifnet.if_addrlist.tqh_first;
@@ -194,18 +194,18 @@ glibtop_get_netload_p (glibtop *server, glibtop_netload *buf,
return;
}
#if (defined __FreeBSD__) && (__FreeBSD_version >= 300000)
#if defined(__FreeBSD__) && (__FreeBSD_version >= 300000)
ifaddraddr = (u_long)ifaddr.ifa.ifa_link.tqe_next;
#elif (defined __FreeBSD__)
#elif defined(__FreeBSD__) || defined(__bsdi__)
ifaddraddr = (u_long)ifaddr.ifa.ifa_next;
#else
ifaddraddr = (u_long)ifaddr.ifa.ifa_list.tqe_next;
#endif
}
#if (defined __FreeBSD__) && (__FreeBSD_version >= 300000)
#if defined(__FreeBSD__) && (__FreeBSD_version >= 300000)
ifnetaddr = (u_long) ifnet.if_link.tqe_next;
#elif (defined __FreeBSD__)
#elif defined(__FreeBSD__) || defined(__bsdi__)
ifnetaddr = (u_long) ifnet.if_next;
#else
ifnetaddr = (u_long) ifnet.if_list.tqe_next;

View File

@@ -39,7 +39,7 @@
#include <net/netisr.h>
#include <net/route.h>
#ifdef __FreeBSD__
#if defined(__FreeBSD__) || defined(__NetBSD__)
#include <net/if_sppp.h>
#else
#include <i4b/sppp/if_sppp.h>
@@ -51,11 +51,11 @@
#endif
static const unsigned long _glibtop_sysdeps_ppp =
(1 << GLIBTOP_PPP_STATE);
(1L << GLIBTOP_PPP_STATE);
#ifdef HAVE_I4B_ACCT
static const unsigned long _glibtop_sysdeps_ppp_acct =
(1 << GLIBTOP_PPP_BYTES_IN) + (1 << GLIBTOP_PPP_BYTES_OUT);
(1L << GLIBTOP_PPP_BYTES_IN) + (1L << GLIBTOP_PPP_BYTES_OUT);
#endif
#endif /* HAVE_I4B */
@@ -99,7 +99,7 @@ glibtop_get_ppp_p (glibtop *server, glibtop_ppp *buf, unsigned short device)
#endif
int phase;
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PPP), 0);
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PPP), 0);
memset (buf, 0, sizeof (glibtop_ppp));
@@ -110,10 +110,15 @@ glibtop_get_ppp_p (glibtop *server, glibtop_ppp *buf, unsigned short device)
#ifdef HAVE_I4B_ACCT
phase = data.sc_if_un.scu_sp.pp_phase;
#else
/* FIXME: Which FreeBSD version have this field and
* which not. */
#if 0
phase = data.pp_phase;
#endif
#endif
switch (phase) {
#ifdef HAVE_I4B_ACCT
case PHASE_DEAD:
case PHASE_TERMINATE:
buf->state = GLIBTOP_PPP_STATE_HANGUP;
@@ -122,6 +127,7 @@ glibtop_get_ppp_p (glibtop *server, glibtop_ppp *buf, unsigned short device)
case PHASE_NETWORK:
buf->state = GLIBTOP_PPP_STATE_ONLINE;
break;
#endif
default:
buf->state = GLIBTOP_PPP_STATE_UNKNOWN;
break;

View File

@@ -33,7 +33,7 @@
#include <sys/proc.h>
static const unsigned long _glibtop_sysdeps_proc_args =
(1 << GLIBTOP_PROC_ARGS_SIZE);
(1L << GLIBTOP_PROC_ARGS_SIZE);
/* Init function. */
@@ -54,18 +54,22 @@ glibtop_get_proc_args_p (glibtop *server, glibtop_proc_args *buf,
unsigned size = 0, pos = 0;
int count;
#ifndef __bsdi__
char filename [BUFSIZ];
struct stat statb;
#endif
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_ARGS), 0);
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_ARGS), 0);
memset (buf, 0, sizeof (glibtop_proc_args));
/* swapper, init, pagedaemon, vmdaemon, update - this doen't work. */
if (pid < 5) return NULL;
#ifndef __bsdi__
sprintf (filename, "/proc/%d/mem", pid);
if (stat (filename, &statb)) return NULL;
#endif
glibtop_suid_enter (server);

View File

@@ -28,7 +28,7 @@
#define LINUX_VERSION(x,y,z) (0x10000*(x) + 0x100*(y) + z)
#define BIT_SHIFT(x) (1 << (x % 32))
#define BIT_SHIFT(x) (1L << (x % 64))
static const unsigned long _glibtop_sysdeps_procdata_0 =
BIT_SHIFT(GLIBTOP_PROCDATA_CMD) +

View File

@@ -31,10 +31,12 @@
#include <sys/param.h>
#include <sys/sysctl.h>
#include <sys/proc.h>
#ifndef __OpenBSD__
#if (!defined __OpenBSD__) && (!defined __bsdi__)
#include <sys/user.h>
#endif
#ifndef __bsdi__
#include <machine/pcb.h>
#endif
#ifdef __FreeBSD__
#include <machine/tss.h>
#endif
@@ -47,18 +49,18 @@
#endif
static const unsigned long _glibtop_sysdeps_proc_kernel_pstats =
(1 << GLIBTOP_PROC_KERNEL_MIN_FLT) +
(1 << GLIBTOP_PROC_KERNEL_MAJ_FLT) +
(1 << GLIBTOP_PROC_KERNEL_CMIN_FLT) +
(1 << GLIBTOP_PROC_KERNEL_CMAJ_FLT);
(1L << GLIBTOP_PROC_KERNEL_MIN_FLT) +
(1L << GLIBTOP_PROC_KERNEL_MAJ_FLT) +
(1L << GLIBTOP_PROC_KERNEL_CMIN_FLT) +
(1L << GLIBTOP_PROC_KERNEL_CMAJ_FLT);
static const unsigned long _glibtop_sysdeps_proc_kernel_pcb =
(1 << GLIBTOP_PROC_KERNEL_KSTK_EIP) +
(1 << GLIBTOP_PROC_KERNEL_KSTK_ESP);
(1L << GLIBTOP_PROC_KERNEL_KSTK_EIP) +
(1L << GLIBTOP_PROC_KERNEL_KSTK_ESP);
static const unsigned long _glibtop_sysdeps_proc_kernel_wchan =
(1 << GLIBTOP_PROC_KERNEL_NWCHAN) +
(1 << GLIBTOP_PROC_KERNEL_WCHAN);
(1L << GLIBTOP_PROC_KERNEL_NWCHAN) +
(1L << GLIBTOP_PROC_KERNEL_WCHAN);
/* Init function. */
@@ -84,7 +86,7 @@ glibtop_get_proc_kernel_p (glibtop *server,
char filename [BUFSIZ];
struct stat statb;
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_KERNEL), 0);
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_KERNEL), 0);
memset (buf, 0, sizeof (glibtop_proc_kernel));
@@ -100,13 +102,13 @@ glibtop_get_proc_kernel_p (glibtop *server,
glibtop_error_io_r (server, "kvm_getprocs (%d)", pid);
buf->nwchan = (unsigned long) pinfo [0].kp_proc.p_wchan &~ KERNBASE;
buf->flags |= (1 << GLIBTOP_PROC_KERNEL_NWCHAN);
buf->flags |= (1L << GLIBTOP_PROC_KERNEL_NWCHAN);
if (pinfo [0].kp_proc.p_wchan && pinfo [0].kp_proc.p_wmesg) {
strncpy (buf->wchan, pinfo [0].kp_eproc.e_wmesg,
sizeof (buf->wchan) - 1);
buf->wchan [sizeof (buf->wchan) - 1] = 0;
buf->flags |= (1 << GLIBTOP_PROC_KERNEL_WCHAN);
buf->flags |= (1L << GLIBTOP_PROC_KERNEL_WCHAN);
} else {
buf->wchan [0] = 0;
}
@@ -122,7 +124,7 @@ glibtop_get_proc_kernel_p (glibtop *server,
/* NOTE: You need to mount the /proc filesystem to make
* `kvm_uread' work. */
sprintf (filename, "/proc/%d/mem", pid);
sprintf (filename, "/proc/%d/mem", (int) pid);
if (stat (filename, &statb)) return;
glibtop_suid_enter (server);
@@ -162,7 +164,11 @@ glibtop_get_proc_kernel_p (glibtop *server,
#endif
#else
buf->kstk_esp = (u_int64_t) pcb.pcb_tss.tss_esp0;
#ifdef __bsdi__
buf->kstk_eip = (u_int64_t) pcb.pcb_tss.tss_eip;
#else
buf->kstk_eip = (u_int64_t) pcb.pcb_tss.__tss_eip;
#endif
buf->flags |= _glibtop_sysdeps_proc_kernel_pcb;
#endif

View File

@@ -29,8 +29,8 @@
#include <glibtop_suid.h>
static const unsigned long _glibtop_sysdeps_proclist =
(1 << GLIBTOP_PROCLIST_TOTAL) + (1 << GLIBTOP_PROCLIST_NUMBER) +
(1 << GLIBTOP_PROCLIST_SIZE);
(1L << GLIBTOP_PROCLIST_TOTAL) + (1L << GLIBTOP_PROCLIST_NUMBER) +
(1L << GLIBTOP_PROCLIST_SIZE);
/* Fetch list of currently running processes.
* The interface of this function is a little bit different from the others:
@@ -67,7 +67,7 @@ glibtop_get_proclist_p (glibtop *server, glibtop_proclist *buf,
int which, count;
int i,j;
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROCLIST), 0);
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROCLIST), 0);
memset (buf, 0, sizeof (glibtop_proclist));

View File

@@ -42,20 +42,28 @@
#include <ufs/ufs/inode.h>
#include <sys/ucred.h>
#ifndef __OpenBSD__
#if (!defined __OpenBSD__) && (!defined __bsdi__)
#include <sys/user.h>
#endif
#include <sys/sysctl.h>
#include <vm/vm.h>
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
/* Fixme ... */
#undef _KERNEL
#define _UVM_UVM_AMAP_I_H_ 1
#define _UVM_UVM_MAP_I_H_ 1
#include <uvm/uvm.h>
#endif
static const unsigned long _glibtop_sysdeps_proc_map =
(1 << GLIBTOP_PROC_MAP_TOTAL) + (1 << GLIBTOP_PROC_MAP_NUMBER) +
(1 << GLIBTOP_PROC_MAP_SIZE);
(1L << GLIBTOP_PROC_MAP_TOTAL) + (1L << GLIBTOP_PROC_MAP_NUMBER) +
(1L << GLIBTOP_PROC_MAP_SIZE);
static const unsigned long _glibtop_sysdeps_map_entry =
(1 << GLIBTOP_MAP_ENTRY_START) + (1 << GLIBTOP_MAP_ENTRY_END) +
(1 << GLIBTOP_MAP_ENTRY_OFFSET) + (1 << GLIBTOP_MAP_ENTRY_PERM) +
(1 << GLIBTOP_MAP_ENTRY_INODE) + (1 << GLIBTOP_MAP_ENTRY_DEVICE);
(1L << GLIBTOP_MAP_ENTRY_START) + (1L << GLIBTOP_MAP_ENTRY_END) +
(1L << GLIBTOP_MAP_ENTRY_OFFSET) + (1L << GLIBTOP_MAP_ENTRY_PERM) +
(1L << GLIBTOP_MAP_ENTRY_INODE) + (1L << GLIBTOP_MAP_ENTRY_DEVICE);
/* Init function. */
@@ -74,15 +82,22 @@ glibtop_get_proc_map_p (glibtop *server, glibtop_proc_map *buf,
struct kinfo_proc *pinfo;
struct vm_map_entry entry, *first;
struct vmspace vmspace;
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
struct vnode vnode;
struct inode inode;
#else
struct vm_object object;
#endif
glibtop_map_entry *maps;
#if defined __FreeBSD__
struct vnode vnode;
struct inode inode;
struct mount mount;
#endif
int count, i = 0;
int update = 0;
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_MAP), 0);
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_MAP), 0);
memset (buf, 0, sizeof (glibtop_proc_map));
@@ -147,9 +162,14 @@ glibtop_get_proc_map_p (glibtop *server, glibtop_proc_map *buf,
if (entry.eflags & (MAP_ENTRY_IS_A_MAP|MAP_ENTRY_IS_SUB_MAP))
continue;
#endif
#else
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
if (UVM_ET_ISSUBMAP (&entry))
continue;
#else
if (entry.is_a_map || entry.is_sub_map)
continue;
#endif
#endif
maps [i].flags = _glibtop_sysdeps_map_entry;
@@ -169,6 +189,19 @@ glibtop_get_proc_map_p (glibtop *server, glibtop_proc_map *buf,
i++;
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
if (!entry.object.uvm_obj)
continue;
/* We're only interested in vnodes */
if (kvm_read (server->machine.kd,
(unsigned long) entry.object.uvm_obj,
&vnode, sizeof (vnode)) != sizeof (vnode)) {
glibtop_warn_io_r (server, "kvm_read (vnode)");
return NULL;
}
#else
if (!entry.object.vm_object)
continue;
@@ -178,6 +211,24 @@ glibtop_get_proc_map_p (glibtop *server, glibtop_proc_map *buf,
(unsigned long) entry.object.vm_object,
&object, sizeof (object)) != sizeof (object))
glibtop_error_io_r (server, "kvm_read (object)");
#endif
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
if (!vnode.v_uvm.u_flags & UVM_VNODE_VALID)
continue;
if ((vnode.v_type != VREG) || (vnode.v_tag != VT_UFS) ||
!vnode.v_data) continue;
if (kvm_read (server->machine.kd,
(unsigned long) vnode.v_data,
&inode, sizeof (inode)) != sizeof (inode))
glibtop_error_io_r (server, "kvm_read (inode)");
maps [i-1].inode = inode.i_number;
maps [i-1].device = inode.i_dev;
#endif
#ifdef __FreeBSD__
/* If the object is of type vnode, add its size */

View File

@@ -39,19 +39,35 @@
#include <ufs/ufs/inode.h>
#include <sys/ucred.h>
#ifndef __OpenBSD__
#if (!defined __OpenBSD__) && (!defined __bsdi__)
#include <sys/user.h>
#endif
#include <sys/sysctl.h>
#include <vm/vm.h>
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
/* Fixme ... */
#undef _KERNEL
#define _UVM_UVM_AMAP_I_H_ 1
#define _UVM_UVM_MAP_I_H_ 1
#include <uvm/uvm.h>
#endif
static const unsigned long _glibtop_sysdeps_proc_mem =
(1 << GLIBTOP_PROC_MEM_SIZE) +
(1 << GLIBTOP_PROC_MEM_VSIZE) +
(1 << GLIBTOP_PROC_MEM_SHARE) +
(1 << GLIBTOP_PROC_MEM_RESIDENT) +
(1 << GLIBTOP_PROC_MEM_RSS) +
(1 << GLIBTOP_PROC_MEM_RSS_RLIM);
(1L << GLIBTOP_PROC_MEM_SIZE) +
(1L << GLIBTOP_PROC_MEM_VSIZE) +
(1L << GLIBTOP_PROC_MEM_RESIDENT) +
(1L << GLIBTOP_PROC_MEM_RSS) +
(1L << GLIBTOP_PROC_MEM_RSS_RLIM);
static const unsigned long _glibtop_sysdeps_proc_mem_share =
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
(1L << GLIBTOP_PROC_MEM_SHARE);
#elif defined(__FreeBSD__)
(1L << GLIBTOP_PROC_MEM_SHARE);
#else
0;
#endif
#ifndef LOG1024
#define LOG1024 10
@@ -82,7 +98,8 @@ glibtop_init_proc_mem_p (glibtop *server)
/* we only need the amount of log(2)1024 for our conversion */
pageshift -= LOG1024;
server->sysdeps.proc_mem = _glibtop_sysdeps_proc_mem;
server->sysdeps.proc_mem = _glibtop_sysdeps_proc_mem |
_glibtop_sysdeps_proc_mem_share;
}
/* Provides detailed information about a process. */
@@ -94,11 +111,16 @@ glibtop_get_proc_mem_p (glibtop *server, glibtop_proc_mem *buf,
struct kinfo_proc *pinfo;
struct vm_map_entry entry, *first;
struct vmspace *vms, vmspace;
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
struct vnode vnode;
struct inode inode;
#else
struct vm_object object;
#endif
struct plimit plimit;
int count;
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_MEM), 0);
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_MEM), 0);
memset (buf, 0, sizeof (glibtop_proc_mem));
@@ -173,11 +195,29 @@ glibtop_get_proc_mem_p (glibtop *server, glibtop_proc_mem *buf,
if (entry.eflags & (MAP_ENTRY_IS_A_MAP|MAP_ENTRY_IS_SUB_MAP))
continue;
#endif
#else
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
if (UVM_ET_ISSUBMAP (&entry))
continue;
#else
if (entry.is_a_map || entry.is_sub_map)
continue;
#endif
#endif
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
if (!entry.object.uvm_obj)
continue;
/* We're only interested in vnodes */
if (kvm_read (server->machine.kd,
(unsigned long) entry.object.uvm_obj,
&vnode, sizeof (vnode)) != sizeof (vnode)) {
glibtop_warn_io_r (server, "kvm_read (vnode)");
return;
}
#else
if (!entry.object.vm_object)
continue;
@@ -189,18 +229,31 @@ glibtop_get_proc_mem_p (glibtop *server, glibtop_proc_mem *buf,
glibtop_warn_io_r (server, "kvm_read (object)");
return;
}
#endif
/* If the object is of type vnode, add its size */
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
if (!vnode.v_uvm.u_flags & UVM_VNODE_VALID)
continue;
if ((vnode.v_type != VREG) || (vnode.v_tag != VT_UFS) ||
!vnode.v_data) continue;
/* Reference count must be at least two. */
if (vnode.v_uvm.u_obj.uo_refs <= 1)
continue;
buf->share += pagetok (vnode.v_uvm.u_obj.uo_npages) << LOG1024;
#endif
#ifdef __FreeBSD__
if (object.type != OBJT_VNODE)
continue;
buf->share += object.un_pager.vnp.vnp_size;
#else
buf->share += object.size;
#endif
}
buf->flags = _glibtop_sysdeps_proc_mem;
buf->flags = _glibtop_sysdeps_proc_mem |
_glibtop_sysdeps_proc_mem_share;
}

View File

@@ -48,7 +48,7 @@ glibtop_get_proc_segment_p (glibtop *server,
glibtop_proc_segment *buf,
pid_t pid)
{
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_SEGMENT), 0);
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_SEGMENT), 0);
memset (buf, 0, sizeof (glibtop_proc_segment));

View File

@@ -28,10 +28,10 @@
#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);
(1L << GLIBTOP_PROC_SIGNAL_SIGNAL) +
(1L << GLIBTOP_PROC_SIGNAL_BLOCKED) +
(1L << GLIBTOP_PROC_SIGNAL_SIGIGNORE) +
(1L << GLIBTOP_PROC_SIGNAL_SIGCATCH);
/* Init function. */
@@ -49,7 +49,7 @@ glibtop_get_proc_signal_p (glibtop *server,
struct kinfo_proc *pinfo;
int count = 0;
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_SIGNAL), 0);
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_SIGNAL), 0);
memset (buf, 0, sizeof (glibtop_proc_signal));

View File

@@ -27,20 +27,29 @@
#include <glibtop_suid.h>
#ifndef __OpenBSD__
#if !defined(__OpenBSD__)
//&& (!defined __bsdi__)
#include <sys/user.h>
#endif
static const unsigned long _glibtop_sysdeps_proc_state =
(1 << GLIBTOP_PROC_STATE_CMD) + (1 << GLIBTOP_PROC_STATE_STATE) +
(1 << GLIBTOP_PROC_STATE_UID) + (1 << GLIBTOP_PROC_STATE_GID);
(1L << GLIBTOP_PROC_STATE_CMD) + (1L << GLIBTOP_PROC_STATE_UID) +
(1L << GLIBTOP_PROC_STATE_GID);
static const unsigned long _glibtop_sysdeps_proc_state_new =
#if LIBGTOP_VERSION_CODE >= 1001000
(1L << GLIBTOP_PROC_STATE_RUID) + (1L << GLIBTOP_PROC_STATE_RGID);
#else
0;
#endif
/* Init function. */
void
glibtop_init_proc_state_p (glibtop *server)
{
server->sysdeps.proc_state = _glibtop_sysdeps_proc_state;
server->sysdeps.proc_state = _glibtop_sysdeps_proc_state |
_glibtop_sysdeps_proc_state_new;
}
/* Provides detailed information about a process. */
@@ -53,7 +62,7 @@ glibtop_get_proc_state_p (glibtop *server,
struct kinfo_proc *pinfo;
int count = 0;
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_STATE), 0);
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_STATE), 0);
memset (buf, 0, sizeof (glibtop_proc_state));
@@ -73,27 +82,34 @@ glibtop_get_proc_state_p (glibtop *server,
buf->uid = pinfo [0].kp_eproc.e_pcred.p_svuid;
buf->gid = pinfo [0].kp_eproc.e_pcred.p_svgid;
switch (pinfo [0].kp_proc.p_stat) {
case SIDL:
buf->state = 'I';
break;
case SRUN:
buf->state = 'R';
break;
case SSLEEP:
buf->state = 'S';
break;
case SSTOP:
buf->state = 'T';
break;
case SZOMB:
buf->state = 'Z';
break;
default:
buf->state = '?';
break;
}
#if LIBGTOP_VERSION_CODE >= 1001000
buf->ruid = pinfo [0].kp_eproc.e_pcred.p_ruid;
buf->rgid = pinfo [0].kp_eproc.e_pcred.p_rgid;
#endif
/* Set the flags for the data we're about to return*/
buf->flags = _glibtop_sysdeps_proc_state;
buf->flags = _glibtop_sysdeps_proc_state |
_glibtop_sysdeps_proc_state_new;
switch (pinfo [0].kp_proc.p_stat) {
case SIDL:
buf->state = 0;
break;
case SRUN:
buf->state = GLIBTOP_PROCESS_RUNNING;
break;
case SSLEEP:
buf->state = GLIBTOP_PROCESS_INTERRUPTIBLE;
break;
case SSTOP:
buf->state = GLIBTOP_PROCESS_STOPPED;
break;
case SZOMB:
buf->state = GLIBTOP_PROCESS_ZOMBIE;
break;
default:
return;
}
buf->flags |= (1L << GLIBTOP_PROC_STATE_STATE);
}

View File

@@ -32,11 +32,12 @@
#endif
static const unsigned long _glibtop_sysdeps_proc_time =
(1 << GLIBTOP_PROC_TIME_RTIME) + (1 << GLIBTOP_PROC_TIME_FREQUENCY);
(1L << GLIBTOP_PROC_TIME_RTIME) + (1L << GLIBTOP_PROC_TIME_FREQUENCY);
static const unsigned long _glibtop_sysdeps_proc_time_user =
(1 << GLIBTOP_PROC_TIME_UTIME) + (1 << GLIBTOP_PROC_TIME_STIME) +
(1 << GLIBTOP_PROC_TIME_CUTIME) + (1 << GLIBTOP_PROC_TIME_CSTIME);
(1L << GLIBTOP_PROC_TIME_UTIME) + (1L << GLIBTOP_PROC_TIME_STIME) +
(1L << GLIBTOP_PROC_TIME_CUTIME) + (1L << GLIBTOP_PROC_TIME_CSTIME) +
(1L << GLIBTOP_PROC_TIME_START_TIME);
#define tv2sec(tv) (((u_int64_t) tv.tv_sec * 1000000) + (u_int64_t) tv.tv_usec)
@@ -123,31 +124,74 @@ glibtop_get_proc_time_p (glibtop *server, glibtop_proc_time *buf,
pid_t pid)
{
struct kinfo_proc *pinfo;
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
register struct rusage *rup;
#else
struct user *u_addr = (struct user *)USRSTACK;
#endif
struct pstats pstats;
int count;
char filename [BUFSIZ];
struct stat statb;
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_TIME), 0);
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_TIME), 0);
memset (buf, 0, sizeof (glibtop_proc_time));
if (server->sysdeps.proc_time == 0)
return;
/* It does not work for the swapper task. */
if (pid == 0) return;
sprintf (filename, "/proc/%d/mem", pid);
#if !(defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000))
if (server->sysdeps.proc_time == 0)
return;
#ifndef __bsdi__
sprintf (filename, "/proc/%d/mem", (int) pid);
if (stat (filename, &statb)) return;
#endif
#endif
/* Get the process information */
pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count);
if ((pinfo == NULL) || (count != 1))
glibtop_error_io_r (server, "kvm_getprocs (%d)", pid);
#if (defined __FreeBSD__) && (__FreeBSD_version >= 300003)
buf->rtime = pinfo [0].kp_proc.p_runtime;
#else
buf->rtime = tv2sec (pinfo [0].kp_proc.p_rtime);
#endif
buf->frequency = 1000000;
buf->flags = _glibtop_sysdeps_proc_time;
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
glibtop_suid_enter (server);
if (kvm_read (server->machine.kd,
(unsigned long) pinfo [0].kp_proc.p_stats,
&pstats, sizeof (pstats)) != sizeof (pstats)) {
glibtop_warn_io_r (server, "kvm_read (pstats)");
return;
}
glibtop_suid_leave (server);
rup = &pstats.p_ru;
calcru(&(pinfo [0]).kp_proc,
&rup->ru_utime, &rup->ru_stime, NULL);
buf->utime = tv2sec (pstats.p_ru.ru_utime);
buf->stime = tv2sec (pstats.p_ru.ru_stime);
buf->cutime = tv2sec (pstats.p_cru.ru_utime);
buf->cstime = tv2sec (pstats.p_cru.ru_stime);
buf->start_time = tv2sec (pstats.p_start);
buf->flags |= _glibtop_sysdeps_proc_time_user;
#else
glibtop_suid_enter (server);
if ((pinfo [0].kp_proc.p_flag & P_INMEM) &&
@@ -180,15 +224,6 @@ glibtop_get_proc_time_p (glibtop *server, glibtop_proc_time *buf,
}
glibtop_suid_leave (server);
#if (defined __FreeBSD__) && (__FreeBSD_version >= 300003)
buf->rtime = pinfo [0].kp_proc.p_runtime;
#else
buf->rtime = tv2sec (pinfo [0].kp_proc.p_rtime);
#endif
buf->frequency = 1000000;
buf->flags |= _glibtop_sysdeps_proc_time;
}

View File

@@ -28,18 +28,28 @@
#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) +
(1 << GLIBTOP_PROC_UID_PPID) + (1 << GLIBTOP_PROC_UID_PGRP) +
(1 << GLIBTOP_PROC_UID_TPGID) + (1 << GLIBTOP_PROC_UID_PRIORITY) +
(1 << GLIBTOP_PROC_UID_NICE);
(1L << GLIBTOP_PROC_UID_UID) + (1L << GLIBTOP_PROC_UID_EUID) +
(1L << GLIBTOP_PROC_UID_EGID) + (1L << GLIBTOP_PROC_UID_PID) +
(1L << GLIBTOP_PROC_UID_PPID) + (1L << GLIBTOP_PROC_UID_PGRP) +
(1L << GLIBTOP_PROC_UID_TPGID) + (1L << GLIBTOP_PROC_UID_PRIORITY) +
(1L << GLIBTOP_PROC_UID_NICE);
static const unsigned long _glibtop_sysdeps_proc_uid_groups =
#if LIBGTOP_VERSION_CODE >= 1001000
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
(1L << GLIBTOP_PROC_UID_NGROUPS) + (1L << GLIBTOP_PROC_UID_GROUPS);
#endif
#else
0;
#endif
/* Init function. */
void
glibtop_init_proc_uid_p (glibtop *server)
{
server->sysdeps.proc_uid = _glibtop_sysdeps_proc_uid;
server->sysdeps.proc_uid = _glibtop_sysdeps_proc_uid |
_glibtop_sysdeps_proc_uid_groups;
}
/* Provides detailed information about a process. */
@@ -51,7 +61,14 @@ glibtop_get_proc_uid_p (glibtop *server, glibtop_proc_uid *buf,
struct kinfo_proc *pinfo;
int count = 0;
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_PROC_UID), 0);
#if LIBGTOP_VERSION_CODE >= 1001000
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
struct ucred ucred;
void *ucred_ptr;
#endif
#endif
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_UID), 0);
memset (buf, 0, sizeof (glibtop_proc_uid));
@@ -80,4 +97,30 @@ glibtop_get_proc_uid_p (glibtop *server, glibtop_proc_uid *buf,
/* Set the flags for the data we're about to return*/
buf->flags = _glibtop_sysdeps_proc_uid;
/* Use LibGTop conditionals here so we can more easily merge this
* code into the LIBGTOP_STABLE_1_0 branch. */
#if LIBGTOP_VERSION_CODE >= 1001000
/* This probably also works with other versions, but not yet
* tested. Please remove the conditional if this is true. */
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
ucred_ptr = (void *) pinfo [0].kp_eproc.e_pcred.pc_ucred;
if (ucred_ptr) {
if (kvm_read (server->machine.kd, (unsigned long) ucred_ptr,
&ucred, sizeof (ucred)) != sizeof (ucred)) {
glibtop_warn_io_r (server, "kvm_read (ucred)");
} else {
int count = (ucred.cr_ngroups < GLIBTOP_MAX_GROUPS) ?
ucred.cr_ngroups : GLIBTOP_MAX_GROUPS;
int i;
for (i = 0; i < count; i++)
buf->groups [i] = ucred.cr_groups [i];
buf->ngroups = count;
buf->flags |= _glibtop_sysdeps_proc_uid_groups;
}
}
#endif
#endif
}

View File

@@ -27,9 +27,26 @@
#include <glibtop_suid.h>
#if defined(__bsdi__) && (_BSDI_VERSION < 199700)
/* Older versions of BSDI don't seem to have this. */
void
glibtop_init_sem_limits_p (glibtop *server)
{ }
void
glibtop_get_sem_limits_p (glibtop *server, glibtop_sem_limits *buf)
{
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_SEM_LIMITS), 0);
memset (buf, 0, sizeof (glibtop_sem_limits));
}
#else
/* #define KERNEL to get declaration of `struct seminfo'. */
#ifdef __FreeBSD__
#if defined(__FreeBSD__) || defined(__bsdi__)
#define KERNEL 1
#else
#define _KERNEL 1
@@ -39,11 +56,11 @@
#include <sys/sem.h>
static unsigned long _glibtop_sysdeps_sem_limits =
(1 << GLIBTOP_IPC_SEMMAP) + (1 << GLIBTOP_IPC_SEMMNI) +
(1 << GLIBTOP_IPC_SEMMNS) + (1 << GLIBTOP_IPC_SEMMNU) +
(1 << GLIBTOP_IPC_SEMMSL) + (1 << GLIBTOP_IPC_SEMOPM) +
(1 << GLIBTOP_IPC_SEMUME) + (1 << GLIBTOP_IPC_SEMUSZ) +
(1 << GLIBTOP_IPC_SEMVMX) + (1 << GLIBTOP_IPC_SEMAEM);
(1L << GLIBTOP_IPC_SEMMAP) + (1L << GLIBTOP_IPC_SEMMNI) +
(1L << GLIBTOP_IPC_SEMMNS) + (1L << GLIBTOP_IPC_SEMMNU) +
(1L << GLIBTOP_IPC_SEMMSL) + (1L << GLIBTOP_IPC_SEMOPM) +
(1L << GLIBTOP_IPC_SEMUME) + (1L << GLIBTOP_IPC_SEMUSZ) +
(1L << GLIBTOP_IPC_SEMVMX) + (1L << GLIBTOP_IPC_SEMAEM);
/* The values in this structure never change at runtime, so we only
* read it once during initialization. We have to use the name `_seminfo'
@@ -80,7 +97,7 @@ glibtop_init_sem_limits_p (glibtop *server)
void
glibtop_get_sem_limits_p (glibtop *server, glibtop_sem_limits *buf)
{
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_SEM_LIMITS), 0);
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_SEM_LIMITS), 0);
memset (buf, 0, sizeof (glibtop_sem_limits));
@@ -98,3 +115,6 @@ glibtop_get_sem_limits_p (glibtop *server, glibtop_sem_limits *buf)
buf->flags = _glibtop_sysdeps_sem_limits;
}
#endif /* either a newer BSDI or no BSDI at all. */

View File

@@ -27,9 +27,26 @@
#include <glibtop_suid.h>
#if defined(__bsdi__) && (_BSDI_VERSION < 199700)
/* Older versions of BSDI don't seem to have this. */
void
glibtop_init_shm_limits_p (glibtop *server)
{ }
void
glibtop_get_shm_limits_p (glibtop *server, glibtop_shm_limits *buf)
{
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_SHM_LIMITS), 0);
memset (buf, 0, sizeof (glibtop_shm_limits));
}
#else
/* #define KERNEL to get declaration of `struct shminfo'. */
#ifdef __FreeBSD__
#if defined(__FreeBSD__) || defined(__bsdi__)
#define KERNEL 1
#else
#define _KERNEL 1
@@ -39,9 +56,9 @@
#include <sys/shm.h>
static unsigned long _glibtop_sysdeps_shm_limits =
(1 << GLIBTOP_IPC_SHMMAX) + (1 << GLIBTOP_IPC_SHMMIN) +
(1 << GLIBTOP_IPC_SHMMNI) + (1 << GLIBTOP_IPC_SHMSEG) +
(1 << GLIBTOP_IPC_SHMALL);
(1L << GLIBTOP_IPC_SHMMAX) + (1L << GLIBTOP_IPC_SHMMIN) +
(1L << GLIBTOP_IPC_SHMMNI) + (1L << GLIBTOP_IPC_SHMSEG) +
(1L << GLIBTOP_IPC_SHMALL);
/* The values in this structure never change at runtime, so we only
* read it once during initialization. We have to use the name `_shminfo'
@@ -78,7 +95,7 @@ glibtop_init_shm_limits_p (glibtop *server)
void
glibtop_get_shm_limits_p (glibtop *server, glibtop_shm_limits *buf)
{
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_SHM_LIMITS), 0);
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_SHM_LIMITS), 0);
memset (buf, 0, sizeof (glibtop_shm_limits));
@@ -93,3 +110,6 @@ glibtop_get_shm_limits_p (glibtop *server, glibtop_shm_limits *buf)
buf->flags = _glibtop_sysdeps_shm_limits;
}
#endif /* either a newer BSDI or no BSDI at all. */

View File

@@ -30,19 +30,28 @@
#include <glibtop_suid.h>
static const unsigned long _glibtop_sysdeps_swap =
(1 << GLIBTOP_SWAP_TOTAL) + (1 << GLIBTOP_SWAP_USED) +
(1 << GLIBTOP_SWAP_FREE) + (1 << GLIBTOP_SWAP_PAGEIN) +
(1 << GLIBTOP_SWAP_PAGEOUT);
(1L << GLIBTOP_SWAP_TOTAL) + (1L << GLIBTOP_SWAP_USED) +
(1L << GLIBTOP_SWAP_FREE) + (1L << GLIBTOP_SWAP_PAGEIN) +
(1L << GLIBTOP_SWAP_PAGEOUT);
#ifdef __FreeBSD__
#if defined(__FreeBSD__) || defined(__bsdi__)
#include <sys/conf.h>
#ifdef __bsdi__
#include <vm/swap_pager.h>
#else
#include <sys/rlist.h>
#endif
#include <sys/vmmeter.h>
#if __FreeBSD__ < 4
/* nlist structure for kernel access */
#if defined(__bsdi__)
static struct nlist nlst [] = {
{ "_swapstats" }, /* general swap info */
{ 0 }
};
#elif __FreeBSD__ < 4
static struct nlist nlst [] = {
#define VM_SWAPLIST 0
{ "_swaplist" },/* list of free swap areas */
@@ -56,28 +65,36 @@ static struct nlist nlst [] = {
{ "_dmmax" }, /* maximum size of a swap block */
{ 0 }
};
#endif
#elif (defined __NetBSD__)
#elif defined(__NetBSD__)
#if (__NetBSD_Version__ >= 104000000)
#include <uvm/uvm_extern.h>
#include <sys/swap.h>
#else
#include <vm/vm_swap.h>
#endif
#endif
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
static int mib_uvmexp [] = { CTL_VM, VM_UVMEXP };
#else
/* nlist structure for kernel access */
static struct nlist nlst2 [] = {
{ "_cnt" },
{ 0 }
};
#endif
/* Init function. */
void
glibtop_init_swap_p (glibtop *server)
{
#ifdef __FreeBSD__
#if __FreeBSD__ < 4
#if defined(__FreeBSD__) || defined(__bsdi__)
#if __FreeBSD__ < 4 || defined(__bsdi__)
if (kvm_nlist (server->machine.kd, nlst) != 0) {
glibtop_warn_io_r (server, "kvm_nlist (swap)");
return;
@@ -86,16 +103,18 @@ glibtop_init_swap_p (glibtop *server)
struct kvm_swap dummy;
if (kvm_getswapinfo (server->machine.kd, &dummy, 1, 0) != 0) {
glibtop_warn_io_r (server, "kvm_nlist (swap)");
glibtop_warn_io_r (server, "kvm_swap (swap)");
return;
}
#endif
#endif
#if !(defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000))
if (kvm_nlist (server->machine.kd, nlst2) != 0) {
glibtop_warn_io_r (server, "kvm_nlist (swap)");
glibtop_warn_io_r (server, "kvm_nlist (cnt)");
return;
}
#endif
server->sysdeps.swap = _glibtop_sysdeps_swap;
}
@@ -110,8 +129,9 @@ glibtop_init_swap_p (glibtop *server)
void
glibtop_get_swap_p (glibtop *server, glibtop_swap *buf)
{
#ifdef __FreeBSD__
#if __FreeBSD__ < 4
#if defined(__FreeBSD__)
# if __FreeBSD__ < 4
char *header;
int hlen, nswdev, dmmax;
int div, nfree, npfree;
@@ -122,29 +142,44 @@ glibtop_get_swap_p (glibtop *server, glibtop_swap *buf)
struct rlist *swapptr;
size_t sw_size;
u_long ptr;
#else
# else
int nswdev;
struct kvm_swap kvmsw[16];
#endif
#elif (defined __NetBSD__)
# endif
#elif defined(__bsdi__)
struct swapstats swap;
#elif defined(__NetBSD__)
struct swapent *swaplist;
#endif
int nswap, i;
int avail = 0, inuse = 0;
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
struct uvmexp uvmexp;
size_t length_uvmexp;
#else
/* To get `pagein' and `pageout'. */
struct vmmeter vmm;
#endif
static int swappgsin = -1;
static int swappgsout = -1;
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_SWAP), 0);
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_SWAP), 0);
memset (buf, 0, sizeof (glibtop_swap));
if (server->sysdeps.swap == 0)
return;
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
length_uvmexp = sizeof (uvmexp);
if (sysctl (mib_uvmexp, 2, &uvmexp, &length_uvmexp, NULL, 0)) {
glibtop_warn_io_r (server, "sysctl (uvmexp)");
return;
}
#else
/* This is used to get the `pagein' and `pageout' members. */
if (kvm_read (server->machine.kd, nlst2[0].n_value,
@@ -152,6 +187,7 @@ glibtop_get_swap_p (glibtop *server, glibtop_swap *buf)
glibtop_warn_io_r (server, "kvm_read (cnt)");
return;
}
#endif
if (swappgsin < 0) {
buf->pagein = 0;
@@ -160,21 +196,31 @@ glibtop_get_swap_p (glibtop *server, glibtop_swap *buf)
#ifdef __FreeBSD__
buf->pagein = vmm.v_swappgsin - swappgsin;
buf->pageout = vmm.v_swappgsout - swappgsout;
#else
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
buf->pagein = uvmexp.swapins - swappgsin;
buf->pageout = uvmexp.swapouts - swappgsout;
#else
buf->pagein = vmm.v_swpin - swappgsin;
buf->pageout = vmm.v_swpout - swappgsout;
#endif
#endif
}
#ifdef __FreeBSD__
swappgsin = vmm.v_swappgsin;
swappgsout = vmm.v_swappgsout;
#else
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
swappgsin = uvmexp.swapins;
swappgsout = uvmexp.swapouts;
#else
swappgsin = vmm.v_swpin;
swappgsout = vmm.v_swpout;
#endif
#endif
#ifdef __FreeBSD__
#if defined(__FreeBSD__)
#if __FreeBSD__ < 4
@@ -214,7 +260,7 @@ glibtop_get_swap_p (glibtop *server, glibtop_swap *buf)
if (kvm_read (server->machine.kd, nlst[VM_SWDEVT].n_value,
&ptr, sizeof (ptr)) != sizeof (ptr)) {
glibtop_warn_io_r (server, "kvm_read (swaplist)");
glibtop_warn_io_r (server, "kvm_read (swdevt)");
return;
}
@@ -328,7 +374,24 @@ glibtop_get_swap_p (glibtop *server, glibtop_swap *buf)
#endif
#elif (defined __NetBSD__)
#elif defined(__bsdi__)
/* General info about swap devices. */
if (kvm_read (server->machine.kd, nlst[0].n_value,
&swap, sizeof (swap)) != sizeof (swap)) {
glibtop_warn_io_r (server, "kvm_read (swap)");
return;
}
buf->flags = _glibtop_sysdeps_swap;
buf->used = swap.swap_total - swap.swap_free;
buf->free = swap.swap_free;
buf->total = swap.swap_total;
#elif defined(__NetBSD__)
nswap = swapctl (SWAP_NSWAP, NULL, 0);
if (nswap < 0) {

View File

@@ -30,11 +30,11 @@
#include <glibtop_suid.h>
static const unsigned long _glibtop_sysdeps_uptime =
(1 << GLIBTOP_UPTIME_UPTIME) + (1 << GLIBTOP_UPTIME_IDLETIME);
(1L << GLIBTOP_UPTIME_UPTIME) + (1L << GLIBTOP_UPTIME_IDLETIME);
static const unsigned long _required_cpu_flags =
(1 << GLIBTOP_CPU_TOTAL) + (1 << GLIBTOP_CPU_IDLE) +
(1 << GLIBTOP_CPU_FREQUENCY);
(1L << GLIBTOP_CPU_TOTAL) + (1L << GLIBTOP_CPU_IDLE) +
(1L << GLIBTOP_CPU_FREQUENCY);
/* Init function. */
@@ -51,7 +51,7 @@ glibtop_get_uptime_p (glibtop *server, glibtop_uptime *buf)
{
glibtop_cpu cpu;
glibtop_init_p (server, (1 << GLIBTOP_SYSDEPS_UPTIME), 0);
glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_UPTIME), 0);
memset (buf, 0, sizeof (glibtop_uptime));

View File

@@ -0,0 +1,89 @@
/* $Id$ */
/* Copyright (C) 1998-99 Martin Baulig
This file is part of LibGTop 1.0.
Contributed by Martin Baulig <martin@home-of-linux.org>, March 1999.
LibGTop is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
LibGTop is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with LibGTop; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __GLIBTOP_PRIVATE_H__
#define __GLIBTOP_PRIVATE_H__
#include <glibtop.h>
#include <glibtop/error.h>
#include <sys/param.h>
#include <sys/sysctl.h>
#include <sys/user.h>
#undef LIBGTOP_VERSION
#include <linux/libgtop.h>
BEGIN_LIBGTOP_DECLS
int
glibtop_get_proc_data_stat_s (glibtop *server, libgtop_stat_t *stat);
int
glibtop_get_proc_data_mem_s (glibtop *server, libgtop_mem_t *mem);
int
glibtop_get_proc_data_swap_s (glibtop *server, libgtop_swap_t *swap);
int
glibtop_get_proc_data_proclist_s (glibtop *server,
libgtop_proclist_t *proclist,
u_int64_t which, u_int64_t arg);
int
glibtop_get_proc_data_proc_state_s (glibtop *server,
libgtop_proc_state_t *proc_state,
pid_t pid);
int
glibtop_get_proc_data_proc_mem_s (glibtop *server,
libgtop_proc_mem_t *proc_mem,
pid_t pid);
int
glibtop_get_proc_data_proc_signal_s (glibtop *server,
libgtop_proc_signal_t *proc_signal,
pid_t pid);
int
glibtop_get_proc_data_proc_kernel_s (glibtop *server,
libgtop_proc_kernel_t *proc_kernel,
pid_t pid);
int
glibtop_get_proc_data_proc_args_s (glibtop *server, pid_t pid,
char *result, size_t max_len);
int
glibtop_get_proc_data_proc_maps_s (glibtop *server, pid_t pid,
libgtop_proc_maps_t *result,
size_t max_len);
int
glibtop_get_proc_data_netload_s (glibtop *server,
libgtop_netload_t *netload,
const char *device);
END_LIBGTOP_DECLS
#endif __GLIBTOP_PRIVATE_H__

94
sysdeps/kernel/sysinfo.c Normal file
View File

@@ -0,0 +1,94 @@
/* $Id$ */
/* Copyright (C) 1998-99 Martin Baulig
This file is part of LibGTop 1.0.
Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
LibGTop is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
LibGTop is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with LibGTop; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <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, *start, *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 = strchr (buffer, ':');
if (!p) continue;
/* Remove leading spaces from `p'. */
*p = '\0'; start = p; p++;
while (isspace (*p)) p++;
/* Remove trailing spaces from `buffer'. */
while ((start > buffer) && (*start) && isspace (*start))
*start-- = '\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

@@ -26,14 +26,14 @@
#include <glibtop/cpu.h>
static const unsigned long _glibtop_sysdeps_cpu =
(1 << GLIBTOP_CPU_TOTAL) + (1 << GLIBTOP_CPU_USER) +
(1 << GLIBTOP_CPU_NICE) + (1 << GLIBTOP_CPU_SYS) +
(1 << GLIBTOP_CPU_IDLE) + (1 << GLIBTOP_CPU_FREQUENCY);
(1L << GLIBTOP_CPU_TOTAL) + (1L << GLIBTOP_CPU_USER) +
(1L << GLIBTOP_CPU_NICE) + (1L << GLIBTOP_CPU_SYS) +
(1L << GLIBTOP_CPU_IDLE) + (1L << 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);
(1L << GLIBTOP_XCPU_TOTAL) + (1L << GLIBTOP_XCPU_USER) +
(1L << GLIBTOP_XCPU_NICE) + (1L << GLIBTOP_XCPU_SYS) +
(1L << GLIBTOP_XCPU_IDLE);
/* Init function. */

View File

@@ -26,12 +26,12 @@
#include <glibtop/loadavg.h>
static const unsigned long _glibtop_sysdeps_loadavg =
(1 << GLIBTOP_LOADAVG_LOADAVG);
(1L << GLIBTOP_LOADAVG_LOADAVG);
static const unsigned long _glibtop_sysdeps_loadavg_tasks =
(1 << GLIBTOP_LOADAVG_NR_RUNNING) +
(1 << GLIBTOP_LOADAVG_NR_TASKS) +
(1 << GLIBTOP_LOADAVG_LAST_PID);
(1L << GLIBTOP_LOADAVG_NR_RUNNING) +
(1L << GLIBTOP_LOADAVG_NR_TASKS) +
(1L << GLIBTOP_LOADAVG_LAST_PID);
/* Init function. */

View File

@@ -26,10 +26,10 @@
#include <glibtop/mem.h>
static const unsigned long _glibtop_sysdeps_mem =
(1 << GLIBTOP_MEM_TOTAL) + (1 << GLIBTOP_MEM_USED) +
(1 << GLIBTOP_MEM_FREE) + (1 << GLIBTOP_MEM_SHARED) +
(1 << GLIBTOP_MEM_BUFFER) + (1 << GLIBTOP_MEM_CACHED) +
(1 << GLIBTOP_MEM_USER);
(1L << GLIBTOP_MEM_TOTAL) + (1L << GLIBTOP_MEM_USED) +
(1L << GLIBTOP_MEM_FREE) + (1L << GLIBTOP_MEM_SHARED) +
(1L << GLIBTOP_MEM_BUFFER) + (1L << GLIBTOP_MEM_CACHED) +
(1L << GLIBTOP_MEM_USER);
/* Init function. */

View File

@@ -27,10 +27,10 @@
#include <sys/msg.h>
static const unsigned long _glibtop_sysdeps_msg_limits =
(1 << GLIBTOP_IPC_MSGPOOL) + (1 << GLIBTOP_IPC_MSGMAP) +
(1 << GLIBTOP_IPC_MSGMAX) + (1 << GLIBTOP_IPC_MSGMNB) +
(1 << GLIBTOP_IPC_MSGMNI) + (1 << GLIBTOP_IPC_MSGSSZ) +
(1 << GLIBTOP_IPC_MSGTQL);
(1L << GLIBTOP_IPC_MSGPOOL) + (1L << GLIBTOP_IPC_MSGMAP) +
(1L << GLIBTOP_IPC_MSGMAX) + (1L << GLIBTOP_IPC_MSGMNB) +
(1L << GLIBTOP_IPC_MSGMNI) + (1L << GLIBTOP_IPC_MSGSSZ) +
(1L << GLIBTOP_IPC_MSGTQL);
/* Init function. */

View File

@@ -51,40 +51,40 @@
#define _GLIBTOP_IP_FW_ACCTOUT 0x2000 /* Account outgoing packets only. */
static const unsigned long _glibtop_sysdeps_netload =
(1 << GLIBTOP_NETLOAD_ERRORS_IN) +
(1 << GLIBTOP_NETLOAD_ERRORS_OUT) +
(1 << GLIBTOP_NETLOAD_COLLISIONS);
(1L << GLIBTOP_NETLOAD_ERRORS_IN) +
(1L << GLIBTOP_NETLOAD_ERRORS_OUT) +
(1L << GLIBTOP_NETLOAD_COLLISIONS);
static const unsigned long _glibtop_sysdeps_netload_data =
(1 << GLIBTOP_NETLOAD_ADDRESS) +
(1 << GLIBTOP_NETLOAD_SUBNET) +
(1 << GLIBTOP_NETLOAD_MTU);
(1L << GLIBTOP_NETLOAD_ADDRESS) +
(1L << GLIBTOP_NETLOAD_SUBNET) +
(1L << GLIBTOP_NETLOAD_MTU);
static const unsigned long _glibtop_sysdeps_netload_bytes =
(1 << GLIBTOP_NETLOAD_BYTES_IN) +
(1 << GLIBTOP_NETLOAD_BYTES_OUT) +
(1 << GLIBTOP_NETLOAD_BYTES_TOTAL);
(1L << GLIBTOP_NETLOAD_BYTES_IN) +
(1L << GLIBTOP_NETLOAD_BYTES_OUT) +
(1L << GLIBTOP_NETLOAD_BYTES_TOTAL);
static const unsigned long _glibtop_sysdeps_netload_packets =
(1 << GLIBTOP_NETLOAD_PACKETS_IN) +
(1 << GLIBTOP_NETLOAD_PACKETS_OUT) +
(1 << GLIBTOP_NETLOAD_PACKETS_TOTAL);
(1L << GLIBTOP_NETLOAD_PACKETS_IN) +
(1L << GLIBTOP_NETLOAD_PACKETS_OUT) +
(1L << GLIBTOP_NETLOAD_PACKETS_TOTAL);
static const unsigned long _glibtop_sysdeps_netload_total =
(1 << GLIBTOP_NETLOAD_PACKETS_TOTAL) +
(1 << GLIBTOP_NETLOAD_BYTES_TOTAL);
(1L << GLIBTOP_NETLOAD_PACKETS_TOTAL) +
(1L << GLIBTOP_NETLOAD_BYTES_TOTAL);
static const unsigned long _glibtop_sysdeps_netload_in =
(1 << GLIBTOP_NETLOAD_PACKETS_TOTAL) +
(1 << GLIBTOP_NETLOAD_BYTES_TOTAL) +
(1 << GLIBTOP_NETLOAD_PACKETS_IN) +
(1 << GLIBTOP_NETLOAD_BYTES_IN);
(1L << GLIBTOP_NETLOAD_PACKETS_TOTAL) +
(1L << GLIBTOP_NETLOAD_BYTES_TOTAL) +
(1L << GLIBTOP_NETLOAD_PACKETS_IN) +
(1L << GLIBTOP_NETLOAD_BYTES_IN);
static const unsigned long _glibtop_sysdeps_netload_out =
(1 << GLIBTOP_NETLOAD_PACKETS_TOTAL) +
(1 << GLIBTOP_NETLOAD_BYTES_TOTAL) +
(1 << GLIBTOP_NETLOAD_PACKETS_OUT) +
(1 << GLIBTOP_NETLOAD_BYTES_OUT);
(1L << GLIBTOP_NETLOAD_PACKETS_TOTAL) +
(1L << GLIBTOP_NETLOAD_BYTES_TOTAL) +
(1L << GLIBTOP_NETLOAD_PACKETS_OUT) +
(1L << GLIBTOP_NETLOAD_BYTES_OUT);
/* Init function. */
@@ -118,47 +118,47 @@ glibtop_get_netload_s (glibtop *server, glibtop_netload *buf,
strcpy (ifr.ifr_name, interface);
if (!ioctl (skfd, SIOCGIFFLAGS, &ifr)) {
buf->flags |= (1 << GLIBTOP_NETLOAD_IF_FLAGS);
buf->flags |= (1L << GLIBTOP_NETLOAD_IF_FLAGS);
flags = ifr.ifr_flags;
} else
flags = 0;
if (flags & IFF_UP)
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_UP);
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_UP);
if (flags & IFF_BROADCAST)
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_BROADCAST);
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_BROADCAST);
if (flags & IFF_DEBUG)
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_DEBUG);
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_DEBUG);
if (flags & IFF_LOOPBACK)
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_LOOPBACK);
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_LOOPBACK);
if (flags & IFF_POINTOPOINT)
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_POINTOPOINT);
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_POINTOPOINT);
if (flags & IFF_RUNNING)
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_RUNNING);
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_RUNNING);
if (flags & IFF_NOARP)
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_NOARP);
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_NOARP);
if (flags & IFF_PROMISC)
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_PROMISC);
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_PROMISC);
if (flags & IFF_ALLMULTI)
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_ALLMULTI);
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_ALLMULTI);
if (flags & IFF_MULTICAST)
buf->if_flags |= (1 << GLIBTOP_IF_FLAGS_MULTICAST);
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_MULTICAST);
strcpy (ifr.ifr_name, interface);
if (!ioctl (skfd, SIOCGIFADDR, &ifr)) {
struct sockaddr_in addr =
*(struct sockaddr_in *) &ifr.ifr_addr;
buf->address = addr.sin_addr.s_addr;
buf->flags |= (1 << GLIBTOP_NETLOAD_ADDRESS);
buf->flags |= (1L << GLIBTOP_NETLOAD_ADDRESS);
}
strcpy (ifr.ifr_name, interface);
@@ -166,13 +166,13 @@ glibtop_get_netload_s (glibtop *server, glibtop_netload *buf,
struct sockaddr_in addr =
*(struct sockaddr_in *) &ifr.ifr_addr;
buf->subnet = addr.sin_addr.s_addr;
buf->flags |= (1 << GLIBTOP_NETLOAD_SUBNET);
buf->flags |= (1L << GLIBTOP_NETLOAD_SUBNET);
}
strcpy (ifr.ifr_name, interface);
if (!ioctl (skfd, SIOCGIFMTU, &ifr)) {
buf->mtu = ifr.ifr_mtu;
buf->flags |= (1 << GLIBTOP_NETLOAD_MTU);
buf->flags |= (1L << GLIBTOP_NETLOAD_MTU);
}
close (skfd);

View File

@@ -34,8 +34,8 @@
#include <glib.h>
static const unsigned long _glibtop_sysdeps_ppp =
(1 << GLIBTOP_PPP_STATE) + (1 << GLIBTOP_PPP_BYTES_IN) +
(1 << GLIBTOP_PPP_BYTES_OUT);
(1L << GLIBTOP_PPP_STATE) + (1L << GLIBTOP_PPP_BYTES_IN) +
(1L << GLIBTOP_PPP_BYTES_OUT);
/* Init function. */
@@ -187,13 +187,13 @@ glibtop_get_ppp_s (glibtop *server, glibtop_ppp *buf, unsigned short device)
if (is_ISDN_on (server, &online)) {
buf->state = online ? GLIBTOP_PPP_STATE_ONLINE :
GLIBTOP_PPP_STATE_HANGUP;
buf->flags |= (1 << GLIBTOP_PPP_STATE);
buf->flags |= (1L << GLIBTOP_PPP_STATE);
}
if (get_ISDN_stats (server, &in, &out)) {
buf->bytes_in = in;
buf->bytes_out = out;
buf->flags |= (1 << GLIBTOP_PPP_BYTES_IN) |
(1 << GLIBTOP_PPP_BYTES_OUT);
buf->flags |= (1L << GLIBTOP_PPP_BYTES_IN) |
(1L << GLIBTOP_PPP_BYTES_OUT);
}
}

View File

@@ -27,7 +27,7 @@
#include <glibtop/procargs.h>
static const unsigned long _glibtop_sysdeps_proc_args =
(1 << GLIBTOP_PROC_ARGS_SIZE);
(1L << GLIBTOP_PROC_ARGS_SIZE);
/* Init function. */

View File

@@ -26,10 +26,10 @@
#include <glibtop/prockernel.h>
static const unsigned long _glibtop_sysdeps_proc_kernel =
(1 << GLIBTOP_PROC_KERNEL_K_FLAGS) + (1 << GLIBTOP_PROC_KERNEL_MIN_FLT) +
(1 << GLIBTOP_PROC_KERNEL_MAJ_FLT) + (1 << GLIBTOP_PROC_KERNEL_CMIN_FLT) +
(1 << GLIBTOP_PROC_KERNEL_CMAJ_FLT) + (1 << GLIBTOP_PROC_KERNEL_KSTK_ESP) +
(1 << GLIBTOP_PROC_KERNEL_KSTK_EIP) + (1 << GLIBTOP_PROC_KERNEL_WCHAN);
(1L << GLIBTOP_PROC_KERNEL_K_FLAGS) + (1L << GLIBTOP_PROC_KERNEL_MIN_FLT) +
(1L << GLIBTOP_PROC_KERNEL_MAJ_FLT) + (1L << GLIBTOP_PROC_KERNEL_CMIN_FLT) +
(1L << GLIBTOP_PROC_KERNEL_CMAJ_FLT) + (1L << GLIBTOP_PROC_KERNEL_KSTK_ESP) +
(1L << GLIBTOP_PROC_KERNEL_KSTK_EIP) + (1L << GLIBTOP_PROC_KERNEL_WCHAN);
/* Init function. */

View File

@@ -34,8 +34,8 @@
#include <ctype.h>
static const unsigned long _glibtop_sysdeps_proclist =
(1 << GLIBTOP_PROCLIST_TOTAL) + (1 << GLIBTOP_PROCLIST_NUMBER) +
(1 << GLIBTOP_PROCLIST_SIZE);
(1L << GLIBTOP_PROCLIST_TOTAL) + (1L << GLIBTOP_PROCLIST_NUMBER) +
(1L << GLIBTOP_PROCLIST_SIZE);
/* Init function. */
@@ -122,28 +122,28 @@ glibtop_get_proclist_s (glibtop *server, glibtop_proclist *buf,
case GLIBTOP_KERN_PROC_PGRP:
/* Do you really, really need this ? */
glibtop_get_proc_uid_s (server, &procuid, pid);
if (procuid.flags & (1 << GLIBTOP_PROC_UID_PGRP))
if (procuid.flags & (1L << GLIBTOP_PROC_UID_PGRP))
if ((int) arg != procuid.pgrp)
continue;
break;
case GLIBTOP_KERN_PROC_SESSION:
/* Do you really, really need this ? */
glibtop_get_proc_uid_s (server, &procuid, pid);
if (procuid.flags & (1 << GLIBTOP_PROC_UID_SESSION))
if (procuid.flags & (1L << GLIBTOP_PROC_UID_SESSION))
if ((int) arg != procuid.session)
continue;
break;
case GLIBTOP_KERN_PROC_TTY:
/* Do you really, really need this ? */
glibtop_get_proc_uid_s (server, &procuid, pid);
if (procuid.flags & (1 << GLIBTOP_PROC_UID_TTY))
if (procuid.flags & (1L << GLIBTOP_PROC_UID_TTY))
if ((int) arg != procuid.tty)
continue;
break;
case GLIBTOP_KERN_PROC_RUID:
/* Do you really, really need this ? */
glibtop_get_proc_uid_s (server, &procuid, pid);
if (procuid.flags & (1 << GLIBTOP_PROC_UID_EUID))
if (procuid.flags & (1L << GLIBTOP_PROC_UID_EUID))
if ((int) arg != procuid.euid)
continue;
break;
@@ -151,19 +151,19 @@ glibtop_get_proclist_s (glibtop *server, glibtop_proclist *buf,
if (which & GLIBTOP_EXCLUDE_NOTTY) {
glibtop_get_proc_uid_s (server, &procuid, pid);
if (procuid.flags & (1 << GLIBTOP_PROC_UID_TTY))
if (procuid.flags & (1L << GLIBTOP_PROC_UID_TTY))
if (procuid.tty == -1) continue;
}
if (which & GLIBTOP_EXCLUDE_IDLE) {
glibtop_get_proc_state_s (server, &procstate, pid);
if (procstate.flags & (1 << GLIBTOP_PROC_STATE_STATE))
if (procstate.flags & (1L << GLIBTOP_PROC_STATE_STATE))
if (procstate.state != 'R') continue;
}
if (which & GLIBTOP_EXCLUDE_SYSTEM) {
glibtop_get_proc_uid_s (server, &procuid, pid);
if (procuid.flags & (1 << GLIBTOP_PROC_UID_UID))
if (procuid.flags & (1L << GLIBTOP_PROC_UID_UID))
if (procuid.uid == 0) continue;
}

View File

@@ -27,14 +27,14 @@
#include <glibtop/procmap.h>
static const unsigned long _glibtop_sysdeps_proc_map =
(1 << GLIBTOP_PROC_MAP_NUMBER) + (1 << GLIBTOP_PROC_MAP_TOTAL) +
(1 << GLIBTOP_PROC_MAP_SIZE);
(1L << GLIBTOP_PROC_MAP_NUMBER) + (1L << GLIBTOP_PROC_MAP_TOTAL) +
(1L << GLIBTOP_PROC_MAP_SIZE);
static const unsigned long _glibtop_sysdeps_map_entry =
(1 << GLIBTOP_MAP_ENTRY_START) + (1 << GLIBTOP_MAP_ENTRY_END) +
(1 << GLIBTOP_MAP_ENTRY_OFFSET) + (1 << GLIBTOP_MAP_ENTRY_PERM) +
(1 << GLIBTOP_MAP_ENTRY_INODE) + (1 << GLIBTOP_MAP_ENTRY_DEVICE) +
(1 << GLIBTOP_MAP_ENTRY_FILENAME);
(1L << GLIBTOP_MAP_ENTRY_START) + (1L << GLIBTOP_MAP_ENTRY_END) +
(1L << GLIBTOP_MAP_ENTRY_OFFSET) + (1L << GLIBTOP_MAP_ENTRY_PERM) +
(1L << GLIBTOP_MAP_ENTRY_INODE) + (1L << GLIBTOP_MAP_ENTRY_DEVICE) +
(1L << GLIBTOP_MAP_ENTRY_FILENAME);
/* Init function. */
@@ -66,11 +66,15 @@ glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid)
do {
short dev_major, dev_minor;
unsigned long start, end, offset, inode, perm;
char flags [5];
char flags [5], *format;
size_t size;
rv = fscanf (maps,
"%08lx-%08lx %4c\n %08lx %02hx:%02hx %ld",
if (sizeof (void*) == 8)
format = "%16lx-%16lx %4c\n %16lx %02hx:%02hx %ld";
else
format = "%08lx-%08lx %4c\n %08lx %02hx:%02hx %ld";
rv = fscanf (maps, format,
&start, &end, flags, &offset,
&dev_major, &dev_minor, &inode);

View File

@@ -26,12 +26,12 @@
#include <glibtop/procmem.h>
static const unsigned long _glibtop_sysdeps_proc_mem =
(1 << GLIBTOP_PROC_MEM_VSIZE) + (1 << GLIBTOP_PROC_MEM_RSS) +
(1 << GLIBTOP_PROC_MEM_RSS_RLIM);
(1L << GLIBTOP_PROC_MEM_VSIZE) + (1L << GLIBTOP_PROC_MEM_RSS) +
(1L << GLIBTOP_PROC_MEM_RSS_RLIM);
static const unsigned long _glibtop_sysdeps_proc_mem_statm =
(1 << GLIBTOP_PROC_MEM_SIZE) + (1 << GLIBTOP_PROC_MEM_RESIDENT) +
(1 << GLIBTOP_PROC_MEM_SHARE);
(1L << GLIBTOP_PROC_MEM_SIZE) + (1L << GLIBTOP_PROC_MEM_RESIDENT) +
(1L << GLIBTOP_PROC_MEM_SHARE);
#ifndef LOG1024
#define LOG1024 10

View File

@@ -26,16 +26,16 @@
#include <glibtop/procsegment.h>
static const unsigned long _glibtop_sysdeps_proc_segment =
(1 << GLIBTOP_PROC_SEGMENT_START_CODE) +
(1 << GLIBTOP_PROC_SEGMENT_END_CODE) +
(1 << GLIBTOP_PROC_SEGMENT_START_STACK);
(1L << GLIBTOP_PROC_SEGMENT_START_CODE) +
(1L << GLIBTOP_PROC_SEGMENT_END_CODE) +
(1L << GLIBTOP_PROC_SEGMENT_START_STACK);
static const unsigned long _glibtop_sysdeps_proc_segment_statm =
(1 << GLIBTOP_PROC_SEGMENT_TEXT_RSS) +
(1L << GLIBTOP_PROC_SEGMENT_TEXT_RSS) +
/* Disabled due to bug in the Linux Kernel. */
/* (1 << GLIBTOP_PROC_SEGMENT_SHLIB_RSS) + */
(1 << GLIBTOP_PROC_SEGMENT_DATA_RSS) +
(1 << GLIBTOP_PROC_SEGMENT_DIRTY_SIZE);
/* (1L << GLIBTOP_PROC_SEGMENT_SHLIB_RSS) + */
(1L << GLIBTOP_PROC_SEGMENT_DATA_RSS) +
(1L << GLIBTOP_PROC_SEGMENT_DIRTY_SIZE);
#ifndef LOG1024
#define LOG1024 10

View File

@@ -26,8 +26,8 @@
#include <glibtop/procsignal.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);
(1L << GLIBTOP_PROC_SIGNAL_SIGNAL) + (1L << GLIBTOP_PROC_SIGNAL_BLOCKED) +
(1L << GLIBTOP_PROC_SIGNAL_SIGIGNORE) + (1L << GLIBTOP_PROC_SIGNAL_SIGCATCH);
/* Init function. */

View File

@@ -28,10 +28,10 @@
#include <sys/stat.h>
static const unsigned long _glibtop_sysdeps_proc_state =
(1 << GLIBTOP_PROC_STATE_CMD) + (1 << GLIBTOP_PROC_STATE_STATE);
(1L << GLIBTOP_PROC_STATE_CMD) + (1L << GLIBTOP_PROC_STATE_STATE);
static const unsigned long _glibtop_sysdeps_proc_state_uid =
(1 << GLIBTOP_PROC_STATE_UID) + (1 << GLIBTOP_PROC_STATE_GID);
(1L << GLIBTOP_PROC_STATE_UID) + (1L << GLIBTOP_PROC_STATE_GID);
/* Init function. */

View File

@@ -26,14 +26,14 @@
#include <glibtop/proctime.h>
static const unsigned long _glibtop_sysdeps_proc_time =
(1 << GLIBTOP_PROC_TIME_UTIME) + (1 << GLIBTOP_PROC_TIME_CUTIME) +
(1 << GLIBTOP_PROC_TIME_STIME) + (1 << GLIBTOP_PROC_TIME_CSTIME) +
(1 << GLIBTOP_PROC_TIME_RTIME) + (1 << GLIBTOP_PROC_TIME_FREQUENCY) +
(1 << GLIBTOP_PROC_TIME_TIMEOUT) + (1 << GLIBTOP_PROC_TIME_IT_REAL_VALUE) +
(1 << GLIBTOP_PROC_TIME_START_TIME);
(1L << GLIBTOP_PROC_TIME_UTIME) + (1L << GLIBTOP_PROC_TIME_CUTIME) +
(1L << GLIBTOP_PROC_TIME_STIME) + (1L << GLIBTOP_PROC_TIME_CSTIME) +
(1L << GLIBTOP_PROC_TIME_RTIME) + (1L << GLIBTOP_PROC_TIME_FREQUENCY) +
(1L << GLIBTOP_PROC_TIME_TIMEOUT) + (1L << GLIBTOP_PROC_TIME_IT_REAL_VALUE) +
(1L << 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);
(1L << GLIBTOP_PROC_TIME_XCPU_UTIME) + (1L << GLIBTOP_PROC_TIME_XCPU_STIME);
/* Init function. */

View File

@@ -26,14 +26,14 @@
#include <glibtop/procuid.h>
static const unsigned long _glibtop_sysdeps_proc_uid =
(1 << GLIBTOP_PROC_UID_UID) + (1 << GLIBTOP_PROC_UID_EUID) +
(1 << GLIBTOP_PROC_UID_GID) + (1 << GLIBTOP_PROC_UID_EGID);
(1L << GLIBTOP_PROC_UID_UID) + (1L << GLIBTOP_PROC_UID_EUID) +
(1L << GLIBTOP_PROC_UID_GID) + (1L << GLIBTOP_PROC_UID_EGID);
static const unsigned long _glibtop_sysdeps_proc_uid_stat =
(1 << GLIBTOP_PROC_UID_PID) + (1 << GLIBTOP_PROC_UID_PPID) +
(1 << GLIBTOP_PROC_UID_PGRP) + (1 << GLIBTOP_PROC_UID_SESSION) +
(1 << GLIBTOP_PROC_UID_TTY) + (1 << GLIBTOP_PROC_UID_TPGID) +
(1 << GLIBTOP_PROC_UID_PRIORITY) + (1 << GLIBTOP_PROC_UID_NICE);
(1L << GLIBTOP_PROC_UID_PID) + (1L << GLIBTOP_PROC_UID_PPID) +
(1L << GLIBTOP_PROC_UID_PGRP) + (1L << GLIBTOP_PROC_UID_SESSION) +
(1L << GLIBTOP_PROC_UID_TTY) + (1L << GLIBTOP_PROC_UID_TPGID) +
(1L << GLIBTOP_PROC_UID_PRIORITY) + (1L << GLIBTOP_PROC_UID_NICE);
#define LINUX_VERSION(x,y,z) (0x10000*(x) + 0x100*(y) + z)

View File

@@ -42,11 +42,11 @@ union semun
#endif
static unsigned long _glibtop_sysdeps_sem_limits =
(1 << GLIBTOP_IPC_SEMMAP) + (1 << GLIBTOP_IPC_SEMMNI) +
(1 << GLIBTOP_IPC_SEMMNS) + (1 << GLIBTOP_IPC_SEMMNU) +
(1 << GLIBTOP_IPC_SEMMSL) + (1 << GLIBTOP_IPC_SEMOPM) +
(1 << GLIBTOP_IPC_SEMUME) + (1 << GLIBTOP_IPC_SEMUSZ) +
(1 << GLIBTOP_IPC_SEMVMX) + (1 << GLIBTOP_IPC_SEMAEM);
(1L << GLIBTOP_IPC_SEMMAP) + (1L << GLIBTOP_IPC_SEMMNI) +
(1L << GLIBTOP_IPC_SEMMNS) + (1L << GLIBTOP_IPC_SEMMNU) +
(1L << GLIBTOP_IPC_SEMMSL) + (1L << GLIBTOP_IPC_SEMOPM) +
(1L << GLIBTOP_IPC_SEMUME) + (1L << GLIBTOP_IPC_SEMUSZ) +
(1L << GLIBTOP_IPC_SEMVMX) + (1L << GLIBTOP_IPC_SEMAEM);
/* Init function. */

View File

@@ -27,9 +27,9 @@
#include <sys/shm.h>
static unsigned long _glibtop_sysdeps_shm_limits =
(1 << GLIBTOP_IPC_SHMMAX) + (1 << GLIBTOP_IPC_SHMMIN) +
(1 << GLIBTOP_IPC_SHMMNI) + (1 << GLIBTOP_IPC_SHMSEG) +
(1 << GLIBTOP_IPC_SHMALL);
(1L << GLIBTOP_IPC_SHMMAX) + (1L << GLIBTOP_IPC_SHMMIN) +
(1L << GLIBTOP_IPC_SHMMNI) + (1L << GLIBTOP_IPC_SHMSEG) +
(1L << GLIBTOP_IPC_SHMALL);
/* Init function. */

View File

@@ -28,11 +28,11 @@
#include <fcntl.h>
static unsigned long _glibtop_sysdeps_swap =
(1 << GLIBTOP_SWAP_TOTAL) + (1 << GLIBTOP_SWAP_USED) +
(1 << GLIBTOP_SWAP_FREE);
(1L << GLIBTOP_SWAP_TOTAL) + (1L << GLIBTOP_SWAP_USED) +
(1L << GLIBTOP_SWAP_FREE);
static unsigned long _glibtop_sysdeps_swap_paging =
(1 << GLIBTOP_SWAP_PAGEIN) + (1 << GLIBTOP_SWAP_PAGEOUT);
(1L << GLIBTOP_SWAP_PAGEIN) + (1L << GLIBTOP_SWAP_PAGEOUT);
/* Init function. */

View File

@@ -26,7 +26,7 @@
#include <glibtop/sysinfo.h>
static const unsigned long _glibtop_sysdeps_sysinfo =
(1 << GLIBTOP_SYSINFO_CPUINFO);
(1L << GLIBTOP_SYSINFO_CPUINFO);
static glibtop_sysinfo sysinfo;
@@ -65,10 +65,12 @@ init_sysinfo (glibtop *server)
p = strchr (buffer, ':');
if (!p) continue;
/* Remove leading spaces from `p'. */
*p = '\0'; start = p; p++;
while (isspace (*p)) p++;
while ((start > buffer) && isspace (*start))
/* Remove trailing spaces from `buffer'. */
while ((start > buffer) && (*start) && isspace (*start))
*start-- = '\0';
key = g_strdup (buffer);

View File

@@ -26,7 +26,7 @@
#include <glibtop/uptime.h>
static unsigned long _glibtop_sysdeps_uptime =
(1 << GLIBTOP_UPTIME_UPTIME) + (1 << GLIBTOP_UPTIME_IDLETIME);
(1L << GLIBTOP_UPTIME_UPTIME) + (1L << GLIBTOP_UPTIME_IDLETIME);
/* Init function. */

View File

@@ -1,3 +1,8 @@
1999-05-11 Martin Baulig <martin@home-of-linux.org>
* procstate.c: Fixed implementation of the `state' field; added
`ruid' and `rgid' fields.
1999-02-19 Martin Baulig <martin@home-of-linux.org>
* procmap.c, procargs.c, netload.c: Copied from stub_suid.

View File

@@ -26,9 +26,9 @@
#include <glibtop/cpu.h>
static const unsigned long _glibtop_sysdeps_cpu =
(1 << GLIBTOP_CPU_TOTAL) + (1 << GLIBTOP_CPU_USER) +
(1 << GLIBTOP_CPU_NICE) + (1 << GLIBTOP_CPU_SYS) +
(1 << GLIBTOP_CPU_IDLE) + (1 << GLIBTOP_CPU_FREQUENCY);
(1L << GLIBTOP_CPU_TOTAL) + (1L << GLIBTOP_CPU_USER) +
(1L << GLIBTOP_CPU_NICE) + (1L << GLIBTOP_CPU_SYS) +
(1L << GLIBTOP_CPU_IDLE) + (1L << GLIBTOP_CPU_FREQUENCY);
/* Init function. */

View File

@@ -26,7 +26,7 @@
#include <glibtop/loadavg.h>
static const unsigned long _glibtop_sysdeps_loadavg =
(1 << GLIBTOP_LOADAVG_LOADAVG);
(1L << GLIBTOP_LOADAVG_LOADAVG);
/* Init function. */

View File

@@ -32,8 +32,8 @@
#include <mach/vm_statistics.h>
static const unsigned long _glibtop_sysdeps_mem =
(1 << GLIBTOP_MEM_TOTAL) + (1 << GLIBTOP_MEM_USED) +
(1 << GLIBTOP_MEM_FREE);
(1L << GLIBTOP_MEM_TOTAL) + (1L << GLIBTOP_MEM_USED) +
(1L << GLIBTOP_MEM_FREE);
/* Init function. */

View File

@@ -26,9 +26,9 @@
#include <glibtop/msg_limits.h>
static const unsigned long _glibtop_sysdeps_msg_limits =
(1 << GLIBTOP_IPC_MSGMAP) + (1 << GLIBTOP_IPC_MSGMAX) +
(1 << GLIBTOP_IPC_MSGMNB) + (1 << GLIBTOP_IPC_MSGMNI) +
(1 << GLIBTOP_IPC_MSGTQL);
(1L << GLIBTOP_IPC_MSGMAP) + (1L << GLIBTOP_IPC_MSGMAX) +
(1L << GLIBTOP_IPC_MSGMNB) + (1L << GLIBTOP_IPC_MSGMNI) +
(1L << GLIBTOP_IPC_MSGTQL);
/* Init function. */
@@ -54,7 +54,7 @@ glibtop_get_msg_limits_s (glibtop *server, glibtop_msg_limits *buf)
if (ret != 1) return;
buf->flags += (1 << GLIBTOP_IPC_MSGMAX);
buf->flags += (1L << GLIBTOP_IPC_MSGMAX);
buf->msgmax = value;
@@ -63,7 +63,7 @@ glibtop_get_msg_limits_s (glibtop *server, glibtop_msg_limits *buf)
if (ret != 1) return;
buf->flags += (1 << GLIBTOP_IPC_MSGMNB);
buf->flags += (1L << GLIBTOP_IPC_MSGMNB);
buf->msgmnb = value;
@@ -72,7 +72,7 @@ glibtop_get_msg_limits_s (glibtop *server, glibtop_msg_limits *buf)
if (ret != 1) return;
buf->flags += (1 << GLIBTOP_IPC_MSGMNI);
buf->flags += (1L << GLIBTOP_IPC_MSGMNI);
buf->msgmni = value;
@@ -81,7 +81,7 @@ glibtop_get_msg_limits_s (glibtop *server, glibtop_msg_limits *buf)
if (ret != 1) return;
buf->flags += (1 << GLIBTOP_IPC_MSGTQL);
buf->flags += (1L << GLIBTOP_IPC_MSGTQL);
buf->msgtql = value;
}

View File

@@ -34,7 +34,7 @@
/* Provides detailed information about a process. */
#define BIT_SHIFT(x) (1 << (x % 32))
#define BIT_SHIFT(x) (1L << (x % 64))
static const unsigned long _glibtop_sysdeps_procdata_0 =
BIT_SHIFT(GLIBTOP_PROCDATA_CMD) +

View File

@@ -29,8 +29,8 @@
#include <glibtop_suid.h>
static const unsigned long _glibtop_sysdeps_proclist =
(1 << GLIBTOP_PROCLIST_TOTAL) + (1 << GLIBTOP_PROCLIST_NUMBER) +
(1 << GLIBTOP_PROCLIST_SIZE);
(1L << GLIBTOP_PROCLIST_TOTAL) + (1L << GLIBTOP_PROCLIST_NUMBER) +
(1L << GLIBTOP_PROCLIST_SIZE);
/* Init function. */

View File

@@ -36,8 +36,8 @@
#include <mach/task_info.h>
static const unsigned long _glibtop_sysdeps_proc_mem =
(1 << GLIBTOP_PROC_MEM_VSIZE) + (1 << GLIBTOP_PROC_MEM_RESIDENT) +
(1 << GLIBTOP_PROC_MEM_RSS);
(1L << GLIBTOP_PROC_MEM_VSIZE) + (1L << GLIBTOP_PROC_MEM_RESIDENT) +
(1L << GLIBTOP_PROC_MEM_RSS);
/* Init function. */
@@ -98,6 +98,6 @@ glibtop_get_proc_mem_p (glibtop *server, glibtop_proc_mem *buf,
buf->share = u.u_ru.ru_ixrss;
buf->flags |= (1 << GLIBTOP_PROC_MEM_RSS_RLIM) |
(1 << GLIBTOP_PROC_MEM_SHARE);
buf->flags |= (1L << GLIBTOP_PROC_MEM_RSS_RLIM) |
(1L << GLIBTOP_PROC_MEM_SHARE);
}

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