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

From Bruce Momjian
Subject Re: [HACKERS] xlog.c.patch for cygwin port.
Date
Msg-id 200003080013.TAA04387@candle.pha.pa.us
Whole thread Raw
In response to Re: [HACKERS] xlog.c.patch for cygwin port.  (yutaka tanida <yutaka@marin.or.jp>)
Responses Re: [HACKERS] xlog.c.patch for cygwin port.
List pgsql-hackers
This looks interesting.  We could remove some of our ifwin cruft.

---------------------------------------------------------------------------


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


************


--  Bruce Momjian                        |  http://www.op.net/~candle pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] sqgfault on initdb with current CVS
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] Optimizer badness in 7.0 beta