Skip to content

Commit b4a10f1

Browse files
Add devstat items
1 parent 106d949 commit b4a10f1

File tree

2 files changed

+431
-3
lines changed

2 files changed

+431
-3
lines changed

libc-test/build.rs

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1877,6 +1877,7 @@ fn test_freebsd(target: &str) {
18771877
"sys/vmmeter.h",
18781878
"sys/wait.h",
18791879
"libprocstat.h",
1880+
"devstat.h",
18801881
"syslog.h",
18811882
"termios.h",
18821883
"time.h",
@@ -1890,8 +1891,19 @@ fn test_freebsd(target: &str) {
18901891
cfg.type_name(move |ty, is_struct, is_union| {
18911892
match ty {
18921893
// Just pass all these through, no need for a "struct" prefix
1893-
"FILE" | "fd_set" | "Dl_info" | "DIR" | "Elf32_Phdr" | "Elf64_Phdr"
1894-
| "Elf32_Auxinfo" | "Elf64_Auxinfo" => ty.to_string(),
1894+
"FILE"
1895+
| "fd_set"
1896+
| "Dl_info"
1897+
| "DIR"
1898+
| "Elf32_Phdr"
1899+
| "Elf64_Phdr"
1900+
| "Elf32_Auxinfo"
1901+
| "Elf64_Auxinfo"
1902+
| "devstat_select_mode"
1903+
| "devstat_support_flags"
1904+
| "devstat_type_flags"
1905+
| "devstat_match_flags"
1906+
| "devstat_priority" => ty.to_string(),
18951907

18961908
// FIXME: https://github.com/rust-lang/libc/issues/1273
18971909
"sighandler_t" => "sig_t".to_string(),
@@ -1919,7 +1931,9 @@ fn test_freebsd(target: &str) {
19191931
}
19201932
// Field is named `type` in C but that is a Rust keyword,
19211933
// so these fields are translated to `type_` in the bindings.
1922-
"type_" if struct_ == "rtprio" || struct_ == "sockstat" => "type".to_string(),
1934+
"type_" if struct_ == "rtprio" => "type".to_string(),
1935+
"type_" if struct_ == "sockstat" => "type".to_string(),
1936+
"type_" if struct_ == "devstat_match_table" => "type".to_string(),
19231937
s => s.to_string(),
19241938
}
19251939
});
@@ -2146,6 +2160,10 @@ fn test_freebsd(target: &str) {
21462160
// for now, it doesn't matter too much...
21472161
"kvm_t" => true,
21482162

2163+
// The C norm is a nightmare to follow for `long double`. Its sized is checked since
2164+
// it's being used as a struct field type in any case.
2165+
"c_longdouble" => true,
2166+
21492167
_ => false,
21502168
}
21512169
});
@@ -2170,6 +2188,9 @@ fn test_freebsd(target: &str) {
21702188
// obsolete version
21712189
"vmtotal" if Some(11) == freebsd_ver => true,
21722190

2191+
// A wrapper around "long double".
2192+
"LongDoubleWrap" => true,
2193+
21732194
_ => false,
21742195
}
21752196
});
@@ -2200,6 +2221,10 @@ fn test_freebsd(target: &str) {
22002221
// https://github.com/gnzlbg/ctest/issues/68
22012222
"lio_listio" => true,
22022223

2224+
// It returns a `long double`, but it's a nightmare to bind correctly in rust
2225+
// for the moment, so it's a best effort thing...
2226+
"devstat_compute_etime" => true,
2227+
22032228
_ => false,
22042229
}
22052230
});
@@ -2255,6 +2280,9 @@ fn test_freebsd(target: &str) {
22552280
("if_data", "__ifi_lastchange") => true,
22562281
("ifreq", "ifr_ifru") => true,
22572282

2283+
// anonymous struct
2284+
("devstat", "dev_links") => true,
2285+
22582286
// FIXME: structs too complicated to bind for now...
22592287
("kinfo_proc", "ki_paddr") => true,
22602288
("kinfo_proc", "ki_addr") => true,
@@ -2272,6 +2300,11 @@ fn test_freebsd(target: &str) {
22722300

22732301
// `__sem_base` is a private struct field
22742302
("semid_ds", "__sem_base") => true,
2303+
2304+
// `snap_time` is a `long double`, but it's a nightmare to bind correctly in rust
2305+
// for the moment, so it's a best effort thing...
2306+
("statinfo", "snap_time") => true,
2307+
22752308
_ => false,
22762309
}
22772310
});

0 commit comments

Comments
 (0)