summaryrefslogtreecommitdiffstats
path: root/toolkit
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2019-11-02 14:37:22 +0100
committerGitHub <noreply@github.com>2019-11-02 14:37:22 +0100
commit21b3f6247403c06f85e1f45d219f87549862198f (patch)
tree0038ae92f1cc7aaff0b55d6e5ac59efcc28bdf8f /toolkit
parentff881bdb6795e0f307b93919f98f454bedde4bb6 (diff)
parenta9dc528a4a7b0aaad5308aff70963485ec3e9bec (diff)
downloadUXP-21b3f6247403c06f85e1f45d219f87549862198f.tar
UXP-21b3f6247403c06f85e1f45d219f87549862198f.tar.gz
UXP-21b3f6247403c06f85e1f45d219f87549862198f.tar.lz
UXP-21b3f6247403c06f85e1f45d219f87549862198f.tar.xz
UXP-21b3f6247403c06f85e1f45d219f87549862198f.zip
Merge pull request #1262 from athenian200/solaris-work
Support Modern Solaris
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/components/osfile/modules/osfile_unix_back.jsm16
-rw-r--r--toolkit/components/terminator/nsTerminator.cpp6
-rw-r--r--toolkit/library/StaticXULComponentsEnd/StaticXULComponentsEnd.cpp5
-rw-r--r--toolkit/library/StaticXULComponentsStart.cpp5
-rw-r--r--toolkit/library/libxul.mk10
-rw-r--r--toolkit/library/moz.build7
-rw-r--r--toolkit/mozapps/update/common/updatedefines.h4
-rw-r--r--toolkit/mozapps/update/updater/updater.cpp82
-rw-r--r--toolkit/xre/nsSigHandlers.cpp56
9 files changed, 181 insertions, 10 deletions
diff --git a/toolkit/components/osfile/modules/osfile_unix_back.jsm b/toolkit/components/osfile/modules/osfile_unix_back.jsm
index bf5c66b8d..7c2c6f28d 100644
--- a/toolkit/components/osfile/modules/osfile_unix_back.jsm
+++ b/toolkit/components/osfile/modules/osfile_unix_back.jsm
@@ -585,10 +585,18 @@
} else if (Const._STAT_VER != undefined) {
const ver = Const._STAT_VER;
let xstat_name, lxstat_name, fxstat_name;
- // Linux, all widths
- xstat_name = "__xstat";
- lxstat_name = "__lxstat";
- fxstat_name = "__fxstat";
+ if (OS.Constants.Sys.Name == "SunOS") {
+ // Solaris
+ xstat_name = "_xstat";
+ lxstat_name = "_lxstat";
+ fxstat_name = "_fxstat";
+ } else {
+
+ // Linux, all widths
+ xstat_name = "__xstat";
+ lxstat_name = "__lxstat";
+ fxstat_name = "__fxstat";
+ }
let Stat = {};
libc.declareLazyFFI(Stat, "xstat",
diff --git a/toolkit/components/terminator/nsTerminator.cpp b/toolkit/components/terminator/nsTerminator.cpp
index 91e872821..9f6a90b57 100644
--- a/toolkit/components/terminator/nsTerminator.cpp
+++ b/toolkit/components/terminator/nsTerminator.cpp
@@ -30,7 +30,7 @@
#include "nsIObserverService.h"
#include "nsIPrefService.h"
-#if defined(XP_WIN)
+#ifdef XP_WIN
#include <windows.h>
#else
#include <unistd.h>
@@ -385,7 +385,11 @@ nsTerminator::StartWatchdog()
}
UniquePtr<Options> options(new Options());
+#ifdef XP_SOLARIS
const PRIntervalTime ticksDuration = PR_MillisecondsToInterval(1000);
+#else
+ const PRIntervalTime ticksDuration = 1000;
+#endif
options->crashAfterTicks = crashAfterMS / ticksDuration;
DebugOnly<PRThread*> watchdogThread = CreateSystemThread(RunWatchdog,
diff --git a/toolkit/library/StaticXULComponentsEnd/StaticXULComponentsEnd.cpp b/toolkit/library/StaticXULComponentsEnd/StaticXULComponentsEnd.cpp
index 28fd9d484..8b5b1f4cb 100644
--- a/toolkit/library/StaticXULComponentsEnd/StaticXULComponentsEnd.cpp
+++ b/toolkit/library/StaticXULComponentsEnd/StaticXULComponentsEnd.cpp
@@ -10,4 +10,7 @@
# undef NSMODULE_SECTION
# define NSMODULE_SECTION __declspec(allocate(".kPStaticModules$Z"), dllexport)
#endif
-NSMODULE_DEFN(end_kPStaticModules) = nullptr;
+/* This could be null, but this needs a dummy value to ensure it actually ends
+ * up in the same section as other NSMODULE_DEFNs, instead of being moved to a
+ * separate readonly section. */
+NSMODULE_DEFN(end_kPStaticModules) = (mozilla::Module*)&NSMODULE_NAME(end_kPStaticModules);
diff --git a/toolkit/library/StaticXULComponentsStart.cpp b/toolkit/library/StaticXULComponentsStart.cpp
index 1738aa810..d2e9a8828 100644
--- a/toolkit/library/StaticXULComponentsStart.cpp
+++ b/toolkit/library/StaticXULComponentsStart.cpp
@@ -1,3 +1,6 @@
#include "mozilla/Module.h"
-NSMODULE_DEFN(start_kPStaticModules) = nullptr;
+/* This could be null, but this needs a dummy value to ensure it actually ends
+ * up in the same section as other NSMODULE_DEFNs, instead of being moved to a
+ * separate readonly section. */
+NSMODULE_DEFN(start_kPStaticModules) = (mozilla::Module*)&NSMODULE_NAME(start_kPStaticModules);
diff --git a/toolkit/library/libxul.mk b/toolkit/library/libxul.mk
index 9e7e8beee..80f934e60 100644
--- a/toolkit/library/libxul.mk
+++ b/toolkit/library/libxul.mk
@@ -16,10 +16,10 @@ EXTRA_DEPS += symverscript
endif
endif
-# Generate GDB pretty printer-autoload files only on Linux. OSX's GDB is
+# Generate GDB pretty printer-autoload files on Linux and Solaris. OSX's GDB is
# too old to support Python pretty-printers; if this changes, we could make
# this 'ifdef GNU_CC'.
-ifeq (Linux,$(OS_ARCH))
+ifeq (,$(filter-out SunOS Linux,$(OS_ARCH)))
# Create a GDB Python auto-load file alongside the libxul shared library in
# the build directory.
PP_TARGETS += LIBXUL_AUTOLOAD
@@ -27,6 +27,10 @@ LIBXUL_AUTOLOAD = $(topsrcdir)/toolkit/library/libxul.so-gdb.py.in
LIBXUL_AUTOLOAD_FLAGS := -Dtopsrcdir=$(abspath $(topsrcdir))
endif
+ifeq ($(OS_ARCH),SunOS)
+OS_LDFLAGS += -Wl,-z,defs
+endif
+
# BFD ld doesn't create multiple PT_LOADs as usual when an unknown section
# exists. Using an implicit linker script to make it fold that section in
# .data.rel.ro makes it create multiple PT_LOADs. That implicit linker
@@ -50,6 +54,6 @@ endif
LOCAL_CHECKS = test "$$($(get_first_and_last) | xargs echo)" != "start_kPStaticModules_NSModule end_kPStaticModules_NSModule" && echo "NSModules are not ordered appropriately" && exit 1 || exit 0
-ifeq (Linux,$(OS_ARCH))
+ifeq (,$(filter-out SunOS Linux,$(OS_ARCH)))
LOCAL_CHECKS += ; test "$$($(TOOLCHAIN_PREFIX)readelf -l $1 | awk '$1 == "LOAD" { t += 1 } END { print t }')" -le 1 && echo "Only one PT_LOAD segment" && exit 1 || exit 0
endif
diff --git a/toolkit/library/moz.build b/toolkit/library/moz.build
index ba7fb5032..293c2feaf 100644
--- a/toolkit/library/moz.build
+++ b/toolkit/library/moz.build
@@ -270,6 +270,13 @@ if CONFIG['MOZ_ENABLE_STARTUP_NOTIFICATION']:
if CONFIG['MOZ_ENABLE_LIBPROXY']:
OS_LIBS += CONFIG['MOZ_LIBPROXY_LIBS']
+if CONFIG['OS_ARCH'] == 'SunOS':
+ OS_LIBS += [
+ 'elf',
+ 'demangle',
+ 'sendfile',
+ ]
+
if CONFIG['OS_ARCH'] == 'FreeBSD':
OS_LIBS += [
'util',
diff --git a/toolkit/mozapps/update/common/updatedefines.h b/toolkit/mozapps/update/common/updatedefines.h
index 5790cf996..871755246 100644
--- a/toolkit/mozapps/update/common/updatedefines.h
+++ b/toolkit/mozapps/update/common/updatedefines.h
@@ -96,7 +96,11 @@ static inline int mywcsprintf(WCHAR* dest, size_t count, const WCHAR* fmt, ...)
# include <sys/wait.h>
# include <unistd.h>
+#ifdef XP_SOLARIS
+# include <sys/stat.h>
+#else
# include <fts.h>
+#endif
# include <dirent.h>
#ifdef XP_MACOSX
diff --git a/toolkit/mozapps/update/updater/updater.cpp b/toolkit/mozapps/update/updater/updater.cpp
index 8025deaaf..f5f71935d 100644
--- a/toolkit/mozapps/update/updater/updater.cpp
+++ b/toolkit/mozapps/update/updater/updater.cpp
@@ -3648,6 +3648,88 @@ int add_dir_entries(const NS_tchar *dirpath, ActionList *list)
return rv;
}
+#elif defined(XP_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)
diff --git a/toolkit/xre/nsSigHandlers.cpp b/toolkit/xre/nsSigHandlers.cpp
index 454882c1b..660af4522 100644
--- a/toolkit/xre/nsSigHandlers.cpp
+++ b/toolkit/xre/nsSigHandlers.cpp
@@ -32,6 +32,11 @@
#endif
#endif
+#ifdef XP_SOLARIS
+#include <sys/resource.h>
+#include <ucontext.h>
+#endif
+
static const char* gProgname = "huh?";
// Note: some tests manipulate this value.
@@ -193,6 +198,32 @@ static void fpehandler(int signum, siginfo_t *si, void *context)
*mxcsr &= ~SSE_STATUS_FLAGS; /* clear all pending SSE exceptions */
#endif
#endif
+#ifdef XP_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
@@ -255,6 +286,31 @@ void InstallSignalHandlers(const char *aProgname)
}
#endif
+#ifdef XP_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 //XP_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 &&