Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 8107299

Browse files
committed
Don't forget to create the dynloader files...
1 parent 208cb8b commit 8107299

File tree

2 files changed

+152
-0
lines changed

2 files changed

+152
-0
lines changed

src/backend/port/dynloader/freebsd.c

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
/*-
2+
* Copyright (c) 1990 The Regents of the University of California.
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions
7+
* are met:
8+
* 1. Redistributions of source code must retain the above copyright
9+
* notice, this list of conditions and the following disclaimer.
10+
* 2. Redistributions in binary form must reproduce the above copyright
11+
* notice, this list of conditions and the following disclaimer in the
12+
* documentation and/or other materials provided with the distribution.
13+
* 3. All advertising materials mentioning features or use of this software
14+
* must display the following acknowledgement:
15+
* This product includes software developed by the University of
16+
* California, Berkeley and its contributors.
17+
* 4. Neither the name of the University nor the names of its contributors
18+
* may be used to endorse or promote products derived from this software
19+
* without specific prior written permission.
20+
*
21+
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24+
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31+
* SUCH DAMAGE.
32+
*/
33+
34+
#if defined(LIBC_SCCS) && !defined(lint)
35+
static char sccsid[] = "@(#)dl.c 5.4 (Berkeley) 2/23/91";
36+
37+
#endif /* LIBC_SCCS and not lint */
38+
39+
#include <sys/types.h>
40+
#include <nlist.h>
41+
#include <link.h>
42+
#include <dlfcn.h>
43+
44+
#include <stdio.h>
45+
#include <stdlib.h>
46+
47+
#include "dynloader.h"
48+
49+
static char error_message[BUFSIZ];
50+
51+
char *
52+
BSD44_derived_dlerror(void)
53+
{
54+
static char ret[BUFSIZ];
55+
56+
strcpy(ret, error_message);
57+
error_message[0] = 0;
58+
return (ret[0] == 0) ? (char *) NULL : ret;
59+
}
60+
61+
void *
62+
BSD44_derived_dlopen(const char *file, int num)
63+
{
64+
#if defined(__mips__) || (defined(__NetBSD__) && defined(vax))
65+
sprintf(error_message, "dlopen (%s) not supported", file);
66+
return NULL;
67+
#else
68+
void *vp;
69+
70+
if ((vp = dlopen((char *) file, num)) == (void *) NULL)
71+
sprintf(error_message, "dlopen (%s) failed", file);
72+
return vp;
73+
#endif
74+
}
75+
76+
void *
77+
BSD44_derived_dlsym(void *handle, const char *name)
78+
{
79+
#if defined(__mips__) || (defined(__NetBSD__) && defined(vax))
80+
sprintf(error_message, "dlsym (%s) failed", name);
81+
return NULL;
82+
#else
83+
void *vp;
84+
char buf[BUFSIZ];
85+
86+
if (*name != '_')
87+
{
88+
sprintf(buf, "_%s", name);
89+
name = buf;
90+
}
91+
if ((vp = dlsym(handle, (char *) name)) == (void *) NULL)
92+
sprintf(error_message, "dlsym (%s) failed", name);
93+
return vp;
94+
#endif
95+
}
96+
97+
void
98+
BSD44_derived_dlclose(void *handle)
99+
{
100+
#if defined(__mips__) || (defined(__NetBSD__) && defined(vax))
101+
#else
102+
dlclose(handle);
103+
#endif
104+
}

src/backend/port/dynloader/freebsd.h

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* port-protos.h--
4+
* port-specific prototypes for NetBSD 1.0
5+
*
6+
*
7+
* Copyright (c) 1994, Regents of the University of California
8+
*
9+
* $Id: freebsd.h,v 1.1 1998/10/27 04:41:29 scrappy Exp $
10+
*
11+
*-------------------------------------------------------------------------
12+
*/
13+
#ifndef PORT_PROTOS_H
14+
#define PORT_PROTOS_H
15+
16+
#include <sys/types.h>
17+
#include <nlist.h>
18+
#include <link.h>
19+
20+
#include "postgres.h"
21+
22+
#include "fmgr.h" /* for func_ptr */
23+
#include "utils/dynamic_loader.h"
24+
25+
/* dynloader.c */
26+
/*
27+
* Dynamic Loader on NetBSD 1.0.
28+
*
29+
* this dynamic loader uses the system dynamic loading interface for shared
30+
* libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared
31+
* library as the file to be dynamically loaded.
32+
*
33+
* agc - I know this is all a bit crufty, but it does work, is fairly
34+
* portable, and works (the stipulation that the d.l. function must
35+
* begin with an underscore is fairly tricky, and some versions of
36+
* NetBSD (like 1.0, and 1.0A pre June 1995) have no dlerror.)
37+
*/
38+
#define pg_dlopen(f) BSD44_derived_dlopen(f, 1)
39+
#define pg_dlsym BSD44_derived_dlsym
40+
#define pg_dlclose BSD44_derived_dlclose
41+
#define pg_dlerror BSD44_derived_dlerror
42+
43+
char *BSD44_derived_dlerror(void);
44+
void *BSD44_derived_dlopen(const char *filename, int num);
45+
void *BSD44_derived_dlsym(void *handle, const char *name);
46+
void BSD44_derived_dlclose(void *handle);
47+
48+
#endif /* PORT_PROTOS_H */

0 commit comments

Comments
 (0)