--- mstools/posix/h/sys/stat.h 2018/08/09 18:22:18 1.1 +++ mstools/posix/h/sys/stat.h 2018/08/09 18:24:37 1.1.1.2 @@ -11,12 +11,6 @@ Abstract: This module contains the stat structure described in section 5.6.1 of IEEE P1003.1/Draft 13. -Author: - - Mark Lucovsky (markl) 15-Mar-1989 - -Revision History: - --*/ #ifndef _SYS_STAT_ @@ -24,6 +18,10 @@ Revision History: #include +#ifdef __cplusplus +extern "C" { +#endif + struct stat { mode_t st_mode; ino_t st_ino; @@ -41,20 +39,20 @@ struct stat { * Type bits for mode field */ -#define S_IFMT 0x01f00000 +#define S_IFMT 000770000 -#define S_IFDIR 0x00100000 -#define S_IFCHR 0x00200000 -#define S_IFBLK 0x00400000 -#define S_IFREG 0x00800000 -#define S_IFIFO 0x01000000 +#define S_IFIFO 000010000 +#define S_IFCHR 000020000 +#define S_IFDIR 000040000 +#define S_IFBLK 000060000 +#define S_IFREG 000100000 /* * Set Id Bits for mode */ -#define S_ISUID 0x00010000 -#define S_ISGID 0x00020000 +#define S_ISUID 000004000 +#define S_ISGID 000002000 /* * Protection Bits for mode @@ -77,11 +75,11 @@ struct stat { #define S_IWOTH 000000002 #define S_IXOTH 000000001 -#define S_ISDIR(m) ( (m) & S_IFDIR ) -#define S_ISCHR(m) ( (m) & S_IFCHR ) -#define S_ISBLK(m) ( (m) & S_IFBLK ) -#define S_ISREG(m) ( (m) & S_IFREG ) -#define S_ISFIFO(m) ( (m) & S_IFIFO ) +#define S_ISDIR(m) ( ((m) & S_IFMT) == S_IFDIR ) +#define S_ISCHR(m) ( ((m) & S_IFMT) == S_IFCHR ) +#define S_ISBLK(m) ( ((m) & S_IFMT) == S_IFBLK ) +#define S_ISREG(m) ( ((m) & S_IFMT) == S_IFREG ) +#define S_ISFIFO(m) ( ((m) & S_IFMT) == S_IFIFO ) mode_t _CRTAPI1 umask(mode_t); int _CRTAPI1 mkdir(const char *, mode_t); @@ -90,4 +88,8 @@ int _CRTAPI1 stat(const char *, struct s int _CRTAPI1 fstat(int, struct stat *); int _CRTAPI1 chmod(const char *, mode_t); +#ifdef __cplusplus +} +#endif + #endif /* _SYS_STAT_ */