1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
$NetBSD: patch-ad,v 1.1.1.1 2008/03/04 12:41:37 adam Exp $
--- src/backend/port/dynloader/netbsd.c.orig 2007-03-26 23:44:11.000000000 +0200
+++ src/backend/port/dynloader/netbsd.c
@@ -42,65 +42,30 @@ static char sccsid[] = "@(#)dl.c 5.4 (Be
#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)
{
-#if defined(__mips__)
- 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)
{
-#if defined(__mips__)
- 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)
{
-#if defined(__mips__)
-#else
- dlclose(handle);
-#endif
}
+
+#endif /* ! HAVE_DLOPEN */
|