From 60245b9290388671edac86d6db1619f60a9ccb68 Mon Sep 17 00:00:00 2001 From: Ziad Hatahet Date: Tue, 22 Oct 2013 18:25:07 -0700 Subject: Remove thread-blocking call to `libc::stat` in `Path::stat` Fixes #9958 --- src/libstd/rt/io/file.rs | 4 ++-- src/libstd/rt/io/mod.rs | 6 ++++++ src/libstd/rt/uv/uvio.rs | 3 +++ 3 files changed, 11 insertions(+), 2 deletions(-) (limited to 'src/libstd/rt') diff --git a/src/libstd/rt/io/file.rs b/src/libstd/rt/io/file.rs index a5d593d2454..e25b03be361 100644 --- a/src/libstd/rt/io/file.rs +++ b/src/libstd/rt/io/file.rs @@ -59,8 +59,8 @@ use path::Path; /// }).inside { /// let stream = match open(p, Create, ReadWrite) { /// Some(s) => s, -/// None => fail!("whoops! I'm sure this raised, anyways.."); -/// } +/// None => fail!("whoops! I'm sure this raised, anyways..") +/// }; /// // do some stuff with that stream /// /// // the file stream will be closed at the end of this block diff --git a/src/libstd/rt/io/mod.rs b/src/libstd/rt/io/mod.rs index c0971b5d3cd..97d44da765a 100644 --- a/src/libstd/rt/io/mod.rs +++ b/src/libstd/rt/io/mod.rs @@ -654,6 +654,12 @@ pub struct FileStat { is_file: bool, /// `true` if the file pointed at by the `PathInfo` is a directory is_dir: bool, + /// The file pointed at by the `PathInfo`'s device + device: u64, + /// The file pointed at by the `PathInfo`'s mode + mode: u64, + /// The file pointed at by the `PathInfo`'s inode + inode: u64, /// The file pointed at by the `PathInfo`'s size in bytes size: u64, /// The file pointed at by the `PathInfo`'s creation time diff --git a/src/libstd/rt/uv/uvio.rs b/src/libstd/rt/uv/uvio.rs index d5893d6d014..c7e51b3485d 100644 --- a/src/libstd/rt/uv/uvio.rs +++ b/src/libstd/rt/uv/uvio.rs @@ -635,6 +635,9 @@ impl IoFactory for UvIoFactory { path: Path::new(path_str.as_slice()), is_file: stat.is_file(), is_dir: stat.is_dir(), + device: stat.st_dev, + mode: stat.st_mode, + inode: stat.st_ino, size: stat.st_size, created: stat.st_ctim.tv_sec as u64, modified: stat.st_mtim.tv_sec as u64, -- cgit 1.4.1-3-g733a5 From dabf3774385aeddaa58b7b25ee39f6034a786b35 Mon Sep 17 00:00:00 2001 From: Ziad Hatahet Date: Wed, 23 Oct 2013 11:16:35 -0700 Subject: Made uv_stat_t.{st_dev, st_ino} public, #9958 --- src/libstd/rt/uv/uvll.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/libstd/rt') diff --git a/src/libstd/rt/uv/uvll.rs b/src/libstd/rt/uv/uvll.rs index 96c5dd068d0..367585b0f0e 100644 --- a/src/libstd/rt/uv/uvll.rs +++ b/src/libstd/rt/uv/uvll.rs @@ -138,13 +138,13 @@ pub struct uv_timespec_t { } pub struct uv_stat_t { - priv st_dev: libc::uint64_t, + st_dev: libc::uint64_t, st_mode: libc::uint64_t, priv st_nlink: libc::uint64_t, priv st_uid: libc::uint64_t, priv st_gid: libc::uint64_t, priv st_rdev: libc::uint64_t, - priv st_ino: libc::uint64_t, + st_ino: libc::uint64_t, st_size: libc::uint64_t, priv st_blksize: libc::uint64_t, priv st_blocks: libc::uint64_t, -- cgit 1.4.1-3-g733a5