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

Add support for Fuchsia #432

Merged
merged 4 commits into from
Oct 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,10 @@ cfg_if! {
#[link(name = "root")]
#[link(name = "network")]
extern {}
} else if #[cfg(target_os = "fuchsia")] {
#[link(name = "c")]
#[link(name = "mxio")]
extern {}
} else {
#[link(name = "c")]
#[link(name = "m")]
Expand Down Expand Up @@ -843,7 +847,8 @@ extern {
cfg_if! {
if #[cfg(any(target_os = "linux",
target_os = "android",
target_os = "emscripten"))] {
target_os = "emscripten",
target_os = "fuchsia"))] {
mod notbsd;
pub use self::notbsd::*;
} else if #[cfg(any(target_os = "macos",
Expand Down
1 change: 1 addition & 0 deletions src/unix/notbsd/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,7 @@ extern {

cfg_if! {
if #[cfg(any(target_env = "musl",
target_os = "fuchsia",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So right now this is under linux, because that's where musl lives, and because the diff is really minimal, but I'm not sure that's the best long-term structure. I think it might be better for musl to be a toplevel under notbsd, and have both linux-musl and fuschsia go there, with additional fuchsia #[cfg] items there as needed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine for now, but if the two start to diverge we can just copy musl over and update fuschia as necessary

target_os = "emscripten"))] {
mod musl;
pub use self::musl::*;
Expand Down
7 changes: 5 additions & 2 deletions src/unix/notbsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ s! {
pub ai_protocol: ::c_int,
pub ai_addrlen: socklen_t,

#[cfg(any(target_os = "linux", target_os = "emscripten"))]
#[cfg(any(target_os = "linux",
target_os = "emscripten",
Copy link

@tedsta tedsta Oct 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Late nitpick - couldn't this be:

        #[cfg(any(target_os = "linux",
                  target_os = "android",
                  target_os = "emscripten",
                  target_os = "fuchsia"))]
        pub ai_addr: *mut ::sockaddr,

rather than having the android entry be separate at line 63?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tedsta Seems reasonable. This isn't #[repr(C)] so nobody should be caring about the order. I'll patch it and if there are problems, hopefully they'll be caught.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it turns out that doesn't work, because the structure is serialized, and order matters. Reverted.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops

target_os = "fuchsia"))]
pub ai_addr: *mut ::sockaddr,

pub ai_canonname: *mut c_char,
Expand Down Expand Up @@ -858,7 +860,8 @@ extern {

cfg_if! {
if #[cfg(any(target_os = "linux",
target_os = "emscripten"))] {
target_os = "emscripten",
target_os = "fuchsia"))] {
mod linux;
pub use self::linux::*;
} else if #[cfg(target_os = "android")] {
Expand Down