-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Fuchsia's target_family should be None, not "unix" #58590
Comments
#[cfg(unix)] was historically defined as While the name is misnomer, making Fuchsia neither |
Is Redox a unix? That's the other "weird" OS we support IIRC. |
That approach would seem limiting. For example, Rust might want to support a future operating system that is quite different from both Unix and Windows some day. |
Redox has no target_family:
|
I think the case of Redox is a good argument for making Fuchsia "not unix". It apparently works. How do we proceed now? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
this one has bitten code I've written, as sled tests used to gate some libc calls (fork + kill 9 for crash testing) on |
My specific suggestion is to change target_family from Some("unix") to None. This is what the redox configuration does as well. |
This comment has been minimized.
This comment has been minimized.
Meanwhile redox: convert to target_family unix. |
An example just cropped up of another mismatch here: Fuchsia doesn't provide a |
The historical definition that we had before no longer holds. We have plenty of targets that are neither |
Another way that Rust thinking Fuchsia is a kind of Unix is causing trouble: Its i would like to stabilise Is the For background, see the stdlib docs for |
This comment reminded me that I filed this bug a long time ago :) I no longer work on Fuchsia and wanted to mention that here. I believe @anp is an appropriate point of contact now. |
Thanks @kulakowski! There are two things we're doing on the Fuchsia side here:
Once (1) has progressed to some consensus and we have answers on (2) I'll report back with some proposed next steps for a migration. @ijackson, re:
As a possible alternative, maybe we should consider disabling the |
I'm not a libs team member, so I'm not authoritative, but I would be fine with that. Would you care to prepare an MR to do that (for both |
For clarity: that's the branch in #82973 which I am hoping will be merged soon. |
Sorry for the delay here! Looks like #82973 merged with a stub impl of ExitStatusError for Fuchsia. I think that's fine, and we can clean it up when we land the |
An interesting addition to this conversation; fuchsia doesn't have |
Updating with what I think are more concrete next steps:
At this point, A lot of
Once Fuchsia's SDK offers a couple of libraries to do this (say |
Another difference from #93858 (comment):
|
…r=tmandry Fixup failing fuchsia tests The Fuchsia platform passes all tests with these changes. Two tests are ignored because they rely on Fuchsia not returning a status code upon a process aborting. See rust-lang#102032 and rust-lang#58590 for more details on that topic. Many formatting changes are also included in this PR. r? tmandry r? erickt
Rollup merge of rust-lang#127461 - c6c7:fixup-failing-fuchsia-tests, r=tmandry Fixup failing fuchsia tests The Fuchsia platform passes all tests with these changes. Two tests are ignored because they rely on Fuchsia not returning a status code upon a process aborting. See rust-lang#102032 and rust-lang#58590 for more details on that topic. Many formatting changes are also included in this PR. r? tmandry r? erickt
I should note that Fuchsia was exempted from implementing |
Currently, the Fuchsia target is part of the unix target_family. I'd like to suggest that this should not be the case, and that
#cfg[unix]
should be false for Fuchsia.First, I want to capture what I think the opposite case is. Fuchsia does support some amount of posix functionality. That subset is currently informal and pragmatic. It has made starting to port exist software a certain amount easier.
"unix" connotes a lot of things. I've singled out some big ones that do not apply to Fuchsia. I think that in aggregate, these outweigh the benefits mentioned above.
Process model: Fuchsia does not have fork and exec, and does not have a process hierarchy. There's no
wait(2)
orwaitpid(2)
on Fuchsia.Signals: Fuchsia does not have unix signals.
Filesystems and users: Fuchsia does not have unix users or groups, and does not implement unix filesystem permissions. Fuchsia does not have a global filesystem.
FDs: Files and file descriptors are central, primitive concepts for unix: "everything is a file". In Fuchsia, they are an abstraction built out of other primitives, and working with those primitives directly is often preferred.
C and ABI: Unix system ABIs are typically deeply intertwined with its C standard library, and C is a de facto standard for specifying ABIs (witness
repr(C)
). On Fuchsia, almost all ABIs are specified in a language-agnostic IDL. The biggest exception, the system ABI in, we have been careful to describe in terms of ELF dynamic linkage, rather than C per se.IO: Portable unix IO boils down to synchronous read(2) and write(2). Abstractions for event-driven programming exist, but are not portable. Fuchsia has limited emulation for some of them, preferring instead to use native constructs more directly.
In aggregate, I think defining
#cfg[unix]
to be true for Fuchsia is tempting, yet a trap. An existing small program which just wants to synchronously manipulate stdin and stdout seems to benefit, for example, until they want to handle ^C with their same unix code.I'd love for rust programs, existing or not, to be as good as possible as easily as possible when built for Fuchsia. I think not setting
#cfg(unix)
will help with that.For some background: I work on Fuchsia. Among other things, I am one of the maintainers for our libc.
cc @cramertj
The text was updated successfully, but these errors were encountered: