Its very important to be able to do the files check fast. What seems
more sane to me is
struct files_struct
{
int count;
int limit;
fd_set close_on_exec;
fd_set open_fds;
struct file *fd[0]
};
and to allocate initially on a 64 fd break point. So you malloc
one files_struct + 64 * (struct file *). That does however requre
you write the code atomically and safely handle growing the file table
- which is actually quite hard if you want speed.