Cargo Features

[dependencies]
rustix = { version = "0.38.31", default-features = false, features = ["std", "use-libc", "event", "fs", "io_uring", "mount", "net", "thread", "process", "shm", "time", "param", "procfs", "pty", "termios", "mm", "pipe", "rand", "stdio", "system", "runtime", "all-apis", "use-libc-auxv", "use-explicitly-provided-auxv", "linux_4_11", "linux_latest", "alloc", "rustc-dep-of-std", "cc"] }
default = std, use-libc-auxv

By default, use std and use libc for aux values.

It turns out to be bizarrely awkward to obtain the aux values reliably and efficiently on Linux from anywhere other than libc. We can do it, but most users are better served by just using libc for this.

std default = alloc

This enables use of std. Disabling this enables #![no_std], and requires Rust 1.64 or newer.

Enables std of bitflags, optional libc, and optional errno

Affects stdio::stdin, stdio::stdout, stdio::stderr

use-libc = libc, libc_errno

Enable this to request the libc backend.

event all-apis? io_uring?

Enable rustix::event::*.

fs all-apis? io_uring? param? procfs? pty? shm?

Enable rustix::fs::*.

Affects chdir::chdir, chroot::chroot, umask::umask, runtime::execveat, chdir::getcwd, rustix::path

io_uring all-apis? = event, fs, net

Enable rustix::io_uring::* (on platforms that support it).

Enables io_uring of linux-raw-sys ^0.4.12

mount all-apis?

Enable rustix::mount::*.

Affects rustix::path

net all-apis? io_uring?

Enable rustix::net::*.

Enables if_ether, net, netlink and xdp of linux-raw-sys ^0.4.12

Affects no_std::net, std::net, rustix::path

thread all-apis?

Enable rustix::thread::*.

Enables prctl of linux-raw-sys ^0.4.12

process all-apis?

Enable rustix::process::*.

Enables prctl of linux-raw-sys ^0.4.12

shm all-apis? = fs

Enable rustix::shm::*.

time all-apis?

Enable rustix::time::*.

param all-apis? = fs

Enable rustix::param::*.

procfs all-apis? = fs, itoa, once_cell

Enable this to enable rustix::io::proc_self_* (on Linux) and ttyname.

Affects rustix::procfs, tty::ttyname

pty all-apis? = fs, itoa

Enable rustix::pty::*.

termios all-apis?

Enable rustix::termios::*.

mm all-apis?

Enable rustix::mm::*.

pipe all-apis?

Enable rustix::pipe::*.

rand all-apis?

Enable rustix::rand::*.

stdio all-apis?

Enable rustix::stdio::*.

system all-apis?

Enable rustix::system::*.

Enables system of linux-raw-sys ^0.4.12

runtime all-apis?

Enable rustix::runtime::*. This API is undocumented and unstable and experimental and not intended for general-purpose use.

Enables prctl of linux-raw-sys ^0.4.12

all-apis = event, fs, io_uring, mm, mount, net, param, pipe, process, procfs, pty, rand, runtime, shm, stdio, system, termios, thread, time

Enable all API features.

use-libc-auxv default

When using the linux_raw backend, should we use libc for reading the aux vectors, instead of reading them ourselves from /proc/self/auxv?

use-explicitly-provided-auxv

Enable "use-explicitly-provided-auxv" mode, with a public rustix::param::init function that must be called before anything else in rustix. This is unstable and experimental and not intended for general-purpose use.

linux_4_11 linux_latest?

OS compatibility features

Optimize for Linux 4.11 or later

linux_latest = linux_4_11

Enable all optimizations for the latest Linux versions.

alloc std

Enable features which depend on the Rust global allocator, such as functions that return owned strings or Vecs.

Affects epoll::wait, epoll::EventVec, epoll::wait, epoll::EventVec, event::kqueue, port::port_getn, abs::readlink, at::readlinkat, netdevice::index_to_name, sockopt::get_tcp_congestion, arg::Arg.to_string_lossy, arg::Arg.as_cow_c_str, arg::Arg.into_c_str, id::getgroups, procctl::get_reaper_pids, pty::ptsname, prctl::name, chdir::getcwd, tty::ttyname

rustc-dep-of-std

This is used in the port of std to rustix. This is experimental and not meant for regular use.

Enables rustc-std-workspace-alloc, rustc-dep-of-std of linux-raw-sys ^0.4.12, rustc-dep-of-std of bitflags and compiler_builtins and rustc-std-workspace-core

Special dependencies used in rustc-dep-of-std mode.

cc

Obsolete and deprecated.

Features from optional dependencies

In crates that don't use the dep: syntax, optional dependencies automatically become Cargo features.

itoa procfs? pty?
libc not rustix_use_libc not miri linux le arm arm64 64-bit riscv64 rustix_use_experimen… powerpc64 rustix_use_experimen… mips rustix_use_experimen… mips32r6 rustix_use_experimen… mips64 rustix_use_experimen… mips64r6 x86 x86_64 64-bit not win rustix_use_libc miri not linux not le not arm arm64 64-bit riscv64 rustix_use_experimen… powerpc64 rustix_use_experimen… mips rustix_use_experimen… mips32r6 rustix_use_experimen… mips64 rustix_use_experimen… mips64r6 x86 x86_64 64-bit use-libc?
libc_errno not rustix_use_libc not miri linux le arm arm64 64-bit riscv64 rustix_use_experimen… powerpc64 rustix_use_experimen… mips rustix_use_experimen… mips32r6 rustix_use_experimen… mips64 rustix_use_experimen… mips64r6 x86 x86_64 64-bit win not win rustix_use_libc miri not linux not le not arm arm64 64-bit riscv64 rustix_use_experimen… powerpc64 rustix_use_experimen… mips rustix_use_experimen… mips32r6 rustix_use_experimen… mips64 rustix_use_experimen… mips64r6 x86 x86_64 64-bit use-libc?

Enables errno

once_cell android linux procfs?