mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-30 19:00:29 +08:00
Fix Linux dynloader code for pre-HAVE_DLOPEN systems, which evidently
are still in use out there. Per report from Brendan LeFebvre.
This commit is contained in:
parent
951ec872c7
commit
3a2ef59116
@ -1,6 +1,6 @@
|
|||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
* dynloader.c
|
* linux.c
|
||||||
* Dynamic Loader for Postgres for Linux, generated from those for
|
* Dynamic Loader for Postgres for Linux, generated from those for
|
||||||
* Ultrix.
|
* Ultrix.
|
||||||
*
|
*
|
||||||
@ -11,18 +11,22 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/port/dynloader/linux.c,v 1.22 2002/06/20 20:29:33 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/port/dynloader/linux.c,v 1.23 2002/10/15 16:04:17 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "postgres.h"
|
#include "postgres.h"
|
||||||
|
|
||||||
#ifdef HAVE_DLD_H
|
#ifdef HAVE_DLD_H
|
||||||
#include "dld.h"
|
#include <dld.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NOT_USED
|
#include "dynloader.h"
|
||||||
extern char pg_pathname[];
|
#include "miscadmin.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef HAVE_DLOPEN
|
||||||
|
|
||||||
void *
|
void *
|
||||||
pg_dlopen(char *filename)
|
pg_dlopen(char *filename)
|
||||||
@ -98,8 +102,28 @@ pg_dlopen(char *filename)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PGFunction
|
||||||
|
pg_dlsym(void *handle, char *funcname)
|
||||||
|
{
|
||||||
|
#ifndef HAVE_DLD_H
|
||||||
|
return NULL;
|
||||||
|
#else
|
||||||
|
return (PGFunction) dld_get_func((funcname));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
pg_dlclose(void *handle)
|
||||||
|
{
|
||||||
|
#ifndef HAVE_DLD_H
|
||||||
|
#else
|
||||||
|
dld_unlink_by_file(handle, 1);
|
||||||
|
free(handle);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
pg_dlerror()
|
pg_dlerror(void)
|
||||||
{
|
{
|
||||||
#ifndef HAVE_DLD_H
|
#ifndef HAVE_DLD_H
|
||||||
return "dynaloader unspported";
|
return "dynaloader unspported";
|
||||||
@ -108,4 +132,4 @@ pg_dlerror()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif /* !HAVE_DLOPEN */
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2002, 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.18 2002/06/20 20:29:33 momjian Exp $
|
* $Id: linux.h,v 1.19 2002/10/15 16:04:17 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -20,21 +20,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef HAVE_DLOPEN
|
#ifdef HAVE_DLOPEN
|
||||||
|
|
||||||
#ifndef HAVE_DLD_H
|
|
||||||
#define pg_dlsym(handle, funcname) (NULL)
|
|
||||||
#define pg_dlclose(handle) {}
|
|
||||||
#else
|
|
||||||
#define pg_dlsym(handle, funcname) ((PGFunction) dld_get_func((funcname)))
|
|
||||||
#define pg_dlclose(handle) \
|
|
||||||
do { \
|
|
||||||
dld_unlink_by_file(handle, 1); \
|
|
||||||
free(handle); \
|
|
||||||
} while (0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else /* HAVE_DLOPEN */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* In some older systems, the RTLD_NOW flag isn't defined and the mode
|
* In some older systems, the RTLD_NOW flag isn't defined and the mode
|
||||||
@ -53,6 +39,7 @@ do { \
|
|||||||
#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 /* HAVE_DLOPEN */
|
#endif /* HAVE_DLOPEN */
|
||||||
|
|
||||||
#endif /* PORT_PROTOS_H */
|
#endif /* PORT_PROTOS_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user