summaryrefslogtreecommitdiff
path: root/src/backend/port/sysv_shmem.c
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/backend/port/sysv_shmem.c
parentf0f36045b2e3d037bb7647d84373404fa4ba9588 (diff)
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/backend/port/sysv_shmem.c')
-rw-r--r--src/backend/port/sysv_shmem.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/backend/port/sysv_shmem.c b/src/backend/port/sysv_shmem.c
index 474c6142ebe..aece026ec64 100644
--- a/src/backend/port/sysv_shmem.c
+++ b/src/backend/port/sysv_shmem.c
@@ -199,15 +199,16 @@ InternalIpcMemoryCreate(IpcMemoryKey memKey, Size size)
on_shmem_exit(IpcMemoryDetach, PointerGetDatum(memAddress));
/*
- * Append record key and ID in lockfile for data directory. Format
- * to try to keep it the same length.
+ * Store shmem key and ID in data directory lockfile. Format to try to
+ * keep it the same length always (trailing junk in the lockfile won't
+ * hurt, but might confuse humans).
*/
{
- char line[32];
+ char line[64];
- sprintf(line, "%9lu %9lu\n", (unsigned long) memKey,
- (unsigned long) shmid);
- AddToLockFile(LOCK_FILE_LINES, line);
+ sprintf(line, "%9lu %9lu",
+ (unsigned long) memKey, (unsigned long) shmid);
+ AddToDataDirLockFile(LOCK_FILE_LINE_SHMEM_KEY, line);
}
return memAddress;