60#define DIRECTORY_LOCK_FILE "postmaster.pid"
165 errmsg_internal(
"could not set postmaster death monitoring pipe to FD_CLOEXEC mode: %m")));
206 elog(
FATAL,
"%s: could not locate my own executable path",
269#define PG_PROCTYPE(bktype, description, main_func, shmem_attach) \
270 case bktype: backendDesc = description; break;
307 errmsg(
"data directory \"%s\" does not exist",
312 errmsg(
"could not read permissions of directory \"%s\": %m",
320 errmsg(
"specified data directory \"%s\" is not a directory",
332#if !defined(WIN32) && !defined(__CYGWIN__)
336 errmsg(
"data directory \"%s\" has wrong ownership",
338 errhint(
"The server must be started by the user that owns the data directory.")));
352#if !defined(WIN32) && !defined(__CYGWIN__)
356 errmsg(
"data directory \"%s\" has invalid permissions",
358 errdetail(
"Permissions should be u=rwx (0700) or u=rwx,g=rx (0750).")));
373#if !defined(WIN32) && !defined(__CYGWIN__)
416 errmsg(
"could not change directory to \"%s\": %m",
674 errmsg(
"cannot set parameter \"%s\" within security-restricted operation",
747 if (rolename !=
NULL)
753 errmsg(
"role \"%s\" does not exist", rolename)));
761 errmsg(
"role with OID %u does not exist", roleid)));
807 errmsg(
"role \"%s\" is not permitted to log in",
822 if (
rform->rolconnlimit >= 0 &&
828 errmsg(
"too many connections for role \"%s\"",
999 errmsg(
"invalid role OID: %u", roleid)));
1146 (
errmsg(
"database system is shut down")));
1204 envvar =
getenv(
"PG_GRANDPARENT_PID");
1233 errmsg(
"could not create lock file \"%s\": %m",
1247 errmsg(
"could not open lock file \"%s\": %m",
1251 if ((
len =
read(
fd, buffer,
sizeof(buffer) - 1)) < 0)
1254 errmsg(
"could not read lock file \"%s\": %m",
1264 errhint(
"Either another server is starting, or the lock file is the remnant of a previous server startup crash.")));
1274 elog(
FATAL,
"bogus data in lock file \"%s\": \"%s\"",
1308 errmsg(
"lock file \"%s\" already exists",
1312 errhint(
"Is another postgres (PID %d) running in data directory \"%s\"?",
1314 errhint(
"Is another postmaster (PID %d) running in data directory \"%s\"?",
1317 errhint(
"Is another postgres (PID %d) using socket file \"%s\"?",
1319 errhint(
"Is another postmaster (PID %d) using socket file \"%s\"?",
1355 errmsg(
"pre-existing shared memory block (key %lu, ID %lu) is still in use",
1357 errhint(
"Terminate any old server processes associated with data directory \"%s\".",
1370 errmsg(
"could not remove old lock file \"%s\": %m",
1372 errhint(
"The file seems accidentally left over, but "
1373 "it could not be removed. Please remove the file "
1374 "by hand and try again.")));
1395 strlcat(buffer,
"\n",
sizeof(buffer));
1534 errmsg(
"could not open file \"%s\": %m",
1545 errmsg(
"could not read from file \"%s\": %m",
1609 errmsg(
"could not write to file \"%s\": %m",
1620 errmsg(
"could not write to file \"%s\": %m",
1628 errmsg(
"could not write to file \"%s\": %m",
1668 errmsg(
"could not open file \"%s\": %m",
1675 errmsg(
"could not open file \"%s\": %m; continuing anyway",
1681 len =
read(
fd, buffer,
sizeof(buffer) - 1);
1687 errmsg(
"could not read from file \"%s\": %m",
1700 (
errmsg(
"lock file \"%s\" contains wrong PID: %ld instead of %ld",
1739 errmsg(
"\"%s\" is not a valid data directory",
1755 errmsg(
"\"%s\" is not a valid data directory",
1757 errdetail(
"File \"%s\" does not contain valid data.",
1759 errhint(
"You might need to initdb.")));
1766 errmsg(
"database files are incompatible with server"),
1767 errdetail(
"The data directory was initialized by PostgreSQL version %s, "
1768 "which is not compatible with this version %s.",
1805 if (libraries ==
NULL || libraries[0] ==
'\0')
1819 errmsg(
"invalid list syntax in parameter \"%s\"",
1828 char *expanded =
NULL;
1855 "shared_preload_libraries",
1868 "session_preload_libraries",
1871 "local_preload_libraries",
bool InitializingParallelWorker
#define CStringGetTextDatum(s)
#define PG_USED_FOR_ASSERTS_ONLY
#define Assert(condition)
#define OidIsValid(objectId)
int find_my_exec(const char *argv0, char *retpath)
void load_file(const char *filename, bool restricted)
int errcode_for_socket_access(void)
int errmsg_internal(const char *fmt,...)
int errcode_for_file_access(void)
int errdetail(const char *fmt,...)
int errhint(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
FILE * AllocateFile(const char *name, const char *mode)
void SetDataDirectoryCreatePerm(int dataDirMode)
#define PG_MODE_MASK_GROUP
#define PG_RETURN_DATUM(x)
char pkglib_path[MAXPGPATH]
bool IsPostmasterEnvironment
char my_exec_path[MAXPGPATH]
void SetConfigOption(const char *name, const char *value, GucContext context, GucSource source)
#define HeapTupleIsValid(tuple)
static void * GETSTRUCT(const HeapTupleData *tuple)
void SignalHandlerForCrashExit(SIGNAL_ARGS)
void AcceptInvalidationMessages(void)
void on_proc_exit(pg_on_exit_callback function, Datum arg)
void InitializeLatchWaitSet(void)
void SetLatch(Latch *latch)
void InitLatch(Latch *latch)
#define FeBeWaitSetLatchPos
List * lcons(void *datum, List *list)
void list_free_deep(List *list)
char * MemoryContextStrdup(MemoryContext context, const char *string)
char * pstrdup(const char *in)
void pfree(void *pointer)
MemoryContext TopMemoryContext
#define IsBootstrapProcessingMode()
#define AmAutoVacuumWorkerProcess()
#define SECURITY_NOFORCE_RLS
#define AmBackgroundWorkerProcess()
#define SECURITY_RESTRICTED_OPERATION
#define AmLogicalSlotSyncWorkerProcess()
#define SECURITY_LOCAL_USERID_CHANGE
#define AmRegularBackendProcess()
void(* shmem_request_hook_type)(void)
void ChangeToDataDir(void)
bool process_shared_preload_libraries_done
void process_shmem_requests(void)
void InitializeSessionUserId(const char *rolename, Oid roleid, bool bypass_login_check)
void InitStandaloneProcess(const char *argv0)
void InitializeSystemUser(const char *authn_id, const char *auth_method)
void InitializeSessionUserIdStandalone(void)
void AddToDataDirLockFile(int target_line, const char *str)
void InitProcessLocalLatch(void)
void GetUserIdAndSecContext(Oid *userid, int *sec_context)
void SetSessionAuthorization(Oid userid, bool is_superuser)
void process_session_preload_libraries(void)
static bool SessionUserIsSuperuser
bool process_shmem_requests_in_progress
const char * GetSystemUser(void)
bool InSecurityRestrictedOperation(void)
#define DIRECTORY_LOCK_FILE
static const char * SystemUser
bool GetSessionUserIsSuperuser(void)
const char * GetBackendTypeDesc(BackendType backendType)
static int SecurityRestrictionContext
static void SetOuterUserId(Oid userid, bool is_superuser)
Size EstimateClientConnectionInfoSpace(void)
Oid GetSessionUserId(void)
void SetCurrentRoleId(Oid roleid, bool is_superuser)
Oid GetAuthenticatedUserId(void)
bool InLocalUserIdChange(void)
Datum system_user(PG_FUNCTION_ARGS)
void SetDatabasePath(const char *path)
void InitPostmasterChild(void)
char * shared_preload_libraries_string
ClientConnectionInfo MyClientConnectionInfo
void process_shared_preload_libraries(void)
char * session_preload_libraries_string
static void SetSessionUserId(Oid userid, bool is_superuser)
shmem_request_hook_type shmem_request_hook
char * local_preload_libraries_string
static Latch LocalLatchData
void TouchSocketLockFiles(void)
void RestoreClientConnectionInfo(char *conninfo)
static bool SetRoleIsActive
bool InNoForceRLSOperation(void)
static Oid AuthenticatedUserId
static void load_libraries(const char *libraries, const char *gucname, bool restricted)
void SetAuthenticatedUserId(Oid userid)
Oid GetCurrentRoleId(void)
static void UnlinkLockFiles(int status, Datum arg)
void SwitchToSharedLatch(void)
BackendType MyBackendType
void GetUserIdAndContext(Oid *userid, bool *sec_def_context)
void SetDataDir(const char *dir)
void SetUserIdAndContext(Oid userid, bool sec_def_context)
bool process_shared_preload_libraries_in_progress
void pg_bindtextdomain(const char *domain)
bool has_rolreplication(Oid roleid)
char * GetUserNameFromId(Oid roleid, bool noerr)
static void CreateLockFile(const char *filename, bool amPostmaster, const char *socketDir, bool isDDLock, const char *refName)
void SerializeClientConnectionInfo(Size maxsize PG_USED_FOR_ASSERTS_ONLY, char *start_address)
void ValidatePgVersion(const char *path)
void SetUserIdAndSecContext(Oid userid, int sec_context)
bool RecheckDataDirLockFile(void)
void CreateDataDirLockFile(bool amPostmaster)
void SwitchBackToLocalLatch(void)
void CreateSocketLockFile(const char *socketfile, bool amPostmaster, const char *socketDir)
FormData_pg_authid * Form_pg_authid
#define LOCK_FILE_LINE_SHMEM_KEY
void PostmasterDeathSignalInit(void)
void get_pkglib_path(const char *my_exec_path, char *ret_path)
void get_locale_path(const char *my_exec_path, char *ret_path)
char * make_absolute_path(const char *path)
char * first_dir_separator(const char *filename)
size_t strlcat(char *dst, const char *src, size_t siz)
static Datum PointerGetDatum(const void *X)
static Datum ObjectIdGetDatum(Oid X)
void InitProcessGlobals(void)
int postmaster_alive_fds[2]
#define POSTMASTER_FD_WATCH
WaitEventSet * FeBeWaitSet
static int fd(const char *x, int i)
int CountUserBackends(Oid roleid)
char * psprintf(const char *fmt,...)
Size add_size(Size s1, Size s2)
void pgwin32_signal_initialize(void)
bool superuser_arg(Oid roleid)
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(int cacheId, Datum key1)
bool PGSharedMemoryIsInUse(unsigned long id1, unsigned long id2)
bool SplitDirectoriesString(char *rawstring, char separator, List **namelist)
static void pgstat_report_wait_start(uint32 wait_event_info)
static void pgstat_report_wait_end(void)
void ModifyWaitEvent(WaitEventSet *set, int pos, uint32 events, Latch *latch)
void InitializeWaitEventSupport(void)