Browse Source

Issue #187: Remove solaris conditional code.

pull/7/head
wolfbeast 3 years ago committed by Roy Tam
parent
commit
78d61fd2b1
  1. 1
      accessible/tests/mochitest/common.js
  2. 2
      accessible/tests/mochitest/elm/test_nsApplicationAcc.html
  3. 6
      accessible/tests/mochitest/treeupdate/test_contextmenu.xul
  4. 4
      accessible/tests/mochitest/treeupdate/test_menu.xul
  5. 7
      application/basilisk/installer/package-manifest.in
  6. 7
      application/palemoon/installer/package-manifest.in
  7. 4
      dom/base/nsContentUtils.h
  8. 6
      dom/plugins/base/nsPluginsDirUnix.cpp
  9. 7
      gfx/thebes/gfxFontconfigFonts.cpp
  10. 4
      js/src/builtin/TestingFunctions.cpp
  11. 4
      js/src/ctypes/CTypes.cpp
  12. 85
      js/src/gc/Memory.cpp
  13. 12
      js/src/jsapi-tests/testGCAllocator.cpp
  14. 14
      js/src/jsnativestack.cpp
  15. 11
      js/src/vm/Time.cpp
  16. 2
      js/src/wasm/WasmSignalHandlers.cpp
  17. 2
      js/xpconnect/src/XPCShellImpl.cpp
  18. 3
      layout/style/nsRuleNode.cpp
  19. 27
      memory/mozjemalloc/jemalloc.c
  20. 4
      toolkit/mozapps/update/common/updatedefines.h
  21. 82
      toolkit/mozapps/update/updater/updater.cpp
  22. 55
      toolkit/xre/nsSigHandlers.cpp
  23. 8
      xpcom/base/nsDebugImpl.cpp
  24. 83
      xpcom/base/nsMemoryReporterManager.cpp
  25. 4
      xpcom/ds/nsMathUtils.h
  26. 16
      xpcom/io/nsLocalFileUnix.cpp

1
accessible/tests/mochitest/common.js

@ -59,7 +59,6 @@ const nsIPropertyElement = Components.interfaces.nsIPropertyElement;
const MAC = (navigator.platform.indexOf("Mac") != -1);
const LINUX = (navigator.platform.indexOf("Linux") != -1);
const SOLARIS = (navigator.platform.indexOf("SunOS") != -1);
const WIN = (navigator.platform.indexOf("Win") != -1);
////////////////////////////////////////////////////////////////////////////////

2
accessible/tests/mochitest/elm/test_nsApplicationAcc.html

