Whitespace cleanup.
* loadavg.c: (glibtop_get_loadavg_s): Whitespace cleanup. * ppp.c: (get_ISDN_stats), (is_ISDN_on): Replace g_malloc by an array. * glibtop_server.c: (get_pageshift): * glibtop_server.h: * procmem.c: (glibtop_init_proc_mem_s), (glibtop_get_proc_mem_s): * procsegment.c: (glibtop_init_proc_segment_s), (glibtop_get_proc_segment_s): Moved the pageshift calculation to glibtop_server.[ch] * procstate.c: (glibtop_get_proc_state_s): * procuid.c: (glibtop_get_proc_uid_s): * sysinfo.c: (init_sysinfo): Minor cleanups.
This commit is contained in:
@@ -37,34 +37,13 @@ static const unsigned long _glibtop_sysdeps_proc_segment_statm =
|
||||
(1L << GLIBTOP_PROC_SEGMENT_DATA_RSS) +
|
||||
(1L << GLIBTOP_PROC_SEGMENT_DIRTY_SIZE);
|
||||
|
||||
#ifndef LOG1024
|
||||
#define LOG1024 10
|
||||
#endif
|
||||
|
||||
/* these are for getting the memory statistics */
|
||||
static int pageshift = 0; /* log base 2 of the pagesize */
|
||||
|
||||
/* define pagetok in terms of pageshift */
|
||||
#define pagetok(size) ((size) << pageshift)
|
||||
|
||||
/* Init function. */
|
||||
|
||||
void
|
||||
glibtop_init_proc_segment_s (glibtop *server)
|
||||
{
|
||||
register int pagesize;
|
||||
|
||||
server->sysdeps.proc_segment = _glibtop_sysdeps_proc_segment |
|
||||
_glibtop_sysdeps_proc_segment_statm;
|
||||
|
||||
/* get the page size with "getpagesize" and calculate pageshift
|
||||
* from it */
|
||||
pagesize = getpagesize ();
|
||||
pageshift = 0;
|
||||
while (pagesize > 1) {
|
||||
pageshift++;
|
||||
pagesize >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Provides detailed information about a process. */
|
||||
@@ -74,6 +53,7 @@ glibtop_get_proc_segment_s (glibtop *server, glibtop_proc_segment *buf,
|
||||
pid_t pid)
|
||||
{
|
||||
char buffer [BUFSIZ], *p;
|
||||
const unsigned pageshift = get_pageshift();
|
||||
|
||||
glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_SEGMENT, 0);
|
||||
|
||||
|
Reference in New Issue
Block a user