(v13) close_file close a file descriptor on a device
This page applies to Harlequin v13.1r0 and later; and to Harlequin Core but not Harlequin MultiRIP
int32 close_file (
DEVICELIST *dev,
DEVICE_FILEDESCRIPTOR descriptor );
This breaks the connection between a descriptor and the underlying file. After a descriptor has been closed, the descriptor's value is free to be returned by a future open
call on this device.
Any data waiting to be written on that file should be written before this call returns. Note that the Harlequin Core itself buffers data read from or written to a file, and so the device implementation normally need not (and indeed should not) also implement a buffering scheme.
The value returned should be 0
, if the close operation was successful, or -1
if some error occurred.
Note that some implementations may need to close the file if the file is deleted (with delete_file
, described in (v13) delete_file remove a file
and so an error may need to be returned even if there is no error in the underlying file system.
As an example, the UNIX file system and socket implementations can just pass the descriptor to, and return the result of, the UNIX close()
system call.