summaryrefslogtreecommitdiff
path: root/src/sys
diff options
context:
space:
mode:
Diffstat (limited to 'src/sys')
-rw-r--r--src/sys/ioctl/mod.rs5
-rw-r--r--src/sys/ioctl/platform/netbsd.rs0
-rw-r--r--src/sys/mman.rs4
-rw-r--r--src/sys/signal.rs7
-rw-r--r--src/sys/socket/consts.rs28
-rw-r--r--src/sys/socket/sockopt.rs2
-rw-r--r--src/sys/termios.rs18
-rw-r--r--src/sys/wait.rs3
8 files changed, 47 insertions, 20 deletions
diff --git a/src/sys/ioctl/mod.rs b/src/sys/ioctl/mod.rs
index 872da39f..4d4d1072 100644
--- a/src/sys/ioctl/mod.rs
+++ b/src/sys/ioctl/mod.rs
@@ -119,6 +119,11 @@ mod platform;
#[macro_use]
mod platform;
+#[cfg(target_os = "netbsd")]
+#[path = "platform/netbsd.rs"]
+#[macro_use]
+mod platform;
+
#[cfg(target_os = "openbsd")]
#[path = "platform/openbsd.rs"]
#[macro_use]
diff --git a/src/sys/ioctl/platform/netbsd.rs b/src/sys/ioctl/platform/netbsd.rs
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/sys/ioctl/platform/netbsd.rs
diff --git a/src/sys/mman.rs b/src/sys/mman.rs
index ad29a015..0522ab52 100644
--- a/src/sys/mman.rs
+++ b/src/sys/mman.rs
@@ -113,7 +113,7 @@ mod consts {
pub const MAP_FAILED: isize = -1;
}
-#[cfg(any(target_os = "freebsd", target_os = "dragonfly", target_os = "openbsd"))]
+#[cfg(any(target_os = "freebsd", target_os = "dragonfly", target_os = "openbsd", target_os = "netbsd"))]
mod consts {
use libc::c_int;
@@ -127,6 +127,8 @@ mod consts {
pub const MAP_NORESERVE: MmapFlag = 0x00040;
pub const MAP_HASSEMAPHORE: MmapFlag = 0x00200;
pub const MAP_STACK: MmapFlag = 0x00400;
+ #[cfg(target_os = "netbsd")]
+ pub const MAP_WIRED: MmapFlag = 0x00800;
pub const MAP_NOSYNC: MmapFlag = 0x00800;
pub const MAP_FILE: MmapFlag = 0x00000;
pub const MAP_ANON: MmapFlag = 0x01000;
diff --git a/src/sys/signal.rs b/src/sys/signal.rs
index a01102f0..72cd17df 100644
--- a/src/sys/signal.rs
+++ b/src/sys/signal.rs
@@ -220,7 +220,8 @@ pub mod signal {
target_os = "ios",
target_os = "freebsd",
target_os = "openbsd",
- target_os = "dragonfly"))]
+ target_os = "dragonfly",
+ target_os = "netbsd"))]
pub mod signal {
use libc;
@@ -273,7 +274,7 @@ pub mod signal {
pub struct sigset_t {
bits: [u32; 4],
}
- #[cfg(target_os = "dragonfly")]
+ #[cfg(any(target_os = "dragonfly", target_os = "netbsd"))]
#[repr(C)]
#[derive(Clone, Copy)]
pub struct sigset_t {
@@ -323,7 +324,7 @@ pub mod signal {
pub sa_mask: sigset_t,
}
- #[cfg(target_os = "openbsd")]
+ #[cfg(any(target_os = "openbsd", target_os = "netbsd"))]
#[repr(C)]
pub struct sigaction {
pub sa_handler: extern fn(libc::c_int),
diff --git a/src/sys/socket/consts.rs b/src/sys/socket/consts.rs
index 35b07165..22bd02a2 100644
--- a/src/sys/socket/consts.rs
+++ b/src/sys/socket/consts.rs
@@ -1,9 +1,5 @@
-use libc::{self, c_int};
pub use self::os::*;
-pub const IPV6_ADD_MEMBERSHIP: c_int = libc::IPV6_ADD_MEMBERSHIP;
-pub const IPV6_DROP_MEMBERSHIP: c_int = libc::IPV6_DROP_MEMBERSHIP;
-
#[cfg(any(target_os = "linux", target_os = "android"))]
mod os {
use libc::{self, c_int, uint8_t};
@@ -77,6 +73,9 @@ mod os {
pub const IP_ADD_MEMBERSHIP: c_int = 35;
pub const IP_DROP_MEMBERSHIP: c_int = 36;
+ pub const IPV6_ADD_MEMBERSHIP: c_int = libc::IPV6_ADD_MEMBERSHIP;
+ pub const IPV6_DROP_MEMBERSHIP: c_int = libc::IPV6_DROP_MEMBERSHIP;
+
pub type InAddrT = u32;
// Declarations of special addresses
@@ -104,18 +103,20 @@ mod os {
}
// Not all of these constants exist on freebsd
-#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "ios", target_os = "openbsd"))]
+#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "ios", target_os = "openbsd", target_os = "netbsd"))]
mod os {
#[cfg(any(target_os = "macos",
target_os = "ios",
target_os = "freebsd"))]
use libc::{self, c_int, uint8_t};
- #[cfg(any(target_os = "openbsd"))]
+ #[cfg(any(target_os = "openbsd", target_os = "netbsd"))]
use libc::{c_int, uint8_t};
pub const AF_UNIX: c_int = 1;
pub const AF_LOCAL: c_int = AF_UNIX;
pub const AF_INET: c_int = 2;
+ #[cfg(target_os = "netbsd")]
+ pub const AF_INET6: c_int = 24;
#[cfg(target_os = "openbsd")]
pub const AF_INET6: c_int = 26;
#[cfg(target_os = "freebsd")]
@@ -138,7 +139,10 @@ mod os {
pub const SO_ACCEPTCONN: c_int = 0x0002;
pub const SO_BROADCAST: c_int = 0x0020;
pub const SO_DEBUG: c_int = 0x0001;
+ #[cfg(not(target_os = "netbsd"))]
pub const SO_DONTTRUNC: c_int = 0x2000;
+ #[cfg(target_os = "netbsd")]
+ pub const SO_USELOOPBACK: c_int = 0x0040;
pub const SO_ERROR: c_int = 0x1007;
pub const SO_DONTROUTE: c_int = 0x0010;
pub const SO_KEEPALIVE: c_int = 0x0008;
@@ -166,9 +170,14 @@ mod os {
pub const SO_REUSEPORT: c_int = 0x0200;
pub const SO_REUSESHAREUID: c_int = 0x1025;
pub const SO_SNDBUF: c_int = 0x1001;
+ #[cfg(not(target_os = "netbsd"))]
pub const SO_TIMESTAMP: c_int = 0x0400;
+ #[cfg(not(target_os = "netbsd"))]
pub const SO_TIMESTAMP_MONOTONIC: c_int = 0x0800;
+ #[cfg(target_os = "netbsd")]
+ pub const SO_TIMESTAMP: c_int = 0x2000;
pub const SO_TYPE: c_int = 0x1008;
+ #[cfg(not(target_os = "netbsd"))]
pub const SO_WANTMORE: c_int = 0x4000;
pub const SO_WANTOOBFLAG: c_int = 0x8000;
#[allow(overflowing_literals)]
@@ -182,6 +191,8 @@ mod os {
pub const TCP_KEEPALIVE: c_int = libc::TCP_KEEPALIVE;
#[cfg(target_os = "freebsd")]
pub const TCP_KEEPIDLE: c_int = libc::TCP_KEEPIDLE;
+ #[cfg(target_os = "netbsd")]
+ pub const TCP_KEEPIDLE: c_int = 3;
// Socket options for the IP layer of the socket
pub const IP_MULTICAST_IF: c_int = 9;
@@ -193,6 +204,11 @@ mod os {
pub const IP_ADD_MEMBERSHIP: c_int = 12;
pub const IP_DROP_MEMBERSHIP: c_int = 13;
+ #[cfg(not(target_os = "netbsd"))]
+ pub const IPV6_ADD_MEMBERSHIP: c_int = libc::IPV6_ADD_MEMBERSHIP;
+ #[cfg(not(target_os = "netbsd"))]
+ pub const IPV6_DROP_MEMBERSHIP: c_int = libc::IPV6_DROP_MEMBERSHIP;
+
pub type InAddrT = u32;
// Declarations of special addresses
diff --git a/src/sys/socket/sockopt.rs b/src/sys/socket/sockopt.rs
index 4c7354ab..ede9d408 100644
--- a/src/sys/socket/sockopt.rs
+++ b/src/sys/socket/sockopt.rs
@@ -121,7 +121,9 @@ sockopt_impl!(Both, TcpNoDelay, consts::IPPROTO_TCP, consts::TCP_NODELAY, bool);
sockopt_impl!(Both, Linger, consts::SOL_SOCKET, consts::SO_LINGER, super::linger);
sockopt_impl!(SetOnly, IpAddMembership, consts::IPPROTO_IP, consts::IP_ADD_MEMBERSHIP, super::ip_mreq);
sockopt_impl!(SetOnly, IpDropMembership, consts::IPPROTO_IP, consts::IP_DROP_MEMBERSHIP, super::ip_mreq);
+#[cfg(not(target_os = "netbsd"))]
sockopt_impl!(SetOnly, Ipv6AddMembership, consts::IPPROTO_IPV6, consts::IPV6_ADD_MEMBERSHIP, super::ipv6_mreq);
+#[cfg(not(target_os = "netbsd"))]
sockopt_impl!(SetOnly, Ipv6DropMembership, consts::IPPROTO_IPV6, consts::IPV6_DROP_MEMBERSHIP, super::ipv6_mreq);
sockopt_impl!(Both, IpMulticastTtl, consts::IPPROTO_IP, consts::IP_MULTICAST_TTL, u8);
sockopt_impl!(Both, IpMulticastLoop, consts::IPPROTO_IP, consts::IP_MULTICAST_LOOP, bool);
diff --git a/src/sys/termios.rs b/src/sys/termios.rs
index 1ecac547..4e6b2e51 100644
--- a/src/sys/termios.rs
+++ b/src/sys/termios.rs
@@ -12,7 +12,7 @@ pub use self::ffi::consts::FlowArg::*;
mod ffi {
pub use self::consts::*;
- #[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "dragonfly", target_os = "openbsd", target_os = "linux"))]
+ #[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "dragonfly", target_os = "openbsd", target_os = "netbsd", target_os = "linux"))]
mod non_android {
use super::consts::*;
use libc::c_int;
@@ -36,7 +36,7 @@ mod ffi {
}
}
- #[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "dragonfly", target_os = "openbsd", target_os = "linux"))]
+ #[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "dragonfly", target_os = "openbsd", target_os = "netbsd", target_os = "linux"))]
pub use self::non_android::*;
// On Android before 5.0, Bionic directly inline these to ioctl() calls.
@@ -95,23 +95,23 @@ mod ffi {
pub use self::android::*;
- #[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "dragonfly", target_os = "openbsd"))]
+ #[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "dragonfly", target_os = "openbsd", target_os = "netbsd"))]
pub mod consts {
- #[cfg(not(target_os = "dragonfly"))]
+ #[cfg(not(any(target_os = "dragonfly", target_os = "netbsd")))]
use libc::{c_int, c_ulong, c_uchar};
- #[cfg(target_os = "dragonfly")]
+ #[cfg(any(target_os = "dragonfly", target_os = "netbsd"))]
use libc::{c_int, c_uint, c_uchar};
- #[cfg(not(target_os = "dragonfly"))]
+ #[cfg(not(any(target_os = "dragonfly", target_os = "netbsd")))]
pub type tcflag_t = c_ulong;
- #[cfg(target_os = "dragonfly")]
+ #[cfg(any(target_os = "dragonfly", target_os = "netbsd"))]
pub type tcflag_t = c_uint;
pub type cc_t = c_uchar;
- #[cfg(not(target_os = "dragonfly"))]
+ #[cfg(not(any(target_os = "dragonfly", target_os = "netbsd")))]
pub type speed_t = c_ulong;
- #[cfg(target_os = "dragonfly")]
+ #[cfg(any(target_os = "dragonfly", target_os = "netbsd"))]
pub type speed_t = c_uint;
#[repr(C)]
diff --git a/src/sys/wait.rs b/src/sys/wait.rs
index 4a0f8b7e..59f7f5c4 100644
--- a/src/sys/wait.rs
+++ b/src/sys/wait.rs
@@ -112,7 +112,8 @@ mod status {
#[cfg(any(target_os = "freebsd",
target_os = "openbsd",
- target_os = "dragonfly"))]
+ target_os = "dragonfly",
+ target_os = "netbsd"))]
mod status {
use sys::signal;