2008-04-05 18:39:26 +02:00
|
|
|
$NetBSD: patch-ad,v 1.2 2008/04/05 16:39:27 adam Exp $
|
2008-03-04 13:41:36 +01:00
|
|
|
|
2008-04-05 18:39:26 +02:00
|
|
|
--- src/backend/port/dynloader/netbsd.c.orig 2008-04-05 10:45:52.000000000 +0200
|
2008-03-04 13:41:36 +01:00
|
|
|
+++ src/backend/port/dynloader/netbsd.c
|
2008-04-05 18:39:26 +02:00
|
|
|
@@ -42,64 +42,30 @@ static char sccsid[] = "@(#)dl.c 5.4 (Be
|
2008-03-04 13:41:36 +01:00
|
|
|
|
|
|
|
#include "dynloader.h"
|
|
|
|
|
|
|
|
-static char error_message[BUFSIZ];
|
|
|
|
+#ifndef HAVE_DLOPEN
|
|
|
|
|
|
|
|
char *
|
|
|
|
-BSD44_derived_dlerror(void)
|
|
|
|
+pg_dlerror(void)
|
|
|
|
{
|
|
|
|
- static char ret[BUFSIZ];
|
|
|
|
-
|
|
|
|
- strcpy(ret, error_message);
|
|
|
|
- error_message[0] = 0;
|
|
|
|
- return (ret[0] == 0) ? NULL : ret;
|
|
|
|
+ return "dynaloader unsupported";
|
|
|
|
}
|
|
|
|
|
|
|
|
void *
|
|
|
|
-BSD44_derived_dlopen(const char *file, int num)
|
|
|
|
+pg_dlopen(const char *file, int num)
|
|
|
|
{
|
2008-04-05 18:39:26 +02:00
|
|
|
-#if !defined(HAVE_DLOPEN)
|
2008-03-04 13:41:36 +01:00
|
|
|
- snprintf(error_message, sizeof(error_message),
|
|
|
|
- "dlopen (%s) not supported", file);
|
|
|
|
+ elog(ERROR, "dynamic load not supported");
|
|
|
|
return NULL;
|
|
|
|
-#else
|
|
|
|
- void *vp;
|
|
|
|
-
|
|
|
|
- if ((vp = dlopen((char *) file, num)) == NULL)
|
|
|
|
- snprintf(error_message, sizeof(error_message),
|
|
|
|
- "dlopen (%s) failed: %s", file, dlerror());
|
|
|
|
- return vp;
|
|
|
|
-#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void *
|
|
|
|
-BSD44_derived_dlsym(void *handle, const char *name)
|
|
|
|
+pg_dlsym(void *handle, const char *name)
|
|
|
|
{
|
2008-04-05 18:39:26 +02:00
|
|
|
-#if !defined(HAVE_DLOPEN)
|
2008-03-04 13:41:36 +01:00
|
|
|
- snprintf(error_message, sizeof(error_message),
|
|
|
|
- "dlsym (%s) failed", name);
|
|
|
|
return NULL;
|
|
|
|
-#elif defined(__ELF__)
|
|
|
|
- return dlsym(handle, name);
|
|
|
|
-#else
|
|
|
|
- void *vp;
|
|
|
|
- char buf[BUFSIZ];
|
|
|
|
-
|
|
|
|
- if (*name != '_')
|
|
|
|
- {
|
|
|
|
- snprintf(buf, sizeof(buf), "_%s", name);
|
|
|
|
- name = buf;
|
|
|
|
- }
|
|
|
|
- if ((vp = dlsym(handle, (char *) name)) == NULL)
|
|
|
|
- snprintf(error_message, sizeof(error_message),
|
|
|
|
- "dlsym (%s) failed", name);
|
|
|
|
- return vp;
|
|
|
|
-#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
-BSD44_derived_dlclose(void *handle)
|
|
|
|
+pg_dlclose(void *handle)
|
|
|
|
{
|
2008-04-05 18:39:26 +02:00
|
|
|
-#if defined(HAVE_DLOPEN)
|
2008-03-04 13:41:36 +01:00
|
|
|
- dlclose(handle);
|
|
|
|
-#endif
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+#endif /* ! HAVE_DLOPEN */
|