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

Re: pgsql-server/src/backend/postmaster postmaster.c

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: Bruce Momjian <momjian(at)svr1(dot)postgresql(dot)org>,pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql-server/src/backend/postmaster postmaster.c
Date: 2003-11-11 03:12:39
Message-ID: 200311110312.hAB3Cdd07405@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-committers
Neil Conway wrote:
> momjian(at)svr1(dot)postgresql(dot)org (Bruce Momjian) writes:
> > 	* ioctlsocket_ret
> > 	- is not initialized to 1 (at least in the WIN_32 code I started
> > 	  with!)
> 
> Couldn't we just use a function for FCNTL_NONBLOCK() instead of a
> macro, and avoid this "ioctlsocket_ret" hackery?

The problem is that the macro needs a holding variable on Win32 and
BeOS:
	
	#if !defined(WIN32) && !defined(__BEOS__)
	#define FCNTL_NONBLOCK(sock)    fcntl(sock, F_SETFL, O_NONBLOCK)
	#else
	extern long ioctlsocket_ret;
	
	/* Returns non-0 on failure, while fcntl() returns -1 on failure */
	#ifdef WIN32
	#define FCNTL_NONBLOCK(sock)    ((ioctlsocket(sock, FIONBIO, &ioctlsocket_ret) == 0) ? 0 : -1)
	#endif
	#ifdef __BEOS__
	#define FCNTL_NONBLOCK(sock)    ((ioctl(sock, FIONBIO, &ioctlsocket_ret) == 0) ? 0 : -1)
	#endif
	#endif

We define the variable only on Win32/BeOS.  Any ideas on how to do this
better?
	
-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

In response to

Responses

pgsql-committers by date

Next:From: Neil ConwayDate: 2003-11-11 03:20:13
Subject: Re: pgsql-server/src/backend/postmaster postmaster.c
Previous:From: Neil ConwayDate: 2003-11-11 03:03:53
Subject: Re: pgsql-server/src/backend/postmaster postmaster.c

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