[Overview][Constants][Types][Procedures and functions][Variables] 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: ;

  mode: LongInt

):Boolean;

Description

FLockimplements file locking. it sets or removes a lock on the file F. F can be of type Textor File, or it can be a linux filedescriptor (a longint) Modecan 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 Trueif successful, Falseotherwise.

Errors

If an error occurs, it is reported in LinuxError.

See also

Fcntl

  

File control operations.