1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-13 07:41:39 +03:00

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.)
This commit is contained in:
Tom Lane
2000-11-29 20:59:54 +00:00
parent 1efd7330cb
commit 792b0f4666
10 changed files with 498 additions and 566 deletions

View File

@ -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");
}
/*