From 1f6573b854643be992584c0ad769af81278ef415 Mon Sep 17 00:00:00 2001 From: Florian Bartels Date: Mon, 2 Dec 2024 11:40:19 +0100 Subject: [PATCH] Adhere to coding guidelines Signed-off-by: Florian Bartels --- libc-test/build.rs | 5 +- src/unix/mod.rs | 20 ++- src/unix/nto/mod.rs | 411 +++++++++++++++++--------------------------- 3 files changed, 173 insertions(+), 263 deletions(-) diff --git a/libc-test/build.rs b/libc-test/build.rs index 8f5bbd31d721..8050340731a0 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -3056,7 +3056,10 @@ fn test_neutrino(target: &str) { let mut cfg = ctest_cfg(); if target.ends_with("_iosock") { - cfg.include(concat!(env!("QNX_TARGET"), "/usr/include/io-sock")); + let qnx_target_val = std::env::var("QNX_TARGET") + .unwrap_or_else(|_| "QNX_TARGET_not_set_please_source_qnxsdp".into()); + + cfg.include(qnx_target_val + "/usr/include/io-sock"); headers! { cfg: "io-sock.h", "sys/types.h", diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 8aaedb1972b0..37b9261eace2 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -337,8 +337,8 @@ pub const ATF_USETRAILERS: c_int = 0x10; cfg_if! { if #[cfg(target_os = "nto")] { - pub const FNM_PERIOD: c_int = 1 << 1;} - else { + pub const FNM_PERIOD: c_int = 1 << 1; + } else { pub const FNM_PERIOD: c_int = 1 << 2; } } @@ -360,12 +360,22 @@ cfg_if! { target_os = "openbsd", ))] { pub const FNM_PATHNAME: c_int = 1 << 1; - pub const FNM_NOESCAPE: c_int = 1 << 0; } else { pub const FNM_PATHNAME: c_int = 1 << 0; - #[cfg(target_os = "nto")] + } +} + +cfg_if! { + if #[cfg(any( + target_os = "macos", + target_os = "freebsd", + target_os = "android", + target_os = "openbsd", + ))] { + pub const FNM_NOESCAPE: c_int = 1 << 0; + } else if #[cfg(target_os = "nto")] { pub const FNM_NOESCAPE: c_int = 1 << 2; - #[cfg(not(target_os = "nto"))] + } else { pub const FNM_NOESCAPE: c_int = 1 << 1; } } diff --git a/src/unix/nto/mod.rs b/src/unix/nto/mod.rs index 3f243daf8d88..35cb5e7fc9fc 100644 --- a/src/unix/nto/mod.rs +++ b/src/unix/nto/mod.rs @@ -1273,10 +1273,123 @@ pub const MS_SYNC: c_int = 2; pub const SCM_RIGHTS: c_int = 0x01; pub const SCM_TIMESTAMP: c_int = 0x02; -#[cfg(not(target_env = "nto71_iosock"))] -pub const SCM_CREDS: c_int = 0x04; -#[cfg(target_env = "nto71_iosock")] -pub const SCM_CREDS: c_int = 0x03; +cfg_if! { + if #[cfg(not(target_env = "nto71_iosock"))] { + pub const SCM_CREDS: c_int = 0x04; + pub const IFF_NOTRAILERS: c_int = 0x00000020; + pub const AF_INET6: c_int = 24; + pub const AF_BLUETOOTH: c_int = 31; + pub const AF_BLUETOOTH: c_int = 36; + pub const pseudo_AF_KEY: c_int = 29; + pub const MSG_NOSIGNAL: c_int = 0x0800; + pub const MSG_WAITFORONE: c_int = 0x2000; + pub const IP_IPSEC_POLICY_COMPAT: c_int = 22; + pub const IP_PKTINFO: c_int = 25; + pub const IPPROTO_DIVERT: c_int = 259; + pub const IPV6_IPSEC_POLICY_COMPAT: c_int = 28; + pub const TCP_KEEPALIVE: c_int = 0x04; + pub const ARPHRD_ARCNET: u16 = 7; + pub const SO_BINDTODEVICE: c_int = 0x0800; + pub const EAI_NODATA: c_int = 7; + pub const IPTOS_ECN_NOT_ECT: u8 = 0x00; + pub const RTF_BROADCAST: u32 = 0x80000; + pub const UDP_ENCAP: c_int = 100; + pub const HW_IOSTATS: c_int = 9; + pub const HW_MACHINE_ARCH: c_int = 10; + pub const HW_ALIGNBYTES: c_int = 11; + pub const HW_CNMAGIC: c_int = 12; + pub const HW_PHYSMEM64: c_int = 13; + pub const HW_USERMEM64: c_int = 14; + pub const HW_IOSTATNAMES: c_int = 15; + pub const HW_MAXID: c_int = 15; + pub const CTL_UNSPEC: c_int = 0; + pub const CTL_QNX: c_int = 9; + pub const CTL_PROC: c_int = 10; + pub const CTL_VENDOR: c_int = 11; + pub const CTL_EMUL: c_int = 12; + pub const CTL_SECURITY: c_int = 13; + pub const CTL_MAXID: c_int = 14; + pub const AF_ARP: c_int = 28; + pub const AF_IEEE80211: c_int = 32; + pub const AF_NATM: c_int = 27; + pub const AF_NS: c_int = 6; + pub const BIOCGDLTLIST: c_int = -1072676233; + pub const BIOCGETIF: c_int = 1083196011; + pub const BIOCGSEESENT: c_int = 1074020984; + pub const BIOCGSTATS: c_int = 1082147439; + pub const BIOCSDLT: c_int = -2147204490; + pub const BIOCSETIF: c_int = -2138029460; + pub const BIOCSSEESENT: c_int = -2147204487; + pub const FIONSPACE: c_int = 1074030200; + pub const FIONWRITE: c_int = 1074030201; + pub const IFF_ACCEPTRTADV: c_int = 0x40000000; + pub const IFF_IP6FORWARDING: c_int = 0x20000000; + pub const IFF_SHIM: c_int = 0x80000000; + pub const KERN_ARND: c_int = 81; + pub const KERN_IOV_MAX: c_int = 38; + pub const KERN_LOGSIGEXIT: c_int = 46; + pub const KERN_MAXID: c_int = 83; + pub const KERN_PROC_ARGS: c_int = 48; + pub const KERN_PROC_ENV: c_int = 3; + pub const KERN_PROC_GID: c_int = 11; + pub const KERN_PROC_RGID: c_int = 8; + pub const LOCAL_CONNWAIT: c_int = 0x0002; + pub const LOCAL_CREDS: c_int = 0x0001; + pub const LOCAL_PEEREID: c_int = 0x0003; + pub const MSG_NOTIFICATION: c_int = 0x0400; + pub const NET_RT_IFLIST: c_int = 4; + pub const NI_NUMERICSCOPE: c_int = 0x00000040; + pub const PF_ARP: c_int = 28; + pub const PF_NATM: c_int = 27; + pub const pseudo_AF_HDRCMPLT: c_int = 30; + pub const SIOCGIFADDR: c_int = -1064277727; + pub const SO_FIB: c_int = 0x100a; + pub const SO_TXPRIO: c_int = 0x100b; + pub const SO_SETFIB: c_int = 0x100a; + pub const SO_VLANPRIO: c_int = 0x100c; + pub const USER_ATEXIT_MAX: c_int = 21; + pub const USER_MAXID: c_int = 22; + pub const SO_OVERFLOWED: c_int = 0x1009; + } else { + pub const SCM_CREDS: c_int = 0x03; + pub const AF_INET6: c_int = 28; + pub const AF_BLUETOOTH: c_int = 36; + pub const pseudo_AF_KEY: c_int = 27; + pub const MSG_NOSIGNAL: c_int = 0x20000; + pub const MSG_WAITFORONE: c_int = 0x00080000; + pub const IPPROTO_DIVERT: c_int = 258; + pub const RTF_BROADCAST: u32 = 0x400000; + pub const UDP_ENCAP: c_int = 1; + pub const HW_MACHINE_ARCH: c_int = 11; + pub const AF_ARP: c_int = 35; + pub const AF_IEEE80211: c_int = 37; + pub const AF_NATM: c_int = 29; + pub const BIOCGDLTLIST: c_ulong = 0xffffffffc0104279; + pub const BIOCGETIF: c_int = 0x4020426b; + pub const BIOCGSEESENT: c_int = 0x40044276; + pub const BIOCGSTATS: c_int = 0x4008426f; + pub const BIOCSDLT: c_int = 0x80044278; + pub const BIOCSETIF: c_int = 0x8020426c; + pub const BIOCSSEESENT: c_int = 0x80044277; + pub const KERN_ARND: c_int = 37; + pub const KERN_IOV_MAX: c_int = 35; + pub const KERN_LOGSIGEXIT: c_int = 34; + pub const KERN_PROC_ARGS: c_int = 7; + pub const KERN_PROC_ENV: c_int = 35; + pub const KERN_PROC_GID: c_int = 7; + pub const KERN_PROC_RGID: c_int = 10; + pub const LOCAL_CONNWAIT: c_int = 4; + pub const LOCAL_CREDS: c_int = 2; + pub const MSG_NOTIFICATION: c_int = 0x00002000; + pub const NET_RT_IFLIST: c_int = 3; + pub const NI_NUMERICSCOPE: c_int = 0x00000020; + pub const PF_ARP: c_int = AF_ARP; + pub const PF_NATM: c_int = AF_NATM; + pub const pseudo_AF_HDRCMPLT: c_int = 31; + pub const SIOCGIFADDR: c_int = 0xc0206921; + pub const SO_SETFIB: c_int = 0x1014; + } +} pub const MAP_TYPE: c_int = 0x3; @@ -1285,8 +1398,6 @@ pub const IFF_BROADCAST: c_int = 0x00000002; pub const IFF_DEBUG: c_int = 0x00000004; pub const IFF_LOOPBACK: c_int = 0x00000008; pub const IFF_POINTOPOINT: c_int = 0x00000010; -#[cfg(not(target_env = "nto71_iosock"))] -pub const IFF_NOTRAILERS: c_int = 0x00000020; pub const IFF_RUNNING: c_int = 0x00000040; pub const IFF_NOARP: c_int = 0x00000080; pub const IFF_PROMISC: c_int = 0x00000100; @@ -1299,16 +1410,9 @@ pub const AF_LOCAL: c_int = 1; pub const AF_INET: c_int = 2; pub const AF_IPX: c_int = 23; pub const AF_APPLETALK: c_int = 16; -#[cfg(not(target_env = "nto71_iosock"))] -pub const AF_INET6: c_int = 24; -#[cfg(target_env = "nto71_iosock")] -pub const AF_INET6: c_int = 28; pub const AF_ROUTE: c_int = 17; pub const AF_SNA: c_int = 11; -#[cfg(not(target_env = "nto71_iosock"))] -pub const AF_BLUETOOTH: c_int = 31; -#[cfg(target_env = "nto71_iosock")] -pub const AF_BLUETOOTH: c_int = 36; + pub const AF_ISDN: c_int = 26; pub const PF_UNSPEC: c_int = AF_UNSPEC; @@ -1318,10 +1422,6 @@ pub const PF_INET: c_int = AF_INET; pub const PF_IPX: c_int = AF_IPX; pub const PF_APPLETALK: c_int = AF_APPLETALK; pub const PF_INET6: c_int = AF_INET6; -#[cfg(not(target_env = "nto71_iosock"))] -pub const pseudo_AF_KEY: c_int = 29; -#[cfg(target_env = "nto71_iosock")] -pub const pseudo_AF_KEY: c_int = 27; pub const PF_KEY: c_int = pseudo_AF_KEY; pub const PF_ROUTE: c_int = AF_ROUTE; pub const PF_SNA: c_int = AF_SNA; @@ -1339,14 +1439,6 @@ pub const MSG_TRUNC: c_int = 0x0010; pub const MSG_DONTWAIT: c_int = 0x0080; pub const MSG_EOR: c_int = 0x0008; pub const MSG_WAITALL: c_int = 0x0040; -#[cfg(not(target_env = "nto71_iosock"))] -pub const MSG_NOSIGNAL: c_int = 0x0800; -#[cfg(target_env = "nto71_iosock")] -pub const MSG_NOSIGNAL: c_int = 0x20000; -#[cfg(not(target_env = "nto71_iosock"))] -pub const MSG_WAITFORONE: c_int = 0x2000; -#[cfg(target_env = "nto71_iosock")] -pub const MSG_WAITFORONE: c_int = 0x00080000; pub const IP_TOS: c_int = 3; pub const IP_TTL: c_int = 4; @@ -1354,10 +1446,6 @@ pub const IP_HDRINCL: c_int = 2; pub const IP_OPTIONS: c_int = 1; pub const IP_RECVOPTS: c_int = 5; pub const IP_RETOPTS: c_int = 8; -#[cfg(not(target_env = "nto71_iosock"))] -pub const IP_PKTINFO: c_int = 25; -#[cfg(not(target_env = "nto71_iosock"))] -pub const IP_IPSEC_POLICY_COMPAT: c_int = 22; pub const IP_MULTICAST_IF: c_int = 9; pub const IP_MULTICAST_TTL: c_int = 10; pub const IP_MULTICAST_LOOP: c_int = 11; @@ -1387,10 +1475,6 @@ pub const IPPROTO_SCTP: c_int = 132; pub const IPPROTO_RAW: c_int = 255; pub const IPPROTO_MAX: c_int = 256; pub const IPPROTO_CARP: c_int = 112; -#[cfg(not(target_env = "nto71_iosock"))] -pub const IPPROTO_DIVERT: c_int = 259; -#[cfg(target_env = "nto71_iosock")] -pub const IPPROTO_DIVERT: c_int = 258; pub const IPPROTO_DONE: c_int = 257; pub const IPPROTO_EON: c_int = 80; pub const IPPROTO_ETHERIP: c_int = 97; @@ -1408,8 +1492,6 @@ pub const IPV6_JOIN_GROUP: c_int = 12; pub const IPV6_LEAVE_GROUP: c_int = 13; pub const IPV6_CHECKSUM: c_int = 26; pub const IPV6_V6ONLY: c_int = 27; -#[cfg(not(target_env = "nto71_iosock"))] -pub const IPV6_IPSEC_POLICY_COMPAT: c_int = 28; pub const IPV6_RTHDRDSTOPTS: c_int = 35; pub const IPV6_RECVPKTINFO: c_int = 36; pub const IPV6_RECVHOPLIMIT: c_int = 37; @@ -1430,8 +1512,6 @@ pub const IPV6_DONTFRAG: c_int = 62; pub const TCP_NODELAY: c_int = 0x01; pub const TCP_MAXSEG: c_int = 0x02; pub const TCP_MD5SIG: c_int = 0x10; -#[cfg(not(target_env = "nto71_iosock"))] -pub const TCP_KEEPALIVE: c_int = 0x04; pub const SHUT_RD: c_int = 0; pub const SHUT_WR: c_int = 1; @@ -1581,8 +1661,6 @@ pub const MAXTTL: u8 = 255; pub const ARPHRD_ETHER: u16 = 1; pub const ARPHRD_IEEE802: u16 = 6; -#[cfg(not(target_env = "nto71_iosock"))] -pub const ARPHRD_ARCNET: u16 = 7; pub const ARPHRD_IEEE1394: u16 = 24; pub const SOL_SOCKET: c_int = 0xffff; @@ -1603,8 +1681,6 @@ pub const SO_RCVLOWAT: c_int = 0x1004; pub const SO_SNDLOWAT: c_int = 0x1003; pub const SO_RCVTIMEO: c_int = 0x1006; pub const SO_SNDTIMEO: c_int = 0x1005; -#[cfg(not(target_env = "nto71_iosock"))] -pub const SO_BINDTODEVICE: c_int = 0x0800; pub const SO_TIMESTAMP: c_int = 0x0400; pub const SO_ACCEPTCONN: c_int = 0x0002; @@ -1650,8 +1726,6 @@ pub const EAI_BADFLAGS: c_int = 3; pub const EAI_NONAME: c_int = 8; pub const EAI_AGAIN: c_int = 2; pub const EAI_FAIL: c_int = 4; -#[cfg(not(target_env = "nto71_iosock"))] -pub const EAI_NODATA: c_int = 7; pub const EAI_FAMILY: c_int = 5; pub const EAI_SOCKTYPE: c_int = 10; pub const EAI_SERVICE: c_int = 9; @@ -1685,9 +1759,6 @@ pub const POSIX_SPAWN_SETSIGMASK: c_short = 0x0002; pub const POSIX_SPAWN_SETSCHEDPARAM: c_short = 0x0400; pub const POSIX_SPAWN_SETSCHEDULER: c_short = 0x0040; -#[cfg(not(target_env = "nto71_iosock"))] -pub const IPTOS_ECN_NOT_ECT: u8 = 0x00; - pub const RTF_UP: c_ushort = 0x0001; pub const RTF_GATEWAY: c_ushort = 0x0002; @@ -1697,20 +1768,11 @@ pub const RTF_MODIFIED: c_ushort = 0x0020; pub const RTF_REJECT: c_ushort = 0x0008; pub const RTF_STATIC: c_ushort = 0x0800; pub const RTF_XRESOLVE: c_ushort = 0x0200; -#[cfg(not(target_env = "nto71_iosock"))] -pub const RTF_BROADCAST: u32 = 0x80000; -#[cfg(target_env = "nto71_iosock")] -pub const RTF_BROADCAST: u32 = 0x400000; pub const RTM_NEWADDR: u16 = 0xc; pub const RTM_DELADDR: u16 = 0xd; pub const RTA_DST: c_ushort = 0x1; pub const RTA_GATEWAY: c_ushort = 0x2; -#[cfg(not(target_env = "nto71_iosock"))] -pub const UDP_ENCAP: c_int = 100; -#[cfg(target_env = "nto71_iosock")] -pub const UDP_ENCAP: c_int = 1; - pub const IN_ACCESS: u32 = 0x00000001; pub const IN_MODIFY: u32 = 0x00000002; pub const IN_ATTRIB: u32 = 0x00000004; @@ -2344,27 +2406,6 @@ pub const HW_PHYSMEM: c_int = 5; pub const HW_USERMEM: c_int = 6; pub const HW_PAGESIZE: c_int = 7; pub const HW_DISKNAMES: c_int = 8; -#[cfg(not(target_env = "nto71_iosock"))] -pub const HW_IOSTATS: c_int = 9; -#[cfg(not(target_env = "nto71_iosock"))] -pub const HW_MACHINE_ARCH: c_int = 10; -#[cfg(target_env = "nto71_iosock")] -pub const HW_MACHINE_ARCH: c_int = 11; -#[cfg(not(target_env = "nto71_iosock"))] -pub const HW_ALIGNBYTES: c_int = 11; -#[cfg(not(target_env = "nto71_iosock"))] -pub const HW_CNMAGIC: c_int = 12; -#[cfg(not(target_env = "nto71_iosock"))] -pub const HW_PHYSMEM64: c_int = 13; -#[cfg(not(target_env = "nto71_iosock"))] -pub const HW_USERMEM64: c_int = 14; -#[cfg(not(target_env = "nto71_iosock"))] -pub const HW_IOSTATNAMES: c_int = 15; -#[cfg(not(target_env = "nto71_iosock"))] -pub const HW_MAXID: c_int = 15; - -#[cfg(not(target_env = "nto71_iosock"))] -pub const CTL_UNSPEC: c_int = 0; pub const CTL_KERN: c_int = 1; pub const CTL_VM: c_int = 2; pub const CTL_VFS: c_int = 3; @@ -2373,18 +2414,6 @@ pub const CTL_DEBUG: c_int = 5; pub const CTL_HW: c_int = 6; pub const CTL_MACHDEP: c_int = 7; pub const CTL_USER: c_int = 8; -#[cfg(not(target_env = "nto71_iosock"))] -pub const CTL_QNX: c_int = 9; -#[cfg(not(target_env = "nto71_iosock"))] -pub const CTL_PROC: c_int = 10; -#[cfg(not(target_env = "nto71_iosock"))] -pub const CTL_VENDOR: c_int = 11; -#[cfg(not(target_env = "nto71_iosock"))] -pub const CTL_EMUL: c_int = 12; -#[cfg(not(target_env = "nto71_iosock"))] -pub const CTL_SECURITY: c_int = 13; -#[cfg(not(target_env = "nto71_iosock"))] -pub const CTL_MAXID: c_int = 14; pub const DAY_1: crate::nl_item = 8; pub const DAY_2: crate::nl_item = 9; @@ -2428,10 +2457,6 @@ pub const ABMON_10: crate::nl_item = 43; pub const ABMON_11: crate::nl_item = 44; pub const ABMON_12: crate::nl_item = 45; -#[cfg(not(target_env = "nto71_iosock"))] -pub const AF_ARP: c_int = 28; -#[cfg(target_env = "nto71_iosock")] -pub const AF_ARP: c_int = 35; pub const AF_CCITT: c_int = 10; pub const AF_CHAOS: c_int = 5; pub const AF_CNT: c_int = 21; @@ -2442,20 +2467,10 @@ pub const AF_DLI: c_int = 13; pub const AF_E164: c_int = 26; pub const AF_ECMA: c_int = 8; pub const AF_HYLINK: c_int = 15; -#[cfg(not(target_env = "nto71_iosock"))] -pub const AF_IEEE80211: c_int = 32; -#[cfg(target_env = "nto71_iosock")] -pub const AF_IEEE80211: c_int = 37; pub const AF_IMPLINK: c_int = 3; pub const AF_ISO: c_int = 7; pub const AF_LAT: c_int = 14; pub const AF_LINK: c_int = 18; -#[cfg(not(target_env = "nto71_iosock"))] -pub const AF_NATM: c_int = 27; -#[cfg(target_env = "nto71_iosock")] -pub const AF_NATM: c_int = 29; -#[cfg(not(target_env = "nto71_iosock"))] -pub const AF_NS: c_int = 6; pub const AF_OSI: c_int = 7; pub const AF_PUP: c_int = 4; pub const ALT_DIGITS: crate::nl_item = 50; @@ -2465,42 +2480,14 @@ pub const B76800: crate::speed_t = 76800; pub const BIOCFLUSH: c_int = 17000; pub const BIOCGBLEN: c_int = 1074020966; pub const BIOCGDLT: c_int = 1074020970; -#[cfg(not(target_env = "nto71_iosock"))] -pub const BIOCGDLTLIST: c_int = -1072676233; -#[cfg(target_env = "nto71_iosock")] -pub const BIOCGDLTLIST: c_ulong = 0xffffffffc0104279; -#[cfg(not(target_env = "nto71_iosock"))] -pub const BIOCGETIF: c_int = 1083196011; -#[cfg(target_env = "nto71_iosock")] -pub const BIOCGETIF: c_int = 0x4020426b; pub const BIOCGHDRCMPLT: c_int = 1074020980; pub const BIOCGRTIMEOUT: c_int = 1074807406; -#[cfg(not(target_env = "nto71_iosock"))] -pub const BIOCGSEESENT: c_int = 1074020984; -#[cfg(target_env = "nto71_iosock")] -pub const BIOCGSEESENT: c_int = 0x40044276; -#[cfg(not(target_env = "nto71_iosock"))] -pub const BIOCGSTATS: c_int = 1082147439; -#[cfg(target_env = "nto71_iosock")] -pub const BIOCGSTATS: c_int = 0x4008426f; pub const BIOCIMMEDIATE: c_int = -2147204496; pub const BIOCPROMISC: c_int = 17001; pub const BIOCSBLEN: c_int = -1073462682; -#[cfg(not(target_env = "nto71_iosock"))] -pub const BIOCSDLT: c_int = -2147204490; -#[cfg(target_env = "nto71_iosock")] -pub const BIOCSDLT: c_int = 0x80044278; pub const BIOCSETF: c_int = -2146418073; -#[cfg(not(target_env = "nto71_iosock"))] -pub const BIOCSETIF: c_int = -2138029460; -#[cfg(target_env = "nto71_iosock")] -pub const BIOCSETIF: c_int = 0x8020426c; pub const BIOCSHDRCMPLT: c_int = -2147204491; pub const BIOCSRTIMEOUT: c_int = -2146418067; -#[cfg(not(target_env = "nto71_iosock"))] -pub const BIOCSSEESENT: c_int = -2147204487; -#[cfg(target_env = "nto71_iosock")] -pub const BIOCSSEESENT: c_int = 0x80044277; pub const BIOCVERSION: c_int = 1074020977; pub const BPF_ALIGNMENT: usize = mem::size_of::(); @@ -2536,23 +2523,13 @@ pub const FIOCLEX: c_int = 26113; pub const FIOGETOWN: c_int = 1074030203; pub const FIONCLEX: c_int = 26114; pub const FIONREAD: c_int = 1074030207; -#[cfg(not(target_env = "nto71_iosock"))] -pub const FIONSPACE: c_int = 1074030200; -#[cfg(not(target_env = "nto71_iosock"))] -pub const FIONWRITE: c_int = 1074030201; pub const FIOSETOWN: c_int = -2147195268; pub const F_SETOWN: c_int = 36; -#[cfg(not(target_env = "nto71_iosock"))] -pub const IFF_ACCEPTRTADV: c_int = 0x40000000; -#[cfg(not(target_env = "nto71_iosock"))] -pub const IFF_IP6FORWARDING: c_int = 0x20000000; pub const IFF_LINK0: c_int = 0x00001000; pub const IFF_LINK1: c_int = 0x00002000; pub const IFF_LINK2: c_int = 0x00004000; pub const IFF_OACTIVE: c_int = 0x00000400; -#[cfg(not(target_env = "nto71_iosock"))] -pub const IFF_SHIM: c_int = 0x80000000; pub const IFF_SIMPLEX: c_int = 0x00000800; pub const IHFLOW: tcflag_t = 0x00000001; pub const IIDLE: tcflag_t = 0x00000008; @@ -2563,27 +2540,13 @@ pub const IUCLC: tcflag_t = 0x00000200; pub const IUTF8: tcflag_t = 0x0004000; pub const KERN_ARGMAX: c_int = 8; -#[cfg(not(target_env = "nto71_iosock"))] -pub const KERN_ARND: c_int = 81; -#[cfg(target_env = "nto71_iosock")] -pub const KERN_ARND: c_int = 37; pub const KERN_BOOTTIME: c_int = 21; pub const KERN_CLOCKRATE: c_int = 12; pub const KERN_FILE: c_int = 15; pub const KERN_HOSTID: c_int = 11; pub const KERN_HOSTNAME: c_int = 10; -#[cfg(not(target_env = "nto71_iosock"))] -pub const KERN_IOV_MAX: c_int = 38; -#[cfg(target_env = "nto71_iosock")] -pub const KERN_IOV_MAX: c_int = 35; pub const KERN_JOB_CONTROL: c_int = 19; -#[cfg(not(target_env = "nto71_iosock"))] -pub const KERN_LOGSIGEXIT: c_int = 46; -#[cfg(target_env = "nto71_iosock")] -pub const KERN_LOGSIGEXIT: c_int = 34; pub const KERN_MAXFILES: c_int = 7; -#[cfg(not(target_env = "nto71_iosock"))] -pub const KERN_MAXID: c_int = 83; pub const KERN_MAXPROC: c_int = 6; pub const KERN_MAXVNODES: c_int = 5; pub const KERN_NGROUPS: c_int = 18; @@ -2593,24 +2556,8 @@ pub const KERN_OSTYPE: c_int = 1; pub const KERN_POSIX1: c_int = 17; pub const KERN_PROC: c_int = 14; pub const KERN_PROC_ALL: c_int = 0; -#[cfg(not(target_env = "nto71_iosock"))] -pub const KERN_PROC_ARGS: c_int = 48; -#[cfg(target_env = "nto71_iosock")] -pub const KERN_PROC_ARGS: c_int = 7; -#[cfg(not(target_env = "nto71_iosock"))] -pub const KERN_PROC_ENV: c_int = 3; -#[cfg(target_env = "nto71_iosock")] -pub const KERN_PROC_ENV: c_int = 35; -#[cfg(not(target_env = "nto71_iosock"))] -pub const KERN_PROC_GID: c_int = 7; -#[cfg(target_env = "nto71_iosock")] -pub const KERN_PROC_GID: c_int = 11; pub const KERN_PROC_PGRP: c_int = 2; pub const KERN_PROC_PID: c_int = 1; -#[cfg(not(target_env = "nto71_iosock"))] -pub const KERN_PROC_RGID: c_int = 8; -#[cfg(target_env = "nto71_iosock")] -pub const KERN_PROC_RGID: c_int = 10; pub const KERN_PROC_RUID: c_int = 6; pub const KERN_PROC_SESSION: c_int = 3; pub const KERN_PROC_TTY: c_int = 4; @@ -2629,44 +2576,16 @@ pub const LC_MONETARY: c_int = 4; pub const LC_NUMERIC: c_int = 8; pub const LC_TIME: c_int = 16; -#[cfg(not(target_env = "nto71_iosock"))] -pub const LOCAL_CONNWAIT: c_int = 0x0002; -#[cfg(target_env = "nto71_iosock")] -pub const LOCAL_CONNWAIT: c_int = 4; -#[cfg(not(target_env = "nto71_iosock"))] -pub const LOCAL_CREDS: c_int = 0x0001; -#[cfg(target_env = "nto71_iosock")] -pub const LOCAL_CREDS: c_int = 2; -#[cfg(not(target_env = "nto71_iosock"))] -pub const LOCAL_PEEREID: c_int = 0x0003; - pub const MAP_STACK: c_int = 0x00001000; pub const MNT_NOEXEC: c_int = 0x02; pub const MNT_NOSUID: c_int = 0x04; pub const MNT_RDONLY: c_int = 0x01; -#[cfg(not(target_env = "nto71_iosock"))] -pub const MSG_NOTIFICATION: c_int = 0x0400; -#[cfg(target_env = "nto71_iosock")] -pub const MSG_NOTIFICATION: c_int = 0x00002000; - pub const NET_RT_DUMP: c_int = 1; pub const NET_RT_FLAGS: c_int = 2; -#[cfg(not(target_env = "nto71_iosock"))] -pub const NET_RT_IFLIST: c_int = 4; -#[cfg(target_env = "nto71_iosock")] -pub const NET_RT_IFLIST: c_int = 3; -#[cfg(not(target_env = "nto71_iosock"))] -pub const NI_NUMERICSCOPE: c_int = 0x00000040; -#[cfg(target_env = "nto71_iosock")] -pub const NI_NUMERICSCOPE: c_int = 0x00000020; pub const OHFLOW: tcflag_t = 0x00000002; pub const P_ALL: idtype_t = 0; pub const PARSTK: tcflag_t = 0x00000004; -#[cfg(not(target_env = "nto71_iosock"))] -pub const PF_ARP: c_int = 28; -#[cfg(target_env = "nto71_iosock")] -pub const PF_ARP: c_int = AF_ARP; pub const PF_CCITT: c_int = 10; pub const PF_CHAOS: c_int = 5; pub const PF_CNT: c_int = 21; @@ -2680,10 +2599,6 @@ pub const PF_IMPLINK: c_int = 3; pub const PF_ISO: c_int = 7; pub const PF_LAT: c_int = 14; pub const PF_LINK: c_int = 18; -#[cfg(not(target_env = "nto71_iosock"))] -pub const PF_NATM: c_int = 27; -#[cfg(target_env = "nto71_iosock")] -pub const PF_NATM: c_int = AF_NATM; pub const PF_OSI: c_int = 7; pub const PF_PIP: c_int = 25; pub const PF_PUP: c_int = 4; @@ -2701,10 +2616,6 @@ pub const P_PID: idtype_t = 1; pub const PRIO_PGRP: c_int = 1; pub const PRIO_PROCESS: c_int = 0; pub const PRIO_USER: c_int = 2; -#[cfg(not(target_env = "nto71_iosock"))] -pub const pseudo_AF_HDRCMPLT: c_int = 30; -#[cfg(target_env = "nto71_iosock")] -pub const pseudo_AF_HDRCMPLT: c_int = 31; pub const pseudo_AF_PIP: c_int = 25; pub const pseudo_AF_RTIP: c_int = 22; pub const pseudo_AF_XTP: c_int = 19; @@ -2749,23 +2660,7 @@ pub const SIGEMT: c_int = 7; pub const SIGEV_NONE: c_int = 0; pub const SIGEV_SIGNAL: c_int = 129; pub const SIGEV_THREAD: c_int = 135; -#[cfg(not(target_env = "nto71_iosock"))] -pub const SIOCGIFADDR: c_int = -1064277727; -#[cfg(target_env = "nto71_iosock")] -pub const SIOCGIFADDR: c_int = 0xc0206921; -#[cfg(not(target_env = "nto71_iosock"))] -pub const SO_FIB: c_int = 0x100a; -#[cfg(not(target_env = "nto71_iosock"))] -pub const SO_OVERFLOWED: c_int = 0x1009; -#[cfg(not(target_env = "nto71_iosock"))] -pub const SO_SETFIB: c_int = 0x100a; -#[cfg(target_env = "nto71_iosock")] -pub const SO_SETFIB: c_int = 0x1014; -#[cfg(not(target_env = "nto71_iosock"))] -pub const SO_TXPRIO: c_int = 0x100b; pub const SO_USELOOPBACK: c_int = 0x0040; -#[cfg(not(target_env = "nto71_iosock"))] -pub const SO_VLANPRIO: c_int = 0x100c; pub const _SS_ALIGNSIZE: usize = mem::size_of::(); pub const _SS_MAXSIZE: usize = 128; pub const _SS_PAD1SIZE: usize = _SS_ALIGNSIZE - 2; @@ -2835,10 +2730,6 @@ pub const USER_POSIX2_SW_DEV: c_int = 17; pub const USER_POSIX2_UPE: c_int = 18; pub const USER_STREAM_MAX: c_int = 19; pub const USER_TZNAME_MAX: c_int = 20; -#[cfg(not(target_env = "nto71_iosock"))] -pub const USER_ATEXIT_MAX: c_int = 21; -#[cfg(not(target_env = "nto71_iosock"))] -pub const USER_MAXID: c_int = 22; pub const VDOWN: usize = 31; pub const VINS: usize = 32; @@ -3044,6 +2935,42 @@ safe_f! { } } +cfg_if! { + if #[cfg(not(target_env = "nto71_iosock"))] { + extern "C" { + pub fn sendmmsg( + sockfd: c_int, + msgvec: *mut crate::mmsghdr, + vlen: c_uint, + flags: c_uint, + ) -> c_int; + pub fn recvmmsg( + sockfd: c_int, + msgvec: *mut crate::mmsghdr, + vlen: c_uint, + flags: c_uint, + timeout: *mut crate::timespec, + ) -> c_int; + } + } else { + extern "C" { + pub fn sendmmsg( + sockfd: c_int, + msgvec: *mut crate::mmsghdr, + vlen: size_t, + flags: c_int, + ) -> ssize_t; + pub fn recvmmsg( + sockfd: c_int, + msgvec: *mut crate::mmsghdr, + vlen: size_t, + flags: c_int, + timeout: *const crate::timespec, + ) -> ssize_t; + } + } +} + // Network related functions are provided by libsocket and regex // functions are provided by libregex. // In QNX <=7.0, libregex functions were included in libc itself. @@ -3463,36 +3390,6 @@ extern "C" { flags: c_int, ) -> c_int; - #[cfg(not(target_env = "nto71_iosock"))] - pub fn sendmmsg( - sockfd: c_int, - msgvec: *mut crate::mmsghdr, - vlen: c_uint, - flags: c_uint, - ) -> c_int; - #[cfg(target_env = "nto71_iosock")] - pub fn sendmmsg( - sockfd: c_int, - msgvec: *mut crate::mmsghdr, - vlen: size_t, - flags: c_int, - ) -> ssize_t; - #[cfg(not(target_env = "nto71_iosock"))] - pub fn recvmmsg( - sockfd: c_int, - msgvec: *mut crate::mmsghdr, - vlen: c_uint, - flags: c_uint, - timeout: *mut crate::timespec, - ) -> c_int; - #[cfg(target_env = "nto71_iosock")] - pub fn recvmmsg( - sockfd: c_int, - msgvec: *mut crate::mmsghdr, - vlen: size_t, - flags: c_int, - timeout: *const crate::timespec, - ) -> ssize_t; pub fn mallopt(param: c_int, value: i64) -> c_int; pub fn gettimeofday(tp: *mut crate::timeval, tz: *mut c_void) -> c_int;