Use RTLD_NOW, not RTLD_LAZY, as binding mode for dlopen() on all platforms.

This restores the Linux behavior to what it was in PG 7.0 and 7.1, and
causes other platforms to agree.  (Other well-tested platforms like HPUX
were doing it this way already.)  Per pghackers discussion over the past
month or so.
This commit is contained in:
Tom Lane 2002-02-12 23:41:25 +00:00
parent baa0bb97b0
commit fa046b6a92
17 changed files with 266 additions and 79 deletions

View File

@ -39,8 +39,8 @@ table. If the path does not contain a '/' character, dlopen will search
for the module using the LIBPATH environment variable. It returns an for the module using the LIBPATH environment variable. It returns an
opaque handle to the module or NULL on error. The mode parameter can be opaque handle to the module or NULL on error. The mode parameter can be
either RTLD_LAZY (for lazy function binding) or RTLD_NOW for immediate either RTLD_LAZY (for lazy function binding) or RTLD_NOW for immediate
function binding. The AIX implementation currently does treat RTLD_NOW function binding. The AIX implementation currently behaves as RTLD_NOW
the same as RTLD_LAZY. The flag RTLD_GLOBAL might be or'ed into the even if RTLD_LAZY is specified. The flag RTLD_GLOBAL might be or'ed into the
mode parameter to allow loaded modules to bind to global variables or mode parameter to allow loaded modules to bind to global variables or
functions in other loaded modules loaded by dlopen(). If RTLD_GLOBAL is functions in other loaded modules loaded by dlopen(). If RTLD_GLOBAL is
not specified, only globals from the main part of the executable or not specified, only globals from the main part of the executable or

View File

@ -1,5 +1,5 @@
/* /*
* $Id: aix.h,v 1.10 2001/11/08 20:37:52 momjian Exp $ * $Id: aix.h,v 1.11 2002/02/12 23:39:46 tgl Exp $
* *
* @(#)dlfcn.h 1.4 revision of 95/04/25 09:36:52 * @(#)dlfcn.h 1.4 revision of 95/04/25 09:36:52
* This is an unpublished work copyright (c) 1992 HELIOS Software GmbH * This is an unpublished work copyright (c) 1992 HELIOS Software GmbH
@ -57,7 +57,7 @@ int dlclose();
#include "utils/dynamic_loader.h" #include "utils/dynamic_loader.h"
#define pg_dlopen(f) dlopen((f), RTLD_LAZY | RTLD_GLOBAL) #define pg_dlopen(f) dlopen((f), RTLD_NOW | RTLD_GLOBAL)
#define pg_dlsym dlsym #define pg_dlsym dlsym
#define pg_dlclose dlclose #define pg_dlclose dlclose
#define pg_dlerror dlerror #define pg_dlerror dlerror

View File

@ -1,12 +1,12 @@
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
* Dynamic loader interface for BSD/OS * bsdi.h
* * Dynamic loader interface for BSD/OS
* *
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* port_protos.h,v 1.2 1995/05/25 22:51:03 andrew Exp * $Id: bsdi.h,v 1.15 2002/02/12 23:39:57 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -19,7 +19,21 @@
#ifdef HAVE_DLOPEN #ifdef HAVE_DLOPEN
#include <dlfcn.h> #include <dlfcn.h>
#define pg_dlopen(f) dlopen((f), RTLD_LAZY | RTLD_GLOBAL)
/*
* 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)
#define pg_dlsym dlsym #define pg_dlsym dlsym
#define pg_dlclose dlclose #define pg_dlclose dlclose
#define pg_dlerror dlerror #define pg_dlerror dlerror
@ -32,6 +46,7 @@ do { \
dld_unlink_by_file(handle, 1); \ dld_unlink_by_file(handle, 1); \
free(handle); \ free(handle); \
} while (0) } while (0)
#endif /* not HAVE_DLOPEN */ #endif /* not HAVE_DLOPEN */
#endif /* PORT_PROTOS_H */ #endif /* PORT_PROTOS_H */

View File

