From f992cc10dd0faed703d076602b2412156aed7c37 Mon Sep 17 00:00:00 2001 From: jdolecek Date: Sun, 10 Oct 2004 17:27:43 +0000 Subject: Update the NetBSD dynloader wrapper code to use straigh dl*() calls on all archs. This fixes support for dynamic loading on mips and also improves error reporting. Fixes PR pkg/25473 by Byron Servies. PKGREVISION not bumped, will ride update to 7.3.7 --- databases/postgresql73/Makefile.common | 7 +++- databases/postgresql73/files/netbsd.c | 73 ++++++++++++++++++++++++++++++++++ databases/postgresql73/files/netbsd.h | 45 +++++++++++++++++++++ 3 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 databases/postgresql73/files/netbsd.c create mode 100644 databases/postgresql73/files/netbsd.h (limited to 'databases/postgresql73') diff --git a/databases/postgresql73/Makefile.common b/databases/postgresql73/Makefile.common index 0cb9d705e3a..d09fc2048fa 100644 --- a/databases/postgresql73/Makefile.common +++ b/databases/postgresql73/Makefile.common @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.common,v 1.2 2004/08/21 17:27:04 seb Exp $ +# $NetBSD: Makefile.common,v 1.3 2004/10/10 17:27:43 jdolecek Exp $ # # This Makefile fragment is included by all PostgreSQL packages built from # the main sources of the PostgreSQL distribution except jdbc-postgresql. @@ -83,6 +83,11 @@ post-extract: ${CP} -f ${COMMON_FILESDIR}/GNUmakefile.libpgtcl \ ${WRKSRC}/src/interfaces/libpgtcl/GNUmakefile; \ fi + if [ -d ${WRKSRC}/src/backend/port/dynloader ]; then \ + ${RM} -f ${WRKSRC}/src/backend/port/dynloader/netbsd.[ch];\ + ${CP} -f ${COMMON_FILESDIR}/netbsd.[ch] \ + ${WRKSRC}/src/backend/port/dynloader/; \ + fi pre-configure: cd ${WRKSRC} && ${AUTOCONF} diff --git a/databases/postgresql73/files/netbsd.c b/databases/postgresql73/files/netbsd.c new file mode 100644 index 00000000000..d2ef8e70699 --- /dev/null +++ b/databases/postgresql73/files/netbsd.c @@ -0,0 +1,73 @@ +/*- + * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group + * Portions Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)dl.c 5.4 (Berkeley) 2/23/91"; +#endif /* LIBC_SCCS and not lint */ + +#include "postgres.h" + +#include +#include +#include + +#include "dynloader.h" + +#ifndef HAVE_DLOPEN + +char * +pg_dlerror(void) +{ + return "dynaloader unsupported"; +} + +void * +pg_dlopen(const char *file, int num) +{ + elog(ERROR, "dynamic load not supported"); + return NULL; +} + +void * +pg_dlsym(void *handle, const char *name) +{ + return NULL; +} + +void +pg_dlclose(void *handle) +{ +} + +#endif /* ! HAVE_DLOPEN */ diff --git a/databases/postgresql73/files/netbsd.h b/databases/postgresql73/files/netbsd.h new file mode 100644 index 00000000000..b6530cc4461 --- /dev/null +++ b/databases/postgresql73/files/netbsd.h @@ -0,0 +1,45 @@ +/*------------------------------------------------------------------------- + * + * netbsd.h + * port-specific prototypes for NetBSD + * + * + * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * $Id: netbsd.h,v 1.1 2004/10/10 17:27:43 jdolecek Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef PORT_PROTOS_H +#define PORT_PROTOS_H + +#include +#include +#include +#include + +#include "utils/dynamic_loader.h" + +#ifdef HAVE_DLOPEN +/* + * 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_dlclose dlclose +#define pg_dlerror dlerror + +#endif /* HAVE_DLOPEN */ + +#endif /* PORT_PROTOS_H */ -- cgit v1.2.3