diff --git a/include/bits/inttypes.h b/include/bits/inttypes.h index 996a450554e9c4af9463a2604d06ec254c706798..20e998c8dc8c8ace772573add45356911a894190 100644 --- a/include/bits/inttypes.h +++ b/include/bits/inttypes.h @@ -1,3 +1,6 @@ +#ifndef _BITS_INTTYPE_H +#define _BITS_INTTYPE_H + #define PRId8 "i" #define PRId16 "i" #define PRId32 "i" @@ -188,3 +191,5 @@ #define SCNoPTR "to" #define SCNuPTR "tu" #define SCNxPTR "tx" + +#endif diff --git a/include/bits/stat.h b/include/bits/stat.h new file mode 100644 index 0000000000000000000000000000000000000000..9f62d7ff4fcfe06ef0d3e6f09b16bee701341224 --- /dev/null +++ b/include/bits/stat.h @@ -0,0 +1,11 @@ +#ifndef _BITS_STAT_H +#define _BITS_STAT_H + +#define S_ISDIR(mode) mode & S_IFMT == S_IFDIR +#define S_ISCHR(mode) mode & S_IFMT == S_IFCHR +#define S_ISBLK(mode) mode & S_IFMT == S_IFBLK +#define S_ISREG(mode) mode & S_IFMT == S_IFREG +#define S_ISIFO(mode) mode & S_IFMT == S_IFIFO +#define S_ISLNK(mode) mode & S_IFMT == S_IFLNK + +#endif diff --git a/src/sys_stat/cbindgen.toml b/src/sys_stat/cbindgen.toml index 58eced99e18054bb142092c186cdd97f5be66cf4..cf9eef50c95a62566aaf901ecb4eb6e200e826b4 100644 --- a/src/sys_stat/cbindgen.toml +++ b/src/sys_stat/cbindgen.toml @@ -1,5 +1,6 @@ sys_includes = ["sys/types.h"] include_guard = "_SYS_STAT_H" +trailer = "#include <bits/stat.h>" language = "C" style = "Tag" diff --git a/src/sys_stat/src/lib.rs b/src/sys_stat/src/lib.rs index 5b4a389d7d4dc287ee17f7d9f4f7a61f8982173a..b34cb2480d313928854fb6571904eae778338ff7 100644 --- a/src/sys_stat/src/lib.rs +++ b/src/sys_stat/src/lib.rs @@ -6,31 +6,31 @@ extern crate platform; use platform::types::*; -pub const S_IFMT: c_int = 00170000; -pub const S_IFBLK: c_int = 0060000; -pub const S_IFCHR: c_int = 0020000; -pub const S_IFIFO: c_int = 0010000; -pub const S_IFREG: c_int = 0100000; -pub const S_IFDIR: c_int = 0040000; -pub const S_IFLNK: c_int = 0120000; - -pub const S_IRWXU: c_int = 00700; -pub const S_IRUSR: c_int = 00400; -pub const S_IWUSR: c_int = 00200; -pub const S_IXUSR: c_int = 00100; - -pub const S_IRWXG: c_int = 00070; -pub const S_IRGRP: c_int = 00040; -pub const S_IWGRP: c_int = 00020; -pub const S_IXGRP: c_int = 00010; - -pub const S_IRWXO: c_int = 00007; -pub const S_IROTH: c_int = 00004; -pub const S_IWOTH: c_int = 00002; -pub const S_IXOTH: c_int = 00001; -pub const S_ISUID: c_int = 04000; -pub const S_ISGID: c_int = 02000; -pub const S_ISVTX: c_int = 01000; +pub const S_IFMT: c_int = 0o0170000; +pub const S_IFBLK: c_int = 0o060000; +pub const S_IFCHR: c_int = 0o020000; +pub const S_IFIFO: c_int = 0o010000; +pub const S_IFREG: c_int = 0o100000; +pub const S_IFDIR: c_int = 0o040000; +pub const S_IFLNK: c_int = 0o120000; + +pub const S_IRWXU: c_int = 0o0700; +pub const S_IRUSR: c_int = 0o0400; +pub const S_IWUSR: c_int = 0o0200; +pub const S_IXUSR: c_int = 0o0100; + +pub const S_IRWXG: c_int = 0o0070; +pub const S_IRGRP: c_int = 0o0040; +pub const S_IWGRP: c_int = 0o0020; +pub const S_IXGRP: c_int = 0o0010; + +pub const S_IRWXO: c_int = 0o0007; +pub const S_IROTH: c_int = 0o0004; +pub const S_IWOTH: c_int = 0o0002; +pub const S_IXOTH: c_int = 0o0001; +pub const S_ISUID: c_int = 0o4000; +pub const S_ISGID: c_int = 0o2000; +pub const S_ISVTX: c_int = 0o1000; #[repr(C)] pub struct stat { @@ -43,9 +43,9 @@ pub struct stat { pub st_rdev: dev_t, pub st_size: off_t, pub st_blksize: blksize_t, - pub st_atim: time_t, - pub st_mtim: time_t, - pub st_ctim: time_t, + pub st_atime: time_t, + pub st_mtime: time_t, + pub st_ctime: time_t, pub st_blocks: blkcnt_t, }