diff options
author | Thomas Munro | 2022-08-13 20:46:53 +0000 |
---|---|---|
committer | Thomas Munro | 2022-08-13 20:46:53 +0000 |
commit | f5580882856963d1b50f9e391a8dda82d44b69a6 (patch) | |
tree | 4060fab53bd3b3aa98c242d3c258161925522d83 /src/test | |
parent | e07ebd4b6e606a7c03ed3c6bf5d6bcbb725247b4 (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/test')
-rw-r--r-- | src/test/regress/pg_regress.c | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c index e015a11c217..9ca1a8d9063 100644 --- a/src/test/regress/pg_regress.c +++ b/src/test/regress/pg_regress.c @@ -99,11 +99,9 @@ static char *logfilename; static FILE *logfile; static char *difffilename; static const char *sockdir; -#ifdef HAVE_UNIX_SOCKETS static const char *temp_sockdir; static char sockself[MAXPGPATH]; static char socklock[MAXPGPATH]; -#endif static _resultmap *resultmap = NULL; @@ -285,7 +283,6 @@ stop_postmaster(void) } } -#ifdef HAVE_UNIX_SOCKETS /* * Remove the socket temporary directory. pg_regress never waits for a * postmaster exit, so it is indeterminate whether the postmaster has yet to @@ -360,7 +357,6 @@ make_temp_sockdir(void) return temp_sockdir; } -#endif /* HAVE_UNIX_SOCKETS */ /* * Check whether string matches pattern @@ -683,7 +679,6 @@ initialize_environment(void) /* PGPORT, see below */ /* PGHOST, see below */ -#ifdef HAVE_UNIX_SOCKETS if (hostname != NULL) setenv("PGHOST", hostname, 1); else @@ -693,10 +688,6 @@ initialize_environment(void) sockdir = make_temp_sockdir(); setenv("PGHOST", sockdir, 1); } -#else - Assert(hostname != NULL); - setenv("PGHOST", hostname, 1); -#endif unsetenv("PGHOSTADDR"); if (port != -1) { @@ -746,11 +737,9 @@ initialize_environment(void) if (!pghost) { /* Keep this bit in sync with libpq's default host location: */ -#ifdef HAVE_UNIX_SOCKETS if (DEFAULT_PGSOCKET_DIR[0]) /* do nothing, we'll print "Unix socket" below */ ; else -#endif pghost = "localhost"; /* DefaultHost in fe-connect.c */ } @@ -2068,14 +2057,11 @@ regression_main(int argc, char *argv[], atexit(stop_postmaster); -#if !defined(HAVE_UNIX_SOCKETS) - use_unix_sockets = false; -#elif defined(WIN32) +#if defined(WIN32) /* - * We don't use Unix-domain sockets on Windows by default, even if the - * build supports them. (See comment at remove_temp() for a reason.) - * Override at your own risk. + * We don't use Unix-domain sockets on Windows by default (see comment at + * remove_temp() for a reason). Override at your own risk. */ use_unix_sockets = getenv("PG_TEST_USE_UNIX_SOCKETS") ? true : false; #else @@ -2209,7 +2195,7 @@ regression_main(int argc, char *argv[], /* * To reduce chances of interference with parallel installations, use * a port number starting in the private range (49152-65535) - * calculated from the version number. This aids !HAVE_UNIX_SOCKETS + * calculated from the version number. This aids non-Unix socket mode * systems; elsewhere, the use of a private socket directory already * prevents interference. */ @@ -2329,8 +2315,6 @@ regression_main(int argc, char *argv[], snprintf(buf, sizeof(buf), "%s/data", temp_instance); config_sspi_auth(buf, NULL); } -#elif !defined(HAVE_UNIX_SOCKETS) -#error Platform has no means to secure the test installation. #endif /* |