Mon May 31 18:14:59 2010 UTC ()
Fix previous, so it builds on some ports.


(rmind)
diff -r1.13 -r1.14 src/external/bsd/top/dist/machine/m_netbsd.c

cvs diff -r1.13 -r1.14 src/external/bsd/top/dist/machine/m_netbsd.c (expand / switch to unified diff)

--- src/external/bsd/top/dist/machine/m_netbsd.c 2010/05/31 03:18:33 1.13
+++ src/external/bsd/top/dist/machine/m_netbsd.c 2010/05/31 18:14:59 1.14
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: m_netbsd.c,v 1.13 2010/05/31 03:18:33 rmind Exp $ */ 1/* $NetBSD: m_netbsd.c,v 1.14 2010/05/31 18:14:59 rmind Exp $ */
2 2
3/* 3/*
4 * top - a top users display for Unix 4 * top - a top users display for Unix
5 * 5 *
6 * SYNOPSIS: For a NetBSD-1.5 (or later) system 6 * SYNOPSIS: For a NetBSD-1.5 (or later) system
7 * 7 *
8 * DESCRIPTION: 8 * DESCRIPTION:
9 * Originally written for BSD4.4 system by Christos Zoulas. 9 * Originally written for BSD4.4 system by Christos Zoulas.
10 * Based on the FreeBSD 2.0 version by Steven Wallace and Wolfram Schneider. 10 * Based on the FreeBSD 2.0 version by Steven Wallace and Wolfram Schneider.
11 * NetBSD-1.0 port by Arne Helme. Process ordering by Luke Mewburn. 11 * NetBSD-1.0 port by Arne Helme. Process ordering by Luke Mewburn.
12 * NetBSD-1.3 port by Luke Mewburn, based on code by Matthew Green. 12 * NetBSD-1.3 port by Luke Mewburn, based on code by Matthew Green.
13 * NetBSD-1.4/UVM port by matthew green. 13 * NetBSD-1.4/UVM port by matthew green.
14 * NetBSD-1.5 port by Simon Burge. 14 * NetBSD-1.5 port by Simon Burge.
@@ -27,32 +27,32 @@ @@ -27,32 +27,32 @@
27 * CFLAGS: -DHAVE_GETOPT -DORDER -DHAVE_STRERROR 27 * CFLAGS: -DHAVE_GETOPT -DORDER -DHAVE_STRERROR
28 * 28 *
29 * AUTHORS: Christos Zoulas <christos@ee.cornell.edu> 29 * AUTHORS: Christos Zoulas <christos@ee.cornell.edu>
30 * Steven Wallace <swallace@freebsd.org> 30 * Steven Wallace <swallace@freebsd.org>
31 * Wolfram Schneider <wosch@cs.tu-berlin.de> 31 * Wolfram Schneider <wosch@cs.tu-berlin.de>
32 * Arne Helme <arne@acm.org> 32 * Arne Helme <arne@acm.org>
33 * Luke Mewburn <lukem@NetBSD.org> 33 * Luke Mewburn <lukem@NetBSD.org>
34 * matthew green <mrg@eterna.com.au> 34 * matthew green <mrg@eterna.com.au>
35 * Simon Burge <simonb@NetBSD.org> 35 * Simon Burge <simonb@NetBSD.org>
36 * Tomas Svensson <ts@unix1.net> 36 * Tomas Svensson <ts@unix1.net>
37 * Andrew Doran <ad@NetBSD.org> 37 * Andrew Doran <ad@NetBSD.org>
38 * 38 *
39 * 39 *
40 * $Id: m_netbsd.c,v 1.13 2010/05/31 03:18:33 rmind Exp $ 40 * $Id: m_netbsd.c,v 1.14 2010/05/31 18:14:59 rmind Exp $
41 */ 41 */
42#include <sys/cdefs.h> 42#include <sys/cdefs.h>
43 43
44#ifndef lint 44#ifndef lint
45__RCSID("$NetBSD: m_netbsd.c,v 1.13 2010/05/31 03:18:33 rmind Exp $"); 45__RCSID("$NetBSD: m_netbsd.c,v 1.14 2010/05/31 18:14:59 rmind Exp $");
46#endif 46#endif
47 47
48#include <sys/param.h> 48#include <sys/param.h>
49#include <sys/sysctl.h> 49#include <sys/sysctl.h>
50#include <sys/sched.h> 50#include <sys/sched.h>
51#include <sys/swap.h> 51#include <sys/swap.h>
52 52
53#include <uvm/uvm_extern.h> 53#include <uvm/uvm_extern.h>
54 54
55#include <err.h> 55#include <err.h>
56#include <errno.h> 56#include <errno.h>
57#include <kvm.h> 57#include <kvm.h>
58#include <math.h> 58#include <math.h>
@@ -832,28 +832,28 @@ format_next_proc(caddr_t handle, char *( @@ -832,28 +832,28 @@ format_next_proc(caddr_t handle, char *(
832 strlcpy(wmesg, pp->p_wmesg, sizeof(wmesg)); 832 strlcpy(wmesg, pp->p_wmesg, sizeof(wmesg));
833 statep = wmesg; 833 statep = wmesg;
834 } else 834 } else
835 statep = state_abbrev[(unsigned)pp->p_stat]; 835 statep = state_abbrev[(unsigned)pp->p_stat];
836 836
837#ifdef KI_NOCPU 837#ifdef KI_NOCPU
838 /* Post-1.5 change: add CPU number if appropriate */ 838 /* Post-1.5 change: add CPU number if appropriate */
839 if (pp->p_cpuid != KI_NOCPU && ncpu > 1) { 839 if (pp->p_cpuid != KI_NOCPU && ncpu > 1) {
840 switch (pp->p_stat) { 840 switch (pp->p_stat) {
841 case LSONPROC: 841 case LSONPROC:
842 case LSRUN: 842 case LSRUN:
843 case LSSLEEP: 843 case LSSLEEP:
844 case LSIDL: 844 case LSIDL:
845 (void)snprintf(state, sizeof(state), "%.6s/%lu",  845 (void)snprintf(state, sizeof(state), "%.6s/%u",
846 statep, pp->p_cpuid); 846 statep, (unsigned int)pp->p_cpuid);
847 statep = state; 847 statep = state;
848 break; 848 break;
849 } 849 }
850 } 850 }
851#endif 851#endif
852 wcpu = 100.0 * weighted_cpu(p_, pct, pp); 852 wcpu = 100.0 * weighted_cpu(p_, pct, pp);
853 cpu = 100.0 * pct; 853 cpu = 100.0 * pct;
854 854
855 /* format this entry */ 855 /* format this entry */
856 sprintf(fmt, 856 sprintf(fmt,
857 Proc_format, 857 Proc_format,
858 pp->p_pid, 858 pp->p_pid,
859 (*userprint)(pp->p_ruid), 859 (*userprint)(pp->p_ruid),
@@ -905,28 +905,28 @@ format_next_lwp(caddr_t handle, char *(* @@ -905,28 +905,28 @@ format_next_lwp(caddr_t handle, char *(*
905 strlcpy(wmesg, pl->l_wmesg, sizeof(wmesg)); 905 strlcpy(wmesg, pl->l_wmesg, sizeof(wmesg));
906 statep = wmesg; 906 statep = wmesg;
907 } else 907 } else
908 statep = state_abbrev[(unsigned)pl->l_stat]; 908 statep = state_abbrev[(unsigned)pl->l_stat];
909 909
910#ifdef KI_NOCPU 910#ifdef KI_NOCPU
911 /* Post-1.5 change: add CPU number if appropriate */ 911 /* Post-1.5 change: add CPU number if appropriate */
912 if (pl->l_cpuid != KI_NOCPU && ncpu > 1) { 912 if (pl->l_cpuid != KI_NOCPU && ncpu > 1) {
913 switch (pl->l_stat) { 913 switch (pl->l_stat) {
914 case LSONPROC: 914 case LSONPROC:
915 case LSRUN: 915 case LSRUN:
916 case LSSLEEP:  916 case LSSLEEP:
917 case LSIDL: 917 case LSIDL:
918 (void)snprintf(state, sizeof(state), "%.6s/%lu",  918 (void)snprintf(state, sizeof(state), "%.6s/%u",
919 statep, pl->l_cpuid); 919 statep, (unsigned int)pl->l_cpuid);
920 statep = state; 920 statep = state;
921 break; 921 break;
922 } 922 }
923 } 923 }
924#endif 924#endif
925 925
926 if (pl->l_name[0] == '\0') { 926 if (pl->l_name[0] == '\0') {
927 pl->l_name[0] = '-'; 927 pl->l_name[0] = '-';
928 pl->l_name[1] = '\0'; 928 pl->l_name[1] = '\0';
929 } 929 }
930 930
931 /* format this entry */ 931 /* format this entry */
932 sprintf(fmt, 932 sprintf(fmt,