summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco A L Barbosa <malbarbo@gmail.com>2017-10-18 10:33:59 -0200
committerMarco A L Barbosa <malbarbo@gmail.com>2017-10-18 21:07:36 -0200
commitbbc2cfa0969caea273c2ae018b2f08418078ed82 (patch)
treea761f892417995a83ad85d9e38344f73ac620ebf
parent477425435a2fefce81d6fda970af0e5325da1668 (diff)
downloadrust-libc-bbc2cfa0969caea273c2ae018b2f08418078ed82.tar.gz
Fix timespec, stat, stat64 for linux x32
-rw-r--r--src/unix/mod.rs7
-rw-r--r--src/unix/notbsd/linux/mod.rs20
-rw-r--r--src/unix/notbsd/linux/other/b64/x86_64.rs12
3 files changed, 22 insertions, 17 deletions
diff --git a/src/unix/mod.rs b/src/unix/mod.rs
index c2a45ff8f7..d326d8818c 100644
--- a/src/unix/mod.rs
+++ b/src/unix/mod.rs
@@ -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 {
diff --git a/src/unix/notbsd/linux/mod.rs b/src/unix/notbsd/linux/mod.rs
index a5a1a46247..93eed1cd70 100644
--- a/src/unix/notbsd/linux/mod.rs
+++ b/src/unix/notbsd/linux/mod.rs
@@ -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],
}
diff --git a/src/unix/notbsd/linux/other/b64/x86_64.rs b/src/unix/notbsd/linux/other/b64/x86_64.rs
index 81b2384a5e..bec275af53 100644
--- a/src/unix/notbsd/linux/other/b64/x86_64.rs
+++ b/src/unix/notbsd/linux/other/b64/x86_64.rs
@@ -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],
}
@@ -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],
}