From 3a529d09548e880801aac84305fa1b47f1021355 Mon Sep 17 00:00:00 2001 From: Maarten de Vries Date: Sat, 6 Nov 2021 20:19:00 +0100 Subject: [PATCH] Move termios2 struct and ioctl constants to linux::arch. The ioctls are interpreted directly by the kernel, so the system libc has no influence on the termios2 struct or the ioctl numbers. --- src/unix/linux_like/linux/arch/generic/mod.rs | 18 ++++++++++++++++++ src/unix/linux_like/linux/arch/mips/mod.rs | 18 ++++++++++++++++++ src/unix/linux_like/linux/arch/sparc/mod.rs | 18 ++++++++++++++++++ src/unix/linux_like/linux/gnu/b32/arm/mod.rs | 15 --------------- src/unix/linux_like/linux/gnu/b32/mips/mod.rs | 15 --------------- .../linux_like/linux/gnu/b32/riscv32/mod.rs | 4 ---- src/unix/linux_like/linux/gnu/b32/sparc/mod.rs | 15 --------------- src/unix/linux_like/linux/gnu/b32/x86/mod.rs | 15 --------------- .../linux_like/linux/gnu/b64/aarch64/mod.rs | 15 --------------- .../linux_like/linux/gnu/b64/mips64/mod.rs | 15 --------------- .../linux_like/linux/gnu/b64/riscv64/mod.rs | 4 ---- src/unix/linux_like/linux/gnu/b64/s390x.rs | 11 ----------- .../linux_like/linux/gnu/b64/sparc64/mod.rs | 15 --------------- .../linux_like/linux/gnu/b64/x86_64/mod.rs | 15 --------------- src/unix/linux_like/linux/musl/b32/hexagon.rs | 11 ----------- 15 files changed, 54 insertions(+), 150 deletions(-) diff --git a/src/unix/linux_like/linux/arch/generic/mod.rs b/src/unix/linux_like/linux/arch/generic/mod.rs index e3401d4b7222a..e5c636d64ae5c 100644 --- a/src/unix/linux_like/linux/arch/generic/mod.rs +++ b/src/unix/linux_like/linux/arch/generic/mod.rs @@ -1,3 +1,16 @@ +s! { + pub struct termios2 { + pub c_iflag: ::tcflag_t, + pub c_oflag: ::tcflag_t, + pub c_cflag: ::tcflag_t, + pub c_lflag: ::tcflag_t, + pub c_line: ::cc_t, + pub c_cc: [::cc_t; 19], + pub c_ispeed: ::speed_t, + pub c_ospeed: ::speed_t, + } +} + // include/uapi/asm-generic/socket.h // arch/alpha/include/uapi/asm/socket.h // tools/include/uapi/asm-generic/socket.h @@ -98,3 +111,8 @@ cfg_if! { // pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP; pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS; pub const SCM_TIMESTAMPING: ::c_int = SO_TIMESTAMPING; + +pub const TCGETS2: ::c_ulong = 0x802c542a; +pub const TCSETS2: ::c_ulong = 0x402c542b; +pub const TCSETSW2: ::c_ulong = 0x402c542c; +pub const TCSETSF2: ::c_ulong = 0x402c542d; diff --git a/src/unix/linux_like/linux/arch/mips/mod.rs b/src/unix/linux_like/linux/arch/mips/mod.rs index cdbdca2bbf99c..34d70226725d7 100644 --- a/src/unix/linux_like/linux/arch/mips/mod.rs +++ b/src/unix/linux_like/linux/arch/mips/mod.rs @@ -1,3 +1,16 @@ +s! { + pub struct termios2 { + pub c_iflag: ::tcflag_t, + pub c_oflag: ::tcflag_t, + pub c_cflag: ::tcflag_t, + pub c_lflag: ::tcflag_t, + pub c_line: ::cc_t, + pub c_cc: [::cc_t; 23], + pub c_ispeed: ::speed_t, + pub c_ospeed: ::speed_t, + } +} + // arch/mips/include/uapi/asm/socket.h pub const SOL_SOCKET: ::c_int = 0xffff; @@ -94,3 +107,8 @@ pub const SO_TIMESTAMPING: ::c_int = 37; // pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP; pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS; pub const SCM_TIMESTAMPING: ::c_int = SO_TIMESTAMPING; + +pub const TCGETS2: ::c_ulong = 0x4030542a; +pub const TCSETS2: ::c_ulong = 0x8030542b; +pub const TCSETSW2: ::c_ulong = 0x8030542c; +pub const TCSETSF2: ::c_ulong = 0x8030542d; diff --git a/src/unix/linux_like/linux/arch/sparc/mod.rs b/src/unix/linux_like/linux/arch/sparc/mod.rs index d4f9bb0ebce66..2c8fdd067f39c 100644 --- a/src/unix/linux_like/linux/arch/sparc/mod.rs +++ b/src/unix/linux_like/linux/arch/sparc/mod.rs @@ -1,3 +1,16 @@ +s! { + pub struct termios2 { + pub c_iflag: ::tcflag_t, + pub c_oflag: ::tcflag_t, + pub c_cflag: ::tcflag_t, + pub c_lflag: ::tcflag_t, + pub c_line: ::cc_t, + pub c_cc: [::cc_t; 19], + pub c_ispeed: ::speed_t, + pub c_ospeed: ::speed_t, + } +} + // arch/sparc/include/uapi/asm/socket.h pub const SOL_SOCKET: ::c_int = 0xffff; @@ -86,3 +99,8 @@ pub const SO_TIMESTAMPING: ::c_int = 0x0023; // pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP; pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS; pub const SCM_TIMESTAMPING: ::c_int = SO_TIMESTAMPING; + +pub const TCGETS2: ::c_ulong = 0x402c540c; +pub const TCSETS2: ::c_ulong = 0x802c540d; +pub const TCSETSW2: ::c_ulong = 0x802c540e; +pub const TCSETSF2: ::c_ulong = 0x802c540f; diff --git a/src/unix/linux_like/linux/gnu/b32/arm/mod.rs b/src/unix/linux_like/linux/gnu/b32/arm/mod.rs index a1eaa2b6a630f..f18df46e4aaf4 100644 --- a/src/unix/linux_like/linux/gnu/b32/arm/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/arm/mod.rs @@ -141,17 +141,6 @@ s! { __glibc_reserved5: ::c_ulong, } - pub struct termios2 { - pub c_iflag: ::tcflag_t, - pub c_oflag: ::tcflag_t, - pub c_cflag: ::tcflag_t, - pub c_lflag: ::tcflag_t, - pub c_line: ::cc_t, - pub c_cc: [::cc_t; 19], - pub c_ispeed: ::speed_t, - pub c_ospeed: ::speed_t, - } - pub struct siginfo_t { pub si_signo: ::c_int, pub si_errno: ::c_int, @@ -447,10 +436,6 @@ pub const TCGETS: ::c_ulong = 0x5401; pub const TCSETS: ::c_ulong = 0x5402; pub const TCSETSW: ::c_ulong = 0x5403; pub const TCSETSF: ::c_ulong = 0x5404; -pub const TCGETS2: ::c_ulong = 0x802c542a; -pub const TCSETS2: ::c_ulong = 0x402c542b; -pub const TCSETSW2: ::c_ulong = 0x402c542c; -pub const TCSETSF2: ::c_ulong = 0x402c542d; pub const TCGETA: ::c_ulong = 0x5405; pub const TCSETA: ::c_ulong = 0x5406; pub const TCSETAW: ::c_ulong = 0x5407; diff --git a/src/unix/linux_like/linux/gnu/b32/mips/mod.rs b/src/unix/linux_like/linux/gnu/b32/mips/mod.rs index 3208d82ddc49d..0a72eba4ab28d 100644 --- a/src/unix/linux_like/linux/gnu/b32/mips/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/mips/mod.rs @@ -153,17 +153,6 @@ s! { pub l_pid: ::pid_t, pad: [::c_long; 4], } - - pub struct termios2 { - pub c_iflag: ::tcflag_t, - pub c_oflag: ::tcflag_t, - pub c_cflag: ::tcflag_t, - pub c_lflag: ::tcflag_t, - pub c_line: ::cc_t, - pub c_cc: [::cc_t; 23], - pub c_ispeed: ::speed_t, - pub c_ospeed: ::speed_t, - } } pub const O_LARGEFILE: ::c_int = 0x2000; @@ -730,10 +719,6 @@ pub const TCGETS: ::c_ulong = 0x540d; pub const TCSETS: ::c_ulong = 0x540e; pub const TCSETSW: ::c_ulong = 0x540f; pub const TCSETSF: ::c_ulong = 0x5410; -pub const TCGETS2: ::c_ulong = 0x4030542a; -pub const TCSETS2: ::c_ulong = 0x8030542b; -pub const TCSETSW2: ::c_ulong = 0x8030542c; -pub const TCSETSF2: ::c_ulong = 0x8030542d; pub const TCGETA: ::c_ulong = 0x5401; pub const TCSETA: ::c_ulong = 0x5402; pub const TCSETAW: ::c_ulong = 0x5403; diff --git a/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs b/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs index 73b317fc868d6..09061f3837a13 100644 --- a/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs @@ -483,10 +483,6 @@ pub const TCGETS: ::c_ulong = 21505; pub const TCSETS: ::c_ulong = 21506; pub const TCSETSW: ::c_ulong = 21507; pub const TCSETSF: ::c_ulong = 21508; -pub const TCGETS2: ::c_ulong = 0x802c542a; -pub const TCSETS2: ::c_ulong = 0x402c542b; -pub const TCSETSW2: ::c_ulong = 0x402c542c; -pub const TCSETSF2: ::c_ulong = 0x402c542d; pub const TCGETA: ::c_ulong = 21509; pub const TCSETA: ::c_ulong = 21510; pub const TCSETAW: ::c_ulong = 21511; diff --git a/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs b/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs index 15074b45e8f05..b5a74314be8e1 100644 --- a/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs @@ -191,17 +191,6 @@ s! { __glibc_reserved1: ::c_ulong, __glibc_reserved2: ::c_ulong, } - - pub struct termios2 { - pub c_iflag: ::tcflag_t, - pub c_oflag: ::tcflag_t, - pub c_cflag: ::tcflag_t, - pub c_lflag: ::tcflag_t, - pub c_line: ::cc_t, - pub c_cc: [::cc_t; 19], - pub c_ispeed: ::speed_t, - pub c_ospeed: ::speed_t, - } } pub const RLIM_INFINITY: ::rlim_t = !0; @@ -508,10 +497,6 @@ pub const TCGETS: ::c_ulong = 0x40245408; pub const TCSETS: ::c_ulong = 0x80245409; pub const TCSETSW: ::c_ulong = 0x8024540a; pub const TCSETSF: ::c_ulong = 0x8024540b; -pub const TCGETS2: ::c_ulong = 0x402c540c; -pub const TCSETS2: ::c_ulong = 0x802c540d; -pub const TCSETSW2: ::c_ulong = 0x802c540e; -pub const TCSETSF2: ::c_ulong = 0x802c540f; pub const TCGETA: ::c_ulong = 0x40125401; pub const TCSETA: ::c_ulong = 0x80125402; pub const TCSETAW: ::c_ulong = 0x80125403; diff --git a/src/unix/linux_like/linux/gnu/b32/x86/mod.rs b/src/unix/linux_like/linux/gnu/b32/x86/mod.rs index cf8378544168c..a4b75f470c46c 100644 --- a/src/unix/linux_like/linux/gnu/b32/x86/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/x86/mod.rs @@ -215,17 +215,6 @@ s! { __glibc_reserved5: ::c_ulong, } - pub struct termios2 { - pub c_iflag: ::tcflag_t, - pub c_oflag: ::tcflag_t, - pub c_cflag: ::tcflag_t, - pub c_lflag: ::tcflag_t, - pub c_line: ::cc_t, - pub c_cc: [::cc_t; 19], - pub c_ispeed: ::speed_t, - pub c_ospeed: ::speed_t, - } - pub struct siginfo_t { pub si_signo: ::c_int, pub si_errno: ::c_int, @@ -666,10 +655,6 @@ pub const TCGETS: ::c_ulong = 0x5401; pub const TCSETS: ::c_ulong = 0x5402; pub const TCSETSW: ::c_ulong = 0x5403; pub const TCSETSF: ::c_ulong = 0x5404; -pub const TCGETS2: ::c_ulong = 0x802c542a; -pub const TCSETS2: ::c_ulong = 0x402c542b; -pub const TCSETSW2: ::c_ulong = 0x402c542c; -pub const TCSETSF2: ::c_ulong = 0x402c542d; pub const TCGETA: ::c_ulong = 0x5405; pub const TCSETA: ::c_ulong = 0x5406; pub const TCSETAW: ::c_ulong = 0x5407; diff --git a/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs b/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs index dfb254e6946cf..5a1ec7a1e69bf 100644 --- a/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs @@ -168,17 +168,6 @@ s! { __unused5: ::c_ulong } - pub struct termios2 { - pub c_iflag: ::tcflag_t, - pub c_oflag: ::tcflag_t, - pub c_cflag: ::tcflag_t, - pub c_lflag: ::tcflag_t, - pub c_line: ::cc_t, - pub c_cc: [::cc_t; 19], - pub c_ispeed: ::speed_t, - pub c_ospeed: ::speed_t, - } - pub struct siginfo_t { pub si_signo: ::c_int, pub si_errno: ::c_int, @@ -560,10 +549,6 @@ pub const TCGETS: ::c_ulong = 0x5401; pub const TCSETS: ::c_ulong = 0x5402; pub const TCSETSW: ::c_ulong = 0x5403; pub const TCSETSF: ::c_ulong = 0x5404; -pub const TCGETS2: ::c_ulong = 0x802c542a; -pub const TCSETS2: ::c_ulong = 0x402c542b; -pub const TCSETSW2: ::c_ulong = 0x402c542c; -pub const TCSETSF2: ::c_ulong = 0x402c542d; pub const TCGETA: ::c_ulong = 0x5405; pub const TCSETA: ::c_ulong = 0x5406; pub const TCSETAW: ::c_ulong = 0x5407; diff --git a/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs b/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs index cbd4cae8a505f..31eaf5a87ba2d 100644 --- a/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs @@ -183,17 +183,6 @@ s! { __unused4: ::c_ulong, __unused5: ::c_ulong } - - pub struct termios2 { - pub c_iflag: ::tcflag_t, - pub c_oflag: ::tcflag_t, - pub c_cflag: ::tcflag_t, - pub c_lflag: ::tcflag_t, - pub c_line: ::cc_t, - pub c_cc: [::cc_t; 23], - pub c_ispeed: ::speed_t, - pub c_ospeed: ::speed_t, - } } pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; @@ -830,10 +819,6 @@ pub const TCGETS: ::c_ulong = 0x540d; pub const TCSETS: ::c_ulong = 0x540e; pub const TCSETSW: ::c_ulong = 0x540f; pub const TCSETSF: ::c_ulong = 0x5410; -pub const TCGETS2: ::c_ulong = 0x4030542a; -pub const TCSETS2: ::c_ulong = 0x8030542b; -pub const TCSETSW2: ::c_ulong = 0x8030542c; -pub const TCSETSF2: ::c_ulong = 0x8030542d; pub const TCGETA: ::c_ulong = 0x5401; pub const TCSETA: ::c_ulong = 0x5402; pub const TCSETAW: ::c_ulong = 0x5403; diff --git a/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs b/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs index 9986dcb6ae368..982277d818da4 100644 --- a/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs @@ -521,10 +521,6 @@ pub const TCGETS: ::c_ulong = 21505; pub const TCSETS: ::c_ulong = 21506; pub const TCSETSW: ::c_ulong = 21507; pub const TCSETSF: ::c_ulong = 21508; -pub const TCGETS2: ::c_ulong = 0x802c542a; -pub const TCSETS2: ::c_ulong = 0x402c542b; -pub const TCSETSW2: ::c_ulong = 0x402c542c; -pub const TCSETSF2: ::c_ulong = 0x402c542d; pub const TCGETA: ::c_ulong = 21509; pub const TCSETA: ::c_ulong = 21510; pub const TCSETAW: ::c_ulong = 21511; diff --git a/src/unix/linux_like/linux/gnu/b64/s390x.rs b/src/unix/linux_like/linux/gnu/b64/s390x.rs index 833997a6d0f62..b6bf1199d9387 100644 --- a/src/unix/linux_like/linux/gnu/b64/s390x.rs +++ b/src/unix/linux_like/linux/gnu/b64/s390x.rs @@ -153,17 +153,6 @@ s! { __f_spare: [::c_int; 6], } - pub struct termios2 { - pub c_iflag: ::tcflag_t, - pub c_oflag: ::tcflag_t, - pub c_cflag: ::tcflag_t, - pub c_lflag: ::tcflag_t, - pub c_line: ::cc_t, - pub c_cc: [::cc_t; 19], - pub c_ispeed: ::speed_t, - pub c_ospeed: ::speed_t, - } - pub struct __psw_t { pub mask: u64, pub addr: u64, diff --git a/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs b/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs index 302dba5a00f04..9508190b21de9 100644 --- a/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs @@ -193,17 +193,6 @@ s! { __reserved1: ::c_ulong, __reserved2: ::c_ulong } - - pub struct termios2 { - pub c_iflag: ::tcflag_t, - pub c_oflag: ::tcflag_t, - pub c_cflag: ::tcflag_t, - pub c_lflag: ::tcflag_t, - pub c_line: ::cc_t, - pub c_cc: [::cc_t; 19], - pub c_ispeed: ::speed_t, - pub c_ospeed: ::speed_t, - } } pub const POSIX_FADV_DONTNEED: ::c_int = 4; @@ -587,10 +576,6 @@ pub const TCGETS: ::c_ulong = 0x40245408; pub const TCSETS: ::c_ulong = 0x80245409; pub const TCSETSW: ::c_ulong = 0x8024540a; pub const TCSETSF: ::c_ulong = 0x8024540b; -pub const TCGETS2: ::c_ulong = 0x402c540c; -pub const TCSETS2: ::c_ulong = 0x802c540d; -pub const TCSETSW2: ::c_ulong = 0x802c540e; -pub const TCSETSF2: ::c_ulong = 0x802c540f; pub const TCGETA: ::c_ulong = 0x40125401; pub const TCSETA: ::c_ulong = 0x80125402; pub const TCSETAW: ::c_ulong = 0x80125403; diff --git a/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs b/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs index 0f113500a770f..c7445f8d77e00 100644 --- a/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs @@ -259,17 +259,6 @@ s! { __unused5: u64 } - pub struct termios2 { - pub c_iflag: ::tcflag_t, - pub c_oflag: ::tcflag_t, - pub c_cflag: ::tcflag_t, - pub c_lflag: ::tcflag_t, - pub c_line: ::cc_t, - pub c_cc: [::cc_t; 19], - pub c_ispeed: ::speed_t, - pub c_ospeed: ::speed_t, - } - pub struct ip_mreqn { pub imr_multiaddr: ::in_addr, pub imr_address: ::in_addr, @@ -772,10 +761,6 @@ pub const TCGETS: ::c_ulong = 0x5401; pub const TCSETS: ::c_ulong = 0x5402; pub const TCSETSW: ::c_ulong = 0x5403; pub const TCSETSF: ::c_ulong = 0x5404; -pub const TCGETS2: ::c_ulong = 0x802c542a; -pub const TCSETS2: ::c_ulong = 0x402c542b; -pub const TCSETSW2: ::c_ulong = 0x402c542c; -pub const TCSETSF2: ::c_ulong = 0x402c542d; pub const TCGETA: ::c_ulong = 0x5405; pub const TCSETA: ::c_ulong = 0x5406; pub const TCSETAW: ::c_ulong = 0x5407; diff --git a/src/unix/linux_like/linux/musl/b32/hexagon.rs b/src/unix/linux_like/linux/musl/b32/hexagon.rs index a94ebb6afc6e3..d8f51c7418f24 100644 --- a/src/unix/linux_like/linux/musl/b32/hexagon.rs +++ b/src/unix/linux_like/linux/musl/b32/hexagon.rs @@ -129,17 +129,6 @@ s! { pub f_namemax: ::c_ulong, __f_spare: [::c_int; 6], } - - pub struct termios2 { - pub c_iflag: ::tcflag_t, - pub c_oflag: ::tcflag_t, - pub c_cflag: ::tcflag_t, - pub c_lflag: ::tcflag_t, - pub c_line: ::cc_t, - pub c_cc: [::cc_t; 19], - pub c_ispeed: ::speed_t, - pub c_ospeed: ::speed_t, - } } pub const AF_FILE: ::c_int = 1;