Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 8979e9459dcd809fab53c09093b7041f33ed9792
Ticket: 1095909fffffffffffffffffffffffffffffffff
Do not use readdir_r
User & Date: jenglish on 2005-01-05 07:39:18
Changes

  1. icomment:
    Logged In: YES 
    user_id=68433
    
    Patch attached; tested with CVS HEAD, on Mandrake Linux
    10.0, --enable-symbols --enable-threads --disable-shared; no
    test failures.
    
    One more note:  The SunOS man pages insist that readdir() is
    not MT-safe and should not be used in multithreaded
    applications.  As near as I am able to determine, this is
    simply not true.
    
    The API itself has no thread-safety issues as long as the
    program does not use the same DIR pointer in multiple
    threads (i.e., it's no more MT-unsafe than, say, lseek() or
    write()).  The SuS requires that independant calls to
    readdir() on distinct DIR pointers not interfere with one
    another; all of the readdir() implementations I've been able
    to find (glibc, various BSDs, IRIX) are thread-safe subject
    to the above constraint; according to Google the traditional
    implementation is MT-safe as well; and if you think about
    it, it would be more work to implement readdir() in a way
    that's *not* MT-safe (subject to the above constraint) than
    it would be to implement one that is.
    
    Considering the problems with readdir_r, both historical and
    inherent, using it in favor of the traditional readdir()
    seems quite strongly contraindicated.  Let's lose the
    #ifdeffery here; it's doing more harm than good.
    
    
    
    
  2. login: "jenglish"
  3. mimetype: "text/plain"
  4. username: "jenglish"