1[package]
2name = "rustix"
3version = "0.38.32"
4authors = [
5 "Dan Gohman <dev@sunfishcode.online>",
6 "Jakub Konka <kubkon@jakubkonka.com>",
7]
8description = "Safe Rust bindings to POSIX/Unix/Linux/Winsock-like syscalls"
9documentation = "https://docs.rs/rustix"
10license = "Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT"
11repository = "https://github.com/bytecodealliance/rustix"
12edition = "2021"
13keywords = ["api", "file", "network", "safe", "syscall"]
14categories = ["os::unix-apis", "date-and-time", "filesystem", "network-programming"]
15include = ["src", "build.rs", "Cargo.toml", "COPYRIGHT", "LICENSE*", "/*.md", "benches"]
16rust-version = "1.63"
17
18[dependencies]
19bitflags = { version = "2.4.0", default-features = false }
20itoa = { version = "1.0.1", default-features = false, optional = true }
21
22# Special dependencies used in rustc-dep-of-std mode.
23core = { version = "1.0.0", optional = true, package = "rustc-std-workspace-core" }
24alloc = { version = "1.0.0", optional = true, package = "rustc-std-workspace-alloc" }
25compiler_builtins = { version = '0.1.49', optional = true }
26
27# The procfs feature needs once_cell.
28# With Rust 1.70.0, we can switch to `core::cell::OnceCell`.
29[target.'cfg(any(target_os = "android", target_os = "linux"))'.dependencies]
30once_cell = { version = "1.5.2", optional = true }
31
32# Dependencies for platforms where linux_raw is supported, in addition to libc:
33#
34# On Linux on selected architectures, the linux_raw backend is supported, in
35# addition to the libc backend. The linux_raw backend is used by default. The
36# libc backend can be selected via adding `--cfg=rustix_use_libc` to
37# `RUSTFLAGS` or enabling the `use-libc` cargo feature.
38[target.'cfg(all(not(rustix_use_libc), not(miri), target_os = "linux", target_endian = "little", any(target_arch = "arm", all(target_arch = "aarch64", target_pointer_width = "64"), target_arch = "riscv64", all(rustix_use_experimental_asm, target_arch = "powerpc64"), all(rustix_use_experimental_asm, target_arch = "mips"), all(rustix_use_experimental_asm, target_arch = "mips32r6"), all(rustix_use_experimental_asm, target_arch = "mips64"), all(rustix_use_experimental_asm, target_arch = "mips64r6"), target_arch = "x86", all(target_arch = "x86_64", target_pointer_width = "64"))))'.dependencies]
39linux-raw-sys = { version = "0.4.12", default-features = false, features = ["general", "errno", "ioctl", "no_std", "elf"] }
40libc_errno = { package = "errno", version = "0.3.8", default-features = false, optional = true }
41libc = { version = "0.2.153", default-features = false, features = ["extra_traits"], optional = true }
42
43# Dependencies for platforms where only libc is supported:
44#
45# On all other Unix-family platforms, and under Miri, we always use the libc
46# backend, so enable its dependencies unconditionally.
47[target.'cfg(all(not(windows), any(rustix_use_libc, miri, not(all(target_os = "linux", target_endian = "little", any(target_arch = "arm", all(target_arch = "aarch64", target_pointer_width = "64"), target_arch = "riscv64", all(rustix_use_experimental_asm, target_arch = "powerpc64"), all(rustix_use_experimental_asm, target_arch = "mips"), all(rustix_use_experimental_asm, target_arch = "mips32r6"), all(rustix_use_experimental_asm, target_arch = "mips64"), all(rustix_use_experimental_asm, target_arch = "mips64r6"), target_arch = "x86", all(target_arch = "x86_64", target_pointer_width = "64")))))))'.dependencies]
48libc_errno = { package = "errno", version = "0.3.8", default-features = false }
49libc = { version = "0.2.153", default-features = false, features = ["extra_traits"] }
50
51# Additional dependencies for Linux with the libc backend:
52#
53# Some syscalls do not have libc wrappers, such as in `io_uring`. For these,
54# the libc backend uses the linux-raw-sys ABI and `libc::syscall`.
55[target.'cfg(all(any(target_os = "android", target_os = "linux"), any(rustix_use_libc, miri, not(all(target_os = "linux", target_endian = "little", any(target_arch = "arm", all(target_arch = "aarch64", target_pointer_width = "64"), target_arch = "riscv64", all(rustix_use_experimental_asm, target_arch = "powerpc64"), all(rustix_use_experimental_asm, target_arch = "mips"), all(rustix_use_experimental_asm, target_arch = "mips32r6"), all(rustix_use_experimental_asm, target_arch = "mips64"), all(rustix_use_experimental_asm, target_arch = "mips64r6"), target_arch = "x86", all(target_arch = "x86_64", target_pointer_width = "64")))))))'.dependencies]
56linux-raw-sys = { version = "0.4.12", default-features = false, features = ["general", "ioctl", "no_std"] }
57
58# For the libc backend on Windows, use the Winsock API in windows-sys.
59[target.'cfg(windows)'.dependencies.windows-sys]
60version = "0.52.0"
61features = [
62 "Win32_Foundation",
63 "Win32_Networking_WinSock",
64 "Win32_NetworkManagement_IpHelper",
65 "Win32_System_Threading"
66]
67
68# For the libc backend on Windows, also use the errno crate, which has Windows
69# support.
70[target.'cfg(windows)'.dependencies.libc_errno]
71version = "0.3.8"
72package = "errno"
73default-features = false
74
75[dev-dependencies]
76tempfile = "3.5.0"
77libc = "0.2.153"
78libc_errno = { package = "errno", version = "0.3.8", default-features = false }
79serial_test = "2.0.0"
80memoffset = "0.9.0"
81flate2 = "1.0"
82static_assertions = "1.1.0"
83
84[target.'cfg(all(criterion, not(any(target_os = "emscripten", target_os = "wasi"))))'.dev-dependencies]
85criterion = "0.4"
86
87[target.'cfg(windows)'.dev-dependencies]
88ctor = "0.2.0"
89
90# Add Criterion configuration, as described here:
91# <https://bheisler.github.io/criterion.rs/book/getting_started.html#step-1---add-dependency-to-cargotoml>
92[[bench]]
93name = "mod"
94harness = false
95
96[package.metadata.docs.rs]
97features = ["all-apis"]
98rustdoc-args = ["--cfg", "doc_cfg"]
99targets = [
100 "x86_64-unknown-linux-gnu",
101 "i686-unknown-linux-gnu",
102 "x86_64-apple-darwin",
103 "x86_64-pc-windows-msvc",
104 "x86_64-unknown-freebsd",
105 "x86_64-unknown-openbsd",
106 "x86_64-unknown-netbsd",
107 "x86_64-unknown-dragonfly",
108 "x86_64-unknown-illumos",
109 "x86_64-unknown-redox",
110 "x86_64-unknown-haiku",
111 "wasm32-unknown-emscripten",
112 "wasm32-wasi",
113]
114
115[features]
116
117# By default, use `std` and use libc for aux values.
118#
119# It turns out to be bizarrely awkward to obtain the aux values reliably and
120# efficiently on Linux from anywhere other than libc. We can do it, but most
121# users are better served by just using libc for this.
122default = ["std", "use-libc-auxv"]
123
124# This enables use of std. Disabling this enables `#![no_std]`, and requires
125# Rust 1.64 or newer.
126std = ["bitflags/std", "alloc", "libc?/std", "libc_errno?/std"]
127
128# Enable this to request the libc backend.
129use-libc = ["libc_errno", "libc"]
130
131# Enable `rustix::event::*`.
132event = []
133
134# Enable `rustix::fs::*`.
135fs = []
136
137# Enable `rustix::io_uring::*` (on platforms that support it).
138io_uring = ["event", "fs", "net", "linux-raw-sys/io_uring"]
139
140# Enable `rustix::mount::*`.
141mount = []
142
143# Enable `rustix::net::*`.
144net = ["linux-raw-sys/net", "linux-raw-sys/netlink", "linux-raw-sys/if_ether", "linux-raw-sys/xdp"]
145
146# Enable `rustix::thread::*`.
147thread = ["linux-raw-sys/prctl"]
148
149# Enable `rustix::process::*`.
150process = ["linux-raw-sys/prctl"]
151
152# Enable `rustix::shm::*`.
153shm = ["fs"]
154
155# Enable `rustix::time::*`.
156time = []
157
158# Enable `rustix::param::*`.
159param = ["fs"]
160
161# Enable this to enable `rustix::io::proc_self_*` (on Linux) and `ttyname`.
162procfs = ["once_cell", "itoa", "fs"]
163
164# Enable `rustix::pty::*`.
165pty = ["itoa", "fs"]
166
167# Enable `rustix::termios::*`.
168termios = []
169
170# Enable `rustix::mm::*`.
171mm = []
172
173# Enable `rustix::pipe::*`.
174pipe = []
175
176# Enable `rustix::rand::*`.
177rand = []
178
179# Enable `rustix::stdio::*`.
180stdio = []
181
182# Enable `rustix::system::*`.
183system = ["linux-raw-sys/system"]
184
185# Enable `rustix::runtime::*`. This API is undocumented and unstable and
186# experimental and not intended for general-purpose use.
187runtime = ["linux-raw-sys/prctl"]
188
189# Enable all API features.
190all-apis = [
191 "event",
192 "fs",
193 "io_uring",
194 "mm",
195 "mount",
196 "net",
197 "param",
198 "pipe",
199 "process",
200 "procfs",
201 "pty",
202 "rand",
203 "runtime",
204 "shm",
205 "stdio",
206 "system",
207 "termios",
208 "thread",
209 "time",
210]
211
212# When using the linux_raw backend, should we use libc for reading the aux
213# vectors, instead of reading them ourselves from /proc/self/auxv?
214use-libc-auxv = []
215
216# Enable "use-explicitly-provided-auxv" mode, with a public
217# `rustix::param::init` function that must be called before anything else in
218# rustix. This is unstable and experimental and not intended for
219# general-purpose use.
220use-explicitly-provided-auxv = []
221
222# OS compatibility features
223
224# Optimize for Linux 4.11 or later
225linux_4_11 = []
226
227# Enable all optimizations for the latest Linux versions.
228linux_latest = ["linux_4_11"]
229
230# Enable features which depend on the Rust global allocator, such as functions
231# that return owned strings or `Vec`s.
232alloc = []
233
234# This is used in the port of std to rustix. This is experimental and not meant
235# for regular use.
236rustc-dep-of-std = [
237 "dep:core",
238 "dep:alloc",
239 "dep:compiler_builtins",
240 "linux-raw-sys/rustc-dep-of-std",
241 "bitflags/rustc-dep-of-std",
242 "compiler_builtins?/rustc-dep-of-std",
243]
244
245# Obsolete and deprecated.
246cc = []
247