18.13 closef (6643)

“closef” is called by “close” (5854) and by “exit” (3230). (The latter is more common since most files do not get closed explicitly but only implicitly when the user program terminates.)

6649:

If the file is a pipe, reset the mode of the pipe and “wakeup” any process which is waiting for the pipe, either for information or for space;

6655:

If this is the last process to reference the file, call “closei” (6672) to handle any special end of file processing for special files and then call “iput”;

6657:

Decrement the “file” entry reference count. If this now zero, the entry is no longer allocated.