From nobody@FreeBSD.org  Mon Mar 19 08:03:18 2001
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id 1771A37B718
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 19 Mar 2001 08:03:18 -0800 (PST)
	(envelope-from nobody@FreeBSD.org)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.1/8.11.1) id f2JG3IR48370;
	Mon, 19 Mar 2001 08:03:18 -0800 (PST)
	(envelope-from nobody)
Message-Id: <200103191603.f2JG3IR48370@freefall.freebsd.org>
Date: Mon, 19 Mar 2001 08:03:18 -0800 (PST)
From: jimz@panasas.com
To: freebsd-gnats-submit@FreeBSD.org
Subject: vm_map.h defines a macro called "min_offset" that creates problems with similarly-named variables
X-Send-Pr-Version: www-1.0

>Number:         25923
>Category:       kern
>Synopsis:       vm_map.h defines a macro called "min_offset" that creates problems with similarly-named variables
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 19 08:10:00 PST 2001
>Closed-Date:    Sun Aug 25 20:29:12 PDT 2002
>Last-Modified:  Sun Aug 25 20:29:12 PDT 2002
>Originator:     Jim Zelenka
>Release:        4.1.1-RELEASE
>Organization:
Panasas, Inc
>Environment:
FreeBSD nagano.panasas.com 4.1.1-RELEASE FreeBSD 4.1.1-RELEASE #0: Thu Mar  8 12:49:16 EST 2001     root@nagano.panasas.com:/usr/src/sys/compile/NAGANO-HZ  i386

>Description:
/usr/src/sys/vm/vm_map.h contains the following line of code:
   #define       min_offset              header.start

This causes problems for code using a variable named min_offset. At best,
it fails to compile. At worst, the code contains a structure named
header with a field named start, and this creates a very mysterious
memory-corruption bug.

>How-To-Repeat:
Include vm_map.h in a file using a local variable named min_offset

>Fix:
"A whole lot of query-replace" :-)

>Release-Note:
>Audit-Trail:

From: Bruce Evans <bde@zeta.org.au>
To: jimz@panasas.com
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: kern/25923: vm_map.h defines a macro called "min_offset" that
 creates problems with similarly-named variables
Date: Tue, 20 Mar 2001 12:47:44 +1100 (EST)

 On Mon, 19 Mar 2001 jimz@panasas.com wrote:
 
 > >How-To-Repeat:
 > Include vm_map.h in a file using a local variable named min_offset
 > 
 > >Fix:
 > "A whole lot of query-replace" :-)
 
 I think the fix is "Don't include vm_map.h in a file using a local
 variable named min_offset".  There are are thousands of other instances
 of undocumented namespace pollution in FreeBSD headers.  min_offset
 is one of the least important since it is in a "kernel-only" header.
 (vm_map.h is not quite kernel-only, but probably should be.  It is
 needed only in programs like top and fstat that know too much about
 kernel internals.)
 
 Bruce
 
State-Changed-From-To: open->feedback 
State-Changed-By: iedowse 
State-Changed-When: Sun Dec 2 14:20:53 PST 2001 
State-Changed-Why:  

Is Bruce's suggestion ("Don't include vm_map.h in a file using a 
local variable named min_offset") acceptible to you? 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=25923 
State-Changed-From-To: feedback->closed 
State-Changed-By: keramida 
State-Changed-When: Sun Aug 25 20:29:02 PDT 2002 
State-Changed-Why:  
Feedback timeout. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=25923 
>Unformatted:
