Search Top Index
HELP LOCKF John Williams, Feb 1989 LIB * LOCKF is a simple Pop-11 interface to the C library function lockf, a tool for file locking. The locks created by lockf are advisory (they do not affect file access permissions), and ephemeral (they only exist for the duration of the process that creates the lock). See MAN * LOCKF for full details. ----------------------------------------------------------------------- 1 Procedures defined by LIB LOCKF ----------------------------------------------------------------------- syslockf(device, lock_op, nbytes) -> success_flag [procedure] Applies the lock operation lock_op to the file described by device (which must be writeable). nbytes specifies the number of bytes after the current file pointer to lock; if 0, the entire file is locked. The result success_flag is true if the lock operation succeeds; and false if the lock operation fails because the file is already locked by another process. An error is signalled if lock_op fails for any other reason. lock_op must be one of the following values: Integer Macro Function 0 F_ULOCK Unlock a previously locked section 1 F_LOCK Lock a section 2 F_TLOCK Test and lock a section (non-blocking) 3 F_TEST Test section for other process' locks Note that calls to syslockf with lock_op = F_LOCK are uninterruptable. Use syslock if this is a problem. syslock(device, wait) -> locked [procedure] Attempts to lock the file described by device. If wait is true, will wait if necessary till the file is free. Returns true if the file was succesfully locked, and false otherwise. sysunlock(device) -> unlocked [procedure] Attempts to unlock the file described by device, returning true if succesful, false otherwise. --- C.unix/help/lockf --- Copyright University of Sussex 1995. All rights reserved.