diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs
index a9ac3ba0e188befe3c4c96e305e3a0a131116ca6..4680389e60c48c360dbb75878d392af27b8915b1 100644
--- a/src/unix/bsd/apple/mod.rs
+++ b/src/unix/bsd/apple/mod.rs
@@ -1549,6 +1549,8 @@ pub const IPV6_LEAVE_GROUP: ::c_int = 13;
 pub const IPV6_PKTINFO: ::c_int = 46;
 pub const IPV6_RECVPKTINFO: ::c_int = 61;
 
+pub const TCP_NOPUSH: ::c_int = 4;
+pub const TCP_NOOPT: ::c_int = 8;
 pub const TCP_KEEPALIVE: ::c_int = 0x10;
 
 pub const SOL_LOCAL: ::c_int = 0;
diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs
index 5948a71fc7e273bf27abcf26d8e7444aa611a527..30228640d448671a0e3fb03c7fa38de3afab96ed 100644
--- a/src/unix/bsd/freebsdlike/mod.rs
+++ b/src/unix/bsd/freebsdlike/mod.rs
@@ -669,6 +669,8 @@ pub const IPV6_LEAVE_GROUP: ::c_int = 13;
 pub const IPV6_RECVPKTINFO: ::c_int = 36;
 pub const IPV6_PKTINFO: ::c_int = 46;
 
+pub const TCP_NOPUSH:    ::c_int = 4;
+pub const TCP_NOOPT:     ::c_int = 8;
 pub const TCP_KEEPIDLE:  ::c_int = 256;
 pub const TCP_KEEPINTVL: ::c_int = 512;
 pub const TCP_KEEPCNT:   ::c_int = 1024;
diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs
index a7ac8d7874cdbd6c1f7619521d32882acd831521..770b9b98180f87c933514be74a72f30e06cae0cb 100644
--- a/src/unix/bsd/mod.rs
+++ b/src/unix/bsd/mod.rs
@@ -318,8 +318,6 @@ pub const LOG_PERROR: ::c_int = 0x20;
 
 pub const TCP_NODELAY: ::c_int = 1;
 pub const TCP_MAXSEG: ::c_int = 2;
-pub const TCP_NOPUSH: ::c_int = 4;
-pub const TCP_NOOPT: ::c_int = 8;
 
 pub const PIPE_BUF: usize = 512;
 
diff --git a/src/unix/bsd/netbsdlike/mod.rs b/src/unix/bsd/netbsdlike/mod.rs
index 3d8c05b1ddc018aef11937ddf0992391789c9bd0..468d3fdd2598e5785ba56972c3e3f3af99e4d856 100644
--- a/src/unix/bsd/netbsdlike/mod.rs
+++ b/src/unix/bsd/netbsdlike/mod.rs
@@ -431,14 +431,6 @@ pub const IP_DROP_MEMBERSHIP: ::c_int = 13;
 pub const IPV6_RECVPKTINFO: ::c_int = 36;
 pub const IPV6_PKTINFO: ::c_int = 46;
 
-pub const TCP_KEEPIDLE: ::c_int = 3;
-pub const TCP_KEEPINTVL: ::c_int = 5;
-pub const TCP_KEEPCNT: ::c_int = 6;
-pub const TCP_KEEPINIT: ::c_int = 7;
-pub const TCP_INFO: ::c_int = 9;
-pub const TCP_MD5SIG: ::c_int = 0x10;
-pub const TCP_CONGCTL: ::c_int = 0x20;
-
 pub const SOL_SOCKET: ::c_int = 0xffff;
 pub const SO_DEBUG: ::c_int = 0x01;
 pub const SO_ACCEPTCONN: ::c_int = 0x0002;
@@ -611,11 +603,6 @@ f! {
     }
 }
 
