From owner-svn-src-head@freebsd.org Sun Mar 26 17:22:46 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5CACAD1F312; Sun, 26 Mar 2017 17:22:46 +0000 (UTC) (envelope-from rwatson@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 mx1.freebsd.org (Postfix) with ESMTPS id 2C6581D23; Sun, 26 Mar 2017 17:22:46 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v2QHMjQF088154; Sun, 26 Mar 2017 17:22:45 GMT (envelope-from rwatson@FreeBSD.org) Received: (from rwatson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2QHMjVE088151; Sun, 26 Mar 2017 17:22:45 GMT (envelope-from rwatson@FreeBSD.org) Message-Id: <201703261722.v2QHMjVE088151@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rwatson set sender to rwatson@FreeBSD.org using -f From: Robert Watson Date: Sun, 26 Mar 2017 17:22:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r315990 - in head: contrib/top usr.bin/top X-SVN-Group: head 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.23 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: Sun, 26 Mar 2017 17:22:46 -0000 Author: rwatson Date: Sun Mar 26 17:22:44 2017 New Revision: 315990 URL: https://svnweb.freebsd.org/changeset/base/315990 Log: Provide proper contemporary function prototypes for many of the functions implemented in top(1), rather than relying on K&R prototypes, which can cause problems on targets where there are multiple incompatible calling conventions and the compiler requires argument information to select the correct one. (There's a bit more to do here, since it looks like top(1) also sometimes provides prototypes for various curses functions rather than relying on the header file...) Sponsored by: DARPA, AFRL MFC after: 1 week Modified: head/contrib/top/machine.h head/contrib/top/top.c head/usr.bin/top/machine.c Modified: head/contrib/top/machine.h ============================================================================== --- head/contrib/top/machine.h Sun Mar 26 16:49:20 2017 (r315989) +++ head/contrib/top/machine.h Sun Mar 26 17:22:44 2017 (r315990) @@ -81,14 +81,15 @@ struct process_select /* routines defined by the machine dependent module */ -char *format_header(); -char *format_next_process(); +char *format_header(char *uname_field); +char *format_next_process(caddr_t 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, char do_unames); int proc_owner(int pid); /* non-int routines typically used by the machine dependent module */ -char *printable(); +char *printable(char *string); #endif /* MACHINE_H */ Modified: head/contrib/top/top.c ============================================================================== --- head/contrib/top/top.c Sun Mar 26 16:49:20 2017 (r315989) +++ head/contrib/top/top.c Sun Mar 26 17:22:44 2017 (r315990) @@ -112,7 +112,8 @@ extern int io_compare(); #endif time_t time(); -caddr_t get_process_info(); +caddr_t get_process_info(struct system_info *si, struct process_select *sel, + int (*compare)(const void *, const void *)); /* different routines for displaying the user's identification */ /* (values assigned to get_userid) */ @@ -120,16 +121,16 @@ char *username(); char *itoa7(); /* pointers to display routines */ -void (*d_loadave)() = i_loadave; -void (*d_procstates)() = i_procstates; -void (*d_cpustates)() = i_cpustates; -void (*d_memory)() = i_memory; -void (*d_arc)() = i_arc; -void (*d_carc)() = i_carc; -void (*d_swap)() = i_swap; -void (*d_message)() = i_message; -void (*d_header)() = i_header; -void (*d_process)() = i_process; +void (*d_loadave)(int mpid, double *avenrun) = i_loadave; +void (*d_procstates)(int total, int *brkdn) = i_procstates; +void (*d_cpustates)(int *states) = i_cpustates; +void (*d_memory)(int *stats) = i_memory; +void (*d_arc)(int *stats) = i_arc; +void (*d_carc)(int *stats) = i_carc; +void (*d_swap)(int *stats) = i_swap; +void (*d_message)(void) = i_message; +void (*d_header)(char *text) = i_header; +void (*d_process)(int line, char *thisline) = i_process; void reset_display(void); Modified: head/usr.bin/top/machine.c ============================================================================== --- head/usr.bin/top/machine.c Sun Mar 26 16:49:20 2017 (r315989) +++ head/usr.bin/top/machine.c Sun Mar 26 17:22:44 2017 (r315990) @@ -241,7 +241,7 @@ static int pageshift; /* log base 2 of ((kip)->ki_swrss > (kip)->ki_rssize ? (kip)->ki_swrss - (kip)->ki_rssize : 0) /* useful externals */ -long percentages(); +long percentages(int cnt, int *out, long *new, long *old, long *diffs); #ifdef ORDER /*