diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs index 3f08a98efc76e49003d1a691b37d29529de25ae2..a56d236b520259765c66faae01591949a60d898b 100644 --- a/src/unix/linux_like/android/mod.rs +++ b/src/unix/linux_like/android/mod.rs @@ -208,6 +208,16 @@ s! { pub cookie: u32, pub len: u32 } + + 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! { @@ -2081,6 +2091,14 @@ pub const FUTEX_CLOCK_REALTIME: ::c_int = 256; pub const FUTEX_CMD_MASK: ::c_int = !(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME); +// linux/errqueue.h +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; + f! { pub fn CMSG_NXTHDR(mhdr: *const msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr { @@ -2140,6 +2158,10 @@ f! { pub fn NLA_ALIGN(len: ::c_int) -> ::c_int { return ((len) + NLA_ALIGNTO - 1) & !(NLA_ALIGNTO - 1) } + + pub fn SO_EE_OFFENDER(ee: *const ::sock_extended_err) -> *mut ::sockaddr { + ee.offset(1) as *mut ::sockaddr + } } extern "C" { diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index 220b38ebd5bda061d8bb77f97bfcef136cc53048..5992c934ea0f3b078c058209bedded7bbabd96fd 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -494,6 +494,16 @@ s! { pub rm_so: regoff_t, pub rm_eo: regoff_t, } + + 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! { @@ -2540,6 +2550,14 @@ pub const REG_ERANGE: ::c_int = 11; pub const REG_ESPACE: ::c_int = 12; pub const REG_BADRPT: ::c_int = 13; +// linux/errqueue.h +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; + f! { pub fn NLA_ALIGN(len: ::c_int) -> ::c_int { return ((len) + NLA_ALIGNTO - 1) & !(NLA_ALIGNTO - 1) @@ -2640,6 +2658,10 @@ f! { pub fn RT_LOCALADDR(flags: u32) -> bool { (flags & RTF_ADDRCLASSMASK) == (RTF_LOCAL | RTF_INTERFACE) } + + pub fn SO_EE_OFFENDER(ee: *const ::sock_extended_err) -> *mut ::sockaddr { + ee.offset(1) as *mut ::sockaddr + } } extern "C" { diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs index a867ed4b080721c9a4fde31fb276dd195b5fa574..2d0b8e48b6dbc1f92ef91e8eaf890f137ec715f9 100644 --- a/src/unix/linux_like/mod.rs +++ b/src/unix/linux_like/mod.rs @@ -199,16 +199,6 @@ 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! { @@ -1202,13 +1192,6 @@ 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::<usize>() - 1 & !(::mem::size_of::<usize>() - 1) @@ -1314,10 +1297,6 @@ 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" {