bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PATH_MAX and test-stat.h


From: Eric Blake
Subject: Re: PATH_MAX and test-stat.h
Date: Mon, 20 Jun 2011 15:28:54 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.10

On 06/20/2011 03:21 PM, Bruno Haible wrote:
> Eric Blake wrote:
>> POSIX states that PATH_MAX, if defined, must be a compile-time constant.
> 
> Please, where does it say this? I cannot find this statement in
> <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html>.

[Line numbers from the .pdf]

2561 3.372 Symbolic Constant
2562 An object-like macro defined with a constant value.
2563 Unless stated otherwise, the following shall apply to every
symbolic constant:
2564 • It expands to a compile-time constant expression with an integer
type.
2565 • It may be defined as another type of constant—e.g., an
enumeration constant—as well as
2566            being a macro.
2567 • It need not be usable in #if preprocessing directives.

...

8908 Pathname Variable Values
8909 The values in the following list may be constants within an
implementation or may vary from
8910 one pathname to another. For example, file systems or directories
may have different
8911 characteristics.

8912 A definition of one of the symbolic constants in the following list
shall be omitted from the
8913 <limits.h> header on specific implementations where the
corresponding value is equal to or
8914 greater than the stated minimum, but where the value can vary
depending on the file to which it
8915 is applied. The actual value supported for a specific pathname
shall be provided by the
8916 pathconf( ) function.

...

8936 {PATH_MAX}
8937 Maximum number of bytes the implementation will store as a pathname
in a user-supplied
8938 buffer of unspecified size, including the terminating null
character. Minimum number the
8939 implementation will accept as the maximum number of bytes in a
pathname.

A runtime-variable PATH_MAX (where fpathconf() gives different values
depending on the path, or where it is truly unlimited as in Hurd)
therefore implies that <limits.h> must not declare PATH_MAX, because the
set of Pathname Variables declared in <limits.h> must be symbolic constants.

-- 
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]