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

FpFcntl

File control operations.

Declaration

Source position: bunxh.inc line 58

function FpFcntl(

  fildes: cint;

  cmd: cint

):cint;

function FpFcntl(

  fildes: cint;

  cmd: cint;

  arg: cint

):cint;

function FpFcntl(

  fildes: cint;

  cmd: cint;

  var arg: FLock

):cint;

Description

Read/set a file's attributes. Fildes a valid file descriptor. Cmd specifies 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 fildes. (only the least significant 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 the 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.

The function returns 0 if successful, -1 otherwise.

Errors

On error, -1 is returned. Use fpGetErrno for extended error information.

sys_ebadf
Fd has a bad file descriptor.
sys_eagain or sys_eaccess
For , if the lock is held by another process.

Documentation generated on: May 14 2021