@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: dgux.h,v 1.13 2001/11/05 17:46:27 momjian Exp $ * $Id: dgux.h,v 1.14 2002/02/12 23:40:03 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -21,9 +21,22 @@
* this dynamic loader uses the system dynamic loading interface for shared * this dynamic loader uses the system dynamic loading interface for shared
* libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared * libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared
* library as the file to be dynamically loaded. * library as the file to be dynamically loaded.
*
*/ */
#define pg_dlopen(f) dlopen((f), RTLD_LAZY | RTLD_GLOBAL)
/*
* 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)
#define pg_dlsym dlsym #define pg_dlsym dlsym
#define pg_dlclose dlclose #define pg_dlclose dlclose
#define pg_dlerror dlerror #define pg_dlerror dlerror

View File

@ -1,13 +1,12 @@
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
* port_protos.h * freebsd.h
* port-specific prototypes for NetBSD 1.0 * port-specific prototypes for FreeBSD
*
* *
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: freebsd.h,v 1.14 2002/02/11 21:38:11 petere Exp $ * $Id: freebsd.h,v 1.15 2002/02/12 23:40:12 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -21,7 +20,6 @@
#include "utils/dynamic_loader.h" #include "utils/dynamic_loader.h"
/* dynloader.c */
/* /*
* Dynamic Loader on NetBSD 1.0. * Dynamic Loader on NetBSD 1.0.
* *
@ -35,11 +33,20 @@
* NetBSD (like 1.0, and 1.0A pre June 1995) have no dlerror.) * NetBSD (like 1.0, and 1.0A pre June 1995) have no dlerror.)
*/ */
/*
* 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 #ifndef RTLD_GLOBAL
#define RTLD_GLOBAL 0 #define RTLD_GLOBAL 0
#endif #endif
#define pg_dlopen(f) BSD44_derived_dlopen((f), RTLD_LAZY | RTLD_GLOBAL) #define pg_dlopen(f) BSD44_derived_dlopen((f), RTLD_NOW | RTLD_GLOBAL)
#define pg_dlsym BSD44_derived_dlsym #define pg_dlsym BSD44_derived_dlsym
#define pg_dlclose BSD44_derived_dlclose #define pg_dlclose BSD44_derived_dlclose
#define pg_dlerror BSD44_derived_dlerror #define pg_dlerror BSD44_derived_dlerror

View File

@ -1,13 +1,13 @@
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
* port_protos.h * irix5.h
* port-specific prototypes for Irix 5 * port-specific prototypes for Irix 5
* *
* *
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* port_protos.h,v 1.2 1995/03/17 06:40:18 andrew Exp * $Id: irix5.h,v 1.12 2002/02/12 23:40:24 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -17,16 +17,28 @@
#include <dlfcn.h> #include <dlfcn.h>
#include "utils/dynamic_loader.h" #include "utils/dynamic_loader.h"
/* dynloader.c */
/* /*
* Dynamic Loader on SunOS 4. * Dynamic Loader on SunOS 4.
* *
* this dynamic loader uses the system dynamic loading interface for shared * this dynamic loader uses the system dynamic loading interface for shared
* libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared * libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared
* library as the file to be dynamically loaded. * library as the file to be dynamically loaded.
*
*/ */
#define pg_dlopen(f) dlopen((f), RTLD_LAZY | RTLD_GLOBAL)
/*
* 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)
#define pg_dlsym dlsym #define pg_dlsym dlsym
#define pg_dlclose dlclose #define pg_dlclose dlclose
#define pg_dlerror dlerror #define pg_dlerror dlerror

View File

@ -1,12 +1,13 @@
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
* Dynamic loader interface for Linux * linux.h
* Port-specific prototypes for Linux
* *
* *
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: linux.h,v 1.16 2001/11/05 17:46:27 momjian Exp $ * $Id: linux.h,v 1.17 2002/02/12 23:40:29 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -35,7 +36,20 @@ do { \
#else /* HAVE_DLOPEN */ #else /* HAVE_DLOPEN */
#define pg_dlopen(f) dlopen((f), RTLD_LAZY | RTLD_GLOBAL) /*
* 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)
#define pg_dlsym dlsym #define pg_dlsym dlsym
#define pg_dlclose dlclose #define pg_dlclose dlclose
#define pg_dlerror dlerror #define pg_dlerror dlerror

View File

@ -1,13 +1,13 @@
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
* port_protos.h * netbsd.h
* port-specific prototypes for NetBSD 1.0 * port-specific prototypes for NetBSD
* *
* *
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: netbsd.h,v 1.8 2001/11/05 17:46:27 momjian Exp $ * $Id: netbsd.h,v 1.9 2002/02/12 23:40:37 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -21,7 +21,6 @@
#include "utils/dynamic_loader.h" #include "utils/dynamic_loader.h"
/* dynloader.c */
/* /*
* Dynamic Loader on NetBSD 1.0. * Dynamic Loader on NetBSD 1.0.
* *
@ -34,7 +33,21 @@
* begin with an underscore is fairly tricky, and some versions of * begin with an underscore is fairly tricky, and some versions of
* NetBSD (like 1.0, and 1.0A pre June 1995) have no dlerror.) * NetBSD (like 1.0, and 1.0A pre June 1995) have no dlerror.)
*/ */
#define pg_dlopen(f) BSD44_derived_dlopen((f), RTLD_LAZY | RTLD_GLOBAL)
/*
* 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) BSD44_derived_dlopen((f), RTLD_NOW | RTLD_GLOBAL)
#define pg_dlsym BSD44_derived_dlsym #define pg_dlsym BSD44_derived_dlsym
#define pg_dlclose BSD44_derived_dlclose #define pg_dlclose BSD44_derived_dlclose
#define pg_dlerror BSD44_derived_dlerror #define pg_dlerror BSD44_derived_dlerror

View File

@ -1,11 +1,12 @@
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
* Dynamic loader for OpenBSD * openbsd.h
* port-specific prototypes for OpenBSD
* *
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: openbsd.h,v 1.9 2001/11/05 17:46:27 momjian Exp $ * $Id: openbsd.h,v 1.10 2002/02/12 23:40:40 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -19,7 +20,6 @@
#include "utils/dynamic_loader.h" #include "utils/dynamic_loader.h"
/* dynloader.c */
/* /*
* Dynamic Loader on NetBSD 1.0. * Dynamic Loader on NetBSD 1.0.
* *
@ -32,7 +32,21 @@
* begin with an underscore is fairly tricky, and some versions of * begin with an underscore is fairly tricky, and some versions of
* NetBSD (like 1.0, and 1.0A pre June 1995) have no dlerror.) * NetBSD (like 1.0, and 1.0A pre June 1995) have no dlerror.)
*/ */
#define pg_dlopen(f) BSD44_derived_dlopen((f), RTLD_LAZY)
/*
* 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) BSD44_derived_dlopen((f), RTLD_NOW | RTLD_GLOBAL)
#define pg_dlsym BSD44_derived_dlsym #define pg_dlsym BSD44_derived_dlsym
#define pg_dlclose BSD44_derived_dlclose #define pg_dlclose BSD44_derived_dlclose
#define pg_dlerror BSD44_derived_dlerror #define pg_dlerror BSD44_derived_dlerror

View File

@ -1,13 +1,13 @@
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
* alpha.h * osf.h
* prototypes for OSF/1-specific routines * prototypes for OSF/1-specific routines
* *
* *
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: osf.h,v 1.7 2001/11/15 16:08:15 petere Exp $ * $Id: osf.h,v 1.8 2002/02/12 23:40:43 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -18,23 +18,28 @@
#include <dlfcn.h> #include <dlfcn.h>
#include "utils/dynamic_loader.h" #include "utils/dynamic_loader.h"
/* dynloader.c */
/* /*
* Dynamic Loader on Alpha OSF/1.x * Dynamic Loader on Alpha OSF/1.x
* *
* this dynamic loader uses the system dynamic loading interface for shared * this dynamic loader uses the system dynamic loading interface for shared
* libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared * libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared
* library as the file to be dynamically loaded. * library as the file to be dynamically loaded.
*
*/ */
/* RTLD_GLOBAL is not available in <5.x */ /*
* 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 #ifndef RTLD_GLOBAL
#define RTLD_GLOBAL 0 #define RTLD_GLOBAL 0
#endif #endif
#define pg_dlopen(f) dlopen((f), RTLD_LAZY | RTLD_GLOBAL) #define pg_dlopen(f) dlopen((f), RTLD_NOW | RTLD_GLOBAL)
#define pg_dlsym(h, f) ((PGFunction) dlsym(h, f)) #define pg_dlsym(h, f) ((PGFunction) dlsym(h, f))
#define pg_dlclose(h) dlclose(h) #define pg_dlclose(h) dlclose(h)
#define pg_dlerror() dlerror() #define pg_dlerror() dlerror()

View File

@ -1,13 +1,13 @@
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
* port_protos.h * sco.h
* port-specific prototypes for SCO 3.2v5.2 * port-specific prototypes for SCO 3.2v5.2
* *
* *
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: sco.h,v 1.11 2001/11/05 17:46:27 momjian Exp $ * $Id: sco.h,v 1.12 2002/02/12 23:40:47 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -17,20 +17,30 @@
#include <dlfcn.h> #include <dlfcn.h>
#include "utils/dynamic_loader.h" #include "utils/dynamic_loader.h"
/* dynloader.c */
/* /*
* Dynamic Loader on SCO 3.2v5.0.2 * Dynamic Loader on SCO 3.2v5.0.2
* *
* this dynamic loader uses the system dynamic loading interface for shared * this dynamic loader uses the system dynamic loading interface for shared
* libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared * libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared
* library as the file to be dynamically loaded. * library as the file to be dynamically loaded.
*
*/ */
#define pg_dlopen(f) dlopen((f), RTLD_LAZY | RTLD_GLOBAL)
/*
* 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)
#define pg_dlsym dlsym #define pg_dlsym dlsym
#define pg_dlclose dlclose #define pg_dlclose dlclose
#define pg_dlerror dlerror #define pg_dlerror dlerror
/* port.c */
#endif /* PORT_PROTOS_H */ #endif /* PORT_PROTOS_H */

