- Notifications
You must be signed in to change notification settings - Fork1.3k
mmap module#3755
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
mmap module#3755
Uh oh!
There was an error while loading.Please reload this page.
Conversation
killme2008 commentedMay 31, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@youknowone I found that it can't be compiled in main branch with such error:
Do i miss something? |
build errors not reproduced by CI is mostly rust version problem. |
@youknowone Got it, my rust version is older. |
Uh oh!
There was an error while loading.Please reload this page.
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.
Some of yourlibc
imports are causingrustc
and/orclippy
to complain.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
There's a test in Can you copy |
killme2008 commentedJun 1, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@fanninpm thank you. This PR isn't ready for review, it's draft right now. I have some protocols such as |
@youknowone@fanninpm
But there are still some work to do because of
And i don't implement this module on windows platform too. Please help me review this module, thank you. |
Can you break out |
@fanninpm Of course, i will break it out. |
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.
Great! You made a big feature! I left a few comments.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
@youknowone@fermian@qingshi163 Thank you for all your comments, i will resolve them ASAP. |
@youknowone I tried to address all the CR problems in3ba2341 Please review this PR again. Thank you. |
Uh oh!
There was an error while loading.Please reload this page.
@fanninpm@youknowone@qingshi163 I tried to address all CR problems again in commiteed1537 and fixed |
@youknowone I rebased the commits , split the |
b5e9c1f
toa93435d
CompareThere 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.
Almost there! Just a few quick changes.
Even if anyone else hasn't already said this, thank you for contributing a significant amount of time and effort on this.
stdlib/src/mmap.rs Outdated
#[cfg(target_os = "linux")] | ||
libc::MADV_FREE => Advice::Free, |
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 is also present on macOS and iOS, as ofmemmap2
v0.5.4. If this doesn't work, you may need to have Cargo refresh theCargo.lock
file.
#[cfg(target_os ="linux")] | |
libc::MADV_FREE =>Advice::Free, | |
#[cfg(any(target_os ="linux", target_vendor ="apple"))] | |
libc::MADV_FREE =>Advice::Free, |
(Please note thatmemmap2
does not currently support BSD systems, as the upstream maintainer has not currently set up CI for them.)
stdlib/src/mmap.rs Outdated
#[cfg(target_os = "linux")] | ||
#[pyattr] | ||
use libc::{ | ||
MADV_DODUMP, MADV_DOFORK, MADV_DONTDUMP, MADV_DONTFORK, MADV_FREE, MADV_HUGEPAGE, |
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.
MADV_FREE
is also present on Apple devices (and the four major BSDs).
I suggest using something like this (with applicable formatting):
#[cfg(any(target_os ="android", target_os ="dragonfly", target_os ="fuchsia", target_os ="freebsd", target_os ="linux", target_os ="netbsd", target_os ="openbsd", target_vendor ="apple"))]#[pyattr]use libc::MADV_FREE;
As for the other imports fromlibc
, I recommend searching the.txt
files inhttps://github.com/rust-lang/libc to see exactly which platforms are compatible with which constants/methods fromlibc
.
stdlib/src/mmap.rs Outdated
0 => dist, /* relative to start */ | ||
1 => { | ||
/* relative to current position */ | ||
let pos = self.pos(); | ||
if (((isize::MAX as usize) - pos) as isize) < dist { | ||
return Err(vm.new_value_error("seek out of range".to_owned())); | ||
} | ||
pos as isize + dist | ||
} | ||
2 => { | ||
/* relative to end */ |
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.
Very minor nitpick: These comments (/* ... */
) are inconsistent with the other comments in this file (// ...
).
|
I changed memmap2 version to |
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.
Great! Thank you for the long time effort!
@youknowone@fanninpm Thank you for all your helper. |
Uh oh!
There was an error while loading.Please reload this page.
Try to implement mmap module#2059
Supersedes andcloses#3564