Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Jul 2000 01:16:40 -0700 (PDT)
From:      Kelly Yancey <kbyanc@posi.net>
To:        gnats-admin@FreeBSD.org, freebsd-bugs@FreeBSD.org
Subject:   Re: kern/19720: more sysctl signed-ness patches
Message-ID:  <Pine.BSF.4.21.0007060104380.18756-100000@gateway.posi.net>
In-Reply-To: <200007060020.RAA06490@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

  Per feedback from Bruce, here are some updated patches...

Index: alpha/alpha/machdep.c
===================================================================
RCS file: /home/cvs/src/sys/alpha/alpha/machdep.c,v
retrieving revision 1.86
diff -u -r1.86 machdep.c
--- alpha/alpha/machdep.c	2000/07/04 11:24:59	1.86
+++ alpha/alpha/machdep.c	2000/07/06 07:26:23
@@ -186,14 +186,15 @@
 
 struct msgbuf *msgbufp=0;
 
-int bootverbose = 0, Maxmem = 0;
+int bootverbose = 0;
+size_t Maxmem = 0;
 long dumplo;
 
-int	totalphysmem;		/* total amount of physical memory in system */
-int	physmem;		/* physical memory used by NetBSD + some rsvd */
-int	resvmem;		/* amount of memory reserved for PROM */
-int	unusedmem;		/* amount of memory for OS that we don't use */
-int	unknownmem;		/* amount of memory with an unknown use */
+size_t	totalphysmem;		/* total amount of physical memory in system */
+size_t	physmem;		/* physical memory used by NetBSD + some rsvd */
+size_t	resvmem;		/* amount of memory reserved for PROM */
+size_t	unusedmem;		/* amount of memory for OS that we don't use */
+size_t	unknownmem;		/* amount of memory with an unknown use */
 int	ncpus;			/* number of cpus */
 
 vm_offset_t phys_avail[10];
@@ -206,7 +207,7 @@
 }
 
 SYSCTL_PROC(_hw, HW_PHYSMEM, physmem, CTLTYPE_INT|CTLFLAG_RD,
-	0, 0, sysctl_hw_physmem, "I", "");
+	0, 0, sysctl_hw_physmem, "IU", "");
 
 static int
 sysctl_hw_usermem(SYSCTL_HANDLER_ARGS)
@@ -219,7 +220,7 @@
 SYSCTL_PROC(_hw, HW_USERMEM, usermem, CTLTYPE_INT|CTLFLAG_RD,
 	0, 0, sysctl_hw_usermem, "I", "");
 
-SYSCTL_INT(_hw, OID_AUTO, availpages, CTLFLAG_RD, &physmem, 0, "");
+SYSCTL_UINT(_hw, OID_AUTO, availpages, CTLFLAG_RD, &physmem, 0, "");
 
 /* must be 2 less so 0 0 can signal end of chunks */
 #define PHYS_AVAIL_ARRAY_END ((sizeof(phys_avail) / sizeof(vm_offset_t)) - 2)
@@ -267,7 +268,7 @@
 #ifdef PERFMON
 	perfmon_init();
 #endif
-	printf("real memory  = %ld (%ldK bytes)\n", alpha_ptob(Maxmem), alpha_ptob(Maxmem) / 1024);
+	printf("real memory  = %lu (%luK bytes)\n", alpha_ptob(Maxmem), alpha_ptob(Maxmem) / 1024);
 
 	/*
 	 * Display any holes after the first chunk of extended memory.
Index: alpha/alpha/vm_machdep.c
===================================================================
RCS file: /home/cvs/src/sys/alpha/alpha/vm_machdep.c,v
retrieving revision 1.32
diff -u -r1.32 vm_machdep.c
--- alpha/alpha/vm_machdep.c	2000/06/19 18:41:27	1.32
+++ alpha/alpha/vm_machdep.c	2000/07/05 20:45:22
@@ -381,9 +381,9 @@
 }
 
 
-static int cnt_prezero;
+static u_int cnt_prezero;
 
-SYSCTL_INT(_machdep, OID_AUTO, cnt_prezero, CTLFLAG_RD, &cnt_prezero, 0, "");
+SYSCTL_UINT(_machdep, OID_AUTO, cnt_prezero, CTLFLAG_RD, &cnt_prezero, 0, "");
 
 /*
  * Implement the pre-zeroed page mechanism.
Index: i386/i386/machdep.c
===================================================================
RCS file: /home/cvs/src/sys/i386/i386/machdep.c,v
retrieving revision 1.398
diff -u -r1.398 machdep.c
--- i386/i386/machdep.c	2000/07/04 11:25:17	1.398
+++ i386/i386/machdep.c	2000/07/06 07:27:01
@@ -150,7 +150,7 @@
 #endif
 SYSCTL_INT(_machdep, OID_AUTO, ispc98, CTLFLAG_RD, &ispc98, 0, "");
 
-int physmem = 0;
+size_t physmem = 0;
 int cold = 1;
 
 static void osendsig __P((sig_t catcher, int sig, sigset_t *mask, u_long code));
@@ -163,7 +163,7 @@
 }
 
 SYSCTL_PROC(_hw, HW_PHYSMEM, physmem, CTLTYPE_INT|CTLFLAG_RD,
-	0, 0, sysctl_hw_physmem, "I", "");
+	0, 0, sysctl_hw_physmem, "IU", "");
 
 static int
 sysctl_hw_usermem(SYSCTL_HANDLER_ARGS)
@@ -174,7 +174,7 @@
 }
 
 SYSCTL_PROC(_hw, HW_USERMEM, usermem, CTLTYPE_INT|CTLFLAG_RD,
-	0, 0, sysctl_hw_usermem, "I", "");
+	0, 0, sysctl_hw_usermem, "IU", "");
 
 static int
 sysctl_hw_availpages(SYSCTL_HANDLER_ARGS)
Index: i386/i386/vm_machdep.c
===================================================================
RCS file: /home/cvs/src/sys/i386/i386/vm_machdep.c,v
retrieving revision 1.136
diff -u -r1.136 vm_machdep.c
--- i386/i386/vm_machdep.c	2000/06/10 02:05:57	1.136
+++ i386/i386/vm_machdep.c	2000/07/05 20:45:06
@@ -533,9 +533,9 @@
 
 SYSCTL_DECL(_vm_stats_misc);
 
-static int cnt_prezero;
+static u_int cnt_prezero;
 
-SYSCTL_INT(_vm_stats_misc, OID_AUTO,
+SYSCTL_UINT(_vm_stats_misc, OID_AUTO,
 	cnt_prezero, CTLFLAG_RD, &cnt_prezero, 0, "");
 
 /*
Index: kern/init_main.c
===================================================================
RCS file: /home/cvs/src/sys/kern/init_main.c,v
retrieving revision 1.136
diff -u -r1.136 init_main.c
--- kern/init_main.c	2000/06/25 10:14:06	1.136
+++ kern/init_main.c	2000/07/05 22:54:01
@@ -91,8 +91,8 @@
 extern	struct user *proc0paddr;
 
 struct	vnode *rootvp;
-int	boothowto = 0;		/* initialized so that it can be patched */
-SYSCTL_INT(_debug, OID_AUTO, boothowto, CTLFLAG_RD, &boothowto, 0, "");
+u_int	boothowto = 0;		/* initialized so that it can be patched */
+SYSCTL_UINT(_debug, OID_AUTO, boothowto, CTLFLAG_RD, &boothowto, 0, "");
 
 /*
  * Promiscuous argument pass for start_init()
Index: kern/kern_mib.c
===================================================================
RCS file: /home/cvs/src/sys/kern/kern_mib.c,v
retrieving revision 1.37
diff -u -r1.37 kern_mib.c
--- kern/kern_mib.c	2000/07/04 11:25:22	1.37
+++ kern/kern_mib.c	2000/07/05 20:50:20
@@ -187,8 +187,7 @@
     &domainname, sizeof(domainname), "Name of the current YP/NIS domain");
 
 long hostid;
-/* Some trouble here, if sizeof (int) != sizeof (long) */
-SYSCTL_INT(_kern, KERN_HOSTID, hostid, CTLFLAG_RW, &hostid, 0, "Host ID");
+SYSCTL_LONG(_kern, KERN_HOSTID, hostid, CTLFLAG_RW, &hostid, 0, "Host ID");
 
 /*
  * This is really cheating.  These actually live in the libc, something
Index: kern/kern_tc.c
===================================================================
RCS file: /home/cvs/src/sys/kern/kern_tc.c,v
retrieving revision 1.108
diff -u -r1.108 kern_tc.c
--- kern/kern_tc.c	2000/07/04 11:25:23	1.108
+++ kern/kern_tc.c	2000/07/05 20:52:19
@@ -49,14 +49,14 @@
 static unsigned nnanouptime;
 static unsigned ngetmicrouptime;
 static unsigned ngetnanouptime;
-SYSCTL_INT(_kern_timecounter, OID_AUTO, nmicrotime, CTLFLAG_RD, &nmicrotime, 0, "");
-SYSCTL_INT(_kern_timecounter, OID_AUTO, nnanotime, CTLFLAG_RD, &nnanotime, 0, "");
-SYSCTL_INT(_kern_timecounter, OID_AUTO, nmicrouptime, CTLFLAG_RD, &nmicrouptime, 0, "");
-SYSCTL_INT(_kern_timecounter, OID_AUTO, nnanouptime, CTLFLAG_RD, &nnanouptime, 0, "");
-SYSCTL_INT(_kern_timecounter, OID_AUTO, ngetmicrotime, CTLFLAG_RD, &ngetmicrotime, 0, "");
-SYSCTL_INT(_kern_timecounter, OID_AUTO, ngetnanotime, CTLFLAG_RD, &ngetnanotime, 0, "");
-SYSCTL_INT(_kern_timecounter, OID_AUTO, ngetmicrouptime, CTLFLAG_RD, &ngetmicrouptime, 0, "");
-SYSCTL_INT(_kern_timecounter, OID_AUTO, ngetnanouptime, CTLFLAG_RD, &ngetnanouptime, 0, "");
+SYSCTL_UINT(_kern_timecounter, OID_AUTO, nmicrotime, CTLFLAG_RD, &nmicrotime, 0, "");
+SYSCTL_UINT(_kern_timecounter, OID_AUTO, nnanotime, CTLFLAG_RD, &nnanotime, 0, "");
+SYSCTL_UINT(_kern_timecounter, OID_AUTO, nmicrouptime, CTLFLAG_RD, &nmicrouptime, 0, "");
+SYSCTL_UINT(_kern_timecounter, OID_AUTO, nnanouptime, CTLFLAG_RD, &nnanouptime, 0, "");
+SYSCTL_UINT(_kern_timecounter, OID_AUTO, ngetmicrotime, CTLFLAG_RD, &ngetmicrotime, 0, "");
+SYSCTL_UINT(_kern_timecounter, OID_AUTO, ngetnanotime, CTLFLAG_RD, &ngetnanotime, 0, "");
+SYSCTL_UINT(_kern_timecounter, OID_AUTO, ngetmicrouptime, CTLFLAG_RD, &ngetmicrouptime, 0, "");
+SYSCTL_UINT(_kern_timecounter, OID_AUTO, ngetnanouptime, CTLFLAG_RD, &ngetnanouptime, 0, "");
 
 /*
  * Implement a dummy timecounter which we can use until we get a real one
Index: kern/subr_kobj.c
===================================================================
RCS file: /home/cvs/src/sys/kern/subr_kobj.c,v
retrieving revision 1.2
diff -u -r1.2 subr_kobj.c
--- kern/subr_kobj.c	2000/05/01 10:45:15	1.2
+++ kern/subr_kobj.c	2000/07/05 20:56:49
@@ -47,12 +47,12 @@
 
 #include <sys/sysctl.h>
 
-int kobj_lookup_hits;
-int kobj_lookup_misses;
+u_int kobj_lookup_hits;
+u_int kobj_lookup_misses;
 
-SYSCTL_INT(_kern, OID_AUTO, kobj_hits, CTLFLAG_RD,
+SYSCTL_UINT(_kern, OID_AUTO, kobj_hits, CTLFLAG_RD,
 	   &kobj_lookup_hits, 0, "")
-SYSCTL_INT(_kern, OID_AUTO, kobj_misses, CTLFLAG_RD,
+SYSCTL_UINT(_kern, OID_AUTO, kobj_misses, CTLFLAG_RD,
 	   &kobj_lookup_misses, 0, "")
 
 #endif
Index: kern/sys_generic.c
===================================================================
RCS file: /home/cvs/src/sys/kern/sys_generic.c,v
retrieving revision 1.58
diff -u -r1.58 sys_generic.c
--- kern/sys_generic.c	2000/07/02 08:08:00	1.58
+++ kern/sys_generic.c	2000/07/05 20:57:59
@@ -603,9 +603,9 @@
 	return (error);
 }
 
-static int	nselcoll;	/* Select collisions since boot */
-int	selwait;
-SYSCTL_INT(_kern, OID_AUTO, nselcoll, CTLFLAG_RD, &nselcoll, 0, "");
+static u_int	nselcoll;	/* Select collisions since boot */
+u_int	selwait;
+SYSCTL_UINT(_kern, OID_AUTO, nselcoll, CTLFLAG_RD, &nselcoll, 0, "");
 
 /*
  * Select system call.
Index: kern/vfs_subr.c
===================================================================
RCS file: /home/cvs/src/sys/kern/vfs_subr.c,v
retrieving revision 1.264
diff -u -r1.264 vfs_subr.c
--- kern/vfs_subr.c	2000/07/04 11:25:23	1.264
+++ kern/vfs_subr.c	2000/07/05 23:46:01
@@ -138,6 +138,7 @@
 static int syncer_maxdelay = SYNCER_MAXDELAY;	/* maximum delay time */
 time_t syncdelay = 30;		/* max time to delay syncing data */
 time_t filedelay = 30;		/* time to delay syncing files */
