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:
Benoît Dejean
2004-10-11 18:01:25 +00:00
parent 13025c6c5f
commit b3dfc1d1d2
16 changed files with 292 additions and 244 deletions

View File

@@ -27,7 +27,6 @@
#include <glibtop/procmap.h>
#include <errno.h>
#include <alloca.h>
#include "safeio.h"
@@ -58,7 +57,7 @@ glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid)
int fd, i, nmaps, pr_err, heap;
#if GLIBTOP_SOLARIS_RELEASE >= 560
prxmap_t *maps;
struct ps_prochandle *Pr;
struct ps_prochandle *Pr = NULL;
#else
prmap_t *maps;
#endif
@@ -97,7 +96,7 @@ glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid)
s_close(fd);
return NULL;
}
maps = alloca(inode.st_size);
maps = g_alloca(inode.st_size);
nmaps = inode.st_size / sizeof(prxmap_t);
if(s_pread(fd, maps, inode.st_size, 0) != inode.st_size)
{
@@ -112,7 +111,7 @@ glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid)
s_close(fd);
return NULL;
}
maps = alloca((nmaps + 1) * sizeof(prmap_t));
maps = g_alloca((nmaps + 1) * sizeof(prmap_t));
if(ioctl(fd, PIOCMAP, maps) < 0)
{
glibtop_warn_io_r(server, "ioctl(%s, PIOCMAP)", buffer);