kobako 0.29.0 → 0.30.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.
Files changed (201) hide show
  1. checksums.yaml +4 -4
  2. data/.release-please-manifest.json +1 -1
  3. data/CHANGELOG.md +217 -10
  4. data/Cargo.lock +139 -141
  5. data/README.md +96 -574
  6. data/ROADMAP.md +2 -1
  7. data/crates/kobako-runtime/CHANGELOG.md +269 -1
  8. data/crates/kobako-runtime/Cargo.toml +25 -15
  9. data/crates/kobako-runtime/README.md +7 -3
  10. data/crates/kobako-runtime/src/dispatch.rs +1 -1
  11. data/crates/kobako-runtime/src/endpoint/buffer.rs +192 -0
  12. data/crates/kobako-runtime/src/endpoint/capture.rs +115 -0
  13. data/crates/kobako-runtime/src/endpoint/dispatch.rs +253 -0
  14. data/crates/kobako-runtime/src/endpoint/invoke.rs +194 -0
  15. data/crates/kobako-runtime/src/endpoint/memory_cap.rs +238 -0
  16. data/crates/kobako-runtime/src/endpoint.rs +166 -0
  17. data/crates/kobako-runtime/src/filesystem/bind/fid.rs +82 -0
  18. data/crates/kobako-runtime/src/filesystem/{directory/spelling.rs → bind/lookup.rs} +91 -49
  19. data/crates/kobako-runtime/src/filesystem/bind/walk.rs +249 -0
  20. data/crates/kobako-runtime/src/filesystem/bind.rs +2665 -0
  21. data/crates/kobako-runtime/src/filesystem/overlay/file.rs +89 -0
  22. data/crates/kobako-runtime/src/filesystem/overlay/inode.rs +106 -0
  23. data/crates/kobako-runtime/src/filesystem/overlay/path.rs +285 -0
  24. data/crates/kobako-runtime/src/filesystem/overlay/stack/copy_up.rs +135 -0
  25. data/crates/kobako-runtime/src/filesystem/overlay/stack/dir.rs +263 -0
  26. data/crates/kobako-runtime/src/filesystem/overlay/stack/namei.rs +135 -0
  27. data/crates/kobako-runtime/src/filesystem/overlay/stack/readdir.rs +57 -0
  28. data/crates/kobako-runtime/src/filesystem/overlay/stack.rs +227 -734
  29. data/crates/kobako-runtime/src/filesystem/overlay.rs +2649 -1135
  30. data/crates/kobako-runtime/src/filesystem/path.rs +2 -41
  31. data/crates/kobako-runtime/src/filesystem/pipe.rs +221 -0
  32. data/crates/kobako-runtime/src/filesystem/rdir.rs +101 -0
  33. data/crates/kobako-runtime/src/filesystem/tmpfs/tmpfile.rs +32 -0
  34. data/crates/kobako-runtime/src/filesystem/tmpfs/whiteout.rs +85 -0
  35. data/crates/kobako-runtime/src/filesystem/tmpfs/xattr.rs +22 -0
  36. data/crates/kobako-runtime/src/filesystem/tmpfs.rs +1985 -0
  37. data/crates/kobako-runtime/src/filesystem/wrap.rs +224 -0
  38. data/crates/kobako-runtime/src/filesystem.rs +21 -387
  39. data/crates/kobako-runtime/src/hashtable.rs +44 -0
  40. data/crates/kobako-runtime/src/lib.rs +11 -6
  41. data/crates/kobako-runtime/src/locking/seqlock.rs +66 -0
  42. data/crates/kobako-runtime/src/locking.rs +218 -0
  43. data/crates/kobako-runtime/src/mount.rs +31 -104
  44. data/crates/kobako-runtime/src/profile.rs +137 -1
  45. data/crates/kobako-runtime/src/sched.rs +210 -0
  46. data/crates/kobako-runtime/src/security.rs +696 -0
  47. data/crates/kobako-runtime/src/vfs/attr.rs +162 -0
  48. data/crates/kobako-runtime/src/vfs/cred.rs +334 -0
  49. data/crates/kobako-runtime/src/vfs/dentry.rs +1412 -0
  50. data/crates/kobako-runtime/src/vfs/errno.rs +153 -0
  51. data/crates/kobako-runtime/src/vfs/file.rs +1915 -0
  52. data/crates/kobako-runtime/src/vfs/inode.rs +429 -0
  53. data/crates/kobako-runtime/src/vfs/kern_path.rs +217 -0
  54. data/crates/kobako-runtime/src/vfs/mount.rs +59 -0
  55. data/crates/kobako-runtime/src/vfs/namei.rs +5708 -0
  56. data/crates/kobako-runtime/src/vfs/openat2.rs +116 -0
  57. data/crates/kobako-runtime/src/vfs/path.rs +64 -0
  58. data/crates/kobako-runtime/src/vfs/readdir.rs +163 -0
  59. data/crates/kobako-runtime/src/vfs/stat.rs +157 -0
  60. data/crates/kobako-runtime/src/vfs/super_block.rs +122 -0
  61. data/crates/kobako-runtime/src/vfs/utimes.rs +289 -0
  62. data/crates/kobako-runtime/src/vfs.rs +60 -0
  63. data/crates/kobako-runtime/tests/linux_baseline/calls.rs +171 -0
  64. data/crates/kobako-runtime/tests/linux_baseline/concurrent.rs +276 -0
  65. data/crates/kobako-runtime/tests/linux_baseline/kobako.rs +323 -0
  66. data/crates/kobako-runtime/tests/linux_baseline/linux-baseline-expected.txt +16 -0
  67. data/crates/kobako-runtime/tests/linux_baseline/linux.rs +449 -0
  68. data/crates/kobako-runtime/tests/linux_baseline/main.rs +611 -0
  69. data/crates/kobako-runtime/tests/linux_baseline/permissions.rs +236 -0
  70. data/crates/kobako-transport/CHANGELOG.md +8 -2
  71. data/crates/kobako-transport/Cargo.toml +3 -3
  72. data/crates/kobako-transport/README.md +6 -5
  73. data/crates/kobako-transport/src/envelope/bytes.rs +33 -25
  74. data/crates/kobako-transport/src/envelope/call.rs +5 -5
  75. data/crates/kobako-transport/src/envelope/compile_reply.rs +2 -2
  76. data/crates/kobako-transport/src/envelope/error_record.rs +3 -3
  77. data/crates/kobako-transport/src/envelope/fault.rs +2 -2
  78. data/crates/kobako-transport/src/envelope/outcome.rs +3 -3
  79. data/crates/kobako-transport/src/envelope/preamble.rs +12 -12
  80. data/crates/kobako-transport/src/envelope/reply.rs +2 -2
  81. data/crates/kobako-transport/src/envelope/request.rs +2 -2
  82. data/crates/kobako-transport/src/envelope/run.rs +1 -1
  83. data/crates/kobako-transport/src/envelope/unsupported.rs +2 -2
  84. data/crates/kobako-transport/src/envelope.rs +2 -2
  85. data/crates/kobako-wasmtime/CHANGELOG.md +154 -8
  86. data/crates/kobako-wasmtime/Cargo.toml +15 -14
  87. data/crates/kobako-wasmtime/README.md +9 -5
  88. data/crates/kobako-wasmtime/src/abi.rs +12 -20
  89. data/crates/kobako-wasmtime/src/ambient.rs +1 -2
  90. data/crates/kobako-wasmtime/src/cache.rs +5 -5
  91. data/crates/kobako-wasmtime/src/config.rs +22 -7
  92. data/crates/kobako-wasmtime/src/descriptors.rs +133 -100
  93. data/crates/kobako-wasmtime/src/driver.rs +29 -96
  94. data/crates/kobako-wasmtime/src/exports.rs +5 -16
  95. data/crates/kobako-wasmtime/src/guest.rs +38 -0
  96. data/crates/kobako-wasmtime/src/imports.rs +14 -8
  97. data/crates/kobako-wasmtime/src/instance_pre.rs +3 -3
  98. data/crates/kobako-wasmtime/src/invocation.rs +26 -46
  99. data/crates/kobako-wasmtime/src/lib.rs +1 -4
  100. data/crates/kobako-wasmtime/src/limiter.rs +6 -230
  101. data/crates/kobako-wasmtime/src/preview1/differential/mount.rs +69 -46
  102. data/crates/kobako-wasmtime/src/preview1/differential.rs +121 -7
  103. data/crates/kobako-wasmtime/src/preview1/errno.rs +74 -206
  104. data/crates/kobako-wasmtime/src/preview1/fd.rs +1248 -500
  105. data/crates/kobako-wasmtime/src/preview1/memory.rs +117 -150
  106. data/crates/kobako-wasmtime/src/preview1/mount_view/wrap.rs +211 -0
  107. data/crates/kobako-wasmtime/src/preview1/mount_view.rs +1939 -672
  108. data/crates/kobako-wasmtime/src/preview1/path.rs +230 -349
  109. data/crates/kobako-wasmtime/src/preview1/poll.rs +148 -100
  110. data/crates/kobako-wasmtime/src/preview1/sock.rs +6 -23
  111. data/crates/kobako-wasmtime/src/preview1/testsuite-expected.txt +6 -0
  112. data/crates/kobako-wasmtime/src/preview1/testsuite.rs +157 -0
  113. data/crates/kobako-wasmtime/src/preview1.rs +464 -413
  114. data/crates/kobako-wasmtime/src/trap.rs +9 -9
  115. data/crates/kobako-wasmtime/src/wasi.rs +53 -37
  116. data/crates/kobako-wasmtime/tests/{guest_file.rs → integration/guest_file.rs} +232 -201
  117. data/crates/kobako-wasmtime/tests/integration/main.rs +29 -0
  118. data/crates/kobako-wasmtime/tests/{preamble_flags.rs → integration/preamble_flags.rs} +1 -1
  119. data/crates/kobako-wasmtime/tests/{snippet_compile.rs → integration/snippet_compile.rs} +1 -1
  120. data/crates/kobako-wasmtime/tests/{unanswered_call.rs → integration/unanswered_call.rs} +1 -1
  121. data/crates/kobako-wasmtime/tests/{unsupported_call.rs → integration/unsupported_call.rs} +1 -1
  122. data/crates/kobako-wasmtime/witx/typenames.witx +750 -0
  123. data/crates/kobako-wasmtime/witx/wasi_snapshot_preview1.witx +441 -0
  124. data/data/kobako.wasm +0 -0
  125. data/ext/kobako/Cargo.toml +1 -1
  126. data/ext/kobako/src/runtime/bridge.rs +1 -1
  127. data/ext/kobako/src/runtime/errors.rs +1 -1
  128. data/ext/kobako/src/runtime/escape.rs +28 -14
  129. data/ext/kobako/src/runtime/filesystem/grants.rs +21 -5
  130. data/ext/kobako/src/runtime/filesystem/ruby.rs +464 -156
  131. data/ext/kobako/src/runtime/filesystem.rs +109 -137
  132. data/ext/kobako/src/runtime/gvl.rs +43 -8
  133. data/ext/kobako/src/runtime/snapshot.rs +1 -1
  134. data/ext/kobako/src/runtime.rs +6 -1
  135. data/lib/kobako/catalog/extensions.rb +5 -5
  136. data/lib/kobako/catalog/flags.rb +2 -2
  137. data/lib/kobako/catalog/handles.rb +6 -6
  138. data/lib/kobako/catalog/mount.rb +2 -10
  139. data/lib/kobako/catalog/services.rb +2 -2
  140. data/lib/kobako/catalog/snippets.rb +7 -7
  141. data/lib/kobako/catalog.rb +1 -1
  142. data/lib/kobako/codec/decoder.rb +10 -10
  143. data/lib/kobako/codec/ext_types.rb +3 -5
  144. data/lib/kobako/codec/handle_walk.rb +4 -6
  145. data/lib/kobako/codec/nesting.rb +7 -7
  146. data/lib/kobako/codec/utils.rb +1 -1
  147. data/lib/kobako/codec/value_budget.rb +3 -3
  148. data/lib/kobako/context.rb +5 -5
  149. data/lib/kobako/filesystem.rb +44 -13
  150. data/lib/kobako/payload/arguments.rb +2 -2
  151. data/lib/kobako/pool.rb +4 -4
  152. data/lib/kobako/sandbox.rb +28 -28
  153. data/lib/kobako/sandbox_options.rb +2 -3
  154. data/lib/kobako/snippet/bytecode.rb +1 -1
  155. data/lib/kobako/snippet/source.rb +1 -1
  156. data/lib/kobako/transport/dispatcher.rb +5 -5
  157. data/lib/kobako/transport/exposure.rb +2 -2
  158. data/lib/kobako/transport/reflection.rb +7 -7
  159. data/lib/kobako/transport/run.rb +5 -5
  160. data/lib/kobako/transport/yielder.rb +1 -1
  161. data/lib/kobako/version.rb +1 -1
  162. data/lib/kobako.rb +34 -0
  163. data/release-please-config.json +1 -0
  164. data/sig/kobako/catalog/extensions.rbs +3 -3
  165. data/sig/kobako/catalog/handles.rbs +3 -3
  166. data/sig/kobako/catalog/mount.rbs +0 -4
  167. data/sig/kobako/catalog/services.rbs +1 -1
  168. data/sig/kobako/catalog/snippets.rbs +3 -3
  169. data/sig/kobako/catalog.rbs +1 -1
  170. data/sig/kobako/codec/decoder.rbs +1 -1
  171. data/sig/kobako/codec/handle_walk.rbs +1 -1
  172. data/sig/kobako/codec/nesting.rbs +2 -2
  173. data/sig/kobako/codec/utils.rbs +1 -1
  174. data/sig/kobako/codec/value_budget.rbs +1 -1
  175. data/sig/kobako/codec.rbs +1 -2
  176. data/sig/kobako/context.rbs +1 -1
  177. data/sig/kobako/filesystem.rbs +19 -14
  178. data/sig/kobako/guest_yielder.rbs +1 -1
  179. data/sig/kobako/payload/arguments.rbs +1 -1
  180. data/sig/kobako/pool.rbs +2 -2
  181. data/sig/kobako/runtime.rbs +1 -1
  182. data/sig/kobako/sandbox.rbs +3 -5
  183. data/sig/kobako/sandbox_options.rbs +1 -1
  184. data/sig/kobako/transport/dispatcher.rbs +2 -2
  185. data/sig/kobako/transport/exposure.rbs +1 -1
  186. data/sig/kobako/transport/reflection.rbs +2 -2
  187. data/sig/kobako/transport/run.rbs +3 -3
  188. data/sig/kobako/transport.rbs +1 -1
  189. metadata +67 -19
  190. data/crates/kobako-runtime/src/filesystem/directory.rs +0 -1082
  191. data/crates/kobako-runtime/src/filesystem/memory.rs +0 -1100
  192. data/crates/kobako-runtime/src/filesystem/overlay/exclusive.rs +0 -88
  193. data/crates/kobako-runtime/src/filesystem/temporary.rs +0 -167
  194. data/crates/kobako-wasmtime/src/capture.rs +0 -96
  195. data/crates/kobako-wasmtime/src/dispatch.rs +0 -125
  196. data/crates/kobako-wasmtime/src/guest_mem.rs +0 -271
  197. data/crates/kobako-wasmtime/src/io.rs +0 -89
  198. data/crates/kobako-wasmtime/src/preview1/args.rs +0 -60
  199. data/crates/kobako-wasmtime/src/preview1/beneath.rs +0 -188
  200. /data/crates/kobako-wasmtime/tests/{compile_posture.rs → integration/compile_posture.rs} +0 -0
  201. /data/crates/kobako-wasmtime/tests/{support → integration/support}/mod.rs +0 -0
