Skip to content

Commit 0c8a009

Browse files
committed
libcore: fix build breakage on win32 stat.
1 parent ef833d4 commit 0c8a009

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

src/libcore/libc.rs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,17 @@
1313
* * ISO 9945:2001 / IEEE 1003.1-2001 ('POSIX:2001', 'SUSv3').
1414
* * ISO 9945:2008 / IEEE 1003.1-2008 ('POSIX:2008', 'SUSv4').
1515
*
16+
* Note that any reference to the 1996 revision of POSIX, or any revs
17+
* between 1990 (when '88 was approved at ISO) and 2001 (when the next
18+
* actual revision-revision happened), are merely additions of other
19+
* chapters (1b and 1c) outside the core interfaces.
20+
*
1621
* Despite having several names each, these are *reasonably* coherent
1722
* point-in-time, list-of-definition sorts of specs. You can get each under a
1823
* variety of names but will wind up with the same definition in each case.
1924
*
25+
* See standards(7) in linux-manpages for more details.
26+
*
2027
* Our interface to these libraries is complicated by the non-universality of
2128
* conformance to any of them. About the only thing universally supported is
2229
* the first (C95), beyond that definitions quickly become absent on various
@@ -124,7 +131,7 @@ pub use open, creat;
124131
pub use access, chdir, close, dup, dup2, execv, execve, execvp, getcwd,
125132
getpid, isatty, lseek, pipe, read, rmdir, unlink, write;
126133

127-
pub use fstat, lstat, stat;
134+
pub use fstat, stat;
128135

129136

130137
mod types {
@@ -392,6 +399,8 @@ mod types {
392399
pub mod os {
393400
pub mod common {
394401
pub mod posix01 {
402+
// Note: this is the struct called stat64 in win32. Not stat,
403+
// nor stati64.
395404
pub struct stat {
396405
st_dev: dev_t,
397406
st_ino: ino_t,
@@ -403,7 +412,7 @@ mod types {
403412
st_size: int64_t,
404413
st_atime: time64_t,
405414
st_mtime: time64_t,
406-
st_c_time: time64_t,
415+
st_ctime: time64_t,
407416
}
408417
}
409418
}
@@ -479,6 +488,8 @@ mod types {
479488
pub type PBOOL = *mut BOOL;
480489
pub type WCHAR = wchar_t;
481490
pub type WORD = u16;
491+
492+
pub type time64_t = i64;
482493
}
483494
}
484495
}
@@ -1025,6 +1036,12 @@ pub mod funcs {
10251036

10261037
#[link_name = "_mkdir"]
10271038
fn mkdir(path: *c_char) -> c_int;
1039+
1040+
#[link_name = "_fstat64"]
1041+
fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
1042+
1043+
#[link_name = "_stat64"]
1044+
fn stat(path: *c_char, buf: *mut stat) -> c_int;
10281045
}
10291046

10301047
#[nolink]

src/libcore/path.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ mod stat {
190190
}
191191
}
192192

193-
#[cfg(target_os = "windows")]
193+
#[cfg(target_os = "win32")]
194194
mod stat {
195195
pub mod arch {
196196
pub fn default_stat() -> libc::stat {
@@ -222,6 +222,7 @@ impl Path {
222222
}
223223
}
224224

225+
#[cfg(unix)]
225226
fn lstat(&self) -> Option<libc::stat> {
226227
do str::as_c_str(self.to_str()) |buf| {
227228
let mut st = stat::arch::default_stat();

0 commit comments

Comments
 (0)