Skip to content

Commit 6d55c24

Browse files
Bryant MairsSusurrus
Bryant Mairs
authored andcommitted
Add termios2 for Android & Linux
Note that termios2 doesn't exist on powerpc(64), termios is used instead.
1 parent 12cfa1e commit 6d55c24

File tree

13 files changed

+147
-2
lines changed

13 files changed

+147
-2
lines changed

Diff for: libc-test/build.rs

+15-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
});
@@ -671,8 +675,7 @@ fn main() {
671675
// fails on a lot of platforms.
672676
let mut cfg = ctest::TestGenerator::new();
673677
cfg.skip_type(|_| true)
674-
.skip_struct(|_| true)
675-
.skip_fn(|_| true);
678+
.skip_fn(|_| true);
676679
if android || linux {
677680
// musl defines these directly in `fcntl.h`
678681
if musl {
@@ -695,8 +698,18 @@ fn main() {
695698
_ => true,
696699
}
697700
});
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+
});
698710
} else {
699711
cfg.skip_const(|_| true);
712+
cfg.skip_struct(|_| true);
700713
}
701714
cfg.generate("../src/lib.rs", "linux_fcntl.rs");
702715
}

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

+11
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,

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

+11
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;

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

+11
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;

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

+11
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;

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

+11
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;

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

+11
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;

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

+11
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],

0 commit comments

Comments
 (0)