svn commit: r335551 - head/usr.bin/top
Eitan Adler
eadler at FreeBSD.org
Fri Jun 22 10:17:14 UTC 2018
Author: eadler
Date: Fri Jun 22 10:17:12 2018
New Revision: 335551
URL: https://svnweb.freebsd.org/changeset/base/335551
Log:
top(1): garbage collect
- remove a now-unused function
- remove needless indirection of handle type
Modified:
head/usr.bin/top/machine.c
head/usr.bin/top/machine.h
Modified: head/usr.bin/top/machine.c
==============================================================================
--- head/usr.bin/top/machine.c Fri Jun 22 10:17:10 2018 (r335550)
+++ head/usr.bin/top/machine.c Fri Jun 22 10:17:12 2018 (r335551)
@@ -871,13 +871,12 @@ get_process_info(struct system_info *si, struct proces
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)
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) {
@@ -1544,28 +1542,6 @@ int (*compares[])(const void *arg1, const void *arg2)
NULL
};
-
-/*
- * 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)
Modified: head/usr.bin/top/machine.h
==============================================================================
--- head/usr.bin/top/machine.h Fri Jun 22 10:17:10 2018 (r335550)
+++ head/usr.bin/top/machine.h Fri Jun 22 10:17:12 2018 (r335551)
@@ -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;
More information about the svn-src-all
mailing list