Added some new features.

1999-03-30  Martin Baulig  <martin@home-of-linux.org>

	Added some new features.

	* (glibtop_uptime): Added `boot_time', boot time in seconds
	since the epoch.

	* (glibtop_proc_state): Changed `state' from char to unsigned.
	`uid' and `gid' are effective uid and gid; added comment.
	Added `ruid' and `rgid' for guaranteed-to-be-correct real uid/gid.
	For SMP systems: added `has_cpu', `processor' and `last_processor'.

	* (glibtop_proc_uid): Added suid, sgid, fsuid, fsgid, ngroups, groups.

	* (glibtop_proc_segment): Added start_data, end_data, start_brk,
	end_brk, start_mmap, arg_start, arg_end, env_start, env_end.

	* include/glibtop/procstate.h: Define some constants for the `state'
	field of glibtop_proc_state.

	* include/glibtop/prockernel.h: Define some constands for the
	`k_flags' field of glibtop_proc_kernel.
This commit is contained in:
Martin Baulig
1999-03-31 16:53:05 +00:00
committed by Martin Baulig
parent 3a7f02352a
commit ede4594dd9
15 changed files with 340 additions and 99 deletions

View File

@@ -1,3 +1,26 @@
1999-03-30 Martin Baulig <martin@home-of-linux.org>
Added some new features.
* (glibtop_uptime): Added `boot_time', boot time in seconds
since the epoch.
* (glibtop_proc_state): Changed `state' from char to unsigned.
`uid' and `gid' are effective uid and gid; added comment.
Added `ruid' and `rgid' for guaranteed-to-be-correct real uid/gid.
For SMP systems: added `has_cpu', `processor' and `last_processor'.
* (glibtop_proc_uid): Added suid, sgid, fsuid, fsgid, ngroups, groups.
* (glibtop_proc_segment): Added start_data, end_data, start_brk,
end_brk, start_mmap, arg_start, arg_end, env_start, env_end.
* include/glibtop/procstate.h: Define some constants for the `state'
field of glibtop_proc_state.
* include/glibtop/prockernel.h: Define some constands for the
`k_flags' field of glibtop_proc_kernel.
1999-03-24 Martin Baulig <martin@home-of-linux.org>
* configure.in: Check for getloadavg () and swapctl () for

View File