+/* XXX time_t != int on all architectures. */
 SYSCTL_INT(_kern, OID_AUTO, filedelay, CTLFLAG_RW, &filedelay, 0, "");
 time_t dirdelay = 29;		/* time to delay syncing directories */
 SYSCTL_INT(_kern, OID_AUTO, dirdelay, CTLFLAG_RW, &dirdelay, 0, "");
Index: pc98/i386/machdep.c
===================================================================
RCS file: /home/cvs/src/sys/pc98/i386/machdep.c,v
retrieving revision 1.166
diff -u -r1.166 machdep.c
--- pc98/i386/machdep.c	2000/07/04 11:25:33	1.166
+++ pc98/i386/machdep.c	2000/07/05 23:28:07
@@ -160,7 +160,7 @@
 #endif
 SYSCTL_INT(_machdep, OID_AUTO, ispc98, CTLFLAG_RD, &ispc98, 0, "");
 
-int physmem = 0;
+u_int physmem = 0;
 int cold = 1;
 
 static void osendsig __P((sig_t catcher, int sig, sigset_t *mask, u_long code));
@@ -173,7 +173,7 @@
 }
 
 SYSCTL_PROC(_hw, HW_PHYSMEM, physmem, CTLTYPE_INT|CTLFLAG_RD,
-	0, 0, sysctl_hw_physmem, "I", "");
+	0, 0, sysctl_hw_physmem, "IU", "");
 
 static int
 sysctl_hw_usermem(SYSCTL_HANDLER_ARGS)
