]> granicus.if.org Git - postgresql/blob - src/backend/port/dynloader/netbsd.h
Update copyrights for 2013
[postgresql] / src / backend / port / dynloader / netbsd.h
1 /*-------------------------------------------------------------------------
2  *
3  * netbsd.h
4  *        port-specific prototypes for NetBSD
5  *
6  *
7  * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * src/backend/port/dynloader/netbsd.h
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef PORT_PROTOS_H
15 #define PORT_PROTOS_H
16
17 #include <sys/types.h>
18 #include <nlist.h>
19 #include <link.h>
20 #include <dlfcn.h>
21
22 #include "utils/dynamic_loader.h"               /* pgrminclude ignore */
23
24 /*
25  * Dynamic Loader on NetBSD 1.0.
26  *
27  * this dynamic loader uses the system dynamic loading interface for shared
28  * libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared
29  * library as the file to be dynamically loaded.
30  *
31  * agc - I know this is all a bit crufty, but it does work, is fairly
32  * portable, and works (the stipulation that the d.l. function must
33  * begin with an underscore is fairly tricky, and some versions of
34  * NetBSD (like 1.0, and 1.0A pre June 1995) have no dlerror.)
35  */
36
37 /*
38  * In some older systems, the RTLD_NOW flag isn't defined and the mode
39  * argument to dlopen must always be 1.  The RTLD_GLOBAL flag is wanted
40  * if available, but it doesn't exist everywhere.
41  * If it doesn't exist, set it to 0 so it has no effect.
42  */
43 #ifndef RTLD_NOW
44 #define RTLD_NOW 1
45 #endif
46 #ifndef RTLD_GLOBAL
47 #define RTLD_GLOBAL 0
48 #endif
49
50 #define            pg_dlopen(f)    BSD44_derived_dlopen((f), RTLD_NOW | RTLD_GLOBAL)
51 #define            pg_dlsym                BSD44_derived_dlsym
52 #define            pg_dlclose      BSD44_derived_dlclose
53 #define            pg_dlerror      BSD44_derived_dlerror
54
55 char       *BSD44_derived_dlerror(void);
56 void       *BSD44_derived_dlopen(const char *filename, int num);
57 void       *BSD44_derived_dlsym(void *handle, const char *name);
58 void            BSD44_derived_dlclose(void *handle);
59
60 #endif   /* PORT_PROTOS_H */