|
2 | 2 |
|
3 | 3 | use crate::prelude::*;
|
4 | 4 |
|
| 5 | +cfg_if! { |
| 6 | + if #[cfg(doc)] { |
| 7 | + pub(crate) type Ioctl = c_int; |
| 8 | + } else { |
| 9 | + #[doc(hidden)] |
| 10 | + pub type Ioctl = c_int; |
| 11 | + } |
| 12 | +} |
| 13 | + |
5 | 14 | pub type clock_t = c_long;
|
6 | 15 | pub type time_t = c_long;
|
7 | 16 | pub type suseconds_t = c_long;
|
@@ -337,19 +346,6 @@ s! {
|
337 | 346 | pub dlpi_tls_data: *mut c_void,
|
338 | 347 | }
|
339 | 348 |
|
340 |
| - // linux/filter.h |
341 |
| - pub struct sock_filter { |
342 |
| - pub code: crate::__u16, |
343 |
| - pub jt: crate::__u8, |
344 |
| - pub jf: crate::__u8, |
345 |
| - pub k: crate::__u32, |
346 |
| - } |
347 |
| - |
348 |
| - pub struct sock_fprog { |
349 |
| - pub len: c_ushort, |
350 |
| - pub filter: *mut sock_filter, |
351 |
| - } |
352 |
| - |
353 | 349 | // linux/seccomp.h
|
354 | 350 | pub struct seccomp_data {
|
355 | 351 | pub nr: c_int,
|
@@ -1698,27 +1694,6 @@ pub const FIONREAD: c_int = 0x541B;
|
1698 | 1694 | pub const TIOCCONS: c_int = 0x541D;
|
1699 | 1695 | pub const TIOCSBRK: c_int = 0x5427;
|
1700 | 1696 | pub const TIOCCBRK: c_int = 0x5428;
|
1701 |
| -cfg_if! { |
1702 |
| - if #[cfg(any( |
1703 |
| - target_arch = "x86", |
1704 |
| - target_arch = "x86_64", |
1705 |
| - target_arch = "arm", |
1706 |
| - target_arch = "aarch64", |
1707 |
| - target_arch = "riscv64", |
1708 |
| - target_arch = "s390x" |
1709 |
| - ))] { |
1710 |
| - pub const FICLONE: c_int = 0x40049409; |
1711 |
| - pub const FICLONERANGE: c_int = 0x4020940D; |
1712 |
| - } else if #[cfg(any( |
1713 |
| - target_arch = "mips", |
1714 |
| - target_arch = "mips64", |
1715 |
| - target_arch = "powerpc", |
1716 |
| - target_arch = "powerpc64" |
1717 |
| - ))] { |
1718 |
| - pub const FICLONE: c_int = 0x80049409; |
1719 |
| - pub const FICLONERANGE: c_int = 0x8020940D; |
1720 |
| - } |
1721 |
| -} |
1722 | 1697 |
|
1723 | 1698 | pub const ST_RDONLY: c_ulong = 1;
|
1724 | 1699 | pub const ST_NOSUID: c_ulong = 2;
|
@@ -1900,38 +1875,6 @@ pub const BLKIOOPT: c_int = 0x1279;
|
1900 | 1875 | pub const BLKSSZGET: c_int = 0x1268;
|
1901 | 1876 | pub const BLKPBSZGET: c_int = 0x127B;
|
1902 | 1877 |
|
1903 |
| -cfg_if! { |
1904 |
| - // Those type are constructed using the _IOC macro |
1905 |
| - // DD-SS_SSSS_SSSS_SSSS-TTTT_TTTT-NNNN_NNNN |
1906 |
| - // where D stands for direction (either None (00), Read (01) or Write (11)) |
1907 |
| - // where S stands for size (int, long, struct...) |
1908 |
| - // where T stands for type ('f','v','X'...) |
1909 |
| - // where N stands for NR (NumbeR) |
1910 |
| - if #[cfg(any(target_arch = "x86", target_arch = "arm"))] { |
1911 |
| - pub const FS_IOC_GETFLAGS: c_int = 0x80046601; |
1912 |
| - pub const FS_IOC_SETFLAGS: c_int = 0x40046602; |
1913 |
| - pub const FS_IOC_GETVERSION: c_int = 0x80047601; |
1914 |
| - pub const FS_IOC_SETVERSION: c_int = 0x40047602; |
1915 |
| - pub const FS_IOC32_GETFLAGS: c_int = 0x80046601; |
1916 |
| - pub const FS_IOC32_SETFLAGS: c_int = 0x40046602; |
1917 |
| - pub const FS_IOC32_GETVERSION: c_int = 0x80047601; |
1918 |
| - pub const FS_IOC32_SETVERSION: c_int = 0x40047602; |
1919 |
| - } else if #[cfg(any( |
1920 |
| - target_arch = "x86_64", |
1921 |
| - target_arch = "riscv64", |
1922 |
| - target_arch = "aarch64" |
1923 |
| - ))] { |
1924 |
| - pub const FS_IOC_GETFLAGS: c_int = 0x80086601; |
1925 |
| - pub const FS_IOC_SETFLAGS: c_int = 0x40086602; |
1926 |
| - pub const FS_IOC_GETVERSION: c_int = 0x80087601; |
1927 |
| - pub const FS_IOC_SETVERSION: c_int = 0x40087602; |
1928 |
| - pub const FS_IOC32_GETFLAGS: c_int = 0x80046601; |
1929 |
| - pub const FS_IOC32_SETFLAGS: c_int = 0x40046602; |
1930 |
| - pub const FS_IOC32_GETVERSION: c_int = 0x80047601; |
1931 |
| - pub const FS_IOC32_SETVERSION: c_int = 0x40047602; |
1932 |
| - } |
1933 |
| -} |
1934 |
| - |
1935 | 1878 | pub const EAI_AGAIN: c_int = 2;
|
1936 | 1879 | pub const EAI_BADFLAGS: c_int = 3;
|
1937 | 1880 | pub const EAI_FAIL: c_int = 4;
|
@@ -2666,65 +2609,6 @@ pub const SND_CNT: usize = SND_MAX as usize + 1;
|
2666 | 2609 | pub const UINPUT_VERSION: c_uint = 5;
|
2667 | 2610 | pub const UINPUT_MAX_NAME_SIZE: usize = 80;
|
2668 | 2611 |
|
2669 |
| -// bionic/libc/kernel/uapi/linux/if_tun.h |
2670 |
| -pub const IFF_TUN: c_int = 0x0001; |
2671 |
| -pub const IFF_TAP: c_int = 0x0002; |
2672 |
| -pub const IFF_NAPI: c_int = 0x0010; |
2673 |
| -pub const IFF_NAPI_FRAGS: c_int = 0x0020; |
2674 |
| -pub const IFF_NO_CARRIER: c_int = 0x0040; |
2675 |
| -pub const IFF_NO_PI: c_int = 0x1000; |
2676 |
| -pub const IFF_ONE_QUEUE: c_int = 0x2000; |
2677 |
| -pub const IFF_VNET_HDR: c_int = 0x4000; |
2678 |
| -pub const IFF_TUN_EXCL: c_int = 0x8000; |
2679 |
| -pub const IFF_MULTI_QUEUE: c_int = 0x0100; |
2680 |
| -pub const IFF_ATTACH_QUEUE: c_int = 0x0200; |
2681 |
| -pub const IFF_DETACH_QUEUE: c_int = 0x0400; |
2682 |
| -pub const IFF_PERSIST: c_int = 0x0800; |
2683 |
| -pub const IFF_NOFILTER: c_int = 0x1000; |
2684 |
| -pub const TUN_TX_TIMESTAMP: c_int = 1; |
2685 |
| -// Features for GSO (TUNSETOFFLOAD) |
2686 |
| -pub const TUN_F_CSUM: c_uint = 0x01; |
2687 |
| -pub const TUN_F_TSO4: c_uint = 0x02; |
2688 |
| -pub const TUN_F_TSO6: c_uint = 0x04; |
2689 |
| -pub const TUN_F_TSO_ECN: c_uint = 0x08; |
2690 |
| -pub const TUN_F_UFO: c_uint = 0x10; |
2691 |
| -pub const TUN_F_USO4: c_uint = 0x20; |
2692 |
| -pub const TUN_F_USO6: c_uint = 0x40; |
2693 |
| -// Protocol info prepended to the packets (when IFF_NO_PI is not set) |
2694 |
| -pub const TUN_PKT_STRIP: c_int = 0x0001; |
2695 |
| -// Accept all multicast packets |
2696 |
| -pub const TUN_FLT_ALLMULTI: c_int = 0x0001; |
2697 |
| -// Ioctl operation codes |
2698 |
| -const T_TYPE: u32 = b'T' as u32; |
2699 |
| -pub const TUNSETNOCSUM: c_int = _IOW::<c_int>(T_TYPE, 200); |
2700 |
| -pub const TUNSETDEBUG: c_int = _IOW::<c_int>(T_TYPE, 201); |
2701 |
| -pub const TUNSETIFF: c_int = _IOW::<c_int>(T_TYPE, 202); |
2702 |
| -pub const TUNSETPERSIST: c_int = _IOW::<c_int>(T_TYPE, 203); |
2703 |
| -pub const TUNSETOWNER: c_int = _IOW::<c_int>(T_TYPE, 204); |
2704 |
| -pub const TUNSETLINK: c_int = _IOW::<c_int>(T_TYPE, 205); |
2705 |
| -pub const TUNSETGROUP: c_int = _IOW::<c_int>(T_TYPE, 206); |
2706 |
| -pub const TUNGETFEATURES: c_int = _IOR::<c_int>(T_TYPE, 207); |
2707 |
| -pub const TUNSETOFFLOAD: c_int = _IOW::<c_int>(T_TYPE, 208); |
2708 |
| -pub const TUNSETTXFILTER: c_int = _IOW::<c_int>(T_TYPE, 209); |
2709 |
| -pub const TUNGETIFF: c_int = _IOR::<c_int>(T_TYPE, 210); |
2710 |
| -pub const TUNGETSNDBUF: c_int = _IOR::<c_int>(T_TYPE, 211); |
2711 |
| -pub const TUNSETSNDBUF: c_int = _IOW::<c_int>(T_TYPE, 212); |
2712 |
| -pub const TUNATTACHFILTER: c_int = _IOW::<sock_fprog>(T_TYPE, 213); |
2713 |
| -pub const TUNDETACHFILTER: c_int = _IOW::<sock_fprog>(T_TYPE, 214); |
2714 |
| -pub const TUNGETVNETHDRSZ: c_int = _IOR::<c_int>(T_TYPE, 215); |
2715 |
| -pub const TUNSETVNETHDRSZ: c_int = _IOW::<c_int>(T_TYPE, 216); |
2716 |
| -pub const TUNSETQUEUE: c_int = _IOW::<c_int>(T_TYPE, 217); |
2717 |
| -pub const TUNSETIFINDEX: c_int = _IOW::<c_int>(T_TYPE, 218); |
2718 |
| -pub const TUNGETFILTER: c_int = _IOR::<sock_fprog>(T_TYPE, 219); |
2719 |
| -pub const TUNSETVNETLE: c_int = _IOW::<c_int>(T_TYPE, 220); |
2720 |
| -pub const TUNGETVNETLE: c_int = _IOR::<c_int>(T_TYPE, 221); |
2721 |
| -pub const TUNSETVNETBE: c_int = _IOW::<c_int>(T_TYPE, 222); |
2722 |
| -pub const TUNGETVNETBE: c_int = _IOR::<c_int>(T_TYPE, 223); |
2723 |
| -pub const TUNSETSTEERINGEBPF: c_int = _IOR::<c_int>(T_TYPE, 224); |
2724 |
| -pub const TUNSETFILTEREBPF: c_int = _IOR::<c_int>(T_TYPE, 225); |
2725 |
| -pub const TUNSETCARRIER: c_int = _IOW::<c_int>(T_TYPE, 226); |
2726 |
| -pub const TUNGETDEVNETNS: c_int = _IO(T_TYPE, 227); |
2727 |
| - |
2728 | 2612 | // start android/platform/bionic/libc/kernel/uapi/linux/if_ether.h
|
2729 | 2613 | // from https://android.googlesource.com/platform/bionic/+/HEAD/libc/kernel/uapi/linux/if_ether.h
|
2730 | 2614 | pub const ETH_ALEN: c_int = 6;
|
@@ -3758,7 +3642,6 @@ extern "C" {
|
3758 | 3642 | pub fn gettimeofday(tp: *mut crate::timeval, tz: *mut crate::timezone) -> c_int;
|
3759 | 3643 | pub fn mlock2(addr: *const c_void, len: size_t, flags: c_int) -> c_int;
|
3760 | 3644 | pub fn madvise(addr: *mut c_void, len: size_t, advice: c_int) -> c_int;
|
3761 |
| - pub fn ioctl(fd: c_int, request: c_int, ...) -> c_int; |
3762 | 3645 | pub fn msync(addr: *mut c_void, len: size_t, flags: c_int) -> c_int;
|
3763 | 3646 | pub fn mprotect(addr: *mut c_void, len: size_t, prot: c_int) -> c_int;
|
3764 | 3647 | pub fn recvfrom(
|
@@ -4299,28 +4182,3 @@ impl siginfo_t {
|
4299 | 4182 | self.sifields().sigchld.si_stime
|
4300 | 4183 | }
|
4301 | 4184 | }
|
4302 |
| - |
4303 |
| -/// Build an ioctl number for an argumentless ioctl. |
4304 |
| -pub const fn _IO(ty: u32, nr: u32) -> c_int { |
4305 |
| - super::_IOC(super::_IOC_NONE, ty, nr, 0) as c_int |
4306 |
| -} |
4307 |
| - |
4308 |
| -/// Build an ioctl number for an read-only ioctl. |
4309 |
| -pub const fn _IOR<T>(ty: u32, nr: u32) -> c_int { |
4310 |
| - super::_IOC(super::_IOC_READ, ty, nr, mem::size_of::<T>()) as c_int |
4311 |
| -} |
4312 |
| - |
4313 |
| -/// Build an ioctl number for an write-only ioctl. |
4314 |
| -pub const fn _IOW<T>(ty: u32, nr: u32) -> c_int { |
4315 |
| - super::_IOC(super::_IOC_WRITE, ty, nr, mem::size_of::<T>()) as c_int |
4316 |
| -} |
4317 |
| - |
4318 |
| -/// Build an ioctl number for a read-write ioctl. |
4319 |
| -pub const fn _IOWR<T>(ty: u32, nr: u32) -> c_int { |
4320 |
| - super::_IOC( |
4321 |
| - super::_IOC_READ | super::_IOC_WRITE, |
4322 |
| - ty, |
4323 |
| - nr, |
4324 |
| - mem::size_of::<T>(), |
4325 |
| - ) as c_int |
4326 |
| -} |
0 commit comments