From a0040d8d7b2ace5e1dece9dcf5d4fb4a647d8ed4 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 10 Jul 2018 15:50:28 +0200 Subject: [PATCH 2/5] Remove obsolete linux dynloader code This has been obsolete probably since the late 1990s. --- configure | 2 +- configure.in | 2 +- src/backend/port/dynloader/linux.c | 134 +---------------------------- src/backend/port/dynloader/linux.h | 6 -- src/include/pg_config.h.in | 3 - src/include/pg_config.h.win32 | 3 - 6 files changed, 6 insertions(+), 144 deletions(-) diff --git a/configure b/configure index 26652133d5..067fc43e4e 100755 --- a/configure +++ b/configure @@ -12495,7 +12495,7 @@ $as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h fi -for ac_header in atomic.h crypt.h dld.h fp_class.h getopt.h ieeefp.h ifaddrs.h langinfo.h mbarrier.h poll.h sys/epoll.h sys/ipc.h sys/prctl.h sys/procctl.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/sockio.h sys/tas.h sys/un.h termios.h ucred.h utime.h wchar.h wctype.h +for ac_header in atomic.h crypt.h fp_class.h getopt.h ieeefp.h ifaddrs.h langinfo.h mbarrier.h poll.h sys/epoll.h sys/ipc.h sys/prctl.h sys/procctl.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/sockio.h sys/tas.h sys/un.h termios.h ucred.h utime.h wchar.h wctype.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" diff --git a/configure.in b/configure.in index 397f6bc765..49257e5301 100644 --- a/configure.in +++ b/configure.in @@ -1260,7 +1260,7 @@ AC_SUBST(UUID_LIBS) AC_HEADER_STDBOOL -AC_CHECK_HEADERS([atomic.h crypt.h dld.h fp_class.h getopt.h ieeefp.h ifaddrs.h langinfo.h mbarrier.h poll.h sys/epoll.h sys/ipc.h sys/prctl.h sys/procctl.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/sockio.h sys/tas.h sys/un.h termios.h ucred.h utime.h wchar.h wctype.h]) +AC_CHECK_HEADERS([atomic.h crypt.h fp_class.h getopt.h ieeefp.h ifaddrs.h langinfo.h mbarrier.h poll.h sys/epoll.h sys/ipc.h sys/prctl.h sys/procctl.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/sockio.h sys/tas.h sys/un.h termios.h ucred.h utime.h wchar.h wctype.h]) # On BSD, test for net/if.h will fail unless sys/socket.h # is included first. diff --git a/src/backend/port/dynloader/linux.c b/src/backend/port/dynloader/linux.c index 8735767add..2126576e8f 100644 --- a/src/backend/port/dynloader/linux.c +++ b/src/backend/port/dynloader/linux.c @@ -1,133 +1,7 @@ -/*------------------------------------------------------------------------- +/* + * src/backend/port/dynloader/linux.c * - * linux.c - * Dynamic Loader for Postgres for Linux, generated from those for - * Ultrix. + * Dummy file used for nothing at this point * - * You need to install the dld library on your Linux system! - * - * Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group - * Portions Copyright (c) 1994, Regents of the University of California - * - * - * IDENTIFICATION - * src/backend/port/dynloader/linux.c - * - *------------------------------------------------------------------------- + * see linux.h */ - -#include "postgres.h" - -#ifdef HAVE_DLD_H -#include -#endif - -#include "dynloader.h" -#include "miscadmin.h" - - -#ifndef HAVE_DLOPEN - -void * -pg_dlopen(const char *filename) -{ -#ifndef HAVE_DLD_H - elog(ERROR, "dynamic load not supported"); - return NULL; -#else - static int dl_initialized = 0; - - /* - * initializes the dynamic loader with the executable's pathname. (only - * needs to do this the first time pg_dlopen is called.) - */ - if (!dl_initialized) - { - if (dld_init(dld_find_executable(my_exec_path))) - return NULL; - - /* - * if there are undefined symbols, we want dl to search from the - * following libraries also. - */ - dl_initialized = 1; - } - - /* - * link the file, then check for undefined symbols! - */ - if (dld_link(filename)) - return NULL; - - /* - * If undefined symbols: try to link with the C and math libraries! This - * could be smarter, if the dynamic linker was able to handle shared libs! - */ - if (dld_undefined_sym_count > 0) - { - if (dld_link("/usr/lib/libc.a")) - { - elog(WARNING, "could not link C library"); - return NULL; - } - if (dld_undefined_sym_count > 0) - { - if (dld_link("/usr/lib/libm.a")) - { - elog(WARNING, "could not link math library"); - return NULL; - } - if (dld_undefined_sym_count > 0) - { - int count = dld_undefined_sym_count; - char **list = dld_list_undefined_sym(); - - /* list the undefined symbols, if any */ - do - { - elog(WARNING, "\"%s\" is undefined", *list); - list++; - count--; - } while (count > 0); - - dld_unlink_by_file(filename, 1); - return NULL; - } - } - } - - return (void *) strdup(filename); -#endif -} - -PGFunction -pg_dlsym(void *handle, const char *funcname) -{ -#ifndef HAVE_DLD_H - return NULL; -#else - return (PGFunction) dld_get_func((funcname)); -#endif -} - -void -pg_dlclose(void *handle) -{ -#ifndef HAVE_DLD_H -#else - dld_unlink_by_file(handle, 1); - free(handle); -#endif -} - -char * -pg_dlerror(void) -{ -#ifndef HAVE_DLD_H - return "dynaloader unsupported"; -#else - return dld_strerror(dld_errno); -#endif -} - -#endif /* !HAVE_DLOPEN */ diff --git a/src/backend/port/dynloader/linux.h b/src/backend/port/dynloader/linux.h index df2852ac58..6beb3d63f8 100644 --- a/src/backend/port/dynloader/linux.h +++ b/src/backend/port/dynloader/linux.h @@ -15,12 +15,7 @@ #define PORT_PROTOS_H #include "utils/dynamic_loader.h" /* pgrminclude ignore */ -#ifdef HAVE_DLOPEN #include -#endif - - -#ifdef HAVE_DLOPEN /* * In some older systems, the RTLD_NOW flag isn't defined and the mode @@ -39,6 +34,5 @@ #define pg_dlsym dlsym #define pg_dlclose dlclose #define pg_dlerror dlerror -#endif /* HAVE_DLOPEN */ #endif /* PORT_PROTOS_H */ diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index b7e469670f..827574ee40 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -186,9 +186,6 @@ don't. */ #undef HAVE_DECL_VSNPRINTF -/* Define to 1 if you have the header file. */ -#undef HAVE_DLD_H - /* Define to 1 if you have the `dlopen' function. */ #undef HAVE_DLOPEN diff --git a/src/include/pg_config.h.win32 b/src/include/pg_config.h.win32 index ab276f7a95..46ce49def2 100644 --- a/src/include/pg_config.h.win32 +++ b/src/include/pg_config.h.win32 @@ -143,9 +143,6 @@ don't. */ #define HAVE_DECL_VSNPRINTF 1 -/* Define to 1 if you have the header file. */ -/* #undef HAVE_DLD_H */ - /* Define to 1 if you have the `dlopen' function. */ /* #undef HAVE_DLOPEN */ -- 2.18.0