Skip to content

Commit 9a9f71e

Browse files
committed
Auto merge of #711 - Susurrus:termios2, r=alexcrichton
Add BOTHER & termios2 to Android & Linux This should be the same for both the struct and the constant across all Linux/Android platforms, but we'll see!
2 parents 2ca5bc5 + 6d55c24 commit 9a9f71e

File tree

15 files changed

+159
-2
lines changed

15 files changed

+159
-2
lines changed

Diff for: libc-test/build.rs

+18-2
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,10 @@ fn main() {
377377
// FIXME: unskip it for next major release
378378
"stat" | "stat64" if android => true,
379379

380+
// These are tested as part of the linux_fcntl tests since there are
381+
// header conflicts when including them with all the other structs.
382+
"termios2" => true,
383+
380384
_ => false
381385
}
382386
});
@@ -489,6 +493,7 @@ fn main() {
489493
"F_CANCELLK" | "F_ADD_SEALS" | "F_GET_SEALS" => true,
490494
"F_SEAL_SEAL" | "F_SEAL_SHRINK" | "F_SEAL_GROW" | "F_SEAL_WRITE" => true,
491495
"QFMT_VFS_OLD" | "QFMT_VFS_V0" | "QFMT_VFS_V1" if mips && linux => true, // Only on MIPS
496+
"BOTHER" => true,
492497

493498
_ => false,
494499
}
@@ -670,8 +675,7 @@ fn main() {
670675
// fails on a lot of platforms.
671676
let mut cfg = ctest::TestGenerator::new();
672677
cfg.skip_type(|_| true)
673-
.skip_struct(|_| true)
674-
.skip_fn(|_| true);
678+
.skip_fn(|_| true);
675679
if android || linux {
676680
// musl defines these directly in `fcntl.h`
677681
if musl {
@@ -684,16 +688,28 @@ fn main() {
684688
cfg.header("linux/if.h");
685689
}
686690
cfg.header("linux/quota.h");
691+
cfg.header("asm/termbits.h");
687692
cfg.skip_const(move |name| {
688693
match name {
689694
"F_CANCELLK" | "F_ADD_SEALS" | "F_GET_SEALS" => false,
690695
"F_SEAL_SEAL" | "F_SEAL_SHRINK" | "F_SEAL_GROW" | "F_SEAL_WRITE" => false,
691696
"QFMT_VFS_OLD" | "QFMT_VFS_V0" | "QFMT_VFS_V1" if mips && linux => false,
697+
"BOTHER" => false,
692698
_ => true,
693699
}
694700
});
701+
cfg.skip_struct(|s| {
702+
s != "termios2"
703+
});
704+
cfg.type_name(move |ty, is_struct| {
705+
match ty {
706+
t if is_struct => format!("struct {}", t),
707+
t => t.to_string(),
708+
}
709+
});
695710
} else {
696711
cfg.skip_const(|_| true);
712+
cfg.skip_struct(|_| true);
697713
}
698714
cfg.generate("../src/lib.rs", "linux_fcntl.rs");
699715
}

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

+12
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,17 @@ s! {
8484
pub c_cc: [::cc_t; ::NCCS],
8585
}
8686

87+
pub struct termios2 {
88+
pub c_iflag: ::tcflag_t,
89+
pub c_oflag: ::tcflag_t,
90+
pub c_cflag: ::tcflag_t,
91+
pub c_lflag: ::tcflag_t,
92+
pub c_line: ::cc_t,
93+
pub c_cc: [::cc_t; 19],
94+
pub c_ispeed: ::speed_t,
95+
pub c_ospeed: ::speed_t,
96+
}
97+
8798
pub struct flock {
8899
pub l_type: ::c_short,
89100
pub l_whence: ::c_short,
@@ -763,6 +774,7 @@ pub const B19200: ::speed_t = 0o000016;
763774
pub const B38400: ::speed_t = 0o000017;
764775
pub const EXTA: ::speed_t = B19200;
765776
pub const EXTB: ::speed_t = B38400;
777+
pub const BOTHER: ::speed_t = 0o010000;
766778
pub const B57600: ::speed_t = 0o010001;
767779
pub const B115200: ::speed_t = 0o010002;
768780
pub const B230400: ::speed_t = 0o010003;

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

+12
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,17 @@ s! {
2525
__size: [::c_char; 32],
2626
__align: [::c_long; 0],
2727
}
28+
29+
pub struct termios2 {
30+
pub c_iflag: ::tcflag_t,
31+
pub c_oflag: ::tcflag_t,
32+
pub c_cflag: ::tcflag_t,
33+
pub c_lflag: ::tcflag_t,
34+
pub c_line: ::cc_t,
35+
pub c_cc: [::cc_t; 23],
36+
pub c_ispeed: ::speed_t,
37+
pub c_ospeed: ::speed_t,
38+
}
2839
}
2940

3041
pub const SFD_CLOEXEC: ::c_int = 0x080000;
@@ -614,6 +625,7 @@ pub const B19200: ::speed_t = 0o000016;
614625
pub const B38400: ::speed_t = 0o000017;
615626
pub const EXTA: ::speed_t = B19200;
616627
pub const EXTB: ::speed_t = B38400;
628+
pub const BOTHER: ::speed_t = 0o010000;
617629
pub const B57600: ::speed_t = 0o010001;
618630
pub const B115200: ::speed_t = 0o010002;
619631
pub const B230400: ::speed_t = 0o010003;

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

+11
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,17 @@ s! {
138138
pub f_namemax: ::c_ulong,
139139
__f_spare: [::c_int; 6],
140140
}
141+
142+
pub struct termios2 {
143+
pub c_iflag: ::tcflag_t,
144+
pub c_oflag: ::tcflag_t,
145+
pub c_cflag: ::tcflag_t,
146+
pub c_lflag: ::tcflag_t,
147+
pub c_line: ::cc_t,
148+
pub c_cc: [::cc_t; 19],
149+
pub c_ispeed: ::speed_t,
150+
pub c_ospeed: ::speed_t,
151+
}
141152
}
142153

