1[package]
2name = "rustix"
3version = "0.37.27"
4authors = [
5 "Dan Gohman <dev@sunfishcode.online>",
6 "Jakub Konka <kubkon@jakubkonka.com>",
7]
8description = "Safe Rust bindings to POSIX/Unix/Linux/Winsock2-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 = "2018"
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.48"
17
18[build-dependencies]
19cc = { version = "1.0.68", optional = true }
20
21[dependencies]
22bitflags = "1.3.2"
23itoa = { version = "1.0.1", default-features = false, optional = true }
24io-lifetimes = { version = "1.0.10", default-features = false, features = ["close"], optional = true }
25
26# Special dependencies used in rustc-dep-of-std mode.
27core = { version = "1.0.0", optional = true, package = "rustc-std-workspace-core" }
28alloc = { version = "1.0.0", optional = true, package = "rustc-std-workspace-alloc" }
29compiler_builtins = { version = '0.1.49', optional = true }
30
31# The procfs feature needs once_cell.
32[target.'cfg(any(target_os = "android", target_os = "linux"))'.dependencies]
33once_cell = { version = "1.5.2", optional = true }
34
35# Dependencies for platforms where linux_raw is supported, in addition to libc:
36#
37# On Linux on selected architectures, the linux_raw backend is supported, in
38# addition to the libc backend. The linux_raw backend is used by default. The
39# libc backend can be selected via adding `--cfg=rustix_use_libc` to
40# `RUSTFLAGS` or enabling the `use-libc` cargo feature.
41[target.'cfg(all(not(rustix_use_libc), not(miri), target_os = "linux", any(target_arch = "x86", all(target_arch = "x86_64", target_pointer_width = "64"), all(target_endian = "little", any(target_arch = "arm", all(target_arch = "aarch64", target_pointer_width = "64"), target_arch = "powerpc64", target_arch = "riscv64", target_arch = "mips", target_arch = "mips64")))))'.dependencies]
42linux-raw-sys = { version = "0.3.6", default-features = false, features = ["general", "errno", "ioctl", "no_std"] }
43libc_errno = { package = "errno", version = "0.3.1", default-features = false, optional = true }
44libc = { version = "0.2.144", features = ["extra_traits"], optional = true }
45
46# Dependencies for platforms where only libc is supported:
47#
48# On all other Unix-family platforms, and under Miri, we always use the libc
49# backend, so enable its dependencies unconditionally.
50[target.'cfg(all(not(windows), any(rustix_use_libc, miri, not(all(target_os = "linux", any(target_arch = "x86", all(target_arch = "x86_64", target_pointer_width = "64"), all(target_endian = "little", any(target_arch = "arm", all(target_arch = "aarch64", target_pointer_width = "64"), target_arch = "powerpc64", target_arch = "riscv64", target_arch = "mips", target_arch = "mips64"))))))))'.dependencies]
51libc_errno = { package = "errno", version = "0.3.1", default-features = false }
52libc = { version = "0.2.144", features = ["extra_traits"] }
53
54# Additional dependencies for Linux with the libc backend:
55#
56# Some syscalls do not have libc wrappers, such as in `io_uring`. For these,
57# the libc backend uses the linux-raw-sys ABI and `libc::syscall`.
58[target.'cfg(all(any(target_os = "android", target_os = "linux"), any(rustix_use_libc, miri, not(all(target_os = "linux", any(target_arch = "x86", all(target_arch = "x86_64", target_pointer_width = "64"), all(target_endian = "little", any(target_arch = "arm", all(target_arch = "aarch64", target_pointer_width = "64"), target_arch = "powerpc64", target_arch = "riscv64", target_arch = "mips", target_arch = "mips64"))))))))'.dependencies]
59linux-raw-sys = { version = "0.3.6", default-features = false, features = ["general", "ioctl", "no_std"] }
60
61# For the libc backend on Windows, use the Winsock2 API in windows-sys.
62[target.'cfg(windows)'.dependencies.windows-sys]
63version = "0.48.0"
64features = [
65 "Win32_Foundation",
66 "Win32_Networking_WinSock",
67 "Win32_NetworkManagement_IpHelper",
68 "Win32_System_Threading"
69]
70
71# For the libc backend on Windows, also use the errno crate, which has Windows
72# support.
73[target.'cfg(windows)'.dependencies.libc_errno]
74version = "0.3.1"
75package = "errno"
76default-features = false
77
78[dev-dependencies]
79tempfile = "3.4.0"
80libc = "0.2.144"
81libc_errno = { package = "errno", version = "0.3.1", default-features = false }
82io-lifetimes = { version = "1.0.10", default-features = false, features = ["close"] }
83memoffset = "0.9.0"
84flate2 = "1.0"
85
86[target.'cfg(windows)'.dev-dependencies]
87ctor = "0.2.0"
88
89[package.metadata.docs.rs]
90features = ["all-apis"]
91rustdoc-args = ["--cfg", "doc_cfg"]
92targets = [
93 "x86_64-unknown-linux-gnu",
94 "i686-unknown-linux-gnu",
95 "x86_64-apple-darwin",
96 "x86_64-pc-windows-msvc",
97 "x86_64-unknown-freebsd",
98 "x86_64-unknown-openbsd",
99 "x86_64-unknown-netbsd",
100 "x86_64-unknown-dragonfly",
101 "x86_64-unknown-illumos",
102 "x86_64-unknown-redox",
103 "x86_64-unknown-haiku",
104 "wasm32-unknown-emscripten",
105 "wasm32-wasi",
106]
107
108[features]
109
110# By default, use `std` and use libc for aux values.
111#
112# It turns out to be bizarrely awkward to obtain the aux values reliably and
113# efficiently on Linux from anywhere other than libc. We can do it, but most
114# users are better served by just using libc for this.
115default = ["std", "use-libc-auxv"]
116
117# This enables use of std. Disabling this enables `#![no_std], and requires
118# Rust 1.64 or newer.
119std = ["io-lifetimes"]
120
121# This is used in the port of std to rustix.
122rustc-dep-of-std = [
123 "core",
124 "alloc",
125 "compiler_builtins",
126 "linux-raw-sys/rustc-dep-of-std",
127 "bitflags/rustc-dep-of-std",
128]
129
130# Enable this to request the libc backend.
131use-libc = ["libc_errno", "libc"]
132
133# Enable `rustix::fs::*`.
134fs = []
135
136# Enable `rustix::io_uring::*` (on platforms that support it).
137io_uring = ["fs", "net"]
138
139# Enable `rustix::net::*`.
140net = []
141
142# Enable `rustix::thread::*`.
143thread = []
144
145# Enable `rustix::process::*`.
146process = []
147
148# Enable `rustix::time::*`.
149time = []
150
151# Enable `rustix::param::*`.
152param = ["fs"]
153
154# Enable this to enable `rustix::io::proc_self_*` (on Linux) and `ttyname`.
155procfs = ["once_cell", "itoa", "fs"]
156
157# Enable `rustix::pty::*`.
158pty = ["itoa", "fs"]
159
160# Enable `rustix::termios::*`.
161termios = []
162
163# Enable `rustix::mm::*`.
164mm = []
165
166# Enable `rustix::rand::*`.
167rand = []
168
169# Enable `rustix::runtime::*`. This API is undocumented and unstable and
170# experimental and not intended for general-purpose use.
171runtime = []
172
173# Enable all API features.
174all-apis = [
175 "fs",
176 "io_uring",
177 "mm",
178 "net",
179 "param",
180 "process",
181 "procfs",
182 "pty",
183 "rand",
184 "runtime",
185 "termios",
186 "thread",
187 "time",
188]
189
190# When using the linux_raw backend, and not using Mustang, should we use libc
191# for reading the aux vectors, instead of reading them ourselves from
192# /proc/self/auxv?
193use-libc-auxv = ["libc"]
194
195# Expose io-lifetimes' features for third-party crate impls.
196# Some of these are temporarily disabled, until the upstream crates add the
197# needed trait implementations.
198#async-std = ["io-lifetimes/async-std"]
199#tokio = ["io-lifetimes/tokio"]
200os_pipe = ["io-lifetimes/os_pipe"]
201#socket2 = ["io-lifetimes/socket2"]
202#mio = ["io-lifetimes/mio"]
203fs-err = ["io-lifetimes/fs-err"]
204#all-impls = ["async-std", "tokio", "os_pipe", "socket2", "mio", "fs-err"]
205all-impls = ["os_pipe", "fs-err"]
206
207# OS compatability features
208
209# Optimize for Linux 4.11 or later
210linux_4_11 = []
211
212# Enable all optimizations for the latest Linux versions.
213linux_latest = ["linux_4_11"]
214