NWLogFileLock2

Logs the specified file in the File Log Table and locks the file if the lock flag is set

Local Servers:blocking
Remote Servers:blocking
NetWare Server:3.11, 3.12, 3.2, 4.x, 5.x, 6.x
Platform:NLM, Windows NT, Windows 95, Windows 98
Library:Cross-Platform NetWare Calls (CAL*.*)
Service:Synchronization

Syntax

  #include <nwfile.h> 
  or 
  #include <nwcalls.h> 
   
  N_EXTERN_LIBRARY(NWCCODE) NWLogFileLock2 ( 
     NWCONN_HANDLE       conn,  
     NWDIR_HANDLE        dirHandle,  
     const nstr8 N_FAR  *path,  
     nuint8              lockFlags,  
     nuint16             timeOut);
  

Delphi Syntax

  uses calwin32 
   
  Function NWLogFileLock2 
    (conn : NWCONN_HANDLE; 
     dirHandle : NWDIR_HANDLE; 
     const path : pnstr8; 
     lockFlags : nuint8; 
     timeOut : nuint16 
  ) : NWCCODE;
  

Parameters

conn
(IN) Specifies the NetWare server connection handle.
dirHandle
(IN) Specifies the directory handle in which the file to be logged resides.
path
(IN) Points to the string containing the path and file name of the file to be logged.
lockFlags
(IN) Specifies the lock flags.
timeOut
(IN) Specifies the length of time the NetWare server attempts to log the specified file before timing out.

Return Values

These are common return values; see Return Values (NDK: Connection, Message, and NCP Extensions) for more information.

0x0000

SUCCESSFUL

0x8801

INVALID_CONNECTION

0x890A

NLM_INVALID_CONNECTION

0x897F

ERR_LOCK_WAITING

0x8982

NO_OPEN_PRIVILEGES

0x8996

SERVER_OUT_OF_MEMORY

0x8998

VOLUME_DOES_NOT_EXIST

0x899B

BAD_DIRECTORY_HANDLE

0x899C

INVALID_PATH

0x89FE

TIMEOUT_FAILURE

0x89FF

LOCK_ERROR

Remarks

NWLogFileLock2 logs the specified file for exclusive use by the workstation. If bit 0 of lockFlags is set, the server immediately attempts to lock the file.

lockFlags ’ values are interpreted as follows:

  0x00   Log file 
  0x01   Log and lock the file
  

When lockFlags is 1, the server attempts to lock the file for the length of time specified by timeOutLimit.

path can specify either a file’s complete path name or a path relative to the current working directory. For example, if a file’s complete path name is SYS:ACCOUNT/DOMEST/TARGET.DAT and the directory handle mapping is SYS:ACCOUNT, path could point to either of the following:

  SYS:ACCOUNT/DOMEST/TARGET.DAT 
  DOMEST/TARGET.DAT
  

timeOut is specified in units of 1/18 second (0 = no wait).

NWLogFileLock2 cannot lock files already logged and exclusively locked by other applications. A file can be locked by a client even if the file does not yet exist. This reserves the file name for use by the client locking it.

The File Log Table contains data locking information used by a NetWare server. The NetWare server tracks this information for each workstation and process. Whenever a file, logical record, or physical record is logged, information identifying the data being logged is entered in the log table. Normally, a set of files or records is logged and then locked as a set. However, a single file or record can also be locked when it is entered in the table.

When using log tables, a task first logs all of the files or records that are needed to complete a transaction. The task then attempts to lock the logged set of files or records. If some of the logged resources cannot be locked, the lock fails and none of the resources are locked.

NCP Calls

See Also

NWClearFileLock2, NWClearFileLockSet, NWLockFileLockSet, NWReleaseFileLock2