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