sys_close  [fs/open.c]


Closes a file descriptor, so that it no longer refers to any file and may be reused. Any record locks (see sys_fcntl) held on the file it was associated with, and owned by the process, are removed (regardless of the file descriptor that was used to obtain the lock).

Arguments

eax 6
ebx File descriptor

Return values

If the system call succeeds the return value is 0.
If the system call fails the return value is one the following errno values:

-EBADF ebx isn't a valid open file descriptor.
-EINTR The sys_close call was interrupted by a signal.
-EIO An I/O error occurred.

Remarks

A successful close does not guarantee that the data has been successfully saved to disk, as the kernel defers writes. It is not common for a filesystem to flush the buffers when the stream is closed. If you need to be sure that the data is physically stored use sys_fsync. (It will depend on the disk hardware at this point.)

Compatibility

n/a