Update WASI to cap-std 0.25 and windows-sys. (#4302)
This updates to rustix 0.35.6, and updates wasi-common to use cap-std 0.25 and windows-sys (instead of winapi). Changes include: - Better error code mappings on Windows. - Fixes undefined references to `utimensat` on Darwin. - Fixes undefined references to `preadv64` and `pwritev64` on Android. - Updates to io-lifetimes 0.7, which matches the io_safety API in Rust. - y2038 bug fixes for 32-bit platforms
This commit is contained in:
128
Cargo.lock
generated
128
Cargo.lock
generated
@@ -237,21 +237,21 @@ checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cap-fs-ext"
|
name = "cap-fs-ext"
|
||||||
version = "0.24.3"
|
version = "0.25.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "de96a353a1b625fae721c0274552533a75d4961e2f313d5a873076c964e9982e"
|
checksum = "337ddae0c23990d98099a34db274fda588a3ddf89e1961aa2d3ae08d4572b746"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cap-primitives",
|
"cap-primitives",
|
||||||
"cap-std",
|
"cap-std",
|
||||||
"io-lifetimes",
|
"io-lifetimes",
|
||||||
"winapi",
|
"windows-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cap-primitives"
|
name = "cap-primitives"
|
||||||
version = "0.24.3"
|
version = "0.25.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7217718088981caa36e35a01307daeeaad2f6e6e188bf4149d35029dad1c08a2"
|
checksum = "5c13977868250c3102a1737c766c0fe0abea4c9d64b60566b55e3df084a46eb6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ambient-authority",
|
"ambient-authority",
|
||||||
"errno",
|
"errno",
|
||||||
@@ -261,16 +261,16 @@ dependencies = [
|
|||||||
"ipnet",
|
"ipnet",
|
||||||
"maybe-owned",
|
"maybe-owned",
|
||||||
"rustix",
|
"rustix",
|
||||||
"winapi",
|
|
||||||
"winapi-util",
|
"winapi-util",
|
||||||
|
"windows-sys",
|
||||||
"winx",
|
"winx",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cap-rand"
|
name = "cap-rand"
|
||||||
version = "0.24.3"
|
version = "0.25.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "575e96a49058d34b2d75caa6ef677d35569add0fcb16cf7866d1a47a35649a87"
|
checksum = "ff1aa052bd5af24e9d1ad26db37c4bed43e45494366a03321f05beeafaf99bdb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ambient-authority",
|
"ambient-authority",
|
||||||
"rand 0.8.5",
|
"rand 0.8.5",
|
||||||
@@ -278,9 +278,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cap-std"
|
name = "cap-std"
|
||||||
version = "0.24.3"
|
version = "0.25.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5d684df5773e4af5c343c466f47151db7e7a4366daab609b4a6bb7a75aecf732"
|
checksum = "9dc3bec032b93533630adb5cd0e05f4eac5475bf3e9edafc562ccbc44fd5db06"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cap-primitives",
|
"cap-primitives",
|
||||||
"io-extras",
|
"io-extras",
|
||||||
@@ -291,9 +291,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cap-tempfile"
|
name = "cap-tempfile"
|
||||||
version = "0.24.3"
|
version = "0.25.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1def2a81a97ba5f361944b55a96ab0ccf0b3b64bd829c12f20f4bf709ce2ab03"
|
checksum = "4e19d4852b4185065d0744d225fb961a79165f5a6dedfee9175457fbfd1a9bbb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cap-std",
|
"cap-std",
|
||||||
"rand 0.8.5",
|
"rand 0.8.5",
|
||||||
@@ -303,9 +303,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cap-time-ext"
|
name = "cap-time-ext"
|
||||||
version = "0.24.3"
|
version = "0.25.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4ed053e759cc9bb1c2cbdb53d029c76c56820787a65619579b9a7147eaaf307b"
|
checksum = "0486425152c6e3e45528baa8edff1c37e82056cb2105a82836989679b6509326"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cap-primitives",
|
"cap-primitives",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
@@ -1190,13 +1190,13 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fs-set-times"
|
name = "fs-set-times"
|
||||||
version = "0.15.0"
|
version = "0.17.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7df62ee66ee2d532ea8d567b5a3f0d03ecd64636b98bad5be1e93dcc918b92aa"
|
checksum = "344a9d25719061ed11379a5ff2f7222486df7d7211f3c228a1d78fa387706576"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"io-lifetimes",
|
"io-lifetimes",
|
||||||
"rustix",
|
"rustix",
|
||||||
"winapi",
|
"windows-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1402,22 +1402,22 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "io-extras"
|
name = "io-extras"
|
||||||
version = "0.13.2"
|
version = "0.15.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d0c937cc9891c12eaa8c63ad347e4a288364b1328b924886970b47a14ab8f8f8"
|
checksum = "4a5d8c2ab5becd8720e30fd25f8fa5500d8dc3fceadd8378f05859bd7b46fc49"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"io-lifetimes",
|
"io-lifetimes",
|
||||||
"winapi",
|
"windows-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "io-lifetimes"
|
name = "io-lifetimes"
|
||||||
version = "0.5.3"
|
version = "0.7.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ec58677acfea8a15352d42fc87d11d63596ade9239e0a7c9352914417515dbe6"
|
checksum = "24c3f4eff5495aee4c0399d7b6a0dc2b6e81be84242ffbfcf253ebacccc1d0cb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"winapi",
|
"windows-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1428,14 +1428,14 @@ checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "is-terminal"
|
name = "is-terminal"
|
||||||
version = "0.1.0"
|
version = "0.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7c89a757e762896bdbdfadf2860d0f8b0cea5e363d8cf3e7bdfeb63d1d976352"
|
checksum = "0d508111813f9af3afd2f92758f77e4ed2cc9371b642112c6a48d22eb73105c5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hermit-abi 0.2.0",
|
"hermit-abi 0.2.0",
|
||||||
"io-lifetimes",
|
"io-lifetimes",
|
||||||
"rustix",
|
"rustix",
|
||||||
"winapi",
|
"windows-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1541,9 +1541,9 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.125"
|
version = "0.2.126"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5916d2ae698f6de9bfb891ad7a8d65c09d232dc58cc4ac433c7da3b2fd84bc2b"
|
checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libfuzzer-sys"
|
name = "libfuzzer-sys"
|
||||||
@@ -1574,9 +1574,9 @@ checksum = "33a33a362ce288760ec6a508b94caaec573ae7d3bbbd91b87aa0bad4456839db"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "linux-raw-sys"
|
name = "linux-raw-sys"
|
||||||
version = "0.0.42"
|
version = "0.0.46"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5284f00d480e1c39af34e72f8ad60b94f47007e3481cd3b731c1d67190ddc7b7"
|
checksum = "d4d2456c373231a208ad294c33dc5bff30051eafd954cd4caae83a712b12854d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "listenfd"
|
name = "listenfd"
|
||||||
@@ -2453,9 +2453,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustix"
|
name = "rustix"
|
||||||
version = "0.33.7"
|
version = "0.35.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "938a344304321a9da4973b9ff4f9f8db9caf4597dfd9dda6a60b523340a0fff0"
|
checksum = "ef258c11e17f5c01979a10543a30a4e12faef6aab217a74266e747eefa3aed88"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"errno",
|
"errno",
|
||||||
@@ -2464,7 +2464,7 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
"linux-raw-sys",
|
"linux-raw-sys",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"winapi",
|
"windows-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2741,9 +2741,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "system-interface"
|
name = "system-interface"
|
||||||
version = "0.20.0"
|
version = "0.21.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1e09bb3fb4e02ec4b87e182ea9718fadbc0fa3e50085b40a9af9690572b67f9e"
|
checksum = "2e3e98c4cf2f43a7e3b3a943b63fd192559b8a98ddcbef260580f29f0f4b9d1b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"atty",
|
"atty",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
@@ -2751,7 +2751,7 @@ dependencies = [
|
|||||||
"cap-std",
|
"cap-std",
|
||||||
"io-lifetimes",
|
"io-lifetimes",
|
||||||
"rustix",
|
"rustix",
|
||||||
"winapi",
|
"windows-sys",
|
||||||
"winx",
|
"winx",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -3098,7 +3098,7 @@ dependencies = [
|
|||||||
"tempfile",
|
"tempfile",
|
||||||
"tracing",
|
"tracing",
|
||||||
"wasi-common",
|
"wasi-common",
|
||||||
"winapi",
|
"windows-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3114,7 +3114,7 @@ dependencies = [
|
|||||||
"thiserror",
|
"thiserror",
|
||||||
"tracing",
|
"tracing",
|
||||||
"wiggle",
|
"wiggle",
|
||||||
"winapi",
|
"windows-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3162,7 +3162,6 @@ dependencies = [
|
|||||||
"wasi-cap-std-sync",
|
"wasi-cap-std-sync",
|
||||||
"wasi-common",
|
"wasi-common",
|
||||||
"wiggle",
|
"wiggle",
|
||||||
"winapi",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3794,14 +3793,57 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winx"
|
name = "windows-sys"
|
||||||
version = "0.31.0"
|
version = "0.36.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "08d5973cb8cd94a77d03ad7e23bbe14889cb29805da1cec0e4aff75e21aebded"
|
checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2"
|
||||||
|
dependencies = [
|
||||||
|
"windows_aarch64_msvc",
|
||||||
|
"windows_i686_gnu",
|
||||||
|
"windows_i686_msvc",
|
||||||
|
"windows_x86_64_gnu",
|
||||||
|
"windows_x86_64_msvc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_aarch64_msvc"
|
||||||
|
version = "0.36.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_gnu"
|
||||||
|
version = "0.36.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_msvc"
|
||||||
|
version = "0.36.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_gnu"
|
||||||
|
version = "0.36.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_msvc"
|
||||||
|
version = "0.36.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winx"
|
||||||
|
version = "0.33.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b7b01e010390eb263a4518c8cebf86cb67469d1511c00b749a47b64c39e8054d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"io-lifetimes",
|
"io-lifetimes",
|
||||||
"winapi",
|
"windows-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ lazy_static = "1.4.0"
|
|||||||
listenfd = "1.0.0"
|
listenfd = "1.0.0"
|
||||||
|
|
||||||
[target.'cfg(unix)'.dependencies]
|
[target.'cfg(unix)'.dependencies]
|
||||||
rustix = "0.33.7"
|
rustix = { version = "0.35.6", features = ["mm", "param"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
# depend again on wasmtime to activate its default features for tests
|
# depend again on wasmtime to activate its default features for tests
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ wasmtime-wasi = { path = "../wasi" }
|
|||||||
wasmtime-wasi-crypto = { path = "../wasi-crypto", optional = true }
|
wasmtime-wasi-crypto = { path = "../wasi-crypto", optional = true }
|
||||||
wasmtime-wasi-nn = { path = "../wasi-nn", optional = true }
|
wasmtime-wasi-nn = { path = "../wasi-nn", optional = true }
|
||||||
wasi-cap-std-sync = { path = "../wasi-common/cap-std-sync" }
|
wasi-cap-std-sync = { path = "../wasi-common/cap-std-sync" }
|
||||||
cap-std = "0.24.1"
|
cap-std = "0.25.0"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
wat = "1.0"
|
wat = "1.0"
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ wat = { version = "1.0.42", optional = true }
|
|||||||
# Optional dependencies for the `wasi` feature
|
# Optional dependencies for the `wasi` feature
|
||||||
wasi-cap-std-sync = { path = "../wasi-common/cap-std-sync", optional = true }
|
wasi-cap-std-sync = { path = "../wasi-common/cap-std-sync", optional = true }
|
||||||
wasmtime-wasi = { path = "../wasi", optional = true }
|
wasmtime-wasi = { path = "../wasi", optional = true }
|
||||||
cap-std = { version = "0.24.1", optional = true }
|
cap-std = { version = "0.25.0", optional = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ['jitdump', 'wat', 'wasi', 'cache', 'parallel-compilation']
|
default = ['jitdump', 'wat', 'wasi', 'cache', 'parallel-compilation']
|
||||||
|
|||||||
2
crates/cache/Cargo.toml
vendored
2
crates/cache/Cargo.toml
vendored
@@ -24,7 +24,7 @@ zstd = { version = "0.11.1", default-features = false }
|
|||||||
winapi = "0.3.7"
|
winapi = "0.3.7"
|
||||||
|
|
||||||
[target.'cfg(not(target_os = "windows"))'.dependencies]
|
[target.'cfg(not(target_os = "windows"))'.dependencies]
|
||||||
rustix = "0.33.7"
|
rustix = { version = "0.35.6", features = ["process"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
filetime = "0.2.7"
|
filetime = "0.2.7"
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ edition = "2021"
|
|||||||
links = "wasmtime-fiber-shims"
|
links = "wasmtime-fiber-shims"
|
||||||
|
|
||||||
[target.'cfg(unix)'.dependencies]
|
[target.'cfg(unix)'.dependencies]
|
||||||
rustix = "0.33.7"
|
rustix = { version = "0.35.6", features = ["mm", "param"] }
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies.winapi]
|
[target.'cfg(windows)'.dependencies.winapi]
|
||||||
version = "0.3.9"
|
version = "0.3.9"
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ impl FiberStack {
|
|||||||
pub fn new(size: usize) -> io::Result<Self> {
|
pub fn new(size: usize) -> io::Result<Self> {
|
||||||
// Round up our stack size request to the nearest multiple of the
|
// Round up our stack size request to the nearest multiple of the
|
||||||
// page size.
|
// page size.
|
||||||
let page_size = rustix::process::page_size();
|
let page_size = rustix::param::page_size();
|
||||||
let size = if size == 0 {
|
let size = if size == 0 {
|
||||||
page_size
|
page_size
|
||||||
} else {
|
} else {
|
||||||
@@ -57,17 +57,17 @@ impl FiberStack {
|
|||||||
unsafe {
|
unsafe {
|
||||||
// Add in one page for a guard page and then ask for some memory.
|
// Add in one page for a guard page and then ask for some memory.
|
||||||
let mmap_len = size + page_size;
|
let mmap_len = size + page_size;
|
||||||
let mmap = rustix::io::mmap_anonymous(
|
let mmap = rustix::mm::mmap_anonymous(
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
mmap_len,
|
mmap_len,
|
||||||
rustix::io::ProtFlags::empty(),
|
rustix::mm::ProtFlags::empty(),
|
||||||
rustix::io::MapFlags::PRIVATE,
|
rustix::mm::MapFlags::PRIVATE,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
rustix::io::mprotect(
|
rustix::mm::mprotect(
|
||||||
mmap.cast::<u8>().add(page_size).cast(),
|
mmap.cast::<u8>().add(page_size).cast(),
|
||||||
size,
|
size,
|
||||||
rustix::io::MprotectFlags::READ | rustix::io::MprotectFlags::WRITE,
|
rustix::mm::MprotectFlags::READ | rustix::mm::MprotectFlags::WRITE,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
@@ -90,7 +90,7 @@ impl Drop for FiberStack {
|
|||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
unsafe {
|
unsafe {
|
||||||
if let Some(len) = self.len {
|
if let Some(len) = self.len {
|
||||||
let ret = rustix::io::munmap(self.top.sub(len) as _, len);
|
let ret = rustix::mm::munmap(self.top.sub(len) as _, len);
|
||||||
debug_assert!(ret.is_ok());
|
debug_assert!(ret.is_ok());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ lazy_static = {version = "1.3.0", optional = true }
|
|||||||
object = { version = "0.28.0", default-features = false, features = ["std", "read_core"], optional = true }
|
object = { version = "0.28.0", default-features = false, features = ["std", "read_core"], optional = true }
|
||||||
|
|
||||||
[target.'cfg(target_os = "linux")'.dependencies]
|
[target.'cfg(target_os = "linux")'.dependencies]
|
||||||
rustix = { version = "0.33.7", optional = true }
|
rustix = { version = "0.35.6", features = ["mm", "param", "time"], optional = true }
|
||||||
|
|
||||||
[badges]
|
[badges]
|
||||||
maintenance = { status = "actively-developed" }
|
maintenance = { status = "actively-developed" }
|
||||||
|
|||||||
@@ -158,11 +158,11 @@ impl JitDumpFile {
|
|||||||
// To match what some perf examples are doing we keep this `mmap` alive
|
// To match what some perf examples are doing we keep this `mmap` alive
|
||||||
// until this agent goes away.
|
// until this agent goes away.
|
||||||
let map_addr = unsafe {
|
let map_addr = unsafe {
|
||||||
let ptr = rustix::io::mmap(
|
let ptr = rustix::mm::mmap(
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
rustix::process::page_size(),
|
rustix::param::page_size(),
|
||||||
rustix::io::ProtFlags::EXEC | rustix::io::ProtFlags::READ,
|
rustix::mm::ProtFlags::EXEC | rustix::mm::ProtFlags::READ,
|
||||||
rustix::io::MapFlags::PRIVATE,
|
rustix::mm::MapFlags::PRIVATE,
|
||||||
&jitdump_file,
|
&jitdump_file,
|
||||||
0,
|
0,
|
||||||
)?;
|
)?;
|
||||||
@@ -287,7 +287,7 @@ impl JitDumpFile {
|
|||||||
impl Drop for JitDumpFile {
|
impl Drop for JitDumpFile {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
unsafe {
|
unsafe {
|
||||||
rustix::io::munmap(self.map_addr as *mut _, rustix::process::page_size()).unwrap();
|
rustix::mm::munmap(self.map_addr as *mut _, rustix::param::page_size()).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ log = "0.4.8"
|
|||||||
winapi = { version = "0.3.8", features = ["winnt", "impl-default"] }
|
winapi = { version = "0.3.8", features = ["winnt", "impl-default"] }
|
||||||
|
|
||||||
[target.'cfg(target_os = "linux")'.dependencies]
|
[target.'cfg(target_os = "linux")'.dependencies]
|
||||||
rustix = "0.33.7"
|
rustix = { version = "0.35.6", features = ["process"] }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
jitdump = ['wasmtime-jit-debug']
|
jitdump = ['wasmtime-jit-debug']
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ memfd = { version = "0.4.1", optional = true }
|
|||||||
mach = "0.3.2"
|
mach = "0.3.2"
|
||||||
|
|
||||||
[target.'cfg(unix)'.dependencies]
|
[target.'cfg(unix)'.dependencies]
|
||||||
rustix = "0.33.7"
|
rustix = { version = "0.35.6", features = ["mm"] }
|
||||||
|
|
||||||
[target.'cfg(target_os = "windows")'.dependencies]
|
[target.'cfg(target_os = "windows")'.dependencies]
|
||||||
winapi = { version = "0.3.7", features = ["winbase", "memoryapi", "errhandlingapi", "handleapi"] }
|
winapi = { version = "0.3.7", features = ["winbase", "memoryapi", "errhandlingapi", "handleapi"] }
|
||||||
|
|||||||
@@ -333,7 +333,7 @@ impl MemoryImageSlot {
|
|||||||
// mprotect the relevant region.
|
// mprotect the relevant region.
|
||||||
self.set_protection(
|
self.set_protection(
|
||||||
self.cur_size..size_bytes,
|
self.cur_size..size_bytes,
|
||||||
rustix::io::MprotectFlags::READ | rustix::io::MprotectFlags::WRITE,
|
rustix::mm::MprotectFlags::READ | rustix::mm::MprotectFlags::WRITE,
|
||||||
)?;
|
)?;
|
||||||
self.cur_size = size_bytes;
|
self.cur_size = size_bytes;
|
||||||
|
|
||||||
@@ -386,7 +386,7 @@ impl MemoryImageSlot {
|
|||||||
.map_err(|e| InstantiationError::Resource(e.into()))?;
|
.map_err(|e| InstantiationError::Resource(e.into()))?;
|
||||||
self.set_protection(
|
self.set_protection(
|
||||||
0..initial_size_bytes,
|
0..initial_size_bytes,
|
||||||
rustix::io::MprotectFlags::READ | rustix::io::MprotectFlags::WRITE,
|
rustix::mm::MprotectFlags::READ | rustix::mm::MprotectFlags::WRITE,
|
||||||
)
|
)
|
||||||
.map_err(|e| InstantiationError::Resource(e.into()))?;
|
.map_err(|e| InstantiationError::Resource(e.into()))?;
|
||||||
} else if initial_size_bytes < self.initial_size {
|
} else if initial_size_bytes < self.initial_size {
|
||||||
@@ -409,7 +409,7 @@ impl MemoryImageSlot {
|
|||||||
// mprotect(NONE) the zone from the first to the second.
|
// mprotect(NONE) the zone from the first to the second.
|
||||||
self.set_protection(
|
self.set_protection(
|
||||||
initial_size_bytes..self.initial_size,
|
initial_size_bytes..self.initial_size,
|
||||||
rustix::io::MprotectFlags::empty(),
|
rustix::mm::MprotectFlags::empty(),
|
||||||
)
|
)
|
||||||
.map_err(|e| InstantiationError::Resource(e.into()))?;
|
.map_err(|e| InstantiationError::Resource(e.into()))?;
|
||||||
} else if initial_size_bytes > self.initial_size {
|
} else if initial_size_bytes > self.initial_size {
|
||||||
@@ -420,7 +420,7 @@ impl MemoryImageSlot {
|
|||||||
// made visible as zeros.
|
// made visible as zeros.
|
||||||
self.set_protection(
|
self.set_protection(
|
||||||
self.initial_size..initial_size_bytes,
|
self.initial_size..initial_size_bytes,
|
||||||
rustix::io::MprotectFlags::READ | rustix::io::MprotectFlags::WRITE,
|
rustix::mm::MprotectFlags::READ | rustix::mm::MprotectFlags::WRITE,
|
||||||
)
|
)
|
||||||
.map_err(|e| InstantiationError::Resource(e.into()))?;
|
.map_err(|e| InstantiationError::Resource(e.into()))?;
|
||||||
} else {
|
} else {
|
||||||
@@ -444,11 +444,11 @@ impl MemoryImageSlot {
|
|||||||
);
|
);
|
||||||
if image.len > 0 {
|
if image.len > 0 {
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr = rustix::io::mmap(
|
let ptr = rustix::mm::mmap(
|
||||||
(self.base + image.linear_memory_offset) as *mut c_void,
|
(self.base + image.linear_memory_offset) as *mut c_void,
|
||||||
image.len,
|
image.len,
|
||||||
rustix::io::ProtFlags::READ | rustix::io::ProtFlags::WRITE,
|
rustix::mm::ProtFlags::READ | rustix::mm::ProtFlags::WRITE,
|
||||||
rustix::io::MapFlags::PRIVATE | rustix::io::MapFlags::FIXED,
|
rustix::mm::MapFlags::PRIVATE | rustix::mm::MapFlags::FIXED,
|
||||||
image.fd.as_file(),
|
image.fd.as_file(),
|
||||||
image.fd_offset,
|
image.fd_offset,
|
||||||
)
|
)
|
||||||
@@ -477,10 +477,10 @@ impl MemoryImageSlot {
|
|||||||
// semantics we want for reuse between instances, so it's all we
|
// semantics we want for reuse between instances, so it's all we
|
||||||
// need to do.
|
// need to do.
|
||||||
unsafe {
|
unsafe {
|
||||||
rustix::io::madvise(
|
rustix::mm::madvise(
|
||||||
self.base as *mut c_void,
|
self.base as *mut c_void,
|
||||||
self.cur_size,
|
self.cur_size,
|
||||||
rustix::io::Advice::LinuxDontNeed,
|
rustix::mm::Advice::LinuxDontNeed,
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -499,20 +499,20 @@ impl MemoryImageSlot {
|
|||||||
// mprotect the initial heap region beyond the initial heap size back to PROT_NONE.
|
// mprotect the initial heap region beyond the initial heap size back to PROT_NONE.
|
||||||
self.set_protection(
|
self.set_protection(
|
||||||
self.initial_size..self.cur_size,
|
self.initial_size..self.cur_size,
|
||||||
rustix::io::MprotectFlags::empty(),
|
rustix::mm::MprotectFlags::empty(),
|
||||||
)?;
|
)?;
|
||||||
self.cur_size = self.initial_size;
|
self.cur_size = self.initial_size;
|
||||||
self.dirty = false;
|
self.dirty = false;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_protection(&self, range: Range<usize>, flags: rustix::io::MprotectFlags) -> Result<()> {
|
fn set_protection(&self, range: Range<usize>, flags: rustix::mm::MprotectFlags) -> Result<()> {
|
||||||
assert!(range.start <= range.end);
|
assert!(range.start <= range.end);
|
||||||
assert!(range.end <= self.static_size);
|
assert!(range.end <= self.static_size);
|
||||||
let mprotect_start = self.base.checked_add(range.start).unwrap();
|
let mprotect_start = self.base.checked_add(range.start).unwrap();
|
||||||
if range.len() > 0 {
|
if range.len() > 0 {
|
||||||
unsafe {
|
unsafe {
|
||||||
rustix::io::mprotect(mprotect_start as *mut _, range.len(), flags)?;
|
rustix::mm::mprotect(mprotect_start as *mut _, range.len(), flags)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -532,11 +532,11 @@ impl MemoryImageSlot {
|
|||||||
/// inaccessible. Used both during instantiate and during drop.
|
/// inaccessible. Used both during instantiate and during drop.
|
||||||
fn reset_with_anon_memory(&self) -> Result<()> {
|
fn reset_with_anon_memory(&self) -> Result<()> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr = rustix::io::mmap_anonymous(
|
let ptr = rustix::mm::mmap_anonymous(
|
||||||
self.base as *mut c_void,
|
self.base as *mut c_void,
|
||||||
self.static_size,
|
self.static_size,
|
||||||
rustix::io::ProtFlags::empty(),
|
rustix::mm::ProtFlags::empty(),
|
||||||
rustix::io::MapFlags::PRIVATE | rustix::io::MapFlags::FIXED,
|
rustix::mm::MapFlags::PRIVATE | rustix::mm::MapFlags::FIXED,
|
||||||
)?;
|
)?;
|
||||||
assert_eq!(ptr as usize, self.base);
|
assert_eq!(ptr as usize, self.base);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ fn decommit(addr: *mut u8, len: usize, protect: bool) -> Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// On Linux, this is enough to cause the kernel to initialize the pages to 0 on next access
|
// On Linux, this is enough to cause the kernel to initialize the pages to 0 on next access
|
||||||
rustix::io::madvise(addr as _, len, rustix::io::Advice::LinuxDontNeed)
|
rustix::mm::madvise(addr as _, len, rustix::mm::Advice::LinuxDontNeed)
|
||||||
.context("madvise failed to decommit: {}")?;
|
.context("madvise failed to decommit: {}")?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,15 +10,15 @@ fn decommit(addr: *mut u8, len: usize, protect: bool) -> Result<()> {
|
|||||||
// The new mapping will be to the CoW zero page, so this effectively
|
// The new mapping will be to the CoW zero page, so this effectively
|
||||||
// zeroes the pages.
|
// zeroes the pages.
|
||||||
unsafe {
|
unsafe {
|
||||||
rustix::io::mmap_anonymous(
|
rustix::mm::mmap_anonymous(
|
||||||
addr as _,
|
addr as _,
|
||||||
len,
|
len,
|
||||||
if protect {
|
if protect {
|
||||||
rustix::io::ProtFlags::empty()
|
rustix::mm::ProtFlags::empty()
|
||||||
} else {
|
} else {
|
||||||
rustix::io::ProtFlags::READ | rustix::io::ProtFlags::WRITE
|
rustix::mm::ProtFlags::READ | rustix::mm::ProtFlags::WRITE
|
||||||
},
|
},
|
||||||
rustix::io::MapFlags::PRIVATE | rustix::io::MapFlags::FIXED,
|
rustix::mm::MapFlags::PRIVATE | rustix::mm::MapFlags::FIXED,
|
||||||
)
|
)
|
||||||
.context("mmap failed to remap pages: {}")?;
|
.context("mmap failed to remap pages: {}")?;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,11 +64,11 @@ impl Mmap {
|
|||||||
.len();
|
.len();
|
||||||
let len = usize::try_from(len).map_err(|_| anyhow!("file too large to map"))?;
|
let len = usize::try_from(len).map_err(|_| anyhow!("file too large to map"))?;
|
||||||
let ptr = unsafe {
|
let ptr = unsafe {
|
||||||
rustix::io::mmap(
|
rustix::mm::mmap(
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
len,
|
len,
|
||||||
rustix::io::ProtFlags::READ,
|
rustix::mm::ProtFlags::READ,
|
||||||
rustix::io::MapFlags::PRIVATE,
|
rustix::mm::MapFlags::PRIVATE,
|
||||||
&file,
|
&file,
|
||||||
0,
|
0,
|
||||||
)
|
)
|
||||||
@@ -171,11 +171,11 @@ impl Mmap {
|
|||||||
Ok(if accessible_size == mapping_size {
|
Ok(if accessible_size == mapping_size {
|
||||||
// Allocate a single read-write region at once.
|
// Allocate a single read-write region at once.
|
||||||
let ptr = unsafe {
|
let ptr = unsafe {
|
||||||
rustix::io::mmap_anonymous(
|
rustix::mm::mmap_anonymous(
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
mapping_size,
|
mapping_size,
|
||||||
rustix::io::ProtFlags::READ | rustix::io::ProtFlags::WRITE,
|
rustix::mm::ProtFlags::READ | rustix::mm::ProtFlags::WRITE,
|
||||||
rustix::io::MapFlags::PRIVATE,
|
rustix::mm::MapFlags::PRIVATE,
|
||||||
)
|
)
|
||||||
.context(format!("mmap failed to allocate {:#x} bytes", mapping_size))?
|
.context(format!("mmap failed to allocate {:#x} bytes", mapping_size))?
|
||||||
};
|
};
|
||||||
@@ -188,11 +188,11 @@ impl Mmap {
|
|||||||
} else {
|
} else {
|
||||||
// Reserve the mapping size.
|
// Reserve the mapping size.
|
||||||
let ptr = unsafe {
|
let ptr = unsafe {
|
||||||
rustix::io::mmap_anonymous(
|
rustix::mm::mmap_anonymous(
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
mapping_size,
|
mapping_size,
|
||||||
rustix::io::ProtFlags::empty(),
|
rustix::mm::ProtFlags::empty(),
|
||||||
rustix::io::MapFlags::PRIVATE,
|
rustix::mm::MapFlags::PRIVATE,
|
||||||
)
|
)
|
||||||
.context(format!("mmap failed to allocate {:#x} bytes", mapping_size))?
|
.context(format!("mmap failed to allocate {:#x} bytes", mapping_size))?
|
||||||
};
|
};
|
||||||
@@ -430,7 +430,7 @@ impl Drop for Mmap {
|
|||||||
#[cfg(not(target_os = "windows"))]
|
#[cfg(not(target_os = "windows"))]
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
if self.len != 0 {
|
if self.len != 0 {
|
||||||
unsafe { rustix::io::munmap(self.ptr as *mut std::ffi::c_void, self.len) }
|
unsafe { rustix::mm::munmap(self.ptr as *mut std::ffi::c_void, self.len) }
|
||||||
.expect("munmap failed");
|
.expect("munmap failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -295,21 +295,21 @@ pub fn lazy_per_thread_init() -> Result<(), Box<Trap>> {
|
|||||||
let guard_size = page_size;
|
let guard_size = page_size;
|
||||||
let alloc_size = guard_size + MIN_STACK_SIZE;
|
let alloc_size = guard_size + MIN_STACK_SIZE;
|
||||||
|
|
||||||
let ptr = rustix::io::mmap_anonymous(
|
let ptr = rustix::mm::mmap_anonymous(
|
||||||
null_mut(),
|
null_mut(),
|
||||||
alloc_size,
|
alloc_size,
|
||||||
rustix::io::ProtFlags::empty(),
|
rustix::mm::ProtFlags::empty(),
|
||||||
rustix::io::MapFlags::PRIVATE,
|
rustix::mm::MapFlags::PRIVATE,
|
||||||
)
|
)
|
||||||
.map_err(|_| Box::new(Trap::oom()))?;
|
.map_err(|_| Box::new(Trap::oom()))?;
|
||||||
|
|
||||||
// Prepare the stack with readable/writable memory and then register it
|
// Prepare the stack with readable/writable memory and then register it
|
||||||
// with `sigaltstack`.
|
// with `sigaltstack`.
|
||||||
let stack_ptr = (ptr as usize + guard_size) as *mut std::ffi::c_void;
|
let stack_ptr = (ptr as usize + guard_size) as *mut std::ffi::c_void;
|
||||||
rustix::io::mprotect(
|
rustix::mm::mprotect(
|
||||||
stack_ptr,
|
stack_ptr,
|
||||||
MIN_STACK_SIZE,
|
MIN_STACK_SIZE,
|
||||||
rustix::io::MprotectFlags::READ | rustix::io::MprotectFlags::WRITE,
|
rustix::mm::MprotectFlags::READ | rustix::mm::MprotectFlags::WRITE,
|
||||||
)
|
)
|
||||||
.expect("mprotect to configure memory for sigaltstack failed");
|
.expect("mprotect to configure memory for sigaltstack failed");
|
||||||
let new_stack = libc::stack_t {
|
let new_stack = libc::stack_t {
|
||||||
@@ -335,7 +335,7 @@ pub fn lazy_per_thread_init() -> Result<(), Box<Trap>> {
|
|||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
unsafe {
|
unsafe {
|
||||||
// Deallocate the stack memory.
|
// Deallocate the stack memory.
|
||||||
let r = rustix::io::munmap(self.mmap_ptr, self.mmap_size);
|
let r = rustix::mm::munmap(self.mmap_ptr, self.mmap_size);
|
||||||
debug_assert!(r.is_ok(), "munmap failed during thread shutdown");
|
debug_assert!(r.is_ok(), "munmap failed during thread shutdown");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ tempfile = "3.1.0"
|
|||||||
os_pipe = "0.9"
|
os_pipe = "0.9"
|
||||||
anyhow = "1.0.19"
|
anyhow = "1.0.19"
|
||||||
wat = "1.0.42"
|
wat = "1.0.42"
|
||||||
cap-std = "0.24.1"
|
cap-std = "0.25.0"
|
||||||
tokio = { version = "1.8.0", features = ["rt-multi-thread"] }
|
tokio = { version = "1.8.0", features = ["rt-multi-thread"] }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
|||||||
@@ -22,16 +22,22 @@ anyhow = "1.0"
|
|||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
wiggle = { path = "../wiggle", default-features = false, version = "=0.39.0" }
|
wiggle = { path = "../wiggle", default-features = false, version = "=0.39.0" }
|
||||||
tracing = "0.1.19"
|
tracing = "0.1.19"
|
||||||
cap-std = "0.24.1"
|
cap-std = "0.25.0"
|
||||||
cap-rand = "0.24.1"
|
cap-rand = "0.25.0"
|
||||||
bitflags = "1.2"
|
bitflags = "1.2"
|
||||||
|
|
||||||
[target.'cfg(unix)'.dependencies]
|
[target.'cfg(unix)'.dependencies]
|
||||||
rustix = "0.33.7"
|
rustix = { version = "0.35.6", features = ["fs"] }
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(windows)'.dependencies]
|
||||||
io-extras = "0.13.2"
|
io-extras = "0.15.0"
|
||||||
winapi = "0.3"
|
|
||||||
|
[target.'cfg(windows)'.dependencies.windows-sys]
|
||||||
|
version = "0.36.0"
|
||||||
|
features = [
|
||||||
|
"Win32_Foundation",
|
||||||
|
"Win32_Networking_WinSock",
|
||||||
|
]
|
||||||
|
|
||||||
[badges]
|
[badges]
|
||||||
maintenance = { status = "actively-developed" }
|
maintenance = { status = "actively-developed" }
|
||||||
|
|||||||
@@ -15,23 +15,28 @@ include = ["src/**/*", "README.md", "LICENSE" ]
|
|||||||
wasi-common = { path = "../", version = "=0.39.0" }
|
wasi-common = { path = "../", version = "=0.39.0" }
|
||||||
async-trait = "0.1"
|
async-trait = "0.1"
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
cap-std = "0.24.1"
|
cap-std = "0.25.0"
|
||||||
cap-fs-ext = "0.24.1"
|
cap-fs-ext = "0.25.0"
|
||||||
cap-time-ext = "0.24.1"
|
cap-time-ext = "0.25.0"
|
||||||
cap-rand = "0.24.1"
|
cap-rand = "0.25.0"
|
||||||
fs-set-times = "0.15.0"
|
fs-set-times = "0.17.0"
|
||||||
system-interface = { version = "0.20.0", features = ["cap_std_impls"] }
|
system-interface = { version = "0.21.0", features = ["cap_std_impls"] }
|
||||||
tracing = "0.1.19"
|
tracing = "0.1.19"
|
||||||
io-lifetimes = { version = "0.5.0", default-features = false }
|
io-lifetimes = { version = "0.7.0", default-features = false }
|
||||||
is-terminal = "0.1.0"
|
is-terminal = "0.3.0"
|
||||||
|
|
||||||
[target.'cfg(unix)'.dependencies]
|
[target.'cfg(unix)'.dependencies]
|
||||||
rustix = "0.33.7"
|
rustix = { version = "0.35.6", features = ["fs"] }
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(windows)'.dependencies]
|
||||||
winapi = "0.3"
|
|
||||||
lazy_static = "1.4"
|
lazy_static = "1.4"
|
||||||
io-extras = "0.13.0"
|
io-extras = "0.15.0"
|
||||||
|
|
||||||
|
[target.'cfg(windows)'.dependencies.windows-sys]
|
||||||
|
version = "0.36.0"
|
||||||
|
features = [
|
||||||
|
"Win32_Foundation",
|
||||||
|
]
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tempfile = "3.1.0"
|
tempfile = "3.1.0"
|
||||||
|
|||||||
@@ -171,7 +171,9 @@ impl WasiDir for Dir {
|
|||||||
// can't get a full metadata for.
|
// can't get a full metadata for.
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
let entries = entries.filter(|entry: &Result<_, wasi_common::Error>| {
|
let entries = entries.filter(|entry: &Result<_, wasi_common::Error>| {
|
||||||
use winapi::shared::winerror::{ERROR_ACCESS_DENIED, ERROR_SHARING_VIOLATION};
|
use windows_sys::Win32::Foundation::{
|
||||||
|
ERROR_ACCESS_DENIED, ERROR_SHARING_VIOLATION,
|
||||||
|
};
|
||||||
if let Err(err) = entry {
|
if let Err(err) = entry {
|
||||||
if let Some(err) = err.downcast_ref::<std::io::Error>() {
|
if let Some(err) = err.downcast_ref::<std::io::Error>() {
|
||||||
if err.raw_os_error() == Some(ERROR_SHARING_VIOLATION as i32)
|
if err.raw_os_error() == Some(ERROR_SHARING_VIOLATION as i32)
|
||||||
|
|||||||
@@ -213,12 +213,12 @@ macro_rules! wasi_stream_write_impl {
|
|||||||
bufs: &mut [io::IoSliceMut<'a>],
|
bufs: &mut [io::IoSliceMut<'a>],
|
||||||
) -> Result<u64, Error> {
|
) -> Result<u64, Error> {
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
let n = Read::read_vectored(&mut *self.as_socketlike_view::<$std_ty>(), bufs)?;
|
let n = Read::read_vectored(&mut &*self.as_socketlike_view::<$std_ty>(), bufs)?;
|
||||||
Ok(n.try_into()?)
|
Ok(n.try_into()?)
|
||||||
}
|
}
|
||||||
async fn write_vectored<'a>(&mut self, bufs: &[io::IoSlice<'a>]) -> Result<u64, Error> {
|
async fn write_vectored<'a>(&mut self, bufs: &[io::IoSlice<'a>]) -> Result<u64, Error> {
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
let n = Write::write_vectored(&mut *self.as_socketlike_view::<$std_ty>(), bufs)?;
|
let n = Write::write_vectored(&mut &*self.as_socketlike_view::<$std_ty>(), bufs)?;
|
||||||
Ok(n.try_into()?)
|
Ok(n.try_into()?)
|
||||||
}
|
}
|
||||||
async fn peek(&mut self, buf: &mut [u8]) -> Result<u64, Error> {
|
async fn peek(&mut self, buf: &mut [u8]) -> Result<u64, Error> {
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ pub async fn poll_oneoff<'a>(poll: &mut Poll<'a>) -> Result<(), Error> {
|
|||||||
);
|
);
|
||||||
match rustix::io::poll(&mut pollfds, poll_timeout) {
|
match rustix::io::poll(&mut pollfds, poll_timeout) {
|
||||||
Ok(ready) => break ready,
|
Ok(ready) => break ready,
|
||||||
Err(rustix::io::Error::INTR) => continue,
|
Err(rustix::io::Errno::INTR) => continue,
|
||||||
Err(err) => return Err(err.into()),
|
Err(err) => return Err(err.into()),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ impl WasiFile for Stdin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
async fn read_vectored<'a>(&mut self, bufs: &mut [io::IoSliceMut<'a>]) -> Result<u64, Error> {
|
async fn read_vectored<'a>(&mut self, bufs: &mut [io::IoSliceMut<'a>]) -> Result<u64, Error> {
|
||||||
let n = self.0.as_filelike_view::<File>().read_vectored(bufs)?;
|
let n = (&*self.0.as_filelike_view::<File>()).read_vectored(bufs)?;
|
||||||
Ok(n.try_into().map_err(|_| Error::range())?)
|
Ok(n.try_into().map_err(|_| Error::range())?)
|
||||||
}
|
}
|
||||||
async fn read_vectored_at<'a>(
|
async fn read_vectored_at<'a>(
|
||||||
@@ -140,7 +140,7 @@ macro_rules! wasi_file_write_impl {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
async fn write_vectored<'a>(&mut self, bufs: &[io::IoSlice<'a>]) -> Result<u64, Error> {
|
async fn write_vectored<'a>(&mut self, bufs: &[io::IoSlice<'a>]) -> Result<u64, Error> {
|
||||||
let n = self.0.as_filelike_view::<File>().write_vectored(bufs)?;
|
let n = (&*self.0.as_filelike_view::<File>()).write_vectored(bufs)?;
|
||||||
Ok(n.try_into().map_err(|c| Error::range().context(c))?)
|
Ok(n.try_into().map_err(|c| Error::range().context(c))?)
|
||||||
}
|
}
|
||||||
async fn write_vectored_at<'a>(
|
async fn write_vectored_at<'a>(
|
||||||
|
|||||||
@@ -112,67 +112,144 @@ impl TryFrom<std::io::Error> for types::Errno {
|
|||||||
fn try_from(err: std::io::Error) -> Result<types::Errno, Error> {
|
fn try_from(err: std::io::Error) -> Result<types::Errno, Error> {
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
fn raw_error_code(err: &std::io::Error) -> Option<types::Errno> {
|
fn raw_error_code(err: &std::io::Error) -> Option<types::Errno> {
|
||||||
use rustix::io::Error;
|
use rustix::io::Errno;
|
||||||
match Error::from_io_error(err) {
|
match Errno::from_io_error(err) {
|
||||||
Some(Error::AGAIN) => Some(types::Errno::Again),
|
Some(Errno::AGAIN) => Some(types::Errno::Again),
|
||||||
Some(Error::PIPE) => Some(types::Errno::Pipe),
|
Some(Errno::PIPE) => Some(types::Errno::Pipe),
|
||||||
Some(Error::PERM) => Some(types::Errno::Perm),
|
Some(Errno::PERM) => Some(types::Errno::Perm),
|
||||||
Some(Error::NOENT) => Some(types::Errno::Noent),
|
Some(Errno::NOENT) => Some(types::Errno::Noent),
|
||||||
Some(Error::NOMEM) => Some(types::Errno::Nomem),
|
Some(Errno::NOMEM) => Some(types::Errno::Nomem),
|
||||||
Some(Error::TOOBIG) => Some(types::Errno::TooBig),
|
Some(Errno::TOOBIG) => Some(types::Errno::TooBig),
|
||||||
Some(Error::IO) => Some(types::Errno::Io),
|
Some(Errno::IO) => Some(types::Errno::Io),
|
||||||
Some(Error::BADF) => Some(types::Errno::Badf),
|
Some(Errno::BADF) => Some(types::Errno::Badf),
|
||||||
Some(Error::BUSY) => Some(types::Errno::Busy),
|
Some(Errno::BUSY) => Some(types::Errno::Busy),
|
||||||
Some(Error::ACCESS) => Some(types::Errno::Acces),
|
Some(Errno::ACCESS) => Some(types::Errno::Acces),
|
||||||
Some(Error::FAULT) => Some(types::Errno::Fault),
|
Some(Errno::FAULT) => Some(types::Errno::Fault),
|
||||||
Some(Error::NOTDIR) => Some(types::Errno::Notdir),
|
Some(Errno::NOTDIR) => Some(types::Errno::Notdir),
|
||||||
Some(Error::ISDIR) => Some(types::Errno::Isdir),
|
Some(Errno::ISDIR) => Some(types::Errno::Isdir),
|
||||||
Some(Error::INVAL) => Some(types::Errno::Inval),
|
Some(Errno::INVAL) => Some(types::Errno::Inval),
|
||||||
Some(Error::EXIST) => Some(types::Errno::Exist),
|
Some(Errno::EXIST) => Some(types::Errno::Exist),
|
||||||
Some(Error::FBIG) => Some(types::Errno::Fbig),
|
Some(Errno::FBIG) => Some(types::Errno::Fbig),
|
||||||
Some(Error::NOSPC) => Some(types::Errno::Nospc),
|
Some(Errno::NOSPC) => Some(types::Errno::Nospc),
|
||||||
Some(Error::SPIPE) => Some(types::Errno::Spipe),
|
Some(Errno::SPIPE) => Some(types::Errno::Spipe),
|
||||||
Some(Error::MFILE) => Some(types::Errno::Mfile),
|
Some(Errno::MFILE) => Some(types::Errno::Mfile),
|
||||||
Some(Error::MLINK) => Some(types::Errno::Mlink),
|
Some(Errno::MLINK) => Some(types::Errno::Mlink),
|
||||||
Some(Error::NAMETOOLONG) => Some(types::Errno::Nametoolong),
|
Some(Errno::NAMETOOLONG) => Some(types::Errno::Nametoolong),
|
||||||
Some(Error::NFILE) => Some(types::Errno::Nfile),
|
Some(Errno::NFILE) => Some(types::Errno::Nfile),
|
||||||
Some(Error::NOTEMPTY) => Some(types::Errno::Notempty),
|
Some(Errno::NOTEMPTY) => Some(types::Errno::Notempty),
|
||||||
Some(Error::LOOP) => Some(types::Errno::Loop),
|
Some(Errno::LOOP) => Some(types::Errno::Loop),
|
||||||
Some(Error::OVERFLOW) => Some(types::Errno::Overflow),
|
Some(Errno::OVERFLOW) => Some(types::Errno::Overflow),
|
||||||
Some(Error::ILSEQ) => Some(types::Errno::Ilseq),
|
Some(Errno::ILSEQ) => Some(types::Errno::Ilseq),
|
||||||
Some(Error::NOTSUP) => Some(types::Errno::Notsup),
|
Some(Errno::NOTSUP) => Some(types::Errno::Notsup),
|
||||||
|
Some(Errno::ADDRINUSE) => Some(types::Errno::Addrinuse),
|
||||||
|
Some(Errno::CANCELED) => Some(types::Errno::Canceled),
|
||||||
|
Some(Errno::ADDRNOTAVAIL) => Some(types::Errno::Addrnotavail),
|
||||||
|
Some(Errno::AFNOSUPPORT) => Some(types::Errno::Afnosupport),
|
||||||
|
Some(Errno::ALREADY) => Some(types::Errno::Already),
|
||||||
|
Some(Errno::CONNABORTED) => Some(types::Errno::Connaborted),
|
||||||
|
Some(Errno::CONNREFUSED) => Some(types::Errno::Connrefused),
|
||||||
|
Some(Errno::CONNRESET) => Some(types::Errno::Connreset),
|
||||||
|
Some(Errno::DESTADDRREQ) => Some(types::Errno::Destaddrreq),
|
||||||
|
Some(Errno::DQUOT) => Some(types::Errno::Dquot),
|
||||||
|
Some(Errno::HOSTUNREACH) => Some(types::Errno::Hostunreach),
|
||||||
|
Some(Errno::INPROGRESS) => Some(types::Errno::Inprogress),
|
||||||
|
Some(Errno::INTR) => Some(types::Errno::Intr),
|
||||||
|
Some(Errno::ISCONN) => Some(types::Errno::Isconn),
|
||||||
|
Some(Errno::MSGSIZE) => Some(types::Errno::Msgsize),
|
||||||
|
Some(Errno::NETDOWN) => Some(types::Errno::Netdown),
|
||||||
|
Some(Errno::NETRESET) => Some(types::Errno::Netreset),
|
||||||
|
Some(Errno::NETUNREACH) => Some(types::Errno::Netunreach),
|
||||||
|
Some(Errno::NOBUFS) => Some(types::Errno::Nobufs),
|
||||||
|
Some(Errno::NOPROTOOPT) => Some(types::Errno::Noprotoopt),
|
||||||
|
Some(Errno::NOTCONN) => Some(types::Errno::Notconn),
|
||||||
|
Some(Errno::NOTSOCK) => Some(types::Errno::Notsock),
|
||||||
|
Some(Errno::PROTONOSUPPORT) => Some(types::Errno::Protonosupport),
|
||||||
|
Some(Errno::PROTOTYPE) => Some(types::Errno::Prototype),
|
||||||
|
Some(Errno::STALE) => Some(types::Errno::Stale),
|
||||||
|
Some(Errno::TIMEDOUT) => Some(types::Errno::Timedout),
|
||||||
|
|
||||||
|
// On some platforms, these have the same value as other errno values.
|
||||||
|
#[allow(unreachable_patterns)]
|
||||||
|
Some(Errno::WOULDBLOCK) => Some(types::Errno::Again),
|
||||||
|
#[allow(unreachable_patterns)]
|
||||||
|
Some(Errno::OPNOTSUPP) => Some(types::Errno::Notsup),
|
||||||
|
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
fn raw_error_code(err: &std::io::Error) -> Option<types::Errno> {
|
fn raw_error_code(err: &std::io::Error) -> Option<types::Errno> {
|
||||||
use winapi::shared::winerror;
|
use windows_sys::Win32::Foundation;
|
||||||
|
use windows_sys::Win32::Networking::WinSock;
|
||||||
|
|
||||||
match err.raw_os_error().map(|code| code as u32) {
|
match err.raw_os_error().map(|code| code as u32) {
|
||||||
Some(winerror::WSAEWOULDBLOCK) => Some(types::Errno::Again),
|
Some(Foundation::ERROR_BAD_ENVIRONMENT) => return Some(types::Errno::TooBig),
|
||||||
Some(winerror::ERROR_BAD_ENVIRONMENT) => Some(types::Errno::TooBig),
|
Some(Foundation::ERROR_FILE_NOT_FOUND) => return Some(types::Errno::Noent),
|
||||||
Some(winerror::ERROR_FILE_NOT_FOUND) => Some(types::Errno::Noent),
|
Some(Foundation::ERROR_PATH_NOT_FOUND) => return Some(types::Errno::Noent),
|
||||||
Some(winerror::ERROR_PATH_NOT_FOUND) => Some(types::Errno::Noent),
|
Some(Foundation::ERROR_TOO_MANY_OPEN_FILES) => return Some(types::Errno::Nfile),
|
||||||
Some(winerror::ERROR_TOO_MANY_OPEN_FILES) => Some(types::Errno::Nfile),
|
Some(Foundation::ERROR_ACCESS_DENIED) => return Some(types::Errno::Acces),
|
||||||
Some(winerror::ERROR_ACCESS_DENIED) => Some(types::Errno::Acces),
|
Some(Foundation::ERROR_SHARING_VIOLATION) => return Some(types::Errno::Acces),
|
||||||
Some(winerror::ERROR_SHARING_VIOLATION) => Some(types::Errno::Acces),
|
Some(Foundation::ERROR_PRIVILEGE_NOT_HELD) => return Some(types::Errno::Perm),
|
||||||
Some(winerror::ERROR_PRIVILEGE_NOT_HELD) => Some(types::Errno::Perm),
|
Some(Foundation::ERROR_INVALID_HANDLE) => return Some(types::Errno::Badf),
|
||||||
Some(winerror::ERROR_INVALID_HANDLE) => Some(types::Errno::Badf),
|
Some(Foundation::ERROR_INVALID_NAME) => return Some(types::Errno::Noent),
|
||||||
Some(winerror::ERROR_INVALID_NAME) => Some(types::Errno::Noent),
|
Some(Foundation::ERROR_NOT_ENOUGH_MEMORY) => return Some(types::Errno::Nomem),
|
||||||
Some(winerror::ERROR_NOT_ENOUGH_MEMORY) => Some(types::Errno::Nomem),
|
Some(Foundation::ERROR_OUTOFMEMORY) => return Some(types::Errno::Nomem),
|
||||||
Some(winerror::ERROR_OUTOFMEMORY) => Some(types::Errno::Nomem),
|
Some(Foundation::ERROR_DIR_NOT_EMPTY) => return Some(types::Errno::Notempty),
|
||||||
Some(winerror::ERROR_DIR_NOT_EMPTY) => Some(types::Errno::Notempty),
|
Some(Foundation::ERROR_NOT_READY) => return Some(types::Errno::Busy),
|
||||||
Some(winerror::ERROR_NOT_READY) => Some(types::Errno::Busy),
|
Some(Foundation::ERROR_BUSY) => return Some(types::Errno::Busy),
|
||||||
Some(winerror::ERROR_BUSY) => Some(types::Errno::Busy),
|
Some(Foundation::ERROR_NOT_SUPPORTED) => return Some(types::Errno::Notsup),
|
||||||
Some(winerror::ERROR_NOT_SUPPORTED) => Some(types::Errno::Notsup),
|
Some(Foundation::ERROR_FILE_EXISTS) => return Some(types::Errno::Exist),
|
||||||
Some(winerror::ERROR_FILE_EXISTS) => Some(types::Errno::Exist),
|
Some(Foundation::ERROR_BROKEN_PIPE) => return Some(types::Errno::Pipe),
|
||||||
Some(winerror::ERROR_BROKEN_PIPE) => Some(types::Errno::Pipe),
|
Some(Foundation::ERROR_BUFFER_OVERFLOW) => return Some(types::Errno::Nametoolong),
|
||||||
Some(winerror::ERROR_BUFFER_OVERFLOW) => Some(types::Errno::Nametoolong),
|
Some(Foundation::ERROR_NOT_A_REPARSE_POINT) => return Some(types::Errno::Inval),
|
||||||
Some(winerror::ERROR_NOT_A_REPARSE_POINT) => Some(types::Errno::Inval),
|
Some(Foundation::ERROR_NEGATIVE_SEEK) => return Some(types::Errno::Inval),
|
||||||
Some(winerror::ERROR_NEGATIVE_SEEK) => Some(types::Errno::Inval),
|
Some(Foundation::ERROR_DIRECTORY) => return Some(types::Errno::Notdir),
|
||||||
Some(winerror::ERROR_DIRECTORY) => Some(types::Errno::Notdir),
|
Some(Foundation::ERROR_ALREADY_EXISTS) => return Some(types::Errno::Exist),
|
||||||
Some(winerror::ERROR_ALREADY_EXISTS) => Some(types::Errno::Exist),
|
Some(Foundation::ERROR_STOPPED_ON_SYMLINK) => return Some(types::Errno::Loop),
|
||||||
Some(winerror::ERROR_STOPPED_ON_SYMLINK) => Some(types::Errno::Loop),
|
Some(Foundation::ERROR_DIRECTORY_NOT_SUPPORTED) => {
|
||||||
Some(winerror::ERROR_DIRECTORY_NOT_SUPPORTED) => Some(types::Errno::Isdir),
|
return Some(types::Errno::Isdir)
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
|
||||||
|
match err.raw_os_error() {
|
||||||
|
Some(WinSock::WSAEWOULDBLOCK) => Some(types::Errno::Again),
|
||||||
|
Some(WinSock::WSAECANCELLED) => Some(types::Errno::Canceled),
|
||||||
|
Some(WinSock::WSA_E_CANCELLED) => Some(types::Errno::Canceled),
|
||||||
|
Some(WinSock::WSAEBADF) => Some(types::Errno::Badf),
|
||||||
|
Some(WinSock::WSAEFAULT) => Some(types::Errno::Fault),
|
||||||
|
Some(WinSock::WSAEINVAL) => Some(types::Errno::Inval),
|
||||||
|
Some(WinSock::WSAEMFILE) => Some(types::Errno::Mfile),
|
||||||
|
Some(WinSock::WSAENAMETOOLONG) => Some(types::Errno::Nametoolong),
|
||||||
|
Some(WinSock::WSAENOTEMPTY) => Some(types::Errno::Notempty),
|
||||||
|
Some(WinSock::WSAELOOP) => Some(types::Errno::Loop),
|
||||||
|
Some(WinSock::WSAEOPNOTSUPP) => Some(types::Errno::Notsup),
|
||||||
|
Some(WinSock::WSAEADDRINUSE) => Some(types::Errno::Addrinuse),
|
||||||
|
Some(WinSock::WSAEACCES) => Some(types::Errno::Acces),
|
||||||
|
Some(WinSock::WSAEADDRNOTAVAIL) => Some(types::Errno::Addrnotavail),
|
||||||
|
Some(WinSock::WSAEAFNOSUPPORT) => Some(types::Errno::Afnosupport),
|
||||||
|
Some(WinSock::WSAEALREADY) => Some(types::Errno::Already),
|
||||||
|
Some(WinSock::WSAECONNABORTED) => Some(types::Errno::Connaborted),
|
||||||
|
Some(WinSock::WSAECONNREFUSED) => Some(types::Errno::Connrefused),
|
||||||
|
Some(WinSock::WSAECONNRESET) => Some(types::Errno::Connreset),
|
||||||
|
Some(WinSock::WSAEDESTADDRREQ) => Some(types::Errno::Destaddrreq),
|
||||||
|
Some(WinSock::WSAEDQUOT) => Some(types::Errno::Dquot),
|
||||||
|
Some(WinSock::WSAEHOSTUNREACH) => Some(types::Errno::Hostunreach),
|
||||||
|
Some(WinSock::WSAEINPROGRESS) => Some(types::Errno::Inprogress),
|
||||||
|
Some(WinSock::WSAEINTR) => Some(types::Errno::Intr),
|
||||||
|
Some(WinSock::WSAEISCONN) => Some(types::Errno::Isconn),
|
||||||
|
Some(WinSock::WSAEMSGSIZE) => Some(types::Errno::Msgsize),
|
||||||
|
Some(WinSock::WSAENETDOWN) => Some(types::Errno::Netdown),
|
||||||
|
Some(WinSock::WSAENETRESET) => Some(types::Errno::Netreset),
|
||||||
|
Some(WinSock::WSAENETUNREACH) => Some(types::Errno::Netunreach),
|
||||||
|
Some(WinSock::WSAENOBUFS) => Some(types::Errno::Nobufs),
|
||||||
|
Some(WinSock::WSAENOPROTOOPT) => Some(types::Errno::Noprotoopt),
|
||||||
|
Some(WinSock::WSAENOTCONN) => Some(types::Errno::Notconn),
|
||||||
|
Some(WinSock::WSAENOTSOCK) => Some(types::Errno::Notsock),
|
||||||
|
Some(WinSock::WSAEPROTONOSUPPORT) => Some(types::Errno::Protonosupport),
|
||||||
|
Some(WinSock::WSAEPROTOTYPE) => Some(types::Errno::Prototype),
|
||||||
|
Some(WinSock::WSAESTALE) => Some(types::Errno::Stale),
|
||||||
|
Some(WinSock::WSAETIMEDOUT) => Some(types::Errno::Timedout),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,20 +15,19 @@ wasi-common = { path = "../", version = "=0.39.0" }
|
|||||||
wasi-cap-std-sync = { path = "../cap-std-sync", version = "=0.39.0" }
|
wasi-cap-std-sync = { path = "../cap-std-sync", version = "=0.39.0" }
|
||||||
wiggle = { path = "../../wiggle", version = "=0.39.0" }
|
wiggle = { path = "../../wiggle", version = "=0.39.0" }
|
||||||
tokio = { version = "1.8.0", features = [ "rt", "fs", "time", "io-util", "net", "io-std", "rt-multi-thread"] }
|
tokio = { version = "1.8.0", features = [ "rt", "fs", "time", "io-util", "net", "io-std", "rt-multi-thread"] }
|
||||||
cap-std = "0.24.1"
|
cap-std = "0.25.0"
|
||||||
anyhow = "1"
|
anyhow = "1"
|
||||||
io-lifetimes = { version = "0.5.0", default-features = false }
|
io-lifetimes = { version = "0.7.0", default-features = false }
|
||||||
|
|
||||||
[target.'cfg(unix)'.dependencies]
|
[target.'cfg(unix)'.dependencies]
|
||||||
rustix = "0.33.7"
|
rustix = { version = "0.35.6", features = ["fs"] }
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(windows)'.dependencies]
|
||||||
winapi = "0.3"
|
|
||||||
lazy_static = "1.4"
|
lazy_static = "1.4"
|
||||||
io-extras = "0.13.0"
|
io-extras = "0.15.0"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tempfile = "3.1.0"
|
tempfile = "3.1.0"
|
||||||
tokio = { version = "1.8.0", features = [ "macros" ] }
|
tokio = { version = "1.8.0", features = [ "macros" ] }
|
||||||
anyhow = "1"
|
anyhow = "1"
|
||||||
cap-tempfile = "0.24.1"
|
cap-tempfile = "0.25.0"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
))]
|
))]
|
||||||
mod tests {
|
mod tests {
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use rustix::io::{mprotect, MprotectFlags};
|
use rustix::mm::{mprotect, MprotectFlags};
|
||||||
use std::sync::atomic::{AtomicBool, Ordering};
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use wasmtime::unix::StoreExt;
|
use wasmtime::unix::StoreExt;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ mod not_for_windows {
|
|||||||
use wasmtime::*;
|
use wasmtime::*;
|
||||||
use wasmtime_environ::{WASM32_MAX_PAGES, WASM_PAGE_SIZE};
|
use wasmtime_environ::{WASM32_MAX_PAGES, WASM_PAGE_SIZE};
|
||||||
|
|
||||||
use rustix::io::{mmap_anonymous, mprotect, munmap, MapFlags, MprotectFlags, ProtFlags};
|
use rustix::mm::{mmap_anonymous, mprotect, munmap, MapFlags, MprotectFlags, ProtFlags};
|
||||||
|
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
use std::ptr::null_mut;
|
use std::ptr::null_mut;
|
||||||
@@ -19,7 +19,7 @@ mod not_for_windows {
|
|||||||
|
|
||||||
impl CustomMemory {
|
impl CustomMemory {
|
||||||
unsafe fn new(minimum: usize, maximum: usize, glob_counter: Arc<Mutex<usize>>) -> Self {
|
unsafe fn new(minimum: usize, maximum: usize, glob_counter: Arc<Mutex<usize>>) -> Self {
|
||||||
let page_size = rustix::process::page_size();
|
let page_size = rustix::param::page_size();
|
||||||
let guard_size = page_size;
|
let guard_size = page_size;
|
||||||
let size = maximum + guard_size;
|
let size = maximum + guard_size;
|
||||||
assert_eq!(size % page_size, 0); // we rely on WASM_PAGE_SIZE being multiple of host page size
|
assert_eq!(size % page_size, 0); // we rely on WASM_PAGE_SIZE being multiple of host page size
|
||||||
|
|||||||
Reference in New Issue
Block a user