Skip to content

Commit aa9e853

Browse files
committed
Add BOTHER and termios2 to Android & Linux
1 parent 2a322c7 commit aa9e853

File tree

11 files changed

+36
-1
lines changed

11 files changed

+36
-1
lines changed

Diff for: libc-test/build.rs

+16-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ fn main() {
99
let aarch64 = target.contains("aarch64");
1010
let i686 = target.contains("i686");
1111
let x86_64 = target.contains("x86_64");
12+
let powerpc = target.contains("powerpc");
1213
let windows = target.contains("windows");
1314
let mingw = target.contains("windows-gnu");
1415
let linux = target.contains("unknown-linux");
@@ -357,6 +358,10 @@ fn main() {
357358
// FIXME: unskip it for next major release
358359
"stat" | "stat64" if android => true,
359360

361+
// These are tested as part of the linux_fcntl tests since there are
362+
// header conflicts when including them with all the other structs.
363+
"termios2" => true,
364+
360365
_ => false
361366
}
362367
});
@@ -472,6 +477,7 @@ fn main() {
472477
// are header conflicts if we try to include the headers that define them here.
473478
"F_CANCELLK" | "F_ADD_SEALS" | "F_GET_SEALS" => true,
474479
"F_SEAL_SEAL" | "F_SEAL_SHRINK" | "F_SEAL_GROW" | "F_SEAL_WRITE" => true,
480+
"BOTHER" => true,
475481

476482
_ => false,
477483
}
@@ -653,9 +659,18 @@ fn main() {
653659
// fails on a lot of platforms.
654660
let mut cfg = ctest::TestGenerator::new();
655661
cfg.skip_type(|_| true)
656-
.skip_struct(|_| true)
662+
.skip_struct(move |name| {
663+
match name {
664+
// The termios2 struct is the same as `termios` on powerpc, so it's actually
665+
// undeclared in the headers. We'll still expose it there to still provide
666+
// some type safety, but we can't check it directly.
667+
"termios2" if !powerpc => false,
668+
_ => true,
669+
}
670+
})
657671
.skip_fn(|_| true);
658672
if android || linux {
673+
cfg.header("asm/termbits.h");
659674
// musl defines these directly in `fcntl.h`
660675
if musl {
661676
cfg.header("fcntl.h");

Diff for: src/unix/notbsd/android/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,7 @@ pub const B19200: ::speed_t = 0o000016;
733733
pub const B38400: ::speed_t = 0o000017;
734734
pub const EXTA: ::speed_t = B19200;
735735
pub const EXTB: ::speed_t = B38400;
736+
pub const BOTHER: ::speed_t = 0o010000;
736737
pub const B57600: ::speed_t = 0o010001;
737738
pub const B115200: ::speed_t = 0o010002;
738739
pub const B230400: ::speed_t = 0o010003;

Diff for: src/unix/notbsd/linux/mips/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,7 @@ pub const B19200: ::speed_t = 0o000016;
591591
pub const B38400: ::speed_t = 0o000017;
592592
pub const EXTA: ::speed_t = B19200;
593593
pub const EXTB: ::speed_t = B38400;
594+
pub const BOTHER: ::speed_t = 0o010000;
594595
pub const B57600: ::speed_t = 0o010001;
595596
pub const B115200: ::speed_t = 0o010002;
596597
pub const B230400: ::speed_t = 0o010003;

Diff for: src/unix/notbsd/linux/other/b32/arm.rs

+1
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ pub const B19200: ::speed_t = 0o000016;
175175
pub const B38400: ::speed_t = 0o000017;
176176
pub const EXTA: ::speed_t = B19200;
177177
pub const EXTB: ::speed_t = B38400;
178+
pub const BOTHER: ::speed_t = 0o010000;
178179
pub const B57600: ::speed_t = 0o010001;
179180
pub const B115200: ::speed_t = 0o010002;
180181
pub const B230400: ::speed_t = 0o010003;

Diff for: src/unix/notbsd/linux/other/b32/powerpc.rs

+1
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ pub const B2500000: ::speed_t = 0o0033;
187187
pub const B3000000: ::speed_t = 0o0034;
188188
pub const B3500000: ::speed_t = 0o0035;
189189
pub const B4000000: ::speed_t = 0o0036;
190+
pub const BOTHER: ::speed_t = 0o0037;
190191

191192
pub const VEOL: usize = 6;
192193
pub const VEOL2: usize = 8;

Diff for: src/unix/notbsd/linux/other/b32/x86.rs

+1
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ pub const B19200: ::speed_t = 0o000016;
273273
pub const B38400: ::speed_t = 0o000017;
274274
pub const EXTA: ::speed_t = B19200;
275275
pub const EXTB: ::speed_t = B38400;
276+
pub const BOTHER: ::speed_t = 0o010000;
276277
pub const B57600: ::speed_t = 0o010001;
277278
pub const B115200: ::speed_t = 0o010002;
278279
pub const B230400: ::speed_t = 0o010003;

Diff for: src/unix/notbsd/linux/other/b64/aarch64.rs

+1
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,7 @@ pub const B19200: ::speed_t = 0o000016;
415415
pub const B38400: ::speed_t = 0o000017;
416416
pub const EXTA: ::speed_t = B19200;
417417
pub const EXTB: ::speed_t = B38400;
418+
pub const BOTHER: ::speed_t = 0o010000;
418419
pub const B57600: ::speed_t = 0o010001;
419420
pub const B115200: ::speed_t = 0o010002;
420421
pub const B230400: ::speed_t = 0o010003;

Diff for: src/unix/notbsd/linux/other/b64/powerpc64.rs

+1
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ pub const B2500000: ::speed_t = 0o0033;
427427
pub const B3000000: ::speed_t = 0o0034;
428428
pub const B3500000: ::speed_t = 0o0035;
429429
pub const B4000000: ::speed_t = 0o0036;
430+
pub const BOTHER: ::speed_t = 0o0037;
430431

431432
pub const VEOL: usize = 6;
432433
pub const VEOL2: usize = 8;

Diff for: src/unix/notbsd/linux/other/b64/x86_64.rs

+1
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,7 @@ pub const B19200: ::speed_t = 0o000016;
522522
pub const B38400: ::speed_t = 0o000017;
523523
pub const EXTA: ::speed_t = B19200;
524524
pub const EXTB: ::speed_t = B38400;
525+
pub const BOTHER: ::speed_t = 0o010000;
525526
pub const B57600: ::speed_t = 0o010001;
526527
pub const B115200: ::speed_t = 0o010002;
527528
pub const B230400: ::speed_t = 0o010003;

Diff for: src/unix/notbsd/linux/s390x.rs

+1
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,7 @@ pub const PARODD: ::tcflag_t = 0o001000;
844844
pub const HUPCL: ::tcflag_t = 0o002000;
845845
pub const CLOCAL: ::tcflag_t = 0o004000;
846846
pub const CBAUDEX: ::tcflag_t = 0o010000;
847+
pub const BOTHER: ::speed_t = 0o010000;
847848
pub const B57600: ::speed_t = 0o010001;
848849
pub const B115200: ::speed_t = 0o010002;
849850
pub const B230400: ::speed_t = 0o010003;

Diff for: src/unix/notbsd/mod.rs

+11
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,17 @@ s! {
178178
#[cfg(target_pointer_width = "32")]
179179
__unused1: [::c_int; 12]
180180
}
181+
182+
pub struct termios2 {
183+
pub c_iflag: ::tcflag_t,
184+
pub c_oflag: ::tcflag_t,
185+
pub c_cflag: ::tcflag_t,
186+
pub c_lflag: ::tcflag_t,
187+
pub c_line: ::cc_t,
188+
pub c_cc: [::cc_t; 19],
189+
pub c_ispeed: ::speed_t,
190+
pub c_ospeed: ::speed_t,
191+
}
181192
}
182193

183194
// intentionally not public, only used for fd_set

0 commit comments

Comments
 (0)