This diff implements the freeing of old file descriptor tables after the file descriptor table has been grown, in the case of a single threaded process where the file descriptor table has not been shared with another process. Details can be found in the junior jobs wiki: here. The relevant project details are given below:
Free old file descriptor tables
Technical Contact: mjg@
Difficulty
Easy
Description
File descriptor tables can be shared between multiple processes (see fdshare).
The kernel performs lockless file descriptor lookup, but file descriptor table can be reallocated by fdgrowtable at any time. To deal with this problem old tables are kept around until all processes possibly using them exit.
However, we can safely free the old table if given process has only one thread and the table is not shared.
Implement freeing such tables and submit a test program showing that it works.