-
Notifications
You must be signed in to change notification settings - Fork 676
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
fcntl: Adding F_TRANSFEREXTENTS fcntl constant for macOs. #2504
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.
LGTM, let's wait for that libc PR, though Nix currently uses libc from branch libc-0.2
, not main
.
/// The other file is specified via a file descriptor as the lone extra argument. | ||
/// Both descriptors must reference regular files in the same volume. | ||
#[cfg(apple_targets)] | ||
F_TRANSFEREXTENTS(RawFd), |
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.
Hmm, just realized that I missed this type when added I/O safety to this module. 😵💫
Yes I planned to keep it as draft as long as it takes :) |
That's totally fine:) |
src/fcntl.rs
Outdated
@@ -952,6 +958,12 @@ pub fn fcntl<Fd: std::os::fd::AsFd>(fd: Fd, arg: FcntlArg) -> Result<c_int> { | |||
F_PREALLOCATE(st) => { | |||
libc::fcntl(fd, libc::F_PREALLOCATE, st) | |||
}, | |||
#[cfg(apple_targets)] | |||
F_TRANSFEREXTENTS(rawfd) => { | |||
// FIXME: ongoing (PR)[https://github.com/rust-lang/libc/pull/3925/files] |
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.
This PR has been merged and backported to the libc-0.2
branch:)
96ca676
to
307ccd3
Compare
src/fcntl.rs
Outdated
// FIXME: ongoing (PR)[https://github.com/rust-lang/libc/pull/3925/files] | ||
const F_TRANSFEREXTENTS: c_int = 110; | ||
libc::fcntl(fd, F_TRANSFEREXTENTS, rawfd) |
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.
Let's use the constant from the libc crate:
// FIXME: ongoing (PR)[https://github.com/rust-lang/libc/pull/3925/files] | |
const F_TRANSFEREXTENTS: c_int = 110; | |
libc::fcntl(fd, F_TRANSFEREXTENTS, rawfd) | |
libc::fcntl(fd, libc::F_TRANSFEREXTENTS, rawfd) |
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.
Yes I forgot to change in fact..
eafc43e
to
a6e589a
Compare
src/fcntl.rs
Outdated
@@ -952,6 +958,11 @@ pub fn fcntl<Fd: std::os::fd::AsFd>(fd: Fd, arg: FcntlArg) -> Result<c_int> { | |||
F_PREALLOCATE(st) => { | |||
libc::fcntl(fd, libc::F_PREALLOCATE, st) | |||
}, | |||
#[cfg(apple_targets)] | |||
F_TRANSFEREXTENTS(rawfd) => { | |||
// FIXME: ongoing (PR)[https://github.com/rust-lang/libc/pull/3925/files] |
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.
Still has a comment to remove:)
a6e589a
to
00b7adc
Compare
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.
Thanks!
No description provided.