1 use crate::prelude::*; 2 use crate::Ioctl; 3 4 s! { 5 pub struct termios2 { 6 pub c_iflag: crate::tcflag_t, 7 pub c_oflag: crate::tcflag_t, 8 pub c_cflag: crate::tcflag_t, 9 pub c_lflag: crate::tcflag_t, 10 pub c_line: crate::cc_t, 11 pub c_cc: [crate::cc_t; 23], 12 pub c_ispeed: crate::speed_t, 13 pub c_ospeed: crate::speed_t, 14 } 15 } 16 17 // arch/mips/include/uapi/asm/socket.h 18 pub const SOL_SOCKET: c_int = 0xffff; 19 20 // Defined in unix/linux_like/mod.rs 21 // pub const SO_DEBUG: c_int = 0x0001; 22 pub const SO_REUSEADDR: c_int = 0x0004; 23 pub const SO_KEEPALIVE: c_int = 0x0008; 24 pub const SO_DONTROUTE: c_int = 0x0010; 25 pub const SO_BROADCAST: c_int = 0x0020; 26 pub const SO_LINGER: c_int = 0x0080; 27 pub const SO_OOBINLINE: c_int = 0x0100; 28 pub const SO_REUSEPORT: c_int = 0x0200; 29 pub const SO_TYPE: c_int = 0x1008; 30 // pub const SO_STYLE: c_int = SO_TYPE; 31 pub const SO_ERROR: c_int = 0x1007; 32 pub const SO_SNDBUF: c_int = 0x1001; 33 pub const SO_RCVBUF: c_int = 0x1002; 34 pub const SO_SNDLOWAT: c_int = 0x1003; 35 pub const SO_RCVLOWAT: c_int = 0x1004; 36 cfg_if! { 37 if #[cfg(linux_time_bits64)] { 38 const SO_RCVTIMEO_NEW: c_int = 66; 39 const SO_SNDTIMEO_NEW: c_int = 67; 40 41 pub const SO_SNDTIMEO: c_int = SO_SNDTIMEO_NEW; 42 pub const SO_RCVTIMEO: c_int = SO_RCVTIMEO_NEW; 43 } else { 44 const SO_SNDTIMEO_OLD: c_int = 0x1005; 45 const SO_RCVTIMEO_OLD: c_int = 0x1006; 46 47 pub const SO_SNDTIMEO: c_int = SO_SNDTIMEO_OLD; 48 pub const SO_RCVTIMEO: c_int = SO_RCVTIMEO_OLD; 49 } 50 } 51 pub const SO_ACCEPTCONN: c_int = 0x1009; 52 pub const SO_PROTOCOL: c_int = 0x1028; 53 pub const SO_DOMAIN: c_int = 0x1029; 54 55 pub const SO_NO_CHECK: c_int = 11; 56 pub const SO_PRIORITY: c_int = 12; 57 pub const SO_BSDCOMPAT: c_int = 14; 58 pub const SO_PASSCRED: c_int = 17; 59 pub const SO_PEERCRED: c_int = 18; 60 pub const SO_SECURITY_AUTHENTICATION: c_int = 22; 61 pub const SO_SECURITY_ENCRYPTION_TRANSPORT: c_int = 23; 62 pub const SO_SECURITY_ENCRYPTION_NETWORK: c_int = 24; 63 pub const SO_BINDTODEVICE: c_int = 25; 64 pub const SO_ATTACH_FILTER: c_int = 26; 65 pub const SO_DETACH_FILTER: c_int = 27; 66 pub const SO_GET_FILTER: c_int = SO_ATTACH_FILTER; 67 pub const SO_PEERNAME: c_int = 28; 68 pub const SO_PEERSEC: c_int = 30; 69 pub const SO_SNDBUFFORCE: c_int = 31; 70 pub const SO_RCVBUFFORCE: c_int = 33; 71 pub const SO_PASSSEC: c_int = 34; 72 pub const SO_MARK: c_int = 36; 73 pub const SO_RXQ_OVFL: c_int = 40; 74 pub const SO_WIFI_STATUS: c_int = 41; 75 pub const SCM_WIFI_STATUS: c_int = SO_WIFI_STATUS; 76 pub const SO_PEEK_OFF: c_int = 42; 77 pub const SO_NOFCS: c_int = 43; 78 pub const SO_LOCK_FILTER: c_int = 44; 79 pub const SO_SELECT_ERR_QUEUE: c_int = 45; 80 pub const SO_BUSY_POLL: c_int = 46; 81 pub const SO_MAX_PACING_RATE: c_int = 47; 82 pub const SO_BPF_EXTENSIONS: c_int = 48; 83 pub const SO_INCOMING_CPU: c_int = 49; 84 pub const SO_ATTACH_BPF: c_int = 50; 85 pub const SO_DETACH_BPF: c_int = SO_DETACH_FILTER; 86 pub const SO_ATTACH_REUSEPORT_CBPF: c_int = 51; 87 pub const SO_ATTACH_REUSEPORT_EBPF: c_int = 52; 88 pub const SO_CNX_ADVICE: c_int = 53; 89 pub const SCM_TIMESTAMPING_OPT_STATS: c_int = 54; 90 pub const SO_MEMINFO: c_int = 55; 91 pub const SO_INCOMING_NAPI_ID: c_int = 56; 92 pub const SO_COOKIE: c_int = 57; 93 pub const SCM_TIMESTAMPING_PKTINFO: c_int = 58; 94 pub const SO_PEERGROUPS: c_int = 59; 95 pub const SO_ZEROCOPY: c_int = 60; 96 pub const SO_TXTIME: c_int = 61; 97 pub const SCM_TXTIME: c_int = SO_TXTIME; 98 pub const SO_BINDTOIFINDEX: c_int = 62; 99 100 cfg_if! { 101 if #[cfg(linux_time_bits64)] { 102 const SO_TIMESTAMP_NEW: c_int = 63; 103 const SO_TIMESTAMPNS_NEW: c_int = 64; 104 const SO_TIMESTAMPING_NEW: c_int = 65; 105 106 pub const SO_TIMESTAMP: c_int = SO_TIMESTAMP_NEW; 107 pub const SO_TIMESTAMPNS: c_int = SO_TIMESTAMPNS_NEW; 108 pub const SO_TIMESTAMPING: c_int = SO_TIMESTAMPING_NEW; 109 } else { 110 const SO_TIMESTAMP_OLD: c_int = 29; 111 const SO_TIMESTAMPNS_OLD: c_int = 35; 112 const SO_TIMESTAMPING_OLD: c_int = 37; 113 114 pub const SO_TIMESTAMP: c_int = SO_TIMESTAMP_OLD; 115 pub const SO_TIMESTAMPNS: c_int = SO_TIMESTAMPNS_OLD; 116 pub const SO_TIMESTAMPING: c_int = SO_TIMESTAMPING_OLD; 117 } 118 } 119 120 // pub const SO_DETACH_REUSEPORT_BPF: c_int = 68; 121 pub const SO_PREFER_BUSY_POLL: c_int = 69; 122 pub const SO_BUSY_POLL_BUDGET: c_int = 70; 123 pub const SO_NETNS_COOKIE: c_int = 71; 124 pub const SO_BUF_LOCK: c_int = 72; 125 pub const SO_RESERVE_MEM: c_int = 73; 126 pub const SO_TXREHASH: c_int = 74; 127 pub const SO_RCVMARK: c_int = 75; 128 pub const SO_PASSPIDFD: c_int = 76; 129 pub const SO_PEERPIDFD: c_int = 77; 130 pub const SO_DEVMEM_LINEAR: c_int = 78; 131 pub const SO_DEVMEM_DMABUF: c_int = 79; 132 pub const SO_DEVMEM_DONTNEED: c_int = 80; 133 134 // Defined in unix/linux_like/mod.rs 135 // pub const SCM_TIMESTAMP: c_int = SO_TIMESTAMP; 136 pub const SCM_TIMESTAMPNS: c_int = SO_TIMESTAMPNS; 137 pub const SCM_TIMESTAMPING: c_int = SO_TIMESTAMPING; 138 139 pub const SCM_DEVMEM_LINEAR: c_int = SO_DEVMEM_LINEAR; 140 pub const SCM_DEVMEM_DMABUF: c_int = SO_DEVMEM_DMABUF; 141 142 // Ioctl Constants 143 144 pub const TCGETS: Ioctl = 0x540d; 145 pub const TCSETS: Ioctl = 0x540e; 146 pub const TCSETSW: Ioctl = 0x540f; 147 pub const TCSETSF: Ioctl = 0x5410; 148 pub const TCGETA: Ioctl = 0x5401; 149 pub const TCSETA: Ioctl = 0x5402; 150 pub const TCSETAW: Ioctl = 0x5403; 151 pub const TCSETAF: Ioctl = 0x5404; 152 pub const TCSBRK: Ioctl = 0x5405; 153 pub const TCXONC: Ioctl = 0x5406; 154 pub const TCFLSH: Ioctl = 0x5407; 155 pub const TIOCEXCL: Ioctl = 0x740d; 156 pub const TIOCNXCL: Ioctl = 0x740e; 157 pub const TIOCSCTTY: Ioctl = 0x5480; 158 pub const TIOCGPGRP: Ioctl = 0x40047477; 159 pub const TIOCSPGRP: Ioctl = 0x80047476; 160 pub const TIOCOUTQ: Ioctl = 0x7472; 161 pub const TIOCSTI: Ioctl = 0x5472; 162 pub const TIOCGWINSZ: Ioctl = 0x40087468; 163 pub const TIOCSWINSZ: Ioctl = 0x80087467; 164 pub const TIOCMGET: Ioctl = 0x741d; 165 pub const TIOCMBIS: Ioctl = 0x741b; 166 pub const TIOCMBIC: Ioctl = 0x741c; 167 pub const TIOCMSET: Ioctl = 0x741a; 168 pub const TIOCGSOFTCAR: Ioctl = 0x5481; 169 pub const TIOCSSOFTCAR: Ioctl = 0x5482; 170 pub const FIONREAD: Ioctl = 0x467f; 171 pub const TIOCINQ: Ioctl = FIONREAD; 172 pub const TIOCLINUX: Ioctl = 0x5483; 173 pub const TIOCCONS: Ioctl = 0x80047478; 174 pub const TIOCGSERIAL: Ioctl = 0x5484; 175 pub const TIOCSSERIAL: Ioctl = 0x5485; 176 pub const TIOCPKT: Ioctl = 0x5470; 177 pub const FIONBIO: Ioctl = 0x667e; 178 pub const TIOCNOTTY: Ioctl = 0x5471; 179 pub const TIOCSETD: Ioctl = 0x7401; 180 pub const TIOCGETD: Ioctl = 0x7400; 181 pub const TCSBRKP: Ioctl = 0x5486; 182 pub const TIOCSBRK: Ioctl = 0x5427; 183 pub const TIOCCBRK: Ioctl = 0x5428; 184 pub const TIOCGSID: Ioctl = 0x7416; 185 pub const TCGETS2: Ioctl = 0x4030542a; 186 pub const TCSETS2: Ioctl = 0x8030542b; 187 pub const TCSETSW2: Ioctl = 0x8030542c; 188 pub const TCSETSF2: Ioctl = 0x8030542d; 189 pub const TIOCGPTN: Ioctl = 0x40045430; 190 pub const TIOCSPTLCK: Ioctl = 0x80045431; 191 pub const TIOCGDEV: Ioctl = 0x40045432; 192 pub const TIOCSIG: Ioctl = 0x80045436; 193 pub const TIOCVHANGUP: Ioctl = 0x5437; 194 pub const TIOCGPKT: Ioctl = 0x40045438; 195 pub const TIOCGPTLCK: Ioctl = 0x40045439; 196 pub const TIOCGEXCL: Ioctl = 0x40045440; 197 pub const TIOCGPTPEER: Ioctl = 0x20005441; 198 //pub const TIOCGISO7816: Ioctl = 0x40285442; 199 //pub const TIOCSISO7816: Ioctl = 0xc0285443; 200 pub const FIONCLEX: Ioctl = 0x6602; 201 pub const FIOCLEX: Ioctl = 0x6601; 202 pub const FIOASYNC: Ioctl = 0x667d; 203 pub const TIOCSERCONFIG: Ioctl = 0x5488; 204 pub const TIOCSERGWILD: Ioctl = 0x5489; 205 pub const TIOCSERSWILD: Ioctl = 0x548a; 206 pub const TIOCGLCKTRMIOS: Ioctl = 0x548b; 207 pub const TIOCSLCKTRMIOS: Ioctl = 0x548c; 208 pub const TIOCSERGSTRUCT: Ioctl = 0x548d; 209 pub const TIOCSERGETLSR: Ioctl = 0x548e; 210 pub const TIOCSERGETMULTI: Ioctl = 0x548f; 211 pub const TIOCSERSETMULTI: Ioctl = 0x5490; 212 pub const TIOCMIWAIT: Ioctl = 0x5491; 213 pub const TIOCGICOUNT: Ioctl = 0x5492; 214 pub const FIOQSIZE: Ioctl = 0x667f; 215 pub const TIOCSLTC: Ioctl = 0x7475; 216 pub const TIOCGETP: Ioctl = 0x7408; 217 pub const TIOCSETP: Ioctl = 0x7409; 218 pub const TIOCSETN: Ioctl = 0x740a; 219 pub const BLKIOMIN: Ioctl = 0x20001278; 220 pub const BLKIOOPT: Ioctl = 0x20001279; 221 pub const BLKSSZGET: Ioctl = 0x20001268; 222 pub const BLKPBSZGET: Ioctl = 0x2000127B; 223 224 cfg_if! { 225 if #[cfg(target_env = "musl")] { 226 pub const TIOCGRS485: Ioctl = 0x4020542e; 227 pub const TIOCSRS485: Ioctl = 0xc020542f; 228 } 229 } 230 231 pub const TIOCM_LE: c_int = 0x001; 232 pub const TIOCM_DTR: c_int = 0x002; 233 pub const TIOCM_RTS: c_int = 0x004; 234 pub const TIOCM_ST: c_int = 0x010; 235 pub const TIOCM_SR: c_int = 0x020; 236 pub const TIOCM_CTS: c_int = 0x040; 237 pub const TIOCM_CAR: c_int = 0x100; 238 pub const TIOCM_CD: c_int = TIOCM_CAR; 239 pub const TIOCM_RNG: c_int = 0x200; 240 pub const TIOCM_RI: c_int = TIOCM_RNG; 241 pub const TIOCM_DSR: c_int = 0x400; 242 243 pub const BOTHER: crate::speed_t = 0o010000; 244 pub const IBSHIFT: crate::tcflag_t = 16; 245 246 // RLIMIT Constants 247 248 cfg_if! { 249 if #[cfg(any(target_env = "gnu", target_env = "uclibc"))] { 250 pub const RLIMIT_CPU: crate::__rlimit_resource_t = 0; 251 pub const RLIMIT_FSIZE: crate::__rlimit_resource_t = 1; 252 pub const RLIMIT_DATA: crate::__rlimit_resource_t = 2; 253 pub const RLIMIT_STACK: crate::__rlimit_resource_t = 3; 254 pub const RLIMIT_CORE: crate::__rlimit_resource_t = 4; 255 pub const RLIMIT_NOFILE: crate::__rlimit_resource_t = 5; 256 pub const RLIMIT_AS: crate::__rlimit_resource_t = 6; 257 pub const RLIMIT_RSS: crate::__rlimit_resource_t = 7; 258 pub const RLIMIT_NPROC: crate::__rlimit_resource_t = 8; 259 pub const RLIMIT_MEMLOCK: crate::__rlimit_resource_t = 9; 260 pub const RLIMIT_LOCKS: crate::__rlimit_resource_t = 10; 261 pub const RLIMIT_SIGPENDING: crate::__rlimit_resource_t = 11; 262 pub const RLIMIT_MSGQUEUE: crate::__rlimit_resource_t = 12; 263 pub const RLIMIT_NICE: crate::__rlimit_resource_t = 13; 264 pub const RLIMIT_RTPRIO: crate::__rlimit_resource_t = 14; 265 pub const RLIMIT_RTTIME: crate::__rlimit_resource_t = 15; 266 #[allow(deprecated)] 267 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")] 268 pub const RLIMIT_NLIMITS: crate::__rlimit_resource_t = RLIM_NLIMITS; 269 } else if #[cfg(target_env = "musl")] { 270 pub const RLIMIT_CPU: c_int = 0; 271 pub const RLIMIT_FSIZE: c_int = 1; 272 pub const RLIMIT_DATA: c_int = 2; 273 pub const RLIMIT_STACK: c_int = 3; 274 pub const RLIMIT_CORE: c_int = 4; 275 pub const RLIMIT_NOFILE: c_int = 5; 276 pub const RLIMIT_AS: c_int = 6; 277 pub const RLIMIT_RSS: c_int = 7; 278 pub const RLIMIT_NPROC: c_int = 8; 279 pub const RLIMIT_MEMLOCK: c_int = 9; 280 pub const RLIMIT_LOCKS: c_int = 10; 281 pub const RLIMIT_SIGPENDING: c_int = 11; 282 pub const RLIMIT_MSGQUEUE: c_int = 12; 283 pub const RLIMIT_NICE: c_int = 13; 284 pub const RLIMIT_RTPRIO: c_int = 14; 285 pub const RLIMIT_RTTIME: c_int = 15; 286 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")] 287 pub const RLIM_NLIMITS: c_int = 16; 288 #[allow(deprecated)] 289 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")] 290 pub const RLIMIT_NLIMITS: c_int = RLIM_NLIMITS; 291 pub const RLIM_INFINITY: crate::rlim_t = !0; 292 } 293 } 294 295 cfg_if! { 296 if #[cfg(target_env = "gnu")] { 297 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")] 298 pub const RLIM_NLIMITS: crate::__rlimit_resource_t = 16; 299 } else if #[cfg(target_env = "uclibc")] { 300 #[deprecated(since = "0.2.64", note = "Not stable across OS versions")] 301 pub const RLIM_NLIMITS: crate::__rlimit_resource_t = 15; 302 } 303 } 304 305 cfg_if! { 306 if #[cfg( 307 any(target_arch = "mips64", target_arch = "mips64r6"), 308 any(target_env = "gnu", target_env = "uclibc") 309 )] { 310 pub const RLIM_INFINITY: crate::rlim_t = !0; 311 } 312 } 313 314 cfg_if! { 315 if #[cfg(all( 316 any(target_arch = "mips", target_arch = "mips32r6"), 317 any( 318 all(target_env = "uclibc", linux_time_bits64), 319 all( 320 target_env = "gnu", 321 any(linux_time_bits64, gnu_file_offset_bits64) 322 ) 323 ) 324 ))] { 325 pub const RLIM_INFINITY: crate::rlim_t = !0; 326 } else if #[cfg(all( 327 any(target_arch = "mips", target_arch = "mips32r6"), 328 any(target_env = "uclibc", target_env = "gnu"), 329 not(linux_time_bits64) 330 ))] { 331 pub const RLIM_INFINITY: crate::rlim_t = 0x7fffffff; 332 } 333 } 334