Issue #1693 - Update NSPR to 4.35
This commit is contained in:
1 parent
c7aa6e40f6
commit
409d3e66de
39 files changed
+2754
-2452
No files matched your search
@@ -17,7 +17,7 @@ f_conf = "configure"
|
||||
f_conf_in = "configure.in"
|
||||
|
||||
def check_call_noisy(cmd, *args, **kwargs):
|
||||
print "Executing command:", cmd
|
||||
print("Executing command:", cmd)
|
||||
check_call(cmd, *args, **kwargs)
|
||||
|
||||
o = OptionParser(usage="client.py [options] remove_beta | set_beta | print_library_versions | set_version_to_minor_release | set_version_to_patch_release | create_nspr_release_archive")
|
||||
@@ -30,7 +30,7 @@ except IndexError:
|
||||
sys.exit(2)
|
||||
|
||||
def exit_with_failure(what):
|
||||
print "failure: ", what
|
||||
print("failure: ", what)
|
||||
sys.exit(2)
|
||||
|
||||
def check_files_exist():
|
||||
@@ -45,31 +45,31 @@ def sed_inplace(sed_expression, filename):
|
||||
def toggle_beta_status(is_beta):
|
||||
check_files_exist()
|
||||
if (is_beta):
|
||||
print "adding Beta status to version numbers"
|
||||
print("adding Beta status to version numbers")
|
||||
sed_inplace('s/^\(#define *PR_VERSION *\"[0-9.]\+\)\" *$/\\1 Beta\"/', prinit_h)
|
||||
sed_inplace('s/^\(#define *PR_BETA *\)PR_FALSE *$/\\1PR_TRUE/', prinit_h)
|
||||
|
||||
else:
|
||||
print "removing Beta status from version numbers"
|
||||
print("removing Beta status from version numbers")
|
||||
sed_inplace('s/^\(#define *PR_VERSION *\"[0-9.]\+\) *Beta\" *$/\\1\"/', prinit_h)
|
||||
sed_inplace('s/^\(#define *PR_BETA *\)PR_TRUE *$/\\1PR_FALSE/', prinit_h)
|
||||
print "please run 'hg stat' and 'hg diff' to verify the files have been verified correctly"
|
||||
print("please run 'hg stat' and 'hg diff' to verify the files have been verified correctly")
|
||||
|
||||
def print_beta_versions():
|
||||
check_call_noisy(["egrep", "#define *PR_VERSION|#define *PR_BETA", prinit_h])
|
||||
|
||||
def remove_beta_status():
|
||||
print "--- removing beta flags. Existing versions were:"
|
||||
print("--- removing beta flags. Existing versions were:")
|
||||
print_beta_versions()
|
||||
toggle_beta_status(False)
|
||||
print "--- finished modifications, new versions are:"
|
||||
print("--- finished modifications, new versions are:")
|
||||
print_beta_versions()
|
||||
|
||||
def set_beta_status():
|
||||
print "--- adding beta flags. Existing versions were:"
|
||||
print("--- adding beta flags. Existing versions were:")
|
||||
print_beta_versions()
|
||||
toggle_beta_status(True)
|
||||
print "--- finished modifications, new versions are:"
|
||||
print("--- finished modifications, new versions are:")
|
||||
print_beta_versions()
|
||||
|
||||
def print_library_versions():
|
||||
@@ -103,17 +103,17 @@ def set_all_lib_versions(version, major, minor, patch):
|
||||
set_major_versions(major)
|
||||
set_minor_versions(minor)
|
||||
set_patch_versions(patch)
|
||||
print
|
||||
print "==========================="
|
||||
print "======== ATTENTION ========"
|
||||
print
|
||||
print "You *MUST* manually edit file pr/tests/vercheck.c"
|
||||
print
|
||||
print "Edit two arrays, named compatible_version and incompatible_version"
|
||||
print "according to the new version you're adding."
|
||||
print
|
||||
print "======== ATTENTION ========"
|
||||
print "==========================="
|
||||
print()
|
||||
print("===========================")
|
||||
print("======== ATTENTION ========")
|
||||
print()
|
||||
print("You *MUST* manually edit file pr/tests/vercheck.c")
|
||||
print()
|
||||
print("Edit two arrays, named compatible_version and incompatible_version")
|
||||
print("according to the new version you're adding.")
|
||||
print()
|
||||
print("======== ATTENTION ========")
|
||||
print("===========================")
|
||||
|
||||
def set_version_to_minor_release():
|
||||
ensure_arguments_after_action(2, "major_version minor_version")
|
||||
@@ -144,12 +144,12 @@ def create_nspr_release_archive():
|
||||
check_call_noisy(["mkdir", "-p", nspr_stagedir])
|
||||
check_call_noisy(["hg", "archive", "-r", nsprreltag, "--prefix=nspr-" + nsprrel + "/nspr",
|
||||
"../stage/v" + nsprrel + "/src/" + nspr_tar, "-X", ".hgtags"])
|
||||
print "changing to directory " + nspr_stagedir
|
||||
print("changing to directory " + nspr_stagedir)
|
||||
os.chdir(nspr_stagedir)
|
||||
|
||||
check_call("sha1sum " + nspr_tar + " > SHA1SUMS", shell=True)
|
||||
check_call("sha256sum " + nspr_tar + " > SHA256SUMS", shell=True)
|
||||
print "created directory " + nspr_stagedir + " with files:"
|
||||
print("created directory " + nspr_stagedir + " with files:")
|
||||
check_call_noisy(["ls", "-l"])
|
||||
|
||||
if action in ('remove_beta'):
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
The config.guess and config.sub scripts were downloaded from
|
||||
http://git.savannah.gnu.org/cgit/config.git/tree/config.guess?id=6947a35648e577c2e3a12d5c88d488c6ea94e1c0
|
||||
http://git.savannah.gnu.org/cgit/config.git/tree/config.sub?id=6947a35648e577c2e3a12d5c88d488c6ea94e1c0
|
||||
|
||||
Our private patches are in the patches/ directory.
|
||||
http://git.savannah.gnu.org/cgit/config.git/tree/config.guess?id=2593751ef276497e312d7c4ce7fd049614c7bf80
|
||||
http://git.savannah.gnu.org/cgit/config.git/tree/config.sub?id=2593751ef276497e312d7c4ce7fd049614c7bf80
|
||||
Vendored
+636
-369
File diff suppressed because it is too large.
Load diff
Vendored
+1448
-1392
File diff suppressed because it is too large.
Load diff
@@ -1,51 +0,0 @@
|
||||
--- config.sub.orig 2014-03-09 18:34:03 -0700
|
||||
+++ config.sub 2014-03-14 19:49:48 -0700
|
||||
@@ -115,7 +115,7 @@
|
||||
# Here we must recognize all the valid KERNEL-OS combinations.
|
||||
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
||||
case $maybe_os in
|
||||
- nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
|
||||
+ nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | \
|
||||
linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
|
||||
knetbsd*-gnu* | netbsd*-gnu* | \
|
||||
kopensolaris*-gnu* | \
|
||||
@@ -123,10 +123,6 @@
|
||||
os=-$maybe_os
|
||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
||||
;;
|
||||
- android-linux)
|
||||
- os=-linux-android
|
||||
- basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
|
||||
- ;;
|
||||
*)
|
||||
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
|
||||
if [ $basic_machine != $1 ]
|
||||
@@ -1367,7 +1363,7 @@
|
||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||
| -chorusos* | -chorusrdb* | -cegcc* \
|
||||
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
- | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
|
||||
+ | -mingw32* | -mingw64* | -linux-gnu* \
|
||||
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
|
||||
| -uxpv* | -beos* | -mpeix* | -udk* \
|
||||
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
|
||||
@@ -1508,6 +1504,9 @@
|
||||
;;
|
||||
-nacl*)
|
||||
;;
|
||||
+ -android*)
|
||||
+ os=-android
|
||||
+ ;;
|
||||
-none)
|
||||
;;
|
||||
*)
|
||||
@@ -1777,6 +1776,9 @@
|
||||
-vos*)
|
||||
vendor=stratus
|
||||
;;
|
||||
+ *-android*|*-linuxandroid*)
|
||||
+ vendor=linux-
|
||||
+ ;;
|
||||
esac
|
||||
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
|
||||
;;
|
||||
Vendored
+63
-59
@@ -1467,7 +1467,7 @@ Optional Features:
|
||||
--enable-cplus Enable some c++ api routines
|
||||
--enable-macos-target=VER
|
||||
Set the minimum MacOS version needed at runtime
|
||||
10.2 for ppc, 10.4 for x86
|
||||
10.3 for ppc, 10.4 for x86
|
||||
--disable-os2-high-mem Disable high-memory support on OS/2
|
||||
|
||||
--enable-strip Enable stripping of shared libs and programs
|
||||
@@ -2486,7 +2486,7 @@ test -n "$target_alias" &&
|
||||
program_prefix=${target_alias}-
|
||||
|
||||
MOD_MAJOR_VERSION=4
|
||||
MOD_MINOR_VERSION=25
|
||||
MOD_MINOR_VERSION=35
|
||||
MOD_PATCH_VERSION=0
|
||||
NSPR_MODNAME=nspr20
|
||||
_HAVE_PTHREADS=
|
||||
@@ -5587,6 +5587,7 @@ if test -n "$CROSS_COMPILE"; then
|
||||
linux*) OS_ARCH=Linux ;;
|
||||
solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
|
||||
mingw*) OS_ARCH=WINNT CPU_ARCH=x86 ;;
|
||||
cygwin*) OS_ARCH=WINNT ;;
|
||||
darwin*) OS_ARCH=Darwin ;;
|
||||
riscos*) OS_ARCH=RISCOS ;;
|
||||
esac
|
||||
@@ -6457,12 +6458,22 @@ fi
|
||||
CPU_ARCH=i386
|
||||
fi
|
||||
;;
|
||||
aarch64)
|
||||
CPU_ARCH=aarch64
|
||||
;;
|
||||
*)
|
||||
CPU_ARCH=ppc
|
||||
;;
|
||||
esac
|
||||
if test "`echo $CC | grep -c '\-arch '`" = "0"; then
|
||||
CC="$CC -arch $CPU_ARCH"
|
||||
case "$CPU_ARCH" in
|
||||
aarch64)
|
||||
CC="$CC -arch arm64"
|
||||
;;
|
||||
*)
|
||||
CC="$CC -arch $CPU_ARCH"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
ac_fn_c_check_header_mongrel "$LINENO" "crt_externs.h" "ac_cv_header_crt_externs_h" "$ac_includes_default"
|
||||
if test "x$ac_cv_header_crt_externs_h" = xyes; then :
|
||||
@@ -6482,78 +6493,71 @@ fi
|
||||
PR_MD_CSRCS=darwin.c
|
||||
PR_MD_ASFILES=os_Darwin.s
|
||||
|
||||
# Add Mac OS X support for loading CFM & CFBundle plugins
|
||||
if test -f "${MACOS_SDK_DIR}/System/Library/Frameworks/Carbon.framework/Carbon"; then
|
||||
$as_echo "#define XP_MACOSX 1" >>confdefs.h
|
||||
if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
|
||||
export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
|
||||
elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then
|
||||
case "${target_cpu}" in
|
||||
powerpc*)
|
||||
export MACOSX_DEPLOYMENT_TARGET=10.3
|
||||
;;
|
||||
i*86*)
|
||||
export MACOSX_DEPLOYMENT_TARGET=10.4
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
OS_TARGET=MacOSX
|
||||
|
||||
if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
|
||||
export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
|
||||
elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then
|
||||
case "${target_cpu}" in
|
||||
powerpc*)
|
||||
export MACOSX_DEPLOYMENT_TARGET=10.2
|
||||
;;
|
||||
i*86*)
|
||||
export MACOSX_DEPLOYMENT_TARGET=10.4
|
||||
;;
|
||||
esac
|
||||
if test "$MACOS_SDK_DIR"; then
|
||||
|
||||
if test ! -d "$MACOS_SDK_DIR"; then
|
||||
as_fn_error $? "SDK not found. When using --with-macos-sdk, you must
|
||||
specify a valid SDK. SDKs are installed when the optional cross-development
|
||||
tools are selected during the Xcode/Developer Tools installation." "$LINENO" 5
|
||||
fi
|
||||
|
||||
|
||||
if test "$MACOS_SDK_DIR"; then
|
||||
CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
|
||||
GCC_VERSION_FULL=`echo $CC_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
|
||||
GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
|
||||
|
||||
if test ! -d "$MACOS_SDK_DIR"; then
|
||||
as_fn_error $? "SDK not found. When using --with-macos-sdk, you must
|
||||
specify a valid SDK. SDKs are installed when the optional cross-development
|
||||
tools are selected during the Xcode/Developer Tools installation." "$LINENO" 5
|
||||
GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
|
||||
if test "$GCC_VERSION_MAJOR" -lt "4" ; then
|
||||
SDK_C_FRAMEWORK="-F${MACOS_SDK_DIR}/System/Library/Frameworks"
|
||||
if test -d "${MACOS_SDK_DIR}/Library/Frameworks" ; then
|
||||
SDK_C_FRAMEWORK="$SDK_C_FRAMEWORK -F${MACOS_SDK_DIR}/Library/Frameworks"
|
||||
fi
|
||||
|
||||
SDK_C_INCLUDE="-isystem ${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION} -isystem ${MACOS_SDK_DIR}/usr/include ${SDK_C_FRAMEWORK}"
|
||||
|
||||
CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
|
||||
GCC_VERSION_FULL=`echo $CC_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
|
||||
GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
|
||||
CFLAGS="$CFLAGS -nostdinc ${SDK_C_INCLUDE}"
|
||||
|
||||
GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
|
||||
if test "$GCC_VERSION_MAJOR" -lt "4" ; then
|
||||
SDK_C_FRAMEWORK="-F${MACOS_SDK_DIR}/System/Library/Frameworks"
|
||||
if test -d "${MACOS_SDK_DIR}/Library/Frameworks" ; then
|
||||
SDK_C_FRAMEWORK="$SDK_C_FRAMEWORK -F${MACOS_SDK_DIR}/Library/Frameworks"
|
||||
fi
|
||||
|
||||
SDK_C_INCLUDE="-isystem ${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION} -isystem ${MACOS_SDK_DIR}/usr/include ${SDK_C_FRAMEWORK}"
|
||||
|
||||
CFLAGS="$CFLAGS -nostdinc ${SDK_C_INCLUDE}"
|
||||
|
||||
CPP="$CPP -nostdinc ${SDK_C_INCLUDE}"
|
||||
CPP="$CPP -nostdinc ${SDK_C_INCLUDE}"
|
||||
|
||||
|
||||
HOST_DARWIN_MAJOR=`echo "$build_os" | sed -E -e 's/^darwin([0-9]+).*$/\1/'`
|
||||
HOST_DARWIN_MAJOR=`echo "$build_os" | sed -E -e 's/^darwin([0-9]+).*$/\1/'`
|
||||
|
||||
if test "$HOST_DARWIN_MAJOR" -lt 9 ; then
|
||||
MACOS_SDK_LIBS="-L${MACOS_SDK_DIR}/usr/lib/gcc/darwin -L${MACOS_SDK_DIR}/usr/lib/gcc/darwin/${GCC_VERSION_FULL} -L${MACOS_SDK_DIR}/usr/lib ${SDK_C_FRAMEWORK}"
|
||||
else
|
||||
MACOS_SDK_LIBS="-Wl,-syslibroot,${MACOS_SDK_DIR}"
|
||||
fi
|
||||
|
||||
LDFLAGS="${MACOS_SDK_LIBS} $LDFLAGS"
|
||||
export NEXT_ROOT=$MACOS_SDK_DIR
|
||||
|
||||
if test -n "$CROSS_COMPILE" ; then
|
||||
HOST_CC="NEXT_ROOT= $HOST_CC"
|
||||
HOST_CXX="NEXT_ROOT= $HOST_CXX"
|
||||
fi
|
||||
if test "$HOST_DARWIN_MAJOR" -lt 9 ; then
|
||||
MACOS_SDK_LIBS="-L${MACOS_SDK_DIR}/usr/lib/gcc/darwin -L${MACOS_SDK_DIR}/usr/lib/gcc/darwin/${GCC_VERSION_FULL} -L${MACOS_SDK_DIR}/usr/lib ${SDK_C_FRAMEWORK}"
|
||||
else
|
||||
CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
|
||||
MACOS_SDK_LIBS="-Wl,-syslibroot,${MACOS_SDK_DIR}"
|
||||
fi
|
||||
|
||||
CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
|
||||
LDFLAGS="${MACOS_SDK_LIBS} $LDFLAGS"
|
||||
export NEXT_ROOT=$MACOS_SDK_DIR
|
||||
|
||||
if test "$GCC_VERSION_FULL" != "4.0.0" ; then
|
||||
LDFLAGS="$LDFLAGS -isysroot ${MACOS_SDK_DIR}"
|
||||
else
|
||||
LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
|
||||
fi
|
||||
if test -n "$CROSS_COMPILE" ; then
|
||||
HOST_CC="NEXT_ROOT= $HOST_CC"
|
||||
HOST_CXX="NEXT_ROOT= $HOST_CXX"
|
||||
fi
|
||||
else
|
||||
CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
|
||||
|
||||
CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
|
||||
|
||||
if test "$GCC_VERSION_FULL" != "4.0.0" ; then
|
||||
LDFLAGS="$LDFLAGS -isysroot ${MACOS_SDK_DIR}"
|
||||
else
|
||||
LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
+107
-102
@@ -8,14 +8,14 @@ AC_PREREQ(2.61)
|
||||
AC_INIT
|
||||
AC_CONFIG_SRCDIR([pr/include/nspr.h])
|
||||
|
||||
AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
|
||||
AC_CONFIG_AUX_DIR(build/autoconf)
|
||||
AC_CANONICAL_TARGET
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Defaults
|
||||
dnl ========================================================
|
||||
MOD_MAJOR_VERSION=4
|
||||
MOD_MINOR_VERSION=25
|
||||
MOD_MINOR_VERSION=35
|
||||
MOD_PATCH_VERSION=0
|
||||
NSPR_MODNAME=nspr20
|
||||
_HAVE_PTHREADS=
|
||||
@@ -398,7 +398,7 @@ AC_ARG_WITH(macos-sdk,
|
||||
AC_ARG_ENABLE(macos-target,
|
||||
[ --enable-macos-target=VER
|
||||
Set the minimum MacOS version needed at runtime
|
||||
[10.2 for ppc, 10.4 for x86]],
|
||||
[10.3 for ppc, 10.4 for x86]],
|
||||
[_MACOSX_DEPLOYMENT_TARGET=$enableval])
|
||||
|
||||
dnl ========================================================
|
||||
@@ -821,6 +821,7 @@ if test -n "$CROSS_COMPILE"; then
|
||||
linux*) OS_ARCH=Linux ;;
|
||||
solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
|
||||
mingw*) OS_ARCH=WINNT CPU_ARCH=x86 ;;
|
||||
cygwin*) OS_ARCH=WINNT ;;
|
||||
darwin*) OS_ARCH=Darwin ;;
|
||||
riscos*) OS_ARCH=RISCOS ;;
|
||||
esac
|
||||
@@ -1326,12 +1327,22 @@ case "$target" in
|
||||
CPU_ARCH=i386
|
||||
fi
|
||||
;;
|
||||
aarch64)
|
||||
CPU_ARCH=aarch64
|
||||
;;
|
||||
*)
|
||||
CPU_ARCH=ppc
|
||||
;;
|
||||
esac
|
||||
if test "`echo $CC | grep -c '\-arch '`" = "0"; then
|
||||
CC="$CC -arch $CPU_ARCH"
|
||||
case "$CPU_ARCH" in
|
||||
aarch64)
|
||||
CC="$CC -arch arm64"
|
||||
;;
|
||||
*)
|
||||
CC="$CC -arch $CPU_ARCH"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
AC_CHECK_HEADER(crt_externs.h, AC_DEFINE(HAVE_CRT_EXTERNS_H))
|
||||
DSO_CFLAGS=-fPIC
|
||||
@@ -1345,116 +1356,110 @@ case "$target" in
|
||||
PR_MD_CSRCS=darwin.c
|
||||
PR_MD_ASFILES=os_Darwin.s
|
||||
|
||||
# Add Mac OS X support for loading CFM & CFBundle plugins
|
||||
if test -f "${MACOS_SDK_DIR}/System/Library/Frameworks/Carbon.framework/Carbon"; then
|
||||
AC_DEFINE(XP_MACOSX)
|
||||
OS_TARGET=MacOSX
|
||||
if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
|
||||
dnl Use the specified value
|
||||
export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
|
||||
elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then
|
||||
dnl No value specified on the command line or in the environment,
|
||||
dnl use the lesser of the library's minimum or the architecture's
|
||||
dnl minimum.
|
||||
case "${target_cpu}" in
|
||||
powerpc*)
|
||||
dnl Architecture minimum 10.3
|
||||
export MACOSX_DEPLOYMENT_TARGET=10.3
|
||||
;;
|
||||
i*86*)
|
||||
dnl Architecture minimum 10.4
|
||||
export MACOSX_DEPLOYMENT_TARGET=10.4
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
|
||||
dnl Use the specified value
|
||||
export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
|
||||
elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then
|
||||
dnl No value specified on the command line or in the environment,
|
||||
dnl use the lesser of the library's minimum or the architecture's
|
||||
dnl minimum.
|
||||
case "${target_cpu}" in
|
||||
powerpc*)
|
||||
dnl Architecture minimum 10.2
|
||||
export MACOSX_DEPLOYMENT_TARGET=10.2
|
||||
;;
|
||||
i*86*)
|
||||
dnl Architecture minimum 10.4
|
||||
export MACOSX_DEPLOYMENT_TARGET=10.4
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
dnl MACOS_SDK_DIR will be set to the SDK location whenever one is
|
||||
dnl in use. NEXT_ROOT will be set and exported if it's needed for
|
||||
dnl ld.
|
||||
|
||||
dnl MACOS_SDK_DIR will be set to the SDK location whenever one is
|
||||
dnl in use. NEXT_ROOT will be set and exported if it's needed for
|
||||
dnl ld.
|
||||
if test "$MACOS_SDK_DIR"; then
|
||||
dnl Sync this section with the one in Mozilla's top level.
|
||||
|
||||
if test "$MACOS_SDK_DIR"; then
|
||||
dnl Sync this section with the one in Mozilla's top level.
|
||||
|
||||
if test ! -d "$MACOS_SDK_DIR"; then
|
||||
AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
|
||||
if test ! -d "$MACOS_SDK_DIR"; then
|
||||
AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
|
||||
specify a valid SDK. SDKs are installed when the optional cross-development
|
||||
tools are selected during the Xcode/Developer Tools installation.])
|
||||
fi
|
||||
|
||||
changequote(,)
|
||||
CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
|
||||
GCC_VERSION_FULL=`echo $CC_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
|
||||
GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
|
||||
changequote([,])
|
||||
GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
|
||||
if test "$GCC_VERSION_MAJOR" -lt "4" ; then
|
||||
SDK_C_FRAMEWORK="-F${MACOS_SDK_DIR}/System/Library/Frameworks"
|
||||
if test -d "${MACOS_SDK_DIR}/Library/Frameworks" ; then
|
||||
SDK_C_FRAMEWORK="$SDK_C_FRAMEWORK -F${MACOS_SDK_DIR}/Library/Frameworks"
|
||||
fi
|
||||
|
||||
SDK_C_INCLUDE="-isystem ${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION} -isystem ${MACOS_SDK_DIR}/usr/include ${SDK_C_FRAMEWORK}"
|
||||
|
||||
CFLAGS="$CFLAGS -nostdinc ${SDK_C_INCLUDE}"
|
||||
|
||||
dnl CPP needs to be set for AC_CHECK_HEADER.
|
||||
CPP="$CPP -nostdinc ${SDK_C_INCLUDE}"
|
||||
|
||||
changequote(,)
|
||||
CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
|
||||
GCC_VERSION_FULL=`echo $CC_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
|
||||
GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
|
||||
HOST_DARWIN_MAJOR=`echo "$build_os" | sed -E -e 's/^darwin([0-9]+).*$/\1/'`
|
||||
changequote([,])
|
||||
GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
|
||||
if test "$GCC_VERSION_MAJOR" -lt "4" ; then
|
||||
SDK_C_FRAMEWORK="-F${MACOS_SDK_DIR}/System/Library/Frameworks"
|
||||
if test -d "${MACOS_SDK_DIR}/Library/Frameworks" ; then
|
||||
SDK_C_FRAMEWORK="$SDK_C_FRAMEWORK -F${MACOS_SDK_DIR}/Library/Frameworks"
|
||||
fi
|
||||
|
||||
SDK_C_INCLUDE="-isystem ${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION} -isystem ${MACOS_SDK_DIR}/usr/include ${SDK_C_FRAMEWORK}"
|
||||
|
||||
CFLAGS="$CFLAGS -nostdinc ${SDK_C_INCLUDE}"
|
||||
|
||||
dnl CPP needs to be set for AC_CHECK_HEADER.
|
||||
CPP="$CPP -nostdinc ${SDK_C_INCLUDE}"
|
||||
|
||||
changequote(,)
|
||||
HOST_DARWIN_MAJOR=`echo "$build_os" | sed -E -e 's/^darwin([0-9]+).*$/\1/'`
|
||||
changequote([,])
|
||||
if test "$HOST_DARWIN_MAJOR" -lt 9 ; then
|
||||
dnl The build host is running Tiger (10.4) or earlier.
|
||||
dnl ld support for -syslibroot is compiler-agnostic, but
|
||||
dnl only available on Tiger and later. On Tiger and
|
||||
dnl earlier build hosts, just rely on NEXT_ROOT, because
|
||||
dnl it's not been shown to cause any problems.
|
||||
MACOS_SDK_LIBS="-L${MACOS_SDK_DIR}/usr/lib/gcc/darwin -L${MACOS_SDK_DIR}/usr/lib/gcc/darwin/${GCC_VERSION_FULL} -L${MACOS_SDK_DIR}/usr/lib ${SDK_C_FRAMEWORK}"
|
||||
else
|
||||
dnl The build host is running Leopard (10.5) or later.
|
||||
dnl With NEXT_ROOT set, the linker will still not apply
|
||||
dnl it when resolving dependencies. This causes problems
|
||||
dnl on Leopard, where an SDK depends on frameworks which
|
||||
dnl were present in earlier OS releases (and the associated
|
||||
dnl SDK) but not in Leopard. -syslibroot does not have
|
||||
dnl this problem, but it results in harmless warnings when
|
||||
dnl NEXT_ROOT is set. NEXT_ROOT needs to remain set even
|
||||
dnl on Leopard because the compiler uses it too.
|
||||
MACOS_SDK_LIBS="-Wl,-syslibroot,${MACOS_SDK_DIR}"
|
||||
fi
|
||||
|
||||
LDFLAGS="${MACOS_SDK_LIBS} $LDFLAGS"
|
||||
export NEXT_ROOT=$MACOS_SDK_DIR
|
||||
|
||||
if test -n "$CROSS_COMPILE" ; then
|
||||
dnl NEXT_ROOT will be in the environment, but it
|
||||
dnl shouldn't be set for the build host. HOST_CXX is
|
||||
dnl presently unused.
|
||||
HOST_CC="NEXT_ROOT= $HOST_CC"
|
||||
HOST_CXX="NEXT_ROOT= $HOST_CXX"
|
||||
fi
|
||||
if test "$HOST_DARWIN_MAJOR" -lt 9 ; then
|
||||
dnl The build host is running Tiger (10.4) or earlier.
|
||||
dnl ld support for -syslibroot is compiler-agnostic, but
|
||||
dnl only available on Tiger and later. On Tiger and
|
||||
dnl earlier build hosts, just rely on NEXT_ROOT, because
|
||||
dnl it's not been shown to cause any problems.
|
||||
MACOS_SDK_LIBS="-L${MACOS_SDK_DIR}/usr/lib/gcc/darwin -L${MACOS_SDK_DIR}/usr/lib/gcc/darwin/${GCC_VERSION_FULL} -L${MACOS_SDK_DIR}/usr/lib ${SDK_C_FRAMEWORK}"
|
||||
else
|
||||
dnl gcc >= 4.0 uses different paths than above, but knows
|
||||
dnl how to find them itself.
|
||||
CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
|
||||
dnl The build host is running Leopard (10.5) or later.
|
||||
dnl With NEXT_ROOT set, the linker will still not apply
|
||||
dnl it when resolving dependencies. This causes problems
|
||||
dnl on Leopard, where an SDK depends on frameworks which
|
||||
dnl were present in earlier OS releases (and the associated
|
||||
dnl SDK) but not in Leopard. -syslibroot does not have
|
||||
dnl this problem, but it results in harmless warnings when
|
||||
dnl NEXT_ROOT is set. NEXT_ROOT needs to remain set even
|
||||
dnl on Leopard because the compiler uses it too.
|
||||
MACOS_SDK_LIBS="-Wl,-syslibroot,${MACOS_SDK_DIR}"
|
||||
fi
|
||||
|
||||
dnl CPP needs to be set for AC_CHECK_HEADER.
|
||||
CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
|
||||
LDFLAGS="${MACOS_SDK_LIBS} $LDFLAGS"
|
||||
export NEXT_ROOT=$MACOS_SDK_DIR
|
||||
|
||||
dnl If gcc >= 4.0.0, we're guaranteed to be on Tiger, which
|
||||
dnl has an ld that supports -syslibroot. Don't set
|
||||
dnl NEXT_ROOT because it will be ignored and cause
|
||||
dnl warnings when -syslibroot is specified.
|
||||
if test "$GCC_VERSION_FULL" != "4.0.0" ; then
|
||||
dnl gcc > 4.0.0 will pass -syslibroot to ld automatically
|
||||
dnl based on the -isysroot it receives.
|
||||
LDFLAGS="$LDFLAGS -isysroot ${MACOS_SDK_DIR}"
|
||||
else
|
||||
dnl gcc 4.0.0 doesn't pass -syslibroot to ld, it needs
|
||||
dnl to be explicit.
|
||||
LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
|
||||
fi
|
||||
if test -n "$CROSS_COMPILE" ; then
|
||||
dnl NEXT_ROOT will be in the environment, but it
|
||||
dnl shouldn't be set for the build host. HOST_CXX is
|
||||
dnl presently unused.
|
||||
HOST_CC="NEXT_ROOT= $HOST_CC"
|
||||
HOST_CXX="NEXT_ROOT= $HOST_CXX"
|
||||
fi
|
||||
else
|
||||
dnl gcc >= 4.0 uses different paths than above, but knows
|
||||
dnl how to find them itself.
|
||||
CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
|
||||
|
||||
dnl CPP needs to be set for AC_CHECK_HEADER.
|
||||
CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
|
||||
|
||||
dnl If gcc >= 4.0.0, we're guaranteed to be on Tiger, which
|
||||
dnl has an ld that supports -syslibroot. Don't set
|
||||
dnl NEXT_ROOT because it will be ignored and cause
|
||||
dnl warnings when -syslibroot is specified.
|
||||
if test "$GCC_VERSION_FULL" != "4.0.0" ; then
|
||||
dnl gcc > 4.0.0 will pass -syslibroot to ld automatically
|
||||
dnl based on the -isysroot it receives.
|
||||
LDFLAGS="$LDFLAGS -isysroot ${MACOS_SDK_DIR}"
|
||||
else
|
||||
dnl gcc 4.0.0 doesn't pass -syslibroot to ld, it needs
|
||||
dnl to be explicit.
|
||||
LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -40,11 +40,7 @@
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
#define HAVE_DLL
|
||||
#if defined(__x86_64__) || defined(__aarch64__)
|
||||
#define USE_DLFCN
|
||||
#else
|
||||
#define USE_MACH_DYLD
|
||||
#endif
|
||||
#define _PR_HAVE_SOCKADDR_LEN
|
||||
#define _PR_STAT_HAS_ST_ATIMESPEC
|
||||
#define _PR_HAVE_LARGE_OFF_T
|
||||
@@ -124,7 +120,16 @@ extern PRInt32 _PR_Darwin_x86_64_AtomicAdd(PRInt32 *ptr, PRInt32 val);
|
||||
#define _MD_ATOMIC_ADD(ptr, val) _PR_Darwin_x86_64_AtomicAdd(ptr, val)
|
||||
#endif /* __x86_64__ */
|
||||
|
||||
#if defined(__arm__) || defined(__aarch64__)
|
||||
#ifdef __aarch64__
|
||||
#define _PR_HAVE_ATOMIC_OPS
|
||||
#define _MD_INIT_ATOMIC()
|
||||
#define _MD_ATOMIC_INCREMENT(val) __sync_add_and_fetch(val, 1)
|
||||
#define _MD_ATOMIC_DECREMENT(val) __sync_sub_and_fetch(val, 1)
|
||||
#define _MD_ATOMIC_SET(val, newval) __sync_lock_test_and_set(val, newval)
|
||||
#define _MD_ATOMIC_ADD(ptr, val) __sync_add_and_fetch(ptr, val)
|
||||
#endif /* __aarch64__ */
|
||||
|
||||
#if defined(__arm__)
|
||||
#define _PR_HAVE_ATOMIC_OPS
|
||||
#define _MD_INIT_ATOMIC()
|
||||
#define _MD_ATOMIC_INCREMENT(val) OSAtomicIncrement32(val)
|
||||
@@ -138,7 +143,7 @@ static inline PRInt32 _MD_ATOMIC_SET(PRInt32 *val, PRInt32 newval)
|
||||
return oldval;
|
||||
}
|
||||
#define _MD_ATOMIC_ADD(ptr, val) OSAtomicAdd32(val, ptr)
|
||||
#endif /* __arm__ || __aarch64__ */
|
||||
#endif /* __arm__ */
|
||||
|
||||
#define USE_SETJMP
|
||||
|
||||
|
||||
@@ -499,7 +499,7 @@
|
||||
#elif defined(__mips__)
|
||||
|
||||
/* For _ABI64 */
|
||||
#include <sgidefs.h>
|
||||
#include <asm/sgidefs.h>
|
||||
|
||||
#ifdef __MIPSEB__
|
||||
#define IS_BIG_ENDIAN 1
|
||||
@@ -1208,6 +1208,99 @@
|
||||
#define PR_BYTES_PER_WORD_LOG2 2
|
||||
#define PR_BYTES_PER_DWORD_LOG2 3
|
||||
|
||||
#elif defined(__e2k__)
|
||||
|
||||
#define IS_LITTLE_ENDIAN 1
|
||||
#undef IS_BIG_ENDIAN
|
||||
|
||||
#define IS_64
|
||||
|
||||
#define PR_BYTES_PER_BYTE 1
|
||||
#define PR_BYTES_PER_SHORT 2
|
||||
#define PR_BYTES_PER_INT 4
|
||||
#define PR_BYTES_PER_INT64 4
|
||||
#define PR_BYTES_PER_LONG 8
|
||||
#define PR_BYTES_PER_FLOAT 4
|
||||
#define PR_BYTES_PER_DOUBLE 8
|
||||
#define PR_BYTES_PER_WORD 8
|
||||
#define PR_BYTES_PER_DWORD 8
|
||||
|
||||
#define PR_BITS_PER_BYTE 8
|
||||
#define PR_BITS_PER_SHORT 16
|
||||
#define PR_BITS_PER_INT 32
|
||||
#define PR_BITS_PER_INT64 32
|
||||
#define PR_BITS_PER_LONG 64
|
||||
#define PR_BITS_PER_FLOAT 32
|
||||
#define PR_BITS_PER_DOUBLE 64
|
||||
#define PR_BITS_PER_WORD 64
|
||||
|
||||
#define PR_BITS_PER_BYTE_LOG2 3
|
||||
#define PR_BITS_PER_SHORT_LOG2 4
|
||||
#define PR_BITS_PER_INT_LOG2 5
|
||||
#define PR_BITS_PER_INT64_LOG2 5
|
||||
#define PR_BITS_PER_LONG_LOG2 6
|
||||
#define PR_BITS_PER_FLOAT_LOG2 5
|
||||
#define PR_BITS_PER_DOUBLE_LOG2 6
|
||||
#define PR_BITS_PER_WORD_LOG2 6
|
||||
|
||||
#define PR_ALIGN_OF_SHORT 2
|
||||
#define PR_ALIGN_OF_INT 4
|
||||
#define PR_ALIGN_OF_LONG 8
|
||||
#define PR_ALIGN_OF_INT64 4
|
||||
#define PR_ALIGN_OF_FLOAT 4
|
||||
#define PR_ALIGN_OF_DOUBLE 8
|
||||
#define PR_ALIGN_OF_POINTER 8
|
||||
#define PR_ALIGN_OF_WORD 8
|
||||
|
||||
#define PR_BYTES_PER_WORD_LOG2 3
|
||||
#define PR_BYTES_PER_DWORD_LOG2 3
|
||||
|
||||
#elif defined(__loongarch64)
|
||||
|
||||
#undef IS_BIG_ENDIAN
|
||||
#define IS_LITTLE_ENDIAN 1
|
||||
#define IS_64
|
||||
|
||||
#define PR_BYTES_PER_BYTE 1
|
||||
#define PR_BYTES_PER_SHORT 2
|
||||
#define PR_BYTES_PER_INT 4
|
||||
#define PR_BYTES_PER_INT64 8
|
||||
#define PR_BYTES_PER_LONG 8
|
||||
#define PR_BYTES_PER_FLOAT 4
|
||||
#define PR_BYTES_PER_DOUBLE 8
|
||||
#define PR_BYTES_PER_WORD 8
|
||||
#define PR_BYTES_PER_DWORD 8
|
||||
|
||||
#define PR_BITS_PER_BYTE 8
|
||||
#define PR_BITS_PER_SHORT 16
|
||||
#define PR_BITS_PER_INT 32
|
||||
#define PR_BITS_PER_INT64 64
|
||||
#define PR_BITS_PER_LONG 64
|
||||
#define PR_BITS_PER_FLOAT 32
|
||||
#define PR_BITS_PER_DOUBLE 64
|
||||
#define PR_BITS_PER_WORD 64
|
||||
|
||||
#define PR_BITS_PER_BYTE_LOG2 3
|
||||
#define PR_BITS_PER_SHORT_LOG2 4
|
||||
#define PR_BITS_PER_INT_LOG2 5
|
||||
#define PR_BITS_PER_INT64_LOG2 6
|
||||
#define PR_BITS_PER_LONG_LOG2 6
|
||||
#define PR_BITS_PER_FLOAT_LOG2 5
|
||||
#define PR_BITS_PER_DOUBLE_LOG2 6
|
||||
#define PR_BITS_PER_WORD_LOG2 6
|
||||
|
||||
#define PR_ALIGN_OF_SHORT 2
|
||||
#define PR_ALIGN_OF_INT 4
|
||||
#define PR_ALIGN_OF_LONG 8
|
||||
#define PR_ALIGN_OF_INT64 8
|
||||
#define PR_ALIGN_OF_FLOAT 4
|
||||
#define PR_ALIGN_OF_DOUBLE 8
|
||||
#define PR_ALIGN_OF_POINTER 8
|
||||
#define PR_ALIGN_OF_WORD 8
|
||||
|
||||
#define PR_BYTES_PER_WORD_LOG2 3
|
||||
#define PR_BYTES_PER_DWORD_LOG2 3
|
||||
|
||||
#else
|
||||
|
||||
#error "Unknown CPU architecture"
|
||||
|
||||
@@ -61,6 +61,8 @@
|
||||
#define _PR_SI_ARCHITECTURE "riscv32"
|
||||
#elif defined(__riscv) && (__riscv_xlen == 64)
|
||||
#define _PR_SI_ARCHITECTURE "riscv64"
|
||||
#elif defined(__e2k__)
|
||||
#define _PR_SI_ARCHITECTURE "e2k"
|
||||
#elif defined(__arc__)
|
||||
#define _PR_SI_ARCHITECTURE "arc"
|
||||
#elif defined(__nios2__)
|
||||
@@ -71,6 +73,8 @@
|
||||
#define _PR_SI_ARCHITECTURE "nds32"
|
||||
#elif defined(__xtensa__)
|
||||
#define _PR_SI_ARCHITECTURE "xtensa"
|
||||
#elif defined(__loongarch64)
|
||||
#define _PR_SI_ARCHITECTURE "loongarch64"
|
||||
#else
|
||||
#error "Unknown CPU architecture"
|
||||
#endif
|
||||
@@ -139,6 +143,18 @@ extern PRInt32 _PR_x86_64_AtomicSet(PRInt32 *val, PRInt32 newval);
|
||||
#define _MD_ATOMIC_SET _PR_x86_64_AtomicSet
|
||||
#endif
|
||||
|
||||
#if defined(__loongarch__)
|
||||
#if defined(__GNUC__)
|
||||
/* Use GCC built-in functions */
|
||||
#define _PR_HAVE_ATOMIC_OPS
|
||||
#define _MD_INIT_ATOMIC()
|
||||
#define _MD_ATOMIC_INCREMENT(ptr) __sync_add_and_fetch(ptr, 1)
|
||||
#define _MD_ATOMIC_DECREMENT(ptr) __sync_sub_and_fetch(ptr, 1)
|
||||
#define _MD_ATOMIC_ADD(ptr, i) __sync_add_and_fetch(ptr, i)
|
||||
#define _MD_ATOMIC_SET(ptr, nv) __sync_lock_test_and_set(ptr, nv)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__or1k__)
|
||||
#if defined(__GNUC__)
|
||||
/* Use GCC built-in functions */
|
||||
|
||||
@@ -16,10 +16,12 @@
|
||||
#define _PR_SI_ARCHITECTURE "alpha"
|
||||
#elif defined(__amd64__)
|
||||
#define _PR_SI_ARCHITECTURE "amd64"
|
||||
#elif defined(__m68k__)
|
||||
#define _PR_SI_ARCHITECTURE "m68k"
|
||||
#elif defined(__powerpc64__)
|
||||
#define _PR_SI_ARCHITECTURE "powerpc64"
|
||||
#elif defined(__powerpc__)
|
||||
#define _PR_SI_ARCHITECTURE "powerpc"
|
||||
#elif defined(__aarch64__)
|
||||
#define _PR_SI_ARCHITECTURE "aarch64"
|
||||
#elif defined(__sparc__)
|
||||
#define _PR_SI_ARCHITECTURE "sparc"
|
||||
#elif defined(__arm__)
|
||||
@@ -190,6 +192,8 @@ struct _MDCPU {
|
||||
|
||||
#endif /* ! _PR_PTHREADS */
|
||||
|
||||
extern void _MD_EarlyInit(void);
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _PR_HAVE_CLOCK_MONOTONIC
|
||||
|
||||
@@ -31,9 +31,9 @@ PR_BEGIN_EXTERN_C
|
||||
** The format of the version string is
|
||||
** "<major version>.<minor version>[.<patch level>] [<Beta>]"
|
||||
*/
|
||||
#define PR_VERSION "4.25"
|
||||
#define PR_VERSION "4.35"
|
||||
#define PR_VMAJOR 4
|
||||
#define PR_VMINOR 25
|
||||
#define PR_VMINOR 35
|
||||
#define PR_VPATCH 0
|
||||
#define PR_BETA PR_FALSE
|
||||
|
||||
|
||||
@@ -205,6 +205,7 @@ typedef enum PRSockOption
|
||||
PR_SockOpt_Broadcast, /* enable broadcast */
|
||||
PR_SockOpt_Reuseport, /* allow local address & port reuse on
|
||||
* platforms that support it */
|
||||
PR_SockOpt_DontFrag, /* Do not fragment flag */
|
||||
PR_SockOpt_Last
|
||||
} PRSockOption;
|
||||
|
||||
@@ -230,6 +231,7 @@ typedef struct PRSocketOptionData
|
||||
PRBool reuse_addr; /* Allow local address reuse */
|
||||
PRBool reuse_port; /* Allow local address & port reuse on
|
||||
* platforms that support it */
|
||||
PRBool dont_fragment; /* Do not fragment flag */
|
||||
PRBool keep_alive; /* Keep connections alive */
|
||||
PRBool mcast_loopback; /* IP multicast loopback */
|
||||
PRBool no_delay; /* Don't delay send to coalesce packets */
|
||||
|
||||
@@ -301,9 +301,9 @@ NSPR_API(void) PR_OS2_UnsetFloatExcpHandler(EXCEPTIONREGISTRATIONRECORD* e);
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef XP_UNIX
|
||||
extern void PR_XLock(void);
|
||||
extern void PR_XUnlock(void);
|
||||
extern PRBool PR_XIsLocked(void);
|
||||
extern void _PR_XLock(void);
|
||||
extern void _PR_XUnlock(void);
|
||||
extern PRBool _PR_XIsLocked(void);
|
||||
#endif /* XP_UNIX */
|
||||
|
||||
PR_END_EXTERN_C
|
||||
|
||||
@@ -49,8 +49,13 @@ typedef struct PRHostEnt {
|
||||
/* A safe size to use that will mostly work... */
|
||||
#if (defined(AIX) && defined(_THREAD_SAFE))
|
||||
#define PR_NETDB_BUF_SIZE sizeof(struct protoent_data)
|
||||
#define PR_MIN_NETDB_BUF_SIZE PR_NETDB_BUF_SIZE
|
||||
#else
|
||||
#define PR_NETDB_BUF_SIZE 1024
|
||||
/* PR_NETDB_BUF_SIZE is the recommended buffer size */
|
||||
#define PR_NETDB_BUF_SIZE 2048
|
||||
/* PR_MIN_NETDB_BUF_SIZE is the smallest buffer size that the API
|
||||
* accepts (for backward compatibility). */
|
||||
#define PR_MIN_NETDB_BUF_SIZE 1024
|
||||
#endif
|
||||
|
||||
/***********************************************************************
|
||||
@@ -423,6 +428,9 @@ NSPR_API(void) PR_FreeAddrInfo(PRAddrInfo *addrInfo);
|
||||
NSPR_API(void *) PR_EnumerateAddrInfo(
|
||||
void *enumPtr, const PRAddrInfo *addrInfo, PRUint16 port, PRNetAddr *result);
|
||||
|
||||
NSPR_API(PRStatus) PR_GetPrefLoopbackAddrInfo(PRNetAddr *result,
|
||||
PRUint16 port);
|
||||
|
||||
/***********************************************************************
|
||||
** FUNCTION:
|
||||
** DESCRIPTION: PR_GetCanonNameFromAddrInfo()
|
||||
|
||||
@@ -43,8 +43,9 @@ typedef enum {
|
||||
PR_SI_SYSNAME,
|
||||
PR_SI_RELEASE,
|
||||
PR_SI_ARCHITECTURE,
|
||||
PR_SI_HOSTNAME_UNTRUNCATED /* the hostname exactly as configured
|
||||
PR_SI_HOSTNAME_UNTRUNCATED, /* the hostname exactly as configured
|
||||
* on the system */
|
||||
PR_SI_RELEASE_BUILD
|
||||
} PRSysInfo;
|
||||
|
||||
|
||||
|
||||
@@ -159,10 +159,6 @@ ifeq ($(OS_TARGET),Android)
|
||||
OS_LIBS += -llog
|
||||
endif
|
||||
|
||||
ifeq ($(OS_TARGET),MacOSX)
|
||||
OS_LIBS = -framework CoreServices -framework CoreFoundation
|
||||
endif
|
||||
|
||||
EXTRA_LIBS += $(OS_LIBS)
|
||||
|
||||
#
|
||||
|
||||
@@ -33,6 +33,15 @@
|
||||
|
||||
#include "primpl.h"
|
||||
|
||||
#if defined(LINUX) || defined(ANDROID)
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#ifdef DARWIN
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/ip.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NETINET_TCP_H
|
||||
#include <netinet/tcp.h> /* TCP_NODELAY, TCP_MAXSEG */
|
||||
#endif
|
||||
@@ -174,6 +183,28 @@ PRStatus PR_CALLBACK _PR_SocketGetSocketOption(PRFileDesc *fd, PRSocketOptionDat
|
||||
(char*)&data->value.mcast_if.inet.ip, &length);
|
||||
break;
|
||||
}
|
||||
case PR_SockOpt_DontFrag:
|
||||
{
|
||||
#if !defined(WIN32) && !defined(DARWIN) && !defined(LINUX) && !defined(ANDROID)
|
||||
PR_SetError(PR_OPERATION_NOT_SUPPORTED_ERROR, 0);
|
||||
rv = PR_FAILURE;
|
||||
#else
|
||||
#ifdef WIN32 /* Winsock */
|
||||
DWORD value;
|
||||
#else
|
||||
PRIntn value;
|
||||
#endif
|
||||
length = sizeof(value);
|
||||
rv = _PR_MD_GETSOCKOPT(
|
||||
fd, level, name, (char*)&value, &length);
|
||||
#if defined(WIN32) || defined(DARWIN)
|
||||
data->value.dont_fragment = value;
|
||||
#else
|
||||
data->value.dont_fragment = (value == IP_PMTUDISC_DO) ? 1 : 0;
|
||||
#endif
|
||||
#endif /* !(!defined(WIN32) && !defined(DARWIN) && !defined(LINUX) && !defined(ANDROID)) */
|
||||
break;
|
||||
}
|
||||
default:
|
||||
PR_NOT_REACHED("Unknown socket option");
|
||||
break;
|
||||
@@ -306,6 +337,27 @@ PRStatus PR_CALLBACK _PR_SocketSetSocketOption(PRFileDesc *fd, const PRSocketOpt
|
||||
sizeof(data->value.mcast_if.inet.ip));
|
||||
break;
|
||||
}
|
||||
case PR_SockOpt_DontFrag:
|
||||
{
|
||||
#if !defined(WIN32) && !defined(DARWIN) && !defined(LINUX) && !defined(ANDROID)
|
||||
PR_SetError(PR_OPERATION_NOT_SUPPORTED_ERROR, 0);
|
||||
rv = PR_FAILURE;
|
||||
#else
|
||||
#if defined(WIN32) /* Winsock */
|
||||
DWORD value;
|
||||
value = (data->value.dont_fragment) ? 1 : 0;
|
||||
#elif defined(LINUX) || defined(ANDROID)
|
||||
PRIntn value;
|
||||
value = (data->value.dont_fragment) ? IP_PMTUDISC_DO : IP_PMTUDISC_DONT;
|
||||
#elif defined(DARWIN)
|
||||
PRIntn value;
|
||||
value = data->value.dont_fragment;
|
||||
#endif
|
||||
rv = _PR_MD_SETSOCKOPT(
|
||||
fd, level, name, (char*)&value, sizeof(value));
|
||||
#endif /* !(!defined(WIN32) && !defined(DARWIN) && !defined(LINUX) && !defined(ANDROID)) */
|
||||
break;
|
||||
}
|
||||
default:
|
||||
PR_NOT_REACHED("Unknown socket option");
|
||||
break;
|
||||
@@ -400,6 +452,23 @@ PRStatus PR_CALLBACK _PR_SocketSetSocketOption(PRFileDesc *fd, const PRSocketOpt
|
||||
#define IP_TOS _PR_NO_SUCH_SOCKOPT
|
||||
#endif
|
||||
|
||||
/* set/get IP do not fragment */
|
||||
#if defined(WIN32)
|
||||
#ifndef IP_DONTFRAGMENT
|
||||
#define IP_DONTFRAGMENT _PR_NO_SUCH_SOCKOPT
|
||||
#endif
|
||||
|
||||
#elif defined(LINUX) || defined(ANDROID)
|
||||
#ifndef IP_MTU_DISCOVER
|
||||
#define IP_MTU_DISCOVER _PR_NO_SUCH_SOCKOPT
|
||||
#endif
|
||||
|
||||
#elif defined(DARWIN)
|
||||
#ifndef IP_DONTFRAG
|
||||
#define IP_DONTFRAG _PR_NO_SUCH_SOCKOPT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef TCP_NODELAY /* don't delay to coalesce data */
|
||||
#define TCP_NODELAY _PR_NO_SUCH_SOCKOPT
|
||||
#endif
|
||||
@@ -424,14 +493,23 @@ PRStatus _PR_MapOptionName(
|
||||
0, SO_LINGER, SO_REUSEADDR, SO_KEEPALIVE, SO_RCVBUF, SO_SNDBUF,
|
||||
IP_TTL, IP_TOS, IP_ADD_MEMBERSHIP, IP_DROP_MEMBERSHIP,
|
||||
IP_MULTICAST_IF, IP_MULTICAST_TTL, IP_MULTICAST_LOOP,
|
||||
TCP_NODELAY, TCP_MAXSEG, SO_BROADCAST, SO_REUSEPORT
|
||||
TCP_NODELAY, TCP_MAXSEG, SO_BROADCAST, SO_REUSEPORT,
|
||||
#if defined(WIN32)
|
||||
IP_DONTFRAGMENT,
|
||||
#elif defined(LINUX) || defined(ANDROID)
|
||||
IP_MTU_DISCOVER,
|
||||
#elif defined(DARWIN)
|
||||
IP_DONTFRAG,
|
||||
#else
|
||||
_PR_NO_SUCH_SOCKOPT,
|
||||
#endif
|
||||
};
|
||||
static PRInt32 socketLevels[PR_SockOpt_Last] =
|
||||
{
|
||||
0, SOL_SOCKET, SOL_SOCKET, SOL_SOCKET, SOL_SOCKET, SOL_SOCKET,
|
||||
IPPROTO_IP, IPPROTO_IP, IPPROTO_IP, IPPROTO_IP,
|
||||
IPPROTO_IP, IPPROTO_IP, IPPROTO_IP,
|
||||
IPPROTO_TCP, IPPROTO_TCP, SOL_SOCKET, SOL_SOCKET
|
||||
IPPROTO_TCP, IPPROTO_TCP, SOL_SOCKET, SOL_SOCKET, IPPROTO_IP
|
||||
};
|
||||
|
||||
if ((optname < PR_SockOpt_Linger)
|
||||
|
||||
@@ -322,7 +322,7 @@ static PRStatus PR_CALLBACK SocketConnectContinue(
|
||||
#if defined(_WIN64)
|
||||
if (fd->secret->overlappedActive) {
|
||||
PRInt32 rvSent;
|
||||
if (GetOverlappedResult(osfd, &fd->secret->ol, &rvSent, FALSE) == FALSE) {
|
||||
if (GetOverlappedResult((HANDLE)osfd, &fd->secret->ol, &rvSent, FALSE) == FALSE) {
|
||||
err = WSAGetLastError();
|
||||
PR_LOG(_pr_io_lm, PR_LOG_MIN,
|
||||
("SocketConnectContinue GetOverlappedResult failed %d\n", err));
|
||||
@@ -354,7 +354,7 @@ static PRStatus PR_CALLBACK SocketConnectContinue(
|
||||
if (fd->secret->overlappedActive) {
|
||||
PR_ASSERT(fd->secret->nonblocking);
|
||||
PRInt32 rvSent;
|
||||
if (GetOverlappedResult(osfd, &fd->secret->ol, &rvSent, FALSE) == TRUE) {
|
||||
if (GetOverlappedResult((HANDLE)osfd, &fd->secret->ol, &rvSent, FALSE) == TRUE) {
|
||||
fd->secret->overlappedActive = PR_FALSE;
|
||||
PR_LOG(_pr_io_lm, PR_LOG_MIN,
|
||||
("SocketConnectContinue GetOverlappedResult succeeded\n"));
|
||||
|
||||
+36
-375
@@ -7,11 +7,6 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#if defined(XP_MACOSX) && defined(USE_MACH_DYLD)
|
||||
#include <Carbon/Carbon.h>
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#endif
|
||||
|
||||
#ifdef XP_UNIX
|
||||
#ifdef USE_DLFCN
|
||||
#include <dlfcn.h>
|
||||
@@ -36,8 +31,6 @@
|
||||
#endif
|
||||
#elif defined(USE_HPSHL)
|
||||
#include <dl.h>
|
||||
#elif defined(USE_MACH_DYLD)
|
||||
#include <mach-o/dyld.h>
|
||||
#endif
|
||||
#endif /* XP_UNIX */
|
||||
|
||||
@@ -46,8 +39,7 @@
|
||||
/*
|
||||
* On these platforms, symbols have a leading '_'.
|
||||
*/
|
||||
#if (defined(DARWIN) && defined(USE_MACH_DYLD)) \
|
||||
|| defined(XP_OS2) \
|
||||
#if defined(XP_OS2) \
|
||||
|| ((defined(OPENBSD) || defined(NETBSD)) && !defined(__ELF__))
|
||||
#define NEED_LEADING_UNDERSCORE
|
||||
#endif
|
||||
@@ -70,19 +62,9 @@ struct PRLibrary {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(XP_MACOSX) && defined(USE_MACH_DYLD)
|
||||
CFragConnectionID connection;
|
||||
CFBundleRef bundle;
|
||||
Ptr main;
|
||||
CFMutableDictionaryRef wrappers;
|
||||
const struct mach_header* image;
|
||||
#endif
|
||||
|
||||
#ifdef XP_UNIX
|
||||
#if defined(USE_HPSHL)
|
||||
shl_t dlh;
|
||||
#elif defined(USE_MACH_DYLD)
|
||||
NSModule dlh;
|
||||
#else
|
||||
void* dlh;
|
||||
#endif
|
||||
@@ -170,7 +152,7 @@ void _PR_InitLinker(void)
|
||||
#elif defined(USE_HPSHL)
|
||||
h = NULL;
|
||||
/* don't abort with this NULL */
|
||||
#elif defined(USE_MACH_DYLD) || defined(NO_DLOPEN_NULL)
|
||||
#elif defined(NO_DLOPEN_NULL)
|
||||
h = NULL; /* XXXX toshok */ /* XXXX vlad */
|
||||
#else
|
||||
#error no dll strategy
|
||||
@@ -270,7 +252,7 @@ PR_GetLibraryPath(void)
|
||||
#endif
|
||||
|
||||
#if defined(XP_UNIX)
|
||||
#if defined(USE_DLFCN) || defined(USE_MACH_DYLD)
|
||||
#if defined(USE_DLFCN)
|
||||
{
|
||||
char *p=NULL;
|
||||
int len;
|
||||
@@ -428,203 +410,6 @@ PR_LoadLibrary(const char *name)
|
||||
return PR_LoadLibraryWithFlags(libSpec, 0);
|
||||
}
|
||||
|
||||
#if defined(USE_MACH_DYLD)
|
||||
static NSModule
|
||||
pr_LoadMachDyldModule(const char *name)
|
||||
{
|
||||
NSObjectFileImage ofi;
|
||||
NSModule h = NULL;
|
||||
if (NSCreateObjectFileImageFromFile(name, &ofi)
|
||||
== NSObjectFileImageSuccess) {
|
||||
h = NSLinkModule(ofi, name, NSLINKMODULE_OPTION_PRIVATE
|
||||
| NSLINKMODULE_OPTION_RETURN_ON_ERROR);
|
||||
if (h == NULL) {
|
||||
NSLinkEditErrors linkEditError;
|
||||
int errorNum;
|
||||
const char *fileName;
|
||||
const char *errorString;
|
||||
NSLinkEditError(&linkEditError, &errorNum, &fileName, &errorString);
|
||||
PR_LOG(_pr_linker_lm, PR_LOG_MIN,
|
||||
("LoadMachDyldModule error %d:%d for file %s:\n%s",
|
||||
linkEditError, errorNum, fileName, errorString));
|
||||
}
|
||||
if (NSDestroyObjectFileImage(ofi) == FALSE) {
|
||||
if (h) {
|
||||
(void)NSUnLinkModule(h, NSUNLINKMODULE_OPTION_NONE);
|
||||
h = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
return h;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(XP_MACOSX) && defined(USE_MACH_DYLD)
|
||||
|
||||
/*
|
||||
** macLibraryLoadProc is a function definition for a Mac shared library
|
||||
** loading method. The "name" param is the same full or partial pathname
|
||||
** that was passed to pr_LoadLibraryByPathName. The function must fill
|
||||
** in the fields of "lm" which apply to its library type. Returns
|
||||
** PR_SUCCESS if successful.
|
||||
*/
|
||||
|
||||
typedef PRStatus (*macLibraryLoadProc)(const char *name, PRLibrary *lm);
|
||||
|
||||
#ifdef __ppc__
|
||||
|
||||
/*
|
||||
** CFM and its TVectors only exist on PowerPC. Other OS X architectures
|
||||
** only use Mach-O as a native binary format.
|
||||
*/
|
||||
|
||||
static void* TV2FP(CFMutableDictionaryRef dict, const char* name, void *tvp)
|
||||
{
|
||||
static uint32 glue[6] = { 0x3D800000, 0x618C0000, 0x800C0000, 0x804C0004, 0x7C0903A6, 0x4E800420 };
|
||||
uint32* newGlue = NULL;
|
||||
|
||||
if (tvp != NULL) {
|
||||
CFStringRef nameRef = CFStringCreateWithCString(NULL, name, kCFStringEncodingASCII);
|
||||
if (nameRef) {
|
||||
CFMutableDataRef glueData = (CFMutableDataRef) CFDictionaryGetValue(dict, nameRef);
|
||||
if (glueData == NULL) {
|
||||
glueData = CFDataCreateMutable(NULL, sizeof(glue));
|
||||
if (glueData != NULL) {
|
||||
newGlue = (uint32*) CFDataGetMutableBytePtr(glueData);
|
||||
memcpy(newGlue, glue, sizeof(glue));
|
||||
newGlue[0] |= ((UInt32)tvp >> 16);
|
||||
newGlue[1] |= ((UInt32)tvp & 0xFFFF);
|
||||
MakeDataExecutable(newGlue, sizeof(glue));
|
||||
CFDictionaryAddValue(dict, nameRef, glueData);
|
||||
CFRelease(glueData);
|
||||
|
||||
PR_LOG(_pr_linker_lm, PR_LOG_MIN, ("TV2FP: created wrapper for CFM function %s().", name));
|
||||
}
|
||||
} else {
|
||||
PR_LOG(_pr_linker_lm, PR_LOG_MIN, ("TV2FP: found wrapper for CFM function %s().", name));
|
||||
|
||||
newGlue = (uint32*) CFDataGetMutableBytePtr(glueData);
|
||||
}
|
||||
CFRelease(nameRef);
|
||||
}
|
||||
}
|
||||
|
||||
return newGlue;
|
||||
}
|
||||
|
||||
static PRStatus
|
||||
pr_LoadViaCFM(const char *name, PRLibrary *lm)
|
||||
{
|
||||
OSErr err;
|
||||
Str255 errName;
|
||||
FSRef ref;
|
||||
FSSpec fileSpec;
|
||||
Boolean tempUnusedBool;
|
||||
|
||||
/*
|
||||
* Make an FSSpec from the path name and call GetDiskFragment.
|
||||
*/
|
||||
|
||||
/* Use direct conversion of POSIX path to FSRef to FSSpec. */
|
||||
err = FSPathMakeRef((const UInt8*)name, &ref, NULL);
|
||||
if (err != noErr) {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
err = FSGetCatalogInfo(&ref, kFSCatInfoNone, NULL, NULL,
|
||||
&fileSpec, NULL);
|
||||
if (err != noErr) {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
/* Resolve an alias if this was one */
|
||||
err = ResolveAliasFile(&fileSpec, true, &tempUnusedBool,
|
||||
&tempUnusedBool);
|
||||
if (err != noErr) {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
/* Finally, try to load the library */
|
||||
err = GetDiskFragment(&fileSpec, 0, kCFragGoesToEOF, fileSpec.name,
|
||||
kLoadCFrag, &lm->connection, &lm->main, errName);
|
||||
|
||||
if (err == noErr && lm->connection) {
|
||||
/*
|
||||
* if we're a mach-o binary, need to wrap all CFM function
|
||||
* pointers. need a hash-table of already seen function
|
||||
* pointers, etc.
|
||||
*/
|
||||
lm->wrappers = CFDictionaryCreateMutable(NULL, 16,
|
||||
&kCFTypeDictionaryKeyCallBacks,
|
||||
&kCFTypeDictionaryValueCallBacks);
|
||||
if (lm->wrappers) {
|
||||
lm->main = TV2FP(lm->wrappers, "main", lm->main);
|
||||
} else {
|
||||
err = memFullErr;
|
||||
}
|
||||
}
|
||||
return (err == noErr) ? PR_SUCCESS : PR_FAILURE;
|
||||
}
|
||||
#endif /* __ppc__ */
|
||||
|
||||
/*
|
||||
** Creates a CFBundleRef if the pathname refers to a Mac OS X bundle
|
||||
** directory. The caller is responsible for calling CFRelease() to
|
||||
** deallocate.
|
||||
*/
|
||||
|
||||
static PRStatus
|
||||
pr_LoadCFBundle(const char *name, PRLibrary *lm)
|
||||
{
|
||||
CFURLRef bundleURL;
|
||||
CFBundleRef bundle = NULL;
|
||||
char pathBuf[PATH_MAX];
|
||||
const char *resolvedPath;
|
||||
CFStringRef pathRef;
|
||||
|
||||
/* Takes care of relative paths and symlinks */
|
||||
resolvedPath = realpath(name, pathBuf);
|
||||
if (!resolvedPath) {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
pathRef = CFStringCreateWithCString(NULL, pathBuf, kCFStringEncodingUTF8);
|
||||
if (pathRef) {
|
||||
bundleURL = CFURLCreateWithFileSystemPath(NULL, pathRef,
|
||||
kCFURLPOSIXPathStyle, true);
|
||||
if (bundleURL) {
|
||||
bundle = CFBundleCreate(NULL, bundleURL);
|
||||
CFRelease(bundleURL);
|
||||
}
|
||||
CFRelease(pathRef);
|
||||
}
|
||||
|
||||
lm->bundle = bundle;
|
||||
return (bundle != NULL) ? PR_SUCCESS : PR_FAILURE;
|
||||
}
|
||||
|
||||
static PRStatus
|
||||
pr_LoadViaDyld(const char *name, PRLibrary *lm)
|
||||
{
|
||||
lm->dlh = pr_LoadMachDyldModule(name);
|
||||
if (lm->dlh == NULL) {
|
||||
lm->image = NSAddImage(name, NSADDIMAGE_OPTION_RETURN_ON_ERROR
|
||||
| NSADDIMAGE_OPTION_WITH_SEARCHING);
|
||||
if (lm->image == NULL) {
|
||||
NSLinkEditErrors linkEditError;
|
||||
int errorNum;
|
||||
const char *fileName;
|
||||
const char *errorString;
|
||||
NSLinkEditError(&linkEditError, &errorNum, &fileName, &errorString);
|
||||
PR_LOG(_pr_linker_lm, PR_LOG_MIN,
|
||||
("LoadMachDyldModule error %d:%d for file %s:\n%s",
|
||||
linkEditError, errorNum, fileName, errorString));
|
||||
}
|
||||
}
|
||||
return (lm->dlh != NULL || lm->image != NULL) ? PR_SUCCESS : PR_FAILURE;
|
||||
}
|
||||
|
||||
#endif /* XP_MACOSX && USE_MACH_DYLD */
|
||||
|
||||
/*
|
||||
** Dynamically load a library. Only load libraries once, so scan the load
|
||||
** map first.
|
||||
@@ -733,36 +518,7 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags)
|
||||
}
|
||||
#endif /* WIN32 */
|
||||
|
||||
#if defined(XP_MACOSX) && defined(USE_MACH_DYLD)
|
||||
{
|
||||
int i;
|
||||
PRStatus status;
|
||||
|
||||
static const macLibraryLoadProc loadProcs[] = {
|
||||
#ifdef __ppc__
|
||||
pr_LoadViaDyld, pr_LoadCFBundle, pr_LoadViaCFM
|
||||
#else /* __ppc__ */
|
||||
pr_LoadViaDyld, pr_LoadCFBundle
|
||||
#endif /* __ppc__ */
|
||||
};
|
||||
|
||||
for (i = 0; i < sizeof(loadProcs) / sizeof(loadProcs[0]); i++) {
|
||||
if ((status = loadProcs[i](name, lm)) == PR_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (status != PR_SUCCESS) {
|
||||
oserr = cfragNoLibraryErr;
|
||||
PR_DELETE(lm);
|
||||
goto unlock;
|
||||
}
|
||||
lm->name = strdup(name);
|
||||
lm->next = pr_loadmap;
|
||||
pr_loadmap = lm;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(XP_UNIX) && !(defined(XP_MACOSX) && defined(USE_MACH_DYLD))
|
||||
#if defined(XP_UNIX)
|
||||
#ifdef HAVE_DLL
|
||||
{
|
||||
#if defined(USE_DLFCN)
|
||||
@@ -793,37 +549,37 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags)
|
||||
dl_flags |= RTLD_LOCAL;
|
||||
}
|
||||
#if defined(DARWIN)
|
||||
/* If the file contains an absolute or relative path (slash)
|
||||
* and the path doesn't look like a System path, then require
|
||||
* the file exists.
|
||||
* The reason is that DARWIN's dlopen ignores the provided path
|
||||
* and checks for the plain filename in DYLD_LIBRARY_PATH,
|
||||
* which could load an unexpected version of a library. */
|
||||
if (strchr(name, PR_DIRECTORY_SEPARATOR) == NULL) {
|
||||
/* no slash, allow to load from any location */
|
||||
okToLoad = PR_TRUE;
|
||||
} else {
|
||||
const char systemPrefix1[] = "/System/";
|
||||
const size_t systemPrefixLen1 = strlen(systemPrefix1);
|
||||
const char systemPrefix2[] = "/usr/lib/";
|
||||
const size_t systemPrefixLen2 = strlen(systemPrefix2);
|
||||
const name_len = strlen(name);
|
||||
if (((name_len > systemPrefixLen1) &&
|
||||
(strncmp(name, systemPrefix1, systemPrefixLen1) == 0)) ||
|
||||
((name_len > systemPrefixLen2) &&
|
||||
(strncmp(name, systemPrefix2, systemPrefixLen2) == 0))) {
|
||||
/* found at beginning, it's a system library.
|
||||
* Skip filesystem check (required for macOS 11),
|
||||
* allow loading from any location */
|
||||
okToLoad = PR_TRUE;
|
||||
} else if (PR_Access(name, PR_ACCESS_EXISTS) == PR_SUCCESS) {
|
||||
/* file exists, allow to load */
|
||||
okToLoad = PR_TRUE;
|
||||
}
|
||||
}
|
||||
if (okToLoad) {
|
||||
h = dlopen(name, dl_flags);
|
||||
}
|
||||
/* If the file contains an absolute or relative path (slash)
|
||||
* and the path doesn't look like a System path, then require
|
||||
* the file exists.
|
||||
* The reason is that DARWIN's dlopen ignores the provided path
|
||||
* and checks for the plain filename in DYLD_LIBRARY_PATH,
|
||||
* which could load an unexpected version of a library. */
|
||||
if (strchr(name, PR_DIRECTORY_SEPARATOR) == NULL) {
|
||||
/* no slash, allow to load from any location */
|
||||
okToLoad = PR_TRUE;
|
||||
} else {
|
||||
const char systemPrefix1[] = "/System/";
|
||||
const size_t systemPrefixLen1 = strlen(systemPrefix1);
|
||||
const char systemPrefix2[] = "/usr/lib/";
|
||||
const size_t systemPrefixLen2 = strlen(systemPrefix2);
|
||||
const size_t name_len = strlen(name);
|
||||
if (((name_len > systemPrefixLen1) &&
|
||||
(strncmp(name, systemPrefix1, systemPrefixLen1) == 0)) ||
|
||||
((name_len > systemPrefixLen2) &&
|
||||
(strncmp(name, systemPrefix2, systemPrefixLen2) == 0))) {
|
||||
/* found at beginning, it's a system library.
|
||||
* Skip filesystem check (required for macOS 11),
|
||||
* allow loading from any location */
|
||||
okToLoad = PR_TRUE;
|
||||
} else if (PR_Access(name, PR_ACCESS_EXISTS) == PR_SUCCESS) {
|
||||
/* file exists, allow to load */
|
||||
okToLoad = PR_TRUE;
|
||||
}
|
||||
}
|
||||
if (okToLoad) {
|
||||
h = dlopen(name, dl_flags);
|
||||
}
|
||||
#else
|
||||
h = dlopen(name, dl_flags);
|
||||
#endif
|
||||
@@ -847,8 +603,6 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags)
|
||||
}
|
||||
/* No equivalent of PR_LD_GLOBAL and PR_LD_LOCAL. */
|
||||
h = shl_load(name, shl_flags, 0L);
|
||||
#elif defined(USE_MACH_DYLD)
|
||||
NSModule h = pr_LoadMachDyldModule(name);
|
||||
#else
|
||||
#error Configuration error
|
||||
#endif
|
||||
@@ -863,7 +617,7 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags)
|
||||
pr_loadmap = lm;
|
||||
}
|
||||
#endif /* HAVE_DLL */
|
||||
#endif /* XP_UNIX && !(XP_MACOSX && USE_MACH_DYLD) */
|
||||
#endif /* XP_UNIX */
|
||||
|
||||
lm->refCount = 1;
|
||||
|
||||
@@ -922,10 +676,6 @@ PR_UnloadLibrary(PRLibrary *lib)
|
||||
result = dlclose(lib->dlh);
|
||||
#elif defined(USE_HPSHL)
|
||||
result = shl_unload(lib->dlh);
|
||||
#elif defined(USE_MACH_DYLD)
|
||||
if (lib->dlh) {
|
||||
result = NSUnLinkModule(lib->dlh, NSUNLINKMODULE_OPTION_NONE) ? 0 : -1;
|
||||
}
|
||||
#else
|
||||
#error Configuration error
|
||||
#endif
|
||||
@@ -938,20 +688,6 @@ PR_UnloadLibrary(PRLibrary *lib)
|
||||
}
|
||||
#endif /* XP_PC */
|
||||
|
||||
#if defined(XP_MACOSX) && defined(USE_MACH_DYLD)
|
||||
/* Close the connection */
|
||||
if (lib->connection) {
|
||||
CloseConnection(&(lib->connection));
|
||||
}
|
||||
if (lib->bundle) {
|
||||
CFRelease(lib->bundle);
|
||||
}
|
||||
if (lib->wrappers) {
|
||||
CFRelease(lib->wrappers);
|
||||
}
|
||||
/* No way to unload an image (lib->image) */
|
||||
#endif
|
||||
|
||||
/* unlink from library search list */
|
||||
if (pr_loadmap == lib) {
|
||||
pr_loadmap = pr_loadmap->next;
|
||||
@@ -1041,53 +777,6 @@ pr_FindSymbolInLib(PRLibrary *lm, const char *name)
|
||||
f = GetProcAddress(lm->dlh, name);
|
||||
#endif /* WIN32 */
|
||||
|
||||
#if defined(XP_MACOSX) && defined(USE_MACH_DYLD)
|
||||
/* add this offset to skip the leading underscore in name */
|
||||
#define SYM_OFFSET 1
|
||||
if (lm->bundle) {
|
||||
CFStringRef nameRef = CFStringCreateWithCString(NULL, name + SYM_OFFSET, kCFStringEncodingASCII);
|
||||
if (nameRef) {
|
||||
f = CFBundleGetFunctionPointerForName(lm->bundle, nameRef);
|
||||
CFRelease(nameRef);
|
||||
}
|
||||
}
|
||||
if (lm->connection) {
|
||||
Ptr symAddr;
|
||||
CFragSymbolClass symClass;
|
||||
Str255 pName;
|
||||
|
||||
PR_LOG(_pr_linker_lm, PR_LOG_MIN, ("Looking up symbol: %s", name + SYM_OFFSET));
|
||||
|
||||
c2pstrcpy(pName, name + SYM_OFFSET);
|
||||
|
||||
f = (FindSymbol(lm->connection, pName, &symAddr, &symClass) == noErr) ? symAddr : NULL;
|
||||
|
||||
#ifdef __ppc__
|
||||
/* callers expect mach-o function pointers, so must wrap tvectors with glue. */
|
||||
if (f && symClass == kTVectorCFragSymbol) {
|
||||
f = TV2FP(lm->wrappers, name + SYM_OFFSET, f);
|
||||
}
|
||||
#endif /* __ppc__ */
|
||||
|
||||
if (f == NULL && strcmp(name + SYM_OFFSET, "main") == 0) {
|
||||
f = lm->main;
|
||||
}
|
||||
}
|
||||
if (lm->image) {
|
||||
NSSymbol symbol;
|
||||
symbol = NSLookupSymbolInImage(lm->image, name,
|
||||
NSLOOKUPSYMBOLINIMAGE_OPTION_BIND
|
||||
| NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR);
|
||||
if (symbol != NULL) {
|
||||
f = NSAddressOfSymbol(symbol);
|
||||
}
|
||||
else {
|
||||
f = NULL;
|
||||
}
|
||||
}
|
||||
#undef SYM_OFFSET
|
||||
#endif /* XP_MACOSX && USE_MACH_DYLD */
|
||||
|
||||
#ifdef XP_UNIX
|
||||
#ifdef HAVE_DLL
|
||||
#ifdef USE_DLFCN
|
||||
@@ -1096,17 +785,6 @@ pr_FindSymbolInLib(PRLibrary *lm, const char *name)
|
||||
if (shl_findsym(&lm->dlh, name, TYPE_PROCEDURE, &f) == -1) {
|
||||
f = NULL;
|
||||
}
|
||||
#elif defined(USE_MACH_DYLD)
|
||||
if (lm->dlh) {
|
||||
NSSymbol symbol;
|
||||
symbol = NSLookupSymbolInModule(lm->dlh, name);
|
||||
if (symbol != NULL) {
|
||||
f = NSAddressOfSymbol(symbol);
|
||||
}
|
||||
else {
|
||||
f = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* HAVE_DLL */
|
||||
#endif /* XP_UNIX */
|
||||
@@ -1289,23 +967,6 @@ PR_GetLibraryFilePathname(const char *name, PRFuncPtr addr)
|
||||
strcpy(result, dli.dli_fname);
|
||||
}
|
||||
return result;
|
||||
#elif defined(USE_MACH_DYLD)
|
||||
char *result;
|
||||
const char *image_name;
|
||||
int i, count = _dyld_image_count();
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
image_name = _dyld_get_image_name(i);
|
||||
if (strstr(image_name, name) != NULL) {
|
||||
result = PR_Malloc(strlen(image_name)+1);
|
||||
if (result != NULL) {
|
||||
strcpy(result, image_name);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
PR_SetError(PR_LIBRARY_NOT_LOADED_ERROR, 0);
|
||||
return NULL;
|
||||
#elif defined(AIX)
|
||||
char *result;
|
||||
#define LD_INFO_INCREMENT 64
|
||||
|
||||
@@ -68,4 +68,4 @@ _PR_ia64_AtomicSet:
|
||||
.endp _PR_ia64_AtomicSet#
|
||||
|
||||
// Magic indicating no need for an executable stack
|
||||
.section .note.GNU-stack, "", @progbits ; .previous
|
||||
.section .note.GNU-stack, "", @progbits
|
||||
@@ -72,4 +72,4 @@ _PR_ppc_AtomicAdd:
|
||||
.Lfe4: .size _PR_ppc_AtomicAdd,.Lfe4-_PR_ppc_AtomicAdd
|
||||
|
||||
# Magic indicating no need for an executable stack
|
||||
.section .note.GNU-stack, "", @progbits ; .previous
|
||||
.section .note.GNU-stack, "", @progbits
|
||||
@@ -82,4 +82,4 @@ _PR_x86_AtomicAdd:
|
||||
ret
|
||||
|
||||
// Magic indicating no need for an executable stack
|
||||
.section .note.GNU-stack, "", @progbits ; .previous
|
||||
.section .note.GNU-stack, "", @progbits
|
||||
@@ -71,4 +71,4 @@ _PR_x86_64_AtomicAdd:
|
||||
.size _PR_x86_64_AtomicAdd, .-_PR_x86_64_AtomicAdd
|
||||
|
||||
// Magic indicating no need for an executable stack
|
||||
.section .note.GNU-stack, "", @progbits ; .previous
|
||||
.section .note.GNU-stack, "", @progbits
|
||||
@@ -2755,8 +2755,8 @@ static void _PR_InitIOV(void)
|
||||
_md_iovector._mmap64 = mmap64;
|
||||
#if (defined(ANDROID) && __ANDROID_API__ < 21)
|
||||
/* Same as the open64 case for Android. */
|
||||
_md_iovector._fstat64 = fstat;
|
||||
_md_iovector._stat64 = stat;
|
||||
_md_iovector._fstat64 = (_MD_Fstat64)fstat;
|
||||
_md_iovector._stat64 = (_MD_Stat64)stat;
|
||||
#else
|
||||
_md_iovector._fstat64 = fstat64;
|
||||
_md_iovector._stat64 = stat64;
|
||||
@@ -3301,36 +3301,21 @@ int _MD_unix_get_nonblocking_connect_error(int osfd)
|
||||
** in a pre-emptive threaded environment, we need to use a lock.
|
||||
*/
|
||||
|
||||
void PR_XLock(void)
|
||||
void _PR_XLock(void)
|
||||
{
|
||||
PR_EnterMonitor(_pr_Xfe_mon);
|
||||
}
|
||||
|
||||
void PR_XUnlock(void)
|
||||
void _PR_XUnlock(void)
|
||||
{
|
||||
PR_ExitMonitor(_pr_Xfe_mon);
|
||||
}
|
||||
|
||||
PRBool PR_XIsLocked(void)
|
||||
PRBool _PR_XIsLocked(void)
|
||||
{
|
||||
return (PR_InMonitor(_pr_Xfe_mon)) ? PR_TRUE : PR_FALSE;
|
||||
}
|
||||
|
||||
void PR_XWait(int ms)
|
||||
{
|
||||
PR_Wait(_pr_Xfe_mon, PR_MillisecondsToInterval(ms));
|
||||
}
|
||||
|
||||
void PR_XNotify(void)
|
||||
{
|
||||
PR_Notify(_pr_Xfe_mon);
|
||||
}
|
||||
|
||||
void PR_XNotifyAll(void)
|
||||
{
|
||||
PR_NotifyAll(_pr_Xfe_mon);
|
||||
}
|
||||
|
||||
#if defined(HAVE_FCNTL_FILE_LOCKING)
|
||||
|
||||
PRStatus
|
||||
@@ -3481,7 +3466,8 @@ PRStatus _MD_getsysinfo(PRSysInfo cmd, char *name, PRUint32 namelen)
|
||||
{
|
||||
struct utsname info;
|
||||
|
||||
PR_ASSERT((cmd == PR_SI_SYSNAME) || (cmd == PR_SI_RELEASE));
|
||||
PR_ASSERT((cmd == PR_SI_SYSNAME) || (cmd == PR_SI_RELEASE) ||
|
||||
(cmd == PR_SI_RELEASE_BUILD));
|
||||
|
||||
if (uname(&info) == -1) {
|
||||
_PR_MD_MAP_DEFAULT_ERROR(errno);
|
||||
@@ -3493,6 +3479,9 @@ PRStatus _MD_getsysinfo(PRSysInfo cmd, char *name, PRUint32 namelen)
|
||||
else if (PR_SI_RELEASE == cmd) {
|
||||
(void)PR_snprintf(name, namelen, info.release);
|
||||
}
|
||||
else if (PR_SI_RELEASE_BUILD == cmd) {
|
||||
(void)PR_snprintf(name, namelen, info.version);
|
||||
}
|
||||
else {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
@@ -3652,7 +3641,8 @@ int poll(struct pollfd *filedes, unsigned long nfds, int timeout)
|
||||
int events = filedes[i].events;
|
||||
PRBool fdHasEvent = PR_FALSE;
|
||||
|
||||
if (osfd < 0) {
|
||||
PR_ASSERT(osfd < FD_SETSIZE);
|
||||
if (osfd < 0 || osfd >= FD_SETSIZE) {
|
||||
continue; /* Skip this osfd. */
|
||||
}
|
||||
|
||||
@@ -3697,6 +3687,10 @@ int poll(struct pollfd *filedes, unsigned long nfds, int timeout)
|
||||
if (filedes[i].fd < 0) {
|
||||
continue;
|
||||
}
|
||||
if (filedes[i].fd >= FD_SETSIZE) {
|
||||
filedes[i].revents |= POLLNVAL;
|
||||
continue;
|
||||
}
|
||||
if (FD_ISSET(filedes[i].fd, &rd)) {
|
||||
if (filedes[i].events & POLLIN) {
|
||||
filedes[i].revents |= POLLIN;
|
||||
|
||||
@@ -187,10 +187,10 @@ int select(int width, fd_set *rd, fd_set *wr, fd_set *ex, struct timeval *tv)
|
||||
|
||||
needToLockXAgain = 0;
|
||||
if (rd && (_pr_xt_hack_fd != -1)
|
||||
&& FD_ISSET(_pr_xt_hack_fd, rd) && PR_XIsLocked()
|
||||
&& FD_ISSET(_pr_xt_hack_fd, rd) && _PR_XIsLocked()
|
||||
&& (!_pr_xt_hack_okayToReleaseXLock
|
||||
|| _pr_xt_hack_okayToReleaseXLock())) {
|
||||
PR_XUnlock();
|
||||
_PR_XUnlock();
|
||||
needToLockXAgain = 1;
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ int select(int width, fd_set *rd, fd_set *wr, fd_set *ex, struct timeval *tv)
|
||||
retVal = _PR_WaitForMultipleFDs(unixpds, pdcnt, timeout);
|
||||
|
||||
if (needToLockXAgain) {
|
||||
PR_XLock();
|
||||
_PR_XLock();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -812,7 +812,8 @@ PRStatus _MD_WindowsGetSysInfo(PRSysInfo cmd, char *name, PRUint32 namelen)
|
||||
{
|
||||
OSVERSIONINFO osvi;
|
||||
|
||||
PR_ASSERT((cmd == PR_SI_SYSNAME) || (cmd == PR_SI_RELEASE));
|
||||
PR_ASSERT((cmd == PR_SI_SYSNAME) || (cmd == PR_SI_RELEASE) ||
|
||||
(cmd == PR_SI_RELEASE_BUILD));
|
||||
|
||||
ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
|
||||
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||
@@ -827,9 +828,13 @@ PRStatus _MD_WindowsGetSysInfo(PRSysInfo cmd, char *name, PRUint32 namelen)
|
||||
if (PR_SI_SYSNAME == cmd) {
|
||||
(void)PR_snprintf(name, namelen, "Windows_NT");
|
||||
}
|
||||
else if (PR_SI_RELEASE == cmd)
|
||||
else if (PR_SI_RELEASE == cmd) {
|
||||
(void)PR_snprintf(name, namelen, "%d.%d",osvi.dwMajorVersion,
|
||||
osvi.dwMinorVersion);
|
||||
}
|
||||
else if (PR_SI_RELEASE_BUILD == cmd) {
|
||||
(void)PR_snprintf(name, namelen, "%d", osvi.dwBuildNumber);
|
||||
}
|
||||
break;
|
||||
case VER_PLATFORM_WIN32_WINDOWS:
|
||||
if (PR_SI_SYSNAME == cmd) {
|
||||
@@ -843,6 +848,8 @@ PRStatus _MD_WindowsGetSysInfo(PRSysInfo cmd, char *name, PRUint32 namelen)
|
||||
} else if (PR_SI_RELEASE == cmd) {
|
||||
(void)PR_snprintf(name, namelen, "%d.%d",osvi.dwMajorVersion,
|
||||
osvi.dwMinorVersion);
|
||||
} else if (PR_SI_RELEASE_BUILD == cmd) {
|
||||
(void)PR_snprintf(name, namelen, "%d", osvi.dwBuildNumber);
|
||||
}
|
||||
break;
|
||||
#ifdef VER_PLATFORM_WIN32_CE
|
||||
@@ -850,9 +857,15 @@ PRStatus _MD_WindowsGetSysInfo(PRSysInfo cmd, char *name, PRUint32 namelen)
|
||||
if (PR_SI_SYSNAME == cmd) {
|
||||
(void)PR_snprintf(name, namelen, "Windows_CE");
|
||||
}
|
||||
else if (PR_SI_RELEASE == cmd)
|
||||
else if (PR_SI_RELEASE == cmd) {
|
||||
(void)PR_snprintf(name, namelen, "%d.%d",osvi.dwMajorVersion,
|
||||
osvi.dwMinorVersion);
|
||||
}
|
||||
else if (PR_SI_RELEASE_BUILD == cmd) {
|
||||
if (namelen) {
|
||||
*name = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
@@ -862,6 +875,11 @@ PRStatus _MD_WindowsGetSysInfo(PRSysInfo cmd, char *name, PRUint32 namelen)
|
||||
else if (PR_SI_RELEASE == cmd) {
|
||||
(void)PR_snprintf(name, namelen, "%d.%d",0,0);
|
||||
}
|
||||
else if (PR_SI_RELEASE_BUILD == cmd) {
|
||||
if (namelen) {
|
||||
*name = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return PR_SUCCESS;
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined(_WIN64)
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
#include "primpl.h"
|
||||
|
||||
#define READ_FD 1
|
||||
@@ -488,7 +491,7 @@ _PR_MD_TCPSENDTO(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags,
|
||||
if ( rv < 0 ) {
|
||||
return -1;
|
||||
}
|
||||
rv = GetOverlappedResult(osfd, &fd->secret->ol, &rvSent, FALSE);
|
||||
rv = GetOverlappedResult((HANDLE)osfd, &fd->secret->ol, &rvSent, FALSE);
|
||||
if ( rv == TRUE ) {
|
||||
return rvSent;
|
||||
} else {
|
||||
|
||||
@@ -304,17 +304,6 @@ static double private_mem[PRIVATE_mem], *pmem_next = private_mem;
|
||||
|
||||
#else /* ifndef Bad_float_h */
|
||||
#include "float.h"
|
||||
/*
|
||||
* MacOS 10.2 defines the macro FLT_ROUNDS to an internal function
|
||||
* which does not exist on 10.1. We can safely #define it to 1 here
|
||||
* to allow 10.2 builds to run on 10.1, since we can't use fesetround()
|
||||
* (which does not exist on 10.1 either).
|
||||
*/
|
||||
#if defined(XP_MACOSX) && (!defined(MAC_OS_X_VERSION_10_2) || \
|
||||
MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_2)
|
||||
#undef FLT_ROUNDS
|
||||
#define FLT_ROUNDS 1
|
||||
#endif /* DT < 10.2 */
|
||||
#endif /* Bad_float_h */
|
||||
|
||||
#ifndef __MATH_H__
|
||||
|
||||
@@ -166,9 +166,7 @@ static PRBool _pr_have_inet6_if = PR_FALSE;
|
||||
#undef DEBUG_QUERY_IFS
|
||||
|
||||
#if defined(AIX) \
|
||||
|| (defined(DARWIN) && (!defined(HAVE_GETIFADDRS) \
|
||||
|| (defined(XP_MACOSX) && (!defined(MAC_OS_X_VERSION_10_2) || \
|
||||
MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_2))))
|
||||
|| (defined(DARWIN) && !defined(HAVE_GETIFADDRS))
|
||||
|
||||
/*
|
||||
* Use SIOCGIFCONF ioctl on platforms that don't have routing
|
||||
@@ -1250,7 +1248,7 @@ PR_IMPLEMENT(PRStatus) PR_GetProtoByName(
|
||||
}
|
||||
#endif /* defined(_PR_HAVE_GETPROTO_R_INT) */
|
||||
|
||||
if (PR_NETDB_BUF_SIZE > buflen)
|
||||
if (PR_MIN_NETDB_BUF_SIZE > buflen)
|
||||
{
|
||||
PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
|
||||
return PR_FAILURE;
|
||||
@@ -1333,7 +1331,7 @@ PR_IMPLEMENT(PRStatus) PR_GetProtoByNumber(
|
||||
}
|
||||
#endif /* defined(_PR_HAVE_GETPROTO_R_INT) */
|
||||
|
||||
if (PR_NETDB_BUF_SIZE > buflen)
|
||||
if (PR_MIN_NETDB_BUF_SIZE > buflen)
|
||||
{
|
||||
PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
|
||||
return PR_FAILURE;
|
||||
@@ -2180,6 +2178,73 @@ PR_IMPLEMENT(PRAddrInfo *) PR_GetAddrInfoByName(const char *hostname,
|
||||
#endif
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PRStatus)
|
||||
PR_GetPrefLoopbackAddrInfo(PRNetAddr *result,
|
||||
PRUint16 port)
|
||||
{
|
||||
char tmpBuf[ 40 ];
|
||||
const int tmpBufSize = sizeof( tmpBuf );
|
||||
|
||||
if (!result) {
|
||||
PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
if (!_pr_initialized) _PR_ImplicitInitialization();
|
||||
|
||||
PR_snprintf(tmpBuf, tmpBufSize, "%u", port );
|
||||
|
||||
#if !defined(_PR_HAVE_GETADDRINFO) || !defined(AI_PASSIVE)
|
||||
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
|
||||
return PR_FAILURE;
|
||||
#else
|
||||
|
||||
PRADDRINFO *res, hints;
|
||||
PRStatus rv;
|
||||
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
|
||||
rv = GETADDRINFO(NULL, tmpBuf, &hints, &res);
|
||||
if (rv == 0) {
|
||||
PRBool result_still_empty = PR_TRUE;
|
||||
PRADDRINFO *ai = res;
|
||||
do {
|
||||
PRNetAddr aNetAddr;
|
||||
|
||||
while (ai && ai->ai_addrlen > sizeof(PRNetAddr))
|
||||
ai = ai->ai_next;
|
||||
|
||||
if (ai) {
|
||||
/* copy sockaddr to PRNetAddr */
|
||||
memcpy(&aNetAddr, ai->ai_addr, ai->ai_addrlen);
|
||||
aNetAddr.raw.family = ai->ai_addr->sa_family;
|
||||
#ifdef _PR_INET6
|
||||
if (AF_INET6 == aNetAddr.raw.family)
|
||||
aNetAddr.raw.family = PR_AF_INET6;
|
||||
#endif
|
||||
if (ai->ai_addrlen < sizeof(PRNetAddr))
|
||||
memset(((char*)result)+ai->ai_addrlen, 0,
|
||||
sizeof(PRNetAddr) - ai->ai_addrlen);
|
||||
}
|
||||
|
||||
/* If we obtain more than one result, prefer IPv6. */
|
||||
if (result_still_empty || aNetAddr.raw.family == PR_AF_INET6) {
|
||||
memcpy(result, &aNetAddr, sizeof(PRNetAddr));
|
||||
}
|
||||
result_still_empty = PR_FALSE;
|
||||
ai = ai->ai_next;
|
||||
}
|
||||
while (ai);
|
||||
|
||||
FREEADDRINFO(res);
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
PR_SetError(PR_DIRECTORY_LOOKUP_ERROR, rv);
|
||||
return PR_FAILURE;
|
||||
#endif
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(void) PR_FreeAddrInfo(PRAddrInfo *ai)
|
||||
{
|
||||
#if defined(_PR_HAVE_GETADDRINFO)
|
||||
|
||||
@@ -152,6 +152,19 @@ PR_IMPLEMENT(PRStatus) PR_GetSystemInfo(PRSysInfo cmd, char *buf, PRUint32 bufle
|
||||
#endif /* OS2 */
|
||||
break;
|
||||
|
||||
case PR_SI_RELEASE_BUILD:
|
||||
/* Return the version of the operating system */
|
||||
#if defined(XP_UNIX) || defined(WIN32)
|
||||
if (PR_FAILURE == _PR_MD_GETSYSINFO(cmd, buf, (PRUintn)buflen)) {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
#else
|
||||
if (buflen) {
|
||||
*buf = 0;
|
||||
}
|
||||
#endif /* XP_UNIX || WIN32 */
|
||||
break;
|
||||
|
||||
case PR_SI_ARCHITECTURE:
|
||||
/* Return the architecture of the machine (ie. x86, mips, alpha, ...)*/
|
||||
(void)PR_snprintf(buf, buflen, _PR_SI_ARCHITECTURE);
|
||||
@@ -193,7 +206,11 @@ PR_IMPLEMENT(PRInt32) PR_GetNumberOfProcessors( void )
|
||||
size_t len = sizeof(numCpus);
|
||||
|
||||
mib[0] = CTL_HW;
|
||||
#ifdef HW_NCPUONLINE
|
||||
mib[1] = HW_NCPUONLINE;
|
||||
#else
|
||||
mib[1] = HW_NCPU;
|
||||
#endif
|
||||
rc = sysctl( mib, 2, &numCpus, &len, NULL, 0 );
|
||||
if ( -1 == rc ) {
|
||||
numCpus = -1; /* set to -1 for return value on error */
|
||||
|
||||
@@ -462,3 +462,7 @@ EXPORTS ;-
|
||||
PR_DuplicateEnvironment;
|
||||
PR_GetEnvSecure;
|
||||
;+} NSPR_4.10.3;
|
||||
;+NSPR_4.34 {
|
||||
;+ global:
|
||||
PR_GetPrefLoopbackAddrInfo;
|
||||
;+} NSPR_4.12;
|
||||
@@ -155,6 +155,15 @@ static ssize_t (*pt_aix_sendfile_fptr)() = NULL;
|
||||
|
||||
#include "primpl.h"
|
||||
|
||||
#if defined(LINUX) || defined(ANDROID)
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#ifdef DARWIN
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/ip.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NETINET_TCP_H
|
||||
#include <netinet/tcp.h> /* TCP_NODELAY, TCP_MAXSEG */
|
||||
#endif
|
||||
@@ -3146,6 +3155,25 @@ static PRStatus pt_GetSocketOption(PRFileDesc *fd, PRSocketOptionData *data)
|
||||
|| (sizeof(data->value.mcast_if.inet.ip) == length));
|
||||
break;
|
||||
}
|
||||
case PR_SockOpt_DontFrag:
|
||||
{
|
||||
#if !defined(DARWIN) && !defined(LINUX) && !defined(ANDROID)
|
||||
PR_SetError(PR_OPERATION_NOT_SUPPORTED_ERROR, 0);
|
||||
rv = PR_FAILURE;
|
||||
#else
|
||||
PRIntn value;
|
||||
length = sizeof(value);
|
||||
rv = getsockopt(
|
||||
fd->secret->md.osfd, level, name, (char*)&value,
|
||||
&length);
|
||||
#if defined(DARWIN)
|
||||
data->value.dont_fragment = value;
|
||||
#else
|
||||
data->value.dont_fragment = (value == IP_PMTUDISC_DO) ? 1 : 0;
|
||||
#endif
|
||||
#endif /* !(!defined(DARWIN) && !defined(LINUX) && !defined(ANDROID)) */
|
||||
break;
|
||||
}
|
||||
default:
|
||||
PR_NOT_REACHED("Unknown socket option");
|
||||
break;
|
||||
@@ -3259,6 +3287,25 @@ static PRStatus pt_SetSocketOption(PRFileDesc *fd, const PRSocketOptionData *dat
|
||||
sizeof(data->value.mcast_if.inet.ip));
|
||||
break;
|
||||
}
|
||||
case PR_SockOpt_DontFrag:
|
||||
{
|
||||
#if !defined(DARWIN) && !defined(LINUX) && !defined(ANDROID)
|
||||
PR_SetError(PR_OPERATION_NOT_SUPPORTED_ERROR, 0);
|
||||
rv = PR_FAILURE;
|
||||
#else
|
||||
PRIntn value;
|
||||
#if defined(LINUX) || defined(ANDROID)
|
||||
value = (data->value.dont_fragment) ? IP_PMTUDISC_DO
|
||||
: IP_PMTUDISC_DONT;
|
||||
#elif defined(DARWIN)
|
||||
value = data->value.dont_fragment;
|
||||
#endif
|
||||
rv = setsockopt(
|
||||
fd->secret->md.osfd, level, name, (char*)&value,
|
||||
sizeof(value));
|
||||
#endif /* !defined(DARWIN) && !defined(LINUX) && !defined(ANDROID)) */
|
||||
break;
|
||||
}
|
||||
default:
|
||||
PR_NOT_REACHED("Unknown socket option");
|
||||
break;
|
||||
|
||||
@@ -1694,13 +1694,20 @@ PR_IMPLEMENT(PRStatus) PR_SetCurrentThreadName(const char *name)
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
#if defined(DARWIN)
|
||||
/* Mac OS X has a length limit of 63 characters, but there is no API
|
||||
* exposing it.
|
||||
*/
|
||||
#define SETNAME_LENGTH_CONSTRAINT 63
|
||||
#else
|
||||
/*
|
||||
* The 15-character name length limit is an experimentally determined
|
||||
* length of a null-terminated string that most linux distros and OS X
|
||||
* accept as an argument to pthread_setname_np. Otherwise the E2BIG
|
||||
* length of a null-terminated string that most linux distros accept
|
||||
* as an argument to pthread_setname_np. Otherwise the E2BIG
|
||||
* error is returned by the function.
|
||||
*/
|
||||
#define SETNAME_LENGTH_CONSTRAINT 15
|
||||
#endif
|
||||
#define SETNAME_FRAGMENT1_LENGTH (SETNAME_LENGTH_CONSTRAINT >> 1)
|
||||
#define SETNAME_FRAGMENT2_LENGTH \
|
||||
(SETNAME_LENGTH_CONSTRAINT - SETNAME_FRAGMENT1_LENGTH - 1)
|
||||
|
||||
@@ -211,6 +211,7 @@ ifdef NS_USE_GCC
|
||||
else
|
||||
EXTRA_LIBS += ws2_32.lib
|
||||
LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO
|
||||
CFLAGS += -Fd$(@:.$(OBJ_SUFFIX)=.pdb)
|
||||
ifdef PROFILE
|
||||
LDOPTS += -PROFILE -MAP
|
||||
endif # profile
|
||||
|
||||
@@ -16,6 +16,10 @@
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(XP_UNIX)
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#define PORT_INC_DO +100
|
||||
#else
|
||||
|
||||
@@ -61,6 +61,7 @@ int main(int argc, char **argv)
|
||||
"PR_SockOpt_MaxSegment", /* maximum segment size */
|
||||
"PR_SockOpt_Broadcast", /* Enable broadcast */
|
||||
"PR_SockOpt_Reuseport", /* allow local address & port reuse */
|
||||
"PR_SockOpt_DontFrag", /* do not fragment */
|
||||
"PR_SockOpt_Last"
|
||||
};
|
||||
|
||||
@@ -144,6 +145,10 @@ int main(int argc, char **argv)
|
||||
data.value.reuse_port = PR_TRUE;
|
||||
break;
|
||||
#endif
|
||||
case PR_SockOpt_DontFrag:
|
||||
data.value.dont_fragment = PR_TRUE;
|
||||
break;
|
||||
|
||||
default: continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,10 @@
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
#if defined(XP_UNIX)
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if defined(XP_OS2)
|
||||
#define INCL_DOSFILEMGR
|
||||
#include <os2.h>
|
||||
|
||||
@@ -41,7 +41,8 @@ static char *compatible_version[] = {
|
||||
"4.10.5", "4.10.6", "4.10.7", "4.10.8", "4.10.9",
|
||||
"4.10.10", "4.11", "4.12", "4.13", "4.14", "4.15",
|
||||
"4.16", "4.17", "4.18", "4.19", "4.20", "4.21", "4.22",
|
||||
"4.23", "4.24",
|
||||
"4.23", "4.24", "4.25", "4,26", "4.27", "4.28", "4.29",
|
||||
"4.30", "4.31", "4.32", "4.33", "4.34",
|
||||
PR_VERSION
|
||||
};
|
||||
|
||||
@@ -57,8 +58,8 @@ static char *incompatible_version[] = {
|
||||
"3.0", "3.0.1",
|
||||
"3.1", "3.1.1", "3.1.2", "3.1.3",
|
||||
"3.5", "3.5.1",
|
||||
"4.25.1",
|
||||
"4.26", "4.26.1",
|
||||
"4.35.1",
|
||||
"4.36", "4.36.1",
|
||||
"10.0", "11.1", "12.14.20"
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user