Re: [HACKERS] xlog.c.patch for cygwin port.

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: yutaka tanida <yutaka(at)marin(dot)or(dot)jp>
Cc: Alexei Zakharov <A(dot)S(dot)Zakharov(at)inp(dot)nsk(dot)su>, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] xlog.c.patch for cygwin port.
Date: 2000-03-08 00:13:06
Message-ID: 200003080013.TAA04387@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)S(dot)Zakharov(at)inp(dot)nsk(dot)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(at)s34(dot)co(dot)jp (Office)
yutaka(at)marin(dot)or(dot)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(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2000-03-08 00:15:10 Re: [HACKERS] Optimizer badness in 7.0 beta
Previous Message Bruce Momjian 2000-03-08 00:09:21 Re: [HACKERS] sqgfault on initdb with current CVS