Skip to content

Commit

Permalink
Fix timespec, stat, stat64 for linux x32
Browse files Browse the repository at this point in the history
  • Loading branch information
malbarbo committed Oct 18, 2017
1 parent 4774254 commit bbc2cfa
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
7 changes: 6 additions & 1 deletion src/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,14 @@ s! {
pub tv_usec: suseconds_t,
}

// linux x32 compatibility
// See https://sourceware.org/bugzilla/show_bug.cgi?id=16437
pub struct timespec {
pub tv_sec: time_t,
pub tv_nsec: c_long,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
pub tv_nsec: i64,
#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
pub tv_nsec: ::c_long,
}

pub struct rlimit {
Expand Down
20 changes: 10 additions & 10 deletions src/unix/notbsd/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,26 +216,26 @@ s! {
// x32 compatibility
// See https://sourceware.org/bugzilla/show_bug.cgi?id=21279
pub struct mq_attr {
#[cfg(target_arch = "x86_64")]
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
pub mq_flags: i64,
#[cfg(target_arch = "x86_64")]
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
pub mq_maxmsg: i64,
#[cfg(target_arch = "x86_64")]
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
pub mq_msgsize: i64,
#[cfg(target_arch = "x86_64")]
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
pub mq_curmsgs: i64,
#[cfg(target_arch = "x86_64")]
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
pad: [i64; 4],

#[cfg(not(target_arch = "x86_64"))]
#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
pub mq_flags: ::c_long,
#[cfg(not(target_arch = "x86_64"))]
#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
pub mq_maxmsg: ::c_long,
#[cfg(not(target_arch = "x86_64"))]
#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
pub mq_msgsize: ::c_long,
#[cfg(not(target_arch = "x86_64"))]
#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
pub mq_curmsgs: ::c_long,
#[cfg(not(target_arch = "x86_64"))]
#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
pad: [::c_long; 4],
}

Expand Down
12 changes: 6 additions & 6 deletions src/unix/notbsd/linux/other/b64/x86_64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ s! {
pub st_blksize: ::blksize_t,
pub st_blocks: ::blkcnt_t,
pub st_atime: ::time_t,
pub st_atime_nsec: ::c_long,
pub st_atime_nsec: i64,
pub st_mtime: ::time_t,
pub st_mtime_nsec: ::c_long,
pub st_mtime_nsec: i64,
pub st_ctime: ::time_t,
pub st_ctime_nsec: ::c_long,
pub st_ctime_nsec: i64,
__unused: [::c_long; 3],
}

Expand All @@ -43,11 +43,11 @@ s! {
pub st_blksize: ::blksize_t,
pub st_blocks: ::blkcnt64_t,
pub st_atime: ::time_t,
pub st_atime_nsec: ::c_long,
pub st_atime_nsec: i64,
pub st_mtime: ::time_t,
pub st_mtime_nsec: ::c_long,
pub st_mtime_nsec: i64,
pub st_ctime: ::time_t,
pub st_ctime_nsec: ::c_long,
pub st_ctime_nsec: i64,
__reserved: [::c_long; 3],
}

Expand Down

0 comments on commit bbc2cfa

Please sign in to comment.