Apply patch by the_h1ghlander@yahoo.com and Cory Omand

2003-10-20  Bastien Nocera  <hadess@hadess.net>

	* include/glibtop/cpu.h:
	* include/glibtop/procstate.h:
	* include/glibtop/procuid.h:
	* include/glibtop/uptime.h:
	* lib/sysdeps.c:
	* sysdeps/names/cpu.c:
	* sysdeps/names/procstate.c:
	* sysdeps/names/procuid.c:
	* sysdeps/names/uptime.c: Apply patch by the_h1ghlander@yahoo.com and
	Cory Omand <cory.omand@Sun.com> for Solaris support
This commit is contained in:
Bastien Nocera
2003-10-20 21:27:31 +00:00
committed by Bastien Nocera
parent a50e5fdc9a
commit 07d991f383
12 changed files with 180 additions and 49 deletions

View File

@@ -1,3 +1,16 @@
2003-10-20 Bastien Nocera <hadess@hadess.net>
* include/glibtop/cpu.h:
* include/glibtop/procstate.h:
* include/glibtop/procuid.h:
* include/glibtop/uptime.h:
* lib/sysdeps.c:
* sysdeps/names/cpu.c:
* sysdeps/names/procstate.c:
* sysdeps/names/procuid.c:
* sysdeps/names/uptime.c: Apply patch by the_h1ghlander@yahoo.com and
Cory Omand <cory.omand@Sun.com> for Solaris support
2003-10-20 Bastien Nocera <hadess@hadess.net>
* src/inodedb/Makefile.am: link to libgtop_suid_common-2.0.la

View File

@@ -41,8 +41,9 @@ G_BEGIN_DECLS
#define GLIBTOP_XCPU_NICE 8
#define GLIBTOP_XCPU_SYS 9
#define GLIBTOP_XCPU_IDLE 10
#define GLIBTOP_XCPU_FLAGS 11
#define GLIBTOP_MAX_CPU 11
#define GLIBTOP_MAX_CPU 12
/* Nobody should really be using more than 4 processors. */
#define GLIBTOP_NCPU 4
@@ -62,7 +63,8 @@ struct _glibtop_cpu
xcpu_user [GLIBTOP_NCPU], /* GLIBTOP_XCPU_USER */
xcpu_nice [GLIBTOP_NCPU], /* GLIBTOP_XCPU_NICE */
xcpu_sys [GLIBTOP_NCPU], /* GLIBTOP_XCPU_SYS */
xcpu_idle [GLIBTOP_NCPU]; /* GLIBTOP_XCPU_IDLE */
xcpu_idle [GLIBTOP_NCPU], /* GLIBTOP_XCPU_IDLE */
xcpu_flags; /* GLIBTOP_XCPU_IDLE */
};
#define glibtop_get_cpu(cpu) glibtop_get_cpu_l(glibtop_global_server, cpu)

View File

@@ -33,8 +33,20 @@ G_BEGIN_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
#define GLIBTOP_PROCESS_RUNNING 1
#define GLIBTOP_PROCESS_INTERRUPTIBLE 2
#define GLIBTOP_PROCESS_UNINTERRUPTIBLE 4
#define GLIBTOP_PROCESS_ZOMBIE 8
#define GLIBTOP_PROCESS_STOPPED 16
#define GLIBTOP_PROCESS_SWAPPING 32
typedef struct _glibtop_proc_state glibtop_proc_state;
@@ -43,9 +55,9 @@ typedef struct _glibtop_proc_state glibtop_proc_state;
struct _glibtop_proc_state
{
guint64 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
unsigned state; /* single-char code for process state
* (S=sleeping) */
/* NOTE: when porting the library, TRY HARD to implement the
* following two fields. */
@@ -53,7 +65,12 @@ struct _glibtop_proc_state
* only to set the flags value for those two
* fields if their values are corrent ! */
int uid, /* UID of process */
gid; /* GID of process */
gid, /* GID of process */
ruid,
rgid;
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

@@ -33,19 +33,27 @@ G_BEGIN_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
typedef struct _glibtop_proc_uid glibtop_proc_uid;
#define GLIBTOP_MAX_GROUPS 64
/* User, Group, Terminal and session */
struct _glibtop_proc_uid
@@ -55,6 +63,10 @@ struct _glibtop_proc_uid
euid, /* effective user id */
gid, /* group id */
egid, /* effective group id */
suid, /* set user id */
sgid, /* set group id */
fsuid, /* ??? user id */
fsgid, /* ??? group id */
pid, /* process id */
ppid, /* pid of parent process */
pgrp, /* process group id */
@@ -62,7 +74,10 @@ 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,
groups [GLIBTOP_MAX_GROUPS];
};
#define glibtop_get_proc_uid(p1, p2) glibtop_get_proc_uid_l(glibtop_global_server, p1, p2)

View File

@@ -31,8 +31,9 @@ G_BEGIN_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;
@@ -41,6 +42,7 @@ struct _glibtop_uptime
guint64 flags;
double uptime, /* GLIBTOP_UPTIME_UPTIME */
idletime; /* GLIBTOP_UPTIME_IDLETIME */
guint64 boot_time;
};
#define glibtop_get_uptime(uptime) glibtop_get_uptime_l(glibtop_global_server, uptime)

View File

