Cargo Features
[dependencies]
rustix = { version = "1.0.2", default-features = false, features = ["std", "use-libc", "event", "fs", "io_uring", "mount", "net", "thread", "process", "shm", "time", "param", "pty", "termios", "mm", "pipe", "rand", "stdio", "system", "runtime", "all-apis", "use-libc-auxv", "use-explicitly-provided-auxv", "linux_4_11", "linux_5_1", "linux_5_11", "linux_latest", "alloc", "rustc-dep-of-std", "try_close"] }
- default = std
-
By default, use
std
. - std default = alloc
-
This enables use of std. Disabling this enables
#![no_std]
, and requires Rust 1.77 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? pty? shm?
-
Enable
rustix::fs::*
.Affects
chdir::chdir
,chroot::chroot
,pivot_root::pivot_root
,umask::umask
,runtime::execveat
,chdir::getcwd
,tty::ttyname
,rustix::path
… - io_uring all-apis? = event, fs, net, thread
-
Enable
rustix::io_uring::*
(on platforms that support it).Enables io_uring of linux-raw-sys
- 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
Affects
no_std::net
,std::net
,rustix::path
… - thread all-apis? io_uring?
-
Enable
rustix::thread::*
.Enables prctl of linux-raw-sys
- process all-apis?
-
Enable
rustix::process::*
.Enables prctl of linux-raw-sys
- shm all-apis? = fs
-
Enable
rustix::shm::*
. - time all-apis?
-
Enable
rustix::time::*
. - param all-apis?
-
Enable
rustix::param::*
. - pty all-apis? = fs
-
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
- 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
- all-apis = event, fs, io_uring, mm, mount, net, param, pipe, process, pty, rand, runtime, shm, stdio, system, termios, thread, time
-
Enable all API features.
This is primarily intended for rustix developers. Users are encouraged to enable only those features they need. - use-libc-auxv
-
When using the linux_raw backend, should we use
getauxval
for reading aux vectors, instead ofPR_GET_AUXV
or "/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_5_1?
-
OS compatibility features
Specialize for Linux 4.11 or later - linux_5_1 linux_5_11? = linux_4_11
-
Specialize for Linux 5.1 or later
- linux_5_11 linux_latest? = linux_5_1
-
Specialize for Linux 5.11 or later
- linux_latest = linux_5_11
-
Enable all specializations for the latest Linux versions.
- alloc std
-
Enable features which depend on the Rust global allocator, such as functions that return owned strings or
Vec
s.Affects
buffer::SpareCapacity
,buffer::spare_capacity
,abs::readlink
,at::readlinkat
,netdevice::index_to_name
,sockopt::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 = compiler_builtins, core, rustc-std-workspace-alloc
-
This is used in the port of std to rustix. This is experimental and not meant for regular use.
Enables rustc-dep-of-std of bitflags, optional compiler_builtins, and linux-raw-sys
- try_close
-
Enable
rustix::io::try_close
. The rustix developers do not intend the existence of this feature to imply that anyone should use it.Affects
close::try_close
…
Features from optional dependencies
In crates that don't use the dep:
syntax, optional dependencies automatically become Cargo features. These features may have been created by mistake, and this functionality may be removed in the future.
- core rustc-dep-of-std?
-
Enables rustc-std-workspace-core
Special dependencies used in rustc-dep-of-std mode.
- rustc-std-workspace-alloc rustc-dep-of-std?
-
Enables rustc-std-workspace-alloc
not aliased here but in lib.rs because of name collision with the alloc feature
- compiler_builtins rustc-dep-of-std?
- libc not rustix_use_libc not miri linux le s390x powerpc arm arm64 64-bit riscv64 rustix_use_experimen… powerpc rustix_use_experimen… powerpc64 rustix_use_experimen… s390x 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 s390x powerpc not arm arm64 64-bit riscv64 rustix_use_experimen… powerpc rustix_use_experimen… powerpc64 rustix_use_experimen… s390x 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 win not rustix_use_libc not miri linux le s390x powerpc arm arm64 64-bit riscv64 rustix_use_experimen… powerpc rustix_use_experimen… powerpc64 rustix_use_experimen… s390x 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 s390x powerpc not arm arm64 64-bit riscv64 rustix_use_experimen… powerpc rustix_use_experimen… powerpc64 rustix_use_experimen… s390x 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