@@ -184,7 +184,7 @@
 }
 
 SYSCTL_PROC(_hw, HW_USERMEM, usermem, CTLTYPE_INT|CTLFLAG_RD,
-	0, 0, sysctl_hw_usermem, "I", "");
+	0, 0, sysctl_hw_usermem, "IU", "");
 
 static int
 sysctl_hw_availpages(SYSCTL_HANDLER_ARGS)
Index: sys/kobj.h
===================================================================
RCS file: /home/cvs/src/sys/sys/kobj.h,v
retrieving revision 1.4
diff -u -r1.4 kobj.h
--- sys/kobj.h	2000/05/11 17:10:22	1.4
+++ sys/kobj.h	2000/07/05 20:54:51
@@ -130,8 +130,8 @@
  * Maintain stats on hits/misses in lookup caches.
  */
 #ifdef KOBJ_STATS
-extern int kobj_lookup_hits;
-extern int kobj_lookup_misses;
+extern u_int kobj_lookup_hits;
+extern u_int kobj_lookup_misses;
 #define KOBJOPHIT	do { kobj_lookup_hits++; } while (0)
 #define KOBJOPMISS	do { kobj_lookup_misses++; } while (0)
 #else
Index: sys/sysctl.h
===================================================================
RCS file: /home/cvs/src/sys/sys/sysctl.h,v
retrieving revision 1.86
diff -u -r1.86 sysctl.h
--- sys/sysctl.h	2000/07/05 07:46:41	1.86
+++ sys/sysctl.h	2000/07/06 07:40:00
@@ -349,8 +349,8 @@
 #define	HW_MODEL	 2		/* string: specific machine model */
 #define	HW_NCPU		 3		/* int: number of cpus */
 #define	HW_BYTEORDER	 4		/* int: machine byte order */
-#define	HW_PHYSMEM	 5		/* int: total memory */
-#define	HW_USERMEM	 6		/* int: non-kernel memory */
+#define	HW_PHYSMEM	 5		/* uint: total memory */
+#define	HW_USERMEM	 6		/* uint: non-kernel memory */
 #define	HW_PAGESIZE	 7		/* int: software page size */
 #define	HW_DISKNAMES	 8		/* strings: disk drive names */
 #define	HW_DISKSTATS	 9		/* struct: diskstats[] */
Index: sys/systm.h
===================================================================
RCS file: /home/cvs/src/sys/sys/systm.h,v
retrieving revision 1.116
diff -u -r1.116 systm.h
--- sys/systm.h	2000/06/05 18:30:55	1.116
+++ sys/systm.h	2000/07/06 07:27:55
@@ -56,11 +56,11 @@
 
 extern int nswap;		/* size of swap space */
 
-extern int selwait;		/* select timeout address */
+extern u_int selwait;		/* select timeout address */
 
 extern u_char curpriority;	/* priority of current process */
 
-extern int physmem;		/* physical memory */
+extern size_t physmem;		/* physical memory */
 
 extern dev_t dumpdev;		/* dump device */
 extern long dumplo;		/* offset into dumpdev */
@@ -70,7 +70,7 @@
 extern char *rootdevnames[2];	/* names of possible root devices */
 extern struct vnode *rootvp;	/* vnode equivalent to above */
 
-extern int boothowto;		/* reboot flags, from console subsystem */
+extern u_int boothowto;		/* reboot flags, from console subsystem */
 extern int bootverbose;		/* nonzero to print verbose messages */
 
 #ifdef	INVARIANTS		/* The option is always available */
Index: vm/vm_meter.c
===================================================================
RCS file: /home/cvs/src/sys/vm/vm_meter.c,v
retrieving revision 1.39
diff -u -r1.39 vm_meter.c
--- vm/vm_meter.c	2000/07/05 07:46:41	1.39
+++ vm/vm_meter.c	2000/07/05 20:19:52
@@ -309,7 +309,7 @@
 	v_pageout_free_min, CTLFLAG_RD, &cnt.v_pageout_free_min, 0, "");
 SYSCTL_UINT(_vm_stats_vm, OID_AUTO,
 	v_interrupt_free_min, CTLFLAG_RD, &cnt.v_interrupt_free_min, 0, "");
-SYSCTL_INT(_vm_stats_misc, OID_AUTO,
+SYSCTL_UINT(_vm_stats_misc, OID_AUTO,
 	zero_page_count, CTLFLAG_RD, &vm_page_zero_count, 0, "");
 #if 0
 SYSCTL_INT(_vm_stats_misc, OID_AUTO,



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0007060104380.18756-100000>