diff --git a/Cargo.lock b/Cargo.lock index 0d9fdfa..790a7bf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,11 +4,11 @@ version = 3 [[package]] name = "addr2line" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" dependencies = [ - "gimli 0.27.3", + "gimli 0.28.0", ] [[package]] @@ -28,15 +28,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "aho-corasick" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" -dependencies = [ - "memchr", -] - [[package]] name = "ambient-authority" version = "0.0.2" @@ -45,24 +36,23 @@ checksum = "e9d4ee0d472d1cd2e28c97dfa124b3d8d992e10eb0a035f33f5d12e3a177ba3b" [[package]] name = "anstream" -version = "0.3.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" +checksum = "b1f58811cfac344940f1a400b6e6231ce35171f614f26439e80f8c1465c5cc0c" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", - "is-terminal", "utf8parse", ] [[package]] name = "anstyle" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" +checksum = "15c4c2c83f81532e5845a733998b6971faca23490340a418e9b72a3ec9de12ea" [[package]] name = "anstyle-parse" @@ -84,9 +74,9 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "1.0.2" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c677ab05e09154296dd37acecd46420c17b9713e8366facafa8fc0885167cf4c" +checksum = "58f54d10c6dfa51283a066ceab3ec1ab78d13fae00aa49243a45e4571fb79dfd" dependencies = [ "anstyle", "windows-sys", @@ -94,9 +84,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.72" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854" +checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" [[package]] name = "arbitrary" @@ -106,13 +96,13 @@ checksum = "e2d098ff73c1ca148721f37baad5ea6a465a13f9573aba8641fbbbae8164a54e" [[package]] name = "async-trait" -version = "0.1.72" +version = "0.1.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc6dde6e4ed435a4c1ee4e73592f5ba9da2151af10076cc04858746af9352d09" +checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -123,9 +113,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.68" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" dependencies = [ "addr2line", "cc", @@ -138,9 +128,9 @@ dependencies = [ [[package]] name = "base64" -version = "0.21.2" +version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" +checksum = "414dcefbc63d77c526a76b3afcf6fbb9b5e2791c19c3aa2297733208750c6e53" [[package]] name = "bincode" @@ -159,9 +149,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.3.3" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" +checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" [[package]] name = "block-buffer" @@ -202,6 +192,18 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "cap-net-ext" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ffc30dee200c20b4dcb80572226f42658e1d9c4b668656d7cc59c33d50e396e" +dependencies = [ + "cap-primitives 2.0.0", + "cap-std 2.0.0", + "rustix 0.38.9", + "smallvec", +] + [[package]] name = "cap-primitives" version = "1.0.15" @@ -231,7 +233,7 @@ dependencies = [ "io-lifetimes 2.0.2", "ipnet", "maybe-owned", - "rustix 0.38.7", + "rustix 0.38.9", "windows-sys", "winx 0.36.1", ] @@ -267,7 +269,7 @@ dependencies = [ "cap-primitives 2.0.0", "io-extras 0.18.0", "io-lifetimes 2.0.2", - "rustix 0.38.7", + "rustix 0.38.9", ] [[package]] @@ -278,15 +280,15 @@ checksum = "f8f52b3c8f4abfe3252fd0a071f3004aaa3b18936ec97bdbd8763ce03aff6247" dependencies = [ "cap-primitives 2.0.0", "once_cell", - "rustix 0.38.7", + "rustix 0.38.9", "winx 0.36.1", ] [[package]] name = "cc" -version = "1.0.82" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "305fe645edc1442a0fa8b6726ba61d422798d37a52e12eaecf4b022ebbb88f01" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ "jobserver", "libc", @@ -300,9 +302,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "4.3.21" +version = "4.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c27cdf28c0f604ba3f512b0c9a409f8de8513e4816705deb0498b627e7c3a3fd" +checksum = "7c8d502cbaec4595d2e7d5f61e318f05417bd2b66fdc3809498f0d3fdf0bea27" dependencies = [ "clap_builder", "clap_derive", @@ -311,9 +313,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.3.21" +version = "4.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08a9f1ab5e9f01a9b81f202e8562eb9a10de70abf9eaeac1be465c28b75aa4aa" +checksum = "5891c7bc0edb3e1c2204fc5e94009affabeb1821c9e5fdc3959536c5c0bb984d" dependencies = [ "anstream", "anstyle", @@ -323,21 +325,21 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.3.12" +version = "4.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050" +checksum = "c9fd1a5729c4548118d7d70ff234a44868d00489a4b6597b0b020918a0e91a1a" dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] name = "clap_lex" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" +checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" [[package]] name = "codespan-reporting" @@ -376,7 +378,7 @@ dependencies = [ [[package]] name = "cranelift-bforest" version = "0.100.0" -source = "git+https://github.com/bytecodealliance/wasmtime#f32993002bc523083b7d7cca49179a3285c44c03" +source = "git+https://github.com/bytecodealliance/wasmtime#0c7bf47f0e608a8b68c4abd20cf52107e09cf9b5" dependencies = [ "cranelift-entity", ] @@ -384,7 +386,7 @@ dependencies = [ [[package]] name = "cranelift-codegen" version = "0.100.0" -source = "git+https://github.com/bytecodealliance/wasmtime#f32993002bc523083b7d7cca49179a3285c44c03" +source = "git+https://github.com/bytecodealliance/wasmtime#0c7bf47f0e608a8b68c4abd20cf52107e09cf9b5" dependencies = [ "bumpalo", "cranelift-bforest", @@ -393,8 +395,8 @@ dependencies = [ "cranelift-control", "cranelift-entity", "cranelift-isle", - "gimli 0.27.3", - "hashbrown 0.13.2", + "gimli 0.28.0", + "hashbrown 0.14.0", "log", "regalloc2", "smallvec", @@ -404,7 +406,7 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" version = "0.100.0" -source = "git+https://github.com/bytecodealliance/wasmtime#f32993002bc523083b7d7cca49179a3285c44c03" +source = "git+https://github.com/bytecodealliance/wasmtime#0c7bf47f0e608a8b68c4abd20cf52107e09cf9b5" dependencies = [ "cranelift-codegen-shared", ] @@ -412,12 +414,12 @@ dependencies = [ [[package]] name = "cranelift-codegen-shared" version = "0.100.0" -source = "git+https://github.com/bytecodealliance/wasmtime#f32993002bc523083b7d7cca49179a3285c44c03" +source = "git+https://github.com/bytecodealliance/wasmtime#0c7bf47f0e608a8b68c4abd20cf52107e09cf9b5" [[package]] name = "cranelift-control" version = "0.100.0" -source = "git+https://github.com/bytecodealliance/wasmtime#f32993002bc523083b7d7cca49179a3285c44c03" +source = "git+https://github.com/bytecodealliance/wasmtime#0c7bf47f0e608a8b68c4abd20cf52107e09cf9b5" dependencies = [ "arbitrary", ] @@ -425,7 +427,7 @@ dependencies = [ [[package]] name = "cranelift-entity" version = "0.100.0" -source = "git+https://github.com/bytecodealliance/wasmtime#f32993002bc523083b7d7cca49179a3285c44c03" +source = "git+https://github.com/bytecodealliance/wasmtime#0c7bf47f0e608a8b68c4abd20cf52107e09cf9b5" dependencies = [ "serde", ] @@ -433,7 +435,7 @@ dependencies = [ [[package]] name = "cranelift-frontend" version = "0.100.0" -source = "git+https://github.com/bytecodealliance/wasmtime#f32993002bc523083b7d7cca49179a3285c44c03" +source = "git+https://github.com/bytecodealliance/wasmtime#0c7bf47f0e608a8b68c4abd20cf52107e09cf9b5" dependencies = [ "cranelift-codegen", "log", @@ -444,12 +446,12 @@ dependencies = [ [[package]] name = "cranelift-isle" version = "0.100.0" -source = "git+https://github.com/bytecodealliance/wasmtime#f32993002bc523083b7d7cca49179a3285c44c03" +source = "git+https://github.com/bytecodealliance/wasmtime#0c7bf47f0e608a8b68c4abd20cf52107e09cf9b5" [[package]] name = "cranelift-native" version = "0.100.0" -source = "git+https://github.com/bytecodealliance/wasmtime#f32993002bc523083b7d7cca49179a3285c44c03" +source = "git+https://github.com/bytecodealliance/wasmtime#0c7bf47f0e608a8b68c4abd20cf52107e09cf9b5" dependencies = [ "cranelift-codegen", "libc", @@ -459,7 +461,7 @@ dependencies = [ [[package]] name = "cranelift-wasm" version = "0.100.0" -source = "git+https://github.com/bytecodealliance/wasmtime#f32993002bc523083b7d7cca49179a3285c44c03" +source = "git+https://github.com/bytecodealliance/wasmtime#0c7bf47f0e608a8b68c4abd20cf52107e09cf9b5" dependencies = [ "cranelift-codegen", "cranelift-entity", @@ -467,7 +469,7 @@ dependencies = [ "itertools", "log", "smallvec", - "wasmparser 0.110.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wasmparser 0.112.0", "wasmtime-types", ] @@ -535,9 +537,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.104" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba1ba0a82363c553ecb7b4cd58ba6e1c017baef8e3cca4e7d66ca17879201144" +checksum = "28403c86fc49e3401fdf45499ba37fad6493d9329449d6449d7f0e10f4654d28" dependencies = [ "cc", "cxxbridge-flags", @@ -547,9 +549,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.104" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac9ec8372f860c6ee7c6463b96a26d08dd590bcbcd9bf2d1894db09ae81410d3" +checksum = "78da94fef01786dc3e0c76eafcd187abcaa9972c78e05ff4041e24fdf059c285" dependencies = [ "cc", "codespan-reporting", @@ -557,24 +559,24 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] name = "cxxbridge-flags" -version = "1.0.104" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "409667bbb937bae87f7cfa91ca29e1415bb92d415371e3344b5269c10d90d595" +checksum = "e2a6f5e1dfb4b34292ad4ea1facbfdaa1824705b231610087b00b17008641809" [[package]] name = "cxxbridge-macro" -version = "1.0.104" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fb2a9757fb085d6d97856b28d4f049141ca4a61a64c697f4426433b5f6caa1f" +checksum = "50c49547d73ba8dcfd4ad7325d64c6d5391ff4224d498fc39a6f3f49825a530d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -654,26 +656,13 @@ checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "encoding_rs" -version = "0.8.32" +version = "0.8.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" dependencies = [ "cfg-if", ] -[[package]] -name = "env_logger" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" -dependencies = [ - "humantime", - "is-terminal", - "log", - "regex", - "termcolor", -] - [[package]] name = "equivalent" version = "1.0.1" @@ -707,6 +696,12 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" +[[package]] +name = "fallible-iterator" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" + [[package]] name = "fastrand" version = "2.0.0" @@ -720,20 +715,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b0377f1edc77dbd1118507bc7a66e4ab64d2b90c66f90726dc801e73a8c68f9" dependencies = [ "cfg-if", - "rustix 0.38.7", + "rustix 0.38.9", "windows-sys", ] -[[package]] -name = "file-per-thread-logger" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a3cc21c33af89af0930c8cae4ade5e6fdc17b5d2c97b3d2e2edb67a1cf683f3" -dependencies = [ - "env_logger", - "log", -] - [[package]] name = "file-read" version = "0.1.0" @@ -764,7 +749,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d167b646a876ba8fda6b50ac645cfd96242553cbaf0ca4fccaa39afcbf0801f" dependencies = [ "io-lifetimes 1.0.11", - "rustix 0.38.7", + "rustix 0.38.9", "windows-sys", ] @@ -775,7 +760,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd738b84894214045e8414eaded76359b4a5773f0a0a56b16575110739cdcf39" dependencies = [ "io-lifetimes 2.0.2", - "rustix 0.38.7", + "rustix 0.38.9", "windows-sys", ] @@ -855,7 +840,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27d12c0aed7f1e24276a241aadc4cb8ea9f83000f34bc062b7cc2d51e3b0fabd" dependencies = [ - "bitflags 2.3.3", + "bitflags 2.4.0", "debugid", "fxhash", "serde", @@ -897,19 +882,19 @@ version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" dependencies = [ - "fallible-iterator", + "fallible-iterator 0.2.0", "indexmap 1.9.3", "stable_deref_trait", ] [[package]] name = "gimli" -version = "0.27.3" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" +checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" dependencies = [ - "fallible-iterator", - "indexmap 1.9.3", + "fallible-iterator 0.3.0", + "indexmap 2.0.0", "stable_deref_trait", ] @@ -933,6 +918,9 @@ name = "hashbrown" version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +dependencies = [ + "ahash", +] [[package]] name = "heck" @@ -958,12 +946,6 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" -[[package]] -name = "humantime" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" - [[package]] name = "id-arena" version = "2.2.1" @@ -1051,7 +1033,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ "hermit-abi", - "rustix 0.38.7", + "rustix 0.38.9", "windows-sys", ] @@ -1134,9 +1116,9 @@ checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" [[package]] name = "log" -version = "0.4.19" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "mach" @@ -1155,9 +1137,9 @@ checksum = "4facc753ae494aeb6e3c22f839b158aebd4f9270f55cd3c79906c45476c47ab4" [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "76fc44e2588d5b436dbc3c6cf62aef290f90dab6235744a93dfe1cc18f451e2c" [[package]] name = "memfd" @@ -1209,13 +1191,13 @@ dependencies = [ [[package]] name = "object" -version = "0.31.1" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" +checksum = "77ac5bbd07aea88c60a577a1ce218075ffd59208b2d7ca97adf9bfc5aeb21ebe" dependencies = [ "crc32fast", - "hashbrown 0.13.2", - "indexmap 1.9.3", + "hashbrown 0.14.0", + "indexmap 2.0.0", "memchr", ] @@ -1239,19 +1221,19 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "petgraph" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4" +checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap 1.9.3", + "indexmap 2.0.0", ] [[package]] name = "pin-project-lite" -version = "0.2.12" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12cc1b0bf1727a77a54b6654e7b5f1af8604923edc8b81885f8ec92f9e3f0a05" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[package]] name = "pin-utils" @@ -1302,9 +1284,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.32" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -1403,35 +1385,6 @@ dependencies = [ "smallvec", ] -[[package]] -name = "regex" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" - [[package]] name = "rustc-demangle" version = "0.1.23" @@ -1462,11 +1415,11 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.7" +version = "0.38.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "172891ebdceb05aa0005f533a6cbfca599ddd7d966f6f5d4d9b2e70478e70399" +checksum = "9bfe0f2582b4931a45d1fa608f8a8722e8b3c7ac54dd6d5f3b3212791fedef49" dependencies = [ - "bitflags 2.3.3", + "bitflags 2.4.0", "errno", "itoa", "libc", @@ -1507,29 +1460,29 @@ checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" [[package]] name = "serde" -version = "1.0.183" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32ac8da02677876d532745a130fc9d8e6edfa81a269b107c5b00829b91d8eb3c" +checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.183" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aafe972d60b0b9bee71a91b92fee2d4fb3c9d7e8f6b179aa99f27203d99a4816" +checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] name = "serde_json" -version = "1.0.104" +version = "1.0.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "076066c5f1078eac5b722a31827a8832fe108bed65dfa75e233c89f8206e976c" +checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" dependencies = [ "itoa", "ryu", @@ -1659,9 +1612,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.28" +version = "2.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" +checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" dependencies = [ "proc-macro2", "quote", @@ -1674,12 +1627,12 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27ce32341b2c0b70c144bbf35627fdc1ef18c76ced5e5e7b3ee8b5ba6b2ab6a0" dependencies = [ - "bitflags 2.3.3", + "bitflags 2.4.0", "cap-fs-ext", "cap-std 2.0.0", "fd-lock", "io-lifetimes 2.0.2", - "rustix 0.38.7", + "rustix 0.38.9", "windows-sys", "winx 0.36.1", ] @@ -1692,14 +1645,14 @@ checksum = "9d0e916b1148c8e263850e1ebcbd046f333e0683c724876bb0da63ea4373dc8a" [[package]] name = "tempfile" -version = "3.7.1" +version = "3.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc02fddf48964c42031a0b3fe0428320ecf3a73c401040fc0096f97794310651" +checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" dependencies = [ "cfg-if", "fastrand", "redox_syscall 0.3.5", - "rustix 0.38.7", + "rustix 0.38.9", "windows-sys", ] @@ -1714,22 +1667,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.44" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90" +checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.44" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96" +checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -1749,9 +1702,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.30.0" +version = "1.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d3ce25f50619af8b0aec2eb23deebe84249e19e2ddd393a6e16e3300a6dadfd" +checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" dependencies = [ "backtrace", "bytes", @@ -1772,7 +1725,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -1839,7 +1792,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -1859,9 +1812,9 @@ checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] name = "unicase" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" +checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" dependencies = [ "version_check", ] @@ -1913,9 +1866,9 @@ checksum = "f28467d3e1d3c6586d8f25fa243f544f5800fec42d97032474e17222c2b75cfa" [[package]] name = "url" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" dependencies = [ "form_urlencoded", "idna", @@ -1985,7 +1938,7 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasi-cap-std-sync" version = "13.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime#f32993002bc523083b7d7cca49179a3285c44c03" +source = "git+https://github.com/bytecodealliance/wasmtime#0c7bf47f0e608a8b68c4abd20cf52107e09cf9b5" dependencies = [ "anyhow", "async-trait", @@ -1998,7 +1951,7 @@ dependencies = [ "io-lifetimes 2.0.2", "is-terminal", "once_cell", - "rustix 0.38.7", + "rustix 0.38.9", "system-interface", "tracing", "wasi-common", @@ -2008,15 +1961,15 @@ dependencies = [ [[package]] name = "wasi-common" version = "13.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime#f32993002bc523083b7d7cca49179a3285c44c03" +source = "git+https://github.com/bytecodealliance/wasmtime#0c7bf47f0e608a8b68c4abd20cf52107e09cf9b5" dependencies = [ "anyhow", - "bitflags 2.3.3", + "bitflags 2.4.0", "cap-rand", "cap-std 2.0.0", "io-extras 0.18.0", "log", - "rustix 0.38.7", + "rustix 0.38.9", "thiserror", "tracing", "wasmtime", @@ -2037,17 +1990,18 @@ dependencies = [ "toml 0.7.6", "walrus", "wasm-compose", - "wasm-metadata 0.10.1 (git+https://github.com/bytecodealliance/wasm-tools)", + "wasm-metadata", "wasm-opt", "wasmtime", "wasmtime-wasi", - "wit-component 0.13.1 (git+https://github.com/bytecodealliance/wasm-tools)", + "wit-component", ] [[package]] name = "wasm-compose" -version = "0.4.0" -source = "git+https://github.com/bytecodealliance/wasm-tools#4678a61ae428da21299aeae016bd56d5e248248f" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a395de8ddf91f118a21e233c16afcf3d41ad9d945fc9578cb054cb3f72aebba6" dependencies = [ "anyhow", "heck 0.4.1", @@ -2057,9 +2011,9 @@ dependencies = [ "serde", "serde_yaml", "smallvec", - "wasm-encoder 0.31.1 (git+https://github.com/bytecodealliance/wasm-tools)", - "wasmparser 0.110.0 (git+https://github.com/bytecodealliance/wasm-tools)", - "wat 1.0.69 (git+https://github.com/bytecodealliance/wasm-tools)", + "wasm-encoder 0.32.0", + "wasmparser 0.112.0", + "wat", ] [[package]] @@ -2073,55 +2027,33 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.31.1" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41763f20eafed1399fff1afb466496d3a959f58241436cfdc17e3f5ca954de16" -dependencies = [ - "leb128", -] - -[[package]] -name = "wasm-encoder" -version = "0.31.1" -source = "git+https://github.com/bytecodealliance/wasm-tools#4678a61ae428da21299aeae016bd56d5e248248f" +checksum = "1ba64e81215916eaeb48fee292f29401d69235d62d8b8fd92a7b2844ec5ae5f7" dependencies = [ "leb128", ] [[package]] name = "wasm-metadata" -version = "0.10.1" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be44e148f09a188971ec512250b3ae136029e2df586dd740586ce76a17ee657d" -dependencies = [ - "anyhow", - "indexmap 2.0.0", - "serde", - "serde_json", - "spdx", - "wasm-encoder 0.31.1 (registry+https://github.com/rust-lang/crates.io-index)", - "wasmparser 0.110.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "wasm-metadata" -version = "0.10.1" -source = "git+https://github.com/bytecodealliance/wasm-tools#4678a61ae428da21299aeae016bd56d5e248248f" +checksum = "08dc59d1fa569150851542143ca79438ca56845ccb31696c70225c638e063471" dependencies = [ "anyhow", "indexmap 2.0.0", "serde", "serde_json", "spdx", - "wasm-encoder 0.31.1 (git+https://github.com/bytecodealliance/wasm-tools)", - "wasmparser 0.110.0 (git+https://github.com/bytecodealliance/wasm-tools)", + "wasm-encoder 0.32.0", + "wasmparser 0.112.0", ] [[package]] name = "wasm-opt" -version = "0.113.0" +version = "0.114.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65a2799e08026234b07b44da6363703974e75be21430cef00756bbc438c8ff8a" +checksum = "4d005a95f934878a1fb446a816d51c3601a0120ff929005ba3bab3c749cfd1c7" dependencies = [ "anyhow", "libc", @@ -2135,9 +2067,9 @@ dependencies = [ [[package]] name = "wasm-opt-cxx-sys" -version = "0.113.0" +version = "0.114.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8d26f86d1132245e8bcea8fac7f02b10fb885b6696799969c94d7d3c14db5e1" +checksum = "6d04e240598162810fad3b2e96fa0dec6dba1eb65a03f3bd99a9248ab8b56caa" dependencies = [ "anyhow", "cxx", @@ -2147,9 +2079,9 @@ dependencies = [ [[package]] name = "wasm-opt-sys" -version = "0.113.0" +version = "0.114.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497d069cd3420cdd52154a320b901114a20946878e2de62c670f9d906e472370" +checksum = "2efd2aaca519d64098c4faefc8b7433a97ed511caf4c9e516384eb6aef1ff4f9" dependencies = [ "anyhow", "cc", @@ -2165,18 +2097,9 @@ checksum = "449167e2832691a1bff24cde28d2804e90e09586a448c8e76984792c44334a6b" [[package]] name = "wasmparser" -version = "0.110.0" +version = "0.112.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dfcdb72d96f01e6c85b6bf20102e7423bdbaad5c337301bab2bbf253d26413c" -dependencies = [ - "indexmap 2.0.0", - "semver", -] - -[[package]] -name = "wasmparser" -version = "0.110.0" -source = "git+https://github.com/bytecodealliance/wasm-tools#4678a61ae428da21299aeae016bd56d5e248248f" +checksum = "e986b010f47fcce49cf8ea5d5f9e5d2737832f12b53ae8ae785bbe895d0877bf" dependencies = [ "indexmap 2.0.0", "semver", @@ -2184,18 +2107,18 @@ dependencies = [ [[package]] name = "wasmprinter" -version = "0.2.62" +version = "0.2.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42cd12ed4d96a984e4b598a17457f1126d01640cc7461afbb319642111ff9e7f" +checksum = "34ddf5892036cd4b780d505eff1194a0cbc10ed896097656fdcea3744b5e7c2f" dependencies = [ "anyhow", - "wasmparser 0.110.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wasmparser 0.112.0", ] [[package]] name = "wasmtime" version = "13.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime#f32993002bc523083b7d7cca49179a3285c44c03" +source = "git+https://github.com/bytecodealliance/wasmtime#0c7bf47f0e608a8b68c4abd20cf52107e09cf9b5" dependencies = [ "anyhow", "async-trait", @@ -2215,8 +2138,8 @@ dependencies = [ "serde", "serde_json", "target-lexicon", - "wasm-encoder 0.31.1 (registry+https://github.com/rust-lang/crates.io-index)", - "wasmparser 0.110.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-encoder 0.32.0", + "wasmparser 0.112.0", "wasmtime-cache", "wasmtime-component-macro", "wasmtime-component-util", @@ -2226,14 +2149,14 @@ dependencies = [ "wasmtime-jit", "wasmtime-runtime", "wasmtime-winch", - "wat 1.0.69 (registry+https://github.com/rust-lang/crates.io-index)", + "wat", "windows-sys", ] [[package]] name = "wasmtime-asm-macros" version = "13.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime#f32993002bc523083b7d7cca49179a3285c44c03" +source = "git+https://github.com/bytecodealliance/wasmtime#0c7bf47f0e608a8b68c4abd20cf52107e09cf9b5" dependencies = [ "cfg-if", ] @@ -2241,15 +2164,14 @@ dependencies = [ [[package]] name = "wasmtime-cache" version = "13.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime#f32993002bc523083b7d7cca49179a3285c44c03" +source = "git+https://github.com/bytecodealliance/wasmtime#0c7bf47f0e608a8b68c4abd20cf52107e09cf9b5" dependencies = [ "anyhow", "base64", "bincode", "directories-next", - "file-per-thread-logger", "log", - "rustix 0.38.7", + "rustix 0.38.9", "serde", "sha2", "toml 0.5.11", @@ -2260,40 +2182,41 @@ dependencies = [ [[package]] name = "wasmtime-component-macro" version = "13.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime#f32993002bc523083b7d7cca49179a3285c44c03" +source = "git+https://github.com/bytecodealliance/wasmtime#0c7bf47f0e608a8b68c4abd20cf52107e09cf9b5" dependencies = [ "anyhow", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", "wasmtime-component-util", "wasmtime-wit-bindgen", - "wit-parser 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", + "wit-parser", ] [[package]] name = "wasmtime-component-util" version = "13.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime#f32993002bc523083b7d7cca49179a3285c44c03" +source = "git+https://github.com/bytecodealliance/wasmtime#0c7bf47f0e608a8b68c4abd20cf52107e09cf9b5" [[package]] name = "wasmtime-cranelift" version = "13.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime#f32993002bc523083b7d7cca49179a3285c44c03" +source = "git+https://github.com/bytecodealliance/wasmtime#0c7bf47f0e608a8b68c4abd20cf52107e09cf9b5" dependencies = [ "anyhow", + "cfg-if", "cranelift-codegen", "cranelift-control", "cranelift-entity", "cranelift-frontend", "cranelift-native", "cranelift-wasm", - "gimli 0.27.3", + "gimli 0.28.0", "log", "object", "target-lexicon", "thiserror", - "wasmparser 0.110.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wasmparser 0.112.0", "wasmtime-cranelift-shared", "wasmtime-environ", "wasmtime-versioned-export-macros", @@ -2302,13 +2225,13 @@ dependencies = [ [[package]] name = "wasmtime-cranelift-shared" version = "13.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime#f32993002bc523083b7d7cca49179a3285c44c03" +source = "git+https://github.com/bytecodealliance/wasmtime#0c7bf47f0e608a8b68c4abd20cf52107e09cf9b5" dependencies = [ "anyhow", "cranelift-codegen", "cranelift-control", "cranelift-native", - "gimli 0.27.3", + "gimli 0.28.0", "object", "target-lexicon", "wasmtime-environ", @@ -2317,19 +2240,19 @@ dependencies = [ [[package]] name = "wasmtime-environ" version = "13.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime#f32993002bc523083b7d7cca49179a3285c44c03" +source = "git+https://github.com/bytecodealliance/wasmtime#0c7bf47f0e608a8b68c4abd20cf52107e09cf9b5" dependencies = [ "anyhow", "cranelift-entity", - "gimli 0.27.3", + "gimli 0.28.0", "indexmap 2.0.0", "log", "object", "serde", "target-lexicon", "thiserror", - "wasm-encoder 0.31.1 (registry+https://github.com/rust-lang/crates.io-index)", - "wasmparser 0.110.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-encoder 0.32.0", + "wasmparser 0.112.0", "wasmprinter", "wasmtime-component-util", "wasmtime-types", @@ -2338,11 +2261,11 @@ dependencies = [ [[package]] name = "wasmtime-fiber" version = "13.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime#f32993002bc523083b7d7cca49179a3285c44c03" +source = "git+https://github.com/bytecodealliance/wasmtime#0c7bf47f0e608a8b68c4abd20cf52107e09cf9b5" dependencies = [ "cc", "cfg-if", - "rustix 0.38.7", + "rustix 0.38.9", "wasmtime-asm-macros", "wasmtime-versioned-export-macros", "windows-sys", @@ -2351,19 +2274,19 @@ dependencies = [ [[package]] name = "wasmtime-jit" version = "13.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime#f32993002bc523083b7d7cca49179a3285c44c03" +source = "git+https://github.com/bytecodealliance/wasmtime#0c7bf47f0e608a8b68c4abd20cf52107e09cf9b5" dependencies = [ "addr2line", "anyhow", "bincode", "cfg-if", "cpp_demangle", - "gimli 0.27.3", + "gimli 0.28.0", "ittapi", "log", "object", "rustc-demangle", - "rustix 0.38.7", + "rustix 0.38.9", "serde", "target-lexicon", "wasmtime-environ", @@ -2376,18 +2299,18 @@ dependencies = [ [[package]] name = "wasmtime-jit-debug" version = "13.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime#f32993002bc523083b7d7cca49179a3285c44c03" +source = "git+https://github.com/bytecodealliance/wasmtime#0c7bf47f0e608a8b68c4abd20cf52107e09cf9b5" dependencies = [ "object", "once_cell", - "rustix 0.38.7", + "rustix 0.38.9", "wasmtime-versioned-export-macros", ] [[package]] name = "wasmtime-jit-icache-coherence" version = "13.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime#f32993002bc523083b7d7cca49179a3285c44c03" +source = "git+https://github.com/bytecodealliance/wasmtime#0c7bf47f0e608a8b68c4abd20cf52107e09cf9b5" dependencies = [ "cfg-if", "libc", @@ -2397,7 +2320,7 @@ dependencies = [ [[package]] name = "wasmtime-runtime" version = "13.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime#f32993002bc523083b7d7cca49179a3285c44c03" +source = "git+https://github.com/bytecodealliance/wasmtime#0c7bf47f0e608a8b68c4abd20cf52107e09cf9b5" dependencies = [ "anyhow", "cc", @@ -2411,57 +2334,61 @@ dependencies = [ "memoffset", "paste", "rand", - "rustix 0.38.7", + "rustix 0.38.9", "sptr", - "wasm-encoder 0.31.1 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-encoder 0.32.0", "wasmtime-asm-macros", "wasmtime-environ", "wasmtime-fiber", "wasmtime-jit-debug", "wasmtime-versioned-export-macros", + "wasmtime-wmemcheck", "windows-sys", ] [[package]] name = "wasmtime-types" version = "13.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime#f32993002bc523083b7d7cca49179a3285c44c03" +source = "git+https://github.com/bytecodealliance/wasmtime#0c7bf47f0e608a8b68c4abd20cf52107e09cf9b5" dependencies = [ "cranelift-entity", "serde", "thiserror", - "wasmparser 0.110.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wasmparser 0.112.0", ] [[package]] name = "wasmtime-versioned-export-macros" version = "13.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime#f32993002bc523083b7d7cca49179a3285c44c03" +source = "git+https://github.com/bytecodealliance/wasmtime#0c7bf47f0e608a8b68c4abd20cf52107e09cf9b5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] name = "wasmtime-wasi" version = "13.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime#f32993002bc523083b7d7cca49179a3285c44c03" +source = "git+https://github.com/bytecodealliance/wasmtime#0c7bf47f0e608a8b68c4abd20cf52107e09cf9b5" dependencies = [ "anyhow", "async-trait", - "bitflags 2.3.3", + "bitflags 2.4.0", "bytes", "cap-fs-ext", + "cap-net-ext", "cap-rand", "cap-std 2.0.0", "cap-time-ext", "fs-set-times 0.20.0", "futures", "io-extras 0.18.0", + "io-lifetimes 2.0.2", + "is-terminal", "libc", "once_cell", - "rustix 0.38.7", + "rustix 0.38.9", "system-interface", "thiserror", "tokio", @@ -2476,14 +2403,14 @@ dependencies = [ [[package]] name = "wasmtime-winch" version = "13.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime#f32993002bc523083b7d7cca49179a3285c44c03" +source = "git+https://github.com/bytecodealliance/wasmtime#0c7bf47f0e608a8b68c4abd20cf52107e09cf9b5" dependencies = [ "anyhow", "cranelift-codegen", - "gimli 0.27.3", + "gimli 0.28.0", "object", "target-lexicon", - "wasmparser 0.110.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wasmparser 0.112.0", "wasmtime-cranelift-shared", "wasmtime-environ", "winch-codegen", @@ -2492,14 +2419,19 @@ dependencies = [ [[package]] name = "wasmtime-wit-bindgen" version = "13.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime#f32993002bc523083b7d7cca49179a3285c44c03" +source = "git+https://github.com/bytecodealliance/wasmtime#0c7bf47f0e608a8b68c4abd20cf52107e09cf9b5" dependencies = [ "anyhow", "heck 0.4.1", "indexmap 2.0.0", - "wit-parser 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", + "wit-parser", ] +[[package]] +name = "wasmtime-wmemcheck" +version = "13.0.0" +source = "git+https://github.com/bytecodealliance/wasmtime#0c7bf47f0e608a8b68c4abd20cf52107e09cf9b5" + [[package]] name = "wast" version = "35.0.2" @@ -2511,52 +2443,33 @@ dependencies = [ [[package]] name = "wast" -version = "62.0.1" +version = "64.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8ae06f09dbe377b889fbd620ff8fa21e1d49d1d9d364983c0cdbf9870cb9f1f" +checksum = "a259b226fd6910225aa7baeba82f9d9933b6d00f2ce1b49b80fa4214328237cc" dependencies = [ "leb128", "memchr", "unicode-width", - "wasm-encoder 0.31.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "wast" -version = "62.0.1" -source = "git+https://github.com/bytecodealliance/wasm-tools#4678a61ae428da21299aeae016bd56d5e248248f" -dependencies = [ - "leb128", - "memchr", - "unicode-width", - "wasm-encoder 0.31.1 (git+https://github.com/bytecodealliance/wasm-tools)", + "wasm-encoder 0.32.0", ] [[package]] name = "wat" -version = "1.0.69" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "842e15861d203fb4a96d314b0751cdeaf0f6f8b35e8d81d2953af2af5e44e637" -dependencies = [ - "wast 62.0.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "wat" -version = "1.0.69" -source = "git+https://github.com/bytecodealliance/wasm-tools#4678a61ae428da21299aeae016bd56d5e248248f" +checksum = "53253d920ab413fca1c7dc2161d601c79b4fdf631d0ba51dd4343bf9b556c3f6" dependencies = [ - "wast 62.0.1 (git+https://github.com/bytecodealliance/wasm-tools)", + "wast 64.0.0", ] [[package]] name = "wiggle" version = "13.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime#f32993002bc523083b7d7cca49179a3285c44c03" +source = "git+https://github.com/bytecodealliance/wasmtime#0c7bf47f0e608a8b68c4abd20cf52107e09cf9b5" dependencies = [ "anyhow", "async-trait", - "bitflags 2.3.3", + "bitflags 2.4.0", "thiserror", "tracing", "wasmtime", @@ -2566,25 +2479,25 @@ dependencies = [ [[package]] name = "wiggle-generate" version = "13.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime#f32993002bc523083b7d7cca49179a3285c44c03" +source = "git+https://github.com/bytecodealliance/wasmtime#0c7bf47f0e608a8b68c4abd20cf52107e09cf9b5" dependencies = [ "anyhow", "heck 0.4.1", "proc-macro2", "quote", "shellexpand", - "syn 2.0.28", + "syn 2.0.29", "witx", ] [[package]] name = "wiggle-macro" version = "13.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime#f32993002bc523083b7d7cca49179a3285c44c03" +source = "git+https://github.com/bytecodealliance/wasmtime#0c7bf47f0e608a8b68c4abd20cf52107e09cf9b5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", "wiggle-generate", ] @@ -2622,15 +2535,15 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "winch-codegen" version = "0.11.0" -source = "git+https://github.com/bytecodealliance/wasmtime#f32993002bc523083b7d7cca49179a3285c44c03" +source = "git+https://github.com/bytecodealliance/wasmtime#0c7bf47f0e608a8b68c4abd20cf52107e09cf9b5" dependencies = [ "anyhow", "cranelift-codegen", - "gimli 0.27.3", + "gimli 0.28.0", "regalloc2", "smallvec", "target-lexicon", - "wasmparser 0.110.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wasmparser 0.112.0", "wasmtime-environ", ] @@ -2645,9 +2558,9 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", @@ -2660,51 +2573,51 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_i686_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_x86_64_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winnow" -version = "0.5.4" +version = "0.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acaaa1190073b2b101e15083c38ee8ec891b5e05cbee516521e94ec008f61e64" +checksum = "7c2e3184b9c4e92ad5167ca73039d0c42476302ab603e2fec4487511f38ccefc" dependencies = [ "memchr", ] @@ -2726,46 +2639,46 @@ version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4857cedf8371f690bb6782a3e2b065c54d1b6661be068aaf3eac8b45e813fdf8" dependencies = [ - "bitflags 2.3.3", + "bitflags 2.4.0", "windows-sys", ] [[package]] name = "wit-bindgen" -version = "0.9.0" -source = "git+https://github.com/bytecodealliance/wit-bindgen#03154cb3de538d068ba9f37f28abe762c7574132" +version = "0.10.0" +source = "git+https://github.com/bytecodealliance/wit-bindgen#f84e0297961623d778f6eaaf04ceecf9540034fd" dependencies = [ - "bitflags 2.3.3", + "bitflags 2.4.0", "wit-bindgen-rust-macro", ] [[package]] name = "wit-bindgen-core" -version = "0.9.0" -source = "git+https://github.com/bytecodealliance/wit-bindgen#03154cb3de538d068ba9f37f28abe762c7574132" +version = "0.10.0" +source = "git+https://github.com/bytecodealliance/wit-bindgen#f84e0297961623d778f6eaaf04ceecf9540034fd" dependencies = [ "anyhow", - "wit-component 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", - "wit-parser 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", + "wit-component", + "wit-parser", ] [[package]] name = "wit-bindgen-rust" -version = "0.9.0" -source = "git+https://github.com/bytecodealliance/wit-bindgen#03154cb3de538d068ba9f37f28abe762c7574132" +version = "0.10.0" +source = "git+https://github.com/bytecodealliance/wit-bindgen#f84e0297961623d778f6eaaf04ceecf9540034fd" dependencies = [ "anyhow", "heck 0.4.1", - "wasm-metadata 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-metadata", "wit-bindgen-core", "wit-bindgen-rust-lib", - "wit-component 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", + "wit-component", ] [[package]] name = "wit-bindgen-rust-lib" -version = "0.9.0" -source = "git+https://github.com/bytecodealliance/wit-bindgen#03154cb3de538d068ba9f37f28abe762c7574132" +version = "0.10.0" +source = "git+https://github.com/bytecodealliance/wit-bindgen#f84e0297961623d778f6eaaf04ceecf9540034fd" dependencies = [ "heck 0.4.1", "wit-bindgen-core", @@ -2773,69 +2686,41 @@ dependencies = [ [[package]] name = "wit-bindgen-rust-macro" -version = "0.9.0" -source = "git+https://github.com/bytecodealliance/wit-bindgen#03154cb3de538d068ba9f37f28abe762c7574132" +version = "0.10.0" +source = "git+https://github.com/bytecodealliance/wit-bindgen#f84e0297961623d778f6eaaf04ceecf9540034fd" dependencies = [ "anyhow", "proc-macro2", - "syn 2.0.28", + "syn 2.0.29", "wit-bindgen-core", "wit-bindgen-rust", "wit-bindgen-rust-lib", - "wit-component 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", + "wit-component", ] [[package]] name = "wit-component" -version = "0.13.1" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d843f4dfead0d465b09e8bfba4d3dcb1a1bcc857f87917d348c7fa401158bc5" +checksum = "66d9f2d16dd55d1a372dcfd4b7a466ea876682a5a3cb97e71ec9eef04affa876" dependencies = [ "anyhow", - "bitflags 2.3.3", + "bitflags 2.4.0", "indexmap 2.0.0", "log", - "wasm-encoder 0.31.1 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-metadata 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", - "wasmparser 0.110.0 (registry+https://github.com/rust-lang/crates.io-index)", - "wit-parser 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "wit-component" -version = "0.13.1" -source = "git+https://github.com/bytecodealliance/wasm-tools#4678a61ae428da21299aeae016bd56d5e248248f" -dependencies = [ - "anyhow", - "bitflags 2.3.3", - "indexmap 2.0.0", - "log", - "wasm-encoder 0.31.1 (git+https://github.com/bytecodealliance/wasm-tools)", - "wasm-metadata 0.10.1 (git+https://github.com/bytecodealliance/wasm-tools)", - "wasmparser 0.110.0 (git+https://github.com/bytecodealliance/wasm-tools)", - "wit-parser 0.9.2 (git+https://github.com/bytecodealliance/wasm-tools)", + "serde", + "serde_json", + "wasm-encoder 0.32.0", + "wasm-metadata", + "wasmparser 0.112.0", + "wit-parser", ] [[package]] name = "wit-parser" -version = "0.9.2" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "541efa2046e544de53a9da1e2f6299e63079840360c9e106f1f8275a97771318" -dependencies = [ - "anyhow", - "id-arena", - "indexmap 2.0.0", - "log", - "pulldown-cmark", - "semver", - "unicode-xid", - "url", -] - -[[package]] -name = "wit-parser" -version = "0.9.2" -source = "git+https://github.com/bytecodealliance/wasm-tools#4678a61ae428da21299aeae016bd56d5e248248f" +checksum = "61e8b849bea13cc2315426b16efe6eb6813466d78f5fde69b0bb150c9c40e0dc" dependencies = [ "anyhow", "id-arena", @@ -2850,7 +2735,7 @@ dependencies = [ [[package]] name = "witx" version = "0.9.1" -source = "git+https://github.com/bytecodealliance/wasmtime#f32993002bc523083b7d7cca49179a3285c44c03" +source = "git+https://github.com/bytecodealliance/wasmtime#0c7bf47f0e608a8b68c4abd20cf52107e09cf9b5" dependencies = [ "anyhow", "log", diff --git a/Cargo.toml b/Cargo.toml index c811f36..8eeb6f1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,10 +33,10 @@ clap = { version = "4", features = ["derive"] } serde = { version = "1", features = ["derive"] } toml = "0.7" walrus = "0.20.1" -wasm-compose = { git = "https://github.com/bytecodealliance/wasm-tools" } -wasm-metadata = { git = "https://github.com/bytecodealliance/wasm-tools" } -wasm-opt = "0.113.0" -wit-component = { git = "https://github.com/bytecodealliance/wasm-tools" } +wasm-compose = "0.4.2" +wasm-metadata = "0.10.3" +wasm-opt = "0.114.1" +wit-component = "0.14.0" [build-dependencies] anyhow = "1" @@ -47,8 +47,8 @@ cap-std = "1.0.12" heck = { version = "0.4" } tokio = { version = "1.30.0", features = ["macros"] } wasmtime = { git = "https://github.com/bytecodealliance/wasmtime", features = ["component-model"] } -wasmtime-wasi = { git = "https://github.com/bytecodealliance/wasmtime" } +wasmtime-wasi = { git = "https://github.com/bytecodealliance/wasmtime" } [workspace.dependencies] anyhow = "1" -wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen" } +wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen" } \ No newline at end of file diff --git a/lib/virtual_adapter.wasm b/lib/virtual_adapter.wasm index 5d59a3f..68a73a6 100755 Binary files a/lib/virtual_adapter.wasm and b/lib/virtual_adapter.wasm differ diff --git a/lib/wasi_snapshot_preview1.reactor.wasm b/lib/wasi_snapshot_preview1.reactor.wasm index 6c31e35..6724926 100644 Binary files a/lib/wasi_snapshot_preview1.reactor.wasm and b/lib/wasi_snapshot_preview1.reactor.wasm differ diff --git a/src/virt_deny.rs b/src/virt_deny.rs index 426e9c5..bacfffa 100644 --- a/src/virt_deny.rs +++ b/src/virt_deny.rs @@ -185,13 +185,7 @@ pub(crate) fn deny_http_virt(module: &mut Module) -> Result<()> { )?; add_stub_exported_func( module, - "wasi:http/types#incoming-request-path", - vec![ValType::I32], - vec![ValType::I32], - )?; - add_stub_exported_func( - module, - "wasi:http/types#incoming-request-query", + "wasi:http/types#incoming-request-path-with-query", vec![ValType::I32], vec![ValType::I32], )?; @@ -255,7 +249,13 @@ pub(crate) fn deny_http_virt(module: &mut Module) -> Result<()> { add_stub_exported_func( module, "wasi:http/types#set-response-outparam", - vec![ValType::I32, ValType::I32, ValType::I32, ValType::I32], + vec![ + ValType::I32, + ValType::I32, + ValType::I32, + ValType::I32, + ValType::I32, + ], vec![ValType::I32], )?; add_stub_exported_func( @@ -368,12 +368,7 @@ pub(crate) fn deny_random_virt(module: &mut Module) -> Result<()> { } pub(crate) fn deny_exit_virt(module: &mut Module) -> Result<()> { - add_stub_exported_func( - module, - "wasi:cli-base/exit#exit", - vec![ValType::I32], - vec![], - )?; + add_stub_exported_func(module, "wasi:cli/exit#exit", vec![ValType::I32], vec![])?; Ok(()) } diff --git a/src/virt_env.rs b/src/virt_env.rs index 78cece3..28f494c 100644 --- a/src/virt_env.rs +++ b/src/virt_env.rs @@ -214,14 +214,16 @@ pub(crate) fn create_env_virt<'a>(module: &'a mut Module, env: &VirtEnv) -> Resu } pub(crate) fn stub_env_virt(module: &mut Module) -> Result<()> { - stub_imported_func(module, "wasi:cli-base/environment", "get-arguments", true)?; - stub_imported_func(module, "wasi:cli-base/environment", "get-environment", true)?; + stub_imported_func(module, "wasi:cli/environment", "get-arguments", true)?; + stub_imported_func(module, "wasi:cli/environment", "get-environment", true)?; + stub_imported_func(module, "wasi:cli/environment", "initial-cwd", true)?; Ok(()) } pub(crate) fn strip_env_virt(module: &mut Module) -> Result<()> { stub_env_virt(module)?; - remove_exported_func(module, "wasi:cli-base/environment#get-arguments")?; - remove_exported_func(module, "wasi:cli-base/environment#get-environment")?; + remove_exported_func(module, "wasi:cli/environment#get-arguments")?; + remove_exported_func(module, "wasi:cli/environment#get-environment")?; + remove_exported_func(module, "wasi:cli/environment#initial-cwd")?; Ok(()) } diff --git a/src/virt_io.rs b/src/virt_io.rs index a592199..5a69b87 100644 --- a/src/virt_io.rs +++ b/src/virt_io.rs @@ -248,30 +248,55 @@ impl FsEntry { Ok(()) } - pub fn visit_pre<'a, Visitor>(&'a self, base_path: &str, visit: &mut Visitor) -> Result<()> + pub fn visit_bfs<'a, Visitor>(&'a self, base_path: &str, visit: &mut Visitor) -> Result<()> where Visitor: FnMut(&FsEntry, &str, &str, usize) -> Result<()>, { - visit(self, base_path, "", 0)?; - self.visit_pre_inner(visit, base_path) + visit(self, base_path, "", 1)?; + let mut children_of = vec![(base_path.to_string(), self)]; + let mut next_children_of; + while children_of.len() > 0 { + next_children_of = Vec::new(); + FsEntry::visit_bfs_level(children_of, visit, &mut next_children_of)?; + children_of = next_children_of; + } + Ok(()) } - fn visit_pre_inner<'a, Visitor>(&'a self, visit: &mut Visitor, base_path: &str) -> Result<()> + fn visit_bfs_level<'a, Visitor>( + children_of: Vec<(String, &'a FsEntry)>, + visit: &mut Visitor, + next_children_of: &mut Vec<(String, &'a FsEntry)>, + ) -> Result<()> where Visitor: FnMut(&FsEntry, &str, &str, usize) -> Result<()>, { - match self { - FsEntry::Dir(dir) => { - let len = dir.iter().len(); - for (idx, (name, sub_entry)) in dir.iter().enumerate() { - visit(sub_entry, name, base_path, len - idx - 1)?; + // first we do a full len count at this depth to be able to predict the + // next depth offset position for children of this item from the current index + let mut child_offset = 0; + for (_, parent) in &children_of { + match parent { + FsEntry::Dir(dir) => { + child_offset += dir.iter().len(); } - for (name, sub_entry) in dir { - let path = format!("{base_path}/{name}"); - sub_entry.visit_pre_inner(visit, &path)?; + _ => {} + } + } + for (base_path, parent) in children_of { + match parent { + FsEntry::Dir(dir) => { + for (name, sub_entry) in dir.iter() { + visit(sub_entry, name, &base_path, child_offset)?; + child_offset -= 1; + let path = format!("{base_path}/{name}"); + next_children_of.push((path, sub_entry)); + if let FsEntry::Dir(dir) = sub_entry { + child_offset += dir.iter().len(); + } + } } + _ => {} } - _ => {} } Ok(()) } @@ -386,7 +411,8 @@ pub(crate) fn create_io_virt<'a>( if let Some(fs) = &fs { for (name, entry) in &fs.preopens { preopen_indices.push(static_fs_data.len() as u32); - entry.visit_pre(name, &mut |entry, name, _path, remaining_siblings| { + let mut cur_idx = 0; + entry.visit_bfs(name, &mut |entry, name, _path, child_offset| { let name_str_ptr = data_section.string(name)?; let (ty, data) = match &entry { // removed during previous step @@ -408,20 +434,12 @@ pub(crate) fn create_io_virt<'a>( StaticFileData { host_path: str }, ) } - FsEntry::Dir(dir) => { - let child_cnt = dir.len() as u32; - // children will be visited next in preorder and contiguously - // therefore the child index in the static fs data is known - // to be the next index - let start_idx = static_fs_data.len() as u32 + 1; - let child_idx = start_idx + remaining_siblings as u32; - ( - StaticIndexType::Dir, - StaticFileData { - dir: (child_idx, child_cnt), - }, - ) - } + FsEntry::Dir(dir) => ( + StaticIndexType::Dir, + StaticFileData { + dir: (child_offset as u32, dir.len() as u32), + }, + ), FsEntry::File(bytes) => { let byte_len = bytes.len(); if byte_len > fs.passive_cutoff.unwrap_or(1024) as usize { @@ -448,6 +466,7 @@ pub(crate) fn create_io_virt<'a>( ty, data, }); + cur_idx += 1; Ok(()) })?; } @@ -525,9 +544,10 @@ pub(crate) fn create_io_virt<'a>( Ok(virtual_files) } -// stubs must be _comprehensive_ in order to act as full deny over entire subsystem +// Stubs must be _comprehensive_ in order to act as full deny over entire subsystem // when stubbing functions that are not part of the virtual adapter exports, we therefore -// have to create this functions fresh +// have to create this functions fresh. +// Ideally, we should generate these stubs automatically from WASI definitions. pub(crate) fn stub_fs_virt(module: &mut Module) -> Result<()> { stub_imported_func(module, "wasi:filesystem/preopens", "get-directories", true)?; stub_imported_func(module, "wasi:filesystem/types", "read-via-stream", true)?; @@ -635,9 +655,39 @@ pub(crate) fn stub_clocks_virt(module: &mut Module) -> Result<()> { } pub(crate) fn stub_stdio_virt(module: &mut Module) -> Result<()> { - stub_imported_func(module, "wasi:cli-base/stdin", "get-stdin", true)?; - stub_imported_func(module, "wasi:cli-base/stdout", "get-stdout", true)?; - stub_imported_func(module, "wasi:cli-base/stderr", "get-stderr", true)?; + stub_imported_func(module, "wasi:cli/stdin", "get-stdin", true)?; + stub_imported_func(module, "wasi:cli/stdout", "get-stdout", true)?; + stub_imported_func(module, "wasi:cli/stderr", "get-stderr", true)?; + stub_imported_func( + module, + "wasi:cli/terminal-stdin", + "get-terminal-stdin", + false, + )?; + stub_imported_func( + module, + "wasi:cli/terminal-stdout", + "get-terminal-stdout", + false, + )?; + stub_imported_func( + module, + "wasi:cli/terminal-stderr", + "get-terminal-stderr", + false, + )?; + stub_imported_func( + module, + "wasi:cli/terminal-input", + "drop-terminal-input", + false, + )?; + stub_imported_func( + module, + "wasi:cli/terminal-output", + "drop-terminal-output", + false, + )?; Ok(()) } @@ -780,8 +830,7 @@ pub(crate) fn strip_http_virt(module: &mut Module) -> Result<()> { remove_exported_func(module, "wasi:http/types#drop-incoming-request")?; remove_exported_func(module, "wasi:http/types#drop-outgoing-request")?; remove_exported_func(module, "wasi:http/types#incoming-request-method")?; - remove_exported_func(module, "wasi:http/types#incoming-request-path")?; - remove_exported_func(module, "wasi:http/types#incoming-request-query")?; + remove_exported_func(module, "wasi:http/types#incoming-request-path-with-query")?; remove_exported_func(module, "wasi:http/types#incoming-request-scheme")?; remove_exported_func(module, "wasi:http/types#incoming-request-authority")?; remove_exported_func(module, "wasi:http/types#incoming-request-headers")?; @@ -817,8 +866,12 @@ pub(crate) fn stub_http_virt(module: &mut Module) -> Result<()> { stub_imported_func(module, "wasi:http/types", "drop-incoming-request", false)?; stub_imported_func(module, "wasi:http/types", "drop-outgoing-request", false)?; stub_imported_func(module, "wasi:http/types", "incoming-request-method", false)?; - stub_imported_func(module, "wasi:http/types", "incoming-request-path", false)?; - stub_imported_func(module, "wasi:http/types", "incoming-request-query", false)?; + stub_imported_func( + module, + "wasi:http/types", + "incoming-request-path-with-query", + false, + )?; stub_imported_func(module, "wasi:http/types", "incoming-request-scheme", false)?; stub_imported_func( module, @@ -872,9 +925,14 @@ pub(crate) fn stub_http_virt(module: &mut Module) -> Result<()> { pub(crate) fn strip_stdio_virt(module: &mut Module) -> Result<()> { stub_stdio_virt(module)?; - remove_exported_func(module, "wasi:cli-base/stdin#get-stdin")?; - remove_exported_func(module, "wasi:cli-base/stdout#get-stdout")?; - remove_exported_func(module, "wasi:cli-base/stderr#get-stderr")?; + remove_exported_func(module, "wasi:cli/stdin#get-stdin")?; + remove_exported_func(module, "wasi:cli/stdout#get-stdout")?; + remove_exported_func(module, "wasi:cli/stderr#get-stderr")?; + remove_exported_func(module, "wasi:cli/terminal-stdin#get-terminal-stdin")?; + remove_exported_func(module, "wasi:cli/terminal-stdout#get-terminal-stdout")?; + remove_exported_func(module, "wasi:cli/terminal-stderr#get-terminal-stderr")?; + remove_exported_func(module, "wasi:cli/terminal-input#drop-terminal-input")?; + remove_exported_func(module, "wasi:cli/terminal-output#drop-terminal-output")?; Ok(()) } diff --git a/tests/components/do-everything/src/lib.rs b/tests/components/do-everything/src/lib.rs index 21a7f42..37936a7 100644 --- a/tests/components/do-everything/src/lib.rs +++ b/tests/components/do-everything/src/lib.rs @@ -15,7 +15,7 @@ wit_bindgen::generate!({ struct VirtTestComponent; -impl VirtTest for VirtTestComponent { +impl Guest for VirtTestComponent { fn test_get_env() -> Vec<(String, String)> { unreachable!(); } diff --git a/tests/components/file-read/src/lib.rs b/tests/components/file-read/src/lib.rs index 6c2d4fa..e974520 100644 --- a/tests/components/file-read/src/lib.rs +++ b/tests/components/file-read/src/lib.rs @@ -10,7 +10,7 @@ wit_bindgen::generate!({ struct VirtTestComponent; -impl VirtTest for VirtTestComponent { +impl Guest for VirtTestComponent { fn test_get_env() -> Vec<(String, String)> { Vec::new() } diff --git a/tests/components/get-env/src/lib.rs b/tests/components/get-env/src/lib.rs index a5e91c2..3aa0f48 100644 --- a/tests/components/get-env/src/lib.rs +++ b/tests/components/get-env/src/lib.rs @@ -10,7 +10,7 @@ wit_bindgen::generate!({ struct VirtTestComponent; -impl VirtTest for VirtTestComponent { +impl Guest for VirtTestComponent { fn test_get_env() -> Vec<(String, String)> { env::vars().collect() } diff --git a/tests/virt.rs b/tests/virt.rs index 05e7a2c..f93c268 100644 --- a/tests/virt.rs +++ b/tests/virt.rs @@ -73,7 +73,7 @@ async fn virt_test() -> Result<()> { let test_case_name = test_case_file_name.strip_suffix(".toml").unwrap(); // Filtering... - // if test_case_name == "encapsulate" { + // if test_case_name != "fs-nested-dir-read" { // continue; // } @@ -89,6 +89,10 @@ async fn virt_test() -> Result<()> { let generated_path = PathBuf::from("tests/generated"); fs::create_dir_all(&generated_path)?; + if DEBUG { + println!("- Building test component"); + } + let mut generated_component_path = generated_path.join(component_name); generated_component_path.set_extension("component.wasm"); cmd(&format!( @@ -96,6 +100,10 @@ async fn virt_test() -> Result<()> { if DEBUG { "" } else { "--release" } ))?; + if DEBUG { + println!("- Encoding test component"); + } + // encode the component let component_core = fs::read(&format!( "target/wasm32-wasi/{}/{}.wasm", @@ -112,6 +120,10 @@ async fn virt_test() -> Result<()> { )?; // create the test case specific virtualization + if DEBUG { + println!("- Creating virtualization"); + } + let mut virt_component_path = generated_path.join(test_case_name); virt_component_path.set_extension("virt.wasm"); let mut virt_opts = test.virt_opts.clone().unwrap_or_default(); @@ -127,6 +139,9 @@ async fn virt_test() -> Result<()> { fs::write(&virt_component_path, virt_component.adapter)?; // compose the test component with the defined test virtualization + if DEBUG { + println!("- Composing virtualization"); + } let component_bytes = ComponentComposer::new( &generated_component_path, &wasm_compose::config::Config { @@ -143,6 +158,9 @@ async fn virt_test() -> Result<()> { } // execute the composed virtualized component test function + if DEBUG { + println!("- Executing composition"); + } let mut builder = WasiCtxBuilder::new(); builder.inherit_stdio().preopened_dir( Dir::open_ambient_dir(".", ambient_authority())?, @@ -201,6 +219,10 @@ async fn virt_test() -> Result<()> { let (instance, _instance) = VirtTest::instantiate_async(&mut store, &component, &linker).await?; + if DEBUG { + println!("- Checking expectations"); + } + // env var expectation check if let Some(expect_env) = &test.expect.env { let env_vars = instance.call_test_get_env(&mut store).await?; @@ -225,18 +247,13 @@ async fn virt_test() -> Result<()> { let file_read = instance .call_test_file_read(&mut store, test.host_fs_path.as_ref().unwrap()) .await?; + if file_read.starts_with("ERR") { + eprintln!("> {}", file_read); + } if !file_read.eq(expect_file_read) { return Err(anyhow!( - "Unexpected file read result testing {:?}: - - \x1b[1mExpected:\x1b[0m {:?} - \x1b[1mActual:\x1b[0m {:?} - - {:?}", - test_case_path, - expect_file_read, - file_read, - test + "Unexpected file read result testing {:?}", + test_case_path )); } } diff --git a/virtual-adapter/src/env.rs b/virtual-adapter/src/env.rs index 677ab54..862bbbe 100644 --- a/virtual-adapter/src/env.rs +++ b/virtual-adapter/src/env.rs @@ -1,5 +1,5 @@ -use crate::exports::wasi::cli_base::environment::Environment; -use crate::wasi::cli_base::environment; +use crate::exports::wasi::cli::environment::Guest as Environment; +use crate::wasi::cli::environment; use crate::VirtAdapter; #[repr(C)] @@ -81,8 +81,10 @@ impl Environment for VirtAdapter { } environment } - fn get_arguments() -> Vec { environment::get_arguments() } + fn initial_cwd() -> Option { + environment::initial_cwd() + } } diff --git a/virtual-adapter/src/io.rs b/virtual-adapter/src/io.rs index 50b072c..0b0061c 100644 --- a/virtual-adapter/src/io.rs +++ b/virtual-adapter/src/io.rs @@ -1,30 +1,40 @@ -use crate::exports::wasi::cli_base::stderr::Stderr; -use crate::exports::wasi::cli_base::stdin::Stdin; -use crate::exports::wasi::cli_base::stdout::Stdout; -use crate::exports::wasi::clocks::monotonic_clock::MonotonicClock; -use crate::exports::wasi::filesystem::preopens::Preopens; +use crate::exports::wasi::cli::stderr::Guest as Stderr; +use crate::exports::wasi::cli::stdin::Guest as Stdin; +use crate::exports::wasi::cli::stdout::Guest as Stdout; +use crate::exports::wasi::cli::terminal_input::Guest as TerminalInput; +use crate::exports::wasi::cli::terminal_output::Guest as TerminalOutput; +use crate::exports::wasi::cli::terminal_stderr::Guest as TerminalStderr; +use crate::exports::wasi::cli::terminal_stdin::Guest as TerminalStdin; +use crate::exports::wasi::cli::terminal_stdout::Guest as TerminalStdout; +use crate::exports::wasi::clocks::monotonic_clock::Guest as MonotonicClock; +use crate::exports::wasi::filesystem::preopens::Guest as Preopens; use crate::exports::wasi::filesystem::types::{ AccessType, Advice, Datetime, DescriptorFlags, DescriptorStat, DescriptorType, DirectoryEntry, - ErrorCode, MetadataHashValue, Modes, NewTimestamp, OpenFlags, PathFlags, - Types as FilesystemTypes, + ErrorCode, Guest as FilesystemTypes, MetadataHashValue, Modes, NewTimestamp, OpenFlags, + PathFlags, }; use crate::exports::wasi::http::types::{ - Error, Fields, Headers, Method, Scheme, StatusCode, Trailers, Types as HttpTypes, + Error, Fields, Guest as HttpTypes, Headers, Method, Scheme, StatusCode, Trailers, }; use crate::exports::wasi::io::streams::{ - InputStream, OutputStream, StreamError, StreamStatus, Streams, + Guest as Streams, InputStream, OutputStream, StreamStatus, }; -use crate::exports::wasi::poll::poll::Poll; +use crate::exports::wasi::poll::poll::Guest as Poll; use crate::exports::wasi::sockets::ip_name_lookup::{ - IpAddress, IpAddressFamily, IpNameLookup, Network, ResolveAddressStream, + Guest as IpNameLookup, IpAddress, IpAddressFamily, Network, ResolveAddressStream, }; use crate::exports::wasi::sockets::tcp::ErrorCode as NetworkErrorCode; -use crate::exports::wasi::sockets::tcp::{IpSocketAddress, ShutdownType, Tcp, TcpSocket}; -use crate::exports::wasi::sockets::udp::{Datagram, Udp, UdpSocket}; - -use crate::wasi::cli_base::stderr; -use crate::wasi::cli_base::stdin; -use crate::wasi::cli_base::stdout; +use crate::exports::wasi::sockets::tcp::{Guest as Tcp, IpSocketAddress, ShutdownType, TcpSocket}; +use crate::exports::wasi::sockets::udp::{Datagram, Guest as Udp, UdpSocket}; + +use crate::wasi::cli::stderr; +use crate::wasi::cli::stdin; +use crate::wasi::cli::stdout; +// use crate::wasi::cli::terminal_input; +// use crate::wasi::cli::terminal_output; +// use crate::wasi::cli::terminal_stderr; +// use crate::wasi::cli::terminal_stdin; +// use crate::wasi::cli::terminal_stdout; use crate::wasi::filesystem::preopens; use crate::wasi::filesystem::types as filesystem_types; use crate::wasi::io::streams; @@ -128,7 +138,7 @@ enum DescriptorTarget { HostDescriptor(u32), } -// #[derive(Debug)] +#[derive(Debug)] struct Descriptor { // the descriptor index of this descriptor fd: u32, @@ -335,9 +345,9 @@ impl StaticIndexEntry { if !matches!(self.ty(), DescriptorType::Directory) { return Err(ErrorCode::NotDirectory); } - let (child_list_idx, child_list_len) = unsafe { (*self).data.dir }; + let (child_offset, child_list_len) = unsafe { (*self).data.dir }; let static_index = Io::static_index(); - Ok(&static_index[child_list_idx..child_list_idx + child_list_len]) + Ok(&static_index[self.idx() + child_offset..self.idx() + child_offset + child_list_len]) } fn dir_lookup(&self, path: &str) -> Result<&'static StaticIndexEntry, ErrorCode> { assert!(path.len() > 0); @@ -390,7 +400,7 @@ union StaticFileData { // } // } -// #[derive(Debug)] +#[derive(Debug)] #[allow(dead_code)] #[repr(u32)] enum StaticIndexType { @@ -481,19 +491,13 @@ struct StaticDirStream { idx: usize, } -fn stream_err() -> StreamError { - StreamError { dummy: 0 } -} - impl StaticFileStream { fn new(fd: u32) -> Self { Self { fd, offset: 0 } } - fn read(&mut self, len: u64) -> Result<(Vec, StreamStatus), StreamError> { - let descriptor = IoState::get_descriptor(self.fd).map_err(|_| stream_err())?; - let (bytes, done) = descriptor - .read(self.offset, len) - .map_err(|_| stream_err())?; + fn read(&mut self, len: u64) -> Result<(Vec, StreamStatus), ()> { + let descriptor = IoState::get_descriptor(self.fd).map_err(|_| ())?; + let (bytes, done) = descriptor.read(self.offset, len).map_err(|_| ())?; self.offset += bytes.len() as u64; Ok(( bytes, @@ -640,10 +644,10 @@ impl IoState { unsafe { STATE.stream_table.insert(sid, stream.into()) }; sid } - fn get_stream<'a>(sid: u32) -> Result<&'a mut Stream, StreamError> { + fn get_stream<'a>(sid: u32) -> Result<&'a mut Stream, ()> { match unsafe { STATE.stream_table.get_mut(&sid) } { Some(stream) => Ok(stream), - None => Err(stream_err()), + None => Err(()), } } fn new_poll(target: PollTarget) -> u32 { @@ -1045,40 +1049,38 @@ fn metadata_hash_map(value: filesystem_types::MetadataHashValue) -> MetadataHash } } -fn stream_res_map( - res: Result<(T, streams::StreamStatus), streams::StreamError>, -) -> Result<(T, StreamStatus), StreamError> { +fn stream_res_map(res: Result<(T, streams::StreamStatus), ()>) -> Result<(T, StreamStatus), ()> { match res { Ok((data, streams::StreamStatus::Ended)) => Ok((data, StreamStatus::Ended)), Ok((data, streams::StreamStatus::Open)) => Ok((data, StreamStatus::Open)), - Err(_) => Err(stream_err()), + Err(_) => Err(()), } } impl Streams for VirtAdapter { - fn read(sid: u32, len: u64) -> Result<(Vec, StreamStatus), StreamError> { + fn read(sid: u32, len: u64) -> Result<(Vec, StreamStatus), ()> { VirtAdapter::blocking_read(sid, len) } - fn blocking_read(sid: u32, len: u64) -> Result<(Vec, StreamStatus), StreamError> { + fn blocking_read(sid: u32, len: u64) -> Result<(Vec, StreamStatus), ()> { let stream = IoState::get_stream(sid)?; match stream { Stream::StaticFile(filestream) => filestream.read(len), Stream::Host(sid) => stream_res_map(streams::blocking_read(*sid, len)), Stream::Null => Ok((vec![], StreamStatus::Ended)), - Stream::Err | Stream::StaticDir(_) => Err(stream_err()), + Stream::Err | Stream::StaticDir(_) => Err(()), } } - fn skip(sid: u32, offset: u64) -> Result<(u64, StreamStatus), StreamError> { + fn skip(sid: u32, offset: u64) -> Result<(u64, StreamStatus), ()> { match IoState::get_stream(sid)? { Stream::Null => Ok((0, StreamStatus::Ended)), - Stream::Err | Stream::StaticDir(_) | Stream::StaticFile(_) => Err(stream_err()), + Stream::Err | Stream::StaticDir(_) | Stream::StaticFile(_) => Err(()), Stream::Host(sid) => stream_res_map(streams::skip(*sid, offset)), } } - fn blocking_skip(sid: u32, offset: u64) -> Result<(u64, StreamStatus), StreamError> { + fn blocking_skip(sid: u32, offset: u64) -> Result<(u64, StreamStatus), ()> { match IoState::get_stream(sid)? { Stream::Null => Ok((0, StreamStatus::Ended)), - Stream::Err | Stream::StaticFile(_) | Stream::StaticDir(_) => Err(stream_err()), + Stream::Err | Stream::StaticFile(_) | Stream::StaticDir(_) => Err(()), Stream::Host(sid) => stream_res_map(streams::blocking_skip(*sid, offset)), } } @@ -1104,41 +1106,41 @@ impl Streams for VirtAdapter { } unsafe { STATE.stream_table.remove(&sid) }; } - fn write(sid: u32, bytes: Vec) -> Result<(u64, StreamStatus), StreamError> { + fn write(sid: u32, bytes: Vec) -> Result<(u64, StreamStatus), ()> { match IoState::get_stream(sid)? { Stream::Null => Ok((bytes.len() as u64, StreamStatus::Ended)), - Stream::Err | Stream::StaticFile(_) | Stream::StaticDir(_) => Err(stream_err()), + Stream::Err | Stream::StaticFile(_) | Stream::StaticDir(_) => Err(()), Stream::Host(sid) => stream_res_map(streams::write(*sid, bytes.as_slice())), } } - fn blocking_write(sid: u32, bytes: Vec) -> Result<(u64, StreamStatus), StreamError> { + fn blocking_write(sid: u32, bytes: Vec) -> Result<(u64, StreamStatus), ()> { match IoState::get_stream(sid)? { Stream::Null => Ok((bytes.len() as u64, StreamStatus::Ended)), - Stream::Err | Stream::StaticFile(_) | Stream::StaticDir(_) => Err(stream_err()), + Stream::Err | Stream::StaticFile(_) | Stream::StaticDir(_) => Err(()), Stream::Host(sid) => stream_res_map(streams::blocking_write(*sid, bytes.as_slice())), } } - fn write_zeroes(sid: u32, len: u64) -> Result<(u64, StreamStatus), StreamError> { + fn write_zeroes(sid: u32, len: u64) -> Result<(u64, StreamStatus), ()> { match IoState::get_stream(sid)? { Stream::Null => Ok((len, StreamStatus::Ended)), - Stream::Err | Stream::StaticFile(_) | Stream::StaticDir(_) => Err(stream_err()), + Stream::Err | Stream::StaticFile(_) | Stream::StaticDir(_) => Err(()), Stream::Host(sid) => stream_res_map(streams::write_zeroes(*sid, len)), } } - fn blocking_write_zeroes(sid: u32, len: u64) -> Result<(u64, StreamStatus), StreamError> { + fn blocking_write_zeroes(sid: u32, len: u64) -> Result<(u64, StreamStatus), ()> { match IoState::get_stream(sid)? { Stream::Null => Ok((len, StreamStatus::Ended)), - Stream::Err | Stream::StaticFile(_) | Stream::StaticDir(_) => Err(stream_err()), + Stream::Err | Stream::StaticFile(_) | Stream::StaticDir(_) => Err(()), Stream::Host(sid) => stream_res_map(streams::blocking_write_zeroes(*sid, len)), } } - fn splice(to_sid: u32, from_sid: u32, len: u64) -> Result<(u64, StreamStatus), StreamError> { + fn splice(to_sid: u32, from_sid: u32, len: u64) -> Result<(u64, StreamStatus), ()> { let to_sid = match IoState::get_stream(to_sid)? { Stream::Null => { return Ok((len, StreamStatus::Ended)); } Stream::Err | Stream::StaticFile(_) | Stream::StaticDir(_) => { - return Err(stream_err()); + return Err(()); } Stream::Host(sid) => *sid, }; @@ -1147,23 +1149,19 @@ impl Streams for VirtAdapter { return Ok((len, StreamStatus::Ended)); } Stream::Err | Stream::StaticFile(_) | Stream::StaticDir(_) => { - return Err(stream_err()); + return Err(()); } Stream::Host(sid) => *sid, }; stream_res_map(streams::splice(to_sid, from_sid, len)) } - fn blocking_splice( - to_sid: u32, - from_sid: u32, - len: u64, - ) -> Result<(u64, StreamStatus), StreamError> { + fn blocking_splice(to_sid: u32, from_sid: u32, len: u64) -> Result<(u64, StreamStatus), ()> { let to_sid = match IoState::get_stream(to_sid)? { Stream::Null => { return Ok((len, StreamStatus::Ended)); } Stream::Err | Stream::StaticFile(_) | Stream::StaticDir(_) => { - return Err(stream_err()); + return Err(()); } Stream::Host(sid) => *sid, }; @@ -1172,19 +1170,19 @@ impl Streams for VirtAdapter { return Ok((len, StreamStatus::Ended)); } Stream::Err | Stream::StaticFile(_) | Stream::StaticDir(_) => { - return Err(stream_err()); + return Err(()); } Stream::Host(sid) => *sid, }; stream_res_map(streams::blocking_splice(to_sid, from_sid, len)) } - fn forward(to_sid: u32, from_sid: u32) -> Result<(u64, StreamStatus), StreamError> { + fn forward(to_sid: u32, from_sid: u32) -> Result<(u64, StreamStatus), ()> { let to_sid = match IoState::get_stream(to_sid)? { Stream::Null => { return Ok((0, StreamStatus::Ended)); } Stream::Err | Stream::StaticFile(_) | Stream::StaticDir(_) => { - return Err(stream_err()); + return Err(()); } Stream::Host(sid) => *sid, }; @@ -1193,7 +1191,7 @@ impl Streams for VirtAdapter { return Ok((0, StreamStatus::Ended)); } Stream::Err | Stream::StaticFile(_) | Stream::StaticDir(_) => { - return Err(stream_err()); + return Err(()); } Stream::Host(sid) => *sid, }; @@ -1243,6 +1241,32 @@ impl Stderr for VirtAdapter { } } +impl TerminalInput for VirtAdapter { + fn drop_terminal_input(_: u32) {} +} + +impl TerminalOutput for VirtAdapter { + fn drop_terminal_output(_: u32) {} +} + +impl TerminalStdin for VirtAdapter { + fn get_terminal_stdin() -> Option { + Some(0) + } +} + +impl TerminalStdout for VirtAdapter { + fn get_terminal_stdout() -> Option { + Some(1) + } +} + +impl TerminalStderr for VirtAdapter { + fn get_terminal_stderr() -> Option { + Some(2) + } +} + impl Poll for VirtAdapter { fn drop_pollable(pid: u32) { let Some(poll) = IoState::get_poll(pid) else { @@ -1313,19 +1337,19 @@ impl HttpTypes for VirtAdapter { fn new_fields(entries: Vec<(String, String)>) -> Fields { http_types::new_fields(&entries) } - fn fields_get(fields: Fields, name: String) -> Vec { + fn fields_get(fields: Fields, name: String) -> Vec> { http_types::fields_get(fields, &name) } - fn fields_set(fields: Fields, name: String, value: Vec) { + fn fields_set(fields: Fields, name: String, value: Vec>) { http_types::fields_set(fields, &name, value.as_slice()) } fn fields_delete(fields: Fields, name: String) { http_types::fields_delete(fields, &name) } - fn fields_append(fields: Fields, name: String, value: String) { + fn fields_append(fields: Fields, name: String, value: Vec) { http_types::fields_append(fields, &name, &value) } - fn fields_entries(fields: Fields) -> Vec<(String, String)> { + fn fields_entries(fields: Fields) -> Vec<(String, Vec)> { http_types::fields_entries(fields) } fn fields_clone(fields: Fields) -> Fields { @@ -1346,16 +1370,13 @@ impl HttpTypes for VirtAdapter { fn incoming_request_method(request: u32) -> Method { method_map_rev(http_types::incoming_request_method(request)) } - fn incoming_request_path(request: u32) -> String { - http_types::incoming_request_path(request) - } - fn incoming_request_query(request: u32) -> String { - http_types::incoming_request_query(request) + fn incoming_request_path_with_query(request: u32) -> Option { + http_types::incoming_request_path_with_query(request) } fn incoming_request_scheme(request: u32) -> Option { http_types::incoming_request_scheme(request).map(scheme_map_rev) } - fn incoming_request_authority(request: u32) -> String { + fn incoming_request_authority(request: u32) -> Option { http_types::incoming_request_authority(request) } fn incoming_request_headers(request: u32) -> Headers { @@ -1366,18 +1387,16 @@ impl HttpTypes for VirtAdapter { } fn new_outgoing_request( method: Method, - path: String, - query: String, + path_with_query: Option, scheme: Option, - authority: String, + authority: Option, headers: Headers, ) -> u32 { http_types::new_outgoing_request( &method_map(method), - &path, - &query, + path_with_query.as_deref(), scheme.map(|s| scheme_map(s)).as_ref(), - &authority, + authority.as_deref(), headers, ) } @@ -1387,12 +1406,12 @@ impl HttpTypes for VirtAdapter { fn drop_response_outparam(response: u32) { http_types::drop_response_outparam(response) } - fn set_response_outparam(response: Result) -> Result<(), ()> { + fn set_response_outparam(param: u32, response: Result) -> Result<(), ()> { match response { - Ok(res) => http_types::set_response_outparam(Ok(res)), + Ok(res) => http_types::set_response_outparam(param, Ok(res)), Err(err) => { let err = http_err_map(err); - http_types::set_response_outparam(Err(&err)) + http_types::set_response_outparam(param, Err(&err)) } } } @@ -1535,8 +1554,8 @@ impl Tcp for VirtAdapter { fn finish_connect(this: TcpSocket) -> Result<(InputStream, OutputStream), NetworkErrorCode> { tcp::finish_connect(this) } - fn start_listen(this: TcpSocket, network: Network) -> Result<(), NetworkErrorCode> { - tcp::start_listen(this, network) + fn start_listen(this: TcpSocket) -> Result<(), NetworkErrorCode> { + tcp::start_listen(this) } fn finish_listen(this: TcpSocket) -> Result<(), NetworkErrorCode> { tcp::finish_listen(this) @@ -1633,22 +1652,29 @@ impl Udp for VirtAdapter { fn finish_connect(this: UdpSocket) -> Result<(), NetworkErrorCode> { udp::finish_connect(this) } - fn receive(this: UdpSocket) -> Result { - match udp::receive(this) { - Ok(datagram) => Ok(Datagram { - data: datagram.data, - remote_address: datagram.remote_address, - }), + fn receive(this: UdpSocket, max_results: u64) -> Result, NetworkErrorCode> { + match udp::receive(this, max_results) { + Ok(mut datagrams) => Ok(datagrams + .drain(..) + .map(|d| Datagram { + data: d.data, + remote_address: d.remote_address, + }) + .collect::>()), Err(err) => Err(err), } } - fn send(this: UdpSocket, datagram: Datagram) -> Result<(), NetworkErrorCode> { + fn send(this: UdpSocket, mut datagrams: Vec) -> Result { udp::send( this, - &udp::Datagram { - data: datagram.data, - remote_address: datagram.remote_address, - }, + datagrams + .drain(..) + .map(|d| udp::Datagram { + data: d.data, + remote_address: d.remote_address, + }) + .collect::>() + .as_slice(), ) } fn local_address(this: UdpSocket) -> Result { diff --git a/virtual-adapter/src/lib.rs b/virtual-adapter/src/lib.rs index dbdea1a..e96638d 100644 --- a/virtual-adapter/src/lib.rs +++ b/virtual-adapter/src/lib.rs @@ -12,14 +12,19 @@ wit_bindgen::generate!({ exports: { "wasi:poll/poll": VirtAdapter, "wasi:io/streams": VirtAdapter, - "wasi:cli-base/environment": VirtAdapter, "wasi:filesystem/filesystem": VirtAdapter, "wasi:filesystem/preopens": VirtAdapter, "wasi:filesystem/types": VirtAdapter, - "wasi:cli-base/stdin": VirtAdapter, - "wasi:cli-base/stdout": VirtAdapter, - "wasi:cli-base/stderr": VirtAdapter, - "wasi:cli-base/stderr": VirtAdapter, + "wasi:cli/environment": VirtAdapter, + "wasi:cli/stdin": VirtAdapter, + "wasi:cli/stdout": VirtAdapter, + "wasi:cli/stderr": VirtAdapter, + "wasi:cli/stderr": VirtAdapter, + "wasi:cli/terminal-input": VirtAdapter, + "wasi:cli/terminal-output": VirtAdapter, + "wasi:cli/terminal-stdin": VirtAdapter, + "wasi:cli/terminal-stdout": VirtAdapter, + "wasi:cli/terminal-stderr": VirtAdapter, "wasi:poll/poll": VirtAdapter, "wasi:clocks/monotonic-clock": VirtAdapter, "wasi:http/types": VirtAdapter, diff --git a/wit/deps/preview/command.wit b/wit/deps/cli/command.wit similarity index 70% rename from wit/deps/preview/command.wit rename to wit/deps/cli/command.wit index dcd06d7..3cd17be 100644 --- a/wit/deps/preview/command.wit +++ b/wit/deps/cli/command.wit @@ -1,3 +1,5 @@ +package wasi:cli + world command { import wasi:clocks/wall-clock import wasi:clocks/monotonic-clock @@ -16,11 +18,16 @@ world command { import wasi:random/insecure-seed import wasi:poll/poll import wasi:io/streams - import wasi:cli-base/environment - import wasi:cli-base/exit - import wasi:cli-base/stdin - import wasi:cli-base/stdout - import wasi:cli-base/stderr - export run: func() -> result + import environment + import exit + import stdin + import stdout + import stderr + import terminal-input + import terminal-output + import terminal-stdin + import terminal-stdout + import terminal-stderr + export run } diff --git a/wit/deps/wasi-cli-base/environment.wit b/wit/deps/cli/environment.wit similarity index 75% rename from wit/deps/wasi-cli-base/environment.wit rename to wit/deps/cli/environment.wit index 4c97c85..36790fe 100644 --- a/wit/deps/wasi-cli-base/environment.wit +++ b/wit/deps/cli/environment.wit @@ -1,5 +1,3 @@ -package wasi:cli-base - interface environment { /// Get the POSIX-style environment variables. /// @@ -13,4 +11,8 @@ interface environment { /// Get the POSIX-style arguments to the program. get-arguments: func() -> list + + /// Return a path that programs should use as their initial current working + /// directory, interpreting `.` as shorthand for this. + initial-cwd: func() -> option } diff --git a/wit/deps/cli/exit.wit b/wit/deps/cli/exit.wit new file mode 100644 index 0000000..4831d50 --- /dev/null +++ b/wit/deps/cli/exit.wit @@ -0,0 +1,4 @@ +interface exit { + /// Exit the current instance and any linked instances. + exit: func(status: result) +} diff --git a/wit/deps/cli/run.wit b/wit/deps/cli/run.wit new file mode 100644 index 0000000..45a1ca5 --- /dev/null +++ b/wit/deps/cli/run.wit @@ -0,0 +1,4 @@ +interface run { + /// Run the program. + run: func() -> result +} diff --git a/wit/deps/wasi-cli-base/stdio.wit b/wit/deps/cli/stdio.wit similarity index 100% rename from wit/deps/wasi-cli-base/stdio.wit rename to wit/deps/cli/stdio.wit diff --git a/wit/deps/cli/terminal.wit b/wit/deps/cli/terminal.wit new file mode 100644 index 0000000..f32e744 --- /dev/null +++ b/wit/deps/cli/terminal.wit @@ -0,0 +1,59 @@ +interface terminal-input { + /// The input side of a terminal. + /// + /// This [represents a resource](https://github.com/WebAssembly/WASI/blob/main/docs/WitInWasi.md#Resources). + type terminal-input = u32 + + // In the future, this may include functions for disabling echoing, + // disabling input buffering so that keyboard events are sent through + // immediately, querying supported features, and so on. + + /// Dispose of the specified terminal-input after which it may no longer + /// be used. + drop-terminal-input: func(this: terminal-input) +} + +interface terminal-output { + /// The output side of a terminal. + /// + /// This [represents a resource](https://github.com/WebAssembly/WASI/blob/main/docs/WitInWasi.md#Resources). + type terminal-output = u32 + + // In the future, this may include functions for querying the terminal + // size, being notified of terminal size changes, querying supported + // features, and so on. + + /// Dispose of the specified terminal-output, after which it may no longer + /// be used. + drop-terminal-output: func(this: terminal-output) +} + +/// An interface providing an optional `terminal-input` for stdin as a +/// link-time authority. +interface terminal-stdin { + use terminal-input.{terminal-input} + + /// If stdin is connected to a terminal, return a `terminal-input` handle + /// allowing further interaction with it. + get-terminal-stdin: func() -> option +} + +/// An interface providing an optional `terminal-output` for stdout as a +/// link-time authority. +interface terminal-stdout { + use terminal-output.{terminal-output} + + /// If stdout is connected to a terminal, return a `terminal-output` handle + /// allowing further interaction with it. + get-terminal-stdout: func() -> option +} + +/// An interface providing an optional `terminal-output` for stderr as a +/// link-time authority. +interface terminal-stderr { + use terminal-output.{terminal-output} + + /// If stderr is connected to a terminal, return a `terminal-output` handle + /// allowing further interaction with it. + get-terminal-stderr: func() -> option +} diff --git a/wit/deps/http/proxy.wit b/wit/deps/http/proxy.wit new file mode 100644 index 0000000..162ab32 --- /dev/null +++ b/wit/deps/http/proxy.wit @@ -0,0 +1,34 @@ +package wasi:http + +// The `wasi:http/proxy` world captures a widely-implementable intersection of +// hosts that includes HTTP forward and reverse proxies. Components targeting +// this world may concurrently stream in and out any number of incoming and +// outgoing HTTP requests. +world proxy { + // HTTP proxies have access to time and randomness. + import wasi:clocks/wall-clock + import wasi:clocks/monotonic-clock + import wasi:clocks/timezone + import wasi:random/random + + // Proxies have standard output and error streams which are expected to + // terminate in a developer-facing console provided by the host. + import wasi:cli/stdout + import wasi:cli/stderr + + // TODO: this is a temporary workaround until component tooling is able to + // gracefully handle the absence of stdin. Hosts must return an eof stream + // for this import, which is what wasi-libc + tooling will do automatically + // when this import is properly removed. + import wasi:cli/stdin + + // This is the default handler to use when user code simply wants to make an + // HTTP request (e.g., via `fetch()`). + import outgoing-handler + + // The host delivers incoming HTTP requests to a component by calling the + // `handle` function of this exported interface. A host may arbitrarily reuse + // or not reuse component instance when delivering incoming HTTP requests and + // thus a component must be able to handle 0..N calls to `handle`. + export incoming-handler +} diff --git a/wit/deps/http/types.wit b/wit/deps/http/types.wit index ee4227f..7b7b015 100644 --- a/wit/deps/http/types.wit +++ b/wit/deps/http/types.wit @@ -1,5 +1,3 @@ -package wasi:http - // The `wasi:http/types` interface is meant to be imported by components to // define the HTTP resource types and operations used by the component's // imported and exported interfaces. @@ -45,11 +43,11 @@ interface types { type fields = u32 drop-fields: func(fields: fields) new-fields: func(entries: list>) -> fields - fields-get: func(fields: fields, name: string) -> list - fields-set: func(fields: fields, name: string, value: list) + fields-get: func(fields: fields, name: string) -> list> + fields-set: func(fields: fields, name: string, value: list>) fields-delete: func(fields: fields, name: string) - fields-append: func(fields: fields, name: string, value: string) - fields-entries: func(fields: fields) -> list> + fields-append: func(fields: fields, name: string, value: list) + fields-entries: func(fields: fields) -> list>> fields-clone: func(fields: fields) -> fields type headers = fields @@ -80,18 +78,16 @@ interface types { drop-incoming-request: func(request: incoming-request) drop-outgoing-request: func(request: outgoing-request) incoming-request-method: func(request: incoming-request) -> method - incoming-request-path: func(request: incoming-request) -> string - incoming-request-query: func(request: incoming-request) -> string + incoming-request-path-with-query: func(request: incoming-request) -> option incoming-request-scheme: func(request: incoming-request) -> option - incoming-request-authority: func(request: incoming-request) -> string + incoming-request-authority: func(request: incoming-request) -> option incoming-request-headers: func(request: incoming-request) -> headers incoming-request-consume: func(request: incoming-request) -> result new-outgoing-request: func( method: method, - path: string, - query: string, + path-with-query: option, scheme: option, - authority: string, + authority: option, headers: headers ) -> outgoing-request outgoing-request-write: func(request: outgoing-request) -> result @@ -120,7 +116,7 @@ interface types { // simply return a `stream`). type response-outparam = u32 drop-response-outparam: func(response: response-outparam) - set-response-outparam: func(response: result) -> result + set-response-outparam: func(param: response-outparam, response: result) -> result // This type corresponds to the HTTP standard Status Code. type status-code = u16 diff --git a/wit/deps/io/streams.wit b/wit/deps/io/streams.wit index 011bde0..98df181 100644 --- a/wit/deps/io/streams.wit +++ b/wit/deps/io/streams.wit @@ -8,16 +8,6 @@ package wasi:io interface streams { use wasi:poll/poll.{pollable} - /// An error type returned from a stream operation. - /// - /// TODO: need to figure out the actual contents of this error. Used to be - /// an empty record but that's no longer allowed. The `dummy` field is - /// only here to have this be a valid in the component model by being - /// non-empty. - record stream-error { - dummy: u32, - } - /// Streams provide a sequence of data and then end; once they end, they /// no longer provide any further data. /// @@ -37,15 +27,12 @@ interface streams { /// An input bytestream. In the future, this will be replaced by handle /// types. /// - /// This conceptually represents a `stream`. It's temporary - /// scaffolding until component-model's async features are ready. - /// /// `input-stream`s are *non-blocking* to the extent practical on underlying /// platforms. I/O operations always return promptly; if fewer bytes are /// promptly available than requested, they return the number of bytes promptly /// available, which could even be zero. To wait for data to be available, /// use the `subscribe-to-input-stream` function to obtain a `pollable` which - /// can be polled for using `wasi_poll`. + /// can be polled for using `wasi:poll/poll.poll_oneoff`. /// /// And at present, it is a `u32` instead of being an actual handle, until /// the wit-bindgen implementation of handles and resources is ready. @@ -58,40 +45,36 @@ interface streams { /// This function returns a list of bytes containing the data that was /// read, along with a `stream-status` which, indicates whether further /// reads are expected to produce data. The returned list will contain up to - /// `len` bytes; it may return fewer than requested, but not more. - /// - /// Once a stream has reached the end, subsequent calls to read or - /// `skip` will always report end-of-stream rather than producing more + /// `len` bytes; it may return fewer than requested, but not more. An + /// empty list and `stream-status:open` indicates no more data is + /// available at this time, and that the pollable given by + /// `subscribe-to-input-stream` will be ready when more data is available. + /// + /// Once a stream has reached the end, subsequent calls to `read` or + /// `skip` will always report `stream-status:ended` rather than producing more /// data. /// - /// If `len` is 0, it represents a request to read 0 bytes, which should - /// always succeed, assuming the stream hasn't reached its end yet, and - /// return an empty list. - /// - /// The len here is a `u64`, but some callees may not be able to allocate - /// a buffer as large as that would imply. - /// FIXME: describe what happens if allocation fails. + /// When the caller gives a `len` of 0, it represents a request to read 0 + /// bytes. This read should always succeed and return an empty list and + /// the current `stream-status`. /// - /// When the returned `stream-status` is `open`, the length of the returned - /// value may be less than `len`. When an empty list is returned, this - /// indicates that no more bytes were available from the stream at that - /// time. In that case the subscribe-to-input-stream pollable will indicate - /// when additional bytes are available for reading. + /// The `len` parameter is a `u64`, which could represent a list of u8 which + /// is not possible to allocate in wasm32, or not desirable to allocate as + /// as a return value by the callee. The callee may return a list of bytes + /// less than `len` in size while more bytes are available for reading. read: func( this: input-stream, /// The maximum number of bytes to read len: u64 - ) -> result, stream-status>, stream-error> + ) -> result, stream-status>> - /// Read bytes from a stream, with blocking. - /// - /// This is similar to `read`, except that it blocks until at least one - /// byte can be read. + /// Read bytes from a stream, after blocking until at least one byte can + /// be read. Except for blocking, identical to `read`. blocking-read: func( this: input-stream, /// The maximum number of bytes to read len: u64 - ) -> result, stream-status>, stream-error> + ) -> result, stream-status>> /// Skip bytes from a stream. /// @@ -102,40 +85,42 @@ interface streams { /// `skip` will always report end-of-stream rather than producing more /// data. /// - /// This function returns the number of bytes skipped, along with a bool - /// indicating whether the end of the stream was reached. The returned - /// value will be at most `len`; it may be less. + /// This function returns the number of bytes skipped, along with a + /// `stream-status` indicating whether the end of the stream was + /// reached. The returned value will be at most `len`; it may be less. skip: func( this: input-stream, /// The maximum number of bytes to skip. len: u64, - ) -> result, stream-error> + ) -> result> - /// Skip bytes from a stream, with blocking. - /// - /// This is similar to `skip`, except that it blocks until at least one - /// byte can be consumed. + /// Skip bytes from a stream, after blocking until at least one byte + /// can be skipped. Except for blocking behavior, identical to `skip`. blocking-skip: func( this: input-stream, /// The maximum number of bytes to skip. len: u64, - ) -> result, stream-error> + ) -> result> /// Create a `pollable` which will resolve once either the specified stream /// has bytes available to read or the other end of the stream has been /// closed. + /// The created `pollable` is a child resource of the `input-stream`. + /// Implementations may trap if the `input-stream` is dropped before + /// all derived `pollable`s created with this function are dropped. subscribe-to-input-stream: func(this: input-stream) -> pollable /// Dispose of the specified `input-stream`, after which it may no longer /// be used. + /// Implementations may trap if this `input-stream` is dropped while child + /// `pollable` resources are still alive. + /// After this `input-stream` is dropped, implementations may report any + /// corresponding `output-stream` has `stream-state.closed`. drop-input-stream: func(this: input-stream) /// An output bytestream. In the future, this will be replaced by handle /// types. /// - /// This conceptually represents a `stream`. It's temporary - /// scaffolding until component-model's async features are ready. - /// /// `output-stream`s are *non-blocking* to the extent practical on /// underlying platforms. Except where specified otherwise, I/O operations also /// always return promptly, after the number of bytes that can be written @@ -159,17 +144,18 @@ interface streams { /// When the returned `stream-status` is `open`, the `u64` return value may /// be less than the length of `buf`. This indicates that no more bytes may /// be written to the stream promptly. In that case the - /// subscribe-to-output-stream pollable will indicate when additional bytes + /// `subscribe-to-output-stream` pollable will indicate when additional bytes /// may be promptly written. /// - /// TODO: document what happens when an empty list is written + /// Writing an empty list must return a non-error result with `0` for the + /// `u64` return value, and the current `stream-status`. write: func( this: output-stream, /// Data to write buf: list - ) -> result, stream-error> + ) -> result> - /// Write bytes to a stream, with blocking. + /// Blocking write of bytes to a stream. /// /// This is similar to `write`, except that it blocks until at least one /// byte can be written. @@ -177,27 +163,29 @@ interface streams { this: output-stream, /// Data to write buf: list - ) -> result, stream-error> + ) -> result> - /// Write multiple zero bytes to a stream. + /// Write multiple zero-bytes to a stream. /// - /// This function returns a `u64` indicating the number of zero bytes - /// that were written; it may be less than `len`. + /// This function returns a `u64` indicating the number of zero-bytes + /// that were written; it may be less than `len`. Equivelant to a call to + /// `write` with a list of zeroes of the given length. write-zeroes: func( this: output-stream, - /// The number of zero bytes to write + /// The number of zero-bytes to write len: u64 - ) -> result, stream-error> + ) -> result> /// Write multiple zero bytes to a stream, with blocking. /// /// This is similar to `write-zeroes`, except that it blocks until at least - /// one byte can be written. + /// one byte can be written. Equivelant to a call to `blocking-write` with + /// a list of zeroes of the given length. blocking-write-zeroes: func( this: output-stream, /// The number of zero bytes to write len: u64 - ) -> result, stream-error> + ) -> result> /// Read from one stream and write to another. /// @@ -212,7 +200,7 @@ interface streams { src: input-stream, /// The number of bytes to splice len: u64, - ) -> result, stream-error> + ) -> result> /// Read from one stream and write to another, with blocking. /// @@ -224,7 +212,7 @@ interface streams { src: input-stream, /// The number of bytes to splice len: u64, - ) -> result, stream-error> + ) -> result> /// Forward the entire contents of an input stream to an output stream. /// @@ -242,13 +230,24 @@ interface streams { this: output-stream, /// The stream to read from src: input-stream - ) -> result, stream-error> + ) -> result> /// Create a `pollable` which will resolve once either the specified stream - /// is ready to accept bytes or the other end of the stream has been closed. + /// is ready to accept bytes or the `stream-state` has become closed. + /// + /// Once the stream-state is closed, this pollable is always ready + /// immediately. + /// + /// The created `pollable` is a child resource of the `output-stream`. + /// Implementations may trap if the `output-stream` is dropped before + /// all derived `pollable`s created with this function are dropped. subscribe-to-output-stream: func(this: output-stream) -> pollable /// Dispose of the specified `output-stream`, after which it may no longer /// be used. + /// Implementations may trap if this `output-stream` is dropped while + /// child `pollable` resources are still alive. + /// After this `output-stream` is dropped, implementations may report any + /// corresponding `input-stream` has `stream-state.closed`. drop-output-stream: func(this: output-stream) } diff --git a/wit/deps/logging/handler.wit b/wit/deps/logging/logging.wit similarity index 91% rename from wit/deps/logging/handler.wit rename to wit/deps/logging/logging.wit index e6b077b..b0cc451 100644 --- a/wit/deps/logging/handler.wit +++ b/wit/deps/logging/logging.wit @@ -2,7 +2,7 @@ package wasi:logging /// WASI Logging is a logging API intended to let users emit log messages with /// simple priority levels and context values. -interface handler { +interface logging { /// A log level, describing a kind of message. enum level { /// Describes messages about the values of variables and the flow of @@ -22,6 +22,9 @@ interface handler { /// Describes messages indicating serious errors. error, + + /// Describes messages indicating fatal errors. + critical, } /// Emit a log message. diff --git a/wit/deps/preview/command-extended.wit b/wit/deps/preview/command-extended.wit deleted file mode 100644 index 8fe7160..0000000 --- a/wit/deps/preview/command-extended.wit +++ /dev/null @@ -1,36 +0,0 @@ -package wasi:preview - -world command-extended { - import wasi:clocks/wall-clock - import wasi:clocks/monotonic-clock - import wasi:clocks/timezone - import wasi:filesystem/types - import wasi:filesystem/preopens - import wasi:sockets/instance-network - import wasi:sockets/ip-name-lookup - import wasi:sockets/network - import wasi:sockets/tcp-create-socket - import wasi:sockets/tcp - import wasi:sockets/udp-create-socket - import wasi:sockets/udp - import wasi:random/random - import wasi:random/insecure - import wasi:random/insecure-seed - import wasi:poll/poll - import wasi:io/streams - import wasi:cli-base/environment - import wasi:cli-base/exit - import wasi:cli-base/stdin - import wasi:cli-base/stdout - import wasi:cli-base/stderr - - // We should replace all others with `include self.command` - // as soon as the unioning of worlds is available: - // https://github.com/WebAssembly/component-model/issues/169 - import wasi:logging/handler - import wasi:http/outgoing-handler - - export run: func( - args: list, - ) -> result -} diff --git a/wit/deps/preview/proxy.wit b/wit/deps/preview/proxy.wit deleted file mode 100644 index a616daa..0000000 --- a/wit/deps/preview/proxy.wit +++ /dev/null @@ -1,9 +0,0 @@ -world proxy { - import wasi:random/random - import wasi:random/insecure - import wasi:random/insecure-seed - import wasi:logging/handler - import wasi:http/outgoing-handler - - export wasi:http/incoming-handler -} diff --git a/wit/deps/preview/reactor.wit b/wit/deps/preview/reactor.wit deleted file mode 100644 index aff49ea..0000000 --- a/wit/deps/preview/reactor.wit +++ /dev/null @@ -1,24 +0,0 @@ -world reactor { - import wasi:clocks/wall-clock - import wasi:clocks/monotonic-clock - import wasi:clocks/timezone - import wasi:filesystem/types - import wasi:filesystem/preopens - import wasi:sockets/instance-network - import wasi:sockets/ip-name-lookup - import wasi:sockets/network - import wasi:sockets/tcp-create-socket - import wasi:sockets/tcp - import wasi:sockets/udp-create-socket - import wasi:sockets/udp - import wasi:random/random - import wasi:poll/poll - import wasi:io/streams - import wasi:logging/handler - import wasi:http/outgoing-handler - import wasi:cli-base/environment - import wasi:cli-base/exit - import wasi:cli-base/stdin - import wasi:cli-base/stdout - import wasi:cli-base/stderr -} diff --git a/wit/deps/sockets/ip-name-lookup.wit b/wit/deps/sockets/ip-name-lookup.wit index 6c64b46..f15d19d 100644 --- a/wit/deps/sockets/ip-name-lookup.wit +++ b/wit/deps/sockets/ip-name-lookup.wit @@ -5,9 +5,9 @@ interface ip-name-lookup { /// Resolve an internet host name to a list of IP addresses. - /// + /// /// See the wasi-socket proposal README.md for a comparison with getaddrinfo. - /// + /// /// # Parameters /// - `name`: The name to look up. IP addresses are not allowed. Unicode domain names are automatically converted /// to ASCII using IDNA encoding. @@ -17,18 +17,18 @@ interface ip-name-lookup { /// systems without an active IPv6 interface. Notes: /// - Even when no public IPv6 interfaces are present or active, names like "localhost" can still resolve to an IPv6 address. /// - Whatever is "available" or "unavailable" is volatile and can change everytime a network cable is unplugged. - /// + /// /// This function never blocks. It either immediately fails or immediately returns successfully with a `resolve-address-stream` /// that can be used to (asynchronously) fetch the results. - /// + /// /// At the moment, the stream never completes successfully with 0 items. Ie. the first call /// to `resolve-next-address` never returns `ok(none)`. This may change in the future. - /// + /// /// # Typical errors /// - `invalid-name`: `name` is a syntactically invalid domain name. /// - `invalid-name`: `name` is an IP address. /// - `address-family-not-supported`: The specified `address-family` is not supported. (EAI_FAMILY) - /// + /// /// # References: /// - /// - @@ -41,14 +41,14 @@ interface ip-name-lookup { type resolve-address-stream = u32 /// Returns the next address from the resolver. - /// + /// /// This function should be called multiple times. On each call, it will /// return the next address in connection order preference. If all /// addresses have been exhausted, this function returns `none`. /// After which, you should release the stream with `drop-resolve-address-stream`. - /// + /// /// This function never returns IPv4-mapped IPv6 addresses. - /// + /// /// # Typical errors /// - `name-unresolvable`: Name does not exist or has no suitable associated IP addresses. (EAI_NONAME, EAI_NODATA, EAI_ADDRFAMILY) /// - `temporary-resolver-failure`: A temporary failure in name resolution occurred. (EAI_AGAIN) @@ -57,12 +57,12 @@ interface ip-name-lookup { resolve-next-address: func(this: resolve-address-stream) -> result, error-code> /// Dispose of the specified `resolve-address-stream`, after which it may no longer be used. - /// + /// /// Note: this function is scheduled to be removed when Resources are natively supported in Wit. drop-resolve-address-stream: func(this: resolve-address-stream) /// Create a `pollable` which will resolve once the stream is ready for I/O. - /// + /// /// Note: this function is here for WASI Preview2 only. /// It's planned to be removed when `future` is natively supported in Preview3. subscribe: func(this: resolve-address-stream) -> pollable diff --git a/wit/deps/sockets/network.wit b/wit/deps/sockets/network.wit index c370214..a198ea8 100644 --- a/wit/deps/sockets/network.wit +++ b/wit/deps/sockets/network.wit @@ -4,12 +4,12 @@ interface network { /// An opaque resource that represents access to (a subset of) the network. /// This enables context-based security for networking. /// There is no need for this to map 1:1 to a physical network interface. - /// + /// /// FYI, In the future this will be replaced by handle types. type network = u32 /// Dispose of the specified `network`, after which it may no longer be used. - /// + /// /// Note: this function is scheduled to be removed when Resources are natively supported in Wit. drop-network: func(this: network) @@ -153,7 +153,7 @@ interface network { enum ip-address-family { /// Similar to `AF_INET` in POSIX. - ipv4, + ipv4, /// Similar to `AF_INET6` in POSIX. ipv6, diff --git a/wit/deps/sockets/tcp-create-socket.wit b/wit/deps/sockets/tcp-create-socket.wit index f467d28..f43bc89 100644 --- a/wit/deps/sockets/tcp-create-socket.wit +++ b/wit/deps/sockets/tcp-create-socket.wit @@ -4,20 +4,20 @@ interface tcp-create-socket { use tcp.{tcp-socket} /// Create a new TCP socket. - /// + /// /// Similar to `socket(AF_INET or AF_INET6, SOCK_STREAM, IPPROTO_TCP)` in POSIX. - /// + /// /// This function does not require a network capability handle. This is considered to be safe because /// at time of creation, the socket is not bound to any `network` yet. Up to the moment `bind`/`listen`/`connect` /// is called, the socket is effectively an in-memory configuration object, unable to communicate with the outside world. - /// + /// /// All sockets are non-blocking. Use the wasi-poll interface to block on asynchronous operations. - /// + /// /// # Typical errors /// - `not-supported`: The host does not support TCP sockets. (EOPNOTSUPP) /// - `address-family-not-supported`: The specified `address-family` is not supported. (EAFNOSUPPORT) /// - `new-socket-limit`: The new socket resource could not be created because of a system limit. (EMFILE, ENFILE) - /// + /// /// # References /// - /// - diff --git a/wit/deps/sockets/tcp.wit b/wit/deps/sockets/tcp.wit index 7ed46a6..4edb1db 100644 --- a/wit/deps/sockets/tcp.wit +++ b/wit/deps/sockets/tcp.wit @@ -6,7 +6,7 @@ interface tcp { /// A TCP socket handle. type tcp-socket = u32 - + enum shutdown-type { /// Similar to `SHUT_RD` in POSIX. @@ -25,24 +25,24 @@ interface tcp { /// If the IP address is zero (`0.0.0.0` in IPv4, `::` in IPv6), it is left to the implementation to decide which /// network interface(s) to bind to. /// If the TCP/UDP port is zero, the socket will be bound to a random free port. - /// + /// /// When a socket is not explicitly bound, the first invocation to a listen or connect operation will /// implicitly bind the socket. - /// + /// /// Unlike in POSIX, this function is async. This enables interactive WASI hosts to inject permission prompts. - /// + /// /// # Typical `start` errors /// - `address-family-mismatch`: The `local-address` has the wrong address family. (EINVAL) /// - `already-bound`: The socket is already bound. (EINVAL) /// - `concurrency-conflict`: Another `bind`, `connect` or `listen` operation is already in progress. (EALREADY) - /// + /// /// # Typical `finish` errors /// - `ephemeral-ports-exhausted`: No ephemeral ports available. (EADDRINUSE, ENOBUFS on Windows) /// - `address-in-use`: Address is already in use. (EADDRINUSE) /// - `address-not-bindable`: `local-address` is not an address that the `network` can bind to. (EADDRNOTAVAIL) /// - `not-in-progress`: A `bind` operation is not in progress. /// - `would-block`: Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN) - /// + /// /// # References /// - /// - @@ -52,11 +52,11 @@ interface tcp { finish-bind: func(this: tcp-socket) -> result<_, error-code> /// Connect to a remote endpoint. - /// + /// /// On success: /// - the socket is transitioned into the Connection state /// - a pair of streams is returned that can be used to read & write to the connection - /// + /// /// # Typical `start` errors /// - `address-family-mismatch`: The `remote-address` has the wrong address family. (EAFNOSUPPORT) /// - `invalid-remote-address`: The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EADDRNOTAVAIL on Windows) @@ -65,7 +65,7 @@ interface tcp { /// - `already-connected`: The socket is already in the Connection state. (EISCONN) /// - `already-listening`: The socket is already in the Listener state. (EOPNOTSUPP, EINVAL on Windows) /// - `concurrency-conflict`: Another `bind`, `connect` or `listen` operation is already in progress. (EALREADY) - /// + /// /// # Typical `finish` errors /// - `timeout`: Connection timed out. (ETIMEDOUT) /// - `connection-refused`: The connection was forcefully rejected. (ECONNREFUSED) @@ -74,7 +74,7 @@ interface tcp { /// - `ephemeral-ports-exhausted`: Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD) /// - `not-in-progress`: A `connect` operation is not in progress. /// - `would-block`: Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN) - /// + /// /// # References /// - /// - @@ -84,13 +84,15 @@ interface tcp { finish-connect: func(this: tcp-socket) -> result, error-code> /// Start listening for new connections. - /// + /// /// Transitions the socket into the Listener state. - /// - /// Unlike in POSIX, this function is async. This enables interactive WASI hosts to inject permission prompts. - /// + /// + /// Unlike POSIX: + /// - this function is async. This enables interactive WASI hosts to inject permission prompts. + /// - the socket must already be explicitly bound. + /// /// # Typical `start` errors - /// - `already-attached`: The socket is already attached to a different network. The `network` passed to `listen` must be identical to the one passed to `bind`. + /// - `not-bound`: The socket is not bound to any local address. (EDESTADDRREQ) /// - `already-connected`: The socket is already in the Connection state. (EISCONN, EINVAL on BSD) /// - `already-listening`: The socket is already in the Listener state. /// - `concurrency-conflict`: Another `bind`, `connect` or `listen` operation is already in progress. (EINVAL on BSD) @@ -105,22 +107,22 @@ interface tcp { /// - /// - /// - - start-listen: func(this: tcp-socket, network: network) -> result<_, error-code> + start-listen: func(this: tcp-socket) -> result<_, error-code> finish-listen: func(this: tcp-socket) -> result<_, error-code> /// Accept a new client socket. - /// + /// /// The returned socket is bound and in the Connection state. - /// + /// /// On success, this function returns the newly accepted client socket along with /// a pair of streams that can be used to read & write to the connection. - /// + /// /// # Typical errors /// - `not-listening`: Socket is not in the Listener state. (EINVAL) /// - `would-block`: No pending connections at the moment. (EWOULDBLOCK, EAGAIN) - /// + /// /// Host implementations must skip over transient errors returned by the native accept syscall. - /// + /// /// # References /// - /// - @@ -129,10 +131,10 @@ interface tcp { accept: func(this: tcp-socket) -> result, error-code> /// Get the bound local address. - /// + /// /// # Typical errors /// - `not-bound`: The socket is not bound to any local address. - /// + /// /// # References /// - /// - @@ -141,10 +143,10 @@ interface tcp { local-address: func(this: tcp-socket) -> result /// Get the bound remote address. - /// + /// /// # Typical errors /// - `not-connected`: The socket is not connected to a remote address. (ENOTCONN) - /// + /// /// # References /// - /// - @@ -153,14 +155,14 @@ interface tcp { remote-address: func(this: tcp-socket) -> result /// Whether this is a IPv4 or IPv6 socket. - /// + /// /// Equivalent to the SO_DOMAIN socket option. address-family: func(this: tcp-socket) -> ip-address-family - + /// Whether IPv4 compatibility (dual-stack) mode is disabled or not. - /// + /// /// Equivalent to the IPV6_V6ONLY socket option. - /// + /// /// # Typical errors /// - `ipv6-only-operation`: (get/set) `this` socket is an IPv4 socket. /// - `already-bound`: (set) The socket is already bound. @@ -170,28 +172,28 @@ interface tcp { set-ipv6-only: func(this: tcp-socket, value: bool) -> result<_, error-code> /// Hints the desired listen queue size. Implementations are free to ignore this. - /// + /// /// # Typical errors /// - `already-connected`: (set) The socket is already in the Connection state. /// - `concurrency-conflict`: (set) A `bind`, `connect` or `listen` operation is already in progress. (EALREADY) set-listen-backlog-size: func(this: tcp-socket, value: u64) -> result<_, error-code> /// Equivalent to the SO_KEEPALIVE socket option. - /// + /// /// # Typical errors /// - `concurrency-conflict`: (set) A `bind`, `connect` or `listen` operation is already in progress. (EALREADY) keep-alive: func(this: tcp-socket) -> result set-keep-alive: func(this: tcp-socket, value: bool) -> result<_, error-code> /// Equivalent to the TCP_NODELAY socket option. - /// + /// /// # Typical errors /// - `concurrency-conflict`: (set) A `bind`, `connect` or `listen` operation is already in progress. (EALREADY) no-delay: func(this: tcp-socket) -> result set-no-delay: func(this: tcp-socket, value: bool) -> result<_, error-code> - + /// Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options. - /// + /// /// # Typical errors /// - `already-connected`: (set) The socket is already in the Connection state. /// - `already-listening`: (set) The socket is already in the Listener state. @@ -200,16 +202,16 @@ interface tcp { set-unicast-hop-limit: func(this: tcp-socket, value: u8) -> result<_, error-code> /// The kernel buffer space reserved for sends/receives on this socket. - /// + /// /// Note #1: an implementation may choose to cap or round the buffer size when setting the value. /// In other words, after setting a value, reading the same setting back may return a different value. - /// + /// /// Note #2: there is not necessarily a direct relationship between the kernel buffer size and the bytes of /// actual data to be sent/received by the application, because the kernel might also use the buffer space /// for internal metadata structures. - /// + /// /// Equivalent to the SO_RCVBUF and SO_SNDBUF socket options. - /// + /// /// # Typical errors /// - `already-connected`: (set) The socket is already in the Connection state. /// - `already-listening`: (set) The socket is already in the Listener state. @@ -220,25 +222,25 @@ interface tcp { set-send-buffer-size: func(this: tcp-socket, value: u64) -> result<_, error-code> /// Create a `pollable` which will resolve once the socket is ready for I/O. - /// + /// /// Note: this function is here for WASI Preview2 only. /// It's planned to be removed when `future` is natively supported in Preview3. subscribe: func(this: tcp-socket) -> pollable /// Initiate a graceful shutdown. - /// + /// /// - receive: the socket is not expecting to receive any more data from the peer. All subsequent read /// operations on the `input-stream` associated with this socket will return an End Of Stream indication. /// Any data still in the receive queue at time of calling `shutdown` will be discarded. /// - send: the socket is not expecting to send any more data to the peer. All subsequent write /// operations on the `output-stream` associated with this socket will return an error. /// - both: same effect as receive & send combined. - /// + /// /// The shutdown function does not close (drop) the socket. - /// + /// /// # Typical errors /// - `not-connected`: The socket is not in the Connection state. (ENOTCONN) - /// + /// /// # References /// - /// - @@ -247,9 +249,9 @@ interface tcp { shutdown: func(this: tcp-socket, shutdown-type: shutdown-type) -> result<_, error-code> /// Dispose of the specified `tcp-socket`, after which it may no longer be used. - /// + /// /// Similar to the POSIX `close` function. - /// + /// /// Note: this function is scheduled to be removed when Resources are natively supported in Wit. drop-tcp-socket: func(this: tcp-socket) } diff --git a/wit/deps/sockets/udp-create-socket.wit b/wit/deps/sockets/udp-create-socket.wit index 1cfbd7f..cd4c08f 100644 --- a/wit/deps/sockets/udp-create-socket.wit +++ b/wit/deps/sockets/udp-create-socket.wit @@ -4,20 +4,20 @@ interface udp-create-socket { use udp.{udp-socket} /// Create a new UDP socket. - /// + /// /// Similar to `socket(AF_INET or AF_INET6, SOCK_DGRAM, IPPROTO_UDP)` in POSIX. - /// + /// /// This function does not require a network capability handle. This is considered to be safe because /// at time of creation, the socket is not bound to any `network` yet. Up to the moment `bind`/`connect` is called, /// the socket is effectively an in-memory configuration object, unable to communicate with the outside world. - /// + /// /// All sockets are non-blocking. Use the wasi-poll interface to block on asynchronous operations. - /// + /// /// # Typical errors /// - `not-supported`: The host does not support UDP sockets. (EOPNOTSUPP) /// - `address-family-not-supported`: The specified `address-family` is not supported. (EAFNOSUPPORT) /// - `new-socket-limit`: The new socket resource could not be created because of a system limit. (EMFILE, ENFILE) - /// + /// /// # References: /// - /// - diff --git a/wit/deps/sockets/udp.wit b/wit/deps/sockets/udp.wit index 9dd4573..700b9e2 100644 --- a/wit/deps/sockets/udp.wit +++ b/wit/deps/sockets/udp.wit @@ -27,23 +27,23 @@ interface udp { /// If the IP address is zero (`0.0.0.0` in IPv4, `::` in IPv6), it is left to the implementation to decide which /// network interface(s) to bind to. /// If the TCP/UDP port is zero, the socket will be bound to a random free port. - /// + /// /// When a socket is not explicitly bound, the first invocation to connect will implicitly bind the socket. - /// + /// /// Unlike in POSIX, this function is async. This enables interactive WASI hosts to inject permission prompts. - /// + /// /// # Typical `start` errors /// - `address-family-mismatch`: The `local-address` has the wrong address family. (EINVAL) /// - `already-bound`: The socket is already bound. (EINVAL) /// - `concurrency-conflict`: Another `bind` or `connect` operation is already in progress. (EALREADY) - /// + /// /// # Typical `finish` errors /// - `ephemeral-ports-exhausted`: No ephemeral ports available. (EADDRINUSE, ENOBUFS on Windows) /// - `address-in-use`: Address is already in use. (EADDRINUSE) /// - `address-not-bindable`: `local-address` is not an address that the `network` can bind to. (EADDRNOTAVAIL) /// - `not-in-progress`: A `bind` operation is not in progress. /// - `would-block`: Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN) - /// + /// /// # References /// - /// - @@ -53,29 +53,29 @@ interface udp { finish-bind: func(this: udp-socket) -> result<_, error-code> /// Set the destination address. - /// + /// /// The local-address is updated based on the best network path to `remote-address`. - /// + /// /// When a destination address is set: /// - all receive operations will only return datagrams sent from the provided `remote-address`. /// - the `send` function can only be used to send to this destination. - /// + /// /// Note that this function does not generate any network traffic and the peer is not aware of this "connection". - /// + /// /// Unlike in POSIX, this function is async. This enables interactive WASI hosts to inject permission prompts. - /// + /// /// # Typical `start` errors /// - `address-family-mismatch`: The `remote-address` has the wrong address family. (EAFNOSUPPORT) /// - `invalid-remote-address`: The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EDESTADDRREQ, EADDRNOTAVAIL) /// - `invalid-remote-address`: The port in `remote-address` is set to 0. (EDESTADDRREQ, EADDRNOTAVAIL) /// - `already-attached`: The socket is already bound to a different network. The `network` passed to `connect` must be identical to the one passed to `bind`. /// - `concurrency-conflict`: Another `bind` or `connect` operation is already in progress. (EALREADY) - /// + /// /// # Typical `finish` errors /// - `ephemeral-ports-exhausted`: Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD) /// - `not-in-progress`: A `connect` operation is not in progress. /// - `would-block`: Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN) - /// + /// /// # References /// - /// - @@ -84,32 +84,42 @@ interface udp { start-connect: func(this: udp-socket, network: network, remote-address: ip-socket-address) -> result<_, error-code> finish-connect: func(this: udp-socket) -> result<_, error-code> - /// Receive a message. - /// - /// Returns: - /// - The sender address of the datagram - /// - The number of bytes read. - /// + /// Receive messages on the socket. + /// + /// This function attempts to receive up to `max-results` datagrams on the socket without blocking. + /// The returned list may contain fewer elements than requested, but never more. + /// If `max-results` is 0, this function returns successfully with an empty list. + /// /// # Typical errors /// - `not-bound`: The socket is not bound to any local address. (EINVAL) /// - `remote-unreachable`: The remote address is not reachable. (ECONNREFUSED, ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN) /// - `would-block`: There is no pending data available to be read at the moment. (EWOULDBLOCK, EAGAIN) - /// + /// /// # References /// - /// - /// - + /// - /// - /// - /// - /// - - receive: func(this: udp-socket) -> result - - /// Send a message to a specific destination address. - /// + receive: func(this: udp-socket, max-results: u64) -> result, error-code> + + /// Send messages on the socket. + /// + /// This function attempts to send all provided `datagrams` on the socket without blocking and + /// returns how many messages were actually sent (or queued for sending). + /// + /// This function semantically behaves the same as iterating the `datagrams` list and sequentially + /// sending each individual datagram until either the end of the list has been reached or the first error occurred. + /// If at least one datagram has been sent successfully, this function never returns an error. + /// + /// If the input list is empty, the function returns `ok(0)`. + /// /// The remote address option is required. To send a message to the "connected" peer, /// call `remote-address` to get their address. - /// + /// /// # Typical errors /// - `address-family-mismatch`: The `remote-address` has the wrong address family. (EAFNOSUPPORT) /// - `invalid-remote-address`: The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EDESTADDRREQ, EADDRNOTAVAIL) @@ -119,22 +129,23 @@ interface udp { /// - `remote-unreachable`: The remote address is not reachable. (ECONNREFUSED, ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN) /// - `datagram-too-large`: The datagram is too large. (EMSGSIZE) /// - `would-block`: The send buffer is currently full. (EWOULDBLOCK, EAGAIN) - /// + /// /// # References /// - /// - /// - + /// - /// - /// - /// - /// - - send: func(this: udp-socket, datagram: datagram) -> result<_, error-code> + send: func(this: udp-socket, datagrams: list) -> result /// Get the current bound address. - /// + /// /// # Typical errors /// - `not-bound`: The socket is not bound to any local address. - /// + /// /// # References /// - /// - @@ -143,10 +154,10 @@ interface udp { local-address: func(this: udp-socket) -> result /// Get the address set with `connect`. - /// + /// /// # Typical errors /// - `not-connected`: The socket is not connected to a remote address. (ENOTCONN) - /// + /// /// # References /// - /// - @@ -155,14 +166,14 @@ interface udp { remote-address: func(this: udp-socket) -> result /// Whether this is a IPv4 or IPv6 socket. - /// + /// /// Equivalent to the SO_DOMAIN socket option. address-family: func(this: udp-socket) -> ip-address-family /// Whether IPv4 compatibility (dual-stack) mode is disabled or not. - /// + /// /// Equivalent to the IPV6_V6ONLY socket option. - /// + /// /// # Typical errors /// - `ipv6-only-operation`: (get/set) `this` socket is an IPv4 socket. /// - `already-bound`: (set) The socket is already bound. @@ -172,25 +183,23 @@ interface udp { set-ipv6-only: func(this: udp-socket, value: bool) -> result<_, error-code> /// Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options. - /// + /// /// # Typical errors /// - `concurrency-conflict`: (set) Another `bind` or `connect` operation is already in progress. (EALREADY) unicast-hop-limit: func(this: udp-socket) -> result set-unicast-hop-limit: func(this: udp-socket, value: u8) -> result<_, error-code> /// The kernel buffer space reserved for sends/receives on this socket. - /// + /// /// Note #1: an implementation may choose to cap or round the buffer size when setting the value. /// In other words, after setting a value, reading the same setting back may return a different value. - /// + /// /// Note #2: there is not necessarily a direct relationship between the kernel buffer size and the bytes of /// actual data to be sent/received by the application, because the kernel might also use the buffer space /// for internal metadata structures. - /// - /// Fails when this socket is in the Listening state. - /// + /// /// Equivalent to the SO_RCVBUF and SO_SNDBUF socket options. - /// + /// /// # Typical errors /// - `concurrency-conflict`: (set) Another `bind` or `connect` operation is already in progress. (EALREADY) receive-buffer-size: func(this: udp-socket) -> result @@ -199,13 +208,13 @@ interface udp { set-send-buffer-size: func(this: udp-socket, value: u64) -> result<_, error-code> /// Create a `pollable` which will resolve once the socket is ready for I/O. - /// + /// /// Note: this function is here for WASI Preview2 only. /// It's planned to be removed when `future` is natively supported in Preview3. subscribe: func(this: udp-socket) -> pollable /// Dispose of the specified `udp-socket`, after which it may no longer be used. - /// + /// /// Note: this function is scheduled to be removed when Resources are natively supported in Wit. drop-udp-socket: func(this: udp-socket) } diff --git a/wit/deps/wasi-cli-base/exit.wit b/wit/deps/wasi-cli-base/exit.wit deleted file mode 100644 index 66835aa..0000000 --- a/wit/deps/wasi-cli-base/exit.wit +++ /dev/null @@ -1,4 +0,0 @@ -interface exit { - /// Exit the curerent instance and any linked instances. - exit: func(status: result) -} diff --git a/wit/virt.wit b/wit/virt.wit index 0a85788..b88fcbd 100644 --- a/wit/virt.wit +++ b/wit/virt.wit @@ -3,7 +3,7 @@ package local:virt // in future this should be defined as a union world of the various // virtual subsystems, when union syntax lands world virtual-adapter { - import wasi:cli-base/environment + import wasi:cli/environment import wasi:filesystem/preopens import wasi:filesystem/types import wasi:io/streams @@ -11,15 +11,25 @@ world virtual-adapter { log: func(msg: string) -> () } export wasi:io/streams - export wasi:cli-base/environment + export wasi:cli/environment export wasi:filesystem/types export wasi:filesystem/preopens - import wasi:cli-base/stdin - import wasi:cli-base/stdout - import wasi:cli-base/stderr - export wasi:cli-base/stdin - export wasi:cli-base/stdout - export wasi:cli-base/stderr + import wasi:cli/stdin + import wasi:cli/stdout + import wasi:cli/stderr + import wasi:cli/terminal-input + import wasi:cli/terminal-output + import wasi:cli/terminal-stdin + import wasi:cli/terminal-stdout + import wasi:cli/terminal-stderr + export wasi:cli/stdin + export wasi:cli/stdout + export wasi:cli/stderr + export wasi:cli/terminal-input + export wasi:cli/terminal-output + export wasi:cli/terminal-stdin + export wasi:cli/terminal-stdout + export wasi:cli/terminal-stderr import wasi:poll/poll export wasi:poll/poll import wasi:clocks/monotonic-clock @@ -77,18 +87,28 @@ world virtual-fs { } world virtual-stdio { - import wasi:cli-base/stdin - import wasi:cli-base/stdout - import wasi:cli-base/stderr - export wasi:cli-base/stdin - export wasi:cli-base/stdout - export wasi:cli-base/stderr + import wasi:cli/stdin + import wasi:cli/stdout + import wasi:cli/stderr + import wasi:cli/terminal-input + import wasi:cli/terminal-output + import wasi:cli/terminal-stdin + import wasi:cli/terminal-stdout + import wasi:cli/terminal-stderr + export wasi:cli/stdin + export wasi:cli/stdout + export wasi:cli/stderr + export wasi:cli/terminal-input + export wasi:cli/terminal-output + export wasi:cli/terminal-stdin + export wasi:cli/terminal-stdout + export wasi:cli/terminal-stderr } // remaining subsystems world virtual-env { - import wasi:cli-base/environment - export wasi:cli-base/environment + import wasi:cli/environment + export wasi:cli/environment } world virtual-clocks { @@ -134,8 +154,8 @@ world virtual-http { } world virtual-exit { - import wasi:cli-base/exit - export wasi:cli-base/exit + import wasi:cli/exit + export wasi:cli/exit } world virt-test { @@ -155,12 +175,17 @@ world virt-test { import wasi:random/insecure-seed import wasi:poll/poll import wasi:io/streams - import wasi:cli-base/environment + import wasi:cli/environment import wasi:filesystem/preopens - import wasi:cli-base/exit - import wasi:cli-base/stdin - import wasi:cli-base/stdout - import wasi:cli-base/stderr + import wasi:cli/exit + import wasi:cli/stdin + import wasi:cli/stdout + import wasi:cli/stderr + import wasi:cli/terminal-input + import wasi:cli/terminal-output + import wasi:cli/terminal-stdin + import wasi:cli/terminal-stdout + import wasi:cli/terminal-stderr export test-get-env: func() -> list> export test-file-read: func(path: string) -> string