Skip to content

Commit

Permalink
Update the libc backend's read to use Buffer.
Browse files Browse the repository at this point in the history
  • Loading branch information
sunfishcode committed Feb 4, 2025
1 parent 7c8adfe commit 8b4cee0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/backend/libc/io/syscalls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ use crate::io::ReadWriteFlags;
use crate::io::{self, FdFlags};
use crate::ioctl::{IoctlOutput, RawOpcode};
use core::cmp::min;
use core::mem::MaybeUninit;
#[cfg(not(any(target_os = "espidf", target_os = "horizon")))]
use {
crate::backend::MAX_IOV,
crate::io::{IoSlice, IoSliceMut},
};

pub(crate) fn read(fd: BorrowedFd<'_>, buf: &mut [MaybeUninit<u8>]) -> io::Result<usize> {
#[inline]
pub(crate) unsafe fn read(fd: BorrowedFd<'_>, buf: (*mut u8, usize)) -> io::Result<usize> {
unsafe {
ret_usize(c::read(
borrowed_fd(fd),
buf.as_mut_ptr().cast(),
min(buf.len(), READ_LIMIT),
buf.0.cast(),
min(buf.1, READ_LIMIT),
))
}
}
Expand Down

0 comments on commit 8b4cee0

Please sign in to comment.