Module linux_io::fd::fcntl

source ·
Expand description

A safer abstraction for fcntl.

The fcntl system call is very open-ended, supporting a variety of different operations with different argument and result types. Passing the wrong kind of value to the wrong command can cause memory corruption.

To make fcntl a little safer to use, this module provides command constants that also include information about the argument and result types, so that the super::File::fcntl method can then provide a type-safe interface as long as these constants are defined correctly.

Structs

Implementation of FcntlCmd with a fixed cmd value and passing the arg through to the underlying system call as a raw const pointer.
Implementation of FcntlCmd with a fixed cmd value and passing the arg directly through to the underlying system call.
Implementation of FcntlCmd with a fixed cmd value and passing the arg through to the underlying system call as a raw mut pointer.

Constants

Duplicate the file descriptor fd using the lowest-numbered available file descriptor greater than or equal to arg.
Duplicate the file descriptor fd using the lowest-numbered available file descriptor greater than or equal to arg, setting the FD_CLOEXEC flag on the new descriptor.
Retrieve the function descriptor flags.
Retrieve the file access mode and the file status flags.
Place a lock on the file.
Place a lock on the file description of the file.
Acquire a lock or release a lock on the file description of the file.
Acquire a lock or release a lock on the file description of the file, waiting for any conflicting lock to be released.
Set the function descriptor flags.
Set the file status flags.
Acquire a lock or release a lock on the file.
Acquire a lock or release a lock on the file, waiting for any conflicting lock to be released.

Traits

Represents a particular command that can be used with the fcntl system call.
Trait for types that can be returned by fcntl calls.

Functions

Constructs a new “simple” FcntlCmd with a fixed command code and an argument type that maps directly to the raw system call argument.
Constructs a new FcntlCmd with a fixed command code and an argument type that will be passed as a raw const pointer.
Constructs a new FcntlCmd with a fixed command code and an argument type that will be passed as a raw mut pointer.