зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1562330 - Upgrade Firefox 70 to NSPR 4.22 beta1. r=me
UPGRADE_NSPR_RELEASE
This commit is contained in:
Родитель
b0e2e62ea6
Коммит
aae22c121f
|
@ -1 +1 @@
|
|||
NSPR_4_21_RTM
|
||||
NSPR_4_22_BETA1
|
||||
|
|
|
@ -26,14 +26,10 @@ mkdir HP-UXB.11.00_64_DBG.OBJ
|
|||
mkdir HP-UXB.11.00_64_OPT.OBJ
|
||||
mkdir HP-UXB.11.00_DBG.OBJ
|
||||
mkdir HP-UXB.11.00_OPT.OBJ
|
||||
mkdir IRIX6.5_n32_PTH_DBG.OBJ
|
||||
mkdir IRIX6.5_n32_PTH_OPT.OBJ
|
||||
mkdir Linux2.2_x86_glibc_PTH_DBG.OBJ
|
||||
mkdir Linux2.2_x86_glibc_PTH_OPT.OBJ
|
||||
mkdir Linux2.4_x86_glibc_PTH_DBG.OBJ
|
||||
mkdir Linux2.4_x86_glibc_PTH_OPT.OBJ
|
||||
mkdir OSF1V4.0D_DBG.OBJ
|
||||
mkdir OSF1V4.0D_OPT.OBJ
|
||||
mkdir SunOS5.6_DBG.OBJ
|
||||
mkdir SunOS5.6_OPT.OBJ
|
||||
mkdir SunOS5.7_64_DBG.OBJ
|
||||
|
|
|
@ -33,9 +33,6 @@ ln -s SunOS5.6_OPT.OBJ SunOS5.8_OPT.OBJ
|
|||
ln -s SunOS5.7_64_DBG.OBJ SunOS5.8_64_DBG.OBJ
|
||||
ln -s SunOS5.7_64_OPT.OBJ SunOS5.8_64_OPT.OBJ
|
||||
|
||||
ln -s OSF1V4.0D_DBG.OBJ OSF1V5.0_DBG.OBJ
|
||||
ln -s OSF1V4.0D_OPT.OBJ OSF1V5.0_OPT.OBJ
|
||||
|
||||
ln -s WINNT4.0_DBG.OBJ WINNT5.0_DBG.OBJ
|
||||
ln -s WINNT4.0_DBG.OBJD WINNT5.0_DBG.OBJD
|
||||
ln -s WINNT4.0_OPT.OBJ WINNT5.0_OPT.OBJ
|
||||
|
|
|
@ -48,22 +48,6 @@ ifeq (,$(filter-out QNX SCOOS UNIXWARE,$(OS_ARCH)))
|
|||
DEFINES += -DOMIT_LIB_BUILD_TIME
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH), IRIX)
|
||||
ifeq ($(basename $(OS_RELEASE)),6)
|
||||
ifndef NS_USE_GCC
|
||||
ifeq ($(USE_N32),1)
|
||||
XLDOPTS += -n32 -Wl,-woff,85
|
||||
else
|
||||
ifeq ($(USE_64),1)
|
||||
XLDOPTS += -64
|
||||
else
|
||||
XLDOPTS += -32
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH), HP-UX)
|
||||
ifeq ($(USE_64),1)
|
||||
XLDOPTS += +DD64
|
||||
|
@ -81,7 +65,7 @@ PROGS = $(OBJDIR)/now$(PROG_SUFFIX)
|
|||
ifeq (,$(CROSS_COMPILE)$(filter-out OS2 WINNT,$(OS_ARCH)))
|
||||
TARGETS = $(PROGS)
|
||||
else
|
||||
ifeq (,$(filter-out SYMBIAN WINCE,$(OS_ARCH)))
|
||||
ifeq (,$(filter-out WINCE,$(OS_ARCH)))
|
||||
TARGETS = $(PROGS)
|
||||
else
|
||||
PROGS += $(OBJDIR)/nsinstall$(PROG_SUFFIX)
|
||||
|
|
|
@ -140,7 +140,6 @@ endif
|
|||
|
||||
MACOS_SDK_DIR = @MACOS_SDK_DIR@
|
||||
|
||||
SYMBIAN_SDK_DIR = @SYMBIAN_SDK_DIR@
|
||||
|
||||
NEXT_ROOT = @NEXT_ROOT@
|
||||
ifdef NEXT_ROOT
|
||||
|
|
|
@ -30,9 +30,6 @@
|
|||
|
||||
#define HAVE_FCHMOD
|
||||
|
||||
#if defined(BEOS)
|
||||
#undef HAVE_FCHMOD
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Does getcwd() take NULL as the first argument and malloc
|
||||
|
@ -517,7 +514,7 @@ reversepath(char *inpath, char *name, int len, char *outpath)
|
|||
xchdir("..");
|
||||
} else {
|
||||
cp -= 3;
|
||||
strncpy(cp, "../", 3);
|
||||
memcpy(cp, "../", 3);
|
||||
xchdir(buf);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,4 +10,3 @@
|
|||
*/
|
||||
|
||||
#error "Do not include this header file."
|
||||
|
||||
|
|
|
@ -623,7 +623,6 @@ ac_subst_vars='LTLIBOBJS
|
|||
LIBOBJS
|
||||
MT
|
||||
NEXT_ROOT
|
||||
SYMBIAN_SDK_DIR
|
||||
MACOS_SDK_DIR
|
||||
WRAP_SYSTEM_INCLUDES
|
||||
VISIBILITY_FLAGS
|
||||
|
@ -757,6 +756,7 @@ infodir
|
|||
docdir
|
||||
oldincludedir
|
||||
includedir
|
||||
runstatedir
|
||||
localstatedir
|
||||
sharedstatedir
|
||||
sysconfdir
|
||||
|
@ -792,10 +792,8 @@ enable_optimize
|
|||
enable_debug
|
||||
enable_debug_symbols
|
||||
enable_win32_target
|
||||
enable_symbian_target
|
||||
enable_debug_rtl
|
||||
enable_static_rtl
|
||||
enable_n32
|
||||
enable_x32
|
||||
enable_64bit
|
||||
enable_mdupdate
|
||||
|
@ -811,13 +809,11 @@ with_arch
|
|||
with_fpu
|
||||
with_float_abi
|
||||
with_soft_float
|
||||
with_symbian_sdk
|
||||
with_ccache
|
||||
enable_strip
|
||||
with_pthreads
|
||||
enable_user_pthreads
|
||||
enable_nspr_threads
|
||||
with_bthreads
|
||||
enable_ipv6
|
||||
enable_wrap_malloc
|
||||
with_wrap_malloc
|
||||
|
@ -872,7 +868,7 @@ datadir='${datarootdir}'
|
|||
sysconfdir='${prefix}/etc'
|
||||
sharedstatedir='${prefix}/com'
|
||||
localstatedir='${prefix}/var'
|
||||
|
||||
runstatedir='${localstatedir}/run'
|
||||
includedir='${prefix}/include'
|
||||
oldincludedir='/usr/include'
|
||||
docdir='${datarootdir}/doc/${PACKAGE}'
|
||||
|
@ -1125,6 +1121,15 @@ do
|
|||
| -silent | --silent | --silen | --sile | --sil)
|
||||
silent=yes ;;
|
||||
|
||||
-runstatedir | --runstatedir | --runstatedi | --runstated \
|
||||
| --runstate | --runstat | --runsta | --runst | --runs \
|
||||
| --run | --ru | --r)
|
||||
ac_prev=runstatedir ;;
|
||||
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
|
||||
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
|
||||
| --run=* | --ru=* | --r=*)
|
||||
runstatedir=$ac_optarg ;;
|
||||
|
||||
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
|
||||
ac_prev=sbindir ;;
|
||||
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
|
||||
|
@ -1262,7 +1267,7 @@ fi
|
|||
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
|
||||
datadir sysconfdir sharedstatedir localstatedir includedir \
|
||||
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
|
||||
libdir localedir mandir
|
||||
libdir localedir mandir runstatedir
|
||||
do
|
||||
eval ac_val=\$$ac_var
|
||||
# Remove trailing slashes.
|
||||
|
@ -1415,6 +1420,7 @@ Fine tuning of the installation directories:
|
|||
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
|
||||
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
|
||||
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
|
||||
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
|
||||
--libdir=DIR object code libraries [EPREFIX/lib]
|
||||
--includedir=DIR C header files [PREFIX/include]
|
||||
--oldincludedir=DIR C header files for non-gcc [/usr/include]
|
||||
|
@ -1453,11 +1459,8 @@ Optional Features:
|
|||
(using compiler flags DBG)
|
||||
--enable-win32-target=\$t
|
||||
Specify win32 flavor. (WIN95 or WINNT)
|
||||
--enable-symbian-target=\$t
|
||||
Specify symbian flavor. (WINSCW or GCCE)
|
||||
--enable-debug-rtl Use the MSVC debug runtime library
|
||||
--enable-static-rtl Use the MSVC static runtime library
|
||||
--enable-n32 Enable n32 ABI support (IRIX only)
|
||||
--enable-x32 Enable x32 ABI support (x86_64 only)
|
||||
--enable-64bit Enable 64-bit support (on certain platforms)
|
||||
--enable-mdupdate Enable use of certain compilers' mdupdate feature
|
||||
|
@ -1506,13 +1509,9 @@ Optional Packages:
|
|||
Use specific arm float ABI (-mfloat-abi=type)
|
||||
--with-soft-float[=yes|no|toolchain-default]
|
||||
Use soft float library (-msoft-float)
|
||||
--with-symbian-sdk=SYMBIAN_SDK_DIR
|
||||
The path to the Symbian SDK
|
||||
--with-ccache=path/to/ccache
|
||||
Enable compiling with ccache
|
||||
--with-pthreads Use system pthreads library as thread subsystem
|
||||
--with-bthreads Use system bthreads library as thread subsystem
|
||||
(BeOS only)
|
||||
--with-wrap-malloc=SHAREDLIB Location of malloc wrapper library
|
||||
|
||||
Some influential environment variables:
|
||||
|
@ -2487,7 +2486,7 @@ test -n "$target_alias" &&
|
|||
program_prefix=${target_alias}-
|
||||
|
||||
MOD_MAJOR_VERSION=4
|
||||
MOD_MINOR_VERSION=21
|
||||
MOD_MINOR_VERSION=22
|
||||
MOD_PATCH_VERSION=0
|
||||
NSPR_MODNAME=nspr20
|
||||
_HAVE_PTHREADS=
|
||||
|
@ -2641,6 +2640,12 @@ fi
|
|||
|
||||
|
||||
case "$target" in
|
||||
x86_64-linux*-android*)
|
||||
android_tool_prefix="x86_64-linux-android"
|
||||
;;
|
||||
aarch64-linux*-android*)
|
||||
android_tool_prefix="aarch64-linux-android"
|
||||
;;
|
||||
arm-linux*-android*|*-linuxandroid*)
|
||||
android_tool_prefix="arm-linux-androideabi"
|
||||
;;
|
||||
|
@ -2855,11 +2860,6 @@ if test "${enable_win32_target+set}" = set; then :
|
|||
fi
|
||||
|
||||
|
||||
# Check whether --enable-symbian-target was given.
|
||||
if test "${enable_symbian_target+set}" = set; then :
|
||||
enableval=$enable_symbian_target; OS_TARGET=`echo $enableval | tr a-z A-Z`
|
||||
fi
|
||||
|
||||
|
||||
# Check whether --enable-debug-rtl was given.
|
||||
if test "${enable_debug_rtl+set}" = set; then :
|
||||
|
@ -2879,17 +2879,6 @@ if test "${enable_static_rtl+set}" = set; then :
|
|||
fi
|
||||
|
||||
|
||||
# Check whether --enable-n32 was given.
|
||||
if test "${enable_n32+set}" = set; then :
|
||||
enableval=$enable_n32; if test "$enableval" = "yes"; then
|
||||
USE_N32=1
|
||||
else if test "$enableval" = "no"; then
|
||||
USE_N32=
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Check whether --enable-x32 was given.
|
||||
if test "${enable_x32+set}" = set; then :
|
||||
enableval=$enable_x32; if test "$enableval" = "yes"; then
|
||||
|
@ -2978,14 +2967,6 @@ if test -z "$CC"; then
|
|||
CC=cc
|
||||
;;
|
||||
|
||||
*-irix*)
|
||||
CC=cc
|
||||
;;
|
||||
|
||||
*-osf*)
|
||||
CC=cc
|
||||
;;
|
||||
|
||||
*-solaris*)
|
||||
CC=cc
|
||||
;;
|
||||
|
@ -3018,14 +2999,6 @@ if test -z "$CXX"; then
|
|||
esac
|
||||
;;
|
||||
|
||||
*-irix*)
|
||||
CXX=CC
|
||||
;;
|
||||
|
||||
*-osf*)
|
||||
CXX=cxx
|
||||
;;
|
||||
|
||||
*-solaris*)
|
||||
CXX=CC
|
||||
;;
|
||||
|
@ -3083,9 +3056,6 @@ if test -n "$MOZ_DEBUG"; then
|
|||
DEFINES="$DEFINES -UNDEBUG"
|
||||
|
||||
case "${target_os}" in
|
||||
beos*)
|
||||
DEFINES="$DEFINES -DDEBUG_${USER}"
|
||||
;;
|
||||
mks*|cygwin*|mingw*|msys*|os2*)
|
||||
DEFINES="$DEFINES -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
|
||||
;;
|
||||
|
@ -5626,10 +5596,6 @@ else
|
|||
OS_TEST=`uname -m`
|
||||
fi
|
||||
|
||||
if test "$OS_ARCH" = "IRIX64"; then
|
||||
OS_ARCH=IRIX
|
||||
fi
|
||||
|
||||
if test "$OS_ARCH" = "AIX"; then
|
||||
OS_RELEASE=`uname -v`.`uname -r`
|
||||
fi
|
||||
|
@ -6016,9 +5982,6 @@ case "$host" in
|
|||
CYGWIN_WRAPPER='sh $(topsrcdir)/build/cygwin-wrapper'
|
||||
fi
|
||||
;;
|
||||
*-beos*)
|
||||
HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE"
|
||||
;;
|
||||
*os2*)
|
||||
;;
|
||||
*)
|
||||
|
@ -6374,77 +6337,6 @@ fi
|
|||
RESOLVE_LINK_SYMBOLS=1
|
||||
;;
|
||||
|
||||
*-beos*)
|
||||
$as_echo "#define XP_BEOS 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define BeOS 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define BEOS 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h
|
||||
|
||||
DSO_LDOPTS=-nostart
|
||||
MDCPUCFG_H=_beos.cfg
|
||||
USE_BTHREADS=1
|
||||
PR_MD_ARCH_DIR=beos
|
||||
RESOLVE_LINK_SYMBOLS=1
|
||||
case "${target_cpu}" in
|
||||
i*86)
|
||||
_OPTIMIZE_FLAGS=-O2
|
||||
_DEBUG_FLAGS='-gdwarf-2 -O0'
|
||||
MKSHLIB='$(CCC) $(DSO_LDOPTS) -o $@'
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyaddr in -lbind" >&5
|
||||
$as_echo_n "checking for gethostbyaddr in -lbind... " >&6; }
|
||||
if ${ac_cv_lib_bind_gethostbyaddr+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lbind $LIBS"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
/* Override any GCC internal prototype to avoid an error.
|
||||
Use char because int might match the return type of a GCC
|
||||
builtin and then its argument prototype would still apply. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
char gethostbyaddr ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return gethostbyaddr ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
ac_cv_lib_bind_gethostbyaddr=yes
|
||||
else
|
||||
ac_cv_lib_bind_gethostbyaddr=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bind_gethostbyaddr" >&5
|
||||
$as_echo "$ac_cv_lib_bind_gethostbyaddr" >&6; }
|
||||
if test "x$ac_cv_lib_bind_gethostbyaddr" = xyes; then :
|
||||
OS_LIBS="$OS_LIBS -lbind -lsocket"
|
||||
fi
|
||||
|
||||
;;
|
||||
powerpc)
|
||||
CC=mwcc
|
||||
CCC=mwcc
|
||||
LD=mwld
|
||||
DSO_LDOPTS='-xms -export pragma -init _init_routine_ -term _term_routine_ -lroot -lnet /boot/develop/lib/ppc/glue-noinit.a /boot/develop/lib/ppc/init_term_dyn.o /boot/develop/lib/ppc/start_dyn.o'
|
||||
_OPTIMIZE_FLAGS=-O2
|
||||
_DEBUG_FLAGS='-g -O0'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
*-bsdi*)
|
||||
$as_echo "#define XP_UNIX 1" >>confdefs.h
|
||||
|
||||
|
@ -6667,28 +6559,6 @@ tools are selected during the Xcode/Developer Tools installation." "$LINENO" 5
|
|||
fi
|
||||
;;
|
||||
|
||||
*-dgux*)
|
||||
$as_echo "#define XP_UNIX 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define _PR_LOCAL_THREADS_ONLY 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define SVR4 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define SYSV 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define DGUX 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define _DGUX_SOURCE 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define _POSIX4A_DRAFT6_SOURCE 1" >>confdefs.h
|
||||
|
||||
DSO_LDOPTS=-G
|
||||
_OPTIMIZE_FLAGS=-O2
|
||||
_DEBUG_FLAGS=
|
||||
MDCPUCFG_H=_dgux.cfg
|
||||
PR_MD_CSRCS=dgux.c
|
||||
;;
|
||||
|
||||
*-freebsd*)
|
||||
if test -z "$USE_NSPR_THREADS"; then
|
||||
USE_PTHREADS=1
|
||||
|
@ -6724,7 +6594,7 @@ tools are selected during the Xcode/Developer Tools installation." "$LINENO" 5
|
|||
|
||||
$as_echo "#define _HPUX_SOURCE 1" >>confdefs.h
|
||||
|
||||
# OSF1 and HPUX report the POLLHUP event for a socket when the
|
||||
# HPUX report the POLLHUP event for a socket when the
|
||||
# shutdown(SHUT_WR) operation is called for the remote end, even though
|
||||
# the socket is still writeable. Use select(), instead of poll(), to
|
||||
# workaround this problem.
|
||||
|
@ -6890,110 +6760,6 @@ tools are selected during the Xcode/Developer Tools installation." "$LINENO" 5
|
|||
fi
|
||||
;;
|
||||
|
||||
*-irix*)
|
||||
$as_echo "#define XP_UNIX 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define IRIX 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define SVR4 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define _SGI_MP_SOURCE 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define HAVE_FCNTL_FILE_LOCKING 1" >>confdefs.h
|
||||
|
||||
PR_MD_CSRCS=irix.c
|
||||
PR_MD_ASFILES=os_Irix.s
|
||||
MKSHLIB='$(LD) $(DSO_LDOPTS) -rdata_shared -shared -soname $(notdir $@) -o $@'
|
||||
STRIP="$STRIP -f"
|
||||
RESOLVE_LINK_SYMBOLS=1
|
||||
if test -n "$USE_64"; then
|
||||
MDCPUCFG_H=_irix64.cfg
|
||||
else
|
||||
MDCPUCFG_H=_irix32.cfg
|
||||
fi
|
||||
case "${target_os}" in
|
||||
irix6*)
|
||||
$as_echo "#define IRIX6 1" >>confdefs.h
|
||||
|
||||
USE_PTHREADS=1
|
||||
USE_N32=1
|
||||
COMPILER_TAG=_n32
|
||||
IMPL_STRATEGY=_PTH
|
||||
;;
|
||||
irix5*)
|
||||
$as_echo "#define IRIX5 1" >>confdefs.h
|
||||
|
||||
USE_NSPR_THREADS=1
|
||||
;;
|
||||
*)
|
||||
USE_PTHREADS=1
|
||||
USE_N32=1
|
||||
;;
|
||||
esac
|
||||
if test "$GNU_CC"; then
|
||||
AS='$(CC) -Wp,-P -x assembler-with-cpp -D_ASM -mips2 $(INCLUDES)'
|
||||
CFLAGS="$CFLAGS -Wall -Wno-format"
|
||||
_OPTIMIZE_FLAGS="-O6"
|
||||
else
|
||||
if test -n "$USE_N32"; then
|
||||
AS='as -D_ASM $(INCLUDES) -n32'
|
||||
else
|
||||
AS='as -D_ASM $(INCLUDES)'
|
||||
fi
|
||||
CFLAGS="$CFLAGS -fullwarn -xansi"
|
||||
if test "$USE_N32"; then
|
||||
_OPTIMIZE_FLAGS="-O -OPT:Olimit=4000"
|
||||
else
|
||||
_OPTIMIZE_FLAGS="-O -Olimit 4000"
|
||||
fi
|
||||
if test "$USE_MDUPDATE"; then
|
||||
CFLAGS="$CFLAGS -MDupdate \$(DEPENDENCIES)"
|
||||
fi
|
||||
case "${target}" in
|
||||
*-irix6.*)
|
||||
CFLAGS="$CFLAGS -multigot"
|
||||
DSO_LDOPTS="-no_unresolved"
|
||||
if test "$USE_N32"; then
|
||||
CFLAGS="$CFLAGS -n32 -woff 1209"
|
||||
DSO_LDOPTS="$DSO_LDOPTS -n32"
|
||||
else
|
||||
if test "$USE_64"; then
|
||||
CFLAGS="$CFLAGS -64"
|
||||
else
|
||||
CFLAGS="$CFLAGS -32"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
CFLAGS="$CFLAGS -xgot"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if test "${target_os}" = "irix5.3"; then
|
||||
$as_echo "#define IRIX5_3 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
case "${target_os}" in
|
||||
irix6.5)
|
||||
if test -z "$GNU_CC"; then
|
||||
CFLAGS="$CFLAGS -mips3"
|
||||
fi
|
||||
$as_echo "#define _PR_HAVE_GETPROTO_R 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define _PR_HAVE_GETPROTO_R_POINTER 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define _PR_HAVE_SGI_PRDA_PROCMASK 1" >>confdefs.h
|
||||
|
||||
;;
|
||||
irix5*)
|
||||
;;
|
||||
*)
|
||||
$as_echo "#define _PR_HAVE_SGI_PRDA_PROCMASK 1" >>confdefs.h
|
||||
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
*-linux*|*-gnu*|*-k*bsd*-gnu|*-android*|*-linuxandroid*)
|
||||
if test -z "$USE_NSPR_THREADS"; then
|
||||
USE_PTHREADS=1
|
||||
|
@ -7290,6 +7056,11 @@ $as_echo "$as_me: WARNING: Unknown version of the Microsoft (R) Manifest Tool."
|
|||
x86_64)
|
||||
$as_echo "#define _AMD64_ 1" >>confdefs.h
|
||||
|
||||
USE_64=1
|
||||
;;
|
||||
aarch64)
|
||||
$as_echo "#define _ARM64_ 1" >>confdefs.h
|
||||
|
||||
USE_64=1
|
||||
;;
|
||||
ia64)
|
||||
|
@ -7387,61 +7158,6 @@ $as_echo "$as_me: WARNING: Unknown version of the Microsoft (R) Manifest Tool."
|
|||
MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
|
||||
;;
|
||||
|
||||
*-osf*)
|
||||
SHELL_OVERRIDE="SHELL = /usr/bin/ksh"
|
||||
$as_echo "#define XP_UNIX 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define OSF1 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define _REENTRANT 1" >>confdefs.h
|
||||
|
||||
# OSF1 and HPUX report the POLLHUP event for a socket when the
|
||||
# shutdown(SHUT_WR) operation is called for the remote end, even though
|
||||
# the socket is still writeable. Use select(), instead of poll(), to
|
||||
# workaround this problem.
|
||||
$as_echo "#define _PR_POLL_WITH_SELECT 1" >>confdefs.h
|
||||
|
||||
|
||||
if echo "$OS_RELEASE" | egrep -c '(V2.0|V3.2)' 2>/dev/null ; then
|
||||
USE_NSPR_THREADS=1
|
||||
fi
|
||||
|
||||
if test -z "$GNU_CC"; then
|
||||
CC="$CC -std1 -ieee_with_inexact"
|
||||
if test "$OS_RELEASE" != "V2.0"; then
|
||||
CC="$CC -readonly_strings"
|
||||
fi
|
||||
_OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Olimit 4000"
|
||||
ac_fn_c_check_header_mongrel "$LINENO" "machine/builtins.h" "ac_cv_header_machine_builtins_h" "$ac_includes_default"
|
||||
if test "x$ac_cv_header_machine_builtins_h" = xyes; then :
|
||||
$as_echo "#define OSF1_HAVE_MACHINE_BUILTINS_H 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
|
||||
else
|
||||
CFLAGS="$CFLAGS -mieee"
|
||||
CXXFLAGS="$CXXFLAGS -mieee"
|
||||
fi
|
||||
|
||||
if echo $OS_RELEASE | egrep -c '(V2.0|V3.2)' 2>/dev/null; then
|
||||
$as_echo "#define HAVE_INT_LOCALTIME_R 1" >>confdefs.h
|
||||
|
||||
else
|
||||
$as_echo "#define HAVE_FCNTL_FILE_LOCKING 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define HAVE_POINTER_LOCALTIME_R 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
if echo $OS_RELEASE | grep -c V4.0 >/dev/null; then
|
||||
$as_echo "#define OSF1V4_MAP_PRIVATE_BUG 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
DSO_LDOPTS='-shared -all -expect_unresolved "*" -soname $(notdir $@)'
|
||||
MDCPUCFG_H=_osf1.cfg
|
||||
PR_MD_CSRCS=osf1.c
|
||||
;;
|
||||
|
||||
*-qnx*)
|
||||
$as_echo "#define XP_UNIX 1" >>confdefs.h
|
||||
|
||||
|
@ -7683,94 +7399,6 @@ fi
|
|||
CPU_ARCH=x86
|
||||
;;
|
||||
|
||||
*-symbian*)
|
||||
|
||||
# Check whether --with-symbian-sdk was given.
|
||||
if test "${with_symbian_sdk+set}" = set; then :
|
||||
withval=$with_symbian_sdk; SYMBIAN_SDK_DIR=$withval
|
||||
fi
|
||||
|
||||
|
||||
echo -----------------------------------------------------------------------------
|
||||
echo Building with Symbian SDK in: $SYMBIAN_SDK_DIR
|
||||
echo -----------------------------------------------------------------------------
|
||||
|
||||
$as_echo "#define XP_UNIX 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define SYMBIAN 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define __arm__ 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define __SYMBIAN32__ 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define _UNICODE 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define NDEBUG 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define __SUPPORT_CPP_EXCEPTIONS__ 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define MOZ_STDERR_TO_STDOUT 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define HAVE_FCNTL_FILE_LOCKING 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define HAVE_SOCKLEN_T 1" >>confdefs.h
|
||||
|
||||
USE_PTHREADS=1
|
||||
LIB_SUFFIX=lib
|
||||
DLL_SUFFIX=dll
|
||||
MKSHLIB=
|
||||
DSO_LDOPTS=
|
||||
DSO_CFLAGS=
|
||||
VISIBILITY_FLAGS=
|
||||
MDCPUCFG_H=_symbian.cfg
|
||||
PR_MD_CSRCS=symbian.c
|
||||
NSINSTALL=nsinstall
|
||||
RANLIB='echo no ranlib '
|
||||
CPU_ARCH=ARM
|
||||
OS_ARCH=SYMBIAN
|
||||
OS_EXE_CFLAGS="$OS_EXE_CFLAGS -D__EXE__"
|
||||
CFLAGS="$CFLAGS -MD -nostdinc"
|
||||
SYMBIAN_SYS_INCLUDE="-I$SYMBIAN_SDK_DIR/Epoc32/include/variant -I$SYMBIAN_SDK_DIR/Epoc32/include -I$SYMBIAN_SDK_DIR/Epoc32/include/stdapis"
|
||||
echo -------------------------------------------------------
|
||||
echo SYMBIAN_SYS_INCLUDE is: $SYMBIAN_SYS_INCLUDE
|
||||
echo -------------------------------------------------------
|
||||
case "$OS_TARGET" in
|
||||
WINSCW)
|
||||
CC=mwccsym2.exe
|
||||
CXX=mwccsym2.exe
|
||||
LD=mwldsym2.exe
|
||||
AR=mwldsym2.exe
|
||||
WINSCW_LD_DIR="\$(SYMBIAN_SDK_DIR)/EPOC32/RELEASE/WINSCW/UDEB"
|
||||
CFLAGS="$CFLAGS -O0 -inline off -wchar_t off -align 4 -warnings on -w nohidevirtual,nounusedexpr -msgstyle gcc -enum int -str pool -exc ms -trigraphs on -nostderr -gccdep -cwd source -i- -I\$(VPATH)"
|
||||
SYMBIAN_SYS_INCLUDE="$SYMBIAN_SYS_INCLUDE -include Symbian_OS_v9.2.hrh"
|
||||
AR_FLAGS="-library -msgstyle gcc -stdlib -subsystem windows -noimplib -o \$@"
|
||||
$as_echo "#define _DEBUG 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define __CW32__ 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define __WINS__ 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define __WINSCW__ 1" >>confdefs.h
|
||||
|
||||
DEFINES="$DEFINES -U_WIN32"
|
||||
;;
|
||||
GCCE)
|
||||
CFLAGS="$CFLAGS -Wall -Wno-unknown-pragmas -fexceptions -march=armv5t -mapcs -pipe -x c -msoft-float"
|
||||
CXXFLAGS="$CXXFLAGS $CFLAGS -Wno-ctor-dtor-privacy"
|
||||
SYMBIAN_SYS_INCLUDE="$SYMBIAN_SYS_INCLUDE -include $SYMBIAN_SDK_DIR/EPOC32/INCLUDE/GCCE/GCCE.h"
|
||||
$as_echo "#define __GCCE__ 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define __EABI__ 1" >>confdefs.h
|
||||
|
||||
DEFINES="$DEFINES -D__PRODUCT_INCLUDE__=$SYMBIAN_SDK_DIR/Epoc32/include/variant/Symbian_OS_v9.2.hrh"
|
||||
;;
|
||||
*)
|
||||
as_fn_error $? "Missing OS_TARGET for ${target}. Set --enable-symbian-target to with 'WINSCW' or 'GCCE'." "$LINENO" 5
|
||||
;;
|
||||
esac
|
||||
CFLAGS="$CFLAGS ${SYMBIAN_SYS_INCLUDE}"
|
||||
;;
|
||||
|
||||
*-os2*)
|
||||
$as_echo "#define XP_OS2 1" >>confdefs.h
|
||||
|
||||
|
@ -7828,7 +7456,7 @@ if test -z "$SKIP_LIBRARY_CHECKS"; then
|
|||
|
||||
|
||||
case $target in
|
||||
*-darwin*|*-beos*|*-os2*)
|
||||
*-darwin*|*-os2*)
|
||||
;;
|
||||
*)
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
|
||||
|
@ -8281,21 +7909,6 @@ if test "${enable_nspr_threads+set}" = set; then :
|
|||
fi
|
||||
|
||||
|
||||
case "$target" in
|
||||
*-beos*)
|
||||
|
||||
# Check whether --with-bthreads was given.
|
||||
if test "${with_bthreads+set}" = set; then :
|
||||
withval=$with_bthreads; if test "$withval" = "yes"; then
|
||||
USE_BTHREADS=1
|
||||
USE_USER_PTHREADS=
|
||||
USE_PTHREADS=
|
||||
fi
|
||||
fi
|
||||
|
||||
;;
|
||||
esac
|
||||
|
||||
fi # SKIP_LIBRARY_CHECKS
|
||||
|
||||
# Check whether --enable-ipv6 was given.
|
||||
|
@ -8473,23 +8086,13 @@ _ACEOF
|
|||
|
||||
fi
|
||||
;;
|
||||
*-irix*)
|
||||
if test "${target_os}" = "irix6.5"; then
|
||||
if test -n "$USE_PTHREADS"; then
|
||||
$as_echo "#define _PR_HAVE_GETHOST_R 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define _PR_HAVE_GETHOST_R_POINTER 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*-linux*|*-gnu*|*-k*bsd*-gnu)
|
||||
if test -n "$USE_NSPR_THREADS"; then
|
||||
$as_echo "#define _PR_LOCAL_THREADS_ONLY 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
;;
|
||||
*-mingw*|*-msys*|*-cygwin*|*-mks*|*-os2*|*-beos*)
|
||||
*-mingw*|*-msys*|*-cygwin*|*-mks*|*-os2*)
|
||||
USE_PTHREADS=
|
||||
_PTHREAD_LDFLAGS=
|
||||
USE_USER_PTHREADS=
|
||||
|
@ -8500,20 +8103,6 @@ _ACEOF
|
|||
|
||||
fi
|
||||
;;
|
||||
*-osf*)
|
||||
if test -n "$USE_NSPR_THREADS"; then
|
||||
$as_echo "#define _PR_LOCAL_THREADS_ONLY 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
if test -n "$USE_PTHREADS"; then
|
||||
if echo $OS_RELEASE | egrep -c '(V2.0|V3.2)' 2>/dev/null; then
|
||||
:
|
||||
else
|
||||
$as_echo "#define _PR_HAVE_THREADSAFE_GETHOST 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*-solaris*)
|
||||
if test -n "$USE_NSPR_THREADS"; then
|
||||
$as_echo "#define _PR_LOCAL_THREADS_ONLY 1" >>confdefs.h
|
||||
|
@ -8715,7 +8304,6 @@ fi
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
MAKEFILES="
|
||||
|
|
|
@ -15,7 +15,7 @@ dnl ========================================================
|
|||
dnl = Defaults
|
||||
dnl ========================================================
|
||||
MOD_MAJOR_VERSION=4
|
||||
MOD_MINOR_VERSION=21
|
||||
MOD_MINOR_VERSION=22
|
||||
MOD_PATCH_VERSION=0
|
||||
NSPR_MODNAME=nspr20
|
||||
_HAVE_PTHREADS=
|
||||
|
@ -133,6 +133,12 @@ AC_ARG_WITH(android-platform,
|
|||
android_platform=$withval)
|
||||
|
||||
case "$target" in
|
||||
x86_64-linux*-android*)
|
||||
android_tool_prefix="x86_64-linux-android"
|
||||
;;
|
||||
aarch64-linux*-android*)
|
||||
android_tool_prefix="aarch64-linux-android"
|
||||
;;
|
||||
arm-linux*-android*|*-linuxandroid*)
|
||||
android_tool_prefix="arm-linux-androideabi"
|
||||
;;
|
||||
|
@ -333,10 +339,6 @@ AC_ARG_ENABLE(win32-target,
|
|||
Specify win32 flavor. (WIN95 or WINNT)],
|
||||
OS_TARGET=`echo $enableval | tr a-z A-Z`)
|
||||
|
||||
AC_ARG_ENABLE(symbian-target,
|
||||
[ --enable-symbian-target=\$t
|
||||
Specify symbian flavor. (WINSCW or GCCE)],
|
||||
OS_TARGET=`echo $enableval | tr a-z A-Z`)
|
||||
|
||||
AC_ARG_ENABLE(debug-rtl,
|
||||
[ --enable-debug-rtl Use the MSVC debug runtime library],
|
||||
|
@ -352,15 +354,6 @@ AC_ARG_ENABLE(static-rtl,
|
|||
USE_STATIC_RTL=1
|
||||
fi ])
|
||||
|
||||
AC_ARG_ENABLE(n32,
|
||||
[ --enable-n32 Enable n32 ABI support (IRIX only)],
|
||||
[ if test "$enableval" = "yes"; then
|
||||
USE_N32=1
|
||||
else if test "$enableval" = "no"; then
|
||||
USE_N32=
|
||||
fi
|
||||
fi ])
|
||||
|
||||
AC_ARG_ENABLE(x32,
|
||||
[ --enable-x32 Enable x32 ABI support (x86_64 only)],
|
||||
[ if test "$enableval" = "yes"; then
|
||||
|
@ -448,14 +441,6 @@ if test -z "$CC"; then
|
|||
CC=cc
|
||||
;;
|
||||
|
||||
*-irix*)
|
||||
CC=cc
|
||||
;;
|
||||
|
||||
*-osf*)
|
||||
CC=cc
|
||||
;;
|
||||
|
||||
*-solaris*)
|
||||
CC=cc
|
||||
;;
|
||||
|
@ -493,14 +478,6 @@ if test -z "$CXX"; then
|
|||
esac
|
||||
;;
|
||||
|
||||
*-irix*)
|
||||
CXX=CC
|
||||
;;
|
||||
|
||||
*-osf*)
|
||||
CXX=cxx
|
||||
;;
|
||||
|
||||
*-solaris*)
|
||||
CXX=CC
|
||||
;;
|
||||
|
@ -517,9 +494,6 @@ if test -n "$MOZ_DEBUG"; then
|
|||
DEFINES="$DEFINES -UNDEBUG"
|
||||
|
||||
case "${target_os}" in
|
||||
beos*)
|
||||
DEFINES="$DEFINES -DDEBUG_${USER}"
|
||||
;;
|
||||
mks*|cygwin*|mingw*|msys*|os2*)
|
||||
DEFINES="$DEFINES -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
|
||||
;;
|
||||
|
@ -856,10 +830,6 @@ else
|
|||
OS_TEST=`uname -m`
|
||||
fi
|
||||
|
||||
if test "$OS_ARCH" = "IRIX64"; then
|
||||
OS_ARCH=IRIX
|
||||
fi
|
||||
|
||||
if test "$OS_ARCH" = "AIX"; then
|
||||
OS_RELEASE=`uname -v`.`uname -r`
|
||||
fi
|
||||
|
@ -1193,9 +1163,6 @@ case "$host" in
|
|||
CYGWIN_WRAPPER='sh $(topsrcdir)/build/cygwin-wrapper'
|
||||
fi
|
||||
;;
|
||||
*-beos*)
|
||||
HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE"
|
||||
;;
|
||||
*os2*)
|
||||
;;
|
||||
*)
|
||||
|
@ -1268,34 +1235,6 @@ case "$target" in
|
|||
RESOLVE_LINK_SYMBOLS=1
|
||||
;;
|
||||
|
||||
*-beos*)
|
||||
AC_DEFINE(XP_BEOS)
|
||||
AC_DEFINE(BeOS)
|
||||
AC_DEFINE(BEOS)
|
||||
AC_DEFINE(_POSIX_SOURCE)
|
||||
DSO_LDOPTS=-nostart
|
||||
MDCPUCFG_H=_beos.cfg
|
||||
USE_BTHREADS=1
|
||||
PR_MD_ARCH_DIR=beos
|
||||
RESOLVE_LINK_SYMBOLS=1
|
||||
case "${target_cpu}" in
|
||||
i*86)
|
||||
_OPTIMIZE_FLAGS=-O2
|
||||
_DEBUG_FLAGS='-gdwarf-2 -O0'
|
||||
MKSHLIB='$(CCC) $(DSO_LDOPTS) -o $@'
|
||||
AC_CHECK_LIB(bind, gethostbyaddr, [OS_LIBS="$OS_LIBS -lbind -lsocket"])
|
||||
;;
|
||||
powerpc)
|
||||
CC=mwcc
|
||||
CCC=mwcc
|
||||
LD=mwld
|
||||
DSO_LDOPTS='-xms -export pragma -init _init_routine_ -term _term_routine_ -lroot -lnet /boot/develop/lib/ppc/glue-noinit.a /boot/develop/lib/ppc/init_term_dyn.o /boot/develop/lib/ppc/start_dyn.o'
|
||||
_OPTIMIZE_FLAGS=-O2
|
||||
_DEBUG_FLAGS='-g -O0'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
*-bsdi*)
|
||||
AC_DEFINE(XP_UNIX)
|
||||
AC_DEFINE(BSDI)
|
||||
|
@ -1521,21 +1460,6 @@ tools are selected during the Xcode/Developer Tools installation.])
|
|||
fi
|
||||
;;
|
||||
|
||||
*-dgux*)
|
||||
AC_DEFINE(XP_UNIX)
|
||||
AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
|
||||
AC_DEFINE(SVR4)
|
||||
AC_DEFINE(SYSV)
|
||||
AC_DEFINE(DGUX)
|
||||
AC_DEFINE(_DGUX_SOURCE)
|
||||
AC_DEFINE(_POSIX4A_DRAFT6_SOURCE)
|
||||
DSO_LDOPTS=-G
|
||||
_OPTIMIZE_FLAGS=-O2
|
||||
_DEBUG_FLAGS=
|
||||
MDCPUCFG_H=_dgux.cfg
|
||||
PR_MD_CSRCS=dgux.c
|
||||
;;
|
||||
|
||||
*-freebsd*)
|
||||
if test -z "$USE_NSPR_THREADS"; then
|
||||
USE_PTHREADS=1
|
||||
|
@ -1563,7 +1487,7 @@ tools are selected during the Xcode/Developer Tools installation.])
|
|||
AC_DEFINE(XP_UNIX)
|
||||
AC_DEFINE(HPUX)
|
||||
AC_DEFINE(_HPUX_SOURCE)
|
||||
# OSF1 and HPUX report the POLLHUP event for a socket when the
|
||||
# HPUX report the POLLHUP event for a socket when the
|
||||
# shutdown(SHUT_WR) operation is called for the remote end, even though
|
||||
# the socket is still writeable. Use select(), instead of poll(), to
|
||||
# workaround this problem.
|
||||
|
@ -1708,105 +1632,6 @@ tools are selected during the Xcode/Developer Tools installation.])
|
|||
fi
|
||||
;;
|
||||
|
||||
*-irix*)
|
||||
AC_DEFINE(XP_UNIX)
|
||||
AC_DEFINE(IRIX)
|
||||
AC_DEFINE(SVR4)
|
||||
AC_DEFINE(_SGI_MP_SOURCE)
|
||||
AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
|
||||
PR_MD_CSRCS=irix.c
|
||||
PR_MD_ASFILES=os_Irix.s
|
||||
MKSHLIB='$(LD) $(DSO_LDOPTS) -rdata_shared -shared -soname $(notdir $@) -o $@'
|
||||
STRIP="$STRIP -f"
|
||||
RESOLVE_LINK_SYMBOLS=1
|
||||
if test -n "$USE_64"; then
|
||||
MDCPUCFG_H=_irix64.cfg
|
||||
else
|
||||
MDCPUCFG_H=_irix32.cfg
|
||||
fi
|
||||
case "${target_os}" in
|
||||
irix6*)
|
||||
AC_DEFINE(IRIX6)
|
||||
USE_PTHREADS=1
|
||||
USE_N32=1
|
||||
COMPILER_TAG=_n32
|
||||
IMPL_STRATEGY=_PTH
|
||||
;;
|
||||
irix5*)
|
||||
AC_DEFINE(IRIX5)
|
||||
USE_NSPR_THREADS=1
|
||||
;;
|
||||
*)
|
||||
USE_PTHREADS=1
|
||||
USE_N32=1
|
||||
;;
|
||||
esac
|
||||
if test "$GNU_CC"; then
|
||||
dnl
|
||||
dnl If we are using gcc with native binutils, we need to
|
||||
dnl suppress the
|
||||
dnl #lineno "filename" num num
|
||||
dnl lines, which confuse IRIX native as. Add -Wp,-P to the
|
||||
dnl gcc command line, which passes -P to the preprocessor.
|
||||
dnl
|
||||
AS='$(CC) -Wp,-P -x assembler-with-cpp -D_ASM -mips2 $(INCLUDES)'
|
||||
CFLAGS="$CFLAGS -Wall -Wno-format"
|
||||
_OPTIMIZE_FLAGS="-O6"
|
||||
else
|
||||
if test -n "$USE_N32"; then
|
||||
AS='as -D_ASM $(INCLUDES) -n32'
|
||||
else
|
||||
AS='as -D_ASM $(INCLUDES)'
|
||||
fi
|
||||
CFLAGS="$CFLAGS -fullwarn -xansi"
|
||||
if test "$USE_N32"; then
|
||||
_OPTIMIZE_FLAGS="-O -OPT:Olimit=4000"
|
||||
else
|
||||
_OPTIMIZE_FLAGS="-O -Olimit 4000"
|
||||
fi
|
||||
if test "$USE_MDUPDATE"; then
|
||||
CFLAGS="$CFLAGS -MDupdate \$(DEPENDENCIES)"
|
||||
fi
|
||||
case "${target}" in
|
||||
*-irix6.*)
|
||||
CFLAGS="$CFLAGS -multigot"
|
||||
DSO_LDOPTS="-no_unresolved"
|
||||
if test "$USE_N32"; then
|
||||
CFLAGS="$CFLAGS -n32 -woff 1209"
|
||||
DSO_LDOPTS="$DSO_LDOPTS -n32"
|
||||
else
|
||||
if test "$USE_64"; then
|
||||
CFLAGS="$CFLAGS -64"
|
||||
else
|
||||
CFLAGS="$CFLAGS -32"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
CFLAGS="$CFLAGS -xgot"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if test "${target_os}" = "irix5.3"; then
|
||||
AC_DEFINE(IRIX5_3)
|
||||
fi
|
||||
case "${target_os}" in
|
||||
irix6.5)
|
||||
if test -z "$GNU_CC"; then
|
||||
CFLAGS="$CFLAGS -mips3"
|
||||
fi
|
||||
AC_DEFINE(_PR_HAVE_GETPROTO_R)
|
||||
AC_DEFINE(_PR_HAVE_GETPROTO_R_POINTER)
|
||||
AC_DEFINE(_PR_HAVE_SGI_PRDA_PROCMASK)
|
||||
;;
|
||||
irix5*)
|
||||
;;
|
||||
*)
|
||||
AC_DEFINE(_PR_HAVE_SGI_PRDA_PROCMASK)
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
*-linux*|*-gnu*|*-k*bsd*-gnu|*-android*|*-linuxandroid*)
|
||||
if test -z "$USE_NSPR_THREADS"; then
|
||||
USE_PTHREADS=1
|
||||
|
@ -2173,47 +1998,6 @@ tools are selected during the Xcode/Developer Tools installation.])
|
|||
MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
|
||||
;;
|
||||
|
||||
*-osf*)
|
||||
SHELL_OVERRIDE="SHELL = /usr/bin/ksh"
|
||||
AC_DEFINE(XP_UNIX)
|
||||
AC_DEFINE(OSF1)
|
||||
AC_DEFINE(_REENTRANT)
|
||||
# OSF1 and HPUX report the POLLHUP event for a socket when the
|
||||
# shutdown(SHUT_WR) operation is called for the remote end, even though
|
||||
# the socket is still writeable. Use select(), instead of poll(), to
|
||||
# workaround this problem.
|
||||
AC_DEFINE(_PR_POLL_WITH_SELECT)
|
||||
|
||||
if echo "$OS_RELEASE" | egrep -c '(V2.0|V3.2)' 2>/dev/null ; then
|
||||
USE_NSPR_THREADS=1
|
||||
fi
|
||||
|
||||
if test -z "$GNU_CC"; then
|
||||
CC="$CC -std1 -ieee_with_inexact"
|
||||
if test "$OS_RELEASE" != "V2.0"; then
|
||||
CC="$CC -readonly_strings"
|
||||
fi
|
||||
_OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Olimit 4000"
|
||||
AC_CHECK_HEADER(machine/builtins.h, AC_DEFINE(OSF1_HAVE_MACHINE_BUILTINS_H))
|
||||
else
|
||||
CFLAGS="$CFLAGS -mieee"
|
||||
CXXFLAGS="$CXXFLAGS -mieee"
|
||||
fi
|
||||
|
||||
if echo $OS_RELEASE | egrep -c '(V2.0|V3.2)' 2>/dev/null; then
|
||||
AC_DEFINE(HAVE_INT_LOCALTIME_R)
|
||||
else
|
||||
AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
|
||||
AC_DEFINE(HAVE_POINTER_LOCALTIME_R)
|
||||
fi
|
||||
if echo $OS_RELEASE | grep -c V4.0 >/dev/null; then
|
||||
AC_DEFINE(OSF1V4_MAP_PRIVATE_BUG)
|
||||
fi
|
||||
DSO_LDOPTS='-shared -all -expect_unresolved "*" -soname $(notdir $@)'
|
||||
MDCPUCFG_H=_osf1.cfg
|
||||
PR_MD_CSRCS=osf1.c
|
||||
;;
|
||||
|
||||
*-qnx*)
|
||||
AC_DEFINE(XP_UNIX)
|
||||
AC_DEFINE(QNX)
|
||||
|
@ -2421,76 +2205,6 @@ tools are selected during the Xcode/Developer Tools installation.])
|
|||
CPU_ARCH=x86
|
||||
;;
|
||||
|
||||
*-symbian*)
|
||||
AC_ARG_WITH(symbian-sdk,
|
||||
[ --with-symbian-sdk=SYMBIAN_SDK_DIR
|
||||
The path to the Symbian SDK],
|
||||
SYMBIAN_SDK_DIR=$withval)
|
||||
|
||||
echo -----------------------------------------------------------------------------
|
||||
echo Building with Symbian SDK in: $SYMBIAN_SDK_DIR
|
||||
echo -----------------------------------------------------------------------------
|
||||
|
||||
AC_DEFINE(XP_UNIX)
|
||||
AC_DEFINE(SYMBIAN)
|
||||
AC_DEFINE(__arm__)
|
||||
AC_DEFINE(__SYMBIAN32__)
|
||||
AC_DEFINE(_UNICODE)
|
||||
AC_DEFINE(NDEBUG)
|
||||
AC_DEFINE(__SUPPORT_CPP_EXCEPTIONS__)
|
||||
AC_DEFINE(MOZ_STDERR_TO_STDOUT)
|
||||
AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
|
||||
AC_DEFINE(HAVE_SOCKLEN_T)
|
||||
USE_PTHREADS=1
|
||||
LIB_SUFFIX=lib
|
||||
DLL_SUFFIX=dll
|
||||
MKSHLIB=
|
||||
DSO_LDOPTS=
|
||||
DSO_CFLAGS=
|
||||
VISIBILITY_FLAGS=
|
||||
MDCPUCFG_H=_symbian.cfg
|
||||
PR_MD_CSRCS=symbian.c
|
||||
NSINSTALL=nsinstall
|
||||
RANLIB='echo no ranlib '
|
||||
CPU_ARCH=ARM
|
||||
OS_ARCH=SYMBIAN
|
||||
OS_EXE_CFLAGS="$OS_EXE_CFLAGS -D__EXE__"
|
||||
CFLAGS="$CFLAGS -MD -nostdinc"
|
||||
SYMBIAN_SYS_INCLUDE="-I$SYMBIAN_SDK_DIR/Epoc32/include/variant -I$SYMBIAN_SDK_DIR/Epoc32/include -I$SYMBIAN_SDK_DIR/Epoc32/include/stdapis"
|
||||
echo -------------------------------------------------------
|
||||
echo SYMBIAN_SYS_INCLUDE is: $SYMBIAN_SYS_INCLUDE
|
||||
echo -------------------------------------------------------
|
||||
case "$OS_TARGET" in
|
||||
WINSCW)
|
||||
CC=mwccsym2.exe
|
||||
CXX=mwccsym2.exe
|
||||
LD=mwldsym2.exe
|
||||
AR=mwldsym2.exe
|
||||
WINSCW_LD_DIR="\$(SYMBIAN_SDK_DIR)/EPOC32/RELEASE/WINSCW/UDEB"
|
||||
CFLAGS="$CFLAGS -O0 -inline off -wchar_t off -align 4 -warnings on -w nohidevirtual,nounusedexpr -msgstyle gcc -enum int -str pool -exc ms -trigraphs on -nostderr -gccdep -cwd source -i- -I\$(VPATH)"
|
||||
SYMBIAN_SYS_INCLUDE="$SYMBIAN_SYS_INCLUDE -include Symbian_OS_v9.2.hrh"
|
||||
AR_FLAGS="-library -msgstyle gcc -stdlib -subsystem windows -noimplib -o \$@"
|
||||
AC_DEFINE(_DEBUG)
|
||||
AC_DEFINE(__CW32__)
|
||||
AC_DEFINE(__WINS__)
|
||||
AC_DEFINE(__WINSCW__)
|
||||
DEFINES="$DEFINES -U_WIN32"
|
||||
;;
|
||||
GCCE)
|
||||
CFLAGS="$CFLAGS -Wall -Wno-unknown-pragmas -fexceptions -march=armv5t -mapcs -pipe -x c -msoft-float"
|
||||
CXXFLAGS="$CXXFLAGS $CFLAGS -Wno-ctor-dtor-privacy"
|
||||
SYMBIAN_SYS_INCLUDE="$SYMBIAN_SYS_INCLUDE -include $SYMBIAN_SDK_DIR/EPOC32/INCLUDE/GCCE/GCCE.h"
|
||||
AC_DEFINE(__GCCE__)
|
||||
AC_DEFINE(__EABI__)
|
||||
DEFINES="$DEFINES -D__PRODUCT_INCLUDE__=$SYMBIAN_SDK_DIR/Epoc32/include/variant/Symbian_OS_v9.2.hrh"
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([Missing OS_TARGET for ${target}. Set --enable-symbian-target to with 'WINSCW' or 'GCCE'.])
|
||||
;;
|
||||
esac
|
||||
CFLAGS="$CFLAGS ${SYMBIAN_SYS_INCLUDE}"
|
||||
;;
|
||||
|
||||
*-os2*)
|
||||
AC_DEFINE(XP_OS2)
|
||||
AC_DEFINE(XP_PC)
|
||||
|
@ -2548,7 +2262,7 @@ dnl The same goes for BeOS.
|
|||
dnl OS/2 has dlfcn in libc.
|
||||
|
||||
case $target in
|
||||
*-darwin*|*-beos*|*-os2*)
|
||||
*-darwin*|*-os2*)
|
||||
;;
|
||||
*)
|
||||
AC_CHECK_LIB(dl, dlopen,
|
||||
|
@ -2714,19 +2428,6 @@ AC_ARG_ENABLE(nspr-threads,
|
|||
USE_NSPR_THREADS=1
|
||||
fi])
|
||||
|
||||
case "$target" in
|
||||
*-beos*)
|
||||
AC_ARG_WITH(bthreads,
|
||||
[ --with-bthreads Use system bthreads library as thread subsystem
|
||||
(BeOS only)],
|
||||
[ if test "$withval" = "yes"; then
|
||||
USE_BTHREADS=1
|
||||
USE_USER_PTHREADS=
|
||||
USE_PTHREADS=
|
||||
fi])
|
||||
;;
|
||||
esac
|
||||
|
||||
fi # SKIP_LIBRARY_CHECKS
|
||||
|
||||
AC_ARG_ENABLE(ipv6,
|
||||
|
@ -2884,21 +2585,13 @@ case "$target" in
|
|||
AC_DEFINE_UNQUOTED(_POSIX_C_SOURCE,199506L)
|
||||
fi
|
||||
;;
|
||||
*-irix*)
|
||||
if test "${target_os}" = "irix6.5"; then
|
||||
if test -n "$USE_PTHREADS"; then
|
||||
AC_DEFINE(_PR_HAVE_GETHOST_R)
|
||||
AC_DEFINE(_PR_HAVE_GETHOST_R_POINTER)
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*-linux*|*-gnu*|*-k*bsd*-gnu)
|
||||
if test -n "$USE_NSPR_THREADS"; then
|
||||
AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
|
||||
fi
|
||||
;;
|
||||
*-mingw*|*-msys*|*-cygwin*|*-mks*|*-os2*|*-beos*)
|
||||
dnl win32, os2 & beos cannot use pthreads
|
||||
*-mingw*|*-msys*|*-cygwin*|*-mks*|*-os2*)
|
||||
dnl win32, os2 cannot use pthreads
|
||||
USE_PTHREADS=
|
||||
_PTHREAD_LDFLAGS=
|
||||
USE_USER_PTHREADS=
|
||||
|
@ -2908,18 +2601,6 @@ case "$target" in
|
|||
AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
|
||||
fi
|
||||
;;
|
||||
*-osf*)
|
||||
if test -n "$USE_NSPR_THREADS"; then
|
||||
AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
|
||||
fi
|
||||
if test -n "$USE_PTHREADS"; then
|
||||
if echo $OS_RELEASE | egrep -c '(V2.0|V3.2)' 2>/dev/null; then
|
||||
:
|
||||
else
|
||||
AC_DEFINE(_PR_HAVE_THREADSAFE_GETHOST)
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*-solaris*)
|
||||
if test -n "$USE_NSPR_THREADS"; then
|
||||
AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
|
||||
|
@ -3124,7 +2805,6 @@ AC_SUBST(CYGWIN_WRAPPER)
|
|||
AC_SUBST(VISIBILITY_FLAGS)
|
||||
AC_SUBST(WRAP_SYSTEM_INCLUDES)
|
||||
AC_SUBST(MACOS_SDK_DIR)
|
||||
AC_SUBST(SYMBIAN_SDK_DIR)
|
||||
AC_SUBST(NEXT_ROOT)
|
||||
AC_SUBST(MT)
|
||||
|
||||
|
|
|
@ -43,10 +43,6 @@ OS_LIBS = -lc_r
|
|||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),IRIX)
|
||||
OS_LIBS = -lc
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),SunOS)
|
||||
OS_LIBS = -lc
|
||||
MAPFILE = $(OBJDIR)/pldsmap.sun
|
||||
|
|
|
@ -52,10 +52,6 @@ OS_LIBS = -lc_r
|
|||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),IRIX)
|
||||
OS_LIBS = -lc
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),SunOS)
|
||||
OS_LIBS = -lc
|
||||
MAPFILE = $(OBJDIR)/plcmap.sun
|
||||
|
|
|
@ -14,12 +14,6 @@ include $(MOD_DEPTH)/config/autoconf.mk
|
|||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
ifeq ($(OS_ARCH), IRIX)
|
||||
ifneq ($(OS_RELEASE),5.3)
|
||||
CCC_ONLY_FLAGS += -exceptions
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH), BeOS)
|
||||
CFLAGS += -frtti -fexceptions
|
||||
endif
|
||||
|
|
|
@ -57,14 +57,6 @@ ifneq ($(OS_ARCH), WINNT)
|
|||
PWD = $(shell pwd)
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH), IRIX)
|
||||
LDOPTS += -rpath $(PWD)/$(dist_libdir)
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH), OSF1)
|
||||
LDOPTS += -rpath $(PWD)/$(dist_libdir)
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH), HP-UX)
|
||||
LDOPTS += -Wl,+s,+b,$(PWD)/$(dist_libdir)
|
||||
endif
|
||||
|
|
|
@ -64,10 +64,6 @@ ifneq ($(OS_ARCH), WINNT)
|
|||
PWD = $(shell pwd)
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH), IRIX)
|
||||
LDOPTS += -rpath $(PWD)/$(dist_libdir)
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH), Linux)
|
||||
ifeq ($(OS_RELEASE), 1.2)
|
||||
EXTRA_LIBS = -ldl
|
||||
|
@ -85,10 +81,6 @@ ifeq (,$(filter-out OpenBSD,$(OS_ARCH)))
|
|||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH), OSF1)
|
||||
LDOPTS += -rpath $(PWD)/$(dist_libdir) -lpthread
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH), HP-UX)
|
||||
LDOPTS += -Wl,+s,+b,$(PWD)/$(dist_libdir)
|
||||
endif
|
||||
|
|
|
@ -5,12 +5,6 @@
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined(sgi)
|
||||
#ifndef IRIX
|
||||
error - IRIX is not defined
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__sun)
|
||||
#ifndef SOLARIS
|
||||
error - SOLARIS is not defined
|
||||
|
@ -24,8 +18,8 @@
|
|||
#endif
|
||||
|
||||
#if defined(__alpha)
|
||||
#if !(defined(_WIN32)) && !(defined(OSF1)) && !(defined(__linux)) && !(defined(__FreeBSD__))
|
||||
error - None of OSF1, _WIN32, __linux, or __FreeBSD__ is defined
|
||||
#if !(defined(_WIN32)) && !(defined(__linux)) && !(defined(__FreeBSD__))
|
||||
error - None of _WIN32, __linux, or __FreeBSD__ is defined
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,120 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nspr_cpucfg___
|
||||
#define nspr_cpucfg___
|
||||
|
||||
#ifndef XP_BEOS
|
||||
#define XP_BEOS
|
||||
#undef XP_UNIX
|
||||
#endif
|
||||
|
||||
#ifndef BEOS
|
||||
#define BEOS
|
||||
#endif
|
||||
|
||||
#define PR_AF_INET6 5 /* same as AF_INET6 */
|
||||
|
||||
#ifdef __powerpc__
|
||||
#undef IS_LITTLE_ENDIAN
|
||||
#define IS_BIG_ENDIAN 1
|
||||
#else
|
||||
#define IS_LITTLE_ENDIAN 1
|
||||
#undef IS_BIG_ENDIAN
|
||||
#endif
|
||||
|
||||
#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 4
|
||||
#define PR_BYTES_PER_FLOAT 4
|
||||
#define PR_BYTES_PER_DOUBLE 8
|
||||
#define PR_BYTES_PER_WORD 4
|
||||
#define PR_BYTES_PER_DWORD 8
|
||||
#define PR_BYTES_PER_WORD_LOG2 2
|
||||
#define PR_BYTES_PER_DWORD_LOG2 3
|
||||
|
||||
#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 32
|
||||
#define PR_BITS_PER_FLOAT 32
|
||||
#define PR_BITS_PER_DOUBLE 64
|
||||
#define PR_BITS_PER_WORD 32
|
||||
|
||||
#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 5
|
||||
#define PR_BITS_PER_FLOAT_LOG2 5
|
||||
#define PR_BITS_PER_DOUBLE_LOG2 6
|
||||
#define PR_BITS_PER_WORD_LOG2 5
|
||||
|
||||
#define PR_ALIGN_OF_SHORT 2
|
||||
#define PR_ALIGN_OF_INT 4
|
||||
#define PR_ALIGN_OF_LONG 4
|
||||
#define PR_ALIGN_OF_INT64 4
|
||||
#define PR_ALIGN_OF_FLOAT 4
|
||||
#define PR_ALIGN_OF_DOUBLE 4
|
||||
#define PR_ALIGN_OF_POINTER 4
|
||||
|
||||
#ifndef HAVE_LONG_LONG
|
||||
#define HAVE_LONG_LONG
|
||||
#endif
|
||||
/*
|
||||
* XXX These two macros need to be investigated for different architectures.
|
||||
*/
|
||||
#define HAVE_ALIGNED_DOUBLES
|
||||
#define HAVE_ALIGNED_LONGLONGS
|
||||
|
||||
#ifndef NO_NSPR_10_SUPPORT
|
||||
|
||||
#define BYTES_PER_BYTE PR_BYTES_PER_BYTE
|
||||
#define BYTES_PER_SHORT PR_BYTES_PER_SHORT
|
||||
#define BYTES_PER_INT PR_BYTES_PER_INT
|
||||
#define BYTES_PER_INT64 PR_BYTES_PER_INT64
|
||||
#define BYTES_PER_LONG PR_BYTES_PER_LONG
|
||||
#define BYTES_PER_FLOAT PR_BYTES_PER_FLOAT
|
||||
#define BYTES_PER_DOUBLE PR_BYTES_PER_DOUBLE
|
||||
#define BYTES_PER_WORD PR_BYTES_PER_WORD
|
||||
#define BYTES_PER_DWORD PR_BYTES_PER_DWORD
|
||||
|
||||
#define BITS_PER_BYTE PR_BITS_PER_BYTE
|
||||
#define BITS_PER_SHORT PR_BITS_PER_SHORT
|
||||
#define BITS_PER_INT PR_BITS_PER_INT
|
||||
#define BITS_PER_INT64 PR_BITS_PER_INT64
|
||||
#define BITS_PER_LONG PR_BITS_PER_LONG
|
||||
#define BITS_PER_FLOAT PR_BITS_PER_FLOAT
|
||||
#define BITS_PER_DOUBLE PR_BITS_PER_DOUBLE
|
||||
#define BITS_PER_WORD PR_BITS_PER_WORD
|
||||
|
||||
#define BITS_PER_BYTE_LOG2 PR_BITS_PER_BYTE_LOG2
|
||||
#define BITS_PER_SHORT_LOG2 PR_BITS_PER_SHORT_LOG2
|
||||
#define BITS_PER_INT_LOG2 PR_BITS_PER_INT_LOG2
|
||||
#define BITS_PER_INT64_LOG2 PR_BITS_PER_INT64_LOG2
|
||||
#define BITS_PER_LONG_LOG2 PR_BITS_PER_LONG_LOG2
|
||||
#define BITS_PER_FLOAT_LOG2 PR_BITS_PER_FLOAT_LOG2
|
||||
#define BITS_PER_DOUBLE_LOG2 PR_BITS_PER_DOUBLE_LOG2
|
||||
#define BITS_PER_WORD_LOG2 PR_BITS_PER_WORD_LOG2
|
||||
|
||||
#define ALIGN_OF_SHORT PR_ALIGN_OF_SHORT
|
||||
#define ALIGN_OF_INT PR_ALIGN_OF_INT
|
||||
#define ALIGN_OF_LONG PR_ALIGN_OF_LONG
|
||||
#define ALIGN_OF_INT64 PR_ALIGN_OF_INT64
|
||||
#define ALIGN_OF_FLOAT PR_ALIGN_OF_FLOAT
|
||||
#define ALIGN_OF_DOUBLE PR_ALIGN_OF_DOUBLE
|
||||
#define ALIGN_OF_POINTER PR_ALIGN_OF_POINTER
|
||||
#define ALIGN_OF_WORD PR_ALIGN_OF_WORD
|
||||
|
||||
#define BYTES_PER_WORD_LOG2 PR_BYTES_PER_WORD_LOG2
|
||||
#define BYTES_PER_DWORD_LOG2 PR_BYTES_PER_DWORD_LOG2
|
||||
#define WORDS_PER_DWORD_LOG2 PR_WORDS_PER_DWORD_LOG2
|
||||
|
||||
#endif /* NO_NSPR_10_SUPPORT */
|
||||
|
||||
#endif /* nspr_cpucfg___ */
|
|
@ -1,583 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nspr_beos_defs_h___
|
||||
#define nspr_beos_defs_h___
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "prio.h"
|
||||
#include "prthread.h"
|
||||
#include "prproces.h"
|
||||
#include "prmem.h"
|
||||
#include "obsolete/prsem.h"
|
||||
#include <errno.h>
|
||||
|
||||
#include <support/SupportDefs.h>
|
||||
#include <kernel/OS.h>
|
||||
#include <dirent.h>
|
||||
|
||||
/*
|
||||
* Internal configuration macros
|
||||
*/
|
||||
|
||||
#ifdef BONE_VERSION
|
||||
#define _PR_HAVE_SOCKADDR_LEN
|
||||
#define HAVE_NETINET_TCP_H
|
||||
#endif
|
||||
|
||||
#define PR_LINKER_ARCH "beos"
|
||||
#define _PR_SI_SYSNAME "BEOS"
|
||||
#ifdef __powerpc__
|
||||
#define _PR_SI_ARCHITECTURE "ppc"
|
||||
#else
|
||||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
#endif
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
#define HAVE_DLL
|
||||
#define _PR_NO_CLOCK_TIMER
|
||||
|
||||
/*
|
||||
* The Atomic operations
|
||||
*/
|
||||
|
||||
#define _PR_HAVE_ATOMIC_OPS
|
||||
#define _MD_INIT_ATOMIC _MD_AtomicInit
|
||||
#define _MD_ATOMIC_INCREMENT _MD_AtomicIncrement
|
||||
#define _MD_ATOMIC_ADD _MD_AtomicAdd
|
||||
#define _MD_ATOMIC_DECREMENT _MD_AtomicDecrement
|
||||
#define _MD_ATOMIC_SET _MD_AtomicSet
|
||||
|
||||
#define HAVE_CVAR_BUILT_ON_SEM
|
||||
#define _PR_GLOBAL_THREADS_ONLY
|
||||
#define _PR_BTHREADS
|
||||
#define _PR_NEED_FAKE_POLL
|
||||
#define _PR_HAVE_PEEK_BUFFER
|
||||
#define _PR_PEEK_BUFFER_MAX (16 * 1024)
|
||||
#define _PR_FD_NEED_EMULATE_MSG_PEEK(fd) 1
|
||||
#define _PR_CONNECT_DOES_NOT_BIND
|
||||
#define _PR_HAVE_O_APPEND
|
||||
|
||||
/* Define threading functions and objects as native BeOS */
|
||||
struct _MDThread {
|
||||
thread_id tid; /* BeOS thread handle */
|
||||
sem_id joinSem; /* sems used to synchronzie joining */
|
||||
PRBool is_joining; /* TRUE if someone is currently waiting to
|
||||
join this thread */
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
* Lock and Semaphore related definitions
|
||||
*/
|
||||
|
||||
struct _MDLock {
|
||||
sem_id semaphoreID;
|
||||
int32 benaphoreCount;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
sem_id sem1;
|
||||
sem_id sem2;
|
||||
int16 count;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
sem_id sid;
|
||||
};
|
||||
|
||||
/*
|
||||
** CPU-related definitions
|
||||
*/
|
||||
struct _MDCPU {
|
||||
int8 unused;
|
||||
};
|
||||
|
||||
/*
|
||||
** Process-related definitions
|
||||
*/
|
||||
struct _MDProcess {
|
||||
pid_t pid;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
** File- and directory-related definitions
|
||||
*/
|
||||
|
||||
#ifndef BONE_VERSION
|
||||
#define BE_SOCK_SHUTDOWN_READ 0x01
|
||||
#define BE_SOCK_SHUTDOWN_WRITE 0x02
|
||||
#endif
|
||||
|
||||
struct _MDFileDesc {
|
||||
PRInt32 osfd;
|
||||
PRInt32 sock_state;
|
||||
PRBool accepted_socket;
|
||||
PRNetAddr peer_addr;
|
||||
#ifndef BONE_VERSION
|
||||
PRBool connectValueValid;
|
||||
int connectReturnValue;
|
||||
int connectReturnError;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct _MDDir {
|
||||
DIR *d;
|
||||
};
|
||||
|
||||
#define PR_DIRECTORY_SEPARATOR '/'
|
||||
#define PR_DIRECTORY_SEPARATOR_STR "/"
|
||||
#define PR_PATH_SEPARATOR ':'
|
||||
#define PR_PATH_SEPARATOR_STR ":"
|
||||
|
||||
#define GETTIMEOFDAY(tp) gettimeofday((tp), NULL)
|
||||
|
||||
/* --- Memory-mapped files stuff --- not implemented on BeOS */
|
||||
|
||||
struct _MDFileMap {
|
||||
PRInt8 unused;
|
||||
};
|
||||
|
||||
/*
|
||||
* Network related definitions.
|
||||
*/
|
||||
|
||||
#ifndef BONE_VERSION
|
||||
#define IPPROTO_IP 0
|
||||
#define AF_UNIX 2
|
||||
#define TCP_NODELAY SO_NONBLOCK
|
||||
#define SO_LINGER -1
|
||||
#define SO_ERROR 4
|
||||
#endif
|
||||
|
||||
#define _PR_INTERRUPT_CHECK_INTERVAL_SECS 5
|
||||
|
||||
#ifndef BONE_VERSION
|
||||
/* these aren't actually used. if they are, we're screwed */
|
||||
struct protoent {
|
||||
char *p_name; /* official protocol name */
|
||||
char **p_aliases; /* alias list */
|
||||
int p_proto; /* protocol # */
|
||||
};
|
||||
|
||||
struct protoent* getprotobyname(const char* name);
|
||||
struct protoent* getprotobynumber(int number);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* malloc() related definitions.
|
||||
*/
|
||||
|
||||
#undef _PR_OVERRIDE_MALLOC
|
||||
|
||||
/* Miscellaneous */
|
||||
|
||||
#define _MD_ERRNO() (errno)
|
||||
|
||||
#define _MD_CLEANUP_BEFORE_EXIT _MD_cleanup_before_exit
|
||||
#define _MD_EXIT _MD_exit
|
||||
|
||||
#define _MD_GET_ENV getenv
|
||||
#define _MD_PUT_ENV putenv
|
||||
|
||||
#define _MD_EARLY_INIT _MD_early_init
|
||||
#define _MD_FINAL_INIT _MD_final_init
|
||||
#define _MD_EARLY_CLEANUP()
|
||||
|
||||
/* CPU Stuff */
|
||||
|
||||
#define _MD_INIT_CPUS _MD_init_cpus
|
||||
#define _MD_WAKEUP_CPUS _MD_wakeup_cpus
|
||||
#define _MD_START_INTERRUPTS _MD_start_interrupts
|
||||
#define _MD_STOP_INTERRUPTS _MD_stop_interrupts
|
||||
#define _MD_DISABLE_CLOCK_INTERRUPTS _MD_disable_clock_interrupts
|
||||
#define _MD_BLOCK_CLOCK_INTERRUPTS _MD_block_clock_interrupts
|
||||
#define _MD_UNBLOCK_CLOCK_INTERRUPTS _MD_unblock_clock_interrupts
|
||||
#define _MD_CLOCK_INTERRUPT _MD_clock_interrupt
|
||||
#define _MD_INIT_STACK _MD_init_stack
|
||||
#define _MD_CLEAR_STACK _MD_clear_stack
|
||||
// #define _MD_GET_INTSOFF _MD_get_intsoff
|
||||
// #define _MD_SET_INTSOFF _MD_set_intsoff
|
||||
#define _MD_CURRENT_CPU _MD_current_cpu
|
||||
#define _MD_SET_CURRENT_CPU _MD_set_current_cpu
|
||||
#define _MD_INIT_RUNNING_CPU _MD_init_running_cpu
|
||||
#define _MD_PAUSE_CPU _MD_pause_cpu
|
||||
|
||||
/* Thread stuff */
|
||||
|
||||
#define _MD_CURRENT_THREAD() PR_GetCurrentThread()
|
||||
// #define _MD_GET_ATTACHED_THREAD _MD_get_attached_thread
|
||||
#define _MD_LAST_THREAD _MD_last_thread
|
||||
#define _MD_SET_CURRENT_THREAD _MD_set_current_THREAD
|
||||
#define _MD_SET_LAST_THREAD _MD_set_last_thread
|
||||
#define _MD_INIT_THREAD _MD_init_thread
|
||||
#define _MD_EXIT_THREAD _MD_exit_thread
|
||||
#define _MD_INIT_ATTACHED_THREAD _MD_init_attached_thread
|
||||
|
||||
#define _MD_SUSPEND_THREAD _MD_suspend_thread
|
||||
#define _MD_RESUME_THREAD _MD_resume_thread
|
||||
#define _MD_SUSPEND_CPU _MD_suspend_cpu
|
||||
#define _MD_RESUME_CPU _MD_resume_cpu
|
||||
#define _MD_BEGIN_SUSPEND_ALL _MD_begin_suspend_all
|
||||
#define _MD_END_SUSPEND_ALL _MD_end_suspend_all
|
||||
#define _MD_BEGIN_RESUME_ALL _MD_begin_resume_all
|
||||
#define _MD_END_RESUME_ALL _MD_end_resume_all
|
||||
|
||||
#define _MD_GET_SP _MD_get_sp
|
||||
|
||||
#define _MD_CLEAN_THREAD _MD_clean_thread
|
||||
#define _MD_CREATE_PRIMORDIAL_USER_THREAD _MD_create_primordial_user_thread
|
||||
#define _MD_CREATE_USER_THREAD _MD_create_user_thread
|
||||
#define _MD_INIT_PRIMORDIAL_THREAD _MD_init_primordial_thread
|
||||
#define _MD_CREATE_THREAD _MD_create_thread
|
||||
#define _MD_YIELD _MD_yield
|
||||
#define _MD_SET_PRIORITY _MD_set_priority
|
||||
|
||||
#define _MD_SUSPENDALL _MD_suspendall
|
||||
#define _MD_RESUMEALL _MD_resumeall
|
||||
|
||||
#define _MD_SWITCH_CONTEXT _MD_switch_context
|
||||
#define _MD_RESTORE_CONTEXT _MD_restore_context
|
||||
|
||||
#define _MD_WAIT _MD_wait
|
||||
#define _MD_WAKEUP_WAITER _MD_wakeup_waiter
|
||||
|
||||
#define _MD_SETTHREADAFFINITYMASK _MD_setthreadaffinitymask
|
||||
#define _MD_GETTHREADAFFINITYMASK _MD_getthreadaffinitymask
|
||||
|
||||
/* Thread Synchronization */
|
||||
|
||||
#define _MD_INIT_LOCKS _MD_init_locks
|
||||
#define _MD_NEW_LOCK _MD_new_lock
|
||||
#define _MD_FREE_LOCK _MD_free_lock
|
||||
#define _MD_LOCK _MD_lock
|
||||
#define _MD_TEST_AND_LOCK _MD_test_and_lock
|
||||
#define _MD_UNLOCK _MD_unlock
|
||||
#define _MD_IOQ_LOCK _MD_ioq_lock
|
||||
#define _MD_IOQ_UNLOCK _MD_ioq_unlock
|
||||
#define _MD_NEW_SEM _MD_new_sem
|
||||
#define _MD_DESTROY_SEM _MD_destroy_sem
|
||||
#define _MD_TIMED_WAIT_SEM _MD_timed_wait_sem
|
||||
#define _MD_WAIT_SEM _MD_wait_sem
|
||||
#define _MD_POST_SEM _MD_post_sem
|
||||
// #define _MD_NEW_CV _MD_new_cv
|
||||
// #define _MD_FREE_CV _MD_free_cv
|
||||
// #define _MD_WAIT_CV _MD_wait_cv
|
||||
// #define _MD_NOTIFY_CV _MD_notify_cv
|
||||
// #define _MD_NOTIFYALL_CV _MD_notifyall_cv
|
||||
|
||||
/* File I/O */
|
||||
|
||||
/* don't need any I/O initializations */
|
||||
#define _MD_INIT_IO()
|
||||
#define _MD_INIT_FILEDESC(fd)
|
||||
|
||||
#define _MD_OPEN_DIR _MD_open_dir
|
||||
#define _MD_READ_DIR _MD_read_dir
|
||||
#define _MD_CLOSE_DIR _MD_close_dir
|
||||
#define _MD_MAKE_NONBLOCK _MD_make_nonblock
|
||||
#define _MD_SET_FD_INHERITABLE _MD_set_fd_inheritable
|
||||
#define _MD_INIT_FD_INHERITABLE _MD_init_fd_inheritable
|
||||
#define _MD_QUERY_FD_INHERITABLE _MD_query_fd_inheritable
|
||||
#define _MD_OPEN _MD_open
|
||||
#define _MD_OPEN_FILE _MD_open
|
||||
#define _MD_CLOSE_FILE _MD_close_file
|
||||
#define _MD_READ _MD_read
|
||||
#define _MD_WRITE _MD_write
|
||||
#define _MD_WRITEV _MD_writev
|
||||
#define _MD_LSEEK _MD_lseek
|
||||
#define _MD_LSEEK64 _MD_lseek64
|
||||
#define _MD_FSYNC _MD_fsync
|
||||
#define _MD_DELETE _MD_delete
|
||||
#define _MD_GETFILEINFO _MD_getfileinfo
|
||||
#define _MD_GETFILEINFO64 _MD_getfileinfo64
|
||||
#define _MD_GETOPENFILEINFO _MD_getopenfileinfo
|
||||
#define _MD_GETOPENFILEINFO64 _MD_getopenfileinfo64
|
||||
#define _MD_RENAME _MD_rename
|
||||
#define _MD_ACCESS _MD_access
|
||||
#define _MD_STAT stat
|
||||
#define _MD_MKDIR _MD_mkdir
|
||||
#define _MD_MAKE_DIR _MD_mkdir
|
||||
#define _MD_RMDIR _MD_rmdir
|
||||
#define _MD_PR_POLL _MD_pr_poll
|
||||
|
||||
/* Network I/O */
|
||||
|
||||
#define _MD_CLOSE_SOCKET _MD_close_socket
|
||||
#define _MD_CONNECT _MD_connect
|
||||
#define _MD_ACCEPT _MD_accept
|
||||
#define _MD_BIND _MD_bind
|
||||
#define _MD_LISTEN _MD_listen
|
||||
#define _MD_SHUTDOWN _MD_shutdown
|
||||
#define _MD_RECV _MD_recv
|
||||
#define _MD_SEND _MD_send
|
||||
#define _MD_ACCEPT_READ _MD_accept_read
|
||||
#define _MD_GETSOCKNAME _MD_getsockname
|
||||
#define _MD_GETPEERNAME _MD_getpeername
|
||||
#define _MD_GETSOCKOPT _MD_getsockopt
|
||||
#define _MD_SETSOCKOPT _MD_setsockopt
|
||||
#define _MD_RECVFROM _MD_recvfrom
|
||||
#define _MD_SENDTO _MD_sendto
|
||||
#define _MD_SOCKETPAIR _MD_socketpair
|
||||
#define _MD_SOCKET _MD_socket
|
||||
#define _MD_SOCKETAVAILABLE _MD_socketavailable
|
||||
#define _MD_PIPEAVAILABLE _MD_socketavailable
|
||||
|
||||
#define _MD_GET_SOCKET_ERROR() (errno)
|
||||
#define _MD_GETHOSTNAME _MD_gethostname
|
||||
|
||||
#define _MD_SELECT select
|
||||
|
||||
/* Process management */
|
||||
|
||||
#define _MD_CREATE_PROCESS _MD_create_process
|
||||
#define _MD_DETACH_PROCESS _MD_detach_process
|
||||
#define _MD_WAIT_PROCESS _MD_wait_process
|
||||
#define _MD_KILL_PROCESS _MD_kill_process
|
||||
|
||||
/* Atomic data operations */
|
||||
|
||||
// #define _MD_INIT_ATOMIC _MD_init_atomic
|
||||
// #define _MD_ATOMIC_INCREMENT _MD_atomic_increment
|
||||
// #define _MD_ATOMIC_DECREMENT _MD_atomic_decrement
|
||||
// #define _MD_ATOMIC_SET _MD_atomic_set
|
||||
|
||||
/* memory management */
|
||||
|
||||
#define _MD_INIT_SEGS _MD_init_segs
|
||||
#define _MD_ALLOC_SEGMENT _MD_alloc_segment
|
||||
#define _MD_FREE_SEGMENT _MD_free_segment
|
||||
|
||||
/* Memory mapped file I/O */
|
||||
|
||||
#define _MD_CREATE_FILE_MAP _MD_create_file_map
|
||||
#define _MD_GET_MEM_MAP_ALIGNMENT _MD_get_mem_map_alignment
|
||||
#define _MD_MEM_MAP _MD_mem_map
|
||||
#define _MD_MEM_UNMAP _MD_mem_unmap
|
||||
#define _MD_CLOSE_FILE_MAP _MD_close_file_map
|
||||
|
||||
/* Time related */
|
||||
|
||||
#define _MD_NOW _MD_now
|
||||
#define _MD_INTERVAL_INIT _MD_interval_init
|
||||
#define _MD_GET_INTERVAL _MD_get_interval
|
||||
#define _MD_INTERVAL_PER_SEC _MD_interval_per_sec
|
||||
|
||||
/* File locking */
|
||||
|
||||
#define _MD_LOCKFILE _MD_lockfile
|
||||
#define _MD_TLOCKFILE _MD_tlockfile
|
||||
#define _MD_UNLOCKFILE _MD_unlockfile
|
||||
|
||||
/**
|
||||
* Prototypes for machine dependent function implementations. (Too bad
|
||||
* NSPR's MD system blows so much that we have to reiterate every stinking
|
||||
* thing we implement here in our MD header file.)
|
||||
*/
|
||||
|
||||
/* Miscellaneous */
|
||||
|
||||
NSPR_API(void) _MD_cleanup_before_exit(void);
|
||||
NSPR_API(void) _MD_exit(PRIntn status);
|
||||
|
||||
NSPR_API(char*) _MD_get_env(const char *name);
|
||||
NSPR_API(PRIntn) _MD_put_env(const char *name);
|
||||
|
||||
NSPR_API(void) _MD_early_init(void);
|
||||
NSPR_API(void) _MD_final_init(void);
|
||||
|
||||
/* CPU Stuff */
|
||||
|
||||
NSPR_API(void) _MD_init_cpus();
|
||||
NSPR_API(void) _MD_wakeup_cpus();
|
||||
NSPR_API(void) _MD_start_interrupts(void);
|
||||
NSPR_API(void) _MD_stop_interrupts(void);
|
||||
NSPR_API(void) _MD_disable_clock_interrupts(void);
|
||||
NSPR_API(void) _MD_block_clock_interrupts(void);
|
||||
NSPR_API(void) _MD_unblock_clock_interrupts(void);
|
||||
NSPR_API(void) _MD_clock_interrupt(void);
|
||||
// NSPR_API(void) _MD_init_stack(PRThreadStack *ts, PRIntn redzone);
|
||||
// NSPR_API(void) _MD_clear_stack(PRThreadStack* ts);
|
||||
// NSPR_API(PRInt32) _MD_get_intsoff(void);
|
||||
// NSPR_API(void) _MD_set_intsoff(PRInt32 _val);
|
||||
// NSPR_API(_PRCPU*) _MD_current_cpu(void);
|
||||
// NSPR_API(void) _MD_set_current_cpu(_PRCPU *cpu);
|
||||
// NSPR_API(void) _MD_init_running_cpu(_PRCPU *cpu);
|
||||
NSPR_API(PRInt32) _MD_pause_cpu(PRIntervalTime timeout);
|
||||
|
||||
/* Thread stuff */
|
||||
|
||||
// NSPR_API(PRThread*) _MD_current_thread(void);
|
||||
NSPR_API(PRThread*) _MD_get_attached_thread(void);
|
||||
NSPR_API(PRThread*) _MD_last_thread(void);
|
||||
NSPR_API(void) _MD_set_current_thread(PRThread *thread);
|
||||
NSPR_API(void) _MD_set_last_thread(PRThread *thread);
|
||||
NSPR_API(PRStatus) _MD_init_thread(PRThread *thread);
|
||||
NSPR_API(void) _MD_exit_thread(PRThread *thread);
|
||||
NSPR_API(PRStatus) _MD_init_attached_thread(PRThread *thread);
|
||||
|
||||
NSPR_API(void) _MD_suspend_thread(PRThread *thread);
|
||||
NSPR_API(void) _MD_resume_thread(PRThread *thread);
|
||||
// NSPR_API(void) _MD_suspend_cpu(_PRCPU *cpu);
|
||||
// NSPR_API(void) _MD_resume_cpu(_PRCPU *cpu);
|
||||
NSPR_API(void) _MD_begin_suspend_all(void);
|
||||
NSPR_API(void) _MD_end_suspend_all(void);
|
||||
NSPR_API(void) _MD_begin_resume_all(void);
|
||||
NSPR_API(void) _MD_end_resume_all(void);
|
||||
|
||||
NSPR_API(void *) _MD_get_sp(PRThread *thread);
|
||||
|
||||
NSPR_API(void) _MD_clean_thread(PRThread *thread);
|
||||
NSPR_API(void) _MD_create_primordial_user_thread(PRThread *);
|
||||
NSPR_API(PRThread*) _MD_create_user_thread(PRUint32 stacksize, void (*start)(void *), void *arg);
|
||||
NSPR_API(void) _MD_init_primordial_thread(PRThread *thread);
|
||||
NSPR_API(PRStatus) _MD_create_thread(PRThread *thread, void (*start)(void *), PRThreadPriority priority, PRThreadScope scope, PRThreadState state, PRUint32 stackSize);
|
||||
NSPR_API(void) _MD_yield(void);
|
||||
NSPR_API(void) _MD_set_priority(struct _MDThread *md, PRThreadPriority newPri);
|
||||
|
||||
NSPR_API(void) _MD_suspendall(void);
|
||||
NSPR_API(void) _MD_resumeall(void);
|
||||
|
||||
NSPR_API(void) _MD_init_context(PRThread *thread, char *top, void (*start) (void), PRBool *status);
|
||||
NSPR_API(void) _MD_switch_context(PRThread *thread);
|
||||
NSPR_API(void) _MD_restore_context(PRThread *thread);
|
||||
|
||||
NSPR_API(PRStatus) _MD_wait(PRThread *, PRIntervalTime timeout);
|
||||
NSPR_API(PRStatus) _MD_wakeup_waiter(PRThread *);
|
||||
|
||||
NSPR_API(PRInt32) _MD_setthreadaffinitymask(PRThread *thread, PRUint32 mask );
|
||||
NSPR_API(PRInt32) _MD_getthreadaffinitymask(PRThread *thread, PRUint32 *mask);
|
||||
|
||||
/* Thread Synchronization */
|
||||
|
||||
NSPR_API(void) _MD_init_locks(void);
|
||||
NSPR_API(PRStatus) _MD_new_lock(struct _MDLock *md);
|
||||
NSPR_API(void) _MD_free_lock(struct _MDLock *md);
|
||||
NSPR_API(void) _MD_lock(struct _MDLock *md);
|
||||
NSPR_API(PRIntn) _MD_test_and_lock(struct _MDLock *md);
|
||||
NSPR_API(void) _MD_unlock(struct _MDLock *md);
|
||||
NSPR_API(void) _MD_ioq_lock(void);
|
||||
NSPR_API(void) _MD_ioq_unlock(void);
|
||||
NSPR_API(void) _MD_new_sem(struct _MDSemaphore *md, PRUintn value);
|
||||
NSPR_API(void) _MD_destroy_sem(struct _MDSemaphore *md);
|
||||
NSPR_API(PRStatus) _MD_timed_wait_sem(struct _MDSemaphore *md, PRIntervalTime timeout);
|
||||
NSPR_API(PRStatus) _MD_wait_sem(struct _MDSemaphore *md);
|
||||
NSPR_API(void) _MD_post_sem(struct _MDSemaphore *md);
|
||||
// NSPR_API(PRInt32) _MD_new_cv(struct _MDCVar *md);
|
||||
// NSPR_API(void) _MD_free_cv(struct _MDCVar *md);
|
||||
// NSPR_API(void) _MD_wait_cv(struct _MDCVar *mdCVar, struct _MDLock *mdLock, PRIntervalTime timeout);
|
||||
// NSPR_API(void) _MD_notify_cv(struct _MDCVar *md, struct _MDLock *lock);
|
||||
// NSPR_API(void) _MD_notifyall_cv(struct _MDCVar *md, struct _MDLock *lock);
|
||||
|
||||
/* File I/O */
|
||||
|
||||
// NSPR_API(void) _MD_init_io(void);
|
||||
NSPR_API(PRStatus) _MD_open_dir(struct _MDDir *md,const char *name);
|
||||
NSPR_API(char *) _MD_read_dir(struct _MDDir *md, PRIntn flags);
|
||||
NSPR_API(PRInt32) _MD_close_dir(struct _MDDir *md);
|
||||
NSPR_API(void) _MD_make_nonblock(PRFileDesc *fd);
|
||||
NSPR_API(void) _MD_init_fd_inheritable(PRFileDesc *fd, PRBool imported);
|
||||
NSPR_API(void) _MD_query_fd_inheritable(PRFileDesc *fd);
|
||||
NSPR_API(PRInt32) _MD_open(const char *name, PRIntn osflags, PRIntn mode);
|
||||
NSPR_API(PRInt32) _MD_close_file(PRInt32 osfd);
|
||||
NSPR_API(PRInt32) _MD_read(PRFileDesc *fd, void *buf, PRInt32 amount);
|
||||
NSPR_API(PRInt32) _MD_write(PRFileDesc *fd, const void *buf, PRInt32 amount);
|
||||
NSPR_API(PRInt32) _MD_writev(PRFileDesc *fd, const PRIOVec *iov, PRInt32 iov_size, PRIntervalTime timeout);
|
||||
NSPR_API(PRInt32) _MD_lseek(PRFileDesc *fd, PRInt32 offset, int whence);
|
||||
NSPR_API(PRInt64) _MD_lseek64(PRFileDesc *fd, PRInt64 offset, int whence);
|
||||
NSPR_API(PRInt32) _MD_fsync(PRFileDesc *fd);
|
||||
NSPR_API(PRInt32) _MD_delete(const char *name);
|
||||
NSPR_API(PRInt32) _MD_getfileinfo(const char *fn, PRFileInfo *info);
|
||||
NSPR_API(PRInt32) _MD_getfileinfo64(const char *fn, PRFileInfo64 *info);
|
||||
NSPR_API(PRInt32) _MD_getopenfileinfo(const PRFileDesc *fd, PRFileInfo *info);
|
||||
NSPR_API(PRInt32) _MD_getopenfileinfo64(const PRFileDesc *fd, PRFileInfo64 *info);
|
||||
NSPR_API(PRInt32) _MD_rename(const char *from, const char *to);
|
||||
NSPR_API(PRInt32) _MD_access(const char *name, PRIntn how);
|
||||
NSPR_API(PRInt32) _MD_stat(const char *name, struct stat *buf);
|
||||
NSPR_API(PRInt32) _MD_mkdir(const char *name, PRIntn mode);
|
||||
NSPR_API(PRInt32) _MD_rmdir(const char *name);
|
||||
NSPR_API(PRInt32) _MD_pr_poll(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout);
|
||||
|
||||
/* Network I/O */
|
||||
NSPR_API(PRInt32) _MD_close_socket(PRInt32 osfd);
|
||||
NSPR_API(PRInt32) _MD_connect(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen, PRIntervalTime timeout);
|
||||
NSPR_API(PRInt32) _MD_accept(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen, PRIntervalTime timeout);
|
||||
NSPR_API(PRInt32) _MD_bind(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen);
|
||||
NSPR_API(PRInt32) _MD_listen(PRFileDesc *fd, PRIntn backlog);
|
||||
NSPR_API(PRInt32) _MD_shutdown(PRFileDesc *fd, PRIntn how);
|
||||
NSPR_API(PRInt32) _MD_recv(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRIntervalTime timeout);
|
||||
NSPR_API(PRInt32) _MD_send(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, PRIntervalTime timeout);
|
||||
NSPR_API(PRInt32) _MD_accept_read(PRFileDesc *sd, PRInt32 *newSock, PRNetAddr **raddr, void *buf, PRInt32 amount, PRIntervalTime timeout);
|
||||
// NSPR_API(PRInt32) _MD_fast_accept(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen, PRIntervalTime timeout, PRBool fast, _PR_AcceptTimeoutCallback callback, void *callbackArg);
|
||||
// NSPR_API(PRInt32) _MD_fast_accept_read(PRFileDesc *sd, PRInt32 *newSock, PRNetAddr **raddr, void *buf, PRInt32 amount, PRIntervalTime timeout, PRBool fast, _PR_AcceptTimeoutCallback callback, void *callbackArg);
|
||||
// NSPR_API(void) _MD_update_accept_context(PRInt32 s, PRInt32 ls);
|
||||
NSPR_API(PRStatus) _MD_getsockname(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen);
|
||||
NSPR_API(PRStatus) _MD_getpeername(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen);
|
||||
NSPR_API(PRStatus) _MD_getsockopt(PRFileDesc *fd, PRInt32 level, PRInt32 optname, char* optval, PRInt32* optlen);
|
||||
NSPR_API(PRStatus) _MD_setsockopt(PRFileDesc *fd, PRInt32 level, PRInt32 optname, const char* optval, PRInt32 optlen);
|
||||
NSPR_API(PRInt32) _MD_recvfrom(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRNetAddr *addr, PRUint32 *addrlen, PRIntervalTime timeout);
|
||||
NSPR_API(PRInt32) _MD_sendto(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, const PRNetAddr *addr, PRUint32 addrlen, PRIntervalTime timeout);
|
||||
NSPR_API(PRInt32) _MD_socketpair(int af, int type, int flags, PRInt32 *osfd);
|
||||
NSPR_API(PRInt32) _MD_socket(int af, int type, int flags);
|
||||
NSPR_API(PRInt32) _MD_socketavailable(PRFileDesc *fd);
|
||||
|
||||
// NSPR_API(PRInt32) _MD_get_socket_error(void);
|
||||
NSPR_API(PRStatus) _MD_gethostname(char *name, PRUint32 namelen);
|
||||
|
||||
/* Process management */
|
||||
|
||||
NSPR_API(PRProcess *) _MD_create_process(const char *path, char *const *argv, char *const *envp, const PRProcessAttr *attr);
|
||||
NSPR_API(PRStatus) _MD_detach_process(PRProcess *process);
|
||||
NSPR_API(PRStatus) _MD_wait_process(PRProcess *process, PRInt32 *exitCode);
|
||||
NSPR_API(PRStatus) _MD_kill_process(PRProcess *process);
|
||||
|
||||
/* Atomic data operations */
|
||||
|
||||
// NSPR_API(void) _MD_init_atomic(void);
|
||||
// NSPR_API(PRInt32) _MD_atomic_increment(PRInt32 *);
|
||||
// NSPR_API(PRInt32) _MD_atomic_decrement(PRInt32 *);
|
||||
// NSPR_API(PRInt32) _MD_atomic_set(PRInt32 *, PRInt32);
|
||||
|
||||
/* Memory management */
|
||||
|
||||
NSPR_API(void) _MD_init_segs(void);
|
||||
NSPR_API(PRStatus) _MD_alloc_segment(PRSegment *seg, PRUint32 size, void *vaddr);
|
||||
NSPR_API(void) _MD_free_segment(PRSegment *seg);
|
||||
|
||||
/* Memory mapped file I/O */
|
||||
|
||||
NSPR_API(PRStatus) _MD_create_file_map(PRFileMap *fmap, PRInt64 size);
|
||||
NSPR_API(PRInt32) _MD_get_mem_map_alignment(void);
|
||||
NSPR_API(void *) _MD_mem_map(PRFileMap *fmap, PRInt64 offset, PRUint32 len);
|
||||
NSPR_API(PRStatus) _MD_mem_unmap(void *addr, PRUint32 size);
|
||||
NSPR_API(PRStatus) _MD_close_file_map(PRFileMap *fmap);
|
||||
|
||||
/* Time related */
|
||||
|
||||
NSPR_API(PRTime) _MD_now(void);
|
||||
NSPR_API(void) _MD_interval_init(void);
|
||||
NSPR_API(PRIntervalTime) _MD_get_interval(void);
|
||||
NSPR_API(PRIntervalTime) _MD_interval_per_sec(void);
|
||||
|
||||
/* File locking */
|
||||
|
||||
NSPR_API(PRStatus) _MD_lockfile(PRInt32 osfd);
|
||||
NSPR_API(PRStatus) _MD_tlockfile(PRInt32 osfd);
|
||||
NSPR_API(PRStatus) _MD_unlockfile(PRInt32 osfd);
|
||||
|
||||
#endif /* _nspr_beos_defs_h___*/
|
|
@ -1,108 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nspr_cpucfg___
|
||||
#define nspr_cpucfg___
|
||||
|
||||
#ifndef XP_UNIX
|
||||
#define XP_UNIX
|
||||
#endif
|
||||
|
||||
#ifndef DGUX
|
||||
#define DGUX
|
||||
#endif
|
||||
|
||||
#define IS_LITTLE_ENDIAN 1
|
||||
#undef IS_BIG_ENDIAN
|
||||
#ifndef HAVE_LONG_LONG
|
||||
#define HAVE_LONG_LONG
|
||||
#endif
|
||||
#undef HAVE_ALIGNED_DOUBLES
|
||||
#undef HAVE_ALIGNED_LONGLONGS
|
||||
|
||||
#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 4
|
||||
#define PR_BYTES_PER_FLOAT 4
|
||||
#define PR_BYTES_PER_DOUBLE 8
|
||||
#define PR_BYTES_PER_WORD 4
|
||||
#define PR_BYTES_PER_DWORD 8
|
||||
#define PR_BYTES_PER_WORD_LOG2 2
|
||||
#define PR_BYTES_PER_DWORD_LOG2 3
|
||||
|
||||
#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 32
|
||||
#define PR_BITS_PER_FLOAT 32
|
||||
#define PR_BITS_PER_DOUBLE 64
|
||||
#define PR_BITS_PER_WORD 32
|
||||
|
||||
#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 5
|
||||
#define PR_BITS_PER_FLOAT_LOG2 5
|
||||
#define PR_BITS_PER_DOUBLE_LOG2 6
|
||||
#define PR_BITS_PER_WORD_LOG2 5
|
||||
|
||||
#define PR_ALIGN_OF_SHORT 2
|
||||
#define PR_ALIGN_OF_INT 4
|
||||
#define PR_ALIGN_OF_LONG 4
|
||||
#define PR_ALIGN_OF_INT64 4
|
||||
#define PR_ALIGN_OF_FLOAT 4
|
||||
#define PR_ALIGN_OF_DOUBLE 4
|
||||
#define PR_ALIGN_OF_POINTER 4
|
||||
|
||||
#ifndef NO_NSPR_10_SUPPORT
|
||||
|
||||
#define BYTES_PER_BYTE PR_BYTES_PER_BYTE
|
||||
#define BYTES_PER_SHORT PR_BYTES_PER_SHORT
|
||||
#define BYTES_PER_INT PR_BYTES_PER_INT
|
||||
#define BYTES_PER_INT64 PR_BYTES_PER_INT64
|
||||
#define BYTES_PER_LONG PR_BYTES_PER_LONG
|
||||
#define BYTES_PER_FLOAT PR_BYTES_PER_FLOAT
|
||||
#define BYTES_PER_DOUBLE PR_BYTES_PER_DOUBLE
|
||||
#define BYTES_PER_WORD PR_BYTES_PER_WORD
|
||||
#define BYTES_PER_DWORD PR_BYTES_PER_DWORD
|
||||
|
||||
#define BITS_PER_BYTE PR_BITS_PER_BYTE
|
||||
#define BITS_PER_SHORT PR_BITS_PER_SHORT
|
||||
#define BITS_PER_INT PR_BITS_PER_INT
|
||||
#define BITS_PER_INT64 PR_BITS_PER_INT64
|
||||
#define BITS_PER_LONG PR_BITS_PER_LONG
|
||||
#define BITS_PER_FLOAT PR_BITS_PER_FLOAT
|
||||
#define BITS_PER_DOUBLE PR_BITS_PER_DOUBLE
|
||||
#define BITS_PER_WORD PR_BITS_PER_WORD
|
||||
|
||||
#define BITS_PER_BYTE_LOG2 PR_BITS_PER_BYTE_LOG2
|
||||
#define BITS_PER_SHORT_LOG2 PR_BITS_PER_SHORT_LOG2
|
||||
#define BITS_PER_INT_LOG2 PR_BITS_PER_INT_LOG2
|
||||
#define BITS_PER_INT64_LOG2 PR_BITS_PER_INT64_LOG2
|
||||
#define BITS_PER_LONG_LOG2 PR_BITS_PER_LONG_LOG2
|
||||
#define BITS_PER_FLOAT_LOG2 PR_BITS_PER_FLOAT_LOG2
|
||||
#define BITS_PER_DOUBLE_LOG2 PR_BITS_PER_DOUBLE_LOG2
|
||||
#define BITS_PER_WORD_LOG2 PR_BITS_PER_WORD_LOG2
|
||||
|
||||
#define ALIGN_OF_SHORT PR_ALIGN_OF_SHORT
|
||||
#define ALIGN_OF_INT PR_ALIGN_OF_INT
|
||||
#define ALIGN_OF_LONG PR_ALIGN_OF_LONG
|
||||
#define ALIGN_OF_INT64 PR_ALIGN_OF_INT64
|
||||
#define ALIGN_OF_FLOAT PR_ALIGN_OF_FLOAT
|
||||
#define ALIGN_OF_DOUBLE PR_ALIGN_OF_DOUBLE
|
||||
#define ALIGN_OF_POINTER PR_ALIGN_OF_POINTER
|
||||
#define ALIGN_OF_WORD PR_ALIGN_OF_WORD
|
||||
|
||||
#define BYTES_PER_WORD_LOG2 PR_BYTES_PER_WORD_LOG2
|
||||
#define BYTES_PER_DWORD_LOG2 PR_BYTES_PER_DWORD_LOG2
|
||||
#define WORDS_PER_DWORD_LOG2 PR_WORDS_PER_DWORD_LOG2
|
||||
|
||||
#endif /* NO_NSPR_10_SUPPORT */
|
||||
|
||||
#endif /* nspr_cpucfg___ */
|
|
@ -1,188 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nspr_dgux_defs_h___
|
||||
#define nspr_dgux_defs_h___
|
||||
|
||||
/*
|
||||
* Internal configuration macros
|
||||
*/
|
||||
|
||||
#define PR_LINKER_ARCH "dgux"
|
||||
#define _PR_SI_SYSNAME "DGUX"
|
||||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#ifndef HAVE_WEAK_IO_SYMBOLS
|
||||
#define HAVE_WEAK_IO_SYMBOLS
|
||||
#endif
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
#define HAVE_NETCONFIG
|
||||
#define HAVE_DLL
|
||||
#define USE_DLFCN
|
||||
#define NEED_STRFTIME_LOCK
|
||||
#define NEED_TIME_R
|
||||
#define _PR_NEED_STRCASECMP
|
||||
#define _PR_POLL_AVAILABLE
|
||||
#define _PR_USE_POLL
|
||||
#define _PR_NO_LARGE_FILES
|
||||
#define _PR_STAT_HAS_ONLY_ST_ATIME
|
||||
|
||||
#define USE_SETJMP
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
#define _SETJMP setjmp
|
||||
#define _LONGJMP longjmp
|
||||
#define _PR_CONTEXT_TYPE jmp_buf
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[4]
|
||||
#define _PR_NUM_GCREGS _JBLEN
|
||||
|
||||
#define CONTEXT(_th) ((_th)->md.context)
|
||||
|
||||
/*
|
||||
** Initialize the thread context preparing it to execute _main.
|
||||
*/
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
*status = PR_TRUE; \
|
||||
if(_SETJMP(CONTEXT(_thread))) (*_main)(); \
|
||||
_MD_GET_SP(_thread) = (int) ((_sp) - 128); \
|
||||
}
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!_SETJMP(CONTEXT(_thread))) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
{ \
|
||||
errno = (_thread)->md.errcode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
_LONGJMP(CONTEXT(_thread), 1); \
|
||||
}
|
||||
|
||||
/* Machine-dependent (MD) data structures.
|
||||
* Don't use SVR4 native threads (yet).
|
||||
*/
|
||||
|
||||
struct _MDThread {
|
||||
_PR_CONTEXT_TYPE context;
|
||||
int id;
|
||||
int errcode;
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDLock {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
* md-specific cpu structure field
|
||||
*/
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
|
||||
struct _MDCPU_Unix {
|
||||
PRCList ioQ;
|
||||
PRUint32 ioq_timeout;
|
||||
PRInt32 ioq_max_osfd;
|
||||
PRInt32 ioq_osfd_cnt;
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
#define _MD_INIT_LOCKS()
|
||||
#define _MD_NEW_LOCK(lock) PR_SUCCESS
|
||||
#define _MD_FREE_LOCK(lock)
|
||||
#define _MD_LOCK(lock)
|
||||
#define _MD_UNLOCK(lock)
|
||||
#define _MD_INIT_IO()
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
/*
|
||||
* The following are copied from _sunos.h, _aix.h. This means
|
||||
* some of them should probably be moved into _unixos.h. But
|
||||
* _irix.h seems to be quite different in regard to these macros.
|
||||
*/
|
||||
#define _MD_INTERVAL_USE_GTOD
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EXIT_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread)
|
||||
#define _MD_RESUME_THREAD(thread)
|
||||
#define _MD_CLEAN_THREAD(_thread)
|
||||
|
||||
/*
|
||||
* We wrapped the select() call. _MD_SELECT refers to the built-in,
|
||||
* unwrapped version.
|
||||
*/
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
extern int _select(int nfds, fd_set *readfds, fd_set *writefds,
|
||||
fd_set *execptfds, struct timeval *timeout);
|
||||
#define _MD_SELECT _select
|
||||
|
||||
#define _MD_POLL _poll
|
||||
#include <poll.h>
|
||||
#include <stropts.h>
|
||||
extern int _poll(struct pollfd *fds, unsigned long nfds, int timeout);
|
||||
|
||||
#endif /* nspr_dgux_defs_h___ */
|
|
@ -1,438 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nspr_irix_defs_h___
|
||||
#define nspr_irix_defs_h___
|
||||
|
||||
#define _PR_HAVE_ATOMIC_CAS
|
||||
|
||||
/*
|
||||
* MipsPro assembler defines _LANGUAGE_ASSEMBLY
|
||||
*/
|
||||
#ifndef _LANGUAGE_ASSEMBLY
|
||||
|
||||
#include "prclist.h"
|
||||
#include "prthread.h"
|
||||
#include <sys/ucontext.h>
|
||||
|
||||
/*
|
||||
* Internal configuration macros
|
||||
*/
|
||||
|
||||
#define PR_LINKER_ARCH "irix"
|
||||
#define _PR_SI_SYSNAME "IRIX"
|
||||
#define _PR_SI_ARCHITECTURE "mips"
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _PR_NUM_GCREGS 9
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_MIN_STACK_SIZE 16384L
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
#define HAVE_WEAK_IO_SYMBOLS
|
||||
#define HAVE_WEAK_MALLOC_SYMBOLS
|
||||
#define HAVE_DLL
|
||||
#define USE_DLFCN
|
||||
#define _PR_HAVE_ATOMIC_OPS
|
||||
#define _PR_POLL_AVAILABLE
|
||||
#define _PR_USE_POLL
|
||||
#define _PR_STAT_HAS_ST_ATIM
|
||||
#define _PR_HAVE_OFF64_T
|
||||
#define HAVE_POINTER_LOCALTIME_R
|
||||
#define _PR_HAVE_POSIX_SEMAPHORES
|
||||
#define PR_HAVE_POSIX_NAMED_SHARED_MEMORY
|
||||
#define _PR_ACCEPT_INHERIT_NONBLOCK
|
||||
|
||||
#ifdef _PR_INET6
|
||||
#define _PR_HAVE_INET_NTOP
|
||||
#define _PR_HAVE_GETIPNODEBYNAME
|
||||
#define _PR_HAVE_GETIPNODEBYADDR
|
||||
#define _PR_HAVE_GETADDRINFO
|
||||
#endif
|
||||
|
||||
/* Initialization entry points */
|
||||
NSPR_API(void) _MD_EarlyInit(void);
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
|
||||
NSPR_API(void) _MD_IrixInit(void);
|
||||
#define _MD_FINAL_INIT _MD_IrixInit
|
||||
|
||||
#define _MD_INIT_IO()
|
||||
|
||||
/* Timer operations */
|
||||
NSPR_API(PRIntervalTime) _MD_IrixGetInterval(void);
|
||||
#define _MD_GET_INTERVAL _MD_IrixGetInterval
|
||||
|
||||
NSPR_API(PRIntervalTime) _MD_IrixIntervalPerSec(void);
|
||||
#define _MD_INTERVAL_PER_SEC _MD_IrixIntervalPerSec
|
||||
|
||||
/* GC operations */
|
||||
NSPR_API(void *) _MD_GetSP(PRThread *thread);
|
||||
#define _MD_GET_SP _MD_GetSP
|
||||
|
||||
/* The atomic operations */
|
||||
#include <mutex.h>
|
||||
#define _MD_INIT_ATOMIC()
|
||||
#define _MD_ATOMIC_INCREMENT(val) add_then_test((unsigned long*)val, 1)
|
||||
#define _MD_ATOMIC_ADD(ptr, val) add_then_test((unsigned long*)ptr, (unsigned long)val)
|
||||
#define _MD_ATOMIC_DECREMENT(val) add_then_test((unsigned long*)val, 0xffffffff)
|
||||
#define _MD_ATOMIC_SET(val, newval) test_and_set((unsigned long*)val, newval)
|
||||
|
||||
#if defined(_PR_PTHREADS)
|
||||
#else /* defined(_PR_PTHREADS) */
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
#include <setjmp.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <bstring.h>
|
||||
#include <sys/time.h>
|
||||
#include <ulocks.h>
|
||||
#include <sys/prctl.h>
|
||||
|
||||
|
||||
/*
|
||||
* Data region private to each sproc. This region is setup by calling
|
||||
* mmap(...,MAP_LOCAL,...). The private data is mapped at the same
|
||||
* address in every sproc, but every sproc gets a private mapping.
|
||||
*
|
||||
* Just make sure that this structure fits in a page, as only one page
|
||||
* is allocated for the private region.
|
||||
*/
|
||||
struct sproc_private_data {
|
||||
struct PRThread *me;
|
||||
struct _PRCPU *cpu;
|
||||
struct PRThread *last;
|
||||
PRUintn intsOff;
|
||||
int sproc_pid;
|
||||
};
|
||||
|
||||
extern char *_nspr_sproc_private;
|
||||
|
||||
#define _PR_PRDA() ((struct sproc_private_data *) _nspr_sproc_private)
|
||||
#define _MD_SET_CURRENT_THREAD(_thread) _PR_PRDA()->me = (_thread)
|
||||
#define _MD_THIS_THREAD() (_PR_PRDA()->me)
|
||||
#define _MD_LAST_THREAD() (_PR_PRDA()->last)
|
||||
#define _MD_SET_LAST_THREAD(_thread) _PR_PRDA()->last = (_thread)
|
||||
#define _MD_CURRENT_CPU() (_PR_PRDA()->cpu)
|
||||
#define _MD_SET_CURRENT_CPU(_cpu) _PR_PRDA()->cpu = (_cpu)
|
||||
#define _MD_SET_INTSOFF(_val) (_PR_PRDA()->intsOff = _val)
|
||||
#define _MD_GET_INTSOFF() (_PR_PRDA()->intsOff)
|
||||
|
||||
#define _MD_SET_SPROC_PID(_val) (_PR_PRDA()->sproc_pid = _val)
|
||||
#define _MD_GET_SPROC_PID() (_PR_PRDA()->sproc_pid)
|
||||
|
||||
NSPR_API(struct PRThread*) _MD_get_attached_thread(void);
|
||||
NSPR_API(struct PRThread*) _MD_get_current_thread(void);
|
||||
#define _MD_GET_ATTACHED_THREAD() _MD_get_attached_thread()
|
||||
#define _MD_CURRENT_THREAD() _MD_get_current_thread()
|
||||
|
||||
#define _MD_CHECK_FOR_EXIT() { \
|
||||
if (_pr_irix_exit_now) { \
|
||||
_PR_POST_SEM(_pr_irix_exit_sem); \
|
||||
_MD_Wakeup_CPUs(); \
|
||||
_exit(0); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define _MD_ATTACH_THREAD(threadp)
|
||||
|
||||
#define _MD_SAVE_ERRNO(_thread) (_thread)->md.errcode = errno;
|
||||
#define _MD_RESTORE_ERRNO(_thread) errno = (_thread)->md.errcode;
|
||||
|
||||
extern struct _PRCPU *_pr_primordialCPU;
|
||||
extern usema_t *_pr_irix_exit_sem;
|
||||
extern PRInt32 _pr_irix_exit_now;
|
||||
extern int _pr_irix_primoridal_cpu_fd[];
|
||||
extern PRInt32 _pr_irix_process_exit;
|
||||
extern PRInt32 _pr_irix_process_exit_code;
|
||||
|
||||
/* Thread operations */
|
||||
#define _PR_LOCK_HEAP() { \
|
||||
PRIntn _is; \
|
||||
if (_pr_primordialCPU) { \
|
||||
if (_MD_GET_ATTACHED_THREAD() && \
|
||||
!_PR_IS_NATIVE_THREAD( \
|
||||
_MD_GET_ATTACHED_THREAD())) \
|
||||
_PR_INTSOFF(_is); \
|
||||
_PR_LOCK(_pr_heapLock); \
|
||||
}
|
||||
|
||||
#define _PR_UNLOCK_HEAP() if (_pr_primordialCPU) { \
|
||||
_PR_UNLOCK(_pr_heapLock); \
|
||||
if (_MD_GET_ATTACHED_THREAD() && \
|
||||
!_PR_IS_NATIVE_THREAD( \
|
||||
_MD_GET_ATTACHED_THREAD())) \
|
||||
_PR_INTSON(_is); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define _PR_OPEN_POLL_SEM(_sem) usopenpollsema(_sem, 0666)
|
||||
#define _PR_WAIT_SEM(_sem) uspsema(_sem)
|
||||
#define _PR_POST_SEM(_sem) usvsema(_sem)
|
||||
|
||||
#define _MD_CVAR_POST_SEM(threadp) usvsema((threadp)->md.cvar_pollsem)
|
||||
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
struct _MDLock {
|
||||
ulock_t lock;
|
||||
usptr_t *arena;
|
||||
};
|
||||
|
||||
/*
|
||||
* disable pre-emption for the LOCAL threads when calling the arena lock
|
||||
* routines
|
||||
*/
|
||||
|
||||
#define _PR_LOCK(lock) { \
|
||||
PRIntn _is; \
|
||||
PRThread *me = _MD_GET_ATTACHED_THREAD(); \
|
||||
if (me && !_PR_IS_NATIVE_THREAD(me)) \
|
||||
_PR_INTSOFF(_is); \
|
||||
ussetlock(lock); \
|
||||
if (me && !_PR_IS_NATIVE_THREAD(me)) \
|
||||
_PR_FAST_INTSON(_is); \
|
||||
}
|
||||
|
||||
#define _PR_UNLOCK(lock) { \
|
||||
PRIntn _is; \
|
||||
PRThread *me = _MD_GET_ATTACHED_THREAD(); \
|
||||
if (me && !_PR_IS_NATIVE_THREAD(me)) \
|
||||
_PR_INTSOFF(_is); \
|
||||
usunsetlock(lock); \
|
||||
if (me && !_PR_IS_NATIVE_THREAD(me)) \
|
||||
_PR_FAST_INTSON(_is); \
|
||||
}
|
||||
|
||||
NSPR_API(PRStatus) _MD_NEW_LOCK(struct _MDLock *md);
|
||||
NSPR_API(void) _MD_FREE_LOCK(struct _MDLock *lockp);
|
||||
|
||||
#define _MD_LOCK(_lockp) _PR_LOCK((_lockp)->lock)
|
||||
#define _MD_UNLOCK(_lockp) _PR_UNLOCK((_lockp)->lock)
|
||||
#define _MD_TEST_AND_LOCK(_lockp) (uscsetlock((_lockp)->lock, 1) == 0)
|
||||
|
||||
extern ulock_t _pr_heapLock;
|
||||
|
||||
struct _MDThread {
|
||||
jmp_buf jb;
|
||||
usptr_t *pollsem_arena;
|
||||
usema_t *cvar_pollsem;
|
||||
PRInt32 cvar_pollsemfd;
|
||||
PRInt32 cvar_pollsem_select; /* acquire sem by calling select */
|
||||
PRInt32 cvar_wait; /* if 1, thread is waiting on cvar Q */
|
||||
PRInt32 id;
|
||||
PRInt32 suspending_id;
|
||||
int errcode;
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
usema_t *sem;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
ulock_t mdcvar_lock;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
* md-specific cpu structure field
|
||||
*/
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
|
||||
struct _MDCPU_Unix {
|
||||
PRCList ioQ;
|
||||
PRUint32 ioq_timeout;
|
||||
PRInt32 ioq_max_osfd;
|
||||
PRInt32 ioq_osfd_cnt;
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
|
||||
struct _MDCPU {
|
||||
PRInt32 id;
|
||||
PRInt32 suspending_id;
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
/*
|
||||
** Initialize the thread context preparing it to execute _main.
|
||||
*/
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
PR_BEGIN_MACRO \
|
||||
int *jb = (_thread)->md.jb; \
|
||||
*status = PR_TRUE; \
|
||||
(void) setjmp(jb); \
|
||||
(_thread)->md.jb[JB_SP] = (int) ((_sp) - 64); \
|
||||
(_thread)->md.jb[JB_PC] = (int) _main; \
|
||||
_thread->no_sched = 0; \
|
||||
PR_END_MACRO
|
||||
|
||||
/*
|
||||
** Switch away from the current thread context by saving its state and
|
||||
** calling the thread scheduler. Reload cpu when we come back from the
|
||||
** context switch because it might have changed.
|
||||
*
|
||||
* XXX RUNQ lock needed before clearing _PR_NO_SCHED flag, because the
|
||||
* thread may be unr RUNQ?
|
||||
*/
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
PR_BEGIN_MACRO \
|
||||
PR_ASSERT(_thread->no_sched); \
|
||||
if (!setjmp(_thread->md.jb)) { \
|
||||
_MD_SAVE_ERRNO(_thread) \
|
||||
_MD_SET_LAST_THREAD(_thread); \
|
||||
_PR_Schedule(); \
|
||||
} else { \
|
||||
PR_ASSERT(_MD_LAST_THREAD() !=_MD_CURRENT_THREAD()); \
|
||||
_MD_LAST_THREAD()->no_sched = 0; \
|
||||
} \
|
||||
PR_END_MACRO
|
||||
|
||||
/*
|
||||
** Restore a thread context that was saved by _MD_SWITCH_CONTEXT or
|
||||
** initialized by _MD_INIT_CONTEXT.
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_newThread) \
|
||||
PR_BEGIN_MACRO \
|
||||
int *jb = (_newThread)->md.jb; \
|
||||
_MD_RESTORE_ERRNO(_newThread) \
|
||||
_MD_SET_CURRENT_THREAD(_newThread); \
|
||||
_newThread->no_sched = 1; \
|
||||
longjmp(jb, 1); \
|
||||
PR_END_MACRO
|
||||
|
||||
NSPR_API(PRStatus) _MD_InitThread(struct PRThread *thread,
|
||||
PRBool wakeup_parent);
|
||||
NSPR_API(PRStatus) _MD_InitAttachedThread(struct PRThread *thread,
|
||||
PRBool wakeup_parent);
|
||||
#define _MD_INIT_THREAD(thread) _MD_InitThread(thread, PR_TRUE)
|
||||
#define _MD_INIT_ATTACHED_THREAD(thread) \
|
||||
_MD_InitAttachedThread(thread, PR_FALSE)
|
||||
|
||||
NSPR_API(void) _MD_ExitThread(struct PRThread *thread);
|
||||
#define _MD_EXIT_THREAD _MD_ExitThread
|
||||
|
||||
NSPR_API(void) _MD_SuspendThread(struct PRThread *thread);
|
||||
#define _MD_SUSPEND_THREAD _MD_SuspendThread
|
||||
|
||||
NSPR_API(void) _MD_ResumeThread(struct PRThread *thread);
|
||||
#define _MD_RESUME_THREAD _MD_ResumeThread
|
||||
|
||||
NSPR_API(void) _MD_SuspendCPU(struct _PRCPU *thread);
|
||||
#define _MD_SUSPEND_CPU _MD_SuspendCPU
|
||||
|
||||
NSPR_API(void) _MD_ResumeCPU(struct _PRCPU *thread);
|
||||
#define _MD_RESUME_CPU _MD_ResumeCPU
|
||||
|
||||
#define _MD_BEGIN_SUSPEND_ALL()
|
||||
#define _MD_END_SUSPEND_ALL()
|
||||
#define _MD_BEGIN_RESUME_ALL()
|
||||
#define _MD_END_RESUME_ALL()
|
||||
|
||||
NSPR_API(void) _MD_InitLocks(void);
|
||||
#define _MD_INIT_LOCKS _MD_InitLocks
|
||||
|
||||
NSPR_API(void) _MD_CleanThread(struct PRThread *thread);
|
||||
#define _MD_CLEAN_THREAD _MD_CleanThread
|
||||
|
||||
#define _MD_YIELD() sginap(0)
|
||||
|
||||
/* The _PR_MD_WAIT_LOCK and _PR_MD_WAKEUP_WAITER functions put to sleep and
|
||||
* awaken a thread which is waiting on a lock or cvar.
|
||||
*/
|
||||
NSPR_API(PRStatus) _MD_wait(struct PRThread *, PRIntervalTime timeout);
|
||||
#define _MD_WAIT _MD_wait
|
||||
|
||||
NSPR_API(void) _PR_MD_primordial_cpu();
|
||||
NSPR_API(void) _PR_MD_WAKEUP_PRIMORDIAL_CPU();
|
||||
|
||||
NSPR_API(PRStatus) _MD_WakeupWaiter(struct PRThread *);
|
||||
#define _MD_WAKEUP_WAITER _MD_WakeupWaiter
|
||||
|
||||
NSPR_API(void ) _MD_exit(PRIntn status);
|
||||
#define _MD_EXIT _MD_exit
|
||||
|
||||
#include "prthread.h"
|
||||
|
||||
NSPR_API(void) _MD_SetPriority(struct _MDThread *thread,
|
||||
PRThreadPriority newPri);
|
||||
#define _MD_SET_PRIORITY _MD_SetPriority
|
||||
|
||||
NSPR_API(PRStatus) _MD_CreateThread(
|
||||
struct PRThread *thread,
|
||||
void (*start) (void *),
|
||||
PRThreadPriority priority,
|
||||
PRThreadScope scope,
|
||||
PRThreadState state,
|
||||
PRUint32 stackSize);
|
||||
#define _MD_CREATE_THREAD _MD_CreateThread
|
||||
|
||||
extern void _MD_CleanupBeforeExit(void);
|
||||
#define _MD_CLEANUP_BEFORE_EXIT _MD_CleanupBeforeExit
|
||||
|
||||
NSPR_API(void) _PR_MD_PRE_CLEANUP(PRThread *me);
|
||||
|
||||
|
||||
/* The following defines the unwrapped versions of select() and poll(). */
|
||||
extern int _select(int nfds, fd_set *readfds, fd_set *writefds,
|
||||
fd_set *exceptfds, struct timeval *timeout);
|
||||
#define _MD_SELECT _select
|
||||
|
||||
#include <stropts.h>
|
||||
#include <poll.h>
|
||||
#define _MD_POLL _poll
|
||||
extern int _poll(struct pollfd *fds, unsigned long nfds, int timeout);
|
||||
|
||||
|
||||
#define HAVE_THREAD_AFFINITY 1
|
||||
|
||||
NSPR_API(PRInt32) _MD_GetThreadAffinityMask(PRThread *unused, PRUint32 *mask);
|
||||
#define _MD_GETTHREADAFFINITYMASK _MD_GetThreadAffinityMask
|
||||
|
||||
NSPR_API(void) _MD_InitRunningCPU(struct _PRCPU *cpu);
|
||||
#define _MD_INIT_RUNNING_CPU _MD_InitRunningCPU
|
||||
|
||||
#endif /* defined(_PR_PTHREADS) */
|
||||
|
||||
#endif /* _LANGUAGE_ASSEMBLY */
|
||||
|
||||
#endif /* nspr_irix_defs_h___ */
|
|
@ -1,119 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nspr_cpucfg___
|
||||
#define nspr_cpucfg___
|
||||
|
||||
#ifndef _SGI_MP_SOURCE
|
||||
#define _SGI_MP_SOURCE
|
||||
#endif
|
||||
|
||||
#ifndef XP_UNIX
|
||||
#define XP_UNIX
|
||||
#endif
|
||||
|
||||
#ifndef IRIX
|
||||
#define IRIX
|
||||
#endif
|
||||
|
||||
#undef IS_LITTLE_ENDIAN
|
||||
#define IS_BIG_ENDIAN 1
|
||||
|
||||
#define PR_AF_INET6 24 /* same as AF_INET6 */
|
||||
|
||||
#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 4
|
||||
#define PR_BYTES_PER_FLOAT 4
|
||||
#define PR_BYTES_PER_DOUBLE 8
|
||||
#define PR_BYTES_PER_WORD 4
|
||||
#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 32
|
||||
#define PR_BITS_PER_FLOAT 32
|
||||
#define PR_BITS_PER_DOUBLE 64
|
||||
#define PR_BITS_PER_WORD 32
|
||||
|
||||
#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 5
|
||||
#define PR_BITS_PER_FLOAT_LOG2 5
|
||||
#define PR_BITS_PER_DOUBLE_LOG2 6
|
||||
#define PR_BITS_PER_WORD_LOG2 5
|
||||
|
||||
#define PR_BYTES_PER_WORD_LOG2 2
|
||||
#define PR_BYTES_PER_DWORD_LOG2 3
|
||||
|
||||
#define PR_ALIGN_OF_SHORT 2
|
||||
#define PR_ALIGN_OF_INT 4
|
||||
#define PR_ALIGN_OF_LONG 4
|
||||
#define PR_ALIGN_OF_INT64 8
|
||||
#define PR_ALIGN_OF_FLOAT 4
|
||||
#define PR_ALIGN_OF_DOUBLE 8
|
||||
#define PR_ALIGN_OF_POINTER 4
|
||||
#define PR_ALIGN_OF_WORD 4
|
||||
|
||||
#ifndef HAVE_LONG_LONG
|
||||
#define HAVE_LONG_LONG
|
||||
#endif
|
||||
#define HAVE_ALIGNED_DOUBLES
|
||||
#define HAVE_ALIGNED_LONGLONGS
|
||||
|
||||
#define _PR_POLL_BACKCOMPAT
|
||||
|
||||
#ifndef NO_NSPR_10_SUPPORT
|
||||
|
||||
#define BYTES_PER_BYTE PR_BYTES_PER_BYTE
|
||||
#define BYTES_PER_SHORT PR_BYTES_PER_SHORT
|
||||
#define BYTES_PER_INT PR_BYTES_PER_INT
|
||||
#define BYTES_PER_INT64 PR_BYTES_PER_INT64
|
||||
#define BYTES_PER_LONG PR_BYTES_PER_LONG
|
||||
#define BYTES_PER_FLOAT PR_BYTES_PER_FLOAT
|
||||
#define BYTES_PER_DOUBLE PR_BYTES_PER_DOUBLE
|
||||
#define BYTES_PER_WORD PR_BYTES_PER_WORD
|
||||
#define BYTES_PER_DWORD PR_BYTES_PER_DWORD
|
||||
|
||||
#define BITS_PER_BYTE PR_BITS_PER_BYTE
|
||||
#define BITS_PER_SHORT PR_BITS_PER_SHORT
|
||||
#define BITS_PER_INT PR_BITS_PER_INT
|
||||
#define BITS_PER_INT64 PR_BITS_PER_INT64
|
||||
#define BITS_PER_LONG PR_BITS_PER_LONG
|
||||
#define BITS_PER_FLOAT PR_BITS_PER_FLOAT
|
||||
#define BITS_PER_DOUBLE PR_BITS_PER_DOUBLE
|
||||
#define BITS_PER_WORD PR_BITS_PER_WORD
|
||||
|
||||
#define BITS_PER_BYTE_LOG2 PR_BITS_PER_BYTE_LOG2
|
||||
#define BITS_PER_SHORT_LOG2 PR_BITS_PER_SHORT_LOG2
|
||||
#define BITS_PER_INT_LOG2 PR_BITS_PER_INT_LOG2
|
||||
#define BITS_PER_INT64_LOG2 PR_BITS_PER_INT64_LOG2
|
||||
#define BITS_PER_LONG_LOG2 PR_BITS_PER_LONG_LOG2
|
||||
#define BITS_PER_FLOAT_LOG2 PR_BITS_PER_FLOAT_LOG2
|
||||
#define BITS_PER_DOUBLE_LOG2 PR_BITS_PER_DOUBLE_LOG2
|
||||
#define BITS_PER_WORD_LOG2 PR_BITS_PER_WORD_LOG2
|
||||
|
||||
#define ALIGN_OF_SHORT PR_ALIGN_OF_SHORT
|
||||
#define ALIGN_OF_INT PR_ALIGN_OF_INT
|
||||
#define ALIGN_OF_LONG PR_ALIGN_OF_LONG
|
||||
#define ALIGN_OF_INT64 PR_ALIGN_OF_INT64
|
||||
#define ALIGN_OF_FLOAT PR_ALIGN_OF_FLOAT
|
||||
#define ALIGN_OF_DOUBLE PR_ALIGN_OF_DOUBLE
|
||||
#define ALIGN_OF_POINTER PR_ALIGN_OF_POINTER
|
||||
#define ALIGN_OF_WORD PR_ALIGN_OF_WORD
|
||||
|
||||
#define BYTES_PER_WORD_LOG2 PR_BYTES_PER_WORD_LOG2
|
||||
#define BYTES_PER_DWORD_LOG2 PR_BYTES_PER_DWORD_LOG2
|
||||
#define WORDS_PER_DWORD_LOG2 PR_WORDS_PER_DWORD_LOG2
|
||||
|
||||
#endif /* NO_NSPR_10_SUPPORT */
|
||||
|
||||
#endif /* nspr_cpucfg___ */
|
|
@ -1,118 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nspr_cpucfg___
|
||||
#define nspr_cpucfg___
|
||||
|
||||
#ifndef _SGI_MP_SOURCE
|
||||
#define _SGI_MP_SOURCE
|
||||
#endif
|
||||
|
||||
#ifndef XP_UNIX
|
||||
#define XP_UNIX
|
||||
#endif
|
||||
|
||||
#ifndef IRIX
|
||||
#define IRIX
|
||||
#endif
|
||||
|
||||
#undef IS_LITTLE_ENDIAN
|
||||
#define IS_BIG_ENDIAN 1
|
||||
#define IS_64
|
||||
|
||||
#define PR_AF_INET6 24 /* same as AF_INET6 */
|
||||
|
||||
#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_BYTES_PER_WORD_LOG2 3
|
||||
#define PR_BYTES_PER_DWORD_LOG2 3
|
||||
|
||||
#define PR_ALIGN_OF_SHORT 2
|
||||
#define PR_ALIGN_OF_INT 4
|
||||
#define PR_ALIGN_OF_LONG 4
|
||||
#define PR_ALIGN_OF_INT64 8
|
||||
#define PR_ALIGN_OF_FLOAT 4
|
||||
#define PR_ALIGN_OF_DOUBLE 8
|
||||
#define PR_ALIGN_OF_POINTER 4
|
||||
#define PR_ALIGN_OF_WORD 4
|
||||
|
||||
#ifndef HAVE_LONG_LONG
|
||||
#define HAVE_LONG_LONG
|
||||
#endif
|
||||
#define HAVE_ALIGNED_DOUBLES
|
||||
#define HAVE_ALIGNED_LONGLONGS
|
||||
|
||||
#ifndef NO_NSPR_10_SUPPORT
|
||||
|
||||
#define BYTES_PER_BYTE PR_BYTES_PER_BYTE
|
||||
#define BYTES_PER_SHORT PR_BYTES_PER_SHORT
|
||||
#define BYTES_PER_INT PR_BYTES_PER_INT
|
||||
#define BYTES_PER_INT64 PR_BYTES_PER_INT64
|
||||
#define BYTES_PER_LONG PR_BYTES_PER_LONG
|
||||
#define BYTES_PER_FLOAT PR_BYTES_PER_FLOAT
|
||||
#define BYTES_PER_DOUBLE PR_BYTES_PER_DOUBLE
|
||||
#define BYTES_PER_WORD PR_BYTES_PER_WORD
|
||||
#define BYTES_PER_DWORD PR_BYTES_PER_DWORD
|
||||
|
||||
#define BITS_PER_BYTE PR_BITS_PER_BYTE
|
||||
#define BITS_PER_SHORT PR_BITS_PER_SHORT
|
||||
#define BITS_PER_INT PR_BITS_PER_INT
|
||||
#define BITS_PER_INT64 PR_BITS_PER_INT64
|
||||
#define BITS_PER_LONG PR_BITS_PER_LONG
|
||||
#define BITS_PER_FLOAT PR_BITS_PER_FLOAT
|
||||
#define BITS_PER_DOUBLE PR_BITS_PER_DOUBLE
|
||||
#define BITS_PER_WORD PR_BITS_PER_WORD
|
||||
|
||||
#define BITS_PER_BYTE_LOG2 PR_BITS_PER_BYTE_LOG2
|
||||
#define BITS_PER_SHORT_LOG2 PR_BITS_PER_SHORT_LOG2
|
||||
#define BITS_PER_INT_LOG2 PR_BITS_PER_INT_LOG2
|
||||
#define BITS_PER_INT64_LOG2 PR_BITS_PER_INT64_LOG2
|
||||
#define BITS_PER_LONG_LOG2 PR_BITS_PER_LONG_LOG2
|
||||
#define BITS_PER_FLOAT_LOG2 PR_BITS_PER_FLOAT_LOG2
|
||||
#define BITS_PER_DOUBLE_LOG2 PR_BITS_PER_DOUBLE_LOG2
|
||||
#define BITS_PER_WORD_LOG2 PR_BITS_PER_WORD_LOG2
|
||||
|
||||
#define ALIGN_OF_SHORT PR_ALIGN_OF_SHORT
|
||||
#define ALIGN_OF_INT PR_ALIGN_OF_INT
|
||||
#define ALIGN_OF_LONG PR_ALIGN_OF_LONG
|
||||
#define ALIGN_OF_INT64 PR_ALIGN_OF_INT64
|
||||
#define ALIGN_OF_FLOAT PR_ALIGN_OF_FLOAT
|
||||
#define ALIGN_OF_DOUBLE PR_ALIGN_OF_DOUBLE
|
||||
#define ALIGN_OF_POINTER PR_ALIGN_OF_POINTER
|
||||
#define ALIGN_OF_WORD PR_ALIGN_OF_WORD
|
||||
|
||||
#define BYTES_PER_WORD_LOG2 PR_BYTES_PER_WORD_LOG2
|
||||
#define BYTES_PER_DWORD_LOG2 PR_BYTES_PER_DWORD_LOG2
|
||||
#define WORDS_PER_DWORD_LOG2 PR_WORDS_PER_DWORD_LOG2
|
||||
|
||||
#endif /* NO_NSPR_10_SUPPORT */
|
||||
|
||||
#endif /* nspr_cpucfg___ */
|
|
@ -1112,6 +1112,51 @@
|
|||
#define PR_BYTES_PER_WORD_LOG2 3
|
||||
#define PR_BYTES_PER_DWORD_LOG2 3
|
||||
|
||||
#elif defined(__arc__)
|
||||
|
||||
#define IS_LITTLE_ENDIAN 1
|
||||
#undef IS_BIG_ENDIAN
|
||||
|
||||
#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 4
|
||||
#define PR_BYTES_PER_FLOAT 4
|
||||
#define PR_BYTES_PER_DOUBLE 8
|
||||
#define PR_BYTES_PER_WORD 4
|
||||
#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 32
|
||||
#define PR_BITS_PER_FLOAT 32
|
||||
#define PR_BITS_PER_DOUBLE 64
|
||||
#define PR_BITS_PER_WORD 32
|
||||
|
||||
#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 5
|
||||
#define PR_BITS_PER_FLOAT_LOG2 5
|
||||
#define PR_BITS_PER_DOUBLE_LOG2 6
|
||||
#define PR_BITS_PER_WORD_LOG2 5
|
||||
|
||||
#define PR_ALIGN_OF_SHORT 2
|
||||
#define PR_ALIGN_OF_INT 4
|
||||
#define PR_ALIGN_OF_LONG 4
|
||||
#define PR_ALIGN_OF_INT64 4
|
||||
#define PR_ALIGN_OF_FLOAT 4
|
||||
#define PR_ALIGN_OF_DOUBLE 4
|
||||
#define PR_ALIGN_OF_POINTER 4
|
||||
#define PR_ALIGN_OF_WORD 4
|
||||
|
||||
#define PR_BYTES_PER_WORD_LOG2 2
|
||||
#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(__arc__)
|
||||
#define _PR_SI_ARCHITECTURE "arc"
|
||||
#else
|
||||
#error "Unknown CPU architecture"
|
||||
#endif
|
||||
|
|
|
@ -1,116 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nspr_cpucfg___
|
||||
#define nspr_cpucfg___
|
||||
|
||||
#ifndef XP_UNIX
|
||||
#define XP_UNIX
|
||||
#endif
|
||||
|
||||
#ifndef OSF1
|
||||
#define OSF1
|
||||
#endif
|
||||
|
||||
#define IS_LITTLE_ENDIAN 1
|
||||
#undef IS_BIG_ENDIAN
|
||||
#ifndef HAVE_LONG_LONG
|
||||
#define HAVE_LONG_LONG
|
||||
#endif
|
||||
#define HAVE_ALIGNED_DOUBLES
|
||||
#define HAVE_ALIGNED_LONGLONGS
|
||||
#ifndef IS_64
|
||||
#define IS_64
|
||||
#endif
|
||||
|
||||
#define PR_AF_INET6 26 /* same as AF_INET6 */
|
||||
|
||||
#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_BYTES_PER_WORD_LOG2 3
|
||||
#define PR_BYTES_PER_DWORD_LOG2 3
|
||||
|
||||
#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_POLL_BACKCOMPAT
|
||||
|
||||
#ifndef NO_NSPR_10_SUPPORT
|
||||
|
||||
#define BYTES_PER_BYTE PR_BYTES_PER_BYTE
|
||||
#define BYTES_PER_SHORT PR_BYTES_PER_SHORT
|
||||
#define BYTES_PER_INT PR_BYTES_PER_INT
|
||||
#define BYTES_PER_INT64 PR_BYTES_PER_INT64
|
||||
#define BYTES_PER_LONG PR_BYTES_PER_LONG
|
||||
#define BYTES_PER_FLOAT PR_BYTES_PER_FLOAT
|
||||
#define BYTES_PER_DOUBLE PR_BYTES_PER_DOUBLE
|
||||
#define BYTES_PER_WORD PR_BYTES_PER_WORD
|
||||
#define BYTES_PER_DWORD PR_BYTES_PER_DWORD
|
||||
|
||||
#define BITS_PER_BYTE PR_BITS_PER_BYTE
|
||||
#define BITS_PER_SHORT PR_BITS_PER_SHORT
|
||||
#define BITS_PER_INT PR_BITS_PER_INT
|
||||
#define BITS_PER_INT64 PR_BITS_PER_INT64
|
||||
#define BITS_PER_LONG PR_BITS_PER_LONG
|
||||
#define BITS_PER_FLOAT PR_BITS_PER_FLOAT
|
||||
#define BITS_PER_DOUBLE PR_BITS_PER_DOUBLE
|
||||
#define BITS_PER_WORD PR_BITS_PER_WORD
|
||||
|
||||
#define BITS_PER_BYTE_LOG2 PR_BITS_PER_BYTE_LOG2
|
||||
#define BITS_PER_SHORT_LOG2 PR_BITS_PER_SHORT_LOG2
|
||||
#define BITS_PER_INT_LOG2 PR_BITS_PER_INT_LOG2
|
||||
#define BITS_PER_INT64_LOG2 PR_BITS_PER_INT64_LOG2
|
||||
#define BITS_PER_LONG_LOG2 PR_BITS_PER_LONG_LOG2
|
||||
#define BITS_PER_FLOAT_LOG2 PR_BITS_PER_FLOAT_LOG2
|
||||
#define BITS_PER_DOUBLE_LOG2 PR_BITS_PER_DOUBLE_LOG2
|
||||
#define BITS_PER_WORD_LOG2 PR_BITS_PER_WORD_LOG2
|
||||
|
||||
#define ALIGN_OF_SHORT PR_ALIGN_OF_SHORT
|
||||
#define ALIGN_OF_INT PR_ALIGN_OF_INT
|
||||
#define ALIGN_OF_LONG PR_ALIGN_OF_LONG
|
||||
#define ALIGN_OF_INT64 PR_ALIGN_OF_INT64
|
||||
#define ALIGN_OF_FLOAT PR_ALIGN_OF_FLOAT
|
||||
#define ALIGN_OF_DOUBLE PR_ALIGN_OF_DOUBLE
|
||||
#define ALIGN_OF_POINTER PR_ALIGN_OF_POINTER
|
||||
#define ALIGN_OF_WORD PR_ALIGN_OF_WORD
|
||||
|
||||
#define BYTES_PER_WORD_LOG2 PR_BYTES_PER_WORD_LOG2
|
||||
#define BYTES_PER_DWORD_LOG2 PR_BYTES_PER_DWORD_LOG2
|
||||
#define WORDS_PER_DWORD_LOG2 PR_WORDS_PER_DWORD_LOG2
|
||||
|
||||
#endif /* NO_NSPR_10_SUPPORT */
|
||||
|
||||
#endif /* nspr_cpucfg___ */
|
|
@ -1,222 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nspr_osf1_defs_h___
|
||||
#define nspr_osf1_defs_h___
|
||||
|
||||
/*
|
||||
* Internal configuration macros
|
||||
*/
|
||||
|
||||
#define PR_LINKER_ARCH "osf"
|
||||
#define _PR_SI_SYSNAME "OSF"
|
||||
#define _PR_SI_ARCHITECTURE "alpha"
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 131072L
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
#undef HAVE_WEAK_IO_SYMBOLS
|
||||
#undef HAVE_WEAK_MALLOC_SYMBOLS
|
||||
#define HAVE_DLL
|
||||
#define HAVE_BSD_FLOCK
|
||||
|
||||
#define NEED_TIME_R
|
||||
#define USE_DLFCN
|
||||
|
||||
#define _PR_POLL_AVAILABLE
|
||||
#define _PR_USE_POLL
|
||||
#define _PR_STAT_HAS_ONLY_ST_ATIME
|
||||
#define _PR_HAVE_LARGE_OFF_T
|
||||
#define _PR_HAVE_GETIPNODEBYNAME
|
||||
#define _PR_HAVE_GETIPNODEBYADDR
|
||||
#define _PR_HAVE_GETADDRINFO
|
||||
#define _PR_INET6_PROBE
|
||||
#ifdef _PR_INET6
|
||||
#define _PR_HAVE_INET_NTOP
|
||||
#else
|
||||
#define AF_INET6 26
|
||||
#ifndef AI_CANONNAME
|
||||
#define AI_CANONNAME 0x00000002
|
||||
struct addrinfo {
|
||||
int ai_flags;
|
||||
int ai_family;
|
||||
int ai_socktype;
|
||||
int ai_protocol;
|
||||
size_t ai_addrlen;
|
||||
char *ai_canonname;
|
||||
struct sockaddr *ai_addr;
|
||||
struct addrinfo *ai_next;
|
||||
};
|
||||
#endif
|
||||
#define AI_V4MAPPED 0x00000010
|
||||
#define AI_ALL 0x00000008
|
||||
#define AI_ADDRCONFIG 0x00000020
|
||||
#endif
|
||||
#define _PR_HAVE_POSIX_SEMAPHORES
|
||||
#define PR_HAVE_POSIX_NAMED_SHARED_MEMORY
|
||||
|
||||
#define USE_SETJMP
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
/*
|
||||
* A jmp_buf is actually a struct sigcontext. The sc_sp field of
|
||||
* struct sigcontext is the stack pointer.
|
||||
*/
|
||||
#define _MD_GET_SP(_t) (((struct sigcontext *) (_t)->md.context)->sc_sp)
|
||||
#define PR_NUM_GCREGS _JBLEN
|
||||
#define CONTEXT(_th) ((_th)->md.context)
|
||||
|
||||
/*
|
||||
** Initialize a thread context to run "_main()" when started
|
||||
*/
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
*status = PR_TRUE; \
|
||||
if (setjmp(CONTEXT(_thread))) { \
|
||||
(*_main)(); \
|
||||
} \
|
||||
_MD_GET_SP(_thread) = (long) ((_sp) - 64); \
|
||||
_MD_GET_SP(_thread) &= ~15; \
|
||||
}
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!setjmp(CONTEXT(_thread))) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
{ \
|
||||
errno = (_thread)->md.errcode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
longjmp(CONTEXT(_thread), 1); \
|
||||
}
|
||||
|
||||
/* Machine-dependent (MD) data structures */
|
||||
|
||||
struct _MDThread {
|
||||
jmp_buf context;
|
||||
int id;
|
||||
int errcode;
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDLock {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
* md-specific cpu structure field
|
||||
*/
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
|
||||
struct _MDCPU_Unix {
|
||||
PRCList ioQ;
|
||||
PRUint32 ioq_timeout;
|
||||
PRInt32 ioq_max_osfd;
|
||||
PRInt32 ioq_osfd_cnt;
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
#ifndef _PR_PTHREADS
|
||||
#define _MD_INIT_LOCKS()
|
||||
#endif
|
||||
#define _MD_NEW_LOCK(lock) PR_SUCCESS
|
||||
#define _MD_FREE_LOCK(lock)
|
||||
#define _MD_LOCK(lock)
|
||||
#define _MD_UNLOCK(lock)
|
||||
#define _MD_INIT_IO()
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
/*
|
||||
* The following are copied from _sunos.h, _aix.h. This means
|
||||
* some of them should probably be moved into _unixos.h. But
|
||||
* _irix.h seems to be quite different in regard to these macros.
|
||||
*/
|
||||
#define _MD_INTERVAL_USE_GTOD
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EXIT_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread)
|
||||
#define _MD_RESUME_THREAD(thread)
|
||||
#define _MD_CLEAN_THREAD(_thread)
|
||||
|
||||
/* The following defines unwrapped versions of select() and poll(). */
|
||||
#include <sys/time.h>
|
||||
extern int __select (int, fd_set *, fd_set *, fd_set *, struct timeval *);
|
||||
#define _MD_SELECT __select
|
||||
|
||||
#include <sys/poll.h>
|
||||
#define _MD_POLL __poll
|
||||
extern int __poll(struct pollfd filedes[], unsigned int nfds, int timeout);
|
||||
|
||||
/*
|
||||
* Atomic operations
|
||||
*/
|
||||
#ifdef OSF1_HAVE_MACHINE_BUILTINS_H
|
||||
#include <machine/builtins.h>
|
||||
#define _PR_HAVE_ATOMIC_OPS
|
||||
#define _MD_INIT_ATOMIC()
|
||||
#define _MD_ATOMIC_INCREMENT(val) (__ATOMIC_INCREMENT_LONG(val) + 1)
|
||||
#define _MD_ATOMIC_ADD(ptr, val) (__ATOMIC_ADD_LONG(ptr, val) + val)
|
||||
#define _MD_ATOMIC_DECREMENT(val) (__ATOMIC_DECREMENT_LONG(val) - 1)
|
||||
#define _MD_ATOMIC_SET(val, newval) __ATOMIC_EXCH_LONG(val, newval)
|
||||
#endif /* OSF1_HAVE_MACHINE_BUILTINS_H */
|
||||
|
||||
#endif /* nspr_osf1_defs_h___ */
|
|
@ -84,12 +84,12 @@
|
|||
* PR_EnterMonitor calls any of these functions, infinite
|
||||
* recursion ensues.
|
||||
*/
|
||||
#if defined(IRIX) || defined(OSF1) || defined(AIX) || defined(SOLARIS) \
|
||||
#if defined(AIX) || defined(SOLARIS) \
|
||||
|| defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
|
||||
|| defined(HPUX) || defined(FREEBSD) \
|
||||
|| defined(NETBSD) || defined(OPENBSD) || defined(BSDI) \
|
||||
|| defined(NTO) || defined(DARWIN) \
|
||||
|| defined(UNIXWARE) || defined(RISCOS) || defined(SYMBIAN)
|
||||
|| defined(UNIXWARE) || defined(RISCOS)
|
||||
#define _PT_PTHREAD_INVALIDATE_THR_HANDLE(t) (t) = 0
|
||||
#define _PT_PTHREAD_THR_HANDLE_IS_INVALID(t) (t) == 0
|
||||
#define _PT_PTHREAD_COPY_THR_HANDLE(st, dt) (dt) = (st)
|
||||
|
@ -116,18 +116,11 @@
|
|||
|| defined(LINUX) || defined(__GNU__)|| defined(__GLIBC__) \
|
||||
|| defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \
|
||||
|| defined(BSDI) || defined(UNIXWARE) \
|
||||
|| defined(DARWIN) || defined(SYMBIAN)
|
||||
|| defined(DARWIN)
|
||||
#define PT_NO_SIGTIMEDWAIT
|
||||
#endif
|
||||
|
||||
#if defined(OSF1)
|
||||
#define PT_PRIO_MIN PRI_OTHER_MIN
|
||||
#define PT_PRIO_MAX PRI_OTHER_MAX
|
||||
#elif defined(IRIX)
|
||||
#include <sys/sched.h>
|
||||
#define PT_PRIO_MIN PX_PRIO_MIN
|
||||
#define PT_PRIO_MAX PX_PRIO_MAX
|
||||
#elif defined(AIX)
|
||||
#if defined(AIX)
|
||||
#include <sys/priv.h>
|
||||
#include <sys/sched.h>
|
||||
#ifndef PTHREAD_CREATE_JOINABLE
|
||||
|
@ -140,7 +133,7 @@
|
|||
#define PT_PRIO_MIN sched_get_priority_min(SCHED_OTHER)
|
||||
#define PT_PRIO_MAX sched_get_priority_max(SCHED_OTHER)
|
||||
#elif defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
|
||||
|| defined(FREEBSD) || defined(SYMBIAN)
|
||||
|| defined(FREEBSD)
|
||||
#define PT_PRIO_MIN sched_get_priority_min(SCHED_OTHER)
|
||||
#define PT_PRIO_MAX sched_get_priority_max(SCHED_OTHER)
|
||||
#elif defined(NTO)
|
||||
|
@ -177,28 +170,14 @@
|
|||
* Needed for garbage collection -- Look at PR_Suspend/PR_Resume
|
||||
* implementation.
|
||||
*/
|
||||
#if defined(OSF1)
|
||||
/*
|
||||
* sched_yield can't be called from a signal handler. Must use
|
||||
* the _np version.
|
||||
*/
|
||||
#define _PT_PTHREAD_YIELD() pthread_yield_np()
|
||||
#elif defined(AIX)
|
||||
#if defined(AIX)
|
||||
extern int (*_PT_aix_yield_fcn)();
|
||||
#define _PT_PTHREAD_YIELD() (*_PT_aix_yield_fcn)()
|
||||
#elif defined(IRIX)
|
||||
#include <time.h>
|
||||
#define _PT_PTHREAD_YIELD() \
|
||||
PR_BEGIN_MACRO \
|
||||
struct timespec onemillisec = {0}; \
|
||||
onemillisec.tv_nsec = 1000000L; \
|
||||
nanosleep(&onemillisec,NULL); \
|
||||
PR_END_MACRO
|
||||
#elif defined(HPUX) || defined(SOLARIS) \
|
||||
|| defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
|
||||
|| defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \
|
||||
|| defined(BSDI) || defined(NTO) || defined(DARWIN) \
|
||||
|| defined(UNIXWARE) || defined(RISCOS) || defined(SYMBIAN)
|
||||
|| defined(UNIXWARE) || defined(RISCOS)
|
||||
#define _PT_PTHREAD_YIELD() sched_yield()
|
||||
#else
|
||||
#error "Need to define _PT_PTHREAD_YIELD for this platform"
|
||||
|
|
|
@ -1,170 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nspr_cpucfg___
|
||||
#define nspr_cpucfg___
|
||||
|
||||
#ifndef XP_UNIX
|
||||
#define XP_UNIX
|
||||
#endif
|
||||
|
||||
#ifndef SYMBIAN
|
||||
#define SYMBIAN
|
||||
#endif
|
||||
|
||||
#define PR_AF_INET6 0x0806 /* same as AF_INET6 */
|
||||
|
||||
#ifdef __arm__
|
||||
|
||||
#define IS_LITTLE_ENDIAN 1
|
||||
#undef IS_BIG_ENDIAN
|
||||
|
||||
#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 4
|
||||
#define PR_BYTES_PER_FLOAT 4
|
||||
#define PR_BYTES_PER_DOUBLE 8
|
||||
#define PR_BYTES_PER_WORD 4
|
||||
#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 32
|
||||
#define PR_BITS_PER_FLOAT 32
|
||||
#define PR_BITS_PER_DOUBLE 64
|
||||
#define PR_BITS_PER_WORD 32
|
||||
|
||||
#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 5
|
||||
#define PR_BITS_PER_FLOAT_LOG2 5
|
||||
#define PR_BITS_PER_DOUBLE_LOG2 6
|
||||
#define PR_BITS_PER_WORD_LOG2 5
|
||||
|
||||
#define PR_ALIGN_OF_SHORT 2
|
||||
#define PR_ALIGN_OF_INT 4
|
||||
#define PR_ALIGN_OF_LONG 4
|
||||
#define PR_ALIGN_OF_FLOAT 4
|
||||
#define PR_ALIGN_OF_POINTER 4
|
||||
#define PR_ALIGN_OF_WORD 4
|
||||
#define PR_ALIGN_OF_INT64 8
|
||||
#define PR_ALIGN_OF_DOUBLE 8
|
||||
|
||||
#define PR_BYTES_PER_WORD_LOG2 2
|
||||
#define PR_BYTES_PER_DWORD_LOG2 3
|
||||
|
||||
#elif defined(__WINS__)
|
||||
|
||||
#define IS_LITTLE_ENDIAN 1
|
||||
#undef IS_BIG_ENDIAN
|
||||
|
||||
#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 4
|
||||
#define PR_BYTES_PER_FLOAT 4
|
||||
#define PR_BYTES_PER_DOUBLE 8
|
||||
#define PR_BYTES_PER_WORD 4
|
||||
#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 32
|
||||
#define PR_BITS_PER_FLOAT 32
|
||||
#define PR_BITS_PER_DOUBLE 64
|
||||
#define PR_BITS_PER_WORD 32
|
||||
|
||||
#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 5
|
||||
#define PR_BITS_PER_FLOAT_LOG2 5
|
||||
#define PR_BITS_PER_DOUBLE_LOG2 6
|
||||
#define PR_BITS_PER_WORD_LOG2 5
|
||||
|
||||
#define PR_ALIGN_OF_SHORT 2
|
||||
#define PR_ALIGN_OF_INT 4
|
||||
#define PR_ALIGN_OF_LONG 4
|
||||
#define PR_ALIGN_OF_FLOAT 4
|
||||
#define PR_ALIGN_OF_POINTER 4
|
||||
#define PR_ALIGN_OF_WORD 4
|
||||
#define PR_ALIGN_OF_INT64 4
|
||||
#define PR_ALIGN_OF_DOUBLE 4
|
||||
|
||||
#define PR_BYTES_PER_WORD_LOG2 2
|
||||
#define PR_BYTES_PER_DWORD_LOG2 3
|
||||
|
||||
#else
|
||||
|
||||
#error "Unknown CPU architecture"
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_LONG_LONG
|
||||
#define HAVE_LONG_LONG
|
||||
#endif
|
||||
#if PR_ALIGN_OF_DOUBLE == 8
|
||||
#define HAVE_ALIGNED_DOUBLES
|
||||
#endif
|
||||
#if PR_ALIGN_OF_INT64 == 8
|
||||
#define HAVE_ALIGNED_LONGLONGS
|
||||
#endif
|
||||
|
||||
#ifndef NO_NSPR_10_SUPPORT
|
||||
|
||||
#define BYTES_PER_BYTE PR_BYTES_PER_BYTE
|
||||
#define BYTES_PER_SHORT PR_BYTES_PER_SHORT
|
||||
#define BYTES_PER_INT PR_BYTES_PER_INT
|
||||
#define BYTES_PER_INT64 PR_BYTES_PER_INT64
|
||||
#define BYTES_PER_LONG PR_BYTES_PER_LONG
|
||||
#define BYTES_PER_FLOAT PR_BYTES_PER_FLOAT
|
||||
#define BYTES_PER_DOUBLE PR_BYTES_PER_DOUBLE
|
||||
#define BYTES_PER_WORD PR_BYTES_PER_WORD
|
||||
#define BYTES_PER_DWORD PR_BYTES_PER_DWORD
|
||||
|
||||
#define BITS_PER_BYTE PR_BITS_PER_BYTE
|
||||
#define BITS_PER_SHORT PR_BITS_PER_SHORT
|
||||
#define BITS_PER_INT PR_BITS_PER_INT
|
||||
#define BITS_PER_INT64 PR_BITS_PER_INT64
|
||||
#define BITS_PER_LONG PR_BITS_PER_LONG
|
||||
#define BITS_PER_FLOAT PR_BITS_PER_FLOAT
|
||||
#define BITS_PER_DOUBLE PR_BITS_PER_DOUBLE
|
||||
#define BITS_PER_WORD PR_BITS_PER_WORD
|
||||
|
||||
#define BITS_PER_BYTE_LOG2 PR_BITS_PER_BYTE_LOG2
|
||||
#define BITS_PER_SHORT_LOG2 PR_BITS_PER_SHORT_LOG2
|
||||
#define BITS_PER_INT_LOG2 PR_BITS_PER_INT_LOG2
|
||||
#define BITS_PER_INT64_LOG2 PR_BITS_PER_INT64_LOG2
|
||||
#define BITS_PER_LONG_LOG2 PR_BITS_PER_LONG_LOG2
|
||||
#define BITS_PER_FLOAT_LOG2 PR_BITS_PER_FLOAT_LOG2
|
||||
#define BITS_PER_DOUBLE_LOG2 PR_BITS_PER_DOUBLE_LOG2
|
||||
#define BITS_PER_WORD_LOG2 PR_BITS_PER_WORD_LOG2
|
||||
|
||||
#define ALIGN_OF_SHORT PR_ALIGN_OF_SHORT
|
||||
#define ALIGN_OF_INT PR_ALIGN_OF_INT
|
||||
#define ALIGN_OF_LONG PR_ALIGN_OF_LONG
|
||||
#define ALIGN_OF_INT64 PR_ALIGN_OF_INT64
|
||||
#define ALIGN_OF_FLOAT PR_ALIGN_OF_FLOAT
|
||||
#define ALIGN_OF_DOUBLE PR_ALIGN_OF_DOUBLE
|
||||
#define ALIGN_OF_POINTER PR_ALIGN_OF_POINTER
|
||||
#define ALIGN_OF_WORD PR_ALIGN_OF_WORD
|
||||
|
||||
#define BYTES_PER_WORD_LOG2 PR_BYTES_PER_WORD_LOG2
|
||||
#define BYTES_PER_DWORD_LOG2 PR_BYTES_PER_DWORD_LOG2
|
||||
#define WORDS_PER_DWORD_LOG2 PR_WORDS_PER_DWORD_LOG2
|
||||
|
||||
#endif /* NO_NSPR_10_SUPPORT */
|
||||
|
||||
#endif /* nspr_cpucfg___ */
|
|
@ -1,50 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nspr_symbian_defs_h___
|
||||
#define nspr_symbian_defs_h___
|
||||
|
||||
#include "prthread.h"
|
||||
|
||||
/*
|
||||
* Internal configuration macros
|
||||
*/
|
||||
|
||||
#define _PR_SI_SYSNAME "SYMBIAN"
|
||||
#if defined(__WINS__)
|
||||
#define _PR_SI_ARCHITECTURE "i386"
|
||||
#elif defined(__arm__)
|
||||
#define _PR_SI_ARCHITECTURE "arm"
|
||||
#else
|
||||
#error "Unknown CPU architecture"
|
||||
#endif
|
||||
#define PR_DLL_SUFFIX ".dll"
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
|
||||
#ifdef DYNAMIC_LIBRARY
|
||||
#define HAVE_DLL
|
||||
#define USE_DLFCN
|
||||
#endif
|
||||
|
||||
#define _PR_STAT_HAS_ONLY_ST_ATIME
|
||||
#define _PR_NO_LARGE_FILES
|
||||
#define _PR_HAVE_SYSV_SEMAPHORES
|
||||
#define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
|
||||
|
||||
#ifndef _PR_PTHREADS
|
||||
#error "Classic NSPR is not implemented"
|
||||
#endif
|
||||
|
||||
extern void _MD_EarlyInit(void);
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_INTERVAL_USE_GTOD
|
||||
|
||||
/* For writev() */
|
||||
#include <sys/uio.h>
|
||||
|
||||
#endif /* nspr_symbian_defs_h___ */
|
|
@ -46,13 +46,11 @@
|
|||
*/
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#if defined(AIX) || defined(SYMBIAN)
|
||||
#if defined(AIX)
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
|
||||
#ifndef SYMBIAN
|
||||
#define HAVE_NETINET_TCP_H
|
||||
#endif
|
||||
|
||||
#define _PR_HAVE_O_APPEND
|
||||
|
||||
|
@ -261,9 +259,7 @@ extern void _MD_Wakeup_CPUs(void);
|
|||
#define _MD_CLEANUP_BEFORE_EXIT()
|
||||
#endif
|
||||
|
||||
#ifndef IRIX
|
||||
#define _MD_EXIT(status) _exit(status)
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
|
|
|
@ -49,15 +49,9 @@ PR_BEGIN_EXTERN_C
|
|||
#elif defined(HPUX)
|
||||
#include "md/_hpux.h"
|
||||
|
||||
#elif defined(IRIX)
|
||||
#include "md/_irix.h"
|
||||
|
||||
#elif defined(LINUX) || defined(__GNU__) || defined(__GLIBC__)
|
||||
#include "md/_linux.h"
|
||||
|
||||
#elif defined(OSF1)
|
||||
#include "md/_osf1.h"
|
||||
|
||||
#elif defined(DARWIN)
|
||||
#include "md/_darwin.h"
|
||||
|
||||
|
@ -70,9 +64,6 @@ PR_BEGIN_EXTERN_C
|
|||
#elif defined(UNIXWARE)
|
||||
#include "md/_unixware.h"
|
||||
|
||||
#elif defined(DGUX)
|
||||
#include "md/_dgux.h"
|
||||
|
||||
#elif defined(QNX)
|
||||
#include "md/_qnx.h"
|
||||
|
||||
|
@ -82,9 +73,6 @@ PR_BEGIN_EXTERN_C
|
|||
#elif defined(RISCOS)
|
||||
#include "md/_riscos.h"
|
||||
|
||||
#elif defined(SYMBIAN)
|
||||
#include "md/_symbian.h"
|
||||
|
||||
#else
|
||||
#error unknown Unix flavor
|
||||
|
||||
|
@ -93,14 +81,9 @@ PR_BEGIN_EXTERN_C
|
|||
#include "md/_unixos.h"
|
||||
#include "md/_unix_errors.h"
|
||||
|
||||
#elif defined(XP_BEOS)
|
||||
|
||||
#include "md/_beos.h"
|
||||
#include "md/_unix_errors.h"
|
||||
|
||||
#else
|
||||
|
||||
#error "The platform is not BeOS, Unix, Windows, or Mac"
|
||||
#error "The platform is not Unix, Windows, or Mac"
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -27,14 +27,6 @@ typedef PRIntn intn;
|
|||
* defined by those standard headers.
|
||||
*/
|
||||
|
||||
/*
|
||||
* BeOS defines all the int types below in its standard header
|
||||
* file SupportDefs.h.
|
||||
*/
|
||||
#ifdef XP_BEOS
|
||||
#include <support/SupportDefs.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* SVR4 typedef of uint is commonly found on UNIX machines.
|
||||
*
|
||||
|
@ -56,7 +48,7 @@ typedef PRIntn intn;
|
|||
* uint
|
||||
*/
|
||||
|
||||
#if !defined(XP_BEOS) && !defined(XP_OS2) && !defined(XP_UNIX) || defined(NTO)
|
||||
#if !defined(XP_OS2) && !defined(XP_UNIX) || defined(NTO)
|
||||
typedef PRUintn uint;
|
||||
#endif
|
||||
|
||||
|
@ -64,43 +56,35 @@ typedef PRUintn uint;
|
|||
* uint64
|
||||
*/
|
||||
|
||||
#if !defined(XP_BEOS)
|
||||
typedef PRUint64 uint64;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* uint32
|
||||
*/
|
||||
|
||||
#if !defined(XP_BEOS)
|
||||
#if !defined(_WIN32) && !defined(XP_OS2) && !defined(NTO)
|
||||
typedef PRUint32 uint32;
|
||||
#else
|
||||
typedef unsigned long uint32;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* uint16
|
||||
*/
|
||||
|
||||
#if !defined(XP_BEOS)
|
||||
typedef PRUint16 uint16;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* uint8
|
||||
*/
|
||||
|
||||
#if !defined(XP_BEOS)
|
||||
typedef PRUint8 uint8;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* int64
|
||||
*/
|
||||
|
||||
#if !defined(XP_BEOS) && !defined(_PR_AIX_HAVE_BSD_INT_TYPES)
|
||||
#if !defined(_PR_AIX_HAVE_BSD_INT_TYPES)
|
||||
typedef PRInt64 int64;
|
||||
#endif
|
||||
|
||||
|
@ -108,7 +92,7 @@ typedef PRInt64 int64;
|
|||
* int32
|
||||
*/
|
||||
|
||||
#if !defined(XP_BEOS) && !defined(_PR_AIX_HAVE_BSD_INT_TYPES) \
|
||||
#if !defined(_PR_AIX_HAVE_BSD_INT_TYPES) \
|
||||
&& !defined(HPUX)
|
||||
#if !defined(_WIN32) && !defined(XP_OS2) && !defined(NTO)
|
||||
typedef PRInt32 int32;
|
||||
|
@ -121,7 +105,7 @@ typedef long int32;
|
|||
* int16
|
||||
*/
|
||||
|
||||
#if !defined(XP_BEOS) && !defined(_PR_AIX_HAVE_BSD_INT_TYPES) \
|
||||
#if !defined(_PR_AIX_HAVE_BSD_INT_TYPES) \
|
||||
&& !defined(HPUX)
|
||||
typedef PRInt16 int16;
|
||||
#endif
|
||||
|
@ -130,7 +114,7 @@ typedef PRInt16 int16;
|
|||
* int8
|
||||
*/
|
||||
|
||||
#if !defined(XP_BEOS) && !defined(_PR_AIX_HAVE_BSD_INT_TYPES) \
|
||||
#if !defined(_PR_AIX_HAVE_BSD_INT_TYPES) \
|
||||
&& !defined(HPUX)
|
||||
typedef PRInt8 int8;
|
||||
#endif
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#ifndef prinet_h__
|
||||
#define prinet_h__
|
||||
|
||||
#if defined(XP_UNIX) || defined(XP_OS2) || defined(XP_BEOS)
|
||||
#if defined(XP_UNIX) || defined(XP_OS2)
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h> /* AF_INET */
|
||||
#include <netinet/in.h> /* INADDR_ANY, ..., ntohl(), ... */
|
||||
|
@ -70,7 +70,7 @@ struct sockaddr_dl;
|
|||
* Prototypes of ntohl() etc. are declared in <machine/endian.h>
|
||||
* on these platforms.
|
||||
*/
|
||||
#if defined(BSDI) || defined(OSF1)
|
||||
#if defined(BSDI)
|
||||
#include <machine/endian.h>
|
||||
#endif
|
||||
|
||||
|
|
|
@ -31,11 +31,11 @@ PR_BEGIN_EXTERN_C
|
|||
** The format of the version string is
|
||||
** "<major version>.<minor version>[.<patch level>] [<Beta>]"
|
||||
*/
|
||||
#define PR_VERSION "4.21"
|
||||
#define PR_VERSION "4.22 Beta"
|
||||
#define PR_VMAJOR 4
|
||||
#define PR_VMINOR 21
|
||||
#define PR_VMINOR 22
|
||||
#define PR_VPATCH 0
|
||||
#define PR_BETA PR_FALSE
|
||||
#define PR_BETA PR_TRUE
|
||||
|
||||
/*
|
||||
** PRVersionCheck
|
||||
|
|
|
@ -145,21 +145,13 @@ typedef struct PRIPv6Addr PRIPv6Addr;
|
|||
union PRNetAddr {
|
||||
struct {
|
||||
PRUint16 family; /* address family (0x00ff maskable) */
|
||||
#ifdef XP_BEOS
|
||||
char data[10]; /* Be has a smaller structure */
|
||||
#else
|
||||
char data[14]; /* raw address data */
|
||||
#endif
|
||||
} raw;
|
||||
struct {
|
||||
PRUint16 family; /* address family (AF_INET) */
|
||||
PRUint16 port; /* port number */
|
||||
PRUint32 ip; /* The actual 32 bits of address */
|
||||
#ifdef XP_BEOS
|
||||
char pad[4]; /* Be has a smaller structure */
|
||||
#else
|
||||
char pad[8];
|
||||
#endif
|
||||
} inet;
|
||||
struct {
|
||||
PRUint16 family; /* address family (AF_INET6) */
|
||||
|
|
|
@ -283,26 +283,6 @@ NSPR_API(PRMonitor*) PR_CTestAndEnterMonitor(void *address);
|
|||
/*---------------------------------------------------------------------------
|
||||
** PLATFORM-SPECIFIC INITIALIZATION FUNCTIONS
|
||||
---------------------------------------------------------------------------*/
|
||||
#if defined(IRIX)
|
||||
/*
|
||||
** Irix specific initialization funtion to be called before PR_Init
|
||||
** is called by the application. Sets the CONF_INITUSERS and CONF_INITSIZE
|
||||
** attributes of the shared arena set up by nspr.
|
||||
**
|
||||
** The environment variables _NSPR_IRIX_INITUSERS and _NSPR_IRIX_INITSIZE
|
||||
** can also be used to set these arena attributes. If _NSPR_IRIX_INITUSERS
|
||||
** is set, but not _NSPR_IRIX_INITSIZE, the value of the CONF_INITSIZE
|
||||
** attribute of the nspr arena is scaled as a function of the
|
||||
** _NSPR_IRIX_INITUSERS value.
|
||||
**
|
||||
** If the _PR_Irix_Set_Arena_Params() is called in addition to setting the
|
||||
** environment variables, the values of the environment variables are used.
|
||||
**
|
||||
*/
|
||||
NSPR_API(void) _PR_Irix_Set_Arena_Params(PRInt32 initusers, PRInt32 initsize);
|
||||
|
||||
#endif /* IRIX */
|
||||
|
||||
#if defined(XP_OS2)
|
||||
/*
|
||||
** These functions need to be called at the start and end of a thread.
|
||||
|
|
|
@ -10,10 +10,6 @@
|
|||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
#if defined(_PR_BTHREADS)
|
||||
#include <kernel/OS.h>
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
/*
|
||||
* Allow use of functions and symbols first defined in Win2k.
|
||||
|
@ -274,7 +270,7 @@ typedef struct _PRInterruptTable {
|
|||
#define _PR_CPU_PTR(_qp) \
|
||||
((_PRCPU*) ((char*) (_qp) - offsetof(_PRCPU,links)))
|
||||
|
||||
#if !defined(IRIX) && !defined(WIN32) && !defined(XP_OS2) \
|
||||
#if !defined(WIN32) && !defined(XP_OS2) \
|
||||
&& !(defined(SOLARIS) && defined(_PR_GLOBAL_THREADS_ONLY))
|
||||
#define _MD_GET_ATTACHED_THREAD() (_PR_MD_CURRENT_THREAD())
|
||||
#endif
|
||||
|
@ -948,10 +944,6 @@ extern void _PR_MD_BEGIN_RESUME_ALL(void);
|
|||
extern void _PR_MD_END_RESUME_ALL(void);
|
||||
#define _PR_MD_END_RESUME_ALL _MD_END_RESUME_ALL
|
||||
|
||||
#if defined(IRIX)
|
||||
NSPR_API(void) _PR_IRIX_CHILD_PROCESS(void);
|
||||
#endif /* IRIX */
|
||||
|
||||
#endif /* !_PR_LOCAL_THREADS_ONLY */
|
||||
|
||||
extern void _PR_MD_CLEAN_THREAD(PRThread *thread);
|
||||
|
@ -2140,23 +2132,6 @@ extern PRSize _pr_CopyLowBits( void *dest, PRSize dstlen, void *src, PRSize srcl
|
|||
|
||||
/* end PR_GetRandomNoise() related */
|
||||
|
||||
#ifdef XP_BEOS
|
||||
|
||||
extern PRLock *_connectLock;
|
||||
|
||||
typedef struct _ConnectListNode {
|
||||
PRInt32 osfd;
|
||||
PRNetAddr addr;
|
||||
PRUint32 addrlen;
|
||||
PRIntervalTime timeout;
|
||||
} ConnectListNode;
|
||||
|
||||
extern ConnectListNode connectList[64];
|
||||
|
||||
extern PRUint32 connectCount;
|
||||
|
||||
#endif /* XP_BEOS */
|
||||
|
||||
#if defined(_WIN64) && defined(WIN95)
|
||||
typedef struct _PRFileDescList {
|
||||
PRFileDesc *fd;
|
||||
|
|
|
@ -47,7 +47,7 @@ typedef struct PRHostEnt {
|
|||
} PRHostEnt;
|
||||
|
||||
/* A safe size to use that will mostly work... */
|
||||
#if (defined(AIX) && defined(_THREAD_SAFE)) || defined(OSF1)
|
||||
#if (defined(AIX) && defined(_THREAD_SAFE))
|
||||
#define PR_NETDB_BUF_SIZE sizeof(struct protoent_data)
|
||||
#else
|
||||
#define PR_NETDB_BUF_SIZE 1024
|
||||
|
|
|
@ -64,22 +64,6 @@
|
|||
#define PR_CALLBACK_DECL
|
||||
#define PR_STATIC_CALLBACK(__x) static __x
|
||||
|
||||
#elif defined(XP_BEOS)
|
||||
|
||||
#define PR_EXPORT(__type) extern __declspec(dllexport) __type
|
||||
#define PR_EXPORT_DATA(__type) extern __declspec(dllexport) __type
|
||||
#define PR_IMPORT(__type) extern __declspec(dllexport) __type
|
||||
#define PR_IMPORT_DATA(__type) extern __declspec(dllexport) __type
|
||||
|
||||
#define PR_EXTERN(__type) extern __declspec(dllexport) __type
|
||||
#define PR_IMPLEMENT(__type) __declspec(dllexport) __type
|
||||
#define PR_EXTERN_DATA(__type) extern __declspec(dllexport) __type
|
||||
#define PR_IMPLEMENT_DATA(__type) __declspec(dllexport) __type
|
||||
|
||||
#define PR_CALLBACK
|
||||
#define PR_CALLBACK_DECL
|
||||
#define PR_STATIC_CALLBACK(__x) static __x
|
||||
|
||||
#elif defined(XP_OS2) && defined(__declspec)
|
||||
|
||||
#define PR_EXPORT(__type) extern __declspec(dllexport) __type
|
||||
|
@ -96,27 +80,6 @@
|
|||
#define PR_CALLBACK_DECL
|
||||
#define PR_STATIC_CALLBACK(__x) static __x
|
||||
|
||||
#elif defined(SYMBIAN)
|
||||
|
||||
#define PR_EXPORT(__type) extern __declspec(dllexport) __type
|
||||
#define PR_EXPORT_DATA(__type) extern __declspec(dllexport) __type
|
||||
#ifdef __WINS__
|
||||
#define PR_IMPORT(__type) extern __declspec(dllexport) __type
|
||||
#define PR_IMPORT_DATA(__type) extern __declspec(dllexport) __type
|
||||
#else
|
||||
#define PR_IMPORT(__type) extern __declspec(dllimport) __type
|
||||
#define PR_IMPORT_DATA(__type) extern __declspec(dllimport) __type
|
||||
#endif
|
||||
|
||||
#define PR_EXTERN(__type) extern __type
|
||||
#define PR_IMPLEMENT(__type) __type
|
||||
#define PR_EXTERN_DATA(__type) extern __type
|
||||
#define PR_IMPLEMENT_DATA(__type) __type
|
||||
|
||||
#define PR_CALLBACK
|
||||
#define PR_CALLBACK_DECL
|
||||
#define PR_STATIC_CALLBACK(__x) static __x
|
||||
|
||||
#else /* Unix */
|
||||
|
||||
/* GCC 3.3 and later support the visibility attribute. */
|
||||
|
|
|
@ -66,13 +66,6 @@ endif
|
|||
endif # sparc
|
||||
endif # SunOS
|
||||
|
||||
ifeq ($(OS_ARCH), IRIX)
|
||||
ifeq ($(USE_PTHREADS), 1)
|
||||
OS_LIBS = -lpthread
|
||||
endif
|
||||
OS_LIBS += -lc
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),AIX)
|
||||
DSO_LDOPTS += -binitfini::_PR_Fini
|
||||
OS_LIBS = -lodm -lcfg
|
||||
|
@ -109,15 +102,6 @@ GARBAGE += $(MAPFILE)
|
|||
MKSHLIB += $(MAPFILE)
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),OSF1)
|
||||
ifeq ($(USE_PTHREADS), 1)
|
||||
OS_LIBS = -lpthread -lrt
|
||||
endif
|
||||
ifneq ($(OS_RELEASE),V2.0)
|
||||
OS_LIBS += -lc_r
|
||||
endif
|
||||
endif
|
||||
|
||||
# Linux, GNU/Hurd, and GNU/kFreeBSD systems
|
||||
ifneq (,$(filter Linux GNU%,$(OS_ARCH)))
|
||||
ifeq ($(USE_PTHREADS), 1)
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Makefile
|
|
@ -1,31 +0,0 @@
|
|||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
|
||||
#! gmake
|
||||
|
||||
MOD_DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(MOD_DEPTH)/config/autoconf.mk
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
include $(srcdir)/bsrcs.mk
|
||||
CSRCS += $(BTCSRCS)
|
||||
|
||||
TARGETS = $(OBJS)
|
||||
|
||||
INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
DEFINES += -D_NSPR_BUILD_
|
||||
|
||||
export:: $(TARGETS)
|
||||
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
# this file lists the source files to be compiled (used in Makefile) and
|
||||
# then enumerated as object files (in objs.mk) for inclusion in the NSPR
|
||||
# shared library
|
||||
|
||||
BTCSRCS = \
|
||||
btthread.c \
|
||||
btlocks.c \
|
||||
btcvar.c \
|
||||
btmon.c \
|
||||
btsem.c \
|
||||
btmisc.c \
|
||||
$(NULL)
|
|
@ -1,244 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include <kernel/OS.h>
|
||||
|
||||
#include "primpl.h"
|
||||
|
||||
/*
|
||||
** Create a new condition variable.
|
||||
**
|
||||
** "lock" is the lock used to protect the condition variable.
|
||||
**
|
||||
** Condition variables are synchronization objects that threads can use
|
||||
** to wait for some condition to occur.
|
||||
**
|
||||
** This may fail if memory is tight or if some operating system resource
|
||||
** is low. In such cases, a NULL will be returned.
|
||||
*/
|
||||
PR_IMPLEMENT(PRCondVar*)
|
||||
PR_NewCondVar (PRLock *lock)
|
||||
{
|
||||
PRCondVar *cv = PR_NEW( PRCondVar );
|
||||
PR_ASSERT( NULL != lock );
|
||||
if( NULL != cv )
|
||||
{
|
||||
cv->lock = lock;
|
||||
cv->sem = create_sem(0, "CVSem");
|
||||
cv->handshakeSem = create_sem(0, "CVHandshake");
|
||||
cv->signalSem = create_sem( 0, "CVSignal");
|
||||
cv->signalBenCount = 0;
|
||||
cv->ns = cv->nw = 0;
|
||||
PR_ASSERT( cv->sem >= B_NO_ERROR );
|
||||
PR_ASSERT( cv->handshakeSem >= B_NO_ERROR );
|
||||
PR_ASSERT( cv->signalSem >= B_NO_ERROR );
|
||||
}
|
||||
return cv;
|
||||
} /* PR_NewCondVar */
|
||||
|
||||
/*
|
||||
** Destroy a condition variable. There must be no thread
|
||||
** waiting on the condvar. The caller is responsible for guaranteeing
|
||||
** that the condvar is no longer in use.
|
||||
**
|
||||
*/
|
||||
PR_IMPLEMENT(void)
|
||||
PR_DestroyCondVar (PRCondVar *cvar)
|
||||
{
|
||||
status_t result = delete_sem( cvar->sem );
|
||||
PR_ASSERT( result == B_NO_ERROR );
|
||||
|
||||
result = delete_sem( cvar->handshakeSem );
|
||||
PR_ASSERT( result == B_NO_ERROR );
|
||||
|
||||
result = delete_sem( cvar->signalSem );
|
||||
PR_ASSERT( result == B_NO_ERROR );
|
||||
|
||||
PR_DELETE( cvar );
|
||||
}
|
||||
|
||||
/*
|
||||
** The thread that waits on a condition is blocked in a "waiting on
|
||||
** condition" state until another thread notifies the condition or a
|
||||
** caller specified amount of time expires. The lock associated with
|
||||
** the condition variable will be released, which must have be held
|
||||
** prior to the call to wait.
|
||||
**
|
||||
** Logically a notified thread is moved from the "waiting on condition"
|
||||
** state and made "ready." When scheduled, it will attempt to reacquire
|
||||
** the lock that it held when wait was called.
|
||||
**
|
||||
** The timeout has two well known values, PR_INTERVAL_NO_TIMEOUT and
|
||||
** PR_INTERVAL_NO_WAIT. The former value requires that a condition be
|
||||
** notified (or the thread interrupted) before it will resume from the
|
||||
** wait. If the timeout has a value of PR_INTERVAL_NO_WAIT, the effect
|
||||
** is to release the lock, possibly causing a rescheduling within the
|
||||
** runtime, then immediately attempting to reacquire the lock and resume.
|
||||
**
|
||||
** Any other value for timeout will cause the thread to be rescheduled
|
||||
** either due to explicit notification or an expired interval. The latter
|
||||
** must be determined by treating time as one part of the monitored data
|
||||
** being protected by the lock and tested explicitly for an expired
|
||||
** interval.
|
||||
**
|
||||
** Returns PR_FAILURE if the caller has not locked the lock associated
|
||||
** with the condition variable or the thread was interrupted (PR_Interrupt()).
|
||||
** The particular reason can be extracted with PR_GetError().
|
||||
*/
|
||||
PR_IMPLEMENT(PRStatus)
|
||||
PR_WaitCondVar (PRCondVar *cvar, PRIntervalTime timeout)
|
||||
{
|
||||
status_t err;
|
||||
if( timeout == PR_INTERVAL_NO_WAIT )
|
||||
{
|
||||
PR_Unlock( cvar->lock );
|
||||
PR_Lock( cvar->lock );
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
if( atomic_add( &cvar->signalBenCount, 1 ) > 0 )
|
||||
{
|
||||
if (acquire_sem(cvar->signalSem) == B_INTERRUPTED)
|
||||
{
|
||||
atomic_add( &cvar->signalBenCount, -1 );
|
||||
return PR_FAILURE;
|
||||
}
|
||||
}
|
||||
cvar->nw += 1;
|
||||
if( atomic_add( &cvar->signalBenCount, -1 ) > 1 )
|
||||
{
|
||||
release_sem_etc(cvar->signalSem, 1, B_DO_NOT_RESCHEDULE);
|
||||
}
|
||||
|
||||
PR_Unlock( cvar->lock );
|
||||
if( timeout==PR_INTERVAL_NO_TIMEOUT )
|
||||
{
|
||||
err = acquire_sem(cvar->sem);
|
||||
}
|
||||
else
|
||||
{
|
||||
err = acquire_sem_etc(cvar->sem, 1, B_RELATIVE_TIMEOUT, PR_IntervalToMicroseconds(timeout) );
|
||||
}
|
||||
|
||||
if( atomic_add( &cvar->signalBenCount, 1 ) > 0 )
|
||||
{
|
||||
while (acquire_sem(cvar->signalSem) == B_INTERRUPTED);
|
||||
}
|
||||
|
||||
if (cvar->ns > 0)
|
||||
{
|
||||
release_sem_etc(cvar->handshakeSem, 1, B_DO_NOT_RESCHEDULE);
|
||||
cvar->ns -= 1;
|
||||
}
|
||||
cvar->nw -= 1;
|
||||
if( atomic_add( &cvar->signalBenCount, -1 ) > 1 )
|
||||
{
|
||||
release_sem_etc(cvar->signalSem, 1, B_DO_NOT_RESCHEDULE);
|
||||
}
|
||||
|
||||
PR_Lock( cvar->lock );
|
||||
if(err!=B_NO_ERROR)
|
||||
{
|
||||
return PR_FAILURE;
|
||||
}
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
** Notify ONE thread that is currently waiting on 'cvar'. Which thread is
|
||||
** dependent on the implementation of the runtime. Common sense would dictate
|
||||
** that all threads waiting on a single condition have identical semantics,
|
||||
** therefore which one gets notified is not significant.
|
||||
**
|
||||
** The calling thead must hold the lock that protects the condition, as
|
||||
** well as the invariants that are tightly bound to the condition, when
|
||||
** notify is called.
|
||||
**
|
||||
** Returns PR_FAILURE if the caller has not locked the lock associated
|
||||
** with the condition variable.
|
||||
*/
|
||||
PR_IMPLEMENT(PRStatus)
|
||||
PR_NotifyCondVar (PRCondVar *cvar)
|
||||
{
|
||||
status_t err ;
|
||||
if( atomic_add( &cvar->signalBenCount, 1 ) > 0 )
|
||||
{
|
||||
if (acquire_sem(cvar->signalSem) == B_INTERRUPTED)
|
||||
{
|
||||
atomic_add( &cvar->signalBenCount, -1 );
|
||||
return PR_FAILURE;
|
||||
}
|
||||
}
|
||||
if (cvar->nw > cvar->ns)
|
||||
{
|
||||
cvar->ns += 1;
|
||||
release_sem_etc(cvar->sem, 1, B_DO_NOT_RESCHEDULE);
|
||||
if( atomic_add( &cvar->signalBenCount, -1 ) > 1 )
|
||||
{
|
||||
release_sem_etc(cvar->signalSem, 1, B_DO_NOT_RESCHEDULE);
|
||||
}
|
||||
|
||||
while (acquire_sem(cvar->handshakeSem) == B_INTERRUPTED)
|
||||
{
|
||||
err = B_INTERRUPTED;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( atomic_add( &cvar->signalBenCount, -1 ) > 1 )
|
||||
{
|
||||
release_sem_etc(cvar->signalSem, 1, B_DO_NOT_RESCHEDULE);
|
||||
}
|
||||
}
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
** Notify all of the threads waiting on the condition variable. The order
|
||||
** that the threads are notified is indeterminant. The lock that protects
|
||||
** the condition must be held.
|
||||
**
|
||||
** Returns PR_FAILURE if the caller has not locked the lock associated
|
||||
** with the condition variable.
|
||||
*/
|
||||
PR_IMPLEMENT(PRStatus)
|
||||
PR_NotifyAllCondVar (PRCondVar *cvar)
|
||||
{
|
||||
int32 handshakes;
|
||||
status_t err = B_OK;
|
||||
|
||||
if( atomic_add( &cvar->signalBenCount, 1 ) > 0 )
|
||||
{
|
||||
if (acquire_sem(cvar->signalSem) == B_INTERRUPTED)
|
||||
{
|
||||
atomic_add( &cvar->signalBenCount, -1 );
|
||||
return PR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
if (cvar->nw > cvar->ns)
|
||||
{
|
||||
handshakes = cvar->nw - cvar->ns;
|
||||
cvar->ns = cvar->nw;
|
||||
release_sem_etc(cvar->sem, handshakes, B_DO_NOT_RESCHEDULE);
|
||||
if( atomic_add( &cvar->signalBenCount, -1 ) > 1 )
|
||||
{
|
||||
release_sem_etc(cvar->signalSem, 1, B_DO_NOT_RESCHEDULE);
|
||||
}
|
||||
|
||||
while (acquire_sem_etc(cvar->handshakeSem, handshakes, 0, 0) == B_INTERRUPTED)
|
||||
{
|
||||
err = B_INTERRUPTED;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( atomic_add( &cvar->signalBenCount, -1 ) > 1 )
|
||||
{
|
||||
release_sem_etc(cvar->signalSem, 1, B_DO_NOT_RESCHEDULE);
|
||||
}
|
||||
}
|
||||
return PR_SUCCESS;
|
||||
}
|
|
@ -1,91 +0,0 @@
|
|||
/* -*- Mode: C++; c-basic-offset: 4 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/*
|
||||
** File: btlocks.c
|
||||
** Description: Implemenation for thread locks using bthreads
|
||||
** Exports: prlock.h
|
||||
*/
|
||||
|
||||
#include "primpl.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
void
|
||||
_PR_InitLocks (void)
|
||||
{
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PRLock*)
|
||||
PR_NewLock (void)
|
||||
{
|
||||
PRLock *lock;
|
||||
status_t semresult;
|
||||
|
||||
if (!_pr_initialized) _PR_ImplicitInitialization();
|
||||
|
||||
lock = PR_NEWZAP(PRLock);
|
||||
if (lock != NULL) {
|
||||
|
||||
lock->benaphoreCount = 0;
|
||||
lock->semaphoreID = create_sem( 0, "nsprLockSem" );
|
||||
if( lock->semaphoreID < B_NO_ERROR ) {
|
||||
|
||||
PR_DELETE( lock );
|
||||
lock = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return lock;
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(void)
|
||||
PR_DestroyLock (PRLock* lock)
|
||||
{
|
||||
status_t result;
|
||||
|
||||
PR_ASSERT(NULL != lock);
|
||||
result = delete_sem(lock->semaphoreID);
|
||||
PR_ASSERT(result == B_NO_ERROR);
|
||||
PR_DELETE(lock);
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(void)
|
||||
PR_Lock (PRLock* lock)
|
||||
{
|
||||
PR_ASSERT(lock != NULL);
|
||||
|
||||
if( atomic_add( &lock->benaphoreCount, 1 ) > 0 ) {
|
||||
|
||||
if( acquire_sem(lock->semaphoreID ) != B_NO_ERROR ) {
|
||||
|
||||
atomic_add( &lock->benaphoreCount, -1 );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
lock->owner = find_thread( NULL );
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PRStatus)
|
||||
PR_Unlock (PRLock* lock)
|
||||
{
|
||||
PR_ASSERT(lock != NULL);
|
||||
lock->owner = NULL;
|
||||
if( atomic_add( &lock->benaphoreCount, -1 ) > 1 ) {
|
||||
|
||||
release_sem_etc( lock->semaphoreID, 1, B_DO_NOT_RESCHEDULE );
|
||||
}
|
||||
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(void)
|
||||
PR_AssertCurrentThreadOwnsLock(PRLock *lock)
|
||||
{
|
||||
PR_ASSERT(lock != NULL);
|
||||
PR_ASSERT(lock->owner == find_thread( NULL ));
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
/* -*- Mode: C++; c-basic-offset: 4 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "primpl.h"
|
||||
#include <stdio.h>
|
||||
|
||||
// void _PR_InitCPUs(void) {PT_LOG("_PR_InitCPUs")}
|
||||
// void _MD_StartInterrupts(void) {PT_LOG("_MD_StartInterrupts")}
|
||||
|
||||
/* this is a total hack.. */
|
||||
|
||||
struct protoent* getprotobyname(const char* name)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct protoent* getprotobynumber(int number)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* this is needed by prinit for some reason */
|
||||
void
|
||||
_PR_InitStacks (void)
|
||||
{
|
||||
}
|
||||
|
||||
/* this is needed by prinit for some reason */
|
||||
void
|
||||
_PR_InitTPD (void)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
** Create extra virtual processor threads. Generally used with MP systems.
|
||||
*/
|
||||
PR_IMPLEMENT(void)
|
||||
PR_SetConcurrency (PRUintn numCPUs)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
** Set thread recycle mode to on (1) or off (0)
|
||||
*/
|
||||
PR_IMPLEMENT(void)
|
||||
PR_SetThreadRecycleMode (PRUint32 flag)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
** Get context registers, return with error for now.
|
||||
*/
|
||||
|
||||
PR_IMPLEMENT(PRWord *)
|
||||
_MD_HomeGCRegisters( PRThread *t, int isCurrent, int *np )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(void *)
|
||||
PR_GetSP( PRThread *t )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PRStatus)
|
||||
PR_EnumerateThreads( PREnumerator func, void *arg )
|
||||
{
|
||||
return PR_FAILURE;
|
||||
}
|
|
@ -1,201 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include <kernel/OS.h>
|
||||
|
||||
#include "primpl.h"
|
||||
|
||||
/*
|
||||
** Create a new monitor. Monitors are re-entrant locks with a single built-in
|
||||
** condition variable.
|
||||
**
|
||||
** This may fail if memory is tight or if some operating system resource
|
||||
** is low.
|
||||
*/
|
||||
PR_IMPLEMENT(PRMonitor*)
|
||||
PR_NewMonitor (void)
|
||||
{
|
||||
PRMonitor *mon;
|
||||
PRCondVar *cvar;
|
||||
PRLock *lock;
|
||||
|
||||
mon = PR_NEWZAP( PRMonitor );
|
||||
if( mon )
|
||||
{
|
||||
lock = PR_NewLock();
|
||||
if( !lock )
|
||||
{
|
||||
PR_DELETE( mon );
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
cvar = PR_NewCondVar( lock );
|
||||
if( !cvar )
|
||||
{
|
||||
PR_DestroyLock( lock );
|
||||
PR_DELETE( mon );
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
mon->cvar = cvar;
|
||||
mon->name = NULL;
|
||||
}
|
||||
|
||||
return( mon );
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PRMonitor*) PR_NewNamedMonitor(const char* name)
|
||||
{
|
||||
PRMonitor* mon = PR_NewMonitor();
|
||||
if( mon )
|
||||
{
|
||||
mon->name = name;
|
||||
}
|
||||
return mon;
|
||||
}
|
||||
|
||||
/*
|
||||
** Destroy a monitor. The caller is responsible for guaranteeing that the
|
||||
** monitor is no longer in use. There must be no thread waiting on the
|
||||
** monitor's condition variable and that the lock is not held.
|
||||
**
|
||||
*/
|
||||
PR_IMPLEMENT(void)
|
||||
PR_DestroyMonitor (PRMonitor *mon)
|
||||
{
|
||||
PR_DestroyLock( mon->cvar->lock );
|
||||
PR_DestroyCondVar( mon->cvar );
|
||||
PR_DELETE( mon );
|
||||
}
|
||||
|
||||
/*
|
||||
** Enter the lock associated with the monitor. If the calling thread currently
|
||||
** is in the monitor, the call to enter will silently succeed. In either case,
|
||||
** it will increment the entry count by one.
|
||||
*/
|
||||
PR_IMPLEMENT(void)
|
||||
PR_EnterMonitor (PRMonitor *mon)
|
||||
{
|
||||
if( mon->cvar->lock->owner == find_thread( NULL ) )
|
||||
{
|
||||
mon->entryCount++;
|
||||
|
||||
} else
|
||||
{
|
||||
PR_Lock( mon->cvar->lock );
|
||||
mon->entryCount = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Decrement the entry count associated with the monitor. If the decremented
|
||||
** entry count is zero, the monitor is exited. Returns PR_FAILURE if the
|
||||
** calling thread has not entered the monitor.
|
||||
*/
|
||||
PR_IMPLEMENT(PRStatus)
|
||||
PR_ExitMonitor (PRMonitor *mon)
|
||||
{
|
||||
if( mon->cvar->lock->owner != find_thread( NULL ) )
|
||||
{
|
||||
return( PR_FAILURE );
|
||||
}
|
||||
if( --mon->entryCount == 0 )
|
||||
{
|
||||
return( PR_Unlock( mon->cvar->lock ) );
|
||||
}
|
||||
return( PR_SUCCESS );
|
||||
}
|
||||
|
||||
/*
|
||||
** Wait for a notify on the monitor's condition variable. Sleep for "ticks"
|
||||
** amount of time (if "ticks" is PR_INTERVAL_NO_TIMEOUT then the sleep is
|
||||
** indefinite).
|
||||
**
|
||||
** While the thread is waiting it exits the monitor (as if it called
|
||||
** PR_ExitMonitor as many times as it had called PR_EnterMonitor). When
|
||||
** the wait has finished the thread regains control of the monitors lock
|
||||
** with the same entry count as before the wait began.
|
||||
**
|
||||
** The thread waiting on the monitor will be resumed when the monitor is
|
||||
** notified (assuming the thread is the next in line to receive the
|
||||
** notify) or when the "ticks" timeout elapses.
|
||||
**
|
||||
** Returns PR_FAILURE if the caller has not entered the monitor.
|
||||
*/
|
||||
PR_IMPLEMENT(PRStatus)
|
||||
PR_Wait (PRMonitor *mon, PRIntervalTime ticks)
|
||||
{
|
||||
PRUint32 entryCount;
|
||||
PRUintn status;
|
||||
PRThread *meThread;
|
||||
thread_id me = find_thread( NULL );
|
||||
meThread = PR_GetCurrentThread();
|
||||
|
||||
if( mon->cvar->lock->owner != me ) return( PR_FAILURE );
|
||||
|
||||
entryCount = mon->entryCount;
|
||||
mon->entryCount = 0;
|
||||
|
||||
status = PR_WaitCondVar( mon->cvar, ticks );
|
||||
|
||||
mon->entryCount = entryCount;
|
||||
|
||||
return( status );
|
||||
}
|
||||
|
||||
/*
|
||||
** Notify a thread waiting on the monitor's condition variable. If a thread
|
||||
** is waiting on the condition variable (using PR_Wait) then it is awakened
|
||||
** and attempts to reenter the monitor.
|
||||
*/
|
||||
PR_IMPLEMENT(PRStatus)
|
||||
PR_Notify (PRMonitor *mon)
|
||||
{
|
||||
if( mon->cvar->lock->owner != find_thread( NULL ) )
|
||||
{
|
||||
return( PR_FAILURE );
|
||||
}
|
||||
|
||||
PR_NotifyCondVar( mon->cvar );
|
||||
return( PR_SUCCESS );
|
||||
}
|
||||
|
||||
/*
|
||||
** Notify all of the threads waiting on the monitor's condition variable.
|
||||
** All of threads waiting on the condition are scheduled to reenter the
|
||||
** monitor.
|
||||
*/
|
||||
PR_IMPLEMENT(PRStatus)
|
||||
PR_NotifyAll (PRMonitor *mon)
|
||||
{
|
||||
if( mon->cvar->lock->owner != find_thread( NULL ) )
|
||||
{
|
||||
return( PR_FAILURE );
|
||||
}
|
||||
|
||||
PR_NotifyAllCondVar( mon->cvar );
|
||||
return( PR_SUCCESS );
|
||||
}
|
||||
|
||||
/*
|
||||
** Return the number of times that the current thread has entered the
|
||||
** lock. Returns zero if the current thread has not entered the lock.
|
||||
*/
|
||||
PR_IMPLEMENT(PRIntn)
|
||||
PR_GetMonitorEntryCount(PRMonitor *mon)
|
||||
{
|
||||
return( (mon->cvar->lock->owner == find_thread( NULL )) ?
|
||||
mon->entryCount : 0 );
|
||||
}
|
||||
|
||||
/*
|
||||
** If the current thread is in |mon|, this assertion is guaranteed to
|
||||
** succeed. Otherwise, the behavior of this function is undefined.
|
||||
*/
|
||||
PR_IMPLEMENT(void)
|
||||
PR_AssertCurrentThreadInMonitor(PRMonitor *mon)
|
||||
{
|
||||
PR_ASSERT_CURRENT_THREAD_OWNS_LOCK(mon->cvar->lock);
|
||||
}
|
|
@ -1,98 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include <kernel/OS.h>
|
||||
|
||||
#include "primpl.h"
|
||||
|
||||
/*
|
||||
** Create a new semaphore object.
|
||||
*/
|
||||
PR_IMPLEMENT(PRSemaphore*)
|
||||
PR_NewSem (PRUintn value)
|
||||
{
|
||||
PRSemaphore *semaphore;
|
||||
|
||||
if (!_pr_initialized) _PR_ImplicitInitialization();
|
||||
|
||||
semaphore = PR_NEWZAP(PRSemaphore);
|
||||
if (NULL != semaphore) {
|
||||
if ((semaphore->sem = create_sem(value, "nspr_sem")) < B_NO_ERROR)
|
||||
return NULL;
|
||||
else
|
||||
return semaphore;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
** Destroy the given semaphore object.
|
||||
**
|
||||
*/
|
||||
PR_IMPLEMENT(void)
|
||||
PR_DestroySem (PRSemaphore *sem)
|
||||
{
|
||||
status_t result;
|
||||
|
||||
PR_ASSERT(sem != NULL);
|
||||
result = delete_sem(sem->sem);
|
||||
PR_ASSERT(result == B_NO_ERROR);
|
||||
PR_DELETE(sem);
|
||||
}
|
||||
|
||||
/*
|
||||
** Wait on a Semaphore.
|
||||
**
|
||||
** This routine allows a calling thread to wait or proceed depending upon
|
||||
** the state of the semahore sem. The thread can proceed only if the
|
||||
** counter value of the semaphore sem is currently greater than 0. If the
|
||||
** value of semaphore sem is positive, it is decremented by one and the
|
||||
** routine returns immediately allowing the calling thread to continue. If
|
||||
** the value of semaphore sem is 0, the calling thread blocks awaiting the
|
||||
** semaphore to be released by another thread.
|
||||
**
|
||||
** This routine can return PR_PENDING_INTERRUPT if the waiting thread
|
||||
** has been interrupted.
|
||||
*/
|
||||
PR_IMPLEMENT(PRStatus)
|
||||
PR_WaitSem (PRSemaphore *sem)
|
||||
{
|
||||
PR_ASSERT(sem != NULL);
|
||||
if (acquire_sem(sem->sem) == B_NO_ERROR)
|
||||
return PR_SUCCESS;
|
||||
else
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
/*
|
||||
** This routine increments the counter value of the semaphore. If other
|
||||
** threads are blocked for the semaphore, then the scheduler will
|
||||
** determine which ONE thread will be unblocked.
|
||||
*/
|
||||
PR_IMPLEMENT(void)
|
||||
PR_PostSem (PRSemaphore *sem)
|
||||
{
|
||||
status_t result;
|
||||
|
||||
PR_ASSERT(sem != NULL);
|
||||
result = release_sem_etc(sem->sem, 1, B_DO_NOT_RESCHEDULE);
|
||||
PR_ASSERT(result == B_NO_ERROR);
|
||||
}
|
||||
|
||||
/*
|
||||
** Returns the value of the semaphore referenced by sem without affecting
|
||||
** the state of the semaphore. The value represents the semaphore value
|
||||
** at the time of the call, but may not be the actual value when the
|
||||
** caller inspects it.
|
||||
*/
|
||||
PR_IMPLEMENT(PRUintn)
|
||||
PR_GetValueSem (PRSemaphore *sem)
|
||||
{
|
||||
sem_info info;
|
||||
|
||||
PR_ASSERT(sem != NULL);
|
||||
get_sem_info(sem->sem, &info);
|
||||
return info.count;
|
||||
}
|
|
@ -1,662 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include <kernel/OS.h>
|
||||
#include <support/TLS.h>
|
||||
|
||||
#include "prlog.h"
|
||||
#include "primpl.h"
|
||||
#include "prcvar.h"
|
||||
#include "prpdce.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
|
||||
/* values for PRThread.state */
|
||||
#define BT_THREAD_PRIMORD 0x01 /* this is the primordial thread */
|
||||
#define BT_THREAD_SYSTEM 0x02 /* this is a system thread */
|
||||
#define BT_THREAD_JOINABLE 0x04 /* this is a joinable thread */
|
||||
|
||||
struct _BT_Bookeeping
|
||||
{
|
||||
PRLock *ml; /* a lock to protect ourselves */
|
||||
sem_id cleanUpSem; /* the primoridal thread will block on this
|
||||
sem while waiting for the user threads */
|
||||
PRInt32 threadCount; /* user thred count */
|
||||
|
||||
} bt_book = { NULL, B_ERROR, 0 };
|
||||
|
||||
|
||||
#define BT_TPD_LIMIT 128 /* number of TPD slots we'll provide (arbitrary) */
|
||||
|
||||
/* these will be used to map an index returned by PR_NewThreadPrivateIndex()
|
||||
to the corresponding beos native TLS slot number, and to the destructor
|
||||
for that slot - note that, because it is allocated globally, this data
|
||||
will be automatically zeroed for us when the program begins */
|
||||
static int32 tpd_beosTLSSlots[BT_TPD_LIMIT];
|
||||
static PRThreadPrivateDTOR tpd_dtors[BT_TPD_LIMIT];
|
||||
|
||||
static vint32 tpd_slotsUsed=0; /* number of currently-allocated TPD slots */
|
||||
static int32 tls_prThreadSlot; /* TLS slot in which PRThread will be stored */
|
||||
|
||||
/* this mutex will be used to synchronize access to every
|
||||
PRThread.md.joinSem and PRThread.md.is_joining (we could
|
||||
actually allocate one per thread, but that seems a bit excessive,
|
||||
especially considering that there will probably be little
|
||||
contention, PR_JoinThread() is allowed to block anyway, and the code
|
||||
protected by the mutex is short/fast) */
|
||||
static PRLock *joinSemLock;
|
||||
|
||||
static PRUint32 _bt_MapNSPRToNativePriority( PRThreadPriority priority );
|
||||
static PRThreadPriority _bt_MapNativeToNSPRPriority( PRUint32 priority );
|
||||
static void _bt_CleanupThread(void *arg);
|
||||
static PRThread *_bt_AttachThread();
|
||||
|
||||
void
|
||||
_PR_InitThreads (PRThreadType type, PRThreadPriority priority,
|
||||
PRUintn maxPTDs)
|
||||
{
|
||||
PRThread *primordialThread;
|
||||
PRUint32 beThreadPriority;
|
||||
|
||||
/* allocate joinSem mutex */
|
||||
joinSemLock = PR_NewLock();
|
||||
if (joinSemLock == NULL)
|
||||
{
|
||||
PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
** Create and initialize NSPR structure for our primordial thread.
|
||||
*/
|
||||
|
||||
primordialThread = PR_NEWZAP(PRThread);
|
||||
if( NULL == primordialThread )
|
||||
{
|
||||
PR_SetError( PR_OUT_OF_MEMORY_ERROR, 0 );
|
||||
return;
|
||||
}
|
||||
|
||||
primordialThread->md.joinSem = B_ERROR;
|
||||
|
||||
/*
|
||||
** Set the priority to the desired level.
|
||||
*/
|
||||
|
||||
beThreadPriority = _bt_MapNSPRToNativePriority( priority );
|
||||
|
||||
set_thread_priority( find_thread( NULL ), beThreadPriority );
|
||||
|
||||
primordialThread->priority = priority;
|
||||
|
||||
|
||||
/* set the thread's state - note that the thread is not joinable */
|
||||
primordialThread->state |= BT_THREAD_PRIMORD;
|
||||
if (type == PR_SYSTEM_THREAD)
|
||||
primordialThread->state |= BT_THREAD_SYSTEM;
|
||||
|
||||
/*
|
||||
** Allocate a TLS slot for the PRThread structure (just using
|
||||
** native TLS, as opposed to NSPR TPD, will make PR_GetCurrentThread()
|
||||
** somewhat faster, and will leave one more TPD slot for our client)
|
||||
*/
|
||||
|
||||
tls_prThreadSlot = tls_allocate();
|
||||
|
||||
/*
|
||||
** Stuff our new PRThread structure into our thread specific
|
||||
** slot.
|
||||
*/
|
||||
|
||||
tls_set(tls_prThreadSlot, primordialThread);
|
||||
|
||||
/* allocate lock for bt_book */
|
||||
bt_book.ml = PR_NewLock();
|
||||
if( NULL == bt_book.ml )
|
||||
{
|
||||
PR_SetError( PR_OUT_OF_MEMORY_ERROR, 0 );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
PRUint32
|
||||
_bt_MapNSPRToNativePriority( PRThreadPriority priority )
|
||||
{
|
||||
switch( priority )
|
||||
{
|
||||
case PR_PRIORITY_LOW: return( B_LOW_PRIORITY );
|
||||
case PR_PRIORITY_NORMAL: return( B_NORMAL_PRIORITY );
|
||||
case PR_PRIORITY_HIGH: return( B_DISPLAY_PRIORITY );
|
||||
case PR_PRIORITY_URGENT: return( B_URGENT_DISPLAY_PRIORITY );
|
||||
default: return( B_NORMAL_PRIORITY );
|
||||
}
|
||||
}
|
||||
|
||||
PRThreadPriority
|
||||
_bt_MapNativeToNSPRPriority(PRUint32 priority)
|
||||
{
|
||||
if (priority < B_NORMAL_PRIORITY)
|
||||
return PR_PRIORITY_LOW;
|
||||
if (priority < B_DISPLAY_PRIORITY)
|
||||
return PR_PRIORITY_NORMAL;
|
||||
if (priority < B_URGENT_DISPLAY_PRIORITY)
|
||||
return PR_PRIORITY_HIGH;
|
||||
return PR_PRIORITY_URGENT;
|
||||
}
|
||||
|
||||
PRUint32
|
||||
_bt_mapNativeToNSPRPriority( int32 priority )
|
||||
{
|
||||
switch( priority )
|
||||
{
|
||||
case PR_PRIORITY_LOW: return( B_LOW_PRIORITY );
|
||||
case PR_PRIORITY_NORMAL: return( B_NORMAL_PRIORITY );
|
||||
case PR_PRIORITY_HIGH: return( B_DISPLAY_PRIORITY );
|
||||
case PR_PRIORITY_URGENT: return( B_URGENT_DISPLAY_PRIORITY );
|
||||
default: return( B_NORMAL_PRIORITY );
|
||||
}
|
||||
}
|
||||
|
||||
/* This method is called by all NSPR threads as they exit */
|
||||
void _bt_CleanupThread(void *arg)
|
||||
{
|
||||
PRThread *me = PR_GetCurrentThread();
|
||||
int32 i;
|
||||
|
||||
/* first, clean up all thread-private data */
|
||||
for (i = 0; i < tpd_slotsUsed; i++)
|
||||
{
|
||||
void *oldValue = tls_get(tpd_beosTLSSlots[i]);
|
||||
if ( oldValue != NULL && tpd_dtors[i] != NULL )
|
||||
(*tpd_dtors[i])(oldValue);
|
||||
}
|
||||
|
||||
/* if this thread is joinable, wait for someone to join it */
|
||||
if (me->state & BT_THREAD_JOINABLE)
|
||||
{
|
||||
/* protect access to our joinSem */
|
||||
PR_Lock(joinSemLock);
|
||||
|
||||
if (me->md.is_joining)
|
||||
{
|
||||
/* someone is already waiting to join us (they've
|
||||
allocated a joinSem for us) - let them know we're
|
||||
ready */
|
||||
delete_sem(me->md.joinSem);
|
||||
|
||||
PR_Unlock(joinSemLock);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/* noone is currently waiting for our demise - it
|
||||
is our responsibility to allocate the joinSem
|
||||
and block on it */
|
||||
me->md.joinSem = create_sem(0, "join sem");
|
||||
|
||||
/* we're done accessing our joinSem */
|
||||
PR_Unlock(joinSemLock);
|
||||
|
||||
/* wait for someone to join us */
|
||||
while (acquire_sem(me->md.joinSem) == B_INTERRUPTED);
|
||||
}
|
||||
}
|
||||
|
||||
/* if this is a user thread, we must update our books */
|
||||
if ((me->state & BT_THREAD_SYSTEM) == 0)
|
||||
{
|
||||
/* synchronize access to bt_book */
|
||||
PR_Lock( bt_book.ml );
|
||||
|
||||
/* decrement the number of currently-alive user threads */
|
||||
bt_book.threadCount--;
|
||||
|
||||
if (bt_book.threadCount == 0 && bt_book.cleanUpSem != B_ERROR) {
|
||||
/* we are the last user thread, and the primordial thread is
|
||||
blocked in PR_Cleanup() waiting for us to finish - notify
|
||||
it */
|
||||
delete_sem(bt_book.cleanUpSem);
|
||||
}
|
||||
|
||||
PR_Unlock( bt_book.ml );
|
||||
}
|
||||
|
||||
/* finally, delete this thread's PRThread */
|
||||
PR_DELETE(me);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a wrapper that all threads invoke that allows us to set some
|
||||
* things up prior to a thread's invocation and clean up after a thread has
|
||||
* exited.
|
||||
*/
|
||||
static void*
|
||||
_bt_root (void* arg)
|
||||
{
|
||||
PRThread *thred = (PRThread*)arg;
|
||||
PRIntn rv;
|
||||
void *privData;
|
||||
status_t result;
|
||||
int i;
|
||||
|
||||
/* save our PRThread object into our TLS */
|
||||
tls_set(tls_prThreadSlot, thred);
|
||||
|
||||
thred->startFunc(thred->arg); /* run the dang thing */
|
||||
|
||||
/* clean up */
|
||||
_bt_CleanupThread(NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PRThread*)
|
||||
PR_CreateThread (PRThreadType type, void (*start)(void* arg), void* arg,
|
||||
PRThreadPriority priority, PRThreadScope scope,
|
||||
PRThreadState state, PRUint32 stackSize)
|
||||
{
|
||||
PRUint32 bePriority;
|
||||
|
||||
PRThread* thred;
|
||||
|
||||
if (!_pr_initialized) _PR_ImplicitInitialization();
|
||||
|
||||
thred = PR_NEWZAP(PRThread);
|
||||
if (thred == NULL)
|
||||
{
|
||||
PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
thred->md.joinSem = B_ERROR;
|
||||
|
||||
thred->arg = arg;
|
||||
thred->startFunc = start;
|
||||
thred->priority = priority;
|
||||
|
||||
if( state == PR_JOINABLE_THREAD )
|
||||
{
|
||||
thred->state |= BT_THREAD_JOINABLE;
|
||||
}
|
||||
|
||||
/* keep some books */
|
||||
|
||||
PR_Lock( bt_book.ml );
|
||||
|
||||
if (type == PR_USER_THREAD)
|
||||
{
|
||||
bt_book.threadCount++;
|
||||
}
|
||||
|
||||
PR_Unlock( bt_book.ml );
|
||||
|
||||
bePriority = _bt_MapNSPRToNativePriority( priority );
|
||||
|
||||
thred->md.tid = spawn_thread((thread_func)_bt_root, "moz-thread",
|
||||
bePriority, thred);
|
||||
if (thred->md.tid < B_OK) {
|
||||
PR_SetError(PR_UNKNOWN_ERROR, thred->md.tid);
|
||||
PR_DELETE(thred);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (resume_thread(thred->md.tid) < B_OK) {
|
||||
PR_SetError(PR_UNKNOWN_ERROR, 0);
|
||||
PR_DELETE(thred);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return thred;
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PRThread*)
|
||||
PR_AttachThread(PRThreadType type, PRThreadPriority priority,
|
||||
PRThreadStack *stack)
|
||||
{
|
||||
/* PR_GetCurrentThread() will attach a thread if necessary */
|
||||
return PR_GetCurrentThread();
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(void)
|
||||
PR_DetachThread()
|
||||
{
|
||||
/* we don't support detaching */
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PRStatus)
|
||||
PR_JoinThread (PRThread* thred)
|
||||
{
|
||||
status_t eval, status;
|
||||
|
||||
PR_ASSERT(thred != NULL);
|
||||
|
||||
if ((thred->state & BT_THREAD_JOINABLE) == 0)
|
||||
{
|
||||
PR_SetError( PR_INVALID_ARGUMENT_ERROR, 0 );
|
||||
return( PR_FAILURE );
|
||||
}
|
||||
|
||||
/* synchronize access to the thread's joinSem */
|
||||
PR_Lock(joinSemLock);
|
||||
|
||||
if (thred->md.is_joining)
|
||||
{
|
||||
/* another thread is already waiting to join the specified
|
||||
thread - we must fail */
|
||||
PR_Unlock(joinSemLock);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
/* let others know we are waiting to join */
|
||||
thred->md.is_joining = PR_TRUE;
|
||||
|
||||
if (thred->md.joinSem == B_ERROR)
|
||||
{
|
||||
/* the thread hasn't finished yet - it is our responsibility to
|
||||
allocate a joinSem and wait on it */
|
||||
thred->md.joinSem = create_sem(0, "join sem");
|
||||
|
||||
/* we're done changing the joinSem now */
|
||||
PR_Unlock(joinSemLock);
|
||||
|
||||
/* wait for the thread to finish */
|
||||
while (acquire_sem(thred->md.joinSem) == B_INTERRUPTED);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/* the thread has already finished, and has allocated the
|
||||
joinSem itself - let it know it can finally die */
|
||||
delete_sem(thred->md.joinSem);
|
||||
|
||||
PR_Unlock(joinSemLock);
|
||||
}
|
||||
|
||||
/* make sure the thread is dead */
|
||||
wait_for_thread(thred->md.tid, &eval);
|
||||
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PRThread*)
|
||||
PR_GetCurrentThread ()
|
||||
{
|
||||
PRThread* thred;
|
||||
|
||||
if (!_pr_initialized) _PR_ImplicitInitialization();
|
||||
|
||||
thred = (PRThread *)tls_get( tls_prThreadSlot);
|
||||
if (thred == NULL)
|
||||
{
|
||||
/* this thread doesn't have a PRThread structure (it must be
|
||||
a native thread not created by the NSPR) - assimilate it */
|
||||
thred = _bt_AttachThread();
|
||||
}
|
||||
PR_ASSERT(NULL != thred);
|
||||
|
||||
return thred;
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PRThreadScope)
|
||||
PR_GetThreadScope (const PRThread* thred)
|
||||
{
|
||||
PR_ASSERT(thred != NULL);
|
||||
return PR_GLOBAL_THREAD;
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PRThreadType)
|
||||
PR_GetThreadType (const PRThread* thred)
|
||||
{
|
||||
PR_ASSERT(thred != NULL);
|
||||
return (thred->state & BT_THREAD_SYSTEM) ?
|
||||
PR_SYSTEM_THREAD : PR_USER_THREAD;
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PRThreadState)
|
||||
PR_GetThreadState (const PRThread* thred)
|
||||
{
|
||||
PR_ASSERT(thred != NULL);
|
||||
return (thred->state & BT_THREAD_JOINABLE)?
|
||||
PR_JOINABLE_THREAD: PR_UNJOINABLE_THREAD;
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PRThreadPriority)
|
||||
PR_GetThreadPriority (const PRThread* thred)
|
||||
{
|
||||
PR_ASSERT(thred != NULL);
|
||||
return thred->priority;
|
||||
} /* PR_GetThreadPriority */
|
||||
|
||||
PR_IMPLEMENT(void) PR_SetThreadPriority(PRThread *thred,
|
||||
PRThreadPriority newPri)
|
||||
{
|
||||
PRUint32 bePriority;
|
||||
|
||||
PR_ASSERT( thred != NULL );
|
||||
|
||||
thred->priority = newPri;
|
||||
bePriority = _bt_MapNSPRToNativePriority( newPri );
|
||||
set_thread_priority( thred->md.tid, bePriority );
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PRStatus)
|
||||
PR_NewThreadPrivateIndex (PRUintn* newIndex,
|
||||
PRThreadPrivateDTOR destructor)
|
||||
{
|
||||
int32 index;
|
||||
|
||||
if (!_pr_initialized) _PR_ImplicitInitialization();
|
||||
|
||||
/* reserve the next available tpd slot */
|
||||
index = atomic_add( &tpd_slotsUsed, 1 );
|
||||
if (index >= BT_TPD_LIMIT)
|
||||
{
|
||||
/* no slots left - decrement value, then fail */
|
||||
atomic_add( &tpd_slotsUsed, -1 );
|
||||
PR_SetError( PR_TPD_RANGE_ERROR, 0 );
|
||||
return( PR_FAILURE );
|
||||
}
|
||||
|
||||
/* allocate a beos-native TLS slot for this index (the new slot
|
||||
automatically contains NULL) */
|
||||
tpd_beosTLSSlots[index] = tls_allocate();
|
||||
|
||||
/* remember the destructor */
|
||||
tpd_dtors[index] = destructor;
|
||||
|
||||
*newIndex = (PRUintn)index;
|
||||
|
||||
return( PR_SUCCESS );
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PRStatus)
|
||||
PR_SetThreadPrivate (PRUintn index, void* priv)
|
||||
{
|
||||
void *oldValue;
|
||||
|
||||
/*
|
||||
** Sanity checking
|
||||
*/
|
||||
|
||||
if(index < 0 || index >= tpd_slotsUsed || index >= BT_TPD_LIMIT)
|
||||
{
|
||||
PR_SetError( PR_TPD_RANGE_ERROR, 0 );
|
||||
return( PR_FAILURE );
|
||||
}
|
||||
|
||||
/* if the old value isn't NULL, and the dtor for this slot isn't
|
||||
NULL, we must destroy the data */
|
||||
oldValue = tls_get(tpd_beosTLSSlots[index]);
|
||||
if (oldValue != NULL && tpd_dtors[index] != NULL)
|
||||
(*tpd_dtors[index])(oldValue);
|
||||
|
||||
/* save new value */
|
||||
tls_set(tpd_beosTLSSlots[index], priv);
|
||||
|
||||
return( PR_SUCCESS );
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(void*)
|
||||
PR_GetThreadPrivate (PRUintn index)
|
||||
{
|
||||
/* make sure the index is valid */
|
||||
if (index < 0 || index >= tpd_slotsUsed || index >= BT_TPD_LIMIT)
|
||||
{
|
||||
PR_SetError( PR_TPD_RANGE_ERROR, 0 );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* return the value */
|
||||
return tls_get( tpd_beosTLSSlots[index] );
|
||||
}
|
||||
|
||||
|
||||
PR_IMPLEMENT(PRStatus)
|
||||
PR_Interrupt (PRThread* thred)
|
||||
{
|
||||
PRIntn rv;
|
||||
|
||||
PR_ASSERT(thred != NULL);
|
||||
|
||||
/*
|
||||
** there seems to be a bug in beos R5 in which calling
|
||||
** resume_thread() on a blocked thread returns B_OK instead
|
||||
** of B_BAD_THREAD_STATE (beos bug #20000422-19095). as such,
|
||||
** to interrupt a thread, we will simply suspend then resume it
|
||||
** (no longer call resume_thread(), check for B_BAD_THREAD_STATE,
|
||||
** the suspend/resume to wake up a blocked thread). this wakes
|
||||
** up blocked threads properly, and doesn't hurt unblocked threads
|
||||
** (they simply get stopped then re-started immediately)
|
||||
*/
|
||||
|
||||
rv = suspend_thread( thred->md.tid );
|
||||
if( rv != B_NO_ERROR )
|
||||
{
|
||||
/* this doesn't appear to be a valid thread_id */
|
||||
PR_SetError( PR_UNKNOWN_ERROR, rv );
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
rv = resume_thread( thred->md.tid );
|
||||
if( rv != B_NO_ERROR )
|
||||
{
|
||||
PR_SetError( PR_UNKNOWN_ERROR, rv );
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(void)
|
||||
PR_ClearInterrupt ()
|
||||
{
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PRStatus)
|
||||
PR_Yield ()
|
||||
{
|
||||
/* we just sleep for long enough to cause a reschedule (100
|
||||
microseconds) */
|
||||
snooze(100);
|
||||
}
|
||||
|
||||
#define BT_MILLION 1000000UL
|
||||
|
||||
PR_IMPLEMENT(PRStatus)
|
||||
PR_Sleep (PRIntervalTime ticks)
|
||||
{
|
||||
bigtime_t tps;
|
||||
status_t status;
|
||||
|
||||
if (!_pr_initialized) _PR_ImplicitInitialization();
|
||||
|
||||
tps = PR_IntervalToMicroseconds( ticks );
|
||||
|
||||
status = snooze(tps);
|
||||
if (status == B_NO_ERROR) return PR_SUCCESS;
|
||||
|
||||
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, status);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PRStatus)
|
||||
PR_Cleanup ()
|
||||
{
|
||||
PRThread *me = PR_GetCurrentThread();
|
||||
|
||||
PR_ASSERT(me->state & BT_THREAD_PRIMORD);
|
||||
if ((me->state & BT_THREAD_PRIMORD) == 0) {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
PR_Lock( bt_book.ml );
|
||||
|
||||
if (bt_book.threadCount != 0)
|
||||
{
|
||||
/* we'll have to wait for some threads to finish - create a
|
||||
sem to block on */
|
||||
bt_book.cleanUpSem = create_sem(0, "cleanup sem");
|
||||
}
|
||||
|
||||
PR_Unlock( bt_book.ml );
|
||||
|
||||
/* note that, if all the user threads were already dead, we
|
||||
wouldn't have created a sem above, so this acquire_sem()
|
||||
will fail immediately */
|
||||
while (acquire_sem(bt_book.cleanUpSem) == B_INTERRUPTED);
|
||||
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(void)
|
||||
PR_ProcessExit (PRIntn status)
|
||||
{
|
||||
exit(status);
|
||||
}
|
||||
|
||||
PRThread *_bt_AttachThread()
|
||||
{
|
||||
PRThread *thread;
|
||||
thread_info tInfo;
|
||||
|
||||
/* make sure this thread doesn't already have a PRThread structure */
|
||||
PR_ASSERT(tls_get(tls_prThreadSlot) == NULL);
|
||||
|
||||
/* allocate a PRThread structure for this thread */
|
||||
thread = PR_NEWZAP(PRThread);
|
||||
if (thread == NULL)
|
||||
{
|
||||
PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* get the native thread's current state */
|
||||
get_thread_info(find_thread(NULL), &tInfo);
|
||||
|
||||
/* initialize new PRThread */
|
||||
thread->md.tid = tInfo.thread;
|
||||
thread->md.joinSem = B_ERROR;
|
||||
thread->priority = _bt_MapNativeToNSPRPriority(tInfo.priority);
|
||||
|
||||
/* attached threads are always non-joinable user threads */
|
||||
thread->state = 0;
|
||||
|
||||
/* increment user thread count */
|
||||
PR_Lock(bt_book.ml);
|
||||
bt_book.threadCount++;
|
||||
PR_Unlock(bt_book.ml);
|
||||
|
||||
/* store this thread's PRThread */
|
||||
tls_set(tls_prThreadSlot, thread);
|
||||
|
||||
/* the thread must call _bt_CleanupThread() before it dies, in order
|
||||
to clean up its PRThread, synchronize with the primordial thread,
|
||||
etc. */
|
||||
on_exit_thread(_bt_CleanupThread, NULL);
|
||||
|
||||
return thread;
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
# This makefile appends to the variable OBJS the bthread object modules
|
||||
# that will be part of the nspr20 library.
|
||||
|
||||
include $(srcdir)/bthreads/bsrcs.mk
|
||||
|
||||
OBJS += $(BTCSRCS:%.c=bthreads/$(OBJDIR)/%.$(OBJ_SUFFIX))
|
|
@ -49,24 +49,6 @@ LDOPTS = -L$(dist_libdir)
|
|||
LIBPR = -lnspr$(MOD_MAJOR_VERSION)
|
||||
LIBPL = -lplc$(MOD_MAJOR_VERSION)
|
||||
|
||||
ifeq ($(OS_ARCH), IRIX)
|
||||
LDOPTS += -rpath $(PWD)/$(dist_libdir) -rdata_shared
|
||||
# For 6.x machines, include this flag
|
||||
ifeq ($(basename $(OS_RELEASE)),6)
|
||||
ifeq ($(USE_N32),1)
|
||||
LDOPTS += -n32
|
||||
else
|
||||
LDOPTS += -32
|
||||
endif
|
||||
|
||||
ifeq ($(USE_PTHREADS), 1)
|
||||
ifeq ($(OS_RELEASE), 6.2)
|
||||
LDOPTS += -Wl,-woff,85
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# Solaris
|
||||
ifeq ($(OS_ARCH), SunOS)
|
||||
ifdef NS_USE_GCC
|
||||
|
@ -103,10 +85,6 @@ ifneq ($(OS_ARCH), WINNT)
|
|||
PWD = $(shell pwd)
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH), OSF1)
|
||||
LDOPTS += -rpath $(PWD)/$(dist_libdir)
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH), HP-UX)
|
||||
LDOPTS += -Wl,+s,+b,$(PWD)/$(dist_libdir)
|
||||
endif
|
||||
|
|
|
@ -388,9 +388,6 @@ PR_IMPLEMENT(PRInt32) PR_GetSysfdTableMax(void)
|
|||
ULONG ulCurMaxFH = 0;
|
||||
DosSetRelMaxFH(&ulReqCount, &ulCurMaxFH);
|
||||
return ulCurMaxFH;
|
||||
#elif defined(XP_BEOS)
|
||||
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
|
||||
return -1;
|
||||
#else
|
||||
write me;
|
||||
#endif
|
||||
|
@ -434,7 +431,7 @@ PR_IMPLEMENT(PRInt32) PR_SetSysfdTableSize(int table_size)
|
|||
}
|
||||
return tableMax;
|
||||
#elif defined(AIX) || defined(QNX) \
|
||||
|| defined(WIN32) || defined(WIN16) || defined(XP_BEOS)
|
||||
|| defined(WIN32) || defined(WIN16)
|
||||
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
|
||||
return -1;
|
||||
#else
|
||||
|
@ -692,7 +689,7 @@ PR_IMPLEMENT(PRStatus) PR_CreatePipe(
|
|||
(*readPipe)->secret->inheritable = _PR_TRI_TRUE;
|
||||
(*writePipe)->secret->inheritable = _PR_TRI_TRUE;
|
||||
return PR_SUCCESS;
|
||||
#elif defined(XP_UNIX) || defined(XP_OS2) || defined(XP_BEOS)
|
||||
#elif defined(XP_UNIX) || defined(XP_OS2)
|
||||
#ifdef XP_OS2
|
||||
HFILE pipefd[2];
|
||||
#else
|
||||
|
@ -722,13 +719,9 @@ PR_IMPLEMENT(PRStatus) PR_CreatePipe(
|
|||
close(pipefd[1]);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
#ifndef XP_BEOS /* Pipes are nonblocking on BeOS */
|
||||
_PR_MD_MAKE_NONBLOCK(*readPipe);
|
||||
#endif
|
||||
_PR_MD_INIT_FD_INHERITABLE(*readPipe, PR_FALSE);
|
||||
#ifndef XP_BEOS /* Pipes are nonblocking on BeOS */
|
||||
_PR_MD_MAKE_NONBLOCK(*writePipe);
|
||||
#endif
|
||||
_PR_MD_INIT_FD_INHERITABLE(*writePipe, PR_FALSE);
|
||||
return PR_SUCCESS;
|
||||
#else
|
||||
|
|
|
@ -223,7 +223,7 @@ PR_IMPLEMENT(PRStatus) PR_SetFDInheritable(
|
|||
PRFileDesc *fd,
|
||||
PRBool inheritable)
|
||||
{
|
||||
#if defined(XP_UNIX) || defined(WIN32) || defined(XP_OS2) || defined(XP_BEOS)
|
||||
#if defined(XP_UNIX) || defined(WIN32) || defined(XP_OS2)
|
||||
/*
|
||||
* Only a non-layered, NSPR file descriptor can be inherited
|
||||
* by a child process.
|
||||
|
|
|
@ -62,7 +62,6 @@ PRStatus PR_CALLBACK _PR_SocketGetSocketOption(PRFileDesc *fd, PRSocketOptionDat
|
|||
{
|
||||
case PR_SockOpt_Linger:
|
||||
{
|
||||
#if !defined(XP_BEOS) || defined(BONE_VERSION)
|
||||
struct linger linger;
|
||||
length = sizeof(linger);
|
||||
rv = _PR_MD_GETSOCKOPT(
|
||||
|
@ -76,10 +75,6 @@ PRStatus PR_CALLBACK _PR_SocketGetSocketOption(PRFileDesc *fd, PRSocketOptionDat
|
|||
PR_SecondsToInterval(linger.l_linger);
|
||||
}
|
||||
break;
|
||||
#else
|
||||
PR_SetError( PR_NOT_IMPLEMENTED_ERROR, 0 );
|
||||
return PR_FAILURE;
|
||||
#endif
|
||||
}
|
||||
case PR_SockOpt_Reuseaddr:
|
||||
case PR_SockOpt_Keepalive:
|
||||
|
@ -221,17 +216,12 @@ PRStatus PR_CALLBACK _PR_SocketSetSocketOption(PRFileDesc *fd, const PRSocketOpt
|
|||
{
|
||||
case PR_SockOpt_Linger:
|
||||
{
|
||||
#if !defined(XP_BEOS) || defined(BONE_VERSION)
|
||||
struct linger linger;
|
||||
linger.l_onoff = data->value.linger.polarity;
|
||||
linger.l_linger = PR_IntervalToSeconds(data->value.linger.linger);
|
||||
rv = _PR_MD_SETSOCKOPT(
|
||||
fd, level, name, (char*)&linger, sizeof(linger));
|
||||
break;
|
||||
#else
|
||||
PR_SetError( PR_NOT_IMPLEMENTED_ERROR, 0 );
|
||||
return PR_FAILURE;
|
||||
#endif
|
||||
}
|
||||
case PR_SockOpt_Reuseaddr:
|
||||
case PR_SockOpt_Keepalive:
|
||||
|
|
|
@ -365,11 +365,7 @@ GetFloat(ScanfState *state)
|
|||
if (state->sizeSpec == _PR_size_l) {
|
||||
*va_arg(state->ap, PRFloat64 *) = dval;
|
||||
} else if (state->sizeSpec == _PR_size_L) {
|
||||
#if defined(OSF1) || defined(IRIX)
|
||||
*va_arg(state->ap, double *) = dval;
|
||||
#else
|
||||
*va_arg(state->ap, long double *) = dval;
|
||||
#endif
|
||||
} else {
|
||||
*va_arg(state->ap, float *) = (float) dval;
|
||||
}
|
||||
|
|
|
@ -381,25 +381,6 @@ static PRStatus PR_CALLBACK SocketConnectContinue(
|
|||
}
|
||||
return PR_SUCCESS;
|
||||
|
||||
#elif defined(XP_BEOS)
|
||||
|
||||
#ifdef BONE_VERSION /* bug 122364 */
|
||||
/* temporary workaround until getsockopt(SO_ERROR) works in BONE */
|
||||
if (out_flags & PR_POLL_EXCEPT) {
|
||||
PR_SetError(PR_CONNECT_REFUSED_ERROR, 0);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
PR_ASSERT(out_flags & PR_POLL_WRITE);
|
||||
return PR_SUCCESS;
|
||||
#else
|
||||
err = _MD_beos_get_nonblocking_connect_error(fd);
|
||||
if( err != 0 ) {
|
||||
_PR_MD_MAP_CONNECT_ERROR(err);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
else
|
||||
return PR_SUCCESS;
|
||||
#endif /* BONE_VERSION */
|
||||
|
||||
#else
|
||||
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
|
||||
|
@ -478,7 +459,7 @@ PRIntervalTime timeout)
|
|||
* platforms can skip the following _PR_MD_MAKE_NONBLOCK
|
||||
* call.
|
||||
*/
|
||||
#if !defined(SOLARIS) && !defined(IRIX) && !defined(WINNT)
|
||||
#if !defined(SOLARIS) && !defined(WINNT)
|
||||
_PR_MD_MAKE_NONBLOCK(fd2);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -7,10 +7,6 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
#ifdef XP_BEOS
|
||||
#include <image.h>
|
||||
#endif
|
||||
|
||||
#if defined(XP_MACOSX) && defined(USE_MACH_DYLD)
|
||||
#include <Carbon/Carbon.h>
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
|
@ -38,10 +34,6 @@
|
|||
#define L_IGNOREUNLOAD 0x10000000
|
||||
#endif
|
||||
#endif
|
||||
#ifdef OSF1
|
||||
#include <loader.h>
|
||||
#include <rld_interface.h>
|
||||
#endif
|
||||
#elif defined(USE_HPSHL)
|
||||
#include <dl.h>
|
||||
#elif defined(USE_MACH_DYLD)
|
||||
|
@ -96,10 +88,6 @@ struct PRLibrary {
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef XP_BEOS
|
||||
void* dlh;
|
||||
void* stub_dlh;
|
||||
#endif
|
||||
};
|
||||
|
||||
static PRLibrary *pr_loadmap;
|
||||
|
@ -276,23 +264,16 @@ PR_GetLibraryPath(void)
|
|||
ev = strdup(ev);
|
||||
#endif
|
||||
|
||||
#if defined(XP_UNIX) || defined(XP_BEOS)
|
||||
#if defined(USE_DLFCN) || defined(USE_MACH_DYLD) || defined(XP_BEOS)
|
||||
#if defined(XP_UNIX)
|
||||
#if defined(USE_DLFCN) || defined(USE_MACH_DYLD)
|
||||
{
|
||||
char *p=NULL;
|
||||
int len;
|
||||
|
||||
#ifdef XP_BEOS
|
||||
ev = getenv("LIBRARY_PATH");
|
||||
if (!ev) {
|
||||
ev = "%A/lib:/boot/home/config/lib:/boot/beos/system/lib";
|
||||
}
|
||||
#else
|
||||
ev = getenv("LD_LIBRARY_PATH");
|
||||
if (!ev) {
|
||||
ev = "/usr/lib:/lib";
|
||||
}
|
||||
#endif
|
||||
len = strlen(ev) + 1; /* +1 for the null */
|
||||
|
||||
p = (char*) malloc(len);
|
||||
|
@ -349,7 +330,7 @@ PR_GetLibraryName(const char *path, const char *lib)
|
|||
}
|
||||
}
|
||||
#endif /* XP_PC */
|
||||
#if defined(XP_UNIX) || defined(XP_BEOS)
|
||||
#if defined(XP_UNIX)
|
||||
if (strstr(lib, PR_DLL_SUFFIX) == NULL)
|
||||
{
|
||||
if (path) {
|
||||
|
@ -364,7 +345,7 @@ PR_GetLibraryName(const char *path, const char *lib)
|
|||
fullname = PR_smprintf("%s", lib);
|
||||
}
|
||||
}
|
||||
#endif /* XP_UNIX || XP_BEOS */
|
||||
#endif /* XP_UNIX */
|
||||
return fullname;
|
||||
}
|
||||
|
||||
|
@ -842,96 +823,6 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags)
|
|||
|
||||
lm->refCount = 1;
|
||||
|
||||
#ifdef XP_BEOS
|
||||
{
|
||||
image_info info;
|
||||
int32 cookie = 0;
|
||||
image_id imageid = B_ERROR;
|
||||
image_id stubid = B_ERROR;
|
||||
PRLibrary *p;
|
||||
|
||||
for (p = pr_loadmap; p != NULL; p = p->next) {
|
||||
/* hopefully, our caller will always use the same string
|
||||
to refer to the same library */
|
||||
if (strcmp(name, p->name) == 0) {
|
||||
/* we've already loaded this library */
|
||||
imageid = info.id;
|
||||
lm->refCount++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(imageid == B_ERROR) {
|
||||
/* it appears the library isn't yet loaded - load it now */
|
||||
char stubName [B_PATH_NAME_LENGTH + 1];
|
||||
|
||||
/* the following is a work-around to a "bug" in the beos -
|
||||
the beos system loader allows only 32M (system-wide)
|
||||
to be used by code loaded as "add-ons" (code loaded
|
||||
through the 'load_add_on()' system call, which includes
|
||||
mozilla components), but allows 256M to be used by
|
||||
shared libraries.
|
||||
|
||||
unfortunately, mozilla is too large to fit into the
|
||||
"add-on" space, so we must trick the loader into
|
||||
loading some of the components as shared libraries. this
|
||||
is accomplished by creating a "stub" add-on (an empty
|
||||
shared object), and linking it with the component
|
||||
(the actual .so file generated by the build process,
|
||||
without any modifications). when this stub is loaded
|
||||
by load_add_on(), the loader will automatically load the
|
||||
component into the shared library space.
|
||||
*/
|
||||
|
||||
strcpy(stubName, name);
|
||||
strcat(stubName, ".stub");
|
||||
|
||||
/* first, attempt to load the stub (thereby loading the
|
||||
component as a shared library */
|
||||
if ((stubid = load_add_on(stubName)) > B_ERROR) {
|
||||
/* the stub was loaded successfully. */
|
||||
imageid = B_FILE_NOT_FOUND;
|
||||
|
||||
cookie = 0;
|
||||
while (get_next_image_info(0, &cookie, &info) == B_OK) {
|
||||
const char *endOfSystemName = strrchr(info.name, '/');
|
||||
const char *endOfPassedName = strrchr(name, '/');
|
||||
if( 0 == endOfSystemName )
|
||||
endOfSystemName = info.name;
|
||||
else
|
||||
endOfSystemName++;
|
||||
if( 0 == endOfPassedName )
|
||||
endOfPassedName = name;
|
||||
else
|
||||
endOfPassedName++;
|
||||
if (strcmp(endOfSystemName, endOfPassedName) == 0) {
|
||||
/* this is the actual component - remember it */
|
||||
imageid = info.id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
/* we failed to load the "stub" - try to load the
|
||||
component directly as an add-on */
|
||||
stubid = B_ERROR;
|
||||
imageid = load_add_on(name);
|
||||
}
|
||||
}
|
||||
|
||||
if (imageid <= B_ERROR) {
|
||||
oserr = imageid;
|
||||
PR_DELETE( lm );
|
||||
goto unlock;
|
||||
}
|
||||
lm->name = strdup(name);
|
||||
lm->dlh = (void*)imageid;
|
||||
lm->stub_dlh = (void*)stubid;
|
||||
lm->next = pr_loadmap;
|
||||
pr_loadmap = lm;
|
||||
}
|
||||
#endif
|
||||
|
||||
result = lm; /* success */
|
||||
PR_LOG(_pr_linker_lm, PR_LOG_MIN, ("Loaded library %s (load lib)", lm->name));
|
||||
|
||||
|
@ -979,13 +870,6 @@ PR_UnloadLibrary(PRLibrary *lib)
|
|||
goto done;
|
||||
}
|
||||
|
||||
#ifdef XP_BEOS
|
||||
if(((image_id)lib->stub_dlh) == B_ERROR)
|
||||
unload_add_on( (image_id) lib->dlh );
|
||||
else
|
||||
unload_add_on( (image_id) lib->stub_dlh);
|
||||
#endif
|
||||
|
||||
#ifdef XP_UNIX
|
||||
#ifdef HAVE_DLL
|
||||
#ifdef USE_DLFCN
|
||||
|
@ -1082,7 +966,7 @@ pr_FindSymbolInLib(PRLibrary *lm, const char *name)
|
|||
** If the symbol was not found in the static table then check if
|
||||
** the symbol was exported in the DLL... Win16 only!!
|
||||
*/
|
||||
#if !defined(WIN16) && !defined(XP_BEOS)
|
||||
#if !defined(WIN16)
|
||||
PR_SetError(PR_FIND_SYMBOL_ERROR, 0);
|
||||
return (void*)NULL;
|
||||
#endif
|
||||
|
@ -1149,12 +1033,6 @@ pr_FindSymbolInLib(PRLibrary *lm, const char *name)
|
|||
#undef SYM_OFFSET
|
||||
#endif /* XP_MACOSX && USE_MACH_DYLD */
|
||||
|
||||
#ifdef XP_BEOS
|
||||
if( B_NO_ERROR != get_image_symbol( (image_id)lm->dlh, name, B_SYMBOL_TYPE_TEXT, &f ) ) {
|
||||
f = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef XP_UNIX
|
||||
#ifdef HAVE_DLL
|
||||
#ifdef USE_DLFCN
|
||||
|
@ -1425,74 +1303,6 @@ PR_GetLibraryFilePathname(const char *name, PRFuncPtr addr)
|
|||
}
|
||||
PR_Free(info);
|
||||
return result;
|
||||
#elif defined(OSF1)
|
||||
/* Contributed by Steve Streeter of HP */
|
||||
ldr_process_t process, ldr_my_process();
|
||||
ldr_module_t mod_id;
|
||||
ldr_module_info_t info;
|
||||
ldr_region_t regno;
|
||||
ldr_region_info_t reginfo;
|
||||
size_t retsize;
|
||||
int rv;
|
||||
char *result;
|
||||
|
||||
/* Get process for which dynamic modules will be listed */
|
||||
|
||||
process = ldr_my_process();
|
||||
|
||||
/* Attach to process */
|
||||
|
||||
rv = ldr_xattach(process);
|
||||
if (rv) {
|
||||
/* should not happen */
|
||||
_PR_MD_MAP_DEFAULT_ERROR(_MD_ERRNO());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Print information for list of modules */
|
||||
|
||||
mod_id = LDR_NULL_MODULE;
|
||||
|
||||
for (;;) {
|
||||
|
||||
/* Get information for the next module in the module list. */
|
||||
|
||||
ldr_next_module(process, &mod_id);
|
||||
if (ldr_inq_module(process, mod_id, &info, sizeof(info),
|
||||
&retsize) != 0) {
|
||||
/* No more modules */
|
||||
break;
|
||||
}
|
||||
if (retsize < sizeof(info)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get information for each region in the module and check if any
|
||||
* contain the address of this function.
|
||||
*/
|
||||
|
||||
for (regno = 0; ; regno++) {
|
||||
if (ldr_inq_region(process, mod_id, regno, ®info,
|
||||
sizeof(reginfo), &retsize) != 0) {
|
||||
/* No more regions */
|
||||
break;
|
||||
}
|
||||
if (((unsigned long)reginfo.lri_mapaddr <=
|
||||
(unsigned long)addr) &&
|
||||
(((unsigned long)reginfo.lri_mapaddr + reginfo.lri_size) >
|
||||
(unsigned long)addr)) {
|
||||
/* Found it. */
|
||||
result = PR_Malloc(strlen(info.lmi_name)+1);
|
||||
if (result != NULL) {
|
||||
strcpy(result, info.lmi_name);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
PR_SetError(PR_LIBRARY_NOT_LOADED_ERROR, 0);
|
||||
return NULL;
|
||||
#elif defined(HPUX) && defined(USE_HPSHL)
|
||||
int index;
|
||||
struct shl_descriptor desc;
|
||||
|
|
|
@ -556,26 +556,6 @@ static pthread_mutex_t _PR_MD_malloc_crustylock;
|
|||
#else /* _PR_PTHREADS */
|
||||
static _MDLock _PR_MD_malloc_crustylock;
|
||||
|
||||
#ifdef IRIX
|
||||
#define _PR_Lock_Malloc() { \
|
||||
PRIntn _is; \
|
||||
if(PR_TRUE == _PR_malloc_initialised) { \
|
||||
if (_PR_MD_GET_ATTACHED_THREAD() && \
|
||||
!_PR_IS_NATIVE_THREAD( \
|
||||
_PR_MD_GET_ATTACHED_THREAD())) \
|
||||
_PR_INTSOFF(_is); \
|
||||
_PR_MD_LOCK(&_PR_MD_malloc_crustylock); \
|
||||
}
|
||||
|
||||
#define _PR_Unlock_Malloc() if(PR_TRUE == _PR_malloc_initialised) { \
|
||||
_PR_MD_UNLOCK(&_PR_MD_malloc_crustylock); \
|
||||
if (_PR_MD_GET_ATTACHED_THREAD() && \
|
||||
!_PR_IS_NATIVE_THREAD( \
|
||||
_PR_MD_GET_ATTACHED_THREAD())) \
|
||||
_PR_INTSON(_is); \
|
||||
} \
|
||||
}
|
||||
#else /* IRIX */
|
||||
#define _PR_Lock_Malloc() { \
|
||||
PRIntn _is; \
|
||||
if(PR_TRUE == _PR_malloc_initialised) { \
|
||||
|
@ -594,7 +574,6 @@ static _MDLock _PR_MD_malloc_crustylock;
|
|||
_PR_INTSON(_is); \
|
||||
} \
|
||||
}
|
||||
#endif /* IRIX */
|
||||
#endif /* _PR_PTHREADS */
|
||||
|
||||
PR_IMPLEMENT(PRStatus) _PR_MallocInit(void)
|
||||
|
@ -636,22 +615,6 @@ void *malloc(size_t size)
|
|||
return p;
|
||||
}
|
||||
|
||||
#if defined(IRIX)
|
||||
void *memalign(size_t alignment, size_t size)
|
||||
{
|
||||
void *p;
|
||||
_PR_Lock_Malloc();
|
||||
p = _PR_UnlockedMemalign(alignment, size);
|
||||
_PR_Unlock_Malloc();
|
||||
return p;
|
||||
}
|
||||
|
||||
void *valloc(size_t size)
|
||||
{
|
||||
return(memalign(sysconf(_SC_PAGESIZE),size));
|
||||
}
|
||||
#endif /* IRIX */
|
||||
|
||||
void free(void *ptr)
|
||||
{
|
||||
_PR_Lock_Malloc();
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Makefile
|
|
@ -1,28 +0,0 @@
|
|||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
|
||||
MOD_DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(MOD_DEPTH)/config/autoconf.mk
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
include $(srcdir)/bsrcs.mk
|
||||
CSRCS += $(MDCSRCS)
|
||||
|
||||
TARGETS = $(OBJS)
|
||||
|
||||
INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
|
||||
|
||||
DEFINES += -D_NSPR_BUILD_
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
export:: $(TARGETS)
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
/* -*- Mode: C++; c-basic-offset: 4 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "primpl.h"
|
||||
|
||||
PR_EXTERN(void) _PR_MD_INIT_CPUS();
|
||||
PR_EXTERN(void) _PR_MD_WAKEUP_CPUS();
|
||||
PR_EXTERN(void) _PR_MD_START_INTERRUPTS(void);
|
||||
PR_EXTERN(void) _PR_MD_STOP_INTERRUPTS(void);
|
||||
PR_EXTERN(void) _PR_MD_DISABLE_CLOCK_INTERRUPTS(void);
|
||||
PR_EXTERN(void) _PR_MD_BLOCK_CLOCK_INTERRUPTS(void);
|
||||
PR_EXTERN(void) _PR_MD_UNBLOCK_CLOCK_INTERRUPTS(void);
|
||||
PR_EXTERN(void) _PR_MD_CLOCK_INTERRUPT(void);
|
||||
PR_EXTERN(void) _PR_MD_INIT_STACK(PRThreadStack *ts, PRIntn redzone);
|
||||
PR_EXTERN(void) _PR_MD_CLEAR_STACK(PRThreadStack* ts);
|
||||
PR_EXTERN(PRInt32) _PR_MD_GET_INTSOFF(void);
|
||||
PR_EXTERN(void) _PR_MD_SET_INTSOFF(PRInt32 _val);
|
||||
PR_EXTERN(_PRCPU*) _PR_MD_CURRENT_CPU(void);
|
||||
PR_EXTERN(void) _PR_MD_SET_CURRENT_CPU(_PRCPU *cpu);
|
||||
PR_EXTERN(void) _PR_MD_INIT_RUNNING_CPU(_PRCPU *cpu);
|
||||
PR_EXTERN(PRInt32) _PR_MD_PAUSE_CPU(PRIntervalTime timeout);
|
|
@ -1,232 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "primpl.h"
|
||||
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
#include <memory.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <errno.h>
|
||||
|
||||
/*
|
||||
* Make sure _PRSockLen_t is 32-bit, because we will cast a PRUint32* or
|
||||
* PRInt32* pointer to a _PRSockLen_t* pointer.
|
||||
*/
|
||||
#define _PRSockLen_t int
|
||||
|
||||
/*
|
||||
** Global lock variable used to bracket calls into rusty libraries that
|
||||
** aren't thread safe (like libc, libX, etc).
|
||||
*/
|
||||
static PRLock *_pr_rename_lock = NULL;
|
||||
static PRMonitor *_pr_Xfe_mon = NULL;
|
||||
|
||||
/*
|
||||
* Variables used by the GC code, initialized in _MD_InitSegs().
|
||||
* _pr_zero_fd should be a static variable. Unfortunately, there is
|
||||
* still some Unix-specific code left in function PR_GrowSegment()
|
||||
* in file memory/prseg.c that references it, so it needs
|
||||
* to be a global variable for now.
|
||||
*/
|
||||
PRInt32 _pr_zero_fd = -1;
|
||||
static PRLock *_pr_md_lock = NULL;
|
||||
|
||||
sigset_t timer_set;
|
||||
|
||||
void _PR_UnixInit()
|
||||
{
|
||||
struct sigaction sigact;
|
||||
int rv;
|
||||
|
||||
sigemptyset(&timer_set);
|
||||
|
||||
sigact.sa_handler = SIG_IGN;
|
||||
sigemptyset(&sigact.sa_mask);
|
||||
sigact.sa_flags = 0;
|
||||
rv = sigaction(SIGPIPE, &sigact, 0);
|
||||
PR_ASSERT(0 == rv);
|
||||
|
||||
_pr_rename_lock = PR_NewLock();
|
||||
PR_ASSERT(NULL != _pr_rename_lock);
|
||||
_pr_Xfe_mon = PR_NewMonitor();
|
||||
PR_ASSERT(NULL != _pr_Xfe_mon);
|
||||
}
|
||||
|
||||
/*
|
||||
*-----------------------------------------------------------------------
|
||||
*
|
||||
* PR_Now --
|
||||
*
|
||||
* Returns the current time in microseconds since the epoch.
|
||||
* The epoch is midnight January 1, 1970 GMT.
|
||||
* The implementation is machine dependent. This is the Unix
|
||||
* implementation.
|
||||
* Cf. time_t time(time_t *tp)
|
||||
*
|
||||
*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
PR_IMPLEMENT(PRTime)
|
||||
PR_Now(void)
|
||||
{
|
||||
struct timeval tv;
|
||||
PRInt64 s, us, s2us;
|
||||
|
||||
GETTIMEOFDAY(&tv);
|
||||
LL_I2L(s2us, PR_USEC_PER_SEC);
|
||||
LL_I2L(s, tv.tv_sec);
|
||||
LL_I2L(us, tv.tv_usec);
|
||||
LL_MUL(s, s, s2us);
|
||||
LL_ADD(s, s, us);
|
||||
return s;
|
||||
}
|
||||
|
||||
PRIntervalTime
|
||||
_PR_UNIX_GetInterval()
|
||||
{
|
||||
struct timeval time;
|
||||
PRIntervalTime ticks;
|
||||
|
||||
(void)GETTIMEOFDAY(&time); /* fallicy of course */
|
||||
ticks = (PRUint32)time.tv_sec * PR_MSEC_PER_SEC; /* that's in milliseconds */
|
||||
ticks += (PRUint32)time.tv_usec / PR_USEC_PER_MSEC; /* so's that */
|
||||
return ticks;
|
||||
} /* _PR_SUNOS_GetInterval */
|
||||
|
||||
PRIntervalTime _PR_UNIX_TicksPerSecond()
|
||||
{
|
||||
return 1000; /* this needs some work :) */
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
/*
|
||||
** Special hacks for xlib. Xlib/Xt/Xm is not re-entrant nor is it thread
|
||||
** safe. Unfortunately, neither is mozilla. To make these programs work
|
||||
** in a pre-emptive threaded environment, we need to use a lock.
|
||||
*/
|
||||
|
||||
void PR_XLock()
|
||||
{
|
||||
PR_EnterMonitor(_pr_Xfe_mon);
|
||||
}
|
||||
|
||||
void PR_XUnlock()
|
||||
{
|
||||
PR_ExitMonitor(_pr_Xfe_mon);
|
||||
}
|
||||
|
||||
PRBool PR_XIsLocked()
|
||||
{
|
||||
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(BEOS)
|
||||
#ifdef HAVE_BSD_FLOCK
|
||||
|
||||
#include <sys/file.h>
|
||||
|
||||
PR_IMPLEMENT(PRStatus)
|
||||
_MD_LOCKFILE (PRInt32 f)
|
||||
{
|
||||
PRInt32 rv;
|
||||
rv = flock(f, LOCK_EX);
|
||||
if (rv == 0)
|
||||
return PR_SUCCESS;
|
||||
_PR_MD_MAP_FLOCK_ERROR(_MD_ERRNO());
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PRStatus)
|
||||
_MD_TLOCKFILE (PRInt32 f)
|
||||
{
|
||||
PRInt32 rv;
|
||||
rv = flock(f, LOCK_EX|LOCK_NB);
|
||||
if (rv == 0)
|
||||
return PR_SUCCESS;
|
||||
_PR_MD_MAP_FLOCK_ERROR(_MD_ERRNO());
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PRStatus)
|
||||
_MD_UNLOCKFILE (PRInt32 f)
|
||||
{
|
||||
PRInt32 rv;
|
||||
rv = flock(f, LOCK_UN);
|
||||
if (rv == 0)
|
||||
return PR_SUCCESS;
|
||||
_PR_MD_MAP_FLOCK_ERROR(_MD_ERRNO());
|
||||
return PR_FAILURE;
|
||||
}
|
||||
#else
|
||||
|
||||
PR_IMPLEMENT(PRStatus)
|
||||
_MD_LOCKFILE (PRInt32 f)
|
||||
{
|
||||
PRInt32 rv;
|
||||
rv = lockf(f, F_LOCK, 0);
|
||||
if (rv == 0)
|
||||
return PR_SUCCESS;
|
||||
_PR_MD_MAP_LOCKF_ERROR(_MD_ERRNO());
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PRStatus)
|
||||
_MD_TLOCKFILE (PRInt32 f)
|
||||
{
|
||||
PRInt32 rv;
|
||||
rv = lockf(f, F_TLOCK, 0);
|
||||
if (rv == 0)
|
||||
return PR_SUCCESS;
|
||||
_PR_MD_MAP_LOCKF_ERROR(_MD_ERRNO());
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PRStatus)
|
||||
_MD_UNLOCKFILE (PRInt32 f)
|
||||
{
|
||||
PRInt32 rv;
|
||||
rv = lockf(f, F_ULOCK, 0);
|
||||
if (rv == 0)
|
||||
return PR_SUCCESS;
|
||||
_PR_MD_MAP_LOCKF_ERROR(_MD_ERRNO());
|
||||
return PR_FAILURE;
|
||||
}
|
||||
#endif
|
||||
|
||||
PR_IMPLEMENT(PRStatus)
|
||||
_MD_GETHOSTNAME (char *name, PRUint32 namelen)
|
||||
{
|
||||
PRIntn rv;
|
||||
|
||||
rv = gethostname(name, namelen);
|
||||
if (0 == rv) {
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
_PR_MD_MAP_GETHOSTNAME_ERROR(_MD_ERRNO());
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
#endif
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,873 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; c-basic-offset: 8 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "primpl.h"
|
||||
|
||||
/*
|
||||
** Global lock variable used to bracket calls into rusty libraries that
|
||||
** aren't thread safe (like libc, libX, etc).
|
||||
*/
|
||||
static PRLock *_pr_rename_lock = NULL;
|
||||
|
||||
void
|
||||
_MD_InitIO (void)
|
||||
{
|
||||
}
|
||||
|
||||
PRStatus
|
||||
_MD_open_dir (_MDDir *md,const char *name)
|
||||
{
|
||||
int err;
|
||||
|
||||
md->d = opendir(name);
|
||||
if (!md->d) {
|
||||
err = _MD_ERRNO();
|
||||
_PR_MD_MAP_OPENDIR_ERROR(err);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
char*
|
||||
_MD_read_dir (_MDDir *md, PRIntn flags)
|
||||
{
|
||||
struct dirent *de;
|
||||
int err;
|
||||
|
||||
for (;;) {
|
||||
/*
|
||||
* XXX: readdir() is not MT-safe
|
||||
*/
|
||||
_MD_ERRNO() = 0;
|
||||
de = readdir(md->d);
|
||||
|
||||
if (!de) {
|
||||
err = _MD_ERRNO();
|
||||
_PR_MD_MAP_READDIR_ERROR(err);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((flags & PR_SKIP_DOT) &&
|
||||
(de->d_name[0] == '.') && (de->d_name[1] == 0))
|
||||
continue;
|
||||
|
||||
if ((flags & PR_SKIP_DOT_DOT) &&
|
||||
(de->d_name[0] == '.') && (de->d_name[1] == '.') &&
|
||||
(de->d_name[2] == 0))
|
||||
continue;
|
||||
|
||||
if ((flags & PR_SKIP_HIDDEN) && (de->d_name[1] == '.'))
|
||||
continue;
|
||||
|
||||
break;
|
||||
}
|
||||
return de->d_name;
|
||||
}
|
||||
|
||||
|
||||
PRInt32
|
||||
_MD_close_dir (_MDDir *md)
|
||||
{
|
||||
int rv = 0, err;
|
||||
|
||||
if (md->d) {
|
||||
rv = closedir(md->d);
|
||||
if (rv == -1) {
|
||||
err = _MD_ERRNO();
|
||||
_PR_MD_MAP_CLOSEDIR_ERROR(err);
|
||||
}
|
||||
}
|
||||
return(rv);
|
||||
}
|
||||
|
||||
void
|
||||
_MD_make_nonblock (PRFileDesc *fd)
|
||||
{
|
||||
int blocking = 1;
|
||||
setsockopt(fd->secret->md.osfd, SOL_SOCKET, SO_NONBLOCK, &blocking, sizeof(blocking));
|
||||
|
||||
}
|
||||
|
||||
PRStatus
|
||||
_MD_set_fd_inheritable (PRFileDesc *fd, PRBool inheritable)
|
||||
{
|
||||
int rv;
|
||||
|
||||
rv = fcntl(fd->secret->md.osfd, F_SETFD, inheritable ? 0 : FD_CLOEXEC);
|
||||
if (-1 == rv) {
|
||||
PR_SetError(PR_UNKNOWN_ERROR, _MD_ERRNO());
|
||||
return PR_FAILURE;
|
||||
}
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
void
|
||||
_MD_init_fd_inheritable (PRFileDesc *fd, PRBool imported)
|
||||
{
|
||||
if (imported) {
|
||||
fd->secret->inheritable = _PR_TRI_UNKNOWN;
|
||||
} else {
|
||||
int flags = fcntl(fd->secret->md.osfd, F_GETFD, 0);
|
||||
if (flags == -1) {
|
||||
PR_SetError(PR_UNKNOWN_ERROR, _MD_ERRNO());
|
||||
return;
|
||||
}
|
||||
fd->secret->inheritable = (flags & FD_CLOEXEC) ?
|
||||
_PR_TRI_TRUE : _PR_TRI_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_MD_query_fd_inheritable (PRFileDesc *fd)
|
||||
{
|
||||
int flags;
|
||||
|
||||
PR_ASSERT(_PR_TRI_UNKNOWN == fd->secret->inheritable);
|
||||
flags = fcntl(fd->secret->md.osfd, F_GETFD, 0);
|
||||
PR_ASSERT(-1 != flags);
|
||||
fd->secret->inheritable = (flags & FD_CLOEXEC) ?
|
||||
_PR_TRI_FALSE : _PR_TRI_TRUE;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
_MD_open (const char *name, PRIntn flags, PRIntn mode)
|
||||
{
|
||||
PRInt32 osflags;
|
||||
PRInt32 rv, err;
|
||||
|
||||
if (flags & PR_RDWR) {
|
||||
osflags = O_RDWR;
|
||||
} else if (flags & PR_WRONLY) {
|
||||
osflags = O_WRONLY;
|
||||
} else {
|
||||
osflags = O_RDONLY;
|
||||
}
|
||||
|
||||
if (flags & PR_EXCL)
|
||||
osflags |= O_EXCL;
|
||||
if (flags & PR_APPEND)
|
||||
osflags |= O_APPEND;
|
||||
if (flags & PR_TRUNCATE)
|
||||
osflags |= O_TRUNC;
|
||||
if (flags & PR_SYNC) {
|
||||
/* Ummmm. BeOS doesn't appear to
|
||||
support sync in any way shape or
|
||||
form. */
|
||||
return PR_NOT_IMPLEMENTED_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
** On creations we hold the 'create' lock in order to enforce
|
||||
** the semantics of PR_Rename. (see the latter for more details)
|
||||
*/
|
||||
if (flags & PR_CREATE_FILE)
|
||||
{
|
||||
osflags |= O_CREAT ;
|
||||
if (NULL !=_pr_rename_lock)
|
||||
PR_Lock(_pr_rename_lock);
|
||||
}
|
||||
|
||||
rv = open(name, osflags, mode);
|
||||
|
||||
if (rv < 0) {
|
||||
err = _MD_ERRNO();
|
||||
_PR_MD_MAP_OPEN_ERROR(err);
|
||||
}
|
||||
|
||||
if ((flags & PR_CREATE_FILE) && (NULL !=_pr_rename_lock))
|
||||
PR_Unlock(_pr_rename_lock);
|
||||
return rv;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
_MD_close_file (PRInt32 osfd)
|
||||
{
|
||||
PRInt32 rv, err;
|
||||
|
||||
rv = close(osfd);
|
||||
if (rv == -1) {
|
||||
err = _MD_ERRNO();
|
||||
_PR_MD_MAP_CLOSE_ERROR(err);
|
||||
}
|
||||
return(rv);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
_MD_read (PRFileDesc *fd, void *buf, PRInt32 amount)
|
||||
{
|
||||
PRInt32 rv, err;
|
||||
PRInt32 osfd = fd->secret->md.osfd;
|
||||
|
||||
rv = read( osfd, buf, amount );
|
||||
if (rv < 0) {
|
||||
err = _MD_ERRNO();
|
||||
_PR_MD_MAP_READ_ERROR(err);
|
||||
}
|
||||
return(rv);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
_MD_write (PRFileDesc *fd, const void *buf, PRInt32 amount)
|
||||
{
|
||||
PRInt32 rv, err;
|
||||
PRInt32 osfd = fd->secret->md.osfd;
|
||||
|
||||
rv = write( osfd, buf, amount );
|
||||
|
||||
if( rv < 0 ) {
|
||||
|
||||
err = _MD_ERRNO();
|
||||
_PR_MD_MAP_WRITE_ERROR(err);
|
||||
}
|
||||
return( rv );
|
||||
}
|
||||
|
||||
#ifndef BONE_VERSION /* Writev moves to bnet.c with BONE */
|
||||
PRInt32
|
||||
_MD_writev (PRFileDesc *fd, const PRIOVec *iov, PRInt32 iov_size,
|
||||
PRIntervalTime timeout)
|
||||
{
|
||||
return PR_NOT_IMPLEMENTED_ERROR;
|
||||
}
|
||||
#endif
|
||||
|
||||
PRInt32
|
||||
_MD_lseek (PRFileDesc *fd, PRInt32 offset, int whence)
|
||||
{
|
||||
PRInt32 rv, err;
|
||||
|
||||
rv = lseek (fd->secret->md.osfd, offset, whence);
|
||||
if (rv == -1) {
|
||||
err = _MD_ERRNO();
|
||||
_PR_MD_MAP_LSEEK_ERROR(err);
|
||||
}
|
||||
return( rv );
|
||||
}
|
||||
|
||||
PRInt64
|
||||
_MD_lseek64 (PRFileDesc *fd, PRInt64 offset, int whence)
|
||||
{
|
||||
PRInt32 rv, err;
|
||||
|
||||
/* According to the BeOS headers, lseek accepts a
|
||||
* variable of type off_t for the offset, and off_t
|
||||
* is defined to be a 64-bit value. So no special
|
||||
* cracking needs to be done on "offset".
|
||||
*/
|
||||
|
||||
rv = lseek (fd->secret->md.osfd, offset, whence);
|
||||
if (rv == -1) {
|
||||
err = _MD_ERRNO();
|
||||
_PR_MD_MAP_LSEEK_ERROR(err);
|
||||
}
|
||||
return( rv );
|
||||
}
|
||||
|
||||
PRInt32
|
||||
_MD_fsync (PRFileDesc *fd)
|
||||
{
|
||||
PRInt32 rv, err;
|
||||
|
||||
rv = fsync(fd->secret->md.osfd);
|
||||
if (rv == -1) {
|
||||
err = _MD_ERRNO();
|
||||
_PR_MD_MAP_FSYNC_ERROR(err);
|
||||
}
|
||||
return(rv);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
_MD_delete (const char *name)
|
||||
{
|
||||
PRInt32 rv, err;
|
||||
|
||||
rv = unlink(name);
|
||||
if (rv == -1)
|
||||
{
|
||||
err = _MD_ERRNO();
|
||||
_PR_MD_MAP_UNLINK_ERROR(err);
|
||||
}
|
||||
return (rv);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
_MD_getfileinfo (const char *fn, PRFileInfo *info)
|
||||
{
|
||||
struct stat sb;
|
||||
PRInt32 rv, err;
|
||||
PRInt64 s, s2us;
|
||||
|
||||
rv = stat(fn, &sb);
|
||||
if (rv < 0) {
|
||||
err = _MD_ERRNO();
|
||||
_PR_MD_MAP_STAT_ERROR(err);
|
||||
} else if (info) {
|
||||
if (S_IFREG & sb.st_mode)
|
||||
info->type = PR_FILE_FILE;
|
||||
else if (S_IFDIR & sb.st_mode)
|
||||
info->type = PR_FILE_DIRECTORY;
|
||||
else
|
||||
info->type = PR_FILE_OTHER;
|
||||
|
||||
/* Must truncate file size for the 32 bit
|
||||
version */
|
||||
info->size = (sb.st_size & 0xffffffff);
|
||||
LL_I2L(s, sb.st_mtime);
|
||||
LL_I2L(s2us, PR_USEC_PER_SEC);
|
||||
LL_MUL(s, s, s2us);
|
||||
info->modifyTime = s;
|
||||
LL_I2L(s, sb.st_ctime);
|
||||
LL_MUL(s, s, s2us);
|
||||
info->creationTime = s;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
_MD_getfileinfo64 (const char *fn, PRFileInfo64 *info)
|
||||
{
|
||||
struct stat sb;
|
||||
PRInt32 rv, err;
|
||||
PRInt64 s, s2us;
|
||||
|
||||
rv = stat(fn, &sb);
|
||||
if (rv < 0) {
|
||||
err = _MD_ERRNO();
|
||||
_PR_MD_MAP_STAT_ERROR(err);
|
||||
} else if (info) {
|
||||
if (S_IFREG & sb.st_mode)
|
||||
info->type = PR_FILE_FILE;
|
||||
else if (S_IFDIR & sb.st_mode)
|
||||
info->type = PR_FILE_DIRECTORY;
|
||||
else
|
||||
info->type = PR_FILE_OTHER;
|
||||
|
||||
/* For the 64 bit version we can use
|
||||
* the native st_size without modification
|
||||
*/
|
||||
info->size = sb.st_size;
|
||||
LL_I2L(s, sb.st_mtime);
|
||||
LL_I2L(s2us, PR_USEC_PER_SEC);
|
||||
LL_MUL(s, s, s2us);
|
||||
info->modifyTime = s;
|
||||
LL_I2L(s, sb.st_ctime);
|
||||
LL_MUL(s, s, s2us);
|
||||
info->creationTime = s;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
_MD_getopenfileinfo (const PRFileDesc *fd, PRFileInfo *info)
|
||||
{
|
||||
struct stat sb;
|
||||
PRInt64 s, s2us;
|
||||
PRInt32 rv, err;
|
||||
|
||||
rv = fstat(fd->secret->md.osfd, &sb);
|
||||
if (rv < 0) {
|
||||
err = _MD_ERRNO();
|
||||
_PR_MD_MAP_FSTAT_ERROR(err);
|
||||
} else if (info) {
|
||||
if (info) {
|
||||
if (S_IFREG & sb.st_mode)
|
||||
info->type = PR_FILE_FILE ;
|
||||
else if (S_IFDIR & sb.st_mode)
|
||||
info->type = PR_FILE_DIRECTORY;
|
||||
else
|
||||
info->type = PR_FILE_OTHER;
|
||||
/* Use lower 32 bits of file size */
|
||||
info->size = ( sb.st_size & 0xffffffff);
|
||||
LL_I2L(s, sb.st_mtime);
|
||||
LL_I2L(s2us, PR_USEC_PER_SEC);
|
||||
LL_MUL(s, s, s2us);
|
||||
info->modifyTime = s;
|
||||
LL_I2L(s, sb.st_ctime);
|
||||
LL_MUL(s, s, s2us);
|
||||
info->creationTime = s;
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
_MD_getopenfileinfo64 (const PRFileDesc *fd, PRFileInfo64 *info)
|
||||
{
|
||||
struct stat sb;
|
||||
PRInt64 s, s2us;
|
||||
PRInt32 rv, err;
|
||||
|
||||
rv = fstat(fd->secret->md.osfd, &sb);
|
||||
if (rv < 0) {
|
||||
err = _MD_ERRNO();
|
||||
_PR_MD_MAP_FSTAT_ERROR(err);
|
||||
} else if (info) {
|
||||
if (info) {
|
||||
if (S_IFREG & sb.st_mode)
|
||||
info->type = PR_FILE_FILE ;
|
||||
else if (S_IFDIR & sb.st_mode)
|
||||
info->type = PR_FILE_DIRECTORY;
|
||||
else
|
||||
info->type = PR_FILE_OTHER;
|
||||
info->size = sb.st_size;
|
||||
LL_I2L(s, sb.st_mtime);
|
||||
LL_I2L(s2us, PR_USEC_PER_SEC);
|
||||
LL_MUL(s, s, s2us);
|
||||
info->modifyTime = s;
|
||||
LL_I2L(s, sb.st_ctime);
|
||||
LL_MUL(s, s, s2us);
|
||||
info->creationTime = s;
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
_MD_rename (const char *from, const char *to)
|
||||
{
|
||||
PRInt32 rv = -1, err;
|
||||
|
||||
/*
|
||||
** This is trying to enforce the semantics of WINDOZE' rename
|
||||
** operation. That means one is not allowed to rename over top
|
||||
** of an existing file. Holding a lock across these two function
|
||||
** and the open function is known to be a bad idea, but ....
|
||||
*/
|
||||
if (NULL != _pr_rename_lock)
|
||||
PR_Lock(_pr_rename_lock);
|
||||
if (0 == access(to, F_OK))
|
||||
PR_SetError(PR_FILE_EXISTS_ERROR, 0);
|
||||
else
|
||||
{
|
||||
rv = rename(from, to);
|
||||
if (rv < 0) {
|
||||
err = _MD_ERRNO();
|
||||
_PR_MD_MAP_RENAME_ERROR(err);
|
||||
}
|
||||
}
|
||||
if (NULL != _pr_rename_lock)
|
||||
PR_Unlock(_pr_rename_lock);
|
||||
return rv;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
_MD_access (const char *name, PRIntn how)
|
||||
{
|
||||
PRInt32 rv, err;
|
||||
int checkFlags;
|
||||
struct stat buf;
|
||||
|
||||
switch (how) {
|
||||
case PR_ACCESS_WRITE_OK:
|
||||
checkFlags = S_IWUSR | S_IWGRP | S_IWOTH;
|
||||
break;
|
||||
|
||||
case PR_ACCESS_READ_OK:
|
||||
checkFlags = S_IRUSR | S_IRGRP | S_IROTH;
|
||||
break;
|
||||
|
||||
case PR_ACCESS_EXISTS:
|
||||
/* we don't need to examine st_mode. */
|
||||
break;
|
||||
|
||||
default:
|
||||
PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
rv = stat(name, &buf);
|
||||
if (rv == 0 && how != PR_ACCESS_EXISTS && (!(buf.st_mode & checkFlags))) {
|
||||
PR_SetError(PR_NO_ACCESS_RIGHTS_ERROR, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (rv < 0) {
|
||||
err = _MD_ERRNO();
|
||||
_PR_MD_MAP_STAT_ERROR(err);
|
||||
}
|
||||
|
||||
return(rv);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
_MD_stat (const char *name, struct stat *buf)
|
||||
{
|
||||
return PR_NOT_IMPLEMENTED_ERROR;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
_MD_mkdir (const char *name, PRIntn mode)
|
||||
{
|
||||
status_t rv;
|
||||
int err;
|
||||
|
||||
/*
|
||||
** This lock is used to enforce rename semantics as described
|
||||
** in PR_Rename. Look there for more fun details.
|
||||
*/
|
||||
if (NULL !=_pr_rename_lock)
|
||||
PR_Lock(_pr_rename_lock);
|
||||
|
||||
rv = mkdir(name, mode);
|
||||
if (rv < 0) {
|
||||
err = _MD_ERRNO();
|
||||
_PR_MD_MAP_MKDIR_ERROR(err);
|
||||
}
|
||||
if (NULL !=_pr_rename_lock)
|
||||
PR_Unlock(_pr_rename_lock);
|
||||
return rv;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
_MD_rmdir (const char *name)
|
||||
{
|
||||
int rv, err;
|
||||
|
||||
rv = rmdir(name);
|
||||
if (rv == -1) {
|
||||
err = _MD_ERRNO();
|
||||
_PR_MD_MAP_RMDIR_ERROR(err);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
_MD_pr_poll(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout)
|
||||
{
|
||||
PRInt32 rv = 0;
|
||||
PRThread *me = _PR_MD_CURRENT_THREAD();
|
||||
/*
|
||||
* This code is almost a duplicate of w32poll.c's _PR_MD_PR_POLL().
|
||||
*/
|
||||
fd_set rd, wt, ex;
|
||||
PRFileDesc *bottom;
|
||||
PRPollDesc *pd, *epd;
|
||||
PRInt32 maxfd = -1, ready, err;
|
||||
PRIntervalTime remaining, elapsed, start;
|
||||
|
||||
struct timeval tv, *tvp = NULL;
|
||||
|
||||
if (_PR_PENDING_INTERRUPT(me))
|
||||
{
|
||||
me->flags &= ~_PR_INTERRUPT;
|
||||
PR_SetError(PR_PENDING_INTERRUPT_ERROR, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (0 == npds) {
|
||||
PR_Sleep(timeout);
|
||||
return rv;
|
||||
}
|
||||
|
||||
FD_ZERO(&rd);
|
||||
FD_ZERO(&wt);
|
||||
FD_ZERO(&ex);
|
||||
|
||||
ready = 0;
|
||||
for (pd = pds, epd = pd + npds; pd < epd; pd++)
|
||||
{
|
||||
PRInt16 in_flags_read = 0, in_flags_write = 0;
|
||||
PRInt16 out_flags_read = 0, out_flags_write = 0;
|
||||
|
||||
if ((NULL != pd->fd) && (0 != pd->in_flags))
|
||||
{
|
||||
if (pd->in_flags & PR_POLL_READ)
|
||||
{
|
||||
in_flags_read = (pd->fd->methods->poll)(pd->fd, pd->in_flags & ~PR_POLL_WRITE, &out_flags_read);
|
||||
}
|
||||
if (pd->in_flags & PR_POLL_WRITE)
|
||||
{
|
||||
in_flags_write = (pd->fd->methods->poll)(pd->fd, pd->in_flags & ~PR_POLL_READ, &out_flags_write);
|
||||
}
|
||||
if ((0 != (in_flags_read & out_flags_read))
|
||||
|| (0 != (in_flags_write & out_flags_write)))
|
||||
{
|
||||
/* this one's ready right now */
|
||||
if (0 == ready)
|
||||
{
|
||||
/*
|
||||
* We will have to return without calling the
|
||||
* system poll/select function. So zero the
|
||||
* out_flags fields of all the poll descriptors
|
||||
* before this one.
|
||||
*/
|
||||
PRPollDesc *prev;
|
||||
for (prev = pds; prev < pd; prev++)
|
||||
{
|
||||
prev->out_flags = 0;
|
||||
}
|
||||
}
|
||||
ready += 1;
|
||||
pd->out_flags = out_flags_read | out_flags_write;
|
||||
}
|
||||
else
|
||||
{
|
||||
pd->out_flags = 0; /* pre-condition */
|
||||
|
||||
/* make sure this is an NSPR supported stack */
|
||||
bottom = PR_GetIdentitiesLayer(pd->fd, PR_NSPR_IO_LAYER);
|
||||
PR_ASSERT(NULL != bottom); /* what to do about that? */
|
||||
if ((NULL != bottom)
|
||||
&& (_PR_FILEDESC_OPEN == bottom->secret->state))
|
||||
{
|
||||
if (0 == ready)
|
||||
{
|
||||
PRInt32 osfd = bottom->secret->md.osfd;
|
||||
if (osfd > maxfd) maxfd = osfd;
|
||||
if (in_flags_read & PR_POLL_READ)
|
||||
{
|
||||
pd->out_flags |= _PR_POLL_READ_SYS_READ;
|
||||
FD_SET(osfd, &rd);
|
||||
}
|
||||
if (in_flags_read & PR_POLL_WRITE)
|
||||
{
|
||||
pd->out_flags |= _PR_POLL_READ_SYS_WRITE;
|
||||
FD_SET(osfd, &wt);
|
||||
}
|
||||
if (in_flags_write & PR_POLL_READ)
|
||||
{
|
||||
pd->out_flags |= _PR_POLL_WRITE_SYS_READ;
|
||||
FD_SET(osfd, &rd);
|
||||
}
|
||||
if (in_flags_write & PR_POLL_WRITE)
|
||||
{
|
||||
pd->out_flags |= _PR_POLL_WRITE_SYS_WRITE;
|
||||
FD_SET(osfd, &wt);
|
||||
}
|
||||
if (pd->in_flags & PR_POLL_EXCEPT) FD_SET(osfd, &ex);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (0 == ready)
|
||||
{
|
||||
PRPollDesc *prev;
|
||||
for (prev = pds; prev < pd; prev++)
|
||||
{
|
||||
prev->out_flags = 0;
|
||||
}
|
||||
}
|
||||
ready += 1; /* this will cause an abrupt return */
|
||||
pd->out_flags = PR_POLL_NVAL; /* bogii */
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pd->out_flags = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (0 != ready) return ready; /* no need to block */
|
||||
|
||||
remaining = timeout;
|
||||
start = PR_IntervalNow();
|
||||
|
||||
retry:
|
||||
if (timeout != PR_INTERVAL_NO_TIMEOUT)
|
||||
{
|
||||
PRInt32 ticksPerSecond = PR_TicksPerSecond();
|
||||
tv.tv_sec = remaining / ticksPerSecond;
|
||||
tv.tv_usec = PR_IntervalToMicroseconds( remaining % ticksPerSecond );
|
||||
tvp = &tv;
|
||||
}
|
||||
|
||||
ready = _MD_SELECT(maxfd + 1, &rd, &wt, &ex, tvp);
|
||||
|
||||
if (ready == -1 && errno == EINTR)
|
||||
{
|
||||
if (timeout == PR_INTERVAL_NO_TIMEOUT) goto retry;
|
||||
else
|
||||
{
|
||||
elapsed = (PRIntervalTime) (PR_IntervalNow() - start);
|
||||
if (elapsed > timeout) ready = 0; /* timed out */
|
||||
else
|
||||
{
|
||||
remaining = timeout - elapsed;
|
||||
goto retry;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Now to unravel the select sets back into the client's poll
|
||||
** descriptor list. Is this possibly an area for pissing away
|
||||
** a few cycles or what?
|
||||
*/
|
||||
if (ready > 0)
|
||||
{
|
||||
ready = 0;
|
||||
for (pd = pds, epd = pd + npds; pd < epd; pd++)
|
||||
{
|
||||
PRInt16 out_flags = 0;
|
||||
if ((NULL != pd->fd) && (0 != pd->in_flags))
|
||||
{
|
||||
PRInt32 osfd;
|
||||
bottom = PR_GetIdentitiesLayer(pd->fd, PR_NSPR_IO_LAYER);
|
||||
PR_ASSERT(NULL != bottom);
|
||||
|
||||
osfd = bottom->secret->md.osfd;
|
||||
|
||||
if (FD_ISSET(osfd, &rd))
|
||||
{
|
||||
if (pd->out_flags & _PR_POLL_READ_SYS_READ)
|
||||
out_flags |= PR_POLL_READ;
|
||||
if (pd->out_flags & _PR_POLL_WRITE_SYS_READ)
|
||||
out_flags |= PR_POLL_WRITE;
|
||||
}
|
||||
if (FD_ISSET(osfd, &wt))
|
||||
{
|
||||
if (pd->out_flags & _PR_POLL_READ_SYS_WRITE)
|
||||
out_flags |= PR_POLL_READ;
|
||||
if (pd->out_flags & _PR_POLL_WRITE_SYS_WRITE)
|
||||
out_flags |= PR_POLL_WRITE;
|
||||
}
|
||||
if (FD_ISSET(osfd, &ex)) out_flags |= PR_POLL_EXCEPT;
|
||||
|
||||
/* Workaround for nonblocking connects under net_server */
|
||||
#ifndef BONE_VERSION
|
||||
if (out_flags)
|
||||
{
|
||||
/* check if it is a pending connect */
|
||||
int i = 0, j = 0;
|
||||
PR_Lock( _connectLock );
|
||||
for( i = 0; i < connectCount; i++ )
|
||||
{
|
||||
if(connectList[i].osfd == osfd)
|
||||
{
|
||||
int connectError;
|
||||
int connectResult;
|
||||
|
||||
connectResult = connect(connectList[i].osfd,
|
||||
&connectList[i].addr,
|
||||
connectList[i].addrlen);
|
||||
connectError = errno;
|
||||
|
||||
if(connectResult < 0 )
|
||||
{
|
||||
if(connectError == EINTR || connectError == EWOULDBLOCK ||
|
||||
connectError == EINPROGRESS || connectError == EALREADY)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(i == (connectCount - 1))
|
||||
{
|
||||
connectList[i].osfd = -1;
|
||||
} else {
|
||||
for(j = i; j < connectCount; j++ )
|
||||
{
|
||||
memcpy( &connectList[j], &connectList[j+1],
|
||||
sizeof(connectList[j]));
|
||||
}
|
||||
}
|
||||
connectCount--;
|
||||
|
||||
bottom->secret->md.connectReturnValue = connectResult;
|
||||
bottom->secret->md.connectReturnError = connectError;
|
||||
bottom->secret->md.connectValueValid = PR_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
PR_Unlock( _connectLock );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
pd->out_flags = out_flags;
|
||||
if (out_flags) ready++;
|
||||
}
|
||||
PR_ASSERT(ready > 0);
|
||||
}
|
||||
else if (ready < 0)
|
||||
{
|
||||
err = _MD_ERRNO();
|
||||
if (err == EBADF)
|
||||
{
|
||||
/* Find the bad fds */
|
||||
ready = 0;
|
||||
for (pd = pds, epd = pd + npds; pd < epd; pd++)
|
||||
{
|
||||
pd->out_flags = 0;
|
||||
if ((NULL != pd->fd) && (0 != pd->in_flags))
|
||||
{
|
||||
bottom = PR_GetIdentitiesLayer(pd->fd, PR_NSPR_IO_LAYER);
|
||||
if (fcntl(bottom->secret->md.osfd, F_GETFL, 0) == -1)
|
||||
{
|
||||
pd->out_flags = PR_POLL_NVAL;
|
||||
ready++;
|
||||
}
|
||||
}
|
||||
}
|
||||
PR_ASSERT(ready > 0);
|
||||
}
|
||||
else _PR_MD_MAP_SELECT_ERROR(err);
|
||||
}
|
||||
|
||||
return ready;
|
||||
} /* _MD_pr_poll */
|
||||
|
||||
/*
|
||||
* File locking.
|
||||
*/
|
||||
|
||||
PRStatus
|
||||
_MD_lockfile (PRInt32 osfd)
|
||||
{
|
||||
PRInt32 rv;
|
||||
struct flock linfo;
|
||||
|
||||
linfo.l_type =
|
||||
linfo.l_whence = SEEK_SET;
|
||||
linfo.l_start = 0;
|
||||
linfo.l_len = 0;
|
||||
|
||||
rv = fcntl(osfd, F_SETLKW, &linfo);
|
||||
if (rv == 0)
|
||||
return PR_SUCCESS;
|
||||
|
||||
_PR_MD_MAP_FLOCK_ERROR(_MD_ERRNO());
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
PRStatus
|
||||
_MD_tlockfile (PRInt32 osfd)
|
||||
{
|
||||
PRInt32 rv;
|
||||
struct flock linfo;
|
||||
|
||||
linfo.l_type =
|
||||
linfo.l_whence = SEEK_SET;
|
||||
linfo.l_start = 0;
|
||||
linfo.l_len = 0;
|
||||
|
||||
rv = fcntl(osfd, F_SETLK, &linfo);
|
||||
if (rv == 0)
|
||||
return PR_SUCCESS;
|
||||
|
||||
_PR_MD_MAP_FLOCK_ERROR(_MD_ERRNO());
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
PRStatus
|
||||
_MD_unlockfile (PRInt32 osfd)
|
||||
{
|
||||
PRInt32 rv;
|
||||
struct flock linfo;
|
||||
|
||||
linfo.l_type =
|
||||
linfo.l_whence = SEEK_SET;
|
||||
linfo.l_start = 0;
|
||||
linfo.l_len = 0;
|
||||
|
||||
rv = fcntl(osfd, F_UNLCK, &linfo);
|
||||
|
||||
if (rv == 0)
|
||||
return PR_SUCCESS;
|
||||
|
||||
_PR_MD_MAP_FLOCK_ERROR(_MD_ERRNO());
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
/* -*- Mode: C++; c-basic-offset: 4 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "primpl.h"
|
||||
|
||||
PR_EXTERN(void) _PR_MD_INIT_SEGS(void);
|
||||
PR_EXTERN(PRStatus) _PR_MD_ALLOC_SEGMENT(PRSegment *seg, PRUint32 size, void *vaddr);
|
||||
PR_EXTERN(void) _PR_MD_FREE_SEGMENT(PRSegment *seg);
|
|
@ -1,91 +0,0 @@
|
|||
/* -*- Mode: C++; c-basic-offset: 4 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "primpl.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
PRLock *_connectLock = NULL;
|
||||
|
||||
#ifndef BONE_VERSION
|
||||
/* Workaround for nonblocking connects under net_server */
|
||||
PRUint32 connectCount = 0;
|
||||
ConnectListNode connectList[64];
|
||||
#endif
|
||||
|
||||
void
|
||||
_MD_cleanup_before_exit (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
_MD_exit (PRIntn status)
|
||||
{
|
||||
exit(status);
|
||||
}
|
||||
|
||||
void
|
||||
_MD_early_init (void)
|
||||
{
|
||||
}
|
||||
|
||||
static PRLock *monitor = NULL;
|
||||
|
||||
void
|
||||
_MD_final_init (void)
|
||||
{
|
||||
_connectLock = PR_NewLock();
|
||||
PR_ASSERT(NULL != _connectLock);
|
||||
#ifndef BONE_VERSION
|
||||
/* Workaround for nonblocking connects under net_server */
|
||||
connectCount = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
_MD_AtomicInit (void)
|
||||
{
|
||||
if (monitor == NULL) {
|
||||
monitor = PR_NewLock();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** This is exceedingly messy. atomic_add returns the last value, NSPR expects the new value.
|
||||
** We just add or subtract 1 from the result. The actual memory update is atomic.
|
||||
*/
|
||||
|
||||
PRInt32
|
||||
_MD_AtomicAdd( PRInt32 *ptr, PRInt32 val )
|
||||
{
|
||||
return( ( atomic_add( (long *)ptr, val ) ) + val );
|
||||
}
|
||||
|
||||
PRInt32
|
||||
_MD_AtomicIncrement( PRInt32 *val )
|
||||
{
|
||||
return( ( atomic_add( (long *)val, 1 ) ) + 1 );
|
||||
}
|
||||
|
||||
PRInt32
|
||||
_MD_AtomicDecrement( PRInt32 *val )
|
||||
{
|
||||
return( ( atomic_add( (long *)val, -1 ) ) - 1 );
|
||||
}
|
||||
|
||||
PRInt32
|
||||
_MD_AtomicSet( PRInt32 *val, PRInt32 newval )
|
||||
{
|
||||
PRInt32 rv;
|
||||
|
||||
if (!_pr_initialized) {
|
||||
_PR_ImplicitInitialization();
|
||||
}
|
||||
PR_Lock(monitor);
|
||||
rv = *val;
|
||||
*val = newval;
|
||||
PR_Unlock(monitor);
|
||||
return rv;
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
/* -*- Mode: C++; c-basic-offset: 4 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "primpl.h"
|
||||
|
||||
PR_EXTERN(PRStatus)
|
||||
_PR_MD_CREATE_FILE_MAP(PRFileMap *fmap, PRInt64 size)
|
||||
{
|
||||
PR_SetError( PR_NOT_IMPLEMENTED_ERROR, 0 );
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
PR_EXTERN(PRInt32)
|
||||
_PR_MD_GET_MEM_MAP_ALIGNMENT(void)
|
||||
{
|
||||
PR_SetError( PR_NOT_IMPLEMENTED_ERROR, 0 );
|
||||
return -1;
|
||||
}
|
||||
|
||||
PR_EXTERN(void *)
|
||||
_PR_MD_MEM_MAP(PRFileMap *fmap, PRInt64 offset, PRUint32 len)
|
||||
{
|
||||
PR_SetError( PR_NOT_IMPLEMENTED_ERROR, 0 );
|
||||
return 0;
|
||||
}
|
||||
|
||||
PR_EXTERN(PRStatus)
|
||||
_PR_MD_MEM_UNMAP(void *addr, PRUint32 size)
|
||||
{
|
||||
PR_SetError( PR_NOT_IMPLEMENTED_ERROR, 0 );
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
PR_EXTERN(PRStatus)
|
||||
_PR_MD_CLOSE_FILE_MAP(PRFileMap *fmap)
|
||||
{
|
||||
PR_SetError( PR_NOT_IMPLEMENTED_ERROR, 0 );
|
||||
return PR_FAILURE;
|
||||
}
|
|
@ -1,911 +0,0 @@
|
|||
/* -*- Mode: C++; c-basic-offset: 4 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "primpl.h"
|
||||
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
#include <memory.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
/*
|
||||
* Make sure _PRSockLen_t is 32-bit, because we will cast a PRUint32* or
|
||||
* PRInt32* pointer to a _PRSockLen_t* pointer.
|
||||
*/
|
||||
#define _PRSockLen_t int
|
||||
|
||||
|
||||
/*
|
||||
** Global lock variable used to bracket calls into rusty libraries that
|
||||
** aren't thread safe (like libc, libX, etc).
|
||||
*/
|
||||
static PRLock *_pr_rename_lock = NULL;
|
||||
static PRMonitor *_pr_Xfe_mon = NULL;
|
||||
|
||||
#define READ_FD 1
|
||||
#define WRITE_FD 2
|
||||
|
||||
/*
|
||||
** This is a support routine to handle "deferred" i/o on sockets.
|
||||
** It uses "select", so it is subject to all of the BeOS limitations
|
||||
** (only READ notification, only sockets)
|
||||
*/
|
||||
|
||||
/*
|
||||
* socket_io_wait --
|
||||
*
|
||||
* wait for socket i/o, periodically checking for interrupt
|
||||
*
|
||||
*/
|
||||
|
||||
static PRInt32 socket_io_wait(PRInt32 osfd, PRInt32 fd_type,
|
||||
PRIntervalTime timeout)
|
||||
{
|
||||
PRInt32 rv = -1;
|
||||
struct timeval tv;
|
||||
PRThread *me = _PR_MD_CURRENT_THREAD();
|
||||
PRIntervalTime epoch, now, elapsed, remaining;
|
||||
PRBool wait_for_remaining;
|
||||
PRInt32 syserror;
|
||||
fd_set rd_wr;
|
||||
|
||||
switch (timeout) {
|
||||
case PR_INTERVAL_NO_WAIT:
|
||||
PR_SetError(PR_IO_TIMEOUT_ERROR, 0);
|
||||
break;
|
||||
case PR_INTERVAL_NO_TIMEOUT:
|
||||
/*
|
||||
* This is a special case of the 'default' case below.
|
||||
* Please see the comments there.
|
||||
*/
|
||||
tv.tv_sec = _PR_INTERRUPT_CHECK_INTERVAL_SECS;
|
||||
tv.tv_usec = 0;
|
||||
FD_ZERO(&rd_wr);
|
||||
do {
|
||||
FD_SET(osfd, &rd_wr);
|
||||
if (fd_type == READ_FD)
|
||||
rv = _MD_SELECT(osfd + 1, &rd_wr, NULL, NULL, &tv);
|
||||
else
|
||||
rv = _MD_SELECT(osfd + 1, NULL, &rd_wr, NULL, &tv);
|
||||
if (rv == -1 && (syserror = _MD_ERRNO()) != EINTR) {
|
||||
#ifdef BONE_VERSION
|
||||
_PR_MD_MAP_SELECT_ERROR(syserror);
|
||||
#else
|
||||
if (syserror == EBADF) {
|
||||
PR_SetError(PR_BAD_DESCRIPTOR_ERROR, EBADF);
|
||||
} else {
|
||||
PR_SetError(PR_UNKNOWN_ERROR, syserror);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
if (_PR_PENDING_INTERRUPT(me)) {
|
||||
me->flags &= ~_PR_INTERRUPT;
|
||||
PR_SetError(PR_PENDING_INTERRUPT_ERROR, 0);
|
||||
rv = -1;
|
||||
break;
|
||||
}
|
||||
} while (rv == 0 || (rv == -1 && syserror == EINTR));
|
||||
break;
|
||||
default:
|
||||
now = epoch = PR_IntervalNow();
|
||||
remaining = timeout;
|
||||
FD_ZERO(&rd_wr);
|
||||
do {
|
||||
/*
|
||||
* We block in _MD_SELECT for at most
|
||||
* _PR_INTERRUPT_CHECK_INTERVAL_SECS seconds,
|
||||
* so that there is an upper limit on the delay
|
||||
* before the interrupt bit is checked.
|
||||
*/
|
||||
wait_for_remaining = PR_TRUE;
|
||||
tv.tv_sec = PR_IntervalToSeconds(remaining);
|
||||
if (tv.tv_sec > _PR_INTERRUPT_CHECK_INTERVAL_SECS) {
|
||||
wait_for_remaining = PR_FALSE;
|
||||
tv.tv_sec = _PR_INTERRUPT_CHECK_INTERVAL_SECS;
|
||||
tv.tv_usec = 0;
|
||||
} else {
|
||||
tv.tv_usec = PR_IntervalToMicroseconds(
|
||||
remaining -
|
||||
PR_SecondsToInterval(tv.tv_sec));
|
||||
}
|
||||
FD_SET(osfd, &rd_wr);
|
||||
if (fd_type == READ_FD)
|
||||
rv = _MD_SELECT(osfd + 1, &rd_wr, NULL, NULL, &tv);
|
||||
else
|
||||
rv = _MD_SELECT(osfd + 1, NULL, &rd_wr, NULL, &tv);
|
||||
/*
|
||||
* we don't consider EINTR a real error
|
||||
*/
|
||||
if (rv == -1 && (syserror = _MD_ERRNO()) != EINTR) {
|
||||
#ifdef BONE_VERSION
|
||||
_PR_MD_MAP_SELECT_ERROR(syserror);
|
||||
#else
|
||||
if (syserror == EBADF) {
|
||||
PR_SetError(PR_BAD_DESCRIPTOR_ERROR, EBADF);
|
||||
} else {
|
||||
PR_SetError(PR_UNKNOWN_ERROR, syserror);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
if (_PR_PENDING_INTERRUPT(me)) {
|
||||
me->flags &= ~_PR_INTERRUPT;
|
||||
PR_SetError(PR_PENDING_INTERRUPT_ERROR, 0);
|
||||
rv = -1;
|
||||
break;
|
||||
}
|
||||
/*
|
||||
* We loop again if _MD_SELECT timed out or got interrupted
|
||||
* by a signal, and the timeout deadline has not passed yet.
|
||||
*/
|
||||
if (rv == 0 || (rv == -1 && syserror == EINTR)) {
|
||||
/*
|
||||
* If _MD_SELECT timed out, we know how much time
|
||||
* we spent in blocking, so we can avoid a
|
||||
* PR_IntervalNow() call.
|
||||
*/
|
||||
if (rv == 0) {
|
||||
if (wait_for_remaining) {
|
||||
now += remaining;
|
||||
} else {
|
||||
now += PR_SecondsToInterval(tv.tv_sec)
|
||||
+ PR_MicrosecondsToInterval(tv.tv_usec);
|
||||
}
|
||||
} else {
|
||||
now = PR_IntervalNow();
|
||||
}
|
||||
elapsed = (PRIntervalTime) (now - epoch);
|
||||
if (elapsed >= timeout) {
|
||||
PR_SetError(PR_IO_TIMEOUT_ERROR, 0);
|
||||
rv = -1;
|
||||
break;
|
||||
} else {
|
||||
remaining = timeout - elapsed;
|
||||
}
|
||||
}
|
||||
} while (rv == 0 || (rv == -1 && syserror == EINTR));
|
||||
break;
|
||||
}
|
||||
return(rv);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
_MD_recv (PRFileDesc *fd, void *buf, PRInt32 amount, PRInt32 flags,
|
||||
PRIntervalTime timeout)
|
||||
{
|
||||
PRInt32 osfd = fd->secret->md.osfd;
|
||||
PRInt32 rv, err;
|
||||
PRThread *me = _PR_MD_CURRENT_THREAD();
|
||||
|
||||
#ifndef BONE_VERSION
|
||||
if (fd->secret->md.sock_state & BE_SOCK_SHUTDOWN_READ) {
|
||||
_PR_MD_MAP_RECV_ERROR(EPIPE);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef BONE_VERSION
|
||||
/*
|
||||
** Gah, stupid hack. If reading a zero amount, instantly return success.
|
||||
** BONE beta 6 returns EINVAL for reads of zero bytes, which parts of
|
||||
** mozilla use to check for socket availability.
|
||||
*/
|
||||
|
||||
if( 0 == amount ) return(0);
|
||||
#endif
|
||||
|
||||
while ((rv = recv(osfd, buf, amount, flags)) == -1) {
|
||||
err = _MD_ERRNO();
|
||||
|
||||
if ((err == EAGAIN) || (err == EWOULDBLOCK)) {
|
||||
if (fd->secret->nonblocking) {
|
||||
break;
|
||||
}
|
||||
/* If socket was supposed to be blocking,
|
||||
wait a while for the condition to be
|
||||
satisfied. */
|
||||
if ((rv = socket_io_wait(osfd, READ_FD, timeout)) < 0)
|
||||
goto done;
|
||||
} else if ((err == EINTR) && (!_PR_PENDING_INTERRUPT(me))){
|
||||
continue;
|
||||
|
||||
} else
|
||||
break;
|
||||
}
|
||||
|
||||
if (rv < 0) {
|
||||
_PR_MD_MAP_RECV_ERROR(err);
|
||||
}
|
||||
|
||||
done:
|
||||
return(rv);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
_MD_recvfrom (PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags,
|
||||
PRNetAddr *addr, PRUint32 *addrlen, PRIntervalTime timeout)
|
||||
{
|
||||
PRInt32 osfd = fd->secret->md.osfd;
|
||||
PRInt32 rv, err;
|
||||
PRThread *me = _PR_MD_CURRENT_THREAD();
|
||||
|
||||
while ((*addrlen = PR_NETADDR_SIZE(addr)),
|
||||
((rv = recvfrom(osfd, buf, amount, flags,
|
||||
(struct sockaddr *) addr,
|
||||
(_PRSockLen_t *)addrlen)) == -1)) {
|
||||
err = _MD_ERRNO();
|
||||
|
||||
if ((err == EAGAIN) || (err == EWOULDBLOCK)) {
|
||||
if (fd->secret->nonblocking) {
|
||||
break;
|
||||
}
|
||||
if ((rv = socket_io_wait(osfd, READ_FD, timeout)) < 0)
|
||||
goto done;
|
||||
|
||||
} else if ((err == EINTR) && (!_PR_PENDING_INTERRUPT(me))) {
|
||||
continue;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (rv < 0) {
|
||||
_PR_MD_MAP_RECVFROM_ERROR(err);
|
||||
}
|
||||
|
||||
done:
|
||||
#ifdef _PR_HAVE_SOCKADDR_LEN
|
||||
if (rv != -1) {
|
||||
/* ignore the sa_len field of struct sockaddr */
|
||||
if (addr) {
|
||||
addr->raw.family = ((struct sockaddr *) addr)->sa_family;
|
||||
}
|
||||
}
|
||||
#endif /* _PR_HAVE_SOCKADDR_LEN */
|
||||
return(rv);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
_MD_send (PRFileDesc *fd, const void *buf, PRInt32 amount, PRInt32 flags,
|
||||
PRIntervalTime timeout)
|
||||
{
|
||||
PRInt32 osfd = fd->secret->md.osfd;
|
||||
PRInt32 rv, err;
|
||||
PRThread *me = _PR_MD_CURRENT_THREAD();
|
||||
|
||||
#ifndef BONE_VERSION
|
||||
if (fd->secret->md.sock_state & BE_SOCK_SHUTDOWN_WRITE)
|
||||
{
|
||||
_PR_MD_MAP_SEND_ERROR(EPIPE);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
while ((rv = send(osfd, buf, amount, flags)) == -1) {
|
||||
err = _MD_ERRNO();
|
||||
|
||||
if ((err == EAGAIN) || (err == EWOULDBLOCK)) {
|
||||
if (fd->secret->nonblocking) {
|
||||
break;
|
||||
}
|
||||
|
||||
#ifndef BONE_VERSION
|
||||
if( _PR_PENDING_INTERRUPT(me)) {
|
||||
|
||||
me->flags &= ~_PR_INTERRUPT;
|
||||
PR_SetError( PR_PENDING_INTERRUPT_ERROR, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* in UNIX implementations, you could do a socket_io_wait here.
|
||||
* but since BeOS doesn't yet support WRITE notification in select,
|
||||
* you're spanked.
|
||||
*/
|
||||
snooze( 10000L );
|
||||
continue;
|
||||
#else /* BONE_VERSION */
|
||||
if ((rv = socket_io_wait(osfd, WRITE_FD, timeout))< 0)
|
||||
goto done;
|
||||
#endif
|
||||
|
||||
} else if ((err == EINTR) && (!_PR_PENDING_INTERRUPT(me))) {
|
||||
continue;
|
||||
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef BONE_VERSION
|
||||
/*
|
||||
* optimization; if bytes sent is less than "amount" call
|
||||
* select before returning. This is because it is likely that
|
||||
* the next writev() call will return EWOULDBLOCK.
|
||||
*/
|
||||
if ((!fd->secret->nonblocking) && (rv > 0) && (rv < amount)
|
||||
&& (timeout != PR_INTERVAL_NO_WAIT)) {
|
||||
if (socket_io_wait(osfd, WRITE_FD, timeout) < 0) {
|
||||
rv = -1;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
#endif /* BONE_VERSION */
|
||||
|
||||
if (rv < 0) {
|
||||
_PR_MD_MAP_SEND_ERROR(err);
|
||||
}
|
||||
|
||||
#ifdef BONE_VERSION
|
||||
done:
|
||||
#endif
|
||||
return(rv);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
_MD_sendto (PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags,
|
||||
const PRNetAddr *addr, PRUint32 addrlen, PRIntervalTime timeout)
|
||||
{
|
||||
PRInt32 osfd = fd->secret->md.osfd;
|
||||
PRInt32 rv, err;
|
||||
PRThread *me = _PR_MD_CURRENT_THREAD();
|
||||
#ifdef _PR_HAVE_SOCKADDR_LEN
|
||||
PRNetAddr addrCopy;
|
||||
|
||||
addrCopy = *addr;
|
||||
((struct sockaddr *) &addrCopy)->sa_len = addrlen;
|
||||
((struct sockaddr *) &addrCopy)->sa_family = addr->raw.family;
|
||||
|
||||
while ((rv = sendto(osfd, buf, amount, flags,
|
||||
(struct sockaddr *) &addrCopy, addrlen)) == -1) {
|
||||
#else
|
||||
while ((rv = sendto(osfd, buf, amount, flags,
|
||||
(struct sockaddr *) addr, addrlen)) == -1) {
|
||||
#endif
|
||||
err = _MD_ERRNO();
|
||||
|
||||
if ((err == EAGAIN) || (err == EWOULDBLOCK)) {
|
||||
if (fd->secret->nonblocking) {
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef BONE_VERSION
|
||||
if ((rv = socket_io_wait(osfd, WRITE_FD, timeout))< 0)
|
||||
goto done;
|
||||
#endif
|
||||
} else if ((err == EINTR) && (!_PR_PENDING_INTERRUPT(me))) {
|
||||
continue;
|
||||
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (rv < 0) {
|
||||
_PR_MD_MAP_SENDTO_ERROR(err);
|
||||
}
|
||||
|
||||
#ifdef BONE_VERSION
|
||||
done:
|
||||
#endif
|
||||
return(rv);
|
||||
}
|
||||
|
||||
#ifdef BONE_VERSION
|
||||
|
||||
PRInt32 _MD_writev(
|
||||
PRFileDesc *fd, const PRIOVec *iov,
|
||||
PRInt32 iov_size, PRIntervalTime timeout)
|
||||
{
|
||||
PRInt32 rv, err;
|
||||
PRThread *me = _PR_MD_CURRENT_THREAD();
|
||||
PRInt32 index, amount = 0;
|
||||
PRInt32 osfd = fd->secret->md.osfd;
|
||||
struct iovec osiov[PR_MAX_IOVECTOR_SIZE];
|
||||
|
||||
/* Ensured by PR_Writev */
|
||||
PR_ASSERT(iov_size <= PR_MAX_IOVECTOR_SIZE);
|
||||
|
||||
/*
|
||||
* We can't pass iov to writev because PRIOVec and struct iovec
|
||||
* may not be binary compatible. Make osiov a copy of iov and
|
||||
* pass osiov to writev.
|
||||
*/
|
||||
for (index = 0; index < iov_size; index++) {
|
||||
osiov[index].iov_base = iov[index].iov_base;
|
||||
osiov[index].iov_len = iov[index].iov_len;
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculate the total number of bytes to be sent; needed for
|
||||
* optimization later.
|
||||
* We could avoid this if this number was passed in; but it is
|
||||
* probably not a big deal because iov_size is usually small (less than
|
||||
* 3)
|
||||
*/
|
||||
if (!fd->secret->nonblocking) {
|
||||
for (index=0; index<iov_size; index++) {
|
||||
amount += iov[index].iov_len;
|
||||
}
|
||||
}
|
||||
|
||||
while ((rv = writev(osfd, osiov, iov_size)) == -1) {
|
||||
err = _MD_ERRNO();
|
||||
if ((err == EAGAIN) || (err == EWOULDBLOCK)) {
|
||||
if (fd->secret->nonblocking) {
|
||||
break;
|
||||
}
|
||||
if ((rv = socket_io_wait(osfd, WRITE_FD, timeout))<0)
|
||||
goto done;
|
||||
|
||||
} else if ((err == EINTR) && (!_PR_PENDING_INTERRUPT(me))){
|
||||
continue;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* optimization; if bytes sent is less than "amount" call
|
||||
* select before returning. This is because it is likely that
|
||||
* the next writev() call will return EWOULDBLOCK.
|
||||
*/
|
||||
if ((!fd->secret->nonblocking) && (rv > 0) && (rv < amount)
|
||||
&& (timeout != PR_INTERVAL_NO_WAIT)) {
|
||||
if (socket_io_wait(osfd, WRITE_FD, timeout) < 0) {
|
||||
rv = -1;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (rv < 0) {
|
||||
_PR_MD_MAP_WRITEV_ERROR(err);
|
||||
}
|
||||
done:
|
||||
return(rv);
|
||||
}
|
||||
|
||||
#endif /* BONE_VERSION */
|
||||
|
||||
PRInt32
|
||||
_MD_accept (PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen,
|
||||
PRIntervalTime timeout)
|
||||
{
|
||||
PRInt32 osfd = fd->secret->md.osfd;
|
||||
PRInt32 rv, err;
|
||||
PRThread *me = _PR_MD_CURRENT_THREAD();
|
||||
|
||||
while ((rv = accept(osfd, (struct sockaddr *) addr,
|
||||
(_PRSockLen_t *)addrlen)) == -1) {
|
||||
err = _MD_ERRNO();
|
||||
|
||||
if ((err == EAGAIN) || (err == EWOULDBLOCK)) {
|
||||
if (fd->secret->nonblocking) {
|
||||
break;
|
||||
}
|
||||
/* If it's SUPPOSED to be a blocking thread, wait
|
||||
* a while to see if the triggering condition gets
|
||||
* satisfied.
|
||||
*/
|
||||
/* Assume that we're always using a native thread */
|
||||
if ((rv = socket_io_wait(osfd, READ_FD, timeout)) < 0)
|
||||
goto done;
|
||||
} else if ((err == EINTR) && (!_PR_PENDING_INTERRUPT(me))) {
|
||||
continue;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (rv < 0) {
|
||||
_PR_MD_MAP_ACCEPT_ERROR(err);
|
||||
} else if (addr != NULL) {
|
||||
/* bug 134099 */
|
||||
err = getpeername(rv, (struct sockaddr *) addr, (_PRSockLen_t *)addrlen);
|
||||
}
|
||||
done:
|
||||
#ifdef _PR_HAVE_SOCKADDR_LEN
|
||||
if (rv != -1) {
|
||||
/* Mask off the first byte of struct sockaddr (the length field) */
|
||||
if (addr) {
|
||||
addr->raw.family = ((struct sockaddr *) addr)->sa_family;
|
||||
}
|
||||
}
|
||||
#endif /* _PR_HAVE_SOCKADDR_LEN */
|
||||
return(rv);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
_MD_connect (PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen,
|
||||
PRIntervalTime timeout)
|
||||
{
|
||||
PRInt32 rv, err;
|
||||
PRThread *me = _PR_MD_CURRENT_THREAD();
|
||||
PRInt32 osfd = fd->secret->md.osfd;
|
||||
|
||||
#ifndef BONE_VERSION
|
||||
fd->secret->md.connectValueValid = PR_FALSE;
|
||||
#endif
|
||||
#ifdef _PR_HAVE_SOCKADDR_LEN
|
||||
PRNetAddr addrCopy;
|
||||
|
||||
addrCopy = *addr;
|
||||
((struct sockaddr *) &addrCopy)->sa_len = addrlen;
|
||||
((struct sockaddr *) &addrCopy)->sa_family = addr->raw.family;
|
||||
#endif
|
||||
|
||||
/* (Copied from unix.c)
|
||||
* We initiate the connection setup by making a nonblocking connect()
|
||||
* call. If the connect() call fails, there are two cases we handle
|
||||
* specially:
|
||||
* 1. The connect() call was interrupted by a signal. In this case
|
||||
* we simply retry connect().
|
||||
* 2. The NSPR socket is nonblocking and connect() fails with
|
||||
* EINPROGRESS. We first wait until the socket becomes writable.
|
||||
* Then we try to find out whether the connection setup succeeded
|
||||
* or failed.
|
||||
*/
|
||||
|
||||
retry:
|
||||
#ifdef _PR_HAVE_SOCKADDR_LEN
|
||||
if ((rv = connect(osfd, (struct sockaddr *)&addrCopy, addrlen)) == -1) {
|
||||
#else
|
||||
if ((rv = connect(osfd, (struct sockaddr *)addr, addrlen)) == -1) {
|
||||
#endif
|
||||
err = _MD_ERRNO();
|
||||
#ifndef BONE_VERSION
|
||||
fd->secret->md.connectReturnValue = rv;
|
||||
fd->secret->md.connectReturnError = err;
|
||||
fd->secret->md.connectValueValid = PR_TRUE;
|
||||
#endif
|
||||
if( err == EINTR ) {
|
||||
|
||||
if( _PR_PENDING_INTERRUPT(me)) {
|
||||
|
||||
me->flags &= ~_PR_INTERRUPT;
|
||||
PR_SetError( PR_PENDING_INTERRUPT_ERROR, 0);
|
||||
return -1;
|
||||
}
|
||||
#ifndef BONE_VERSION
|
||||
snooze( 100000L );
|
||||
#endif
|
||||
goto retry;
|
||||
}
|
||||
|
||||
#ifndef BONE_VERSION
|
||||
if(!fd->secret->nonblocking && ((err == EINPROGRESS) || (err==EAGAIN) || (err==EALREADY))) {
|
||||
|
||||
/*
|
||||
** There's no timeout on this connect, but that's not
|
||||
** a big deal, since the connect times out anyways
|
||||
** after 30 seconds. Just sleep for 1/10th of a second
|
||||
** and retry until we go through or die.
|
||||
*/
|
||||
|
||||
if( _PR_PENDING_INTERRUPT(me)) {
|
||||
me->flags &= ~_PR_INTERRUPT;
|
||||
PR_SetError( PR_PENDING_INTERRUPT_ERROR, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
goto retry;
|
||||
}
|
||||
|
||||
if( fd->secret->nonblocking && ((err == EAGAIN) || (err == EINPROGRESS))) {
|
||||
PR_Lock(_connectLock);
|
||||
if (connectCount < sizeof(connectList)/sizeof(connectList[0])) {
|
||||
connectList[connectCount].osfd = osfd;
|
||||
memcpy(&connectList[connectCount].addr, addr, addrlen);
|
||||
connectList[connectCount].addrlen = addrlen;
|
||||
connectList[connectCount].timeout = timeout;
|
||||
connectCount++;
|
||||
PR_Unlock(_connectLock);
|
||||
_PR_MD_MAP_CONNECT_ERROR(err);
|
||||
} else {
|
||||
PR_Unlock(_connectLock);
|
||||
PR_SetError(PR_INSUFFICIENT_RESOURCES_ERROR, 0);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
#else /* BONE_VERSION */
|
||||
if(!fd->secret->nonblocking && (err == EINTR)) {
|
||||
|
||||
rv = socket_io_wait(osfd, WRITE_FD, timeout);
|
||||
if (rv == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
PR_ASSERT(rv == 1);
|
||||
if (_PR_PENDING_INTERRUPT(me)) {
|
||||
me->flags &= ~_PR_INTERRUPT;
|
||||
PR_SetError( PR_PENDING_INTERRUPT_ERROR, 0);
|
||||
return -1;
|
||||
}
|
||||
err = _MD_beos_get_nonblocking_connect_error(osfd);
|
||||
if (err != 0) {
|
||||
_PR_MD_MAP_CONNECT_ERROR(err);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
_PR_MD_MAP_CONNECT_ERROR(err);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
_MD_bind (PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen)
|
||||
{
|
||||
PRInt32 rv, err;
|
||||
#ifdef _PR_HAVE_SOCKADDR_LEN
|
||||
PRNetAddr addrCopy;
|
||||
|
||||
addrCopy = *addr;
|
||||
((struct sockaddr *) &addrCopy)->sa_len = addrlen;
|
||||
((struct sockaddr *) &addrCopy)->sa_family = addr->raw.family;
|
||||
rv = bind(fd->secret->md.osfd, (struct sockaddr *) &addrCopy, (int )addrlen);
|
||||
#else
|
||||
rv = bind(fd->secret->md.osfd, (struct sockaddr *) addr, (int )addrlen);
|
||||
#endif
|
||||
if (rv < 0) {
|
||||
err = _MD_ERRNO();
|
||||
_PR_MD_MAP_BIND_ERROR(err);
|
||||
}
|
||||
|
||||
return(rv);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
_MD_listen (PRFileDesc *fd, PRIntn backlog)
|
||||
{
|
||||
PRInt32 rv, err;
|
||||
|
||||
#ifndef BONE_VERSION
|
||||
/* Bug workaround! Setting listen to 0 on Be accepts no connections.
|
||||
** On most UN*Xes this sets the default.
|
||||
*/
|
||||
|
||||
if( backlog == 0 ) backlog = 5;
|
||||
#endif
|
||||
|
||||
rv = listen(fd->secret->md.osfd, backlog);
|
||||
if (rv < 0) {
|
||||
err = _MD_ERRNO();
|
||||
_PR_MD_MAP_LISTEN_ERROR(err);
|
||||
}
|
||||
|
||||
return(rv);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
_MD_shutdown (PRFileDesc *fd, PRIntn how)
|
||||
{
|
||||
PRInt32 rv, err;
|
||||
|
||||
#ifndef BONE_VERSION
|
||||
if (how == PR_SHUTDOWN_SEND)
|
||||
fd->secret->md.sock_state = BE_SOCK_SHUTDOWN_WRITE;
|
||||
else if (how == PR_SHUTDOWN_RCV)
|
||||
fd->secret->md.sock_state = BE_SOCK_SHUTDOWN_READ;
|
||||
else if (how == PR_SHUTDOWN_BOTH) {
|
||||
fd->secret->md.sock_state = (BE_SOCK_SHUTDOWN_WRITE | BE_SOCK_SHUTDOWN_READ);
|
||||
}
|
||||
|
||||
return 0;
|
||||
#else /* BONE_VERSION */
|
||||
rv = shutdown(fd->secret->md.osfd, how);
|
||||
if (rv < 0) {
|
||||
err = _MD_ERRNO();
|
||||
_PR_MD_MAP_SHUTDOWN_ERROR(err);
|
||||
}
|
||||
return(rv);
|
||||
#endif
|
||||
}
|
||||
|
||||
PRInt32
|
||||
_MD_socketpair (int af, int type, int flags, PRInt32 *osfd)
|
||||
{
|
||||
return PR_NOT_IMPLEMENTED_ERROR;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
_MD_close_socket (PRInt32 osfd)
|
||||
{
|
||||
#ifdef BONE_VERSION
|
||||
close( osfd );
|
||||
#else
|
||||
closesocket( osfd );
|
||||
#endif
|
||||
}
|
||||
|
||||
PRStatus
|
||||
_MD_getsockname (PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen)
|
||||
{
|
||||
PRInt32 rv, err;
|
||||
|
||||
rv = getsockname(fd->secret->md.osfd,
|
||||
(struct sockaddr *) addr, (_PRSockLen_t *)addrlen);
|
||||
#ifdef _PR_HAVE_SOCKADDR_LEN
|
||||
if (rv == 0) {
|
||||
/* ignore the sa_len field of struct sockaddr */
|
||||
if (addr) {
|
||||
addr->raw.family = ((struct sockaddr *) addr)->sa_family;
|
||||
}
|
||||
}
|
||||
#endif /* _PR_HAVE_SOCKADDR_LEN */
|
||||
if (rv < 0) {
|
||||
err = _MD_ERRNO();
|
||||
_PR_MD_MAP_GETSOCKNAME_ERROR(err);
|
||||
}
|
||||
|
||||
return rv==0?PR_SUCCESS:PR_FAILURE;
|
||||
}
|
||||
|
||||
PRStatus
|
||||
_MD_getpeername (PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen)
|
||||
{
|
||||
PRInt32 rv, err;
|
||||
|
||||
rv = getpeername(fd->secret->md.osfd,
|
||||
(struct sockaddr *) addr, (_PRSockLen_t *)addrlen);
|
||||
|
||||
#ifdef _PR_HAVE_SOCKADDR_LEN
|
||||
if (rv == 0) {
|
||||
/* ignore the sa_len field of struct sockaddr */
|
||||
if (addr) {
|
||||
addr->raw.family = ((struct sockaddr *) addr)->sa_family;
|
||||
}
|
||||
}
|
||||
#endif /* _PR_HAVE_SOCKADDR_LEN */
|
||||
|
||||
if (rv < 0) {
|
||||
err = _MD_ERRNO();
|
||||
_PR_MD_MAP_GETPEERNAME_ERROR(err);
|
||||
}
|
||||
return rv==0?PR_SUCCESS:PR_FAILURE;
|
||||
}
|
||||
|
||||
PRStatus
|
||||
_MD_getsockopt (PRFileDesc *fd, PRInt32 level,
|
||||
PRInt32 optname, char* optval, PRInt32* optlen)
|
||||
{
|
||||
PRInt32 rv, err;
|
||||
|
||||
rv = getsockopt(fd->secret->md.osfd, level, optname,
|
||||
optval, (_PRSockLen_t *)optlen);
|
||||
if (rv < 0) {
|
||||
err = _MD_ERRNO();
|
||||
_PR_MD_MAP_GETSOCKOPT_ERROR(err);
|
||||
}
|
||||
|
||||
return rv==0?PR_SUCCESS:PR_FAILURE;
|
||||
}
|
||||
|
||||
PRStatus
|
||||
_MD_setsockopt (PRFileDesc *fd, PRInt32 level,
|
||||
PRInt32 optname, const char* optval, PRInt32 optlen)
|
||||
{
|
||||
PRInt32 rv, err;
|
||||
|
||||
rv = setsockopt(fd->secret->md.osfd, level, optname, optval, optlen);
|
||||
if (rv < 0) {
|
||||
err = _MD_ERRNO();
|
||||
_PR_MD_MAP_SETSOCKOPT_ERROR(err);
|
||||
}
|
||||
return rv==0?PR_SUCCESS:PR_FAILURE;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
_MD_accept_read (PRFileDesc *sd, PRInt32 *newSock, PRNetAddr **raddr,
|
||||
void *buf, PRInt32 amount, PRIntervalTime timeout)
|
||||
{
|
||||
return PR_NOT_IMPLEMENTED_ERROR;
|
||||
}
|
||||
|
||||
#ifndef BONE_VERSION
|
||||
PRInt32
|
||||
_MD_socket (int af, int type, int flags)
|
||||
{
|
||||
PRInt32 osfd, err;
|
||||
|
||||
osfd = socket( af, type, 0 );
|
||||
|
||||
if( -1 == osfd ) {
|
||||
|
||||
err = _MD_ERRNO();
|
||||
_PR_MD_MAP_SOCKET_ERROR( err );
|
||||
}
|
||||
|
||||
return( osfd );
|
||||
}
|
||||
#else
|
||||
PRInt32
|
||||
_MD_socket(PRInt32 domain, PRInt32 type, PRInt32 proto)
|
||||
{
|
||||
PRInt32 osfd, err;
|
||||
|
||||
osfd = socket(domain, type, proto);
|
||||
|
||||
if (osfd == -1) {
|
||||
err = _MD_ERRNO();
|
||||
_PR_MD_MAP_SOCKET_ERROR(err);
|
||||
}
|
||||
|
||||
return(osfd);
|
||||
}
|
||||
#endif
|
||||
|
||||
PRInt32
|
||||
_MD_socketavailable (PRFileDesc *fd)
|
||||
{
|
||||
#ifdef BONE_VERSION
|
||||
PRInt32 result;
|
||||
|
||||
if (ioctl(fd->secret->md.osfd, FIONREAD, &result) < 0) {
|
||||
_PR_MD_MAP_SOCKETAVAILABLE_ERROR(_MD_ERRNO());
|
||||
return -1;
|
||||
}
|
||||
return result;
|
||||
#else
|
||||
return PR_NOT_IMPLEMENTED_ERROR;
|
||||
#endif
|
||||
}
|
||||
|
||||
PRInt32
|
||||
_MD_get_socket_error (void)
|
||||
{
|
||||
return PR_NOT_IMPLEMENTED_ERROR;
|
||||
}
|
||||
|
||||
PRStatus
|
||||
_MD_gethostname (char *name, PRUint32 namelen)
|
||||
{
|
||||
PRInt32 rv, err;
|
||||
|
||||
rv = gethostname(name, namelen);
|
||||
if (rv == 0)
|
||||
{
|
||||
err = _MD_ERRNO();
|
||||
_PR_MD_MAP_GETHOSTNAME_ERROR(err);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
#ifndef BONE_VERSION
|
||||
PRInt32
|
||||
_MD_beos_get_nonblocking_connect_error(PRFileDesc *fd)
|
||||
{
|
||||
int rv;
|
||||
int flags = 0;
|
||||
|
||||
rv = recv(fd->secret->md.osfd, NULL, 0, flags);
|
||||
PR_ASSERT(-1 == rv || 0 == rv);
|
||||
if (-1 == rv && errno != EAGAIN && errno != EWOULDBLOCK) {
|
||||
return errno;
|
||||
}
|
||||
return 0; /* no error */
|
||||
}
|
||||
#else
|
||||
PRInt32
|
||||
_MD_beos_get_nonblocking_connect_error(int osfd)
|
||||
{
|
||||
return PR_NOT_IMPLEMENTED_ERROR;
|
||||
// int err;
|
||||
// _PRSockLen_t optlen = sizeof(err);
|
||||
// if (getsockopt(osfd, SOL_SOCKET, SO_ERROR, (char *) &err, &optlen) == -1) {
|
||||
// return errno;
|
||||
// } else {
|
||||
// return err;
|
||||
// }
|
||||
}
|
||||
#endif /* BONE_VERSION */
|
|
@ -1,212 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; c-basic-offset: 8 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "primpl.h"
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
|
||||
#define _PR_SIGNALED_EXITSTATUS 256
|
||||
|
||||
PRProcess*
|
||||
_MD_create_process (const char *path, char *const *argv,
|
||||
char *const *envp, const PRProcessAttr *attr)
|
||||
{
|
||||
PRProcess *process;
|
||||
int nEnv, idx;
|
||||
char *const *childEnvp;
|
||||
char **newEnvp = NULL;
|
||||
int flags;
|
||||
PRBool found = PR_FALSE;
|
||||
|
||||
process = PR_NEW(PRProcess);
|
||||
if (!process) {
|
||||
PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
childEnvp = envp;
|
||||
if (attr && attr->fdInheritBuffer) {
|
||||
if (NULL == childEnvp) {
|
||||
childEnvp = environ;
|
||||
}
|
||||
for (nEnv = 0; childEnvp[nEnv]; nEnv++) {
|
||||
}
|
||||
newEnvp = (char **) PR_MALLOC((nEnv + 2) * sizeof(char *));
|
||||
if (NULL == newEnvp) {
|
||||
PR_DELETE(process);
|
||||
PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
|
||||
return NULL;
|
||||
}
|
||||
for (idx = 0; idx < nEnv; idx++) {
|
||||
newEnvp[idx] = childEnvp[idx];
|
||||
if (!found && !strncmp(newEnvp[idx], "NSPR_INHERIT_FDS=", 17)) {
|
||||
newEnvp[idx] = attr->fdInheritBuffer;
|
||||
found = PR_TRUE;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
newEnvp[idx++] = attr->fdInheritBuffer;
|
||||
}
|
||||
newEnvp[idx] = NULL;
|
||||
childEnvp = newEnvp;
|
||||
}
|
||||
|
||||
process->md.pid = fork();
|
||||
|
||||
if ((pid_t) -1 == process->md.pid) {
|
||||
PR_SetError(PR_INSUFFICIENT_RESOURCES_ERROR, errno);
|
||||
PR_DELETE(process);
|
||||
if (newEnvp) {
|
||||
PR_DELETE(newEnvp);
|
||||
}
|
||||
return NULL;
|
||||
} else if (0 == process->md.pid) { /* the child process */
|
||||
/*
|
||||
* If the child process needs to exit, it must call _exit().
|
||||
* Do not call exit(), because exit() will flush and close
|
||||
* the standard I/O file descriptors, and hence corrupt
|
||||
* the parent process's standard I/O data structures.
|
||||
*/
|
||||
|
||||
if (attr) {
|
||||
/* the osfd's to redirect stdin, stdout, and stderr to */
|
||||
int in_osfd = -1, out_osfd = -1, err_osfd = -1;
|
||||
|
||||
if (attr->stdinFd
|
||||
&& attr->stdinFd->secret->md.osfd != 0) {
|
||||
in_osfd = attr->stdinFd->secret->md.osfd;
|
||||
if (dup2(in_osfd, 0) != 0) {
|
||||
_exit(1); /* failed */
|
||||
}
|
||||
flags = fcntl(0, F_GETFL, 0);
|
||||
if (flags & O_NONBLOCK) {
|
||||
fcntl(0, F_SETFL, flags & ~O_NONBLOCK);
|
||||
}
|
||||
}
|
||||
if (attr->stdoutFd
|
||||
&& attr->stdoutFd->secret->md.osfd != 1) {
|
||||
out_osfd = attr->stdoutFd->secret->md.osfd;
|
||||
if (dup2(out_osfd, 1) != 1) {
|
||||
_exit(1); /* failed */
|
||||
}
|
||||
flags = fcntl(1, F_GETFL, 0);
|
||||
if (flags & O_NONBLOCK) {
|
||||
fcntl(1, F_SETFL, flags & ~O_NONBLOCK);
|
||||
}
|
||||
}
|
||||
if (attr->stderrFd
|
||||
&& attr->stderrFd->secret->md.osfd != 2) {
|
||||
err_osfd = attr->stderrFd->secret->md.osfd;
|
||||
if (dup2(err_osfd, 2) != 2) {
|
||||
_exit(1); /* failed */
|
||||
}
|
||||
flags = fcntl(2, F_GETFL, 0);
|
||||
if (flags & O_NONBLOCK) {
|
||||
fcntl(2, F_SETFL, flags & ~O_NONBLOCK);
|
||||
}
|
||||
}
|
||||
if (in_osfd != -1) {
|
||||
close(in_osfd);
|
||||
}
|
||||
if (out_osfd != -1 && out_osfd != in_osfd) {
|
||||
close(out_osfd);
|
||||
}
|
||||
if (err_osfd != -1 && err_osfd != in_osfd
|
||||
&& err_osfd != out_osfd) {
|
||||
close(err_osfd);
|
||||
}
|
||||
if (attr->currentDirectory) {
|
||||
if (chdir(attr->currentDirectory) < 0) {
|
||||
_exit(1); /* failed */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (childEnvp) {
|
||||
(void)execve(path, argv, childEnvp);
|
||||
} else {
|
||||
/* Inherit the environment of the parent. */
|
||||
(void)execv(path, argv);
|
||||
}
|
||||
/* Whoops! It returned. That's a bad sign. */
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
if (newEnvp) {
|
||||
PR_DELETE(newEnvp);
|
||||
}
|
||||
|
||||
return process;
|
||||
}
|
||||
|
||||
PRStatus
|
||||
_MD_detach_process (PRProcess *process)
|
||||
{
|
||||
/* If we kept a process table like unix does,
|
||||
* we'd remove the entry here.
|
||||
* Since we dont', just delete the process variable
|
||||
*/
|
||||
PR_DELETE(process);
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
PRStatus
|
||||
_MD_wait_process (PRProcess *process, PRInt32 *exitCode)
|
||||
{
|
||||
PRStatus retVal = PR_SUCCESS;
|
||||
int ret, status;
|
||||
|
||||
/* Ignore interruptions */
|
||||
do {
|
||||
ret = waitpid(process->md.pid, &status, 0);
|
||||
} while (ret == -1 && errno == EINTR);
|
||||
|
||||
/*
|
||||
* waitpid() cannot return 0 because we did not invoke it
|
||||
* with the WNOHANG option.
|
||||
*/
|
||||
PR_ASSERT(0 != ret);
|
||||
|
||||
if (ret < 0) {
|
||||
PR_SetError(PR_UNKNOWN_ERROR, _MD_ERRNO());
|
||||
return PR_FAILURE;
|
||||
}
|
||||
|
||||
/* If child process exited normally, return child exit code */
|
||||
if (WIFEXITED(status)) {
|
||||
*exitCode = WEXITSTATUS(status);
|
||||
} else {
|
||||
PR_ASSERT(WIFSIGNALED(status));
|
||||
*exitCode = _PR_SIGNALED_EXITSTATUS;
|
||||
}
|
||||
|
||||
PR_DELETE(process);
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
PRStatus
|
||||
_MD_kill_process (PRProcess *process)
|
||||
{
|
||||
PRErrorCode prerror;
|
||||
PRInt32 oserror;
|
||||
|
||||
if (kill(process->md.pid, SIGKILL) == 0) {
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
oserror = errno;
|
||||
switch (oserror) {
|
||||
case EPERM:
|
||||
prerror = PR_NO_ACCESS_RIGHTS_ERROR;
|
||||
break;
|
||||
case ESRCH:
|
||||
prerror = PR_INVALID_ARGUMENT_ERROR;
|
||||
break;
|
||||
default:
|
||||
prerror = PR_UNKNOWN_ERROR;
|
||||
break;
|
||||
}
|
||||
PR_SetError(prerror, oserror);
|
||||
return PR_FAILURE;
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/stat.h>
|
||||
#include <assert.h>
|
||||
#include <time.h>
|
||||
#include "primpl.h"
|
||||
|
||||
extern PRSize _PR_MD_GetRandomNoise( void *buf, PRSize size )
|
||||
{
|
||||
struct timeval tv;
|
||||
int n = 0;
|
||||
int s;
|
||||
|
||||
GETTIMEOFDAY(&tv);
|
||||
|
||||
if ( size > 0 ) {
|
||||
s = _pr_CopyLowBits((char*)buf+n, size, &tv.tv_usec, sizeof(tv.tv_usec));
|
||||
size -= s;
|
||||
n += s;
|
||||
}
|
||||
if ( size > 0 ) {
|
||||
s = _pr_CopyLowBits((char*)buf+n, size, &tv.tv_sec, sizeof(tv.tv_usec));
|
||||
size -= s;
|
||||
n += s;
|
||||
}
|
||||
|
||||
return n;
|
||||
} /* end _PR_MD_GetRandomNoise() */
|
|
@ -1,22 +0,0 @@
|
|||
/* -*- Mode: C++; c-basic-offset: 4 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "primpl.h"
|
||||
|
||||
PR_IMPLEMENT(void)
|
||||
_MD_init_segs (void)
|
||||
{
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(PRStatus)
|
||||
_MD_alloc_segment (PRSegment *seg, PRUint32 size, void *vaddr)
|
||||
{
|
||||
return PR_NOT_IMPLEMENTED_ERROR;
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(void)
|
||||
_MD_free_segment (PRSegment *seg)
|
||||
{
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
|
||||
# this file lists the source files to be compiled (used in Makefile) and
|
||||
# then enumerated as object files (in objs.mk) for inclusion in the NSPR
|
||||
# shared library
|
||||
|
||||
MDCSRCS = \
|
||||
beos.c \
|
||||
beos_errors.c \
|
||||
bfile.c \
|
||||
bmisc.c \
|
||||
bnet.c \
|
||||
bproc.c \
|
||||
brng.c \
|
||||
bseg.c \
|
||||
btime.c \
|
||||
bmmap.c \
|
||||
$(NULL)
|
|
@ -1,43 +0,0 @@
|
|||
/* -*- Mode: C++; c-basic-offset: 4 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "primpl.h"
|
||||
#include <kernel/OS.h>
|
||||
|
||||
static bigtime_t start;
|
||||
|
||||
PRTime
|
||||
_MD_now (void)
|
||||
{
|
||||
return (PRTime)real_time_clock_usecs();
|
||||
}
|
||||
|
||||
void
|
||||
_MD_interval_init (void)
|
||||
{
|
||||
/* grab the base interval time */
|
||||
start = real_time_clock_usecs();
|
||||
}
|
||||
|
||||
PRIntervalTime
|
||||
_MD_get_interval (void)
|
||||
{
|
||||
return( (PRIntervalTime) real_time_clock_usecs() / 10 );
|
||||
|
||||
#if 0
|
||||
/* return the number of tens of microseconds that have elapsed since
|
||||
we were initialized */
|
||||
bigtime_t now = real_time_clock_usecs();
|
||||
now -= start;
|
||||
now /= 10;
|
||||
return (PRIntervalTime)now;
|
||||
#endif
|
||||
}
|
||||
|
||||
PRIntervalTime
|
||||
_MD_interval_per_sec (void)
|
||||
{
|
||||
return 100000L;
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
# This makefile appends to the variable OBJS the platform-dependent
|
||||
# object modules that will be part of the nspr20 library.
|
||||
|
||||
include $(srcdir)/md/beos/bsrcs.mk
|
||||
|
||||
OBJS += $(MDCSRCS:%.c=md/beos/$(OBJDIR)/%.$(OBJ_SUFFIX))
|
|
@ -12,9 +12,6 @@
|
|||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#ifdef XP_BEOS
|
||||
#include <OS.h>
|
||||
#endif
|
||||
|
||||
PRInt32 _pr_pageShift;
|
||||
PRInt32 _pr_pageSize;
|
||||
|
@ -31,7 +28,7 @@ static void GetPageSize(void)
|
|||
#if defined BSDI || defined AIX \
|
||||
|| defined LINUX || defined __GNU__ || defined __GLIBC__ \
|
||||
|| defined FREEBSD || defined NETBSD || defined OPENBSD \
|
||||
|| defined DARWIN || defined SYMBIAN
|
||||
|| defined DARWIN
|
||||
_pr_pageSize = getpagesize();
|
||||
#elif defined(HPUX)
|
||||
/* I have no idea. Don't get me started. --Rob */
|
||||
|
@ -41,10 +38,6 @@ static void GetPageSize(void)
|
|||
#endif
|
||||
#endif /* XP_UNIX */
|
||||
|
||||
#ifdef XP_BEOS
|
||||
_pr_pageSize = B_PAGE_SIZE;
|
||||
#endif
|
||||
|
||||
#ifdef XP_PC
|
||||
#ifdef _WIN32
|
||||
SYSTEM_INFO info;
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,134 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/*
|
||||
* Atomically add a new element to the top of the stack
|
||||
*
|
||||
* usage : PR_StackPush(listp, elementp);
|
||||
* -----------------------
|
||||
*/
|
||||
|
||||
#include "md/_irix.h"
|
||||
#ifdef _PR_HAVE_ATOMIC_CAS
|
||||
|
||||
#include <sys/asm.h>
|
||||
#include <sys/regdef.h>
|
||||
|
||||
LEAF(PR_StackPush)
|
||||
|
||||
retry_push:
|
||||
.set noreorder
|
||||
lw v0,0(a0)
|
||||
li t1,1
|
||||
beq v0,t1,retry_push
|
||||
move t0,a1
|
||||
|
||||
ll v0,0(a0)
|
||||
beq v0,t1,retry_push
|
||||
nop
|
||||
sc t1,0(a0)
|
||||
beq t1,0,retry_push
|
||||
nop
|
||||
sw v0,0(a1)
|
||||
sync
|
||||
sw t0,0(a0)
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
jr ra
|
||||
nop
|
||||
|
||||
END(PR_StackPush)
|
||||
|
||||
/*
|
||||
*
|
||||
* Atomically remove the element at the top of the stack
|
||||
*
|
||||
* usage : elemep = PR_StackPop(listp);
|
||||
*
|
||||
*/
|
||||
|
||||
LEAF(PR_StackPop)
|
||||
retry_pop:
|
||||
.set noreorder
|
||||
|
||||
|
||||
lw v0,0(a0)
|
||||
li t1,1
|
||||
beq v0,0,done
|
||||
nop
|
||||
beq v0,t1,retry_pop
|
||||
nop
|
||||
|
||||
ll v0,0(a0)
|
||||
beq v0,0,done
|
||||
nop
|
||||
beq v0,t1,retry_pop
|
||||
nop
|
||||
sc t1,0(a0)
|
||||
beq t1,0,retry_pop
|
||||
nop
|
||||
lw t0,0(v0)
|
||||
sw t0,0(a0)
|
||||
done:
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
jr ra
|
||||
nop
|
||||
|
||||
END(PR_StackPop)
|
||||
|
||||
#endif /* _PR_HAVE_ATOMIC_CAS */
|
|
@ -1,75 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "primpl.h"
|
||||
|
||||
void _MD_EarlyInit(void)
|
||||
{
|
||||
}
|
||||
|
||||
PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np)
|
||||
{
|
||||
#ifndef _PR_PTHREADS
|
||||
if (isCurrent) {
|
||||
(void) setjmp(CONTEXT(t));
|
||||
}
|
||||
*np = sizeof(CONTEXT(t)) / sizeof(PRWord);
|
||||
return (PRWord *) CONTEXT(t);
|
||||
#else
|
||||
*np = 0;
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef _PR_PTHREADS
|
||||
void
|
||||
_MD_SET_PRIORITY(_MDThread *thread, PRUintn newPri)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
PRStatus
|
||||
_MD_InitializeThread(PRThread *thread)
|
||||
{
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
PRStatus
|
||||
_MD_WAIT(PRThread *thread, PRIntervalTime ticks)
|
||||
{
|
||||
PR_ASSERT(!(thread->flags & _PR_GLOBAL_SCOPE));
|
||||
_PR_MD_SWITCH_CONTEXT(thread);
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
PRStatus
|
||||
_MD_WAKEUP_WAITER(PRThread *thread)
|
||||
{
|
||||
if (thread) {
|
||||
PR_ASSERT(!(thread->flags & _PR_GLOBAL_SCOPE));
|
||||
}
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
/* These functions should not be called for OSF1 */
|
||||
void
|
||||
_MD_YIELD(void)
|
||||
{
|
||||
PR_NOT_REACHED("_MD_YIELD should not be called for OSF1.");
|
||||
}
|
||||
|
||||
PRStatus
|
||||
_MD_CREATE_THREAD(
|
||||
PRThread *thread,
|
||||
void (*start) (void *),
|
||||
PRThreadPriority priority,
|
||||
PRThreadScope scope,
|
||||
PRThreadState state,
|
||||
PRUint32 stackSize)
|
||||
{
|
||||
PR_NOT_REACHED("_MD_CREATE_THREAD should not be called for OSF1.");
|
||||
return PR_FAILURE;
|
||||
}
|
||||
#endif /* ! _PR_PTHREADS */
|
|
@ -1,16 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "primpl.h"
|
||||
|
||||
void _MD_EarlyInit(void)
|
||||
{
|
||||
}
|
||||
|
||||
PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np)
|
||||
{
|
||||
*np = 0;
|
||||
return NULL;
|
||||
}
|
|
@ -41,7 +41,7 @@
|
|||
#if defined(HAVE_SOCKLEN_T) \
|
||||
|| (defined(__GLIBC__) && __GLIBC__ >= 2)
|
||||
#define _PRSockLen_t socklen_t
|
||||
#elif defined(IRIX) || defined(HPUX) || defined(OSF1) || defined(SOLARIS) \
|
||||
#elif defined(HPUX) || defined(SOLARIS) \
|
||||
|| defined(AIX4_1) || defined(LINUX) \
|
||||
|| defined(BSDI) || defined(SCO) \
|
||||
|| defined(DARWIN) \
|
||||
|
@ -49,7 +49,7 @@
|
|||
#define _PRSockLen_t int
|
||||
#elif (defined(AIX) && !defined(AIX4_1)) || defined(FREEBSD) \
|
||||
|| defined(NETBSD) || defined(OPENBSD) || defined(UNIXWARE) \
|
||||
|| defined(DGUX) || defined(NTO) || defined(RISCOS)
|
||||
|| defined(NTO) || defined(RISCOS)
|
||||
#define _PRSockLen_t size_t
|
||||
#else
|
||||
#error "Cannot determine architecture"
|
||||
|
@ -84,10 +84,6 @@ static sigset_t empty_set;
|
|||
*/
|
||||
int _nspr_noclock = 1;
|
||||
|
||||
#ifdef IRIX
|
||||
extern PRInt32 _nspr_terminate_on_error;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* There is an assertion in this code that NSPR's definition of PRIOVec
|
||||
* is bit compatible with UNIX' definition of a struct iovec. This is
|
||||
|
@ -1084,10 +1080,6 @@ PRInt32 _MD_connect(
|
|||
PRInt32 rv, err;
|
||||
PRThread *me = _PR_MD_CURRENT_THREAD();
|
||||
PRInt32 osfd = fd->secret->md.osfd;
|
||||
#ifdef IRIX
|
||||
extern PRInt32 _MD_irix_connect(
|
||||
PRInt32 osfd, const PRNetAddr *addr, PRInt32 addrlen, PRIntervalTime timeout);
|
||||
#endif
|
||||
#ifdef _PR_HAVE_SOCKADDR_LEN
|
||||
PRNetAddr addrCopy;
|
||||
|
||||
|
@ -1109,14 +1101,10 @@ extern PRInt32 _MD_irix_connect(
|
|||
*/
|
||||
|
||||
retry:
|
||||
#ifdef IRIX
|
||||
if ((rv = _MD_irix_connect(osfd, addr, addrlen, timeout)) == -1) {
|
||||
#else
|
||||
#ifdef _PR_HAVE_SOCKADDR_LEN
|
||||
if ((rv = connect(osfd, (struct sockaddr *)&addrCopy, addrlen)) == -1) {
|
||||
#else
|
||||
if ((rv = connect(osfd, (struct sockaddr *)addr, addrlen)) == -1) {
|
||||
#endif
|
||||
#endif
|
||||
err = _MD_ERRNO();
|
||||
|
||||
|
@ -1466,9 +1454,6 @@ void _MD_PauseCPU(PRIntervalTime ticks)
|
|||
PRCList *q;
|
||||
PRUint32 min_timeout;
|
||||
sigset_t oldset;
|
||||
#ifdef IRIX
|
||||
extern sigset_t ints_off;
|
||||
#endif
|
||||
|
||||
PR_ASSERT(_PR_MD_GET_INTSOFF() != 0);
|
||||
|
||||
|
@ -1487,16 +1472,6 @@ extern sigset_t ints_off;
|
|||
*/
|
||||
if (_PR_IS_NATIVE_THREAD_SUPPORTED()) {
|
||||
npollfds++;
|
||||
#ifdef IRIX
|
||||
/*
|
||||
* On Irix, a second pipe is used to cause the primordial cpu to
|
||||
* wakeup and exit, when the process is exiting because of a call
|
||||
* to exit/PR_ProcessExit.
|
||||
*/
|
||||
if (me->cpu->id == 0) {
|
||||
npollfds++;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1522,16 +1497,6 @@ extern sigset_t ints_off;
|
|||
pollfdPtr->fd = _pr_md_pipefd[0];
|
||||
pollfdPtr->events = POLLIN;
|
||||
pollfdPtr++;
|
||||
#ifdef IRIX
|
||||
/*
|
||||
* On Irix, the second element is the exit pipe
|
||||
*/
|
||||
if (me->cpu->id == 0) {
|
||||
pollfdPtr->fd = _pr_irix_primoridal_cpu_fd[0];
|
||||
pollfdPtr->events = POLLIN;
|
||||
pollfdPtr++;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
min_timeout = PR_INTERVAL_NO_TIMEOUT;
|
||||
|
@ -1615,22 +1580,9 @@ extern sigset_t ints_off;
|
|||
* are enabled. Otherwise, when the select/poll calls are interrupted, the
|
||||
* timer value starts ticking from zero again when the system call is restarted.
|
||||
*/
|
||||
#ifdef IRIX
|
||||
/*
|
||||
* SIGCHLD signal is used on Irix to detect he termination of an
|
||||
* sproc by SIGSEGV, SIGBUS or SIGABRT signals when
|
||||
* _nspr_terminate_on_error is set.
|
||||
*/
|
||||
if ((!_nspr_noclock) || (_nspr_terminate_on_error))
|
||||
#else
|
||||
if (!_nspr_noclock)
|
||||
#endif /* IRIX */
|
||||
#ifdef IRIX
|
||||
sigprocmask(SIG_BLOCK, &ints_off, &oldset);
|
||||
#else
|
||||
PR_ASSERT(sigismember(&timer_set, SIGALRM));
|
||||
sigprocmask(SIG_BLOCK, &timer_set, &oldset);
|
||||
#endif /* IRIX */
|
||||
#endif /* !_PR_NO_CLOCK_TIMER */
|
||||
|
||||
#ifndef _PR_USE_POLL
|
||||
|
@ -1641,19 +1593,13 @@ extern sigset_t ints_off;
|
|||
#endif /* !_PR_USE_POLL */
|
||||
|
||||
#ifndef _PR_NO_CLOCK_TIMER
|
||||
#ifdef IRIX
|
||||
if ((!_nspr_noclock) || (_nspr_terminate_on_error))
|
||||
#else
|
||||
if (!_nspr_noclock)
|
||||
#endif /* IRIX */
|
||||
sigprocmask(SIG_SETMASK, &oldset, 0);
|
||||
#endif /* !_PR_NO_CLOCK_TIMER */
|
||||
|
||||
_MD_CHECK_FOR_EXIT();
|
||||
|
||||
#ifdef IRIX
|
||||
_PR_MD_primordial_cpu();
|
||||
#endif
|
||||
|
||||
_PR_MD_IOQ_LOCK();
|
||||
/*
|
||||
|
@ -1679,30 +1625,6 @@ extern sigset_t ints_off;
|
|||
PR_ASSERT((rv > 0) || ((rv == -1) && (errno == EAGAIN)));
|
||||
}
|
||||
pollfdPtr++;
|
||||
#ifdef IRIX
|
||||
/*
|
||||
* On Irix, check to see if the primordial cpu needs to exit
|
||||
* to cause the process to terminate
|
||||
*/
|
||||
if (me->cpu->id == 0) {
|
||||
PR_ASSERT(pollfds[1].fd == _pr_irix_primoridal_cpu_fd[0]);
|
||||
if (pollfdPtr->revents & POLLIN) {
|
||||
if (_pr_irix_process_exit) {
|
||||
/*
|
||||
* process exit due to a call to PR_ProcessExit
|
||||
*/
|
||||
prctl(PR_SETEXITSIG, SIGKILL);
|
||||
_exit(_pr_irix_process_exit_code);
|
||||
} else {
|
||||
while ((rv = read(_pr_irix_primoridal_cpu_fd[0],
|
||||
_pr_md_pipebuf, PIPE_BUF)) == PIPE_BUF) {
|
||||
}
|
||||
PR_ASSERT(rv > 0);
|
||||
}
|
||||
}
|
||||
pollfdPtr++;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
for (q = _PR_IOQ(me->cpu).next; q != &_PR_IOQ(me->cpu); q = q->next) {
|
||||
PRPollQueue *pq = _PR_POLLQUEUE_PTR(q);
|
||||
|
@ -1898,27 +1820,6 @@ extern sigset_t ints_off;
|
|||
}
|
||||
if (_PR_IOQ_MAX_OSFD(me->cpu) < _pr_md_pipefd[0])
|
||||
_PR_IOQ_MAX_OSFD(me->cpu) = _pr_md_pipefd[0];
|
||||
#ifdef IRIX
|
||||
if ((me->cpu->id == 0) &&
|
||||
(FD_ISSET(_pr_irix_primoridal_cpu_fd[0], rp))) {
|
||||
if (_pr_irix_process_exit) {
|
||||
/*
|
||||
* process exit due to a call to PR_ProcessExit
|
||||
*/
|
||||
prctl(PR_SETEXITSIG, SIGKILL);
|
||||
_exit(_pr_irix_process_exit_code);
|
||||
} else {
|
||||
while ((rv = read(_pr_irix_primoridal_cpu_fd[0],
|
||||
_pr_md_pipebuf, PIPE_BUF)) == PIPE_BUF) {
|
||||
}
|
||||
PR_ASSERT(rv > 0);
|
||||
}
|
||||
}
|
||||
if (me->cpu->id == 0) {
|
||||
if (_PR_IOQ_MAX_OSFD(me->cpu) < _pr_irix_primoridal_cpu_fd[0])
|
||||
_PR_IOQ_MAX_OSFD(me->cpu) = _pr_irix_primoridal_cpu_fd[0];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} else if (nfd < 0) {
|
||||
if (errno == EBADF) {
|
||||
|
@ -2241,7 +2142,7 @@ PRInt32 _MD_open(const char *name, PRIntn flags, PRIntn mode)
|
|||
|
||||
PRIntervalTime intr_timeout_ticks;
|
||||
|
||||
#if defined(SOLARIS) || defined(IRIX)
|
||||
#if defined(SOLARIS)
|
||||
static void sigsegvhandler() {
|
||||
fprintf(stderr,"Received SIGSEGV\n");
|
||||
fflush(stderr);
|
||||
|
@ -2259,7 +2160,7 @@ static void sigbushandler() {
|
|||
fflush(stderr);
|
||||
pause();
|
||||
}
|
||||
#endif /* SOLARIS, IRIX */
|
||||
#endif /* SOLARIS */
|
||||
|
||||
#endif /* !defined(_PR_PTHREADS) */
|
||||
|
||||
|
@ -2626,11 +2527,7 @@ PRInt32 _MD_getopenfileinfo64(const PRFileDesc *fd, PRFileInfo64 *info)
|
|||
* initialized by _PR_MD_FINAL_INIT. This means the log file cannot be a
|
||||
* large file on some platforms.
|
||||
*/
|
||||
#ifdef SYMBIAN
|
||||
struct _MD_IOVector _md_iovector; /* Will crash if NSPR_LOG_FILE is set. */
|
||||
#else
|
||||
struct _MD_IOVector _md_iovector = { open };
|
||||
#endif
|
||||
|
||||
/*
|
||||
** These implementations are to emulate large file routines on systems that
|
||||
|
@ -2735,28 +2632,6 @@ mmap64(void *addr, size_t len, int prot, int flags, int fd, loff_t offset)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(OSF1) && defined(__GNUC__)
|
||||
|
||||
/*
|
||||
* On OSF1 V5.0A, <sys/stat.h> defines stat and fstat as
|
||||
* macros when compiled under gcc, so it is rather tricky to
|
||||
* take the addresses of the real functions the macros expend
|
||||
* to. A simple solution is to define forwarder functions
|
||||
* and take the addresses of the forwarder functions instead.
|
||||
*/
|
||||
|
||||
static int stat_forwarder(const char *path, struct stat *buffer)
|
||||
{
|
||||
return stat(path, buffer);
|
||||
}
|
||||
|
||||
static int fstat_forwarder(int filedes, struct stat *buffer)
|
||||
{
|
||||
return fstat(filedes, buffer);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void _PR_InitIOV(void)
|
||||
{
|
||||
#if defined(SOLARIS2_5)
|
||||
|
@ -2789,7 +2664,7 @@ static void _PR_InitIOV(void)
|
|||
_md_iovector._stat64 = stat;
|
||||
_md_iovector._lseek64 = _MD_Unix_lseek64;
|
||||
#elif defined(_PR_HAVE_OFF64_T)
|
||||
#if defined(IRIX5_3) || (defined(ANDROID) && __ANDROID_API__ < 21)
|
||||
#if (defined(ANDROID) && __ANDROID_API__ < 21)
|
||||
/*
|
||||
* Android < 21 doesn't have open64. We pass the O_LARGEFILE flag to open
|
||||
* in _MD_open.
|
||||
|
@ -2811,13 +2686,8 @@ static void _PR_InitIOV(void)
|
|||
#elif defined(_PR_HAVE_LARGE_OFF_T)
|
||||
_md_iovector._open64 = open;
|
||||
_md_iovector._mmap64 = mmap;
|
||||
#if defined(OSF1) && defined(__GNUC__)
|
||||
_md_iovector._fstat64 = fstat_forwarder;
|
||||
_md_iovector._stat64 = stat_forwarder;
|
||||
#else
|
||||
_md_iovector._fstat64 = fstat;
|
||||
_md_iovector._stat64 = stat;
|
||||
#endif
|
||||
_md_iovector._lseek64 = lseek;
|
||||
#else
|
||||
#error "I don't know yet"
|
||||
|
@ -2839,7 +2709,7 @@ void _PR_UnixInit(void)
|
|||
intr_timeout_ticks =
|
||||
PR_SecondsToInterval(_PR_INTERRUPT_CHECK_INTERVAL_SECS);
|
||||
|
||||
#if defined(SOLARIS) || defined(IRIX)
|
||||
#if defined(SOLARIS)
|
||||
|
||||
if (getenv("NSPR_SIGSEGV_HANDLE")) {
|
||||
sigact.sa_handler = sigsegvhandler;
|
||||
|
@ -3569,14 +3439,9 @@ PRStatus _MD_CreateFileMap(PRFileMap *fmap, PRInt64 size)
|
|||
}
|
||||
if (fmap->prot == PR_PROT_READONLY) {
|
||||
fmap->md.prot = PROT_READ;
|
||||
#if defined(OSF1V4_MAP_PRIVATE_BUG) || defined(DARWIN) || defined(ANDROID)
|
||||
#if defined(DARWIN) || defined(ANDROID)
|
||||
/*
|
||||
* Use MAP_SHARED to work around a bug in OSF1 V4.0D
|
||||
* (QAR 70220 in the OSF_QAR database) that results in
|
||||
* corrupted data in the memory-mapped region. This
|
||||
* bug is fixed in V5.0.
|
||||
*
|
||||
* This is also needed on OS X because its implementation of
|
||||
* This is needed on OS X because its implementation of
|
||||
* POSIX shared memory returns an error for MAP_PRIVATE, even
|
||||
* when the mapping is read-only.
|
||||
*
|
||||
|
|
|
@ -55,11 +55,10 @@ typedef struct pr_PidRecord {
|
|||
} pr_PidRecord;
|
||||
|
||||
/*
|
||||
* Irix sprocs and LinuxThreads are actually a kind of processes
|
||||
* LinuxThreads are actually a kind of processes
|
||||
* that can share the virtual address space and file descriptors.
|
||||
*/
|
||||
#if (defined(IRIX) && !defined(_PR_PTHREADS)) \
|
||||
|| ((defined(LINUX) || defined(__GNU__) || defined(__GLIBC__)) \
|
||||
#if ((defined(LINUX) || defined(__GNU__) || defined(__GLIBC__)) \
|
||||
&& defined(_PR_PTHREADS))
|
||||
#define _PR_SHARE_CLONES
|
||||
#endif
|
||||
|
@ -192,7 +191,7 @@ ForkAndExec(
|
|||
|
||||
#ifdef AIX
|
||||
process->md.pid = (*pr_wp.forkptr)();
|
||||
#elif defined(NTO) || defined(SYMBIAN)
|
||||
#elif defined(NTO)
|
||||
/*
|
||||
* fork() & exec() does not work in a multithreaded process.
|
||||
* Use spawn() instead.
|
||||
|
@ -223,12 +222,7 @@ ForkAndExec(
|
|||
PR_ASSERT(attr->currentDirectory == NULL); /* not implemented */
|
||||
}
|
||||
|
||||
#ifdef SYMBIAN
|
||||
/* In Symbian OS, we use posix_spawn instead of fork() and exec() */
|
||||
posix_spawn(&(process->md.pid), path, NULL, NULL, argv, childEnvp);
|
||||
#else
|
||||
process->md.pid = spawn(path, 3, fd_map, NULL, argv, childEnvp);
|
||||
#endif
|
||||
|
||||
if (fd_map[0] != 0)
|
||||
close(fd_map[0]);
|
||||
|
@ -256,7 +250,7 @@ ForkAndExec(
|
|||
* the parent process's standard I/O data structures.
|
||||
*/
|
||||
|
||||
#if !defined(NTO) && !defined(SYMBIAN)
|
||||
#if !defined(NTO)
|
||||
if (attr) {
|
||||
/* the osfd's to redirect stdin, stdout, and stderr to */
|
||||
int in_osfd = -1, out_osfd = -1, err_osfd = -1;
|
||||
|
@ -855,11 +849,6 @@ PRStatus _MD_KillUnixProcess(PRProcess *process)
|
|||
PRErrorCode prerror;
|
||||
PRInt32 oserror;
|
||||
|
||||
#ifdef SYMBIAN
|
||||
/* In Symbian OS, we can not kill other process with Open C */
|
||||
PR_SetError(PR_OPERATION_NOT_SUPPORTED_ERROR, oserror);
|
||||
return PR_FAILURE;
|
||||
#else
|
||||
if (kill(process->md.pid, SIGKILL) == 0) {
|
||||
return PR_SUCCESS;
|
||||
}
|
||||
|
@ -877,5 +866,4 @@ PRStatus _MD_KillUnixProcess(PRProcess *process)
|
|||
}
|
||||
PR_SetError(prerror, oserror);
|
||||
return PR_FAILURE;
|
||||
#endif
|
||||
} /* _MD_KillUnixProcess */
|
||||
|
|
|
@ -54,28 +54,6 @@ GetHighResClock(void *buf, size_t maxbytes)
|
|||
}
|
||||
#endif
|
||||
|
||||
#elif defined(OSF1)
|
||||
|
||||
#include <c_asm.h>
|
||||
|
||||
/*
|
||||
* Use the "get the cycle counter" instruction on the alpha.
|
||||
* The low 32 bits completely turn over in less than a minute.
|
||||
* The high 32 bits are some non-counter gunk that changes sometimes.
|
||||
*/
|
||||
static size_t
|
||||
GetHighResClock(void *buf, size_t maxbytes)
|
||||
{
|
||||
unsigned long t;
|
||||
|
||||
#ifdef __GNUC__
|
||||
__asm__("rpcc %0" : "=r" (t));
|
||||
#else
|
||||
t = asm("rpcc %v0");
|
||||
#endif
|
||||
return _pr_CopyLowBits(buf, maxbytes, &t, sizeof(t));
|
||||
}
|
||||
|
||||
#elif defined(AIX)
|
||||
|
||||
static size_t
|
||||
|
@ -86,7 +64,7 @@ GetHighResClock(void *buf, size_t maxbytes)
|
|||
|
||||
#elif (defined(LINUX) || defined(FREEBSD) || defined(__FreeBSD_kernel__) \
|
||||
|| defined(NETBSD) || defined(__NetBSD_kernel__) || defined(OPENBSD) \
|
||||
|| defined(SYMBIAN) || defined(__GNU__))
|
||||
|| defined(__GNU__))
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
@ -126,89 +104,6 @@ GetHighResClock(void *buf, size_t maxbytes)
|
|||
return(GetDevURandom( buf, maxbytes ));
|
||||
}
|
||||
|
||||
#elif defined(IRIX)
|
||||
#include <fcntl.h>
|
||||
#undef PRIVATE
|
||||
#include <sys/mman.h>
|
||||
#include <sys/syssgi.h>
|
||||
#include <sys/immu.h>
|
||||
#include <sys/systeminfo.h>
|
||||
#include <sys/utsname.h>
|
||||
|
||||
static size_t GetHighResClock(void *buf, size_t maxbuf)
|
||||
{
|
||||
unsigned phys_addr, raddr, cycleval;
|
||||
static volatile unsigned *iotimer_addr = NULL;
|
||||
static int tries = 0;
|
||||
static int cntr_size;
|
||||
int mfd;
|
||||
unsigned s0[2];
|
||||
|
||||
#ifndef SGI_CYCLECNTR_SIZE
|
||||
#define SGI_CYCLECNTR_SIZE 165 /* Size user needs to use to read CC */
|
||||
#endif
|
||||
|
||||
if (iotimer_addr == NULL) {
|
||||
if (tries++ > 1) {
|
||||
/* Don't keep trying if it didn't work */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
** For SGI machines we can use the cycle counter, if it has one,
|
||||
** to generate some truly random numbers
|
||||
*/
|
||||
phys_addr = syssgi(SGI_QUERY_CYCLECNTR, &cycleval);
|
||||
if (phys_addr) {
|
||||
int pgsz = getpagesize();
|
||||
int pgoffmask = pgsz - 1;
|
||||
|
||||
raddr = phys_addr & ~pgoffmask;
|
||||
mfd = open("/dev/mmem", O_RDONLY);
|
||||
if (mfd < 0) {
|
||||
return 0;
|
||||
}
|
||||
iotimer_addr = (unsigned *)
|
||||
mmap(0, pgoffmask, PROT_READ, MAP_PRIVATE, mfd, (int)raddr);
|
||||
if (iotimer_addr == (unsigned*)-1) {
|
||||
close(mfd);
|
||||
iotimer_addr = NULL;
|
||||
return 0;
|
||||
}
|
||||
iotimer_addr = (unsigned*)
|
||||
((__psint_t)iotimer_addr | (phys_addr & pgoffmask));
|
||||
/*
|
||||
* The file 'mfd' is purposefully not closed.
|
||||
*/
|
||||
cntr_size = syssgi(SGI_CYCLECNTR_SIZE);
|
||||
if (cntr_size < 0) {
|
||||
struct utsname utsinfo;
|
||||
|
||||
/*
|
||||
* We must be executing on a 6.0 or earlier system, since the
|
||||
* SGI_CYCLECNTR_SIZE call is not supported.
|
||||
*
|
||||
* The only pre-6.1 platforms with 64-bit counters are
|
||||
* IP19 and IP21 (Challenge, PowerChallenge, Onyx).
|
||||
*/
|
||||
uname(&utsinfo);
|
||||
if (!strncmp(utsinfo.machine, "IP19", 4) ||
|
||||
!strncmp(utsinfo.machine, "IP21", 4))
|
||||
cntr_size = 64;
|
||||
else
|
||||
cntr_size = 32;
|
||||
}
|
||||
cntr_size /= 8; /* Convert from bits to bytes */
|
||||
}
|
||||
}
|
||||
|
||||
s0[0] = *iotimer_addr;
|
||||
if (cntr_size > 4)
|
||||
s0[1] = *(iotimer_addr + 1);
|
||||
memcpy(buf, (char *)&s0[0], cntr_size);
|
||||
return _pr_CopyLowBits(buf, maxbuf, &s0, cntr_size);
|
||||
}
|
||||
|
||||
#elif defined(SCO) || defined(UNIXWARE) || defined(BSDI) || defined(NTO) \
|
||||
|| defined(QNX) || defined(DARWIN) || defined(RISCOS)
|
||||
#include <sys/times.h>
|
||||
|
|
|
@ -231,12 +231,7 @@ extern PRStatus _MD_DeleteSharedMemory( const char *name )
|
|||
("_MD_DeleteSharedMemory(): ftok() failed on name: %s", ipcname));
|
||||
}
|
||||
|
||||
#ifdef SYMBIAN
|
||||
/* In Symbian OS the system imposed minimum is 1 byte, instead of ZERO */
|
||||
id = shmget( key, 1, 0 );
|
||||
#else
|
||||
id = shmget( key, 0, 0 );
|
||||
#endif
|
||||
if ( -1 == id ) {
|
||||
_PR_MD_MAP_DEFAULT_ERROR( errno );
|
||||
PR_LOG( _pr_shm_lm, PR_LOG_DEBUG,
|
||||
|
@ -488,11 +483,7 @@ extern PRFileMap* _md_OpenAnonFileMap(
|
|||
** make maxTries number of attempts at uniqueness in the filename
|
||||
*/
|
||||
for ( incr = 0; incr < maxTries ; incr++ ) {
|
||||
#if defined(SYMBIAN)
|
||||
#define NSPR_AFM_FILENAME "%s\\NSPR-AFM-%d-%p.%d"
|
||||
#else
|
||||
#define NSPR_AFM_FILENAME "%s/.NSPR-AFM-%d-%p.%d"
|
||||
#endif
|
||||
genName = PR_smprintf( NSPR_AFM_FILENAME,
|
||||
dirName, (int) pid, tid, incr );
|
||||
if ( NULL == genName ) {
|
||||
|
@ -529,13 +520,7 @@ extern PRFileMap* _md_OpenAnonFileMap(
|
|||
}
|
||||
|
||||
urc = unlink( genName );
|
||||
#if defined(SYMBIAN) && defined(__WINS__)
|
||||
/* If it is being used by the system or another process, Symbian OS
|
||||
* Emulator(WINS) considers this an error. */
|
||||
if ( -1 == urc && EACCES != errno ) {
|
||||
#else
|
||||
if ( -1 == urc ) {
|
||||
#endif
|
||||
_PR_MD_MAP_UNLINK_ERROR( errno );
|
||||
PR_LOG( _pr_shma_lm, PR_LOG_DEBUG,
|
||||
("_md_OpenAnonFileMap(): failed on unlink(), errno: %d", errno));
|
||||
|
|
|
@ -18,11 +18,6 @@
|
|||
/* Do not wrap select() and poll(). */
|
||||
#else /* defined(_PR_PTHREADS) || defined(_PR_GLOBAL_THREADS_ONLY) */
|
||||
/* The include files for select() */
|
||||
#ifdef IRIX
|
||||
#include <unistd.h>
|
||||
#include <bstring.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
|
@ -255,10 +250,8 @@ int select(int width, fd_set *rd, fd_set *wr, fd_set *ex, struct timeval *tv)
|
|||
nbits++;
|
||||
}
|
||||
PR_ASSERT(nbits > 0);
|
||||
#if defined(HPUX) || defined(SOLARIS) || defined(OSF1) || defined(AIX)
|
||||
#if defined(HPUX) || defined(SOLARIS) || defined(AIX)
|
||||
retVal += nbits;
|
||||
#else /* IRIX */
|
||||
retVal += 1;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -303,7 +296,7 @@ int select(int width, fd_set *rd, fd_set *wr, fd_set *ex, struct timeval *tv)
|
|||
int wrap_poll(void *listptr, unsigned long nfds, long timeout)
|
||||
#elif (defined(AIX) && !defined(AIX_RENAME_SELECT))
|
||||
int poll(void *listptr, unsigned long nfds, long timeout)
|
||||
#elif defined(OSF1) || (defined(HPUX) && !defined(HPUX9))
|
||||
#elif defined(HPUX) && !defined(HPUX9)
|
||||
int poll(struct pollfd filedes[], unsigned int nfds, int timeout)
|
||||
#elif defined(HPUX9)
|
||||
int poll(struct pollfd filedes[], int nfds, int timeout)
|
||||
|
|
|
@ -369,14 +369,6 @@ PR_IMPLEMENT(PRStatus) PR_Cleanup()
|
|||
}
|
||||
PR_Unlock(_pr_activeLock);
|
||||
|
||||
#ifdef IRIX
|
||||
_PR_MD_PRE_CLEANUP(me);
|
||||
/*
|
||||
* The primordial thread must now be running on the primordial cpu
|
||||
*/
|
||||
PR_ASSERT((_PR_IS_NATIVE_THREAD(me)) || (me->cpu->id == 0));
|
||||
#endif
|
||||
|
||||
_PR_MD_EARLY_CLEANUP();
|
||||
|
||||
_PR_CleanupMW();
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* A POSIX IPC name must begin with a '/'.
|
||||
* A POSIX IPC name on Solaris cannot contain any '/' except
|
||||
* the required leading '/'.
|
||||
* A POSIX IPC name on HP-UX and OSF1 must be a valid pathname
|
||||
* A POSIX IPC name on HP-UX must be a valid pathname
|
||||
* in the file system.
|
||||
*
|
||||
* The ftok() function for System V IPC requires a valid pathname
|
||||
|
|
|
@ -29,14 +29,13 @@ extern int h_errno;
|
|||
* The meaning of the macros related to gethostbyname, gethostbyaddr,
|
||||
* and gethostbyname2 is defined below.
|
||||
* - _PR_HAVE_THREADSAFE_GETHOST: the gethostbyXXX functions return
|
||||
* the result in thread specific storage. For example, AIX, HP-UX,
|
||||
* and OSF1.
|
||||
* the result in thread specific storage. For example, AIX, HP-UX.
|
||||
* - _PR_HAVE_GETHOST_R: have the gethostbyXXX_r functions. See next
|
||||
* two macros.
|
||||
* - _PR_HAVE_GETHOST_R_INT: the gethostbyXXX_r functions return an
|
||||
* int. For example, Linux glibc.
|
||||
* - _PR_HAVE_GETHOST_R_POINTER: the gethostbyXXX_r functions return
|
||||
* a struct hostent* pointer. For example, Solaris and IRIX.
|
||||
* a struct hostent* pointer. For example, Solaris.
|
||||
*/
|
||||
#if defined(_PR_NO_PREEMPT) || defined(_PR_HAVE_GETHOST_R) \
|
||||
|| defined(_PR_HAVE_THREADSAFE_GETHOST)
|
||||
|
@ -58,12 +57,6 @@ PRLock *_pr_dnsLock = NULL;
|
|||
* Some return a pointer to struct protoent, others return
|
||||
* an int, and glibc's flavor takes five arguments.
|
||||
*/
|
||||
#if defined(XP_BEOS) && defined(BONE_VERSION)
|
||||
#include <arpa/inet.h> /* pick up define for inet_addr */
|
||||
#include <sys/socket.h>
|
||||
#define _PR_HAVE_GETPROTO_R
|
||||
#define _PR_HAVE_GETPROTO_R_POINTER
|
||||
#endif
|
||||
|
||||
#if defined(SOLARIS) || (defined(BSDI) && defined(_REENTRANT)) \
|
||||
|| (defined(LINUX) && defined(_REENTRANT) \
|
||||
|
@ -72,8 +65,7 @@ PRLock *_pr_dnsLock = NULL;
|
|||
#define _PR_HAVE_GETPROTO_R_POINTER
|
||||
#endif
|
||||
|
||||
#if defined(OSF1) \
|
||||
|| defined(AIX4_3_PLUS) || (defined(AIX) && defined(_THREAD_SAFE)) \
|
||||
#if defined(AIX4_3_PLUS) || (defined(AIX) && defined(_THREAD_SAFE)) \
|
||||
|| (defined(HPUX10_10) && defined(_REENTRANT)) \
|
||||
|| (defined(HPUX10_20) && defined(_REENTRANT)) \
|
||||
|| defined(OPENBSD)
|
||||
|
@ -87,7 +79,7 @@ PRLock *_pr_dnsLock = NULL;
|
|||
#endif
|
||||
|
||||
/* BeOS has glibc but not the glibc-style getprotobyxxx_r functions. */
|
||||
#if (defined(__GLIBC__) && __GLIBC__ >= 2 && !defined(XP_BEOS))
|
||||
#if (defined(__GLIBC__) && __GLIBC__ >= 2)
|
||||
#define _PR_HAVE_GETPROTO_R
|
||||
#define _PR_HAVE_5_ARG_GETPROTO_R
|
||||
#endif
|
||||
|
@ -568,25 +560,6 @@ static PRStatus CopyHostent(
|
|||
return PR_SUCCESS;
|
||||
}
|
||||
|
||||
#ifdef SYMBIAN
|
||||
/* Set p_aliases by hand because Symbian's getprotobyname() returns NULL. */
|
||||
static void AssignAliases(struct protoent *Protoent, char** aliases)
|
||||
{
|
||||
if (NULL == Protoent->p_aliases) {
|
||||
if (0 == strcmp(Protoent->p_name, "ip"))
|
||||
aliases[0] = "IP";
|
||||
else if (0 == strcmp(Protoent->p_name, "tcp"))
|
||||
aliases[0] = "TCP";
|
||||
else if (0 == strcmp(Protoent->p_name, "udp"))
|
||||
aliases[0] = "UDP";
|
||||
else
|
||||
aliases[0] = "UNKNOWN";
|
||||
aliases[1] = NULL;
|
||||
Protoent->p_aliases = aliases;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(_PR_HAVE_GETPROTO_R)
|
||||
/*
|
||||
** Copy a protoent, and all of the memory that it refers to into
|
||||
|
@ -1249,10 +1222,6 @@ PR_IMPLEMENT(PRStatus) PR_GetProtoByName(
|
|||
}
|
||||
else
|
||||
{
|
||||
#if defined(SYMBIAN)
|
||||
char* aliases[2];
|
||||
AssignAliases(staticBuf, aliases);
|
||||
#endif
|
||||
rv = CopyProtoent(staticBuf, buffer, buflen, result);
|
||||
if (PR_FAILURE == rv)
|
||||
PR_SetError(PR_INSUFFICIENT_RESOURCES_ERROR, 0);
|
||||
|
@ -1333,10 +1302,6 @@ PR_IMPLEMENT(PRStatus) PR_GetProtoByNumber(
|
|||
}
|
||||
else
|
||||
{
|
||||
#if defined(SYMBIAN)
|
||||
char* aliases[2];
|
||||
AssignAliases(staticBuf, aliases);
|
||||
#endif
|
||||
rv = CopyProtoent(staticBuf, buffer, buflen, result);
|
||||
if (PR_FAILURE == rv)
|
||||
PR_SetError(PR_INSUFFICIENT_RESOURCES_ERROR, 0);
|
||||
|
|
|
@ -8,10 +8,6 @@
|
|||
#include "prprf.h"
|
||||
#include "prlong.h"
|
||||
|
||||
#if defined(BEOS)
|
||||
#include <kernel/OS.h>
|
||||
#endif
|
||||
|
||||
#if defined(OS2)
|
||||
#define INCL_DOS
|
||||
#define INCL_DOSMISC
|
||||
|
@ -183,11 +179,6 @@ PR_IMPLEMENT(PRInt32) PR_GetNumberOfProcessors( void )
|
|||
|
||||
GetSystemInfo( &info );
|
||||
numCpus = info.dwNumberOfProcessors;
|
||||
#elif defined(BEOS)
|
||||
system_info sysInfo;
|
||||
|
||||
get_system_info(&sysInfo);
|
||||
numCpus = sysInfo.cpu_count;
|
||||
#elif defined(OS2)
|
||||
DosQuerySysInfo( QSV_NUMPROCESSORS, QSV_NUMPROCESSORS, &numCpus, sizeof(numCpus));
|
||||
#elif defined(_PR_HAVE_SYSCTL)
|
||||
|
@ -208,9 +199,7 @@ PR_IMPLEMENT(PRInt32) PR_GetNumberOfProcessors( void )
|
|||
numCpus = -1; /* set to -1 for return value on error */
|
||||
_PR_MD_MAP_DEFAULT_ERROR( _MD_ERRNO() );
|
||||
}
|
||||
#elif defined(IRIX)
|
||||
numCpus = sysconf( _SC_NPROC_ONLN );
|
||||
#elif defined(RISCOS) || defined(SYMBIAN)
|
||||
#elif defined(RISCOS)
|
||||
numCpus = 1;
|
||||
#elif defined(LINUX)
|
||||
/* for the benefit of devices with advanced power-saving, that
|
||||
|
|
|
@ -585,7 +585,7 @@ void _PR_CleanupTime(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
#if defined(XP_UNIX) || defined(XP_PC) || defined(XP_BEOS)
|
||||
#if defined(XP_UNIX) || defined(XP_PC)
|
||||
|
||||
PR_IMPLEMENT(PRTimeParameters)
|
||||
PR_LocalTimeParameters(const PRExplodedTime *gmt)
|
||||
|
@ -736,7 +736,7 @@ PR_LocalTimeParameters(const PRExplodedTime *gmt)
|
|||
return retVal;
|
||||
}
|
||||
|
||||
#endif /* defined(XP_UNIX) || defined(XP_PC) || defined(XP_BEOS) */
|
||||
#endif /* defined(XP_UNIX) || defined(XP_PC) */
|
||||
|
||||
/*
|
||||
*------------------------------------------------------------------------
|
||||
|
@ -1720,9 +1720,9 @@ PR_FormatTime(char *buf, int buflen, const char *fmt,
|
|||
* additional fields: tm_zone and tm_gmtoff.
|
||||
*/
|
||||
|
||||
#if (__GLIBC__ >= 2) || defined(XP_BEOS) \
|
||||
|| defined(NETBSD) || defined(OPENBSD) || defined(FREEBSD) \
|
||||
|| defined(DARWIN) || defined(SYMBIAN) || defined(ANDROID)
|
||||
#if (__GLIBC__ >= 2) || defined(NETBSD) \
|
||||
|| defined(OPENBSD) || defined(FREEBSD) \
|
||||
|| defined(DARWIN) || defined(ANDROID)
|
||||
a.tm_zone = NULL;
|
||||
a.tm_gmtoff = time->tm_params.tp_gmt_offset +
|
||||
time->tm_params.tp_dst_offset;
|
||||
|
|
|
@ -177,13 +177,13 @@ static PRBool _pr_ipv6_v6only_on_by_default;
|
|||
#define _PRSelectFdSetArg_t int *
|
||||
#elif defined(AIX4_1)
|
||||
#define _PRSelectFdSetArg_t void *
|
||||
#elif defined(IRIX) || (defined(AIX) && !defined(AIX4_1)) \
|
||||
|| defined(OSF1) || defined(SOLARIS) \
|
||||
#elif (defined(AIX) && !defined(AIX4_1)) \
|
||||
|| defined(SOLARIS) \
|
||||
|| defined(HPUX10_30) || defined(HPUX11) \
|
||||
|| defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
|
||||
|| defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \
|
||||
|| defined(BSDI) || defined(NTO) || defined(DARWIN) \
|
||||
|| defined(UNIXWARE) || defined(RISCOS) || defined(SYMBIAN)
|
||||
|| defined(UNIXWARE) || defined(RISCOS)
|
||||
#define _PRSelectFdSetArg_t fd_set *
|
||||
#else
|
||||
#error "Cannot determine architecture"
|
||||
|
@ -403,7 +403,7 @@ PR_IMPLEMENT(void) PT_FPrintStats(PRFileDesc *debug_out, const char *msg)
|
|||
|
||||
#if defined(_PR_POLL_WITH_SELECT)
|
||||
/*
|
||||
* OSF1 and HPUX report the POLLHUP event for a socket when the
|
||||
* HPUX report the POLLHUP event for a socket when the
|
||||
* shutdown(SHUT_WR) operation is called for the remote end, even though
|
||||
* the socket is still writeable. Use select(), instead of poll(), to
|
||||
* workaround this problem.
|
||||
|
@ -1254,26 +1254,8 @@ static PRStatus pt_Close(PRFileDesc *fd)
|
|||
{
|
||||
if (-1 == close(fd->secret->md.osfd))
|
||||
{
|
||||
#ifdef OSF1
|
||||
/*
|
||||
* Bug 86941: On Tru64 UNIX V5.0A and V5.1, the close()
|
||||
* system call, when called to close a TCP socket, may
|
||||
* return -1 with errno set to EINVAL but the system call
|
||||
* does close the socket successfully. An application
|
||||
* may safely ignore the EINVAL error. This bug is fixed
|
||||
* on Tru64 UNIX V5.1A and later. The defect tracking
|
||||
* number is QAR 81431.
|
||||
*/
|
||||
if (PR_DESC_SOCKET_TCP != fd->methods->file_type
|
||||
|| EINVAL != errno)
|
||||
{
|
||||
pt_MapError(_PR_MD_MAP_CLOSE_ERROR, errno);
|
||||
return PR_FAILURE;
|
||||
}
|
||||
#else
|
||||
pt_MapError(_PR_MD_MAP_CLOSE_ERROR, errno);
|
||||
return PR_FAILURE;
|
||||
#endif
|
||||
}
|
||||
fd->secret->state = _PR_FILEDESC_CLOSED;
|
||||
}
|
||||
|
@ -1647,18 +1629,9 @@ static PRFileDesc* pt_Accept(
|
|||
PRFileDesc *newfd = NULL;
|
||||
PRIntn syserrno, osfd = -1;
|
||||
pt_SockLen addr_len = sizeof(PRNetAddr);
|
||||
#ifdef SYMBIAN
|
||||
PRNetAddr dummy_addr;
|
||||
#endif
|
||||
|
||||
if (pt_TestAbort()) return newfd;
|
||||
|
||||
#ifdef SYMBIAN
|
||||
/* On Symbian OS, accept crashes if addr is NULL. */
|
||||
if (!addr)
|
||||
addr = &dummy_addr;
|
||||
#endif
|
||||
|
||||
#ifdef _PR_STRICT_ADDR_LEN
|
||||
if (addr)
|
||||
{
|
||||
|
@ -1835,13 +1808,7 @@ static PRInt32 pt_Recv(
|
|||
osflags = 0;
|
||||
else if (PR_MSG_PEEK == flags)
|
||||
{
|
||||
#ifdef SYMBIAN
|
||||
/* MSG_PEEK doesn't work as expected. */
|
||||
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
|
||||
return bytes;
|
||||
#else
|
||||
osflags = MSG_PEEK;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3352,12 +3319,11 @@ static PRIOMethods _pr_socketpollfd_methods = {
|
|||
(PRReservedFN)_PR_InvalidInt
|
||||
};
|
||||
|
||||
#if defined(HPUX) || defined(OSF1) || defined(SOLARIS) || defined (IRIX) \
|
||||
#if defined(HPUX) || defined(SOLARIS) \
|
||||
|| defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
|
||||
|| defined(AIX) || defined(FREEBSD) || defined(NETBSD) \
|
||||
|| defined(OPENBSD) || defined(BSDI) || defined(NTO) \
|
||||
|| defined(DARWIN) || defined(UNIXWARE) || defined(RISCOS) \
|
||||
|| defined(SYMBIAN)
|
||||
|| defined(DARWIN) || defined(UNIXWARE) || defined(RISCOS)
|
||||
#define _PR_FCNTL_FLAGS O_NONBLOCK
|
||||
#else
|
||||
#error "Can't determine architecture"
|
||||
|
@ -4106,7 +4072,7 @@ retry:
|
|||
|
||||
#if defined(_PR_POLL_WITH_SELECT)
|
||||
/*
|
||||
* OSF1 and HPUX report the POLLHUP event for a socket when the
|
||||
* HPUX report the POLLHUP event for a socket when the
|
||||
* shutdown(SHUT_WR) operation is called for the remote end, even though
|
||||
* the socket is still writeable. Use select(), instead of poll(), to
|
||||
* workaround this problem.
|
||||
|
@ -4483,84 +4449,6 @@ PR_IMPLEMENT(PRFileDesc*) PR_OpenTCPSocket(PRIntn af)
|
|||
|
||||
PR_IMPLEMENT(PRStatus) PR_NewTCPSocketPair(PRFileDesc *fds[2])
|
||||
{
|
||||
#ifdef SYMBIAN
|
||||
/*
|
||||
* For the platforms that don't have socketpair.
|
||||
*
|
||||
* Copied from prsocket.c, with the parameter f[] renamed fds[] and the
|
||||
* _PR_CONNECT_DOES_NOT_BIND code removed.
|
||||
*/
|
||||
PRFileDesc *listenSock;
|
||||
PRNetAddr selfAddr, peerAddr;
|
||||
PRUint16 port;
|
||||
|
||||
fds[0] = fds[1] = NULL;
|
||||
listenSock = PR_NewTCPSocket();
|
||||
if (listenSock == NULL) {
|
||||
goto failed;
|
||||
}
|
||||
PR_InitializeNetAddr(PR_IpAddrLoopback, 0, &selfAddr); /* BugZilla: 35408 */
|
||||
if (PR_Bind(listenSock, &selfAddr) == PR_FAILURE) {
|
||||
goto failed;
|
||||
}
|
||||
if (PR_GetSockName(listenSock, &selfAddr) == PR_FAILURE) {
|
||||
goto failed;
|
||||
}
|
||||
port = ntohs(selfAddr.inet.port);
|
||||
if (PR_Listen(listenSock, 5) == PR_FAILURE) {
|
||||
goto failed;
|
||||
}
|
||||
fds[0] = PR_NewTCPSocket();
|
||||
if (fds[0] == NULL) {
|
||||
goto failed;
|
||||
}
|
||||
PR_InitializeNetAddr(PR_IpAddrLoopback, port, &selfAddr);
|
||||
|
||||
/*
|
||||
* Only a thread is used to do the connect and accept.
|
||||
* I am relying on the fact that PR_Connect returns
|
||||
* successfully as soon as the connect request is put
|
||||
* into the listen queue (but before PR_Accept is called).
|
||||
* This is the behavior of the BSD socket code. If
|
||||
* connect does not return until accept is called, we
|
||||
* will need to create another thread to call connect.
|
||||
*/
|
||||
if (PR_Connect(fds[0], &selfAddr, PR_INTERVAL_NO_TIMEOUT)
|
||||
== PR_FAILURE) {
|
||||
goto failed;
|
||||
}
|
||||
/*
|
||||
* A malicious local process may connect to the listening
|
||||
* socket, so we need to verify that the accepted connection
|
||||
* is made from our own socket fds[0].
|
||||
*/
|
||||
if (PR_GetSockName(fds[0], &selfAddr) == PR_FAILURE) {
|
||||
goto failed;
|
||||
}
|
||||
fds[1] = PR_Accept(listenSock, &peerAddr, PR_INTERVAL_NO_TIMEOUT);
|
||||
if (fds[1] == NULL) {
|
||||
goto failed;
|
||||
}
|
||||
if (peerAddr.inet.port != selfAddr.inet.port) {
|
||||
/* the connection we accepted is not from fds[0] */
|
||||
PR_SetError(PR_INSUFFICIENT_RESOURCES_ERROR, 0);
|
||||
goto failed;
|
||||
}
|
||||
PR_Close(listenSock);
|
||||
return PR_SUCCESS;
|
||||
|
||||
failed:
|
||||
if (listenSock) {
|
||||
PR_Close(listenSock);
|
||||
}
|
||||
if (fds[0]) {
|
||||
PR_Close(fds[0]);
|
||||
}
|
||||
if (fds[1]) {
|
||||
PR_Close(fds[1]);
|
||||
}
|
||||
return PR_FAILURE;
|
||||
#else
|
||||
PRInt32 osfd[2];
|
||||
|
||||
if (pt_TestAbort()) return PR_FAILURE;
|
||||
|
@ -4583,7 +4471,6 @@ failed:
|
|||
return PR_FAILURE;
|
||||
}
|
||||
return PR_SUCCESS;
|
||||
#endif
|
||||
} /* PR_NewTCPSocketPair */
|
||||
|
||||
PR_IMPLEMENT(PRStatus) PR_CreatePipe(
|
||||
|
@ -4812,7 +4699,7 @@ PR_IMPLEMENT(PRStatus) PR_UnlockFile(PRFileDesc *fd)
|
|||
|
||||
PR_IMPLEMENT(PRInt32) PR_GetSysfdTableMax(void)
|
||||
{
|
||||
#if defined(AIX) || defined(SYMBIAN)
|
||||
#if defined(AIX)
|
||||
return sysconf(_SC_OPEN_MAX);
|
||||
#else
|
||||
struct rlimit rlim;
|
||||
|
@ -4826,7 +4713,7 @@ PR_IMPLEMENT(PRInt32) PR_GetSysfdTableMax(void)
|
|||
|
||||
PR_IMPLEMENT(PRInt32) PR_SetSysfdTableSize(PRIntn table_size)
|
||||
{
|
||||
#if defined(AIX) || defined(SYMBIAN)
|
||||
#if defined(AIX)
|
||||
return -1;
|
||||
#else
|
||||
struct rlimit rlim;
|
||||
|
|
|
@ -913,7 +913,7 @@ PR_IMPLEMENT(PRStatus) PR_DeleteSemaphore(const char *name)
|
|||
#if (defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)) \
|
||||
|| (defined(FREEBSD) && __FreeBSD_version < 1200059) \
|
||||
|| defined(OPENBSD) || defined(BSDI) \
|
||||
|| defined(DARWIN) || defined(SYMBIAN)
|
||||
|| defined(DARWIN)
|
||||
/* union semun is defined by including <sys/sem.h> */
|
||||
#else
|
||||
/* according to X/OPEN we have to define it ourselves */
|
||||
|
|
|
@ -25,11 +25,8 @@
|
|||
#include <pthread_np.h>
|
||||
#endif
|
||||
|
||||
#ifdef SYMBIAN
|
||||
/* In Open C sched_get_priority_min/max do not work properly, so we undefine
|
||||
* _POSIX_THREAD_PRIORITY_SCHEDULING here.
|
||||
*/
|
||||
#undef _POSIX_THREAD_PRIORITY_SCHEDULING
|
||||
#if defined(ANDROID)
|
||||
#include <sys/prctl.h>
|
||||
#endif
|
||||
|
||||
#ifdef _PR_NICE_PRIORITY_SCHEDULING
|
||||
|
@ -434,17 +431,6 @@ static PRThread* _PR_CreateThread(
|
|||
|
||||
if (EPERM == rv)
|
||||
{
|
||||
#if defined(IRIX)
|
||||
if (PR_GLOBAL_BOUND_THREAD == scope) {
|
||||
/*
|
||||
* SCOPE_SYSTEM requires appropriate privilege
|
||||
* reset to process scope and try again
|
||||
*/
|
||||
rv = pthread_attr_setscope(&tattr, PTHREAD_SCOPE_PROCESS);
|
||||
PR_ASSERT(0 == rv);
|
||||
thred->state &= ~PT_THREAD_BOUND;
|
||||
}
|
||||
#else
|
||||
/* Remember that we don't have thread scheduling privilege. */
|
||||
pt_schedpriv = EPERM;
|
||||
PR_LOG(_pr_thread_lm, PR_LOG_MIN,
|
||||
|
@ -454,7 +440,6 @@ static PRThread* _PR_CreateThread(
|
|||
rv = pthread_attr_setinheritsched(&tattr, PTHREAD_INHERIT_SCHED);
|
||||
PR_ASSERT(0 == rv);
|
||||
#endif
|
||||
#endif /* IRIX */
|
||||
rv = _PT_PTHREAD_CREATE(&id, tattr, _pt_root, thred);
|
||||
}
|
||||
|
||||
|
@ -1194,7 +1179,6 @@ static void null_signal_handler(PRIntn sig);
|
|||
*/
|
||||
static void init_pthread_gc_support(void)
|
||||
{
|
||||
#ifndef SYMBIAN
|
||||
PRIntn rv;
|
||||
|
||||
{
|
||||
|
@ -1224,7 +1208,6 @@ static void init_pthread_gc_support(void)
|
|||
PR_ASSERT(0 ==rv);
|
||||
}
|
||||
#endif /* defined(PT_NO_SIGTIMEDWAIT) */
|
||||
#endif /* SYMBIAN */
|
||||
}
|
||||
|
||||
PR_IMPLEMENT(void) PR_SetThreadGCAble(void)
|
||||
|
@ -1370,8 +1353,7 @@ static void suspend_signal_handler(PRIntn sig)
|
|||
{
|
||||
#if !defined(FREEBSD) && !defined(NETBSD) && !defined(OPENBSD) \
|
||||
&& !defined(BSDI) && !defined(UNIXWARE) \
|
||||
&& !defined(DARWIN) && !defined(RISCOS) \
|
||||
&& !defined(SYMBIAN) /*XXX*/
|
||||
&& !defined(DARWIN) && !defined(RISCOS)
|
||||
PRIntn rv;
|
||||
sigwait(&sigwait_set, &rv);
|
||||
#endif
|
||||
|
@ -1415,12 +1397,7 @@ static void pt_SuspendSet(PRThread *thred)
|
|||
PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS,
|
||||
("doing pthread_kill in pt_SuspendSet thred %p tid = %X\n",
|
||||
thred, thred->id));
|
||||
#if defined(SYMBIAN)
|
||||
/* All signal group functions are not implemented in Symbian OS */
|
||||
rv = 0;
|
||||
#else
|
||||
rv = pthread_kill (thred->id, SIGUSR2);
|
||||
#endif
|
||||
PR_ASSERT(0 == rv);
|
||||
}
|
||||
|
||||
|
@ -1472,12 +1449,8 @@ static void pt_ResumeSet(PRThread *thred)
|
|||
thred->suspend &= ~PT_THREAD_SUSPENDED;
|
||||
|
||||
#if defined(PT_NO_SIGTIMEDWAIT)
|
||||
#if defined(SYMBIAN)
|
||||
/* All signal group functions are not implemented in Symbian OS */
|
||||
#else
|
||||
pthread_kill(thred->id, SIGUSR1);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
} /* pt_ResumeSet */
|
||||
|
||||
|
@ -1633,6 +1606,8 @@ PR_IMPLEMENT(PRStatus) PR_SetCurrentThreadName(const char *name)
|
|||
|
||||
#if defined(OPENBSD) || defined(FREEBSD) || defined(DRAGONFLY)
|
||||
pthread_set_name_np(thread->id, name);
|
||||
#elif defined(ANDROID)
|
||||
prctl(PR_SET_NAME, (unsigned long)(name));
|
||||
#elif defined(NETBSD)
|
||||
result = pthread_setname_np(thread->id, "%s", (void *)name);
|
||||
#else /* not BSD */
|
||||
|
|
|
@ -786,9 +786,6 @@ static PRThread *get_thread(_PRCPU *cpu, PRBool *wakeup_cpus)
|
|||
*/
|
||||
|
||||
thread = NULL;
|
||||
#ifdef IRIX
|
||||
_PR_MD_WAKEUP_PRIMORDIAL_CPU();
|
||||
#endif
|
||||
continue;
|
||||
} else if (thread->io_pending == PR_TRUE) {
|
||||
/*
|
||||
|
@ -1453,10 +1450,10 @@ PR_IMPLEMENT(PRThread*) PR_AttachThread(PRThreadType type,
|
|||
PR_IMPLEMENT(void) PR_DetachThread(void)
|
||||
{
|
||||
/*
|
||||
* On IRIX, Solaris, and Windows, foreign threads are detached when
|
||||
* On Solaris, and Windows, foreign threads are detached when
|
||||
* they terminate.
|
||||
*/
|
||||
#if !defined(IRIX) && !defined(WIN32) \
|
||||
#if !defined(WIN32) \
|
||||
&& !(defined(SOLARIS) && defined(_PR_GLOBAL_THREADS_ONLY))
|
||||
PRThread *me;
|
||||
if (_pr_initialized) {
|
||||
|
|
|
@ -280,11 +280,7 @@ PR_IMPLEMENT(PRInt32) PR_GetThreadAffinityMask(PRThread *thread, PRUint32 *mask)
|
|||
PR_IMPLEMENT(PRInt32) PR_SetThreadAffinityMask(PRThread *thread, PRUint32 mask )
|
||||
{
|
||||
#ifdef HAVE_THREAD_AFFINITY
|
||||
#ifndef IRIX
|
||||
return _PR_MD_SETTHREADAFFINITYMASK(thread, mask);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
** the routines in pr/src/btthreads/
|
||||
*/
|
||||
|
||||
#ifndef XP_BEOS
|
||||
|
||||
#include "primpl.h"
|
||||
|
||||
|
@ -249,4 +248,3 @@ void _PR_DestroyThreadPrivate(PRThread* self)
|
|||
}
|
||||
} /* _PR_DestroyThreadPrivate */
|
||||
|
||||
#endif /* !XP_BEOS */
|
||||
|
|
|
@ -150,8 +150,6 @@ CSRCS = \
|
|||
sockping.c \
|
||||
sockpong.c \
|
||||
sprintf.c \
|
||||
sproc_ch.c \
|
||||
sproc_p.c \
|
||||
stack.c \
|
||||
stdio.c \
|
||||
str2addr.c \
|
||||
|
@ -237,49 +235,6 @@ ABSOLUTE_LIB_DIR = $(PWD)/$(dist_libdir)
|
|||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH), IRIX)
|
||||
ifeq ($(USE_CPLUS), 1)
|
||||
CC = CC
|
||||
endif
|
||||
LDOPTS += -rpath $(ABSOLUTE_LIB_DIR)
|
||||
ifdef NS_USE_GCC
|
||||
LDOPTS += -Wl,-rdata_shared
|
||||
else
|
||||
LDOPTS += -rdata_shared
|
||||
endif
|
||||
# For 6.x machines, include this flag
|
||||
ifeq ($(basename $(OS_RELEASE)),6)
|
||||
ifndef NS_USE_GCC
|
||||
ifeq ($(USE_N32),1)
|
||||
LDOPTS += -n32
|
||||
else
|
||||
LDOPTS += -32
|
||||
endif
|
||||
|
||||
ifeq ($(USE_PTHREADS), 1)
|
||||
ifeq ($(OS_RELEASE), 6.2)
|
||||
LDOPTS += -Wl,-woff,85
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH), OSF1)
|
||||
ifeq ($(USE_CPLUS), 1)
|
||||
CC = cxx
|
||||
endif
|
||||
# I haven't figured out how to pass -rpath to cc on OSF1 V3.2, so
|
||||
# we do static linking.
|
||||
ifeq (,$(filter-out V2.0 V3.2,$(OS_RELEASE)))
|
||||
LIBNSPR = $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).a
|
||||
LIBPLC = $(dist_libdir)/libplc$(MOD_MAJOR_VERSION).a
|
||||
EXTRA_LIBS = -lc_r
|
||||
else
|
||||
LDOPTS += -rpath $(ABSOLUTE_LIB_DIR)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH), HP-UX)
|
||||
LDOPTS += -z -Wl,+s,+b,$(ABSOLUTE_LIB_DIR)
|
||||
ifeq ($(USE_64),1)
|
||||
|
|
|
@ -317,12 +317,6 @@ sockopt.c
|
|||
sprintf.c
|
||||
Tests sprintf.
|
||||
|
||||
sproc_ch.c
|
||||
Obsolete. Tests IRIX sproc-based threads.
|
||||
|
||||
sproc_p.c
|
||||
Obsolete. Tests IRIX sproc-based threads.
|
||||
|
||||
stack.c
|
||||
Test atomic stack operations.
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
|
||||
#define SERVER_MAX_BIND_COUNT 100
|
||||
|
||||
#if defined(XP_OS2) || defined(SYMBIAN)
|
||||
#if defined(XP_OS2)
|
||||
#define TIMEOUTSECS 10
|
||||
#else
|
||||
#define TIMEOUTSECS 2
|
||||
|
|
|
@ -33,11 +33,7 @@ static PRStatus PrintAddress(const PRNetAddr* address)
|
|||
static void ConnectingThread(void *arg)
|
||||
{
|
||||
PRInt32 nbytes;
|
||||
#ifdef SYMBIAN
|
||||
char buf[256];
|
||||
#else
|
||||
char buf[1024];
|
||||
#endif
|
||||
PRFileDesc *sock;
|
||||
PRNetAddr peer_addr, *addr;
|
||||
|
||||
|
|
|
@ -48,11 +48,7 @@ static PRStatus PrintAddress(const PRNetAddr* address)
|
|||
static void ConnectingThread(void *arg)
|
||||
{
|
||||
PRInt32 nbytes;
|
||||
#ifdef SYMBIAN
|
||||
char buf[256];
|
||||
#else
|
||||
char buf[1024];
|
||||
#endif
|
||||
PRFileDesc *sock;
|
||||
PRNetAddr peer_addr, *addr;
|
||||
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче