Expand description
I/O operations.
Structs
The error type for rustix
APIs.
A buffer type used with Write::write_vectored
.
A buffer type used with Read::read_vectored
.
PROT_*
flags for use with mprotect
.
MS_*
flags for use with msync
.
A wrapper around io_lifetimes::OwnedFd
which closes the file descriptor
using rustix
’s own close
rather than libc’s close
.
Enums
Enumeration of possible methods to seek within an I/O object.
Constants
Functions
dup(fd)
—Creates a new OwnedFd
instance that shares the same
underlying file description as fd
.
dup2(fd, new)
—Creates a new OwnedFd
instance that shares the
same underlying file description as the existing OwnedFd
instance,
closing new
and reusing its file descriptor.
dup3(fd, new, flags)
—Creates a new OwnedFd
instance that shares the
same underlying file description as the existing OwnedFd
instance,
closing new
and reusing its file descriptor, with flags.
ioctl(fd, FIOCLEX)
—Set the close-on-exec flag.
ioctl(fd, FIONBIO, &value)
—Enables or disables non-blocking mode.
ioctl(fd, FIONREAD)
—Returns the number of bytes ready to be read.
ioctl(fd, TCGETS)
—Get terminal attributes.
ioctl(fd, TIOCEXCL)
—Enables exclusive mode on a terminal.
ioctl(fd, TIOCGWINSZ)
—Get the current terminal window size.
ioctl(fd, TIOCNXCL)
—Disables exclusive mode on a terminal.
Returns a pair of booleans indicating whether the file descriptor is readable and/or writable, respectively.
isatty(fd)
—Tests whether a file descriptor refers to a terminal.
posix_madvise(addr, len, advice)
—Declares an expected access pattern
for a memory-mapped file.
mmap(ptr, len, prot, MAP_ANONYMOUS | flags, -1, 0)
—Create an anonymous
memory mapping.
pipe()
—Creates a pipe.
poll(self.fds, timeout)
pread(fd, buf, offset)
—Reads from a file at a given position.
preadv(fd, bufs, offset)
—Reads from a file at a given position into
multiple buffers.
pwrite(fd, bufs)
—Writes to a file at a given position.
pwritev(fd, bufs, offset)
—Writes to a file at a given position from
multiple buffers.
read(fd, buf)
—Reads from a stream.
readv(fd, bufs)
—Reads from a stream into multiple buffers.
STDERR_FILENO
—Standard error, owned.
STDIN_FILENO
—Standard input, owned.
STDOUT_FILENO
—Standard output, owned.
procfs
ttyname_r(fd)
Call f
until it either succeeds or fails other than Error::INTR
.
write(fd, buf)
—Writes to a stream.
writev(fd, bufs)
—Writes to a stream from multiple buffers.
Type Definitions
A specialized Result
type for rustix
APIs.
struct termios
for use with ioctl_tcgets
.
struct winsize
for use with ioctl_tiocgwinsz
.