[lkml]   [2003]   [Mar]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: select() stress
    Hi Richard, again :)

In my last message I told you that getdtablesize() is not
reliable for closing all file descriptors, that its return value is
not necessarily related to the file descriptor index. Well, I forgot
to say that getdtablehi() effectively returns the index for the
largest file descriptor available to the process plus one, that is,
perfect for using with 'select()' and for closing all open files:

for(i=0; i<getdtablehi(); i++) close(i);

Is this implemented under Linux? I have a piece of software that
relies on the above (now it's written using getdtablesize(), which is
non-correct as you noted) for closing all file descriptors...

Thanks again for noting this, Richard :)

Raúl Núñez de Arenas Coronado

Linux Registered User 88736 &
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:34    [W:0.040 / U:2.484 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site