Subject: kern/30408: compat/irix uses "bufpages" in dubious context
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Martin Husemann <martin@duskware.de>
List: netbsd-bugs
Date: 06/02/2005 20:47:00
>Number:         30408
>Category:       kern
>Synopsis:       compat/irix uses "bufpages" in dubious context
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jun 02 20:47:00 +0000 2005
>Originator:     Martin Husemann
>Release:        NetBSD 3.99.3
>Organization:
>Environment:
System: NetBSD night-porter.duskware.de 3.99.3 NetBSD 3.99.3 (PORTER) #5: Fri May 20 12:54:13 CEST 2005 martin@night-porter.duskware.de:/usr/src/sys/arch/i386/compile/PORTER i386
Architecture: i386
Machine: i386
>Description:

The irix compat stuff uses the variable bufpages, which usualy is 0 nowadays.
The returned structure member "bufmem" is marked "not usefull" in sgi docs,
but maybe we should return something meaningfull here anyway.

>How-To-Repeat:
Code inspection

>Fix:
We could return bufmem/PAGE_SIZE, or the file cache pages, as in this patch

Index: irix_sysmp.c
===================================================================
RCS file: /cvsroot/src/sys/compat/irix/irix_sysmp.c,v
retrieving revision 1.13
diff -c -u -r1.13 irix_sysmp.c
--- irix_sysmp.c	2 Jun 2005 20:14:55 -0000	1.13
+++ irix_sysmp.c	2 Jun 2005 20:40:43 -0000
@@ -184,7 +184,6 @@
 	char *buf;
 	size_t len;
 {
-	extern u_int bufpages;
 	void *kbuf;
 	int error = 0;
 
@@ -200,7 +199,7 @@
 		    + uvmexp.wired + (uvmexp.swpages - uvmexp.swpgonly);
 		irm->availrmem = uvmexp.free + uvmexp.active + uvmexp.inactive
 		    + uvmexp.wired;
-		irm->bufmem = bufpages;
+		irm->bufmem = uvmexp.filepages;
 		irm->physmem = uvmexp.npages;
 		irm->dchunkpages = 0; /* unsupported */
 		irm->pmapmem = 0;     /* unsupported */