@@ -116,9 +116,10 @@ main (int argc, char *argv [])
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_uptime (&data.uptime);
printf ("Uptime (0x%08lx): %f, %f\n",
printf ("Uptime (0x%08lx): %f, %f, %lu\n",
(unsigned long) data.uptime.flags,
data.uptime.uptime, data.uptime.idletime);
data.uptime.uptime, data.uptime.idletime,
(unsigned long) data.uptime.boot_time);
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_loadavg (&data.loadavg);
@@ -242,24 +243,42 @@ main (int argc, char *argv [])
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_state (&data.proc_state, pid);
printf ("Proc_State PID %5d (0x%08lx): '%s', %c, %lu, %lu\n",
(int) pid, (unsigned long) data.proc_state.flags,
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,
(unsigned long) data.proc_state.uid,
(unsigned long) data.proc_state.gid);
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);
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_uid (&data.proc_uid, pid);
printf ("Proc_Uid PID %5d (0x%08lx): "
"%d %d %d %d %d %d %d %d %d %d %d %d\n", (int) pid,
(unsigned long) data.proc_uid.flags,
"%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.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");
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_mem (&data.proc_mem, pid);
@@ -278,7 +297,9 @@ main (int argc, char *argv [])
glibtop_get_proc_segment (&data.proc_segment, pid);
printf ("Proc_Segment PID %5d (0x%08lx): "
"%lu %lu %lu %lu %lu 0x%lx 0x%lx 0x%lx\n", (int) pid,
"%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,
@@ -287,7 +308,16 @@ main (int argc, char *argv [])
(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_stack);
(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);
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_time (&data.proc_time, pid);
@@ -357,24 +387,42 @@ main (int argc, char *argv [])
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_state (&data.proc_state, ppid);
printf ("Proc_State PPID %5d (0x%08lx): '%s', %c, %lu, %lu\n",
(int) ppid, (unsigned long) data.proc_state.flags,
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,
(unsigned long) data.proc_state.uid,
(unsigned long) data.proc_state.gid);
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);
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_uid (&data.proc_uid, ppid);
printf ("Proc_Uid PPID %5d (0x%08lx): "
"%d %d %d %d %d %d %d %d %d %d %d %d\n", (int) ppid,
(unsigned long) data.proc_uid.flags,
"%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.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");
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_mem (&data.proc_mem, ppid);
@@ -393,7 +441,9 @@ main (int argc, char *argv [])
glibtop_get_proc_segment (&data.proc_segment, ppid);
printf ("Proc_Segment PPID %5d (0x%08lx): "
"%lu %lu %lu %lu %lu 0x%lx 0x%lx 0x%lx\n", (int) ppid,
"%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,
@@ -402,7 +452,16 @@ main (int argc, char *argv [])
(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_stack);
(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);
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_time (&data.proc_time, ppid);
@@ -472,24 +531,42 @@ main (int argc, char *argv [])
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_state (&data.proc_state, 1);
printf ("Proc_State INIT %5d (0x%08lx): '%s', %c, %lu, %lu\n", 1,
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,
(unsigned long) data.proc_state.uid,
(unsigned long) data.proc_state.gid);
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);
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_uid (&data.proc_uid, 1);
printf ("Proc_Uid INIT %5d (0x%08lx): "
"%d %d %d %d %d %d %d %d %d %d %d %d\n", 1,
"%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.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");
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_mem (&data.proc_mem, 1);
@@ -508,7 +585,9 @@ main (int argc, char *argv [])
glibtop_get_proc_segment (&data.proc_segment, 1);
printf ("Proc_Segment INIT %5d (0x%08lx): "
"%lu %lu %lu %lu %lu 0x%lx 0x%lx 0x%lx\n", 1,
"%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,
@@ -517,7 +596,16 @@ main (int argc, char *argv [])
(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_stack);
(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);
for (c = 0; c < PROFILE_COUNT; c++)
glibtop_get_proc_time (&data.proc_time, 1);

View File

@@ -53,24 +53,41 @@ output (pid_t pid)
glibtop_get_proc_state (&data.proc_state, pid);
printf ("Proc_State PID %5d (0x%08lx): "
"'%s', %c, %lu, %lu\n", (int) pid,
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,
(unsigned long) data.proc_state.uid,
(unsigned long) data.proc_state.gid);
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);
glibtop_get_proc_uid (&data.proc_uid, pid);
printf ("Proc_Uid PID %5d (0x%08lx): "
"%d %d %d %d %d %d %d %d %d %d %d %d\n", (int) pid,
(unsigned long) data.proc_uid.flags,
"%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.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");
glibtop_get_proc_mem (&data.proc_mem, pid);
@@ -87,7 +104,9 @@ output (pid_t pid)
glibtop_get_proc_segment (&data.proc_segment, pid);
printf ("Proc_Segment PID %5d (0x%08lx): "
"%lu %lu %lu %lu %lu 0x%lx 0x%lx 0x%lx\n", (int) pid,
"%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,
@@ -96,7 +115,16 @@ output (pid_t pid)
(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_stack);
(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);
glibtop_get_proc_time (&data.proc_time, pid);

View File

@@ -1,19 +1,19 @@
void|cpu|ulong(total,user,nice,sys,idle,frequency,xcpu_total[4],xcpu_user[4],xcpu_nice[4],xcpu_sys[4],xcpu_idle[4])
void|mem|ulong(total,used,free,shared,buffer,cached,user,locked)
void|swap|ulong(total,used,free,pagein,pageout)
void|uptime|double(uptime,idletime)
void|uptime|double(uptime,idletime):ulong(boot_time)
void|loadavg|double(loadavg[3]):ulong(nr_running,nr_tasks,last_pid)
void|shm_limits|ulong(shmmax,shmmin,shmmni,shmseg,shmall)
void|msg_limits|ulong(msgpool,msgmap,msgmax,msgmnb,msgmni,msgssz,msgtql)
void|sem_limits|ulong(semmap,semmni,semmns,semmnu,semmsl,semopm,semume,semusz,semvmx,semaem)
unsigned *|proclist|ulong(number,size,total)|long(which,arg)
void|proc_state|str(cmd):char(state):ulong(uid,gid)|pid_t(pid)
void|proc_uid|long(uid,euid,gid,egid,pid,ppid,pgrp,session,tty,tpgid,priority,nice)|pid_t(pid)
void|proc_state|str(cmd):unsigned(state):ulong(uid,gid,ruid,rgid,has_cpu,processor,last_processor)|pid_t(pid)
void|proc_uid|long(uid,euid,gid,egid,suid,sgid,fsuid,fsgid,pid,ppid,pgrp,session,tty,tpgid,priority,nice,ngroups,groups[32])|pid_t(pid)
void|proc_mem|long(size,vsize,resident,share,rss,rss_rlim)|pid_t(pid)
void|proc_time|long(start_time,rtime,utime,stime,cutime,cstime,timeout,it_real_value,frequency,xcpu_utime[4],xcpu_stime[4])|pid_t(pid)
void|proc_signal|ulong(signal[2],blocked[2],sigignore[2],sigcatch[2])|pid_t(pid)
void|proc_kernel|ulong(k_flags,min_flt,maj_flt,cmin_flt,cmaj_flt,kstk_esp,kstk_eip,nwchan):str(wchan)|pid_t(pid)
void|proc_segment|ulong(text_rss,shlib_rss,data_rss,stack_rss,dirty_size,start_code,end_code,start_stack)|pid_t(pid)
void|proc_segment|ulong(text_rss,shlib_rss,data_rss,stack_rss,dirty_size,start_code,end_code,start_data,end_data,start_brk,end_brk,start_stack,start_mmap,arg_start,arg_end,env_start,env_end)|pid_t(pid)
char *|proc_args|ulong(size)|pid_t(pid):unsigned(max_len)
glibtop_map_entry *|proc_map|ulong(number,size,total)|pid_t(pid)
glibtop_mountentry *|@mountlist|ulong(number,size,total)|int(all_fs)

View File

@@ -43,6 +43,17 @@ BEGIN_LIBGTOP_DECLS
#define GLIBTOP_MAX_PROC_KERNEL 9
/* Constants for the `k_flags' field. */
#define GLIBTOP_KFLAGS_STARTING 1 /* being created */
#define GLIBTOP_KFLAGS_EXITING 2 /* getting shut down */
#define GLIBTOP_KFLAGS_PTRACED 4 /* set if ptrace (0) has
been called */
#define GLIBTOP_KFLAGS_TRACESYS 8 /* tracing system calls */
#define GLIBTOP_KFLAGS_FORKNOEXEC 16 /* forked but didn't exec */
#define GLIBTOP_KFLAGS_SUPERPRIV 32 /* used super-user privileges */
#define GLIBTOP_KFLAGS_DUMPEDCORE 64 /* dumped core */
#define GLIBTOP_KFLAGS_SIGNALED 128 /* killed by a signal */
typedef struct _glibtop_proc_kernel glibtop_proc_kernel;
/* Kernel stuff */

View File

@@ -38,9 +38,18 @@ BEGIN_LIBGTOP_DECLS
#define GLIBTOP_PROC_SEGMENT_DIRTY_SIZE 4
#define GLIBTOP_PROC_SEGMENT_START_CODE 5
#define GLIBTOP_PROC_SEGMENT_END_CODE 6
#define GLIBTOP_PROC_SEGMENT_START_STACK 7
#define GLIBTOP_PROC_SEGMENT_START_DATA 7
#define GLIBTOP_PROC_SEGMENT_END_DATA 8
#define GLIBTOP_PROC_SEGMENT_START_BRK 9
#define GLIBTOP_PROC_SEGMENT_END_BRK 10
#define GLIBTOP_PROC_SEGMENT_START_STACK 11
#define GLIBTOP_PROC_SEGMENT_START_MMAP 12
#define GLIBTOP_PROC_SEGMENT_ARG_START 13
#define GLIBTOP_PROC_SEGMENT_ARG_END 14
#define GLIBTOP_PROC_SEGMENT_ENV_START 15
#define GLIBTOP_PROC_SEGMENT_ENV_END 16
#define GLIBTOP_MAX_PROC_SEGMENT 8
#define GLIBTOP_MAX_PROC_SEGMENT 17
typedef struct _glibtop_proc_segment glibtop_proc_segment;
@@ -54,10 +63,18 @@ struct _glibtop_proc_segment
data_rss, /* data resident set size */
stack_rss, /* stack resident set size */
dirty_size, /* size of dirty pages */
start_code,
/* address of beginning of code segment */
start_code, /* address of beginning of code segment */
end_code, /* address of end of code segment */
start_stack; /* address of the bottom of stack segment */
start_data, /* address of beginning of data segment */
end_data, /* address of end of data segment */
start_brk,
end_brk,
start_stack, /* address of the bottom of stack segment */
start_mmap,
arg_start,
arg_end,
env_start,
env_end;
};
#define glibtop_get_proc_segment(p1, p2) glibtop_get_proc_segment_l(glibtop_global_server, p1, p2)

