Is there a portable way (POSIX) to get the highest allocated file descriptor number for the current process?
I know that there\'s a nice way to get the number on AIX
Why don't you close all descriptors from 0 to, say, 10000.
It would be pretty fast, and the worst thing that would happen is EBADF.