Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Mar 2017 17:22:44 +0000 (UTC)
From:      Robert Watson <rwatson@FreeBSD.org>
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
Message-ID:  <201703261722.v2QHMjVE088151@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703261722.v2QHMjVE088151>