Modules
epoll support.
Structs
O_*
constants for use with dup2
.
The error type for rustix
APIs.
The EFD_*
flags accepted by eventfd
.
MAP_*
flags for use with mmap
.
MLOCK_*
flags for use with mlock_with
.
PROT_*
flags for use with mprotect
.
MREMAP_*
flags for use with mremap
.
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
.
O_*
constants for use with pipe_with
.
struct pollfd
—File descriptor and flags for use with poll
.
POLL*
flags for use with poll
.
PROT_*
flags for use with mmap
.
The O_*
flags accepted by userfaultfd
.
Enums
Functions
close This function is unsafe to use
close(raw_fd)
—Closes a RawFd
directly.
dup not(target_os = "wasi")
dup(fd)
—Creates a new OwnedFd
instance that shares the same
underlying file description as fd
.
dup2 not(target_os = "wasi")
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.
dup2_with not(target_os = "wasi")
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.
eventfd(initval, flags)
—Creates a file descriptor for event
notification.
ioctl_blkpbszget any(target_os = "android", target_os = "linux")
ioctl(fd, BLKPBSZGET)
—Returns the physical block size of a block device.
ioctl_blksszget any(target_os = "android", target_os = "linux")
ioctl(fd, BLKSSZGET)
—Returns the logical block size of a block device.
ioctl(fd, FIONBIO, &value)
—Enables or disables non-blocking mode.
ioctl_fionread not(any(windows, target_os = "redox"))
ioctl(fd, FIONREAD)
—Returns the number of bytes ready to be read.
ioctl_tcgets not(any(windows, target_os = "wasi"))
ioctl(fd, TCGETS)
—Get terminal attributes.
ioctl_tiocexcl any(linux_raw, all(libc, not(any(windows, target_os = "redox", target_os = "wasi"))))
ioctl(fd, TIOCEXCL)
—Enables exclusive mode on a terminal.
ioctl_tiocgwinsz not(any(windows, target_os = "wasi"))
ioctl(fd, TIOCGWINSZ)
—Get the current terminal window size.
ioctl_tiocnxcl any(linux_raw, all(libc, not(any(windows, target_os = "redox", target_os = "wasi"))))
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.
madvise This function is unsafe to use
posix_madvise(addr, len, advice)
—Declares an expected access pattern
for a memory-mapped file.
mlock This function is unsafe to use
mlock(ptr, len)
—Lock memory into RAM.
mlock_with This function is unsafe to use any(linux_raw, all(libc, any(target_os = "android", target_os = "linux")))
mlock2(ptr, len, flags)
—Lock memory into RAM, with
flags.
mmap This function is unsafe to use
mmap(ptr, len, prot, flags, fd, offset)
—Create a file-backed memory
mapping.
mmap_anonymous This function is unsafe to use
mmap(ptr, len, prot, MAP_ANONYMOUS | flags, -1, 0)
—Create an anonymous
memory mapping.
mprotect This function is unsafe to use
mprotect(ptr, len, flags)
mremap This function is unsafe to use any(linux_raw, all(libc, target_os = "linux"))
mremap(old_address, old_size, new_size, flags)
—Resize, modify,
and/or move a memory mapping.
mremap_fixed This function is unsafe to use any(linux_raw, all(libc, target_os = "linux"))
mremap(old_address, old_size, new_size, MREMAP_FIXED | flags)
—Resize,
modify, and/or move a memory mapping to a specific address.
msync This function is unsafe to use
msync(addr, len, flags)
—Declares an expected access pattern
for a memory-mapped file.
munlock This function is unsafe to use
munlock(ptr, len)
—Unlock memory.
munmap This function is unsafe to use
munmap(ptr, len)
pipe()
—Creates a pipe.
pipe_with not(any(target_os = "ios", target_os = "macos"))
pipe2(flags)
—Creates a pipe, with flags.
poll(self.fds, timeout)
pread(fd, buf, offset)
—Reads from a file at a given position.
preadv not(target_os = "redox")
preadv(fd, bufs, offset)
—Reads from a file at a given position into
multiple buffers.
preadv2 any(linux_raw, all(libc, any(target_os = "android", target_os = "linux")))
preadv2(fd, bufs, offset, flags)
—Reads data, with several options.
pwrite(fd, bufs)
—Writes to a file at a given position.
pwritev not(target_os = "redox")
pwritev(fd, bufs, offset)
—Writes to a file at a given position from
multiple buffers.
pwritev2 any(linux_raw, all(libc, any(target_os = "android", target_os = "linux")))
pwritev2(fd, bufs, offset, flags)
—Writes data, with several options.
read(fd, buf)
—Reads from a stream.
readv(fd, bufs)
—Reads from a stream into multiple buffers.
stderr This function is unsafe to use
STDERR_FILENO
—Standard error, borrowed.
stdin This function is unsafe to use
STDIN_FILENO
—Standard input, borrowed.
stdout This function is unsafe to use
STDOUT_FILENO
—Standard output, borrowed.
take_stderr This function is unsafe to use
STDERR_FILENO
—Standard error, owned.
take_stdin This function is unsafe to use
STDIN_FILENO
—Standard input, owned.
take_stdout This function is unsafe to use
STDOUT_FILENO
—Standard output, owned.
userfaultfd This function is unsafe to use
userfaultfd(flags)
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
.