diff options
author | jdolecek <jdolecek@pkgsrc.org> | 2004-10-10 16:44:39 +0000 |
---|---|---|
committer | jdolecek <jdolecek@pkgsrc.org> | 2004-10-10 16:44:39 +0000 |
commit | e07638733ebcc8f439d0fbc27600cb537fe13a4e (patch) | |
tree | fc8e97ffbb98803811eec6f4fd60f7171018d8a0 /databases | |
parent | 8a38b14515176cbc5cf4ebaacd80421ab82cc2eb (diff) | |
download | pkgsrc-e07638733ebcc8f439d0fbc27600cb537fe13a4e.tar.gz |
Update the NetBSD dynloader wrapper code to use straigh dl*() calls on all
archs. This fixes support for dynamic loading on mips, and adresses
PR pkg/25473 by Byron Servies.
Diffstat (limited to 'databases')
-rw-r--r-- | databases/postgresql74/Makefile.common | 7 | ||||
-rw-r--r-- | databases/postgresql74/files/netbsd.c | 73 | ||||
-rw-r--r-- | databases/postgresql74/files/netbsd.h | 45 |
3 files changed, 124 insertions, 1 deletions
diff --git a/databases/postgresql74/Makefile.common b/databases/postgresql74/Makefile.common index e0d8af7a5b7..724d06e3659 100644 --- a/databases/postgresql74/Makefile.common +++ b/databases/postgresql74/Makefile.common @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.common,v 1.12 2004/10/10 07:30:22 jdolecek Exp $ +# $NetBSD: Makefile.common,v 1.13 2004/10/10 16:44:39 jdolecek Exp $ # # This Makefile fragment is included by all PostgreSQL packages built from # the main sources of the PostgreSQL distribution except jdbc-postgresql. @@ -103,6 +103,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 .include "../../devel/gettext-lib/buildlink3.mk" .include "../../devel/zlib/buildlink3.mk" diff --git a/databases/postgresql74/files/netbsd.c b/databases/postgresql74/files/netbsd.c new file mode 100644 index 00000000000..d2ef8e70699 --- /dev/null +++ b/databases/postgresql74/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 <nlist.h> +#include <link.h> +#include <dlfcn.h> + +#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/postgresql74/files/netbsd.h b/databases/postgresql74/files/netbsd.h new file mode 100644 index 00000000000..9747903b5bb --- /dev/null +++ b/databases/postgresql74/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 16:44:39 jdolecek Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef PORT_PROTOS_H +#define PORT_PROTOS_H + +#include <sys/types.h> +#include <nlist.h> +#include <link.h> +#include <dlfcn.h> + +#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 */ |