Module 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§

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

Constants§

F_DUPFD
Duplicate the file descriptor fd using the lowest-numbered available file descriptor greater than or equal to arg.
F_DUPFD_CLOEXEC
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.
F_GETFD
Retrieve the function descriptor flags.
F_GETFL
Retrieve the file access mode and the file status flags.
F_GETLK
Place a lock on the file.
F_OFD_GETLK
Place a lock on the file description of the file.
F_OFD_SETLK
Acquire a lock or release a lock on the file description of the file.
F_OFD_SETLKW
Acquire a lock or release a lock on the file description of the file, waiting for any conflicting lock to be released.
F_SETFD
Set the function descriptor flags.
F_SETFL
Set the file status flags.
F_SETLK
Acquire a lock or release a lock on the file.
F_SETLKW
Acquire a lock or release a lock on the file, waiting for any conflicting lock to be released.

Traits§

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

Functions§

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