Provide workaround in nsPageMgr.cpp if platform (HPUX) doesn't have /dev/zero.
briano, ramiro & warren all looked at the code. (also sneaked in a linking option in for hpux only)
This commit is contained in:
Родитель
137022b011
Коммит
41857cf2bf
30
configure.in
30
configure.in
|
@ -579,7 +579,7 @@ case "$target" in
|
|||
*-hpux*)
|
||||
DLL_SUFFIX="sl"
|
||||
if test ! "$GNU_CC"; then
|
||||
DSO_LDOPTS='-b -E -L$(DIST)/bin'
|
||||
DSO_LDOPTS='-b -E +s -L$(DIST)/bin'
|
||||
DSO_CFLAGS=""
|
||||
DSO_PIC_CFLAGS="+Z"
|
||||
else
|
||||
|
@ -1802,6 +1802,34 @@ else
|
|||
AC_MSG_RESULT(unknown)
|
||||
fi
|
||||
|
||||
dnl Figure out how to 'allocate' paged memory areas (see xpcom/ds/nsPageMgr.cpp)
|
||||
dnl First see if /dev/zero is supported so that we
|
||||
dnl can mmap against it. If not (hpux) then see if
|
||||
dnl if valloc is supported (which is hpux's malloc
|
||||
dnl on paged memory boundary
|
||||
dnl ========================================================
|
||||
|
||||
AC_MSG_CHECKING(for /dev/zero)
|
||||
if test -f /dev/zero; then
|
||||
AC_DEFINE(HAVE_DEV_ZERO)
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_CHECKING(for valloc)
|
||||
AC_CACHE_VAL(ac_cv_valloc,
|
||||
[AC_TRY_COMPILE([#include <stdlib.h>],
|
||||
[void *ptr = valloc(1);],
|
||||
[ac_cv_valloc=true],
|
||||
[ac_cv_valloc=false])])
|
||||
|
||||
if test "$ac_cv_valloc" = true ; then
|
||||
AC_DEFINE(HAVE_VALLOC)
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Check for dll-challenged libc's.
|
||||
dnl This check is apparently only needed for Linux.
|
||||
case "$target" in
|
||||
|
|
|
@ -400,10 +400,10 @@ nsPageMgr::InitPages(nsPageCount minPages, nsPageCount maxPages)
|
|||
nsPageCount size = maxPages;
|
||||
mZero_fd = NULL;
|
||||
|
||||
#ifdef HAVE_DEV_ZERO
|
||||
mZero_fd = open("/dev/zero", O_RDWR);
|
||||
|
||||
while (addr == NULL) {
|
||||
/* let the system place the heap */
|
||||
/* let the system place the heap */
|
||||
addr = (nsPage*)mmap(0, size << NS_PAGEMGR_PAGE_BITS,
|
||||
PROT_READ | PROT_WRITE,
|
||||
MAP_PRIVATE,
|
||||
|
@ -416,6 +416,21 @@ nsPageMgr::InitPages(nsPageCount minPages, nsPageCount maxPages)
|
|||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
#ifdef HAVE_VALLOC
|
||||
while (addr == NULL) {
|
||||
addr = (nsPage*)valloc(size << NS_PAGEMGR_PAGE_BITS);
|
||||
if (NULL == addr) {
|
||||
size--;
|
||||
if (size < minPages) {
|
||||
return PR_FAILURE;
|
||||
}
|
||||
}
|
||||
}
|
||||
memset(addr, '\0', size << NS_PAGEMGR_PAGE_BITS);
|
||||
#endif /* HAVE_VALLOC */
|
||||
#endif /* HAVE_DEV_ZERO */
|
||||
|
||||
PR_ASSERT(NS_PAGEMGR_IS_ALIGNED(addr, NS_PAGEMGR_PAGE_BITS));
|
||||
mMemoryBase = addr;
|
||||
mPageCount = size;
|
||||
|
@ -464,8 +479,14 @@ nsPageMgr::FinalizePages()
|
|||
sys$deltva(&retadr,&retadr2,0);
|
||||
|
||||
#else
|
||||
#ifdef HAVE_DEV_ZERO
|
||||
munmap((caddr_t)mMemoryBase, mPageCount << NS_PAGEMGR_PAGE_BITS);
|
||||
close(mZero_fd);
|
||||
#else /* HAVE_DEV_ZERO */
|
||||
#ifdef HAVE_VALLOC
|
||||
free(mMemoryBase);
|
||||
#endif /* HAVE_VALLOC */
|
||||
#endif /* HAVE_DEV_ZERO */
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче