From 792b0f4666b6ea6346aa8d29b568e5d3fe1fcef5 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 29 Nov 2000 20:59:54 +0000 Subject: 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.) --- src/backend/tcop/postgres.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'src/backend/tcop/postgres.c') 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"); } /* -- cgit v1.2.3