Unit 'Unix' Package
[Overview][Constants][Types][Procedures and functions][Index] [#rtl]

fpFlock

Lock a file (advisory lock).

Declaration

Source position: unix.pp line 140

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

#rtl.baseunix.FpFcntl

  

File control operations.

fpFSync

  

Synchronize file's kernel data with disk.


Documentation generated on: Dec 24 2024