Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3a2ef59

Browse files
committed
Fix Linux dynloader code for pre-HAVE_DLOPEN systems, which evidently
are still in use out there. Per report from Brendan LeFebvre.
1 parent951ec87 commit3a2ef59

File tree

2 files changed

+34
-23
lines changed

2 files changed

+34
-23
lines changed

‎src/backend/port/dynloader/linux.c

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*-------------------------------------------------------------------------
22
*
3-
*dynloader.c
3+
*linux.c
44
* Dynamic Loader for Postgres for Linux, generated from those for
55
* Ultrix.
66
*
@@ -11,18 +11,22 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $Header: /cvsroot/pgsql/src/backend/port/dynloader/linux.c,v 1.22 2002/06/20 20:29:33 momjian Exp $
14+
* $Header: /cvsroot/pgsql/src/backend/port/dynloader/linux.c,v 1.23 2002/10/15 16:04:17 tgl Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
1818

1919
#include"postgres.h"
20+
2021
#ifdefHAVE_DLD_H
21-
#include"dld.h"
22+
#include<dld.h>
2223
#endif
2324

24-
#ifdefNOT_USED
25-
externcharpg_pathname[];
25+
#include"dynloader.h"
26+
#include"miscadmin.h"
27+
28+
29+
#ifndefHAVE_DLOPEN
2630

2731
void*
2832
pg_dlopen(char*filename)
@@ -98,8 +102,28 @@ pg_dlopen(char *filename)
98102
#endif
99103
}
100104

105+
PGFunction
106+
pg_dlsym(void*handle,char*funcname)
107+
{
108+
#ifndefHAVE_DLD_H
109+
returnNULL;
110+
#else
111+
return (PGFunction)dld_get_func((funcname));
112+
#endif
113+
}
114+
115+
void
116+
pg_dlclose(void*handle)
117+
{
118+
#ifndefHAVE_DLD_H
119+
#else
120+
dld_unlink_by_file(handle,1);
121+
free(handle);
122+
#endif
123+
}
124+
101125
char*
102-
pg_dlerror()
126+
pg_dlerror(void)
103127
{
104128
#ifndefHAVE_DLD_H
105129
return"dynaloader unspported";
@@ -108,4 +132,4 @@ pg_dlerror()
108132
#endif
109133
}
110134

111-
#endif
135+
#endif/* !HAVE_DLOPEN */

‎src/backend/port/dynloader/linux.h

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: linux.h,v 1.18 2002/06/20 20:29:33 momjian Exp $
10+
* $Id: linux.h,v 1.19 2002/10/15 16:04:17 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -20,21 +20,7 @@
2020
#endif
2121

2222

23-
#ifndefHAVE_DLOPEN
24-
25-
#ifndefHAVE_DLD_H
26-
#definepg_dlsym(handle,funcname)(NULL)
27-
#definepg_dlclose(handle) {}
28-
#else
29-
#definepg_dlsym(handle,funcname)((PGFunction) dld_get_func((funcname)))
30-
#definepg_dlclose(handle) \
31-
do { \
32-
dld_unlink_by_file(handle, 1); \
33-
free(handle); \
34-
} while (0)
35-
#endif
36-
37-
#else/* HAVE_DLOPEN */
23+
#ifdefHAVE_DLOPEN
3824

3925
/*
4026
* In some older systems, the RTLD_NOW flag isn't defined and the mode
@@ -53,6 +39,7 @@ do { \
5339
#definepg_dlsymdlsym
5440
#definepg_dlclosedlclose
5541
#definepg_dlerrordlerror
42+
5643
#endif/* HAVE_DLOPEN */
5744

5845
#endif/* PORT_PROTOS_H */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp