00001 /*------------------------------------------------------------------------- 00002 * 00003 * netbsd.h 00004 * port-specific prototypes for NetBSD 00005 * 00006 * 00007 * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group 00008 * Portions Copyright (c) 1994, Regents of the University of California 00009 * 00010 * src/backend/port/dynloader/netbsd.h 00011 * 00012 *------------------------------------------------------------------------- 00013 */ 00014 #ifndef PORT_PROTOS_H 00015 #define PORT_PROTOS_H 00016 00017 #include <sys/types.h> 00018 #include <nlist.h> 00019 #include <link.h> 00020 #include <dlfcn.h> 00021 00022 #include "utils/dynamic_loader.h" /* pgrminclude ignore */ 00023 00024 /* 00025 * Dynamic Loader on NetBSD 1.0. 00026 * 00027 * this dynamic loader uses the system dynamic loading interface for shared 00028 * libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared 00029 * library as the file to be dynamically loaded. 00030 * 00031 * agc - I know this is all a bit crufty, but it does work, is fairly 00032 * portable, and works (the stipulation that the d.l. function must 00033 * begin with an underscore is fairly tricky, and some versions of 00034 * NetBSD (like 1.0, and 1.0A pre June 1995) have no dlerror.) 00035 */ 00036 00037 /* 00038 * In some older systems, the RTLD_NOW flag isn't defined and the mode 00039 * argument to dlopen must always be 1. The RTLD_GLOBAL flag is wanted 00040 * if available, but it doesn't exist everywhere. 00041 * If it doesn't exist, set it to 0 so it has no effect. 00042 */ 00043 #ifndef RTLD_NOW 00044 #define RTLD_NOW 1 00045 #endif 00046 #ifndef RTLD_GLOBAL 00047 #define RTLD_GLOBAL 0 00048 #endif 00049 00050 #define pg_dlopen(f) BSD44_derived_dlopen((f), RTLD_NOW | RTLD_GLOBAL) 00051 #define pg_dlsym BSD44_derived_dlsym 00052 #define pg_dlclose BSD44_derived_dlclose 00053 #define pg_dlerror BSD44_derived_dlerror 00054 00055 char *BSD44_derived_dlerror(void); 00056 void *BSD44_derived_dlopen(const char *filename, int num); 00057 void *BSD44_derived_dlsym(void *handle, const char *name); 00058 void BSD44_derived_dlclose(void *handle); 00059 00060 #endif /* PORT_PROTOS_H */