Skip to main content

fcntl

Function fcntl 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn fcntl( fildes: c_int, cmd: c_int, ... ) -> c_int
Expand description

See https://pubs.opengroup.org/onlinepubs/9799919799/functions/fcntl.html.

Performs the operation specified by cmd on open files pointed to by the file descriptor fildes.

The return value depends on the value of cmd:

  • F_DUPFD: A new file descriptor.
  • F_DUPFD_CLOEXEC: A new file descriptor.
  • F_DUPFD_CLOFORK: A new file descriptor.
  • F_GETFD: Value of flags. The return value shall not be negative.
  • F_SETFD: Value other than -1.
  • F_GETFL: Value of file status flags and access modes. The return value shall not be negative.
  • F_SETFL: Value other than -1.
  • F_GETLK: Value other than -1.
  • F_SETLK: Value other than -1.
  • F_SETLKW: Value other than -1.
  • F_OFD_GETLK: Value other than -1.
  • F_OFD_SETLK: Value other than -1.
  • F_OFD_SETLKW: Value other than -1.
  • F_GETOWN: Value of the socket owner process or process group; this shall not be -1.
  • F_SETOWN: Value other than -1.
  • F_GETOWN_EX: Value other than -1.
  • F_SETOWN_EX: Value other than -1.

Otherwise, -1 shall be returned and errno set to indicate the error.