1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-09 13:09:39 +03:00

Remove HAVE_UNIX_SOCKETS.

Since HAVE_UNIX_SOCKETS is now defined unconditionally, remove the macro
and drop a small amount of dead code.

The last known systems not to have them (as far as I know at least) were
QNX, which we de-supported years ago, and Windows, which now has them.

If a new OS ever shows up with the POSIX sockets API but without working
AF_UNIX, it'll presumably still be able to compile the code, and fail at
runtime with an unsupported address family error.  We might want to
consider adding a HINT that you should turn off the option to use it if
your network stack doesn't support it at that point, but it doesn't seem
worth making the relevant code conditional at compile time.

Also adjust a couple of places in the docs and comments that referred to
builds without Unix-domain sockets, since there aren't any.  Windows
still gets a special mention in those places, though, because we don't
try to use them by default there yet.

Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Discussion: https://postgr.es/m/CA%2BhUKG%2BL_3brvh%3D8e0BW_VfX9h7MtwgN%3DnFHP5o7X2oZucY9dg%40mail.gmail.com
This commit is contained in:
Thomas Munro
2022-08-14 08:46:53 +12:00
parent e07ebd4b6e
commit f558088285
13 changed files with 12 additions and 130 deletions

View File

@@ -1102,10 +1102,8 @@ connectOptions2(PGconn *conn)
else if (ch->host != NULL && ch->host[0] != '\0')
{
ch->type = CHT_HOST_NAME;
#ifdef HAVE_UNIX_SOCKETS
if (is_unixsock_path(ch->host))
ch->type = CHT_UNIX_SOCKET;
#endif
}
else
{
@@ -1115,14 +1113,12 @@ connectOptions2(PGconn *conn)
* This bit selects the default host location. If you change
* this, see also pg_regress.
*/
#ifdef HAVE_UNIX_SOCKETS
if (DEFAULT_PGSOCKET_DIR[0])
{
ch->host = strdup(DEFAULT_PGSOCKET_DIR);
ch->type = CHT_UNIX_SOCKET;
}
else
#endif
{
ch->host = strdup(DefaultHost);
ch->type = CHT_HOST_NAME;
@@ -1684,7 +1680,6 @@ getHostaddr(PGconn *conn, char *host_addr, int host_addr_len)
static void
emitHostIdentityInfo(PGconn *conn, const char *host_addr)
{
#ifdef HAVE_UNIX_SOCKETS
if (conn->raddr.addr.ss_family == AF_UNIX)
{
char service[NI_MAXHOST];
@@ -1698,7 +1693,6 @@ emitHostIdentityInfo(PGconn *conn, const char *host_addr)
service);
}
else
#endif /* HAVE_UNIX_SOCKETS */
{
const char *displayed_host;
const char *displayed_port;
@@ -1748,12 +1742,10 @@ connectFailureMessage(PGconn *conn, int errorno)
"%s\n",
SOCK_STRERROR(errorno, sebuf, sizeof(sebuf)));
#ifdef HAVE_UNIX_SOCKETS
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
#endif
appendPQExpBufferStr(&conn->errorMessage,
libpq_gettext("\tIs the server running on that host and accepting TCP/IP connections?\n"));
}
@@ -2415,7 +2407,6 @@ keep_going: /* We will come back to here until there is
break;
case CHT_UNIX_SOCKET:
#ifdef HAVE_UNIX_SOCKETS
conn->addrlist_family = hint.ai_family = AF_UNIX;
UNIXSOCK_PATH(portstr, thisport, ch->host);
if (strlen(portstr) >= UNIXSOCK_PATH_BUFLEN)
@@ -2440,9 +2431,6 @@ keep_going: /* We will come back to here until there is
portstr, gai_strerror(ret));
goto keep_going;
}
#else
Assert(false);
#endif
break;
}