diff --git a/libc-test/build.rs b/libc-test/build.rs index 824bae5d..4f8cf70a 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -2189,6 +2189,7 @@ fn test_linux(target: &str) { cfg: "asm/mman.h", "linux/dccp.h", + "linux/errqueue.h", "linux/falloc.h", "linux/fs.h", "linux/futex.h", diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs index 792548f9..5b2fb11c 100644 --- a/src/unix/linux_like/mod.rs +++ b/src/unix/linux_like/mod.rs @@ -199,6 +199,16 @@ s! { pub msg_hdr: ::msghdr, pub msg_len: ::c_uint, } + + pub struct sock_extended_err { + pub ee_errno: u32, + pub ee_origin: u8, + pub ee_type: u8, + pub ee_code: u8, + pub ee_pad: u8, + pub ee_info: u32, + pub ee_data: u32 + } } s_no_extra_traits! { @@ -1189,6 +1199,13 @@ pub const ARPHRD_IEEE802154: u16 = 804; pub const ARPHRD_VOID: u16 = 0xFFFF; pub const ARPHRD_NONE: u16 = 0xFFFE; +pub const SO_EE_ORIGIN_NONE: u8 = 0; +pub const SO_EE_ORIGIN_LOCAL: u8 = 1; +pub const SO_EE_ORIGIN_ICMP: u8 = 2; +pub const SO_EE_ORIGIN_ICMP6: u8 = 3; +pub const SO_EE_ORIGIN_TXSTATUS: u8 = 4; +pub const SO_EE_ORIGIN_TIMESTAMPING: u8 = SO_EE_ORIGIN_TXSTATUS; + const_fn! { {const} fn CMSG_ALIGN(len: usize) -> usize { len + ::mem::size_of::() - 1 & !(::mem::size_of::() - 1) @@ -1294,6 +1311,10 @@ f! { pub fn IPTOS_ECN(x: u8) -> u8 { x & ::IPTOS_ECN_MASK } + + pub fn SO_EE_OFFENDER(ee: *const ::sock_extended_err) -> *mut ::sockaddr { + ee.offset(1) as *mut ::sockaddr + } } extern "C" {