Skip to content

Commit dc3424e

Browse files
authored
Rollup merge of rust-lang#125333 - hermit-os:fuse, r=workingjubilee
switch to the default implementation of `write_vectored` HermitOS doesn't support write_vectored and switch to the default implementation of `write_vectored`.
2 parents 7142c42 + c0ee0c7 commit dc3424e

File tree

1 file changed

+4
-21
lines changed

1 file changed

+4
-21
lines changed

Diff for: std/src/sys/pal/hermit/net.rs

+4-21
Original file line numberDiff line numberDiff line change
@@ -175,23 +175,12 @@ impl Socket {
175175
}
176176

177177
pub fn read_vectored(&self, bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize> {
178-
let mut size: isize = 0;
179-
180-
for i in bufs.iter_mut() {
181-
let ret: isize =
182-
cvt(unsafe { netc::read(self.0.as_raw_fd(), i.as_mut_ptr(), i.len()) })?;
183-
184-
if ret != 0 {
185-
size += ret;
186-
}
187-
}
188-
189-
Ok(size.try_into().unwrap())
178+
crate::io::default_read_vectored(|b| self.read(b), bufs)
190179
}
191180

192181
#[inline]
193182
pub fn is_read_vectored(&self) -> bool {
194-
true
183+
false
195184
}
196185

197186
fn recv_from_with_flags(&self, buf: &mut [u8], flags: i32) -> io::Result<(usize, SocketAddr)> {
@@ -225,17 +214,11 @@ impl Socket {
225214
}
226215

227216
pub fn write_vectored(&self, bufs: &[IoSlice<'_>]) -> io::Result<usize> {
228-
let mut size: isize = 0;
229-
230-
for i in bufs.iter() {
231-
size += cvt(unsafe { netc::write(self.0.as_raw_fd(), i.as_ptr(), i.len()) })?;
232-
}
233-
234-
Ok(size.try_into().unwrap())
217+
crate::io::default_write_vectored(|b| self.write(b), bufs)
235218
}
236219

237220
pub fn is_write_vectored(&self) -> bool {
238-
true
221+
false
239222
}
240223

241224
pub fn set_timeout(&self, dur: Option<Duration>, kind: i32) -> io::Result<()> {

0 commit comments

Comments
 (0)