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

Bart Veer bartv@ecoscentric.com
Thu Apr 1 16:31:00 GMT 2004


>>>>> "Oyvind" == =?ISO-8859-1?Q?=D8yvind?= Harboe <ISO-8859-1> writes:

    <snip>
    >> 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.

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

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

    Oyvind> Who defines chdir()?

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

chdir() is defined by POSIX, and related standards such as
www.opengroup.org. The key definition on the opengroup website is:

  "Working Directory (or Current Working Directory)

  A directory, associated with a process, that is used in pathname
  resolution for pathnames that do not begin with a slash."

This is what chdir() manipulates. The definition specifically
associates the working directory with the process as a whole, not with
individual threads. Therefore a chdir() should change the working
directory for all threads within the process. Offhand I don't remember
any system where chdir() behaves differently, i.e. on a per-thread
rather than per-process basis.

Bart

-- 
Bart Veer                       eCos Configuration Architect
http://www.ecoscentric.com/     The eCos and RedBoot experts

-- 
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