This is the mail archive of the
cygwin-patches@cygwin.com
mailing list for the Cygwin project.
sys/stat.h constants patch
- To: Cygwin-Patches <cygwin-patches at sources dot redhat dot com>
- Subject: sys/stat.h constants patch
- From: Jason Tishler <Jason dot Tishler at dothill dot com>
- Date: Tue, 27 Mar 2001 22:29:42 -0500
- Organization: Dot Hill Systems Corp.
The attached patch "properly" initializes sys/stat.h constants such as
S_IXUSR. I quote properly because I'm not sure what is the best way to
correct this problem. I tried a couple of permutations and ended up
with this one.
Nevertheless, without this patch the interesting lines in
winsup/cygwin/lib/_cygwin_S_IEXEC.cc end up as follows after cpp:
const unsigned _cygwin_S_IEXEC = _cygwin_S_IEXEC ;
const unsigned _cygwin_S_IXUSR = _cygwin_S_IXUSR ;
const unsigned _cygwin_S_IXGRP = _cygwin_S_IXGRP ;
const unsigned _cygwin_S_IXOTH = _cygwin_S_IXOTH ;
const unsigned _cygwin_X_OK = _cygwin_X_OK ;
instead of:
extern const unsigned _cygwin_S_IEXEC = 0000100 ;
extern const unsigned _cygwin_S_IXUSR = 0000100 ;
extern const unsigned _cygwin_S_IXGRP = 0000010 ;
extern const unsigned _cygwin_S_IXOTH = 0000001 ;
extern const unsigned _cygwin_X_OK = 1 ;
Hence, the above constants are set to 0 instead of their expected values.
The attached small test program demonstrates the issue. Built against
1.1.8-2, I get the following:
$ j
S_IXUSR = 64
But, when built against the 2001-03-25 snapshot, I get the following:
$ j
S_IXUSR = 0
BTW, this problem prevents PostgreSQL built against a Cygwin with this
issue from functioning properly. postgres.exe declares that it *itself*
is an invalid executable even though it is running!
Thanks,
Jason
--
Jason Tishler
Director, Software Engineering Phone: +1 (732) 264-8770 x235
Dot Hill Systems Corp. Fax: +1 (732) 264-8798
82 Bethany Road, Suite 7 Email: Jason.Tishler@dothill.com
Hazlet, NJ 07730 USA WWW: http://www.dothill.com
Index: _cygwin_S_IEXEC.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/lib/_cygwin_S_IEXEC.cc,v
retrieving revision 1.1
diff -u -p -r1.1 _cygwin_S_IEXEC.cc
--- _cygwin_S_IEXEC.cc 2001/03/05 06:28:25 1.1
+++ _cygwin_S_IEXEC.cc 2001/03/27 22:24:04
@@ -13,14 +13,15 @@ details. */
#include <sys/cygwin.h>
#include "perprocess.h"
#endif
+#define __INSIDE_CYGWIN__
#include <sys/stat.h>
#include <sys/unistd.h>
-const unsigned _cygwin_S_IEXEC = S_IEXEC;
-const unsigned _cygwin_S_IXUSR = S_IXUSR;
-const unsigned _cygwin_S_IXGRP = S_IXGRP;
-const unsigned _cygwin_S_IXOTH = S_IXOTH;
-const unsigned _cygwin_X_OK = X_OK;
+extern const unsigned _cygwin_S_IEXEC = S_IEXEC;
+extern const unsigned _cygwin_S_IXUSR = S_IXUSR;
+extern const unsigned _cygwin_S_IXGRP = S_IXGRP;
+extern const unsigned _cygwin_S_IXOTH = S_IXOTH;
+extern const unsigned _cygwin_X_OK = X_OK;
extern int __declspec (dllimport) _check_for_executable;
struct _cygwin_bob__
Tue Mar 27 22:16:52 2001 Jason Tishler <jt@dothill.com>
* lib/_cygwin_S_IEXEC.cc: Fix initialization of sys/stat.h constants.
#include <sys/stat.h>
#include <stdio.h>
int
main()
{
printf("S_IXUSR = %d\n", S_IXUSR);
}