Skip to content
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
2 changes: 1 addition & 1 deletion libc-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ default-features = false
[build-dependencies]
cc = "1.0.61"
# FIXME: Use fork ctest until the maintainer gets back.
ctest2 = "0.4.2"
ctest2 = "0.4.3"

[features]
default = [ "std" ]
Expand Down
28 changes: 25 additions & 3 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1877,6 +1877,7 @@ fn test_freebsd(target: &str) {
"sys/vmmeter.h",
"sys/wait.h",
"libprocstat.h",
"devstat.h",
"syslog.h",
"termios.h",
"time.h",
Expand All @@ -1890,8 +1891,19 @@ fn test_freebsd(target: &str) {
cfg.type_name(move |ty, is_struct, is_union| {
match ty {
// Just pass all these through, no need for a "struct" prefix
"FILE" | "fd_set" | "Dl_info" | "DIR" | "Elf32_Phdr" | "Elf64_Phdr"
| "Elf32_Auxinfo" | "Elf64_Auxinfo" => ty.to_string(),
"FILE"
| "fd_set"
| "Dl_info"
| "DIR"
| "Elf32_Phdr"
| "Elf64_Phdr"
| "Elf32_Auxinfo"
| "Elf64_Auxinfo"
| "devstat_select_mode"
| "devstat_support_flags"
| "devstat_type_flags"
| "devstat_match_flags"
| "devstat_priority" => ty.to_string(),

// FIXME: https://github.com/rust-lang/libc/issues/1273
"sighandler_t" => "sig_t".to_string(),
Expand Down Expand Up @@ -1919,7 +1931,9 @@ fn test_freebsd(target: &str) {
}
// Field is named `type` in C but that is a Rust keyword,
// so these fields are translated to `type_` in the bindings.
"type_" if struct_ == "rtprio" || struct_ == "sockstat" => "type".to_string(),
"type_" if struct_ == "rtprio" => "type".to_string(),
"type_" if struct_ == "sockstat" => "type".to_string(),
"type_" if struct_ == "devstat_match_table" => "type".to_string(),
s => s.to_string(),
}
});
Expand Down Expand Up @@ -2261,6 +2275,9 @@ fn test_freebsd(target: &str) {
("if_data", "__ifi_lastchange") => true,
("ifreq", "ifr_ifru") => true,

// anonymous struct
("devstat", "dev_links") => true,

// FIXME: structs too complicated to bind for now...
("kinfo_proc", "ki_paddr") => true,
("kinfo_proc", "ki_addr") => true,
Expand All @@ -2278,6 +2295,11 @@ fn test_freebsd(target: &str) {

// `__sem_base` is a private struct field
("semid_ds", "__sem_base") => true,

// `snap_time` is a `long double`, but it's a nightmare to bind correctly in rust
// for the moment, so it's a best effort thing...
("statinfo", "snap_time") => true,

_ => false,
}
});
Expand Down
Loading