WIN32 errno patch

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian - CVS <momjian(at)hub(dot)org>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: WIN32 errno patch
Date: 2001-07-21 20:45:54
Message-ID: 21086.995748354@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers pgsql-patches

Upon review, I don't think these patches are very good at all.
#defining errno as WSAGetLastError() is a fairly blunt instrument,
and it breaks all the places that do actually need to use errno,
such as PQoidValue, lo_import, lo_export. I'm also concerned that
PQrequestCancel may need to save/restore both errno and
WSAGetLastError() in order to be safe for use in a signal handler.

Is errno a plain variable on WIN32, or is it a macro? If the former,
we could hack around this problem by doing

#if WIN32
#undef errno
#endif

...

#if WIN32
#define errno WSAGetLastError()
#endif

around the routines that need to access the real errno. While ugly,
this probably beats the alternative of ifdef'ing all the places that
do need to access the WSA error code.

regards, tom lane

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian - CVS 2001-07-21 21:27:41 pgsql/src/interfaces/jdbc/org/postgresql/test ...
Previous Message Bruce Momjian - CVS 2001-07-21 18:57:09 pgsql/src/interfaces/jdbc/org/postgresql jdbc1 ...

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2001-07-21 21:35:45 Re: WIN32 errno patch
Previous Message mlw 2001-07-21 18:48:58 sub queries and caching.

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2001-07-21 21:27:58 Re: [PATCHES] Re: [PATCH] Cleanup of JDBC character encoding
Previous Message Anders Bengtsson 2001-07-21 20:20:39 Re: [PATCHES] Re: [PATCH] Cleanup of JDBC character encoding