From 658b5db941bcace10daa2d17e8c1158030a4fc8c Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Mon, 5 Mar 2001 05:13:06 +0000 Subject: [PATCH] * libc/include/sys/stat.h: Use special defines for executable stat bits when compiling for Cygwin. * libc/include/sys/unistd.h: Use special define for X_OK when compiling for Cygwin. --- newlib/ChangeLog | 7 +++++++ newlib/libc/include/sys/stat.h | 25 ++++++++++++++++++------- newlib/libc/include/sys/unistd.h | 6 ++++++ 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/newlib/ChangeLog b/newlib/ChangeLog index ac112f334..e5934f90f 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,10 @@ +Sat Mar 3 00:34:14 2001 Christopher Faylor + + * libc/include/sys/stat.h: Use special defines for executable stat bits + when compiling for Cygwin. + * libc/include/sys/unistd.h: Use special define for X_OK when compiling + for Cygwin. + 2001-03-02 Jeff Johnston * libc/string/strtok.c: Add #undef of __STRICT_ANSI__ so prototype diff --git a/newlib/libc/include/sys/stat.h b/newlib/libc/include/sys/stat.h index 2ae1b56b9..802244f3d 100644 --- a/newlib/libc/include/sys/stat.h +++ b/newlib/libc/include/sys/stat.h @@ -68,7 +68,6 @@ struct stat #define S_IREAD 0000400 /* read permission, owner */ #define S_IWRITE 0000200 /* write permission, owner */ #define S_IEXEC 0000100 /* execute/search permission, owner */ - #define S_ENFMT 0002000 /* enforcement-mode locking */ #define S_IFMT _IFMT @@ -94,18 +93,30 @@ struct stat #define _S_IEXEC 0000100 #endif -#define S_IRWXU 0000700 /* rwx, owner */ +#define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) #define S_IRUSR 0000400 /* read permission, owner */ #define S_IWUSR 0000200 /* write permission, owner */ -#define S_IXUSR 0000100 /* execute/search permission, owner */ -#define S_IRWXG 0000070 /* rwx, group */ +#define S_IXUSR 0000100/* execute/search permission, owner */ +#define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP) #define S_IRGRP 0000040 /* read permission, group */ #define S_IWGRP 0000020 /* write permission, grougroup */ -#define S_IXGRP 0000010 /* execute/search permission, group */ -#define S_IRWXO 0000007 /* rwx, other */ +#define S_IXGRP 0000010/* execute/search permission, group */ +#define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH) #define S_IROTH 0000004 /* read permission, other */ #define S_IWOTH 0000002 /* write permission, other */ -#define S_IXOTH 0000001 /* execute/search permission, other */ +#define S_IXOTH 0000001/* execute/search permission, other */ + +#if defined (__CYGWIN__) && !defined (__INSIDE_CYGWIN__) +extern unsigned const _cygwin_S_IEXEC, _cygwin_S_IXUSR, _cygwin_S_IXGRP, _cygwin_S_IXOTH; +#undef S_IEXEC +#undef S_IXUSR +#undef S_IXGRP +#undef S_IXOTH +#define S_IEXEC _cygwin_S_IEXEC +#define S_IXUSR _cygwin_S_IXUSR +#define S_IXGRP _cygwin_S_IXGRP +#define S_IXOTH _cygwin_S_IXOTH +#endif #define S_ISBLK(m) (((m)&_IFMT) == _IFBLK) #define S_ISCHR(m) (((m)&_IFMT) == _IFCHR) diff --git a/newlib/libc/include/sys/unistd.h b/newlib/libc/include/sys/unistd.h index 42cf56ebf..143129f86 100644 --- a/newlib/libc/include/sys/unistd.h +++ b/newlib/libc/include/sys/unistd.h @@ -137,6 +137,12 @@ int _EXFUN(symlink, (const char *__name1, const char *__name2)); # define W_OK 2 # define X_OK 1 +#if defined (__CYGWIN__) && !defined (__INSIDE_CYGWIN__) +# undef X_OK +# define X_OK _cygwin_X_OK +extern const unsigned _cygwin_X_OK; +#endif + # define SEEK_SET 0 # define SEEK_CUR 1 # define SEEK_END 2