Re: PATH_MAX true POSIX size?
From: Heiner Steven (heiner.steven_at_nexgo.de)
Date: 01/29/05
- Next message: Heny Townsend: "Re: PATH_MAX true POSIX size?"
- Previous message: Richard B. Gilbert: "Re: Thinking about upgrading to Solaris 10"
- In reply to: Heny Townsend: "PATH_MAX true POSIX size?"
- Next in thread: Heny Townsend: "Re: PATH_MAX true POSIX size?"
- Reply: Heny Townsend: "Re: PATH_MAX true POSIX size?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 29 Jan 2005 01:58:55 +0100
Heny Townsend wrote:
> I notice that PATH_MAX on Solaris is at (2**n - 1):
>
> % getconf -a | grep PATH_MAX
> PATH_MAX: 1023
> _POSIX_PATH_MAX: 255
I tried this with Solaris 8, and could not verify your results:
$ getconf -a | grep PATH_MAX
PATH_MAX: 1024
_POSIX_PATH_MAX: 255
> Whereas on Linux and FreeBSD it's the full round number (256/1024 on
> FreeBSD, 256/4096 on Linux). Did somebody read POSIX wrong? Or is it a
> case where POSIX is unclear and Sun decided to be pessimistic while the
> freebies were optimistic? Or maybe Solaris is counting on the fact that
> a request for 1023 bytes will generally be padded to 1024, thus allowing
> a "hidden" spot for the null byte and avoiding programmer off-by-one
> errors?
>
> Notice that it's not just the interpretation of PATH_MAX that differs.
> They disagree on the interpretation of _POSIX_PATH_MAX too.
POSIX (at least IEEE Std 1003.1, 2004 Edition) is clear on this:
PATH_MAX
Maximum number of bytes in a pathname, including the terminating
null character. Minimum Acceptable Value: _POSIX_PATH_MAX
[...]
_POSIX_PATH_MAX
Maximum number of bytes in a pathname. Value: 256
So it seems that with Solaris 8 "getconf" prints PATH_MAX correctly,
but prints a wrong result for _POSIX_PATH_MAX .
Confusingly enough NAME_MAX (the length of a path component) does not
include the terminating null character:
NAME_MAX
Maximum number of bytes in a filename (not including terminating
null). Minimum Acceptable Value: _POSIX_NAME_MAX
_POSIX_NAME_MAX
Maximum number of bytes in a filename (not including terminating
null). Value: 14
Solaris 2.8 and (SuSE) Linux both get this right.
Heiner
-- ___ _ / __| |_ _____ _____ _ _ Heiner STEVEN <heiner.steven@nexgo.de> \__ \ _/ -_) V / -_) ' \ Shell Script Programmers: visit |___/\__\___|\_/\___|_||_| http://www.shelldorado.com/
- Next message: Heny Townsend: "Re: PATH_MAX true POSIX size?"
- Previous message: Richard B. Gilbert: "Re: Thinking about upgrading to Solaris 10"
- In reply to: Heny Townsend: "PATH_MAX true POSIX size?"
- Next in thread: Heny Townsend: "Re: PATH_MAX true POSIX size?"
- Reply: Heny Townsend: "Re: PATH_MAX true POSIX size?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|