Hello everyone!
I'd like to contribute to rsix
and would like some guidance as to things I could implement or issues I could solve
Hello and welcome! cc @Dan Gohman for this -- he might have some thoughts on good starter issues
Hello! Are there specific features you're interested in working on, or are you looking for ideas? :-)
Hello Dan and Chris! :D
Nothing in specific right now (although making bindings for mlock
and mlockall
would be nice), I'd be happy helping in any way possible
As it happens, I implemented mlock
just yesterday :-)
But not mlockall
, so that's something you could start with
And along those lines, mincore
, msync
, mremap
Right on!!
I've faced the same MCL_ONFAULT
issue before and resorted to FFI in order to get it (https://github.com/vrmiguel/bustd/blob/master/cc/helper.c)
Would that be suitable for rsix
or should we just ignore this constant for now?
In general, it's fine to ignore stuff. In effect, we're currently ignoring all the MCL_*
flags, so just implementing some of them is progress :-)
Also, yeah, in general we want to stay away from emulating things, or providing our own definitions. If someone really wants MCL_ONFAULT
, the linux_raw backend should get it from linux-raw-sys (which already has a definition of MCL_ONFAULT
), and the libc backend should get it from libc (which doesn't yet, so the first step would be to add it upstream)
No problem :D
I've open a PR for mlockall and munlockall although it's still a WIP (no linux_raw support yet)
I've previously done a conversion for mlockall's errnos into proper Rust error enums
Err(match errno() {
// Some or all of the memory identified by the operation could not be locked when the call was made.
EAGAIN => Error::CouldNotLockMemoryError,
// The flags argument is zero, or includes unimplemented flags.
EINVAL => Error::InvalidFlagsError,
// Locking all of the pages currently mapped into the address space of the process
// would exceed an implementation-defined limit on the amount of memory
// that the process may lock.
ENOMEM => Error::TooMuchMemoryToLockError,
// The calling process does not have appropriate privileges to perform the requested operation
EPERM => Error::NoPermission,
// Should not happen
_ => Error::UnknownMlockallError,
})
are higher-level error enums like that out of place for rsix?
That's a good question. rsix doesn't yet provide any enums like that, but that doesn't mean it shouldn't.
For the more portable system calls, enums like that would sometimes get tricky, becuase there are a lot of subtle errno differences between eg. Linux and FreeBSD and other things.
I think my gut feeling is that rsix shouldn't define enums like that; that can be done in higher-level APIs that wrap rsix. But it's just a feeling, and I could be convinced otherwise.
Makes sense!
Hey there, Dan!
I plan on finishing the PR soon(-ish), I just haven't had great availability :-P
Hi! No worries :-)
hey @Dan Gohman !
so sorry for the delay
Hello!
Is there anything you're blocked on, or that's confusing?
Last updated: Nov 22 2024 at 17:03 UTC