Re: [HACKERS] xlog.c.patch for cygwin port. - Mailing list pgsql-hackers

From yutaka tanida
Subject Re: [HACKERS] xlog.c.patch for cygwin port.
Date
Msg-id 38C492C232E.8E0EYUTAKA@s34gway.s34.co.jp
Whole thread Raw
In response to xlog.c.patch for cygwin port.  ("Alexei Zakharov" <A.S.Zakharov@inp.nsk.su>)
Responses Re: [HACKERS] xlog.c.patch for cygwin port.  (Bruce Momjian <pgman@candle.pha.pa.us>)
Re: xlog.c.patch for cygwin port.  (Bruce Momjian <pgman@candle.pha.pa.us>)
Re: xlog.c.patch for cygwin port.  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
Hi,

On Mon, 6 Mar 2000 12:06:27 +0600
"Alexei Zakharov" <A.S.Zakharov@inp.nsk.su> wrote:

> I suggest a following patch.  BTW the situation appeared before, 
> see hba.c, pqcomm.c and others.

I propose another patch, against src/include/port/win.h.
If this patch is applied, #ifdef with open() such as following is no
more needed.

--
#ifndef __CYGWIN__ fd=open(path,flags,mode);
#else fd=open(path,flags | O_BINARY,mode);
#endif
--

Comments?

--
Yutaka tanida / S34 Co., Ltd.
tanida@s34.co.jp (Office)
yutaka@marin.or.jp(Private, or if you *HATE* Microsoft Outlook)



*** win.h.orig    Thu Feb 10 17:00:14 2000
--- win.h    Tue Mar 07 14:07:21 2000
***************
*** 10,15 ****
--- 10,35 ---- #define USE_POSIX_TIME #define HAVE_INT_TIMEZONE        /* has int _timezone */ 
+ /* open() must use with O_BINARY flag */
+ 
+ #include<stdarg.h>
+ #include<sys/fcntl.h>
+ 
+ static __inline int pg_cygwin_open(const char *pathname,int flags,...) {
+     va_list va;
+     mode_t mode;
+     if(flags | O_CREAT) {
+         va_start(va,flags);
+         mode=va_arg(va,int);
+         va_end(va);
+         return open(pathname,flags | O_BINARY,mode);
+     }else{
+         return open(pathname,flags | O_BINARY);
+     }
+ }
+ 
+ #define open pg_cygwin_open
+  #include <cygwin/version.h> #if (CYGWIN_VERSION_API_MAJOR >= 0) && (CYGWIN_VERSION_API_MINOR >= 8) #define sys_nerr
_sys_nerr



pgsql-hackers by date:

Previous
From: Thomas Lockhart
Date:
Subject: Re: [HACKERS] sqgfault on initdb with current CVS
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] Re: [GENERAL] Version 7.0 beta problem