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

Fcntl

File control operations.

Declaration

Source position: line 0

function Fcntl(

  Fd: LongInt;

  Cmd: LongInt

):LongInt;

procedure Fcntl(

  Fd: LongInt;

  Cmd: LongInt;

  Arg: LongInt

);

function Fcntl(

  var Fd: Text;

  Cmd: LongInt

):LongInt;

procedure Fcntl(

  var Fd: Text;

  Cmd: LongInt;

  Arg: LongInt

);

Description

Read a file's attributes. Fd is an assigned file, or a valid file descriptor. Cmd speciefies what to do, and is one of the following:

F_GetFd
Read the close_on_exec flag. If the low-order bit is 0, then the file will remain open across execve calls.
F_GetFl
Read the descriptor's flags.
F_GetOwn
Get the Process ID of the owner of a socket.
F_SetFd
Set the close_on_exec flag of Fd. (only the least siginificant bit is used).
F_GetLk
Return the flock record that prevents this process from obtaining the lock, or set the l_type field of the lock of there is no obstruction. Arg is a pointer to a flock record.
F_SetLk
Set the lock or clear it (depending on l_type in the flock structure). if the lock is held by another process, an error occurs.
F_GetLkw
Same as for F_Setlk, but wait until the lock is released.
F_SetOwn
Set the Process or process group that owns a socket.

Errors

LinuxError is used to report errors.

sys_ebadf
Fd has a bad file descriptor.
sys_eagain or sys_eaccess
For F_SetLk, if the lock is held by another process.
The latest version of this document can be found at lazarus-ccr.sourceforge.net.