DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

Lock(3tlib)


Lock: LockPread, LockPwrite, LockVread, LockVwrite -- apply/release read/write locks on files

Synopsis

LockPread filename
LockPwrite filename
LockVread filehandle
LockVwrite filehandle

Description

These calls provide blocking, advisory read and/or write locks for data synchronization. A read lock permits additional read locks but not a write lock. A write lock prohibits any additional locks from being applied. Locking calls will block until the lock can be applied. Locks apply to the entire file.

LockPread
applies a read lock on the given file and returns a file handle for use by LockVread. If a write lock exists on the file, the call does not return until the lock has been released and the requested lock is set.

LockVread
releases the read lock corresponding to the given file handle.

LockPwrite
applies a write lock on the given file and returns a file handle for use by LockVwrite. If a read or write lock exists on the file, the call does not return until the lock has been released and the requested lock is set.

LockVwrite
releases the write lock corresponding to the given file handle.

Arguments


filename
full pathname of a filesystem object (file, directory etc.)

filehandle
lock file handle returned by LockPread orLockPwrite.

Return values

LockPread and LockPwrite return a lock file handle for use with subsequent LockVread or LockVwrite calls. Note, this is not a generic Tcl file handle that may be used with generic IO functions; it is internal to the lock subsystem.

Diagnostics

Errors encountered (such as non-existent file, wrong permissions) will result in a throw with a SCOadmin error stack. See Error(3tlib) or catch(1tcl).

References

fcntl(2).

Notices

These functions use System V advisory locks. For each lock, the caller must have the requested permissions on the file to be locked in order for the lock to succeed (such as write permission in order to apply a write lock, and so on).
25 April 2004
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004