-
Notifications
You must be signed in to change notification settings - Fork 667
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose preadv
and pwritev
on BSDs
#883
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also add some docs above the [#cfg...]
line for both of these functions since they're missing them?
src/sys/uio.rs
Outdated
@@ -19,7 +19,11 @@ pub fn readv(fd: RawFd, iov: &mut [IoVec<&mut [u8]>]) -> Result<usize> { | |||
Errno::result(res).map(|r| r as usize) | |||
} | |||
|
|||
#[cfg(target_os = "linux")] | |||
#[cfg(any(target_os = "linux", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please alphabetize the list of target OSes.
@Susurrus ready for re-review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comments apply to the other function as well.
Also, CI is failing, so please look into that.
@@ -19,7 +19,16 @@ pub fn readv(fd: RawFd, iov: &mut [IoVec<&mut [u8]>]) -> Result<usize> { | |||
Errno::result(res).map(|r| r as usize) | |||
} | |||
|
|||
#[cfg(target_os = "linux")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doc comments should start with a short summary line, like git
commit messages. Then a blank line and a longer descriptive message afterwards. See the Rust book.
src/sys/uio.rs
Outdated
/// until all buffers have been written or an error occurs. The file offset is | ||
/// not changed. | ||
/// | ||
/// See also: `writev` and `pwrite` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please link to these functions using inline links.
I don't understand what you mean that "the comments apply to the other function as well." How do I fix that? |
My review comments apply to both of the functions you've added. |
How does the documentation look? When I checked on the failed builds before my push, they didn't show any steps or errors. Now those two aren't showing up at all. Is the build machine/service having trouble? |
Looks like the build machine hit ENOSPC :(. I'll fix it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It all looks fine to me now.
Awesome, looks great, thanks! bors r+ |
883: Expose `preadv` and `pwritev` on BSDs r=Susurrus a=morrowa This addresses issue #690. It exposes the `preadv` and `pwritev` functions on supported BSDs (not including Apple platforms). Co-authored-by: Andrew Morrow <[email protected]>
Timed out |
I don't have permission to follow Bors' details link. Is there anything I can correct? |
No. I need to rebuild the i386 builder. |
Er, I forgot that I had already done that 2 days ago. But Buildbot was stuck and needed a restart, which I have done. Let's try again. bors retry |
Actually, on second thought, could you please squash the commits? bors r- |
Squashed! |
bors r+ |
883: Expose `preadv` and `pwritev` on BSDs r=asomers a=morrowa This addresses issue #690. It exposes the `preadv` and `pwritev` functions on supported BSDs (not including Apple platforms). Co-authored-by: Andrew Morrow <[email protected]>
Hi, Please tell me why Thanks |
These two functions do not exist in any version of macOS 10. It looks like they have been added in macOS 11 per this external patch: https://mail.gnu.org/archive/html/qemu-devel/2020-10/msg03484.html |
Yes, so is there a plan to add #[cfg(target_os = "linux")]
fn pwritev(fd: RawFd, iov: &[IoVec<&[u8]>], offset: off_t) -> nix::Result<usize> {
use nix::sys::uio::pwritev as _pwritev;
_pwritev(fd, iov, offset)
}
#[cfg(target_os = "macos")]
fn pwritev(fd: RawFd, iov: &[IoVec<&[u8]>], offset: off_t) -> nix::Result<usize> {
use nix::sys::uio::pwrite;
let mut buff = Vec::<u8>::new();
for iv in iov {
buff.extend_from_slice(iv.as_slice());
}
pwrite(fd, buff.as_slice(), offset)
} https://github.com/hidva/KuiBaDB/blob/master/src/bin/kuiba/access/wal.rs#L24 Thanks. |
I am not upgrading to macOS 11 yet because too many of my peripherals don't yet support it. You are welcome to implement the change yourself! |
This addresses issue #690.
It exposes the
preadv
andpwritev
functions on supported BSDs (not including Apple platforms).