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

Commitca1e855

Browse files
committed
Remove configure probe for dlopen, and refactor.
dlopen() is in SUSv2 and all targeted Unix systems have it. We stillneed replacement functions for Windows, but we don't need a configureprobe for that.Since it's no longer needed by other operating systems, rename dlopen.cto win32dlopen.c and move the declarations into win32_port.h.Likewise, the macros RTLD_NOW and RTLD_GLOBAL now only need to bedefined on Windows, since all targeted Unix systems have 'em.Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>Reviewed-by: Andres Freund <andres@anarazel.de>Discussion:https://postgr.es/m/CA+hUKGJ3LHeP9w5Fgzdr4G8AnEtJ=z=p6hGDEm4qYGEUX5B6fQ@mail.gmail.com
1 parent87e22f6 commitca1e855

File tree

9 files changed

+23
-87
lines changed

9 files changed

+23
-87
lines changed

‎configure

Lines changed: 6 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -16618,30 +16618,6 @@ cat >>confdefs.h <<_ACEOF
1661816618
_ACEOF
1661916619

1662016620

16621-
ac_fn_c_check_decl "$LINENO" "RTLD_GLOBAL" "ac_cv_have_decl_RTLD_GLOBAL" "#include <dlfcn.h>
16622-
"
16623-
if test "x$ac_cv_have_decl_RTLD_GLOBAL" = xyes; then :
16624-
ac_have_decl=1
16625-
else
16626-
ac_have_decl=0
16627-
fi
16628-
16629-
cat >>confdefs.h <<_ACEOF
16630-
#define HAVE_DECL_RTLD_GLOBAL $ac_have_decl
16631-
_ACEOF
16632-
ac_fn_c_check_decl "$LINENO" "RTLD_NOW" "ac_cv_have_decl_RTLD_NOW" "#include <dlfcn.h>
16633-
"
16634-
if test "x$ac_cv_have_decl_RTLD_NOW" = xyes; then :
16635-
ac_have_decl=1
16636-
else
16637-
ac_have_decl=0
16638-
fi
16639-
16640-
cat >>confdefs.h <<_ACEOF
16641-
#define HAVE_DECL_RTLD_NOW $ac_have_decl
16642-
_ACEOF
16643-
16644-
1664516621
ac_fn_c_check_type "$LINENO" "struct sockaddr_in6" "ac_cv_type_struct_sockaddr_in6" "$ac_includes_default
1664616622
#include <netinet/in.h>
1664716623
"
@@ -16687,19 +16663,6 @@ $as_echo "#define HAVE_PS_STRINGS 1" >>confdefs.h
1668716663

1668816664
fi
1668916665

16690-
ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
16691-
if test "x$ac_cv_func_dlopen" = xyes; then :
16692-
$as_echo "#define HAVE_DLOPEN 1" >>confdefs.h
16693-
16694-
else
16695-
case " $LIBOBJS " in
16696-
*" dlopen.$ac_objext "* ) ;;
16697-
*) LIBOBJS="$LIBOBJS dlopen.$ac_objext"
16698-
;;
16699-
esac
16700-
16701-
fi
16702-
1670316666
ac_fn_c_check_func "$LINENO" "explicit_bzero" "ac_cv_func_explicit_bzero"
1670416667
if test "x$ac_cv_func_explicit_bzero" = xyes; then :
1670516668
$as_echo "#define HAVE_EXPLICIT_BZERO 1" >>confdefs.h
@@ -17078,6 +17041,12 @@ esac
1707817041
;;
1707917042
esac
1708017043

17044+
case " $LIBOBJS " in
17045+
*" win32dlopen.$ac_objext "* ) ;;
17046+
*) LIBOBJS="$LIBOBJS win32dlopen.$ac_objext"
17047+
;;
17048+
esac
17049+
1708117050
case " $LIBOBJS " in
1708217051
*" win32env.$ac_objext "* ) ;;
1708317052
*) LIBOBJS="$LIBOBJS win32env.$ac_objext"

