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 void | incompatible_module_error (const char *libname, const Pg_magic_struct *module_magic_data) pg_attribute_noreturn() |
static char * | expand_dynamic_library_name (const char *name) |
static void | check_restricted_library_name (const char *name) |
static char * | substitute_libpath_macro (const char *name) |
static char * | find_in_dynamic_libpath (const char *basename) |
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) |
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 |
Definition at line 463 of file dfmgr.c.
References ereport, errcode(), errmsg(), ERROR, first_dir_separator(), and name.
Referenced by load_file().
Size EstimateLibraryStateSpace | ( | void | ) |
Definition at line 631 of file dfmgr.c.
References add_size(), file_list, df_files::filename, df_files::next, and size.
Referenced by InitializeParallelDSM().
|
static |
Definition at line 408 of file dfmgr.c.
References Assert, find_in_dynamic_libpath(), first_dir_separator(), name, pfree(), pg_file_exists(), psprintf(), pstrdup(), and substitute_libpath_macro().
Referenced by load_external_function(), and load_file().
|
static |
Definition at line 509 of file dfmgr.c.
References Assert, canonicalize_path(), DEBUG3, Dynamic_library_path, 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_libpath_macro().
Referenced by expand_dynamic_library_name().
void** find_rendezvous_variable | ( | const char * | varName | ) |
Definition at line 593 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 296 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 174 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 95 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(), LoadArchiveLibrary(), LoadOutputPlugin(), LookupBackgroundWorkerFunction(), LookupParallelWorkerFunction(), and provider_init().
void load_file | ( | const char * | filename, |
bool | restricted | ||
) |
Definition at line 134 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 670 of file dfmgr.c.
References internal_load_library().
Referenced by ParallelWorkerMain().
void SerializeLibraryState | ( | Size | maxsize, |
char * | start_address | ||
) |
Definition at line 648 of file dfmgr.c.
References Assert, file_list, df_files::filename, len, df_files::next, and strlcpy().
Referenced by InitializeParallelDSM().
|
static |
Definition at line 478 of file dfmgr.c.
References Assert, ereport, errcode(), errmsg(), ERROR, first_dir_separator(), name, pkglib_path, psprintf(), and pstrdup().
Referenced by expand_dynamic_library_name(), and find_in_dynamic_libpath().
char* Dynamic_library_path |
Definition at line 67 of file dfmgr.c.
Referenced by find_in_dynamic_libpath().
|
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 78 of file dfmgr.c.
Referenced by incompatible_module_error(), and internal_load_library().