about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorGraydon Hoare <graydon@mozilla.com>2012-11-21 15:35:47 -0800
committerGraydon Hoare <graydon@mozilla.com>2012-11-21 15:35:47 -0800
commit0c8a009dc993e8bad278bacba425f3daf3edfa96 (patch)
tree69116985f72ebb175acb6df2039f928b7fcb1dbe /src/libcore
parentef833d41014481acdfc19bfd50f27f662dba8a2b (diff)
downloadrust-0c8a009dc993e8bad278bacba425f3daf3edfa96.tar.gz
rust-0c8a009dc993e8bad278bacba425f3daf3edfa96.zip
libcore: fix build breakage on win32 stat.
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/libc.rs21
-rw-r--r--src/libcore/path.rs3
2 files changed, 21 insertions, 3 deletions
diff --git a/src/libcore/libc.rs b/src/libcore/libc.rs
index be932ce5558..03ff6ac0be9 100644
--- a/src/libcore/libc.rs
+++ b/src/libcore/libc.rs
@@ -13,10 +13,17 @@
 * * ISO 9945:2001 / IEEE 1003.1-2001 ('POSIX:2001', 'SUSv3').
 * * ISO 9945:2008 / IEEE 1003.1-2008 ('POSIX:2008', 'SUSv4').
 *
+* Note that any reference to the 1996 revision of POSIX, or any revs
+* between 1990 (when '88 was approved at ISO) and 2001 (when the next
+* actual revision-revision happened), are merely additions of other
+* chapters (1b and 1c) outside the core interfaces.
+*
 * Despite having several names each, these are *reasonably* coherent
 * point-in-time, list-of-definition sorts of specs. You can get each under a
 * variety of names but will wind up with the same definition in each case.
 *
+* See standards(7) in linux-manpages for more details.
+*
 * Our interface to these libraries is complicated by the non-universality of
 * conformance to any of them. About the only thing universally supported is
 * the first (C95), beyond that definitions quickly become absent on various
@@ -124,7 +131,7 @@ pub use open, creat;
 pub use access, chdir, close, dup, dup2, execv, execve, execvp, getcwd,
 getpid, isatty, lseek, pipe, read, rmdir, unlink, write;
 
-pub use fstat, lstat, stat;
+pub use fstat, stat;
 
 
 mod types {
@@ -392,6 +399,8 @@ mod types {
     pub mod os {
         pub mod common {
             pub mod posix01 {
+                // Note: this is the struct called stat64 in win32. Not stat,
+                // nor stati64.
                 pub struct stat {
                     st_dev: dev_t,
                     st_ino: ino_t,
@@ -403,7 +412,7 @@ mod types {
                     st_size: int64_t,
                     st_atime: time64_t,
                     st_mtime: time64_t,
-                    st_c_time: time64_t,
+                    st_ctime: time64_t,
                 }
             }
         }
@@ -479,6 +488,8 @@ mod types {
                 pub type PBOOL = *mut BOOL;
                 pub type WCHAR = wchar_t;
                 pub type WORD = u16;
+
+                pub type time64_t = i64;
             }
         }
     }
@@ -1025,6 +1036,12 @@ pub mod funcs {
 
             #[link_name = "_mkdir"]
             fn mkdir(path: *c_char) -> c_int;
+
+            #[link_name = "_fstat64"]
+            fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
+
+            #[link_name = "_stat64"]
+            fn stat(path: *c_char, buf: *mut stat) -> c_int;
         }
 
         #[nolink]
diff --git a/src/libcore/path.rs b/src/libcore/path.rs
index a31be1ab15b..8b5e383ed94 100644
--- a/src/libcore/path.rs
+++ b/src/libcore/path.rs
@@ -190,7 +190,7 @@ mod stat {
     }
 }
 
-#[cfg(target_os = "windows")]
+#[cfg(target_os = "win32")]
 mod stat {
     pub mod arch {
         pub fn default_stat() -> libc::stat {
@@ -222,6 +222,7 @@ impl Path {
         }
     }
 
+    #[cfg(unix)]
     fn lstat(&self) -> Option<libc::stat> {
          do str::as_c_str(self.to_str()) |buf| {
             let mut st = stat::arch::default_stat();