diff options
Diffstat (limited to 'src/backend/libpq/pqcomm.c')
-rw-r--r-- | src/backend/libpq/pqcomm.c | 56 |
1 files changed, 37 insertions, 19 deletions
diff --git a/src/backend/libpq/pqcomm.c b/src/backend/libpq/pqcomm.c index 64a351cedcb..0b511008fc8 100644 --- a/src/backend/libpq/pqcomm.c +++ b/src/backend/libpq/pqcomm.c @@ -750,7 +750,8 @@ StreamConnection(pgsocket server_fd, Port *port) (struct sockaddr *) &port->laddr.addr, &port->laddr.salen) < 0) { - elog(LOG, "getsockname() failed: %m"); + ereport(LOG, + (errmsg("getsockname() failed: %m"))); return STATUS_ERROR; } @@ -769,7 +770,8 @@ StreamConnection(pgsocket server_fd, Port *port) if (setsockopt(port->sock, IPPROTO_TCP, TCP_NODELAY, (char *) &on, sizeof(on)) < 0) { - elog(LOG, "setsockopt(%s) failed: %m", "TCP_NODELAY"); + ereport(LOG, + (errmsg("setsockopt(%s) failed: %m", "TCP_NODELAY"))); return STATUS_ERROR; } #endif @@ -777,7 +779,8 @@ StreamConnection(pgsocket server_fd, Port *port) if (setsockopt(port->sock, SOL_SOCKET, SO_KEEPALIVE, (char *) &on, sizeof(on)) < 0) { - elog(LOG, "setsockopt(%s) failed: %m", "SO_KEEPALIVE"); + ereport(LOG, + (errmsg("setsockopt(%s) failed: %m", "SO_KEEPALIVE"))); return STATUS_ERROR; } @@ -808,7 +811,8 @@ StreamConnection(pgsocket server_fd, Port *port) if (getsockopt(port->sock, SOL_SOCKET, SO_SNDBUF, (char *) &oldopt, &optlen) < 0) { - elog(LOG, "getsockopt(%s) failed: %m", "SO_SNDBUF"); + ereport(LOG, + (errmsg("getsockopt(%s) failed: %m", "SO_SNDBUF"))); return STATUS_ERROR; } newopt = PQ_SEND_BUFFER_SIZE * 4; @@ -817,7 +821,8 @@ StreamConnection(pgsocket server_fd, Port *port) if (setsockopt(port->sock, SOL_SOCKET, SO_SNDBUF, (char *) &newopt, sizeof(newopt)) < 0) { - elog(LOG, "setsockopt(%s) failed: %m", "SO_SNDBUF"); + ereport(LOG, + (errmsg("setsockopt(%s) failed: %m", "SO_SNDBUF"))); return STATUS_ERROR; } } @@ -1677,8 +1682,9 @@ pq_setkeepaliveswin32(Port *port, int idle, int interval) NULL) != 0) { - elog(LOG, "WSAIoctl(SIO_KEEPALIVE_VALS) failed: %ui", - WSAGetLastError()); + ereport(LOG, + (errmsg("WSAIoctl(%s) failed: %ui", + "SIO_KEEPALIVE_VALS", WSAGetLastError()))); return STATUS_ERROR; } if (port->keepalives_idle != idle) @@ -1708,7 +1714,8 @@ pq_getkeepalivesidle(Port *port) (char *) &port->default_keepalives_idle, &size) < 0) { - elog(LOG, "getsockopt(%s) failed: %m", PG_TCP_KEEPALIVE_IDLE_STR); + ereport(LOG, + (errmsg("getsockopt(%s) failed: %m", PG_TCP_KEEPALIVE_IDLE_STR))); port->default_keepalives_idle = -1; /* don't know */ } #else /* WIN32 */ @@ -1752,7 +1759,8 @@ pq_setkeepalivesidle(int idle, Port *port) if (setsockopt(port->sock, IPPROTO_TCP, PG_TCP_KEEPALIVE_IDLE, (char *) &idle, sizeof(idle)) < 0) { - elog(LOG, "setsockopt(%s) failed: %m", PG_TCP_KEEPALIVE_IDLE_STR); + ereport(LOG, + (errmsg("setsockopt(%s) failed: %m", PG_TCP_KEEPALIVE_IDLE_STR))); return STATUS_ERROR; } @@ -1763,7 +1771,8 @@ pq_setkeepalivesidle(int idle, Port *port) #else if (idle != 0) { - elog(LOG, "setting the keepalive idle time is not supported"); + ereport(LOG, + (errmsg("setting the keepalive idle time is not supported"))); return STATUS_ERROR; } #endif @@ -1790,7 +1799,8 @@ pq_getkeepalivesinterval(Port *port) (char *) &port->default_keepalives_interval, &size) < 0) { - elog(LOG, "getsockopt(%s) failed: %m", "TCP_KEEPINTVL"); + ereport(LOG, + (errmsg("getsockopt(%s) failed: %m", "TCP_KEEPINTVL"))); port->default_keepalives_interval = -1; /* don't know */ } #else @@ -1833,7 +1843,8 @@ pq_setkeepalivesinterval(int interval, Port *port) if (setsockopt(port->sock, IPPROTO_TCP, TCP_KEEPINTVL, (char *) &interval, sizeof(interval)) < 0) { - elog(LOG, "setsockopt(%s) failed: %m", "TCP_KEEPINTVL"); + ereport(LOG, + (errmsg("setsockopt(%s) failed: %m", "TCP_KEEPINTVL"))); return STATUS_ERROR; } @@ -1844,7 +1855,8 @@ pq_setkeepalivesinterval(int interval, Port *port) #else if (interval != 0) { - elog(LOG, "setsockopt(%s) not supported", "TCP_KEEPINTVL"); + ereport(LOG, + (errmsg("setsockopt(%s) not supported", "TCP_KEEPINTVL"))); return STATUS_ERROR; } #endif @@ -1870,7 +1882,8 @@ pq_getkeepalivescount(Port *port) (char *) &port->default_keepalives_count, &size) < 0) { - elog(LOG, "getsockopt(%s) failed: %m", "TCP_KEEPCNT"); + ereport(LOG, + (errmsg("getsockopt(%s) failed: %m", "TCP_KEEPCNT"))); port->default_keepalives_count = -1; /* don't know */ } } @@ -1908,7 +1921,8 @@ pq_setkeepalivescount(int count, Port *port) if (setsockopt(port->sock, IPPROTO_TCP, TCP_KEEPCNT, (char *) &count, sizeof(count)) < 0) { - elog(LOG, "setsockopt(%s) failed: %m", "TCP_KEEPCNT"); + ereport(LOG, + (errmsg("setsockopt(%s) failed: %m", "TCP_KEEPCNT"))); return STATUS_ERROR; } @@ -1916,7 +1930,8 @@ pq_setkeepalivescount(int count, Port *port) #else if (count != 0) { - elog(LOG, "setsockopt(%s) not supported", "TCP_KEEPCNT"); + ereport(LOG, + (errmsg("setsockopt(%s) not supported", "TCP_KEEPCNT"))); return STATUS_ERROR; } #endif @@ -1942,7 +1957,8 @@ pq_gettcpusertimeout(Port *port) (char *) &port->default_tcp_user_timeout, &size) < 0) { - elog(LOG, "getsockopt(%s) failed: %m", "TCP_USER_TIMEOUT"); + ereport(LOG, + (errmsg("getsockopt(%s) failed: %m", "TCP_USER_TIMEOUT"))); port->default_tcp_user_timeout = -1; /* don't know */ } } @@ -1980,7 +1996,8 @@ pq_settcpusertimeout(int timeout, Port *port) if (setsockopt(port->sock, IPPROTO_TCP, TCP_USER_TIMEOUT, (char *) &timeout, sizeof(timeout)) < 0) { - elog(LOG, "setsockopt(%s) failed: %m", "TCP_USER_TIMEOUT"); + ereport(LOG, + (errmsg("setsockopt(%s) failed: %m", "TCP_USER_TIMEOUT"))); return STATUS_ERROR; } @@ -1988,7 +2005,8 @@ pq_settcpusertimeout(int timeout, Port *port) #else if (timeout != 0) { - elog(LOG, "setsockopt(%s) not supported", "TCP_USER_TIMEOUT"); + ereport(LOG, + (errmsg("setsockopt(%s) not supported", "TCP_USER_TIMEOUT"))); return STATUS_ERROR; } #endif |