diff options
author | Amanda Tait <atait@google.com> | 2020-08-05 13:25:03 -0400 |
---|---|---|
committer | Tamir Duberstein <tamird@google.com> | 2020-12-19 14:17:42 -0500 |
commit | 5846ae2afd76ba1ffaddb9d08f91dfbed30243c4 (patch) | |
tree | 132bd0d0d639b1f58471be1e37481381e199973f /src/sys/socket | |
parent | 16d62f6622f90208341045864a9a6c5470dc9cc2 (diff) | |
download | nix-5846ae2afd76ba1ffaddb9d08f91dfbed30243c4.zip |
Add fuchsia support
Allow nix to compile on Fuchsia by conditionally avoiding libc
functionality that does not exist for Fuchsia.
Diffstat (limited to 'src/sys/socket')
-rw-r--r-- | src/sys/socket/addr.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/sys/socket/addr.rs b/src/sys/socket/addr.rs index 8784a37b..2299c57d 100644 --- a/src/sys/socket/addr.rs +++ b/src/sys/socket/addr.rs @@ -21,7 +21,8 @@ use crate::sys::socket::addr::sys_control::SysControlAddr; target_os = "linux", target_os = "macos", target_os = "netbsd", - target_os = "openbsd"))] + target_os = "openbsd", + target_os = "fuchsia"))] pub use self::datalink::LinkAddr; #[cfg(any(target_os = "android", target_os = "linux"))] pub use self::vsock::VsockAddr; @@ -41,7 +42,7 @@ pub enum AddressFamily { #[cfg(any(target_os = "android", target_os = "linux"))] Netlink = libc::AF_NETLINK, /// Low level packet interface (see [`packet(7)`](http://man7.org/linux/man-pages/man7/packet.7.html)) - #[cfg(any(target_os = "android", target_os = "linux"))] + #[cfg(any(target_os = "android", target_os = "linux", target_os = "fuchsia"))] Packet = libc::AF_PACKET, /// KEXT Controls and Notifications #[cfg(any(target_os = "ios", target_os = "macos"))] @@ -718,6 +719,7 @@ impl SockAddr { /// /// unsafe because it takes a raw pointer as argument. The caller must /// ensure that the pointer is valid. + #[cfg(not(target_os = "fuchsia"))] pub(crate) unsafe fn from_libc_sockaddr(addr: *const libc::sockaddr) -> Option<SockAddr> { if addr.is_null() { None @@ -1045,7 +1047,7 @@ pub mod sys_control { } -#[cfg(any(target_os = "android", target_os = "linux"))] +#[cfg(any(target_os = "android", target_os = "linux", target_os = "fuchsia"))] mod datalink { use super::{fmt, AddressFamily}; |