Re: MSFT compiler fixes + misc

From: "Magnus Hagander" <mha(at)sollentuna(dot)net>
To: "Claudio Natoli" <claudio(dot)natoli(at)memetrics(dot)com>, <pgsql-patches(at)postgresql(dot)org>
Subject: Re: MSFT compiler fixes + misc
Date: 2004-04-05 08:59:36
Message-ID: 6BCB9D8A16AC4241919521715F4D8BCE34B69E@algol.sollentuna.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

> > A thought about this - how about converting pgpiperead() and
> > pgpipewrite() into functions intead of macros (on win32 - still
> > redifining them on != win32), mimicking the behaviour of read() and
> > write()?
>
> And #def'ing them to be read + write under win32? Don't want
> to change every instance of read/write.

No.
#def'ing them to be read + write under non-win32. As is done today.

It would change (in port.h):
#ifndef WIN32
#define pgpipe(a) pipe(a)
#define piperead(a,b,c) read(a,b,c)
#define pipewrite(a,b,c) write(a,b,c)
#else
extern int pgpipe(int handles[2]);
#define piperead(a,b,c) recv(a,b,c,0)
#define pipewrite(a,b,c) send(a,b,c,0)
#endif

to

#ifndef WIN32
#define pgpipe(a) pipe(a)
#define piperead(a,b,c) read(a,b,c)
#define pipewrite(a,b,c) write(a,b,c)
#else
extern int pgpipe(int handles[2]);
extern int piperead(a,b,c);
extern int pipewrite(a,b,c);
#endif

And then put piperead() and pipewrite() along with pgpipe() in the C
file. (Naturally, arguments with the correct syntax, but you get the
idea)

> > Then we could do awya with the #ifdefs at the points where
> its used,
> > and just expect the normal Unix behaviour?
>
> I don't see that we do have any #ifdefs where its used.

pgstat.c, inside the main loop.
#ifdef WIN32
if (WSAGetLastError() == WSAECONNRESET) /* EOF on the pipe! (win32
socket based implementation) */
{
pipeEOF = true;
break;
}
#endif

There's where I notived it. That might be the only place, though -
haven't checked further. If it's the only case, then it's not such a big
deal.
But it might come back to bite us in the future - since it currently
does not actually implement "expected behaviour" of a pipe.

//Magnus

Browse pgsql-patches by date

  From Date Subject
Next Message Peter Eisentraut 2004-04-05 09:03:04 Re: Translation Updates for 7.3: libpq-ru.po.gz; pg_controldata-ru.po.gz; pg_resetxlog-ru.po.gz; postgres-ru.po.gz
Previous Message Peter Eisentraut 2004-04-05 08:58:29 Re: Translation Updates for 7.4.x: pg_dump-ru.po.gz;psql-ru.po.gz