Getting the highest allocated file descriptor

后端 未结 5 617
傲寒
傲寒 2020-11-29 01:25

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

5条回答
  •  隐瞒了意图╮
    2020-11-29 02:15

    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.

提交回复
热议问题