diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2011-04-07 15:14:39 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2011-04-07 15:14:39 -0400 |
commit | 73d9a908140e709b4cb12a8d2257a11baaec974f (patch) | |
tree | b7a2a378e281242ff2c681cfcc66fc50f544e701 /src/backend/port/dynloader/openbsd.c | |
parent | 1eb2231fc46bbfa85b47c19d88f72162b323aa51 (diff) |
Modernize dlopen interface code for FreeBSD and OpenBSD.
Remove the hard-wired assumption that __mips__ (and only __mips__) lacks
dlopen in FreeBSD and OpenBSD. This assumption is outdated at least for
OpenBSD, as per report from an anonymous 9.1 tester. We can perfectly well
use HAVE_DLOPEN instead to decide which code to use.
Some other cosmetic adjustments to make freebsd.c, netbsd.c, and openbsd.c
exactly alike.
Diffstat (limited to 'src/backend/port/dynloader/openbsd.c')
-rw-r--r-- | src/backend/port/dynloader/openbsd.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/backend/port/dynloader/openbsd.c b/src/backend/port/dynloader/openbsd.c index d099ec37602..2d061efb1e8 100644 --- a/src/backend/port/dynloader/openbsd.c +++ b/src/backend/port/dynloader/openbsd.c @@ -57,7 +57,7 @@ BSD44_derived_dlerror(void) void * BSD44_derived_dlopen(const char *file, int num) { -#if defined(__mips__) +#if !defined(HAVE_DLOPEN) snprintf(error_message, sizeof(error_message), "dlopen (%s) not supported", file); return NULL; @@ -74,14 +74,14 @@ BSD44_derived_dlopen(const char *file, int num) void * BSD44_derived_dlsym(void *handle, const char *name) { -#if defined(__mips__) +#if !defined(HAVE_DLOPEN) snprintf(error_message, sizeof(error_message), "dlsym (%s) failed", name); return NULL; -#elif defined(__ELF__) - return dlsym(handle, name); #else void *vp; + +#ifndef __ELF__ char buf[BUFSIZ]; if (*name != '_') @@ -89,6 +89,7 @@ BSD44_derived_dlsym(void *handle, const char *name) snprintf(buf, sizeof(buf), "_%s", name); name = buf; } +#endif /* !__ELF__ */ if ((vp = dlsym(handle, (char *) name)) == NULL) snprintf(error_message, sizeof(error_message), "dlsym (%s) failed", name); @@ -99,8 +100,7 @@ BSD44_derived_dlsym(void *handle, const char *name) void BSD44_derived_dlclose(void *handle) { -#if defined(__mips__) -#else +#if defined(HAVE_DLOPEN) dlclose(handle); #endif } |