Skip to content
Tcl Source Code View Ticket
Login

View Ticket

readdir_r() is different on IRIX 5.3

Closed / Fixed1001325fffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 22 years ago
Descriptionplain2004-07-31 22:55:41
When compiling tcl 8.4.7 on IRIX 5.3 with --enable-threads one ends up with
cfe: Error: ./../unix/tclUnixThrd.c, line 837: The number of arguments doesn't agree with the number in the declaration.
     if (readdir_r (dir, ent, &ent) != 0) {
 ------------------^
*** Error code 1 (bu21)

This is because on IRIX 5.3 readdir_r() is

 struct dirent *readdir_r (DIR *dirp, struct dirent *res);

unix/tclUnixThrd.c thushas to be changed on IRIX 5.3 into

#ifdef HAVE_READDIR_R
    ent = &tsdPtr->rdbuf.ent;
/*    if (TclOSreaddir_r(dir, ent, &ent) != 0) {
        ent = NULL;
    }
*/
        ent=TclOSreaddir_r(dir, ent);

#else /* !HAVE_READDIR_R */

ideally the configure tools should detect which version of readdir_r is being used on a given platform.
mdejongplain2004-09-24 13:17:00
File Added - 102636: readdir_r.patch

Logged In: YES 
user_id=90858

Could someone with an IRIX 5.3 system try this patch? It should
detect the 2 or 3 arg version of readdir_r, but it has had
no testing.
gschwarzplain2004-11-18 06:40:01
Logged In: YES 
user_id=951222

I've applied that patch to 8.4.7, and it now compiles on IRIX 
5.3.
mdejong Closed ticket [1001325fff]. [History diff]2004-11-23 05:40:46
kennykbplain2004-11-25 01:13:50
Logged In: YES 
user_id=99768

Mo's change breaks an ordinary Linux-IA32 build, because NULL
is undefined unless <stdlib.h> is included.  Don, could you
rerun
autoconf with the attached 1001325.patch? (I don't have 2.13 to
and at the moment.)
kennykbplain2004-11-25 01:13:51
File Added - 109993: 1001325.patch
dgpplain2004-11-25 01:41:56
File Added - 109995: autoconf.patch

Logged In: YES 
user_id=80530

new patch includes
outcome of running
autoconf-2.13.
kennykbplain2004-11-25 03:22:45
Logged In: YES 
user_id=99768

Correction applied to both HEAD and 8.4 branch
dgp Open ticket [1001325fff]. [History diff]2004-11-25 05:00:37
dgpplain2004-11-25 05:00:38
Logged In: YES 
user_id=80530

See 1071701.  Things are
still broken.
kennykbplain2004-11-29 22:55:39
Logged In: YES 
user_id=99768

I see that you closed 1071701 - is this bug now fixed also?
dgpplain2004-11-29 22:58:04
Logged In: YES 
user_id=80530


It would be best for someone with
and IRIX 5.3 system to say for sure.
dgp Ticket [1001325fff]: 1 change [History diff]2004-11-29 22:58:55
jenglishplain2004-11-30 00:45:18
Logged In: YES 
user_id=68433

A suggestion: don't  use readdir_r() at all, unless it can
be demonstrated that readdir() is in fact broken on the host
platform.

On most systems (including IRIX 5.3 AFAICT), readdir() is
perfectly thread-safe as long as you don't share the same
DIR * across multiple threads (which Tcl doesn't do).
dgpplain2004-12-02 08:17:56
Logged In: YES 
user_id=80530

unless someone says
otherwise, I believe this is fixed
for Tcl 8.4.9.

jenglish''s suggestion is a
good one to explore in 8.5 development.
Log in (anonymous is fine) to add a comment.

Attachments: