| 1 | /*------------------------------------------------------------------------- |
| 2 | * |
| 3 | * pidfile.h |
| 4 | * Declarations describing the data directory lock file (postmaster.pid) |
| 5 | * |
| 6 | * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group |
| 7 | * Portions Copyright (c) 1994, Regents of the University of California |
| 8 | * |
| 9 | * src/include/utils/pidfile.h |
| 10 | * |
| 11 | *------------------------------------------------------------------------- |
| 12 | */ |
| 13 | #ifndef UTILS_PIDFILE_H |
| 14 | #define UTILS_PIDFILE_H |
| 15 | |
| 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 path |
| 22 | * 3 postmaster start timestamp (time_t representation) |
| 23 | * 4 port number |
| 24 | * 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 file |
| 30 | * creation; also, line 5 is initially empty and is changed after the first |
| 31 | * Unix socket is opened. |
| 32 | * |
| 33 | * Socket lock file(s), if used, have the same contents as lines 1-5, with |
| 34 | * line 5 being their own directory. |
| 35 | */ |
| 36 | #define LOCK_FILE_LINE_PID 1 |
| 37 | #define LOCK_FILE_LINE_DATA_DIR 2 |
| 38 | #define LOCK_FILE_LINE_START_TIME 3 |
| 39 | #define LOCK_FILE_LINE_PORT 4 |
| 40 | #define LOCK_FILE_LINE_SOCKET_DIR 5 |
| 41 | #define LOCK_FILE_LINE_LISTEN_ADDR 6 |
| 42 | #define LOCK_FILE_LINE_SHMEM_KEY 7 |
| 43 | #define LOCK_FILE_LINE_PM_STATUS 8 |
| 44 | |
| 45 | /* |
| 46 | * The PM_STATUS line may contain one of these values. All these strings |
| 47 | * must be the same length, per comments for AddToDataDirLockFile(). |
| 48 | * We pad with spaces as needed to make that true. |
| 49 | */ |
| 50 | #define PM_STATUS_STARTING "starting" /* still starting up */ |
| 51 | #define PM_STATUS_STOPPING "stopping" /* in shutdown sequence */ |
| 52 | #define PM_STATUS_READY "ready " /* ready for connections */ |
| 53 | #define PM_STATUS_STANDBY "standby " /* up, won't accept connections */ |
| 54 | |
| 55 | #endif /* UTILS_PIDFILE_H */ |
| 56 | |