@@ -6,10 +6,10 @@
6
6
  //! a descriptor keeps the guest on one table, `crate::descriptors`, where
7
7
  //! each Mount is a preopen. The other ten imports — arguments,
8
8
  //! environment, clocks, process, scheduling, and randomness — stay
9
- //! wasmtime-wasi's.
9
+ //! wasmtime-wasi's, so `witx/` declares only these 36. wiggle generates their
10
+ //! glue as it generates wasmtime-wasi's, so a value outside what the witx
11
+ //! defines traps there before a call starts.
10
12
 
11
- mod args;
12
- mod beneath;
13
13
  mod errno;
14
14
  mod fd;
15
15
  mod memory;
@@ -21,441 +21,492 @@ mod sock;
21
21
  mod differential;
22
22
  #[cfg(test)]
23
23
  mod mount_view;
24
+ #[cfg(test)]
25
+ mod testsuite;
24
26
 
25
- use wasmtime::{Caller, Extern, Linker};
27
+ use wasmtime::Linker;
28
+ use wiggle::GuestPtr;
26
29
 
27
30
  use crate::descriptors::Descriptors;
28
31
  use crate::invocation::Invocation;
29
- use errno::{Answer, Failure};
32
+ use errno::Answer;
30
33
  use memory::GuestMemory;