‎configure.ac

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1858,8 +1858,6 @@ AC_CHECK_DECLS([pwritev], [], [AC_LIBOBJ(pwritev)], [#include <sys/uio.h>])
18581858
# This is probably only present on macOS, but may as well check always
18591859
AC_CHECK_DECLS(F_FULLFSYNC,[],[],[#include <fcntl.h>])
18601860

1861-
AC_CHECK_DECLS([RTLD_GLOBAL, RTLD_NOW],[],[],[#include <dlfcn.h>])
1862-
18631861
AC_CHECK_TYPE([struct sockaddr_in6],
18641862
[AC_DEFINE(HAVE_IPV6,1,[Define to 1 if you have support for IPv6.])],
18651863
[],
@@ -1880,7 +1878,6 @@ if test "$pgac_cv_var_PS_STRINGS" = yes ; then
18801878
fi
18811879

18821880
AC_REPLACE_FUNCS(m4_normalize([
1883-
dlopen
18841881
explicit_bzero
18851882
getopt
18861883
getpeereid
@@ -1962,6 +1959,7 @@ if test "$PORTNAME" = "win32"; then
19621959
AC_LIBOBJ(kill)
19631960
AC_LIBOBJ(open)
19641961
AC_LIBOBJ(system)
1962+
AC_LIBOBJ(win32dlopen)
19651963
AC_LIBOBJ(win32env)
19661964
AC_LIBOBJ(win32error)
19671965
AC_LIBOBJ(win32ntdll)

‎src/backend/utils/fmgr/dfmgr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
#include<sys/stat.h>
1818

19-
#ifdefHAVE_DLOPEN
19+
#ifndefWIN32
2020
#include<dlfcn.h>
2121

2222
/*
@@ -28,7 +28,7 @@
2828
#undef bool
2929
#endif
3030
#endif
31-
#endif/*HAVE_DLOPEN */
31+
#endif/*!WIN32 */
3232

3333
#include"fmgr.h"
3434
#include"lib/stringinfo.h"

‎src/include/pg_config.h.in

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,6 @@
141141
don't. */
142142
#undef HAVE_DECL_PWRITEV
143143

144-
/* Define to 1 if you have the declaration of `RTLD_GLOBAL', and to 0 if you
145-
don't. */
146-
#undef HAVE_DECL_RTLD_GLOBAL
147-
148-
/* Define to 1 if you have the declaration of `RTLD_NOW', and to 0 if you
149-
don't. */
150-
#undef HAVE_DECL_RTLD_NOW
151-
152144
/* Define to 1 if you have the declaration of `strlcat', and to 0 if you
153145
don't. */
154146
#undef HAVE_DECL_STRLCAT
@@ -169,9 +161,6 @@
169161
don't. */
170162
#undef HAVE_DECL_STRTOULL
171163

172-
/* Define to 1 if you have the `dlopen' function. */
173-
#undef HAVE_DLOPEN
174-
175164
/* Define to 1 if you have the <editline/history.h> header file. */
176165
#undef HAVE_EDITLINE_HISTORY_H
177166

‎src/include/port.h

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -455,29 +455,6 @@ extern intsetenv(const char *name, const char *value, int overwrite);
455455
externintunsetenv(constchar*name);
456456
#endif
457457

458-
#ifndefHAVE_DLOPEN
459-
externvoid*dlopen(constchar*file,intmode);
460-
externvoid*dlsym(void*handle,constchar*symbol);
461-
externintdlclose(void*handle);
462-
externchar*dlerror(void);
463-
#endif
464-
465-
/*
466-
* In some older systems, the RTLD_NOW flag isn't defined and the mode
467-
* argument to dlopen must always be 1.
468-
*/
469-
#if !HAVE_DECL_RTLD_NOW
470-
#defineRTLD_NOW 1
471-
#endif
472-
473-
/*
474-
* The RTLD_GLOBAL flag is wanted if available, but it doesn't exist
475-
* everywhere. If it doesn't exist, set it to 0 so it has no effect.
476-
*/
477-
#if !HAVE_DECL_RTLD_GLOBAL
478-
#defineRTLD_GLOBAL 0
479-
#endif
480-
481458
/* thread.c */
482459
#ifndefWIN32
483460
externboolpg_get_user_name(uid_tuser_id,char*buffer,size_tbuflen);

‎src/include/port/win32_port.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,15 @@ extern intpgwin32_ReserveSharedMemoryRegion(HANDLE);
503503
/* in backend/port/win32/crashdump.c */
504504
externvoidpgwin32_install_crashdump_handler(void);
505505

506+
/* in port/win32dlopen.c */
507+
externvoid*dlopen(constchar*file,intmode);
508+
externvoid*dlsym(void*handle,constchar*symbol);
509+
externintdlclose(void*handle);
510+
externchar*dlerror(void);
511+
512+
#defineRTLD_NOW 1
513+
#defineRTLD_GLOBAL 0
514+
506515
/* in port/win32error.c */
507516
externvoid_dosmaperr(unsigned long);
508517

‎src/port/dlopen.crenamed to‎src/port/win32dlopen.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
/*-------------------------------------------------------------------------
22
*
3-
*dlopen.c
4-
* dynamic loader forplatforms without dlopen()
3+
*win32dlopen.c
4+
* dynamic loader forWindows
55
*
66
* Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
*
1010
* IDENTIFICATION
11-
* src/port/dlopen.c
11+
* src/port/win32dlopen.c
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
1515

1616
#include"c.h"
1717

18-
#if defined(WIN32)
19-
2018
staticcharlast_dyn_error[512];
2119

2220
staticvoid
@@ -93,5 +91,3 @@ dlopen(const char *file, int mode)
9391
last_dyn_error[0]=0;
9492
return (void*)h;
9593
}
96-
97-
#endif

‎src/tools/msvc/Mkvcbuild.pm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,12 @@ sub mkvcbuild
103103
getpeereid.c getrusage.c inet_aton.c
104104
getaddrinfo.c gettimeofday.c inet_net_ntop.c kill.c open.c
105105
snprintf.c strlcat.c strlcpy.c dirmod.c noblock.c path.c
106-
dirent.cdlopen.cgetopt.c getopt_long.c link.c
106+
dirent.c getopt.c getopt_long.c link.c
107107
pread.c preadv.c pwrite.c pwritev.c pg_bitutils.c
108108
pg_strong_random.c pgcheckdir.c pgmkdirp.c pgsleep.c pgstrcasecmp.c
109109
pqsignal.c mkdtemp.c qsort.c qsort_arg.c bsearch_arg.c quotes.c system.c
110110
strerror.c tar.c
111+
win32dlopen.c
111112
win32env.c win32error.c win32ntdll.c
112113
win32security.c win32setlocale.c win32stat.c);
113114

‎src/tools/msvc/Solution.pm

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,14 +244,11 @@ sub GenerateFiles
244244
HAVE_DECL_POSIX_FADVISE=> 0,
245245
HAVE_DECL_PREADV=> 0,
246246
HAVE_DECL_PWRITEV=> 0,
247-
HAVE_DECL_RTLD_GLOBAL=> 0,
248-
HAVE_DECL_RTLD_NOW=> 0,
249247
HAVE_DECL_STRLCAT=> 0,
250248
HAVE_DECL_STRLCPY=> 0,
251249
HAVE_DECL_STRNLEN=> 1,
252250
HAVE_DECL_STRTOLL=> 1,
253251
HAVE_DECL_STRTOULL=> 1,
254-
HAVE_DLOPEN=>undef,
255252
HAVE_EDITLINE_HISTORY_H=>undef,
256253
HAVE_EDITLINE_READLINE_H=>undef,
257254
HAVE_EXECINFO_H=>undef,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp