1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

Refactor dlopen() support

Nowadays, all platforms except Windows and older HP-UX have standard
dlopen() support.  So having a separate implementation per platform
under src/backend/port/dynloader/ is a bit excessive.  Instead, treat
dlopen() like other library functions that happen to be missing
sometimes and put a replacement implementation under src/port/.

Discussion: https://www.postgresql.org/message-id/flat/e11a49cb-570a-60b7-707d-7084c8de0e61%402ndquadrant.com#54e735ae37476a121abb4e33c2549b03
This commit is contained in:
Peter Eisentraut
2018-09-06 10:07:24 +02:00
parent ac27c74def
commit 842cb9fa62
37 changed files with 172 additions and 540 deletions

View File

@@ -403,6 +403,29 @@ extern void srandom(unsigned int seed);
#define SSL_get_current_compression(x) 0
#endif
#ifndef HAVE_DLOPEN
extern void *dlopen(const char *file, int mode);
extern void *dlsym(void *handle, const char *symbol);
extern int dlclose(void *handle);
extern char *dlerror(void);
#endif
/*
* In some older systems, the RTLD_NOW flag isn't defined and the mode
* argument to dlopen must always be 1.
*/
#if !HAVE_DECL_RTLD_NOW
#define RTLD_NOW 1
#endif
/*
* The RTLD_GLOBAL flag is wanted if available, but it doesn't exist
* everywhere. If it doesn't exist, set it to 0 so it has no effect.
*/
#if !HAVE_DECL_RTLD_GLOBAL
#define RTLD_GLOBAL 0
#endif
/* thread.h */
extern char *pqStrerror(int errnum, char *strerrbuf, size_t buflen);