Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com From: JRSON AT NetZero DOT Net (John R Hanson) To: "Victor Szel" Cc: cygwin AT sourceware DOT cygnus DOT com Subject: Re: BUG: open() O_ flags one bit too high Date: Sun, 05 Sep 1999 10:27:53 GMT Reply-To: JRSON AT NetZero DOT Net Message-ID: <37d344b8.40996984@smtp.netzero.net> References: <00f201bef785$7ac2cb50$0a0ac8c8 AT VECWS1> In-Reply-To: <00f201bef785$7ac2cb50$0a0ac8c8@VECWS1> X-Mailer: Forte Agent 1.5/32.452 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Note-from-DJ: This may be spam Cygwin uses win32 calls, not crtdll or msvcrt(XX) calls, so the only way you can tell which flags do what is to USE THE SOURCE LUKE ;-) if you have had problems with open, you may be using the wrong headers, DO NOT use vc++ or mingw32 headers when building cygwin apps. On Sun, 5 Sep 1999 12:00:26 +0200, you wrote: >Chris, > >> > >#ifdef __CYGWIN__ >> > >/* TODO: Get Cygwin fixed so that this bug fix won't be needed */ >> > >static inline int FixCygwinIOflags( int flags ) >> > >{ >> > > /* Starting with O_CREAT, the Cygwin I/O flags are 1 bit too high */ >> > > return ( ( flags & 0x1FF00 ) >> 1 ) | ( flags & 0xFF ); >> > >} >> > >#endif >> > >> > System O_CREAT (octal) O_CREAT (hex) >> > ---------------------------------------------------- >> > Cygwin 01000 0x200 >> > Digital UNIX 01000 0x200 >> > FreeBSD 01000 0x200 >> > Irix 00400 0x100 >> > Linux 00100 0x040 >> > SCO UNIX 3.2 00400 0x100 >> > Solaris 00400 0x100 >> > Ultrix 01000 0x200 >> > >> > What was the bug again? >> >> It could be that it's some sort of feature/bug in WinNT and not in Cygwin then, >> since the O_CREAT flag passed to open() was 0x200, but open always >> returned -1 in this case. WinNT 4.0 SP5 and Win2000 Build 2072 is the >> same in this respect. If this is the case, a workaround in Cygwin could be >> worth considering. > >After digging a bit more here's a snippet from >the FCNTL.H supplied with MS VC++ 4: > >#define _O_CREAT 0x0100 /* create and open file */ >#define _O_TRUNC 0x0200 /* open and truncate */ >#define _O_EXCL 0x0400 /* open only if file doesn't already exist */ > >#define O_CREAT _O_CREAT >#define O_TRUNC _O_TRUNC >#define O_EXCL _O_EXCL > >Victor Szel ________________________________________________________ NetZero - We believe in a FREE Internet. Shouldn't you? Get your FREE Internet Access and Email at http://www.netzero.net/download/index.html -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com