From owner-svn-src-head@freebsd.org Fri Jun 22 10:17:14 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DCC2E1015FF9; Fri, 22 Jun 2018 10:17:13 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 889EA89AAB; Fri, 22 Jun 2018 10:17:13 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 50EA91F57F; Fri, 22 Jun 2018 10:17:13 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w5MAHD8N059663; Fri, 22 Jun 2018 10:17:13 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5MAHDoh059662; Fri, 22 Jun 2018 10:17:13 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201806221017.w5MAHDoh059662@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Fri, 22 Jun 2018 10:17:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r335551 - head/usr.bin/top X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/usr.bin/top X-SVN-Commit-Revision: 335551 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2018 10:17:14 -0000 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;