Cargo Features
[dependencies]
rustix = { version = "0.38.42", default-features = false, features = ["std", "use-libc", "libc-extra-traits", "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", "try_close"] }
- 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, libc-extra-traits
-
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-extra-traits, libc_errno
-
Enable this to request the libc backend.
- libc-extra-traits std use-libc?
-
Enable
extra_traits
in libc types, to provideDebug
,Hash
, and other trait impls for libc types.Enables extra_traits of optional libc
- 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
,pivot_root::pivot_root
,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.14
- 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.14
Affects
no_std::net
,std::net
,rustix::path
… - thread all-apis?
-
Enable
rustix::thread::*
.Enables prctl of linux-raw-sys ^0.4.14
- process all-apis?
-
Enable
rustix::process::*
.Enables prctl of linux-raw-sys ^0.4.14
- 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) andttyname
.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.14
- 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.14
- 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
Vec
s.Affects
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 = 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 ^0.4.14
- cc
-
Obsolete and deprecated.
- 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.
- itoa procfs? pty?
- 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 arm arm64 64-bit riscv64 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 not arm arm64 64-bit riscv64 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 not rustix_use_libc not miri linux le s390x arm arm64 64-bit riscv64 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 not arm arm64 64-bit riscv64 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 win use-libc?
-
Enables errno
- once_cell android linux procfs?