codekingpro/portable-devtools
116k
1/*-------------------------------------------------------------------------2 *3 * pidfile.h4 * Declarations describing the data directory lock file (postmaster.pid)5 *6 * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group7 * Portions Copyright (c) 1994, Regents of the University of California8 *9 * src/include/utils/pidfile.h10 *11 *-------------------------------------------------------------------------12 */13#ifndef UTILS_PIDFILE_H14#define UTILS_PIDFILE_H15 16/*17 * As of Postgres 10, the contents of the data-directory lock file are:18 *19 * line #20 * 1 postmaster PID (or negative of a standalone backend's PID)21 * 2 data directory path22 * 3 postmaster start timestamp (time_t representation)23 * 4 port number24 * 5 first Unix socket directory path (empty if none)25 * 6 first listen_address (IP address or "*"; empty if no TCP port)26 * 7 shared memory key (empty on Windows)27 * 8 postmaster status (see values below)28 *29 * Lines 6 and up are added via AddToDataDirLockFile() after initial file30 * creation; also, line 5 is initially empty and is changed after the first31 * Unix socket is opened. Onlookers should not assume that lines 4 and up32 * are filled in any particular order.33 *34 * Socket lock file(s), if used, have the same contents as lines 1-5, with35 * line 5 being their own directory.36 */37#define LOCK_FILE_LINE_PID 138#define LOCK_FILE_LINE_DATA_DIR 239#define LOCK_FILE_LINE_START_TIME 340#define LOCK_FILE_LINE_PORT 441#define LOCK_FILE_LINE_SOCKET_DIR 542#define LOCK_FILE_LINE_LISTEN_ADDR 643#define LOCK_FILE_LINE_SHMEM_KEY 744#define LOCK_FILE_LINE_PM_STATUS 845 46/*47 * The PM_STATUS line may contain one of these values. All these strings48 * must be the same length, per comments for AddToDataDirLockFile().49 * We pad with spaces as needed to make that true.50 */51#define PM_STATUS_STARTING "starting" /* still starting up */52#define PM_STATUS_STOPPING "stopping" /* in shutdown sequence */53#define PM_STATUS_READY "ready " /* ready for connections */54#define PM_STATUS_STANDBY "standby " /* up, won't accept connections */55 56#endif /* UTILS_PIDFILE_H */57 