143154
pub const O_DIRECT: ::c_int = 0x10000;

Diff for: src/unix/notbsd/linux/musl/b32/mips.rs

+11
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,17 @@ s! {
149149
pub f_namemax: ::c_ulong,
150150
__f_spare: [::c_int; 6],
151151
}
152+
153+
pub struct termios2 {
154+
pub c_iflag: ::tcflag_t,
155+
pub c_oflag: ::tcflag_t,
156+
pub c_cflag: ::tcflag_t,
157+
pub c_lflag: ::tcflag_t,
158+
pub c_line: ::cc_t,
159+
pub c_cc: [::cc_t; 23],
160+
pub c_ispeed: ::speed_t,
161+
pub c_ospeed: ::speed_t,
162+
}
152163
}
153164

154165
pub const O_DIRECT: ::c_int = 0o100000;

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

+11
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,17 @@ s! {
151151
pub f_namemax: ::c_ulong,
152152
__f_spare: [::c_int; 6],
153153
}
154+
155+
pub struct termios2 {
156+
pub c_iflag: ::tcflag_t,
157+
pub c_oflag: ::tcflag_t,
158+
pub c_cflag: ::tcflag_t,
159+
pub c_lflag: ::tcflag_t,
160+
pub c_line: ::cc_t,
161+
pub c_cc: [::cc_t; 19],
162+
pub c_ispeed: ::speed_t,
163+
pub c_ospeed: ::speed_t,
164+
}
154165
}
155166

156167
pub const O_DIRECT: ::c_int = 0x4000;

Diff for: src/unix/notbsd/linux/musl/b64/mod.rs

+11
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,17 @@ s! {
118118
pub _pad: [::c_int; 29],
119119
_align: [usize; 0],
120120
}
121+
122+
pub struct termios2 {
123+
pub c_iflag: ::tcflag_t,
124+
pub c_oflag: ::tcflag_t,
125+
pub c_cflag: ::tcflag_t,
126+
pub c_lflag: ::tcflag_t,
127+
pub c_line: ::cc_t,
128+
pub c_cc: [::cc_t; 19],
129+
pub c_ispeed: ::speed_t,
130+
pub c_ospeed: ::speed_t,
131+
}
121132
}
122133

