Skip to content

Commit 9e2d2dc

Browse files
committed
Add termios 2 on all platforms
1 parent 15df477 commit 9e2d2dc

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

Diff for: libc-test/build.rs

+15-2
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");
@@ -377,6 +378,10 @@ fn main() {
377378
// FIXME: unskip it for next major release
378379
"stat" | "stat64" if android => true,
379380

381+
// These are tested as part of the linux_fcntl tests since there are
382+
// header conflicts when including them with all the other structs.
383+
"termios2" => true,
384+
380385
_ => false
381386
}
382387
});
@@ -671,8 +676,16 @@ fn main() {
671676
// fails on a lot of platforms.
672677
let mut cfg = ctest::TestGenerator::new();
673678
cfg.skip_type(|_| true)
674-
.skip_struct(|_| true)
675-
.skip_fn(|_| true);
679+
.type_name(move |ty, _| {
680+
match ty {
681+
// The termios2 struct is the same as `termios` on powerpc, so it's actually
682+
// undeclared in the headers. We'll still expose it there to still provide
683+
// some type safety, but we can't check it directly.
684+
"termios2" if powerpc => "termios".to_string(),
685+
t => t.to_string(),
686+
}
687+
})
688+
.skip_fn(|_| true);
676689
if android || linux {
677690
// musl defines these directly in `fcntl.h`
678691
if musl {

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

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

182193
// intentionally not public, only used for fd_set

0 commit comments

Comments
 (0)