Re: [INTERFACES] libpq sockets on win32

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: jeff(at)jeffjohnson(dot)net
Cc: pgsql-interfaces(at)postgresql(dot)org, pgsql-docs(at)postgresql(dot)org
Subject: Re: [INTERFACES] libpq sockets on win32
Date: 2001-06-04 19:21:49
Message-ID: 200106041921.f54JLns03333@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-interfaces

> As Tom Lane points out in another post, the "define errno
> WSAGetLastError" seems to confuse a variable with a function. I was
> surprised that such a thing could work. I'm happy to hear that it
> doesn't.
>
> What about something like this:
>
> #ifdef WIN32
> #define s_errno WSAGetLastError()
> #else
> #define s_errno errno
> #endif
>
> /* for socket functions, check s_errno */
> if (s_errno == EINPROGRESS || s_errno == 0)
> ...
>
> /* for non-socket functions, check errno as usual */
> if (errno == ENOENT)
> ...

I have done exactly that. I assume fcntl(), ioctl(), select() use errno
even if used on a socket, while getsockopt(), setsockopt(), socket(),
connect(), getsockname(), send(), recv() use WSAGetLastError. Is this
list correct?

The patch is attached. Please let me know so I can finalize it and
apply it.

--
Bruce Momjian | http://candle.pha.pa.us
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

Attachment Content-Type Size
unknown_filename text/plain 10.5 KB

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message Bruce Momjian 2001-06-04 19:32:08 Re: Update needed for documentation
Previous Message Jeff Johnson 2001-06-04 19:03:35 RE: [INTERFACES] libpq sockets on win32

Browse pgsql-interfaces by date

  From Date Subject
Next Message Jeff Johnson 2001-06-04 19:48:50 RE: [INTERFACES] libpq sockets on win32
Previous Message Jeff Johnson 2001-06-04 19:03:35 RE: [INTERFACES] libpq sockets on win32