Skip to content

fpFlock

Lock a file (advisory lock)

Declaration

Source position: unix.pp line 125

  function fpFlock(var T: text; mode: cint) : cint;
  function fpFlock(var F: File; mode: cint) : cint;
  function fpFlock(fd: cint; mode: cint) : cint;

Description

FpFLock 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 file descriptor (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 zero if successful, a nonzero return value indicates an error.

Errors

Extended error information is returned by the FpGetErrno function:

See also

Name Description
FSync Synchronize file's kernel data with disk.
#rtl.baseunix.FpFcntl File control operations.