123134
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;

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

+12
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,17 @@ s! {
101101
__glibc_reserved4: ::c_ulong,
102102
__glibc_reserved5: ::c_ulong,
103103
}
104+
105+
pub struct termios2 {
106+
pub c_iflag: ::tcflag_t,
107+
pub c_oflag: ::tcflag_t,
108+
pub c_cflag: ::tcflag_t,
109+
pub c_lflag: ::tcflag_t,
110+
pub c_line: ::cc_t,
111+
pub c_cc: [::cc_t; 19],
112+
pub c_ispeed: ::speed_t,
113+
pub c_ospeed: ::speed_t,
114+
}
104115
}
105116

106117
pub const O_DIRECT: ::c_int = 0x10000;
@@ -203,6 +214,7 @@ pub const B19200: ::speed_t = 0o000016;
203214
pub const B38400: ::speed_t = 0o000017;
204215
pub const EXTA: ::speed_t = B19200;
205216
pub const EXTB: ::speed_t = B38400;
217+
pub const BOTHER: ::speed_t = 0o010000;
206218
pub const B57600: ::speed_t = 0o010001;
207219
pub const B115200: ::speed_t = 0o010002;
208220
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
@@ -215,6 +215,7 @@ pub const B2500000: ::speed_t = 0o0033;
215215
pub const B3000000: ::speed_t = 0o0034;
216216
pub const B3500000: ::speed_t = 0o0035;
217217
pub const B4000000: ::speed_t = 0o0036;
218+
pub const BOTHER: ::speed_t = 0o0037;
218219

219220
pub const VEOL: usize = 6;
220221
pub const VEOL2: usize = 8;

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

+12
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,17 @@ s! {
200200
__glibc_reserved4: ::c_ulong,
201201
__glibc_reserved5: ::c_ulong,
202202
}
203+
204+
pub struct termios2 {
205+
pub c_iflag: ::tcflag_t,
206+
pub c_oflag: ::tcflag_t,
207+
pub c_cflag: ::tcflag_t,
208+
pub c_lflag: ::tcflag_t,
209+
pub c_line: ::cc_t,
210+
pub c_cc: [::cc_t; 19],
211+
pub c_ispeed: ::speed_t,
212+
pub c_ospeed: ::speed_t,
213+
}
203214
}
204215

205216
pub const O_DIRECT: ::c_int = 0x4000;
@@ -304,6 +315,7 @@ pub const B19200: ::speed_t = 0o000016;
304315
pub const B38400: ::speed_t = 0o000017;
305316
pub const EXTA: ::speed_t = B19200;
306317
pub const EXTB: ::speed_t = B38400;
318+
pub const BOTHER: ::speed_t = 0o010000;
307319
pub const B57600: ::speed_t = 0o010001;
308320
pub const B115200: ::speed_t = 0o010002;
309321
pub const B230400: ::speed_t = 0o010003;

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

+12
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,17 @@ s! {
111111
__unused4: ::c_ulong,
112112
__unused5: ::c_ulong
113113
}
114+
115+
pub struct termios2 {
116+
pub c_iflag: ::tcflag_t,
117+
pub c_oflag: ::tcflag_t,
118+
pub c_cflag: ::tcflag_t,
119+
pub c_lflag: ::tcflag_t,
120+
pub c_line: ::cc_t,
121+
pub c_cc: [::cc_t; 19],
122+
pub c_ispeed: ::speed_t,
123+
pub c_ospeed: ::speed_t,
124+
}
114125
}
115126

