Header And Logo

PostgreSQL
| The world's most advanced open source database.

Functions | Variables

netbsd.c File Reference

#include "postgres.h"
#include <nlist.h>
#include <link.h>
#include <dlfcn.h>
#include "dynloader.h"
Include dependency graph for netbsd.c:

Go to the source code of this file.

Functions

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

Variables

static char error_message [BUFSIZ]

Function Documentation

void BSD44_derived_dlclose ( void *  handle  ) 

Definition at line 101 of file netbsd.c.

References dlclose().

{
#if defined(HAVE_DLOPEN)
    dlclose(handle);
#endif
}

char* BSD44_derived_dlerror ( void   ) 

Definition at line 48 of file netbsd.c.

References error_message, and NULL.

{
    static char ret[BUFSIZ];

    strcpy(ret, error_message);
    error_message[0] = 0;
    return (ret[0] == 0) ? NULL : ret;
}

void* BSD44_derived_dlopen ( const char *  file,
int  num 
)

Definition at line 58 of file netbsd.c.

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

{
#if !defined(HAVE_DLOPEN)
    snprintf(error_message, sizeof(error_message),
             "dlopen (%s) not supported", file);
    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 
)

Definition at line 75 of file netbsd.c.

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

{
#if !defined(HAVE_DLOPEN)
    snprintf(error_message, sizeof(error_message),
             "dlsym (%s) failed", name);
    return NULL;
#else
    void       *vp;

#ifndef __ELF__
    char        buf[BUFSIZ];

    if (*name != '_')
    {
        snprintf(buf, sizeof(buf), "_%s", name);
        name = buf;
    }
#endif   /* !__ELF__ */
    if ((vp = dlsym(handle, (char *) name)) == NULL)
        snprintf(error_message, sizeof(error_message),
                 "dlsym (%s) failed", name);
    return vp;
#endif
}


Variable Documentation

char error_message[BUFSIZ] [static]

Definition at line 45 of file netbsd.c.

Referenced by BSD44_derived_dlerror(), BSD44_derived_dlopen(), and BSD44_derived_dlsym().