Update NSPR to the NSPR_HEAD_20090828 CVS tag. Contains fixes

for bug 366194, bug 506502, bug 508165, bug 509243, bug 510705,
bug 511315, bug 512806.
This commit is contained in:
Wan-Teh Chang 2009-08-28 19:53:48 -07:00
Родитель 43fe2392f1
Коммит e80d61bf6a
18 изменённых файлов: 201 добавлений и 127 удалений

Просмотреть файл

@ -42,4 +42,3 @@
*/
#error "Do not include this header file."

71
nsprpub/configure поставляемый
Просмотреть файл

@ -2788,6 +2788,7 @@ if test -n "$CROSS_COMPILE"; then
mingw*) OS_ARCH=WINNT ;;
wince*) OS_ARCH=WINCE ;;
darwin*) OS_ARCH=Darwin ;;
riscos*) OS_ARCH=RISCOS ;;
esac
else
OS_ARCH=`uname -s | sed -e 's|/|_|g'`
@ -2974,17 +2975,17 @@ EOF
DSO_LDOPTS='-brtl -bnortllib -bM:SRE -bnoentry -bexpall -blibpath:/usr/lib:/lib'
ac_safe=`echo "sys/atomic_op.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for sys/atomic_op.h""... $ac_c" 1>&6
echo "configure:2978: checking for sys/atomic_op.h" >&5
echo "configure:2979: checking for sys/atomic_op.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2983 "configure"
#line 2984 "configure"
#include "confdefs.h"
#include <sys/atomic_op.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2988: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:2989: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@ -3141,7 +3142,7 @@ EOF
_DEBUG_FLAGS='-gdwarf-2 -O0'
MKSHLIB='$(CCC) $(DSO_LDOPTS) -o $@'
echo $ac_n "checking for gethostbyaddr in -lbind""... $ac_c" 1>&6
echo "configure:3145: checking for gethostbyaddr in -lbind" >&5
echo "configure:3146: checking for gethostbyaddr in -lbind" >&5
ac_lib_var=`echo bind'_'gethostbyaddr | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -3149,7 +3150,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lbind $LIBS"
cat > conftest.$ac_ext <<EOF
#line 3153 "configure"
#line 3154 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -3160,7 +3161,7 @@ int main() {
gethostbyaddr()
; return 0; }
EOF
if { (eval echo configure:3164: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:3165: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -4227,9 +4228,9 @@ EOF
DLLFLAGS='-OUT:"$@"'
if test -n "$MOZ_DEBUG_SYMBOLS"; then
OS_LDFLAGS=-DEBUG -DEBUGTYPE:CV
OS_DLLFLAGS=-DEBUG -DEBUGTYPE:CV
DSO_LDOPTS=-DEBUG -DEBUGTYPE:CV
OS_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
OS_DLLFLAGS='-DEBUG -DEBUGTYPE:CV'
DSO_LDOPTS='-DEBUG -DEBUGTYPE:CV'
fi
_DEBUG_FLAGS=-Zi
_OPTIMIZE_FLAGS=-O2
@ -4506,17 +4507,17 @@ EOF
_OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Olimit 4000"
ac_safe=`echo "machine/builtins.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for machine/builtins.h""... $ac_c" 1>&6
echo "configure:4510: checking for machine/builtins.h" >&5
echo "configure:4511: checking for machine/builtins.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 4515 "configure"
#line 4516 "configure"
#include "confdefs.h"
#include <machine/builtins.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:4520: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:4521: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@ -4605,8 +4606,9 @@ EOF
USE_PTHREADS=1
MDCPUCFG_H=_riscos.cfg
PR_MD_CSRCS=riscos.c
DLL_SUFFIX=a
LD="/home/riscos/env/ro-ar cr"
DSO_CFLAGS=-fPIC
DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
;;
*-*-sco*)
@ -5132,7 +5134,6 @@ EOF
if test -n "$MOZ_OPTIMIZE"; then
DSO_LDOPTS="$DSO_LDOPTS -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
fi
OS_LIBS="-lsocket"
IMPLIB='emximp -o'
FILTER='emxexp -o'
if test -n "$MOZ_OS2_HIGH_MEMORY"; then
@ -5161,11 +5162,11 @@ if test -z "$SKIP_LIBRARY_CHECKS"; then
case $target in
*-darwin*|*-beos*)
*-darwin*|*-beos*|*-os2*)
;;
*)
echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
echo "configure:5169: checking for dlopen in -ldl" >&5
echo "configure:5170: checking for dlopen in -ldl" >&5
ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -5173,7 +5174,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
#line 5177 "configure"
#line 5178 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -5184,7 +5185,7 @@ int main() {
dlopen()
; return 0; }
EOF
if { (eval echo configure:5188: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:5189: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -5201,17 +5202,17 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_safe=`echo "dlfcn.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for dlfcn.h""... $ac_c" 1>&6
echo "configure:5205: checking for dlfcn.h" >&5
echo "configure:5206: checking for dlfcn.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 5210 "configure"
#line 5211 "configure"
#include "confdefs.h"
#include <dlfcn.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:5215: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:5216: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@ -5244,13 +5245,13 @@ esac
if test $ac_cv_prog_gcc = yes; then
echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
echo "configure:5248: checking whether ${CC-cc} needs -traditional" >&5
echo "configure:5249: checking whether ${CC-cc} needs -traditional" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_pattern="Autoconf.*'x'"
cat > conftest.$ac_ext <<EOF
#line 5254 "configure"
#line 5255 "configure"
#include "confdefs.h"
#include <sgtty.h>
Autoconf TIOCGETP
@ -5268,7 +5269,7 @@ rm -f conftest*
if test $ac_cv_prog_gcc_traditional = no; then
cat > conftest.$ac_ext <<EOF
#line 5272 "configure"
#line 5273 "configure"
#include "confdefs.h"
#include <termio.h>
Autoconf TCGETA
@ -5292,12 +5293,12 @@ fi
for ac_func in lchown strerror
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:5296: checking for $ac_func" >&5
echo "configure:5297: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 5301 "configure"
#line 5302 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -5320,7 +5321,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:5324: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:5325: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@ -5361,7 +5362,7 @@ hpux*)
if test -z "$GNU_CC"; then
echo $ac_n "checking for +Olit support""... $ac_c" 1>&6
echo "configure:5365: checking for +Olit support" >&5
echo "configure:5366: checking for +Olit support" >&5
if eval "test \"`echo '$''{'ac_cv_hpux_usable_olit_option'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -5400,7 +5401,7 @@ darwin*)
*)
echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6
echo "configure:5404: checking for pthread_create in -lpthreads" >&5
echo "configure:5405: checking for pthread_create in -lpthreads" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@ -5422,7 +5423,7 @@ echo "
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
echo "configure:5426: checking for pthread_create in -lpthread" >&5
echo "configure:5427: checking for pthread_create in -lpthread" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@ -5444,7 +5445,7 @@ echo "
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6
echo "configure:5448: checking for pthread_create in -lc_r" >&5
echo "configure:5449: checking for pthread_create in -lc_r" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@ -5466,7 +5467,7 @@ echo "
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6
echo "configure:5470: checking for pthread_create in -lc" >&5
echo "configure:5471: checking for pthread_create in -lc" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@ -5598,7 +5599,7 @@ if test -n "$USE_PTHREADS"; then
rm -f conftest*
ac_cv_have_dash_pthread=no
echo $ac_n "checking whether ${CC-cc} accepts -pthread""... $ac_c" 1>&6
echo "configure:5602: checking whether ${CC-cc} accepts -pthread" >&5
echo "configure:5603: checking whether ${CC-cc} accepts -pthread" >&5
echo 'int main() { return 0; }' | cat > conftest.c
${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
if test $? -eq 0; then
@ -5621,7 +5622,7 @@ echo "configure:5602: checking whether ${CC-cc} accepts -pthread" >&5
ac_cv_have_dash_pthreads=no
if test "$ac_cv_have_dash_pthread" = "no"; then
echo $ac_n "checking whether ${CC-cc} accepts -pthreads""... $ac_c" 1>&6
echo "configure:5625: checking whether ${CC-cc} accepts -pthreads" >&5
echo "configure:5626: checking whether ${CC-cc} accepts -pthreads" >&5
echo 'int main() { return 0; }' | cat > conftest.c
${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
if test $? -eq 0; then

Просмотреть файл

@ -649,6 +649,7 @@ if test -n "$CROSS_COMPILE"; then
mingw*) OS_ARCH=WINNT ;;
wince*) OS_ARCH=WINCE ;;
darwin*) OS_ARCH=Darwin ;;
riscos*) OS_ARCH=RISCOS ;;
esac
else
OS_ARCH=`uname -s | sed -e 's|/|_|g'`
@ -1679,9 +1680,9 @@ tools are selected during the Xcode/Developer Tools installation.])
DLLFLAGS='-OUT:"$@"'
if test -n "$MOZ_DEBUG_SYMBOLS"; then
OS_LDFLAGS=-DEBUG -DEBUGTYPE:CV
OS_DLLFLAGS=-DEBUG -DEBUGTYPE:CV
DSO_LDOPTS=-DEBUG -DEBUGTYPE:CV
OS_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
OS_DLLFLAGS='-DEBUG -DEBUGTYPE:CV'
DSO_LDOPTS='-DEBUG -DEBUGTYPE:CV'
fi
_DEBUG_FLAGS=-Zi
_OPTIMIZE_FLAGS=-O2
@ -1881,8 +1882,9 @@ mips-sony-newsos*)
USE_PTHREADS=1
MDCPUCFG_H=_riscos.cfg
PR_MD_CSRCS=riscos.c
DLL_SUFFIX=a
LD="/home/riscos/env/ro-ar cr"
DSO_CFLAGS=-fPIC
DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
;;
*-*-sco*)
@ -2229,7 +2231,6 @@ mips-sony-newsos*)
if test -n "$MOZ_OPTIMIZE"; then
DSO_LDOPTS="$DSO_LDOPTS -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
fi
OS_LIBS="-lsocket"
IMPLIB='emximp -o'
FILTER='emxexp -o'
if test -n "$MOZ_OS2_HIGH_MEMORY"; then
@ -2279,9 +2280,10 @@ dnl AC_CHECK_LIB(vms_jackets, main)
dnl We don't want anything to link with libdl even if it's present on OS X,
dnl since it's not used and not part of the default installation.
dnl The same goes for BeOS.
dnl OS/2 has dlfcn in libc.
case $target in
*-darwin*|*-beos*)
*-darwin*|*-beos*|*-os2*)
;;
*)
AC_CHECK_LIB(dl, dlopen,

Просмотреть файл

@ -184,10 +184,3 @@ else
$(INSTALL) -m 444 $(SHARED_LIBRARY) $(dist_bindir)
endif
endif
ifeq ($(MOZ_BITS),16)
$(INSTALL) -m 444 $(HEADERS) $(MOZ_INCL)
$(INSTALL) -m 444 $(TARGETS) $(MOZ_DIST)/lib
$(INSTALL) -m 444 $(TARGETS) $(MOZ_DIST)/bin
endif

Просмотреть файл

@ -54,8 +54,3 @@ include $(topsrcdir)/config/rules.mk
export:: $(HEADERS)
$(INSTALL) -m 444 $(HEADERS) $(dist_includedir)
ifeq ($(MOZ_BITS),16)
$(INSTALL) -m 444 $(HEADERS) $(MOZ_INCL)
endif

Просмотреть файл

@ -185,8 +185,3 @@ else
$(INSTALL) -m 444 $(SHARED_LIBRARY) $(dist_bindir)
endif
endif
ifeq ($(MOZ_BITS),16)
$(INSTALL) -m 444 $(TARGETS) $(MOZ_DIST)/lib
$(INSTALL) -m 444 $(TARGETS) $(MOZ_DIST)/bin
endif

Просмотреть файл

@ -55,7 +55,3 @@ include $(topsrcdir)/config/rules.mk
export:: $(EXPORT_HEADERS)
$(INSTALL) -m 444 $(EXPORT_HEADERS) $(dist_includedir)
ifeq ($(MOZ_BITS),16)
$(INSTALL) -m 444 $(EXPORT_HEADERS) $(MOZ_INCL)
endif

Просмотреть файл

@ -91,8 +91,3 @@ export:: $(TARGETS)
ifdef SHARED_LIBRARY
$(INSTALL) -m 444 $(SHARED_LIBRARY) $(dist_bindir)
endif
ifeq ($(MOZ_BITS),16)
$(INSTALL) -m 444 $(TARGETS) $(MOZ_DIST)/lib
$(INSTALL) -m 444 $(TARGETS) $(MOZ_DIST)/bin
endif

Просмотреть файл

@ -450,10 +450,12 @@ extern struct PRThread * _MD_CURRENT_THREAD(void);
#define _MD_INIT_STACK(stack, redzone)
#define _MD_CLEAR_STACK(stack)
/* --- Memory-mapped files stuff --- not implemented on OS/2 */
/* --- Memory-mapped files stuff --- */
/* ReadOnly and WriteCopy modes are simulated on OS/2;
* ReadWrite mode is not supported.
*/
struct _MDFileMap {
PRInt8 unused;
PROffset64 maxExtent;
};
extern PRStatus _MD_CreateFileMap(struct PRFileMap *fmap, PRInt64 size);

Просмотреть файл

@ -44,7 +44,7 @@
#define PR_LINKER_ARCH "riscos"
#define _PR_SI_SYSNAME "RISCOS"
#define _PR_SI_ARCHITECTURE "arm"
#define PR_DLL_SUFFIX ".a"
#define PR_DLL_SUFFIX ".so"
#define _PR_POLL_AVAILABLE
#define _PR_USE_POLL
@ -60,8 +60,8 @@
#undef HAVE_STACK_GROWING_UP
#undef HAVE_DLL
#undef USE_DLFCN
#define HAVE_DLL
#define USE_DLFCN
#define NEED_STRFTIME_LOCK
#define NEED_TIME_R
#define PT_NO_SIGTIMEDWAIT

Просмотреть файл

@ -487,6 +487,11 @@ extern PRStatus _PR_KillWindowsProcess(struct PRProcess *process);
/* --- Time --- */
extern void _PR_FileTimeToPRTime(const FILETIME *filetime, PRTime *prtm);
#ifdef WINCE
extern void _MD_InitTime(void);
extern void _MD_CleanupTime(void);
#endif
/* --- Native-Thread Specific Definitions ------------------------------- */
extern struct PRThread * _MD_CURRENT_THREAD(void);

Просмотреть файл

@ -165,6 +165,8 @@ typedef struct PRLibSpec {
#define PR_LD_NOW 0x2 /* equivalent to RTLD_NOW on Unix */
#define PR_LD_GLOBAL 0x4 /* equivalent to RTLD_GLOBAL on Unix */
#define PR_LD_LOCAL 0x8 /* equivalent to RTLD_LOCAL on Unix */
/* The following is equivalent to LOAD_WITH_ALTERED_SEARCH_PATH on Windows */
#define PR_LD_ALT_SEARCH_PATH 0x10
/* 0x8000 reserved for NSPR internal use */
/*

Просмотреть файл

@ -398,14 +398,8 @@ else
$(INSTALL) -m 444 $(SHARED_LIBRARY) $(dist_bindir)
endif
endif
ifeq ($(MOZ_BITS),16)
$(INSTALL) -m 444 $(TARGETS) $(MOZ_DIST)/lib
$(INSTALL) -m 444 $(TARGETS) $(MOZ_DIST)/bin
endif
ifeq ($(BUILD_AIX_RTL_LIBC),1)
$(AIX_RTL_LIBC): /usr/ccs/lib/libc.a
rtl_enable -o $@ $<
endif

Просмотреть файл

@ -188,18 +188,12 @@ void _PR_InitLinker(void)
#if defined(XP_PC)
lm = PR_NEWZAP(PRLibrary);
lm->name = strdup("Executable");
/*
** In WIN32, GetProcAddress(...) expects a module handle in order to
** get exported symbols from the executable...
**
** However, in WIN16 this is accomplished by passing NULL to
** GetProcAddress(...)
*/
#if defined(_WIN32)
lm->dlh = GetModuleHandle(NULL);
#if defined(XP_OS2)
lm->dlh = NULLHANDLE;
#else
lm->dlh = (HINSTANCE)NULL;
#endif /* ! _WIN32 */
/* A module handle for the executable. */
lm->dlh = GetModuleHandle(NULL);
#endif /* ! XP_OS2 */
lm->refCount = 1;
lm->staticTable = NULL;
@ -758,7 +752,9 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags)
{
HINSTANCE h;
h = LoadLibraryW(wname);
h = LoadLibraryExW(wname, NULL,
(flags & PR_LD_ALT_SEARCH_PATH) ?
LOAD_WITH_ALTERED_SEARCH_PATH : 0);
if (h == NULL) {
oserr = _MD_ERRNO();
PR_DELETE(lm);

Просмотреть файл

@ -21,6 +21,7 @@
*
* Contributor(s):
* Davide Bresolin <davide@teamos2.it>
* Rich Walsh <dragtext@e-vertise.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -544,45 +545,109 @@ _PR_MD_WAKEUP_CPUS( void )
return;
}
/*
**********************************************************************
*
* Memory-mapped files are not supported on OS/2 (or Win16).
* Memory-mapped files
*
* A credible emulation of memory-mapped i/o on OS/2 would require
* an exception-handler on each thread that might access the mapped
* memory. In the Mozilla environment, that would be impractical.
* Instead, the following simulates those modes which don't modify
* the mapped file. It reads the entire mapped file segment at once
* when MemMap is called, and frees it on MemUnmap. CreateFileMap
* only does sanity-checks, while CloseFileMap does almost nothing.
*
**********************************************************************
*/
PRStatus _MD_CreateFileMap(PRFileMap *fmap, PRInt64 size)
{
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
return PR_FAILURE;
PRFileInfo64 info;
/* assert on PR_PROT_READWRITE which modifies the underlying file */
PR_ASSERT(fmap->prot == PR_PROT_READONLY ||
fmap->prot == PR_PROT_WRITECOPY);
if (fmap->prot != PR_PROT_READONLY &&
fmap->prot != PR_PROT_WRITECOPY) {
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
return PR_FAILURE;
}
if (PR_GetOpenFileInfo64(fmap->fd, &info) == PR_FAILURE) {
return PR_FAILURE;
}
/* reject zero-byte mappings & zero-byte files */
if (!size || !info.size) {
PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
return PR_FAILURE;
}
/* file size rounded up to the next page boundary */
fmap->md.maxExtent = (info.size + 0xfff) & ~(0xfff);
return PR_SUCCESS;
}
PRInt32 _MD_GetMemMapAlignment(void)
{
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
return -1;
/* OS/2 pages are 4k */
return 0x1000;
}
void * _MD_MemMap(
PRFileMap *fmap,
PROffset64 offset,
PRUint32 len)
void * _MD_MemMap(PRFileMap *fmap, PROffset64 offset, PRUint32 len)
{
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
return NULL;
PRUint32 rv;
void *addr;
/* prevent mappings beyond EOF + remainder of page */
if (offset + len > fmap->md.maxExtent) {
PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
return NULL;
}
if (PR_Seek64(fmap->fd, offset, PR_SEEK_SET) == -1) {
return NULL;
}
/* try for high memory, fall back to low memory if hi-mem fails */
rv = DosAllocMem(&addr, len, OBJ_ANY | PAG_COMMIT | PAG_READ | PAG_WRITE);
if (rv) {
rv = DosAllocMem(&addr, len, PAG_COMMIT | PAG_READ | PAG_WRITE);
if (rv) {
PR_SetError(PR_OUT_OF_MEMORY_ERROR, rv);
return NULL;
}
}
if (PR_Read(fmap->fd, addr, len) == -1) {
DosFreeMem(addr);
return NULL;
}
/* don't permit writes if readonly */
if (fmap->prot == PR_PROT_READONLY) {
rv = DosSetMem(addr, len, PAG_READ);
if (rv) {
DosFreeMem(addr);
PR_SetError(PR_UNKNOWN_ERROR, rv);
return NULL;
}
}
return addr;
}
PRStatus _MD_MemUnmap(void *addr, PRUint32 len)
{
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
return PR_FAILURE;
PRUint32 rv;
/* we just have to trust that addr & len are those used by MemMap */
rv = DosFreeMem(addr);
if (rv) {
PR_SetError(PR_INVALID_ARGUMENT_ERROR, rv);
return PR_FAILURE;
}
return PR_SUCCESS;
}
PRStatus _MD_CloseFileMap(PRFileMap *fmap)
{
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
return PR_FAILURE;
/* nothing to do except free the PRFileMap struct */
PR_Free(fmap);
return PR_SUCCESS;
}

Просмотреть файл

@ -1,4 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@ -76,13 +76,15 @@ PRIntn _PR_MD_PUT_ENV(const char *name)
*/
#ifdef __GNUC__
const PRTime _pr_filetime_offset = 116444736000000000LL;
const PRTime _pr_filetime_divisor = 10LL;
#else
const PRTime _pr_filetime_offset = 116444736000000000i64;
const PRTime _pr_filetime_divisor = 10i64;
#endif
#ifdef WINCE
#define FILETIME2INT64(ft) \
#define FILETIME_TO_INT64(ft) \
(((PRInt64)ft.dwHighDateTime) << 32 | (PRInt64)ft.dwLowDateTime)
static void
@ -108,6 +110,9 @@ typedef struct CalibrationData {
static CalibrationData calibration;
typedef void (*GetSystemTimeAsFileTimeFcn)(LPFILETIME);
static GetSystemTimeAsFileTimeFcn ce6_GetSystemTimeAsFileTime = NULL;
static void
NowCalibrate(void)
{
@ -136,11 +141,11 @@ NowCalibrate(void)
timeEndPeriod(1);
calibration.granularity =
(FILETIME2INT64(ft) - FILETIME2INT64(ftStart))/10;
(FILETIME_TO_INT64(ft) - FILETIME_TO_INT64(ftStart))/10;
QueryPerformanceCounter(&now);
calibration.offset = (long double) FILETIME2INT64(ft);
calibration.offset = (long double) FILETIME_TO_INT64(ft);
calibration.timer_offset = (long double) now.QuadPart;
/*
* The windows epoch is around 1600. The unix epoch is around 1970.
@ -159,27 +164,34 @@ NowCalibrate(void)
#define DATALOCK_SPINCOUNT 4096
#define LASTLOCK_SPINCOUNT 4096
static PRStatus
void
_MD_InitTime(void)
{
memset(&calibration, 0, sizeof(calibration));
NowCalibrate();
InitializeCriticalSection(&calibration.calibration_lock);
InitializeCriticalSection(&calibration.data_lock);
return PR_SUCCESS;
/* try for CE6 GetSystemTimeAsFileTime first */
HANDLE h = GetModuleHandleW(L"coredll.dll");
ce6_GetSystemTimeAsFileTime = (GetSystemTimeAsFileTimeFcn)
GetProcAddressA(h, "GetSystemTimeAsFileTime");
/* otherwise go the slow route */
if (ce6_GetSystemTimeAsFileTime == NULL) {
memset(&calibration, 0, sizeof(calibration));
NowCalibrate();
InitializeCriticalSection(&calibration.calibration_lock);
InitializeCriticalSection(&calibration.data_lock);
}
}
void
_MD_CleanupTime(void)
{
DeleteCriticalSection(&calibration.calibration_lock);
DeleteCriticalSection(&calibration.data_lock);
if (ce6_GetSystemTimeAsFileTime == NULL) {
DeleteCriticalSection(&calibration.calibration_lock);
DeleteCriticalSection(&calibration.data_lock);
}
}
#define MUTEX_SETSPINCOUNT(m, c)
static PRCallOnceType calibrationOnce;
/*
*-----------------------------------------------------------------------
*
@ -205,8 +217,23 @@ PR_Now(void)
PRInt64 returnedTime;
long double cachedOffset = 0.0;
/* For non threadsafe platforms, _MD_InitTime is not necessary */
PR_CallOnce(&calibrationOnce, _MD_InitTime);
if (ce6_GetSystemTimeAsFileTime) {
union {
FILETIME ft;
PRTime prt;
} currentTime;
PR_ASSERT(sizeof(FILETIME) == sizeof(PRTime));
ce6_GetSystemTimeAsFileTime(&currentTime.ft);
/* written this way on purpose, since the second term becomes
* a constant, and the entire expression is faster to execute.
*/
return currentTime.prt/_pr_filetime_divisor -
_pr_filetime_offset/_pr_filetime_divisor;
}
do {
if (!calibration.calibrated || needsCalibration) {
EnterCriticalSection(&calibration.calibration_lock);
@ -233,8 +260,8 @@ PR_Now(void)
/* Calculate a low resolution time */
LowResTime(&ft);
lowresTime = ((long double)(FILETIME2INT64(ft) - _pr_filetime_offset))
* 0.1;
lowresTime =
((long double)(FILETIME_TO_INT64(ft) - _pr_filetime_offset)) * 0.1;
if (calibration.freq > 0.0) {
long double highresTime, diff;

Просмотреть файл

@ -586,6 +586,9 @@ void _PR_InitTime(void)
#ifdef HAVE_LOCALTIME_MONITOR
monitor = PR_NewLock();
#endif
#ifdef WINCE
_MD_InitTime();
#endif
}
void _PR_CleanupTime(void)

Просмотреть файл

@ -456,6 +456,10 @@ EXTRA_LIBS = -ldl
endif
endif
ifeq ($(OS_ARCH),RISCOS)
EXTRA_LIBS = -ldl
endif
ifeq ($(USE_PTHREADS),1)
LIBPTHREAD = -lpthread
ifeq ($(OS_ARCH),AIX)