kobako 0.30.0 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.githooks/linux-tests.sh +29 -0
- data/.release-please-manifest.json +1 -1
- data/CHANGELOG.md +460 -0
- data/Cargo.lock +868 -447
- data/README.md +43 -4
- data/ROADMAP.md +1 -2
- data/crates/kobako-runtime/CHANGELOG.md +309 -0
- data/crates/kobako-runtime/Cargo.toml +58 -11
- data/crates/kobako-runtime/README.md +7 -4
- data/crates/kobako-runtime/src/cred.rs +136 -0
- data/crates/kobako-runtime/src/dispatch.rs +4 -5
- data/crates/kobako-runtime/src/endpoint/buffer.rs +153 -44
- data/crates/kobako-runtime/src/endpoint/dispatch.rs +80 -41
- data/crates/kobako-runtime/src/endpoint/invoke.rs +23 -36
- data/crates/kobako-runtime/src/endpoint.rs +137 -36
- data/crates/kobako-runtime/src/errno.rs +391 -0
- data/crates/kobako-runtime/src/error.rs +31 -10
- data/crates/kobako-runtime/src/filesystem/anon_inodes.rs +52 -0
- data/crates/kobako-runtime/src/filesystem/bind/fid.rs +300 -22
- data/crates/kobako-runtime/src/filesystem/bind/lookup.rs +101 -29
- data/crates/kobako-runtime/src/filesystem/bind/unicode.rs +109 -0
- data/crates/kobako-runtime/src/filesystem/bind/walk.rs +52 -34
- data/crates/kobako-runtime/src/filesystem/bind.rs +812 -447
- data/crates/kobako-runtime/src/filesystem/overlay/file.rs +6 -6
- data/crates/kobako-runtime/src/filesystem/overlay/path.rs +43 -65
- data/crates/kobako-runtime/src/filesystem/overlay/stack/copy_up.rs +11 -16
- data/crates/kobako-runtime/src/filesystem/overlay/stack/dir.rs +47 -72
- data/crates/kobako-runtime/src/filesystem/overlay/stack/namei.rs +12 -12
- data/crates/kobako-runtime/src/filesystem/overlay/stack/readdir.rs +4 -7
- data/crates/kobako-runtime/src/filesystem/overlay/stack.rs +120 -37
- data/crates/kobako-runtime/src/filesystem/overlay.rs +578 -388
- data/crates/kobako-runtime/src/filesystem/pipe.rs +12 -9
- data/crates/kobako-runtime/src/filesystem/rdir.rs +14 -50
- data/crates/kobako-runtime/src/filesystem/testing.rs +31 -0
- data/crates/kobako-runtime/src/filesystem/tmpfs/seed.rs +32 -0
- data/crates/kobako-runtime/src/filesystem/tmpfs/tmpfile.rs +3 -3
- data/crates/kobako-runtime/src/filesystem/tmpfs/whiteout.rs +57 -35
- data/crates/kobako-runtime/src/filesystem/tmpfs/xattr.rs +2 -2
- data/crates/kobako-runtime/src/filesystem/tmpfs.rs +219 -173
- data/crates/kobako-runtime/src/filesystem/wrap.rs +36 -52
- data/crates/kobako-runtime/src/filesystem.rs +8 -3
- data/crates/kobako-runtime/src/fork.rs +319 -0
- data/crates/kobako-runtime/src/grant.rs +3 -0
- data/crates/kobako-runtime/src/hashtable.rs +4 -2
- data/crates/kobako-runtime/src/lib.rs +18 -7
- data/crates/kobako-runtime/src/limits.rs +171 -0
- data/crates/kobako-runtime/src/locking/seqlock.rs +29 -3
- data/crates/kobako-runtime/src/locking.rs +518 -113
- data/crates/kobako-runtime/src/memcg.rs +306 -0
- data/crates/kobako-runtime/src/mount.rs +37 -9
- data/crates/kobako-runtime/src/net/backends.rs +43 -0
- data/crates/kobako-runtime/src/net/connections.rs +219 -0
- data/crates/kobako-runtime/src/net/credential.rs +125 -0
- data/crates/kobako-runtime/src/net/egress.rs +180 -0
- data/crates/kobako-runtime/src/net/family.rs +181 -0
- data/crates/kobako-runtime/src/net/http.rs +3165 -0
- data/crates/kobako-runtime/src/net/lookup.rs +385 -0
- data/crates/kobako-runtime/src/net/mock.rs +251 -0
- data/crates/kobako-runtime/src/net/namespace.rs +1368 -0
- data/crates/kobako-runtime/src/net/reactor.rs +626 -0
- data/crates/kobako-runtime/src/net/resolv/darwin.rs +280 -0
- data/crates/kobako-runtime/src/net/resolv/stub/tests.rs +519 -0
- data/crates/kobako-runtime/src/net/resolv/stub.rs +542 -0
- data/crates/kobako-runtime/src/net/resolv/windows.rs +218 -0
- data/crates/kobako-runtime/src/net/resolv.rs +251 -0
- data/crates/kobako-runtime/src/net/skbuff.rs +109 -0
- data/crates/kobako-runtime/src/net/socket.rs +869 -0
- data/crates/kobako-runtime/src/net/task.rs +223 -0
- data/crates/kobako-runtime/src/net/tcp.rs +1840 -0
- data/crates/kobako-runtime/src/net/tls.rs +120 -0
- data/crates/kobako-runtime/src/net/transport.rs +304 -0
- data/crates/kobako-runtime/src/net/udp.rs +1105 -0
- data/crates/kobako-runtime/src/net.rs +45 -0
- data/crates/kobako-runtime/src/network/builder.rs +177 -0
- data/crates/kobako-runtime/src/network/ruleset.rs +777 -0
- data/crates/kobako-runtime/src/network.rs +551 -0
- data/crates/kobako-runtime/src/policy.rs +16 -0
- data/crates/kobako-runtime/src/profile.rs +29 -144
- data/crates/kobako-runtime/src/runtime.rs +3 -5
- data/crates/kobako-runtime/src/sched.rs +338 -51
- data/crates/kobako-runtime/src/security/entry_policy.rs +22 -0
- data/crates/kobako-runtime/src/{vfs/cred.rs → security/hooks.rs} +52 -144
- data/crates/kobako-runtime/src/security/mount_policy.rs +158 -0
- data/crates/kobako-runtime/src/security.rs +125 -209
- data/crates/kobako-runtime/src/snapshot.rs +121 -2
- data/crates/kobako-runtime/src/vfs/attr.rs +5 -5
- data/crates/kobako-runtime/src/vfs/dentry.rs +210 -117
- data/crates/kobako-runtime/src/vfs/file.rs +243 -248
- data/crates/kobako-runtime/src/vfs/inode.rs +41 -45
- data/crates/kobako-runtime/src/vfs/kern_path.rs +62 -53
- data/crates/kobako-runtime/src/vfs/mount.rs +10 -9
- data/crates/kobako-runtime/src/vfs/namei.rs +1162 -818
- data/crates/kobako-runtime/src/vfs/namespace.rs +245 -0
- data/crates/kobako-runtime/src/vfs/open_files.rs +69 -0
- data/crates/kobako-runtime/src/vfs/openat2.rs +3 -3
- data/crates/kobako-runtime/src/vfs/path.rs +6 -6
- data/crates/kobako-runtime/src/vfs/readdir.rs +6 -6
- data/crates/kobako-runtime/src/vfs/stat.rs +248 -23
- data/crates/kobako-runtime/src/vfs/super_block.rs +18 -14
- data/crates/kobako-runtime/src/vfs/utimes.rs +37 -27
- data/crates/kobako-runtime/src/vfs.rs +10 -6
- data/crates/kobako-runtime/src/wait.rs +381 -0
- data/crates/kobako-transport/CHANGELOG.md +38 -0
- data/crates/kobako-transport/Cargo.toml +1 -1
- data/crates/kobako-transport/README.md +3 -4
- data/crates/kobako-transport/src/abi.rs +78 -72
- data/crates/kobako-transport/src/envelope/bytes.rs +17 -6
- data/crates/kobako-transport/src/envelope/call.rs +32 -4
- data/crates/kobako-transport/src/envelope/error_record.rs +21 -0
- data/crates/kobako-transport/src/envelope/name.rs +99 -0
- data/crates/kobako-transport/src/envelope/outcome.rs +9 -9
- data/crates/kobako-transport/src/envelope/preamble.rs +24 -21
- data/crates/kobako-transport/src/envelope/reply.rs +27 -27
- data/crates/kobako-transport/src/envelope/unsupported.rs +10 -10
- data/crates/kobako-transport/src/envelope.rs +13 -8
- data/crates/kobako-wasmtime/CHANGELOG.md +208 -0
- data/crates/kobako-wasmtime/Cargo.toml +47 -7
- data/crates/kobako-wasmtime/README.md +4 -3
- data/crates/kobako-wasmtime/build/preview2.rs +1339 -0
- data/crates/kobako-wasmtime/build.rs +16 -0
- data/crates/kobako-wasmtime/src/abi.rs +18 -37
- data/crates/kobako-wasmtime/src/ambient.rs +43 -19
- data/crates/kobako-wasmtime/src/cache/unix.rs +95 -0
- data/crates/kobako-wasmtime/src/cache/windows.rs +359 -0
- data/crates/kobako-wasmtime/src/cache.rs +106 -113
- data/crates/kobako-wasmtime/src/config.rs +52 -68
- data/crates/kobako-wasmtime/src/driver.rs +80 -82
- data/crates/kobako-wasmtime/src/exports.rs +143 -17
- data/crates/kobako-wasmtime/src/guest.rs +12 -6
- data/crates/kobako-wasmtime/src/guest_binary.rs +14 -0
- data/crates/kobako-wasmtime/src/imports.rs +42 -18
- data/crates/kobako-wasmtime/src/instance_pre.rs +4 -4
- data/crates/kobako-wasmtime/src/invocation.rs +91 -15
- data/crates/kobako-wasmtime/src/lib.rs +7 -3
- data/crates/kobako-wasmtime/src/limiter.rs +130 -12
- data/crates/kobako-wasmtime/src/preview1/descriptors.rs +305 -0
- data/crates/kobako-wasmtime/src/preview1/differential/mount.rs +9 -20
- data/crates/kobako-wasmtime/src/preview1/differential.rs +27 -31
- data/crates/kobako-wasmtime/src/preview1/errno.rs +55 -66
- data/crates/kobako-wasmtime/src/preview1/fd.rs +347 -312
- data/crates/kobako-wasmtime/src/preview1/memory.rs +21 -12
- data/crates/kobako-wasmtime/src/preview1/mount_view/wrap.rs +34 -53
- data/crates/kobako-wasmtime/src/preview1/mount_view.rs +335 -388
- data/crates/kobako-wasmtime/src/preview1/path.rs +56 -121
- data/crates/kobako-wasmtime/src/preview1/poll.rs +255 -125
- data/crates/kobako-wasmtime/src/preview1/random.rs +125 -0
- data/crates/kobako-wasmtime/src/preview1/sock.rs +10 -8
- data/crates/kobako-wasmtime/src/preview1/testing.rs +31 -0
- data/crates/kobako-wasmtime/src/preview1/testsuite.rs +5 -15
- data/crates/kobako-wasmtime/src/preview1.rs +131 -51
- data/crates/kobako-wasmtime/src/preview2/abi.rs +227 -0
- data/crates/kobako-wasmtime/src/preview2/error.rs +118 -0
- data/crates/kobako-wasmtime/src/preview2/filesystem.rs +122 -0
- data/crates/kobako-wasmtime/src/preview2/host.rs +4319 -0
- data/crates/kobako-wasmtime/src/preview2/http.rs +1587 -0
- data/crates/kobako-wasmtime/src/preview2/io.rs +328 -0
- data/crates/kobako-wasmtime/src/preview2/sockets.rs +379 -0
- data/crates/kobako-wasmtime/src/preview2/table.rs +257 -0
- data/crates/kobako-wasmtime/src/preview2.rs +57 -0
- data/crates/kobako-wasmtime/src/trap.rs +88 -28
- data/crates/kobako-wasmtime/src/waits.rs +59 -0
- data/crates/kobako-wasmtime/src/wasi.rs +291 -81
- data/crates/kobako-wasmtime/wit/deps/cli.wit +233 -0
- data/crates/kobako-wasmtime/wit/deps/clocks.wit +162 -0
- data/crates/kobako-wasmtime/wit/deps/filesystem.wit +589 -0
- data/crates/kobako-wasmtime/wit/deps/http.wit +733 -0
- data/crates/kobako-wasmtime/wit/deps/io.wit +299 -0
- data/crates/kobako-wasmtime/wit/deps/random.wit +92 -0
- data/crates/kobako-wasmtime/wit/deps/sockets.wit +949 -0
- data/crates/kobako-wasmtime/witx/wasi_snapshot_preview1.witx +13 -0
- data/data/kobako.wasm +0 -0
- data/ext/kobako/Cargo.toml +6 -2
- data/ext/kobako/src/{runtime/errors.rs → errors.rs} +34 -26
- data/ext/kobako/src/escape.rs +404 -0
- data/ext/kobako/src/{runtime/filesystem → filesystem}/grants.rs +34 -32
- data/ext/kobako/src/{runtime/filesystem → filesystem}/ruby.rs +158 -170
- data/ext/kobako/src/{runtime/filesystem.rs → filesystem.rs} +71 -23
- data/ext/kobako/src/fork.rs +72 -0
- data/ext/kobako/src/gvl.rs +729 -0
- data/ext/kobako/src/handoff.rs +490 -0
- data/ext/kobako/src/lib.rs +74 -3
- data/ext/kobako/src/network/mock.rs +187 -0
- data/ext/kobako/src/network.rs +593 -0
- data/ext/kobako/src/pinned_value.rs +44 -0
- data/ext/kobako/src/runtime/bridge.rs +58 -50
- data/ext/kobako/src/runtime/snapshot.rs +4 -4
- data/ext/kobako/src/runtime.rs +272 -163
- data/ext/kobako/src/wire.rs +42 -0
- data/lib/kobako/catalog/extensions.rb +14 -2
- data/lib/kobako/catalog/flags.rb +3 -5
- data/lib/kobako/catalog/grants.rb +5 -4
- data/lib/kobako/catalog/handles.rb +14 -32
- data/lib/kobako/catalog/mount.rb +11 -3
- data/lib/kobako/catalog/network.rb +35 -0
- data/lib/kobako/catalog/replacements.rb +28 -0
- data/lib/kobako/catalog/services.rb +5 -19
- data/lib/kobako/catalog/snippets.rb +3 -18
- data/lib/kobako/catalog.rb +3 -0
- data/lib/kobako/codec/{utils.rb → boundary.rb} +4 -2
- data/lib/kobako/codec/decoder.rb +5 -5
- data/lib/kobako/codec/ext_types.rb +3 -3
- data/lib/kobako/codec/handle_walk.rb +3 -43
- data/lib/kobako/codec/state.rb +2 -18
- data/lib/kobako/codec/value_budget.rb +133 -41
- data/lib/kobako/codec.rb +6 -7
- data/lib/kobako/context.rb +24 -11
- data/lib/kobako/errors.rb +18 -18
- data/lib/kobako/extension.rb +3 -2
- data/lib/kobako/filesystem.rb +10 -3
- data/lib/kobako/fork.rb +42 -0
- data/lib/kobako/handle.rb +2 -3
- data/lib/kobako/names.rb +28 -0
- data/lib/kobako/network.rb +210 -0
- data/lib/kobako/outcome.rb +7 -7
- data/lib/kobako/runtime.rb +3 -2
- data/lib/kobako/sandbox.rb +73 -35
- data/lib/kobako/sandbox_options.rb +42 -109
- data/lib/kobako/transport/argument_wrap.rb +64 -0
- data/lib/kobako/transport/block_failure.rb +1 -1
- data/lib/kobako/transport/dispatcher.rb +6 -6
- data/lib/kobako/transport/exposure.rb +26 -15
- data/lib/kobako/transport/reflection.rb +21 -4
- data/lib/kobako/transport/run.rb +8 -23
- data/lib/kobako/transport/yielder.rb +2 -9
- data/lib/kobako/transport.rb +1 -0
- data/lib/kobako/usage.rb +4 -2
- data/lib/kobako/version.rb +1 -1
- data/lib/kobako.rb +8 -4
- data/release-please-config.json +15 -0
- data/sig/kobako/catalog/extensions.rbs +2 -0
- data/sig/kobako/catalog/grants.rbs +7 -4
- data/sig/kobako/catalog/handles.rbs +2 -2
- data/sig/kobako/catalog/mount.rbs +3 -1
- data/sig/kobako/catalog/network.rbs +20 -0
- data/sig/kobako/catalog/replacements.rbs +14 -0
- data/sig/kobako/catalog/services.rbs +0 -4
- data/sig/kobako/catalog/snippets.rbs +0 -2
- data/sig/kobako/codec/{utils.rbs → boundary.rbs} +2 -2
- data/sig/kobako/codec/handle_walk.rbs +0 -6
- data/sig/kobako/codec/state.rbs +0 -4
- data/sig/kobako/codec/value_budget.rbs +48 -5
- data/sig/kobako/codec.rbs +2 -2
- data/sig/kobako/context.rbs +3 -1
- data/sig/kobako/errors.rbs +4 -7
- data/sig/kobako/filesystem.rbs +21 -3
- data/sig/kobako/fork.rbs +17 -0
- data/sig/kobako/network.rbs +115 -0
- data/sig/kobako/outcome.rbs +1 -1
- data/sig/kobako/runtime.rbs +32 -3
- data/sig/kobako/sandbox.rbs +10 -2
- data/sig/kobako/sandbox_options.rbs +29 -40
- data/sig/kobako/transport/argument_wrap.rbs +15 -0
- data/sig/kobako/transport/error.rbs +1 -1
- data/sig/kobako/transport/exposure.rbs +2 -4
- data/sig/kobako/transport/reflection.rbs +10 -0
- data/sig/kobako/transport/run.rbs +0 -2
- data/sig/kobako/transport/yielder.rbs +0 -3
- data/sig/kobako/transport.rbs +1 -1
- data/sig/kobako.rbs +13 -0
- metadata +97 -37
- data/crates/kobako-runtime/src/endpoint/capture.rs +0 -115
- data/crates/kobako-runtime/src/endpoint/memory_cap.rs +0 -238
- data/crates/kobako-runtime/src/filesystem/path.rs +0 -21
- data/crates/kobako-runtime/src/vfs/errno.rs +0 -153
- data/crates/kobako-runtime/tests/linux_baseline/calls.rs +0 -171
- data/crates/kobako-runtime/tests/linux_baseline/concurrent.rs +0 -276
- data/crates/kobako-runtime/tests/linux_baseline/kobako.rs +0 -323
- data/crates/kobako-runtime/tests/linux_baseline/linux-baseline-expected.txt +0 -16
- data/crates/kobako-runtime/tests/linux_baseline/linux.rs +0 -449
- data/crates/kobako-runtime/tests/linux_baseline/main.rs +0 -611
- data/crates/kobako-runtime/tests/linux_baseline/permissions.rs +0 -236
- data/crates/kobako-wasmtime/src/descriptors.rs +0 -200
- data/crates/kobako-wasmtime/tests/integration/compile_posture.rs +0 -43
- data/crates/kobako-wasmtime/tests/integration/guest_file.rs +0 -1085
- data/crates/kobako-wasmtime/tests/integration/main.rs +0 -29
- data/crates/kobako-wasmtime/tests/integration/preamble_flags.rs +0 -70
- data/crates/kobako-wasmtime/tests/integration/snippet_compile.rs +0 -95
- data/crates/kobako-wasmtime/tests/integration/support/mod.rs +0 -30
- data/crates/kobako-wasmtime/tests/integration/unanswered_call.rs +0 -86
- data/crates/kobako-wasmtime/tests/integration/unsupported_call.rs +0 -51
- data/ext/kobako/src/runtime/escape.rs +0 -67
- data/ext/kobako/src/runtime/gvl.rs +0 -147
- data/ext/kobako/src/runtime/pinned_value.rs +0 -31
- data/lib/kobako/constant_name.rb +0 -8
- data/lib/kobako/pool.rb +0 -140
- data/sig/kobako/constant_name.rbs +0 -3
- data/sig/kobako/pool.rbs +0 -42
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
package wasi:cli@0.2.12;
|
|
2
|
+
|
|
3
|
+
@since(version = 0.2.0)
|
|
4
|
+
interface environment {
|
|
5
|
+
/// Get the POSIX-style environment variables.
|
|
6
|
+
///
|
|
7
|
+
/// Each environment variable is provided as a pair of string variable names
|
|
8
|
+
/// and string value.
|
|
9
|
+
///
|
|
10
|
+
/// Morally, these are a value import, but until value imports are available
|
|
11
|
+
/// in the component model, this import function should return the same
|
|
12
|
+
/// values each time it is called.
|
|
13
|
+
@since(version = 0.2.0)
|
|
14
|
+
get-environment: func() -> list<tuple<string, string>>;
|
|
15
|
+
|
|
16
|
+
/// Get the POSIX-style arguments to the program.
|
|
17
|
+
@since(version = 0.2.0)
|
|
18
|
+
get-arguments: func() -> list<string>;
|
|
19
|
+
|
|
20
|
+
/// Return a path that programs should use as their initial current working
|
|
21
|
+
/// directory, interpreting `.` as shorthand for this.
|
|
22
|
+
@since(version = 0.2.0)
|
|
23
|
+
initial-cwd: func() -> option<string>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@since(version = 0.2.0)
|
|
27
|
+
interface exit {
|
|
28
|
+
/// Exit the current instance and any linked instances.
|
|
29
|
+
@since(version = 0.2.0)
|
|
30
|
+
exit: func(status: result);
|
|
31
|
+
|
|
32
|
+
/// Exit the current instance and any linked instances, reporting the
|
|
33
|
+
/// specified status code to the host.
|
|
34
|
+
///
|
|
35
|
+
/// The meaning of the code depends on the context, with 0 usually meaning
|
|
36
|
+
/// "success", and other values indicating various types of failure.
|
|
37
|
+
///
|
|
38
|
+
/// This function does not return; the effect is analogous to a trap, but
|
|
39
|
+
/// without the connotation that something bad has happened.
|
|
40
|
+
@since(version = 0.2.12)
|
|
41
|
+
exit-with-code: func(status-code: u8);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@since(version = 0.2.0)
|
|
45
|
+
interface run {
|
|
46
|
+
/// Run the program.
|
|
47
|
+
@since(version = 0.2.0)
|
|
48
|
+
run: func() -> result;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@since(version = 0.2.0)
|
|
52
|
+
interface stdin {
|
|
53
|
+
@since(version = 0.2.0)
|
|
54
|
+
use wasi:io/streams@0.2.12.{input-stream};
|
|
55
|
+
|
|
56
|
+
@since(version = 0.2.0)
|
|
57
|
+
get-stdin: func() -> input-stream;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@since(version = 0.2.0)
|
|
61
|
+
interface stdout {
|
|
62
|
+
@since(version = 0.2.0)
|
|
63
|
+
use wasi:io/streams@0.2.12.{output-stream};
|
|
64
|
+
|
|
65
|
+
@since(version = 0.2.0)
|
|
66
|
+
get-stdout: func() -> output-stream;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@since(version = 0.2.0)
|
|
70
|
+
interface stderr {
|
|
71
|
+
@since(version = 0.2.0)
|
|
72
|
+
use wasi:io/streams@0.2.12.{output-stream};
|
|
73
|
+
|
|
74
|
+
@since(version = 0.2.0)
|
|
75
|
+
get-stderr: func() -> output-stream;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/// Terminal input.
|
|
79
|
+
///
|
|
80
|
+
/// In the future, this may include functions for disabling echoing,
|
|
81
|
+
/// disabling input buffering so that keyboard events are sent through
|
|
82
|
+
/// immediately, querying supported features, and so on.
|
|
83
|
+
@since(version = 0.2.0)
|
|
84
|
+
interface terminal-input {
|
|
85
|
+
/// The input side of a terminal.
|
|
86
|
+
@since(version = 0.2.0)
|
|
87
|
+
resource terminal-input;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/// Terminal output.
|
|
91
|
+
///
|
|
92
|
+
/// In the future, this may include functions for querying the terminal
|
|
93
|
+
/// size, being notified of terminal size changes, querying supported
|
|
94
|
+
/// features, and so on.
|
|
95
|
+
@since(version = 0.2.0)
|
|
96
|
+
interface terminal-output {
|
|
97
|
+
/// The output side of a terminal.
|
|
98
|
+
@since(version = 0.2.0)
|
|
99
|
+
resource terminal-output;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/// An interface providing an optional `terminal-input` for stdin as a
|
|
103
|
+
/// link-time authority.
|
|
104
|
+
@since(version = 0.2.0)
|
|
105
|
+
interface terminal-stdin {
|
|
106
|
+
@since(version = 0.2.0)
|
|
107
|
+
use terminal-input.{terminal-input};
|
|
108
|
+
|
|
109
|
+
/// If stdin is connected to a terminal, return a `terminal-input` handle
|
|
110
|
+
/// allowing further interaction with it.
|
|
111
|
+
@since(version = 0.2.0)
|
|
112
|
+
get-terminal-stdin: func() -> option<terminal-input>;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/// An interface providing an optional `terminal-output` for stdout as a
|
|
116
|
+
/// link-time authority.
|
|
117
|
+
@since(version = 0.2.0)
|
|
118
|
+
interface terminal-stdout {
|
|
119
|
+
@since(version = 0.2.0)
|
|
120
|
+
use terminal-output.{terminal-output};
|
|
121
|
+
|
|
122
|
+
/// If stdout is connected to a terminal, return a `terminal-output` handle
|
|
123
|
+
/// allowing further interaction with it.
|
|
124
|
+
@since(version = 0.2.0)
|
|
125
|
+
get-terminal-stdout: func() -> option<terminal-output>;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/// An interface providing an optional `terminal-output` for stderr as a
|
|
129
|
+
/// link-time authority.
|
|
130
|
+
@since(version = 0.2.0)
|
|
131
|
+
interface terminal-stderr {
|
|
132
|
+
@since(version = 0.2.0)
|
|
133
|
+
use terminal-output.{terminal-output};
|
|
134
|
+
|
|
135
|
+
/// If stderr is connected to a terminal, return a `terminal-output` handle
|
|
136
|
+
/// allowing further interaction with it.
|
|
137
|
+
@since(version = 0.2.0)
|
|
138
|
+
get-terminal-stderr: func() -> option<terminal-output>;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
@since(version = 0.2.0)
|
|
142
|
+
world imports {
|
|
143
|
+
@since(version = 0.2.0)
|
|
144
|
+
import environment;
|
|
145
|
+
@since(version = 0.2.0)
|
|
146
|
+
import exit;
|
|
147
|
+
@since(version = 0.2.0)
|
|
148
|
+
import wasi:io/error@0.2.12;
|
|
149
|
+
@since(version = 0.2.0)
|
|
150
|
+
import wasi:io/poll@0.2.12;
|
|
151
|
+
@since(version = 0.2.0)
|
|
152
|
+
import wasi:io/streams@0.2.12;
|
|
153
|
+
@since(version = 0.2.0)
|
|
154
|
+
import stdin;
|
|
155
|
+
@since(version = 0.2.0)
|
|
156
|
+
import stdout;
|
|
157
|
+
@since(version = 0.2.0)
|
|
158
|
+
import stderr;
|
|
159
|
+
@since(version = 0.2.0)
|
|
160
|
+
import terminal-input;
|
|
161
|
+
@since(version = 0.2.0)
|
|
162
|
+
import terminal-output;
|
|
163
|
+
@since(version = 0.2.0)
|
|
164
|
+
import terminal-stdin;
|
|
165
|
+
@since(version = 0.2.0)
|
|
166
|
+
import terminal-stdout;
|
|
167
|
+
@since(version = 0.2.0)
|
|
168
|
+
import terminal-stderr;
|
|
169
|
+
import wasi:clocks/monotonic-clock@0.2.12;
|
|
170
|
+
import wasi:clocks/wall-clock@0.2.12;
|
|
171
|
+
@unstable(feature = clocks-timezone)
|
|
172
|
+
import wasi:clocks/timezone@0.2.12;
|
|
173
|
+
import wasi:filesystem/types@0.2.12;
|
|
174
|
+
import wasi:filesystem/preopens@0.2.12;
|
|
175
|
+
import wasi:sockets/network@0.2.12;
|
|
176
|
+
import wasi:sockets/instance-network@0.2.12;
|
|
177
|
+
import wasi:sockets/udp@0.2.12;
|
|
178
|
+
import wasi:sockets/udp-create-socket@0.2.12;
|
|
179
|
+
import wasi:sockets/tcp@0.2.12;
|
|
180
|
+
import wasi:sockets/tcp-create-socket@0.2.12;
|
|
181
|
+
import wasi:sockets/ip-name-lookup@0.2.12;
|
|
182
|
+
import wasi:random/random@0.2.12;
|
|
183
|
+
import wasi:random/insecure@0.2.12;
|
|
184
|
+
import wasi:random/insecure-seed@0.2.12;
|
|
185
|
+
}
|
|
186
|
+
@since(version = 0.2.0)
|
|
187
|
+
world command {
|
|
188
|
+
@since(version = 0.2.0)
|
|
189
|
+
import environment;
|
|
190
|
+
@since(version = 0.2.0)
|
|
191
|
+
import exit;
|
|
192
|
+
@since(version = 0.2.0)
|
|
193
|
+
import wasi:io/error@0.2.12;
|
|
194
|
+
@since(version = 0.2.0)
|
|
195
|
+
import wasi:io/poll@0.2.12;
|
|
196
|
+
@since(version = 0.2.0)
|
|
197
|
+
import wasi:io/streams@0.2.12;
|
|
198
|
+
@since(version = 0.2.0)
|
|
199
|
+
import stdin;
|
|
200
|
+
@since(version = 0.2.0)
|
|
201
|
+
import stdout;
|
|
202
|
+
@since(version = 0.2.0)
|
|
203
|
+
import stderr;
|
|
204
|
+
@since(version = 0.2.0)
|
|
205
|
+
import terminal-input;
|
|
206
|
+
@since(version = 0.2.0)
|
|
207
|
+
import terminal-output;
|
|
208
|
+
@since(version = 0.2.0)
|
|
209
|
+
import terminal-stdin;
|
|
210
|
+
@since(version = 0.2.0)
|
|
211
|
+
import terminal-stdout;
|
|
212
|
+
@since(version = 0.2.0)
|
|
213
|
+
import terminal-stderr;
|
|
214
|
+
import wasi:clocks/monotonic-clock@0.2.12;
|
|
215
|
+
import wasi:clocks/wall-clock@0.2.12;
|
|
216
|
+
@unstable(feature = clocks-timezone)
|
|
217
|
+
import wasi:clocks/timezone@0.2.12;
|
|
218
|
+
import wasi:filesystem/types@0.2.12;
|
|
219
|
+
import wasi:filesystem/preopens@0.2.12;
|
|
220
|
+
import wasi:sockets/network@0.2.12;
|
|
221
|
+
import wasi:sockets/instance-network@0.2.12;
|
|
222
|
+
import wasi:sockets/udp@0.2.12;
|
|
223
|
+
import wasi:sockets/udp-create-socket@0.2.12;
|
|
224
|
+
import wasi:sockets/tcp@0.2.12;
|
|
225
|
+
import wasi:sockets/tcp-create-socket@0.2.12;
|
|
226
|
+
import wasi:sockets/ip-name-lookup@0.2.12;
|
|
227
|
+
import wasi:random/random@0.2.12;
|
|
228
|
+
import wasi:random/insecure@0.2.12;
|
|
229
|
+
import wasi:random/insecure-seed@0.2.12;
|
|
230
|
+
|
|
231
|
+
@since(version = 0.2.0)
|
|
232
|
+
export run;
|
|
233
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
package wasi:clocks@0.2.12;
|
|
2
|
+
|
|
3
|
+
/// WASI Monotonic Clock is a clock API intended to let users measure elapsed
|
|
4
|
+
/// time.
|
|
5
|
+
///
|
|
6
|
+
/// It is intended to be portable at least between Unix-family platforms and
|
|
7
|
+
/// Windows.
|
|
8
|
+
///
|
|
9
|
+
/// A monotonic clock is a clock which has an unspecified initial value, and
|
|
10
|
+
/// successive reads of the clock will produce non-decreasing values.
|
|
11
|
+
@since(version = 0.2.0)
|
|
12
|
+
interface monotonic-clock {
|
|
13
|
+
@since(version = 0.2.0)
|
|
14
|
+
use wasi:io/poll@0.2.12.{pollable};
|
|
15
|
+
|
|
16
|
+
/// An instant in time, in nanoseconds. An instant is relative to an
|
|
17
|
+
/// unspecified initial value, and can only be compared to instances from
|
|
18
|
+
/// the same monotonic-clock.
|
|
19
|
+
@since(version = 0.2.0)
|
|
20
|
+
type instant = u64;
|
|
21
|
+
|
|
22
|
+
/// A duration of time, in nanoseconds.
|
|
23
|
+
@since(version = 0.2.0)
|
|
24
|
+
type duration = u64;
|
|
25
|
+
|
|
26
|
+
/// Read the current value of the clock.
|
|
27
|
+
///
|
|
28
|
+
/// The clock is monotonic, therefore calling this function repeatedly will
|
|
29
|
+
/// produce a sequence of non-decreasing values.
|
|
30
|
+
///
|
|
31
|
+
/// For completeness, this function traps if it's not possible to represent
|
|
32
|
+
/// the value of the clock in an `instant`. Consequently, implementations
|
|
33
|
+
/// should ensure that the starting time is low enough to avoid the
|
|
34
|
+
/// possibility of overflow in practice.
|
|
35
|
+
@since(version = 0.2.0)
|
|
36
|
+
now: func() -> instant;
|
|
37
|
+
|
|
38
|
+
/// Query the resolution of the clock. Returns the duration of time
|
|
39
|
+
/// corresponding to a clock tick.
|
|
40
|
+
@since(version = 0.2.0)
|
|
41
|
+
resolution: func() -> duration;
|
|
42
|
+
|
|
43
|
+
/// Create a `pollable` which will resolve once the specified instant
|
|
44
|
+
/// has occurred.
|
|
45
|
+
@since(version = 0.2.0)
|
|
46
|
+
subscribe-instant: func(when: instant) -> pollable;
|
|
47
|
+
|
|
48
|
+
/// Create a `pollable` that will resolve after the specified duration has
|
|
49
|
+
/// elapsed from the time this function is invoked.
|
|
50
|
+
@since(version = 0.2.0)
|
|
51
|
+
subscribe-duration: func(when: duration) -> pollable;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/// WASI Wall Clock is a clock API intended to let users query the current
|
|
55
|
+
/// time. The name "wall" makes an analogy to a "clock on the wall", which
|
|
56
|
+
/// is not necessarily monotonic as it may be reset.
|
|
57
|
+
///
|
|
58
|
+
/// It is intended to be portable at least between Unix-family platforms and
|
|
59
|
+
/// Windows.
|
|
60
|
+
///
|
|
61
|
+
/// A wall clock is a clock which measures the date and time according to
|
|
62
|
+
/// some external reference.
|
|
63
|
+
///
|
|
64
|
+
/// External references may be reset, so this clock is not necessarily
|
|
65
|
+
/// monotonic, making it unsuitable for measuring elapsed time.
|
|
66
|
+
///
|
|
67
|
+
/// It is intended for reporting the current date and time for humans.
|
|
68
|
+
@since(version = 0.2.0)
|
|
69
|
+
interface wall-clock {
|
|
70
|
+
/// A time and date in seconds plus nanoseconds.
|
|
71
|
+
@since(version = 0.2.0)
|
|
72
|
+
record datetime {
|
|
73
|
+
seconds: u64,
|
|
74
|
+
nanoseconds: u32,
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/// Read the current value of the clock.
|
|
78
|
+
///
|
|
79
|
+
/// This clock is not monotonic, therefore calling this function repeatedly
|
|
80
|
+
/// will not necessarily produce a sequence of non-decreasing values.
|
|
81
|
+
///
|
|
82
|
+
/// The returned timestamps represent the number of seconds since
|
|
83
|
+
/// 1970-01-01T00:00:00Z, also known as [POSIX's Seconds Since the Epoch],
|
|
84
|
+
/// also known as [Unix Time].
|
|
85
|
+
///
|
|
86
|
+
/// The nanoseconds field of the output is always less than 1000000000.
|
|
87
|
+
///
|
|
88
|
+
/// [POSIX's Seconds Since the Epoch]: https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap04.html#tag_21_04_16
|
|
89
|
+
/// [Unix Time]: https://en.wikipedia.org/wiki/Unix_time
|
|
90
|
+
@since(version = 0.2.0)
|
|
91
|
+
now: func() -> datetime;
|
|
92
|
+
|
|
93
|
+
/// Query the resolution of the clock.
|
|
94
|
+
///
|
|
95
|
+
/// The nanoseconds field of the output is always less than 1000000000.
|
|
96
|
+
@since(version = 0.2.0)
|
|
97
|
+
resolution: func() -> datetime;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@unstable(feature = clocks-timezone)
|
|
101
|
+
interface timezone {
|
|
102
|
+
@unstable(feature = clocks-timezone)
|
|
103
|
+
use wall-clock.{datetime};
|
|
104
|
+
|
|
105
|
+
/// Information useful for displaying the timezone of a specific `datetime`.
|
|
106
|
+
///
|
|
107
|
+
/// This information may vary within a single `timezone` to reflect daylight
|
|
108
|
+
/// saving time adjustments.
|
|
109
|
+
@unstable(feature = clocks-timezone)
|
|
110
|
+
record timezone-display {
|
|
111
|
+
/// The number of seconds difference between UTC time and the local
|
|
112
|
+
/// time of the timezone.
|
|
113
|
+
///
|
|
114
|
+
/// The returned value will always be less than 86400 which is the
|
|
115
|
+
/// number of seconds in a day (24*60*60).
|
|
116
|
+
///
|
|
117
|
+
/// In implementations that do not expose an actual time zone, this
|
|
118
|
+
/// should return 0.
|
|
119
|
+
utc-offset: s32,
|
|
120
|
+
/// The abbreviated name of the timezone to display to a user. The name
|
|
121
|
+
/// `UTC` indicates Coordinated Universal Time. Otherwise, this should
|
|
122
|
+
/// reference local standards for the name of the time zone.
|
|
123
|
+
///
|
|
124
|
+
/// In implementations that do not expose an actual time zone, this
|
|
125
|
+
/// should be the string `UTC`.
|
|
126
|
+
///
|
|
127
|
+
/// In time zones that do not have an applicable name, a formatted
|
|
128
|
+
/// representation of the UTC offset may be returned, such as `-04:00`.
|
|
129
|
+
name: string,
|
|
130
|
+
/// Whether daylight saving time is active.
|
|
131
|
+
///
|
|
132
|
+
/// In implementations that do not expose an actual time zone, this
|
|
133
|
+
/// should return false.
|
|
134
|
+
in-daylight-saving-time: bool,
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/// Return information needed to display the given `datetime`. This includes
|
|
138
|
+
/// the UTC offset, the time zone name, and a flag indicating whether
|
|
139
|
+
/// daylight saving time is active.
|
|
140
|
+
///
|
|
141
|
+
/// If the timezone cannot be determined for the given `datetime`, return a
|
|
142
|
+
/// `timezone-display` for `UTC` with a `utc-offset` of 0 and no daylight
|
|
143
|
+
/// saving time.
|
|
144
|
+
@unstable(feature = clocks-timezone)
|
|
145
|
+
display: func(when: datetime) -> timezone-display;
|
|
146
|
+
|
|
147
|
+
/// The same as `display`, but only return the UTC offset.
|
|
148
|
+
@unstable(feature = clocks-timezone)
|
|
149
|
+
utc-offset: func(when: datetime) -> s32;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
@since(version = 0.2.0)
|
|
153
|
+
world imports {
|
|
154
|
+
@since(version = 0.2.0)
|
|
155
|
+
import wasi:io/poll@0.2.12;
|
|
156
|
+
@since(version = 0.2.0)
|
|
157
|
+
import monotonic-clock;
|
|
158
|
+
@since(version = 0.2.0)
|
|
159
|
+
import wall-clock;
|
|
160
|
+
@unstable(feature = clocks-timezone)
|
|
161
|
+
import timezone;
|
|
162
|
+
}
|