Messages in this thread | | | From | (Alan Cox) | Subject | Re: fork: out of memory | Date | Tue, 25 Nov 1997 10:43:52 +0000 (GMT) |
| |
> Maybe it would be a wise idea to make few pointers instead of > fd[NR_OPEN]. Every pointer would point to a smaller table of let's say > 64 file descriptors and would be allocated as needed. First such table > would be in files_struct itself.
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.
| |