aboutsummaryrefslogtreecommitdiff
path: root/src/backend/tcop/postgres.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-11-29 20:59:54 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-11-29 20:59:54 +0000
commit792b0f4666b6ea6346aa8d29b568e5d3fe1fcef5 (patch)
treedf4cff9d3d2bfbae0ff00928965e5751649e942b /src/backend/tcop/postgres.c
parent1efd7330cbdd50fc2c9b065e63db357b539a4d1d (diff)
downloadpostgresql-792b0f4666b6ea6346aa8d29b568e5d3fe1fcef5.tar.gz
postgresql-792b0f4666b6ea6346aa8d29b568e5d3fe1fcef5.zip
Get rid of not-very-portable fcntl(F_SETLK) mechanism for locking the Unix
socket file, in favor of having an ordinary lockfile beside the socket file. Clean up a few robustness problems in the lockfile code. If postmaster is going to reject a connection request based on database state, it will now tell you so before authentication exchange not after. (Of course, a failure after is still possible if conditions change meanwhile, but this makes life easier for a yet-to-be-written pg_ping utility.)
Diffstat (limited to 'src/backend/tcop/postgres.c')
-rw-r--r--src/backend/tcop/postgres.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 0f8dec00d89..7d143a9590a 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.191 2000/11/25 20:33:52 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.192 2000/11/29 20:59:52 tgl Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
@@ -1514,16 +1514,10 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
}
/*
- * Try to create pid file.
+ * Create lockfile for data directory.
*/
- SetPidFname(DataDir);
- if (SetPidFile(-getpid()))
- proc_exit(0);
-
- /*
- * Register clean up proc.
- */
- on_proc_exit(UnlinkPidFile, 0);
+ if (! CreateDataDirLockFile(DataDir, false))
+ proc_exit(1);
XLOGPathInit();
BaseInit();
@@ -1635,7 +1629,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
if (!IsUnderPostmaster)
{
puts("\nPOSTGRES backend interactive interface ");
- puts("$Revision: 1.191 $ $Date: 2000/11/25 20:33:52 $\n");
+ puts("$Revision: 1.192 $ $Date: 2000/11/29 20:59:52 $\n");
}
/*