[RFA] Cygwin header file patches
Christopher Faylor
cgf@redhat.com
Fri Mar 2 21:40:00 GMT 2001
I thought I'd ask for approval rather than just check these patches in
since they "pollute the namespace" a little even when not in the Cygwin
environment.
Are there any objections to this method of defining various constants or
should I just completely isolate the Cygwin stuff? I did things this way
so that the actual constant would only have to be defined once but I can
obviously just define things twice inside of an ifdef if the introduction of
things like _S_IEXEC is objectionable (and I have absolutely no problems
understanding if that is the case).
Otherwise, is this ok to check in?
cgf
Sat Mar 3 00:34:14 2001 Christopher Faylor <cgf@cygnus.com>
* 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.
Index: libc/include/sys/stat.h
===================================================================
RCS file: /cvs/uberbaum/newlib/libc/include/sys/stat.h,v
retrieving revision 1.6
diff -u -p -r1.6 stat.h
--- stat.h 2001/02/12 18:17:17 1.6
+++ stat.h 2001/03/03 05:35:05
@@ -67,8 +67,15 @@ struct stat
#define S_ISVTX 0001000 /* save swapped text even after use */
#define S_IREAD 0000400 /* read permission, owner */
#define S_IWRITE 0000200 /* write permission, owner */
-#define S_IEXEC 0000100 /* execute/search permission, owner */
+#define _S_IEXEC 0000100 /* execute/search permission, owner */
+#if !defined (__CYGWIN__) || defined (__INSIDE_CYGWIN__)
+#define S_IEXEC _S_IEXEC
+#else
+extern unsigned const _cygwin_S_IEXEC, _cygwin_S_IXUSR, _cygwin_S_IXGRP, _cygwin_S_IXOTH;
+#define S_IEXEC _cygwin_S_IEXEC
+#endif
+
#define S_ENFMT 0002000 /* enforcement-mode locking */
#define S_IFMT _IFMT
@@ -94,18 +101,28 @@ 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__)
+#define S_IXUSR _S_IXUSR
+#define S_IXGRP _S_IXGRP
+#define S_IXOTH _S_IXOTH
+#else
+#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)
Index: libc/include/sys/unistd.h
===================================================================
RCS file: /cvs/uberbaum/newlib/libc/include/sys/unistd.h,v
retrieving revision 1.15
diff -u -p -r1.15 unistd.h
--- unistd.h 2001/02/09 00:13:54 1.15
+++ unistd.h 2001/03/03 05:35:05
@@ -135,7 +135,13 @@ int _EXFUN(symlink, (const char *__n
# define F_OK 0
# define R_OK 4
# define W_OK 2
-# define X_OK 1
+# define _X_OK 1
+#if defined (__CYGWIN__) || defined (__INSIDE_CYGWIN__)
+# define X_OK _X_OK /* Check for execute permission. */
+#else
+extern const unsigned _cygwin_X_OK;
+# define X_OK _cygwin_X_OK
+#endif
# define SEEK_SET 0
# define SEEK_CUR 1
More information about the Newlib
mailing list