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

fpFlock

Lock a file (advisory lock)

Declaration

Source position: unix.pp line 101

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

Errors

Extended error information is returned by the FpGetErrno function:

See also

#rtl.baseunix.FpFcntl

  

File control operations.

FSync

  

Synchronize file's kernel data with disk.


Documentation generated on: Mar 17 2017