Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move more ioctl constants and flags to linux::arch::* modules. #2530

Merged
merged 3 commits into from Nov 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion libc-test/build.rs
Expand Up @@ -1663,6 +1663,7 @@ fn test_android(target: &str) {

// FIXME: conflicts with standard C headers and is tested in
// `linux_termios.rs` below:
"IBSHIFT" => true,
"TCGETS2" | "TCSETS2" | "TCSETSW2" | "TCSETSF2" => true,

_ => false,
Expand Down Expand Up @@ -2915,6 +2916,7 @@ fn test_linux(target: &str) {
// FIXME: conflicts with glibc headers and is tested in
// `linux_termios.rs` below:
| "BOTHER"
| "IBSHIFT"
| "TCGETS2"
| "TCSETS2"
| "TCSETSW2"
Expand Down Expand Up @@ -3274,7 +3276,7 @@ fn test_linux_like_apis(target: &str) {
.skip_static(|_| true)
.skip_fn(|_| true)
.skip_const(|c| match c {
"BOTHER" => false,
"BOTHER" | "IBSHIFT" => false,
"TCGETS2" | "TCSETS2" | "TCSETSW2" | "TCSETSF2" => false,
_ => true,
})
Expand Down
1 change: 0 additions & 1 deletion libc-test/semver/TODO-linux.txt
@@ -1,6 +1,5 @@
# The following symbols are not not available in some combinations of
# musl/gnu/android and/or architecture.
BOTHER
KEYCTL_CAPABILITIES
KEYCTL_CAPS0_BIG_KEY
KEYCTL_CAPS0_CAPABILITIES
Expand Down
1 change: 1 addition & 0 deletions libc-test/semver/android.txt
Expand Up @@ -665,6 +665,7 @@ GRPQUOTA
HPFS_SUPER_MAGIC
HUGETLBFS_MAGIC
HUPCL
IBSHIFT
ICANON
ICRNL
IEXTEN
Expand Down
1 change: 0 additions & 1 deletion libc-test/semver/linux-gnu-x86_64.txt
@@ -1,4 +1,3 @@
BOTHER
KEYCTL_CAPABILITIES
KEYCTL_CAPS0_BIG_KEY
KEYCTL_CAPS0_CAPABILITIES
Expand Down
1 change: 0 additions & 1 deletion libc-test/semver/linux-i686.txt
Expand Up @@ -2,7 +2,6 @@ B2500000
B3000000
B3500000
B4000000
BOTHER
CIBAUD
CS
DS
Expand Down
1 change: 0 additions & 1 deletion libc-test/semver/linux-powerpc.txt
Expand Up @@ -2,7 +2,6 @@ B2500000
B3000000
B3500000
B4000000
BOTHER
KEYCTL_CAPABILITIES
KEYCTL_CAPS0_BIG_KEY
KEYCTL_CAPS0_CAPABILITIES
Expand Down
1 change: 0 additions & 1 deletion libc-test/semver/linux-powerpc64.txt
Expand Up @@ -2,7 +2,6 @@ B2500000
B3000000
B3500000
B4000000
BOTHER
KEYCTL_CAPABILITIES
KEYCTL_CAPS0_BIG_KEY
KEYCTL_CAPS0_CAPABILITIES
Expand Down
1 change: 0 additions & 1 deletion libc-test/semver/linux-powerpc64le.txt
Expand Up @@ -2,7 +2,6 @@ B2500000
B3000000
B3500000
B4000000
BOTHER
KEYCTL_CAPABILITIES
KEYCTL_CAPS0_BIG_KEY
KEYCTL_CAPS0_CAPABILITIES
Expand Down
1 change: 0 additions & 1 deletion libc-test/semver/linux-s390x.txt
Expand Up @@ -2,7 +2,6 @@ B2500000
B3000000
B3500000
B4000000
BOTHER
CIBAUD
KEYCTL_CAPABILITIES
KEYCTL_CAPS0_BIG_KEY
Expand Down
1 change: 0 additions & 1 deletion libc-test/semver/linux-sparc64.txt
Expand Up @@ -2,7 +2,6 @@ B153600
B307200
B614400
B76800
BOTHER
CIBAUD
KEYCTL_CAPABILITIES
KEYCTL_CAPS0_BIG_KEY
Expand Down
2 changes: 2 additions & 0 deletions libc-test/semver/linux.txt
Expand Up @@ -189,6 +189,7 @@ B460800
B500000
B576000
B921600
BOTHER
BS0
BS1
BSDLY
Expand Down Expand Up @@ -644,6 +645,7 @@ GLOB_NOSORT
GLOB_NOSPACE
GRND_NONBLOCK
GRND_RANDOM
IBSHIFT
IFA_ADDRESS
IFA_ANYCAST
IFA_BROADCAST
Expand Down
1 change: 1 addition & 0 deletions src/unix/linux_like/android/mod.rs
Expand Up @@ -1538,6 +1538,7 @@ pub const B2500000: ::speed_t = 0o010014;
pub const B3000000: ::speed_t = 0o010015;
pub const B3500000: ::speed_t = 0o010016;
pub const B4000000: ::speed_t = 0o010017;
pub const IBSHIFT: ::tcflag_t = 16;

pub const EAI_AGAIN: ::c_int = 2;
pub const EAI_BADFLAGS: ::c_int = 3;
Expand Down
19 changes: 19 additions & 0 deletions src/unix/linux_like/linux/arch/generic/mod.rs
Expand Up @@ -112,7 +112,26 @@ cfg_if! {
pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS;
pub const SCM_TIMESTAMPING: ::c_int = SO_TIMESTAMPING;

pub const TIOCMGET: ::c_ulong = 0x5415;
pub const TIOCMBIS: ::c_ulong = 0x5416;
pub const TIOCMBIC: ::c_ulong = 0x5417;
pub const TIOCMSET: ::c_ulong = 0x5418;
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 TIOCM_LE: ::c_int = 0x001;
pub const TIOCM_DTR: ::c_int = 0x002;
pub const TIOCM_RTS: ::c_int = 0x004;
pub const TIOCM_ST: ::c_int = 0x008;
pub const TIOCM_SR: ::c_int = 0x010;
pub const TIOCM_CTS: ::c_int = 0x020;
pub const TIOCM_CAR: ::c_int = 0x040;
pub const TIOCM_CD: ::c_int = TIOCM_CAR;
pub const TIOCM_RNG: ::c_int = 0x080;
pub const TIOCM_RI: ::c_int = TIOCM_RNG;
pub const TIOCM_DSR: ::c_int = 0x100;

pub const BOTHER: ::speed_t = 0o010000;
pub const IBSHIFT: ::tcflag_t = 16;
19 changes: 19 additions & 0 deletions src/unix/linux_like/linux/arch/mips/mod.rs
Expand Up @@ -108,7 +108,26 @@ pub const SO_TIMESTAMPING: ::c_int = 37;
pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS;
pub const SCM_TIMESTAMPING: ::c_int = SO_TIMESTAMPING;

pub const TIOCMGET: ::c_ulong = 0x741d;
pub const TIOCMBIS: ::c_ulong = 0x741b;
pub const TIOCMBIC: ::c_ulong = 0x741c;
pub const TIOCMSET: ::c_ulong = 0x741a;
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 TIOCM_LE: ::c_int = 0x001;
pub const TIOCM_DTR: ::c_int = 0x002;
pub const TIOCM_RTS: ::c_int = 0x004;
pub const TIOCM_ST: ::c_int = 0x010;
pub const TIOCM_SR: ::c_int = 0x020;
pub const TIOCM_CTS: ::c_int = 0x040;
pub const TIOCM_CAR: ::c_int = 0x100;
pub const TIOCM_CD: ::c_int = TIOCM_CAR;
pub const TIOCM_RNG: ::c_int = 0x200;
pub const TIOCM_RI: ::c_int = TIOCM_RNG;
pub const TIOCM_DSR: ::c_int = 0x400;

pub const BOTHER: ::speed_t = 0o010000;
pub const IBSHIFT: ::tcflag_t = 16;
20 changes: 20 additions & 0 deletions src/unix/linux_like/linux/arch/powerpc/mod.rs
Expand Up @@ -89,3 +89,23 @@ pub const SO_BINDTOIFINDEX: ::c_int = 62;
// 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 TIOCMGET: ::c_int = 0x5415;
pub const TIOCMBIS: ::c_int = 0x5416;
pub const TIOCMBIC: ::c_int = 0x5417;
pub const TIOCMSET: ::c_int = 0x5418;

pub const TIOCM_LE: ::c_int = 0x001;
pub const TIOCM_DTR: ::c_int = 0x002;
pub const TIOCM_RTS: ::c_int = 0x004;
pub const TIOCM_ST: ::c_int = 0x008;
pub const TIOCM_SR: ::c_int = 0x010;
pub const TIOCM_CTS: ::c_int = 0x020;
pub const TIOCM_CAR: ::c_int = 0x040;
pub const TIOCM_CD: ::c_int = TIOCM_CAR;
pub const TIOCM_RNG: ::c_int = 0x080;
pub const TIOCM_RI: ::c_int = TIOCM_RNG;
pub const TIOCM_DSR: ::c_int = 0x100;

pub const BOTHER: ::speed_t = 0o0037;
pub const IBSHIFT: ::tcflag_t = 16;
19 changes: 19 additions & 0 deletions src/unix/linux_like/linux/arch/sparc/mod.rs
Expand Up @@ -100,7 +100,26 @@ pub const SO_TIMESTAMPING: ::c_int = 0x0023;
pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS;
pub const SCM_TIMESTAMPING: ::c_int = SO_TIMESTAMPING;

pub const TIOCMGET: ::c_ulong = 0x4004746a;
pub const TIOCMBIS: ::c_ulong = 0x8004746c;
pub const TIOCMBIC: ::c_ulong = 0x8004746b;
pub const TIOCMSET: ::c_ulong = 0x8004746d;
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 TIOCM_LE: ::c_int = 0x001;
pub const TIOCM_DTR: ::c_int = 0x002;
pub const TIOCM_RTS: ::c_int = 0x004;
pub const TIOCM_ST: ::c_int = 0x008;
pub const TIOCM_SR: ::c_int = 0x010;
pub const TIOCM_CTS: ::c_int = 0x020;
pub const TIOCM_CAR: ::c_int = 0x040;
pub const TIOCM_CD: ::c_int = TIOCM_CAR;
pub const TIOCM_RNG: ::c_int = 0x080;
pub const TIOCM_RI: ::c_int = TIOCM_RNG;
pub const TIOCM_DSR: ::c_int = 0x100;

pub const BOTHER: ::speed_t = 0x1000;
pub const IBSHIFT: ::tcflag_t = 16;
11 changes: 0 additions & 11 deletions src/unix/linux_like/linux/gnu/b32/arm/mod.rs
Expand Up @@ -408,7 +408,6 @@ pub const B19200: ::speed_t = 0o000016;
pub const B38400: ::speed_t = 0o000017;
pub const EXTA: ::speed_t = B19200;
pub const EXTB: ::speed_t = B38400;
pub const BOTHER: ::speed_t = 0o010000;
pub const B57600: ::speed_t = 0o010001;
pub const B115200: ::speed_t = 0o010002;
pub const B230400: ::speed_t = 0o010003;
Expand Down Expand Up @@ -459,10 +458,6 @@ pub const TIOCEXCL: ::c_ulong = 0x540C;
pub const TIOCNXCL: ::c_ulong = 0x540D;
pub const TIOCSCTTY: ::c_ulong = 0x540E;
pub const TIOCSTI: ::c_ulong = 0x5412;
pub const TIOCMGET: ::c_ulong = 0x5415;
pub const TIOCMBIS: ::c_ulong = 0x5416;
pub const TIOCMBIC: ::c_ulong = 0x5417;
pub const TIOCMSET: ::c_ulong = 0x5418;
pub const TIOCCONS: ::c_ulong = 0x541D;

pub const TCSANOW: ::c_int = 0;
Expand All @@ -471,12 +466,6 @@ pub const TCSAFLUSH: ::c_int = 2;

pub const TIOCLINUX: ::c_ulong = 0x541C;
pub const TIOCGSERIAL: ::c_ulong = 0x541E;
pub const TIOCM_ST: ::c_int = 0x008;
pub const TIOCM_SR: ::c_int = 0x010;
pub const TIOCM_CTS: ::c_int = 0x020;
pub const TIOCM_CAR: ::c_int = 0x040;
pub const TIOCM_RNG: ::c_int = 0x080;
pub const TIOCM_DSR: ::c_int = 0x100;

// Syscall table
pub const SYS_restart_syscall: ::c_long = 0;
Expand Down
12 changes: 0 additions & 12 deletions src/unix/linux_like/linux/gnu/b32/mips/mod.rs
Expand Up @@ -740,10 +740,6 @@ pub const TIOCOUTQ: ::c_ulong = 0x7472;
pub const TIOCSTI: ::c_ulong = 0x5472;
pub const TIOCGWINSZ: ::c_ulong = 0x40087468;
pub const TIOCSWINSZ: ::c_ulong = 0x80087467;
pub const TIOCMGET: ::c_ulong = 0x741d;
pub const TIOCMBIS: ::c_ulong = 0x741b;
pub const TIOCMBIC: ::c_ulong = 0x741c;
pub const TIOCMSET: ::c_ulong = 0x741a;
pub const FIONREAD: ::c_ulong = 0x467f;
pub const TIOCCONS: ::c_ulong = 0x80047478;

Expand Down Expand Up @@ -826,7 +822,6 @@ pub const B19200: ::speed_t = 0o000016;
pub const B38400: ::speed_t = 0o000017;
pub const EXTA: ::speed_t = B19200;
pub const EXTB: ::speed_t = B38400;
pub const BOTHER: ::speed_t = 0o010000;
pub const B57600: ::speed_t = 0o010001;
pub const B115200: ::speed_t = 0o010002;
pub const B230400: ::speed_t = 0o010003;
Expand All @@ -843,13 +838,6 @@ pub const B3000000: ::speed_t = 0o010015;
pub const B3500000: ::speed_t = 0o010016;
pub const B4000000: ::speed_t = 0o010017;

pub const TIOCM_ST: ::c_int = 0x010;
pub const TIOCM_SR: ::c_int = 0x020;
pub const TIOCM_CTS: ::c_int = 0x040;
pub const TIOCM_CAR: ::c_int = 0x100;
pub const TIOCM_RNG: ::c_int = 0x200;
pub const TIOCM_DSR: ::c_int = 0x400;

pub const EHWPOISON: ::c_int = 168;

cfg_if! {
Expand Down
11 changes: 0 additions & 11 deletions src/unix/linux_like/linux/gnu/b32/powerpc.rs
Expand Up @@ -194,12 +194,6 @@ pub const TCSAFLUSH: ::c_int = 2;

pub const TIOCLINUX: ::c_ulong = 0x541C;
pub const TIOCGSERIAL: ::c_ulong = 0x541E;
pub const TIOCM_ST: ::c_int = 0x008;
pub const TIOCM_SR: ::c_int = 0x010;
pub const TIOCM_CTS: ::c_int = 0x020;
pub const TIOCM_CAR: ::c_int = 0x040;
pub const TIOCM_RNG: ::c_int = 0x080;
pub const TIOCM_DSR: ::c_int = 0x100;

pub const MADV_SOFT_OFFLINE: ::c_int = 101;
pub const MAP_LOCKED: ::c_int = 0x00080;
Expand Down Expand Up @@ -329,10 +323,6 @@ pub const TIOCEXCL: ::c_ulong = 0x540C;
pub const TIOCNXCL: ::c_ulong = 0x540D;
pub const TIOCSCTTY: ::c_ulong = 0x540E;
pub const TIOCSTI: ::c_ulong = 0x5412;
pub const TIOCMGET: ::c_ulong = 0x5415;
pub const TIOCMBIS: ::c_ulong = 0x5416;
pub const TIOCMBIC: ::c_ulong = 0x5417;
pub const TIOCMSET: ::c_ulong = 0x5418;
pub const TIOCCONS: ::c_ulong = 0x541D;

pub const SIGCHLD: ::c_int = 17;
Expand Down Expand Up @@ -446,7 +436,6 @@ pub const B2500000: ::speed_t = 0o0033;
pub const B3000000: ::speed_t = 0o0034;
pub const B3500000: ::speed_t = 0o0035;
pub const B4000000: ::speed_t = 0o0036;
pub const BOTHER: ::speed_t = 0o0037;

pub const VEOL: usize = 6;
pub const VEOL2: usize = 8;
Expand Down
10 changes: 0 additions & 10 deletions src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs
Expand Up @@ -347,17 +347,7 @@ pub const TIOCEXCL: ::c_ulong = 21516;
pub const TIOCNXCL: ::c_ulong = 21517;
pub const TIOCSCTTY: ::c_ulong = 21518;
pub const TIOCSTI: ::c_ulong = 21522;
pub const TIOCMGET: ::c_ulong = 21525;
pub const TIOCMBIS: ::c_ulong = 21526;
pub const TIOCMBIC: ::c_ulong = 21527;
pub const TIOCMSET: ::c_ulong = 21528;
pub const TIOCCONS: ::c_ulong = 21533;
pub const TIOCM_ST: ::c_int = 8;
pub const TIOCM_SR: ::c_int = 16;
pub const TIOCM_CTS: ::c_int = 32;
pub const TIOCM_CAR: ::c_int = 64;
pub const TIOCM_RNG: ::c_int = 128;
pub const TIOCM_DSR: ::c_int = 256;

pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
Expand Down
12 changes: 0 additions & 12 deletions src/unix/linux_like/linux/gnu/b32/sparc/mod.rs
Expand Up @@ -362,19 +362,8 @@ pub const TIOCEXCL: ::c_ulong = 0x2000740d;
pub const TIOCNXCL: ::c_ulong = 0x2000740e;
pub const TIOCSCTTY: ::c_ulong = 0x20007484;
pub const TIOCSTI: ::c_ulong = 0x80017472;
pub const TIOCMGET: ::c_ulong = 0x4004746a;
pub const TIOCMBIS: ::c_ulong = 0x8004746c;
pub const TIOCMBIC: ::c_ulong = 0x8004746b;
pub const TIOCMSET: ::c_ulong = 0x8004746d;
pub const TIOCCONS: ::c_ulong = 0x20007424;

pub const TIOCM_ST: ::c_int = 0x008;
pub const TIOCM_SR: ::c_int = 0x010;
pub const TIOCM_CTS: ::c_int = 0x020;
pub const TIOCM_CAR: ::c_int = 0x040;
pub const TIOCM_RNG: ::c_int = 0x080;
pub const TIOCM_DSR: ::c_int = 0x100;

pub const O_DIRECTORY: ::c_int = 0o200000;
pub const O_NOFOLLOW: ::c_int = 0o400000;
pub const O_LARGEFILE: ::c_int = 0x40000;
Expand Down Expand Up @@ -469,7 +458,6 @@ pub const B19200: ::speed_t = 0o000016;
pub const B38400: ::speed_t = 0o000017;
pub const EXTA: ::speed_t = B19200;
pub const EXTB: ::speed_t = B38400;
pub const BOTHER: ::speed_t = 0x1000;
pub const B57600: ::speed_t = 0x1001;
pub const B115200: ::speed_t = 0x1002;
pub const B230400: ::speed_t = 0x1003;
Expand Down
11 changes: 0 additions & 11 deletions src/unix/linux_like/linux/gnu/b32/x86/mod.rs
Expand Up @@ -603,10 +603,6 @@ pub const TIOCEXCL: ::c_ulong = 0x540C;
pub const TIOCNXCL: ::c_ulong = 0x540D;
pub const TIOCSCTTY: ::c_ulong = 0x540E;
pub const TIOCSTI: ::c_ulong = 0x5412;
pub const TIOCMGET: ::c_ulong = 0x5415;
pub const TIOCMBIS: ::c_ulong = 0x5416;
pub const TIOCMBIC: ::c_ulong = 0x5417;
pub const TIOCMSET: ::c_ulong = 0x5418;
pub const TIOCCONS: ::c_ulong = 0x541D;

pub const B0: ::speed_t = 0o000000;
Expand All @@ -627,7 +623,6 @@ pub const B19200: ::speed_t = 0o000016;
pub const B38400: ::speed_t = 0o000017;
pub const EXTA: ::speed_t = B19200;
pub const EXTB: ::speed_t = B38400;
pub const BOTHER: ::speed_t = 0o010000;
pub const B57600: ::speed_t = 0o010001;
pub const B115200: ::speed_t = 0o010002;
pub const B230400: ::speed_t = 0o010003;
Expand Down Expand Up @@ -678,12 +673,6 @@ pub const TCSAFLUSH: ::c_int = 2;

pub const TIOCLINUX: ::c_ulong = 0x541C;
pub const TIOCGSERIAL: ::c_ulong = 0x541E;
pub const TIOCM_ST: ::c_int = 0x008;
pub const TIOCM_SR: ::c_int = 0x010;
pub const TIOCM_CTS: ::c_int = 0x020;
pub const TIOCM_CAR: ::c_int = 0x040;
pub const TIOCM_RNG: ::c_int = 0x080;
pub const TIOCM_DSR: ::c_int = 0x100;

// Syscall table
pub const SYS_restart_syscall: ::c_long = 0;
Expand Down