lkml.org 
[lkml]   [1997]   [Nov]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: fork: out of memory
Date
> 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.



\
 
 \ /
  Last update: 2005-03-22 13:40    [W:0.346 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site