-extern {
-    pub fn chflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int;
-    pub fn fchflags(fd: ::c_int, flags: ::c_ulong) -> ::c_int;
-}
-
 #[link(name = "util")]
 extern {
     pub fn mincore(addr: *mut ::c_void, len: ::size_t,
diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs
index 5fedee60b139c24b02cf986e5fd20edbed798833..786b9c74e637c0f2965cb04b52e4dc00aa4ae544 100644
--- a/src/unix/bsd/netbsdlike/netbsd/mod.rs
+++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs
@@ -399,9 +399,14 @@ pub const IPV6_JOIN_GROUP: ::c_int = 12;
 pub const IPV6_LEAVE_GROUP: ::c_int = 13;
 
 pub const TCP_KEEPIDLE:  ::c_int = 3;
+pub const TCP_NOPUSH:    ::c_int = 4;
 pub const TCP_KEEPINTVL: ::c_int = 5;
 pub const TCP_KEEPCNT:   ::c_int = 6;
 pub const TCP_KEEPINIT:  ::c_int = 7;
+pub const TCP_NOOPT:     ::c_int = 8;
+pub const TCP_INFO:      ::c_int = 9;
+pub const TCP_MD5SIG:    ::c_int = 0x10;
+pub const TCP_CONGCTL:   ::c_int = 0x20;
 
 pub const SOCK_CONN_DGRAM: ::c_int = 6;
 pub const SOCK_DCCP: ::c_int = SOCK_CONN_DGRAM;
@@ -1032,6 +1037,8 @@ extern {
     pub fn lio_listio(mode: ::c_int, aiocb_list: *const *mut aiocb,
                       nitems: ::c_int, sevp: *mut sigevent) -> ::c_int;
 
+    pub fn chflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int;
+    pub fn fchflags(fd: ::c_int, flags: ::c_ulong) -> ::c_int;
     pub fn lchflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int;
 
     pub fn extattr_delete_fd(fd: ::c_int,
diff --git a/src/unix/bsd/netbsdlike/openbsdlike/mod.rs b/src/unix/bsd/netbsdlike/openbsdlike/mod.rs
index 01e9cca2379af18cca7d765ddbf280af0cc3ac9d..85f0a02a12ead33263cada3ac827cbe96d2b8e20 100644
--- a/src/unix/bsd/netbsdlike/openbsdlike/mod.rs
+++ b/src/unix/bsd/netbsdlike/openbsdlike/mod.rs
@@ -321,6 +321,7 @@ pub const IP_RECVDSTADDR: ::c_int = 7;
 pub const IP_SENDSRCADDR: ::c_int = IP_RECVDSTADDR;
 
 // sys/netinet/in.h
+pub const TCP_MD5SIG: ::c_int = 0x04;
 pub const TCP_NOPUSH: ::c_int = 0x10;
 
 pub const AF_ECMA: ::c_int = 8;
@@ -667,7 +668,8 @@ pub const KERN_GLOBAL_PTRACE: ::c_int = 81;
 pub const KERN_CONSBUFSIZE: ::c_int = 82;
 pub const KERN_CONSBUF: ::c_int = 83;
 pub const KERN_AUDIO: ::c_int = 84;
-pub const KERN_MAXID: ::c_int = 85;
+pub const KERN_CPUSTATS: ::c_int = 85;
+pub const KERN_MAXID: ::c_int = 86;
 pub const KERN_PROC_ALL: ::c_int = 0;
 pub const KERN_PROC_PID: ::c_int = 1;
 pub const KERN_PROC_PGRP: ::c_int = 2;
@@ -710,7 +712,9 @@ f! {
 }
 
 extern {
-    pub fn chflagsat(fd: ::c_int, path: *const ::c_char, flags: ::c_ulong,
+    pub fn chflags(path: *const ::c_char, flags: ::c_uint) -> ::c_int;
+    pub fn fchflags(fd: ::c_int, flags: ::c_uint) -> ::c_int;
+    pub fn chflagsat(fd: ::c_int, path: *const ::c_char, flags: ::c_uint,
                      atflag: ::c_int) -> ::c_int;
     pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
     pub fn getnameinfo(sa: *const ::sockaddr,