View File

@@ -35,8 +35,21 @@ BEGIN_LIBGTOP_DECLS
#define GLIBTOP_PROC_STATE_STATE 1
#define GLIBTOP_PROC_STATE_UID 2
#define GLIBTOP_PROC_STATE_GID 3
#define GLIBTOP_PROC_STATE_RUID 4
#define GLIBTOP_PROC_STATE_RGID 5
#define GLIBTOP_PROC_STATE_HAS_CPU 6
#define GLIBTOP_PROC_STATE_PROCESSOR 7
#define GLIBTOP_PROC_STATE_LAST_PROCESSOR 8
#define GLIBTOP_MAX_PROC_STATE 4
#define GLIBTOP_MAX_PROC_STATE 9
/* Constants for the `state' field. */
#define GLIBTOP_PROCESS_RUNNING 0
#define GLIBTOP_PROCESS_INTERRUPTIBLE 1
#define GLIBTOP_PROCESS_UNINTERRUPTIBLE 2
#define GLIBTOP_PROCESS_ZOMBIE 4
#define GLIBTOP_PROCESS_STOPPED 8
#define GLIBTOP_PROCESS_SWAPPING 16
typedef struct _glibtop_proc_state glibtop_proc_state;
@@ -45,17 +58,23 @@ typedef struct _glibtop_proc_state glibtop_proc_state;
struct _glibtop_proc_state
{
u_int64_t flags;
char cmd[40], /* basename of executable file in
char cmd[40]; /* basename of executable file in
* call to exec(2) */
state; /* single-char code for process state
* (S=sleeping) */
unsigned state; /* process state */
/* NOTE: when porting the library, TRY HARD to implement the
* following two fields. */
/* IMPORTANT NOTICE: For security reasons, it is extremely important
* only to set the flags value for those two
* fields if their values are corrent ! */
int uid, /* UID of process */
gid; /* GID of process */
int uid, /* effective UID of process */
gid, /* effective GID of process */
ruid, /* real UID of process */
rgid; /* real GID of process */
/* SMP values. */
int has_cpu,
processor,
last_processor;
};
#define glibtop_get_proc_state(p1, p2) glibtop_get_proc_state_l(glibtop_global_server, p1, p2)

