PostgreSQL Source Code git master
|
#include "postgres.h"
#include <sys/param.h>
#include <signal.h>
#include <time.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <grp.h>
#include <pwd.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <utime.h>
#include "access/htup_details.h"
#include "access/parallel.h"
#include "catalog/pg_authid.h"
#include "common/file_perm.h"
#include "libpq/libpq.h"
#include "libpq/pqsignal.h"
#include "mb/pg_wchar.h"
#include "miscadmin.h"
#include "pgstat.h"
#include "postmaster/autovacuum.h"
#include "postmaster/interrupt.h"
#include "postmaster/postmaster.h"
#include "replication/slotsync.h"
#include "storage/fd.h"
#include "storage/ipc.h"
#include "storage/latch.h"
#include "storage/pg_shmem.h"
#include "storage/pmsignal.h"
#include "storage/proc.h"
#include "storage/procarray.h"
#include "utils/builtins.h"
#include "utils/guc.h"
#include "utils/inval.h"
#include "utils/memutils.h"
#include "utils/pidfile.h"
#include "utils/syscache.h"
#include "utils/varlena.h"
Go to the source code of this file.
Data Structures | |
struct | SerializedClientConnectionInfo |
Macros | |
#define | DIRECTORY_LOCK_FILE "postmaster.pid" |
Typedefs | |
typedef struct SerializedClientConnectionInfo | SerializedClientConnectionInfo |
Functions | |
void | InitPostmasterChild (void) |
void | InitStandaloneProcess (const char *argv0) |
void | SwitchToSharedLatch (void) |
void | InitProcessLocalLatch (void) |
void | SwitchBackToLocalLatch (void) |
const char * | GetBackendTypeDesc (BackendType backendType) |
void | SetDatabasePath (const char *path) |
void | checkDataDir (void) |
void | SetDataDir (const char *dir) |
void | ChangeToDataDir (void) |
Oid | GetUserId (void) |
Oid | GetOuterUserId (void) |
static void | SetOuterUserId (Oid userid, bool is_superuser) |
Oid | GetSessionUserId (void) |
bool | GetSessionUserIsSuperuser (void) |
static void | SetSessionUserId (Oid userid, bool is_superuser) |
const char * | GetSystemUser (void) |
Oid | GetAuthenticatedUserId (void) |
void | SetAuthenticatedUserId (Oid userid) |
void | GetUserIdAndSecContext (Oid *userid, int *sec_context) |
void | SetUserIdAndSecContext (Oid userid, int sec_context) |
bool | InLocalUserIdChange (void) |
bool | InSecurityRestrictedOperation (void) |
bool | InNoForceRLSOperation (void) |
void | GetUserIdAndContext (Oid *userid, bool *sec_def_context) |
void | SetUserIdAndContext (Oid userid, bool sec_def_context) |
bool | has_rolreplication (Oid roleid) |
void | InitializeSessionUserId (const char *rolename, Oid roleid, bool bypass_login_check) |
void | InitializeSessionUserIdStandalone (void) |
void | InitializeSystemUser (const char *authn_id, const char *auth_method) |
Datum | system_user (PG_FUNCTION_ARGS) |
void | SetSessionAuthorization (Oid userid, bool is_superuser) |
Oid | GetCurrentRoleId (void) |
void | SetCurrentRoleId (Oid roleid, bool is_superuser) |
char * | GetUserNameFromId (Oid roleid, bool noerr) |
Size | EstimateClientConnectionInfoSpace (void) |
void | SerializeClientConnectionInfo (Size maxsize, char *start_address) |
void | RestoreClientConnectionInfo (char *conninfo) |
static void | UnlinkLockFiles (int status, Datum arg) |
static void | CreateLockFile (const char *filename, bool amPostmaster, const char *socketDir, bool isDDLock, const char *refName) |
void | CreateDataDirLockFile (bool amPostmaster) |
void | CreateSocketLockFile (const char *socketfile, bool amPostmaster, const char *socketDir) |
void | TouchSocketLockFiles (void) |
void | AddToDataDirLockFile (int target_line, const char *str) |
bool | RecheckDataDirLockFile (void) |
void | ValidatePgVersion (const char *path) |
static void | load_libraries (const char *libraries, const char *gucname, bool restricted) |
void | process_shared_preload_libraries (void) |
void | process_session_preload_libraries (void) |
void | process_shmem_requests (void) |
void | pg_bindtextdomain (const char *domain) |
Variables | |
ProcessingMode | Mode = InitProcessing |
BackendType | MyBackendType |
static List * | lock_files = NIL |
static Latch | LocalLatchData |
bool | IgnoreSystemIndexes = false |
static Oid | AuthenticatedUserId = InvalidOid |
static Oid | SessionUserId = InvalidOid |
static Oid | OuterUserId = InvalidOid |
static Oid | CurrentUserId = InvalidOid |
static const char * | SystemUser = NULL |
static bool | SessionUserIsSuperuser = false |
static int | SecurityRestrictionContext = 0 |
static bool | SetRoleIsActive = false |
ClientConnectionInfo | MyClientConnectionInfo |
char * | session_preload_libraries_string = NULL |
char * | shared_preload_libraries_string = NULL |
char * | local_preload_libraries_string = NULL |
bool | process_shared_preload_libraries_in_progress = false |
bool | process_shared_preload_libraries_done = false |
shmem_request_hook_type | shmem_request_hook = NULL |
bool | process_shmem_requests_in_progress = false |
#define DIRECTORY_LOCK_FILE "postmaster.pid" |
Definition at line 60 of file miscinit.c.
typedef struct SerializedClientConnectionInfo SerializedClientConnectionInfo |
void AddToDataDirLockFile | ( | int | target_line, |
const char * | str | ||
) |
Definition at line 1567 of file miscinit.c.
References close, DIRECTORY_LOCK_FILE, ereport, errcode_for_file_access(), errmsg(), fd(), len, LOG, PG_BINARY, pg_fsync(), pg_pwrite, pgstat_report_wait_end(), pgstat_report_wait_start(), read, snprintf, and str.
Referenced by InternalIpcMemoryCreate(), PostmasterMain(), process_pm_child_exit(), process_pm_pmsignal(), and process_pm_shutdown_request().
void ChangeToDataDir | ( | void | ) |
Definition at line 457 of file miscinit.c.
References Assert, DataDir, ereport, errcode_for_file_access(), errmsg(), and FATAL.
Referenced by BootstrapModeMain(), PostgresSingleUserMain(), and PostmasterMain().
void checkDataDir | ( | void | ) |
Definition at line 344 of file miscinit.c.
References Assert, data_directory_mode, DataDir, ereport, errcode(), errcode_for_file_access(), errdetail(), errhint(), errmsg(), FATAL, pg_dir_create_mode, pg_mode_mask, PG_MODE_MASK_GROUP, S_ISDIR, SetDataDirectoryCreatePerm(), stat::st_mode, stat::st_uid, stat, and ValidatePgVersion().
Referenced by BootstrapModeMain(), PostgresSingleUserMain(), and PostmasterMain().
void CreateDataDirLockFile | ( | bool | amPostmaster | ) |
Definition at line 1511 of file miscinit.c.
References CreateLockFile(), DataDir, and DIRECTORY_LOCK_FILE.
Referenced by BootstrapModeMain(), PostgresSingleUserMain(), and PostmasterMain().
|
static |
Definition at line 1206 of file miscinit.c.
References close, DataDir, elog, ereport, errcode(), errcode_for_file_access(), errhint(), errmsg(), FATAL, fd(), filename, INT64_FORMAT, kill, lcons(), len, LOCK_FILE_LINE_SHMEM_KEY, lock_files, MAXPGPATH, MyStartTime, NIL, on_proc_exit(), pg_file_create_mode, pg_fsync(), PGSharedMemoryIsInUse(), pgstat_report_wait_end(), pgstat_report_wait_start(), PostPortNumber, pstrdup(), read, snprintf, strlcat(), UnlinkLockFiles(), and write.
Referenced by CreateDataDirLockFile(), and CreateSocketLockFile().
void CreateSocketLockFile | ( | const char * | socketfile, |
bool | amPostmaster, | ||
const char * | socketDir | ||
) |
Definition at line 1520 of file miscinit.c.
References CreateLockFile(), MAXPGPATH, and snprintf.
Referenced by Lock_AF_UNIX().
Size EstimateClientConnectionInfoSpace | ( | void | ) |
Definition at line 1083 of file miscinit.c.
References add_size(), ClientConnectionInfo::authn_id, MyClientConnectionInfo, and size.
Referenced by InitializeParallelDSM().
Oid GetAuthenticatedUserId | ( | void | ) |
Definition at line 593 of file miscinit.c.
References Assert, AuthenticatedUserId, and OidIsValid.
Referenced by check_session_authorization(), and InitializeParallelDSM().
const char * GetBackendTypeDesc | ( | BackendType | backendType | ) |
Definition at line 263 of file miscinit.c.
References B_ARCHIVER, B_AUTOVAC_LAUNCHER, B_AUTOVAC_WORKER, B_BACKEND, B_BG_WORKER, B_BG_WRITER, B_CHECKPOINTER, B_DEAD_END_BACKEND, B_INVALID, B_LOGGER, B_SLOTSYNC_WORKER, B_STANDALONE_BACKEND, B_STARTUP, B_WAL_RECEIVER, B_WAL_SENDER, B_WAL_SUMMARIZER, B_WAL_WRITER, and gettext_noop.
Referenced by BackendInitialize(), BackendStartup(), CleanupBackend(), CountChildren(), get_backend_type_for_log(), init_ps_display(), pg_stat_get_activity(), pg_stat_io_build_tuples(), and SignalChildren().
Oid GetCurrentRoleId | ( | void | ) |
Definition at line 983 of file miscinit.c.
References InvalidOid, OuterUserId, and SetRoleIsActive.
Referenced by check_role(), InitializeParallelDSM(), and show_role().
Oid GetOuterUserId | ( | void | ) |
Definition at line 528 of file miscinit.c.
References Assert, OidIsValid, and OuterUserId.
Referenced by DropRole(), and RenameRole().
Oid GetSessionUserId | ( | void | ) |
Definition at line 556 of file miscinit.c.
References Assert, OidIsValid, and SessionUserId.
Referenced by check_role(), check_session_authorization(), DropRole(), get_rolespec_oid(), get_rolespec_tuple(), InitializeParallelDSM(), InitPostgres(), pgstat_bestart(), RenameRole(), and session_user().
bool GetSessionUserIsSuperuser | ( | void | ) |
Definition at line 563 of file miscinit.c.
References Assert, OidIsValid, SessionUserId, and SessionUserIsSuperuser.
Referenced by check_session_authorization(), and InitializeParallelDSM().
const char * GetSystemUser | ( | void | ) |
Oid GetUserId | ( | void | ) |
Definition at line 517 of file miscinit.c.
References Assert, CurrentUserId, and OidIsValid.
Referenced by AggregateCreate(), AlterCollation(), AlterDatabase(), AlterDatabaseOwner(), AlterDatabaseRefreshColl(), AlterDatabaseSet(), AlterEventTrigger(), AlterEventTriggerOwner_internal(), AlterExtensionNamespace(), AlterForeignServer(), AlterForeignServerOwner_internal(), AlterFunction(), AlterObjectNamespace_internal(), AlterObjectOwner_internal(), AlterObjectRename_internal(), AlterOperator(), AlterOpFamilyAdd(), AlterPublication(), AlterPublicationOwner_internal(), AlterRole(), AlterRoleSet(), AlterSchemaOwner_internal(), AlterStatistics(), AlterSubscription(), AlterSubscriptionOwner_internal(), AlterSystemSetConfigFile(), AlterTableMoveAll(), AlterTableSpaceOptions(), AlterTSConfiguration(), AlterTSDictionary(), AlterType(), AlterTypeNamespace_oid(), AlterTypeOwner(), ATExecChangeOwner(), ATPrepAlterColumnType(), ATPrepSetTableSpace(), ATSimplePermissions(), bbsink_server_new(), be_lo_unlink(), binary_upgrade_create_empty_extension(), binary_upgrade_logical_slot_has_caught_up(), brin_desummarize_range(), BuildCachedPlan(), BuildDescForRelation(), BuildIndexValueDescription(), calculate_database_size(), calculate_tablespace_size(), call_pltcl_start_proc(), check_enable_rls(), check_search_path(), check_temp_tablespaces(), CheckCachedPlan(), checkDomainOwner(), checkEnumOwner(), checkFkeyPermissions(), CheckFunctionValidatorAccess(), CheckMyDatabase(), CheckSlotPermissions(), CommentObject(), compile_plperl_function(), compile_pltcl_function(), CompleteCachedPlan(), compute_return_type(), ConfigOptionIsVisible(), convert_and_check_filename(), CreateCast(), CreateConversionCommand(), createdb(), CreateEventTrigger(), CreateExtensionInternal(), CreateForeignDataWrapper(), CreateForeignServer(), CreateForeignTable(), CreateFunction(), CreateOpFamily(), CreateProceduralLanguage(), CreatePublication(), CreateRole(), CreateStatistics(), CreateSubscription(), CreateTableSpace(), CreateTransform(), CreateTriggerFiringOn(), current_user(), currtid_internal(), currval_oid(), DefineAggregate(), DefineCollation(), DefineDomain(), DefineEnum(), DefineIndex(), DefineOpClass(), DefineOperator(), DefineOpFamily(), DefineQueryRewrite(), DefineRange(), DefineRelation(), DefineTSConfiguration(), DefineTSDictionary(), DefineType(), do_setval(), DoCopy(), dropdb(), DropOwnedObjects(), DropRole(), DropSubscription(), DropTableSpace(), emit_audit_message(), EnableDisableRule(), examine_simple_variable(), examine_variable(), ExecAlterDefaultPrivilegesStmt(), ExecAlterExtensionContentsStmt(), ExecAlterExtensionStmt(), ExecAlterObjectDependsStmt(), ExecBuildGroupingEqual(), ExecBuildParamSetEqual(), ExecBuildSlotPartitionKeyDescription(), ExecBuildSlotValueDescription(), ExecCheckOneRelPerms(), ExecGetResultRelCheckAsUser(), ExecGrant_Attribute(), ExecGrant_common(), ExecGrant_Largeobject(), ExecGrant_Parameter(), ExecGrant_Relation(), ExecInitAgg(), ExecInitExprRec(), ExecInitFunc(), ExecInitWindowAgg(), ExecReindex(), ExecSecLabelStmt(), execute_extension_script(), ExecuteCallStmt(), ExecuteDoStmt(), ExecuteGrantStmt(), ExecuteTruncateGuts(), extension_is_trusted(), file_fdw_validator(), findRangeCanonicalFunction(), findRangeSubtypeDiffFunction(), FinishPreparedTransaction(), fmgr_security_definer(), get_connect_string(), get_other_operator(), get_rel_from_relname(), get_rolespec_oid(), get_rolespec_tuple(), get_row_security_policies(), get_tables_to_cluster(), get_tables_to_cluster_partitioned(), GetConfigOptionValues(), gin_clean_pending_list(), GrantRole(), HandleFunctionRequest(), has_any_column_privilege_id(), has_any_column_privilege_name(), has_column_privilege_id_attnum(), has_column_privilege_id_name(), has_column_privilege_name_attnum(), has_column_privilege_name_name(), has_database_privilege_id(), has_database_privilege_name(), has_foreign_data_wrapper_privilege_id(), has_foreign_data_wrapper_privilege_name(), has_function_privilege_id(), has_function_privilege_name(), has_language_privilege_id(), has_language_privilege_name(), has_largeobject_privilege_id(), has_parameter_privilege_name(), has_schema_privilege_id(), has_schema_privilege_name(), has_sequence_privilege_id(), has_sequence_privilege_name(), has_server_privilege_id(), has_server_privilege_name(), has_table_privilege_id(), has_table_privilege_name(), has_tablespace_privilege_id(), has_tablespace_privilege_name(), has_type_privilege_id(), has_type_privilege_name(), have_createdb_privilege(), have_createrole_privilege(), heap_force_common(), ImportForeignSchema(), init_sexpr(), InitializeSearchPath(), InitPostgres(), InitTempTableNamespace(), inline_function(), inline_set_returning_function(), insert_username(), interpret_function_parameter_list(), inv_create(), inv_open(), LargeObjectCreate(), lastval(), LockViewRecurse(), LogicalRepSyncTableStart(), lookup_agg_function(), LookupCreationNamespace(), LookupExplicitNamespace(), MergeAttributes(), movedb(), nextval_internal(), OperatorCreate(), OperatorShellMake(), pg_get_sequence_data(), pg_has_role_id(), pg_has_role_name(), pg_import_system_collations(), pg_prewarm(), pg_sequence_last_value(), pg_sequence_parameters(), pg_signal_backend(), pg_stat_get_wal_receiver(), pg_stat_get_wal_senders(), pg_stat_statements_internal(), pgrowlocks(), pgss_store(), pgstat_get_backend_current_activity(), pltcl_fetch_interp(), postgresBeginDirectModify(), postgresBeginForeignScan(), postgresExecForeignTruncate(), postgresGetForeignRelSize(), postgresImportForeignSchema(), PrepareTempTablespaces(), PrepareTransaction(), PublicationAddTables(), RangeVarCallbackForAlterRelation(), RangeVarCallbackForDropRelation(), RangeVarCallbackForLockTable(), RangeVarCallbackForPolicy(), RangeVarCallbackForReindexIndex(), RangeVarCallbackForRenameRule(), RangeVarCallbackForRenameTrigger(), RangeVarCallbackMaintainsTable(), RangeVarCallbackOwnsRelation(), RangeVarGetAndCheckCreationNamespace(), ReassignOwnedObjects(), recomputeNamespacePath(), REGRESS_exec_check_perms(), REGRESS_object_access_hook(), REGRESS_object_access_hook_str(), REGRESS_utility_command(), ReindexMultipleInternal(), ReindexMultipleTables(), RemoveObjects(), renameatt_check(), RenameDatabase(), RenameRole(), RenameSchema(), RenameTableSpace(), RenameType(), RevalidateCachedQuery(), RI_Initial_Check(), ri_ReportViolation(), select_perl_context(), set_config_option(), set_foreign_rel_properties(), shell_check_detail(), standard_ProcessUtility(), statext_is_compatible_clause(), stats_lock_check_privileges(), superuser(), TargetPrivilegesCheck(), TerminateOtherDBBackends(), transformTableLikeClause(), truncate_check_perms(), user_mapping_ddl_aclcheck(), vacuum_is_permitted_for_relation(), validate_option_array_item(), ValidateJoinEstimator(), ValidateOperatorReference(), and ValidateRestrictionEstimator().
void GetUserIdAndContext | ( | Oid * | userid, |
bool * | sec_def_context | ||
) |
Definition at line 709 of file miscinit.c.
References CurrentUserId, and InLocalUserIdChange().
void GetUserIdAndSecContext | ( | Oid * | userid, |
int * | sec_context | ||
) |
Definition at line 660 of file miscinit.c.
References CurrentUserId, and SecurityRestrictionContext.
Referenced by brin_summarize_range(), bt_index_check_internal(), cluster_rel(), ComputeIndexAttrs(), CreateSchemaCommand(), DefineIndex(), do_analyze_rel(), execute_extension_script(), fmgr_security_definer(), index_build(), index_concurrently_build(), InitializeParallelDSM(), PushTransaction(), RefreshMatViewByOid(), reindex_index(), ReindexRelationConcurrently(), ri_PerformCheck(), ri_PlanCheck(), StartTransaction(), SwitchToUntrustedUser(), vacuum_rel(), and validate_index().
char * GetUserNameFromId | ( | Oid | roleid, |
bool | noerr | ||
) |
Definition at line 1036 of file miscinit.c.
References ereport, errcode(), errmsg(), ERROR, GETSTRUCT, HeapTupleIsValid, NameStr, ObjectIdGetDatum(), pstrdup(), ReleaseSysCache(), rolname, and SearchSysCache1().
Referenced by AddRoleMems(), check_can_set_role(), check_object_ownership(), check_role_grantor(), check_role_membership_authorization(), current_user(), DelRoleMems(), DropOwnedObjects(), execute_extension_script(), getObjectDescription(), getObjectIdentityParts(), insert_username(), LogicalRepSyncTableStart(), ReassignOwnedObjects(), regroleout(), session_user(), SwitchToUntrustedUser(), and TargetPrivilegesCheck().
bool has_rolreplication | ( | Oid | roleid | ) |
Definition at line 736 of file miscinit.c.
References GETSTRUCT, HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), rolreplication, SearchSysCache1(), and superuser_arg().
Referenced by AlterRole(), binary_upgrade_logical_slot_has_caught_up(), CheckSlotPermissions(), CreateRole(), and InitPostgres().
void InitializeSessionUserId | ( | const char * | rolename, |
Oid | roleid, | ||
bool | bypass_login_check | ||
) |
Definition at line 758 of file miscinit.c.
References AcceptInvalidationMessages(), AmRegularBackendProcess, Assert, CountUserBackends(), ereport, errcode(), errmsg(), FATAL, GETSTRUCT, HeapTupleIsValid, InitializingParallelWorker, is_superuser(), IsBootstrapProcessingMode, IsUnderPostmaster, NameStr, ObjectIdGetDatum(), PGC_BACKEND, PGC_S_OVERRIDE, PointerGetDatum(), ReleaseSysCache(), SearchSysCache1(), SetAuthenticatedUserId(), and SetConfigOption().
Referenced by InitPostgres().
void InitializeSessionUserIdStandalone | ( | void | ) |
Definition at line 888 of file miscinit.c.
References AmAutoVacuumWorkerProcess, AmBackgroundWorkerProcess, AmLogicalSlotSyncWorkerProcess, Assert, AuthenticatedUserId, InvalidOid, IsUnderPostmaster, OidIsValid, SetCurrentRoleId(), and SetSessionAuthorization().
Referenced by InitPostgres().
void InitializeSystemUser | ( | const char * | authn_id, |
const char * | auth_method | ||
) |
Definition at line 922 of file miscinit.c.
References Assert, MemoryContextStrdup(), pfree(), psprintf(), system_user(), SystemUser, and TopMemoryContext.
Referenced by InitPostgres(), and ParallelWorkerMain().
void InitPostmasterChild | ( | void | ) |
Definition at line 96 of file miscinit.c.
References BlockSig, elog, ereport, errcode_for_socket_access(), errmsg_internal(), FATAL, InitializeLatchSupport(), InitializeLatchWaitSet(), InitProcessGlobals(), InitProcessLocalLatch(), IsUnderPostmaster, on_exit_reset(), pgwin32_signal_initialize(), postmaster_alive_fds, POSTMASTER_FD_WATCH, PostmasterDeathSignalInit(), pqinitmask(), pqsignal(), SignalHandlerForCrashExit(), and SIGQUIT.
Referenced by postmaster_child_launch().
void InitProcessLocalLatch | ( | void | ) |
Definition at line 235 of file miscinit.c.
References InitLatch(), LocalLatchData, and MyLatch.
Referenced by InitPostmasterChild(), InitStandaloneProcess(), and PostmasterMain().
void InitStandaloneProcess | ( | const char * | argv0 | ) |
Definition at line 175 of file miscinit.c.
References argv0, Assert, B_STANDALONE_BACKEND, BlockSig, elog, FATAL, find_my_exec(), get_pkglib_path(), InitializeLatchSupport(), InitializeLatchWaitSet(), InitProcessGlobals(), InitProcessLocalLatch(), IsPostmasterEnvironment, my_exec_path, MyBackendType, pgwin32_signal_initialize(), pkglib_path, and pqinitmask().
Referenced by BootstrapModeMain(), and PostgresSingleUserMain().
bool InLocalUserIdChange | ( | void | ) |
Definition at line 678 of file miscinit.c.
References SECURITY_LOCAL_USERID_CHANGE, and SecurityRestrictionContext.
Referenced by GetUserIdAndContext(), and set_config_with_handle().
bool InNoForceRLSOperation | ( | void | ) |
Definition at line 696 of file miscinit.c.
References SECURITY_NOFORCE_RLS, and SecurityRestrictionContext.
Referenced by check_enable_rls().
bool InSecurityRestrictedOperation | ( | void | ) |
Definition at line 687 of file miscinit.c.
References SECURITY_RESTRICTED_OPERATION, and SecurityRestrictionContext.
Referenced by afterTriggerMarkEvents(), CheckRestrictedOperation(), DefineRelation(), PerformCursorOpen(), set_config_with_handle(), and SetUserIdAndContext().
|
static |
Definition at line 1847 of file miscinit.c.
References DEBUG1, ereport, errcode(), errmsg(), errmsg_internal(), filename, first_dir_separator(), lfirst, list_free_deep(), load_file(), LOG, pfree(), psprintf(), pstrdup(), and SplitDirectoriesString().
Referenced by process_session_preload_libraries(), and process_shared_preload_libraries().
void pg_bindtextdomain | ( | const char * | domain | ) |
Definition at line 1936 of file miscinit.c.
References get_locale_path(), MAXPGPATH, and my_exec_path.
Referenced by _PG_init().
void process_session_preload_libraries | ( | void | ) |
Definition at line 1913 of file miscinit.c.
References load_libraries(), local_preload_libraries_string, and session_preload_libraries_string.
Referenced by InitPostgres().
void process_shared_preload_libraries | ( | void | ) |
Definition at line 1899 of file miscinit.c.
References load_libraries(), process_shared_preload_libraries_done, process_shared_preload_libraries_in_progress, and shared_preload_libraries_string.
Referenced by PostgresSingleUserMain(), and PostmasterMain().
void process_shmem_requests | ( | void | ) |
Definition at line 1927 of file miscinit.c.
References process_shmem_requests_in_progress, and shmem_request_hook.
Referenced by PostgresSingleUserMain(), and PostmasterMain().
bool RecheckDataDirLockFile | ( | void | ) |
Definition at line 1694 of file miscinit.c.
References close, DIRECTORY_LOCK_FILE, ereport, errcode_for_file_access(), errmsg(), fd(), len, LOG, PG_BINARY, pgstat_report_wait_end(), pgstat_report_wait_start(), and read.
Referenced by ServerLoop().
void RestoreClientConnectionInfo | ( | char * | conninfo | ) |
Definition at line 1131 of file miscinit.c.
References SerializedClientConnectionInfo::auth_method, ClientConnectionInfo::auth_method, ClientConnectionInfo::authn_id, SerializedClientConnectionInfo::authn_id_len, MemoryContextStrdup(), MyClientConnectionInfo, and TopMemoryContext.
Referenced by ParallelWorkerMain().
void SerializeClientConnectionInfo | ( | Size | maxsize, |
char * | start_address | ||
) |
Definition at line 1099 of file miscinit.c.
References Assert, SerializedClientConnectionInfo::auth_method, ClientConnectionInfo::auth_method, ClientConnectionInfo::authn_id, SerializedClientConnectionInfo::authn_id_len, and MyClientConnectionInfo.
Referenced by InitializeParallelDSM().
void SetAuthenticatedUserId | ( | Oid | userid | ) |
Definition at line 600 of file miscinit.c.
References Assert, AuthenticatedUserId, MyProc, OidIsValid, and PGPROC::roleId.
Referenced by InitializeSessionUserId(), and ParallelWorkerMain().
void SetCurrentRoleId | ( | Oid | roleid, |
bool | is_superuser | ||
) |
Definition at line 1004 of file miscinit.c.
References is_superuser(), OidIsValid, SessionUserId, SessionUserIsSuperuser, SetOuterUserId(), and SetRoleIsActive.
Referenced by assign_role(), InitializeSessionUserIdStandalone(), and ParallelWorkerMain().
void SetDatabasePath | ( | const char * | path | ) |
Definition at line 331 of file miscinit.c.
References Assert, DatabasePath, MemoryContextStrdup(), and TopMemoryContext.
Referenced by InitPostgres().
void SetDataDir | ( | const char * | dir | ) |
Definition at line 437 of file miscinit.c.
References Assert, DataDir, free, and make_absolute_path().
Referenced by SelectConfigFiles().
|
static |
Definition at line 536 of file miscinit.c.
References Assert, CurrentUserId, is_superuser(), OidIsValid, OuterUserId, PGC_INTERNAL, PGC_S_DYNAMIC_DEFAULT, SecurityRestrictionContext, and SetConfigOption().
Referenced by SetCurrentRoleId(), and SetSessionAuthorization().
void SetSessionAuthorization | ( | Oid | userid, |
bool | is_superuser | ||
) |
Definition at line 968 of file miscinit.c.
References is_superuser(), SetOuterUserId(), SetRoleIsActive, and SetSessionUserId().
Referenced by assign_session_authorization(), InitializeSessionUserIdStandalone(), and ParallelWorkerMain().
|
static |
Definition at line 570 of file miscinit.c.
References Assert, is_superuser(), OidIsValid, SecurityRestrictionContext, SessionUserId, and SessionUserIsSuperuser.
Referenced by SetSessionAuthorization().
void SetUserIdAndContext | ( | Oid | userid, |
bool | sec_def_context | ||
) |
Definition at line 716 of file miscinit.c.
References CurrentUserId, ereport, errcode(), errmsg(), ERROR, InSecurityRestrictedOperation(), SECURITY_LOCAL_USERID_CHANGE, and SecurityRestrictionContext.
void SetUserIdAndSecContext | ( | Oid | userid, |
int | sec_context | ||
) |
Definition at line 667 of file miscinit.c.
References CurrentUserId, and SecurityRestrictionContext.
Referenced by AbortSubTransaction(), AbortTransaction(), brin_summarize_range(), bt_index_check_internal(), cluster_rel(), ComputeIndexAttrs(), CreateSchemaCommand(), DefineIndex(), do_analyze_rel(), execute_extension_script(), fmgr_security_definer(), index_build(), index_concurrently_build(), ParallelWorkerMain(), refresh_by_match_merge(), RefreshMatViewByOid(), reindex_index(), ReindexRelationConcurrently(), RestoreUserContext(), ri_PerformCheck(), ri_PlanCheck(), SwitchToUntrustedUser(), vacuum_rel(), and validate_index().
void SwitchBackToLocalLatch | ( | void | ) |
Definition at line 242 of file miscinit.c.
References Assert, FeBeWaitSet, FeBeWaitSetLatchPos, LocalLatchData, ModifyWaitEvent(), MyLatch, MyProc, PGPROC::procLatch, SetLatch(), and WL_LATCH_SET.
Referenced by AuxiliaryProcKill(), and ProcKill().
void SwitchToSharedLatch | ( | void | ) |
Definition at line 215 of file miscinit.c.
References Assert, FeBeWaitSet, FeBeWaitSetLatchPos, LocalLatchData, ModifyWaitEvent(), MyLatch, MyProc, PGPROC::procLatch, SetLatch(), and WL_LATCH_SET.
Referenced by InitAuxiliaryProcess(), and InitProcess().
Datum system_user | ( | PG_FUNCTION_ARGS | ) |
Definition at line 946 of file miscinit.c.
References CStringGetTextDatum, GetSystemUser(), PG_RETURN_DATUM, and PG_RETURN_NULL.
Referenced by check_ident_usermap(), check_usermap(), and InitializeSystemUser().
void TouchSocketLockFiles | ( | void | ) |
Definition at line 1538 of file miscinit.c.
References DIRECTORY_LOCK_FILE, lfirst, and lock_files.
Referenced by ServerLoop().
|
static |
Definition at line 1171 of file miscinit.c.
References ereport, errmsg(), IsPostmasterEnvironment, lfirst, lock_files, LOG, NIL, and NOTICE.
Referenced by CreateLockFile().
void ValidatePgVersion | ( | const char * | path | ) |
Definition at line 1766 of file miscinit.c.
References AllocateFile(), ereport, errcode(), errcode_for_file_access(), errdetail(), errhint(), errmsg(), FATAL, FreeFile(), MAXPGPATH, and snprintf.
Referenced by checkDataDir(), and InitPostgres().
|
static |
Definition at line 497 of file miscinit.c.
Referenced by GetAuthenticatedUserId(), InitializeSessionUserIdStandalone(), and SetAuthenticatedUserId().
|
static |
Definition at line 500 of file miscinit.c.
Referenced by GetUserId(), GetUserIdAndContext(), GetUserIdAndSecContext(), SetOuterUserId(), SetUserIdAndContext(), and SetUserIdAndSecContext().
bool IgnoreSystemIndexes = false |
Definition at line 81 of file miscinit.c.
Referenced by AuxiliaryProcessMainCommon(), BootstrapModeMain(), get_relation_info(), systable_beginscan(), and systable_beginscan_ordered().
char* local_preload_libraries_string = NULL |
Definition at line 1831 of file miscinit.c.
Referenced by process_session_preload_libraries().
|
static |
Definition at line 69 of file miscinit.c.
Referenced by InitProcessLocalLatch(), SwitchBackToLocalLatch(), and SwitchToSharedLatch().
Definition at line 67 of file miscinit.c.
Referenced by CreateLockFile(), TouchSocketLockFiles(), and UnlinkLockFiles().
ProcessingMode Mode = InitProcessing |
Definition at line 62 of file miscinit.c.
BackendType MyBackendType |
Definition at line 64 of file miscinit.c.
Referenced by AutoVacWorkerMain(), BackgroundWorkerMain(), BackgroundWriterMain(), CheckpointerMain(), CreateRestartPoint(), get_backend_type_for_log(), init_ps_display(), InitStandaloneProcess(), InvalidatePossiblyObsoleteSlot(), PgArchiverMain(), pgstat_bestart(), pgstat_count_io_op_n(), pgstat_count_io_op_time(), pgstat_flush_backend(), pgstat_io_flush_cb(), pgstat_should_report_connstat(), pgstat_write_statsfile(), ProcessStartupPacket(), ReplSlotSyncWorkerMain(), send_message_to_server_log(), standard_ProcessUtility(), StartupProcessMain(), SysLoggerMain(), WalReceiverMain(), WalSummarizerMain(), WalWriterMain(), write_csvlog(), and write_jsonlog().
ClientConnectionInfo MyClientConnectionInfo |
Definition at line 1066 of file miscinit.c.
Referenced by auth_peer(), ClientAuthentication(), EstimateClientConnectionInfoSpace(), InitPostgres(), ParallelWorkerMain(), RestoreClientConnectionInfo(), SerializeClientConnectionInfo(), and set_authn_id().
|
static |
Definition at line 499 of file miscinit.c.
Referenced by GetCurrentRoleId(), GetOuterUserId(), and SetOuterUserId().
bool process_shared_preload_libraries_done = false |
Definition at line 1835 of file miscinit.c.
Referenced by check_wal_consistency_checking(), InitializeWalConsistencyChecking(), and process_shared_preload_libraries().
bool process_shared_preload_libraries_in_progress = false |
Definition at line 1834 of file miscinit.c.
Referenced by _PG_init(), apw_start_leader_worker(), init_custom_variable(), pgstat_register_kind(), process_shared_preload_libraries(), RegisterBackgroundWorker(), and RegisterCustomRmgr().
bool process_shmem_requests_in_progress = false |
Definition at line 1838 of file miscinit.c.
Referenced by process_shmem_requests(), RequestAddinShmemSpace(), and RequestNamedLWLockTranche().
|
static |
Definition at line 506 of file miscinit.c.
Referenced by GetUserIdAndSecContext(), InLocalUserIdChange(), InNoForceRLSOperation(), InSecurityRestrictedOperation(), SetOuterUserId(), SetSessionUserId(), SetUserIdAndContext(), and SetUserIdAndSecContext().
char* session_preload_libraries_string = NULL |
Definition at line 1829 of file miscinit.c.
Referenced by process_session_preload_libraries().
|
static |
Definition at line 498 of file miscinit.c.
Referenced by GetSessionUserId(), GetSessionUserIsSuperuser(), SetCurrentRoleId(), and SetSessionUserId().
|
static |
Definition at line 504 of file miscinit.c.
Referenced by GetSessionUserIsSuperuser(), SetCurrentRoleId(), and SetSessionUserId().
|
static |
Definition at line 509 of file miscinit.c.
Referenced by GetCurrentRoleId(), SetCurrentRoleId(), and SetSessionAuthorization().
char* shared_preload_libraries_string = NULL |
Definition at line 1830 of file miscinit.c.
Referenced by process_shared_preload_libraries().
shmem_request_hook_type shmem_request_hook = NULL |
Definition at line 1837 of file miscinit.c.
Referenced by _PG_init(), and process_shmem_requests().
|
static |
Definition at line 501 of file miscinit.c.
Referenced by GetSystemUser(), and InitializeSystemUser().