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
6 changes: 6 additions & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5587,6 +5587,12 @@ fn test_aix(target: &str) {
// The field 'data' is actually a unnamed union in the AIX header.
"pollfd_ext" if field.ident() == "data" => true,

// On AIX, <stat.h> declares 'tv_nsec' as 'long', but the
// underlying system calls return a 32-bit value in both 32-bit
// and 64-bit modes. In the 'libc' crate it is declared as 'i32'
// to match the system call. Skip this field.
"timespec" if field.ident() == "tv_nsec" => true,

_ => false,
}
});
Expand Down
9 changes: 9 additions & 0 deletions src/unix/aix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,15 @@ s! {
pub tv_nsec: c_int,
}

// On AIX, <stat.h> declares 'tv_nsec' as 'long', but the underlying
// system calls return a 4-byte value in both 32-bit and 64-bit modes.
// It is declared as 'c_int' here to avoid using the other undefined 4
// bytes in the 64-bit mode.
pub struct timespec {
pub tv_sec: time_t,
pub tv_nsec: c_int,
}

pub struct statfs64 {
pub f_version: c_int,
pub f_type: c_int,
Expand Down
2 changes: 1 addition & 1 deletion src/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ s! {

// linux x32 compatibility
// See https://sourceware.org/bugzilla/show_bug.cgi?id=16437
#[cfg(not(target_env = "gnu"))]
#[cfg(all(not(target_env = "gnu"), not(target_os = "aix")))]
pub struct timespec {
pub tv_sec: time_t,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
Expand Down
Loading