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:
committed by
Martin Baulig
parent
3a7f02352a
commit
ede4594dd9
@@ -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 */
|
||||
|
@@ -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)
|
||||
|
@@ -31,12 +31,25 @@
|
||||
|
||||
BEGIN_LIBGTOP_DECLS
|
||||
|
||||
#define GLIBTOP_PROC_STATE_CMD 0
|
||||
#define GLIBTOP_PROC_STATE_STATE 1
|
||||
#define GLIBTOP_PROC_STATE_UID 2
|
||||
#define GLIBTOP_PROC_STATE_GID 3
|
||||
#define GLIBTOP_PROC_STATE_CMD 0
|
||||
#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)
|
||||
|
@@ -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)
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user