diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-09-30 20:19:44 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-09-30 20:19:44 -0700 |
commit | e259c7ec60a84280dbf7e2cf041a6fec79f53e1f (patch) | |
tree | b0f908a9f23fa54a6a4a55bef2c731d4992c9362 /fd.c | |
parent | fcb83e31a0dfd85e4ec105dd656ed405e64c387b (diff) | |
download | xscope-e259c7ec60a84280dbf7e2cf041a6fec79f53e1f.tar.gz |
Make FDinfo dynamically allocated
We still allocate one fdinfo struct for every possible FD up front
instead of resizing as needed, but they're much smaller now that
we just have a pointer to the 32k buffer instead of including it
directly in the fdinfo.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Diffstat (limited to 'fd.c')
-rw-r--r-- | fd.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -109,6 +109,10 @@ InitializeFD(void) if (FDD == NULL) { panic("Can't allocate memory for file descriptor table"); } + FDinfo = calloc(MaxFD, sizeof (struct fdinfo)); + if (FDD == NULL) { + panic("Can't allocate memory for file descriptor info table"); + } /* be sure all fd's are closed and marked not busy */ for (i = 0; i < MaxFD; i++) |