about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPeter Atashian <retep998@gmail.com>2014-08-07 04:05:00 -0400
committerPeter Atashian <retep998@gmail.com>2014-08-07 04:05:00 -0400
commitfeb219d23fd4236fc69ec86e34c088e232289534 (patch)
tree460d17654ca883be34400eef5f1a17e0d8d54073 /src
parent51e19e750185f60e404412f702f8f2edc7bc1245 (diff)
downloadrust-feb219d23fd4236fc69ec86e34c088e232289534.tar.gz
rust-feb219d23fd4236fc69ec86e34c088e232289534.zip
windows: Fix several tests on 64-bit.
Signed-off-by: Peter Atashian <retep998@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/liblibc/lib.rs21
-rw-r--r--src/libnative/io/c_win32.rs12
-rw-r--r--src/libnative/io/util.rs8
-rw-r--r--src/libstd/io/fs.rs9
4 files changed, 34 insertions, 16 deletions
diff --git a/src/liblibc/lib.rs b/src/liblibc/lib.rs
index 1bc64ffcc92..fa29ab508ff 100644
--- a/src/liblibc/lib.rs
+++ b/src/liblibc/lib.rs
@@ -1142,18 +1142,17 @@ pub mod types {
     pub mod os {
         pub mod common {
             pub mod posix01 {
-                use types::os::arch::c95::{c_short, time_t, suseconds_t,
+                use types::os::arch::c95::{c_short, time_t,
                                                  c_long};
                 use types::os::arch::extra::{int64, time64_t};
                 use types::os::arch::posix88::{dev_t, ino_t};
-                use types::os::arch::posix88::mode_t;
 
                 // pub Note: this is the struct called stat64 in win32. Not stat,
                 // nor stati64.
                 pub struct stat {
                     pub st_dev: dev_t,
                     pub st_ino: ino_t,
-                    pub st_mode: mode_t,
+                    pub st_mode: u16,
                     pub st_nlink: c_short,
                     pub st_uid: c_short,
                     pub st_gid: c_short,
@@ -1171,8 +1170,8 @@ pub mod types {
                 }
 
                 pub struct timeval {
-                    pub tv_sec: time_t,
-                    pub tv_usec: suseconds_t,
+                    pub tv_sec: c_long,
+                    pub tv_usec: c_long,
                 }
 
                 pub struct timespec {
@@ -1186,7 +1185,7 @@ pub mod types {
             pub mod bsd44 {
                 use types::os::arch::c95::{c_char, c_int, c_uint, size_t};
 
-                pub type SOCKET = c_uint;
+                pub type SOCKET = uint;
                 pub type socklen_t = c_int;
                 pub type sa_family_t = u16;
                 pub type in_port_t = u16;
@@ -1197,6 +1196,7 @@ pub mod types {
                 }
                 pub struct sockaddr_storage {
                     pub ss_family: sa_family_t,
+                    pub __ss_pad1: [u8, ..6],
                     pub __ss_align: i64,
                     pub __ss_pad2: [u8, ..112],
                 }
@@ -1293,12 +1293,9 @@ pub mod types {
             pub mod posix88 {
                 pub type off_t = i32;
                 pub type dev_t = u32;
-                pub type ino_t = i16;
+                pub type ino_t = u16;
 
-                #[cfg(target_arch = "x86")]
-                pub type pid_t = i32;
-                #[cfg(target_arch = "x86_64")]
-                pub type pid_t = i64;
+                pub type pid_t = u32;
 
                 pub type useconds_t = u32;
                 pub type mode_t = u16;
@@ -1415,7 +1412,7 @@ pub mod types {
                     pub dwPageSize: DWORD,
                     pub lpMinimumApplicationAddress: LPVOID,
                     pub lpMaximumApplicationAddress: LPVOID,
-                    pub dwActiveProcessorMask: DWORD,
+                    pub dwActiveProcessorMask: uint,
                     pub dwNumberOfProcessors: DWORD,
                     pub dwProcessorType: DWORD,
                     pub dwAllocationGranularity: DWORD,
diff --git a/src/libnative/io/c_win32.rs b/src/libnative/io/c_win32.rs
index 482155c339c..80c9e91b48f 100644
--- a/src/libnative/io/c_win32.rs
+++ b/src/libnative/io/c_win32.rs
@@ -28,6 +28,7 @@ pub static ENABLE_PROCESSED_INPUT: libc::DWORD = 0x1;
 pub static ENABLE_QUICK_EDIT_MODE: libc::DWORD = 0x40;
 
 #[repr(C)]
+#[cfg(target_arch = "x86")]
 pub struct WSADATA {
     pub wVersion: libc::WORD,
     pub wHighVersion: libc::WORD,
@@ -37,6 +38,17 @@ pub struct WSADATA {
     pub iMaxUdpDg: u16,
     pub lpVendorInfo: *mut u8,
 }
+#[repr(C)]
+#[cfg(target_arch = "x86_64")]
+pub struct WSADATA {
+    pub wVersion: libc::WORD,
+    pub wHighVersion: libc::WORD,
+    pub iMaxSockets: u16,
+    pub iMaxUdpDg: u16,
+    pub lpVendorInfo: *mut u8,
+    pub szDescription: [u8, ..WSADESCRIPTION_LEN + 1],
+    pub szSystemStatus: [u8, ..WSASYS_STATUS_LEN + 1],
+}
 
 pub type LPWSADATA = *mut WSADATA;
 
diff --git a/src/libnative/io/util.rs b/src/libnative/io/util.rs
index 06046cc74cf..97518bbf199 100644
--- a/src/libnative/io/util.rs
+++ b/src/libnative/io/util.rs
@@ -52,6 +52,14 @@ pub fn eof() -> IoError {
     }
 }
 
+#[cfg(windows)]
+pub fn ms_to_timeval(ms: u64) -> libc::timeval {
+    libc::timeval {
+        tv_sec: (ms / 1000) as libc::c_long,
+        tv_usec: ((ms % 1000) * 1000) as libc::c_long,
+    }
+}
+#[cfg(not(windows))]
 pub fn ms_to_timeval(ms: u64) -> libc::timeval {
     libc::timeval {
         tv_sec: (ms / 1000) as libc::time_t,
diff --git a/src/libstd/io/fs.rs b/src/libstd/io/fs.rs
index 246ff901f5c..e0a6c702627 100644
--- a/src/libstd/io/fs.rs
+++ b/src/libstd/io/fs.rs
@@ -1592,10 +1592,11 @@ mod test {
         let tmpdir = tmpdir();
         let path = tmpdir.join("a");
         check!(File::create(&path));
-
-        check!(change_file_times(&path, 1000, 2000));
-        assert_eq!(check!(path.stat()).accessed, 1000);
-        assert_eq!(check!(path.stat()).modified, 2000);
+        // These numbers have to be bigger than the time in the day to account for timezones
+        // Windows in particular will fail in certain timezones with small enough values
+        check!(change_file_times(&path, 100000, 200000));
+        assert_eq!(check!(path.stat()).accessed, 100000);
+        assert_eq!(check!(path.stat()).modified, 200000);
     })
 
     iotest!(fn utime_noexist() {