Use RTLD_GLOBAL flag for dlopen-style dynamic loaders.

This commit is contained in:
Peter Eisentraut 2001-05-14 21:45:53 +00:00
parent 83966889ed
commit c87bc779d4
18 changed files with 44 additions and 49 deletions

View File

@ -1,5 +1,5 @@
/* /*
* $Id: aix.h,v 1.5 2001/03/22 03:59:42 momjian Exp $ * $Id: aix.h,v 1.6 2001/05/14 21:45:53 petere 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
@ -58,7 +58,7 @@ extern "C"
#include "utils/dynamic_loader.h" #include "utils/dynamic_loader.h"
#define pg_dlopen(f) dlopen(f, RTLD_LAZY) #define pg_dlopen(f) dlopen((f), RTLD_LAZY | 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

@ -15,7 +15,7 @@
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
#ifdef PRE_BSDI_2_1 #ifndef HAVE_DLOPEN
#include "postgres.h" #include "postgres.h"
extern char pg_pathname[]; extern char pg_pathname[];
@ -95,4 +95,4 @@ pg_dlerror()
return dld_strerror(dld_errno); return dld_strerror(dld_errno);
} }
#endif #endif /* not HAVE_DLOPEN */

View File

@ -1,7 +1,6 @@
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
* port_protos.h * Dynamic loader interface for BSD/OS
* port-specific prototypes for SunOS 4
* *
* *
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
@ -16,19 +15,20 @@
#include "utils/dynamic_loader.h" #include "utils/dynamic_loader.h"
/* dynloader.c */
#ifndef PRE_BSDI_2_1 #ifdef HAVE_DLOPEN
#include <dlfcn.h> #include <dlfcn.h>
#define pg_dlopen(f) dlopen(f, RTLD_LAZY) #define pg_dlopen(f) dlopen((f), RTLD_LAZY | 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
#else
#else /* not HAVE_DLOPEN */
#define pg_dlsym(handle, funcname) ((PGFunction) dld_get_func((funcname))) #define pg_dlsym(handle, funcname) ((PGFunction) dld_get_func((funcname)))
#define pg_dlclose(handle) ({ dld_unlink_by_file(handle, 1); free(handle); }) #define pg_dlclose(handle) ({ dld_unlink_by_file(handle, 1); free(handle); })
#endif
/* port.c */ #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.9 2001/02/10 02:31:26 tgl Exp $ * $Id: dgux.h,v 1.10 2001/05/14 21:45:53 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -23,7 +23,7 @@
* library as the file to be dynamically loaded. * library as the file to be dynamically loaded.
* *
*/ */
#define pg_dlopen(f) dlopen(f,1) #define pg_dlopen(f) dlopen((f), RTLD_LAZY | 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

@ -7,7 +7,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: freebsd.h,v 1.8 2001/02/10 02:31:26 tgl Exp $ * $Id: freebsd.h,v 1.9 2001/05/14 21:45:53 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -33,7 +33,7 @@
* 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, 1) #define pg_dlopen(f) BSD44_derived_dlopen((f), RTLD_LAZY | 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

@ -26,7 +26,7 @@
* library as the file to be dynamically loaded. * library as the file to be dynamically loaded.
* *
*/ */
#define pg_dlopen(f) dlopen(f,1) #define pg_dlopen(f) dlopen((f), RTLD_LAZY | 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 * Dynamic loader interface for Linux
* 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.11 2001/02/10 02:31:26 tgl Exp $ * $Id: linux.h,v 1.12 2001/05/14 21:45:53 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -15,13 +14,13 @@
#define PORT_PROTOS_H #define PORT_PROTOS_H
#include "utils/dynamic_loader.h" #include "utils/dynamic_loader.h"
#ifdef __ELF__ #ifdef HAVE_DLOPEN
#include <dlfcn.h> #include <dlfcn.h>
#endif #endif
/* dynloader.c */
#ifndef __ELF__ #ifndef HAVE_DLOPEN
#ifndef HAVE_DLD_H #ifndef HAVE_DLD_H
#define pg_dlsym(handle, funcname) (NULL) #define pg_dlsym(handle, funcname) (NULL)
#define pg_dlclose(handle) ({}) #define pg_dlclose(handle) ({})
@ -29,14 +28,14 @@
#define pg_dlsym(handle, funcname) ((PGFunction) dld_get_func((funcname))) #define pg_dlsym(handle, funcname) ((PGFunction) dld_get_func((funcname)))
#define pg_dlclose(handle) ({ dld_unlink_by_file(handle, 1); free(handle); }) #define pg_dlclose(handle) ({ dld_unlink_by_file(handle, 1); free(handle); })
#endif #endif
#else
/* #define pg_dlopen(f) dlopen(f, 1) */ #else /* HAVE_DLOPEN */
#define pg_dlopen(f) dlopen(f, 2)
#define pg_dlopen(f) dlopen((f), RTLD_LAZY | 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
/* port.c */ #endif /* HAVE_DLOPEN */
#endif /* PORT_PROTOS_H */ #endif /* PORT_PROTOS_H */

View File

@ -7,7 +7,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: netbsd.h,v 1.3 2001/02/10 02:31:26 tgl Exp $ * $Id: netbsd.h,v 1.4 2001/05/14 21:45:53 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -33,7 +33,7 @@
* 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, 1) #define pg_dlopen(f) BSD44_derived_dlopen((f), RTLD_LAZY | 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

@ -7,7 +7,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: openbsd.h,v 1.3 2001/02/10 02:31:26 tgl Exp $ * $Id: openbsd.h,v 1.4 2001/05/14 21:45:53 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -33,7 +33,7 @@
* 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, 1) #define pg_dlopen(f) BSD44_derived_dlopen((f), RTLD_LAZY | 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

@ -7,7 +7,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: osf.h,v 1.2 2001/01/24 19:43:04 momjian Exp $ * $Id: osf.h,v 1.3 2001/05/14 21:45:53 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -28,7 +28,7 @@
* library as the file to be dynamically loaded. * library as the file to be dynamically loaded.
* *
*/ */
#define pg_dlopen(f) dlopen(f, RTLD_LAZY) #define pg_dlopen(f) dlopen((f), RTLD_LAZY | 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

@ -7,7 +7,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: sco.h,v 1.7 2001/02/10 02:31:26 tgl Exp $ * $Id: sco.h,v 1.8 2001/05/14 21:45:53 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -26,7 +26,7 @@
* library as the file to be dynamically loaded. * library as the file to be dynamically loaded.
* *
*/ */
#define pg_dlopen(f) dlopen(f,1) #define pg_dlopen(f) dlopen((f), RTLD_LAZY | 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,4 +1,4 @@
/* $Header: /cvsroot/pgsql/src/backend/port/dynloader/solaris.h,v 1.3 2001/03/22 03:59:43 momjian Exp $ */ /* $Header: /cvsroot/pgsql/src/backend/port/dynloader/solaris.h,v 1.4 2001/05/14 21:45:53 petere Exp $ */
#ifndef DYNLOADER_SOLARIS_H #ifndef DYNLOADER_SOLARIS_H
#define DYNLOADER_SOLARIS_H #define DYNLOADER_SOLARIS_H
@ -6,7 +6,7 @@
#include <dlfcn.h> #include <dlfcn.h>
#include "utils/dynamic_loader.h" #include "utils/dynamic_loader.h"
#define pg_dlopen(f) dlopen(f,1) #define pg_dlopen(f) dlopen((f), RTLD_LAZY | 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

@ -7,7 +7,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: sunos4.h,v 1.7 2001/02/10 02:31:26 tgl Exp $ * $Id: sunos4.h,v 1.8 2001/05/14 21:45:53 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -26,7 +26,7 @@
* library as the file to be dynamically loaded. * library as the file to be dynamically loaded.
* *
*/ */
#define pg_dlopen(f) dlopen(f, 1) #define pg_dlopen(f) dlopen((f), RTLD_LAZY | 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

@ -7,7 +7,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: svr4.h,v 1.7 2001/02/10 02:31:26 tgl Exp $ * $Id: svr4.h,v 1.8 2001/05/14 21:45:53 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -26,7 +26,7 @@
* library as the file to be dynamically loaded. * library as the file to be dynamically loaded.
* *
*/ */
#define pg_dlopen(f) dlopen(f,RTLD_LAZY) #define pg_dlopen(f) dlopen((f), RTLD_LAZY | 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

@ -26,7 +26,7 @@
* library as the file to be dynamically loaded. * library as the file to be dynamically loaded.
* *
*/ */
#define pg_dlopen(f) dlopen(f,RTLD_LAZY) #define pg_dlopen(f) dlopen((f), RTLD_LAZY | 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

@ -26,7 +26,7 @@
* library as the file to be dynamically loaded. * library as the file to be dynamically loaded.
* *
*/ */
#define pg_dlopen(f) dlopen(f,RTLD_LAZY) #define pg_dlopen(f) dlopen((f), RTLD_LAZY | 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

@ -26,7 +26,7 @@
* library as the file to be dynamically loaded. * library as the file to be dynamically loaded.
* *
*/ */
#define pg_dlopen(f) dlopen(f,1) #define pg_dlopen(f) dlopen((f), RTLD_LAZY | 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

@ -4,10 +4,6 @@ case $host_cpu in
i?86) CFLAGS="$CFLAGS -m486";; i?86) CFLAGS="$CFLAGS -m486";;
esac esac
case $host_os in
bsdi2.0) CFLAGS="$CFLAGS -DPRE_BSDI_2_1";;
esac
case $host_os in case $host_os in
bsdi2.0 | bsdi2.1 | bsdi3*) bsdi2.0 | bsdi2.1 | bsdi3*)
CC=gcc2 CC=gcc2