116127
pub const TIOCGSOFTCAR: ::c_ulong = 0x5419;
@@ -442,6 +453,7 @@ pub const B19200: ::speed_t = 0o000016;
442453
pub const B38400: ::speed_t = 0o000017;
443454
pub const EXTA: ::speed_t = B19200;
444455
pub const EXTB: ::speed_t = B38400;
456+
pub const BOTHER: ::speed_t = 0o010000;
445457
pub const B57600: ::speed_t = 0o010001;
446458
pub const B115200: ::speed_t = 0o010002;
447459
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
@@ -454,6 +454,7 @@ pub const B2500000: ::speed_t = 0o0033;
454454
pub const B3000000: ::speed_t = 0o0034;
455455
pub const B3500000: ::speed_t = 0o0035;
456456
pub const B4000000: ::speed_t = 0o0036;
457+
pub const BOTHER: ::speed_t = 0o0037;
457458

458459
pub const VEOL: usize = 6;
459460
pub const VEOL2: usize = 8;

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

+11
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,17 @@ s! {
111111
__reserved1: ::c_ulong,
112112
__reserved2: ::c_ulong
113113
}
114+
115+
pub struct termios2 {
116+
pub c_iflag: ::tcflag_t,
117+
pub c_oflag: ::tcflag_t,
118+
pub c_cflag: ::tcflag_t,
119+
pub c_lflag: ::tcflag_t,
120+
pub c_line: ::cc_t,
121+
pub c_cc: [::cc_t; 19],
122+
pub c_ispeed: ::speed_t,
123+
pub c_ospeed: ::speed_t,
124+
}
114125
}
115126

116127
pub const TIOCGSOFTCAR: ::c_ulong = 0x40047464;

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

+12
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,17 @@ s! {
212212
__unused4: ::c_ulong,
213213
__unused5: ::c_ulong
214214
}
215+
216+
pub struct termios2 {
217+
pub c_iflag: ::tcflag_t,
218+
pub c_oflag: ::tcflag_t,
219+
pub c_cflag: ::tcflag_t,
220+
pub c_lflag: ::tcflag_t,
221+
pub c_line: ::cc_t,
222+
pub c_cc: [::cc_t; 19],
223+
pub c_ispeed: ::speed_t,
224+
pub c_ospeed: ::speed_t,
225+
}
215226
}
216227

217228
pub const TIOCGSOFTCAR: ::c_ulong = 0x5419;
@@ -552,6 +563,7 @@ pub const B19200: ::speed_t = 0o000016;
552563
pub const B38400: ::speed_t = 0o000017;
553564
pub const EXTA: ::speed_t = B19200;
554565
pub const EXTB: ::speed_t = B38400;
566+
pub const BOTHER: ::speed_t = 0o010000;
555567
pub const B57600: ::speed_t = 0o010001;
556568
pub const B115200: ::speed_t = 0o010002;
557569
pub const B230400: ::speed_t = 0o010003;

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

+12
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,17 @@ s! {
177177
pub c_ospeed: ::speed_t,
178178
}
179179

180+
pub struct termios2 {
181+
pub c_iflag: ::tcflag_t,
182+
pub c_oflag: ::tcflag_t,
183+
pub c_cflag: ::tcflag_t,
184+
pub c_lflag: ::tcflag_t,
185+
pub c_line: ::cc_t,
186+
pub c_cc: [::cc_t; 19],
187+
pub c_ispeed: ::speed_t,
188+
pub c_ospeed: ::speed_t,
189+
}
190+
180191
pub struct sysinfo {
181192
pub uptime: ::c_long,
182193
pub loads: [::c_ulong; 3],
@@ -869,6 +880,7 @@ pub const PARODD: ::tcflag_t = 0o001000;
869880
pub const HUPCL: ::tcflag_t = 0o002000;
870881
pub const CLOCAL: ::tcflag_t = 0o004000;
871882
pub const CBAUDEX: ::tcflag_t = 0o010000;
883+
pub const BOTHER: ::speed_t = 0o010000;
872884
pub const B57600: ::speed_t = 0o010001;
873885
pub const B115200: ::speed_t = 0o010002;
874886
pub const B230400: ::speed_t = 0o010003;

0 commit comments

Comments
 (0)