FpFcntl function
File control operations.
Declaration
function FpFcntl(fildes: cint; cmd: cint): cintDescription
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
flockrecord that prevents this process from obtaining the lock, or set thel_typefield of the lock of there is no obstruction.Argis the flock record. - F_SetLk
- Set the lock or clear it (depending on
l_typein theflockstructure). 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
-
Fdhas a bad file descriptor. - sys_eagain or sys_eaccess
- For
F_SetLk, if the lock is held by another process.
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
