-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodified-world.wit
More file actions
164 lines (142 loc) · 3.55 KB
/
modified-world.wit
File metadata and controls
164 lines (142 loc) · 3.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
package root:component;
world root {
import wasi:cli/environment@0.2.0;
import wasi:cli/exit@0.2.0;
import wasi:io/error@0.2.0;
import wasi:io/streams@0.2.0;
import wasi:cli/stdin@0.2.0;
import wasi:cli/stdout@0.2.0;
import wasi:cli/stderr@0.2.0;
import wasi:clocks/wall-clock@0.2.0;
import wasi:filesystem/types@0.2.0;
import wasi:filesystem/preopens@0.2.0;
import inc-counter: func(idx: s32, %type: s32, file-idx: s32, line-num: s32, column: s32);
export wasi:cli/run@0.2.0;
}
package wasi:io@0.2.0 {
interface error {
resource error;
}
interface streams {
use error.{error};
resource output-stream {
check-write: func() -> result<u64, stream-error>;
write: func(contents: list<u8>) -> result<_, stream-error>;
blocking-write-and-flush: func(contents: list<u8>) -> result<_, stream-error>;
blocking-flush: func() -> result<_, stream-error>;
}
variant stream-error {
last-operation-failed(error),
closed,
}
resource input-stream;
}
}
package wasi:cli@0.2.0 {
interface environment {
get-environment: func() -> list<tuple<string, string>>;
}
interface exit {
exit: func(status: result);
}
interface stdin {
use wasi:io/streams@0.2.0.{input-stream};
get-stdin: func() -> input-stream;
}
interface stdout {
use wasi:io/streams@0.2.0.{output-stream};
get-stdout: func() -> output-stream;
}
interface stderr {
use wasi:io/streams@0.2.0.{output-stream};
get-stderr: func() -> output-stream;
}
interface run {
run: func() -> result;
}
}
package wasi:clocks@0.2.0 {
interface wall-clock {
record datetime {
seconds: u64,
nanoseconds: u32,
}
}
}
package wasi:filesystem@0.2.0 {
interface types {
use wasi:io/streams@0.2.0.{output-stream};
use wasi:clocks/wall-clock@0.2.0.{datetime};
use wasi:io/streams@0.2.0.{error};
resource descriptor {
write-via-stream: func(offset: filesize) -> result<output-stream, error-code>;
append-via-stream: func() -> result<output-stream, error-code>;
get-type: func() -> result<descriptor-type, error-code>;
stat: func() -> result<descriptor-stat, error-code>;
}
type filesize = u64;
enum error-code {
access,
would-block,
already,
bad-descriptor,
busy,
deadlock,
quota,
exist,
file-too-large,
illegal-byte-sequence,
in-progress,
interrupted,
invalid,
io,
is-directory,
loop,
too-many-links,
message-size,
name-too-long,
no-device,
no-entry,
no-lock,
insufficient-memory,
insufficient-space,
not-directory,
not-empty,
not-recoverable,
unsupported,
no-tty,
no-such-device,
overflow,
not-permitted,
pipe,
read-only,
invalid-seek,
text-file-busy,
cross-device,
}
enum descriptor-type {
unknown,
block-device,
character-device,
directory,
fifo,
symbolic-link,
regular-file,
socket,
}
type link-count = u64;
record descriptor-stat {
%type: descriptor-type,
link-count: link-count,
size: filesize,
data-access-timestamp: option<datetime>,
data-modification-timestamp: option<datetime>,
status-change-timestamp: option<datetime>,
}
filesystem-error-code: func(err: borrow<error>) -> option<error-code>;
}
interface preopens {
use types.{descriptor};
get-directories: func() -> list<tuple<descriptor, string>>;
}
}