| 1 | //! Adapt the Linux API to resemble a POSIX-style libc API. |
| 2 | //! |
| 3 | //! The linux_raw backend doesn't use actual libc; this just defines certain |
| 4 | //! types that are convenient to have defined. |
| 5 | |
| 6 | #![allow (unused_imports)] |
| 7 | #![allow (non_camel_case_types)] |
| 8 | |
| 9 | pub(crate) type size_t = usize; |
| 10 | pub(crate) use linux_raw_sys::ctypes::*; |
| 11 | pub(crate) use linux_raw_sys::errno::{EBADF, EINVAL}; |
| 12 | pub(crate) use linux_raw_sys::general::{__kernel_fd_set as fd_set, __FD_SETSIZE as FD_SETSIZE}; |
| 13 | pub(crate) use linux_raw_sys::ioctl::{FIONBIO, FIONREAD}; |
| 14 | // Import the kernel's `uid_t` and `gid_t` if they're 32-bit. |
| 15 | #[cfg (feature = "thread" )] |
| 16 | pub(crate) use linux_raw_sys::general::futex_waitv; |
| 17 | #[cfg (not(any(target_arch = "arm" , target_arch = "sparc" , target_arch = "x86" )))] |
| 18 | pub(crate) use linux_raw_sys::general::{__kernel_gid_t as gid_t, __kernel_uid_t as uid_t}; |
| 19 | pub(crate) use linux_raw_sys::general::{ |
| 20 | __kernel_pid_t as pid_t, __kernel_time64_t as time_t, __kernel_timespec as timespec, iovec, |
| 21 | O_CLOEXEC, O_NOCTTY, O_NONBLOCK, O_RDWR, |
| 22 | }; |
| 23 | #[cfg (feature = "system" )] |
| 24 | pub(crate) use linux_raw_sys::system::sysinfo; |
| 25 | |
| 26 | #[cfg (feature = "fs" )] |
| 27 | #[cfg (target_arch = "x86" )] |
| 28 | #[cfg (test)] |
| 29 | pub(crate) use linux_raw_sys::general::stat64; |
| 30 | #[cfg (feature = "fs" )] |
| 31 | #[cfg (test)] |
| 32 | pub(crate) use linux_raw_sys::general::{ |
| 33 | __kernel_fsid_t as fsid_t, stat, statfs64, statx, statx_timestamp, |
| 34 | }; |
| 35 | |
| 36 | #[cfg (feature = "event" )] |
| 37 | #[cfg (test)] |
| 38 | pub(crate) use linux_raw_sys::general::epoll_event; |
| 39 | |
| 40 | #[cfg (feature = "mm" )] |
| 41 | mod mm { |
| 42 | pub(crate) use linux_raw_sys::general::{MAP_HUGETLB, MAP_HUGE_SHIFT}; |
| 43 | } |
| 44 | #[cfg (feature = "mm" )] |
| 45 | pub(crate) use mm::*; |
| 46 | |
| 47 | #[cfg (any( |
| 48 | feature = "fs" , |
| 49 | all( |
| 50 | not(feature = "use-libc-auxv" ), |
| 51 | not(feature = "use-explicitly-provided-auxv" ), |
| 52 | any( |
| 53 | feature = "param" , |
| 54 | feature = "runtime" , |
| 55 | feature = "thread" , |
| 56 | feature = "time" , |
| 57 | target_arch = "x86" , |
| 58 | ) |
| 59 | ) |
| 60 | ))] |
| 61 | pub(crate) use linux_raw_sys::general::{ |
| 62 | AT_FDCWD, NFS_SUPER_MAGIC, O_LARGEFILE, PROC_SUPER_MAGIC, UTIME_NOW, UTIME_OMIT, XATTR_CREATE, |
| 63 | XATTR_REPLACE, |
| 64 | }; |
| 65 | |
| 66 | pub(crate) use linux_raw_sys::ioctl::{BLKPBSZGET, BLKSSZGET, FICLONE}; |
| 67 | #[cfg (target_pointer_width = "32" )] |
| 68 | pub(crate) use linux_raw_sys::ioctl::{FS_IOC32_GETFLAGS, FS_IOC32_SETFLAGS}; |
| 69 | #[cfg (target_pointer_width = "64" )] |
| 70 | pub(crate) use linux_raw_sys::ioctl::{FS_IOC_GETFLAGS, FS_IOC_SETFLAGS}; |
| 71 | |
| 72 | #[cfg (feature = "io_uring" )] |
| 73 | pub(crate) use linux_raw_sys::{general::open_how, io_uring::*}; |
| 74 | |
| 75 | #[cfg (feature = "net" )] |
| 76 | pub(crate) use linux_raw_sys::{ |
| 77 | cmsg_macros::*, |
| 78 | general::{O_CLOEXEC as SOCK_CLOEXEC, O_NONBLOCK as SOCK_NONBLOCK}, |
| 79 | if_ether::*, |
| 80 | net::{ |
| 81 | __kernel_sa_family_t as sa_family_t, __kernel_sockaddr_storage as sockaddr_storage, |
| 82 | cmsghdr, in6_addr, in_addr, ip_mreq, ip_mreq_source, ip_mreqn, ipv6_mreq, linger, mmsghdr, |
| 83 | msghdr, sockaddr, sockaddr_in, sockaddr_in6, sockaddr_un, socklen_t, AF_DECnet, |
| 84 | AF_APPLETALK, AF_ASH, AF_ATMPVC, AF_ATMSVC, AF_AX25, AF_BLUETOOTH, AF_BRIDGE, AF_CAN, |
| 85 | AF_ECONET, AF_IEEE802154, AF_INET, AF_INET6, AF_IPX, AF_IRDA, AF_ISDN, AF_IUCV, AF_KEY, |
| 86 | AF_LLC, AF_NETBEUI, AF_NETLINK, AF_NETROM, AF_PACKET, AF_PHONET, AF_PPPOX, AF_RDS, AF_ROSE, |
| 87 | AF_RXRPC, AF_SECURITY, AF_SNA, AF_TIPC, AF_UNIX, AF_UNSPEC, AF_WANPIPE, AF_X25, AF_XDP, |
| 88 | IP6T_SO_ORIGINAL_DST, IPPROTO_FRAGMENT, IPPROTO_ICMPV6, IPPROTO_MH, IPPROTO_ROUTING, |
| 89 | IPV6_ADD_MEMBERSHIP, IPV6_DROP_MEMBERSHIP, IPV6_FREEBIND, IPV6_MULTICAST_HOPS, |
| 90 | IPV6_MULTICAST_LOOP, IPV6_RECVTCLASS, IPV6_TCLASS, IPV6_UNICAST_HOPS, IPV6_V6ONLY, |
| 91 | IP_ADD_MEMBERSHIP, IP_ADD_SOURCE_MEMBERSHIP, IP_DROP_MEMBERSHIP, IP_DROP_SOURCE_MEMBERSHIP, |
| 92 | IP_FREEBIND, IP_MULTICAST_LOOP, IP_MULTICAST_TTL, IP_RECVTOS, IP_TOS, IP_TTL, |
| 93 | MSG_CMSG_CLOEXEC, MSG_CONFIRM, MSG_CTRUNC, MSG_DONTROUTE, MSG_DONTWAIT, MSG_EOR, |
| 94 | MSG_ERRQUEUE, MSG_MORE, MSG_NOSIGNAL, MSG_OOB, MSG_PEEK, MSG_TRUNC, MSG_WAITALL, |
| 95 | SCM_CREDENTIALS, SCM_RIGHTS, SHUT_RD, SHUT_RDWR, SHUT_WR, SOCK_DGRAM, SOCK_RAW, SOCK_RDM, |
| 96 | SOCK_SEQPACKET, SOCK_STREAM, SOL_SOCKET, SOL_XDP, SO_ACCEPTCONN, SO_BROADCAST, SO_COOKIE, |
| 97 | SO_DOMAIN, SO_ERROR, SO_INCOMING_CPU, SO_KEEPALIVE, SO_LINGER, SO_OOBINLINE, |
| 98 | SO_ORIGINAL_DST, SO_PASSCRED, SO_PROTOCOL, SO_RCVBUF, SO_RCVBUFFORCE, SO_RCVTIMEO_NEW, |
| 99 | SO_RCVTIMEO_NEW as SO_RCVTIMEO, SO_RCVTIMEO_OLD, SO_REUSEADDR, SO_REUSEPORT, SO_SNDBUF, |
| 100 | SO_SNDBUFFORCE, SO_SNDTIMEO_NEW, SO_SNDTIMEO_NEW as SO_SNDTIMEO, SO_SNDTIMEO_OLD, SO_TYPE, |
| 101 | TCP_CONGESTION, TCP_CORK, TCP_KEEPCNT, TCP_KEEPIDLE, TCP_KEEPINTVL, TCP_NODELAY, |
| 102 | TCP_QUICKACK, TCP_THIN_LINEAR_TIMEOUTS, TCP_USER_TIMEOUT, |
| 103 | }, |
| 104 | netlink::*, |
| 105 | xdp::{ |
| 106 | sockaddr_xdp, xdp_desc, xdp_mmap_offsets, xdp_mmap_offsets_v1, xdp_options, |
| 107 | xdp_ring_offset, xdp_ring_offset_v1, xdp_statistics, xdp_statistics_v1, xdp_umem_reg, |
| 108 | xdp_umem_reg_v1, XDP_COPY, XDP_MMAP_OFFSETS, XDP_OPTIONS, XDP_OPTIONS_ZEROCOPY, |
| 109 | XDP_PGOFF_RX_RING, XDP_PGOFF_TX_RING, XDP_PKT_CONTD, XDP_RING_NEED_WAKEUP, XDP_RX_RING, |
| 110 | XDP_SHARED_UMEM, XDP_STATISTICS, XDP_TX_RING, XDP_UMEM_COMPLETION_RING, XDP_UMEM_FILL_RING, |
| 111 | XDP_UMEM_PGOFF_COMPLETION_RING, XDP_UMEM_PGOFF_FILL_RING, XDP_UMEM_REG, |
| 112 | XDP_UMEM_UNALIGNED_CHUNK_FLAG, XDP_USE_NEED_WAKEUP, XDP_USE_SG, XDP_ZEROCOPY, |
| 113 | XSK_UNALIGNED_BUF_ADDR_MASK, XSK_UNALIGNED_BUF_OFFSET_SHIFT, |
| 114 | }, |
| 115 | }; |
| 116 | |
| 117 | // Cast away bindgen's `enum` type to make these consistent with the other |
| 118 | // `setsockopt`/`getsockopt` level values. |
| 119 | #[cfg (feature = "net" )] |
| 120 | pub(crate) const IPPROTO_IP: u32 = linux_raw_sys::net::IPPROTO_IP as _; |
| 121 | #[cfg (feature = "net" )] |
| 122 | pub(crate) const IPPROTO_ICMP: u32 = linux_raw_sys::net::IPPROTO_ICMP as _; |
| 123 | #[cfg (feature = "net" )] |
| 124 | pub(crate) const IPPROTO_IGMP: u32 = linux_raw_sys::net::IPPROTO_IGMP as _; |
| 125 | #[cfg (feature = "net" )] |
| 126 | pub(crate) const IPPROTO_IPIP: u32 = linux_raw_sys::net::IPPROTO_IPIP as _; |
| 127 | #[cfg (feature = "net" )] |
| 128 | pub(crate) const IPPROTO_TCP: u32 = linux_raw_sys::net::IPPROTO_TCP as _; |
| 129 | #[cfg (feature = "net" )] |
| 130 | pub(crate) const IPPROTO_EGP: u32 = linux_raw_sys::net::IPPROTO_EGP as _; |
| 131 | #[cfg (feature = "net" )] |
| 132 | pub(crate) const IPPROTO_PUP: u32 = linux_raw_sys::net::IPPROTO_PUP as _; |
| 133 | #[cfg (feature = "net" )] |
| 134 | pub(crate) const IPPROTO_UDP: u32 = linux_raw_sys::net::IPPROTO_UDP as _; |
| 135 | #[cfg (feature = "net" )] |
| 136 | pub(crate) const IPPROTO_IDP: u32 = linux_raw_sys::net::IPPROTO_IDP as _; |
| 137 | #[cfg (feature = "net" )] |
| 138 | pub(crate) const IPPROTO_TP: u32 = linux_raw_sys::net::IPPROTO_TP as _; |
| 139 | #[cfg (feature = "net" )] |
| 140 | pub(crate) const IPPROTO_DCCP: u32 = linux_raw_sys::net::IPPROTO_DCCP as _; |
| 141 | #[cfg (feature = "net" )] |
| 142 | pub(crate) const IPPROTO_IPV6: u32 = linux_raw_sys::net::IPPROTO_IPV6 as _; |
| 143 | #[cfg (feature = "net" )] |
| 144 | pub(crate) const IPPROTO_RSVP: u32 = linux_raw_sys::net::IPPROTO_RSVP as _; |
| 145 | #[cfg (feature = "net" )] |
| 146 | pub(crate) const IPPROTO_GRE: u32 = linux_raw_sys::net::IPPROTO_GRE as _; |
| 147 | #[cfg (feature = "net" )] |
| 148 | pub(crate) const IPPROTO_ESP: u32 = linux_raw_sys::net::IPPROTO_ESP as _; |
| 149 | #[cfg (feature = "net" )] |
| 150 | pub(crate) const IPPROTO_AH: u32 = linux_raw_sys::net::IPPROTO_AH as _; |
| 151 | #[cfg (feature = "net" )] |
| 152 | pub(crate) const IPPROTO_MTP: u32 = linux_raw_sys::net::IPPROTO_MTP as _; |
| 153 | #[cfg (feature = "net" )] |
| 154 | pub(crate) const IPPROTO_BEETPH: u32 = linux_raw_sys::net::IPPROTO_BEETPH as _; |
| 155 | #[cfg (feature = "net" )] |
| 156 | pub(crate) const IPPROTO_ENCAP: u32 = linux_raw_sys::net::IPPROTO_ENCAP as _; |
| 157 | #[cfg (feature = "net" )] |
| 158 | pub(crate) const IPPROTO_PIM: u32 = linux_raw_sys::net::IPPROTO_PIM as _; |
| 159 | #[cfg (feature = "net" )] |
| 160 | pub(crate) const IPPROTO_COMP: u32 = linux_raw_sys::net::IPPROTO_COMP as _; |
| 161 | #[cfg (feature = "net" )] |
| 162 | pub(crate) const IPPROTO_SCTP: u32 = linux_raw_sys::net::IPPROTO_SCTP as _; |
| 163 | #[cfg (feature = "net" )] |
| 164 | pub(crate) const IPPROTO_UDPLITE: u32 = linux_raw_sys::net::IPPROTO_UDPLITE as _; |
| 165 | #[cfg (feature = "net" )] |
| 166 | pub(crate) const IPPROTO_MPLS: u32 = linux_raw_sys::net::IPPROTO_MPLS as _; |
| 167 | #[cfg (feature = "net" )] |
| 168 | pub(crate) const IPPROTO_ETHERNET: u32 = linux_raw_sys::net::IPPROTO_ETHERNET as _; |
| 169 | #[cfg (feature = "net" )] |
| 170 | pub(crate) const IPPROTO_RAW: u32 = linux_raw_sys::net::IPPROTO_RAW as _; |
| 171 | #[cfg (feature = "net" )] |
| 172 | pub(crate) const IPPROTO_MPTCP: u32 = linux_raw_sys::net::IPPROTO_MPTCP as _; |
| 173 | |
| 174 | #[cfg (any(feature = "process" , feature = "runtime" ))] |
| 175 | pub(crate) use linux_raw_sys::general::siginfo_t; |
| 176 | |
| 177 | #[cfg (any(feature = "process" , feature = "runtime" ))] |
| 178 | pub(crate) const EXIT_SUCCESS: c_int = 0; |
| 179 | #[cfg (any(feature = "process" , feature = "runtime" ))] |
| 180 | pub(crate) const EXIT_FAILURE: c_int = 1; |
| 181 | #[cfg (feature = "process" )] |
| 182 | pub(crate) const EXIT_SIGNALED_SIGABRT: c_int = 128 + linux_raw_sys::general::SIGABRT as c_int; |
| 183 | #[cfg (feature = "runtime" )] |
| 184 | pub(crate) const CLONE_CHILD_SETTID: c_int = linux_raw_sys::general::CLONE_CHILD_SETTID as c_int; |
| 185 | |
| 186 | #[cfg (feature = "process" )] |
| 187 | pub(crate) use linux_raw_sys::{ |
| 188 | general::{ |
| 189 | CLD_CONTINUED, CLD_DUMPED, CLD_EXITED, CLD_KILLED, CLD_STOPPED, CLD_TRAPPED, F_RDLCK, |
| 190 | F_UNLCK, F_WRLCK, O_NONBLOCK as PIDFD_NONBLOCK, P_ALL, P_PGID, P_PID, P_PIDFD, SEEK_CUR, |
| 191 | SEEK_END, SEEK_SET, |
| 192 | }, |
| 193 | ioctl::TIOCSCTTY, |
| 194 | }; |
| 195 | |
| 196 | #[cfg (feature = "process" )] |
| 197 | #[cfg (target_pointer_width = "32" )] |
| 198 | pub(crate) use linux_raw_sys::general::{flock64 as flock, F_GETLK64}; |
| 199 | |
| 200 | #[cfg (feature = "process" )] |
| 201 | #[cfg (target_pointer_width = "64" )] |
| 202 | pub(crate) use linux_raw_sys::general::{flock, F_GETLK}; |
| 203 | |
| 204 | #[cfg (feature = "pty" )] |
| 205 | pub(crate) use linux_raw_sys::ioctl::TIOCGPTPEER; |
| 206 | |
| 207 | #[cfg (feature = "termios" )] |
| 208 | pub(crate) use linux_raw_sys::{ |
| 209 | general::{ |
| 210 | cc_t, speed_t, tcflag_t, termios, termios2, winsize, B0, B1000000, B110, B115200, B1152000, |
| 211 | B1200, B134, B150, B1500000, B1800, B19200, B200, B2000000, B230400, B2400, B2500000, B300, |
| 212 | B3000000, B3500000, B38400, B4000000, B460800, B4800, B50, B500000, B57600, B576000, B600, |
| 213 | B75, B921600, B9600, BOTHER, BRKINT, BS0, BS1, BSDLY, CBAUD, CBAUDEX, CIBAUD, CLOCAL, |
| 214 | CMSPAR, CR0, CR1, CR2, CR3, CRDLY, CREAD, CRTSCTS, CS5, CS6, CS7, CS8, CSIZE, CSTOPB, ECHO, |
| 215 | ECHOCTL, ECHOE, ECHOK, ECHOKE, ECHONL, ECHOPRT, EXTA, EXTB, EXTPROC, FF0, FF1, FFDLY, |
| 216 | FLUSHO, HUPCL, IBSHIFT, ICANON, ICRNL, IEXTEN, IGNBRK, IGNCR, IGNPAR, IMAXBEL, INLCR, |
| 217 | INPCK, ISIG, ISTRIP, IUCLC, IUTF8, IXANY, IXOFF, IXON, NCCS, NL0, NL1, NLDLY, NOFLSH, |
| 218 | OCRNL, OFDEL, OFILL, OLCUC, ONLCR, ONLRET, ONOCR, OPOST, PARENB, PARMRK, PARODD, PENDIN, |
| 219 | TAB0, TAB1, TAB2, TAB3, TABDLY, TCIFLUSH, TCIOFF, TCIOFLUSH, TCION, TCOFLUSH, TCOOFF, |
| 220 | TCOON, TCSADRAIN, TCSAFLUSH, TCSANOW, TOSTOP, VDISCARD, VEOF, VEOL, VEOL2, VERASE, VINTR, |
| 221 | VKILL, VLNEXT, VMIN, VQUIT, VREPRINT, VSTART, VSTOP, VSUSP, VSWTC, VT0, VT1, VTDLY, VTIME, |
| 222 | VWERASE, XCASE, XTABS, |
| 223 | }, |
| 224 | ioctl::{ |
| 225 | TCFLSH, TCGETS, TCGETS2, TCSBRK, TCSETS, TCSETS2, TCSETSF2, TCSETSW2, TCXONC, TIOCEXCL, |
| 226 | TIOCGPGRP, TIOCGSID, TIOCGWINSZ, TIOCNXCL, TIOCSPGRP, TIOCSWINSZ, |
| 227 | }, |
| 228 | }; |
| 229 | |
| 230 | // Define our own `uid_t` and `gid_t` if the kernel's versions are not 32-bit. |
| 231 | #[cfg (any(target_arch = "arm" , target_arch = "sparc" , target_arch = "x86" ))] |
| 232 | pub(crate) type uid_t = u32; |
| 233 | #[cfg (any(target_arch = "arm" , target_arch = "sparc" , target_arch = "x86" ))] |
| 234 | pub(crate) type gid_t = u32; |
| 235 | |
| 236 | // Bindgen infers `u32` for many of these macro types which meant to be |
| 237 | // used with `c_int` in the C APIs, so cast them to `c_int`. |
| 238 | |
| 239 | // Convert the signal constants from `u32` to `c_int`. |
| 240 | pub(crate) const SIGHUP: c_int = linux_raw_sys::general::SIGHUP as _; |
| 241 | pub(crate) const SIGINT: c_int = linux_raw_sys::general::SIGINT as _; |
| 242 | pub(crate) const SIGQUIT: c_int = linux_raw_sys::general::SIGQUIT as _; |
| 243 | pub(crate) const SIGILL: c_int = linux_raw_sys::general::SIGILL as _; |
| 244 | pub(crate) const SIGTRAP: c_int = linux_raw_sys::general::SIGTRAP as _; |
| 245 | pub(crate) const SIGABRT: c_int = linux_raw_sys::general::SIGABRT as _; |
| 246 | pub(crate) const SIGBUS: c_int = linux_raw_sys::general::SIGBUS as _; |
| 247 | pub(crate) const SIGFPE: c_int = linux_raw_sys::general::SIGFPE as _; |
| 248 | pub(crate) const SIGKILL: c_int = linux_raw_sys::general::SIGKILL as _; |
| 249 | pub(crate) const SIGUSR1: c_int = linux_raw_sys::general::SIGUSR1 as _; |
| 250 | pub(crate) const SIGSEGV: c_int = linux_raw_sys::general::SIGSEGV as _; |
| 251 | pub(crate) const SIGUSR2: c_int = linux_raw_sys::general::SIGUSR2 as _; |
| 252 | pub(crate) const SIGPIPE: c_int = linux_raw_sys::general::SIGPIPE as _; |
| 253 | pub(crate) const SIGALRM: c_int = linux_raw_sys::general::SIGALRM as _; |
| 254 | pub(crate) const SIGTERM: c_int = linux_raw_sys::general::SIGTERM as _; |
| 255 | #[cfg (not(any( |
| 256 | target_arch = "mips" , |
| 257 | target_arch = "mips32r6" , |
| 258 | target_arch = "mips64" , |
| 259 | target_arch = "mips64r6" , |
| 260 | target_arch = "sparc" , |
| 261 | target_arch = "sparc64" |
| 262 | )))] |
| 263 | pub(crate) const SIGSTKFLT: c_int = linux_raw_sys::general::SIGSTKFLT as _; |
| 264 | pub(crate) const SIGCHLD: c_int = linux_raw_sys::general::SIGCHLD as _; |
| 265 | pub(crate) const SIGCONT: c_int = linux_raw_sys::general::SIGCONT as _; |
| 266 | pub(crate) const SIGSTOP: c_int = linux_raw_sys::general::SIGSTOP as _; |
| 267 | pub(crate) const SIGTSTP: c_int = linux_raw_sys::general::SIGTSTP as _; |
| 268 | pub(crate) const SIGTTIN: c_int = linux_raw_sys::general::SIGTTIN as _; |
| 269 | pub(crate) const SIGTTOU: c_int = linux_raw_sys::general::SIGTTOU as _; |
| 270 | pub(crate) const SIGURG: c_int = linux_raw_sys::general::SIGURG as _; |
| 271 | pub(crate) const SIGXCPU: c_int = linux_raw_sys::general::SIGXCPU as _; |
| 272 | pub(crate) const SIGXFSZ: c_int = linux_raw_sys::general::SIGXFSZ as _; |
| 273 | pub(crate) const SIGVTALRM: c_int = linux_raw_sys::general::SIGVTALRM as _; |
| 274 | pub(crate) const SIGPROF: c_int = linux_raw_sys::general::SIGPROF as _; |
| 275 | pub(crate) const SIGWINCH: c_int = linux_raw_sys::general::SIGWINCH as _; |
| 276 | pub(crate) const SIGIO: c_int = linux_raw_sys::general::SIGIO as _; |
| 277 | pub(crate) const SIGPWR: c_int = linux_raw_sys::general::SIGPWR as _; |
| 278 | pub(crate) const SIGSYS: c_int = linux_raw_sys::general::SIGSYS as _; |
| 279 | #[cfg (any( |
| 280 | target_arch = "mips" , |
| 281 | target_arch = "mips32r6" , |
| 282 | target_arch = "mips64" , |
| 283 | target_arch = "mips64r6" , |
| 284 | target_arch = "sparc" , |
| 285 | target_arch = "sparc64" |
| 286 | ))] |
| 287 | pub(crate) const SIGEMT: c_int = linux_raw_sys::general::SIGEMT as _; |
| 288 | |
| 289 | #[cfg (feature = "stdio" )] |
| 290 | pub(crate) const STDIN_FILENO: c_int = linux_raw_sys::general::STDIN_FILENO as _; |
| 291 | #[cfg (feature = "stdio" )] |
| 292 | pub(crate) const STDOUT_FILENO: c_int = linux_raw_sys::general::STDOUT_FILENO as _; |
| 293 | #[cfg (feature = "stdio" )] |
| 294 | pub(crate) const STDERR_FILENO: c_int = linux_raw_sys::general::STDERR_FILENO as _; |
| 295 | |
| 296 | pub(crate) const PIPE_BUF: usize = linux_raw_sys::general::PIPE_BUF as _; |
| 297 | |
| 298 | pub(crate) const CLOCK_MONOTONIC: c_int = linux_raw_sys::general::CLOCK_MONOTONIC as _; |
| 299 | pub(crate) const CLOCK_REALTIME: c_int = linux_raw_sys::general::CLOCK_REALTIME as _; |
| 300 | pub(crate) const CLOCK_MONOTONIC_RAW: c_int = linux_raw_sys::general::CLOCK_MONOTONIC_RAW as _; |
| 301 | pub(crate) const CLOCK_MONOTONIC_COARSE: c_int = |
| 302 | linux_raw_sys::general::CLOCK_MONOTONIC_COARSE as _; |
| 303 | pub(crate) const CLOCK_REALTIME_COARSE: c_int = linux_raw_sys::general::CLOCK_REALTIME_COARSE as _; |
| 304 | pub(crate) const CLOCK_THREAD_CPUTIME_ID: c_int = |
| 305 | linux_raw_sys::general::CLOCK_THREAD_CPUTIME_ID as _; |
| 306 | pub(crate) const CLOCK_PROCESS_CPUTIME_ID: c_int = |
| 307 | linux_raw_sys::general::CLOCK_PROCESS_CPUTIME_ID as _; |
| 308 | #[cfg (any(feature = "thread" , feature = "time" ))] |
| 309 | pub(crate) const CLOCK_BOOTTIME: c_int = linux_raw_sys::general::CLOCK_BOOTTIME as _; |
| 310 | #[cfg (any(feature = "thread" , feature = "time" ))] |
| 311 | pub(crate) const CLOCK_BOOTTIME_ALARM: c_int = linux_raw_sys::general::CLOCK_BOOTTIME_ALARM as _; |
| 312 | #[cfg (any(feature = "thread" , feature = "time" ))] |
| 313 | pub(crate) const CLOCK_TAI: c_int = linux_raw_sys::general::CLOCK_TAI as _; |
| 314 | #[cfg (any(feature = "thread" , feature = "time" ))] |
| 315 | pub(crate) const CLOCK_REALTIME_ALARM: c_int = linux_raw_sys::general::CLOCK_REALTIME_ALARM as _; |
| 316 | |
| 317 | #[cfg (feature = "system" )] |
| 318 | mod reboot_symbols { |
| 319 | use super::c_int; |
| 320 | |
| 321 | pub(crate) const LINUX_REBOOT_MAGIC1: c_int = linux_raw_sys::general::LINUX_REBOOT_MAGIC1 as _; |
| 322 | pub(crate) const LINUX_REBOOT_MAGIC2: c_int = linux_raw_sys::general::LINUX_REBOOT_MAGIC2 as _; |
| 323 | |
| 324 | pub(crate) const LINUX_REBOOT_CMD_RESTART: c_int = |
| 325 | linux_raw_sys::general::LINUX_REBOOT_CMD_RESTART as _; |
| 326 | pub(crate) const LINUX_REBOOT_CMD_HALT: c_int = |
| 327 | linux_raw_sys::general::LINUX_REBOOT_CMD_HALT as _; |
| 328 | pub(crate) const LINUX_REBOOT_CMD_CAD_ON: c_int = |
| 329 | linux_raw_sys::general::LINUX_REBOOT_CMD_CAD_ON as _; |
| 330 | pub(crate) const LINUX_REBOOT_CMD_CAD_OFF: c_int = |
| 331 | linux_raw_sys::general::LINUX_REBOOT_CMD_CAD_OFF as _; |
| 332 | pub(crate) const LINUX_REBOOT_CMD_POWER_OFF: c_int = |
| 333 | linux_raw_sys::general::LINUX_REBOOT_CMD_POWER_OFF as _; |
| 334 | pub(crate) const LINUX_REBOOT_CMD_SW_SUSPEND: c_int = |
| 335 | linux_raw_sys::general::LINUX_REBOOT_CMD_SW_SUSPEND as _; |
| 336 | pub(crate) const LINUX_REBOOT_CMD_KEXEC: c_int = |
| 337 | linux_raw_sys::general::LINUX_REBOOT_CMD_KEXEC as _; |
| 338 | } |
| 339 | #[cfg (feature = "system" )] |
| 340 | pub(crate) use reboot_symbols::*; |
| 341 | |
| 342 | #[cfg (any( |
| 343 | feature = "fs" , |
| 344 | all( |
| 345 | linux_raw, |
| 346 | not(feature = "use-libc-auxv" ), |
| 347 | not(feature = "use-explicitly-provided-auxv" ), |
| 348 | any( |
| 349 | feature = "param" , |
| 350 | feature = "runtime" , |
| 351 | feature = "thread" , |
| 352 | feature = "time" , |
| 353 | target_arch = "x86" , |
| 354 | ) |
| 355 | ) |
| 356 | ))] |
| 357 | mod statx_flags { |
| 358 | pub(crate) use linux_raw_sys::general::{ |
| 359 | STATX_ALL, STATX_ATIME, STATX_BASIC_STATS, STATX_BLOCKS, STATX_BTIME, STATX_CTIME, |
| 360 | STATX_DIOALIGN, STATX_GID, STATX_INO, STATX_MNT_ID, STATX_MODE, STATX_MTIME, STATX_NLINK, |
| 361 | STATX_SIZE, STATX_TYPE, STATX_UID, |
| 362 | }; |
| 363 | |
| 364 | pub(crate) use linux_raw_sys::general::{ |
| 365 | STATX_ATTR_APPEND, STATX_ATTR_AUTOMOUNT, STATX_ATTR_COMPRESSED, STATX_ATTR_DAX, |
| 366 | STATX_ATTR_ENCRYPTED, STATX_ATTR_IMMUTABLE, STATX_ATTR_MOUNT_ROOT, STATX_ATTR_NODUMP, |
| 367 | STATX_ATTR_VERITY, |
| 368 | }; |
| 369 | } |
| 370 | #[cfg (any( |
| 371 | feature = "fs" , |
| 372 | all( |
| 373 | linux_raw, |
| 374 | not(feature = "use-libc-auxv" ), |
| 375 | not(feature = "use-explicitly-provided-auxv" ), |
| 376 | any( |
| 377 | feature = "param" , |
| 378 | feature = "runtime" , |
| 379 | feature = "thread" , |
| 380 | feature = "time" , |
| 381 | target_arch = "x86" , |
| 382 | ) |
| 383 | ) |
| 384 | ))] |
| 385 | pub(crate) use statx_flags::*; |
| 386 | |