>>-close--fd---------------------------------------------------><
Function
close invokes the close callable service to close a file.
Parameters
- fd
- The file descriptor (a number) for the file to be closed.
Usage notes
- Closing a file closes, or frees, the file descriptor by which
the file was known to the process. The system can then reassign the
file descriptor to the same file or to another file when it is opened.
- Closing a file descriptor also unlocks all outstanding byte range
locks that a process has on the associated file.
- If a file has been opened by more than one process, each process
has a file descriptor. When the last open file descriptor is closed,
the file itself is closed. If the file's link count is zero at
that time, the file's space is freed and the file becomes inaccessible.
When the last open file descriptor for a pipe or FIFO special file
is closed, any data remaining in the file is discarded.
Example
In the following example, assume that
fd was assigned
a value earlier in the exec:
"close" fd