31
- use path::OpenFlags;
32
-
33
- const MODULE: &str = "wasi_snapshot_preview1";
34
-
35
- /// Run one call against the calling instance's memory and invocation,
36
- /// answering its `errno`, or the trap that ends the invocation.
37
- fn answer(
38
- caller: &mut Caller<'_, Invocation>,
39
- call: impl FnOnce(&mut GuestMemory, &mut Invocation) -> Answer,
40
- ) -> wasmtime::Result<i32> {
41
- let memory = caller
42
- .get_export("memory")
43
- .and_then(Extern::into_memory)
44
- .ok_or_else(|| wasmtime::Error::msg("a preview1 call needs the guest's `memory` export"))?;
45
- let (bytes, invocation) = memory.data_and_store_mut(caller);
46
- let answer = call(&mut GuestMemory::new(bytes), invocation);
47
- if let Some(trap) = invocation.abandonment() {
48
- return Err(trap);
49
- }
50
- match answer {
51
- Ok(()) => Ok(0),
52
- Err(Failure::Errno(errno)) => Ok(errno as i32),
53
- Err(Failure::Trap(trap)) => Err(trap),
34
+
35
+ // wiggle gives each generated call one parameter per witx argument, and no
36
+ // generated signature can be shrunk to fit the lint.
37
+ #[allow(clippy::too_many_arguments)]
38
+ mod witx {
39
+ wiggle::from_witx!({
40
+ witx: ["witx/wasi_snapshot_preview1.witx"],
41
+ tracing: false,
42
+ errors: { errno => trappable Error },
43
+ });
44
+
45
+ pub(super) mod glue {
46
+ wiggle::wasmtime_integration!({
47
+ witx: ["witx/wasi_snapshot_preview1.witx"],
48
+ target: super,
49
+ tracing: false,
50
+ errors: { errno => trappable Error },
51
+ });
54
52
  }
55
53
  }
56
54
 
57
- fn table(invocation: &mut Invocation) -> &mut Descriptors {
58
- invocation.wasi_mut().descriptors_mut()
55
+ use witx::{types, wasi_snapshot_preview1};
56
+
57
+ impl wiggle::GuestErrorType for types::Errno {
58
+ fn success() -> Self {
59
+ Self::Success
60
+ }
59
61
  }
60
62
 
61
63
  /// Define kobako's answers over wasmtime-wasi's for the same names.
62
64
  pub(crate) fn shadow(linker: &mut Linker<Invocation>) -> wasmtime::Result<()> {
63
65
  linker.allow_shadowing(true);
64
- shadow_fd(linker)?;
65
- shadow_path(linker)?;
66
- shadow_poll_and_sock(linker)?;
66
+ witx::glue::add_wasi_snapshot_preview1_to_linker(linker, |invocation: &mut Invocation| {
67
+ invocation
68
+ })?;
67
69
  linker.allow_shadowing(false);
68
70
  Ok(())
69
71
  }
70
72
 
71
- fn shadow_fd(linker: &mut Linker<Invocation>) -> wasmtime::Result<()> {
72
- type C<'a> = Caller<'a, Invocation>;
73
- linker.func_wrap(
74
- MODULE,
75
- "fd_advise",
76
- |mut c: C, fd: i32, offset: i64, len: i64, advice: i32| {
77
- answer(&mut c, |_, inv| {
78
- fd::advise(
79
- table(inv),
80
- fd as u32,
81
- offset as u64,
82
- len as u64,
83
- advice as u32,
84
- )
85
- })
86
- },
87
- )?;
88
- linker.func_wrap(
89
- MODULE,
90
- "fd_allocate",
91
- |mut c: C, fd: i32, _: i64, _: i64| {
92
- answer(&mut c, |_, inv| fd::allocate(table(inv), fd as u32))
93
- },
94
- )?;
95
- linker.func_wrap(MODULE, "fd_close", |mut c: C, fd: i32| {
96
- answer(&mut c, |_, inv| fd::close(table(inv), fd as u32))
97
- })?;
98
- // A Filesystem makes what was written durable in one step, so data
99
- // and metadata sync alike.
100
- for name in ["fd_datasync", "fd_sync"] {
101
- linker.func_wrap(MODULE, name, |mut c: C, fd: i32| {
102
- answer(&mut c, |_, inv| fd::sync(table(inv), fd as u32))
103
- })?;
104
- }
105
- linker.func_wrap(MODULE, "fd_fdstat_get", |mut c: C, fd: i32, out: i32| {
106
- answer(&mut c, |mem, inv| {
107
- fd::fdstat_get(table(inv), mem, fd as u32, out as u32)
73
+ fn table(invocation: &mut Invocation) -> &mut Descriptors {
74
+ invocation.wasi_mut().descriptors_mut()
75
+ }
76
+
77
+ impl Invocation {
78
+ /// Run one call against the calling instance's memory, answering what it
79
+ /// answers unless its host has given the invocation up by then.
80
+ fn answer<T>(
81
+ &mut self,
82
+ memory: &mut wiggle::GuestMemory<'_>,
83
+ call: impl FnOnce(&mut GuestMemory<'_, '_>, &mut Invocation) -> Answer<T>,
84
+ ) -> Answer<T> {
85
+ let fuel = self.hostcall_fuel();
86
+ let answer = call(&mut GuestMemory::new(memory, fuel), self);
87
+ match self.abandonment() {
88
+ Some(trap) => Err(types::Error::trap(trap)),
89
+ None => answer,
90
+ }
91
+ }
92
+ }
93
+
94
+ impl wasi_snapshot_preview1::WasiSnapshotPreview1 for Invocation {
95
+ fn set_hostcall_fuel(&mut self, fuel: usize) {
96
+ Invocation::set_hostcall_fuel(self, fuel);
97
+ }
98
+
99
+ fn fd_advise(
100
+ &mut self,
101
+ memory: &mut wiggle::GuestMemory<'_>,
102
+ fd: types::Fd,
103
+ offset: types::Filesize,
104
+ len: types::Filesize,
105
+ _advice: types::Advice,
106
+ ) -> Answer {
107
+ self.answer(memory, |_, inv| {
108
+ fd::advise(table(inv), fd.into(), offset, len)
108
109
  })
109
- })?;
110
- linker.func_wrap(
111
- MODULE,
112
- "fd_fdstat_set_flags",
113
- |mut c: C, fd: i32, flags: i32| {
114
- answer(&mut c, |_, inv| {
115
- fd::fdstat_set_flags(table(inv), fd as u32, flags as u32)
116
- })
117
- },
118
- )?;
119
- linker.func_wrap(
120
- MODULE,
121
- "fd_fdstat_set_rights",
122
- |mut c: C, fd: i32, base: i64, inheriting: i64| {
123
- answer(&mut c, |_, inv| {
124
- fd::fdstat_set_rights(table(inv), fd as u32, base as u64, inheriting as u64)
125
- })
126
- },
127
- )?;
128
- linker.func_wrap(MODULE, "fd_filestat_get", |mut c: C, fd: i32, out: i32| {
129
- answer(&mut c, |mem, inv| {
130
- fd::filestat_get(table(inv), mem, fd as u32, out as u32)
110
+ }
111
+
112
+ fn fd_allocate(
113
+ &mut self,
114
+ memory: &mut wiggle::GuestMemory<'_>,
115
+ fd: types::Fd,
116
+ offset: types::Filesize,
117
+ len: types::Filesize,
118
+ ) -> Answer {
119
+ self.answer(memory, |_, inv| {
120
+ fd::allocate(table(inv), fd.into(), offset, len)
131
121
  })
132
- })?;
133
- linker.func_wrap(
134
- MODULE,
135
- "fd_filestat_set_size",
136
- |mut c: C, fd: i32, size: i64| {
137
- answer(&mut c, |_, inv| {
138
- fd::filestat_set_size(table(inv), fd as u32, size as u64)
139
- })
140
- },
141
- )?;
142
- linker.func_wrap(
143
- MODULE,
144
- "fd_filestat_set_times",
145
- |mut c: C, fd: i32, _: i64, _: i64, fst_flags: i32| {
146
- answer(&mut c, |_, inv| {
147
- fd::filestat_set_times(table(inv), fd as u32, fst_flags as u32)
148
- })
149
- },
150
- )?;
151
- linker.func_wrap(
152
- MODULE,
153
- "fd_pread",
154
- |mut c: C, fd: i32, iovs: i32, iovs_len: i32, offset: i64, nread: i32| {
155
- answer(&mut c, |mem, inv| {
156
- let iovs = (iovs as u32, iovs_len as u32);
157
- fd::pread(
158
- table(inv),
159
- mem,
160
- fd as u32,
161
- iovs,
162
- offset as u64,
163
- nread as u32,
164
- )
165
- })
166
- },
167
- )?;
168
- linker.func_wrap(MODULE, "fd_prestat_get", |mut c: C, fd: i32, out: i32| {
169
- answer(&mut c, |mem, inv| {
170
- fd::prestat_get(table(inv), mem, fd as u32, out as u32)
122
+ }
123
+
124
+ fn fd_close(&mut self, memory: &mut wiggle::GuestMemory<'_>, fd: types::Fd) -> Answer {
125
+ self.answer(memory, |_, inv| fd::close(table(inv), fd.into()))
126
+ }
127
+
128
+ fn fd_datasync(&mut self, memory: &mut wiggle::GuestMemory<'_>, fd: types::Fd) -> Answer {
129
+ self.answer(memory, |_, inv| fd::sync(table(inv), fd.into(), true))
130
+ }
131
+
132
+ fn fd_fdstat_get(
133
+ &mut self,
134
+ memory: &mut wiggle::GuestMemory<'_>,
135
+ fd: types::Fd,
136
+ ) -> Answer<types::Fdstat> {
137
+ self.answer(memory, |_, inv| fd::fdstat_get(table(inv), fd.into()))
138
+ }
139
+
140
+ fn fd_fdstat_set_flags(
141
+ &mut self,
142
+ memory: &mut wiggle::GuestMemory<'_>,
143
+ fd: types::Fd,
144
+ flags: types::Fdflags,
145
+ ) -> Answer {
146
+ self.answer(memory, |_, inv| {
147
+ fd::fdstat_set_flags(table(inv), fd.into(), flags)
171
148
  })
172
- })?;
173
- linker.func_wrap(
174
- MODULE,
175
- "fd_prestat_dir_name",
176
- |mut c: C, fd: i32, path: i32, path_len: i32| {
177
- answer(&mut c, |mem, inv| {
178
- fd::prestat_dir_name(table(inv), mem, fd as u32, path as u32, path_len as u32)
179
- })
180
- },
181
- )?;
182
- linker.func_wrap(
183
- MODULE,
184
- "fd_pwrite",
185
- |mut c: C, fd: i32, ciovs: i32, ciovs_len: i32, offset: i64, nwritten: i32| {
186
- answer(&mut c, |mem, inv| {
187
- let ciovs = (ciovs as u32, ciovs_len as u32);
188
- fd::pwrite(
189
- table(inv),
190
- mem,
191
- fd as u32,
192
- ciovs,
193
- offset as u64,
194
- nwritten as u32,
195
- )
196
- })
197
- },
198
- )?;
199
- linker.func_wrap(
200
- MODULE,
201
- "fd_read",
202
- |mut c: C, fd: i32, iovs: i32, iovs_len: i32, nread: i32| {
203
- answer(&mut c, |mem, inv| {
204
- let iovs = (iovs as u32, iovs_len as u32);
205
- fd::read(table(inv), mem, fd as u32, iovs, nread as u32)
206
- })
207
- },
208
- )?;
209
- linker.func_wrap(
210
- MODULE,
211
- "fd_readdir",
212
- |mut c: C, fd: i32, buf: i32, buf_len: i32, cookie: i64, bufused: i32| {
213
- answer(&mut c, |mem, inv| {
214
- let buf = (buf as u32, buf_len as u32);
215
- fd::readdir(
216
- table(inv),
217
- mem,
218
- fd as u32,
219
- buf,
220
- cookie as u64,
221
- bufused as u32,
222
- )
223
- })
224
- },
225
- )?;
226
- linker.func_wrap(MODULE, "fd_renumber", |mut c: C, from: i32, to: i32| {
227
- answer(&mut c, |_, inv| {
228
- fd::renumber(table(inv), from as u32, to as u32)
149
+ }
150
+
151
+ fn fd_fdstat_set_rights(
152
+ &mut self,
153
+ memory: &mut wiggle::GuestMemory<'_>,
154
+ fd: types::Fd,
155
+ _fs_rights_base: types::Rights,
156
+ _fs_rights_inheriting: types::Rights,
157
+ ) -> Answer {
158
+ self.answer(memory, |_, inv| {
159
+ fd::fdstat_set_rights(table(inv), fd.into())
229
160
  })
230
- })?;
231
- linker.func_wrap(
232
- MODULE,
233
- "fd_seek",
234
- |mut c: C, fd: i32, offset: i64, whence: i32, out: i32| {
235
- answer(&mut c, |mem, inv| {
236
- fd::seek(
237
- table(inv),
238
- mem,
239
- fd as u32,
240
- offset,
241
- whence as u32,
242
- out as u32,
243
- )
244
- })
245
- },
246
- )?;
247
- linker.func_wrap(MODULE, "fd_tell", |mut c: C, fd: i32, out: i32| {
248
- answer(&mut c, |mem, inv| {
249
- fd::tell(table(inv), mem, fd as u32, out as u32)
161
+ }
162
+
163
+ fn fd_filestat_get(
164
+ &mut self,
165
+ memory: &mut wiggle::GuestMemory<'_>,
166
+ fd: types::Fd,
167
+ ) -> Answer<types::Filestat> {
168
+ self.answer(memory, |_, inv| fd::filestat_get(table(inv), fd.into()))
169
+ }
170
+
171
+ fn fd_filestat_set_size(
172
+ &mut self,
173
+ memory: &mut wiggle::GuestMemory<'_>,
174
+ fd: types::Fd,
175
+ size: types::Filesize,
176
+ ) -> Answer {
177
+ self.answer(memory, |_, inv| {
178
+ fd::filestat_set_size(table(inv), fd.into(), size)
250
179
  })
251
- })?;
252
- linker.func_wrap(
253
- MODULE,
254
- "fd_write",
255
- |mut c: C, fd: i32, ciovs: i32, ciovs_len: i32, nwritten: i32| {
256
- answer(&mut c, |mem, inv| {
257
- let ciovs = (ciovs as u32, ciovs_len as u32);
258
- fd::write(table(inv), mem, fd as u32, ciovs, nwritten as u32)
259
- })
260
- },
261
- )?;
262
- Ok(())
263
- }
180
+ }
264
181
 
265
- fn shadow_path(linker: &mut Linker<Invocation>) -> wasmtime::Result<()> {
266
- type C<'a> = Caller<'a, Invocation>;
267
- linker.func_wrap(
268
- MODULE,
269
- "path_create_directory",
270
- |mut c: C, fd: i32, path: i32, len: i32| {
271
- answer(&mut c, |mem, inv| {
272
- path::create_directory(table(inv), mem, fd as u32, (path as u32, len as u32))
273
- })
274
- },
275
- )?;
276
- linker.func_wrap(
277
- MODULE,
278
- "path_filestat_get",
279
- |mut c: C, fd: i32, flags: i32, path: i32, len: i32, out: i32| {
280
- answer(&mut c, |mem, inv| {
281
- let path = (path as u32, len as u32);
282
- path::filestat_get(table(inv), mem, fd as u32, flags as u32, path, out as u32)
283
- })
284
- },
285
- )?;
286
- linker.func_wrap(
287
- MODULE,
288
- "path_filestat_set_times",
289
- |mut c: C, fd: i32, flags: i32, path: i32, len: i32, _: i64, _: i64, fst_flags: i32| {
290
- answer(&mut c, |mem, inv| {
291
- let path = (path as u32, len as u32);
292
- path::filestat_set_times(
293
- table(inv),
294
- mem,
295
- fd as u32,
296
- flags as u32,
297
- path,
298
- fst_flags as u32,
299
- )
300
- })
301
- },
302
- )?;
303
- linker.func_wrap(
304
- MODULE,
305
- "path_link",
306
- |mut c: C,
307
- old_fd: i32,
308
- old_flags: i32,
309
- old_path: i32,
310
- old_len: i32,
311
- new_fd: i32,
312
- new_path: i32,
313
- new_len: i32| {
314
- answer(&mut c, |mem, inv| {
315
- path::link(
316
- table(inv),
317
- mem,
318
- old_fd as u32,
319
- old_flags as u32,
320
- (old_path as u32, old_len as u32),
321
- new_fd as u32,
322
- (new_path as u32, new_len as u32),
323
- )
324
- })
325
- },
326
- )?;
327
- linker.func_wrap(
328
- MODULE,
329
- "path_open",
330
- |mut c: C,
331
- fd: i32,
332
- dirflags: i32,
333
- path: i32,
334
- path_len: i32,
335
- oflags: i32,
336
- rights_base: i64,
337
- rights_inheriting: i64,
338
- fdflags: i32,
339
- out: i32| {
340
- let flags = OpenFlags {
341
- dirflags: dirflags as u32,
342
- oflags: oflags as u32,
343
- rights_base: rights_base as u64,
344
- rights_inheriting: rights_inheriting as u64,
345
- fdflags: fdflags as u32,
346
- };
347
- answer(&mut c, |mem, inv| {
348
- let path = (path as u32, path_len as u32);
349
- path::open(table(inv), mem, fd as u32, path, &flags, out as u32)
350
- })
351
- },
352
- )?;
353
- linker.func_wrap(
354
- MODULE,
355
- "path_readlink",
356
- |mut c: C, fd: i32, path: i32, len: i32, _: i32, _: i32, _: i32| {
357
- answer(&mut c, |mem, inv| {
358
- path::readlink(table(inv), mem, fd as u32, (path as u32, len as u32))
359
- })
360
- },
361
- )?;
362
- linker.func_wrap(
363
- MODULE,
364
- "path_remove_directory",
365
- |mut c: C, fd: i32, path: i32, len: i32| {
366
- answer(&mut c, |mem, inv| {
367
- path::remove_directory(table(inv), mem, fd as u32, (path as u32, len as u32))
368
- })
369
- },
370
- )?;
371
- linker.func_wrap(
372
- MODULE,
373
- "path_rename",
374
- |mut c: C, fd: i32, old: i32, old_len: i32, new_fd: i32, new: i32, new_len: i32| {
375
- answer(&mut c, |mem, inv| {
376
- path::rename(
377
- table(inv),
378
- mem,
379
- (fd as u32, (old as u32, old_len as u32)),
380
- (new_fd as u32, (new as u32, new_len as u32)),
381
- )
382
- })
383
- },
384
- )?;
385
- linker.func_wrap(
386
- MODULE,
387
- "path_symlink",
388
- |mut c: C, old: i32, old_len: i32, fd: i32, new: i32, new_len: i32| {
389
- answer(&mut c, |mem, inv| {
390
- path::symlink(
391
- table(inv),
392
- mem,
393
- (old as u32, old_len as u32),
394
- fd as u32,
395
- (new as u32, new_len as u32),
396
- )
182
+ fn fd_filestat_set_times(
183
+ &mut self,
184
+ memory: &mut wiggle::GuestMemory<'_>,
185
+ fd: types::Fd,
186
+ atim: types::Timestamp,
187
+ mtim: types::Timestamp,
188
+ fst_flags: types::Fstflags,
189
+ ) -> Answer {
190
+ self.answer(memory, |_, inv| {
191
+ fd::utimensat(atim, mtim, fst_flags, |times| {
192
+ fd::filestat_set_times(table(inv), fd.into(), times)
397
193
  })
398
- },
399
- )?;
400
- linker.func_wrap(
401
- MODULE,
402
- "path_unlink_file",
403
- |mut c: C, fd: i32, path: i32, len: i32| {
404
- answer(&mut c, |mem, inv| {
405
- path::unlink_file(table(inv), mem, fd as u32, (path as u32, len as u32))
406
- })
407
- },
408
- )?;
409
- Ok(())
410
- }
194
+ })
195
+ }
411
196
 
412
- fn shadow_poll_and_sock(linker: &mut Linker<Invocation>) -> wasmtime::Result<()> {
413
- type C<'a> = Caller<'a, Invocation>;
414
- linker.func_wrap(
415
- MODULE,
416
- "poll_oneoff",
417
- |mut c: C, subs: i32, events: i32, count: i32, nevents: i32| {
418
- answer(&mut c, |mem, inv| {
419
- poll::poll_oneoff(
420
- inv,
421
- mem,
422
- subs as u32,
423
- events as u32,
424
- count as u32,
425
- nevents as u32,
426
- )
427
- })
428
- },
429
- )?;
430
- linker.func_wrap(
431
- MODULE,
432
- "sock_accept",
433
- |mut c: C, fd: i32, flags: i32, _: i32| {
434
- answer(&mut c, |_, inv| {
435
- sock::accept(table(inv), fd as u32, flags as u32)
436
- })
437
- },
438
- )?;
439
- linker.func_wrap(
440
- MODULE,
441
- "sock_recv",
442
- |mut c: C, fd: i32, _: i32, _: i32, ri_flags: i32, _: i32, _: i32| {
443
- answer(&mut c, |_, inv| {
444
- sock::recv(table(inv), fd as u32, ri_flags as u32)
197
+ fn fd_pread(
198
+ &mut self,
199
+ memory: &mut wiggle::GuestMemory<'_>,
200
+ fd: types::Fd,
201
+ iovs: types::IovecArray,
202
+ offset: types::Filesize,
203
+ ) -> Answer<types::Size> {
204
+ self.answer(memory, |mem, inv| {
205
+ fd::pread(table(inv), mem, fd.into(), iovs, offset)
206
+ })
207
+ }
208
+
209
+ fn fd_prestat_get(
210
+ &mut self,
211
+ memory: &mut wiggle::GuestMemory<'_>,
212
+ fd: types::Fd,
213
+ ) -> Answer<types::Prestat> {
214
+ self.answer(memory, |_, inv| fd::prestat_get(table(inv), fd.into()))
215
+ }
216
+
217
+ fn fd_prestat_dir_name(
218
+ &mut self,
219
+ memory: &mut wiggle::GuestMemory<'_>,
220
+ fd: types::Fd,
221
+ path: GuestPtr<u8>,
222
+ path_max_len: types::Size,
223
+ ) -> Answer {
224
+ self.answer(memory, |mem, inv| {
225
+ fd::prestat_dir_name(table(inv), mem, fd.into(), path, path_max_len)
226
+ })
227
+ }
228
+
229
+ fn fd_pwrite(
230
+ &mut self,
231
+ memory: &mut wiggle::GuestMemory<'_>,
232
+ fd: types::Fd,
233
+ ciovs: types::CiovecArray,
234
+ offset: types::Filesize,
235
+ ) -> Answer<types::Size> {
236
+ self.answer(memory, |mem, inv| {
237
+ fd::pwrite(table(inv), mem, fd.into(), ciovs, offset)
238
+ })
239
+ }
240
+
241
+ fn fd_read(
242
+ &mut self,
243
+ memory: &mut wiggle::GuestMemory<'_>,
244
+ fd: types::Fd,
245
+ iovs: types::IovecArray,
246
+ ) -> Answer<types::Size> {
247
+ self.answer(memory, |mem, inv| {
248
+ fd::read(table(inv), mem, fd.into(), iovs)
249
+ })
250
+ }
251
+
252
+ fn fd_readdir(
253
+ &mut self,
254
+ memory: &mut wiggle::GuestMemory<'_>,
255
+ fd: types::Fd,
256
+ buf: GuestPtr<u8>,
257
+ buf_len: types::Size,
258
+ cookie: types::Dircookie,
259
+ ) -> Answer<types::Size> {
260
+ self.answer(memory, |mem, inv| {
261
+ fd::readdir(table(inv), mem, fd.into(), buf, buf_len, cookie)
262
+ })
263
+ }
264
+
265
+ fn fd_renumber(
266
+ &mut self,
267
+ memory: &mut wiggle::GuestMemory<'_>,
268
+ from: types::Fd,
269
+ to: types::Fd,
270
+ ) -> Answer {
271
+ self.answer(memory, |_, inv| {
272
+ fd::renumber(table(inv), from.into(), to.into())
273
+ })
274
+ }
275
+
276
+ fn fd_seek(
277
+ &mut self,
278
+ memory: &mut wiggle::GuestMemory<'_>,
279
+ fd: types::Fd,
280
+ offset: types::Filedelta,
281
+ whence: types::Whence,
282
+ ) -> Answer<types::Filesize> {
283
+ self.answer(memory, |_, inv| {
284
+ fd::seek(table(inv), fd.into(), offset, whence)
285
+ })
286
+ }
287
+
288
+ fn fd_sync(&mut self, memory: &mut wiggle::GuestMemory<'_>, fd: types::Fd) -> Answer {
289
+ self.answer(memory, |_, inv| fd::sync(table(inv), fd.into(), false))
290
+ }
291
+
292
+ fn fd_tell(
293
+ &mut self,
294
+ memory: &mut wiggle::GuestMemory<'_>,
295
+ fd: types::Fd,
296
+ ) -> Answer<types::Filesize> {
297
+ self.answer(memory, |_, inv| fd::tell(table(inv), fd.into()))
298
+ }
299
+
300
+ fn fd_write(
301
+ &mut self,
302
+ memory: &mut wiggle::GuestMemory<'_>,
303
+ fd: types::Fd,
304
+ ciovs: types::CiovecArray,
305
+ ) -> Answer<types::Size> {
306
+ self.answer(memory, |mem, inv| {
307
+ fd::write(table(inv), mem, fd.into(), ciovs)
308
+ })
309
+ }
310
+
311
+ fn path_create_directory(
312
+ &mut self,
313
+ memory: &mut wiggle::GuestMemory<'_>,
314
+ fd: types::Fd,
315
+ path: GuestPtr<str>,
316
+ ) -> Answer {
317
+ self.answer(memory, |mem, inv| {
318
+ path::create_directory(table(inv), mem, fd.into(), path)
319
+ })
320
+ }
321
+
322
+ fn path_filestat_get(
323
+ &mut self,
324
+ memory: &mut wiggle::GuestMemory<'_>,
325
+ fd: types::Fd,
326
+ flags: types::Lookupflags,
327
+ path: GuestPtr<str>,
328
+ ) -> Answer<types::Filestat> {
329
+ self.answer(memory, |mem, inv| {
330
+ path::filestat_get(table(inv), mem, fd.into(), flags, path)
331
+ })
332
+ }
333
+
334
+ fn path_filestat_set_times(
335
+ &mut self,
336
+ memory: &mut wiggle::GuestMemory<'_>,
337
+ fd: types::Fd,
338
+ flags: types::Lookupflags,
339
+ path: GuestPtr<str>,
340
+ atim: types::Timestamp,
341
+ mtim: types::Timestamp,
342
+ fst_flags: types::Fstflags,
343
+ ) -> Answer {
344
+ self.answer(memory, |mem, inv| {
345
+ fd::utimensat(atim, mtim, fst_flags, |times| {
346
+ path::filestat_set_times(table(inv), mem, fd.into(), flags, path, times)
445
347
  })
446
- },
447
- )?;
448
- linker.func_wrap(
449
- MODULE,
450
- "sock_send",
451
- |mut c: C, fd: i32, _: i32, _: i32, _: i32, _: i32| {
452
- answer(&mut c, |_, inv| sock::send(table(inv), fd as u32))
453
- },
454
- )?;
455
- linker.func_wrap(MODULE, "sock_shutdown", |mut c: C, fd: i32, how: i32| {
456
- answer(&mut c, |_, inv| {
457
- sock::shutdown(table(inv), fd as u32, how as u32)
458
348
  })
459
- })?;
460
- Ok(())
349
+ }
350
+
351
+ fn path_link(
352
+ &mut self,
353
+ memory: &mut wiggle::GuestMemory<'_>,
354
+ old_fd: types::Fd,
355
+ old_flags: types::Lookupflags,
356
+ old_path: GuestPtr<str>,
357
+ new_fd: types::Fd,
358
+ new_path: GuestPtr<str>,
359
+ ) -> Answer {
360
+ self.answer(memory, |mem, inv| {
361
+ path::link(
362
+ table(inv),
363
+ mem,
364
+ (old_fd.into(), old_path),
365
+ (new_fd.into(), new_path),
366
+ old_flags,
367
+ )
368
+ })
369
+ }
370
+
371
+ fn path_open(
372
+ &mut self,
373
+ memory: &mut wiggle::GuestMemory<'_>,
374
+ fd: types::Fd,
375
+ dirflags: types::Lookupflags,
376
+ path: GuestPtr<str>,
377
+ oflags: types::Oflags,
378
+ fs_rights_base: types::Rights,
379
+ _fs_rights_inheriting: types::Rights,
380
+ fdflags: types::Fdflags,
381
+ ) -> Answer<types::Fd> {
382
+ self.answer(memory, |mem, inv| {
383
+ path::open(
384
+ table(inv),
385
+ mem,
386
+ fd.into(),
387
+ path,
388
+ &path::PathOpen {
389
+ dirflags,
390
+ oflags,
391
+ rights_base: fs_rights_base,
392
+ fdflags,
393
+ },
394
+ )
395
+ })
396
+ }
397
+
398
+ fn path_readlink(
399
+ &mut self,
400
+ memory: &mut wiggle::GuestMemory<'_>,
401
+ fd: types::Fd,
402
+ path: GuestPtr<str>,
403
+ buf: GuestPtr<u8>,
404
+ buf_len: types::Size,
405
+ ) -> Answer<types::Size> {
406
+ self.answer(memory, |mem, inv| {
407
+ path::readlink(table(inv), mem, fd.into(), path, buf, buf_len)
408
+ })
409
+ }
410
+
411
+ fn path_remove_directory(
412
+ &mut self,
413
+ memory: &mut wiggle::GuestMemory<'_>,
414
+ fd: types::Fd,
415
+ path: GuestPtr<str>,
416
+ ) -> Answer {
417
+ self.answer(memory, |mem, inv| {
418
+ path::remove_directory(table(inv), mem, fd.into(), path)
419
+ })
420
+ }
421
+
422
+ fn path_rename(
423
+ &mut self,
424
+ memory: &mut wiggle::GuestMemory<'_>,
425
+ old_fd: types::Fd,
426
+ old_path: GuestPtr<str>,
427
+ new_fd: types::Fd,
428
+ new_path: GuestPtr<str>,
429
+ ) -> Answer {
430
+ self.answer(memory, |mem, inv| {
431
+ path::rename(
432
+ table(inv),
433
+ mem,
434
+ (old_fd.into(), old_path),
435
+ (new_fd.into(), new_path),
436
+ )
437
+ })
438
+ }
439
+
440
+ fn path_symlink(
441
+ &mut self,
442
+ memory: &mut wiggle::GuestMemory<'_>,
443
+ old_path: GuestPtr<str>,
444
+ fd: types::Fd,
445
+ new_path: GuestPtr<str>,
446
+ ) -> Answer {
447
+ self.answer(memory, |mem, inv| {
448
+ path::symlink(table(inv), mem, old_path, fd.into(), new_path)
449
+ })
450
+ }
451
+
452
+ fn path_unlink_file(
453
+ &mut self,
454
+ memory: &mut wiggle::GuestMemory<'_>,
455
+ fd: types::Fd,
456
+ path: GuestPtr<str>,
457
+ ) -> Answer {
458
+ self.answer(memory, |mem, inv| {
459
+ path::unlink_file(table(inv), mem, fd.into(), path)
460
+ })
461
+ }
462
+
463
+ fn poll_oneoff(
464
+ &mut self,
465
+ memory: &mut wiggle::GuestMemory<'_>,
466
+ subs: GuestPtr<types::Subscription>,
467
+ events: GuestPtr<types::Event>,
468
+ count: types::Size,
469
+ ) -> Answer<types::Size> {
470
+ self.answer(memory, |mem, inv| {
471
+ poll::poll_oneoff(inv, mem, subs, events, count)
472
+ })
473
+ }
474
+
475
+ fn sock_accept(
476
+ &mut self,
477
+ memory: &mut wiggle::GuestMemory<'_>,
478
+ fd: types::Fd,
479
+ _flags: types::Fdflags,
480
+ ) -> Answer<types::Fd> {
481
+ self.answer(memory, |_, inv| sock::socket(table(inv), fd.into()))
482
+ }
483
+
484
+ fn sock_recv(
485
+ &mut self,
486
+ memory: &mut wiggle::GuestMemory<'_>,
487
+ fd: types::Fd,
488
+ _ri_data: types::IovecArray,
489
+ _ri_flags: types::Riflags,
490
+ ) -> Answer<(types::Size, types::Roflags)> {
491
+ self.answer(memory, |_, inv| sock::socket(table(inv), fd.into()))
492
+ }
493
+
494
+ fn sock_send(
495
+ &mut self,
496
+ memory: &mut wiggle::GuestMemory<'_>,
497
+ fd: types::Fd,
498
+ _si_data: types::CiovecArray,
499
+ _si_flags: types::Siflags,
500
+ ) -> Answer<types::Size> {
501
+ self.answer(memory, |_, inv| sock::socket(table(inv), fd.into()))
502
+ }
503
+
504
+ fn sock_shutdown(
505
+ &mut self,
506
+ memory: &mut wiggle::GuestMemory<'_>,
507
+ fd: types::Fd,
508
+ _how: types::Sdflags,
509
+ ) -> Answer {
510
+ self.answer(memory, |_, inv| sock::socket(table(inv), fd.into()))
511
+ }
461
512
  }