unlock

Unlocks a region of previously locked data in a file

Local Servers:blocking
Remote Servers:blocking
Platform:NLM
Service:Operating System I/O

Syntax

  #include <nwfileio.h>  
   
  int unlock  (  
     int    fildes,   
     LONG   offset,   
     LONG   length);
  

Parameters

handle
(IN) Specifies a file handle.
offset
(IN) Specifies the starting byte.
length
(IN) Specifies the amount of data (in bytes).

Return Values

unlock returns a value of 0 if successful and a value of -1 when an error occurs.

If an error occurs, errno can be set to:

Decimal

Constant

Description

4

EBADF

Bad file number.

19

EWRNGKND

The region was not locked.

If unlock does not complete successfully, NetWareErrno is set.

Remarks

The unlock function unlocks the region of the file previously locked with the lock function that specified the same offset as the call to unlock. If the file does not have a locked region starting at offset, the unlock function returns a value of -1 and sets errno to EWRNGKND. All locked regions of a file should be unlocked before a file is closed.

See Also

dup, dup2, lock, open, sopen