View File

@@ -35,16 +35,24 @@ BEGIN_LIBGTOP_DECLS
#define GLIBTOP_PROC_UID_EUID 1
#define GLIBTOP_PROC_UID_GID 2
#define GLIBTOP_PROC_UID_EGID 3
#define GLIBTOP_PROC_UID_PID 4
#define GLIBTOP_PROC_UID_PPID 5
#define GLIBTOP_PROC_UID_PGRP 6
#define GLIBTOP_PROC_UID_SESSION 7
#define GLIBTOP_PROC_UID_TTY 8
#define GLIBTOP_PROC_UID_TPGID 9
#define GLIBTOP_PROC_UID_PRIORITY 10
#define GLIBTOP_PROC_UID_NICE 11
#define GLIBTOP_PROC_UID_SUID 4
#define GLIBTOP_PROC_UID_SGID 5
#define GLIBTOP_PROC_UID_FSUID 6
#define GLIBTOP_PROC_UID_FSGID 7
#define GLIBTOP_PROC_UID_PID 8
#define GLIBTOP_PROC_UID_PPID 9
#define GLIBTOP_PROC_UID_PGRP 10
#define GLIBTOP_PROC_UID_SESSION 11
#define GLIBTOP_PROC_UID_TTY 12
#define GLIBTOP_PROC_UID_TPGID 13
#define GLIBTOP_PROC_UID_PRIORITY 14
#define GLIBTOP_PROC_UID_NICE 15
#define GLIBTOP_PROC_UID_NGROUPS 16
#define GLIBTOP_PROC_UID_GROUPS 17
#define GLIBTOP_MAX_PROC_UID 12
#define GLIBTOP_MAX_PROC_UID 18
#define GLIBTOP_MAX_GROUPS 32
typedef struct _glibtop_proc_uid glibtop_proc_uid;
@@ -57,6 +65,10 @@ struct _glibtop_proc_uid
euid, /* effective user id */
gid, /* group id */
egid, /* effective group id */
suid, /* saved user id */
sgid, /* saved group id */
fsuid, /* file system user id */
fsgid, /* file system group id */
pid, /* process id */
ppid, /* pid of parent process */
pgrp, /* process group id */
@@ -64,7 +76,9 @@ struct _glibtop_proc_uid
tty, /* full device number of controlling terminal */
tpgid, /* terminal process group id */
priority, /* kernel scheduling priority */
nice; /* standard unix nice level of process */
nice, /* standard unix nice level of process */
ngroups, /* number of additional process groups */
groups [GLIBTOP_MAX_GROUPS]; /* additional prcess groups */
};
#define glibtop_get_proc_uid(p1, p2) glibtop_get_proc_uid_l(glibtop_global_server, p1, p2)