View File

@ -1,14 +1,38 @@
/* $Header: /cvsroot/pgsql/src/backend/port/dynloader/solaris.h,v 1.7 2001/11/05 17:46:27 momjian Exp $ */ /*-------------------------------------------------------------------------
*
#ifndef DYNLOADER_SOLARIS_H * solaris.h
#define DYNLOADER_SOLARIS_H * port-specific prototypes for Solaris
*
*
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: solaris.h,v 1.8 2002/02/12 23:40:53 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef PORT_PROTOS_H
#define PORT_PROTOS_H
#include <dlfcn.h> #include <dlfcn.h>
#include "utils/dynamic_loader.h" #include "utils/dynamic_loader.h"
#define pg_dlopen(f) dlopen((f), RTLD_LAZY | RTLD_GLOBAL) /*
* 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)
#define pg_dlsym dlsym #define pg_dlsym dlsym
#define pg_dlclose dlclose #define pg_dlclose dlclose
#define pg_dlerror dlerror #define pg_dlerror dlerror
#endif /* DYNLOADER_SOLARIS_H */ #endif /* PORT_PROTOS_H */

View File

@ -1,13 +1,13 @@
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
* port_protos.h * sunos4.h
* port-specific prototypes for SunOS 4 * port-specific prototypes for SunOS 4
* *
* *
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: sunos4.h,v 1.12 2001/12/05 02:03:59 ishii Exp $ * $Id: sunos4.h,v 1.13 2002/02/12 23:40:55 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -17,16 +17,28 @@
#include <dlfcn.h> #include <dlfcn.h>
#include "utils/dynamic_loader.h" #include "utils/dynamic_loader.h"
/* dynloader.c */
/* /*
* Dynamic Loader on SunOS 4. * Dynamic Loader on SunOS 4.
* *
* this dynamic loader uses the system dynamic loading interface for shared * this dynamic loader uses the system dynamic loading interface for shared
* libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared * libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared
* library as the file to be dynamically loaded. * library as the file to be dynamically loaded.
*
*/ */
#define pg_dlopen(f) dlopen((f),1)
/*
* 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)
#define pg_dlsym dlsym #define pg_dlsym dlsym
#define pg_dlclose dlclose #define pg_dlclose dlclose
#define pg_dlerror dlerror #define pg_dlerror dlerror

View File

@ -1,34 +1,46 @@
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
* dynloader.h * svr4.h
* port-specific prototypes for Intel x86/Intel SVR4 * port-specific prototypes for Intel x86/Intel SVR4
* *
* *
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: svr4.h,v 1.11 2001/11/05 17:46:27 momjian Exp $ * $Id: svr4.h,v 1.12 2002/02/12 23:41:01 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
#ifndef DYNLOADER_H #ifndef PORT_PROTOS_H
#define DYNLOADER_H #define PORT_PROTOS_H
#include <dlfcn.h> #include <dlfcn.h>
#include "utils/dynamic_loader.h" #include "utils/dynamic_loader.h"
/* dynloader.h */
/* /*
* Dynamic Loader on Intel x86/Intel SVR4. * Dynamic Loader on Intel x86/Intel SVR4.
* *
* this dynamic loader uses the system dynamic loading interface for shared * this dynamic loader uses the system dynamic loading interface for shared
* libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared * libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared
* library as the file to be dynamically loaded. * library as the file to be dynamically loaded.
*
*/ */
#define pg_dlopen(f) dlopen((f), RTLD_LAZY | RTLD_GLOBAL)
/*
* 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)
#define pg_dlsym dlsym #define pg_dlsym dlsym
#define pg_dlclose dlclose #define pg_dlclose dlclose
#define pg_dlerror dlerror #define pg_dlerror dlerror
#endif /* DYNLOADER_H */ #endif /* PORT_PROTOS_H */

