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

why does memmap2::Mmap::map need to be unsafe? #101

Closed
dev-ardi opened this issue Oct 24, 2023 · 4 comments
Closed

why does memmap2::Mmap::map need to be unsafe? #101

dev-ardi opened this issue Oct 24, 2023 · 4 comments

Comments

@dev-ardi
Copy link

Most other ffi wrappers provide a safe interface. Why is this unsafe?

@RazrFalcon
Copy link
Owner

Can you list those wrappers?

To be safe in Rust terms, a memory chunk must have a single owner. Which is not possible with memmap, since anyone can modify the mapped file.

@dev-ardi
Copy link
Author

I'm not talking about mmap wrappers, I'm talking about general libc wrappers.

This makes sense, is that in the docs? Did I miss it?

@RazrFalcon
Copy link
Owner

@dev-ardi
Copy link
Author

Ah that's great. It would be nice to add a link to that section in all unsafe APIs.

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

No branches or pull requests

2 participants