View File

@@ -32,8 +32,9 @@ BEGIN_LIBGTOP_DECLS
#define GLIBTOP_TYPE_ULONG 2
#define GLIBTOP_TYPE_DOUBLE 3
#define GLIBTOP_TYPE_INT 4
#define GLIBTOP_TYPE_CHAR 5
#define GLIBTOP_TYPE_STRING 6
#define GLIBTOP_TYPE_UNSIGNED 5
#define GLIBTOP_TYPE_CHAR 6
#define GLIBTOP_TYPE_STRING 7
END_LIBGTOP_DECLS

View File

@@ -33,8 +33,9 @@ BEGIN_LIBGTOP_DECLS
#define GLIBTOP_UPTIME_UPTIME 0
#define GLIBTOP_UPTIME_IDLETIME 1
#define GLIBTOP_UPTIME_BOOT_TIME 2
#define GLIBTOP_MAX_UPTIME 2
#define GLIBTOP_MAX_UPTIME 3
typedef struct _glibtop_uptime glibtop_uptime;

View File

@@ -100,7 +100,18 @@ glibtop_get_proc_segment_s (glibtop *server, glibtop_proc_segment *buf,
buf->start_code = proc_state.start_code;
buf->end_code = proc_state.end_code;
buf->start_data = proc_state.start_data;
buf->end_data = proc_state.end_data;
buf->start_brk = proc_state.start_brk;
buf->end_brk = proc_state.brk;
buf->start_stack = proc_state.start_stack;
buf->start_mmap = proc_state.start_mmap;
buf->arg_start = proc_state.arg_start;
buf->arg_end = proc_state.arg_end;
buf->env_start = proc_state.env_start;
buf->env_end = proc_state.env_end;
buf->flags |= _glibtop_sysdeps_proc_segment_state;
}

View File

