1 use crate::prelude::*; 2 use crate::Ioctl; 3 4 // arch/powerpc/include/uapi/asm/socket.h 5 6 pub const SOL_SOCKET: c_int = 1; 7 8 // Defined in unix/linux_like/mod.rs 9 // pub const SO_DEBUG: c_int = 1; 10 pub const SO_REUSEADDR: c_int = 2; 11 pub const SO_TYPE: c_int = 3; 12 pub const SO_ERROR: c_int = 4; 13 pub const SO_DONTROUTE: c_int = 5; 14 pub const SO_BROADCAST: c_int = 6; 15 pub const SO_SNDBUF: c_int = 7; 16 pub const SO_RCVBUF: c_int = 8; 17 pub const SO_KEEPALIVE: c_int = 9; 18 pub const SO_OOBINLINE: c_int = 10; 19 pub const SO_NO_CHECK: c_int = 11; 20 pub const SO_PRIORITY: c_int = 12; 21 pub const SO_LINGER: c_int = 13; 22 pub const SO_BSDCOMPAT: c_int = 14; 23 pub const SO_REUSEPORT: c_int = 15; 24 // powerpc only differs in these 25 pub const SO_RCVLOWAT: c_int = 16; 26 pub const SO_SNDLOWAT: c_int = 17; 27 28 cfg_if! { 29 if #[cfg(linux_time_bits64)] { 30 const SO_RCVTIMEO_NEW: c_int = 66; 31 const SO_SNDTIMEO_NEW: c_int = 67; 32 33 pub const SO_RCVTIMEO: c_int = SO_RCVTIMEO_NEW; 34 pub const SO_SNDTIMEO: c_int = SO_SNDTIMEO_NEW; 35 } else { 36 const SO_RCVTIMEO_OLD: c_int = 18; 37 const SO_SNDTIMEO_OLD: c_int = 19; 38 39 pub const SO_RCVTIMEO: c_int = SO_RCVTIMEO_OLD; 40 pub const SO_SNDTIMEO: c_int = SO_SNDTIMEO_OLD; 41 } 42 } 43 44 pub const SO_PASSCRED: c_int = 20; 45 pub const SO_PEERCRED: c_int = 21; 46 // end 47 pub const SO_SECURITY_AUTHENTICATION: c_int = 22; 48 pub const SO_SECURITY_ENCRYPTION_TRANSPORT: c_int = 23; 49 pub const SO_SECURITY_ENCRYPTION_NETWORK: c_int = 24; 50 pub const SO_BINDTODEVICE: c_int = 25; 51 pub const SO_ATTACH_FILTER: c_int = 26; 52 pub const SO_DETACH_FILTER: c_int = 27; 53 pub const SO_GET_FILTER: c_int = SO_ATTACH_FILTER; 54 pub const SO_PEERNAME: c_int = 28; 55 cfg_if! { 56 if #[cfg(linux_time_bits64)] { 57 const SO_TIMESTAMP_NEW: c_int = 63; 58 const SO_TIMESTAMPNS_NEW: c_int = 64; 59 const SO_TIMESTAMPING_NEW: c_int = 65; 60 61 pub const SO_TIMESTAMP: c_int = SO_TIMESTAMP_NEW; 62 pub const SO_TIMESTAMPNS: c_int = SO_TIMESTAMPNS_NEW; 63 pub const SO_TIMESTAMPING: c_int = SO_TIMESTAMPING_NEW; 64 } else { 65 const SO_TIMESTAMP_OLD: c_int = 29; 66 const SO_TIMESTAMPNS_OLD: c_int = 35; 67 const SO_TIMESTAMPING_OLD: c_int = 37; 68 69 pub const SO_TIMESTAMP: c_int = SO_TIMESTAMP_OLD; 70 pub const SO_TIMESTAMPNS: c_int = SO_TIMESTAMPNS_OLD; 71 pub const SO_TIMESTAMPING: c_int = SO_TIMESTAMPING_OLD; 72 } 73 } 74 pub const SO_ACCEPTCONN: c_int = 30; 75 pub const SO_PEERSEC: c_int = 31; 76 pub const SO_SNDBUFFORCE: c_int = 32; 77 pub const SO_RCVBUFFORCE: c_int = 33; 78 pub const SO_PASSSEC: c_int = 34; 79 pub const SO_MARK: c_int = 36; 80 pub const SO_PROTOCOL: c_int = 38; 81 pub const SO_DOMAIN: c_int = 39; 82 pub const SO_RXQ_OVFL: c_int = 40; 83 pub const SO_WIFI_STATUS: c_int = 41; 84 pub const SCM_WIFI_STATUS: c_int = SO_WIFI_STATUS; 85 pub const SO_PEEK_OFF: c_int = 42; 86 pub const SO_NOFCS: c_int = 43; 87 pub const SO_LOCK_FILTER: c_int = 44; 88 pub const SO_SELECT_ERR_QUEUE: c_int = 45; 89 pub const SO_BUSY_POLL: c_int = 46; 90 pub const SO_MAX_PACING_RATE: c_int = 47; 91 pub const SO_BPF_EXTENSIONS: c_int = 48; 92 pub const SO_INCOMING_CPU: c_int = 49; 93 pub const SO_ATTACH_BPF: c_int = 50; 94 pub const SO_DETACH_BPF: c_int = SO_DETACH_FILTER; 95 pub const SO_ATTACH_REUSEPORT_CBPF: c_int = 51; 96 pub const SO_ATTACH_REUSEPORT_EBPF: c_int = 52; 97 pub const SO_CNX_ADVICE: c_int = 53; 98 pub const SCM_TIMESTAMPING_OPT_STATS: c_int = 54; 99 pub const SO_MEMINFO: c_int = 55; 100 pub const SO_INCOMING_NAPI_ID: c_int = 56; 101 pub const SO_COOKIE: c_int = 57; 102 pub const SCM_TIMESTAMPING_PKTINFO: c_int = 58; 103 pub const SO_PEERGROUPS: c_int = 59; 104 pub const SO_ZEROCOPY: c_int = 60; 105 pub const SO_TXTIME: c_int = 61; 106 pub const SCM_TXTIME: c_int = SO_TXTIME; 107 pub const SO_BINDTOIFINDEX: c_int = 62; 108 // pub const SO_DETACH_REUSEPORT_BPF: c_int = 68; 109 pub const SO_PREFER_BUSY_POLL: c_int = 69; 110 pub const SO_BUSY_POLL_BUDGET: c_int = 70; 111 pub const SO_NETNS_COOKIE: c_int = 71; 112 pub const SO_BUF_LOCK: c_int = 72; 113 pub const SO_RESERVE_MEM: c_int = 73; 114 pub const SO_TXREHASH: c_int = 74; 115 pub const SO_RCVMARK: c_int = 75; 116 pub const SO_PASSPIDFD: c_int = 76; 117 pub const SO_PEERPIDFD: c_int = 77; 118 pub const SO_DEVMEM_LINEAR: c_int = 78; 119 pub const SO_DEVMEM_DMABUF: c_int = 79; 120 pub const SO_DEVMEM_DONTNEED: c_int = 80; 121 122 // Defined in unix/linux_like/mod.rs 123 // pub const SCM_TIMESTAMP: c_int = SO_TIMESTAMP; 124 pub const SCM_TIMESTAMPNS: c_int = SO_TIMESTAMPNS; 125 pub const SCM_TIMESTAMPING: c_int = SO_TIMESTAMPING; 126 127 pub const SCM_DEVMEM_LINEAR: c_int = SO_DEVMEM_LINEAR; 128 pub const SCM_DEVMEM_DMABUF: c_int = SO_DEVMEM_DMABUF; 129 130 // Ioctl Constants 131 132 cfg_if! { 133 if #[cfg(target_env = "gnu")] { 134 pub const TCGETS: Ioctl = 0x403c7413; 135 pub const TCSETS: Ioctl = 0x803c7414; 136 pub const TCSETSW: Ioctl = 0x803c7415; 137 pub const TCSETSF: Ioctl = 0x803c7416; 138 } else if #[cfg(target_env = "musl")] { 139 pub const TCGETS: Ioctl = 0x402c7413; 140 pub const TCSETS: Ioctl = 0x802c7414; 141 pub const TCSETSW: Ioctl = 0x802c7415; 142 pub const TCSETSF: Ioctl = 0x802c7416; 143 } 144 } 145 146 pub const TCGETA: Ioctl = 0x40147417; 147 pub const TCSETA: Ioctl = 0x80147418; 148 pub const TCSETAW: Ioctl = 0x80147419; 149 pub const TCSETAF: Ioctl = 0x8014741C; 150 pub const TCSBRK: Ioctl = 0x2000741D; 151 pub const TCXONC: Ioctl = 0x2000741E; 152 pub const TCFLSH: Ioctl = 0x2000741F; 153 pub const TIOCEXCL: Ioctl = 0x540C; 154 pub const TIOCNXCL: Ioctl = 0x540D; 155 pub const TIOCSCTTY: Ioctl = 0x540E; 156 pub const TIOCGPGRP: Ioctl = 0x40047477; 157 pub const TIOCSPGRP: Ioctl = 0x80047476; 158 pub const TIOCOUTQ: Ioctl = 0x40047473; 159 pub const TIOCSTI: Ioctl = 0x5412; 160 pub const TIOCGWINSZ: Ioctl = 0x40087468; 161 pub const TIOCSWINSZ: Ioctl = 0x80087467; 162 pub const TIOCMGET: Ioctl = 0x5415; 163 pub const TIOCMBIS: Ioctl = 0x5416; 164 pub const TIOCMBIC: Ioctl = 0x5417; 165 pub const TIOCMSET: Ioctl = 0x5418; 166 pub const TIOCGSOFTCAR: Ioctl = 0x5419; 167 pub const TIOCSSOFTCAR: Ioctl = 0x541A; 168 pub const FIONREAD: Ioctl = 0x4004667F; 169 pub const TIOCINQ: Ioctl = FIONREAD; 170 pub const TIOCLINUX: Ioctl = 0x541C; 171 pub const TIOCCONS: Ioctl = 0x541D; 172 pub const TIOCGSERIAL: Ioctl = 0x541E; 173 pub const TIOCSSERIAL: Ioctl = 0x541F; 174 pub const TIOCPKT: Ioctl = 0x5420; 175 pub const FIONBIO: Ioctl = 0x8004667e; 176 pub const TIOCNOTTY: Ioctl = 0x5422; 177 pub const TIOCSETD: Ioctl = 0x5423; 178 pub const TIOCGETD: Ioctl = 0x5424; 179 pub const TCSBRKP: Ioctl = 0x5425; 180 pub const TIOCSBRK: Ioctl = 0x5427; 181 pub const TIOCCBRK: Ioctl = 0x5428; 182 pub const TIOCGSID: Ioctl = 0x5429; 183 pub const TIOCGRS485: Ioctl = 0x542e; 184 pub const TIOCSRS485: Ioctl = 0x542f; 185 pub const TIOCGPTN: Ioctl = 0x40045430; 186 pub const TIOCSPTLCK: Ioctl = 0x80045431; 187 pub const TIOCGDEV: Ioctl = 0x40045432; 188 pub const TIOCSIG: Ioctl = 0x80045436; 189 pub const TIOCVHANGUP: Ioctl = 0x5437; 190 pub const TIOCGPKT: Ioctl = 0x40045438; 191 pub const TIOCGPTLCK: Ioctl = 0x40045439; 192 pub const TIOCGEXCL: Ioctl = 0x40045440; 193 pub const TIOCGPTPEER: Ioctl = 0x20005441; 194 //pub const TIOCGISO7816: Ioctl = 0x40285442; 195 //pub const TIOCSISO7816: Ioctl = 0xc0285443; 196 pub const FIONCLEX: Ioctl = 0x20006602; 197 pub const FIOCLEX: Ioctl = 0x20006601; 198 pub const FIOASYNC: Ioctl = 0x8004667d; 199 pub const TIOCSERCONFIG: Ioctl = 0x5453; 200 pub const TIOCSERGWILD: Ioctl = 0x5454; 201 pub const TIOCSERSWILD: Ioctl = 0x5455; 202 pub const TIOCGLCKTRMIOS: Ioctl = 0x5456; 203 pub const TIOCSLCKTRMIOS: Ioctl = 0x5457; 204 pub const TIOCSERGSTRUCT: Ioctl = 0x5458; 205 pub const TIOCSERGETLSR: Ioctl = 0x5459; 206 pub const TIOCSERGETMULTI: Ioctl = 0x545A; 207 pub const TIOCSERSETMULTI: Ioctl = 0x545B; 208 pub const TIOCMIWAIT: Ioctl = 0x545C; 209 pub const TIOCGICOUNT: Ioctl = 0x545D; 210 pub const BLKIOMIN: Ioctl = 0x20001278; 211 pub const BLKIOOPT: Ioctl = 0x20001279; 212 pub const BLKSSZGET: Ioctl = 0x20001268; 213 pub const BLKPBSZGET: Ioctl = 0x2000127B; 214 //pub const FIOQSIZE: Ioctl = 0x40086680; 215 216 pub const TIOCM_LE: c_int = 0x001; 217 pub const TIOCM_DTR: c_int = 0x002; 218 pub const TIOCM_RTS: c_int = 0x004; 219 pub const TIOCM_ST: c_int = 0x008; 220 pub const TIOCM_SR: c_int = 0x010; 221 pub const TIOCM_CTS: c_int = 0x020; 222 pub const TIOCM_CAR: c_int = 0x040; 223 pub const TIOCM_CD: c_int = TIOCM_CAR; 224 pub const TIOCM_RNG: c_int = 0x080; 225 pub const TIOCM_RI: c_int = TIOCM_RNG; 226 pub const TIOCM_DSR: c_int = 0x100; 227 228 pub const BOTHER: crate::speed_t = 0o0037; 229 pub const IBSHIFT: crate::tcflag_t = 16; 230 231 // RLIMIT Constants 232 233 cfg_if! { 234 if #[cfg(target_env = "gnu")] { 235 pub const RLIMIT_CPU: crate::__rlimit_resource_t = 0; 236 pub const RLIMIT_FSIZE: crate::__rlimit_resource_t = 1; 237 pub const RLIMIT_DATA: crate::__rlimit_resource_t = 2; 238 pub const RLIMIT_STACK: crate::__rlimit_resource_t = 3; 239 pub const RLIMIT_CORE: crate::__rlimit_resource_t = 4; 240 pub const RLIMIT_RSS: crate::__rlimit_resource_t = 5; 241 pub const RLIMIT_NPROC: crate::__rlimit_resource_t = 6; 242 pub const RLIMIT_NOFILE: crate::__rlimit_resource_t = 7; 243 pub const RLIMIT_MEMLOCK: crate::__rlimit_resource_t = 8; 244 pub const RLIMIT_AS: crate::__rlimit_resource_t = 9; 245 pub const RLIMIT_LOCKS: crate::__rlimit_resource_t = 10; 246 pub const RLIMIT_SIGPENDING: crate::__rlimit_resource_t = 11; 247 pub const RLIMIT_MSGQUEUE: crate::__rlimit_resource_t = 12; 248 pub const RLIMIT_NICE: crate::__rlimit_resource_t = 13; 249 pub const RLIMIT_RTPRIO: crate::__rlimit_resource_t = 14; 250 pub const RLIMIT_RTTIME: crate::__rlimit_resource_t = 15; 251 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")] 252 pub const RLIM_NLIMITS: crate::__rlimit_resource_t = 16; 253 #[allow(deprecated)] 254 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")] 255 pub const RLIMIT_NLIMITS: crate::__rlimit_resource_t = RLIM_NLIMITS; 256 } else if #[cfg(target_env = "musl")] { 257 pub const RLIMIT_CPU: c_int = 0; 258 pub const RLIMIT_FSIZE: c_int = 1; 259 pub const RLIMIT_DATA: c_int = 2; 260 pub const RLIMIT_STACK: c_int = 3; 261 pub const RLIMIT_CORE: c_int = 4; 262 pub const RLIMIT_RSS: c_int = 5; 263 pub const RLIMIT_NPROC: c_int = 6; 264 pub const RLIMIT_NOFILE: c_int = 7; 265 pub const RLIMIT_MEMLOCK: c_int = 8; 266 pub const RLIMIT_AS: c_int = 9; 267 pub const RLIMIT_LOCKS: c_int = 10; 268 pub const RLIMIT_SIGPENDING: c_int = 11; 269 pub const RLIMIT_MSGQUEUE: c_int = 12; 270 pub const RLIMIT_NICE: c_int = 13; 271 pub const RLIMIT_RTPRIO: c_int = 14; 272 pub const RLIMIT_RTTIME: c_int = 15; 273 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")] 274 pub const RLIM_NLIMITS: c_int = 16; 275 #[allow(deprecated)] 276 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")] 277 pub const RLIMIT_NLIMITS: c_int = RLIM_NLIMITS; 278 } 279 } 280 pub const RLIM_INFINITY: crate::rlim_t = !0; 281