mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Rollup merge of #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`.
This commit is contained in:
commit
73bb47eecd
@ -175,23 +175,12 @@ impl Socket {
|
||||
}
|
||||
|
||||
pub fn read_vectored(&self, bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize> {
|
||||
let mut size: isize = 0;
|
||||
|
||||
for i in bufs.iter_mut() {
|
||||
let ret: isize =
|
||||
cvt(unsafe { netc::read(self.0.as_raw_fd(), i.as_mut_ptr(), i.len()) })?;
|
||||
|
||||
if ret != 0 {
|
||||
size += ret;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(size.try_into().unwrap())
|
||||
crate::io::default_read_vectored(|b| self.read(b), bufs)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_read_vectored(&self) -> bool {
|
||||
true
|
||||
false
|
||||
}
|
||||
|
||||
fn recv_from_with_flags(&self, buf: &mut [u8], flags: i32) -> io::Result<(usize, SocketAddr)> {
|
||||
@ -225,17 +214,11 @@ impl Socket {
|
||||
}
|
||||
|
||||
pub fn write_vectored(&self, bufs: &[IoSlice<'_>]) -> io::Result<usize> {
|
||||
let mut size: isize = 0;
|
||||
|
||||
for i in bufs.iter() {
|
||||
size += cvt(unsafe { netc::write(self.0.as_raw_fd(), i.as_ptr(), i.len()) })?;
|
||||
}
|
||||
|
||||
Ok(size.try_into().unwrap())
|
||||
crate::io::default_write_vectored(|b| self.write(b), bufs)
|
||||
}
|
||||
|
||||
pub fn is_write_vectored(&self) -> bool {
|
||||
true
|
||||
false
|
||||
}
|
||||
|
||||
pub fn set_timeout(&self, dur: Option<Duration>, kind: i32) -> io::Result<()> {
|
||||
|
Loading…
Reference in New Issue
Block a user