This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Changing MAXPATHLEN in glob.cc back to 16384


On Mar  6 17:06, Piotr Foltyn wrote:
> Hi,
> 
> Revision 1.7 of src/winsup/cygwin/glob.cc reduced maximum allowed path length from 16384 to 4096 characters. This is unfortunate because some paths used in my build system can reach 6k characters in length. Attached patch reinstates 16384 characters limit.

MAXPATHLEN == PATH_MAX == 4096.  While the OS allows 32K char paths,
we don't support any longer paths than PATH_MAX.  There are other
restrictions in Cygwin based on PATH_MAX.

The problems with the size of MAXPATHLEN in glob.cc are:

- The buffer type is Char, which is defined as uint_fast64_t, which
  is 8 byte.

- The temporary buffers are allocated on the stack.  Each of them takes
  8 * MAXPATHLEN bytes,  32K vs. 128K.  3 of them are always needed,
  plus one MAXPATHLEN bytes buffer.  Additional MAXPATHLEN bytes buffers
  can be created via recursion.
  
- So the stack pressure just by calling glob and the glob internal
  functions it at least 400K if MAXPATHLEN is 16384.  That's quite a
  lot, given the default stacksizes of 2 Megs for the main thread and 1
  Meg for other threads.

Having said that, I'm willing to try with setting MAXPATHLEN to 8192.
I change that in CVS.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]