bug-hurd
[Top][All Lists]
Advanced

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

Re: MAXPATHLEN


From: Roland McGrath
Subject: Re: MAXPATHLEN
Date: Fri, 29 Sep 2000 15:16:54 -0400 (EDT)

>   Even though so many applications depend on MAXPATHLEN, why doesn't
> Hurd define it as an arbitrary number (e.g. INT_MAX)?

The way that most programs use MAXPATHLEN is as the size statically-sized
arrays, so an unreasonably large value will either just not work or will
eat unreasonable amounts of memory (or at least address space).  If you
think of values that are small enough to be used as a size for
stack-allocated arrays, then you get to 4k or the like that other systems
use--and that is exactly the kind of arbitrary limit the GNU system avoids.

Any program that uses MAXPATHLEN or PATH_MAX in a way for which a value
like INT_MAX would work, i.e. explicit checks against a maximum length, can
be trivially changed to work with an unlimited value (by just eliding its
check).  (Conformant POSIX.1 programs need to deal with this anyway, since
sysconf(_SC_PATH_MAX) is allowed to return -1 as it does on the Hurd.)



reply via email to

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