Skip to content

Add BOTHER & termios2 to Android & Linux #711

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

Merged
merged 2 commits into from
Oct 19, 2017
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,10 @@ fn main() {
// FIXME: unskip it for next major release
"stat" | "stat64" if android => true,

// These are tested as part of the linux_fcntl tests since there are
// header conflicts when including them with all the other structs.
"termios2" => true,

_ => false
}
});
Expand Down Expand Up @@ -489,6 +493,7 @@ fn main() {
"F_CANCELLK" | "F_ADD_SEALS" | "F_GET_SEALS" => true,
"F_SEAL_SEAL" | "F_SEAL_SHRINK" | "F_SEAL_GROW" | "F_SEAL_WRITE" => true,
"QFMT_VFS_OLD" | "QFMT_VFS_V0" | "QFMT_VFS_V1" if mips && linux => true, // Only on MIPS
"BOTHER" => true,

_ => false,
}
Expand Down Expand Up @@ -670,8 +675,7 @@ fn main() {
// fails on a lot of platforms.
let mut cfg = ctest::TestGenerator::new();
cfg.skip_type(|_| true)
.skip_struct(|_| true)
.skip_fn(|_| true);
.skip_fn(|_| true);
if android || linux {
// musl defines these directly in `fcntl.h`
if musl {
Expand All @@ -684,16 +688,28 @@ fn main() {
cfg.header("linux/if.h");
}
cfg.header("linux/quota.h");
cfg.header("asm/termbits.h");
cfg.skip_const(move |name| {
match name {
"F_CANCELLK" | "F_ADD_SEALS" | "F_GET_SEALS" => false,
"F_SEAL_SEAL" | "F_SEAL_SHRINK" | "F_SEAL_GROW" | "F_SEAL_WRITE" => false,
"QFMT_VFS_OLD" | "QFMT_VFS_V0" | "QFMT_VFS_V1" if mips && linux => false,
"BOTHER" => false,
_ => true,
}
});
cfg.skip_struct(|s| {
s != "termios2"
});
cfg.type_name(move |ty, is_struct| {
match ty {
t if is_struct => format!("struct {}", t),
t => t.to_string(),
}
});
} else {
cfg.skip_const(|_| true);
cfg.skip_struct(|_| true);
}
cfg.generate("../src/lib.rs", "linux_fcntl.rs");
}
12 changes: 12 additions & 0 deletions src/unix/notbsd/android/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,17 @@ s! {
pub c_cc: [::cc_t; ::NCCS],
}

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 flock {
pub l_type: ::c_short,
pub l_whence: ::c_short,
Expand Down Expand Up @@ -763,6 +774,7 @@ 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
12 changes: 12 additions & 0 deletions src/unix/notbsd/linux/mips/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ s! {
__size: [::c_char; 32],
__align: [::c_long; 0],
}

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 SFD_CLOEXEC: ::c_int = 0x080000;
Expand Down Expand Up @@ -614,6 +625,7 @@ 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
11 changes: 11 additions & 0 deletions src/unix/notbsd/linux/musl/b32/arm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,17 @@ 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 O_DIRECT: ::c_int = 0x10000;
Expand Down
11 changes: 11 additions & 0 deletions src/unix/notbsd/linux/musl/b32/mips.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,17 @@ 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; 23],
pub c_ispeed: ::speed_t,
pub c_ospeed: ::speed_t,
}
}

pub const O_DIRECT: ::c_int = 0o100000;
Expand Down
11 changes: 11 additions & 0 deletions src/unix/notbsd/linux/musl/b32/x86.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,17 @@ 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 O_DIRECT: ::c_int = 0x4000;
Expand Down
11 changes: 11 additions & 0 deletions src/unix/notbsd/linux/musl/b64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,17 @@ s! {
pub _pad: [::c_int; 29],
_align: [usize; 0],
}

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 __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
Expand Down
12 changes: 12 additions & 0 deletions src/unix/notbsd/linux/other/b32/arm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,17 @@ s! {
__glibc_reserved4: ::c_ulong,
__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 const O_DIRECT: ::c_int = 0x10000;
Expand Down Expand Up @@ -203,6 +214,7 @@ 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
1 change: 1 addition & 0 deletions src/unix/notbsd/linux/other/b32/powerpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ 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
12 changes: 12 additions & 0 deletions src/unix/notbsd/linux/other/b32/x86.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,17 @@ s! {
__glibc_reserved4: ::c_ulong,
__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 const O_DIRECT: ::c_int = 0x4000;
Expand Down Expand Up @@ -304,6 +315,7 @@ 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
12 changes: 12 additions & 0 deletions src/unix/notbsd/linux/other/b64/aarch64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,17 @@ 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; 19],
pub c_ispeed: ::speed_t,
pub c_ospeed: ::speed_t,
}
}

pub const TIOCGSOFTCAR: ::c_ulong = 0x5419;
Expand Down Expand Up @@ -442,6 +453,7 @@ 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
1 change: 1 addition & 0 deletions src/unix/notbsd/linux/other/b64/powerpc64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ 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
11 changes: 11 additions & 0 deletions src/unix/notbsd/linux/other/b64/sparc64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,17 @@ 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 TIOCGSOFTCAR: ::c_ulong = 0x40047464;
Expand Down
12 changes: 12 additions & 0 deletions src/unix/notbsd/linux/other/b64/x86_64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,17 @@ 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; 19],
pub c_ispeed: ::speed_t,
pub c_ospeed: ::speed_t,
}
}

pub const TIOCGSOFTCAR: ::c_ulong = 0x5419;
Expand Down Expand Up @@ -552,6 +563,7 @@ 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
12 changes: 12 additions & 0 deletions src/unix/notbsd/linux/s390x.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,17 @@ s! {
pub c_ospeed: ::speed_t,
}

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 sysinfo {
pub uptime: ::c_long,
pub loads: [::c_ulong; 3],
Expand Down Expand Up @@ -869,6 +880,7 @@ pub const PARODD: ::tcflag_t = 0o001000;
pub const HUPCL: ::tcflag_t = 0o002000;
pub const CLOCAL: ::tcflag_t = 0o004000;
pub const CBAUDEX: ::tcflag_t = 0o010000;
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