@ -32,7 +32,7 @@
// nsIAccessible::name
var applicationName = "";
if (LINUX || SOLARIS) {
if (LINUX) {
applicationName = appInfo.name;
} else {
try {

6
accessible/tests/mochitest/treeupdate/test_contextmenu.xul

@ -130,7 +130,7 @@
*/
function getMenuTree1()
{
if (LINUX || SOLARIS) {
if (LINUX) {
var tree = {
role: ROLE_MENUPOPUP,
children: [
@ -190,7 +190,7 @@
function getMenuTree2()
{
var tree = getMenuTree1();
if (LINUX || SOLARIS) {
if (LINUX) {
var submenuTree =
{
name: "item2.0",
@ -232,7 +232,7 @@
children: []
};
if (LINUX || SOLARIS)
if (LINUX)
tree.children[2].children[0].children.push(subsubmenuTree);
else
tree.children[2].children[0].children[0].children[0].children.push(subsubmenuTree);

4
accessible/tests/mochitest/treeupdate/test_menu.xul

@ -32,7 +32,7 @@
this.invoke = function openMenu_invoke()
{
var tree;
if (LINUX || SOLARIS) {
if (LINUX) {
tree =
{ PARENT_MENUITEM: [ ] };
@ -51,7 +51,7 @@
this.finalCheck = function openMenu_finalCheck()
{
var tree;
if (LINUX || SOLARIS) {
if (LINUX) {
tree =
{ PARENT_MENUITEM: [
{ MENUITEM: [ ] },

7
application/basilisk/installer/package-manifest.in

@ -725,13 +725,6 @@
@RESPATH@/components/pipnss.xpt
@RESPATH@/components/pippki.xpt
; for Solaris SPARC
#ifdef SOLARIS
bin/libfreebl_32fpu_3.so
bin/libfreebl_32int_3.so
bin/libfreebl_32int64_3.so
#endif
; [Updater]
;
#ifdef MOZ_UPDATER

7
application/palemoon/installer/package-manifest.in

@ -318,13 +318,6 @@
@RESPATH@/chrome/pippki@JAREXT@
@RESPATH@/chrome/pippki.manifest
; for Solaris SPARC
#ifdef SOLARIS
bin/libfreebl_32fpu_3.so
bin/libfreebl_32int_3.so
bin/libfreebl_32int64_3.so
#endif
; [Updater]
;
#ifdef MOZ_UPDATER

4
dom/base/nsContentUtils.h

@ -13,10 +13,6 @@
#include <float.h>
#endif
#if defined(SOLARIS)
#include <ieeefp.h>
#endif
#include "js/TypeDecls.h"
#include "js/Value.h"
#include "js/RootingAPI.h"

6
dom/plugins/base/nsPluginsDirUnix.cpp

@ -27,8 +27,6 @@
#elif defined(_AIX)
#define DEFAULT_X11_PATH "/usr/lib"
#define LOCAL_PLUGIN_DLL_ALT_SUFFIX ".a"
#elif defined(SOLARIS)
#define DEFAULT_X11_PATH "/usr/openwin/lib/"
#elif defined(LINUX)
#define DEFAULT_X11_PATH "/usr/X11R6/lib/"
#elif defined(__APPLE__)
@ -102,7 +100,7 @@ static bool LoadExtraSharedLib(const char *name, char **soname, bool tryToGetSon
#define PLUGIN_MAX_NUMBER_OF_EXTRA_LIBS 32
#define PREF_PLUGINS_SONAME "plugin.soname.list"
#if defined(SOLARIS) || defined(HPUX)
#if defined(HPUX)
#define DEFAULT_EXTRA_LIBS_LIST "libXt" LOCAL_PLUGIN_DLL_SUFFIX ":libXext" LOCAL_PLUGIN_DLL_SUFFIX ":libXm" LOCAL_PLUGIN_DLL_SUFFIX
#else
#define DEFAULT_EXTRA_LIBS_LIST "libXt" LOCAL_PLUGIN_DLL_SUFFIX ":libXext" LOCAL_PLUGIN_DLL_SUFFIX
@ -280,7 +278,7 @@ nsresult nsPluginFile::LoadPlugin(PRLibrary **outLibrary)
// work fine.
#if defined(SOLARIS) || defined(HPUX)
#if defined(HPUX)
// Acrobat/libXm: Lazy resolving might cause crash later (bug 211587)
*outLibrary = PR_LoadLibraryWithFlags(libSpec, PR_LD_NOW);
pLibrary = *outLibrary;

7
gfx/thebes/gfxFontconfigFonts.cpp

@ -1096,15 +1096,8 @@ gfxFcFontSet::SortPreferredFonts(bool &aWaitForUserFont)
FcFontSet *sets[1] = { fontSet };
FcResult result;
#ifdef SOLARIS
// Get around a crash of FcFontSetSort when FcConfig is nullptr
// Solaris's FcFontSetSort needs an FcConfig (bug 474758)
fontSet.own(FcFontSetSort(FcConfigGetCurrent(), sets, 1, mSortPattern,
FcFalse, nullptr, &result));
#else
fontSet.own(FcFontSetSort(nullptr, sets, 1, mSortPattern,
FcFalse, nullptr, &result));
#endif
if (truncateMarker != nullptr && fontSet) {
nsAutoRef<FcFontSet> truncatedSet(FcFontSetCreate());

4
js/src/builtin/TestingFunctions.cpp

@ -240,11 +240,7 @@ GetBuildConfiguration(JSContext* cx, unsigned argc, Value* vp)
if (!JS_SetProperty(cx, info, "intl-api", value))
return false;
#if defined(SOLARIS)
value = BooleanValue(false);
#else
value = BooleanValue(true);
#endif
if (!JS_SetProperty(cx, info, "mapped-array-buffer", value))
return false;

4
js/src/ctypes/CTypes.cpp

@ -20,10 +20,6 @@
#include <float.h>
#endif
#if defined(SOLARIS)
#include <ieeefp.h>
#endif
#ifdef HAVE_SSIZE_T
#include <sys/types.h>
#endif

85
js/src/gc/Memory.cpp

@ -17,11 +17,6 @@
#include "jswin.h"
#include <psapi.h>
#elif defined(SOLARIS)
#include <sys/mman.h>
#include <unistd.h>
#elif defined(XP_UNIX)
#include <algorithm>
@ -408,86 +403,6 @@ DeallocateMappedContent(void* p, size_t length)
# endif
#elif defined(SOLARIS)
#ifndef MAP_NOSYNC
# define MAP_NOSYNC 0
#endif
void
InitMemorySubsystem()
{
if (pageSize == 0)
pageSize = allocGranularity = size_t(sysconf(_SC_PAGESIZE));
}
void*
MapAlignedPages(size_t size, size_t alignment)
{
MOZ_ASSERT(size >= alignment);
MOZ_ASSERT(size >= allocGranularity);
MOZ_ASSERT(size % alignment == 0);
MOZ_ASSERT(size % pageSize == 0);
MOZ_ASSERT_IF(alignment < allocGranularity, allocGranularity % alignment == 0);
MOZ_ASSERT_IF(alignment > allocGranularity, alignment % allocGranularity == 0);
int prot = PROT_READ | PROT_WRITE;
int flags = MAP_PRIVATE | MAP_ANON | MAP_ALIGN | MAP_NOSYNC;
void* p = mmap((caddr_t)alignment, size, prot, flags, -1, 0);
if (p == MAP_FAILED)
return nullptr;
return p;
}
static void*
MapAlignedPagesLastDitch(size_t size, size_t alignment)
{
return nullptr;
}
void
UnmapPages(void* p, size_t size)
{
MOZ_ALWAYS_TRUE(0 == munmap((caddr_t)p, size));
}
bool
MarkPagesUnused(void* p, size_t size)
{
MOZ_ASSERT(OffsetFromAligned(p, pageSize) == 0);
return true;
}
bool
MarkPagesInUse(void* p, size_t size)
{
if (!DecommitEnabled())
return;
MOZ_ASSERT(OffsetFromAligned(p, pageSize) == 0);
}
size_t
GetPageFaultCount()
{
return 0;
}
void*
AllocateMappedContent(int fd, size_t offset, size_t length, size_t alignment)
{
// Not implemented.
return nullptr;
}
// Deallocate mapped memory for object.
void
DeallocateMappedContent(void* p, size_t length)
{
// Not implemented.
}
#elif defined(XP_UNIX)
void

12
js/src/jsapi-tests/testGCAllocator.cpp

@ -14,8 +14,6 @@
#if defined(XP_WIN)
#include "jswin.h"
#include <psapi.h>
#elif defined(SOLARIS)
// This test doesn't apply to Solaris.
#elif defined(XP_UNIX)
#include <algorithm>
#include <errno.h>
@ -39,8 +37,6 @@ BEGIN_TEST(testGCAllocator)
# else // Various APIs are unavailable. This test is disabled.
return true;
# endif
#elif defined(SOLARIS)
return true;
#elif defined(XP_UNIX)
PageSize = size_t(sysconf(_SC_PAGESIZE));
#else
@ -301,12 +297,6 @@ void* mapMemory(size_t length) { return nullptr; }
void unmapPages(void* p, size_t size) { }
# endif
#elif defined(SOLARIS) // This test doesn't apply to Solaris.
void* mapMemoryAt(void* desired, size_t length) { return nullptr; }
void* mapMemory(size_t length) { return nullptr; }
void unmapPages(void* p, size_t size) { }
#elif defined(XP_UNIX)
void*
@ -377,7 +367,7 @@ unmapPages(void* p, size_t size)
MOZ_RELEASE_ASSERT(errno == ENOMEM);
}
#else // !defined(XP_WIN) && !defined(SOLARIS) && !defined(XP_UNIX)
#else // !defined(XP_WIN) && !defined(XP_UNIX)
#error "Memory mapping functions are not defined for your OS."
#endif
END_TEST(testGCAllocator)

14
js/src/jsnativestack.cpp

@ -71,20 +71,6 @@ js::GetNativeStackBaseImpl()
# endif
}
#elif defined(SOLARIS)
#include <ucontext.h>
JS_STATIC_ASSERT(JS_STACK_GROWTH_DIRECTION < 0);
void*
js::GetNativeStackBaseImpl()
{
stack_t st;
stack_getbounds(&st);
return static_cast<char*>(st.ss_sp) + st.ss_size;
}
#elif defined(AIX)
#include <ucontext.h>

11
js/src/vm/Time.cpp

@ -11,9 +11,6 @@
#include "mozilla/DebugOnly.h"
#include "mozilla/MathAlgorithms.h"
#ifdef SOLARIS
#define _REENTRANT 1
#endif
#include <string.h>
#include <time.h>
@ -33,10 +30,6 @@
#ifdef XP_UNIX
#ifdef _SVID_GETTOD /* Defined only on Solaris, see Solaris <sys/types.h> */
extern int gettimeofday(struct timeval* tv);
#endif
#include <sys/time.h>
#endif /* XP_UNIX */
@ -49,11 +42,7 @@ PRMJ_Now()
{
struct timeval tv;
#ifdef _SVID_GETTOD /* Defined only on Solaris, see Solaris <sys/types.h> */
gettimeofday(&tv);
#else
gettimeofday(&tv, 0);
#endif /* _SVID_GETTOD */
return int64_t(tv.tv_sec) * PRMJ_USEC_PER_SEC + int64_t(tv.tv_usec);
}

2
js/src/wasm/WasmSignalHandlers.cpp

@ -130,7 +130,7 @@ class AutoSetHandlingSegFault
# define EPC_sig(p) ((p)->sc_pc)
# define RFP_sig(p) ((p)->sc_regs[30])
# endif
#elif defined(__linux__) || defined(SOLARIS)
#elif defined(__linux__)
# if defined(__linux__)
# define XMM_sig(p,i) ((p)->uc_mcontext.fpregs->_xmm[i])
# define EIP_sig(p) ((p)->uc_mcontext.gregs[REG_EIP])

2
js/xpconnect/src/XPCShellImpl.cpp

@ -644,7 +644,6 @@ env_setProperty(JSContext* cx, HandleObject obj, HandleId id, MutableHandleValue
ObjectOpResult& result)
{
/* XXX porting may be easy, but these don't seem to supply setenv by default */
#if !defined SOLARIS
RootedString valstr(cx);
RootedString idstr(cx);
int rv;
@ -696,7 +695,6 @@ env_setProperty(JSContext* cx, HandleObject obj, HandleId id, MutableHandleValue
return false;
}
vp.setString(valstr);
#endif /* !defined SOLARIS */
return result.succeed();
}

3
layout/style/nsRuleNode.cpp

@ -67,9 +67,6 @@
#define alloca _alloca
#endif
#endif
#ifdef SOLARIS
#include <alloca.h>
#endif
using std::max;
using std::min;

27
memory/mozjemalloc/jemalloc.c

@ -283,9 +283,7 @@ typedef long ssize_t;
#define JEMALLOC_RECYCLE
#ifndef MOZ_MEMORY_WINDOWS
#ifndef MOZ_MEMORY_SOLARIS
#include <sys/cdefs.h>
#endif
#ifndef __DECONST
# define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var))
#endif
@ -311,7 +309,7 @@ __FBSDID("$FreeBSD: head/lib/libc/stdlib/malloc.c 180599 2008-07-18 19:35:44Z ja
#endif
#include <sys/time.h>
#include <sys/types.h>
#if !defined(MOZ_MEMORY_SOLARIS) && !defined(MOZ_MEMORY_ANDROID)
#if !defined(MOZ_MEMORY_ANDROID)
#include <sys/sysctl.h>
#endif
#include <sys/uio.h>
@ -413,10 +411,6 @@ void *_mmap(void *addr, size_t length, int prot, int flags,
#endif
#endif
#if defined(MOZ_MEMORY_SOLARIS) && defined(MAP_ALIGN) && !defined(JEMALLOC_NEVER_USES_MAP_ALIGN)
#define JEMALLOC_USES_MAP_ALIGN /* Required on Solaris 10. Might improve performance elsewhere. */
#endif
#ifndef __DECONST
#define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var))
#endif
@ -1043,7 +1037,7 @@ static const bool config_recycle = false;
* will abort.
* Platform specific page size conditions copied from js/public/HeapAPI.h
*/
#if (defined(SOLARIS) || defined(__FreeBSD__)) && \
#if (defined(__FreeBSD__)) && \
(defined(__sparc) || defined(__sparcv9) || defined(__ia64))
#define pagesize_2pow ((size_t) 13)
#elif defined(__powerpc64__)
@ -5131,13 +5125,6 @@ malloc_ncpus(void)
else
return (n);
}
#elif (defined(MOZ_MEMORY_SOLARIS))
static inline unsigned
malloc_ncpus(void)
{
return sysconf(_SC_NPROCESSORS_ONLN);
}
#elif (defined(MOZ_MEMORY_WINDOWS))
static inline unsigned
malloc_ncpus(void)
@ -5934,19 +5921,9 @@ RETURN:
#define MOZ_MEMORY_ELF
#endif
#ifdef MOZ_MEMORY_SOLARIS
# ifdef __SUNPRO_C
void *
memalign_impl(size_t alignment, size_t size);
#pragma no_inline(memalign_impl)
# elif (defined(__GNUC__))
__attribute__((noinline))
# endif
#else
#if (defined(MOZ_MEMORY_ELF))
__attribute__((visibility ("hidden")))
#endif
#endif
#endif /* MOZ_REPLACE_MALLOC */
#ifdef MOZ_MEMORY_ELF

4
toolkit/mozapps/update/common/updatedefines.h

@ -96,11 +96,7 @@ static inline int mywcsprintf(WCHAR* dest, size_t count, const WCHAR* fmt, ...)
# include <sys/wait.h>
# include <unistd.h>
#ifdef SOLARIS
# include <sys/stat.h>
#else
# include <fts.h>
#endif
# include <dirent.h>
#ifdef XP_MACOSX

82
toolkit/mozapps/update/updater/updater.cpp

@ -3648,88 +3648,6 @@ int add_dir_entries(const NS_tchar *dirpath, ActionList *list)
return rv;
}
#elif defined(SOLARIS)
int add_dir_entries(const NS_tchar *dirpath, ActionList *list)
{
int rv = OK;
NS_tchar foundpath[MAXPATHLEN];
struct {
dirent dent_buffer;
char chars[MAXNAMLEN];
} ent_buf;
struct dirent* ent;
mozilla::UniquePtr<NS_tchar[]> searchpath(get_full_path(dirpath));
DIR* dir = opendir(searchpath.get());
if (!dir) {
LOG(("add_dir_entries error on opendir: " LOG_S ", err: %d", searchpath.get(),
errno));
return UNEXPECTED_FILE_OPERATION_ERROR;
}
while (readdir_r(dir, (dirent *)&ent_buf, &ent) == 0 && ent) {
if ((strcmp(ent->d_name, ".") == 0) ||
(strcmp(ent->d_name, "..") == 0))
continue;
NS_tsnprintf(foundpath, sizeof(foundpath)/sizeof(foundpath[0]),
NS_T("%s%s"), searchpath.get(), ent->d_name);
struct stat64 st_buf;
int test = stat64(foundpath, &st_buf);
if (test) {
closedir(dir);
return UNEXPECTED_FILE_OPERATION_ERROR;
}
if (S_ISDIR(st_buf.st_mode)) {
NS_tsnprintf(foundpath, sizeof(foundpath)/sizeof(foundpath[0]),
NS_T("%s/"), foundpath);
// Recurse into the directory.
rv = add_dir_entries(foundpath, list);
if (rv) {
LOG(("add_dir_entries error: " LOG_S ", err: %d", foundpath, rv));
closedir(dir);
return rv;
}
} else {
// Add the file to be removed to the ActionList.
NS_tchar *quotedpath = get_quoted_path(get_relative_path(foundpath));
if (!quotedpath) {
closedir(dir);
return PARSE_ERROR;
}
Action *action = new RemoveFile();
rv = action->Parse(quotedpath);
if (rv) {
LOG(("add_dir_entries Parse error on recurse: " LOG_S ", err: %d",
quotedpath, rv));
closedir(dir);
return rv;
}
list->Append(action);
}
}
closedir(dir);
// Add the directory to be removed to the ActionList.
NS_tchar *quotedpath = get_quoted_path(get_relative_path(dirpath));
if (!quotedpath)
return PARSE_ERROR;
Action *action = new RemoveDir();
rv = action->Parse(quotedpath);
if (rv) {
LOG(("add_dir_entries Parse error on close: " LOG_S ", err: %d",
quotedpath, rv));
}
else {
list->Append(action);
}
return rv;
}
#else
int add_dir_entries(const NS_tchar *dirpath, ActionList *list)

55
toolkit/xre/nsSigHandlers.cpp

@ -32,11 +32,6 @@
#endif
#endif
#if defined(SOLARIS)
#include <sys/resource.h>
#include <ucontext.h>
#endif
static const char* gProgname = "huh?";
// Note: some tests manipulate this value.
@ -198,32 +193,6 @@ static void fpehandler(int signum, siginfo_t *si, void *context)
*mxcsr &= ~SSE_STATUS_FLAGS; /* clear all pending SSE exceptions */
#endif
#endif
#ifdef SOLARIS
ucontext_t *uc = (ucontext_t *)context;
#if defined(__i386)
uint32_t *cw = &uc->uc_mcontext.fpregs.fp_reg_set.fpchip_state.state[0];
*cw |= FPU_EXCEPTION_MASK;
uint32_t *sw = &uc->uc_mcontext.fpregs.fp_reg_set.fpchip_state.state[1];
*sw &= ~FPU_STATUS_FLAGS;
/* address of the instruction that caused the exception */
uint32_t *ip = &uc->uc_mcontext.fpregs.fp_reg_set.fpchip_state.state[3];
uc->uc_mcontext.gregs[REG_PC] = *ip;
#endif
#if defined(__amd64__)
uint16_t *cw = &uc->uc_mcontext.fpregs.fp_reg_set.fpchip_state.cw;
*cw |= FPU_EXCEPTION_MASK;
uint16_t *sw = &uc->uc_mcontext.fpregs.fp_reg_set.fpchip_state.sw;
*sw &= ~FPU_STATUS_FLAGS;
uint32_t *mxcsr = &uc->uc_mcontext.fpregs.fp_reg_set.fpchip_state.mxcsr;
*mxcsr |= SSE_EXCEPTION_MASK; /* disable all SSE exceptions */
*mxcsr &= ~SSE_STATUS_FLAGS; /* clear all pending SSE exceptions */
#endif
#endif
}
#endif
@ -286,30 +255,6 @@ void InstallSignalHandlers(const char *aProgname)
}
#endif
#if defined(SOLARIS)
#define NOFILES 512
// Boost Solaris file descriptors
{
struct rlimit rl;
if (getrlimit(RLIMIT_NOFILE, &rl) == 0)
if (rl.rlim_cur < NOFILES) {
rl.rlim_cur = NOFILES;
if (setrlimit(RLIMIT_NOFILE, &rl) < 0) {
perror("setrlimit(RLIMIT_NOFILE)");
fprintf(stderr, "Cannot exceed hard limit for open files");
}
#if defined(DEBUG)
if (getrlimit(RLIMIT_NOFILE, &rl) == 0)
printf("File descriptors set to %d\n", rl.rlim_cur);
#endif //DEBUG
}
}
#endif //SOLARIS
#if defined(MOZ_WIDGET_GTK) && (GLIB_MAJOR_VERSION > 2 || (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION >= 6))
const char *assertString = PR_GetEnv("XPCOM_DEBUG_BREAK");
if (assertString &&

8
xpcom/base/nsDebugImpl.cpp

@ -450,12 +450,6 @@ RealBreak()
".object_arch armv4t\n"
#endif
"BKPT #0");
#elif defined(SOLARIS)
#if defined(__i386__) || defined(__i386) || defined(__x86_64__)
asm("int $3");
#else
raise(SIGTRAP);
#endif
#else
#warning do not know how to break on this platform
#endif
@ -530,8 +524,6 @@ Break(const char* aMsg)
RealBreak();
#elif defined(__arm__)
RealBreak();
#elif defined(SOLARIS)
RealBreak();
#else
#warning do not know how to break on this platform
#endif

83
xpcom/base/nsMemoryReporterManager.cpp

@ -317,85 +317,6 @@ VsizeMaxContiguousDistinguishedAmount(int64_t* aN)
}
#endif // FreeBSD
#elif defined(SOLARIS)
#include <procfs.h>
#include <fcntl.h>
#include <unistd.h>
static void
XMappingIter(int64_t& aVsize, int64_t& aResident)
{
aVsize = -1;
aResident = -1;
int mapfd = open("/proc/self/xmap", O_RDONLY);
struct stat st;
prxmap_t* prmapp = nullptr;
if (mapfd >= 0) {
if (!fstat(mapfd, &st)) {
int nmap = st.st_size / sizeof(prxmap_t);
while (1) {
// stat(2) on /proc/<pid>/xmap returns an incorrect value,
// prior to the release of Solaris 11.
// Here is a workaround for it.
nmap *= 2;
prmapp = (prxmap_t*)malloc((nmap + 1) * sizeof(prxmap_t));
if (!prmapp) {
// out of memory
break;
}
int n = pread(mapfd, prmapp, (nmap + 1) * sizeof(prxmap_t), 0);
if (n < 0) {
break;
}
if (nmap >= n / sizeof(prxmap_t)) {
aVsize = 0;
aResident = 0;
for (int i = 0; i < n / sizeof(prxmap_t); i++) {
aVsize += prmapp[i].pr_size;
aResident += prmapp[i].pr_rss * prmapp[i].pr_pagesize;
}
break;
}
free(prmapp);
}
free(prmapp);
}
close(mapfd);
}
}
#define HAVE_VSIZE_AND_RESIDENT_REPORTERS 1
static MOZ_MUST_USE nsresult
VsizeDistinguishedAmount(int64_t* aN)
{
int64_t vsize, resident;
XMappingIter(vsize, resident);
if (vsize == -1) {
return NS_ERROR_FAILURE;
}
*aN = vsize;
return NS_OK;
}
static MOZ_MUST_USE nsresult
ResidentDistinguishedAmount(int64_t* aN)
{
int64_t vsize, resident;
XMappingIter(vsize, resident);
if (resident == -1) {
return NS_ERROR_FAILURE;
}
*aN = resident;
return NS_OK;
}
static MOZ_MUST_USE nsresult
ResidentFastDistinguishedAmount(int64_t* aN)
{
return ResidentDistinguishedAmount(aN);
}
#elif defined(XP_MACOSX)
#include <mach/mach_init.h>
@ -1145,13 +1066,9 @@ ResidentPeakDistinguishedAmount(int64_t* aN)
if (0 == getrusage(RUSAGE_SELF, &usage)) {
// The units for ru_maxrrs:
// - Mac: bytes
// - Solaris: pages? But some sources it actually always returns 0, so
// check for that
// - Linux, {Net/Open/Free}BSD, DragonFly: KiB
#ifdef XP_MACOSX
*aN = usage.ru_maxrss;
#elif defined(SOLARIS)
*aN = usage.ru_maxrss * getpagesize();
#else
*aN = usage.ru_maxrss * 1024;
#endif

4
xpcom/ds/nsMathUtils.h

@ -11,10 +11,6 @@
#include <cmath>
#include <float.h>
#ifdef SOLARIS
#include <ieeefp.h>
#endif
/*
* round
*/

16
xpcom/io/nsLocalFileUnix.cpp

@ -1591,22 +1591,6 @@ nsLocalFile::IsExecutable(bool* aResult)
// Then check the execute bit.
*aResult = (access(mPath.get(), X_OK) == 0);
#ifdef SOLARIS
// On Solaris, access will always return 0 for root user, however
// the file is only executable if S_IXUSR | S_IXGRP | S_IXOTH is set.
// See bug 351950, https://bugzilla.mozilla.org/show_bug.cgi?id=351950
if (*aResult) {
struct STAT buf;
*aResult = (STAT(mPath.get(), &buf) == 0);
if (*aResult || errno == EACCES) {
*aResult = *aResult && (buf.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH));
return NS_OK;
}
return NSRESULT_FOR_ERRNO();
}
#endif
if (*aResult || errno == EACCES) {
return NS_OK;
}

Loading…
Cancel
Save