summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorThomas Munro2022-08-13 20:46:53 +0000
committerThomas Munro2022-08-13 20:46:53 +0000
commitf5580882856963d1b50f9e391a8dda82d44b69a6 (patch)
tree4060fab53bd3b3aa98c242d3c258161925522d83 /src/backend
parente07ebd4b6e606a7c03ed3c6bf5d6bcbb725247b4 (diff)
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
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/libpq/hba.c10
-rw-r--r--src/backend/libpq/pqcomm.c18
-rw-r--r--src/backend/postmaster/postmaster.c2
-rw-r--r--src/backend/utils/misc/guc.c4
4 files changed, 0 insertions, 34 deletions
diff --git a/src/backend/libpq/hba.c b/src/backend/libpq/hba.c
index deee05c197..66f2156cde 100644
--- a/src/backend/libpq/hba.c
+++ b/src/backend/libpq/hba.c
@@ -973,17 +973,7 @@ parse_hba_line(TokenizedAuthLine *tok_line, int elevel)
token = linitial(tokens);
if (strcmp(token->string, "local") == 0)
{
-#ifdef HAVE_UNIX_SOCKETS
parsedline->conntype = ctLocal;
-#else
- ereport(elevel,
- (errcode(ERRCODE_CONFIG_FILE_ERROR),
- errmsg("local connections are not supported by this build"),
- errcontext("line %d of configuration file \"%s\"",
- line_num, HbaFileName)));
- *err_msg = "local connections are not supported by this build";
- return NULL;
-#endif
}
else if (strcmp(token->string, "host") == 0 ||
strcmp(token->string, "hostssl") == 0 ||
diff --git a/src/backend/libpq/pqcomm.c b/src/backend/libpq/pqcomm.c
index 75392a8bb7..3ec4328613 100644
--- a/src/backend/libpq/pqcomm.c
+++ b/src/backend/libpq/pqcomm.c
@@ -149,10 +149,8 @@ static void socket_putmessage_noblock(char msgtype, const char *s, size_t len);
static int internal_putbytes(const char *s, size_t len);
static int internal_flush(void);
-#ifdef HAVE_UNIX_SOCKETS
static int Lock_AF_UNIX(const char *unixSocketDir, const char *unixSocketPath);
static int Setup_AF_UNIX(const char *sock_path);
-#endif /* HAVE_UNIX_SOCKETS */
static const PQcommMethods PqCommSocketMethods = {
socket_comm_reset,
@@ -334,10 +332,7 @@ StreamServerPort(int family, const char *hostName, unsigned short portNumber,
struct addrinfo hint;
int listen_index = 0;
int added = 0;
-
-#ifdef HAVE_UNIX_SOCKETS
char unixSocketPath[MAXPGPATH];
-#endif
#if !defined(WIN32) || defined(IPV6_V6ONLY)
int one = 1;
#endif
@@ -348,7 +343,6 @@ StreamServerPort(int family, const char *hostName, unsigned short portNumber,
hint.ai_flags = AI_PASSIVE;
hint.ai_socktype = SOCK_STREAM;
-#ifdef HAVE_UNIX_SOCKETS
if (family == AF_UNIX)
{
/*
@@ -369,7 +363,6 @@ StreamServerPort(int family, const char *hostName, unsigned short portNumber,
service = unixSocketPath;
}
else
-#endif /* HAVE_UNIX_SOCKETS */
{
snprintf(portNumberStr, sizeof(portNumberStr), "%d", portNumber);
service = portNumberStr;
@@ -427,11 +420,9 @@ StreamServerPort(int family, const char *hostName, unsigned short portNumber,
familyDesc = _("IPv6");
break;
#endif
-#ifdef HAVE_UNIX_SOCKETS
case AF_UNIX:
familyDesc = _("Unix");
break;
-#endif
default:
snprintf(familyDescBuf, sizeof(familyDescBuf),
_("unrecognized address family %d"),
@@ -441,11 +432,9 @@ StreamServerPort(int family, const char *hostName, unsigned short portNumber,
}
/* set up text form of address for log messages */
-#ifdef HAVE_UNIX_SOCKETS
if (addr->ai_family == AF_UNIX)
addrDesc = unixSocketPath;
else
-#endif
{
pg_getnameinfo_all((const struct sockaddr_storage *) addr->ai_addr,
addr->ai_addrlen,
@@ -540,7 +529,6 @@ StreamServerPort(int family, const char *hostName, unsigned short portNumber,
continue;
}
-#ifdef HAVE_UNIX_SOCKETS
if (addr->ai_family == AF_UNIX)
{
if (Setup_AF_UNIX(service) != STATUS_OK)
@@ -549,7 +537,6 @@ StreamServerPort(int family, const char *hostName, unsigned short portNumber,
break;
}
}
-#endif
/*
* Select appropriate accept-queue length limit. PG_SOMAXCONN is only
@@ -572,13 +559,11 @@ StreamServerPort(int family, const char *hostName, unsigned short portNumber,
continue;
}
-#ifdef HAVE_UNIX_SOCKETS
if (addr->ai_family == AF_UNIX)
ereport(LOG,
(errmsg("listening on Unix socket \"%s\"",
addrDesc)));
else
-#endif
ereport(LOG,
/* translator: first %s is IPv4 or IPv6 */
(errmsg("listening on %s address \"%s\", port %d",
@@ -597,8 +582,6 @@ StreamServerPort(int family, const char *hostName, unsigned short portNumber,
}
-#ifdef HAVE_UNIX_SOCKETS
-
/*
* Lock_AF_UNIX -- configure unix socket file path
*/
@@ -699,7 +682,6 @@ Setup_AF_UNIX(const char *sock_path)
}
return STATUS_OK;
}
-#endif /* HAVE_UNIX_SOCKETS */
/*
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 227bd9891e..8a038d1b2a 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -1297,7 +1297,6 @@ PostmasterMain(int argc, char *argv[])
}
#endif
-#ifdef HAVE_UNIX_SOCKETS
if (Unix_socket_directories)
{
char *rawstring;
@@ -1347,7 +1346,6 @@ PostmasterMain(int argc, char *argv[])
list_free_deep(elemlist);
pfree(rawstring);
}
-#endif
/*
* check that we have some socket to listen on
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 5db5df6285..9fbbfb1be5 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -4452,11 +4452,7 @@ static struct config_string ConfigureNamesString[] =
GUC_LIST_INPUT | GUC_LIST_QUOTE | GUC_SUPERUSER_ONLY
},
&Unix_socket_directories,
-#ifdef HAVE_UNIX_SOCKETS
DEFAULT_PGSOCKET_DIR,
-#else
- "",
-#endif
NULL, NULL, NULL
},