-
Notifications
You must be signed in to change notification settings - Fork 689
Add Redox support for most of the modules #1098
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
Conversation
Interesting! But I have two big questions:
|
There is redoxer that does exactly this. You basically pull the redoxos/redoxer docker image and then run |
5e6db09
to
6fd6456
Compare
The libc request was merged. |
492ef33
to
030e753
Compare
fcf97ca
to
94a4d2b
Compare
Btw, should I include the tests for redox in this PR or should I make another one specifically for it? |
Best if you can add them to this PR. |
b8498fb
to
2a560e4
Compare
@asomers the CI succeeded and I only added a new test. Is the problem resolved? |
Amazing! You fixed it! ;). I guess Travis undid whatever they did on September 6. I see a lot of warnings in the Redox test build, though. Could you please silence all of the warnings? |
I was using the warnings to remember what needs to be included. I'd have silenced them when you would have been ready to merge. Is that ok with you? |
You mean you want to silence them after I've reviewed the rest of the PR? That's ok. |
There is currently ongoing work to improve what redox can do, so as this goes I remove |
1- Qemu is only necessary to run it. To compile, you'd simply do |
@@ -153,21 +161,21 @@ libc_bitflags!( | |||
|
|||
pub fn open<P: ?Sized + NixPath>(path: &P, oflag: OFlag, mode: Mode) -> Result<RawFd> { | |||
let fd = path.with_nix_path(|cstr| { | |||
let modebits = c_uint::from(mode.bits()); | |||
unsafe { libc::open(cstr.as_ptr(), oflag.bits(), modebits) } | |||
unsafe { libc::open(cstr.as_ptr(), oflag.bits(), mode.bits() as c_uint) } |
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.
Why did you make this change? Using from
is usually preferable to as
.
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.
It's because mode_t is a signed int on redox, so in terms of integer, because it can be lossy, the From<c_uint>
trait is not implemented for c_int
but as c_uint
works fine.
pub fn openat<P: ?Sized + NixPath>(dirfd: RawFd, path: &P, oflag: OFlag, mode: Mode) -> Result<RawFd> { | ||
let fd = path.with_nix_path(|cstr| { | ||
let modebits = c_uint::from(mode.bits()); | ||
unsafe { libc::openat(dirfd, cstr.as_ptr(), oflag.bits(), modebits) } | ||
unsafe { libc::openat(dirfd, cstr.as_ptr(), oflag.bits(), mode.bits() as c_uint) } |
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.
Ditto from/as.
The |
3320483
to
ef07a8e
Compare
Some things are not implemented yet in redox, so a lot of annotations were added to remove functions when compiling for redox. Those functions will hopefully be added in time, but for now it's better to have partial support than none. Blocked by rust-lang/libc#1438
TODO: Fix them in Relibc
FIFOs are not supported (yet?) by RedoxFS, so disable it
- Make sure all tests pass the CI - Redox does not (yet) have passwd functions, so remove it
ef07a8e
to
bedbb8d
Compare
Rebased |
Ok, could you please do one last thing? Just add Redox to the list of supported platforms in the README.md. Put it in the "Tier 3" section. |
Sure it's done! |
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.
Let's do it!
bors r+
Yes! Thanks a lot for your time, it's greatly appreciated! |
Build succeeded: |
This test cannot be compiled under Redox. PR nix-rust#1098 attempted to disable it for Redox, but actually disabled it everywhere. AFAICT, Cargo has no syntax to conditionally enable a target, except based on features. Instead, use conditional compilation within the test.
This test cannot be compiled under Redox. PR #1098 attempted to disable it for Redox, but actually disabled it everywhere. AFAICT, Cargo has no syntax to conditionally enable a target, except based on features. Instead, use conditional compilation within the test.
Some things are not implemented yet in redox, so a lot of annotations were added to remove functions when compiling for redox. Those functions will hopefully be added in time, but for now it's better to have partial support than none.
Blocked by rust-lang/libc#1438