@@ -29,11 +29,17 @@
const char *glibtop_names_proc_segment[GLIBTOP_MAX_PROC_SEGMENT] =
{
"text_rss", "shlib_rss", "data_rss", "stack_rss",
"dirty_size", "start_code", "end_code", "start_stack"
"dirty_size", "start_code", "end_code", "start_data",
"end_data", "start_brk", "end_brk", "start_stack",
"start_mmap", "arg_start", "arg_end", "env_start",
"env_end"
};
const unsigned glibtop_types_proc_segment[GLIBTOP_MAX_PROC_SEGMENT] =
{
GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG,
GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG,
GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG,
GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG,
GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG,
GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG
@@ -42,7 +48,10 @@ const unsigned glibtop_types_proc_segment[GLIBTOP_MAX_PROC_SEGMENT] =
const char *glibtop_labels_proc_segment[GLIBTOP_MAX_PROC_SEGMENT] =
{
N_ ("Text_RSS"), N_ ("ShLib_RSS"), N_ ("Data_RSS"), N_ ("Stack_RSS"),
N_ ("Dirty Size"), N_ ("Start_Code"), N_ ("End_Code"), N_ ("Start_Stack")
N_ ("Dirty Size"), N_ ("Start_Code"), N_ ("End_Code"),
N_ ("Start_Data"), N_ ("End_Data"), N_ ("Start_Brk"), N_ ("Brk"),
N_ ("Start_Stack"), N_ ("Start_MMap"), N_ ("Arg_Start"),
N_ ("Arg_End"), N_ ("Env_Start"), N_ ("Env_End")
};
const char *glibtop_descriptions_proc_segment[GLIBTOP_MAX_PROC_SEGMENT] =
@@ -54,5 +63,14 @@ const char *glibtop_descriptions_proc_segment[GLIBTOP_MAX_PROC_SEGMENT] =
N_ ("Total size of dirty pages"),
N_ ("Address of beginning of code segment"),
N_ ("Address of end of code segment"),
N_ ("Address of the bottom of stack segment")
N_ ("Address of beginning of data segment"),
N_ ("Address of end of data segment"),
N_ ("Brk_Start"),
N_ ("Brk_End"),
N_ ("Address of the bottom of stack segment"),
N_ ("Start of mmap()ed areas"),
N_ ("Arg_Start"),
N_ ("Arg_End"),
N_ ("Env_Start"),
N_ ("Env_End")
};

View File

@@ -28,24 +28,34 @@
const char *glibtop_names_proc_state[GLIBTOP_MAX_PROC_STATE] =
{
"cmd", "state", "uid", "gid"
"cmd", "state", "uid", "gid", "ruid", "rgid", "has_cpu",
"processor", "last_processor"
};
const unsigned glibtop_types_proc_state[GLIBTOP_MAX_PROC_STATE] =
{
GLIBTOP_TYPE_STRING, GLIBTOP_TYPE_CHAR,
GLIBTOP_TYPE_INT, GLIBTOP_TYPE_INT
GLIBTOP_TYPE_STRING, GLIBTOP_TYPE_UNSIGNED,
GLIBTOP_TYPE_INT, GLIBTOP_TYPE_INT, GLIBTOP_TYPE_INT,
GLIBTOP_TYPE_INT, GLIBTOP_TYPE_INT, GLIBTOP_TYPE_INT,
GLIBTOP_TYPE_INT
};
const char *glibtop_labels_proc_state[GLIBTOP_MAX_PROC_STATE] =
{
N_ ("Cmd"), N_ ("State"), N_ ("UID"), N_ ("GID")
N_ ("Cmd"), N_ ("State"), N_ ("UID"), N_ ("GID"), N_ ("RUID"),
N_ ("RGID"), N_ ("Has CPU"), N_ ("Processor"),
N_ ("Last Processor")
};
const char *glibtop_descriptions_proc_state[GLIBTOP_MAX_PROC_STATE] =
{
N_ ("Basename of executable file in call to exec()"),
N_ ("Single-Char code for process state (S=sleeping)"),
N_ ("UID of process"),
N_ ("GID of process")
N_ ("effective UID of process"),
N_ ("effective GID of process"),
N_ ("real UID of process"),
N_ ("real GID of process"),
N_ ("has_cpu"),
N_ ("processor"),
N_ ("last_processor")
};

View File

