Comments (10)
madvice
is in libc. And it already caused too many problems. I'm not interested in maintaining more features.
from memmap2-rs.
There is no libc function for mbind, it involves either using libnuma
, or calling syscall
directly, with the appropriate op. As that's all libnuma does, i think the latter is preferable.
from memmap2-rs.
If someone is willing to implement it - sure.
from memmap2-rs.
I am, it save the hacks i've currently got in place. The headache is either upstreaming the mbind call to libc, or using syscall here directly
from memmap2-rs.
The headache is either upstreaming the mbind call to libc, or using syscall here directly
I think as a third option, you could also just put the prototype of the libc function into this crate until the upstreaming is complete. (We do use the same approach for the Windows API calls used here for example.)
from memmap2-rs.
Then I guess this is out of scope.
from memmap2-rs.
How do you feel about a dependency on the syscalls crate?
You end up with something like this (different function):
pub fn get_mem_policy() -> Result<(i32, [usize; 1]), Errno> {
let mut mode: i32 = 0;
let mut node_mask: [usize; 1] = [0; 1];
unsafe {
syscall5(
Sysno::get_mempolicy,
((&mut mode) as *mut i32) as usize,
node_mask.as_mut_ptr() as usize,
8 * std::mem::size_of::<usize>(),
0,
0,
)
}
.map(drop);
Ok((mode, node_mask))
}
from memmap2-rs.
It's way out of scope. This crate is for memory mapping only.
from memmap2-rs.
its exactly the same rational as mlock
and madvise
, both of which have apis: you'd like to control some aspect of the mapping, in this case its allocation onto a specific numa node. Ignore the get_mem_policy
- that was to highlight the use of syscalls directly, not a function we'd nessesarily use
from memmap2-rs.
understood. Closing this issue.
from memmap2-rs.
Related Issues (20)
- Migrate to `safer_owning_ref` HOT 1
- why does memmap2::Mmap::map need to be unsafe? HOT 4
- Implement AsRawFd, IntoRawFd, AsRawHandle, IntoRawHandle and Into<Stdio> for MMap HOT 2
- Composite memory maps currently impossible HOT 7
- mmap'd anon pages fail in io_uring IOSQE_BUFFER_SELECT usage HOT 2
- advise_writes_unsafely_to_part_of_map test fails on powerpc64le-unknown-linux-gnu HOT 2
- error[E0433]: failed to resolve: could not find `Advice` in `memmap2` HOT 1
- PermissionDenied, message: "Access is denied." at remove file after read on Github Action WIndows HOT 2
- Doesn't compile for freebsd HOT 3
- v0.9.2 build failed for android target. HOT 3
- Support for `MS_INVALIDATE`? HOT 8
- Mac osx support HOT 1
- Support `mremap(2)` HOT 1
- Mapping beyond 4GB offset if broken on 32 bit glibc (Linux) HOT 3
- Support multiple advice HOT 2
- Contributing a migration from rustix to libc HOT 9
- MSRV and edition HOT 5
- Merging changes with memmapix HOT 24
- memmap2 `advise` is unsound HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from memmap2-rs.