James Carlson <james.d.carlson at sun.com> wrote:

> Joerg Schilling writes:
> > Also, nftw() is not reentrant as it depends on static data that is 
> > overwritten
> > in case you run two instances from two threads at the same time.
>
> At least on Open Solaris[1], nftw() is safe in multithreaded
> applications as long as you don't use FTW_CHDIR[2].  It doesn't use
> static data, and instead passes around pointers to 'struct Var' and
> 'struct Save' that are allocated on the stack.

Sorry, it seems that I did have something wrong in mind.

...

> [2] The inherent problems with chdir should be obvious.

I just noticed that chdir(2) is process global. 

As the only way to let a treewalker behave in a way that does what POSIX
like (not being limited in pathname length), it seems that we need to have 
an implementation of a trewalker that uses openat() for everything.

This is something that unfortunately has not been mentioned as important fact
for openat() when the interface has been presented to the Austin mailing 
list.....

J?rg

-- 
 EMail:joerg at schily.isdn.cs.tu-berlin.de (home) J?rg Schilling D-13353 Berlin
       js at cs.tu-berlin.de                (uni)  
       schilling at fokus.fraunhofer.de     (work) Blog: 
http://schily.blogspot.com/
 URL:  http://cdrecord.berlios.de/old/private/ ftp://ftp.berlios.de/pub/schily

Reply via email to