• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1[package]
2name = "rustix"
3version = "0.36.8"
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.2.1"
23itoa = { version = "1.0.1", default-features = false, optional = true }
24io-lifetimes = { version = "1.0.0", 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.1.2", default-features = false, features = ["general", "errno", "ioctl", "no_std"] }
43libc_errno = { package = "errno", version = "0.2.8", default-features = false, optional = true }
44libc = { version = "0.2.133", 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(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.2.8", default-features = false }
52libc = { version = "0.2.133", 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.1.2", default-features = false, features = ["general", "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.45.0"
64features = [
65    "Win32_Foundation",
66    "Win32_Networking_WinSock",
67    "Win32_NetworkManagement_IpHelper",
68    "Win32_System_Threading"
69]
70
71[dev-dependencies]
72tempfile = "3.2.0"
73libc = "0.2.133"
74libc_errno = { package = "errno", version = "0.2.8", default-features = false }
75io-lifetimes = { version = "1.0.0", default-features = false, features = ["close"] }
76# Don't upgrade to serial_test 0.7 for now because it depends on a
77# `parking_lot_core` version which is not compatible with our MSRV of 1.48.
78serial_test = "0.6"
79memoffset = "0.7.1"
80flate2 = "1.0"
81
82[target.'cfg(all(criterion, not(any(target_os = "emscripten", target_os = "wasi"))))'.dev-dependencies]
83criterion = "0.4"
84
85[target.'cfg(windows)'.dev-dependencies]
86ctor = "0.1.21"
87
88# Add Criterion configuration, as described here:
89# <https://bheisler.github.io/criterion.rs/book/getting_started.html#step-1---add-dependency-to-cargotoml>
90[[bench]]
91name = "mod"
92harness = false
93
94[package.metadata.docs.rs]
95features = ["all-apis"]
96rustdoc-args = ["--cfg", "doc_cfg"]
97targets = [
98    "x86_64-unknown-linux-gnu",
99    "i686-unknown-linux-gnu",
100    "x86_64-apple-darwin",
101    "x86_64-pc-windows-msvc",
102]
103
104[features]
105
106# By default, use `std` and use libc for aux values.
107#
108# It turns out to be bizarrely awkward to obtain the aux values reliably and
109# efficiently on Linux from anywhere other than libc. We can do it, but most
110# users are better served by just using libc for this.
111default = ["std", "use-libc-auxv"]
112
113# This enables use of std. Disabling this enables `#![no_std], and requires
114# Rust 1.64 or newer.
115std = ["io-lifetimes"]
116
117# This is used in the port of std to rustix.
118rustc-dep-of-std = [
119    "core",
120    "alloc",
121    "compiler_builtins",
122    "linux-raw-sys/rustc-dep-of-std",
123    "bitflags/rustc-dep-of-std",
124]
125
126# Enable this to request the libc backend.
127use-libc = ["libc_errno", "libc"]
128
129# Enable `rustix::fs::*`.
130fs = []
131
132# Enable `rustix::io_uring::*` (on platforms that support it).
133io_uring = ["fs", "net"]
134
135# Enable `rustix::net::*`.
136net = []
137
138# Enable `rustix::thread::*`.
139thread = []
140
141# Enable `rustix::process::*`.
142process = []
143
144# Enable `rustix::time::*`.
145time = []
146
147# Enable `rustix::param::*`.
148param = ["fs"]
149
150# Enable this to enable `rustix::io::proc_self_*` (on Linux) and `ttyname`.
151procfs = ["once_cell", "itoa", "fs"]
152
153# Enable `rustix::termios::*`.
154termios = []
155
156# Enable `rustix::mm::*`.
157mm = []
158
159# Enable `rustix::rand::*`.
160rand = []
161
162# Enable `rustix::runtime::*`. This API is undocumented and unstable.
163runtime = []
164
165# Enable all API features.
166all-apis = [
167    "fs",
168    "io_uring",
169    "mm",
170    "net",
171    "param",
172    "process",
173    "procfs",
174    "rand",
175    "runtime",
176    "termios",
177    "thread",
178    "time",
179]
180
181# When using the linux_raw backend, and not using Mustang, should we use libc
182# for reading the aux vectors, instead of reading them ourselves from
183# /proc/self/auxv?
184use-libc-auxv = ["libc"]
185
186# Expose io-lifetimes' features for third-party crate impls.
187# Some of these are temporarily disabled, until the upstream creates add the
188# needed trait implementations.
189#async-std = ["io-lifetimes/async-std"]
190#tokio = ["io-lifetimes/tokio"]
191os_pipe = ["io-lifetimes/os_pipe"]
192#socket2 = ["io-lifetimes/socket2"]
193#mio = ["io-lifetimes/mio"]
194fs-err = ["io-lifetimes/fs-err"]
195#all-impls = ["async-std", "tokio", "os_pipe", "socket2", "mio", "fs-err"]
196all-impls = ["os_pipe", "fs-err"]
197