Thread View: comp.std.unix
4 messages
4 total messages
Started by Steve Emmerson
Fri, 05 Apr 1991 17:49
FILENAME_MAX & _POSIX_PATH_MAX relationship?
Author: Steve Emmerson
Date: Fri, 05 Apr 1991 17:49
Date: Fri, 05 Apr 1991 17:49
18 lines
1149 bytes
1149 bytes
Submitted-by: steve@unidata.ucar.edu (Steve Emmerson) Hi, Would someone who knows please tell me the relationship between the Standard C macro FILENAME_MAX and the POSIX macro _POSIX_PATH_MAX. In particular, should they be the same, or should FILENAME_MAX correspond instead to _POSIX_NAME_MAX. I ask because HP-UX has FILENAME_MAX set to 14 and we think this is wrong. Thanks in advance, Steve Emmerson steve@unidata.ucar.edu ...!ncar!unidata!steve Volume-Number: Volume 23, Number 24
Re: FILENAME_MAX & _POSIX_PATH_MAX relationship?
Author: David A Willcox
Date: Mon, 08 Apr 1991 14:18
Date: Mon, 08 Apr 1991 14:18
34 lines
2057 bytes
2057 bytes
Submitted-by: willcox@urbana.mcd.mot.com (David A Willcox)
>Would someone who knows please tell me the relationship between the
>Standard C macro FILENAME_MAX and the POSIX macro _POSIX_PATH_MAX.
Since FILENAME_MAX is the longest possible filename string that can be
passed to fopen() and the like, it should be a value no smaller than
the largest possible value for PATH_MAX on your system. It mustn't
ever be smaller than _POSIX_PATH_MAX, and would only be that small on
an implementation that only supported the minimum value for PATH_MAX
required by POSIX.
To quote from the C standard, FILENAME_MAX:
... expands to an integral constant expression that is the size needed
for an array of char large enough to hold the longest file name
string that the implementation guarantees can be opened. [There's
a footnote saying that this doesn't mean that just any string this
long is a valid file name.]
Since the C standard does not have any concept of directories, "file
name" in this context clearly corresponds to a POSIX path, not an
individual file name.
(Standard disclaimer stuff. Motorola and POSIX disavow all knowledge of
my actions.)
David A. Willcox "Just say 'NO' to universal drug testing"
Motorola MCD - Urbana UUCP: ...!uiucuxc!udc!willcox
1101 E. University Ave. INET: willcox@urbana.mcd.mot.com
Urbana, IL 61801 FONE: 217-384-8534
Volume-Number: Volume 23, Number 25
Re: FILENAME_MAX & _POSIX_PATH_MAX relationship?
Author: Chuck Karish
Date: Tue, 09 Apr 1991 23:46
Date: Tue, 09 Apr 1991 23:46
19 lines
1356 bytes
1356 bytes
Submitted-by: karish@mindcraft.com (Chuck Karish) In article <127638@uunet.UU.NET> steve@unidata.ucar.edu (Steve Emmerson) writes: >Would someone who knows please tell me the relationship between the >Standard C macro FILENAME_MAX and the POSIX macro _POSIX_PATH_MAX. > >In particular, should they be the same, or should FILENAME_MAX >correspond instead to _POSIX_NAME_MAX. _POSIX_PATH_MAX is more appropriate. Standard C has no notion of a path prefix. Clause 4.9.1 of both the Standard and its rationale tells us that a buffer of FILENAME_MAX characters should hold the entire file name (what POSIX.1 would term the 'path'). Chuck Karish karish@mindcraft.com Mindcraft, Inc. (415) 323-9000 Volume-Number: Volume 23, Number 26
Re: FILENAME_MAX & _POSIX_PATH_MAX relationship?
Author: David A Willcox
Date: Thu, 11 Apr 1991 13:15
Date: Thu, 11 Apr 1991 13:15
23 lines
1697 bytes
1697 bytes
Submitted-by: willcox@urbana.mcd.mot.com (David A Willcox) >>Would someone who knows please tell me the relationship between the >>Standard C macro FILENAME_MAX and the POSIX macro _POSIX_PATH_MAX. >_POSIX_PATH_MAX is more appropriate. Standard C has no notion of a >path prefix. Clause 4.9.1 of both the Standard and its rationale >tells us that a buffer of FILENAME_MAX characters should hold >the entire file name (what POSIX.1 would term the 'path'). _POSIX_PATH_MAX is probably not the correct value, unless your implementation never supports anything larger than the minimum required by POSIX. PATH_MAX would be better, if it's defined on your implementation (implying that you don't need to call pathconf() to get a path-specific value). If PATH_MAX isn't defined, then FILENAME_MAX must be no smaller than the largest value you can get from pathconf(_PC_PATH_MAX,...). David A. Willcox "Just say 'NO' to universal drug testing" [ Standards are such lovely things... -mod ] Volume-Number: Volume 23, Number 28
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads