Releases advisory range locks on a file.
#include <nks/fsio.h> int NXFileRangeUnlock ( NXHandle_t fileHandle, unsigned long flags, NXOffset_t offset, NXOffset_t length);
(IN) Specifies a file handle (or descriptor), which refers to a system-maintained state description for a file.
(IN) Specifies a qualifier for the unlock operation. Use the following flag:
(IN) Specifies the starting offset of the file unlock operation.
(IN) Specifies in bytes the length of the file lock, forward from the offset if positive, and backward from the offset if negative.
If successful, returns 0 (which is assured if fileHandle is -1). Otherwise, returns one of the following:
NXFileRangeUnlock releases previously acquired byte range locks (with NXFileRangeLock) on the file specified by fileHandle.
If the lock type does not match the lock type of the range being unlocked, the call will fail.Sub-range unlocking is not permitted. That is, the values specified in the parameters offset and length must match the values specified in an earlier lock acquire call. Also, lock ownership is tied to the file handle with which the lock was acquired and not to the file. Specifically, this means that if the same file is opened twice by a virtual machine, and a byte range lock is acquired using one handle, and the other file handle is closed, byte range locks acquired with the open file handle are not automatically released. This also means that locks acquired via one file handle cannot be released via another file handle, even if both file handles correspond to the same file.
For locking and unlocking purposes, a byte range lock's owner is fully described by <virtual machine, file handle, offset, length>.Closing a file handle, which has established byte range locks, results in the locks acquired using that file handle to be released automatically.
NOTE:Locks acquired on the same file via a different file handle are not disturbed.
To prevent unexpected results, only locks acquired via NXFileRangeLock should be released using this function. Use NXFileRangeUnlockEx to release locks acquired via NXFileRangeLockEx.