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 "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/pgarch.h"
#include "postmaster/postmaster.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 |
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 | AuthenticatedUserIsSuperuser = false |
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 59 of file miscinit.c.
typedef struct SerializedClientConnectionInfo SerializedClientConnectionInfo |
void AddToDataDirLockFile | ( | int | target_line, |
const char * | str | ||
) |
Definition at line 1515 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, generate_unaccent_rules::str, WAIT_EVENT_LOCK_FILE_ADDTODATADIR_READ, WAIT_EVENT_LOCK_FILE_ADDTODATADIR_SYNC, and WAIT_EVENT_LOCK_FILE_ADDTODATADIR_WRITE.
Referenced by InternalIpcMemoryCreate(), PostmasterMain(), process_pm_child_exit(), process_pm_pmsignal(), and process_pm_shutdown_request().
void ChangeToDataDir | ( | void | ) |
Definition at line 449 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 336 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 1459 of file miscinit.c.
References CreateLockFile(), DataDir, and DIRECTORY_LOCK_FILE.
Referenced by BootstrapModeMain(), PostgresSingleUserMain(), and PostmasterMain().
|
static |
Definition at line 1154 of file miscinit.c.
References close, DataDir, elog(), ereport, errcode(), errcode_for_file_access(), errhint(), errmsg(), FATAL, fd(), filename, 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(), WAIT_EVENT_LOCK_FILE_CREATE_READ, WAIT_EVENT_LOCK_FILE_CREATE_SYNC, WAIT_EVENT_LOCK_FILE_CREATE_WRITE, and write.
Referenced by CreateDataDirLockFile(), and CreateSocketLockFile().
void CreateSocketLockFile | ( | const char * | socketfile, |
bool | amPostmaster, | ||
const char * | socketDir | ||
) |
Definition at line 1468 of file miscinit.c.
References CreateLockFile(), MAXPGPATH, and snprintf.
Referenced by Lock_AF_UNIX().
Size EstimateClientConnectionInfoSpace | ( | void | ) |
Definition at line 1031 of file miscinit.c.
References add_size(), ClientConnectionInfo::authn_id, and MyClientConnectionInfo.
Referenced by InitializeParallelDSM().
Oid GetAuthenticatedUserId | ( | void | ) |
Definition at line 579 of file miscinit.c.
References Assert(), AuthenticatedUserId, and OidIsValid.
Referenced by InitializeParallelDSM().
const char* GetBackendTypeDesc | ( | BackendType | backendType | ) |
Definition at line 264 of file miscinit.c.
References B_ARCHIVER, B_AUTOVAC_LAUNCHER, B_AUTOVAC_WORKER, B_BACKEND, B_BG_WORKER, B_BG_WRITER, B_CHECKPOINTER, B_INVALID, B_LOGGER, B_STANDALONE_BACKEND, B_STARTUP, B_WAL_RECEIVER, B_WAL_SENDER, and B_WAL_WRITER.
Referenced by BackendInitialize(), get_backend_type_for_log(), init_ps_display(), pg_stat_get_activity(), and pg_stat_get_io().
Oid GetCurrentRoleId | ( | void | ) |
Definition at line 928 of file miscinit.c.
References InvalidOid, OuterUserId, and SetRoleIsActive.
Referenced by InitializeParallelDSM(), and show_role().
Oid GetOuterUserId | ( | void | ) |
Definition at line 521 of file miscinit.c.
References Assert(), OidIsValid, and OuterUserId.
Referenced by DropRole(), and RenameRole().
Oid GetSessionUserId | ( | void | ) |
Definition at line 544 of file miscinit.c.
References Assert(), OidIsValid, and SessionUserId.
Referenced by check_role(), DropRole(), get_rolespec_oid(), get_rolespec_tuple(), InitPostgres(), pgstat_bestart(), RenameRole(), and session_user().
const char* GetSystemUser | ( | void | ) |
Oid GetUserId | ( | void | ) |
Definition at line 510 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(), ATExecAddColumn(), ATExecChangeOwner(), ATPrepAlterColumnType(), ATPrepSetTableSpace(), ATSimplePermissions(), bbsink_server_new(), be_lo_put(), be_lo_unlink(), binary_upgrade_create_empty_extension(), brin_desummarize_range(), BuildCachedPlan(), BuildDescForRelation(), BuildIndexValueDescription(), calculate_database_size(), calculate_tablespace_size(), call_pltcl_start_proc(), check_enable_rls(), 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(), get_connect_string(), get_other_operator(), get_rel_from_relname(), get_rolespec_oid(), get_rolespec_tuple(), get_row_security_policies(), get_tables_to_cluster(), 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_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_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(), superuser(), TargetPrivilegesCheck(), TerminateOtherDBBackends(), transformTableLikeClause(), truncate_check_perms(), user_mapping_ddl_aclcheck(), vacuum_is_permitted_for_relation(), validate_option_array_item(), ValidateJoinEstimator(), and ValidateRestrictionEstimator().
void GetUserIdAndSecContext | ( | Oid * | userid, |
int * | sec_context | ||
) |
Definition at line 631 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(), ExecCreateTableAs(), ExecRefreshMatView(), execute_extension_script(), fmgr_security_definer(), index_build(), index_concurrently_build(), InitializeParallelDSM(), PushTransaction(), reindex_index(), ReindexRelationConcurrently(), ri_PerformCheck(), ri_PlanCheck(), StartTransaction(), SwitchToUntrustedUser(), vacuum_rel(), and validate_index().
Definition at line 984 of file miscinit.c.
References AUTHOID, 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().
Definition at line 707 of file miscinit.c.
References AUTHOID, GETSTRUCT, HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), rolreplication, SearchSysCache1(), and superuser_arg().
Referenced by AlterRole(), CheckSlotPermissions(), CreateRole(), and InitPostgres().
void InitializeSessionUserId | ( | const char * | rolename, |
Oid | roleid | ||
) |
Definition at line 729 of file miscinit.c.
References AcceptInvalidationMessages(), Assert(), AuthenticatedUserId, AuthenticatedUserIsSuperuser, AUTHNAME, AUTHOID, CountUserBackends(), ereport, errcode(), errmsg(), FATAL, GETSTRUCT, HeapTupleIsValid, IsBootstrapProcessingMode, IsUnderPostmaster, MyProc, NameStr, ObjectIdGetDatum(), OidIsValid, PGC_BACKEND, PGC_INTERNAL, PGC_S_DYNAMIC_DEFAULT, PGC_S_OVERRIDE, PointerGetDatum(), ReleaseSysCache(), PGPROC::roleId, SearchSysCache1(), SetConfigOption(), and SetSessionUserId().
Referenced by InitPostgres().
void InitializeSessionUserIdStandalone | ( | void | ) |
Definition at line 832 of file miscinit.c.
References Assert(), AuthenticatedUserId, AuthenticatedUserIsSuperuser, IsAutoVacuumWorkerProcess(), IsBackgroundWorker, IsUnderPostmaster, OidIsValid, and SetSessionUserId().
Referenced by InitPostgres().
void InitializeSystemUser | ( | const char * | authn_id, |
const char * | auth_method | ||
) |
Definition at line 855 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 95 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(), set_stack_base(), SignalHandlerForCrashExit(), and SIGQUIT.
Referenced by BackendStartup(), do_start_bgworker(), StartAutoVacWorker(), StartChildProcess(), and SysLogger_Start().
void InitProcessLocalLatch | ( | void | ) |
Definition at line 242 of file miscinit.c.
References InitLatch(), LocalLatchData, and MyLatch.
Referenced by InitPostmasterChild(), InitStandaloneProcess(), and PostmasterMain().
void InitStandaloneProcess | ( | const char * | argv0 | ) |
Definition at line 182 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 649 of file miscinit.c.
References SECURITY_LOCAL_USERID_CHANGE, and SecurityRestrictionContext.
Referenced by GetUserIdAndContext(), and set_config_option_ext().
bool InNoForceRLSOperation | ( | void | ) |
Definition at line 667 of file miscinit.c.
References SECURITY_NOFORCE_RLS, and SecurityRestrictionContext.
Referenced by check_enable_rls().
bool InSecurityRestrictedOperation | ( | void | ) |
Definition at line 658 of file miscinit.c.
References SECURITY_RESTRICTED_OPERATION, and SecurityRestrictionContext.
Referenced by afterTriggerMarkEvents(), CheckRestrictedOperation(), DefineRelation(), PerformCursorOpen(), set_config_option_ext(), and SetUserIdAndContext().
|
static |
Definition at line 1795 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 1884 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 1861 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 1847 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 1875 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 1642 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(), read, and WAIT_EVENT_LOCK_FILE_RECHECKDATADIR_READ.
Referenced by ServerLoop().
void RestoreClientConnectionInfo | ( | char * | conninfo | ) |
Definition at line 1079 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 1047 of file miscinit.c.
References Assert(), SerializedClientConnectionInfo::auth_method, ClientConnectionInfo::auth_method, ClientConnectionInfo::authn_id, SerializedClientConnectionInfo::authn_id_len, and MyClientConnectionInfo.
Referenced by InitializeParallelDSM().
Definition at line 949 of file miscinit.c.
References is_superuser(), OidIsValid, PGC_INTERNAL, PGC_S_DYNAMIC_DEFAULT, SessionUserId, SessionUserIsSuperuser, SetConfigOption(), SetOuterUserId(), and SetRoleIsActive.
Referenced by assign_role(), and ParallelWorkerMain().
void SetDatabasePath | ( | const char * | path | ) |
Definition at line 323 of file miscinit.c.
References Assert(), DatabasePath, MemoryContextStrdup(), and TopMemoryContext.
Referenced by InitPostgres().
void SetDataDir | ( | const char * | dir | ) |
Definition at line 429 of file miscinit.c.
References Assert(), DataDir, free, and make_absolute_path().
Referenced by SelectConfigFiles().
|
static |
Definition at line 529 of file miscinit.c.
References Assert(), CurrentUserId, OidIsValid, OuterUserId, and SecurityRestrictionContext.
Referenced by SetCurrentRoleId().
Definition at line 903 of file miscinit.c.
References Assert(), AuthenticatedUserId, AuthenticatedUserIsSuperuser, ereport, errcode(), errmsg(), ERROR, is_superuser(), OidIsValid, PGC_INTERNAL, PGC_S_DYNAMIC_DEFAULT, SetConfigOption(), and SetSessionUserId().
Referenced by assign_session_authorization().
Definition at line 552 of file miscinit.c.
References Assert(), CurrentUserId, is_superuser(), OidIsValid, OuterUserId, SecurityRestrictionContext, SessionUserId, SessionUserIsSuperuser, and SetRoleIsActive.
Referenced by InitializeSessionUserId(), InitializeSessionUserIdStandalone(), and SetSessionAuthorization().
Definition at line 687 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 638 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(), ExecCreateTableAs(), ExecRefreshMatView(), execute_extension_script(), fmgr_security_definer(), index_build(), index_concurrently_build(), ParallelWorkerMain(), refresh_by_match_merge(), reindex_index(), ReindexRelationConcurrently(), RestoreUserContext(), ri_PerformCheck(), ri_PlanCheck(), SwitchToUntrustedUser(), vacuum_rel(), and validate_index().
void SwitchBackToLocalLatch | ( | void | ) |
Definition at line 249 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 222 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 879 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 1486 of file miscinit.c.
References DIRECTORY_LOCK_FILE, lfirst, and lock_files.
Referenced by ServerLoop().
|
static |
Definition at line 1119 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 1714 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 489 of file miscinit.c.
Referenced by GetAuthenticatedUserId(), InitializeSessionUserId(), InitializeSessionUserIdStandalone(), and SetSessionAuthorization().
Definition at line 496 of file miscinit.c.
Referenced by InitializeSessionUserId(), InitializeSessionUserIdStandalone(), and SetSessionAuthorization().
|
static |
Definition at line 492 of file miscinit.c.
Referenced by GetUserId(), GetUserIdAndContext(), GetUserIdAndSecContext(), SetOuterUserId(), SetSessionUserId(), SetUserIdAndContext(), and SetUserIdAndSecContext().
Definition at line 80 of file miscinit.c.
Referenced by AuxiliaryProcessMain(), BootstrapModeMain(), get_relation_info(), systable_beginscan(), and systable_beginscan_ordered().
char* local_preload_libraries_string = NULL |
Definition at line 1779 of file miscinit.c.
Referenced by process_session_preload_libraries().
|
static |
Definition at line 68 of file miscinit.c.
Referenced by InitProcessLocalLatch(), SwitchBackToLocalLatch(), and SwitchToSharedLatch().
Definition at line 66 of file miscinit.c.
Referenced by CreateLockFile(), TouchSocketLockFiles(), and UnlinkLockFiles().
ProcessingMode Mode = InitProcessing |
Definition at line 61 of file miscinit.c.
BackendType MyBackendType |
Definition at line 63 of file miscinit.c.
Referenced by AutoVacLauncherMain(), AutoVacWorkerMain(), AuxiliaryProcessMain(), CreateRestartPoint(), get_backend_type_for_log(), init_ps_display(), InitStandaloneProcess(), InvalidatePossiblyObsoleteSlot(), pgstat_bestart(), pgstat_count_io_op_n(), pgstat_flush_io(), pgstat_should_report_connstat(), ProcessStartupPacket(), send_message_to_server_log(), standard_ProcessUtility(), StartBackgroundWorker(), SysLoggerMain(), write_csvlog(), and write_jsonlog().
ClientConnectionInfo MyClientConnectionInfo |
Definition at line 1014 of file miscinit.c.
Referenced by auth_peer(), EstimateClientConnectionInfoSpace(), InitPostgres(), ParallelWorkerMain(), RestoreClientConnectionInfo(), SerializeClientConnectionInfo(), and set_authn_id().
|
static |
Definition at line 491 of file miscinit.c.
Referenced by GetCurrentRoleId(), GetOuterUserId(), SetOuterUserId(), and SetSessionUserId().
Definition at line 1783 of file miscinit.c.
Referenced by check_wal_consistency_checking(), InitializeWalConsistencyChecking(), and process_shared_preload_libraries().
Definition at line 1782 of file miscinit.c.
Referenced by _PG_init(), apw_start_leader_worker(), init_custom_variable(), process_shared_preload_libraries(), RegisterBackgroundWorker(), and RegisterCustomRmgr().
Definition at line 1786 of file miscinit.c.
Referenced by process_shmem_requests(), RequestAddinShmemSpace(), and RequestNamedLWLockTranche().
|
static |
Definition at line 499 of file miscinit.c.
Referenced by GetUserIdAndSecContext(), InLocalUserIdChange(), InNoForceRLSOperation(), InSecurityRestrictedOperation(), SetOuterUserId(), SetSessionUserId(), SetUserIdAndContext(), and SetUserIdAndSecContext().
char* session_preload_libraries_string = NULL |
Definition at line 1777 of file miscinit.c.
Referenced by process_session_preload_libraries().
|
static |
Definition at line 490 of file miscinit.c.
Referenced by GetSessionUserId(), SetCurrentRoleId(), and SetSessionUserId().
Definition at line 497 of file miscinit.c.
Referenced by SetCurrentRoleId(), and SetSessionUserId().
Definition at line 502 of file miscinit.c.
Referenced by GetCurrentRoleId(), SetCurrentRoleId(), and SetSessionUserId().
char* shared_preload_libraries_string = NULL |
Definition at line 1778 of file miscinit.c.
Referenced by process_shared_preload_libraries().
shmem_request_hook_type shmem_request_hook = NULL |
Definition at line 1785 of file miscinit.c.
Referenced by _PG_init(), and process_shmem_requests().
|
static |
Definition at line 493 of file miscinit.c.
Referenced by GetSystemUser(), and InitializeSystemUser().