*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.203 2001/01/24 19:43:04 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.204 2001/01/27 00:05:31 tgl Exp $
*
* NOTES
*
timeout = &timeout_tv;
}
else
+ {
CheckPointPID = CheckPointDataBase();
+ /*
+ * Since this code is executed periodically, it's a fine
+ * place to do other actions that should happen every now
+ * and then on no particular schedule. Such as...
+ */
+ TouchSocketLockFile();
+ }
}
#ifdef USE_SSL
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.60 2001/01/24 19:43:16 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.61 2001/01/27 00:05:31 tgl Exp $
*
*-------------------------------------------------------------------------
*/
ProcessingMode Mode = InitProcessing;
+/* Note: we rely on this to initialize as zeroes */
+static char socketLockFile[MAXPGPATH];
+
/* ----------------------------------------------------------------
* ignoring system indexes support stuff
encoded_pid, socketfile);
return false;
}
+ /* Save name of lockfile for TouchSocketLockFile */
+ strcpy(socketLockFile, lockfile);
return true;
}
+/*
+ * Re-read the socket lock file. This should be called every so often
+ * to ensure that the lock file has a recent access date. That saves it
+ * from being removed by overenthusiastic /tmp-directory-cleaner daemons.
+ * (Another reason we should never have put the socket file in /tmp...)
+ */
+void
+TouchSocketLockFile(void)
+{
+ int fd;
+ char buffer[1];
+
+ /* Do nothing if we did not create a socket... */
+ if (socketLockFile[0] != '\0')
+ {
+ /* XXX any need to complain about errors here? */
+ fd = open(socketLockFile, O_RDONLY | PG_BINARY, 0);
+ if (fd >= 0)
+ {
+ read(fd, buffer, sizeof(buffer));
+ close(fd);
+ }
+ }
+}
+
+
/*-------------------------------------------------------------------------
* Version checking support
*-------------------------------------------------------------------------
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: miscadmin.h,v 1.79 2001/01/24 19:43:19 momjian Exp $
+ * $Id: miscadmin.h,v 1.80 2001/01/27 00:05:31 tgl Exp $
*
* NOTES
* some of the information in this file should be moved to
extern bool CreateDataDirLockFile(const char *datadir, bool amPostmaster);
extern bool CreateSocketLockFile(const char *socketfile, bool amPostmaster);
+extern void TouchSocketLockFile(void);
extern void ValidatePgVersion(const char *path);