]> granicus.if.org Git - postgresql/commitdiff
Make default socket directory location configurable from config.h.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 30 Nov 2000 23:19:04 +0000 (23:19 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 30 Nov 2000 23:19:04 +0000 (23:19 +0000)
If we're going to let it be run-time configurable, might as well allow
this too...

src/include/config.h.in
src/include/libpq/pqcomm.h

index 13745c07f3206c765ef1ea27468e498b212c80ad..ed98a5ea70354b3469779dfda91c13169acbe0df 100644 (file)
@@ -8,7 +8,7 @@
  * or in config.h afterwards.  Of course, if you edit config.h, then your
  * changes will be overwritten the next time you run configure.
  *
- * $Id: config.h.in,v 1.151 2000/11/30 08:46:25 vadim Exp $
+ * $Id: config.h.in,v 1.152 2000/11/30 23:19:04 tgl Exp $
  */
 
 #ifndef CONFIG_H
 # define HAVE_UNIX_SOCKETS 1
 #endif
 
+/*
+ * This is the default directory in which AF_UNIX socket files are placed.
+ * Caution: changing this risks breaking your existing client applications,
+ * which are likely to continue to look in the old directory.  But if you
+ * just hate the idea of sockets in /tmp, here's where to twiddle it.
+ * You can also override this at runtime with the postmaster's -k switch.
+ */
+#define DEFAULT_PGSOCKET_DIR  "/tmp"
+
+
 /*
  *------------------------------------------------------------------------
  * These hand-configurable symbols are for enabling debugging code,
index 90caf8ff5c59d8d78fe55c8a16345ac95bf123a6..c4f607234e66d01f10d002f1ff4203b81c6ca9cc 100644 (file)
@@ -9,7 +9,7 @@
  * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pqcomm.h,v 1.51 2000/11/25 22:34:14 momjian Exp $
+ * $Id: pqcomm.h,v 1.52 2000/11/30 23:19:04 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -48,24 +48,26 @@ typedef union SockAddr
 } SockAddr;
 
 
-/* Configure the UNIX socket address for the well known port. */
-
-#if defined(SUN_LEN)
-#define UNIXSOCK_LEN(sun) \
-        (SUN_LEN(&(sun)))
-#else
-#define UNIXSOCK_LEN(sun) \
-        (strlen((sun).sun_path)+ offsetof(struct sockaddr_un, sun_path))
-#endif
+/* Configure the UNIX socket location for the well known port. */
 
 #define UNIXSOCK_PATH(sun,port,defpath) \
-        (sprintf((sun).sun_path, "%s/.s.PGSQL.%d", ((defpath) && *(defpath) != '\0') ? (defpath) : "/tmp", (port)))
+               sprintf((sun).sun_path, "%s/.s.PGSQL.%d", \
+                               ((defpath) && *(defpath) != '\0') ? (defpath) : \
+                               DEFAULT_PGSOCKET_DIR, \
+                               (port))
 
 /*
  *             We do this because sun_len is in BSD's struct, while others don't.
  *             We never actually set BSD's sun_len, and I can't think of a
  *             platform-safe way of doing it, but the code still works. bjm
  */
+#if defined(SUN_LEN)
+#define UNIXSOCK_LEN(sun) \
+               (SUN_LEN(&(sun)))
+#else
+#define UNIXSOCK_LEN(sun) \
+               (strlen((sun).sun_path) + offsetof(struct sockaddr_un, sun_path))
+#endif
 
 /*
  * These manipulate the frontend/backend protocol version number.