diff options
-rw-r--r-- | libc-test/build.rs | 1 | ||||
-rw-r--r-- | src/redox/mod.rs | 1 | ||||
-rw-r--r-- | src/unix/bsd/apple/mod.rs | 16 | ||||
-rw-r--r-- | src/unix/bsd/freebsdlike/mod.rs | 10 | ||||
-rw-r--r-- | src/unix/bsd/netbsdlike/mod.rs | 11 | ||||
-rw-r--r-- | src/unix/haiku/mod.rs | 1 | ||||
-rw-r--r-- | src/unix/mod.rs | 15 | ||||
-rw-r--r-- | src/unix/notbsd/emscripten.rs | 15 | ||||
-rw-r--r-- | src/unix/notbsd/linux/mod.rs | 15 | ||||
-rw-r--r-- | src/unix/notbsd/mod.rs | 95 | ||||
-rw-r--r-- | src/unix/solaris/mod.rs | 2 | ||||
-rw-r--r-- | src/unix/uclibc/mod.rs | 2 |
12 files changed, 173 insertions, 11 deletions
diff --git a/libc-test/build.rs b/libc-test/build.rs index a39e317971..b76b6f09ce 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -85,6 +85,7 @@ fn main() { } cfg.header("net/if.h"); cfg.header("net/route.h"); + cfg.header("net/if_arp.h"); cfg.header("netdb.h"); cfg.header("netinet/in.h"); cfg.header("netinet/ip.h"); diff --git a/src/redox/mod.rs b/src/redox/mod.rs index 793fd32c88..e32c4b385b 100644 --- a/src/redox/mod.rs +++ b/src/redox/mod.rs @@ -119,6 +119,7 @@ pub const SIGSYS: ::c_int = 31; extern { pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int; + pub fn getpid() -> pid_t; pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void; pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t) -> ::ssize_t; diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index d97eb3f4f6..fdc8daba26 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -549,6 +549,14 @@ s! { pub shm_internal: *mut ::c_void, } + + pub struct arphdr { + pub ar_hrd: u16, + pub ar_pro: u16, + pub ar_hln: u8, + pub ar_pln: u8, + pub ar_op: u16, + } } pub const _UTX_USERSIZE: usize = 256; @@ -1859,6 +1867,9 @@ pub const NI_MAXHOST: ::socklen_t = 1025; pub const Q_GETQUOTA: ::c_int = 0x300; pub const Q_SETQUOTA: ::c_int = 0x400; +pub const RENAME_SWAP: ::c_uint = 0x00000002; +pub const RENAME_EXCL: ::c_uint = 0x00000004; + pub const RTLD_LOCAL: ::c_int = 0x4; pub const RTLD_FIRST: ::c_int = 0x100; pub const RTLD_NODELETE: ::c_int = 0x80; @@ -2451,6 +2462,11 @@ extern { size: ::size_t, flags: ::c_int) -> ::ssize_t; pub fn removexattr(path: *const ::c_char, name: *const ::c_char, flags: ::c_int) -> ::c_int; + pub fn renamex_np(from: *const ::c_char, to: *const ::c_char, + flags: ::c_uint) -> ::c_int; + pub fn renameatx_np(fromfd: ::c_int, from: *const ::c_char, + tofd: ::c_int, to: *const ::c_char, + flags: ::c_uint) -> ::c_int; pub fn fremovexattr(filedes: ::c_int, name: *const ::c_char, flags: ::c_int) -> ::c_int; diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index cf3e41b5f4..75a7a670e9 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -180,6 +180,14 @@ s! { pub ipi6_addr: ::in6_addr, pub ipi6_ifindex: ::c_uint, } + + pub struct arphdr { + pub ar_hrd: u16, + pub ar_pro: u16, + pub ar_hln: u8, + pub ar_pln: u8, + pub ar_op: u16, + } } pub const AIO_LISTIO_MAX: ::c_int = 16; @@ -1170,8 +1178,6 @@ extern { pub fn setpriority(which: ::c_int, who: ::c_int, prio: ::c_int) -> ::c_int; pub fn rtprio(function: ::c_int, pid: ::pid_t, rtp: *mut rtprio) -> ::c_int; - pub fn fdopendir(fd: ::c_int) -> *mut ::DIR; - #[cfg_attr(target_os = "freebsd", link_name = "mknodat@FBSD_1.1")] pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t, dev: dev_t) -> ::c_int; diff --git a/src/unix/bsd/netbsdlike/mod.rs b/src/unix/bsd/netbsdlike/mod.rs index a7c6f960e7..1b7576e768 100644 --- a/src/unix/bsd/netbsdlike/mod.rs +++ b/src/unix/bsd/netbsdlike/mod.rs @@ -57,6 +57,15 @@ s! { pub l_type: ::c_short, pub l_whence: ::c_short, } + + #[repr(packed)] + pub struct arphdr { + pub ar_hrd: u16, + pub ar_pro: u16, + pub ar_hln: u8, + pub ar_pln: u8, + pub ar_op: u16, + } } pub const D_T_FMT: ::nl_item = 0; @@ -631,8 +640,6 @@ extern { pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int; pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int; - pub fn fdopendir(fd: ::c_int) -> *mut ::DIR; - pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t, dev: dev_t) -> ::c_int; pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, diff --git a/src/unix/haiku/mod.rs b/src/unix/haiku/mod.rs index 8e312856ed..dd3dc7b163 100644 --- a/src/unix/haiku/mod.rs +++ b/src/unix/haiku/mod.rs @@ -1097,7 +1097,6 @@ extern { pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t, options: ::c_int) -> ::c_int; - pub fn fdopendir(fd: ::c_int) -> *mut ::DIR; pub fn glob(pattern: *const ::c_char, flags: ::c_int, errfunc: Option<extern fn(epath: *const ::c_char, diff --git a/src/unix/mod.rs b/src/unix/mod.rs index d6cde7ae71..15c7821fa1 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -268,6 +268,14 @@ pub const INADDR_ANY: in_addr_t = 0; pub const INADDR_BROADCAST: in_addr_t = 4294967295; pub const INADDR_NONE: in_addr_t = 4294967295; +pub const ARPOP_REQUEST: u16 = 1; +pub const ARPOP_REPLY: u16 = 2; + +pub const ATF_COM: ::c_int = 0x02; +pub const ATF_PERM: ::c_int = 0x04; +pub const ATF_PUBL: ::c_int = 0x08; +pub const ATF_USETRAILERS: ::c_int = 0x10; + cfg_if! { if #[cfg(cross_platform_docs)] { // on dox builds don't pull in anything @@ -416,6 +424,13 @@ extern { link_name = "opendir$INODE64$UNIX2003")] #[cfg_attr(target_os = "netbsd", link_name = "__opendir30")] pub fn opendir(dirname: *const c_char) -> *mut ::DIR; + + #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), + link_name = "fdopendir$INODE64")] + #[cfg_attr(all(target_os = "macos", target_arch = "x86"), + link_name = "fdopendir$INODE64$UNIX2003")] + pub fn fdopendir(fd: ::c_int) -> *mut ::DIR; + #[cfg_attr(target_os = "macos", link_name = "readdir$INODE64")] #[cfg_attr(target_os = "netbsd", link_name = "__readdir30")] #[cfg_attr(target_os = "freebsd", link_name = "readdir@FBSD_1.0")] diff --git a/src/unix/notbsd/emscripten.rs b/src/unix/notbsd/emscripten.rs index 0d314ec15d..6216947ee5 100644 --- a/src/unix/notbsd/emscripten.rs +++ b/src/unix/notbsd/emscripten.rs @@ -451,6 +451,15 @@ s! { pub f_namemax: ::c_ulong, __f_spare: [::c_int; 6], } + + pub struct arpd_request { + pub req: ::c_ushort, + pub ip: u32, + pub dev: ::c_ulong, + pub stamp: ::c_ulong, + pub updated: ::c_ulong, + pub ha: [::c_uchar; ::MAX_ADDR_LEN], + } } pub const ABDAY_1: ::nl_item = 0x20000; @@ -1474,6 +1483,12 @@ pub const TIOCM_CD: ::c_int = TIOCM_CAR; pub const TIOCM_RI: ::c_int = TIOCM_RNG; pub const O_TMPFILE: ::c_int = 0x400000; +pub const MAX_ADDR_LEN: usize = 7; +pub const ARPD_UPDATE: ::c_ushort = 0x01; +pub const ARPD_LOOKUP: ::c_ushort = 0x02; +pub const ARPD_FLUSH: ::c_ushort = 0x03; +pub const ATF_MAGIC: ::c_int = 0x80; + f! { pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () { for slot in cpuset.bits.iter_mut() { diff --git a/src/unix/notbsd/linux/mod.rs b/src/unix/notbsd/linux/mod.rs index 60e0d8e2a8..fdd26f8409 100644 --- a/src/unix/notbsd/linux/mod.rs +++ b/src/unix/notbsd/linux/mod.rs @@ -464,6 +464,15 @@ s! { pub ipi6_addr: ::in6_addr, pub ipi6_ifindex: ::c_uint, } + + pub struct arpd_request { + pub req: ::c_ushort, + pub ip: u32, + pub dev: ::c_ulong, + pub stamp: ::c_ulong, + pub updated: ::c_ulong, + pub ha: [::c_uchar; ::MAX_ADDR_LEN], + } } pub const ABDAY_1: ::nl_item = 0x20000; @@ -1467,6 +1476,12 @@ pub const RTMSG_DELRULE: u32 = 0x32; pub const RTMSG_CONTROL: u32 = 0x40; pub const RTMSG_AR_FAILED: u32 = 0x51; +pub const MAX_ADDR_LEN: usize = 7; +pub const ARPD_UPDATE: ::c_ushort = 0x01; +pub const ARPD_LOOKUP: ::c_ushort = 0x02; +pub const ARPD_FLUSH: ::c_ushort = 0x03; +pub const ATF_MAGIC: ::c_int = 0x80; + f! { pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () { for slot in cpuset.bits.iter_mut() { diff --git a/src/unix/notbsd/mod.rs b/src/unix/notbsd/mod.rs index 2de3ac8876..eead3fd847 100644 --- a/src/unix/notbsd/mod.rs +++ b/src/unix/notbsd/mod.rs @@ -206,6 +206,29 @@ s! { rtmsg_flags: u32, rtmsg_ifindex: ::c_int, } + + pub struct arpreq { + pub arp_pa: ::sockaddr, + pub arp_ha: ::sockaddr, + pub arp_flags: ::c_int, + pub arp_netmask: ::sockaddr, + pub arp_dev: [::c_char; 16], + } + + pub struct arpreq_old { + pub arp_pa: ::sockaddr, + pub arp_ha: ::sockaddr, + pub arp_flags: ::c_int, + pub arp_netmask: ::sockaddr, + } + + pub struct arphdr { + pub ar_hrd: u16, + pub ar_pro: u16, + pub ar_hln: u8, + pub ar_pln: u8, + pub ar_op: u16, + } } // intentionally not public, only used for fd_set @@ -883,6 +906,76 @@ pub const IPOPT_TS_TSONLY: u8 = 0; pub const IPOPT_TS_TSANDADDR: u8 = 1; pub const IPOPT_TS_PRESPEC: u8 = 3; +pub const ARPOP_RREQUEST: u16 = 3; +pub const ARPOP_RREPLY: u16 = 4; +pub const ARPOP_InREQUEST: u16 = 8; +pub const ARPOP_InREPLY: u16 = 9; +pub const ARPOP_NAK: u16 = 10; + +pub const ATF_NETMASK: ::c_int = 0x20; +pub const ATF_DONTPUB: ::c_int = 0x40; + +pub const ARPHRD_NETROM: u16 = 0; +pub const ARPHRD_ETHER: u16 = 1; +pub const ARPHRD_EETHER: u16 = 2; +pub const ARPHRD_AX25: u16 = 3; +pub const ARPHRD_PRONET: u16 = 4; +pub const ARPHRD_CHAOS: u16 = 5; +pub const ARPHRD_IEEE802: u16 = 6; +pub const ARPHRD_ARCNET: u16 = 7; +pub const ARPHRD_APPLETLK: u16 = 8; +pub const ARPHRD_DLCI: u16 = 15; +pub const ARPHRD_ATM: u16 = 19; +pub const ARPHRD_METRICOM: u16 = 23; +pub const ARPHRD_IEEE1394: u16 = 24; +pub const ARPHRD_EUI64: u16 = 27; +pub const ARPHRD_INFINIBAND: u16 = 32; + +pub const ARPHRD_SLIP: u16 = 256; +pub const ARPHRD_CSLIP: u16 = 257; +pub const ARPHRD_SLIP6: u16 = 258; +pub const ARPHRD_CSLIP6: u16 = 259; +pub const ARPHRD_RSRVD: u16 = 260; +pub const ARPHRD_ADAPT: u16 = 264; +pub const ARPHRD_ROSE: u16 = 270; +pub const ARPHRD_X25: u16 = 271; +pub const ARPHRD_HWX25: u16 = 272; +pub const ARPHRD_PPP: u16 = 512; +pub const ARPHRD_CISCO: u16 = 513; +pub const ARPHRD_HDLC: u16 = ARPHRD_CISCO; +pub const ARPHRD_LAPB: u16 = 516; +pub const ARPHRD_DDCMP: u16 = 517; +pub const ARPHRD_RAWHDLC: u16 = 518; + +pub const ARPHRD_TUNNEL: u16 = 768; +pub const ARPHRD_TUNNEL6: u16 = 769; +pub const ARPHRD_FRAD: u16 = 770; +pub const ARPHRD_SKIP: u16 = 771; +pub const ARPHRD_LOOPBACK: u16 = 772; +pub const ARPHRD_LOCALTLK: u16 = 773; +pub const ARPHRD_FDDI: u16 = 774; +pub const ARPHRD_BIF: u16 = 775; +pub const ARPHRD_SIT: u16 = 776; +pub const ARPHRD_IPDDP: u16 = 777; +pub const ARPHRD_IPGRE: u16 = 778; +pub const ARPHRD_PIMREG: u16 = 779; +pub const ARPHRD_HIPPI: u16 = 780; +pub const ARPHRD_ASH: u16 = 781; +pub const ARPHRD_ECONET: u16 = 782; +pub const ARPHRD_IRDA: u16 = 783; +pub const ARPHRD_FCPP: u16 = 784; +pub const ARPHRD_FCAL: u16 = 785; +pub const ARPHRD_FCPL: u16 = 786; +pub const ARPHRD_FCFABRIC: u16 = 787; +pub const ARPHRD_IEEE802_TR: u16 = 800; +pub const ARPHRD_IEEE80211: u16 = 801; +pub const ARPHRD_IEEE80211_PRISM: u16 = 802; +pub const ARPHRD_IEEE80211_RADIOTAP: u16 = 803; +pub const ARPHRD_IEEE802154: u16 = 804; + +pub const ARPHRD_VOID: u16 = 0xFFFF; +pub const ARPHRD_NONE: u16 = 0xFFFE; + f! { pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () { let fd = fd as usize; @@ -1036,8 +1129,6 @@ extern { pub fn stat64(path: *const c_char, buf: *mut stat64) -> ::c_int; pub fn truncate64(path: *const c_char, length: off64_t) -> ::c_int; - pub fn fdopendir(fd: ::c_int) -> *mut ::DIR; - pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t, dev: dev_t) -> ::c_int; pub fn pthread_condattr_getclock(attr: *const pthread_condattr_t, diff --git a/src/unix/solaris/mod.rs b/src/unix/solaris/mod.rs index aecc611777..d76bb80270 100644 --- a/src/unix/solaris/mod.rs +++ b/src/unix/solaris/mod.rs @@ -1297,8 +1297,6 @@ extern { pub fn getpriority(which: ::c_int, who: ::c_int) -> ::c_int; pub fn setpriority(which: ::c_int, who: ::c_int, prio: ::c_int) -> ::c_int; - pub fn fdopendir(fd: ::c_int) -> *mut ::DIR; - pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t, dev: dev_t) -> ::c_int; pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, diff --git a/src/unix/uclibc/mod.rs b/src/unix/uclibc/mod.rs index 49f7792d0a..e9c1f21e9e 100644 --- a/src/unix/uclibc/mod.rs +++ b/src/unix/uclibc/mod.rs @@ -1612,8 +1612,6 @@ extern { pub fn truncate64(path: *const c_char, length: off64_t) -> ::c_int; pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int; - pub fn fdopendir(fd: ::c_int) -> *mut ::DIR; - pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t, dev: dev_t) -> ::c_int; pub fn ppoll(fds: *mut ::pollfd, |