diff --git a/usr.bin/top/machine.c b/usr.bin/top/machine.c index bfc257a7b216..14ab1b529ae0 100644 --- a/usr.bin/top/machine.c +++ b/usr.bin/top/machine.c @@ -871,13 +871,12 @@ get_process_info(struct system_info *si, struct process_select *sel, static char fmt[512]; /* static area where result is built */ char * -format_next_process(void* xhandle, char *(*get_userid)(int), int flags) +format_next_process(struct handle * xhandle, char *(*get_userid)(int), int flags) { struct kinfo_proc *pp; const struct kinfo_proc *oldp; long cputime; double pct; - struct handle *hp; char status[22]; int cpu; size_t state; @@ -891,9 +890,8 @@ format_next_process(void* xhandle, char *(*get_userid)(int), int flags) const int cmdlen = 128; /* find and remember the next proc structure */ - hp = (struct handle *)xhandle; - pp = *(hp->next_proc++); - hp->remaining--; + pp = *(xhandle->next_proc++); + xhandle->remaining--; /* get the process's command name */ if ((pp->ki_flag & P_INMEM) == 0) { @@ -1545,28 +1543,6 @@ int (*compares[])(const void *arg1, const void *arg2) = { }; -/* - * proc_owner(pid) - returns the uid that owns process "pid", or -1 if - * the process does not exist. - */ - -int -proc_owner(int pid) -{ - int cnt; - struct kinfo_proc **prefp; - struct kinfo_proc *pp; - - prefp = pref; - cnt = pref_len; - while (--cnt >= 0) { - pp = *prefp++; - if (pp->ki_pid == (pid_t)pid) - return ((int)pp->ki_ruid); - } - return (-1); -} - static int swapmode(int *retavail, int *retfree) { diff --git a/usr.bin/top/machine.h b/usr.bin/top/machine.h index e278a4d87edc..c3c7777d910e 100644 --- a/usr.bin/top/machine.h +++ b/usr.bin/top/machine.h @@ -78,13 +78,14 @@ struct process_select /* routines defined by the machine dependent module */ +struct handle; + char *format_header(const char *uname_field); -char *format_next_process(void* handle, char *(*get_userid)(int), +char *format_next_process(struct handle* handle, char *(*get_userid)(int), int flags); void toggle_pcpustats(void); void get_system_info(struct system_info *si); int machine_init(struct statics *statics); -int proc_owner(int pid); /* non-int routines typically used by the machine dependent module */ extern struct process_select ps;