Updated. Lots of cleanup.
* cpu.c: (glibtop_init_cpu_s), (glibtop_get_cpu_s): * loadavg.c: (glibtop_get_loadavg_s): * mem.c: (glibtop_init_mem_s), (glibtop_get_mem_s): * open.c: (glibtop_get_kstats), (glibtop_open_s): * procargs.c: (glibtop_get_proc_args_s): * procdata.c: (glibtop_get_proc_data_psinfo_s), (glibtop_get_proc_data_usage_s), (glibtop_get_proc_credentials_s), (glibtop_get_proc_status_s): * proclist.c: (glibtop_get_proclist_s): * procmap.c: (glibtop_get_proc_map_s): * procmem.c: (glibtop_get_proc_mem_s): * procstate.c: (glibtop_get_proc_state_s): * safeio.c: * safeio.h: * shm_limits.c: (glibtop_init_shm_limits_p), (glibtop_get_shm_limits_p): * swap.c: (glibtop_get_swap_s): * uptime.c: (glibtop_get_uptime_s): Updated. Lots of cleanup.
This commit is contained in:
@@ -28,18 +28,25 @@
|
||||
#include <sys/shm.h>
|
||||
|
||||
static const struct nlist nlst[] = { {"shminfo"}, {NULL} };
|
||||
|
||||
#if GLIBTOP_SOLARIS_RELEASE < 590
|
||||
static const unsigned long _glibtop_sysdeps_shm_limits =
|
||||
(1L << GLIBTOP_IPC_SHMMAX) + (1L << GLIBTOP_IPC_SHMMIN);
|
||||
|
||||
#else
|
||||
static const unsigned long _glibtop_sysdeps_shm_limits =
|
||||
(1L << GLIBTOP_IPC_SHMMAX) + (1L << GLIBTOP_IPC_SHMMIN) +
|
||||
(1L << GLIBTOP_IPC_SHMMNI) + (1L << GLIBTOP_IPC_SHMSEG);
|
||||
#endif
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_shm_limits_p (glibtop *server)
|
||||
{
|
||||
kvm_t *kd = server->machine.kd;
|
||||
kvm_t * const kd = server->machine.kd;
|
||||
|
||||
if(kd && !kvm_nlist(kd, nlst))
|
||||
if(kd && !kvm_nlist(kd, nlst))
|
||||
server->sysdeps.shm_limits = _glibtop_sysdeps_shm_limits;
|
||||
else
|
||||
server->sysdeps.shm_limits = 0;
|
||||
@@ -50,16 +57,18 @@ glibtop_init_shm_limits_p (glibtop *server)
|
||||
void
|
||||
glibtop_get_shm_limits_p (glibtop *server, glibtop_shm_limits *buf)
|
||||
{
|
||||
kvm_t *kd = server->machine.kd;
|
||||
kvm_t * const kd = server->machine.kd;
|
||||
struct shminfo sinfo;
|
||||
|
||||
memset (buf, 0, sizeof (glibtop_shm_limits));
|
||||
|
||||
if(!(server->sysdeps.shm_limits))
|
||||
return;
|
||||
return;
|
||||
|
||||
if(kvm_read(kd, nlst[0].n_value, (void *)&sinfo,
|
||||
sizeof(struct shminfo)) != sizeof(struct shminfo))
|
||||
return;
|
||||
return;
|
||||
|
||||
buf->shmmax = sinfo.shmmax;
|
||||
buf->shmmni = sinfo.shmmni;
|
||||
#if GLIBTOP_SOLARIS_RELEASE < 590
|
||||
|
Reference in New Issue
Block a user