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 6
/
errno.go
246 lines (184 loc) · 7.21 KB
/
errno.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
package wasicall
import (
"context"
. "github.com/stealthrocket/wasi-go"
)
// NewErrnoSystem creates a wasi.System that returns an errno for all calls.
func NewErrnoSystem(errno Errno) System {
return errnoSystem(errno)
}
type errnoSystem Errno
func (e errnoSystem) ArgsSizesGet(ctx context.Context) (argCount int, stringBytes int, errno Errno) {
return 0, 0, Errno(e)
}
func (e errnoSystem) ArgsGet(ctx context.Context) ([]string, Errno) {
return nil, Errno(e)
}
func (e errnoSystem) EnvironSizesGet(ctx context.Context) (argCount int, stringBytes int, errno Errno) {
return 0, 0, Errno(e)
}
func (e errnoSystem) EnvironGet(ctx context.Context) ([]string, Errno) {
return nil, Errno(e)
}
func (e errnoSystem) ClockResGet(ctx context.Context, id ClockID) (Timestamp, Errno) {
return 0, Errno(e)
}
func (e errnoSystem) ClockTimeGet(ctx context.Context, id ClockID, precision Timestamp) (Timestamp, Errno) {
return 0, Errno(e)
}
func (e errnoSystem) FDAdvise(ctx context.Context, fd FD, offset FileSize, length FileSize, advice Advice) Errno {
return Errno(e)
}
func (e errnoSystem) FDAllocate(ctx context.Context, fd FD, offset FileSize, length FileSize) Errno {
return Errno(e)
}
func (e errnoSystem) FDClose(ctx context.Context, fd FD) Errno {
return Errno(e)
}
func (e errnoSystem) FDDataSync(ctx context.Context, fd FD) Errno {
return Errno(e)
}
func (e errnoSystem) FDStatGet(ctx context.Context, fd FD) (FDStat, Errno) {
return FDStat{}, Errno(e)
}
func (e errnoSystem) FDStatSetFlags(ctx context.Context, fd FD, flags FDFlags) Errno {
return Errno(e)
}
func (e errnoSystem) FDStatSetRights(ctx context.Context, fd FD, rightsBase, rightsInheriting Rights) Errno {
return Errno(e)
}
func (e errnoSystem) FDFileStatGet(ctx context.Context, fd FD) (FileStat, Errno) {
return FileStat{}, Errno(e)
}
func (e errnoSystem) FDFileStatSetSize(ctx context.Context, fd FD, size FileSize) Errno {
return Errno(e)
}
func (e errnoSystem) FDFileStatSetTimes(ctx context.Context, fd FD, accessTime, modifyTime Timestamp, flags FSTFlags) Errno {
return Errno(e)
}
func (e errnoSystem) FDPread(ctx context.Context, fd FD, iovecs []IOVec, offset FileSize) (Size, Errno) {
return 0, Errno(e)
}
func (e errnoSystem) FDPreStatGet(ctx context.Context, fd FD) (PreStat, Errno) {
return PreStat{}, Errno(e)
}
func (e errnoSystem) FDPreStatDirName(ctx context.Context, fd FD) (string, Errno) {
return "", Errno(e)
}
func (e errnoSystem) FDPwrite(ctx context.Context, fd FD, iovecs []IOVec, offset FileSize) (Size, Errno) {
return 0, Errno(e)
}
func (e errnoSystem) FDRead(ctx context.Context, fd FD, iovecs []IOVec) (Size, Errno) {
return 0, Errno(e)
}
func (e errnoSystem) FDReadDir(ctx context.Context, fd FD, entries []DirEntry, cookie DirCookie, bufferSizeBytes int) (int, Errno) {
return 0, Errno(e)
}
func (e errnoSystem) FDRenumber(ctx context.Context, from, to FD) Errno {
return Errno(e)
}
func (e errnoSystem) FDSeek(ctx context.Context, fd FD, offset FileDelta, whence Whence) (FileSize, Errno) {
return 0, Errno(e)
}
func (e errnoSystem) FDSync(ctx context.Context, fd FD) Errno {
return Errno(e)
}
func (e errnoSystem) FDTell(ctx context.Context, fd FD) (FileSize, Errno) {
return 0, Errno(e)
}
func (e errnoSystem) FDWrite(ctx context.Context, fd FD, iovecs []IOVec) (Size, Errno) {
return 0, Errno(e)
}
func (e errnoSystem) PathCreateDirectory(ctx context.Context, fd FD, path string) Errno {
return Errno(e)
}
func (e errnoSystem) PathFileStatGet(ctx context.Context, fd FD, lookupFlags LookupFlags, path string) (FileStat, Errno) {
return FileStat{}, Errno(e)
}
func (e errnoSystem) PathFileStatSetTimes(ctx context.Context, fd FD, lookupFlags LookupFlags, path string, accessTime, modifyTime Timestamp, flags FSTFlags) Errno {
return Errno(e)
}
func (e errnoSystem) PathLink(ctx context.Context, oldFD FD, oldFlags LookupFlags, oldPath string, newFD FD, newPath string) Errno {
return Errno(e)
}
func (e errnoSystem) PathOpen(ctx context.Context, fd FD, dirFlags LookupFlags, path string, openFlags OpenFlags, rightsBase, rightsInheriting Rights, fdFlags FDFlags) (FD, Errno) {
return -1, Errno(e)
}
func (e errnoSystem) PathReadLink(ctx context.Context, fd FD, path string, buffer []byte) (int, Errno) {
return 0, Errno(e)
}
func (e errnoSystem) PathRemoveDirectory(ctx context.Context, fd FD, path string) Errno {
return Errno(e)
}
func (e errnoSystem) PathRename(ctx context.Context, fd FD, oldPath string, newFD FD, newPath string) Errno {
return Errno(e)
}
func (e errnoSystem) PathSymlink(ctx context.Context, oldPath string, fd FD, newPath string) Errno {
return Errno(e)
}
func (e errnoSystem) PathUnlinkFile(ctx context.Context, fd FD, path string) Errno {
return Errno(e)
}
func (e errnoSystem) PollOneOff(ctx context.Context, subscriptions []Subscription, events []Event) (int, Errno) {
return 0, Errno(e)
}
func (e errnoSystem) ProcExit(ctx context.Context, exitCode ExitCode) Errno {
return Errno(e)
}
func (e errnoSystem) ProcRaise(ctx context.Context, signal Signal) Errno {
return Errno(e)
}
func (e errnoSystem) SchedYield(ctx context.Context) Errno {
return Errno(e)
}
func (e errnoSystem) RandomGet(ctx context.Context, b []byte) Errno {
return Errno(e)
}
func (e errnoSystem) SockAccept(ctx context.Context, fd FD, flags FDFlags) (FD, SocketAddress, SocketAddress, Errno) {
return -1, nil, nil, Errno(e)
}
func (e errnoSystem) SockRecv(ctx context.Context, fd FD, iovecs []IOVec, flags RIFlags) (Size, ROFlags, Errno) {
return 0, 0, Errno(e)
}
func (e errnoSystem) SockSend(ctx context.Context, fd FD, iovecs []IOVec, flags SIFlags) (Size, Errno) {
return 0, Errno(e)
}
func (e errnoSystem) SockShutdown(ctx context.Context, fd FD, flags SDFlags) Errno {
return Errno(e)
}
func (e errnoSystem) SockOpen(ctx context.Context, family ProtocolFamily, socketType SocketType, protocol Protocol, rightsBase, rightsInheriting Rights) (FD, Errno) {
return -1, Errno(e)
}
func (e errnoSystem) SockBind(ctx context.Context, fd FD, addr SocketAddress) (SocketAddress, Errno) {
return nil, Errno(e)
}
func (e errnoSystem) SockConnect(ctx context.Context, fd FD, addr SocketAddress) (SocketAddress, Errno) {
return nil, Errno(e)
}
func (e errnoSystem) SockListen(ctx context.Context, fd FD, backlog int) Errno {
return Errno(e)
}
func (e errnoSystem) SockSendTo(ctx context.Context, fd FD, iovecs []IOVec, flags SIFlags, addr SocketAddress) (Size, Errno) {
return 0, Errno(e)
}
func (e errnoSystem) SockRecvFrom(ctx context.Context, fd FD, iovecs []IOVec, flags RIFlags) (Size, ROFlags, SocketAddress, Errno) {
return 0, 0, nil, Errno(e)
}
func (e errnoSystem) SockGetOpt(ctx context.Context, fd FD, option SocketOption) (SocketOptionValue, Errno) {
return nil, Errno(e)
}
func (e errnoSystem) SockSetOpt(ctx context.Context, fd FD, option SocketOption, value SocketOptionValue) Errno {
return Errno(e)
}
func (e errnoSystem) SockLocalAddress(ctx context.Context, fd FD) (SocketAddress, Errno) {
return nil, Errno(e)
}
func (e errnoSystem) SockRemoteAddress(ctx context.Context, fd FD) (SocketAddress, Errno) {
return nil, Errno(e)
}
func (e errnoSystem) SockAddressInfo(ctx context.Context, name, service string, hints AddressInfo, results []AddressInfo) (int, Errno) {
return 0, Errno(e)
}
func (e errnoSystem) Close(ctx context.Context) error {
return nil
}