summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluozijun <gnulinux@126.com>2017-12-26 15:57:11 +0800
committerluozijun <gnulinux@126.com>2017-12-27 04:03:39 +0800
commit629908abe33f4594a04dd4b4091e6eaca4056302 (patch)
tree79c4911b0a77f9dd3232933b31ef30ba578ea6ea
parent5221616a7714428df82b38605a786bb9988b4391 (diff)
downloadrust-libc-629908abe33f4594a04dd4b4091e6eaca4056302.tar.gz
Add struct `bpf_hdr` on macOS
-rw-r--r--libc-test/build.rs1
-rw-r--r--src/unix/bsd/apple/b32.rs7
-rw-r--r--src/unix/bsd/apple/b64.rs7
3 files changed, 15 insertions, 0 deletions
diff --git a/libc-test/build.rs b/libc-test/build.rs
index a356be20d4..cc4ec04c93 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -170,6 +170,7 @@ fn main() {
cfg.header("sys/xattr.h");
cfg.header("sys/sys_domain.h");
cfg.header("net/if_utun.h");
+ cfg.header("net/bpf.h");
if target.starts_with("x86") {
cfg.header("crt_externs.h");
}
diff --git a/src/unix/bsd/apple/b32.rs b/src/unix/bsd/apple/b32.rs
index 53fc0ae19d..5dea472ccb 100644
--- a/src/unix/bsd/apple/b32.rs
+++ b/src/unix/bsd/apple/b32.rs
@@ -41,6 +41,13 @@ s! {
pub ifi_reserved1: u32,
pub ifi_reserved2: u32,
}
+
+ pub struct bpf_hdr {
+ pub bh_tstamp: ::timeval,
+ pub bh_caplen: ::uint32_t,
+ pub bh_datalen: ::uint32_t,
+ pub bh_hdrlen: ::c_ushort,
+ }
}
pub const __PTHREAD_MUTEX_SIZE__: usize = 40;
diff --git a/src/unix/bsd/apple/b64.rs b/src/unix/bsd/apple/b64.rs
index e4a3981941..2b34f85345 100644
--- a/src/unix/bsd/apple/b64.rs
+++ b/src/unix/bsd/apple/b64.rs
@@ -46,6 +46,13 @@ s! {
pub ifi_reserved1: u32,
pub ifi_reserved2: u32,
}
+
+ pub struct bpf_hdr {
+ pub bh_tstamp: ::timeval32,
+ pub bh_caplen: ::uint32_t,
+ pub bh_datalen: ::uint32_t,
+ pub bh_hdrlen: ::c_ushort,
+ }
}
pub const __PTHREAD_MUTEX_SIZE__: usize = 56;