PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
dfmgr.c
Go to the documentation of this file.
1/*-------------------------------------------------------------------------
2 *
3 * dfmgr.c
4 * Dynamic function manager code.
5 *
6 * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
8 *
9 *
10 * IDENTIFICATION
11 * src/backend/utils/fmgr/dfmgr.c
12 *
13 *-------------------------------------------------------------------------
14 */
15#include "postgres.h"
16
17#include <sys/stat.h>
18
19#ifndef WIN32
20#include <dlfcn.h>
21#endif /* !WIN32 */
22
23#include "fmgr.h"
24#include "lib/stringinfo.h"
25#include "miscadmin.h"
26#include "storage/fd.h"
27#include "storage/shmem.h"
28#include "utils/hsearch.h"
29
30
31/* signature for PostgreSQL-specific library init function */
32typedef void (*PG_init_t) (void);
33
34/* hashtable entry for rendezvous variables */
35typedef struct
36{
37 char varName[NAMEDATALEN]; /* hash key (must be first) */
38 void *varValue;
40
41/*
42 * List of dynamically loaded files (kept in malloc'd memory).
43 *
44 * Note: "typedef struct DynamicFileList DynamicFileList" appears in fmgr.h.
45 */
47{
48 DynamicFileList *next; /* List link */
49 dev_t device; /* Device file is on */
50#ifndef WIN32 /* ensures we never again depend on this under
51 * win32 */
52 ino_t inode; /* Inode number of file */
53#endif
54 void *handle; /* a handle for pg_dl* functions */
55 const Pg_magic_struct *magic; /* Location of module's magic block */
56 char filename[FLEXIBLE_ARRAY_MEMBER]; /* Full pathname of file */
57};
58
61
62/* stat() call under Win32 returns an st_ino field, but it has no meaning */
63#ifndef WIN32
64#define SAME_INODE(A,B) ((A).st_ino == (B).inode && (A).st_dev == (B).device)
65#else
66#define SAME_INODE(A,B) false
67#endif
68
70
71static void *internal_load_library(const char *libname);
72pg_noreturn static void incompatible_module_error(const char *libname,
73 const Pg_abi_values *module_magic_data);
74static char *expand_dynamic_library_name(const char *name);
75static void check_restricted_library_name(const char *name);
76
77/* ABI values that module needs to match to be accepted */
79
80
81/*
82 * Load the specified dynamic-link library file, and look for a function
83 * named funcname in it.
84 *
85 * If the function is not found, we raise an error if signalNotFound is true,
86 * else return NULL. Note that errors in loading the library
87 * will provoke ereport() regardless of signalNotFound.
88 *
89 * If filehandle is not NULL, then *filehandle will be set to a handle
90 * identifying the library file. The filehandle can be used with
91 * lookup_external_function to lookup additional functions in the same file
92 * at less cost than repeating load_external_function.
93 */
94void *
95load_external_function(const char *filename, const char *funcname,
96 bool signalNotFound, void **filehandle)
97{
98 char *fullname;
99 void *lib_handle;
100 void *retval;
101
102 /* Expand the possibly-abbreviated filename to an exact path name */
104
105 /* Load the shared library, unless we already did */
106 lib_handle = internal_load_library(fullname);
107
108 /* Return handle if caller wants it */
109 if (filehandle)
110 *filehandle = lib_handle;
111
112 /* Look up the function within the library. */
113 retval = dlsym(lib_handle, funcname);
114
115 if (retval == NULL && signalNotFound)
117 (errcode(ERRCODE_UNDEFINED_FUNCTION),
118 errmsg("could not find function \"%s\" in file \"%s\"",
119 funcname, fullname)));
120
121 pfree(fullname);
122 return retval;
123}
124
125/*
126 * This function loads a shlib file without looking up any particular
127 * function in it. If the same shlib has previously been loaded,
128 * we do not load it again.
129 *
130 * When 'restricted' is true, only libraries in the presumed-secure
131 * directory $libdir/plugins may be referenced.
132 */
133void
134load_file(const char *filename, bool restricted)
135{
136 char *fullname;
137
138 /* Apply security restriction if requested */
139 if (restricted)
141
142 /* Expand the possibly-abbreviated filename to an exact path name */
144
145 /* Load the shared library, unless we already did */
146 (void) internal_load_library(fullname);
147
148 pfree(fullname);
149}
150
151/*
152 * Lookup a function whose library file is already loaded.
153 * Return NULL if not found.
154 */
155void *
156lookup_external_function(void *filehandle, const char *funcname)
157{
158 return dlsym(filehandle, funcname);
159}
160
161
162/*
163 * Load the specified dynamic-link library file, unless it already is
164 * loaded. Return the pg_dl* handle for the file.
165 *
166 * Note: libname is expected to be an exact name for the library file.
167 *
168 * NB: There is presently no way to unload a dynamically loaded file. We might
169 * add one someday if we can convince ourselves we have safe protocols for un-
170 * hooking from hook function pointers, releasing custom GUC variables, and
171 * perhaps other things that are definitely unsafe currently.
172 */
173static void *
174internal_load_library(const char *libname)
175{
176 DynamicFileList *file_scanner;
177 PGModuleMagicFunction magic_func;
178 char *load_error;
179 struct stat stat_buf;
180 PG_init_t PG_init;
181
182 /*
183 * Scan the list of loaded FILES to see if the file has been loaded.
184 */
185 for (file_scanner = file_list;
186 file_scanner != NULL &&
187 strcmp(libname, file_scanner->filename) != 0;
188 file_scanner = file_scanner->next)
189 ;
190
191 if (file_scanner == NULL)
192 {
193 /*
194 * Check for same files - different paths (ie, symlink or link)
195 */
196 if (stat(libname, &stat_buf) == -1)
199 errmsg("could not access file \"%s\": %m",
200 libname)));
201
202 for (file_scanner = file_list;
203 file_scanner != NULL &&
204 !SAME_INODE(stat_buf, *file_scanner);
205 file_scanner = file_scanner->next)
206 ;
207 }
208
209 if (file_scanner == NULL)
210 {
211 /*
212 * File not loaded yet.
213 */
214 file_scanner = (DynamicFileList *)
215 malloc(offsetof(DynamicFileList, filename) + strlen(libname) + 1);
216 if (file_scanner == NULL)
218 (errcode(ERRCODE_OUT_OF_MEMORY),
219 errmsg("out of memory")));
220
221 MemSet(file_scanner, 0, offsetof(DynamicFileList, filename));
222 strcpy(file_scanner->filename, libname);
223 file_scanner->device = stat_buf.st_dev;
224#ifndef WIN32
225 file_scanner->inode = stat_buf.st_ino;
226#endif
227 file_scanner->next = NULL;
228
229 file_scanner->handle = dlopen(file_scanner->filename, RTLD_NOW | RTLD_GLOBAL);
230 if (file_scanner->handle == NULL)
231 {
232 load_error = dlerror();
233 free(file_scanner);
234 /* errcode_for_file_access might not be appropriate here? */
237 errmsg("could not load library \"%s\": %s",
238 libname, load_error)));
239 }
240
241 /* Check the magic function to determine compatibility */
242 magic_func = (PGModuleMagicFunction)
244 if (magic_func)
245 {
246 const Pg_magic_struct *magic_data_ptr = (*magic_func) ();
247
248 /* Check ABI compatibility fields */
249 if (magic_data_ptr->len != sizeof(Pg_magic_struct) ||
250 memcmp(&magic_data_ptr->abi_fields, &magic_data,
251 sizeof(Pg_abi_values)) != 0)
252 {
253 /* copy data block before unlinking library */
254 Pg_magic_struct module_magic_data = *magic_data_ptr;
255
256 /* try to close library */
257 dlclose(file_scanner->handle);
258 free(file_scanner);
259
260 /* issue suitable complaint */
261 incompatible_module_error(libname, &module_magic_data.abi_fields);
262 }
263
264 /* Remember the magic block's location for future use */
265 file_scanner->magic = magic_data_ptr;
266 }
267 else
268 {
269 /* try to close library */
270 dlclose(file_scanner->handle);
271 free(file_scanner);
272 /* complain */
274 (errmsg("incompatible library \"%s\": missing magic block",
275 libname),
276 errhint("Extension libraries are required to use the PG_MODULE_MAGIC macro.")));
277 }
278
279 /*
280 * If the library has a _PG_init() function, call it.
281 */
282 PG_init = (PG_init_t) dlsym(file_scanner->handle, "_PG_init");
283 if (PG_init)
284 (*PG_init) ();
285
286 /* OK to link it into list */
287 if (file_list == NULL)
288 file_list = file_scanner;
289 else
290 file_tail->next = file_scanner;
291 file_tail = file_scanner;
292 }
293
294 return file_scanner->handle;
295}
296
297/*
298 * Report a suitable error for an incompatible magic block.
299 */
300static void
301incompatible_module_error(const char *libname,
302 const Pg_abi_values *module_magic_data)
303{
304 StringInfoData details;
305
306 /*
307 * If the version doesn't match, just report that, because the rest of the
308 * block might not even have the fields we expect.
309 */
310 if (magic_data.version != module_magic_data->version)
311 {
312 char library_version[32];
313
314 if (module_magic_data->version >= 1000)
315 snprintf(library_version, sizeof(library_version), "%d",
316 module_magic_data->version / 100);
317 else
318 snprintf(library_version, sizeof(library_version), "%d.%d",
319 module_magic_data->version / 100,
320 module_magic_data->version % 100);
322 (errmsg("incompatible library \"%s\": version mismatch",
323 libname),
324 errdetail("Server is version %d, library is version %s.",
325 magic_data.version / 100, library_version)));
326 }
327
328 /*
329 * Similarly, if the ABI extra field doesn't match, error out. Other
330 * fields below might also mismatch, but that isn't useful information if
331 * you're using the wrong product altogether.
332 */
333 if (strcmp(module_magic_data->abi_extra, magic_data.abi_extra) != 0)
334 {
336 (errmsg("incompatible library \"%s\": ABI mismatch",
337 libname),
338 errdetail("Server has ABI \"%s\", library has \"%s\".",
340 module_magic_data->abi_extra)));
341 }
342
343 /*
344 * Otherwise, spell out which fields don't agree.
345 *
346 * XXX this code has to be adjusted any time the set of fields in a magic
347 * block change!
348 */
349 initStringInfo(&details);
350
351 if (module_magic_data->funcmaxargs != magic_data.funcmaxargs)
352 {
353 if (details.len)
354 appendStringInfoChar(&details, '\n');
355 appendStringInfo(&details,
356 /* translator: %s is a variable name and %d its values */
357 _("Server has %s = %d, library has %d."),
358 "FUNC_MAX_ARGS", magic_data.funcmaxargs,
359 module_magic_data->funcmaxargs);
360 }
361 if (module_magic_data->indexmaxkeys != magic_data.indexmaxkeys)
362 {
363 if (details.len)
364 appendStringInfoChar(&details, '\n');
365 appendStringInfo(&details,
366 /* translator: %s is a variable name and %d its values */
367 _("Server has %s = %d, library has %d."),
368 "INDEX_MAX_KEYS", magic_data.indexmaxkeys,
369 module_magic_data->indexmaxkeys);
370 }
371 if (module_magic_data->namedatalen != magic_data.namedatalen)
372 {
373 if (details.len)
374 appendStringInfoChar(&details, '\n');
375 appendStringInfo(&details,
376 /* translator: %s is a variable name and %d its values */
377 _("Server has %s = %d, library has %d."),
378 "NAMEDATALEN", magic_data.namedatalen,
379 module_magic_data->namedatalen);
380 }
381 if (module_magic_data->float8byval != magic_data.float8byval)
382 {
383 if (details.len)
384 appendStringInfoChar(&details, '\n');
385 appendStringInfo(&details,
386 /* translator: %s is a variable name and %d its values */
387 _("Server has %s = %s, library has %s."),
388 "FLOAT8PASSBYVAL", magic_data.float8byval ? "true" : "false",
389 module_magic_data->float8byval ? "true" : "false");
390 }
391
392 if (details.len == 0)
393 appendStringInfoString(&details,
394 _("Magic block has unexpected length or padding difference."));
395
397 (errmsg("incompatible library \"%s\": magic block mismatch",
398 libname),
399 errdetail_internal("%s", details.data)));
400}
401
402
403/*
404 * Iterator functions to allow callers to scan the list of loaded modules.
405 *
406 * Note: currently, there is no special provision for dealing with changes
407 * in the list while a scan is happening. Current callers don't need it.
408 */
411{
412 return file_list;
413}
414
417{
418 return dfptr->next;
419}
420
421/*
422 * Return some details about the specified module.
423 *
424 * Note that module_name and module_version could be returned as NULL.
425 *
426 * We could dispense with this function by exposing struct DynamicFileList
427 * globally, but this way seems preferable.
428 */
429void
431 const char **library_path,
432 const char **module_name,
433 const char **module_version)
434{
435 *library_path = dfptr->filename;
436 *module_name = dfptr->magic->name;
437 *module_version = dfptr->magic->version;
438}
439
440
441/*
442 * If name contains a slash, check if the file exists, if so return
443 * the name. Else (no slash) try to expand using search path (see
444 * find_in_path below); if that works, return the fully
445 * expanded file name. If the previous failed, append DLSUFFIX and
446 * try again. If all fails, just return the original name.
447 *
448 * The result will always be freshly palloc'd.
449 */
450static char *
452{
453 bool have_slash;
454 char *new;
455 char *full;
456
457 Assert(name);
458
459 /*
460 * If the value starts with "$libdir/", strip that. This is because many
461 * extensions have hardcoded '$libdir/foo' as their library name, which
462 * prevents using the path.
463 */
464 if (strncmp(name, "$libdir/", 8) == 0)
465 name += 8;
466
467 have_slash = (first_dir_separator(name) != NULL);
468
469 if (!have_slash)
470 {
471 full = find_in_path(name, Dynamic_library_path, "dynamic_library_path", "$libdir", pkglib_path);
472 if (full)
473 return full;
474 }
475 else
476 {
477 full = substitute_path_macro(name, "$libdir", pkglib_path);
478 if (pg_file_exists(full))
479 return full;
480 pfree(full);
481 }
482
483 new = psprintf("%s%s", name, DLSUFFIX);
484
485 if (!have_slash)
486 {
487 full = find_in_path(new, Dynamic_library_path, "dynamic_library_path", "$libdir", pkglib_path);
488 pfree(new);
489 if (full)
490 return full;
491 }
492 else
493 {
494 full = substitute_path_macro(new, "$libdir", pkglib_path);
495 pfree(new);
496 if (pg_file_exists(full))
497 return full;
498 pfree(full);
499 }
500
501 /*
502 * If we can't find the file, just return the string as-is. The ensuing
503 * load attempt will fail and report a suitable message.
504 */
505 return pstrdup(name);
506}
507
508/*
509 * Check a restricted library name. It must begin with "$libdir/plugins/"
510 * and there must not be any directory separators after that (this is
511 * sufficient to prevent ".." style attacks).
512 */
513static void
515{
516 if (strncmp(name, "$libdir/plugins/", 16) != 0 ||
517 first_dir_separator(name + 16) != NULL)
519 (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
520 errmsg("access to library \"%s\" is not allowed",
521 name)));
522}
523
524/*
525 * Substitute for any macros appearing in the given string.
526 * Result is always freshly palloc'd.
527 */
528char *
529substitute_path_macro(const char *str, const char *macro, const char *value)
530{
531 const char *sep_ptr;
532
533 Assert(str != NULL);
534 Assert(macro[0] == '$');
535
536 /* Currently, we only recognize $macro at the start of the string */
537 if (str[0] != '$')
538 return pstrdup(str);
539
540 if ((sep_ptr = first_dir_separator(str)) == NULL)
541 sep_ptr = str + strlen(str);
542
543 if (strlen(macro) != sep_ptr - str ||
544 strncmp(str, macro, strlen(macro)) != 0)
546 (errcode(ERRCODE_INVALID_NAME),
547 errmsg("invalid macro name in path: %s",
548 str)));
549
550 return psprintf("%s%s", value, sep_ptr);
551}
552
553
554/*
555 * Search for a file called 'basename' in the colon-separated search
556 * path given. If the file is found, the full file name
557 * is returned in freshly palloc'd memory. If the file is not found,
558 * return NULL.
559 *
560 * path_param is the name of the parameter that path came from, for error
561 * messages.
562 *
563 * macro and macro_val allow substituting a macro; see
564 * substitute_path_macro().
565 */
566char *
567find_in_path(const char *basename, const char *path, const char *path_param,
568 const char *macro, const char *macro_val)
569{
570 const char *p;
571 size_t baselen;
572
573 Assert(basename != NULL);
574 Assert(first_dir_separator(basename) == NULL);
575 Assert(path != NULL);
576 Assert(path_param != NULL);
577
578 p = path;
579
580 /*
581 * If the path variable is empty, don't do a path search.
582 */
583 if (strlen(p) == 0)
584 return NULL;
585
586 baselen = strlen(basename);
587
588 for (;;)
589 {
590 size_t len;
591 char *piece;
592 char *mangled;
593 char *full;
594
595 piece = first_path_var_separator(p);
596 if (piece == p)
598 (errcode(ERRCODE_INVALID_NAME),
599 errmsg("zero-length component in parameter \"%s\"", path_param)));
600
601 if (piece == NULL)
602 len = strlen(p);
603 else
604 len = piece - p;
605
606 piece = palloc(len + 1);
607 strlcpy(piece, p, len + 1);
608
609 mangled = substitute_path_macro(piece, macro, macro_val);
610 pfree(piece);
611
612 canonicalize_path(mangled);
613
614 /* only absolute paths */
615 if (!is_absolute_path(mangled))
617 (errcode(ERRCODE_INVALID_NAME),
618 errmsg("component in parameter \"%s\" is not an absolute path", path_param)));
619
620 full = palloc(strlen(mangled) + 1 + baselen + 1);
621 sprintf(full, "%s/%s", mangled, basename);
622 pfree(mangled);
623
624 elog(DEBUG3, "%s: trying \"%s\"", __func__, full);
625
626 if (pg_file_exists(full))
627 return full;
628
629 pfree(full);
630
631 if (p[len] == '\0')
632 break;
633 else
634 p += len + 1;
635 }
636
637 return NULL;
638}
639
640
641/*
642 * Find (or create) a rendezvous variable that one dynamically
643 * loaded library can use to meet up with another.
644 *
645 * On the first call of this function for a particular varName,
646 * a "rendezvous variable" is created with the given name.
647 * The value of the variable is a void pointer (initially set to NULL).
648 * Subsequent calls with the same varName just return the address of
649 * the existing variable. Once created, a rendezvous variable lasts
650 * for the life of the process.
651 *
652 * Dynamically loaded libraries can use rendezvous variables
653 * to find each other and share information: they just need to agree
654 * on the variable name and the data it will point to.
655 */
656void **
657find_rendezvous_variable(const char *varName)
658{
659 static HTAB *rendezvousHash = NULL;
660
661 rendezvousHashEntry *hentry;
662 bool found;
663
664 /* Create a hashtable if we haven't already done so in this process */
665 if (rendezvousHash == NULL)
666 {
667 HASHCTL ctl;
668
669 ctl.keysize = NAMEDATALEN;
670 ctl.entrysize = sizeof(rendezvousHashEntry);
671 rendezvousHash = hash_create("Rendezvous variable hash",
672 16,
673 &ctl,
675 }
676
677 /* Find or create the hashtable entry for this varName */
678 hentry = (rendezvousHashEntry *) hash_search(rendezvousHash,
679 varName,
681 &found);
682
683 /* Initialize to NULL if first time */
684 if (!found)
685 hentry->varValue = NULL;
686
687 return &hentry->varValue;
688}
689
690/*
691 * Estimate the amount of space needed to serialize the list of libraries
692 * we have loaded.
693 */
694Size
696{
697 DynamicFileList *file_scanner;
698 Size size = 1;
699
700 for (file_scanner = file_list;
701 file_scanner != NULL;
702 file_scanner = file_scanner->next)
703 size = add_size(size, strlen(file_scanner->filename) + 1);
704
705 return size;
706}
707
708/*
709 * Serialize the list of libraries we have loaded to a chunk of memory.
710 */
711void
712SerializeLibraryState(Size maxsize, char *start_address)
713{
714 DynamicFileList *file_scanner;
715
716 for (file_scanner = file_list;
717 file_scanner != NULL;
718 file_scanner = file_scanner->next)
719 {
720 Size len;
721
722 len = strlcpy(start_address, file_scanner->filename, maxsize) + 1;
723 Assert(len < maxsize);
724 maxsize -= len;
725 start_address += len;
726 }
727 start_address[0] = '\0';
728}
729
730/*
731 * Load every library the serializing backend had loaded.
732 */
733void
734RestoreLibraryState(char *start_address)
735{
736 while (*start_address != '\0')
737 {
738 internal_load_library(start_address);
739 start_address += strlen(start_address) + 1;
740 }
741}
#define pg_noreturn
Definition: c.h:165
#define FLEXIBLE_ARRAY_MEMBER
Definition: c.h:434
#define MemSet(start, val, len)
Definition: c.h:991
size_t Size
Definition: c.h:576
static char * expand_dynamic_library_name(const char *name)
Definition: dfmgr.c:451
static const Pg_abi_values magic_data
Definition: dfmgr.c:78
static DynamicFileList * file_tail
Definition: dfmgr.c:60
void RestoreLibraryState(char *start_address)
Definition: dfmgr.c:734
char * find_in_path(const char *basename, const char *path, const char *path_param, const char *macro, const char *macro_val)
Definition: dfmgr.c:567
char * Dynamic_library_path
Definition: dfmgr.c:69
static void * internal_load_library(const char *libname)
Definition: dfmgr.c:174
void SerializeLibraryState(Size maxsize, char *start_address)
Definition: dfmgr.c:712
DynamicFileList * get_next_loaded_module(DynamicFileList *dfptr)
Definition: dfmgr.c:416
void load_file(const char *filename, bool restricted)
Definition: dfmgr.c:134
static pg_noreturn void incompatible_module_error(const char *libname, const Pg_abi_values *module_magic_data)
Definition: dfmgr.c:301
void ** find_rendezvous_variable(const char *varName)
Definition: dfmgr.c:657
Size EstimateLibraryStateSpace(void)
Definition: dfmgr.c:695
void * lookup_external_function(void *filehandle, const char *funcname)
Definition: dfmgr.c:156
static DynamicFileList * file_list
Definition: dfmgr.c:59
void(* PG_init_t)(void)
Definition: dfmgr.c:32
DynamicFileList * get_first_loaded_module(void)
Definition: dfmgr.c:410
void * load_external_function(const char *filename, const char *funcname, bool signalNotFound, void **filehandle)
Definition: dfmgr.c:95
void get_loaded_module_details(DynamicFileList *dfptr, const char **library_path, const char **module_name, const char **module_version)
Definition: dfmgr.c:430
static void check_restricted_library_name(const char *name)
Definition: dfmgr.c:514
#define SAME_INODE(A, B)
Definition: dfmgr.c:64
char * substitute_path_macro(const char *str, const char *macro, const char *value)
Definition: dfmgr.c:529
void * hash_search(HTAB *hashp, const void *keyPtr, HASHACTION action, bool *foundPtr)
Definition: dynahash.c:955
HTAB * hash_create(const char *tabname, long nelem, const HASHCTL *info, int flags)
Definition: dynahash.c:352
int errdetail_internal(const char *fmt,...)
Definition: elog.c:1231
int errcode_for_file_access(void)
Definition: elog.c:877
int errdetail(const char *fmt,...)
Definition: elog.c:1204
int errhint(const char *fmt,...)
Definition: elog.c:1318
int errcode(int sqlerrcode)
Definition: elog.c:854
int errmsg(const char *fmt,...)
Definition: elog.c:1071
#define _(x)
Definition: elog.c:91
#define DEBUG3
Definition: elog.h:28
#define ERROR
Definition: elog.h:39
#define elog(elevel,...)
Definition: elog.h:226
#define ereport(elevel,...)
Definition: elog.h:149
bool pg_file_exists(const char *name)
Definition: fd.c:503
#define PG_MAGIC_FUNCTION_NAME_STRING
Definition: fmgr.h:518
const Pg_magic_struct *(* PGModuleMagicFunction)(void)
Definition: fmgr.h:515
#define PG_MODULE_ABI_DATA
Definition: fmgr.h:487
char pkglib_path[MAXPGPATH]
Definition: globals.c:83
Assert(PointerIsAligned(start, uint64))
const char * str
#define free(a)
Definition: header.h:65
#define malloc(a)
Definition: header.h:50
#define HASH_STRINGS
Definition: hsearch.h:96
@ HASH_ENTER
Definition: hsearch.h:114
#define HASH_ELEM
Definition: hsearch.h:95
#define funcname
Definition: indent_codes.h:69
static struct @165 value
char * pstrdup(const char *in)
Definition: mcxt.c:2321
void pfree(void *pointer)
Definition: mcxt.c:2146
void * palloc(Size size)
Definition: mcxt.c:1939
#define NAMEDATALEN
const void size_t len
static char * filename
Definition: pg_dumpall.c:123
#define is_absolute_path(filename)
Definition: port.h:104
#define sprintf
Definition: port.h:241
char * first_path_var_separator(const char *pathlist)
Definition: path.c:127
void canonicalize_path(char *path)
Definition: path.c:337
#define snprintf
Definition: port.h:239
char * first_dir_separator(const char *filename)
Definition: path.c:110
size_t strlcpy(char *dst, const char *src, size_t siz)
Definition: strlcpy.c:45
char * psprintf(const char *fmt,...)
Definition: psprintf.c:43
tree ctl
Definition: radixtree.h:1838
Size add_size(Size s1, Size s2)
Definition: shmem.c:493
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition: stringinfo.c:145
void appendStringInfoString(StringInfo str, const char *s)
Definition: stringinfo.c:230
void appendStringInfoChar(StringInfo str, char ch)
Definition: stringinfo.c:242
void initStringInfo(StringInfo str)
Definition: stringinfo.c:97
ino_t inode
Definition: dfmgr.c:52
dev_t device
Definition: dfmgr.c:49
const Pg_magic_struct * magic
Definition: dfmgr.c:55
char filename[FLEXIBLE_ARRAY_MEMBER]
Definition: dfmgr.c:56
DynamicFileList * next
Definition: dfmgr.c:48
void * handle
Definition: dfmgr.c:54
Definition: dynahash.c:220
int funcmaxargs
Definition: fmgr.h:469
int version
Definition: fmgr.h:468
char abi_extra[32]
Definition: fmgr.h:473
int float8byval
Definition: fmgr.h:472
int indexmaxkeys
Definition: fmgr.h:470
int namedatalen
Definition: fmgr.h:471
const char * name
Definition: fmgr.h:482
Pg_abi_values abi_fields
Definition: fmgr.h:480
const char * version
Definition: fmgr.h:483
void * varValue
Definition: dfmgr.c:38
_dev_t st_dev
Definition: win32_port.h:256
_ino_t st_ino
Definition: win32_port.h:257
const char * name
void * dlopen(const char *file, int mode)
Definition: win32dlopen.c:76
#define stat
Definition: win32_port.h:274
char * dlerror(void)
Definition: win32dlopen.c:40
void * dlsym(void *handle, const char *symbol)
Definition: win32dlopen.c:61
#define RTLD_NOW
Definition: win32_port.h:533
#define RTLD_GLOBAL
Definition: win32_port.h:534
int dlclose(void *handle)
Definition: win32dlopen.c:49