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

add mlockall and munlockall #876

Merged
merged 2 commits into from
Mar 29, 2018
Merged

add mlockall and munlockall #876

merged 2 commits into from
Mar 29, 2018

Conversation

afck
Copy link
Contributor

@afck afck commented Mar 24, 2018

Closes #875

Copy link
Member

@asomers asomers left a comment

Choose a reason for hiding this comment

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

Please add doccomments and explain why these functions need to be unsafe. Also, the tests are failing on Linux/S390 because the relevant constants are undefined. You'll have to figure out whether Linux does in fact define those constants on S390 and either define them in libc, or conditionalize them in nix.

src/sys/mman.rs Outdated
@@ -213,6 +223,14 @@ pub unsafe fn munlock(addr: *const c_void, length: size_t) -> Result<()> {
Errno::result(libc::munlock(addr, length)).map(drop)
}

pub unsafe fn mlockall(flags: MlockAllFlags) -> Result<()> {
Copy link
Member

Choose a reason for hiding this comment

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

Why are these functions unsafe?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, I suppose there's nothing actually unsafe here. Done.

@afck afck force-pushed the master branch 2 times, most recently from ad62086 to 099e0e4 Compare March 24, 2018 15:44
@afck
Copy link
Contributor Author

afck commented Mar 24, 2018

I conditionalized the constants for now.

@asomers
Copy link
Member

asomers commented Mar 24, 2018

Could you please check Linux/S390x? I'd rather not needlessly disable obscure platforms simply out of neglect.

@afck
Copy link
Contributor Author

afck commented Mar 24, 2018

I'm not sure how to verify that; it looks like the constants are defined in tools/include/uapi/asm-generic/mman.h, which is included in tools/arch/s390/include/uapi/asm/mman.h, so I guess it is? I'll have a look at the libc crate.

@asomers
Copy link
Member

asomers commented Mar 26, 2018

libc merged the PR, so you should be able to update this PR as well. No need to update Nix's Cargo.toml.

@afck
Copy link
Contributor Author

afck commented Mar 27, 2018

Thank you, I removed the conditions.

@asomers
Copy link
Member

asomers commented Mar 27, 2018

Could you please add some doc comments for the new functions, too?

@afck
Copy link
Contributor Author

afck commented Mar 27, 2018

I also documented mlock/munlock. Please check whether you're okay with my formulation.

@asomers
Copy link
Member

asomers commented Mar 28, 2018

Ok, I think we're done here.

bors r+

@bors
Copy link
Contributor

bors bot commented Mar 28, 2018

👎 Rejected by code reviews

@asomers
Copy link
Member

asomers commented Mar 28, 2018

Hm, bors's behavior has changed. It appears that I now need to click "approve changes" before telling bors to merge.

bors r+

bors bot added a commit that referenced this pull request Mar 28, 2018
876: add mlockall and munlockall r=asomers a=afck

Closes #875
@bors
Copy link
Contributor

bors bot commented Mar 28, 2018

Timed out

@asomers
Copy link
Member

asomers commented Mar 29, 2018

Let's retry.

bors r+

bors bot added a commit that referenced this pull request Mar 29, 2018
876: add mlockall and munlockall r=asomers a=afck

Closes #875
@bors
Copy link
Contributor

bors bot commented Mar 29, 2018

@bors bors bot merged commit e262fd0 into nix-rust:master Mar 29, 2018
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