[Overview][Constants][Types][Procedures and functions][Variables][Index] Reference for unit 'oldlinux' (#rtl)

Flock

Lock a file (advisory lock)

Declaration

Source position: line 0

function Flock(

  fd: LongInt;

  mode: LongInt

):Boolean;

function Flock(

  var T: text;

  mode: LongInt

):Boolean;

function Flock(

  var F: file;

  mode: LongInt

):Boolean;

Description

FLock implements file locking. it sets or removes a lock on the file F. F can be of type Text or File, or it can be a linux filedescriptor (a longint) Mode can be one of the following constants :

LOCK_SH
sets a shared lock.
LOCK_EX
sets an exclusive lock.
LOCK_UN
unlocks the file.
LOCK_NB
This can be OR-ed together with the other. If this is done the application doesn't block when locking.

The function returns True if successful, False otherwise.

Errors

If an error occurs, it is reported in LinuxError.

See also

Fcntl

  

File control operations.

The latest version of this document can be found at lazarus-ccr.sourceforge.net.