aboutsummaryrefslogtreecommitdiff
path: root/src/include/miscadmin.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2011-01-13 19:01:28 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2011-01-13 19:01:28 -0500
commit52948169bcddf443b76d6ff1806259b153a2ac04 (patch)
tree9582d9be324ed653a88b63688f5e7073d3329ccf /src/include/miscadmin.h
parentf0f36045b2e3d037bb7647d84373404fa4ba9588 (diff)
downloadpostgresql-52948169bcddf443b76d6ff1806259b153a2ac04.tar.gz
postgresql-52948169bcddf443b76d6ff1806259b153a2ac04.zip
Code review for postmaster.pid contents changes.
Fix broken test for pre-existing postmaster, caused by wrong code for appending lines to the lockfile; don't write a failed listen_address setting into the lockfile; don't arbitrarily change the location of the data directory in the lockfile compared to previous releases; provide more consistent and useful definitions of the socket path and listen_address entries; avoid assuming that pg_ctl has the same DEFAULT_PGSOCKET_DIR as the postmaster; assorted code style improvements.
Diffstat (limited to 'src/include/miscadmin.h')
-rw-r--r--src/include/miscadmin.h28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h
index 382a5deced4..aa8cce5ca81 100644
--- a/src/include/miscadmin.h
+++ b/src/include/miscadmin.h
@@ -348,11 +348,35 @@ extern PGDLLIMPORT bool process_shared_preload_libraries_in_progress;
extern char *shared_preload_libraries_string;
extern char *local_preload_libraries_string;
-#define LOCK_FILE_LINES 7
+/*
+ * As of 9.1, the contents of the data-directory lock file are:
+ *
+ * line #
+ * 1 postmaster PID (or negative of a standalone backend's PID)
+ * 2 data directory path
+ * 3 postmaster start timestamp (time_t representation)
+ * 4 port number
+ * 5 socket directory path (empty on Windows)
+ * 6 first listen_address (IP address or "*"; empty if no TCP port)
+ * 7 shared memory key (not present on Windows)
+ *
+ * Lines 6 and up are added via AddToDataDirLockFile() after initial file
+ * creation; they have to be ordered according to time of addition.
+ *
+ * The socket lock file, if used, has the same contents as lines 1-5.
+ */
+#define LOCK_FILE_LINE_PID 1
+#define LOCK_FILE_LINE_DATA_DIR 2
+#define LOCK_FILE_LINE_START_TIME 3
+#define LOCK_FILE_LINE_PORT 4
+#define LOCK_FILE_LINE_SOCKET_DIR 5
+#define LOCK_FILE_LINE_LISTEN_ADDR 6
+#define LOCK_FILE_LINE_SHMEM_KEY 7
+
extern void CreateDataDirLockFile(bool amPostmaster);
extern void CreateSocketLockFile(const char *socketfile, bool amPostmaster);
extern void TouchSocketLockFile(void);
-extern void AddToLockFile(int target_line, const char *str);
+extern void AddToDataDirLockFile(int target_line, const char *str);
extern void ValidatePgVersion(const char *path);
extern void process_shared_preload_libraries(void);
extern void process_local_preload_libraries(void);