1996-07-09 08:22:35 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
2002-02-13 00:41:25 +01:00
|
|
|
* linux.h
|
|
|
|
* Port-specific prototypes for Linux
|
1996-07-09 08:22:35 +02:00
|
|
|
*
|
|
|
|
*
|
2002-06-20 22:29:54 +02:00
|
|
|
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
2000-01-26 06:58:53 +01:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
1996-07-09 08:22:35 +02:00
|
|
|
*
|
2002-06-20 22:29:54 +02:00
|
|
|
* $Id: linux.h,v 1.18 2002/06/20 20:29:33 momjian Exp $
|
1996-07-09 08:22:35 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#ifndef PORT_PROTOS_H
|
|
|
|
#define PORT_PROTOS_H
|
|
|
|
|
|
|
|
#include "utils/dynamic_loader.h"
|
2001-05-14 23:45:53 +02:00
|
|
|
#ifdef HAVE_DLOPEN
|
1999-07-16 01:04:24 +02:00
|
|
|
#include <dlfcn.h>
|
1996-07-09 08:22:35 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2001-05-14 23:45:53 +02:00
|
|
|
#ifndef HAVE_DLOPEN
|
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
#ifndef HAVE_DLD_H
|
|
|
|
#define pg_dlsym(handle, funcname) (NULL)
|
2001-10-25 03:29:37 +02:00
|
|
|
#define pg_dlclose(handle) {}
|
1996-07-09 08:22:35 +02:00
|
|
|
#else
|
2000-05-28 19:56:29 +02:00
|
|
|
#define pg_dlsym(handle, funcname) ((PGFunction) dld_get_func((funcname)))
|
2001-10-25 03:29:37 +02:00
|
|
|
#define pg_dlclose(handle) \
|
|
|
|
do { \
|
|
|
|
dld_unlink_by_file(handle, 1); \
|
|
|
|
free(handle); \
|
|
|
|
} while (0)
|
1997-09-07 07:04:48 +02:00
|
|
|
#endif
|
2001-05-14 23:45:53 +02:00
|
|
|
|
2001-10-25 07:50:21 +02:00
|
|
|
#else /* HAVE_DLOPEN */
|
2001-05-14 23:45:53 +02:00
|
|
|
|
2002-02-13 00:41:25 +01:00
|
|
|
/*
|
|
|
|
* In some older systems, the RTLD_NOW flag isn't defined and the mode
|
|
|
|
* argument to dlopen must always be 1. The RTLD_GLOBAL flag is wanted
|
|
|
|
* if available, but it doesn't exist everywhere.
|
|
|
|
* If it doesn't exist, set it to 0 so it has no effect.
|
|
|
|
*/
|
|
|
|
#ifndef RTLD_NOW
|
|
|
|
#define RTLD_NOW 1
|
|
|
|
#endif
|
|
|
|
#ifndef RTLD_GLOBAL
|
|
|
|
#define RTLD_GLOBAL 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define pg_dlopen(f) dlopen((f), RTLD_NOW | RTLD_GLOBAL)
|
1997-09-07 07:04:48 +02:00
|
|
|
#define pg_dlsym dlsym
|
|
|
|
#define pg_dlclose dlclose
|
|
|
|
#define pg_dlerror dlerror
|
2001-11-05 18:46:40 +01:00
|
|
|
#endif /* HAVE_DLOPEN */
|
2001-10-28 07:26:15 +01:00
|
|
|
|
2001-11-05 18:46:40 +01:00
|
|
|
#endif /* PORT_PROTOS_H */
|