aboutsummaryrefslogtreecommitdiff
path: root/src/include/port.h
diff options
context:
space:
mode:
authorThomas Munro <tmunro@postgresql.org>2022-08-05 09:22:56 +1200
committerThomas Munro <tmunro@postgresql.org>2022-08-05 09:22:56 +1200
commit2b1f580ee2ca373d0451d89a40fc8f0a5f55ede9 (patch)
treef752391d9be7ab5a8229c1f3c4e0e5f413e5d5ec /src/include/port.h
parentadeef67834cc3db14c36430c1421cf4ed8a809d3 (diff)
downloadpostgresql-2b1f580ee2ca373d0451d89a40fc8f0a5f55ede9.tar.gz
postgresql-2b1f580ee2ca373d0451d89a40fc8f0a5f55ede9.zip
Remove configure probes for symlink/readlink, and dead code.
symlink() and readlink() are in SUSv2 and all targeted Unix systems have them. We have partial emulation on Windows. Code that raised runtime errors on systems without it has been dead for years, so we can remove that and also references to such systems in the documentation. Define HAVE_READLINK and HAVE_SYMLINK macros on Unix. Our Windows replacement functions based on junction points can't be used for relative paths or for non-directories, so the macros can be used to check for full symlink support. The places that deal with tablespaces can just use symlink functions without checking the macros. (If they did check the macros, they'd need to provide an #else branch with a runtime or compile time error, and it'd be dead code.) Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Reviewed-by: Andres Freund <andres@anarazel.de> Discussion: https://postgr.es/m/CA+hUKGJ3LHeP9w5Fgzdr4G8AnEtJ=z=p6hGDEm4qYGEUX5B6fQ@mail.gmail.com
Diffstat (limited to 'src/include/port.h')
-rw-r--r--src/include/port.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/include/port.h b/src/include/port.h
index 7a1a02f6598..7dad6caa639 100644
--- a/src/include/port.h
+++ b/src/include/port.h
@@ -522,11 +522,19 @@ extern bool wait_result_is_any_signal(int exit_status, bool include_command_not_
/*
* Interfaces that we assume all Unix system have. We retain individual macros
* for better documentation.
+ *
+ * For symlink-related functions, there is often no need to test these macros,
+ * because we provided basic support on Windows that can work with absolute
+ * paths to directories. Code that wants to test for complete symlink support
+ * (including relative paths and non-directories) should be conditional on
+ * HAVE_READLINK or HAVE_SYMLINK.
*/
#ifndef WIN32
#define HAVE_GETRLIMIT 1
+#define HAVE_READLINK 1
#define HAVE_SETSID 1
#define HAVE_SHM_OPEN 1
+#define HAVE_SYMLINK 1
#endif
#endif /* PG_PORT_H */