Messages in this thread |  | | Date | Tue, 18 Mar 2003 15:46:32 +0100 | From | DervishD <> | Subject | Re: 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 http://www.pleyades.net & http://www.pleyades.net/~raulnac - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|  |