Skip to content
Open
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
77 changes: 1 addition & 76 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -540,14 +540,7 @@ fn test_openbsd(target: &str) {
cfg.rename_struct_field(|struct_, field_| {
let struct_ = struct_.ident();
let replacement = match field_.ident() {
"st_birthtime" if struct_.starts_with("stat") => "__st_birthtime".to_string(),
"st_birthtime_nsec" if struct_.starts_with("stat") => "__st_birthtimensec".to_string(),

// Our stat *_nsec fields normally don't actually exist but are part
// of a timeval struct
s if s.ends_with("_nsec") && struct_.starts_with("stat") => {
s.replace("e_nsec", ".tv_nsec")
}
"st_birthtim" if struct_.starts_with("stat") => "__st_birthtim".to_string(),

"sa_sigaction" if struct_ == "sigaction" => "sa_handler".to_string(),

Expand Down Expand Up @@ -694,12 +687,6 @@ fn test_cygwin(target: &str) {

cfg.rename_struct_field(move |struct_, field| {
match field.ident() {
// Our stat *_nsec fields normally don't actually exist but are part
// of a timeval struct
s if s.ends_with("_nsec") && struct_.ident().starts_with("stat") => {
Some(s.replace("e_nsec", ".tv_nsec"))
}

// FIXME(cygwin): sigaction actually contains a union with two variants:
// a sa_sigaction with type: (*)(int, struct __siginfo *, void *)
// a sa_handler with type sig_t
Expand Down Expand Up @@ -1046,10 +1033,6 @@ fn test_solarish(target: &str) {
match struct_.ident() {
// rust struct was committed with typo for Solaris
"door_arg_t" if field.ident() == "dec_num" => Some("desc_num".to_string()),
"stat" if field.ident().ends_with("_nsec") => {
// expose stat.Xtim.tv_nsec fields
Some(field.ident().trim_end_matches("e_nsec").to_string() + ".tv_nsec")
}
_ => None,
}
});
Expand Down Expand Up @@ -1324,17 +1307,6 @@ fn test_netbsd(target: &str) {
_ => None,
});

cfg.rename_struct_field(move |struct_, field| {
match field.ident() {
// Our stat *_nsec fields normally don't actually exist but are part
// of a timeval struct
s if s.ends_with("_nsec") && struct_.ident().starts_with("stat") => {
Some(s.replace("e_nsec", ".tv_nsec"))
}
_ => None,
}
});

cfg.alias_is_c_enum(|ty| ty == "fae_action");

cfg.skip_alias(move |ty| {
Expand Down Expand Up @@ -1619,11 +1591,6 @@ fn test_dragonflybsd(target: &str) {

cfg.rename_struct_field(move |struct_, field| {
match field.ident() {
// Our stat *_nsec fields normally don't actually exist but are part
// of a timeval struct
s if s.ends_with("_nsec") && struct_.ident().starts_with("stat") => {
Some(s.replace("e_nsec", ".tv_nsec"))
}
// 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_.ident() == "rtprio" => Some("type".to_string()),
Expand Down Expand Up @@ -1984,13 +1951,6 @@ fn test_android(target: &str) {

cfg.rename_struct_field(move |struct_, field| {
match (struct_.ident(), field.ident()) {
// Our stat *_nsec fields normally don't actually exist but are part
// of a timeval struct
("stat" | "statfs" | "statvfs" | "stat64" | "statfs64" | "statvfs64", f)
if f.ends_with("_nsec") =>
{
Some(f.to_string())
}
// The following structs have a field called `type` in C,
// but `type` is a Rust keyword, so these fields are translated
// to `type_` in Rust.
Expand Down Expand Up @@ -2481,11 +2441,6 @@ fn test_freebsd(target: &str) {
cfg.rename_struct_field(|struct_, field_| {
let struct_ = struct_.ident();
let replacement = match field_.ident() {
// Our stat *_nsec fields normally don't actually exist but are part
// of a timeval struct
s if s.ends_with("_nsec") && struct_.starts_with("stat") => {
s.replace("e_nsec", ".tv_nsec")
}
// 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" => "type".to_string(),
Expand Down Expand Up @@ -3068,17 +3023,6 @@ fn test_emscripten(target: &str) {
}
});

cfg.rename_struct_field(move |struct_, field| {
match field.ident() {
// Our stat *_nsec fields normally don't actually exist but are part
// of a timeval struct
s if s.ends_with("_nsec") && struct_.ident().starts_with("stat") => {
Some(s.replace("e_nsec", ".tv_nsec"))
}
_ => None,
}
});

cfg.skip_alias(move |ty| {
match ty.ident() {
// sighandler_t is crazy across platforms
Expand Down Expand Up @@ -3989,14 +3933,6 @@ fn test_linux(target: &str) {

cfg.rename_struct_field(move |struct_, field| {
match (struct_.ident(), field.ident()) {
// Our stat *_nsec fields normally don't actually exist but are part
// of a timeval struct - this is fixed in musl_v1_2_3
("stat" | "statfs" | "statvfs" | "stat64" | "statfs64" | "statvfs64", f)
if !musl_v1_2_3 && f.ends_with("_nsec") =>
{
Some(f.replace("e_nsec", ".tv_nsec"))
}

// FIXME(linux): epoll_event.data is actually a union in C, but in Rust
// it is only a u64 because we only expose one field
// http://man7.org/linux/man-pages/man2/epoll_wait.2.html
Expand Down Expand Up @@ -5262,17 +5198,6 @@ fn test_haiku(target: &str) {

cfg.skip_struct_field(move |struct_, field| {
match (struct_.ident(), field.ident()) {
// FIXME(time): the stat struct actually has timespec members, whereas
// the current representation has these unpacked.
("stat", "st_atime") => true,
("stat", "st_atime_nsec") => true,
("stat", "st_mtime") => true,
("stat", "st_mtime_nsec") => true,
("stat", "st_ctime") => true,
("stat", "st_ctime_nsec") => true,
("stat", "st_crtime") => true,
("stat", "st_crtime_nsec") => true,

// these are actually unions, but we cannot represent it well
("sem_t", "named_sem_id") => true,
("sigaction", "sa_sigaction") => true,
Expand Down
18 changes: 6 additions & 12 deletions src/fuchsia/aarch64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,9 @@ s! {
pub st_blksize: crate::blksize_t,
__pad1: Padding<c_int>,
pub st_blocks: crate::blkcnt_t,
pub st_atime: crate::time_t,
pub st_atime_nsec: c_long,
pub st_mtime: crate::time_t,
pub st_mtime_nsec: c_long,
pub st_ctime: crate::time_t,
pub st_ctime_nsec: c_long,
pub st_atim: crate::timespec,
pub st_mtim: crate::timespec,
pub st_ctim: crate::timespec,
__unused: Padding<[c_uint; 2]>,
}

Expand All @@ -42,12 +39,9 @@ s! {
pub st_blksize: crate::blksize_t,
__pad1: Padding<c_int>,
pub st_blocks: crate::blkcnt_t,
pub st_atime: crate::time_t,
pub st_atime_nsec: c_long,
pub st_mtime: crate::time_t,
pub st_mtime_nsec: c_long,
pub st_ctime: crate::time_t,
pub st_ctime_nsec: c_long,
pub st_atim: crate::timespec,
pub st_mtim: crate::timespec,
pub st_ctim: crate::timespec,
__unused: Padding<[c_uint; 2]>,
}

Expand Down
9 changes: 3 additions & 6 deletions src/fuchsia/riscv64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,9 @@ s! {
pub st_size: off_t,
pub st_blksize: crate::blksize_t,
pub st_blocks: crate::blkcnt_t,
pub st_atime: crate::time_t,
pub st_atime_nsec: c_long,
pub st_mtime: crate::time_t,
pub st_mtime_nsec: c_long,
pub st_ctime: crate::time_t,
pub st_ctime_nsec: c_long,
pub st_atim: crate::timespec,
pub st_mtim: crate::timepsec,
pub st_ctim: crate::timespec,
__unused: Padding<[c_long; 3]>,
}

Expand Down
18 changes: 6 additions & 12 deletions src/fuchsia/x86_64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,9 @@ s! {
pub st_size: off_t,
pub st_blksize: crate::blksize_t,
pub st_blocks: crate::blkcnt_t,
pub st_atime: crate::time_t,
pub st_atime_nsec: c_long,
pub st_mtime: crate::time_t,
pub st_mtime_nsec: c_long,
pub st_ctime: crate::time_t,
pub st_ctime_nsec: c_long,
pub st_atim: crate::timespec,
pub st_mtim: crate::timespec,
pub st_ctim: crate::timespec,
__unused: Padding<[c_long; 3]>,
}

Expand All @@ -40,12 +37,9 @@ s! {
pub st_size: off_t,
pub st_blksize: crate::blksize_t,
pub st_blocks: crate::blkcnt64_t,
pub st_atime: crate::time_t,
pub st_atime_nsec: c_long,
pub st_mtime: crate::time_t,
pub st_mtime_nsec: c_long,
pub st_ctime: crate::time_t,
pub st_ctime_nsec: c_long,
pub st_atim: crate::timespec,
pub st_mtim: crate::timespec,
pub st_ctim: crate::timespec,
__reserved: Padding<[c_long; 3]>,
}

Expand Down
9 changes: 3 additions & 6 deletions src/unix/bsd/freebsdlike/dragonfly/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,9 @@ s! {
pub st_uid: crate::uid_t,
pub st_gid: crate::gid_t,
pub st_rdev: crate::dev_t,
pub st_atime: crate::time_t,
pub st_atime_nsec: c_long,
pub st_mtime: crate::time_t,
pub st_mtime_nsec: c_long,
pub st_ctime: crate::time_t,
pub st_ctime_nsec: c_long,
pub st_atim: crate::timespec,
pub st_mtim: crate::timespec,
pub st_ctim: crate::timespec,
pub st_size: off_t,
pub st_blocks: i64,
pub __old_st_blksize: u32,
Expand Down
12 changes: 4 additions & 8 deletions src/unix/bsd/freebsdlike/freebsd/freebsd11/b32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,16 @@ s! {
pub st_uid: crate::uid_t,
pub st_gid: crate::gid_t,
pub st_rdev: crate::dev_t,
pub st_atime: crate::time_t,
pub st_atime_nsec: c_long,
pub st_mtime: crate::time_t,
pub st_mtime_nsec: c_long,
pub st_ctime: crate::time_t,
pub st_ctime_nsec: c_long,
pub st_atim: crate::timespec,
pub st_mtim: crate::timespec,
pub st_ctim: crate::timespec,
pub st_size: off_t,
pub st_blocks: crate::blkcnt_t,
pub st_blksize: crate::blksize_t,
pub st_flags: crate::fflags_t,
pub st_gen: u32,
pub st_lspare: i32,
pub st_birthtime: crate::time_t,
pub st_birthtime_nsec: c_long,
pub st_birthtim: crate::timespec,
__unused: Padding<[u8; 8]>,
}
}
13 changes: 4 additions & 9 deletions src/unix/bsd/freebsdlike/freebsd/freebsd11/b64.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::off_t;
use crate::prelude::*;

s! {
pub struct stat {
Expand All @@ -10,19 +9,15 @@ s! {
pub st_uid: crate::uid_t,
pub st_gid: crate::gid_t,
pub st_rdev: crate::dev_t,
pub st_atime: crate::time_t,
pub st_atime_nsec: c_long,
pub st_mtime: crate::time_t,
pub st_mtime_nsec: c_long,
pub st_ctime: crate::time_t,
pub st_ctime_nsec: c_long,
pub st_atim: crate::timespec,
pub st_mtim: crate::timespec,
pub st_ctim: crate::timespec,
pub st_size: off_t,
pub st_blocks: crate::blkcnt_t,
pub st_blksize: crate::blksize_t,
pub st_flags: crate::fflags_t,
pub st_gen: u32,
pub st_lspare: i32,
pub st_birthtime: crate::time_t,
pub st_birthtime_nsec: c_long,
pub st_birthtim: crate::timespec,
}
}
12 changes: 4 additions & 8 deletions src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,20 +233,16 @@ s! {
pub st_rdev: crate::dev_t,
#[cfg(target_arch = "x86")]
st_atim_ext: i32,
pub st_atime: crate::time_t,
pub st_atime_nsec: c_long,
pub st_atim: crate::timespec,
#[cfg(target_arch = "x86")]
st_mtim_ext: i32,
pub st_mtime: crate::time_t,
pub st_mtime_nsec: c_long,
pub st_mtim: crate::timespec,
#[cfg(target_arch = "x86")]
st_ctim_ext: i32,
pub st_ctime: crate::time_t,
pub st_ctime_nsec: c_long,
pub st_ctim: crate::timespec,
#[cfg(target_arch = "x86")]
st_btim_ext: i32,
pub st_birthtime: crate::time_t,
pub st_birthtime_nsec: c_long,
pub st_birthtim: crate::timespec,
pub st_size: off_t,
pub st_blocks: crate::blkcnt_t,
pub st_blksize: crate::blksize_t,
Expand Down
12 changes: 4 additions & 8 deletions src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,20 +246,16 @@ s! {
pub st_rdev: crate::dev_t,
#[cfg(target_arch = "x86")]
st_atim_ext: i32,
pub st_atime: crate::time_t,
pub st_atime_nsec: c_long,
pub st_atim: crate::timespec,
#[cfg(target_arch = "x86")]
st_mtim_ext: i32,
pub st_mtime: crate::time_t,
pub st_mtime_nsec: c_long,
pub st_mtim: crate::timespec,
#[cfg(target_arch = "x86")]
st_ctim_ext: i32,
pub st_ctime: crate::time_t,
pub st_ctime_nsec: c_long,
pub st_ctim: crate::timespec,
#[cfg(target_arch = "x86")]
st_btim_ext: i32,
pub st_birthtime: crate::time_t,
pub st_birthtime_nsec: c_long,
pub st_birthtim: crate::timespec,
pub st_size: off_t,
pub st_blocks: crate::blkcnt_t,
pub st_blksize: crate::blksize_t,
Expand Down
12 changes: 4 additions & 8 deletions src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,20 +247,16 @@ s! {
pub st_rdev: crate::dev_t,
#[cfg(target_arch = "x86")]
st_atim_ext: i32,
pub st_atime: crate::time_t,
pub st_atime_nsec: c_long,
pub st_atim: crate::timespec,
#[cfg(target_arch = "x86")]
st_mtim_ext: i32,
pub st_mtime: crate::time_t,
pub st_mtime_nsec: c_long,
pub st_mtim: crate::timespec,
#[cfg(target_arch = "x86")]
st_ctim_ext: i32,
pub st_ctime: crate::time_t,
pub st_ctime_nsec: c_long,
pub st_ctim: crate::timespec,
#[cfg(target_arch = "x86")]
st_btim_ext: i32,
pub st_birthtime: crate::time_t,
pub st_birthtime_nsec: c_long,
pub st_birthtim: crate::timespec,
pub st_size: off_t,
pub st_blocks: crate::blkcnt_t,
pub st_blksize: crate::blksize_t,
Expand Down
12 changes: 4 additions & 8 deletions src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,20 +249,16 @@ s! {
pub st_rdev: crate::dev_t,
#[cfg(target_arch = "x86")]
st_atim_ext: i32,
pub st_atime: crate::time_t,
pub st_atime_nsec: c_long,
pub st_atim: crate::timespec,
#[cfg(target_arch = "x86")]
st_mtim_ext: i32,
pub st_mtime: crate::time_t,
pub st_mtime_nsec: c_long,
pub st_mtim: crate::timespec,
#[cfg(target_arch = "x86")]
st_ctim_ext: i32,
pub st_ctime: crate::time_t,
pub st_ctime_nsec: c_long,
pub st_ctim: crate::timespec,
#[cfg(target_arch = "x86")]
st_btim_ext: i32,
pub st_birthtime: crate::time_t,
pub st_birthtime_nsec: c_long,
pub st_birthtim: crate::timespec,
pub st_size: off_t,
pub st_blocks: crate::blkcnt_t,
pub st_blksize: crate::blksize_t,
Expand Down
Loading