View File

@ -17,16 +17,28 @@
#include <dlfcn.h> #include <dlfcn.h>
#include "utils/dynamic_loader.h" #include "utils/dynamic_loader.h"
/* dynloader.c */
/* /*
* Dynamic Loader on Intel x86/Intel SVR4. * Dynamic Loader on Intel x86/Intel SVR4.
* *
* this dynamic loader uses the system dynamic loading interface for shared * this dynamic loader uses the system dynamic loading interface for shared
* libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared * libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared
* library as the file to be dynamically loaded. * library as the file to be dynamically loaded.
* */
*/
#define pg_dlopen(f) dlopen((f), RTLD_LAZY | RTLD_GLOBAL) /*
* 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)
#define pg_dlsym dlsym #define pg_dlsym dlsym
#define pg_dlclose dlclose #define pg_dlclose dlclose
#define pg_dlerror dlerror #define pg_dlerror dlerror

View File

@ -17,16 +17,28 @@
#include <dlfcn.h> #include <dlfcn.h>
#include "utils/dynamic_loader.h" #include "utils/dynamic_loader.h"
/* dynloader.c */
/* /*
* Dynamic Loader on Intel x86/Intel SVR4. * Dynamic Loader on Intel x86/Intel SVR4.
* *
* this dynamic loader uses the system dynamic loading interface for shared * this dynamic loader uses the system dynamic loading interface for shared
* libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared * libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared
* library as the file to be dynamically loaded. * library as the file to be dynamically loaded.
* */
*/
#define pg_dlopen(f) dlopen((f), RTLD_LAZY | RTLD_GLOBAL) /*
* 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)
#define pg_dlsym dlsym #define pg_dlsym dlsym
#define pg_dlclose dlclose #define pg_dlclose dlclose
#define pg_dlerror dlerror #define pg_dlerror dlerror

View File

@ -17,16 +17,28 @@
#include <dlfcn.h> #include <dlfcn.h>
#include "utils/dynamic_loader.h" #include "utils/dynamic_loader.h"
/* dynloader.c */
/* /*
* Dynamic Loader on Intel x86/Windows NT * Dynamic Loader on Intel x86/Windows NT
* *
* this dynamic loader uses the system dynamic loading interface for shared * this dynamic loader uses the system dynamic loading interface for shared
* libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared * libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared
* library as the file to be dynamically loaded. * library as the file to be dynamically loaded.
* */
*/
#define pg_dlopen(f) dlopen((f), RTLD_LAZY | RTLD_GLOBAL) /*
* 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)
#define pg_dlsym dlsym #define pg_dlsym dlsym
#define pg_dlclose dlclose #define pg_dlclose dlclose
#define pg_dlerror dlerror #define pg_dlerror dlerror