mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-29 11:57:32 +09:00
Issue #187: Remove solaris conditional code.
This commit is contained in:
parent
471c65b924
commit
78d61fd2b1
26 changed files with 12 additions and 448 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -11,10 +11,6 @@
|
|||
#include <cmath>
|
||||
#include <float.h>
|
||||
|
||||
#ifdef SOLARIS
|
||||
#include <ieeefp.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* round
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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…
Add table
Add a link
Reference in a new issue