PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
openbsd.h File Reference
#include <sys/types.h>
#include <nlist.h>
#include <link.h>
#include <dlfcn.h>
#include "utils/dynamic_loader.h"
Include dependency graph for openbsd.h:

Go to the source code of this file.

Macros

#define RTLD_NOW   1
 
#define RTLD_GLOBAL   0
 
#define pg_dlopen(f)   BSD44_derived_dlopen((f), RTLD_NOW | RTLD_GLOBAL)
 
#define pg_dlsym   BSD44_derived_dlsym
 
#define pg_dlclose   BSD44_derived_dlclose
 
#define pg_dlerror   BSD44_derived_dlerror
 

Functions

char * BSD44_derived_dlerror (void)
 
void * BSD44_derived_dlopen (const char *filename, int num)
 
void * BSD44_derived_dlsym (void *handle, const char *name)
 
void BSD44_derived_dlclose (void *handle)
 

Macro Definition Documentation

#define pg_dlclose   BSD44_derived_dlclose

Definition at line 51 of file openbsd.h.

#define pg_dlerror   BSD44_derived_dlerror

Definition at line 52 of file openbsd.h.

#define pg_dlopen (   f)    BSD44_derived_dlopen((f), RTLD_NOW | RTLD_GLOBAL)

Definition at line 49 of file openbsd.h.

#define pg_dlsym   BSD44_derived_dlsym

Definition at line 50 of file openbsd.h.

#define RTLD_GLOBAL   0

Definition at line 46 of file openbsd.h.

#define RTLD_NOW   1

Definition at line 43 of file openbsd.h.

Function Documentation

void BSD44_derived_dlclose ( void *  handle)

Definition at line 101 of file freebsd.c.

References dlclose().

102 {
103 #if defined(HAVE_DLOPEN)
104  dlclose(handle);
105 #endif
106 }
int dlclose(void *handle)
Definition: win32.c:41
char* BSD44_derived_dlerror ( void  )

Definition at line 48 of file freebsd.c.

References error_message, and NULL.

49 {
50  static char ret[BUFSIZ];
51 
52  strcpy(ret, error_message);
53  error_message[0] = 0;
54  return (ret[0] == 0) ? NULL : ret;
55 }
static char error_message[BUFSIZ]
Definition: freebsd.c:45
#define NULL
Definition: c.h:226
void* BSD44_derived_dlopen ( const char *  filename,
int  num 
)

Definition at line 58 of file freebsd.c.

References dlerror(), dlopen(), error_message, NULL, and snprintf().

59 {
60 #if !defined(HAVE_DLOPEN)
62  "dlopen (%s) not supported", file);
63  return NULL;
64 #else
65  void *vp;
66 
67  if ((vp = dlopen((char *) file, num)) == NULL)
69  "dlopen (%s) failed: %s", file, dlerror());
70  return vp;
71 #endif
72 }
char * dlerror(void)
Definition: win32.c:32
static char error_message[BUFSIZ]
Definition: freebsd.c:45
int snprintf(char *str, size_t count, const char *fmt,...) pg_attribute_printf(3
#define NULL
Definition: c.h:226
void * dlopen(const char *path, int mode)
Definition: win32.c:68
void* BSD44_derived_dlsym ( void *  handle,
const char *  name 
)

Definition at line 75 of file freebsd.c.

References buf, dlsym(), error_message, NULL, and snprintf().

76 {
77 #if !defined(HAVE_DLOPEN)
79  "dlsym (%s) failed", name);
80  return NULL;
81 #else
82  void *vp;
83 
84 #ifndef __ELF__
85  char buf[BUFSIZ];
86 
87  if (*name != '_')
88  {
89  snprintf(buf, sizeof(buf), "_%s", name);
90  name = buf;
91  }
92 #endif /* !__ELF__ */
93  if ((vp = dlsym(handle, (char *) name)) == NULL)
95  "dlsym (%s) failed", name);
96  return vp;
97 #endif
98 }
static char error_message[BUFSIZ]
Definition: freebsd.c:45
int snprintf(char *str, size_t count, const char *fmt,...) pg_attribute_printf(3
void * dlsym(void *handle, const char *symbol)
Definition: win32.c:53
static char * buf
Definition: pg_test_fsync.c:65
#define NULL
Definition: c.h:226
const char * name
Definition: encode.c:521