I was cleaning up my memory, specifically,
free-ing out my file handle objects. Basically I have an array of size
OPEN_MAX, each element of which stores a pointer to my file handle struct. Initially I start out with all
NULLs in the array. (with and without doing so explicitly). In my
sys_close logic, when the reference count of a handle is 0, I deallocate the file handle object and set a
NULL at that index in my file table.
However, in subsequent calls to open, I observe that a
0xdeadbeef has been written into the file table instead of a
NULL. Thus, my
NULL-checking logic fails. Is this something I should be manually checking for?
The bigger picture: All tests except forktest-stability fail. Essentially, the first instance of
p testbin/forktest passes in sys161. Subsequent invocations of
p testbin/forktest fail because my file table contains deadbeefs.