From 84300a22f7b84c8e84ac9c0c7079df04a8bef6b5 Mon Sep 17 00:00:00 2001 From: arcnmx Date: Mon, 18 Apr 2016 23:39:25 -0400 Subject: [PATCH 1/3] Add some missing SFlags --- src/sys/stat.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/sys/stat.rs b/src/sys/stat.rs index cd142a9600..6048b9da14 100644 --- a/src/sys/stat.rs +++ b/src/sys/stat.rs @@ -18,11 +18,14 @@ mod ffi { bitflags!( flags SFlag: mode_t { - const S_IFREG = 0o100000, + const S_IFIFO = 0o010000, const S_IFCHR = 0o020000, + const S_IFDIR = 0o040000, const S_IFBLK = 0o060000, - const S_IFIFO = 0o010000, - const S_IFSOCK = 0o140000 + const S_IFREG = 0o100000, + const S_IFLNK = 0o120000, + const S_IFSOCK = 0o140000, + const S_IFMT = 0o170000 } ); From b8e192bd4398efecf2069be0cba4501bdc771091 Mon Sep 17 00:00:00 2001 From: arcnmx Date: Tue, 19 Apr 2016 09:40:04 -0400 Subject: [PATCH 2/3] Use constants from libc --- src/sys/stat.rs | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/sys/stat.rs b/src/sys/stat.rs index 6048b9da14..50b96de026 100644 --- a/src/sys/stat.rs +++ b/src/sys/stat.rs @@ -2,7 +2,7 @@ pub use libc::dev_t; pub use libc::stat as FileStat; use {Errno, Result, NixPath}; -use libc::mode_t; +use libc::{self, mode_t}; use std::mem; use std::os::unix::io::RawFd; @@ -18,33 +18,33 @@ mod ffi { bitflags!( flags SFlag: mode_t { - const S_IFIFO = 0o010000, - const S_IFCHR = 0o020000, - const S_IFDIR = 0o040000, - const S_IFBLK = 0o060000, - const S_IFREG = 0o100000, - const S_IFLNK = 0o120000, - const S_IFSOCK = 0o140000, - const S_IFMT = 0o170000 + const S_IFIFO = libc::S_IFIFO, + const S_IFCHR = libc::S_IFCHR, + const S_IFDIR = libc::S_IFDIR, + const S_IFBLK = libc::S_IFBLK, + const S_IFREG = libc::S_IFREG, + const S_IFLNK = libc::S_IFLNK, + const S_IFSOCK = libc::S_IFSOCK, + const S_IFMT = libc::S_IFMT, } ); bitflags! { flags Mode: mode_t { - const S_IRWXU = 0o0700, - const S_IRUSR = 0o0400, - const S_IWUSR = 0o0200, - const S_IXUSR = 0o0100, - - const S_IRWXG = 0o0070, - const S_IRGRP = 0o0040, - const S_IWGRP = 0o0020, - const S_IXGRP = 0o0010, - - const S_IRWXO = 0o0007, - const S_IROTH = 0o0004, - const S_IWOTH = 0o0002, - const S_IXOTH = 0o0001, + const S_IRWXU = libc::S_IRWXU, + const S_IRUSR = libc::S_IRUSR, + const S_IWUSR = libc::S_IWUSR, + const S_IXUSR = libc::S_IXUSR, + + const S_IRWXG = libc::S_IRWXG, + const S_IRGRP = libc::S_IRGRP, + const S_IWGRP = libc::S_IWGRP, + const S_IXGRP = libc::S_IXGRP, + + const S_IRWXO = libc::S_IRWXO, + const S_IROTH = libc::S_IROTH, + const S_IWOTH = libc::S_IWOTH, + const S_IXOTH = libc::S_IXOTH, const S_ISUID = 0o4000, const S_ISGID = 0o2000, From 70362e2f75bc66e6e1277451b781e668440f647b Mon Sep 17 00:00:00 2001 From: arcnmx Date: Wed, 20 Apr 2016 10:46:18 -0400 Subject: [PATCH 3/3] Last few constants --- src/sys/stat.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sys/stat.rs b/src/sys/stat.rs index 50b96de026..076fe93347 100644 --- a/src/sys/stat.rs +++ b/src/sys/stat.rs @@ -46,9 +46,9 @@ bitflags! { const S_IWOTH = libc::S_IWOTH, const S_IXOTH = libc::S_IXOTH, - const S_ISUID = 0o4000, - const S_ISGID = 0o2000, - const S_ISVTX = 0o1000, + const S_ISUID = libc::S_ISUID as mode_t, + const S_ISGID = libc::S_ISGID as mode_t, + const S_ISVTX = libc::S_ISVTX as mode_t, } }