Skip to content
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 macOs F_RDADVISE flag #2480

Merged
merged 3 commits into from
Sep 4, 2024

Conversation

devnexen
Copy link
Contributor

@devnexen devnexen commented Sep 3, 2024

Hints to prefetch blocks of the file into memory when possible. Can be useful to process large files.

Hints to prefetch blocks of the file into memory when possible.
Can be useful to process large files.
@devnexen devnexen marked this pull request as ready for review September 3, 2024 21:09
Copy link
Member

@SteveLauC SteveLauC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting prefetch feature, can we have a test for this flag, just create a temp file and invoke the call against it:)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was accidentally modified, please revert it.

@@ -797,6 +797,9 @@ pub enum FcntlArg<'a> {
/// Return the full path without firmlinks of the fd.
#[cfg(apple_targets)]
F_GETPATH_NOFIRMLINK(&'a mut PathBuf),
/// Issue an advisory read async with no copy to user
#[cfg(apple_targets)]
F_RDADVISE(libc::radvisory),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw this was changed in the "testing" commit, the previous API is indeed a bit unclear:

F_RDADVISE(off_t, c_int),

I am actually thinking about this:

F_RDADVISE {
    offset: off_t,
    count: c_int,
}

So semantically, the API will be more clear and users won't need to bother with the libc raw structure. The drawback is, we need to copy these 2 numbers, considering they are simply numbers, IMHO, it is fine to copy them. Your thoughts? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was being consistent with flags passing libc::flock.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get it, makes sense to me then:)

Copy link
Member

@SteveLauC SteveLauC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@@ -797,6 +797,9 @@ pub enum FcntlArg<'a> {
/// Return the full path without firmlinks of the fd.
#[cfg(apple_targets)]
F_GETPATH_NOFIRMLINK(&'a mut PathBuf),
/// Issue an advisory read async with no copy to user
#[cfg(apple_targets)]
F_RDADVISE(libc::radvisory),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get it, makes sense to me then:)

@SteveLauC
Copy link
Member

Let's try if the Cirrus CI will be ok in this PR, it fails at cloning the repo in other PRs😵‍💫

@SteveLauC SteveLauC added this pull request to the merge queue Sep 4, 2024
Merged via the queue into nix-rust:master with commit f1d9beb Sep 4, 2024
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants