version 1.75, 2012/12/18 21:28:45 |
version 1.76, 2013/03/23 21:12:32 |
|
|
char * |
char * |
format_next_process(caddr_t handle, char *(*get_userid)(uid_t), pid_t *pid) |
format_next_process(caddr_t handle, char *(*get_userid)(uid_t), pid_t *pid) |
{ |
{ |
char *p_wait, waddr[sizeof(void *) * 2 + 3]; /* Hexify void pointer */ |
char *p_wait; |
struct kinfo_proc *pp; |
struct kinfo_proc *pp; |
struct handle *hp; |
struct handle *hp; |
int cputime; |
int cputime; |
|
|
/* calculate the base for cpu percentages */ |
/* calculate the base for cpu percentages */ |
pct = pctdouble(pp->p_pctcpu); |
pct = pctdouble(pp->p_pctcpu); |
|
|
if (pp->p_wchan) { |
if (pp->p_wmesg[0]) |
if (pp->p_wmesg) |
p_wait = pp->p_wmesg; |
p_wait = pp->p_wmesg; |
else |
else { |
|
snprintf(waddr, sizeof(waddr), "%llx", |
|
(unsigned long long)pp->p_wchan); |
|
p_wait = waddr; |
|
} |
|
} else |
|
p_wait = "-"; |
p_wait = "-"; |
|
|
/* format this entry */ |
/* format this entry */ |