This repository has been archived by the owner on Feb 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
exit.go
253 lines (190 loc) · 7.72 KB
/
exit.go
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
package wasicall
import (
"context"
. "github.com/stealthrocket/wasi-go"
"github.com/tetratelabs/wazero/sys"
)
// NewExitSystem creates a wasi.System that exits all calls with the exit code.
func NewExitSystem(exitCode int) System {
return &exitSystem{exitCode: exitCode}
}
type exitSystem struct {
exitCode int
}
func (s *exitSystem) newExitError() *sys.ExitError {
return sys.NewExitError(uint32(s.exitCode))
}
func (s *exitSystem) ArgsSizesGet(ctx context.Context) (int, int, Errno) {
panic(s.newExitError())
}
func (s *exitSystem) ArgsGet(ctx context.Context) ([]string, Errno) {
panic(s.newExitError())
}
func (s *exitSystem) EnvironSizesGet(ctx context.Context) (int, int, Errno) {
panic(s.newExitError())
}
func (s *exitSystem) EnvironGet(ctx context.Context) ([]string, Errno) {
panic(s.newExitError())
}
func (s *exitSystem) ClockResGet(ctx context.Context, id ClockID) (Timestamp, Errno) {
panic(s.newExitError())
}
func (s *exitSystem) ClockTimeGet(ctx context.Context, id ClockID, precision Timestamp) (Timestamp, Errno) {
panic(s.newExitError())
}
func (s *exitSystem) FDAdvise(ctx context.Context, fd FD, offset FileSize, length FileSize, advice Advice) Errno {
panic(s.newExitError())
}
func (s *exitSystem) FDAllocate(ctx context.Context, fd FD, offset FileSize, length FileSize) Errno {
panic(s.newExitError())
}
func (s *exitSystem) FDClose(ctx context.Context, fd FD) Errno {
panic(s.newExitError())
}
func (s *exitSystem) FDDataSync(ctx context.Context, fd FD) Errno {
panic(s.newExitError())
}
func (s *exitSystem) FDStatGet(ctx context.Context, fd FD) (FDStat, Errno) {
panic(s.newExitError())
}
func (s *exitSystem) FDStatSetFlags(ctx context.Context, fd FD, flags FDFlags) Errno {
panic(s.newExitError())
}
func (s *exitSystem) FDStatSetRights(ctx context.Context, fd FD, rightsBase, rightsInheriting Rights) Errno {
panic(s.newExitError())
}
func (s *exitSystem) FDFileStatGet(ctx context.Context, fd FD) (FileStat, Errno) {
panic(s.newExitError())
}
func (s *exitSystem) FDFileStatSetSize(ctx context.Context, fd FD, size FileSize) Errno {
panic(s.newExitError())
}
func (s *exitSystem) FDFileStatSetTimes(ctx context.Context, fd FD, accessTime, modifyTime Timestamp, flags FSTFlags) Errno {
panic(s.newExitError())
}
func (s *exitSystem) FDPread(ctx context.Context, fd FD, iovecs []IOVec, offset FileSize) (Size, Errno) {
panic(s.newExitError())
}
func (s *exitSystem) FDPreStatGet(ctx context.Context, fd FD) (PreStat, Errno) {
panic(s.newExitError())
}
func (s *exitSystem) FDPreStatDirName(ctx context.Context, fd FD) (string, Errno) {
panic(s.newExitError())
}
func (s *exitSystem) FDPwrite(ctx context.Context, fd FD, iovecs []IOVec, offset FileSize) (Size, Errno) {
panic(s.newExitError())
}
func (s *exitSystem) FDRead(ctx context.Context, fd FD, iovecs []IOVec) (Size, Errno) {
panic(s.newExitError())
}
func (s *exitSystem) FDReadDir(ctx context.Context, fd FD, entries []DirEntry, cookie DirCookie, bufferSizeBytes int) (int, Errno) {
panic(s.newExitError())
}
func (s *exitSystem) FDRenumber(ctx context.Context, from, to FD) Errno {
panic(s.newExitError())
}
func (s *exitSystem) FDSeek(ctx context.Context, fd FD, offset FileDelta, whence Whence) (FileSize, Errno) {
panic(s.newExitError())
}
func (s *exitSystem) FDSync(ctx context.Context, fd FD) Errno {
panic(s.newExitError())
}
func (s *exitSystem) FDTell(ctx context.Context, fd FD) (FileSize, Errno) {
panic(s.newExitError())
}
func (s *exitSystem) FDWrite(ctx context.Context, fd FD, iovecs []IOVec) (Size, Errno) {
panic(s.newExitError())
}
func (s *exitSystem) PathCreateDirectory(ctx context.Context, fd FD, path string) Errno {
panic(s.newExitError())
}
func (s *exitSystem) PathFileStatGet(ctx context.Context, fd FD, lookupFlags LookupFlags, path string) (FileStat, Errno) {
panic(s.newExitError())
}
func (s *exitSystem) PathFileStatSetTimes(ctx context.Context, fd FD, lookupFlags LookupFlags, path string, accessTime, modifyTime Timestamp, flags FSTFlags) Errno {
panic(s.newExitError())
}
func (s *exitSystem) PathLink(ctx context.Context, oldFD FD, oldFlags LookupFlags, oldPath string, newFD FD, newPath string) Errno {
panic(s.newExitError())
}
func (s *exitSystem) PathOpen(ctx context.Context, fd FD, dirFlags LookupFlags, path string, openFlags OpenFlags, rightsBase, rightsInheriting Rights, fdFlags FDFlags) (FD, Errno) {
panic(s.newExitError())
}
func (s *exitSystem) PathReadLink(ctx context.Context, fd FD, path string, buffer []byte) (int, Errno) {
panic(s.newExitError())
}
func (s *exitSystem) PathRemoveDirectory(ctx context.Context, fd FD, path string) Errno {
panic(s.newExitError())
}
func (s *exitSystem) PathRename(ctx context.Context, fd FD, oldPath string, newFD FD, newPath string) Errno {
panic(s.newExitError())
}
func (s *exitSystem) PathSymlink(ctx context.Context, oldPath string, fd FD, newPath string) Errno {
panic(s.newExitError())
}
func (s *exitSystem) PathUnlinkFile(ctx context.Context, fd FD, path string) Errno {
panic(s.newExitError())
}
func (s *exitSystem) PollOneOff(ctx context.Context, subscriptions []Subscription, events []Event) (int, Errno) {
panic(s.newExitError())
}
func (s *exitSystem) ProcExit(ctx context.Context, exitCode ExitCode) Errno {
panic(s.newExitError())
}
func (s *exitSystem) ProcRaise(ctx context.Context, signal Signal) Errno {
panic(s.newExitError())
}
func (s *exitSystem) SchedYield(ctx context.Context) Errno {
panic(s.newExitError())
}
func (s *exitSystem) RandomGet(ctx context.Context, b []byte) Errno {
panic(s.newExitError())
}
func (s *exitSystem) SockAccept(ctx context.Context, fd FD, flags FDFlags) (FD, SocketAddress, SocketAddress, Errno) {
panic(s.newExitError())
}
func (s *exitSystem) SockRecv(ctx context.Context, fd FD, iovecs []IOVec, iflags RIFlags) (Size, ROFlags, Errno) {
panic(s.newExitError())
}
func (s *exitSystem) SockSend(ctx context.Context, fd FD, iovecs []IOVec, flags SIFlags) (Size, Errno) {
panic(s.newExitError())
}
func (s *exitSystem) SockShutdown(ctx context.Context, fd FD, flags SDFlags) Errno {
panic(s.newExitError())
}
func (s *exitSystem) SockOpen(ctx context.Context, family ProtocolFamily, socketType SocketType, protocol Protocol, rightsBase, rightsInheriting Rights) (newfd FD, errno Errno) {
panic(s.newExitError())
}
func (s *exitSystem) SockBind(ctx context.Context, fd FD, bind SocketAddress) (addr SocketAddress, errno Errno) {
panic(s.newExitError())
}
func (s *exitSystem) SockConnect(ctx context.Context, fd FD, peer SocketAddress) (addr SocketAddress, errno Errno) {
panic(s.newExitError())
}
func (s *exitSystem) SockListen(ctx context.Context, fd FD, backlog int) (errno Errno) {
panic(s.newExitError())
}
func (s *exitSystem) SockSendTo(ctx context.Context, fd FD, iovecs []IOVec, flags SIFlags, addr SocketAddress) (size Size, errno Errno) {
panic(s.newExitError())
}
func (s *exitSystem) SockRecvFrom(ctx context.Context, fd FD, iovecs []IOVec, flags RIFlags) (size Size, oflags ROFlags, addr SocketAddress, errno Errno) {
panic(s.newExitError())
}
func (s *exitSystem) SockGetOpt(ctx context.Context, fd FD, option SocketOption) (value SocketOptionValue, errno Errno) {
panic(s.newExitError())
}
func (s *exitSystem) SockSetOpt(ctx context.Context, fd FD, option SocketOption, value SocketOptionValue) (errno Errno) {
panic(s.newExitError())
}
func (s *exitSystem) SockLocalAddress(ctx context.Context, fd FD) (addr SocketAddress, errno Errno) {
panic(s.newExitError())
}
func (s *exitSystem) SockRemoteAddress(ctx context.Context, fd FD) (addr SocketAddress, errno Errno) {
panic(s.newExitError())
}
func (s *exitSystem) SockAddressInfo(ctx context.Context, name, service string, hints AddressInfo, results []AddressInfo) (int, Errno) {
panic(s.newExitError())
}
func (s *exitSystem) Close(ctx context.Context) error {
return nil
}