@@ -109,6 +109,70 @@ glibtop_init_func_t _glibtop_init_hook_s [] = {
NULL
};
glibtop_init_func_t _glibtop_init_hook_p [] = {
#if GLIBTOP_SUID_CPU
glibtop_init_cpu_p,
#endif
#if GLIBTOP_SUID_MEM
glibtop_init_mem_p,
#endif
#if GLIBTOP_SUID_SWAP
glibtop_init_swap_p,
#endif
#if GLIBTOP_SUID_UPTIME
glibtop_init_uptime_p,
#endif
#if GLIBTOP_SUID_LOADAVG
glibtop_init_loadavg_p,
#endif
#if GLIBTOP_SUID_SHM_LIMITS
glibtop_init_shm_limits_p,
#endif
#if GLIBTOP_SUID_MSG_LIMITS
glibtop_init_msg_limits_p,
#endif
#if GLIBTOP_SUID_SEM_LIMITS
glibtop_init_sem_limits_p,
#endif
#if GLIBTOP_SUID_PROCLIST
glibtop_init_proclist_p,
#endif
#if GLIBTOP_SUID_PROC_STATE
glibtop_init_proc_state_p,
#endif
#if GLIBTOP_SUID_PROC_UID
glibtop_init_proc_uid_p,
#endif
#if GLIBTOP_SUID_PROC_MEM
glibtop_init_proc_mem_p,
#endif
#if GLIBTOP_SUID_PROC_TIME
glibtop_init_proc_time_p,
#endif
#if GLIBTOP_SUID_PROC_SIGNAL
glibtop_init_proc_signal_p,
#endif
#if GLIBTOP_SUID_PROC_KERNEL
glibtop_init_proc_kernel_p,
#endif
#if GLIBTOP_SUID_PROC_SEGMENT
glibtop_init_proc_segment_p,
#endif
#if GLIBTOP_SUID_PROC_ARGS
glibtop_init_proc_args_p,
#endif
#if GLIBTOP_SUID_PROC_MAP
glibtop_init_proc_map_p,
#endif
#if GLIBTOP_SUID_NETLOAD
glibtop_init_netload_p,
#endif
#if GLIBTOP_SUID_PPP
glibtop_init_ppp_p,
#endif
NULL
};
/* Checks which features are implemented. */
void

View File

@@ -28,7 +28,7 @@ const char *glibtop_names_cpu [GLIBTOP_MAX_CPU] =
{
"total", "user", "nice", "sys", "idle", "frequency",
"xcpu_total", "xcpu_user", "xcpu_nice", "xcpu_sys",
"xcpu_idle"
"xcpu_idle", "xcpu_flags"
};
const unsigned glibtop_types_cpu [GLIBTOP_MAX_CPU] =
@@ -36,7 +36,7 @@ const unsigned glibtop_types_cpu [GLIBTOP_MAX_CPU] =
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
};
const char *glibtop_labels_cpu [GLIBTOP_MAX_CPU] =
@@ -51,7 +51,8 @@ const char *glibtop_labels_cpu [GLIBTOP_MAX_CPU] =
N_("SMP CPU Time in User Mode"),
N_("SMP CPU Time in User Mode (nice)"),
N_("SMP CPU Time in System Mode"),
N_("SMP CPU Time in the Idle Task")
N_("SMP CPU Time in the Idle Task"),
N_("SMP CPU Flags")
};
const char *glibtop_descriptions_cpu [GLIBTOP_MAX_CPU] =
@@ -67,4 +68,5 @@ const char *glibtop_descriptions_cpu [GLIBTOP_MAX_CPU] =
N_("Number of clock ticks the system spent in user mode (nice)"),
N_("Number of clock ticks the system spent in system mode"),
N_("Number of clock ticks the system spent in the idle task"),
N_("Bit field indicating which CPU is currently running"),
};

View File

@@ -27,18 +27,21 @@
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_CHAR, 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_("RGid"), N_("RUid"), N_("HasCPU"), N_("Proc"), N_("LProc")
};
const char *glibtop_descriptions_proc_state [GLIBTOP_MAX_PROC_STATE] =
@@ -46,5 +49,10 @@ 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_("GID of process"),
N_("Real UID of process"),
N_("Real GID of process"),
N_("Has CPU"),
N_("Processor"),
N_("Last Processor"),
};

View File

@@ -25,27 +25,18 @@
#include <glibtop/procuid.h>
#include <libgnome/gnome-i18n.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,
@@ -54,9 +45,10 @@ 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] =
@@ -65,6 +57,10 @@ const char *glibtop_descriptions_proc_uid [GLIBTOP_MAX_PROC_UID] =
N_("Effective User ID"),
N_("Group ID"),
N_("Effective Group ID"),
N_("Set User ID"),
N_("Set Group ID"),
N_("Filesystem User ID"),
N_("Filesystem Group ID"),
N_("Process ID"),
N_("PID of parent process"),
N_("Process group ID"),
@@ -72,5 +68,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_("Array of additional process groups")
};

View File

@@ -26,22 +26,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_("BootTime")
};
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_("Time of last system boot in seconds since the epoch"),
};

View File

@@ -1,3 +1,9 @@
2003-10-20 Bastien Nocera <hadess@hadess.net>
* shm_limits.c: (glibtop_get_shm_limits_p): Apply patch by
the_h1ghlander@yahoo.com and Cory Omand <cory.omand@Sun.com> for
Solaris support
2003-10-20 Bastien Nocera <hadess@hadess.net>
* mem.c: (glibtop_get_mem_s):

View File

@@ -61,8 +61,10 @@ glibtop_get_shm_limits_p (glibtop *server, glibtop_shm_limits *buf)
sizeof(struct shminfo)) != sizeof(struct shminfo))
return;
buf->shmmax = sinfo.shmmax;
buf->shmmin = sinfo.shmmin;
buf->shmmni = sinfo.shmmni;
#if GLIBTOP_SOLARIS_RELEASE < 590
buf->shmmin = sinfo.shmmin;
buf->shmseg = sinfo.shmseg;
#endif
buf->flags = _glibtop_sysdeps_shm_limits;
}