PostgreSQL Source Code git master
|
#include "postgres.h"
#include <sys/stat.h>
#include <dlfcn.h>
#include "fmgr.h"
#include "lib/stringinfo.h"
#include "miscadmin.h"
#include "storage/fd.h"
#include "storage/shmem.h"
#include "utils/hsearch.h"
Go to the source code of this file.
Data Structures | |
struct | rendezvousHashEntry |
struct | df_files |
Macros | |
#define | SAME_INODE(A, B) ((A).st_ino == (B).inode && (A).st_dev == (B).device) |
Typedefs | |
typedef void(* | PG_init_t) (void) |
typedef struct df_files | DynamicFileList |
Functions | |
static void * | internal_load_library (const char *libname) |
static pg_noreturn void | incompatible_module_error (const char *libname, const Pg_magic_struct *module_magic_data) |
static char * | expand_dynamic_library_name (const char *name) |
static void | check_restricted_library_name (const char *name) |
void * | load_external_function (const char *filename, const char *funcname, bool signalNotFound, void **filehandle) |
void | load_file (const char *filename, bool restricted) |
void * | lookup_external_function (void *filehandle, const char *funcname) |
char * | substitute_path_macro (const char *str, const char *macro, const char *value) |
char * | find_in_path (const char *basename, const char *path, const char *path_param, const char *macro, const char *macro_val) |
void ** | find_rendezvous_variable (const char *varName) |
Size | EstimateLibraryStateSpace (void) |
void | SerializeLibraryState (Size maxsize, char *start_address) |
void | RestoreLibraryState (char *start_address) |
Variables | |
static DynamicFileList * | file_list = NULL |
static DynamicFileList * | file_tail = NULL |
char * | Dynamic_library_path |
static const Pg_magic_struct | magic_data = PG_MODULE_MAGIC_DATA |
#define SAME_INODE | ( | A, | |
B | |||
) | ((A).st_ino == (B).inode && (A).st_dev == (B).device) |
typedef struct df_files DynamicFileList |
|
static |
Size EstimateLibraryStateSpace | ( | void | ) |
Definition at line 650 of file dfmgr.c.
References add_size(), file_list, df_files::filename, and df_files::next.
Referenced by InitializeParallelDSM().
|
static |
Definition at line 406 of file dfmgr.c.
References Assert(), Dynamic_library_path, find_in_path(), first_dir_separator(), name, pfree(), pg_file_exists(), pkglib_path, psprintf(), pstrdup(), and substitute_path_macro().
Referenced by load_external_function(), and load_file().
char * find_in_path | ( | const char * | basename, |
const char * | path, | ||
const char * | path_param, | ||
const char * | macro, | ||
const char * | macro_val | ||
) |
Definition at line 522 of file dfmgr.c.
References Assert(), canonicalize_path(), DEBUG3, elog, ereport, errcode(), errmsg(), ERROR, first_dir_separator(), first_path_var_separator(), is_absolute_path, len, palloc(), pfree(), pg_file_exists(), sprintf, strlcpy(), and substitute_path_macro().
Referenced by expand_dynamic_library_name(), and find_extension_control_filename().
void ** find_rendezvous_variable | ( | const char * | varName | ) |
Definition at line 612 of file dfmgr.c.
References ctl, hash_create(), HASH_ELEM, HASH_ENTER, hash_search(), HASH_STRINGS, NAMEDATALEN, and rendezvousHashEntry::varValue.
Referenced by _PG_init().
|
static |
Definition at line 294 of file dfmgr.c.
References _, Pg_magic_struct::abi_extra, appendStringInfo(), appendStringInfoChar(), appendStringInfoString(), StringInfoData::data, ereport, errdetail(), errdetail_internal(), errmsg(), ERROR, Pg_magic_struct::float8byval, Pg_magic_struct::funcmaxargs, Pg_magic_struct::indexmaxkeys, initStringInfo(), StringInfoData::len, magic_data, Pg_magic_struct::namedatalen, snprintf, and Pg_magic_struct::version.
Referenced by internal_load_library().
|
static |
Definition at line 172 of file dfmgr.c.
References df_files::device, dlclose(), dlerror(), dlopen(), dlsym(), ereport, errcode(), errcode_for_file_access(), errhint(), errmsg(), ERROR, file_list, file_tail, df_files::filename, filename, free, df_files::handle, incompatible_module_error(), df_files::inode, Pg_magic_struct::len, magic_data, malloc, MemSet, df_files::next, PG_MAGIC_FUNCTION_NAME_STRING, RTLD_GLOBAL, RTLD_NOW, SAME_INODE, stat::st_dev, stat::st_ino, and stat.
Referenced by load_external_function(), load_file(), and RestoreLibraryState().
void * load_external_function | ( | const char * | filename, |
const char * | funcname, | ||
bool | signalNotFound, | ||
void ** | filehandle | ||
) |
Definition at line 93 of file dfmgr.c.
References dlsym(), ereport, errcode(), errmsg(), ERROR, expand_dynamic_library_name(), filename, funcname, internal_load_library(), and pfree().
Referenced by _PG_init(), fmgr_c_validator(), fmgr_info_C_lang(), llvm_resolve_symbol(), load_validator_library(), LoadArchiveLibrary(), LoadOutputPlugin(), LookupBackgroundWorkerFunction(), LookupParallelWorkerFunction(), and provider_init().
void load_file | ( | const char * | filename, |
bool | restricted | ||
) |
Definition at line 132 of file dfmgr.c.
References check_restricted_library_name(), expand_dynamic_library_name(), filename, internal_load_library(), and pfree().
Referenced by AlterSubscription(), AlterSubscription_refresh(), CreateSubscription(), DropSubscription(), load_libraries(), pg_sync_replication_slots(), ReplicationSlotDropAtPubNode(), ReplSlotSyncWorkerMain(), SetupApplyOrSyncWorker(), standard_ProcessUtility(), and WalReceiverMain().
void * lookup_external_function | ( | void * | filehandle, |
const char * | funcname | ||
) |
void RestoreLibraryState | ( | char * | start_address | ) |
Definition at line 689 of file dfmgr.c.
References internal_load_library().
Referenced by ParallelWorkerMain().
void SerializeLibraryState | ( | Size | maxsize, |
char * | start_address | ||
) |
Definition at line 667 of file dfmgr.c.
References Assert(), file_list, df_files::filename, len, df_files::next, and strlcpy().
Referenced by InitializeParallelDSM().
char * substitute_path_macro | ( | const char * | str, |
const char * | macro, | ||
const char * | value | ||
) |
Definition at line 484 of file dfmgr.c.
References Assert(), ereport, errcode(), errmsg(), ERROR, first_dir_separator(), psprintf(), pstrdup(), str, and value.
Referenced by expand_dynamic_library_name(), find_in_path(), and get_extension_control_directories().
char* Dynamic_library_path |
Definition at line 67 of file dfmgr.c.
Referenced by expand_dynamic_library_name().
|
static |
Definition at line 57 of file dfmgr.c.
Referenced by EstimateLibraryStateSpace(), internal_load_library(), and SerializeLibraryState().
|
static |
Definition at line 58 of file dfmgr.c.
Referenced by internal_load_library().
|
static |
Definition at line 76 of file dfmgr.c.
Referenced by incompatible_module_error(), and internal_load_library().