From aledm@ns.wcom.co.uk  Tue Oct  6 05:56:23 1998
Received: from ns.wcom.co.uk (ns.wcom.co.uk [194.203.119.46])
          by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id FAA11542
          for <FreeBSD-gnats-submit@freebsd.org>; Tue, 6 Oct 1998 05:56:22 -0700 (PDT)
          (envelope-from aledm@ns.wcom.co.uk)
Received: (from aledm@localhost)
	by ns.wcom.co.uk (8.8.8/8.8.8) id NAA23400;
	Tue, 6 Oct 1998 13:56:09 +0100 (BST)
	(envelope-from aledm)
Message-Id: <199810061256.NAA23400@ns.wcom.co.uk>
Date: Tue, 6 Oct 1998 13:56:09 +0100 (BST)
From: aledm@routers.co.uk
Reply-To: aledm@routers.co.uk
To: FreeBSD-gnats-submit@freebsd.org
Subject: minor inconsistency in dirent.h
X-Send-Pr-Version: 3.2

>Number:         8165
>Category:       kern
>Synopsis:       sys/dirent.h has duplicate constant from sys/syslimits.h
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct  6 06:00:01 PDT 1998
>Closed-Date:    Sat Jan 23 09:38:39 PST 1999
>Last-Modified:  Sat Jan 23 09:39:56 PST 1999
>Originator:     Aled Morris
>Release:        FreeBSD 3.0-980309-SNAP i386
>Organization:
Routers Ltd.
>Environment:

kernel include files

>Description:

sys/dirent.h has a definition of MAXNAMLEN as follows:

#define MAXNAMLEN       255

This should be the same as NAME_MAX from sys/syslimits.h:

#define NAME_MAX                  255   /* max bytes in a file name */

These should be synchronised in the same way that MAXPATHLEN in sys/param.h
is fixed to PATH_MAX from sys/syslimits.h

>How-To-Repeat:

by inspection

>Fix:
	
to sys/dirent.h add #include <sys/syslimits.h>
and change "#define MAXNAMLEN 255" to "#define MAXNAMLEN NAME_MAX"
>Release-Note:
>Audit-Trail:

From: Bruce Evans <bde@zeta.org.au>
To: aledm@routers.co.uk, FreeBSD-gnats-submit@FreeBSD.ORG
Cc:  Subject: Re: kern/8165: minor inconsistency in dirent.h
Date: Wed, 7 Oct 1998 13:26:42 +1000

 >These should be synchronised in the same way that MAXPATHLEN in sys/param.h
 >is fixed to PATH_MAX from sys/syslimits.h
 >
 >>How-To-Repeat:
 >
 >by inspection
 >
 >>Fix:
 >	
 >to sys/dirent.h add #include <sys/syslimits.h>
 >and change "#define MAXNAMLEN 255" to "#define MAXNAMLEN NAME_MAX"
 
 This would pollute <dirent.h> some more and is not permitted in the
 _POSIX_SOURCE case.
 
 Bruce

From: Aled Morris <aledm@routers.co.uk>
To: Bruce Evans <bde@zeta.org.au>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: kern/8165: minor inconsistency in dirent.h
Date: Wed, 7 Oct 1998 23:17:53 +0100 (BST)

 On Wed, 7 Oct 1998, Bruce Evans wrote:
 
 >>>Fix:
 >>	
 >>to sys/dirent.h add #include <sys/syslimits.h>
 >>and change "#define MAXNAMLEN 255" to "#define MAXNAMLEN NAME_MAX"
 >
 >This would pollute <dirent.h> some more and is not permitted in the
 >_POSIX_SOURCE case.
 
 I understand what you're saying, but do you agree that having the same
 constant (i.e. constants with the same meaning) being defined in two
 places is bad?
 
 Aled
 -- 
 tel +44 973 207987
 

From: Bruce Evans <bde@zeta.org.au>
To: aledm@routers.co.uk, bde@zeta.org.au
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: kern/8165: minor inconsistency in dirent.h
Date: Thu, 8 Oct 1998 13:23:04 +1000

 >I understand what you're saying, but do you agree that having the same
 >constant (i.e. constants with the same meaning) being defined in two
 >places is bad?
 
 It's no worse than the same types being defined in several headers, as
 they must be to limit namespace pollution.  size_t is a good example.
 The right technique for this is to define them in terms of a commin
 definition in an implementation-only header like <machine/ansi.h>.
 
 A closer look shows that MAXNAMLEN is not the same as NAME_MAX.
 They just happen to have the same value.  NAME_MAX (if it is defined)
 is supposed to give the maximum length of a file name - file names
 of this length (but no longer) may exist on all (POSIX) file systems.
 MAXNAMLEN in <sys/dirent.h> is just the maximum length of a file name
 that may be returned by readdir().  It should be defined as the maximum
 of all the per-file-system maximum name lengths, but that is too hard
 to put in a single #define.
 
 Bruce
State-Changed-From-To: open->closed 
State-Changed-By: rnordier 
State-Changed-When: Sat Jan 23 09:38:39 PST 1999 
State-Changed-Why:  
A decision was made not to make the suggested change, and the originator 
was informed some time ago. 
>Unformatted:
