| 1 | [package] |
| 2 | name = "rustix" |
| 3 | version = "1.0.5" |
| 4 | authors = [ |
| 5 | "Dan Gohman <dev@sunfishcode.online>" , |
| 6 | "Jakub Konka <kubkon@jakubkonka.com>" , |
| 7 | ] |
| 8 | description = "Safe Rust bindings to POSIX/Unix/Linux/Winsock-like syscalls" |
| 9 | documentation = "https://docs.rs/rustix" |
| 10 | license = "Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT" |
| 11 | repository = "https://github.com/bytecodealliance/rustix" |
| 12 | edition = "2021" |
| 13 | keywords = ["api" , "file" , "network" , "safe" , "syscall" ] |
| 14 | categories = ["os::unix-apis" , "date-and-time" , "filesystem" , "network-programming" ] |
| 15 | include = ["src" , "build.rs" , "Cargo.toml" , "COPYRIGHT" , "LICENSE*" , "/*.md" , "benches" ] |
| 16 | rust-version = "1.63" |
| 17 | |
| 18 | [dependencies] |
| 19 | bitflags = { version = "2.4.0" , default-features = false } |
| 20 | |
| 21 | # Special dependencies used in rustc-dep-of-std mode. |
| 22 | core = { version = "1.0.0" , optional = true, package = "rustc-std-workspace-core" } |
| 23 | rustc-std-workspace-alloc = { version = "1.0.0" , optional = true } # not aliased here but in lib.rs because of name collision with the alloc feature |
| 24 | compiler_builtins = { version = '0.1.49' , optional = true } |
| 25 | |
| 26 | # Dependencies for platforms where linux_raw is supported, in addition to libc: |
| 27 | # |
| 28 | # On Linux on selected architectures, the linux_raw backend is supported, in |
| 29 | # addition to the libc backend. The linux_raw backend is used by default. The |
| 30 | # libc backend can be selected via adding `--cfg=rustix_use_libc` to |
| 31 | # `RUSTFLAGS` or enabling the `use-libc` cargo feature. |
| 32 | [target.'cfg(all(not(rustix_use_libc), not(miri), target_os = "linux", any(target_endian = "little", any(target_arch = "s390x", target_arch = "powerpc")), any(target_arch = "arm", all(target_arch = "aarch64", target_pointer_width = "64"), target_arch = "riscv64", all(rustix_use_experimental_asm, target_arch = "powerpc"), all(rustix_use_experimental_asm, target_arch = "powerpc64"), all(rustix_use_experimental_asm, target_arch = "s390x"), 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] |
| 33 | linux-raw-sys = { version = "0.9.2" , default-features = false, features = ["general" , "errno" , "ioctl" , "no_std" , "elf" ] } |
| 34 | libc_errno = { package = "errno" , version = "0.3.10" , default-features = false, optional = true } |
| 35 | libc = { version = "0.2.168" , default-features = false, optional = true } |
| 36 | |
| 37 | # Dependencies for platforms where only libc is supported: |
| 38 | # |
| 39 | # On all other Unix-family platforms, and under Miri, we always use the libc |
| 40 | # backend, so enable its dependencies unconditionally. |
| 41 | [target.'cfg(all(not(windows), any(rustix_use_libc, miri, not(all(target_os = "linux", any(target_endian = "little", any(target_arch = "s390x", target_arch = "powerpc")), any(target_arch = "arm", all(target_arch = "aarch64", target_pointer_width = "64"), target_arch = "riscv64", all(rustix_use_experimental_asm, target_arch = "powerpc"), all(rustix_use_experimental_asm, target_arch = "powerpc64"), all(rustix_use_experimental_asm, target_arch = "s390x"), 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] |
| 42 | libc_errno = { package = "errno" , version = "0.3.10" , default-features = false } |
| 43 | libc = { version = "0.2.168" , default-features = false } |
| 44 | |
| 45 | # Additional dependencies for Linux with the libc backend: |
| 46 | # |
| 47 | # Some syscalls do not have libc wrappers, such as in `io_uring`. For these, |
| 48 | # the libc backend uses the linux-raw-sys ABI and `libc::syscall`. |
| 49 | [target.'cfg(all(any(target_os = "android", target_os = "linux"), any(rustix_use_libc, miri, not(all(target_os = "linux", any(target_endian = "little", any(target_arch = "s390x", target_arch = "powerpc")), any(target_arch = "arm", all(target_arch = "aarch64", target_pointer_width = "64"), target_arch = "riscv64", all(rustix_use_experimental_asm, target_arch = "powerpc"), all(rustix_use_experimental_asm, target_arch = "powerpc64"), all(rustix_use_experimental_asm, target_arch = "s390x"), 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] |
| 50 | linux-raw-sys = { version = "0.9.2" , default-features = false, features = ["general" , "ioctl" , "no_std" ] } |
| 51 | |
| 52 | # For the libc backend on Windows, use the Winsock API in windows-sys. |
| 53 | [target.'cfg(windows)'.dependencies.windows-sys] |
| 54 | version = ">=0.52, <0.60" |
| 55 | features = [ |
| 56 | "Win32_Foundation" , |
| 57 | "Win32_Networking_WinSock" , |
| 58 | ] |
| 59 | |
| 60 | # For the libc backend on Windows, also use the errno crate, which has Windows |
| 61 | # support. |
| 62 | [target.'cfg(windows)'.dependencies.libc_errno] |
| 63 | version = "0.3.10" |
| 64 | package = "errno" |
| 65 | default-features = false |
| 66 | |
| 67 | [dev-dependencies] |
| 68 | tempfile = "3.5.0" |
| 69 | libc = "0.2.168" |
| 70 | libc_errno = { package = "errno" , version = "0.3.10" , default-features = false } |
| 71 | serial_test = "2.0.0" |
| 72 | memoffset = "0.9.0" |
| 73 | flate2 = "1.0" |
| 74 | static_assertions = "1.1.0" |
| 75 | |
| 76 | # With Rust 1.70 this can be removed in favor of `std::sync::OnceLock`. |
| 77 | [target.'cfg(windows)'.dev-dependencies] |
| 78 | once_cell = "1.20.3" |
| 79 | |
| 80 | [target.'cfg(all(criterion, not(any(target_os = "emscripten", target_os = "wasi"))))'.dev-dependencies] |
| 81 | criterion = "0.4" |
| 82 | |
| 83 | # Add Criterion configuration, as described here: |
| 84 | # <https://bheisler.github.io/criterion.rs/book/getting_started.html#step-1---add-dependency-to-cargotoml> |
| 85 | [[bench]] |
| 86 | name = "mod" |
| 87 | harness = false |
| 88 | |
| 89 | [package.metadata.docs.rs] |
| 90 | features = ["all-apis" ] |
| 91 | targets = [ |
| 92 | "x86_64-unknown-linux-gnu" , |
| 93 | "i686-unknown-linux-gnu" , |
| 94 | "x86_64-apple-darwin" , |
| 95 | "x86_64-pc-windows-msvc" , |
| 96 | "x86_64-unknown-freebsd" , |
| 97 | "x86_64-unknown-openbsd" , |
| 98 | "x86_64-unknown-netbsd" , |
| 99 | "x86_64-unknown-dragonfly" , |
| 100 | "x86_64-unknown-illumos" , |
| 101 | "x86_64-unknown-redox" , |
| 102 | "x86_64-unknown-haiku" , |
| 103 | "wasm32-unknown-emscripten" , |
| 104 | "wasm32-wasip1" , |
| 105 | ] |
| 106 | |
| 107 | [features] |
| 108 | |
| 109 | # By default, use `std`. |
| 110 | default = ["std" ] |
| 111 | |
| 112 | # This enables use of std. Disabling this enables `#![no_std]`, and requires |
| 113 | # Rust 1.77 or newer. |
| 114 | std = ["bitflags/std" , "alloc" , "libc?/std" , "libc_errno?/std" ] |
| 115 | |
| 116 | # Enable this to request the libc backend. |
| 117 | use-libc = ["libc_errno" , "libc" ] |
| 118 | |
| 119 | # Enable `rustix::event::*`. |
| 120 | event = [] |
| 121 | |
| 122 | # Enable `rustix::fs::*`. |
| 123 | fs = [] |
| 124 | |
| 125 | # Enable `rustix::io_uring::*` (on platforms that support it). |
| 126 | io_uring = ["event" , "fs" , "net" , "thread" , "linux-raw-sys/io_uring" ] |
| 127 | |
| 128 | # Enable `rustix::mount::*`. |
| 129 | mount = [] |
| 130 | |
| 131 | # Enable `rustix::net::*`. |
| 132 | net = ["linux-raw-sys/net" , "linux-raw-sys/netlink" , "linux-raw-sys/if_ether" , "linux-raw-sys/xdp" ] |
| 133 | |
| 134 | # Enable `rustix::thread::*`. |
| 135 | thread = ["linux-raw-sys/prctl" ] |
| 136 | |
| 137 | # Enable `rustix::process::*`. |
| 138 | process = ["linux-raw-sys/prctl" ] |
| 139 | |
| 140 | # Enable `rustix::shm::*`. |
| 141 | shm = ["fs" ] |
| 142 | |
| 143 | # Enable `rustix::time::*`. |
| 144 | time = [] |
| 145 | |
| 146 | # Enable `rustix::param::*`. |
| 147 | param = [] |
| 148 | |
| 149 | # Enable `rustix::pty::*`. |
| 150 | pty = ["fs" ] |
| 151 | |
| 152 | # Enable `rustix::termios::*`. |
| 153 | termios = [] |
| 154 | |
| 155 | # Enable `rustix::mm::*`. |
| 156 | mm = [] |
| 157 | |
| 158 | # Enable `rustix::pipe::*`. |
| 159 | pipe = [] |
| 160 | |
| 161 | # Enable `rustix::rand::*`. |
| 162 | rand = [] |
| 163 | |
| 164 | # Enable `rustix::stdio::*`. |
| 165 | stdio = [] |
| 166 | |
| 167 | # Enable `rustix::system::*`. |
| 168 | system = ["linux-raw-sys/system" ] |
| 169 | |
| 170 | # Enable `rustix::runtime::*`. ⚠ This API is undocumented and unstable and |
| 171 | # experimental and not intended for general-purpose use. ⚠ |
| 172 | runtime = ["linux-raw-sys/prctl" ] |
| 173 | |
| 174 | # Enable all API features. |
| 175 | # |
| 176 | # This is primarily intended for rustix developers. Users are encouraged to |
| 177 | # enable only those features they need. |
| 178 | all-apis = [ |
| 179 | "event" , |
| 180 | "fs" , |
| 181 | "io_uring" , |
| 182 | "mm" , |
| 183 | "mount" , |
| 184 | "net" , |
| 185 | "param" , |
| 186 | "pipe" , |
| 187 | "process" , |
| 188 | "pty" , |
| 189 | "rand" , |
| 190 | "runtime" , |
| 191 | "shm" , |
| 192 | "stdio" , |
| 193 | "system" , |
| 194 | "termios" , |
| 195 | "thread" , |
| 196 | "time" , |
| 197 | ] |
| 198 | |
| 199 | # When using the linux_raw backend, should we use `getauxval` for reading aux |
| 200 | # vectors, instead of `PR_GET_AUXV` or "/proc/self/auxv"? |
| 201 | use-libc-auxv = [] |
| 202 | |
| 203 | # Enable "use-explicitly-provided-auxv" mode, with a public |
| 204 | # `rustix::param::init` function that must be called before anything else in |
| 205 | # rustix. This is unstable and experimental and not intended for |
| 206 | # general-purpose use. |
| 207 | use-explicitly-provided-auxv = [] |
| 208 | |
| 209 | # OS compatibility features |
| 210 | |
| 211 | # Specialize for Linux 4.11 or later |
| 212 | linux_4_11 = [] |
| 213 | |
| 214 | # Specialize for Linux 5.1 or later |
| 215 | linux_5_1 = ["linux_4_11" ] |
| 216 | |
| 217 | # Specialize for Linux 5.11 or later |
| 218 | linux_5_11 = ["linux_5_1" ] |
| 219 | |
| 220 | # Enable all specializations for the latest Linux versions. |
| 221 | linux_latest = ["linux_5_11" ] |
| 222 | |
| 223 | # Enable features which depend on the Rust global allocator, such as functions |
| 224 | # that return owned strings or `Vec`s. |
| 225 | alloc = [] |
| 226 | |
| 227 | # This is used in the port of std to rustix. This is experimental and not meant |
| 228 | # for regular use. |
| 229 | rustc-dep-of-std = [ |
| 230 | "core" , |
| 231 | "rustc-std-workspace-alloc" , |
| 232 | "compiler_builtins" , |
| 233 | "linux-raw-sys/rustc-dep-of-std" , |
| 234 | "bitflags/rustc-dep-of-std" , |
| 235 | "compiler_builtins?/rustc-dep-of-std" , |
| 236 | ] |
| 237 | |
| 238 | # Enable `rustix::io::try_close`. The rustix developers do not intend the |
| 239 | # existence of this feature to imply that anyone should use it. |
| 240 | try_close = [] |
| 241 | |
| 242 | [lints.rust.unexpected_cfgs] |
| 243 | level = "warn" |
| 244 | check-cfg = [ |
| 245 | 'cfg(alloc_c_string)' , |
| 246 | 'cfg(alloc_ffi)' , |
| 247 | 'cfg(apple)' , |
| 248 | 'cfg(asm_experimental_arch)' , |
| 249 | 'cfg(bsd)' , |
| 250 | 'cfg(core_c_str)' , |
| 251 | 'cfg(core_ffi_c)' , |
| 252 | 'cfg(core_intrinsics)' , |
| 253 | 'cfg(criterion)' , |
| 254 | 'cfg(document_experimental_runtime_api)' , |
| 255 | 'cfg(error_in_core)' , |
| 256 | 'cfg(fix_y2038)' , |
| 257 | 'cfg(freebsdlike)' , |
| 258 | 'cfg(libc)' , |
| 259 | 'cfg(linux_kernel)' , |
| 260 | 'cfg(linux_like)' , |
| 261 | 'cfg(linux_raw)' , |
| 262 | 'cfg(netbsdlike)' , |
| 263 | 'cfg(rustc_attrs)' , |
| 264 | 'cfg(solarish)' , |
| 265 | 'cfg(staged_api)' , |
| 266 | 'cfg(static_assertions)' , |
| 267 | 'cfg(thumb_mode)' , |
| 268 | 'cfg(wasi)' , |
| 269 | 'cfg(wasi_ext)' , |
| 270 | 'cfg(wasip2)' , |
| 271 | 'cfg(target_arch, values("xtensa"))' , |
| 272 | 'cfg(target_os, values("cygwin"))' , |
| 273 | ] |
| 274 | |