@@ -26,27 +26,17 @@
#include <glibtop.h>
#include <glibtop/procuid.h>
#define GLIBTOP_PROC_UID_UID 0
#define GLIBTOP_PROC_UID_EUID 1
#define GLIBTOP_PROC_UID_GID 2
#define GLIBTOP_PROC_UID_EGID 3
#define GLIBTOP_PROC_UID_PID 4
#define GLIBTOP_PROC_UID_PPID 5
#define GLIBTOP_PROC_UID_PGRP 6
#define GLIBTOP_PROC_UID_SESSION 7
#define GLIBTOP_PROC_UID_TTY 8
#define GLIBTOP_PROC_UID_TPGID 9
#define GLIBTOP_PROC_UID_PRIORITY 10
#define GLIBTOP_PROC_UID_NICE 11
const char *glibtop_names_proc_uid[GLIBTOP_MAX_PROC_UID] =
{
"uid", "euid", "gid", "egid", "pid", "ppid", "pgrp",
"session", "tty", "tpgid", "priority", "nice"
"uid", "euid", "gid", "egid", "suid", "sgid", "fsuid", "fsgid",
"pid", "ppid", "pgrp", "session", "tty", "tpgid", "priority",
"nice", "ngroups", "groups"
};
const unsigned glibtop_types_proc_uid[GLIBTOP_MAX_PROC_UID] =
{
GLIBTOP_TYPE_INT, GLIBTOP_TYPE_INT, GLIBTOP_TYPE_INT,
GLIBTOP_TYPE_INT, GLIBTOP_TYPE_INT, GLIBTOP_TYPE_INT,
GLIBTOP_TYPE_INT, GLIBTOP_TYPE_INT, GLIBTOP_TYPE_INT,
GLIBTOP_TYPE_INT, GLIBTOP_TYPE_INT, GLIBTOP_TYPE_INT,
GLIBTOP_TYPE_INT, GLIBTOP_TYPE_INT, GLIBTOP_TYPE_INT,
@@ -55,9 +45,11 @@ const unsigned glibtop_types_proc_uid[GLIBTOP_MAX_PROC_UID] =
const char *glibtop_labels_proc_uid[GLIBTOP_MAX_PROC_UID] =
{
N_ ("Uid"), N_ ("EUid"), N_ ("Gid"), N_ ("EGid"), N_ ("Pid"),
N_ ("Uid"), N_ ("EUid"), N_ ("Gid"), N_ ("EGid"), N_ ("SUid"),
N_ ("SGid"), N_ ("FsUid"), N_ ("FsGid"), N_ ("Pid"),
N_ ("PPid"), N_ ("PGrp"), N_ ("Session"), N_ ("Tty"),
N_ ("TPGid"), N_ ("Priority"), N_ ("Nice")
N_ ("TPGid"), N_ ("Priority"), N_ ("Nice"), N_ ("NGroups"),
N_ ("Groups")
};
const char *glibtop_descriptions_proc_uid[GLIBTOP_MAX_PROC_UID] =
@@ -66,6 +58,10 @@ const char *glibtop_descriptions_proc_uid[GLIBTOP_MAX_PROC_UID] =
N_ ("Effective User ID"),
N_ ("Group ID"),
N_ ("Effective Group ID"),
N_ ("Saved User ID"),
N_ ("Saved Group ID"),
N_ ("Filesystem User ID"),
N_ ("Filesystem Group ID"),
N_ ("Process ID"),
N_ ("PID of parent process"),
N_ ("Process group ID"),
@@ -73,5 +69,7 @@ const char *glibtop_descriptions_proc_uid[GLIBTOP_MAX_PROC_UID] =
N_ ("Full device number of controlling terminal"),
N_ ("Terminal process group ID"),
N_ ("Kernel scheduling priority"),
N_ ("Standard unix nice level of process")
N_ ("Standard unix nice level of process"),
N_ ("Number of additional process groups"),
N_ ("Additional process groups")
};

View File

@@ -27,22 +27,24 @@
const char *glibtop_names_uptime[GLIBTOP_MAX_UPTIME] =
{
"uptime", "idletime"
"uptime", "idletime", "boot_time"
};
const unsigned glibtop_types_uptime[GLIBTOP_MAX_UPTIME] =
{
GLIBTOP_TYPE_DOUBLE, GLIBTOP_TYPE_DOUBLE
GLIBTOP_TYPE_DOUBLE, GLIBTOP_TYPE_DOUBLE, GLIBTOP_TYPE_ULONG
};
const char *glibtop_labels_uptime[GLIBTOP_MAX_UPTIME] =
{
N_ ("Uptime"),
N_ ("Idletime")
N_ ("Idletime"),
N_ ("Boot time")
};
const char *glibtop_descriptions_uptime[GLIBTOP_MAX_UPTIME] =
{
N_ ("Time in seconds since system boot"),
N_ ("Time in seconds the system spent in the idle task since system boot")
N_ ("Time in seconds the system spent in the idle task since system boot"),
N_ ("Boot time (seconds sice epoch)")
};