Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-docspgsql-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

In response to

pgsql-docs by date

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

pgsql-interfaces by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group