for (addr = addrs; addr; addr = addr->ai_next)
{
- if (!IS_AF_UNIX(family) && IS_AF_UNIX(addr->ai_family))
+ if (family != AF_UNIX && addr->ai_family == AF_UNIX)
{
/*
* Only set up a unix domain socket when they really asked for it.
* unpredictable behavior. With no flags at all, win32 behaves as Unix
* with SO_REUSEADDR.
*/
- if (!IS_AF_UNIX(addr->ai_family))
+ if (addr->ai_family != AF_UNIX)
{
if ((setsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
(char *) &one, sizeof(one))) == -1)
errmsg("could not bind %s address \"%s\": %m",
familyDesc, addrDesc),
saved_errno == EADDRINUSE ?
- (IS_AF_UNIX(addr->ai_family) ?
+ (addr->ai_family == AF_UNIX ?
errhint("Is another postmaster already running on port %d?",
(int) portNumber) :
errhint("Is another postmaster already running on port %d?"
}
/* select NODELAY and KEEPALIVE options if it's a TCP connection */
- if (!IS_AF_UNIX(port->laddr.addr.ss_family))
+ if (port->laddr.addr.ss_family != AF_UNIX)
{
int on;
#ifdef WIN32
pq_getkeepalivesidle(Port *port)
{
#if defined(PG_TCP_KEEPALIVE_IDLE) || defined(SIO_KEEPALIVE_VALS)
- if (port == NULL || IS_AF_UNIX(port->laddr.addr.ss_family))
+ if (port == NULL || port->laddr.addr.ss_family == AF_UNIX)
return 0;
if (port->keepalives_idle != 0)
int
pq_setkeepalivesidle(int idle, Port *port)
{
- if (port == NULL || IS_AF_UNIX(port->laddr.addr.ss_family))
+ if (port == NULL || port->laddr.addr.ss_family == AF_UNIX)
return STATUS_OK;
/* check SIO_KEEPALIVE_VALS here, not just WIN32, as some toolchains lack it */
pq_getkeepalivesinterval(Port *port)
{
#if defined(TCP_KEEPINTVL) || defined(SIO_KEEPALIVE_VALS)
- if (port == NULL || IS_AF_UNIX(port->laddr.addr.ss_family))
+ if (port == NULL || port->laddr.addr.ss_family == AF_UNIX)
return 0;
if (port->keepalives_interval != 0)
int
pq_setkeepalivesinterval(int interval, Port *port)
{
- if (port == NULL || IS_AF_UNIX(port->laddr.addr.ss_family))
+ if (port == NULL || port->laddr.addr.ss_family == AF_UNIX)
return STATUS_OK;
#if defined(TCP_KEEPINTVL) || defined(SIO_KEEPALIVE_VALS)
pq_getkeepalivescount(Port *port)
{
#ifdef TCP_KEEPCNT
- if (port == NULL || IS_AF_UNIX(port->laddr.addr.ss_family))
+ if (port == NULL || port->laddr.addr.ss_family == AF_UNIX)
return 0;
if (port->keepalives_count != 0)
int
pq_setkeepalivescount(int count, Port *port)
{
- if (port == NULL || IS_AF_UNIX(port->laddr.addr.ss_family))
+ if (port == NULL || port->laddr.addr.ss_family == AF_UNIX)
return STATUS_OK;
#ifdef TCP_KEEPCNT
pq_gettcpusertimeout(Port *port)
{
#ifdef TCP_USER_TIMEOUT
- if (port == NULL || IS_AF_UNIX(port->laddr.addr.ss_family))
+ if (port == NULL || port->laddr.addr.ss_family == AF_UNIX)
return 0;
if (port->tcp_user_timeout != 0)
int
pq_settcpusertimeout(int timeout, Port *port)
{
- if (port == NULL || IS_AF_UNIX(port->laddr.addr.ss_family))
+ if (port == NULL || port->laddr.addr.ss_family == AF_UNIX)
return STATUS_OK;
#ifdef TCP_USER_TIMEOUT
emitHostIdentityInfo(PGconn *conn, const char *host_addr)
{
#ifdef HAVE_UNIX_SOCKETS
- if (IS_AF_UNIX(conn->raddr.addr.ss_family))
+ if (conn->raddr.addr.ss_family == AF_UNIX)
{
char service[NI_MAXHOST];
SOCK_STRERROR(errorno, sebuf, sizeof(sebuf)));
#ifdef HAVE_UNIX_SOCKETS
- if (IS_AF_UNIX(conn->raddr.addr.ss_family))
+ if (conn->raddr.addr.ss_family == AF_UNIX)
appendPQExpBufferStr(&conn->errorMessage,
libpq_gettext("\tIs the server running locally and accepting connections on that socket?\n"));
else
* TCP sockets, nonblock mode, close-on-exec. Try the
* next address if any of this fails.
*/
- if (!IS_AF_UNIX(addr_cur->ai_family))
+ if (addr_cur->ai_family != AF_UNIX)
{
if (!connectNoDelay(conn))
{
}
#endif /* F_SETFD */
- if (!IS_AF_UNIX(addr_cur->ai_family))
+ if (addr_cur->ai_family != AF_UNIX)
{
#ifndef WIN32
int on = 1;
* Unix-domain socket.
*/
if (conn->requirepeer && conn->requirepeer[0] &&
- IS_AF_UNIX(conn->raddr.addr.ss_family))
+ conn->raddr.addr.ss_family == AF_UNIX)
{
#ifndef WIN32
char *remote_username;
#endif /* WIN32 */
}
- if (IS_AF_UNIX(conn->raddr.addr.ss_family))
+ if (conn->raddr.addr.ss_family == AF_UNIX)
{
/* Don't request SSL or GSSAPI over Unix sockets */
#ifdef USE_SSL
* This ensures that this function does not block indefinitely when
* reasonable keepalive and timeout settings have been provided.
*/
- if (!IS_AF_UNIX(cancel->raddr.addr.ss_family) &&
+ if (cancel->raddr.addr.ss_family != AF_UNIX &&
cancel->keepalives != 0)
{
#ifndef WIN32