| 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; 19], |
| 12 |
pub c_ispeed: crate::speed_t, |
| 13 |
pub c_ospeed: crate::speed_t, |
| 14 |
} |
| 15 |
} |
| 16 |
|
| 17 |
// arch/sparc/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_PASSCRED: c_int = 0x0002; |
| 23 |
pub const SO_REUSEADDR: c_int = 0x0004; |
| 24 |
pub const SO_KEEPALIVE: c_int = 0x0008; |
| 25 |
pub const SO_DONTROUTE: c_int = 0x0010; |
| 26 |
pub const SO_BROADCAST: c_int = 0x0020; |
| 27 |
pub const SO_PEERCRED: c_int = 0x0040; |
| 28 |
pub const SO_LINGER: c_int = 0x0080; |
| 29 |
pub const SO_OOBINLINE: c_int = 0x0100; |
| 30 |
pub const SO_REUSEPORT: c_int = 0x0200; |
| 31 |
pub const SO_BSDCOMPAT: c_int = 0x0400; |
| 32 |
pub const SO_RCVLOWAT: c_int = 0x0800; |
| 33 |
pub const SO_SNDLOWAT: c_int = 0x1000; |
| 34 |
pub const SO_RCVTIMEO: c_int = 0x2000; |
| 35 |
pub const SO_SNDTIMEO: c_int = 0x4000; |
| 36 |
// pub const SO_RCVTIMEO_OLD: c_int = 0x2000; |
| 37 |
// pub const SO_SNDTIMEO_OLD: c_int = 0x4000; |
| 38 |
pub const SO_ACCEPTCONN: c_int = 0x8000; |
| 39 |
pub const SO_SNDBUF: c_int = 0x1001; |
| 40 |
pub const SO_RCVBUF: c_int = 0x1002; |
| 41 |
pub const SO_SNDBUFFORCE: c_int = 0x100a; |
| 42 |
pub const SO_RCVBUFFORCE: c_int = 0x100b; |
| 43 |
pub const SO_ERROR: c_int = 0x1007; |
| 44 |
pub const SO_TYPE: c_int = 0x1008; |
| 45 |
pub const SO_PROTOCOL: c_int = 0x1028; |
| 46 |
pub const SO_DOMAIN: c_int = 0x1029; |
| 47 |
pub const SO_NO_CHECK: c_int = 0x000b; |
| 48 |
pub const SO_PRIORITY: c_int = 0x000c; |
| 49 |
pub const SO_BINDTODEVICE: c_int = 0x000d; |
| 50 |
pub const SO_ATTACH_FILTER: c_int = 0x001a; |
| 51 |
pub const SO_DETACH_FILTER: c_int = 0x001b; |
| 52 |
pub const SO_GET_FILTER: c_int = SO_ATTACH_FILTER; |
| 53 |
pub const SO_PEERNAME: c_int = 0x001c; |
| 54 |
pub const SO_PEERSEC: c_int = 0x001e; |
| 55 |
pub const SO_PASSSEC: c_int = 0x001f; |
| 56 |
pub const SO_MARK: c_int = 0x0022; |
| 57 |
pub const SO_RXQ_OVFL: c_int = 0x0024; |
| 58 |
pub const SO_WIFI_STATUS: c_int = 0x0025; |
| 59 |
pub const SCM_WIFI_STATUS: c_int = SO_WIFI_STATUS; |
| 60 |
pub const SO_PEEK_OFF: c_int = 0x0026; |
| 61 |
pub const SO_NOFCS: c_int = 0x0027; |
| 62 |
pub const SO_LOCK_FILTER: c_int = 0x0028; |
| 63 |
pub const SO_SELECT_ERR_QUEUE: c_int = 0x0029; |
| 64 |
pub const SO_BUSY_POLL: c_int = 0x0030; |
| 65 |
pub const SO_MAX_PACING_RATE: c_int = 0x0031; |
| 66 |
pub const SO_BPF_EXTENSIONS: c_int = 0x0032; |
| 67 |
pub const SO_INCOMING_CPU: c_int = 0x0033; |
| 68 |
pub const SO_ATTACH_BPF: c_int = 0x0034; |
| 69 |
pub const SO_DETACH_BPF: c_int = SO_DETACH_FILTER; |
| 70 |
pub const SO_ATTACH_REUSEPORT_CBPF: c_int = 0x0035; |
| 71 |
pub const SO_ATTACH_REUSEPORT_EBPF: c_int = 0x0036; |
| 72 |
pub const SO_CNX_ADVICE: c_int = 0x0037; |
| 73 |
pub const SCM_TIMESTAMPING_OPT_STATS: c_int = 0x0038; |
| 74 |
pub const SO_MEMINFO: c_int = 0x0039; |
| 75 |
pub const SO_INCOMING_NAPI_ID: c_int = 0x003a; |
| 76 |
pub const SO_COOKIE: c_int = 0x003b; |
| 77 |
pub const SCM_TIMESTAMPING_PKTINFO: c_int = 0x003c; |
| 78 |
pub const SO_PEERGROUPS: c_int = 0x003d; |
| 79 |
pub const SO_ZEROCOPY: c_int = 0x003e; |
| 80 |
pub const SO_TXTIME: c_int = 0x003f; |
| 81 |
pub const SCM_TXTIME: c_int = SO_TXTIME; |
| 82 |
pub const SO_BINDTOIFINDEX: c_int = 0x0041; |
| 83 |
pub const SO_SECURITY_AUTHENTICATION: c_int = 0x5001; |
| 84 |
pub const SO_SECURITY_ENCRYPTION_TRANSPORT: c_int = 0x5002; |
| 85 |
pub const SO_SECURITY_ENCRYPTION_NETWORK: c_int = 0x5004; |
| 86 |
pub const SO_TIMESTAMP: c_int = 0x001d; |
| 87 |
pub const SO_TIMESTAMPNS: c_int = 0x0021; |
| 88 |
pub const SO_TIMESTAMPING: c_int = 0x0023; |
| 89 |
// pub const SO_TIMESTAMP_OLD: c_int = 0x001d; |
| 90 |
// pub const SO_TIMESTAMPNS_OLD: c_int = 0x0021; |
| 91 |
// pub const SO_TIMESTAMPING_OLD: c_int = 0x0023; |
| 92 |
// pub const SO_TIMESTAMP_NEW: c_int = 0x0046; |
| 93 |
// pub const SO_TIMESTAMPNS_NEW: c_int = 0x0042; |
| 94 |
// pub const SO_TIMESTAMPING_NEW: c_int = 0x0043; |
| 95 |
// pub const SO_RCVTIMEO_NEW: c_int = 0x0044; |
| 96 |
// pub const SO_SNDTIMEO_NEW: c_int = 0x0045; |
| 97 |
// pub const SO_DETACH_REUSEPORT_BPF: c_int = 0x0047; |
| 98 |
pub const SO_PREFER_BUSY_POLL: c_int = 0x0048; |
| 99 |
pub const SO_BUSY_POLL_BUDGET: c_int = 0x0049; |
| 100 |
pub const SO_NETNS_COOKIE: c_int = 0x0050; |
| 101 |
pub const SO_BUF_LOCK: c_int = 0x0051; |
| 102 |
pub const SO_RESERVE_MEM: c_int = 0x0052; |
| 103 |
pub const SO_TXREHASH: c_int = 0x0053; |
| 104 |
pub const SO_RCVMARK: c_int = 0x0054; |
| 105 |
pub const SO_PASSPIDFD: c_int = 0x0055; |
| 106 |
pub const SO_PEERPIDFD: c_int = 0x0056; |
| 107 |
pub const SO_DEVMEM_LINEAR: c_int = 0x0057; |
| 108 |
pub const SO_DEVMEM_DMABUF: c_int = 0x0058; |
| 109 |
pub const SO_DEVMEM_DONTNEED: c_int = 0x0059; |
| 110 |
|
| 111 |
// Defined in unix/linux_like/mod.rs |
| 112 |
// pub const SCM_TIMESTAMP: c_int = SO_TIMESTAMP; |
| 113 |
pub const SCM_TIMESTAMPNS: c_int = SO_TIMESTAMPNS; |
| 114 |
pub const SCM_TIMESTAMPING: c_int = SO_TIMESTAMPING; |
| 115 |
|
| 116 |
pub const SCM_DEVMEM_LINEAR: c_int = SO_DEVMEM_LINEAR; |
| 117 |
pub const SCM_DEVMEM_DMABUF: c_int = SO_DEVMEM_DMABUF; |
| 118 |
|
| 119 |
// Ioctl Constants |
| 120 |
|
| 121 |
pub const TCGETS: Ioctl = 0x40245408; |
| 122 |
pub const TCSETS: Ioctl = 0x80245409; |
| 123 |
pub const TCSETSW: Ioctl = 0x8024540a; |
| 124 |
pub const TCSETSF: Ioctl = 0x8024540b; |
| 125 |
pub const TCGETA: Ioctl = 0x40125401; |
| 126 |
pub const TCSETA: Ioctl = 0x80125402; |
| 127 |
pub const TCSETAW: Ioctl = 0x80125403; |
| 128 |
pub const TCSETAF: Ioctl = 0x80125404; |
| 129 |
pub const TCSBRK: Ioctl = 0x20005405; |
| 130 |
pub const TCXONC: Ioctl = 0x20005406; |
| 131 |
pub const TCFLSH: Ioctl = 0x20005407; |
| 132 |
pub const TIOCEXCL: Ioctl = 0x2000740d; |
| 133 |
pub const TIOCNXCL: Ioctl = 0x2000740e; |
| 134 |
pub const TIOCSCTTY: Ioctl = 0x20007484; |
| 135 |
pub const TIOCGPGRP: Ioctl = 0x40047483; |
| 136 |
pub const TIOCSPGRP: Ioctl = 0x80047482; |
| 137 |
pub const TIOCOUTQ: Ioctl = 0x40047473; |
| 138 |
pub const TIOCSTI: Ioctl = 0x80017472; |
| 139 |
pub const TIOCGWINSZ: Ioctl = 0x40087468; |
| 140 |
pub const TIOCSWINSZ: Ioctl = 0x80087467; |
| 141 |
pub const TIOCMGET: Ioctl = 0x4004746a; |
| 142 |
pub const TIOCMBIS: Ioctl = 0x8004746c; |
| 143 |
pub const TIOCMBIC: Ioctl = 0x8004746b; |
| 144 |
pub const TIOCMSET: Ioctl = 0x8004746d; |
| 145 |
pub const TIOCGSOFTCAR: Ioctl = 0x40047464; |
| 146 |
pub const TIOCSSOFTCAR: Ioctl = 0x80047465; |
| 147 |
pub const FIONREAD: Ioctl = 0x4004667f; |
| 148 |
pub const TIOCINQ: Ioctl = FIONREAD; |
| 149 |
pub const TIOCLINUX: Ioctl = 0x541C; |
| 150 |
pub const TIOCCONS: Ioctl = 0x20007424; |
| 151 |
pub const TIOCGSERIAL: Ioctl = 0x541E; |
| 152 |
pub const TIOCSSERIAL: Ioctl = 0x541F; |
| 153 |
pub const TIOCPKT: Ioctl = 0x80047470; |
| 154 |
pub const FIONBIO: Ioctl = 0x8004667e; |
| 155 |
pub const TIOCNOTTY: Ioctl = 0x20007471; |
| 156 |
pub const TIOCSETD: Ioctl = 0x80047401; |
| 157 |
pub const TIOCGETD: Ioctl = 0x40047400; |
| 158 |
pub const TCSBRKP: Ioctl = 0x5425; |
| 159 |
pub const TIOCSBRK: Ioctl = 0x2000747b; |
| 160 |
pub const TIOCCBRK: Ioctl = 0x2000747a; |
| 161 |
pub const TIOCGSID: Ioctl = 0x40047485; |
| 162 |
pub const TCGETS2: Ioctl = 0x402c540c; |
| 163 |
pub const TCSETS2: Ioctl = 0x802c540d; |
| 164 |
pub const TCSETSW2: Ioctl = 0x802c540e; |
| 165 |
pub const TCSETSF2: Ioctl = 0x802c540f; |
| 166 |
pub const TIOCGPTN: Ioctl = 0x40047486; |
| 167 |
pub const TIOCSPTLCK: Ioctl = 0x80047487; |
| 168 |
pub const TIOCGDEV: Ioctl = 0x40045432; |
| 169 |
pub const TIOCSIG: Ioctl = 0x80047488; |
| 170 |
pub const TIOCVHANGUP: Ioctl = 0x20005437; |
| 171 |
pub const TIOCGPKT: Ioctl = 0x40045438; |
| 172 |
pub const TIOCGPTLCK: Ioctl = 0x40045439; |
| 173 |
pub const TIOCGEXCL: Ioctl = 0x40045440; |
| 174 |
pub const TIOCGPTPEER: Ioctl = 0x20007489; |
| 175 |
pub const FIONCLEX: Ioctl = 0x20006602; |
| 176 |
pub const FIOCLEX: Ioctl = 0x20006601; |
| 177 |
pub const TIOCSERCONFIG: Ioctl = 0x5453; |
| 178 |
pub const TIOCSERGWILD: Ioctl = 0x5454; |
| 179 |
pub const TIOCSERSWILD: Ioctl = 0x5455; |
| 180 |
pub const TIOCGLCKTRMIOS: Ioctl = 0x5456; |
| 181 |
pub const TIOCSLCKTRMIOS: Ioctl = 0x5457; |
| 182 |
pub const TIOCSERGSTRUCT: Ioctl = 0x5458; |
| 183 |
pub const TIOCSERGETLSR: Ioctl = 0x5459; |
| 184 |
pub const TIOCSERGETMULTI: Ioctl = 0x545A; |
| 185 |
pub const TIOCSERSETMULTI: Ioctl = 0x545B; |
| 186 |
pub const TIOCMIWAIT: Ioctl = 0x545C; |
| 187 |
pub const TIOCGICOUNT: Ioctl = 0x545D; |
| 188 |
pub const TIOCSTART: Ioctl = 0x2000746e; |
| 189 |
pub const TIOCSTOP: Ioctl = 0x2000746f; |
| 190 |
pub const BLKIOMIN: Ioctl = 0x20001278; |
| 191 |
pub const BLKIOOPT: Ioctl = 0x20001279; |
| 192 |
pub const BLKSSZGET: Ioctl = 0x20001268; |
| 193 |
pub const BLKPBSZGET: Ioctl = 0x2000127B; |
| 194 |
|
| 195 |
//pub const FIOASYNC: Ioctl = 0x4004667d; |
| 196 |
//pub const FIOQSIZE: Ioctl = ; |
| 197 |
//pub const TIOCGISO7816: Ioctl = 0x40285443; |
| 198 |
//pub const TIOCSISO7816: Ioctl = 0xc0285444; |
| 199 |
//pub const TIOCGRS485: Ioctl = 0x40205441; |
| 200 |
//pub const TIOCSRS485: Ioctl = 0xc0205442; |
| 201 |
|
| 202 |
// linux/if_tun.h |
| 203 |
pub const TUNSETNOCSUM: Ioctl = 0x800454c8; |
| 204 |
pub const TUNSETDEBUG: Ioctl = 0x800454c9; |
| 205 |
pub const TUNSETIFF: Ioctl = 0x800454ca; |
| 206 |
pub const TUNSETPERSIST: Ioctl = 0x800454cb; |
| 207 |
pub const TUNSETOWNER: Ioctl = 0x800454cc; |
| 208 |
pub const TUNSETLINK: Ioctl = 0x800454cd; |
| 209 |
pub const TUNSETGROUP: Ioctl = 0x800454ce; |
| 210 |
pub const TUNGETFEATURES: Ioctl = 0x400454cf; |
| 211 |
pub const TUNSETOFFLOAD: Ioctl = 0x800454d0; |
| 212 |
pub const TUNSETTXFILTER: Ioctl = 0x800454d1; |
| 213 |
pub const TUNGETIFF: Ioctl = 0x400454d2; |
| 214 |
pub const TUNGETSNDBUF: Ioctl = 0x400454d3; |
| 215 |
pub const TUNSETSNDBUF: Ioctl = 0x800454d4; |
| 216 |
pub const TUNGETVNETHDRSZ: Ioctl = 0x400454d7; |
| 217 |
pub const TUNSETVNETHDRSZ: Ioctl = 0x800454d8; |
| 218 |
pub const TUNSETQUEUE: Ioctl = 0x800454d9; |
| 219 |
pub const TUNSETIFINDEX: Ioctl = 0x800454da; |
| 220 |
pub const TUNSETVNETLE: Ioctl = 0x800454dc; |
| 221 |
pub const TUNGETVNETLE: Ioctl = 0x400454dd; |
| 222 |
/* The TUNSETVNETBE and TUNGETVNETBE ioctls are for cross-endian support on |
| 223 |
* little-endian hosts. Not all kernel configurations support them, but all |
| 224 |
* configurations that support SET also support GET. |
| 225 |
*/ |
| 226 |
pub const TUNSETVNETBE: Ioctl = 0x800454de; |
| 227 |
pub const TUNGETVNETBE: Ioctl = 0x400454df; |
| 228 |
pub const TUNSETSTEERINGEBPF: Ioctl = 0x400454e0; |
| 229 |
pub const TUNSETFILTEREBPF: Ioctl = 0x400454e1; |
| 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 = 0x008; |
| 235 |
pub const TIOCM_SR: c_int = 0x010; |
| 236 |
pub const TIOCM_CTS: c_int = 0x020; |
| 237 |
pub const TIOCM_CAR: c_int = 0x040; |
| 238 |
pub const TIOCM_CD: c_int = TIOCM_CAR; |
| 239 |
pub const TIOCM_RNG: c_int = 0x080; |
| 240 |
pub const TIOCM_RI: c_int = TIOCM_RNG; |
| 241 |
pub const TIOCM_DSR: c_int = 0x100; |
| 242 |
|
| 243 |
pub const BOTHER: crate::speed_t = 0x1000; |
| 244 |
pub const IBSHIFT: crate::tcflag_t = 16; |
| 245 |
|
| 246 |
// RLIMIT Constants |
| 247 |
|
| 248 |
pub const RLIMIT_CPU: crate::__rlimit_resource_t = 0; |
| 249 |
pub const RLIMIT_FSIZE: crate::__rlimit_resource_t = 1; |
| 250 |
pub const RLIMIT_DATA: crate::__rlimit_resource_t = 2; |
| 251 |
pub const RLIMIT_STACK: crate::__rlimit_resource_t = 3; |
| 252 |
pub const RLIMIT_CORE: crate::__rlimit_resource_t = 4; |
| 253 |
pub const RLIMIT_RSS: crate::__rlimit_resource_t = 5; |
| 254 |
pub const RLIMIT_NOFILE: crate::__rlimit_resource_t = 6; |
| 255 |
pub const RLIMIT_NPROC: crate::__rlimit_resource_t = 7; |
| 256 |
pub const RLIMIT_MEMLOCK: crate::__rlimit_resource_t = 8; |
| 257 |
pub const RLIMIT_AS: crate::__rlimit_resource_t = 9; |
| 258 |
pub const RLIMIT_LOCKS: crate::__rlimit_resource_t = 10; |
| 259 |
pub const RLIMIT_SIGPENDING: crate::__rlimit_resource_t = 11; |
| 260 |
pub const RLIMIT_MSGQUEUE: crate::__rlimit_resource_t = 12; |
| 261 |
pub const RLIMIT_NICE: crate::__rlimit_resource_t = 13; |
| 262 |
pub const RLIMIT_RTPRIO: crate::__rlimit_resource_t = 14; |
| 263 |
pub const RLIMIT_RTTIME: crate::__rlimit_resource_t = 15; |
| 264 |
#[deprecated(since = "0.2.64", note = "Not stable across OS versions")] |
| 265 |
pub const RLIM_NLIMITS: crate::__rlimit_resource_t = 16; |
| 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 |
|
| 270 |
cfg_if! { |
| 271 |
if #[cfg(target_arch = "sparc64")] { |
| 272 |
pub const RLIM_INFINITY: crate::rlim_t = !0; |
| 273 |
} else if #[cfg(target_arch = "sparc")] { |
| 274 |
pub const RLIM_INFINITY: crate::rlim_t = 0x7fffffff; |
| 275 |
} |
| 276 |
} |
| 277 |
|
| 278 |
cfg_if! { |
| 279 |
// Those type are constructed using the _IOC macro |
| 280 |
// DD-SS_SSSS_SSSS_SSSS-TTTT_TTTT-NNNN_NNNN |
| 281 |
// where D stands for direction (either None (00), Read (01) or Write (11)) |
| 282 |
// where S stands for size (int, long, struct...) |
| 283 |
// where T stands for type ('f','v','X'...) |
| 284 |
// where N stands for NR (NumbeR) |
| 285 |
if #[cfg(target_arch = "sparc")] { |
| 286 |
pub const FS_IOC_GETFLAGS: Ioctl = 0x40046601; |
| 287 |
pub const FS_IOC_SETFLAGS: Ioctl = 0x80046602; |
| 288 |
pub const FS_IOC_GETVERSION: Ioctl = 0x40047601; |
| 289 |
pub const FS_IOC_SETVERSION: Ioctl = 0x80047602; |
| 290 |
pub const FS_IOC32_GETFLAGS: Ioctl = 0x40046601; |
| 291 |
pub const FS_IOC32_SETFLAGS: Ioctl = 0x80046602; |
| 292 |
pub const FS_IOC32_GETVERSION: Ioctl = 0x40047601; |
| 293 |
pub const FS_IOC32_SETVERSION: Ioctl = 0x80047602; |
| 294 |
pub const TUNATTACHFILTER: Ioctl = 0x800854d5; |
| 295 |
pub const TUNDETACHFILTER: Ioctl = 0x800854d6; |
| 296 |
pub const TUNGETFILTER: Ioctl = 0x400854db; |
| 297 |
} else if #[cfg(target_arch = "sparc64")] { |
| 298 |
pub const FS_IOC_GETFLAGS: Ioctl = 0x40086601; |
| 299 |
pub const FS_IOC_SETFLAGS: Ioctl = 0x80086602; |
| 300 |
pub const FS_IOC_GETVERSION: Ioctl = 0x40087601; |
| 301 |
pub const FS_IOC_SETVERSION: Ioctl = 0x80087602; |
| 302 |
pub const FS_IOC32_GETFLAGS: Ioctl = 0x40046601; |
| 303 |
pub const FS_IOC32_SETFLAGS: Ioctl = 0x80046602; |
| 304 |
pub const FS_IOC32_GETVERSION: Ioctl = 0x40047601; |
| 305 |
pub const FS_IOC32_SETVERSION: Ioctl = 0x80047602; |
| 306 |
pub const TUNATTACHFILTER: Ioctl = 0x801054d5; |
| 307 |
pub const TUNDETACHFILTER: Ioctl = 0x801054d6; |
| 308 |
pub const TUNGETFILTER: Ioctl = 0x401054db; |
| 309 |
} |
| 310 |
} |