[ECOS] chdir() is not per thread and JFFS2 unmount

Øyvind Harboe oyvind.harboe@zylin.com
Thu Apr 1 14:12:00 GMT 2004


On Thu, 2004-04-01 at 15:41, Thomas Koeller wrote:
> Øyvind Harboe wrote:
> > While tracking down some other bugs I ran into a surprise with current
> > directories:
> >
> > 1. chdir() does not appear to be tracked per thread.
> >
> > This seems a bit strange. errno is tracked per thread, so why not
> > current directory?
> >
> > io/fileio/current/src/misc.cxx:cyg_dir cyg_cdir_dir = CYG_DIR_NULL;
> >
> > 2. Is chdir(CYG_DIR_NULL) supported?

No comment on this one?

I discovered that the code crashes if I pass in CYG_DIR_NULL, but the
current directory starts out as CYG_DIR_NULL, so it does not seem 
unreasonable to be able to switch back to the staring point.



> >
> > http://sources.redhat.com/ml/ecos-discuss/2004-03/msg00155.html
> >
> >
> > Øyvind
> 
> I'd say errno is a per-thread variable by its very nature, different
> threads making different calls expect to receive error information
> for the calls they made.
> 
> This is different for the current directory - all threads share a
> common set of file descriptors and stream handles, and so it makes
> sense to also share a common current directory. Think of it as
> _one_ multithreaded process.

This does not give me a warm fuzzy feeling. :-)

I know of two applications other than mine that are broken since
they assume per thread chdir().


Who defines chdir()?


Presumably this is an API defined by someone other than eCos. 

> 
> tk


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list