Index: doc/src/sgml/runtime.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v
retrieving revision 1.321
diff -c -c -r1.321 runtime.sgml
*** doc/src/sgml/runtime.sgml 25 May 2005 02:56:15 -0000 1.321
--- doc/src/sgml/runtime.sgml 27 May 2005 20:46:42 -0000
***************
*** 309,318 ****
While the postmaster is running, its
PID is stored in the file
! postmaster.pid in the data directory. This is
! used to prevent multiple postmaster processes
! running in the same data directory and can also be used for
! shutting down the postmaster process.
--- 309,319 ----
While the postmaster is running, its
PID is stored in the file
! postmaster.pid in the data or configuration
! directory. This is used to prevent multiple
! postmaster processes running in the same data
! directory and can also be used for shutting down the
! postmaster process.
***************
*** 4933,4940 ****
Alternatively, you can send the signal directly using kill>.
The PID> of the postmaster process can be
found using the ps program, or from the file
! postmaster.pid in the data directory. For
! example, to do a fast shutdown:
$ kill -INT `head -1 /usr/local/pgsql/data/postmaster.pid`
--- 4934,4941 ----
Alternatively, you can send the signal directly using kill>.
The PID> of the postmaster process can be
found using the ps program, or from the file
! postmaster.pid in the data or configuration directory.
! For example, to do a fast shutdown:
$ kill -INT `head -1 /usr/local/pgsql/data/postmaster.pid`
Index: src/backend/bootstrap/bootstrap.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v
retrieving revision 1.204
diff -c -c -r1.204 bootstrap.c
*** src/backend/bootstrap/bootstrap.c 6 May 2005 17:24:52 -0000 1.204
--- src/backend/bootstrap/bootstrap.c 27 May 2005 20:46:43 -0000
***************
*** 367,373 ****
/* If standalone, create lockfile for data directory */
if (!IsUnderPostmaster)
! CreateDataDirLockFile(DataDir, false);
SetProcessingMode(BootstrapProcessing);
IgnoreSystemIndexes(true);
--- 367,373 ----
/* If standalone, create lockfile for data directory */
if (!IsUnderPostmaster)
! CreateDataDirLockFile(userDoption, false);
SetProcessingMode(BootstrapProcessing);
IgnoreSystemIndexes(true);
Index: src/backend/postmaster/postmaster.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v
retrieving revision 1.451
diff -c -c -r1.451 postmaster.c
*** src/backend/postmaster/postmaster.c 15 May 2005 00:26:18 -0000 1.451
--- src/backend/postmaster/postmaster.c 27 May 2005 20:46:45 -0000
***************
*** 689,695 ****
* :-(). For the same reason, it's best to grab the TCP socket(s)
* before the Unix socket.
*/
! CreateDataDirLockFile(DataDir, true);
/*
* Remove old temporary files. At this point there can be no other
--- 689,695 ----
* :-(). For the same reason, it's best to grab the TCP socket(s)
* before the Unix socket.
*/
! CreateDataDirLockFile(userDoption, true);
/*
* Remove old temporary files. At this point there can be no other
Index: src/backend/tcop/postgres.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/tcop/postgres.c,v
retrieving revision 1.444
diff -c -c -r1.444 postgres.c
*** src/backend/tcop/postgres.c 24 May 2005 04:18:04 -0000 1.444
--- src/backend/tcop/postgres.c 27 May 2005 20:46:47 -0000
***************
*** 2795,2801 ****
/*
* Create lockfile for data directory.
*/
! CreateDataDirLockFile(DataDir, false);
XLOGPathInit();
BaseInit();
--- 2795,2801 ----
/*
* Create lockfile for data directory.
*/
! CreateDataDirLockFile(userDoption, false);
XLOGPathInit();
BaseInit();
Index: src/backend/utils/init/miscinit.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v
retrieving revision 1.139
diff -c -c -r1.139 miscinit.c
*** src/backend/utils/init/miscinit.c 14 Apr 2005 20:03:26 -0000 1.139
--- src/backend/utils/init/miscinit.c 27 May 2005 20:46:47 -0000
***************
*** 706,719 ****
}
void
! CreateDataDirLockFile(const char *datadir, bool amPostmaster)
{
char lockfile[MAXPGPATH];
! snprintf(lockfile, sizeof(lockfile), "%s/postmaster.pid", datadir);
! CreateLockFile(lockfile, amPostmaster, true, datadir);
/* Save name of lockfile for RecordSharedMemoryInLockFile */
strcpy(directoryLockFile, lockfile);
}
void
--- 706,733 ----
}
void
! CreateDataDirLockFile(const char *userDoption, bool amPostmaster)
{
char lockfile[MAXPGPATH];
! char *configdir;
!
! /* configdir is -D option, or $PGDATA if no -D.
! * The pid file has to be created in the -D/PGDATA
! * location because that is the only location pg_ctl
! * knows about.
! */
! if (userDoption)
! configdir = make_absolute_path(userDoption);
! else
! configdir = make_absolute_path(getenv("PGDATA"));
!
! snprintf(lockfile, sizeof(lockfile), "%s/postmaster.pid", configdir);
! CreateLockFile(lockfile, amPostmaster, true, configdir);
/* Save name of lockfile for RecordSharedMemoryInLockFile */
strcpy(directoryLockFile, lockfile);
+
+ free(configdir);
}
void
Index: src/include/miscadmin.h
===================================================================
RCS file: /cvsroot/pgsql/src/include/miscadmin.h,v
retrieving revision 1.175
diff -c -c -r1.175 miscadmin.h
*** src/include/miscadmin.h 26 Feb 2005 18:43:34 -0000 1.175
--- src/include/miscadmin.h 27 May 2005 20:46:49 -0000
***************
*** 309,315 ****
extern void ResetReindexProcessing(void);
extern bool ReindexIsProcessingHeap(Oid heapOid);
extern bool ReindexIsProcessingIndex(Oid indexOid);
! extern void CreateDataDirLockFile(const char *datadir, bool amPostmaster);
extern void CreateSocketLockFile(const char *socketfile, bool amPostmaster);
extern void TouchSocketLockFile(void);
extern void RecordSharedMemoryInLockFile(unsigned long id1,
--- 309,315 ----
extern void ResetReindexProcessing(void);
extern bool ReindexIsProcessingHeap(Oid heapOid);
extern bool ReindexIsProcessingIndex(Oid indexOid);
! extern void CreateDataDirLockFile(const char *userDoption, bool amPostmaster);
extern void CreateSocketLockFile(const char *socketfile, bool amPostmaster);
extern void TouchSocketLockFile(void);
extern void RecordSharedMemoryInLockFile(unsigned long id1,