From afc187cc3f907947453b428f857acf16b2b0774e Mon Sep 17 00:00:00 2001 From: athenian200 Date: Tue, 1 Oct 2019 06:07:31 -0500 Subject: MoonchildProductions#1251 - Part 1: Restore initial Solaris support, fixed up. Compared with what Pale Moon had for Solaris originally, this is mostly the same zero point I started patching from, but I've made the following changes here after reviewing all this initial code I never looked at closely before. 1. In package-manifest.in for both Basilisk and Pale Moon, I've made the SPARC code for libfreebl not interefere with the x86 code, use the proper build flags, and also updated it to allow a SPARC64 build which is more likely to be used than the 32-bit SPARC code we had there. 2. See Mozilla bug #832272 and the old rules.mk patch from around Firefox 30 in oracle/solaris-userland. I believe they screwed up NSINSTALL on Solaris when they were trying to streamline the NSS buildsystem, because they started having unexplained issues with it around that time after Firefox 22 that they never properly resolved until Mozilla began building NSS with gyp files. I'm actually not even sure how relevant the thing they broke actually is to Solaris at this point, bug 665509 is so old it predates Firefox itself and goes back to the Mozilla suite days. I believe $(INSTALL) -t was wrong, and they meant $(NSINSTALL) -t because that makes more sense and is closer to what was there originally. It's what they have for WINNT, and it's possible a fix more like that could serve for Solaris as well. Alternatively, we could get rid of all these half-broken Makefiles and start building NSS with gyp files like Mozilla did. 3. I've completely cut out support for the Sun compiler and taken into account the reality that everyone builds Firefox (and therefore its forks) with GCC now on Solaris. This alone helped clean up a lot of the uglier parts of the code. 4. I've updated all remaining SOLARIS build flags to the newer XP_SOLARIS, because the SOLARIS flag is no longer set when building Solaris. 5. I've confirmed the workaround in gtxFontconfigFonts.cpp is no longer necessary. The Solaris people got impatient about implementing a half-baked patch for a fontconfig feature that wasn't ready yet back in 2009, and somehow convinced Mozilla to patch their software to work around it when really they should have just fixed or removed their broken fontconfig patch. The feature they wanted has since been implemented properly, and no version of Solaris still uses the broken patch that required this fix. If anyone had ever properly audited this code, it would have been removed a long time ago. --- Makefile.in | 2 +- accessible/tests/mochitest/common.js | 1 + .../tests/mochitest/elm/test_nsApplicationAcc.html | 2 +- .../mochitest/treeupdate/test_contextmenu.xul | 6 +- .../tests/mochitest/treeupdate/test_menu.xul | 4 +- application/basilisk/installer/package-manifest.in | 7 ++ application/palemoon/installer/package-manifest.in | 7 ++ build/gyp.mozbuild | 1 + config/external/nss/Makefile.in | 20 ++++ dom/base/nsContentUtils.h | 4 + dom/plugins/base/nptypes.h | 13 ++ dom/plugins/base/nsPluginsDirUnix.cpp | 16 ++- .../tests/test_htmleditor_keyevent_handling.html | 2 +- editor/reftests/xul/platform.js | 2 + js/src/Makefile.in | 11 ++ js/src/builtin/TestingFunctions.cpp | 5 +- js/src/ctypes/CTypes.cpp | 4 + js/src/jsnativestack.cpp | 13 ++ js/src/moz.build | 8 ++ js/src/vm/Time.cpp | 12 ++ js/xpconnect/src/XPCShellImpl.cpp | 2 + layout/style/nsRuleNode.cpp | 3 + memory/mozjemalloc/jemalloc.c | 21 +++- .../components/osfile/modules/osfile_unix_back.jsm | 16 ++- toolkit/library/moz.build | 6 + toolkit/mozapps/update/common/updatedefines.h | 4 + toolkit/mozapps/update/updater/updater.cpp | 82 +++++++++++++ toolkit/xre/nsSigHandlers.cpp | 57 +++++++++ xpcom/base/nsDebugImpl.cpp | 8 ++ xpcom/base/nsMemoryReporterManager.cpp | 83 +++++++++++++ xpcom/ds/nsMathUtils.h | 4 + xpcom/io/nsLocalFileUnix.cpp | 17 +++ xpcom/reflect/xptcall/md/unix/moz.build | 32 ++++- .../md/unix/xptcinvoke_asm_sparc_solaris_GCC3.s | 52 ++++++++ .../xptcall/md/unix/xptcinvoke_asm_x86_64_unix.S | 122 +++++++++++++++++++ .../xptcall/md/unix/xptcinvoke_sparc64_openbsd.cpp | 4 +- .../xptcall/md/unix/xptcinvoke_sparc_solaris.cpp | 131 +++++++++++++++++++++ .../xptcall/md/unix/xptcstubs_asm_sparc_solaris.s | 49 ++++++++ .../xptcall/md/unix/xptcstubs_sparc64_openbsd.cpp | 7 +- .../xptcall/md/unix/xptcstubs_sparc_solaris.cpp | 112 ++++++++++++++++++ xpcom/reflect/xptcall/status.html | 14 +++ 41 files changed, 945 insertions(+), 21 deletions(-) create mode 100644 xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_sparc_solaris_GCC3.s create mode 100644 xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_x86_64_unix.S create mode 100644 xpcom/reflect/xptcall/md/unix/xptcinvoke_sparc_solaris.cpp create mode 100644 xpcom/reflect/xptcall/md/unix/xptcstubs_asm_sparc_solaris.s create mode 100644 xpcom/reflect/xptcall/md/unix/xptcstubs_sparc_solaris.cpp diff --git a/Makefile.in b/Makefile.in index 4adf3ac9a..26cd688d4 100644 --- a/Makefile.in +++ b/Makefile.in @@ -290,7 +290,7 @@ MAKE_SYM_STORE_PATH := $(DIST)/bin endif DUMP_SYMS_BIN ?= $(DIST)/host/bin/dump_syms endif -ifeq (,$(filter-out Linux,$(OS_ARCH))) +ifeq (,$(filter-out Linux SunOS,$(OS_ARCH))) MAKE_SYM_STORE_ARGS := -c --vcs-info DUMP_SYMS_BIN ?= $(DIST)/host/bin/dump_syms MAKE_SYM_STORE_PATH := $(DIST)/bin diff --git a/accessible/tests/mochitest/common.js b/accessible/tests/mochitest/common.js index b3f83ea84..1e48fa067 100644 --- a/accessible/tests/mochitest/common.js +++ b/accessible/tests/mochitest/common.js @@ -59,6 +59,7 @@ 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); //////////////////////////////////////////////////////////////////////////////// diff --git a/accessible/tests/mochitest/elm/test_nsApplicationAcc.html b/accessible/tests/mochitest/elm/test_nsApplicationAcc.html index e23eb37bc..58763e437 100644 --- a/accessible/tests/mochitest/elm/test_nsApplicationAcc.html +++ b/accessible/tests/mochitest/elm/test_nsApplicationAcc.html @@ -32,7 +32,7 @@ // nsIAccessible::name var applicationName = ""; - if (LINUX) { + if (LINUX || SOLARIS) { applicationName = appInfo.name; } else { try { diff --git a/accessible/tests/mochitest/treeupdate/test_contextmenu.xul b/accessible/tests/mochitest/treeupdate/test_contextmenu.xul index 916b815eb..5b31e0136 100644 --- a/accessible/tests/mochitest/treeupdate/test_contextmenu.xul +++ b/accessible/tests/mochitest/treeupdate/test_contextmenu.xul @@ -130,7 +130,7 @@ */ function getMenuTree1() { - if (LINUX) { + if (LINUX || SOLARIS) { var tree = { role: ROLE_MENUPOPUP, children: [ @@ -190,7 +190,7 @@ function getMenuTree2() { var tree = getMenuTree1(); - if (LINUX) { + if (LINUX || SOLARIS) { var submenuTree = { name: "item2.0", @@ -232,7 +232,7 @@ children: [] }; - if (LINUX) + if (LINUX || SOLARIS) tree.children[2].children[0].children.push(subsubmenuTree); else tree.children[2].children[0].children[0].children[0].children.push(subsubmenuTree); diff --git a/accessible/tests/mochitest/treeupdate/test_menu.xul b/accessible/tests/mochitest/treeupdate/test_menu.xul index d62ac8c5d..abdea217e 100644 --- a/accessible/tests/mochitest/treeupdate/test_menu.xul +++ b/accessible/tests/mochitest/treeupdate/test_menu.xul @@ -32,7 +32,7 @@ this.invoke = function openMenu_invoke() { var tree; - if (LINUX) { + if (LINUX || SOLARIS) { tree = { PARENT_MENUITEM: [ ] }; @@ -51,7 +51,7 @@ this.finalCheck = function openMenu_finalCheck() { var tree; - if (LINUX) { + if (LINUX || SOLARIS) { tree = { PARENT_MENUITEM: [ { MENUITEM: [ ] }, diff --git a/application/basilisk/installer/package-manifest.in b/application/basilisk/installer/package-manifest.in index bffab0f6e..d8f65bcfb 100644 --- a/application/basilisk/installer/package-manifest.in +++ b/application/basilisk/installer/package-manifest.in @@ -685,6 +685,13 @@ #ifndef MOZ_SYSTEM_NSS #if defined(XP_LINUX) && !defined(ANDROID) @BINPATH@/@DLL_PREFIX@freeblpriv3@DLL_SUFFIX@ +#elif defined(XP_SOLARIS) && defined(SPARC64) +@BINPATH@/@DLL_PREFIX@freebl_64fpu_3@DLL_SUFFIX@ +@BINPATH@/@DLL_PREFIX@freebl_64int_3@DLL_SUFFIX@ +#elif defined(XP_SOLARIS) && defined(SPARC) +@BINPATH@/@DLL_PREFIX@freebl_32fpu_3@DLL_SUFFIX@ +@BINPATH@/@DLL_PREFIX@freebl_32int64_3@DLL_SUFFIX@ +@BINPATH@/@DLL_PREFIX@freebl3@DLL_SUFFIX@ #else @BINPATH@/@DLL_PREFIX@freebl3@DLL_SUFFIX@ #endif diff --git a/application/palemoon/installer/package-manifest.in b/application/palemoon/installer/package-manifest.in index f95f18f77..e24b605e8 100644 --- a/application/palemoon/installer/package-manifest.in +++ b/application/palemoon/installer/package-manifest.in @@ -296,6 +296,13 @@ #ifndef MOZ_SYSTEM_NSS #if defined(XP_LINUX) && !defined(ANDROID) @BINPATH@/@DLL_PREFIX@freeblpriv3@DLL_SUFFIX@ +#elif defined(XP_SOLARIS) && defined(SPARC64) +@BINPATH@/@DLL_PREFIX@freebl_64fpu_3@DLL_SUFFIX@ +@BINPATH@/@DLL_PREFIX@freebl_64int_3@DLL_SUFFIX@ +#elif defined(XP_SOLARIS) && defined(SPARC) +@BINPATH@/@DLL_PREFIX@freebl_32fpu_3@DLL_SUFFIX@ +@BINPATH@/@DLL_PREFIX@freebl_32int64_3@DLL_SUFFIX@ +@BINPATH@/@DLL_PREFIX@freebl3@DLL_SUFFIX@ #else @BINPATH@/@DLL_PREFIX@freebl3@DLL_SUFFIX@ #endif diff --git a/build/gyp.mozbuild b/build/gyp.mozbuild index 545b888bd..fd8714ecf 100644 --- a/build/gyp.mozbuild +++ b/build/gyp.mozbuild @@ -89,6 +89,7 @@ flavors = { 'Android': 'android', 'Linux': 'linux', 'Darwin': 'mac' if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa' else 'ios', + 'SunOS': 'solaris', 'GNU/kFreeBSD': 'freebsd', 'DragonFly': 'dragonfly', 'FreeBSD': 'freebsd', diff --git a/config/external/nss/Makefile.in b/config/external/nss/Makefile.in index 2c266eb20..71954b403 100644 --- a/config/external/nss/Makefile.in +++ b/config/external/nss/Makefile.in @@ -43,6 +43,21 @@ endif # Default HAVE_FREEBL_LIBS = 1 +# SunOS SPARC + +ifeq ($(OS_ARCH), SunOS) +ifneq (86,$(findstring 86,$(OS_TEST))) +ifdef HAVE_64BIT_BUILD +HAVE_FREEBL_LIBS = +HAVE_FREEBL_LIBS_64 = 1 +else +HAVE_FREEBL_LIBS = +HAVE_FREEBL_LIBS_32FPU = 1 +HAVE_FREEBL_LIBS_32INT64 = 1 +endif +endif +endif + ifeq ($(OS_TARGET),Linux) HAVE_FREEBL_LIBS = HAVE_FREEBL_LIBS_PRIV = 1 @@ -317,6 +332,11 @@ NSS_DIST_DLL_DEST := $(DIST)/bin NSS_DIST_DLL_TARGET := target INSTALL_TARGETS += NSS_DIST_DLL +ifeq ($(OS_ARCH)_$(1), SunOS_softokn3) +# has to use copy mode on Solaris, see #665509 +$(DIST)/bin/$(DLL_PREFIX)softokn3$(DLL_SUFFIX): INSTALL := $(NSINSTALL) -t +endif + NSS_SDK_LIB_FILES := \ $(addprefix $(DIST)/lib/$(LIB_PREFIX),$(addsuffix .$(LIB_SUFFIX),$(SDK_LIBS))) \ $(addprefix $(DIST)/bin/$(DLL_PREFIX),$(addsuffix $(DLL_SUFFIX),$(NSS_DLLS))) \ diff --git a/dom/base/nsContentUtils.h b/dom/base/nsContentUtils.h index 299a8e859..26635acd6 100644 --- a/dom/base/nsContentUtils.h +++ b/dom/base/nsContentUtils.h @@ -13,6 +13,10 @@ #include #endif +#if defined(XP_SOLARIS) +#include +#endif + #include "js/TypeDecls.h" #include "js/Value.h" #include "js/RootingAPI.h" diff --git a/dom/plugins/base/nptypes.h b/dom/plugins/base/nptypes.h index c36532472..d0cef6540 100644 --- a/dom/plugins/base/nptypes.h +++ b/dom/plugins/base/nptypes.h @@ -22,6 +22,19 @@ typedef unsigned int uint32_t; typedef long long int64_t; typedef unsigned long long uint64_t; +#elif defined(__sun) + /* + * SunOS ships an inttypes.h header that defines [u]int32_t, + * but not bool for C. + */ + #include + + + #ifndef __cplusplus + typedef int bool; + #define true 1 + #define false 0 + #endif #elif defined(bsdi) || defined(FREEBSD) || defined(OPENBSD) /* * BSD/OS, FreeBSD, and OpenBSD ship sys/types.h that define int32_t and diff --git a/dom/plugins/base/nsPluginsDirUnix.cpp b/dom/plugins/base/nsPluginsDirUnix.cpp index e6956c34c..22d6bd44b 100644 --- a/dom/plugins/base/nsPluginsDirUnix.cpp +++ b/dom/plugins/base/nsPluginsDirUnix.cpp @@ -19,7 +19,9 @@ #include "nsIPrefService.h" #define LOCAL_PLUGIN_DLL_SUFFIX ".so" -#if defined(LINUX) +#if defined(XP_SOLARIS) +#define DEFAULT_X11_PATH "/usr/openwin/lib" +#elif defined(LINUX) #define DEFAULT_X11_PATH "/usr/X11R6/lib/" #elif defined(__APPLE__) #define DEFAULT_X11_PATH "/usr/X11R6/lib" @@ -92,7 +94,11 @@ 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 (XP_SOLARIS) +#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 +#endif /* this function looks for user_pref("plugin.soname.list", "/usr/X11R6/lib/libXt.so.6:libXext.so"); @@ -264,11 +270,15 @@ nsresult nsPluginFile::LoadPlugin(PRLibrary **outLibrary) // at runtime. Explicitly opening Xt/Xext into the global // namespace before attempting to load the plug-in seems to // work fine. - - +#if defined(XP_SOLARIS) + // Acrobat/libXm: Lazy resolving might cause crash later (bug 211587) + *outLibrary = PR_LoadLibraryWithFlags(libSpec, PR_LD_NOW); + pLibrary = *outLibrary; +#else // Some dlopen() doesn't recover from a failed PR_LD_NOW (bug 223744) *outLibrary = PR_LoadLibraryWithFlags(libSpec, 0); pLibrary = *outLibrary; +#endif if (!pLibrary) { LoadExtraSharedLibs(); // try reload plugin once more diff --git a/editor/libeditor/tests/test_htmleditor_keyevent_handling.html b/editor/libeditor/tests/test_htmleditor_keyevent_handling.html index 414045ac0..bfec290a5 100644 --- a/editor/libeditor/tests/test_htmleditor_keyevent_handling.html +++ b/editor/libeditor/tests/test_htmleditor_keyevent_handling.html @@ -27,7 +27,7 @@ var htmlEditor = document.getElementById("htmlEditor"); const kIsMac = navigator.platform.indexOf("Mac") == 0; const kIsWin = navigator.platform.indexOf("Win") == 0; -const kIsLinux = navigator.platform.indexOf("Linux") == 0; +const kIsLinux = navigator.platform.indexOf("Linux") == 0 || navigator.platform.indexOf("SunOS") == 0 ; function runTests() { diff --git a/editor/reftests/xul/platform.js b/editor/reftests/xul/platform.js index a8633fb09..d3f5d33bf 100644 --- a/editor/reftests/xul/platform.js +++ b/editor/reftests/xul/platform.js @@ -13,6 +13,8 @@ if (/Windows/.test(ua)) { } else if (/Linux/.test(ua)) id = "linux"; +else if (/SunOS/.test(ua)) + id = "linux"; else if (/Mac OS X/.test(ua)) id = "mac"; diff --git a/js/src/Makefile.in b/js/src/Makefile.in index 20678c68c..bc99e62b5 100644 --- a/js/src/Makefile.in +++ b/js/src/Makefile.in @@ -138,6 +138,17 @@ distclean:: CFLAGS += $(MOZ_ZLIB_CFLAGS) +ifeq ($(OS_ARCH),SunOS) +ifeq ($(TARGET_CPU),sparc) + +ifdef GNU_CC +CFLAGS += -mcpu=v9 +CXXFLAGS += -mcpu=v9 +endif #GNU_CC + +endif +endif + $(LIBRARY_NAME).pc: js.pc cp $^ $@ diff --git a/js/src/builtin/TestingFunctions.cpp b/js/src/builtin/TestingFunctions.cpp index 992fe2c97..6beb82932 100644 --- a/js/src/builtin/TestingFunctions.cpp +++ b/js/src/builtin/TestingFunctions.cpp @@ -239,8 +239,11 @@ GetBuildConfiguration(JSContext* cx, unsigned argc, Value* vp) value = BooleanValue(true); if (!JS_SetProperty(cx, info, "intl-api", value)) return false; - +#if defined(XP_SOLARIS) + value = BooleanValue(false); +#else value = BooleanValue(true); +#endif if (!JS_SetProperty(cx, info, "mapped-array-buffer", value)) return false; diff --git a/js/src/ctypes/CTypes.cpp b/js/src/ctypes/CTypes.cpp index d6adfac2c..aed1114bd 100644 --- a/js/src/ctypes/CTypes.cpp +++ b/js/src/ctypes/CTypes.cpp @@ -20,6 +20,10 @@ #include #endif +#if defined(XP_SOLARIS) +#include +#endif + #ifdef HAVE_SSIZE_T #include #endif diff --git a/js/src/jsnativestack.cpp b/js/src/jsnativestack.cpp index 94a296bd0..389d7e657 100644 --- a/js/src/jsnativestack.cpp +++ b/js/src/jsnativestack.cpp @@ -67,6 +67,19 @@ js::GetNativeStackBaseImpl() # endif } +#elif defined(XP_SOLARIS) + +#include + +JS_STATIC_ASSERT(JS_STACK_GROWTH_DIRECTION < 0); + +void js::GetNativeStackBaseImpl() +{ + stack_t st; + stack_getbounds(&st); + return static_cast(st.ss_sp) + st.ss_size; +} + #elif defined(XP_LINUX) && !defined(ANDROID) && defined(__GLIBC__) void* js::GetNativeStackBaseImpl() diff --git a/js/src/moz.build b/js/src/moz.build index a0f074d1c..47ffe0159 100644 --- a/js/src/moz.build +++ b/js/src/moz.build @@ -721,6 +721,14 @@ if CONFIG['OS_ARCH'] == 'Linux': 'dl', ] +if CONFIG['OS_ARCH'] == 'SunOS': + OS_LIBS += [ + 'posix4', + 'dl', + 'nsl', + 'socket', + ] + OS_LIBS += CONFIG['REALTIME_LIBS'] CFLAGS += CONFIG['MOZ_ICU_CFLAGS'] diff --git a/js/src/vm/Time.cpp b/js/src/vm/Time.cpp index 87531c148..a9a5b7f0f 100644 --- a/js/src/vm/Time.cpp +++ b/js/src/vm/Time.cpp @@ -11,6 +11,10 @@ #include "mozilla/DebugOnly.h" #include "mozilla/MathAlgorithms.h" +#ifdef XP_SOLARIS +#define _REENTRANT 1 +#endif + #include #include @@ -30,6 +34,10 @@ #ifdef XP_UNIX +#ifdef _SVID_GETTOD /* Defined only on Solaris, see Solaris */ +extern int gettimeofday(struct timeval* tv); +#endif + #include #endif /* XP_UNIX */ @@ -42,7 +50,11 @@ PRMJ_Now() { struct timeval tv; +#ifdef _SVID_GETTOD /* Defined only on Solaris, see Solaris */ + gettimeofday(&tv); +#else gettimeofday(&tv, 0); +#endif /* _SVID_GETTOD */ return int64_t(tv.tv_sec) * PRMJ_USEC_PER_SEC + int64_t(tv.tv_usec); } diff --git a/js/xpconnect/src/XPCShellImpl.cpp b/js/xpconnect/src/XPCShellImpl.cpp index 4ddc8deb3..abe50f449 100644 --- a/js/xpconnect/src/XPCShellImpl.cpp +++ b/js/xpconnect/src/XPCShellImpl.cpp @@ -644,6 +644,7 @@ 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 XP_SOLARIS RootedString valstr(cx); RootedString idstr(cx); int rv; @@ -686,6 +687,7 @@ env_setProperty(JSContext* cx, HandleObject obj, HandleId id, MutableHandleValue return false; } vp.setString(valstr); +#endif /* !defined XP_SOLARIS */ return result.succeed(); } diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index 08400635b..a0f65c069 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -67,6 +67,9 @@ #define alloca _alloca #endif #endif +#ifdef XP_SOLARIS +#include +#endif using std::max; using std::min; diff --git a/memory/mozjemalloc/jemalloc.c b/memory/mozjemalloc/jemalloc.c index 9a97bbb09..c54a85959 100644 --- a/memory/mozjemalloc/jemalloc.c +++ b/memory/mozjemalloc/jemalloc.c @@ -280,7 +280,9 @@ typedef long ssize_t; #define JEMALLOC_RECYCLE #ifndef MOZ_MEMORY_WINDOWS +#ifndef MOZ_MEMORY_SOLARIS #include +#endif #ifndef __DECONST # define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var)) #endif @@ -306,7 +308,7 @@ __FBSDID("$FreeBSD: head/lib/libc/stdlib/malloc.c 180599 2008-07-18 19:35:44Z ja #endif #include #include -#if !defined(MOZ_MEMORY_ANDROID) +#if !defined(MOZ_MEMORY_SOLARIS) && !defined(MOZ_MEMORY_ANDROID) #include #endif #include @@ -408,6 +410,10 @@ 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 @@ -5120,6 +5126,13 @@ 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) @@ -5916,9 +5929,15 @@ RETURN: #define MOZ_MEMORY_ELF #endif +#ifdef MOZ_MEMORY_SOLARIS +# if (defined(__GNUC__)) +__attribute__((noinline)) +# endif +#else #if (defined(MOZ_MEMORY_ELF)) __attribute__((visibility ("hidden"))) #endif +#endif #endif /* MOZ_REPLACE_MALLOC */ #ifdef MOZ_MEMORY_ELF 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/library/moz.build b/toolkit/library/moz.build index ba7fb5032..cd900a615 100644 --- a/toolkit/library/moz.build +++ b/toolkit/library/moz.build @@ -270,6 +270,12 @@ 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', + ] + 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 # include +#ifdef XP_SOLARIS +# include +#else # include +#endif # include #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 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..bcbcb6e3d 100644 --- a/toolkit/xre/nsSigHandlers.cpp +++ b/toolkit/xre/nsSigHandlers.cpp @@ -32,6 +32,11 @@ #endif #endif +#if defined(XP_SOLARIS) +#include +#include +#endif + static const char* gProgname = "huh?"; // Note: some tests manipulate this value. @@ -193,6 +198,33 @@ 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 +287,31 @@ void InstallSignalHandlers(const char *aProgname) } #endif +#if defined(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 && diff --git a/xpcom/base/nsDebugImpl.cpp b/xpcom/base/nsDebugImpl.cpp index a81eb3d71..84ba150db 100644 --- a/xpcom/base/nsDebugImpl.cpp +++ b/xpcom/base/nsDebugImpl.cpp @@ -450,6 +450,12 @@ RealBreak() ".object_arch armv4t\n" #endif "BKPT #0"); +#elif defined(__sun) +#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 @@ -524,6 +530,8 @@ Break(const char* aMsg) RealBreak(); #elif defined(__arm__) RealBreak(); +#elif defined(__sun) + RealBreak(); #else #warning do not know how to break on this platform #endif diff --git a/xpcom/base/nsMemoryReporterManager.cpp b/xpcom/base/nsMemoryReporterManager.cpp index 88964f9b5..9c2d620cc 100644 --- a/xpcom/base/nsMemoryReporterManager.cpp +++ b/xpcom/base/nsMemoryReporterManager.cpp @@ -317,6 +317,85 @@ VsizeMaxContiguousDistinguishedAmount(int64_t* aN) } #endif // FreeBSD +#elif defined(XP_SOLARIS) + +#include +#include +#include + +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//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 @@ -1066,9 +1145,13 @@ 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(XP_SOLARIS) + *aN = usage.ru.maxrss * getpagesize(); #else *aN = usage.ru_maxrss * 1024; #endif diff --git a/xpcom/ds/nsMathUtils.h b/xpcom/ds/nsMathUtils.h index cbbd38611..08bf908da 100644 --- a/xpcom/ds/nsMathUtils.h +++ b/xpcom/ds/nsMathUtils.h @@ -11,6 +11,10 @@ #include #include +#ifdef XP_SOLARIS +#include +#endif + /* * round */ diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp index 272153bba..c0b5c0f48 100644 --- a/xpcom/io/nsLocalFileUnix.cpp +++ b/xpcom/io/nsLocalFileUnix.cpp @@ -1591,6 +1591,23 @@ nsLocalFile::IsExecutable(bool* aResult) // Then check the execute bit. *aResult = (access(mPath.get(), X_OK) == 0); +#ifdef XP_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) { if (*aResult || errno == EACCES) { return NS_OK; } diff --git a/xpcom/reflect/xptcall/md/unix/moz.build b/xpcom/reflect/xptcall/md/unix/moz.build index d455ed854..c5cba0c8d 100644 --- a/xpcom/reflect/xptcall/md/unix/moz.build +++ b/xpcom/reflect/xptcall/md/unix/moz.build @@ -46,6 +46,21 @@ if CONFIG['OS_ARCH'] in ('Linux', 'FreeBSD'): 'xptcstubs_ipf64.cpp' ] +# Without the need to accomodate the Sun compiler, Solaris/GCC support is pretty +# standard, actually. Not all that different from Linux. + +if CONFIG['OS_ARCH'] == 'SunOS': + if CONFIG['OS_TEST'] == 'x86_64': + SOURCES += [ + 'xptcinvoke_asm_x86_64_unix.S', + 'xptcinvoke_x86_64_unix.cpp', + 'xptcstubs_x86_64_linux.cpp' + ] + elif CONFIG['OS_TEST'] == 'x86': + SOURCES += [ + 'xptcinvoke_gcc_x86_unix.cpp', + 'xptcstubs_gcc_x86_unix.cpp' + ] if CONFIG['OS_TEST'] == 'alpha': if CONFIG['OS_ARCH'] in ('Linux', 'FreeBSD', 'NetBSD'): @@ -186,7 +201,11 @@ if CONFIG['OS_ARCH'] == 'OpenBSD' and CONFIG['OS_TEST'] == 'sparc': 'xptcstubs_sparc_openbsd.cpp', ] -if CONFIG['OS_ARCH'] in ('OpenBSD', 'FreeBSD') and CONFIG['OS_TEST'] == 'sparc64': +# Mozilla discovered at some point that Solaris and Linux can also use these +# files for 64-bit SPARC with no ill effects, so basically the entire mess that +# was there before is no longer needed. + +if CONFIG['OS_ARCH'] in ('OpenBSD', 'FreeBSD', 'SunOS') and CONFIG['OS_TEST'] == 'sparc64': SOURCES += [ 'xptcinvoke_asm_sparc64_openbsd.s', 'xptcinvoke_sparc64_openbsd.cpp', @@ -194,6 +213,17 @@ if CONFIG['OS_ARCH'] in ('OpenBSD', 'FreeBSD') and CONFIG['OS_TEST'] == 'sparc64 'xptcstubs_sparc64_openbsd.cpp', ] +# As for the 32-bit SPARC build? That would look like the Linux version with +# one file changed. + +if CONFIG['OS_ARCH'] == 'SunOS' and CONFIG['OS_TEST'] == 'sparc': + SOURCES += [ + 'xptcinvoke_asm_sparc_solaris_GCC3.s', + 'xptcinvoke_sparc_solaris.cpp', + 'xptcstubs_asm_sparc_solaris.s', + 'xptcstubs_sparc_solaris.cpp', + ] + if CONFIG['OS_ARCH'] == 'Linux': if CONFIG['OS_TEST'] == 's390': SOURCES += [ diff --git a/xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_sparc_solaris_GCC3.s b/xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_sparc_solaris_GCC3.s new file mode 100644 index 000000000..54adcd147 --- /dev/null +++ b/xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_sparc_solaris_GCC3.s @@ -0,0 +1,52 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* + * Platform specific code to invoke XPCOM methods on native objects for + * solaris/sparc with gcc 3 ABI. + */ + .global NS_InvokeByIndex +/* + * NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex, + * uint32_t paramCount, nsXPTCVariant* params); + */ +NS_InvokeByIndex: + save %sp,-(64 + 32),%sp ! room for the register window and + ! struct pointer, rounded up to 0 % 32 + mov %i2,%o0 ! paramCount + call invoke_count_words ! returns the required stack size in %o0 + mov %i3,%o1 ! params + + sll %o0,2,%l0 ! number of bytes + sub %sp,%l0,%sp ! create the additional stack space + + mov %sp,%o0 ! pointer for copied args + add %o0,72,%o0 ! step past the register window, the + ! struct result pointer and the 'this' slot + mov %i2,%o1 ! paramCount + call invoke_copy_to_stack + mov %i3,%o2 ! params +! +! calculate the target address from the vtable +! + ld [%i0],%l1 ! *that --> vTable + sll %i1,2,%i1 ! multiply index by 4 + add %i1,%l1,%l1 ! l1 now points to vTable entry + ld [%l1],%l0 ! target address + +.L5: ld [%sp + 88],%o5 +.L4: ld [%sp + 84],%o4 +.L3: ld [%sp + 80],%o3 +.L2: ld [%sp + 76],%o2 +.L1: ld [%sp + 72],%o1 +.L0: + jmpl %l0,%o7 ! call the routine +! always have a 'this', from the incoming 'that' + mov %i0,%o0 + + mov %o0,%i0 ! propagate return value + ret + restore diff --git a/xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_x86_64_unix.S b/xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_x86_64_unix.S new file mode 100644 index 000000000..131cfc334 --- /dev/null +++ b/xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_x86_64_unix.S @@ -0,0 +1,122 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# Darwin gives a leading '_' to symbols defined in C code. +#ifdef XP_DARWIN +#define SYM(x) _ ## x +#define CFI_STARTPROC +#define CFI_ENDPROC +#define CFI_DEF_CFA_OFFSET(offset) +#define CFI_OFFSET(reg, offset) +#define CFI_DEF_CFA_REGISTER(reg) +#define CFI_DEF_CFA(reg, offset) +#else +#define SYM(x) x +#define CFI_STARTPROC .cfi_startproc +#define CFI_ENDPROC .cfi_endproc +#define CFI_DEF_CFA_OFFSET(offset) .cfi_def_cfa_offset offset +#define CFI_OFFSET(reg, offset) .cfi_offset reg, offset +#define CFI_DEF_CFA_REGISTER(reg) .cfi_def_cfa_register reg +#define CFI_DEF_CFA(reg, offset) .cfi_def_cfa reg, offset +#endif + +.intel_syntax noprefix + +# nsresult NS_InvokeByIndex(nsISupports* this, uint32_t aVtableIndex, +# uint32_t argc, nsXPTCVariant* argv); +.text +.global SYM(NS_InvokeByIndex) +#ifndef XP_DARWIN +.type NS_InvokeByIndex, @function +#endif +.align 4 +SYM(NS_InvokeByIndex): + CFI_STARTPROC + push rbp + CFI_DEF_CFA_OFFSET(16) + CFI_OFFSET(6, -16) + mov rbp, rsp + CFI_DEF_CFA_REGISTER(6) + +# save r12 and r13 because we use them and they are callee saved. + push r12 + push r13 + CFI_OFFSET(12, -24) + CFI_OFFSET(13, -32) + +# save this and the vtable index because we need them after setting up the +# stack. + mov r12, rdi + mov r13, rsi + +# allocate space for stack arguments, in theory we only need 8 * (argc - 5) +# bytes because at least 5 arguments will go in registers, but for now it is +# just simpler to allocate 8 * argc bytes. Note that we treat the this +# pointer specially. + lea eax, [edx * 8] + sub rsp, rax + +# If there is an odd number of args the stack can be misaligned so realign it. + and rsp, 0xfffffffffffffff0 + +# pass the stack slot area to InvokeCopyToStack. + mov r8, rsp + +# setup space for the register slots: there are 5 integer ones and 8 floating +# point ones. So we need 104 bytes of space, but we allocate 112 to keep rsp +# aligned to 16 bytes. + sub rsp, 112 + +# the first argument to InvokeCopyToStack is the integer register area, and the +# second is the floating point area. + mov rdi, rsp + lea rsi, [rsp + 40] + +# The 3rd and 4th arguments to InvokeCopyToStack are already in the right +# registers. So now we can just call InvokeCopyToStack. + call SYM(InvokeCopyToStack) + +# setup this + mov rdi, r12 + +# copy the integer arguments into place. + mov rsi, [rsp] + mov rdx, [rsp + 8] + mov rcx, [rsp + 16] + mov r8, [rsp + 24] + mov r9, [rsp + 32] + +# copy the float arguments into place + movsd xmm0, [rsp + 40] + movsd xmm1, [rsp + 48] + movsd xmm2, [rsp + 56] + movsd xmm3, [rsp + 64] + movsd xmm4, [rsp + 72] + movsd xmm5, [rsp + 80] + movsd xmm6, [rsp + 88] + movsd xmm7, [rsp + 96] + +# get rid of the scratch space for registers + add rsp, 112 + +# load the function pointer and call + lea eax, [r13d * 8] + add rax, [rdi] + call [rax] + +# r12 and r13 were pushed relative to the old stack pointer which is now the +# frame pointer. + mov r12, [rbp - 0x8] + mov r13, [rbp - 0x10] + + mov rsp, rbp + pop rbp + CFI_DEF_CFA(7, 8) + ret + CFI_ENDPROC + +#ifndef XP_DARWIN +// Magic indicating no need for an executable stack +.section .note.GNU-stack, "", @progbits ; .previous +#endif diff --git a/xpcom/reflect/xptcall/md/unix/xptcinvoke_sparc64_openbsd.cpp b/xpcom/reflect/xptcall/md/unix/xptcinvoke_sparc64_openbsd.cpp index 050f9414d..1b5039ed9 100644 --- a/xpcom/reflect/xptcall/md/unix/xptcinvoke_sparc64_openbsd.cpp +++ b/xpcom/reflect/xptcall/md/unix/xptcinvoke_sparc64_openbsd.cpp @@ -30,9 +30,9 @@ invoke_copy_to_stack(uint64_t* d, uint32_t paramCount, nsXPTCVariant* s) { if (regCount < 5) regCount++; - if (l_s->IsPtrData()) + if (l_s->IsIndirect()) { - *l_d = (uint64_t)l_s->ptr; + *l_d = (uint64_t) &l_s->val; continue; } switch (l_s->type) diff --git a/xpcom/reflect/xptcall/md/unix/xptcinvoke_sparc_solaris.cpp b/xpcom/reflect/xptcall/md/unix/xptcinvoke_sparc_solaris.cpp new file mode 100644 index 000000000..126ef1dad --- /dev/null +++ b/xpcom/reflect/xptcall/md/unix/xptcinvoke_sparc_solaris.cpp @@ -0,0 +1,131 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* Platform specific code to invoke XPCOM methods on native objects */ + +#include "xptcprivate.h" + +/* solaris defines __sparc for workshop compilers and + linux defines __sparc__ */ + +#if !defined(__sparc) && !defined(__sparc__) +#error "This code is for Sparc only" +#endif + +typedef unsigned nsXPCVariant; + +extern "C" uint32_t +invoke_count_words(uint32_t paramCount, nsXPTCVariant* s) +{ + uint32_t result = 0; + for(uint32_t i = 0; i < paramCount; i++, s++) + { + if(s->IsPtrData()) + { + result++; + continue; + } + switch(s->type) + { + case nsXPTType::T_I8 : + case nsXPTType::T_I16 : + case nsXPTType::T_I32 : + result++; + break; + case nsXPTType::T_I64 : + result+=2; + break; + case nsXPTType::T_U8 : + case nsXPTType::T_U16 : + case nsXPTType::T_U32 : + result++; + break; + case nsXPTType::T_U64 : + result+=2; + break; + case nsXPTType::T_FLOAT : + result++; + break; + case nsXPTType::T_DOUBLE : + result+=2; + break; + case nsXPTType::T_BOOL : + case nsXPTType::T_CHAR : + case nsXPTType::T_WCHAR : + result++; + break; + default: + // all the others are plain pointer types + result++; + break; + } + } + // nuts, I know there's a cooler way of doing this, but it's late + // now and it'll probably come to me in the morning. + if (result & 0x3) result += 4 - (result & 0x3); // ensure q-word alignment + return result; +} + +extern "C" uint32_t +invoke_copy_to_stack(uint32_t* d, uint32_t paramCount, nsXPTCVariant* s) +{ +/* + We need to copy the parameters for this function to locals and use them + from there since the parameters occupy the same stack space as the stack + we're trying to populate. +*/ + uint32_t *l_d = d; + nsXPTCVariant *l_s = s; + uint32_t l_paramCount = paramCount; + uint32_t regCount = 0; // return the number of registers to load from the stack + + typedef struct { + uint32_t hi; + uint32_t lo; + } DU; // have to move 64 bit entities as 32 bit halves since + // stack slots are not guaranteed 16 byte aligned + + for(uint32_t i = 0; i < l_paramCount; i++, l_d++, l_s++) + { + if (regCount < 5) regCount++; + if(l_s->IsPtrData()) + { + if(l_s->type == nsXPTType::T_JSVAL) + { + // On SPARC, we need to pass a pointer to HandleValue + *((void**)l_d) = &l_s->ptr; + } else + { + *((void**)l_d) = l_s->ptr; + } + continue; + } + switch(l_s->type) + { + case nsXPTType::T_I8 : *((int32_t*) l_d) = l_s->val.i8; break; + case nsXPTType::T_I16 : *((int32_t*) l_d) = l_s->val.i16; break; + case nsXPTType::T_I32 : *((int32_t*) l_d) = l_s->val.i32; break; + case nsXPTType::T_I64 : + case nsXPTType::T_U64 : + case nsXPTType::T_DOUBLE : *((uint32_t*) l_d++) = ((DU *)l_s)->hi; + if (regCount < 5) regCount++; + *((uint32_t*) l_d) = ((DU *)l_s)->lo; + break; + case nsXPTType::T_U8 : *((uint32_t*) l_d) = l_s->val.u8; break; + case nsXPTType::T_U16 : *((uint32_t*) l_d) = l_s->val.u16; break; + case nsXPTType::T_U32 : *((uint32_t*) l_d) = l_s->val.u32; break; + case nsXPTType::T_FLOAT : *((float*) l_d) = l_s->val.f; break; + case nsXPTType::T_BOOL : *((uint32_t*) l_d) = l_s->val.b; break; + case nsXPTType::T_CHAR : *((uint32_t*) l_d) = l_s->val.c; break; + case nsXPTType::T_WCHAR : *((int32_t*) l_d) = l_s->val.wc; break; + default: + // all the others are plain pointer types + *((void**)l_d) = l_s->val.p; + break; + } + } + return regCount; +} + diff --git a/xpcom/reflect/xptcall/md/unix/xptcstubs_asm_sparc_solaris.s b/xpcom/reflect/xptcall/md/unix/xptcstubs_asm_sparc_solaris.s new file mode 100644 index 000000000..9b448d7c7 --- /dev/null +++ b/xpcom/reflect/xptcall/md/unix/xptcstubs_asm_sparc_solaris.s @@ -0,0 +1,49 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + .global SharedStub + +/* + in the frame for the function that called SharedStub are the + rest of the parameters we need + +*/ + +SharedStub: +! we don't create a new frame yet, but work within the frame of the calling +! function to give ourselves the other parameters we want + + mov %o0, %o1 ! shuffle the index up to 2nd place + mov %i0, %o0 ! the original 'this' + add %fp, 72, %o2 ! previous stack top adjusted to the first argument slot (beyond 'this') +! save off the original incoming parameters that arrived in +! registers, the ABI guarantees the space for us to do this + st %i1, [%fp + 72] + st %i2, [%fp + 76] + st %i3, [%fp + 80] + st %i4, [%fp + 84] + st %i5, [%fp + 88] +! now we can build our own stack frame + save %sp,-(64 + 32),%sp ! room for the register window and + ! struct pointer, rounded up to 0 % 32 +! our function now appears to have been called +! as SharedStub(nsISupports* that, uint32_t index, uint32_t* args) +! so we can just copy these through + + mov %i0, %o0 + mov %i1, %o1 + mov %i2, %o2 + call PrepareAndDispatch + nop + mov %o0,%i0 ! propagate return value + b .LL1 + nop +.LL1: + ret + restore + + .size SharedStub, .-SharedStub + .type SharedStub, #function diff --git a/xpcom/reflect/xptcall/md/unix/xptcstubs_sparc64_openbsd.cpp b/xpcom/reflect/xptcall/md/unix/xptcstubs_sparc64_openbsd.cpp index b8a09c97e..e28a03794 100644 --- a/xpcom/reflect/xptcall/md/unix/xptcstubs_sparc64_openbsd.cpp +++ b/xpcom/reflect/xptcall/md/unix/xptcstubs_sparc64_openbsd.cpp @@ -85,8 +85,13 @@ PrepareAndDispatch(nsXPTCStubBase* self, uint64_t methodIndex, uint64_t* args) extern "C" nsresult SharedStub(int, int*); +/* + * Avoid GCC stack protector to wipe out imput registers since the compiler + * thinks the function takes no arguments. + */ + #define STUB_ENTRY(n) \ -nsresult nsXPTCStubBase::Stub##n() \ +nsresult __attribute__((__optimize__("no-stack-protector"))) nsXPTCStubBase::Stub##n() \ { \ int dummy; /* defeat tail-call optimization */ \ return SharedStub(n, &dummy); \ diff --git a/xpcom/reflect/xptcall/md/unix/xptcstubs_sparc_solaris.cpp b/xpcom/reflect/xptcall/md/unix/xptcstubs_sparc_solaris.cpp new file mode 100644 index 000000000..61f3df4ff --- /dev/null +++ b/xpcom/reflect/xptcall/md/unix/xptcstubs_sparc_solaris.cpp @@ -0,0 +1,112 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* Implement shared vtbl methods. */ + +#include "xptcprivate.h" +#include "xptiprivate.h" + +#if defined(sparc) || defined(__sparc__) + +extern "C" nsresult ATTRIBUTE_USED +PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint32_t* args) +{ + + typedef struct { + uint32_t hi; + uint32_t lo; + } DU; // have to move 64 bit entities as 32 bit halves since + // stack slots are not guaranteed 16 byte aligned + +#define PARAM_BUFFER_COUNT 16 + + nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT]; + nsXPTCMiniVariant* dispatchParams = nullptr; + const nsXPTMethodInfo* info; + uint8_t paramCount; + uint8_t i; + nsresult result = NS_ERROR_FAILURE; + + NS_ASSERTION(self,"no self"); + + self->mEntry->GetMethodInfo(uint16_t(methodIndex), &info); + NS_ASSERTION(info,"no interface info"); + + paramCount = info->GetParamCount(); + + // setup variant array pointer + if(paramCount > PARAM_BUFFER_COUNT) + dispatchParams = new nsXPTCMiniVariant[paramCount]; + else + dispatchParams = paramBuffer; + NS_ASSERTION(dispatchParams,"no place for params"); + + uint32_t* ap = args; + for(i = 0; i < paramCount; i++, ap++) + { + const nsXPTParamInfo& param = info->GetParam(i); + const nsXPTType& type = param.GetType(); + nsXPTCMiniVariant* dp = &dispatchParams[i]; + + if(param.IsOut() || !type.IsArithmetic()) + { + if (type == nsXPTType::T_JSVAL) + dp->val.p = *((void**) *ap); + else + dp->val.p = (void*) *ap; + continue; + } + // else + switch(type) + { + case nsXPTType::T_I8 : dp->val.i8 = *((int32_t*) ap); break; + case nsXPTType::T_I16 : dp->val.i16 = *((int32_t*) ap); break; + case nsXPTType::T_I32 : dp->val.i32 = *((int32_t*) ap); break; + case nsXPTType::T_DOUBLE : + case nsXPTType::T_U64 : + case nsXPTType::T_I64 : ((DU *)dp)->hi = ((DU *)ap)->hi; + ((DU *)dp)->lo = ((DU *)ap)->lo; + ap++; + break; + case nsXPTType::T_U8 : dp->val.u8 = *((uint32_t*)ap); break; + case nsXPTType::T_U16 : dp->val.u16 = *((uint32_t*)ap); break; + case nsXPTType::T_U32 : dp->val.u32 = *((uint32_t*)ap); break; + case nsXPTType::T_FLOAT : dp->val.f = *((float*) ap); break; + case nsXPTType::T_BOOL : dp->val.b = *((uint32_t*)ap); break; + case nsXPTType::T_CHAR : dp->val.c = *((uint32_t*)ap); break; + case nsXPTType::T_WCHAR : dp->val.wc = *((int32_t*) ap); break; + default: + NS_ERROR("bad type"); + break; + } + } + + result = self->mOuter->CallMethod((uint16_t)methodIndex, info, dispatchParams); + + if(dispatchParams != paramBuffer) + delete [] dispatchParams; + + return result; +} + +extern "C" nsresult SharedStub(int, int*); + +#define STUB_ENTRY(n) \ +nsresult nsXPTCStubBase::Stub##n() \ +{ \ + int dummy; /* defeat tail-call optimization */ \ + return SharedStub(n, &dummy); \ +} + +#define SENTINEL_ENTRY(n) \ +nsresult nsXPTCStubBase::Sentinel##n() \ +{ \ + NS_ERROR("nsXPTCStubBase::Sentinel called"); \ + return NS_ERROR_NOT_IMPLEMENTED; \ +} + +#include "xptcstubsdef.inc" + +#endif /* sparc || __sparc__ */ diff --git a/xpcom/reflect/xptcall/status.html b/xpcom/reflect/xptcall/status.html index deb4da92e..996159c82 100644 --- a/xpcom/reflect/xptcall/status.html +++ b/xpcom/reflect/xptcall/status.html @@ -239,6 +239,20 @@ a port. + +Done +SunOS x86 + +Contributed code! +Arthur Jones <aljones@lbl.gov>
+? +Philip Pokorny <ppokorny@mindspring.com>
+ + +The word I hear is that this is working and done + + + Done Irix -- cgit v1.2.3 From 9d449ce614ef70479228dd119f6361624d4a6b88 Mon Sep 17 00:00:00 2001 From: athenian200 Date: Tue, 1 Oct 2019 06:38:45 -0500 Subject: MoonchildProductions#1251 - Part 2: Make the mozconfig loader POSIX-compliant. https://bugzilla.mozilla.org/show_bug.cgi?id=1360571 Solaris uses ksh as the default shell, and furthermore bash doesn't seem to support the 'local' keyword feature when invoked as sh on OpenIndiana. We could just change the script to use bash (it is an option even on Solaris), but this fix is available and Mozilla has been using it since Firefox 55 with no issues on any other platforms. It was specfically done this way to avoid any need to change existing mozconfig files, so I feel confident saying the change is totally benign and if anything the way it is now is technically a POSIX compliance issue inherited from Mozilla that we'll hit if we ever try to compile this on any Unix platform where bash isn't sh. --- python/mozbuild/mozbuild/mozconfig_loader | 38 +++++++++++++++---------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/python/mozbuild/mozbuild/mozconfig_loader b/python/mozbuild/mozbuild/mozconfig_loader index 6b1e05dce..6c3df47ac 100755 --- a/python/mozbuild/mozbuild/mozconfig_loader +++ b/python/mozbuild/mozbuild/mozconfig_loader @@ -10,49 +10,46 @@ set -e ac_add_options() { - local opt - for opt; do - case "$opt" in + for _mozconfig_opt; do + case "$_mozconfig_opt" in --target=*) echo "------BEGIN_MK_OPTION" - echo $opt | sed s/--target/CONFIG_GUESS/ + echo $_mozconfig_opt | sed s/--target/CONFIG_GUESS/ echo "------END_MK_OPTION" ;; esac echo "------BEGIN_AC_OPTION" - echo $opt + echo $_mozconfig_opt echo "------END_AC_OPTION" done } ac_add_app_options() { - local app - app=$1 + _mozconfig_app=$1 shift echo "------BEGIN_AC_APP_OPTION" - echo $app + echo $_mozconfig_app echo "$*" echo "------END_AC_APP_OPTION" } mk_add_options() { - local opt name op value - for opt; do + for _mozconfig_opt; do echo "------BEGIN_MK_OPTION" - echo $opt + echo $_mozconfig_opt # Remove any leading "export" - opt=${opt#export} - case "$opt" in - *\?=*) op="?=" ;; - *:=*) op=":=" ;; - *+=*) op="+=" ;; - *=*) op="=" ;; + opt=${_mozconfig_opt#export} + case "$_mozconfig_opt" in + *\?=*) _mozconfig_op="?=" ;; + *:=*) _mozconfig_op=":=" ;; + *+=*) _mozconfig_op="+=" ;; + *=*) _mozconfig_op="=" ;; esac # Remove the operator and the value that follows - name=${opt%%${op}*} - # Note: $(echo ${name}) strips the variable from any leading and trailing + _mozconfig_name=${_mozconfig_opt%%${_mozconfig_op}*} + # Note: $(echo ${_mozconfig_name}) strips the variable from any leading and trailing # whitespaces. - eval "$(echo ${name})_IS_SET=1" + eval "$(echo ${_mozconfig_name})_IS_SET=1" echo "------END_MK_OPTION" done } @@ -77,4 +74,5 @@ echo "------END_AFTER_SOURCE" echo "------BEGIN_ENV_AFTER_SOURCE" $3 $4 + echo "------END_ENV_AFTER_SOURCE" -- cgit v1.2.3 From 64e03d0149bed895d00e20e71da775e2aabf2f81 Mon Sep 17 00:00:00 2001 From: athenian200 Date: Tue, 1 Oct 2019 07:26:40 -0500 Subject: MoonchildProductions#1251 - Part 3: Finally end the long tradition of casting getpid() to int. https://bugzilla.mozilla.org/show_bug.cgi?id=535106 https://bugzilla.mozilla.org/show_bug.cgi?id=1359841 Like many parts of the busted Solaris support, this one has its origins in the pre-Firefox days. Bug 535106, another Mozilla suite bug. It keeps coming up because the core issue is never addressed, the fact that nsTSubstring doesn't know how to handle pid_t. I think the explicit cast to int is a band-aid they use because they know if they touch that substring header file to make it handle pid_t, they'll probably be asked to fix all the other problems with it. I honestly think it just works by accident on other platforms because it's implicitly cast to signed or unsigned int, even though the POSIX standard says pid_t can be either long or int, and work as either a signed or unsigned integer. Whatever the case may be, it's handled better on Solaris now than it was. Ironically enough, the main point of having pid_t rather than just having pids be int or something is to hide this little implementation detail so you can just use pid_t for the return type in portable code without having to worry about what it is on a specific platform. The unfortunate way Mozilla implemented string functions turns that on its head and makes the good things about pid_t into liabilities rather than assets. --- xpcom/base/nsTraceRefcnt.cpp | 2 +- xpcom/string/nsTSubstring.h | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/xpcom/base/nsTraceRefcnt.cpp b/xpcom/base/nsTraceRefcnt.cpp index da51305a9..48448dbd9 100644 --- a/xpcom/base/nsTraceRefcnt.cpp +++ b/xpcom/base/nsTraceRefcnt.cpp @@ -657,7 +657,7 @@ InitLog(const char* aEnvVar, const char* aMsg, FILE** aResult) fname.Append('_'); fname.Append((char*)XRE_ChildProcessTypeToString(XRE_GetProcessType())); fname.AppendLiteral("_pid"); - fname.AppendInt((uint32_t)getpid()); + fname.AppendInt(getpid()); if (hasLogExtension) { fname.AppendLiteral(".log"); } diff --git a/xpcom/string/nsTSubstring.h b/xpcom/string/nsTSubstring.h index 53b4fb9a8..2b0723c04 100644 --- a/xpcom/string/nsTSubstring.h +++ b/xpcom/string/nsTSubstring.h @@ -9,6 +9,9 @@ #include "mozilla/MemoryReporting.h" #include "mozilla/IntegerTypeTraits.h" #include "mozilla/Span.h" +#ifdef XP_SOLARIS +#include +#endif #ifndef MOZILLA_INTERNAL_API #error Cannot use internal string classes without MOZILLA_INTERNAL_API defined. Use the frozen header nsStringAPI.h instead. @@ -587,6 +590,17 @@ public: const char* fmt = aRadix == 10 ? "%d" : aRadix == 8 ? "%o" : "%x"; AppendPrintf(fmt, aInteger); } +#ifdef XP_SOLARIS + void AppendInt(pid_t aInteger) + { + AppendPrintf("%lu", aInteger); + } + void AppendInt(pid_t aInteger, int aRadix) + { + const char* fmt = aRadix == 10 ? "%lu" : aRadix == 8 ? "%lo" : "%lx"; + AppendPrintf(fmt, aInteger); + } +#endif void AppendInt(uint32_t aInteger) { AppendPrintf("%u", aInteger); -- cgit v1.2.3 From 4105ebb6ed85aaffec5e4469a939945fb9eea066 Mon Sep 17 00:00:00 2001 From: athenian200 Date: Tue, 1 Oct 2019 18:28:10 -0500 Subject: MoonchildProductions#1251 - Part 4: Core build system changes, lots of libevent/IPC junk. This is mostly ifdefs, but as you can see, Solaris is actually a lot like Linux. They're both more SysV than BSD at core, and most of the differences have more to do with Solaris not using glibc than anything else. I still need to audit a lot of these changes and understand why they're needed and what the alternative approaches are. After this patch, most of the core functionality needed to build Solaris is here. --- build/moz.configure/init.configure | 24 ++ config/external/nspr/pr/moz.build | 14 + config/external/nspr/prcpucfg.h | 2 + dom/media/AudioStream.h | 4 + dom/plugins/ipc/PluginMessageUtils.cpp | 6 +- dom/plugins/ipc/PluginModuleChild.cpp | 4 +- dom/plugins/ipc/PluginModuleChild.h | 2 +- intl/icu/source/common/uposixdefs.h | 2 +- ipc/chromium/chromium-config.mozbuild | 3 + ipc/chromium/moz.build | 11 +- ipc/chromium/src/base/message_loop.cc | 4 +- ipc/chromium/src/base/message_pump_glib.cc | 19 +- ipc/chromium/src/base/message_pump_libevent.cc | 3 + ipc/chromium/src/base/platform_thread.h | 2 +- ipc/chromium/src/base/platform_thread_posix.cc | 4 +- ipc/chromium/src/base/process_util.h | 2 +- ipc/chromium/src/base/process_util_posix.cc | 4 +- ipc/chromium/src/base/sys_info_posix.cc | 8 + ipc/chromium/src/base/time.h | 7 + ipc/chromium/src/base/time_posix.cc | 29 +- ipc/chromium/src/build/build_config.h | 4 +- ipc/chromium/src/chrome/common/transport_dib.h | 6 +- ipc/chromium/src/third_party/libevent/arc4random.c | 6 + ipc/chromium/src/third_party/libevent/event.c | 2 + .../src/third_party/libevent/evutil_rand.c | 2 +- .../src/third_party/libevent/include/event2/util.h | 2 +- .../libevent/solaris/event2/event-config.h | 480 +++++++++++++++++++++ .../src/third_party/libeventcommon.mozbuild | 4 + ipc/chromium/src/third_party/moz.build | 5 + ipc/glue/BrowserProcessSubThread.cpp | 4 +- ipc/glue/BrowserProcessSubThread.h | 2 +- ipc/glue/GeckoChildProcessHost.cpp | 4 +- ipc/glue/MessageLink.cpp | 18 +- python/mozbuild/mozbuild/configure/constants.py | 3 + toolkit/components/terminator/nsTerminator.cpp | 4 + widget/GfxInfoX11.cpp | 9 + xpcom/ds/nsMathUtils.h | 3 +- xpcom/glue/FileUtils.cpp | 2 +- 38 files changed, 682 insertions(+), 32 deletions(-) create mode 100644 ipc/chromium/src/third_party/libevent/solaris/event2/event-config.h diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure index 7664591ad..a275957b7 100644 --- a/build/moz.configure/init.configure +++ b/build/moz.configure/init.configure @@ -336,6 +336,8 @@ def split_triplet(triplet): canonical_os = canonical_kernel = 'NetBSD' elif os.startswith('openbsd'): canonical_os = canonical_kernel = 'OpenBSD' + elif os.startswith('solaris'): + canonical_os = canonical_kernel = 'SunOS' else: die('Unknown OS: %s' % os) @@ -569,6 +571,28 @@ def target_is_linux(target): set_define('XP_LINUX', target_is_linux) +@depends(target) +def target_is_solaris(target): + if target.kernel == 'SunOS': + return True + +set_define('XP_SOLARIS', target_is_solaris) + +@depends(target) +def target_is_sparc(target): + if target.cpu == 'sparc': + return True + +set_define('SPARC', target_is_sparc) + +@depends(target) +def target_is_sparc64(target): + if target.cpu == 'sparc64': + return True + +set_define('SPARC64', target_is_sparc64) + + # The application/project to build # ============================================================== option('--enable-application', nargs=1, env='MOZ_BUILD_APP', diff --git a/config/external/nspr/pr/moz.build b/config/external/nspr/pr/moz.build index af710f850..02811aae8 100644 --- a/config/external/nspr/pr/moz.build +++ b/config/external/nspr/pr/moz.build @@ -51,6 +51,19 @@ elif CONFIG['OS_TARGET'] == 'Darwin': ] if not CONFIG['MOZ_IOS']: DEFINES['HAVE_CRT_EXTERNS_H'] = True +elif CONFIG['OS_TARGET'] == 'SunOS': + DEFINES.update( + HAVE_FCNTL_FILE_LOCKING=True, + HAVE_SOCKLEN_T=True, + _PR_HAVE_OFF64_T=True, + _PR_INET6=True, + ) + DEFINES['SOLARIS'] = True + SOURCES += ['/nsprpub/pr/src/md/unix/solaris.c'] + if CONFIG['CPU_ARCH'] == 'x86_64': + SOURCES += ['/nsprpub/pr/src/md/unix/os_SunOS_x86_64.s'] + elif CONFIG['CPU_ARCH'] == 'x86': + SOURCES += ['/nsprpub/pr/src/md/unix/os_SunOS/x86.s'] elif CONFIG['OS_TARGET'] == 'WINNT': OS_LIBS += [ 'advapi32', @@ -224,6 +237,7 @@ EXPORTS.nspr.md += [ '/nsprpub/pr/include/md/_linux.cfg', '/nsprpub/pr/include/md/_netbsd.cfg', '/nsprpub/pr/include/md/_openbsd.cfg', + '/nsprpub/pr/include/md/_solaris.cfg', '/nsprpub/pr/include/md/_win95.cfg', ] diff --git a/config/external/nspr/prcpucfg.h b/config/external/nspr/prcpucfg.h index 5f7962733..8769abeeb 100644 --- a/config/external/nspr/prcpucfg.h +++ b/config/external/nspr/prcpucfg.h @@ -22,6 +22,8 @@ #include "md/_openbsd.cfg" #elif defined(__linux__) #include "md/_linux.cfg" +#elif defined(__sun__) +#include "md/_solaris.cfg" #else #error "Unsupported platform!" #endif diff --git a/dom/media/AudioStream.h b/dom/media/AudioStream.h index acc38b93d..13cbb0c75 100644 --- a/dom/media/AudioStream.h +++ b/dom/media/AudioStream.h @@ -17,6 +17,10 @@ #include "mozilla/UniquePtr.h" #include "CubebUtils.h" #include "soundtouch/SoundTouchFactory.h" +#if defined(XP_SOLARIS) +#include "soundtouch/SoundTouch.h" +#endif + namespace mozilla { diff --git a/dom/plugins/ipc/PluginMessageUtils.cpp b/dom/plugins/ipc/PluginMessageUtils.cpp index 47653fe6e..5b1d1667f 100644 --- a/dom/plugins/ipc/PluginMessageUtils.cpp +++ b/dom/plugins/ipc/PluginMessageUtils.cpp @@ -82,7 +82,7 @@ MediateRace(const MessageChannel::MessageInfo& parent, } } -#if defined(OS_LINUX) +#if defined(OS_LINUX) || defined(OS_SOLARIS) static string ReplaceAll(const string& haystack, const string& needle, const string& with) { @@ -101,7 +101,7 @@ ReplaceAll(const string& haystack, const string& needle, const string& with) string MungePluginDsoPath(const string& path) { -#if defined(OS_LINUX) +#if defined(OS_LINUX) || defined(OS_SOLARIS) // https://bugzilla.mozilla.org/show_bug.cgi?id=519601 return ReplaceAll(path, "netscape", "netsc@pe"); #else @@ -112,7 +112,7 @@ MungePluginDsoPath(const string& path) string UnmungePluginDsoPath(const string& munged) { -#if defined(OS_LINUX) +#if defined(OS_LINUX) || defined(OS_SOLARIS) return ReplaceAll(munged, "netsc@pe", "netscape"); #else return munged; diff --git a/dom/plugins/ipc/PluginModuleChild.cpp b/dom/plugins/ipc/PluginModuleChild.cpp index cbf6e509f..102c44a5e 100644 --- a/dom/plugins/ipc/PluginModuleChild.cpp +++ b/dom/plugins/ipc/PluginModuleChild.cpp @@ -1821,7 +1821,7 @@ PluginModuleChild::AnswerNP_GetEntryPoints(NPError* _retval) AssertPluginThread(); MOZ_ASSERT(mIsChrome); -#if defined(OS_LINUX) || defined(OS_BSD) +#if defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS) return true; #elif defined(OS_WIN) || defined(OS_MACOSX) *_retval = mGetEntryPointsFunc(&mFunctions); @@ -1866,7 +1866,7 @@ PluginModuleChild::DoNP_Initialize(const PluginSettings& aSettings) #endif NPError result; -#if defined(OS_LINUX) || defined(OS_BSD) +#if defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS) result = mInitializeFunc(&sBrowserFuncs, &mFunctions); #elif defined(OS_WIN) || defined(OS_MACOSX) result = mInitializeFunc(&sBrowserFuncs); diff --git a/dom/plugins/ipc/PluginModuleChild.h b/dom/plugins/ipc/PluginModuleChild.h index 681743582..5e4fa7d20 100644 --- a/dom/plugins/ipc/PluginModuleChild.h +++ b/dom/plugins/ipc/PluginModuleChild.h @@ -258,7 +258,7 @@ private: // we get this from the plugin NP_PLUGINSHUTDOWN mShutdownFunc; -#if defined(OS_LINUX) || defined(OS_BSD) +#if defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS) NP_PLUGINUNIXINIT mInitializeFunc; #elif defined(OS_WIN) || defined(OS_MACOSX) NP_PLUGININIT mInitializeFunc; diff --git a/intl/icu/source/common/uposixdefs.h b/intl/icu/source/common/uposixdefs.h index 495deea49..a5b7fd09f 100644 --- a/intl/icu/source/common/uposixdefs.h +++ b/intl/icu/source/common/uposixdefs.h @@ -54,7 +54,7 @@ * * z/OS needs this definition for timeval and to get usleep. */ -#if !defined(_XOPEN_SOURCE_EXTENDED) +#if !defined(_XOPEN_SOURCE_EXTENDED) && (U_PLATFORM != U_PF_SOLARIS) # define _XOPEN_SOURCE_EXTENDED 1 #endif diff --git a/ipc/chromium/chromium-config.mozbuild b/ipc/chromium/chromium-config.mozbuild index 9df182cb8..f045bca54 100644 --- a/ipc/chromium/chromium-config.mozbuild +++ b/ipc/chromium/chromium-config.mozbuild @@ -41,6 +41,9 @@ else: if CONFIG['OS_ARCH'] == 'Darwin': DEFINES['OS_MACOSX'] = 1 + elif CONFIG['OS_ARCH'] == 'SunOS': + DEFINES['OS_SOLARIS'] = 1 + elif CONFIG['OS_ARCH'] == 'DragonFly': DEFINES.update({ 'OS_DRAGONFLY': 1, diff --git a/ipc/chromium/moz.build b/ipc/chromium/moz.build index f047e7011..ba5f4e512 100644 --- a/ipc/chromium/moz.build +++ b/ipc/chromium/moz.build @@ -132,12 +132,21 @@ if os_linux: DEFINES['ANDROID'] = True DEFINES['_POSIX_MONOTONIC_CLOCK'] = 0 -if os_bsd or os_linux: +if os_bsd or os_linux or os_solaris: if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']: SOURCES += [ 'src/base/message_pump_glib.cc', ] +if os_solaris: + SOURCES += [ + 'src/base/atomicops_internals_x86_gcc.cc', + 'src/base/process_util_linux.cc', + 'src/base/time_posix.cc', +] + +LOCAL_INCLUDES += ['src/third_party/libevent/linux'] + ost = CONFIG['OS_TEST'] if '86' not in ost and 'arm' not in ost and 'aarch64' != ost and 'mips' not in ost: SOURCES += [ diff --git a/ipc/chromium/src/base/message_loop.cc b/ipc/chromium/src/base/message_loop.cc index 3c794b276..638018feb 100644 --- a/ipc/chromium/src/base/message_loop.cc +++ b/ipc/chromium/src/base/message_loop.cc @@ -21,7 +21,7 @@ #if defined(OS_POSIX) #include "base/message_pump_libevent.h" #endif -#if defined(OS_LINUX) || defined(OS_BSD) +#if defined(OS_LINUX) || defined(OS_BSD) || defined (OS_SOLARIS) #if defined(MOZ_WIDGET_GTK) #include "base/message_pump_glib.h" #endif @@ -149,7 +149,7 @@ MessageLoop::MessageLoop(Type type, nsIThread* aThread) if (type_ == TYPE_UI) { #if defined(OS_MACOSX) pump_ = base::MessagePumpMac::Create(); -#elif defined(OS_LINUX) || defined(OS_BSD) +#elif defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS) pump_ = new base::MessagePumpForUI(); #endif // OS_LINUX } else if (type_ == TYPE_IO) { diff --git a/ipc/chromium/src/base/message_pump_glib.cc b/ipc/chromium/src/base/message_pump_glib.cc index 36ebfdd69..a5e719c72 100644 --- a/ipc/chromium/src/base/message_pump_glib.cc +++ b/ipc/chromium/src/base/message_pump_glib.cc @@ -9,6 +9,9 @@ #include #include +#if defined(OS_SOLARIS) +#include +#endif #include #include @@ -131,6 +134,12 @@ MessagePumpForUI::MessagePumpForUI() // Create our wakeup pipe, which is used to flag when work was scheduled. int fds[2]; CHECK(pipe(fds) == 0); +#if defined(OS_SOLARIS) + int flags = fcntl(fds[0], F_GETFL,0); + if (flags == -1) + flags = 0; + fntl(fds[0], F_SETFL, flags | O_NDELAY); +#endif wakeup_pipe_read_ = fds[0]; wakeup_pipe_write_ = fds[1]; wakeup_gpollfd_->fd = wakeup_pipe_read_; @@ -238,11 +247,15 @@ bool MessagePumpForUI::HandleCheck() { // whether there was data, so this read shouldn't block. if (wakeup_gpollfd_->revents & G_IO_IN) { pipe_full_ = false; - +#ifndef OS_SOLARIS char msg; if (HANDLE_EINTR(read(wakeup_pipe_read_, &msg, 1)) != 1 || msg != '!') { NOTREACHED() << "Error reading from the wakeup pipe."; } +#else + char buf[32]; + while (HANDLE_EINTR(read(wakeup_pipe_read_, &buf, 32))); +#endif // Since we ate the message, we need to record that we have more work, // because HandleCheck() may be called without HandleDispatch being called // afterwards. @@ -311,6 +324,10 @@ void MessagePumpForUI::ScheduleWork() { // variables as we would then need locks all over. This ensures that if // we are sleeping in a poll that we will wake up. char msg = '!'; +#if defined(OS_SOLARIS) + char buf[32]; + while (HANDLE_EINTR(read(wakeup_pipe_read_, &buf, 32))); +#endif if (HANDLE_EINTR(write(wakeup_pipe_write_, &msg, 1)) != 1) { NOTREACHED() << "Could not write to the UI message loop wakeup pipe!"; } diff --git a/ipc/chromium/src/base/message_pump_libevent.cc b/ipc/chromium/src/base/message_pump_libevent.cc index 3cca238c1..daba7c2fe 100644 --- a/ipc/chromium/src/base/message_pump_libevent.cc +++ b/ipc/chromium/src/base/message_pump_libevent.cc @@ -8,6 +8,9 @@ #include #include +#if defined(OS_SOLARIS) +#include +#endif #if defined(ANDROID) || defined(OS_POSIX) #include #endif diff --git a/ipc/chromium/src/base/platform_thread.h b/ipc/chromium/src/base/platform_thread.h index 727a13a84..3432128a6 100644 --- a/ipc/chromium/src/base/platform_thread.h +++ b/ipc/chromium/src/base/platform_thread.h @@ -24,7 +24,7 @@ typedef void* PlatformThreadHandle; // HANDLE #elif defined(OS_POSIX) #include typedef pthread_t PlatformThreadHandle; -#if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(__GLIBC__) +#if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_SOLARIS) || defined(__GLIBC__) #include typedef pid_t PlatformThreadId; #elif defined(OS_BSD) diff --git a/ipc/chromium/src/base/platform_thread_posix.cc b/ipc/chromium/src/base/platform_thread_posix.cc index 4acd95f23..fdb2d9200 100644 --- a/ipc/chromium/src/base/platform_thread_posix.cc +++ b/ipc/chromium/src/base/platform_thread_posix.cc @@ -49,7 +49,7 @@ PlatformThreadId PlatformThread::CurrentId() { return port; #elif defined(OS_LINUX) return syscall(__NR_gettid); -#elif defined(OS_OPENBSD) || defined(__GLIBC__) +#elif defined(OS_OPENBSD) || defined(OS_SOLARIS) || defined(__GLIBC__) return (intptr_t) (pthread_self()); #elif defined(OS_NETBSD) return _lwp_self(); @@ -103,6 +103,8 @@ void PlatformThread::SetName(const char* name) { pthread_setname_np(pthread_self(), "%s", (void *)name); #elif defined(OS_BSD) && !defined(__GLIBC__) pthread_set_name_np(pthread_self(), name); +#elif defined(OS_SOLARIS) + pthread_setname_np(pthread_self(), name); #else #endif } diff --git a/ipc/chromium/src/base/process_util.h b/ipc/chromium/src/base/process_util.h index 4df1f29fb..2b257b587 100644 --- a/ipc/chromium/src/base/process_util.h +++ b/ipc/chromium/src/base/process_util.h @@ -19,7 +19,7 @@ #ifndef STDOUT_FILENO #define STDOUT_FILENO 1 #endif -#elif defined(OS_LINUX) || defined(__GLIBC__) +#elif defined(OS_LINUX) || defined(OS_SOLARIS) || defined(__GLIBC__) #include #include #include diff --git a/ipc/chromium/src/base/process_util_posix.cc b/ipc/chromium/src/base/process_util_posix.cc index ade3ebe5e..3eb952a32 100644 --- a/ipc/chromium/src/base/process_util_posix.cc +++ b/ipc/chromium/src/base/process_util_posix.cc @@ -117,7 +117,7 @@ void CloseSuperfluousFds(const base::InjectiveMultimap& saved_mapping) { #if defined(ANDROID) static const rlim_t kSystemDefaultMaxFds = 1024; static const char kFDDir[] = "/proc/self/fd"; -#elif defined(OS_LINUX) +#elif defined(OS_LINUX) || defined(OS_SOLARIS) static const rlim_t kSystemDefaultMaxFds = 8192; static const char kFDDir[] = "/proc/self/fd"; #elif defined(OS_MACOSX) @@ -209,7 +209,7 @@ void CloseSuperfluousFds(const base::InjectiveMultimap& saved_mapping) { // TODO(agl): Remove this function. It's fundamentally broken for multithreaded // apps. void SetAllFDsToCloseOnExec() { -#if defined(OS_LINUX) +#if defined(OS_LINUX) || defined(OS_SOLARIS) const char fd_dir[] = "/proc/self/fd"; #elif defined(OS_MACOSX) || defined(OS_BSD) const char fd_dir[] = "/dev/fd"; diff --git a/ipc/chromium/src/base/sys_info_posix.cc b/ipc/chromium/src/base/sys_info_posix.cc index 81ec78053..1b88883eb 100644 --- a/ipc/chromium/src/base/sys_info_posix.cc +++ b/ipc/chromium/src/base/sys_info_posix.cc @@ -121,7 +121,11 @@ std::wstring SysInfo::GetEnvVar(const wchar_t* var) { // static std::string SysInfo::OperatingSystemName() { +#if !defined(XP_SOLARIS) utsname info; +#else + struct utsname info; +#endif if (uname(&info) < 0) { NOTREACHED(); return ""; @@ -131,7 +135,11 @@ std::string SysInfo::OperatingSystemName() { // static std::string SysInfo::CPUArchitecture() { +#if !defined(XP_SOLARIS) utsname info; +#else + struct utsname info; +#endif if (uname(&info) < 0) { NOTREACHED(); return ""; diff --git a/ipc/chromium/src/base/time.h b/ipc/chromium/src/base/time.h index 55bc7b451..6a5c92d14 100644 --- a/ipc/chromium/src/base/time.h +++ b/ipc/chromium/src/base/time.h @@ -64,6 +64,10 @@ class TimeDelta { return delta_; } +#if defined(OS_SOLARIS) + struct timespec ToTimeSpec() const; +#endif + // Returns the time delta in some unit. The F versions return a floating // point value, the "regular" versions return a rounded-down value. int InDays() const; @@ -226,6 +230,9 @@ class Time { static Time FromDoubleT(double dt); double ToDoubleT() const; +#if defined(OS_SOLARIS) + struct timeval ToTimeVal() const; +#endif #if defined(OS_WIN) static Time FromFileTime(FILETIME ft); diff --git a/ipc/chromium/src/base/time_posix.cc b/ipc/chromium/src/base/time_posix.cc index 2eb76a989..419cc8afb 100644 --- a/ipc/chromium/src/base/time_posix.cc +++ b/ipc/chromium/src/base/time_posix.cc @@ -67,11 +67,13 @@ Time Time::FromExploded(bool is_local, const Exploded& exploded) { timestruct.tm_wday = exploded.day_of_week; // mktime/timegm ignore this timestruct.tm_yday = 0; // mktime/timegm ignore this timestruct.tm_isdst = -1; // attempt to figure it out +#ifndef OS_SOLARIS timestruct.tm_gmtoff = 0; // not a POSIX field, so mktime/timegm ignore timestruct.tm_zone = NULL; // not a POSIX field, so mktime/timegm ignore +#endif time_t seconds; -#ifdef ANDROID +#if defined(ANDROID) || defined(OS_SOLARIS) seconds = mktime(×truct); #else if (is_local) @@ -175,7 +177,7 @@ TimeTicks TimeTicks::Now() { // With numer and denom = 1 (the expected case), the 64-bit absolute time // reported in nanoseconds is enough to last nearly 585 years. -#elif defined(OS_OPENBSD) || defined(OS_POSIX) && \ +#elif defined(OS_OPENBSD) || defined(OS_SOLARIS) || defined(OS_POSIX) && \ defined(_POSIX_MONOTONIC_CLOCK) && _POSIX_MONOTONIC_CLOCK >= 0 struct timespec ts; @@ -200,4 +202,27 @@ TimeTicks TimeTicks::HighResNow() { return Now(); } +#if defined(OS_SOLARIS) +struct timespec TimeDelta::ToTimeSpec() const { + int64_t microseconds = InMicroseconds(); + time_t seconds = 0; + if (microseconds >= Time::kMicrosecondsPerSecond) { + seconds = InSeconds(); + microseconds -= seconds * Time::kMicrosecondsPerSecond; + } + struct timespec result = + {seconds, + microseconds * Time::kNanosecondsPerMicrosecond}; + return result; +} + +struct timeval Time::ToTimeVal() const { + struct timeval result; + int64_t us = us_ - kTimeTToMicrosecondsOffset; + result.tv_sec = us / Time::kMicrosecondsPerSecond; + result.tv_usec = us % Time::kMicrosecondsPerSecond; + return result; +} +#endif + } // namespace base diff --git a/ipc/chromium/src/build/build_config.h b/ipc/chromium/src/build/build_config.h index 390fa77a8..7e6beb37a 100644 --- a/ipc/chromium/src/build/build_config.h +++ b/ipc/chromium/src/build/build_config.h @@ -32,6 +32,8 @@ #define OS_NETBSD 1 #elif defined(__OpenBSD__) #define OS_OPENBSD 1 +#elif defined(__sun__) +#define OS_SOLARIS 1 #elif defined(_WIN32) #define OS_WIN 1 #else @@ -47,7 +49,7 @@ // For access to standard POSIX features, use OS_POSIX instead of a more // specific macro. -#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_BSD) +#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS) #define OS_POSIX 1 #endif diff --git a/ipc/chromium/src/chrome/common/transport_dib.h b/ipc/chromium/src/chrome/common/transport_dib.h index b1e5c0fab..e3c40768c 100644 --- a/ipc/chromium/src/chrome/common/transport_dib.h +++ b/ipc/chromium/src/chrome/common/transport_dib.h @@ -68,7 +68,7 @@ class TransportDIB { typedef base::SharedMemoryHandle Handle; // On Mac, the inode number of the backing file is used as an id. typedef base::SharedMemoryId Id; -#elif defined(OS_LINUX) +#elif defined(OS_LINUX) || defined(OS_SOLARIS) typedef int Handle; // These two ints are SysV IPC shared memory keys typedef int Id; #endif @@ -98,7 +98,7 @@ class TransportDIB { // wire to give this transport DIB to another process. Handle handle() const; -#if defined(OS_LINUX) +#if defined(OS_LINUX) || defined(OS_SOLARIS) // Map the shared memory into the X server and return an id for the shared // segment. XID MapToX(Display* connection); @@ -109,7 +109,7 @@ class TransportDIB { #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_BSD) explicit TransportDIB(base::SharedMemoryHandle dib); base::SharedMemory shared_memory_; -#elif defined(OS_LINUX) +#elif defined(OS_LINUX) || defined(OS_SOLARIS) int key_; // SysV shared memory id void* address_; // mapped address XID x_shm_; // X id for the shared segment diff --git a/ipc/chromium/src/third_party/libevent/arc4random.c b/ipc/chromium/src/third_party/libevent/arc4random.c index cabc46f4b..0dd6934ef 100644 --- a/ipc/chromium/src/third_party/libevent/arc4random.c +++ b/ipc/chromium/src/third_party/libevent/arc4random.c @@ -41,6 +41,10 @@ * RC4 is a registered trademark of RSA Laboratories. */ +#ifdef XP_SOLARIS +#include "build/build_config.h" +#endif + #ifndef ARC4RANDOM_EXPORT #define ARC4RANDOM_EXPORT #endif @@ -477,6 +481,7 @@ arc4random(void) } #endif +#if defined(_we_have_arc4random_buf) || !defined(XP_SOLARIS) ARC4RANDOM_EXPORT void arc4random_buf(void *_buf, size_t n) { @@ -490,6 +495,7 @@ arc4random_buf(void *_buf, size_t n) } _ARC4_UNLOCK(); } +#endif #ifndef ARC4RANDOM_NOUNIFORM /* diff --git a/ipc/chromium/src/third_party/libevent/event.c b/ipc/chromium/src/third_party/libevent/event.c index a979f1f26..f6b44bcaf 100644 --- a/ipc/chromium/src/third_party/libevent/event.c +++ b/ipc/chromium/src/third_party/libevent/event.c @@ -2883,8 +2883,10 @@ event_global_setup_locks_(const int enable_locks) #endif if (evsig_global_setup_locks_(enable_locks) < 0) return -1; +#ifndef OS_SOLARIS if (evutil_secure_rng_global_setup_locks_(enable_locks) < 0) return -1; +#endif return 0; } #endif diff --git a/ipc/chromium/src/third_party/libevent/evutil_rand.c b/ipc/chromium/src/third_party/libevent/evutil_rand.c index 3bab23121..7c92bae23 100644 --- a/ipc/chromium/src/third_party/libevent/evutil_rand.c +++ b/ipc/chromium/src/third_party/libevent/evutil_rand.c @@ -139,7 +139,7 @@ evutil_secure_rng_get_bytes(void *buf, size_t n) ev_arc4random_buf(buf, n); } -#if !defined(__OpenBSD__) && !defined(ANDROID) +#if !defined(__OpenBSD__) && !defined(ANDROID) && !defined(__sun__) void evutil_secure_rng_add_bytes(const char *buf, size_t n) { diff --git a/ipc/chromium/src/third_party/libevent/include/event2/util.h b/ipc/chromium/src/third_party/libevent/include/event2/util.h index 42a28adcb..78516c156 100644 --- a/ipc/chromium/src/third_party/libevent/include/event2/util.h +++ b/ipc/chromium/src/third_party/libevent/include/event2/util.h @@ -672,7 +672,7 @@ void evutil_secure_rng_get_bytes(void *buf, size_t n); */ int evutil_secure_rng_init(void); -#if !defined(__OpenBSD__) && !defined(ANDROID) +#if !defined(__OpenBSD__) && !defined(ANDROID) && !defined(__sun__) /** Seed the random number generator with extra random bytes. You should almost never need to call this function; it should be diff --git a/ipc/chromium/src/third_party/libevent/solaris/event2/event-config.h b/ipc/chromium/src/third_party/libevent/solaris/event2/event-config.h new file mode 100644 index 000000000..73000106b --- /dev/null +++ b/ipc/chromium/src/third_party/libevent/solaris/event2/event-config.h @@ -0,0 +1,480 @@ +/* event2/event-config.h + * + * This file was generated by autoconf when libevent was built, and post- + * processed by Libevent so that its macros would have a uniform prefix. + * + * DO NOT EDIT THIS FILE. + * + * Do not rely on macros in this file existing in later versions. + */ + +#ifndef _EVENT2_EVENT_CONFIG_H_ +#define _EVENT2_EVENT_CONFIG_H_ + +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define if libevent should build without support for a debug mode */ +/* #undef _EVENT_DISABLE_DEBUG_MODE */ + +/* Define if libevent should not allow replacing the mm functions */ +/* #undef _EVENT_DISABLE_MM_REPLACEMENT */ + +/* Define if libevent should not be compiled with thread support */ +/* #undef _EVENT_DISABLE_THREAD_SUPPORT */ + +/* Define to 1 if you have the `arc4random' function. */ +#define _EVENT_HAVE_ARC4RANDOM 1 + +/* Define to 1 if you have the `arc4random_buf' function. */ +#define _EVENT_HAVE_ARC4RANDOM_BUF 1 + +/* Define to 1 if you have the header file. */ +#define _EVENT_HAVE_ARPA_INET_H 1 + +/* Define to 1 if you have the `clock_gettime' function. */ +#define _EVENT_HAVE_CLOCK_GETTIME 1 + +/* Define to 1 if you have the declaration of `CTL_KERN', and to 0 if you + don't. */ +/* #undef _EVENT_HAVE_DECL_CTL_KERN */ + +/* Define to 1 if you have the declaration of `KERN_ARND', and to 0 if you + don't. */ +/* #undef _EVENT_HAVE_DECL_KERN_ARND */ + +/* Define to 1 if you have the declaration of `KERN_RANDOM', and to 0 if you + don't. */ +/* #undef _EVENT_HAVE_DECL_KERN_RANDOM */ + +/* Define to 1 if you have the declaration of `RANDOM_UUID', and to 0 if you + don't. */ +/* #undef _EVENT_HAVE_DECL_RANDOM_UUID */ + +/* Define if /dev/poll is available */ +#define _EVENT_HAVE_DEVPOLL 1 + +/* Define to 1 if you have the header file. */ +#define _EVENT_HAVE_DLFCN_H 1 + +/* Define if your system supports the epoll system calls */ +#undef _EVENT_HAVE_EPOLL + +/* Define to 1 if you have the `epoll_ctl' function. */ +/* #undef _EVENT_HAVE_EPOLL_CTL */ + +/* Define to 1 if you have the `eventfd' function. */ +/* #undef _EVENT_HAVE_EVENTFD */ + +/* Define if your system supports event ports */ +/*#define _EVENT_HAVE_EVENT_PORTS 1*/ + +/* Define to 1 if you have the `fcntl' function. */ +#define _EVENT_HAVE_FCNTL 1 + +/* Define to 1 if you have the header file. */ +#define _EVENT_HAVE_FCNTL_H 1 + +/* Define to 1 if the system has the type `fd_mask'. */ +#define _EVENT_HAVE_FD_MASK 1 + +/* Do we have getaddrinfo()? */ +#define _EVENT_HAVE_GETADDRINFO 1 + +/* Define to 1 if you have the `getegid' function. */ +#define _EVENT_HAVE_GETEGID 1 + +/* Define to 1 if you have the `geteuid' function. */ +#define _EVENT_HAVE_GETEUID 1 + +/* Define this if you have any gethostbyname_r() */ +/* #undef _EVENT_HAVE_GETHOSTBYNAME_R */ + +/* Define this if gethostbyname_r takes 3 arguments */ +/* #undef _EVENT_HAVE_GETHOSTBYNAME_R_3_ARG */ + +/* Define this if gethostbyname_r takes 5 arguments */ +/* #undef _EVENT_HAVE_GETHOSTBYNAME_R_5_ARG */ + +/* Define this if gethostbyname_r takes 6 arguments */ +/* #undef _EVENT_HAVE_GETHOSTBYNAME_R_6_ARG */ + +/* Define to 1 if you have the `getnameinfo' function. */ +#define _EVENT_HAVE_GETNAMEINFO 1 + +/* Define to 1 if you have the `getprotobynumber' function. */ +#define _EVENT_HAVE_GETPROTOBYNUMBER 1 + +/* Define to 1 if you have the `getservbyname' function. */ +/* #undef _EVENT_HAVE_GETSERVBYNAME */ + +/* Define to 1 if you have the `gettimeofday' function. */ +#define _EVENT_HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the `inet_aton' function. */ +#define _EVENT_HAVE_INET_ATON 1 + +/* Define to 1 if you have the `inet_ntop' function. */ +#define _EVENT_HAVE_INET_NTOP 1 + +/* Define to 1 if you have the `inet_pton' function. */ +#define _EVENT_HAVE_INET_PTON 1 + +/* Define to 1 if you have the header file. */ +#define _EVENT_HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `issetugid' function. */ +#define _EVENT_HAVE_ISSETUGID 1 + +/* Define to 1 if you have the `kqueue' function. */ +/* #undef _EVENT_HAVE_KQUEUE */ + +/* Define if the system has zlib */ +#define _EVENT_HAVE_LIBZ 1 + +/* Define to 1 if you have the header file. */ +#define _EVENT_HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `mmap' function. */ +#define _EVENT_HAVE_MMAP 1 + +/* Define to 1 if you have the header file. */ +#define _EVENT_HAVE_NETDB_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef _EVENT_HAVE_NETINET_IN6_H */ + +/* Define to 1 if you have the header file. */ +#define _EVENT_HAVE_NETINET_IN_H 1 + +/* Define if the system has openssl */ +#define _EVENT_HAVE_OPENSSL 1 + +/* Define to 1 if you have the header file. */ +#define _EVENT_HAVE_OPENSSL_BIO_H 1 + +/* Define to 1 if you have the `pipe' function. */ +#define _EVENT_HAVE_PIPE 1 + +/* Define to 1 if you have the `poll' function. */ +#define _EVENT_HAVE_POLL 1 + +/* Define to 1 if you have the header file. */ +#define _EVENT_HAVE_POLL_H 1 + +/* Define to 1 if you have the `port_create' function. */ +#define _EVENT_HAVE_PORT_CREATE 1 + +/* Define to 1 if you have the header file. */ +#define _EVENT_HAVE_PORT_H 1 + +/* Define if you have POSIX threads libraries and header files. */ +/* #undef _EVENT_HAVE_PTHREAD */ + +/* Define if we have pthreads on this system */ +#define _EVENT_HAVE_PTHREADS 1 + +/* Define to 1 if you have the `putenv' function. */ +#define _EVENT_HAVE_PUTENV 1 + +/* Define to 1 if the system has the type `sa_family_t'. */ +#define _EVENT_HAVE_SA_FAMILY_T 1 + +/* Define to 1 if you have the `select' function. */ +#define _EVENT_HAVE_SELECT 1 + +/* Define to 1 if you have the `sendfile' function. */ +#define _EVENT_HAVE_SENDFILE 1 + +/* Define to 1 if you have the `setenv' function. */ +#define _EVENT_HAVE_SETENV 1 + +/* Define if F_SETFD is defined in */ +#define _EVENT_HAVE_SETFD 1 + +/* Define to 1 if you have the `sigaction' function. */ +#define _EVENT_HAVE_SIGACTION 1 + +/* Define to 1 if you have the `signal' function. */ +#define _EVENT_HAVE_SIGNAL 1 + +/* Define to 1 if you have the `splice' function. */ +/* #undef _EVENT_HAVE_SPLICE */ + +/* Define to 1 if you have the header file. */ +#define _EVENT_HAVE_STDARG_H 1 + +/* Define to 1 if you have the header file. */ +#define _EVENT_HAVE_STDDEF_H 1 + +/* Define to 1 if you have the header file. */ +#define _EVENT_HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define _EVENT_HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define _EVENT_HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define _EVENT_HAVE_STRING_H 1 + +/* Define to 1 if you have the `strlcpy' function. */ +#define _EVENT_HAVE_STRLCPY 1 + +/* Define to 1 if you have the `strsep' function. */ +#define _EVENT_HAVE_STRSEP 1 + +/* Define to 1 if you have the `strtok_r' function. */ +#define _EVENT_HAVE_STRTOK_R 1 + +/* Define to 1 if you have the `strtoll' function. */ +#define _EVENT_HAVE_STRTOLL 1 + +/* Define to 1 if the system has the type `struct addrinfo'. */ +#define _EVENT_HAVE_STRUCT_ADDRINFO 1 + +/* Define to 1 if the system has the type `struct in6_addr'. */ +#define _EVENT_HAVE_STRUCT_IN6_ADDR 1 + +/* Define to 1 if `s6_addr16' is a member of `struct in6_addr'. */ +/* #undef _EVENT_HAVE_STRUCT_IN6_ADDR_S6_ADDR16 */ + +/* Define to 1 if `s6_addr32' is a member of `struct in6_addr'. */ +/* #undef _EVENT_HAVE_STRUCT_IN6_ADDR_S6_ADDR32 */ + +/* Define to 1 if the system has the type `struct sockaddr_in6'. */ +#define _EVENT_HAVE_STRUCT_SOCKADDR_IN6 1 + +/* Define to 1 if `sin6_len' is a member of `struct sockaddr_in6'. */ +/* #undef _EVENT_HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN */ + +/* Define to 1 if `sin_len' is a member of `struct sockaddr_in'. */ +/* #undef _EVENT_HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */ + +/* Define to 1 if the system has the type `struct sockaddr_storage'. */ +#define _EVENT_HAVE_STRUCT_SOCKADDR_STORAGE 1 + +/* Define to 1 if `ss_family' is a member of `struct sockaddr_storage'. */ +#define _EVENT_HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY 1 + +/* Define to 1 if `__ss_family' is a member of `struct sockaddr_storage'. */ +/* #undef _EVENT_HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY */ + +/* Define to 1 if you have the `sysctl' function. */ +/* #undef _EVENT_HAVE_SYSCTL */ + +/* Define to 1 if you have the header file. */ +#define _EVENT_HAVE_SYS_DEVPOLL_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef _EVENT_HAVE_SYS_EPOLL_H */ + +/* Define to 1 if you have the header file. */ +/* #undef _EVENT_HAVE_SYS_EVENTFD_H */ + +/* Define to 1 if you have the header file. */ +/* #undef _EVENT_HAVE_SYS_EVENT_H */ + +/* Define to 1 if you have the header file. */ +#define _EVENT_HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the header file. */ +#define _EVENT_HAVE_SYS_MMAN_H 1 + +/* Define to 1 if you have the header file. */ +#define _EVENT_HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +#define _EVENT_HAVE_SYS_QUEUE_H 1 + +/* Define to 1 if you have the header file. */ +#define _EVENT_HAVE_SYS_SELECT_H 1 + +/* Define to 1 if you have the header file. */ +#define _EVENT_HAVE_SYS_SENDFILE_H 1 + +/* Define to 1 if you have the header file. */ +#define _EVENT_HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +#define _EVENT_HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#undef _EVENT_HAVE_SYS_SYSCTL_H + +/* Define to 1 if you have the header file. */ +#define _EVENT_HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define _EVENT_HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define _EVENT_HAVE_SYS_UIO_H 1 + +/* Define to 1 if you have the header file. */ +#define _EVENT_HAVE_SYS_WAIT_H 1 + +/* Define if TAILQ_FOREACH is defined in */ +#define _EVENT_HAVE_TAILQFOREACH 1 + +/* Define if timeradd is defined in */ +#define _EVENT_HAVE_TIMERADD 1 + +/* Define if timerclear is defined in */ +#define _EVENT_HAVE_TIMERCLEAR 1 + +/* Define if timercmp is defined in */ +#define _EVENT_HAVE_TIMERCMP 1 + +/* Define if timerisset is defined in */ +#define _EVENT_HAVE_TIMERISSET 1 + +/* Define to 1 if the system has the type `uint16_t'. */ +#define _EVENT_HAVE_UINT16_T 1 + +/* Define to 1 if the system has the type `uint32_t'. */ +#define _EVENT_HAVE_UINT32_T 1 + +/* Define to 1 if the system has the type `uint64_t'. */ +#define _EVENT_HAVE_UINT64_T 1 + +/* Define to 1 if the system has the type `uint8_t'. */ +#define _EVENT_HAVE_UINT8_T 1 + +/* Define to 1 if the system has the type `uintptr_t'. */ +#define _EVENT_HAVE_UINTPTR_T 1 + +/* Define to 1 if you have the `umask' function. */ +#define _EVENT_HAVE_UMASK 1 + +/* Define to 1 if you have the header file. */ +#define _EVENT_HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `unsetenv' function. */ +#define _EVENT_HAVE_UNSETENV 1 + +/* Define to 1 if you have the `vasprintf' function. */ +#define _EVENT_HAVE_VASPRINTF 1 + +/* Define if kqueue works correctly with pipes */ +/* #undef _EVENT_HAVE_WORKING_KQUEUE */ + +/* Define to 1 if you have the header file. */ +#define _EVENT_HAVE_ZLIB_H 1 + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#define _EVENT_LT_OBJDIR ".libs/" + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +/* #undef _EVENT_NO_MINUS_C_MINUS_O */ + +/* Numeric representation of the version */ +#define _EVENT_NUMERIC_VERSION 0x02001600 + +/* Name of package */ +#define _EVENT_PACKAGE "libevent" + +/* Define to the address where bug reports for this package should be sent. */ +#define _EVENT_PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define _EVENT_PACKAGE_NAME "" + +/* Define to the full name and version of this package. */ +#define _EVENT_PACKAGE_STRING "" + +/* Define to the one symbol short name of this package. */ +#define _EVENT_PACKAGE_TARNAME "" + +/* Define to the home page for this package. */ +#define _EVENT_PACKAGE_URL "" + +/* Define to the version of this package. */ +#define _EVENT_PACKAGE_VERSION "" + +/* Define to necessary symbol if this constant uses a non-standard name on + your system. */ +/* #undef _EVENT_PTHREAD_CREATE_JOINABLE */ + +/* ------------------------------------------------------------------------ */ +/* MOZILLA NOTE: the following constants are hand-modified to be suitable */ +/* for both 32-bit and 64-bit platforms. See README.mozilla for details. */ +/* ------------------------------------------------------------------------ */ + +/* The size of `int', as computed by sizeof. */ +#define _EVENT_SIZEOF_INT 4 + +/* The size of `long', as computed by sizeof. */ +#ifdef __LP64__ +#define _EVENT_SIZEOF_LONG 8 +#else +#define _EVENT_SIZEOF_LONG 4 +#endif + +/* The size of `long long', as computed by sizeof. */ +#define _EVENT_SIZEOF_LONG_LONG 8 + +/* The size of `pthread_t', as computed by sizeof. */ +#ifdef __LP64__ +#define _EVENT_SIZEOF_PTHREAD_T 8 +#else +#define _EVENT_SIZEOF_PTHREAD_T 4 +#endif + +/* The size of `short', as computed by sizeof. */ +#define _EVENT_SIZEOF_SHORT 2 + +/* The size of `size_t', as computed by sizeof. */ +#ifdef __LP64__ +#define _EVENT_SIZEOF_SIZE_T 8 +#else +#define _EVENT_SIZEOF_SIZE_T 4 +#endif + +/* The size of `void *', as computed by sizeof. */ +#ifdef __LP64__ +#define _EVENT_SIZEOF_VOID_P 8 +#else +#define _EVENT_SIZEOF_VOID_P 4 +#endif + +/* ------------------------------------------------------------------------ */ +/* END MOZILLA NOTE */ +/* ------------------------------------------------------------------------ */ + +/* Define to 1 if you have the ANSI C header files. */ +#define _EVENT_STDC_HEADERS 1 + +/* Define to 1 if you can safely include both and . */ +#define _EVENT_TIME_WITH_SYS_TIME 1 + +/* Version number of package */ +#define _EVENT_VERSION "2.0.22-stable" + +/* Define to appropriate substitue if compiler doesnt have __func__ */ +/* #undef _EVENT___func__ */ + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef _EVENT_const */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef _EVENT___cplusplus +/* #undef _EVENT_inline */ +#endif + +/* Define to `int' if does not define. */ +/* #undef _EVENT_pid_t */ + +/* Define to `unsigned int' if does not define. */ +/* #undef _EVENT_size_t */ + +/* Define to unsigned int if you dont have it */ +/* #undef _EVENT_socklen_t */ + +/* Define to `int' if does not define. */ +/* #undef _EVENT_ssize_t */ + +#endif /* event2/event-config.h */ diff --git a/ipc/chromium/src/third_party/libeventcommon.mozbuild b/ipc/chromium/src/third_party/libeventcommon.mozbuild index 7b0627e17..2b45ecb19 100644 --- a/ipc/chromium/src/third_party/libeventcommon.mozbuild +++ b/ipc/chromium/src/third_party/libeventcommon.mozbuild @@ -9,6 +9,7 @@ os_posix = 0 os_macosx = 0 os_bsd = 0 os_linux = 0 +os_solaris = 0 if CONFIG['OS_ARCH'] == 'WINNT': os_win = 1 @@ -21,6 +22,9 @@ else: 'NetBSD', 'OpenBSD']: os_bsd = 1 libevent_include_suffix = 'bsd' + elif CONFIG['OS_ARCH'] in ['SunOS']: + os_solaris = 1 + libevent_include_suffix = 'solaris' else: os_linux = 1 if CONFIG['OS_TARGET'] == 'Android': diff --git a/ipc/chromium/src/third_party/moz.build b/ipc/chromium/src/third_party/moz.build index 989e2aafc..2b99e53b3 100644 --- a/ipc/chromium/src/third_party/moz.build +++ b/ipc/chromium/src/third_party/moz.build @@ -54,6 +54,11 @@ if os_linux: 'libevent/epoll_sub.c', ] +if os_solaris: + SOURCES += [ + 'libevent/devpoll.c', + ] + # We allow warnings for third-party code that can be updated from upstream. ALLOW_COMPILER_WARNINGS = True diff --git a/ipc/glue/BrowserProcessSubThread.cpp b/ipc/glue/BrowserProcessSubThread.cpp index 7618dc934..589f20003 100644 --- a/ipc/glue/BrowserProcessSubThread.cpp +++ b/ipc/glue/BrowserProcessSubThread.cpp @@ -23,7 +23,7 @@ static const char* kBrowserThreadNames[BrowserProcessSubThread::ID_COUNT] = { // "Chrome_FileThread", // FILE // "Chrome_DBThread", // DB // "Chrome_HistoryThread", // HISTORY -#if defined(OS_LINUX) +#if defined(OS_LINUX) || defined(OS_SOLARIS) "Gecko_Background_X11Thread", // BACKGROUND_X11 #endif }; @@ -34,7 +34,7 @@ BrowserProcessSubThread* BrowserProcessSubThread::sBrowserThreads[ID_COUNT] = { // nullptr, // FILE // nullptr, // DB // nullptr, // HISTORY -#if defined(OS_LINUX) +#if defined(OS_LINUX) || defined(OS_SOLARIS) nullptr, // BACKGROUND_X11 #endif }; diff --git a/ipc/glue/BrowserProcessSubThread.h b/ipc/glue/BrowserProcessSubThread.h index e1b4aef46..cc9051412 100644 --- a/ipc/glue/BrowserProcessSubThread.h +++ b/ipc/glue/BrowserProcessSubThread.h @@ -25,7 +25,7 @@ public: //FILE, //DB, //HISTORY, -#if defined(OS_LINUX) +#if defined(OS_LINUX) || defined(OS_SOLARIS) // This thread has a second connection to the X server and is used // to process UI requests when routing the request to the UI // thread would risk deadlock. diff --git a/ipc/glue/GeckoChildProcessHost.cpp b/ipc/glue/GeckoChildProcessHost.cpp index fee429238..ea76f85f0 100644 --- a/ipc/glue/GeckoChildProcessHost.cpp +++ b/ipc/glue/GeckoChildProcessHost.cpp @@ -599,7 +599,7 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector& aExt // and passing wstrings from one config to the other is unsafe. So // we split the logic here. -#if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_BSD) +#if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_BSD) || defined(OS_SOLARIS) base::environment_map newEnvVars; ChildPrivileges privs = mPrivileges; if (privs == base::PRIVILEGES_DEFAULT) { @@ -744,7 +744,7 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector& aExt childArgv.push_back(childProcessType); base::LaunchApp(childArgv, mFileMap, -#if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_BSD) +#if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_BSD) || defined(OS_SOLARIS) newEnvVars, privs, #endif false, &process, arch); diff --git a/ipc/glue/MessageLink.cpp b/ipc/glue/MessageLink.cpp index a66fbbb32..8c6d9b890 100644 --- a/ipc/glue/MessageLink.cpp +++ b/ipc/glue/MessageLink.cpp @@ -16,6 +16,9 @@ #include "nsDebug.h" #include "nsISupportsImpl.h" #include "nsXULAppAPI.h" +#if defined(__sun__) || defined(__sun) +#include +#endif using namespace mozilla; using namespace std; @@ -267,9 +270,19 @@ ProcessLink::OnChannelOpened() MonitorAutoLock lock(*mChan->mMonitor); mExistingListener = mTransport->set_listener(this); + +// The queue we want here is defined in the namespace 'std' on Solaris, which +// also has another function called queue in a different namespace. Need to +// determine whether queue is defined in 'std' on other supported platforms +// before possibly removing ifdefs. + #ifdef DEBUG if (mExistingListener) { +#if defined(XP_SOLARIS) + std::queue pending; +#else queue pending; +#endif mExistingListener->GetQueuedMessages(pending); MOZ_ASSERT(pending.empty()); } @@ -285,8 +298,11 @@ void ProcessLink::OnTakeConnectedChannel() { AssertIOThread(); - +#if defined(XP_SOLARIS) + std::queue pending; +#else queue pending; +#endif { MonitorAutoLock lock(*mChan->mMonitor); diff --git a/python/mozbuild/mozbuild/configure/constants.py b/python/mozbuild/mozbuild/configure/constants.py index dfc7cf8ad..00d9ff9bb 100644 --- a/python/mozbuild/mozbuild/configure/constants.py +++ b/python/mozbuild/mozbuild/configure/constants.py @@ -23,6 +23,7 @@ OS = EnumString.subclass( 'iOS', 'NetBSD', 'OpenBSD', + 'SunOS', 'OSX', 'WINNT', ) @@ -35,6 +36,7 @@ Kernel = EnumString.subclass( 'Linux', 'NetBSD', 'OpenBSD', + 'SunOS', 'WINNT', ) @@ -97,6 +99,7 @@ kernel_preprocessor_checks = { 'Linux': '__linux__', 'NetBSD': '__NetBSD__', 'OpenBSD': '__OpenBSD__', + 'SunOS': '__sun__', 'WINNT': '_WIN32 || __CYGWIN__', } diff --git a/toolkit/components/terminator/nsTerminator.cpp b/toolkit/components/terminator/nsTerminator.cpp index 91e872821..007885b8d 100644 --- a/toolkit/components/terminator/nsTerminator.cpp +++ b/toolkit/components/terminator/nsTerminator.cpp @@ -385,7 +385,11 @@ nsTerminator::StartWatchdog() } UniquePtr options(new Options()); +#if !defined(XP_SOLARIS) const PRIntervalTime ticksDuration = PR_MillisecondsToInterval(1000); +#else + const PRIntervalTime ticksDuration = 1000; +#endif options->crashAfterTicks = crashAfterMS / ticksDuration; DebugOnly watchdogThread = CreateSystemThread(RunWatchdog, diff --git a/widget/GfxInfoX11.cpp b/widget/GfxInfoX11.cpp index 338dcac67..98a4bb965 100644 --- a/widget/GfxInfoX11.cpp +++ b/widget/GfxInfoX11.cpp @@ -187,6 +187,15 @@ GfxInfo::GetData() note.AppendLiteral(" -- texture_from_pixmap"); note.Append('\n'); + // illumos/Solaris 10 libc lacks a strcasestr function, but NSPR has + // one. A lot of programs just implement one on the spot or use strstr + // and a buffer as some kind of workaround. They've been implementing + // missing functions lately, though, so this may not be needed much longer. + +#if defined(XP_SOLARIS) +#define strcasestr PL_strcasestr +#endif + // determine the major OpenGL version. That's the first integer in the version string. mGLMajorVersion = strtol(mVersion.get(), 0, 10); diff --git a/xpcom/ds/nsMathUtils.h b/xpcom/ds/nsMathUtils.h index 08bf908da..61eb47501 100644 --- a/xpcom/ds/nsMathUtils.h +++ b/xpcom/ds/nsMathUtils.h @@ -11,7 +11,8 @@ #include #include -#ifdef XP_SOLARIS +#if defined(XP_SOLARIS) +#include #include #endif diff --git a/xpcom/glue/FileUtils.cpp b/xpcom/glue/FileUtils.cpp index 699812461..53fe68708 100644 --- a/xpcom/glue/FileUtils.cpp +++ b/xpcom/glue/FileUtils.cpp @@ -532,7 +532,7 @@ mozilla::ReadAheadFile(mozilla::pathstr_t aFilePath, const size_t aOffset, if (!aOutFd) { CloseHandle(fd); } -#elif defined(LINUX) && !defined(ANDROID) || defined(XP_MACOSX) +#elif defined(LINUX) && !defined(ANDROID) || defined(XP_MACOSX) || defined(XP_SOLARIS) if (!aFilePath) { if (aOutFd) { *aOutFd = -1; -- cgit v1.2.3 From f105b741e549e2c2b985e1458ff6153c3d13929a Mon Sep 17 00:00:00 2001 From: athenian200 Date: Tue, 1 Oct 2019 19:15:26 -0500 Subject: MoonchildProductions#1251 - Part 5: Fix POSIX compliance issue in process_util.h. https://bugzilla.mozilla.org/show_bug.cgi?id=1364865 Solaris doesn't define NAME_MAX because if you read the current POSIX standard literally, no system that supports multiple file systems or networking should be defining it. It's a pedantic choice given that they USED to define NAME_MAX, but Solaris always did take POSIX compliance seriously, for better or worse. --- ipc/chromium/src/base/process_util.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ipc/chromium/src/base/process_util.h b/ipc/chromium/src/base/process_util.h index 2b257b587..9b1e4fed5 100644 --- a/ipc/chromium/src/base/process_util.h +++ b/ipc/chromium/src/base/process_util.h @@ -44,10 +44,12 @@ typedef PROCESSENTRY32 ProcessEntry; typedef IO_COUNTERS IoCounters; #elif defined(OS_POSIX) // TODO(port): we should not rely on a Win32 structure. +// Using NAME_MAX here would raise POSIX compliance issues +// (see Mozilla bug 1364865). struct ProcessEntry { int pid; int ppid; - char szExeFile[NAME_MAX + 1]; + char szExeFile[_POSIX_PATH_MAX + 1]; }; struct IoCounters { -- cgit v1.2.3 From 57bfda37aebdef6a0f7bbb320d508dfaf1a89718 Mon Sep 17 00:00:00 2001 From: athenian200 Date: Tue, 1 Oct 2019 20:29:46 -0500 Subject: MoonchildProductions#1251 - Part 6: Solaris needs an audio implementation. Current versions of libcubeb already have a Sun audio implementation, but in Firefox 52 and earlier, this was all they had. I'm not completely happy with this implementation because it has issues like video freezing if the soundcard isn't working, but I think fixing this or pulling in a newer libcubeb would be going too far for too little gain. --- ipc/chromium/src/base/sys_info_posix.cc | 4 + media/libcubeb/src/cubeb.c | 6 + media/libcubeb/src/cubeb_sun.c | 504 ++++++++++++++++++++++++++++++++ media/libcubeb/src/moz.build | 6 + 4 files changed, 520 insertions(+) create mode 100644 media/libcubeb/src/cubeb_sun.c diff --git a/ipc/chromium/src/base/sys_info_posix.cc b/ipc/chromium/src/base/sys_info_posix.cc index 1b88883eb..6adbb1c06 100644 --- a/ipc/chromium/src/base/sys_info_posix.cc +++ b/ipc/chromium/src/base/sys_info_posix.cc @@ -133,6 +133,10 @@ std::string SysInfo::OperatingSystemName() { return std::string(info.sysname); } +// Solaris contains "extern struct utsname utsname;" +// As a consequence, any use of utsname has to be proceeded with struct on +// Solaris. See Mozilla bugs 758483 and 1353332. + // static std::string SysInfo::CPUArchitecture() { #if !defined(XP_SOLARIS) diff --git a/media/libcubeb/src/cubeb.c b/media/libcubeb/src/cubeb.c index eb22a9b94..a239319a4 100644 --- a/media/libcubeb/src/cubeb.c +++ b/media/libcubeb/src/cubeb.c @@ -54,6 +54,9 @@ int audiotrack_init(cubeb ** context, char const * context_name); #if defined(USE_KAI) int kai_init(cubeb ** context, char const * context_name); #endif +#if defined(USE_SUN) +int sunaudio_init(cubeb ** context, char const * context_name); +#endif static int @@ -140,6 +143,9 @@ cubeb_init(cubeb ** context, char const * context_name) #endif #if defined(USE_KAI) kai_init, +#endif +#if defined(USE_SUN) + sunaudio_init, #endif }; int i; diff --git a/media/libcubeb/src/cubeb_sun.c b/media/libcubeb/src/cubeb_sun.c new file mode 100644 index 000000000..b768bca56 --- /dev/null +++ b/media/libcubeb/src/cubeb_sun.c @@ -0,0 +1,504 @@ +/* + * Copyright (c) 2013, 2017 Ginn Chen + * + * This program is made available under an ISC-style license. See the + * accompanying file LICENSE for details. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "cubeb/cubeb.h" +#include "cubeb-internal.h" + +/* Macros copied from audio_oss.h */ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright (C) 4Front Technologies 1996-2008. + * + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ +#define OSSIOCPARM_MASK 0x1fff /* parameters must be < 8192 bytes */ +#define OSSIOC_VOID 0x00000000 /* no parameters */ +#define OSSIOC_OUT 0x20000000 /* copy out parameters */ +#define OSSIOC_IN 0x40000000 /* copy in parameters */ +#define OSSIOC_INOUT (OSSIOC_IN|OSSIOC_OUT) +#define OSSIOC_SZ(t) ((sizeof (t) & OSSIOCPARM_MASK) << 16) +#define __OSSIO(x, y) ((int)(OSSIOC_VOID|(x<<8)|y)) +#define __OSSIOR(x, y, t) ((int)(OSSIOC_OUT|OSSIOC_SZ(t)|(x<<8)|y)) +#define __OSSIOWR(x, y, t) ((int)(OSSIOC_INOUT|OSSIOC_SZ(t)|(x<<8)|y)) +#define SNDCTL_DSP_SPEED __OSSIOWR('P', 2, int) +#define SNDCTL_DSP_CHANNELS __OSSIOWR('P', 6, int) +#define SNDCTL_DSP_SETFMT __OSSIOWR('P', 5, int) /* Selects ONE fmt */ +#define SNDCTL_DSP_GETODELAY __OSSIOR('P', 23, int) +#define SNDCTL_DSP_HALT_OUTPUT __OSSIO('P', 34) +#define AFMT_S16_LE 0x00000010 +#define AFMT_S16_BE 0x00000020 + +#if defined(WORDS_BIGENDIAN) || defined(__BIG_ENDIAN__) +#define AFMT_S16_NE AFMT_S16_BE +#else +#define AFMT_S16_NE AFMT_S16_LE +#endif + +#define DEFAULT_AUDIO_DEVICE "/dev/audio" +#define DEFAULT_DSP_DEVICE "/dev/dsp" + +#define BUF_SIZE_MS 10 + +#if defined(CUBEB_SUNAUDIO_DEBUG) +#define DPR(...) fprintf(stderr, __VA_ARGS__); +#else +#define DPR(...) do {} while(0) +#endif + +static struct cubeb_ops const sunaudio_ops; + +struct cubeb { + struct cubeb_ops const * ops; +}; + +struct cubeb_stream { + cubeb * context; + pthread_t th; /* to run real-time audio i/o */ + pthread_mutex_t mutex; /* protects fd and frm_played */ + int fd; /* link us to sunaudio */ + int active; /* cubec_start() called */ + int conv; /* need float->s16 conversion */ + int using_oss; + unsigned char *buf; /* data is prepared here */ + unsigned int rate; + unsigned int n_channles; + unsigned int bytes_per_ch; + unsigned int n_frm; + unsigned int buffer_size; + int64_t frm_played; + cubeb_data_callback data_cb; /* cb to preapare data */ + cubeb_state_callback state_cb; /* cb to notify about state changes */ + void *arg; /* user arg to {data,state}_cb */ +}; + +static void +float_to_s16(void *ptr, long nsamp) +{ + int16_t *dst = ptr; + float *src = ptr; + + while (nsamp-- > 0) + *(dst++) = *(src++) * 32767; +} + +static void * +sunaudio_mainloop(void *arg) +{ + struct cubeb_stream *s = arg; + int state; + + DPR("sunaudio_mainloop()\n"); + + s->state_cb(s, s->arg, CUBEB_STATE_STARTED); + + pthread_mutex_lock(&s->mutex); + DPR("sunaudio_mainloop(), started\n"); + + for (;;) { + if (!s->active) { + DPR("sunaudio_mainloop() stopped\n"); + state = CUBEB_STATE_STOPPED; + break; + } + + if (!s->using_oss) { + audio_info_t info; + ioctl(s->fd, AUDIO_GETINFO, &info); + if (s->frm_played > info.play.samples + 3 * s->n_frm) { + pthread_mutex_unlock(&s->mutex); + struct timespec ts = {0, 10000}; // 10 ms + nanosleep(&ts, NULL); + pthread_mutex_lock(&s->mutex); + continue; + } + } + + pthread_mutex_unlock(&s->mutex); + unsigned int got = s->data_cb(s, s->arg, NULL, s->buf, s->n_frm); + DPR("sunaudio_mainloop() ask %d got %d\n", s->n_frm, got); + pthread_mutex_lock(&s->mutex); + + if (got < 0) { + DPR("sunaudio_mainloop() cb err\n"); + state = CUBEB_STATE_ERROR; + break; + } + + if (s->conv) { + float_to_s16(s->buf, got * s->n_channles); + } + + unsigned int avail = got * 2 * s->n_channles; // coverted to s16 + unsigned int pos = 0; + + while (avail > 0 && s->active) { + int written = write(s->fd, s->buf + pos, avail); + if (written == -1) { + if (errno != EINTR && errno != EWOULDBLOCK) { + DPR("sunaudio_mainloop() write err\n"); + state = CUBEB_STATE_ERROR; + break; + } + pthread_mutex_unlock(&s->mutex); + struct timespec ts = {0, 10000}; // 10 ms + nanosleep(&ts, NULL); + pthread_mutex_lock(&s->mutex); + } else { + pos += written; + DPR("sunaudio_mainloop() write %d pos %d\n", written, pos); + s->frm_played += written / 2 / s->n_channles; + avail -= written; + } + } + + if ((got < s->n_frm)) { + DPR("sunaudio_mainloop() drained\n"); + state = CUBEB_STATE_DRAINED; + break; + } + } + + pthread_mutex_unlock(&s->mutex); + s->state_cb(s, s->arg, state); + + return NULL; +} + +/*static*/ int +sunaudio_init(cubeb **context, char const *context_name) +{ + DPR("sunaudio_init(%s)\n", context_name); + *context = malloc(sizeof(*context)); + (*context)->ops = &sunaudio_ops; + (void)context_name; + return CUBEB_OK; +} + +static char const * +sunaudio_get_backend_id(cubeb *context) +{ + return "sunaudio"; +} + +static void +sunaudio_destroy(cubeb *context) +{ + DPR("sunaudio_destroy()\n"); + free(context); +} + +static int +sunaudio_stream_init(cubeb *context, + cubeb_stream **stream, + char const *stream_name, + cubeb_devid input_device, + cubeb_stream_params * input_stream_params, + cubeb_devid output_device, + cubeb_stream_params * output_stream_params, + unsigned int latency, + cubeb_data_callback data_callback, + cubeb_state_callback state_callback, + void *user_ptr) +{ + struct cubeb_stream *s; + DPR("sunaudio_stream_init(%s)\n", stream_name); + size_t size; + + s = malloc(sizeof(struct cubeb_stream)); + if (s == NULL) + return CUBEB_ERROR; + s->context = context; + + // If UTAUDIODEV is set, use it with Sun Audio interface + char * sa_device_name = getenv("UTAUDIODEV"); + char * dsp_device_name = NULL; + if (!sa_device_name) { + dsp_device_name = getenv("AUDIODSP"); + if (!dsp_device_name) { + dsp_device_name = DEFAULT_DSP_DEVICE; + } + sa_device_name = getenv("AUDIODEV"); + if (!sa_device_name) { + sa_device_name = DEFAULT_AUDIO_DEVICE; + } + } + + s->using_oss = 0; + // Try to use OSS if available + if (dsp_device_name) { + s->fd = open(dsp_device_name, O_WRONLY | O_NONBLOCK); + if (s->fd >= 0) { + s->using_oss = 1; + } + } + + // Try Sun Audio + if (!s->using_oss) { + s->fd = open(sa_device_name, O_WRONLY | O_NONBLOCK); + } + + if (s->fd < 0) { + free(s); + DPR("sunaudio_stream_init(), open() failed\n"); + return CUBEB_ERROR; + } + + if (s->using_oss) { + if (ioctl(s->fd, SNDCTL_DSP_SPEED, &output_stream_params->rate) < 0) { + DPR("ioctl SNDCTL_DSP_SPEED failed.\n"); + close(s->fd); + free(s); + return CUBEB_ERROR_INVALID_FORMAT; + } + + if (ioctl(s->fd, SNDCTL_DSP_CHANNELS, &output_stream_params->channels) < 0) { + DPR("ioctl SNDCTL_DSP_CHANNELS failed.\n"); + close(s->fd); + free(s); + return CUBEB_ERROR_INVALID_FORMAT; + } + + int format = AFMT_S16_NE; + if (ioctl(s->fd, SNDCTL_DSP_SETFMT, &format) < 0) { + DPR("ioctl SNDCTL_DSP_SETFMT failed.\n"); + close(s->fd); + free(s); + return CUBEB_ERROR_INVALID_FORMAT; + } + } else { + audio_info_t audio_info; + AUDIO_INITINFO(&audio_info) + audio_info.play.sample_rate = output_stream_params->rate; + audio_info.play.channels = output_stream_params->channels; + audio_info.play.encoding = AUDIO_ENCODING_LINEAR; + audio_info.play.precision = 16; + if (ioctl(s->fd, AUDIO_SETINFO, &audio_info) == -1) { + DPR("ioctl AUDIO_SETINFO failed.\n"); + close(s->fd); + free(s); + return CUBEB_ERROR_INVALID_FORMAT; + } + } + + s->conv = 0; + switch (output_stream_params->format) { + case CUBEB_SAMPLE_S16NE: + s->bytes_per_ch = 2; + break; + case CUBEB_SAMPLE_FLOAT32NE: + s->bytes_per_ch = 4; + s->conv = 1; + break; + default: + DPR("sunaudio_stream_init() unsupported format\n"); + close(s->fd); + free(s); + return CUBEB_ERROR_INVALID_FORMAT; + } + + s->active = 0; + s->rate = output_stream_params->rate; + s->n_channles = output_stream_params->channels; + s->data_cb = data_callback; + s->state_cb = state_callback; + s->arg = user_ptr; + if (pthread_mutex_init(&s->mutex, NULL) != 0) { + free(s); + return CUBEB_ERROR; + } + s->frm_played = 0; + s->n_frm = s->rate * BUF_SIZE_MS / 1000; + s->buffer_size = s->bytes_per_ch * s->n_channles * s->n_frm; + s->buf = malloc(s->buffer_size); + if (s->buf == NULL) { + close(s->fd); + free(s); + return CUBEB_ERROR; + } + + *stream = s; + DPR("sunaudio_stream_init() end, ok\n"); + return CUBEB_OK; +} + +static void +sunaudio_stream_destroy(cubeb_stream *s) +{ + DPR("sunaudio_stream_destroy()\n"); + if (s->fd > 0) { + // Flush buffer + if (s->using_oss) { + ioctl(s->fd, SNDCTL_DSP_HALT_OUTPUT); + } else { + ioctl(s->fd, I_FLUSH); + } + close(s->fd); + } + free(s->buf); + free(s); +} + +static int +sunaudio_stream_start(cubeb_stream *s) +{ + int err; + + DPR("sunaudio_stream_start()\n"); + s->active = 1; + err = pthread_create(&s->th, NULL, sunaudio_mainloop, s); + if (err) { + s->active = 0; + return CUBEB_ERROR; + } + return CUBEB_OK; +} + +static int +sunaudio_stream_stop(cubeb_stream *s) +{ + void *dummy; + + DPR("sunaudio_stream_stop()\n"); + if (s->active) { + s->active = 0; + pthread_join(s->th, &dummy); + } + return CUBEB_OK; +} + +static int +sunaudio_stream_get_position(cubeb_stream *s, uint64_t *p) +{ + int rv = CUBEB_OK; + pthread_mutex_lock(&s->mutex); + if (s->active && s->fd > 0) { + if (s->using_oss) { + int delay; + ioctl(s->fd, SNDCTL_DSP_GETODELAY, &delay); + int64_t t = s->frm_played - delay / s->n_channles / 2; + if (t < 0) { + *p = 0; + } else { + *p = t; + } + } else { + audio_info_t info; + ioctl(s->fd, AUDIO_GETINFO, &info); + *p = info.play.samples; + } + DPR("sunaudio_stream_get_position() %lld\n", *p); + } else { + rv = CUBEB_ERROR; + } + pthread_mutex_unlock(&s->mutex); + return rv; +} + +static int +sunaudio_get_max_channel_count(cubeb * ctx, uint32_t * max_channels) +{ + if (!ctx || !max_channels) + return CUBEB_ERROR; + + *max_channels = 2; + + return CUBEB_OK; +} + +static int +sunaudio_get_preferred_sample_rate(cubeb * ctx, uint32_t * rate) +{ + if (!ctx || !rate) + return CUBEB_ERROR; + + // XXX Not yet implemented. + *rate = 44100; + + return CUBEB_OK; +} + +static int +sunaudio_get_min_latency(cubeb * ctx, cubeb_stream_params params, uint32_t * latency_ms) +{ + if (!ctx || !latency_ms) + return CUBEB_ERROR; + + // XXX Not yet implemented. + *latency_ms = 20; + + return CUBEB_OK; +} + +static int +sunaudio_stream_get_latency(cubeb_stream * s, uint32_t * latency) +{ + if (!s || !latency) + return CUBEB_ERROR; + + int rv = CUBEB_OK; + pthread_mutex_lock(&s->mutex); + if (s->active && s->fd > 0) { + if (s->using_oss) { + int delay; + ioctl(s->fd, SNDCTL_DSP_GETODELAY, &delay); + *latency = delay / s->n_channles / 2 / s->rate; + } else { + audio_info_t info; + ioctl(s->fd, AUDIO_GETINFO, &info); + *latency = (s->frm_played - info.play.samples) / s->rate; + } + DPR("sunaudio_stream_get_position() %lld\n", *p); + } else { + rv = CUBEB_ERROR; + } + pthread_mutex_unlock(&s->mutex); + return rv; +} + +static struct cubeb_ops const sunaudio_ops = { + .init = sunaudio_init, + .get_backend_id = sunaudio_get_backend_id, + .destroy = sunaudio_destroy, + .get_preferred_sample_rate = sunaudio_get_preferred_sample_rate, + .stream_init = sunaudio_stream_init, + .stream_destroy = sunaudio_stream_destroy, + .stream_start = sunaudio_stream_start, + .stream_stop = sunaudio_stream_stop, + .stream_get_position = sunaudio_stream_get_position, + .get_max_channel_count = sunaudio_get_max_channel_count, + .get_min_latency = sunaudio_get_min_latency, + .stream_get_latency = sunaudio_stream_get_latency +}; diff --git a/media/libcubeb/src/moz.build b/media/libcubeb/src/moz.build index 2ca3a2f54..b6d07126a 100644 --- a/media/libcubeb/src/moz.build +++ b/media/libcubeb/src/moz.build @@ -45,6 +45,12 @@ if CONFIG['OS_ARCH'] == 'OpenBSD': ] DEFINES['USE_SNDIO'] = True +if CONFIG['OS_ARCH'] == 'SunOS': + SOURCES += [ + 'cubeb_sun.c', + ] + DEFINES['USE_SUN'] = True + if CONFIG['OS_TARGET'] == 'Darwin': SOURCES += [ 'cubeb_audiounit.cpp', -- cgit v1.2.3 From 3647f42c27761472e4ee204bade964e8ffad4679 Mon Sep 17 00:00:00 2001 From: athenian200 Date: Tue, 1 Oct 2019 21:36:29 -0500 Subject: MoonchildProductions#1251 - Part 7: All the posix_m* memory-related stuff, gathered together. https://bugzilla.mozilla.org/show_bug.cgi?id=1158445 https://bugzilla.mozilla.org/show_bug.cgi?id=963983 https://bugzilla.mozilla.org/show_bug.cgi?id=1542758 Solaris madvise and malign don't perfectly map to their POSIX counterparts, and some Linux versions (especially Android) don't define the POSIX counterparts at all, so options are limited. Ideally posix_madvise and posix_malign should be the safer and more portable options for all platforms. --- build/moz.configure/memory.configure | 3 +++ js/src/gc/Memory.cpp | 6 +++++- memory/mozjemalloc/jemalloc.c | 18 ++++++++++++++---- mfbt/Poison.cpp | 4 ++++ mfbt/tests/TestPoisonArea.cpp | 4 ++++ modules/libjar/nsZipArchive.cpp | 4 +++- 6 files changed, 33 insertions(+), 6 deletions(-) diff --git a/build/moz.configure/memory.configure b/build/moz.configure/memory.configure index 398413b62..1292d7273 100644 --- a/build/moz.configure/memory.configure +++ b/build/moz.configure/memory.configure @@ -58,6 +58,9 @@ def jemalloc_os_define(jemalloc, target): return 'MOZ_MEMORY_DARWIN' if target.kernel in ('kFreeBSD', 'FreeBSD', 'NetBSD'): return 'MOZ_MEMORY_BSD' + if target.kernel == 'SunOS': + return 'MOZ_MEMORY_SOLARIS' + die('--enable-jemalloc is not supported on %s', target.kernel) set_define(jemalloc_os_define, '1') diff --git a/js/src/gc/Memory.cpp b/js/src/gc/Memory.cpp index 268e1e489..5cf0cd2f7 100644 --- a/js/src/gc/Memory.cpp +++ b/js/src/gc/Memory.cpp @@ -678,7 +678,11 @@ MarkPagesUnused(void* p, size_t size) return false; MOZ_ASSERT(OffsetFromAligned(p, pageSize) == 0); - int result = madvise(p, size, MADV_DONTNEED); +#if defined(XP_SOLARIS) + int result = posix_madvise(p, size, POSIX_MADV_DONTNEED); +#else + int result = madvise(p, size, MADV_DONTNEED); +#endif return result != -1; } diff --git a/memory/mozjemalloc/jemalloc.c b/memory/mozjemalloc/jemalloc.c index c54a85959..acaf2572c 100644 --- a/memory/mozjemalloc/jemalloc.c +++ b/memory/mozjemalloc/jemalloc.c @@ -410,8 +410,8 @@ 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. */ +#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 @@ -1040,7 +1040,7 @@ static const bool config_recycle = false; * will abort. * Platform specific page size conditions copied from js/public/HeapAPI.h */ -#if (defined(__FreeBSD__)) && \ +#if (defined(SOLARIS) || defined(__FreeBSD__)) && \ (defined(__sparc) || defined(__sparcv9) || defined(__ia64)) #define pagesize_2pow ((size_t) 13) #elif defined(__powerpc64__) @@ -2646,8 +2646,13 @@ pages_purge(void *addr, size_t length) # define JEMALLOC_MADV_PURGE MADV_FREE # define JEMALLOC_MADV_ZEROS false # endif +#ifdef MOZ_MEMORY_SOLARIS + int err = posix_madvise(addr, length, JEMALLOC_MADV_PURGE); + unzeroed = (JEMALLOC_MADV_ZEROS == false || err != 0); +#else int err = madvise(addr, length, JEMALLOC_MADV_PURGE); unzeroed = (JEMALLOC_MADV_ZEROS == false || err != 0); +#endif # undef JEMALLOC_MADV_PURGE # undef JEMALLOC_MADV_ZEROS # endif @@ -3603,9 +3608,14 @@ arena_purge(arena_t *arena, bool all) #endif #ifndef MALLOC_DECOMMIT +#ifdef MOZ_MEMORY_SOLARIS + posix_madvise((void*)((uintptr_t)chunk + (i << pagesize_2pow)), + (npages << pagesize_2pow),MADV_FREE); +#else madvise((void *)((uintptr_t)chunk + (i << pagesize_2pow)), (npages << pagesize_2pow), MADV_FREE); +#endif # ifdef MALLOC_DOUBLE_PURGE madvised = true; # endif @@ -5131,7 +5141,7 @@ malloc_ncpus(void) static inline unsigned malloc_ncpus(void) { - return sysconf(_SC_NPROCESSORS_ONLN); + return sysconf(_SC_NPROCESSORS_ONLN); } #elif (defined(MOZ_MEMORY_WINDOWS)) static inline unsigned diff --git a/mfbt/Poison.cpp b/mfbt/Poison.cpp index b2767011d..7972dbea3 100644 --- a/mfbt/Poison.cpp +++ b/mfbt/Poison.cpp @@ -129,7 +129,11 @@ ReleaseRegion(void* aRegion, uintptr_t aSize) static bool ProbeRegion(uintptr_t aRegion, uintptr_t aSize) { +#ifdef XP_SOLARIS + if (posix_madvise(reinterpret_cast(aRegion), aSize, POSIX_MADV_NORMAL)) { +#else if (madvise(reinterpret_cast(aRegion), aSize, MADV_NORMAL)) { +#endif return true; } else { return false; diff --git a/mfbt/tests/TestPoisonArea.cpp b/mfbt/tests/TestPoisonArea.cpp index 6f1b61ed3..fb39ccf79 100644 --- a/mfbt/tests/TestPoisonArea.cpp +++ b/mfbt/tests/TestPoisonArea.cpp @@ -266,7 +266,11 @@ ReleaseRegion(void* aPage) static bool ProbeRegion(uintptr_t aPage) { +#ifdef XP_SOLARIS + return !!posix_madvise(reinterpret_cast(aPage), PageSize(), POSIX_MADV_NORMAL); +#else return !!madvise(reinterpret_cast(aPage), PageSize(), MADV_NORMAL); +#endif } static int diff --git a/modules/libjar/nsZipArchive.cpp b/modules/libjar/nsZipArchive.cpp index 429de1011..24da13072 100644 --- a/modules/libjar/nsZipArchive.cpp +++ b/modules/libjar/nsZipArchive.cpp @@ -688,7 +688,9 @@ MOZ_WIN_MEM_TRY_BEGIN // Success means optimized jar layout from bug 559961 is in effect uint32_t readaheadLength = xtolong(startp); if (readaheadLength) { -#if defined(XP_UNIX) +#if defined(XP_SOLARIS) + posix_madvise(const_cast(startp), readaheadLength, POSIX_MADV_WILLNEED); +#elif defined(XP_UNIX) madvise(const_cast(startp), readaheadLength, MADV_WILLNEED); #elif defined(XP_WIN) if (aFd) { -- cgit v1.2.3 From c0d814c1d52b0e9ae884b83f214218b954133acb Mon Sep 17 00:00:00 2001 From: athenian200 Date: Tue, 1 Oct 2019 22:59:38 -0500 Subject: MoonchildProductions#1251 - Part 8: Align pointer for char_16t. https://bugzilla.mozilla.org/show_bug.cgi?id=1352449 Mozilla patch that's been in the code since Firefox 55. Seems like there have been no ill effects from implementing it, and it would only increase the portability of the UXP code. All the Solaris Firefox repos I've seen implement some variation on the jsexn patch, and this seems to be the cleanest version of it. I can add ifdefs if needed or there are performance concerns associated with this patch, but I get the impression this alignment backlog issue might affect a few platforms other than Solaris, though none were named. Otherwise I think they wouldn't have used "platforms that need it" in plural form or failed to ifdef it. --- js/src/jsexn.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/js/src/jsexn.cpp b/js/src/jsexn.cpp index 65cc81a1a..3fc9200c1 100644 --- a/js/src/jsexn.cpp +++ b/js/src/jsexn.cpp @@ -205,7 +205,12 @@ size_t ExtraMallocSize(JSErrorReport* report) { if (report->linebuf()) - return (report->linebufLength() + 1) * sizeof(char16_t); + /* + * Mozilla bug 1352449. Count with null + * terminator and alignment. See CopyExtraData for + * the details about alignment. + */ + return (report->linebufLength() + 1) * sizeof(char16_t) + 1; return 0; } @@ -220,10 +225,20 @@ bool CopyExtraData(JSContext* cx, uint8_t** cursor, JSErrorReport* copy, JSErrorReport* report) { if (report->linebuf()) { + /* + * Make sure cursor is properly aligned for char16_t for platforms + * which need it and it's at the end of the buffer on exit. + */ + size_t alignment_backlog = 0; + if (size_t(*cursor) % 2) + (*cursor)++; + else + alignment_backlog = 1; + size_t linebufSize = (report->linebufLength() + 1) * sizeof(char16_t); const char16_t* linebufCopy = (const char16_t*)(*cursor); js_memcpy(*cursor, report->linebuf(), linebufSize); - *cursor += linebufSize; + *cursor += linebufSize + alignment_backlog; copy->initBorrowedLinebuf(linebufCopy, report->linebufLength(), report->tokenOffset()); } -- cgit v1.2.3 From cf75ede0de7cc8febc12d666783631836c6b8e43 Mon Sep 17 00:00:00 2001 From: athenian200 Date: Tue, 1 Oct 2019 23:39:11 -0500 Subject: MoonchildProductions#1251 - Part 9: Look for hypot in the math library (libm). https://bugzilla.mozilla.org/show_bug.cgi?id=1351309 https://bugzilla.mozilla.org/show_bug.cgi?id=1309157 I assess this change to be low-risk for the following reasons: 1. It has been in Firefox since version 55 without issues. 2. It's nearly identical to the fix for bug 1309157 which is already in our tree, so that one would be causing problems if this one were going to. 3. Linux, Windows, and BSD are known to have a hypot function in their math libraries. 4. Even if it does break something, it should only break a test and not critical functionality. --- js/src/jit-test/tests/ctypes/function-definition.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/src/jit-test/tests/ctypes/function-definition.js b/js/src/jit-test/tests/ctypes/function-definition.js index 4df317a09..5882ba889 100644 --- a/js/src/jit-test/tests/ctypes/function-definition.js +++ b/js/src/jit-test/tests/ctypes/function-definition.js @@ -27,7 +27,7 @@ function test() { let lib; try { - lib = ctypes.open(ctypes.libraryName("c")); + lib = ctypes.open(ctypes.libraryName("m")); } catch (e) { } if (!lib) -- cgit v1.2.3 From 52f2321cba8486169779773dc13a213410fc853b Mon Sep 17 00:00:00 2001 From: athenian200 Date: Wed, 2 Oct 2019 01:16:38 -0500 Subject: MoonchildProductions#1251 - Part 10: ipc_channel_posix.cc should use IOV_MAX. https://bugzilla.mozilla.org/show_bug.cgi?id=1345102 I assess this change to be low-risk for the following reasons: 1. It has been in Firefox since version 55 without issues. 2. The current behavior is not POSIX compliant, and is retained in the one instance where the new functionality causes issues. 3. It makes safer assumptions about implementation details than what we have now. --- ipc/chromium/src/chrome/common/ipc_channel_posix.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ipc/chromium/src/chrome/common/ipc_channel_posix.cc b/ipc/chromium/src/chrome/common/ipc_channel_posix.cc index 0d3a2b16c..9a8858656 100644 --- a/ipc/chromium/src/chrome/common/ipc_channel_posix.cc +++ b/ipc/chromium/src/chrome/common/ipc_channel_posix.cc @@ -8,6 +8,7 @@ #include #include +#include #if defined(OS_MACOSX) #include #endif @@ -39,8 +40,16 @@ #include "mozilla/ipc/Faulty.h" #endif -// Work around possible OS limitations. +// Use OS specific iovec array limit where it's possible +#if defined(IOV_MAX) +static const size_t kMaxIOVecSize = IOV_MAX; +// IOV_MAX isn't defined on Android, but the hard-coded 256 works well. +#elif defined(ANDROID) static const size_t kMaxIOVecSize = 256; +// On all other platforms, fallback to 16 (_XOPEN_IOV_MAX) as a safe bet. +#else +static const size_t kMaxIOVecSize = 16; +#endif #ifdef MOZ_TASK_TRACER #include "GeckoTaskTracerImpl.h" -- cgit v1.2.3 From 7966d22df36adfd418c49558611fbd092180ea9b Mon Sep 17 00:00:00 2001 From: athenian200 Date: Wed, 2 Oct 2019 13:25:24 -0500 Subject: MoonchildProductions#1251 - Part 11: libpng uses C89 now to avoid buffer overflows. https://bugzilla.mozilla.org/show_bug.cgi?id=1371266 https://github.com/glennrp/libpng/commit/12e63e91af1378225993b36e25ce3252b54e751a This sounds absurd, and the fact that we had to change a C++ comment to a C-style comment on account of this may seem hilarious and inconsequential, but this isapparently not a joke and leaving it as it is now may be a bad idea. --- media/libpng/moz.build | 3 +++ mozilla-config.h.in | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/media/libpng/moz.build b/media/libpng/moz.build index 9146a8d5a..782aa93df 100644 --- a/media/libpng/moz.build +++ b/media/libpng/moz.build @@ -51,3 +51,6 @@ FINAL_LIBRARY = 'gkmedias' # We allow warnings for third-party code that can be updated from upstream. ALLOW_COMPILER_WARNINGS = True + +if CONFIG['GNU_CC'] + CFLAGS += ['std=c89'] diff --git a/mozilla-config.h.in b/mozilla-config.h.in index 7484180b0..6883a7be2 100644 --- a/mozilla-config.h.in +++ b/mozilla-config.h.in @@ -13,7 +13,7 @@ #endif #endif -// Expands to all the defines from configure. +/* Expands to all the defines from configure. */ #undef ALLDEFINES /* -- cgit v1.2.3 From 76c55f747ce5878d1d37d8bf3bd0a50c1b478bec Mon Sep 17 00:00:00 2001 From: athenian200 Date: Wed, 2 Oct 2019 14:08:55 -0500 Subject: MoonchildProductions#1251 - Part 12: Add Solaris/illumos support to WasmSignalHandlers. https://www.illumos.org/issues/5876 https://bugzilla.mozilla.org/show_bug.cgi?id=135050 --- js/src/wasm/WasmSignalHandlers.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/js/src/wasm/WasmSignalHandlers.cpp b/js/src/wasm/WasmSignalHandlers.cpp index c4733cc96..21093ca9a 100644 --- a/js/src/wasm/WasmSignalHandlers.cpp +++ b/js/src/wasm/WasmSignalHandlers.cpp @@ -130,11 +130,16 @@ class AutoSetHandlingSegFault # define EPC_sig(p) ((p)->sc_pc) # define RFP_sig(p) ((p)->sc_regs[30]) # endif -#elif defined(__linux__) +#elif defined(__linux__) || defined(__sun) # if defined(__linux__) # define XMM_sig(p,i) ((p)->uc_mcontext.fpregs->_xmm[i]) # define EIP_sig(p) ((p)->uc_mcontext.gregs[REG_EIP]) -# else +# else // defined(__sun) +/* See https://www.illumos.org/issues/5876. They keep arguing over whether + * should provide the register index defines in regset.h or + * require applications to request them specifically, and we need them here. */ +#include +#include # define XMM_sig(p,i) ((p)->uc_mcontext.fpregs.fp_reg_set.fpchip_state.xmm[i]) # define EIP_sig(p) ((p)->uc_mcontext.gregs[REG_PC]) # endif -- cgit v1.2.3 From 5c28f10c144026aba25044410510ba8418978698 Mon Sep 17 00:00:00 2001 From: athenian200 Date: Wed, 2 Oct 2019 14:44:26 -0500 Subject: MoonchildProductions#1251 - Part 13: Redefining abort in C++ requires extern "C" https://bugzilla.mozilla.org/show_bug.cgi?id=1375467 I would ifdef this, but it's been in Firefox since version of 56, and Petr Sumbara's explanation as to why it's wrong in the first place is so detailed that it's pretty obvious the code wasn't technically doing things properly to begin with. Basically, they tried to redefine a system function after including the header file that declares it, and it caused problems on Solaris because libc functions are imported into the C++ std namespace in a different way that also complies with standards. So the existing implementation is technically bad code on all platforms, the Solaris implementation just uncovered the lack of standards compliance in the Mozilla code. --- memory/mozalloc/mozalloc_abort.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/memory/mozalloc/mozalloc_abort.cpp b/memory/mozalloc/mozalloc_abort.cpp index a998d8164..85e566db0 100644 --- a/memory/mozalloc/mozalloc_abort.cpp +++ b/memory/mozalloc/mozalloc_abort.cpp @@ -68,7 +68,7 @@ void fillAbortMessage(char (&msg)[N], uintptr_t retAddress) { // // That segmentation fault will be interpreted as another bug by ASan and as a // result, ASan will just exit(1) instead of aborting. -void abort(void) +extern "C" void abort(void) { #ifdef MOZ_WIDGET_ANDROID char msg[64] = {}; -- cgit v1.2.3 From e3fb8bd24dcbc8357c325e3b24d0ad410bf0b15d Mon Sep 17 00:00:00 2001 From: athenian200 Date: Wed, 2 Oct 2019 16:46:20 -0500 Subject: MoonchildProductions#1251 - Part 14: libstagefright build should avoid _GLIBCXX_OS_DEFINES. https://bugzilla.mozilla.org/show_bug.cgi?id=1367775 Windows already requires this ifdef, Solaris needs it too. Not much more to say, but I can do research and follow up on this if asked. --- media/libstagefright/moz.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/media/libstagefright/moz.build b/media/libstagefright/moz.build index 5a8c9521a..87e162112 100644 --- a/media/libstagefright/moz.build +++ b/media/libstagefright/moz.build @@ -7,7 +7,7 @@ DEFINES['ANDROID_SMP'] = 0 DEFINES['LOG_NDEBUG'] = 1 -if CONFIG['OS_TARGET'] != 'WINNT': +if CONFIG['OS_TARGET'] != 'WINNT' and CONFIG['OS_TARGET'] != 'SunOS': DEFINES['_GLIBCXX_OS_DEFINES'] = True if CONFIG['OS_TARGET'] == 'WINNT': -- cgit v1.2.3 From 4f6639a1b35d4941f52eb4c8901adf45b35bc10d Mon Sep 17 00:00:00 2001 From: athenian200 Date: Wed, 2 Oct 2019 17:38:39 -0500 Subject: MoonchildProductions#1251 - Part 15: fdlibm should provide definition for u_int32_t and u_int64_t. https://bugzilla.mozilla.org/show_bug.cgi?id=1350355 u_int32_t is not an stdint.h type. Windows already requires this, Solaris needs it too. If someone has a nit with this approach, the alternatives include: 1. Just replacing every instance of u_int32_t with uint32_t. 2. Including for Solaris only, which does define this. 3. Changing the original ifdef to be WIN32 || XP_SOLARIS But it really doesn't matter how you solve this problem, all of the approaches are functionally equivalent, and this one has been used in Firefox since version 55. As far as I can tell, all it does is apply a fix that was being done for Windows already to any platform that needs it. --- .../fdlibm/patches/12_define_u_int32_t_and_u_int64_t_on_windows.patch | 4 +++- modules/fdlibm/src/math_private.h | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/fdlibm/patches/12_define_u_int32_t_and_u_int64_t_on_windows.patch b/modules/fdlibm/patches/12_define_u_int32_t_and_u_int64_t_on_windows.patch index b8f238c74..c0e9814aa 100644 --- a/modules/fdlibm/patches/12_define_u_int32_t_and_u_int64_t_on_windows.patch +++ b/modules/fdlibm/patches/12_define_u_int32_t_and_u_int64_t_on_windows.patch @@ -10,8 +10,10 @@ diff --git a/modules/fdlibm/src/math_private.h b/modules/fdlibm/src/math_private * endianness at run time. */ -+#ifdef WIN32 ++#ifndef u_int32_t +#define u_int32_t uint32_t ++#endif ++#ifndef u_int64_t +#define u_int64_t uint64_t +#endif + diff --git a/modules/fdlibm/src/math_private.h b/modules/fdlibm/src/math_private.h index 6947cecc0..86597e75f 100644 --- a/modules/fdlibm/src/math_private.h +++ b/modules/fdlibm/src/math_private.h @@ -38,8 +38,10 @@ * endianness at run time. */ -#ifdef WIN32 +#ifndef u_int32_t #define u_int32_t uint32_t +#endif +#ifndef u_int64_t #define u_int64_t uint64_t #endif -- cgit v1.2.3 From fca7c45a62542e0f625122222386cbee9b76243f Mon Sep 17 00:00:00 2001 From: athenian200 Date: Wed, 2 Oct 2019 18:26:54 -0500 Subject: MoonchildProductions#1251 - Part 16: Resolve namespace conflicts with dbm on Solaris. https://bugzilla.mozilla.org/show_bug.cgi?id=1513913 Mozilla's solution to this is arguably overkill, since the namespace issue on Solaris only required them to change (or temporarily undefine) __log2. Instead they changed ALL the functions to be something along the lines of dbm_log2. They haven't changed the external interface at all, though. If you're unhappy with this patch, I think I could also use XP_SOLARIS ifdefs to undefine __log2 prior to where it's declared in the dbm headers. The good thing about Mozilla's solution is that it guarantees this namespace issue never occurs again on any platform, though. --- security/nss/lib/dbm/include/extern.h | 48 ++++++++++----------- security/nss/lib/dbm/include/hash.h | 50 +++++++++++----------- security/nss/lib/dbm/include/mcom_db.h | 24 +++++------ security/nss/lib/dbm/include/ncompat.h | 6 +-- security/nss/lib/dbm/src/db.c | 25 +++++------ security/nss/lib/dbm/src/h_bigkey.c | 61 ++++++++++++++------------- security/nss/lib/dbm/src/h_func.c | 3 +- security/nss/lib/dbm/src/h_log2.c | 3 +- security/nss/lib/dbm/src/h_page.c | 77 +++++++++++++++++----------------- security/nss/lib/dbm/src/hash.c | 71 +++++++++++++++---------------- security/nss/lib/dbm/src/hash_buf.c | 25 +++++------ 11 files changed, 200 insertions(+), 193 deletions(-) diff --git a/security/nss/lib/dbm/include/extern.h b/security/nss/lib/dbm/include/extern.h index 897369fb8..4fbdc2d80 100644 --- a/security/nss/lib/dbm/include/extern.h +++ b/security/nss/lib/dbm/include/extern.h @@ -31,32 +31,32 @@ * @(#)extern.h 8.4 (Berkeley) 6/16/94 */ -BUFHEAD *__add_ovflpage(HTAB *, BUFHEAD *); -int __addel(HTAB *, BUFHEAD *, const DBT *, const DBT *); -int __big_delete(HTAB *, BUFHEAD *); -int __big_insert(HTAB *, BUFHEAD *, const DBT *, const DBT *); -int __big_keydata(HTAB *, BUFHEAD *, DBT *, DBT *, int); -int __big_return(HTAB *, BUFHEAD *, int, DBT *, int); -int __big_split(HTAB *, BUFHEAD *, BUFHEAD *, BUFHEAD *, - uint32, uint32, SPLIT_RETURN *); -int __buf_free(HTAB *, int, int); -void __buf_init(HTAB *, int); -uint32 __call_hash(HTAB *, char *, size_t); -int __delpair(HTAB *, BUFHEAD *, int); -int __expand_table(HTAB *); -int __find_bigpair(HTAB *, BUFHEAD *, int, char *, int); -uint16 __find_last_page(HTAB *, BUFHEAD **); -void __free_ovflpage(HTAB *, BUFHEAD *); -BUFHEAD *__get_buf(HTAB *, uint32, BUFHEAD *, int); -int __get_page(HTAB *, char *, uint32, int, int, int); -int __ibitmap(HTAB *, int, int, int); -uint32 __log2(uint32); -int __put_page(HTAB *, char *, uint32, int, int); -void __reclaim_buf(HTAB *, BUFHEAD *); -int __split_page(HTAB *, uint32, uint32); +BUFHEAD *dbm_add_ovflpage(HTAB *, BUFHEAD *); +int dbm_addel(HTAB *, BUFHEAD *, const DBT *, const DBT *); +int dbm_big_delete(HTAB *, BUFHEAD *); +int dbm_big_insert(HTAB *, BUFHEAD *, const DBT *, const DBT *); +int dbm_big_keydata(HTAB *, BUFHEAD *, DBT *, DBT *, int); +int dbm_big_return(HTAB *, BUFHEAD *, int, DBT *, int); +int dbm_big_split(HTAB *, BUFHEAD *, BUFHEAD *, BUFHEAD *, + uint32, uint32, SPLIT_RETURN *); +int dbm_buf_free(HTAB *, int, int); +void dbm_buf_init(HTAB *, int); +uint32 dbm_call_hash(HTAB *, char *, size_t); +int dbm_delpair(HTAB *, BUFHEAD *, int); +int dbm_expand_table(HTAB *); +int dbm_find_bigpair(HTAB *, BUFHEAD *, int, char *, int); +uint16 dbm_find_last_page(HTAB *, BUFHEAD **); +void dbm_free_ovflpage(HTAB *, BUFHEAD *); +BUFHEAD *dbm_get_buf(HTAB *, uint32, BUFHEAD *, int); +int dbm_get_page(HTAB *, char *, uint32, int, int, int); +int dbm_ibitmap(HTAB *, int, int, int); +uint32 dbm_log2(uint32); +int dbm_put_page(HTAB *, char *, uint32, int, int); +void dbm_reclaim_buf(HTAB *, BUFHEAD *); +int dbm_split_page(HTAB *, uint32, uint32); /* Default hash routine. */ -extern uint32 (*__default_hash)(const void *, size_t); +extern uint32 (*dbm_default_hash)(const void *, size_t); #ifdef HASH_STATISTICS extern int hash_accesses, hash_collisions, hash_expansions, hash_overflows; diff --git a/security/nss/lib/dbm/include/hash.h b/security/nss/lib/dbm/include/hash.h index 7da51dc64..0ce3c3ff2 100644 --- a/security/nss/lib/dbm/include/hash.h +++ b/security/nss/lib/dbm/include/hash.h @@ -190,7 +190,7 @@ typedef struct htab { /* Memory resident data structure */ #define OADDR_OF(S, O) ((uint32)((uint32)(S) << SPLITSHIFT) + (O)) #define BUCKET_TO_PAGE(B) \ - (B) + hashp->HDRPAGES + ((B) ? hashp->SPARES[__log2((uint32)((B) + 1)) - 1] : 0) + (B) + hashp->HDRPAGES + ((B) ? hashp->SPARES[dbm_log2((uint32)((B) + 1)) - 1] : 0) #define OADDR_TO_PAGE(B) \ BUCKET_TO_PAGE((1 << SPLITNUM((B))) - 1) + OPAGENUM((B)); @@ -314,28 +314,28 @@ typedef struct htab { /* Memory resident data structure */ #define NEXT_FREE hdr.next_free #define H_CHARKEY hdr.h_charkey -extern uint32 (*__default_hash)(const void *, size_t); -void __buf_init(HTAB *hashp, int32 nbytes); -int __big_delete(HTAB *hashp, BUFHEAD *bufp); -BUFHEAD *__get_buf(HTAB *hashp, uint32 addr, BUFHEAD *prev_bp, int newpage); -uint32 __call_hash(HTAB *hashp, char *k, size_t len); +extern uint32 (*dbm_default_hash)(const void *, size_t); +void dbm_buf_init(HTAB *hashp, int32 nbytes); +int dbm_big_delete(HTAB *hashp, BUFHEAD *bufp); +BUFHEAD *dbm_get_buf(HTAB *hashp, uint32 addr, BUFHEAD *prev_bp, int newpage); +uint32 dbm_call_hash(HTAB *hashp, char *k, size_t len); #include "page.h" -extern int __big_split(HTAB *hashp, BUFHEAD *op, BUFHEAD *np, - BUFHEAD *big_keyp, uint32 addr, uint32 obucket, SPLIT_RETURN *ret); -void __free_ovflpage(HTAB *hashp, BUFHEAD *obufp); -BUFHEAD *__add_ovflpage(HTAB *hashp, BUFHEAD *bufp); -int __big_insert(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val); -int __expand_table(HTAB *hashp); -uint32 __log2(uint32 num); -void __reclaim_buf(HTAB *hashp, BUFHEAD *bp); -int __get_page(HTAB *hashp, char *p, uint32 bucket, int is_bucket, int is_disk, int is_bitmap); -int __put_page(HTAB *hashp, char *p, uint32 bucket, int is_bucket, int is_bitmap); -int __ibitmap(HTAB *hashp, int pnum, int nbits, int ndx); -int __buf_free(HTAB *hashp, int do_free, int to_disk); -int __find_bigpair(HTAB *hashp, BUFHEAD *bufp, int ndx, char *key, int size); -uint16 __find_last_page(HTAB *hashp, BUFHEAD **bpp); -int __addel(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val); -int __big_return(HTAB *hashp, BUFHEAD *bufp, int ndx, DBT *val, int set_current); -int __delpair(HTAB *hashp, BUFHEAD *bufp, int ndx); -int __big_keydata(HTAB *hashp, BUFHEAD *bufp, DBT *key, DBT *val, int set); -int __split_page(HTAB *hashp, uint32 obucket, uint32 nbucket); +extern int dbm_big_split(HTAB *hashp, BUFHEAD *op, BUFHEAD *np, + BUFHEAD *big_keyp, uint32 addr, uint32 obucket, SPLIT_RETURN *ret); +void dbm_free_ovflpage(HTAB *hashp, BUFHEAD *obufp); +BUFHEAD *dbm_add_ovflpage(HTAB *hashp, BUFHEAD *bufp); +int dbm_big_insert(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val); +int dbm_expand_table(HTAB *hashp); +uint32 dbm_log2(uint32 num); +void dbm_reclaim_buf(HTAB *hashp, BUFHEAD *bp); +int dbm_get_page(HTAB *hashp, char *p, uint32 bucket, int is_bucket, int is_disk, int is_bitmap); +int dbm_put_page(HTAB *hashp, char *p, uint32 bucket, int is_bucket, int is_bitmap); +int dbm_ibitmap(HTAB *hashp, int pnum, int nbits, int ndx); +int dbm_buf_free(HTAB *hashp, int do_free, int to_disk); +int dbm_find_bigpair(HTAB *hashp, BUFHEAD *bufp, int ndx, char *key, int size); +uint16 dbm_find_last_page(HTAB *hashp, BUFHEAD **bpp); +int dbm_addel(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val); +int dbm_big_return(HTAB *hashp, BUFHEAD *bufp, int ndx, DBT *val, int set_current); +int dbm_delpair(HTAB *hashp, BUFHEAD *bufp, int ndx); +int dbm_big_keydata(HTAB *hashp, BUFHEAD *bufp, DBT *key, DBT *val, int set); +int dbm_split_page(HTAB *hashp, uint32 obucket, uint32 nbucket); diff --git a/security/nss/lib/dbm/include/mcom_db.h b/security/nss/lib/dbm/include/mcom_db.h index 0a4f6dc14..e961dd1b4 100644 --- a/security/nss/lib/dbm/include/mcom_db.h +++ b/security/nss/lib/dbm/include/mcom_db.h @@ -287,16 +287,16 @@ typedef enum { LockOutDatabase, #endif /* Access method description structure. */ -typedef struct __db { +typedef struct dbm_db { DBTYPE type; /* Underlying db type. */ - int (*close)(struct __db *); - int (*del)(const struct __db *, const DBT *, uint); - int (*get)(const struct __db *, const DBT *, DBT *, uint); - int (*put)(const struct __db *, DBT *, const DBT *, uint); - int (*seq)(const struct __db *, DBT *, DBT *, uint); - int (*sync)(const struct __db *, uint); + int (*close)(struct dbm_db *); + int (*del)(const struct dbm_db *, const DBT *, uint); + int (*get)(const struct dbm_db *, const DBT *, DBT *, uint); + int (*put)(const struct dbm_db *, DBT *, const DBT *, uint); + int (*seq)(const struct dbm_db *, DBT *, DBT *, uint); + int (*sync)(const struct dbm_db *, uint); void *internal; /* Access method private. */ - int (*fd)(const struct __db *); + int (*fd)(const struct dbm_db *); } DB; #define BTREEMAGIC 0x053162 @@ -412,10 +412,10 @@ dbopen(const char *, int, int, DBTYPE, const void *); void dbSetOrClearDBLock(DBLockFlagEnum type); #ifdef __DBINTERFACE_PRIVATE -DB *__bt_open(const char *, int, int, const BTREEINFO *, int); -DB *__hash_open(const char *, int, int, const HASHINFO *, int); -DB *__rec_open(const char *, int, int, const RECNOINFO *, int); -void __dbpanic(DB *dbp); +DB *dbm_bt_open(const char *, int, int, const BTREEINFO *, int); +DB *dbm_hash_open(const char *, int, int, const HASHINFO *, int); +DB *dbm_rec_open(const char *, int, int, const RECNOINFO *, int); +void dbm_dbpanic(DB *dbp); #endif PR_END_EXTERN_C diff --git a/security/nss/lib/dbm/include/ncompat.h b/security/nss/lib/dbm/include/ncompat.h index 9fd434799..f9f631622 100644 --- a/security/nss/lib/dbm/include/ncompat.h +++ b/security/nss/lib/dbm/include/ncompat.h @@ -89,13 +89,13 @@ typedef unsigned int sigset_t; #define SIG_UNBLOCK 2 #define SIG_SETMASK 3 -static int __sigtemp; /* For the use of sigprocmask */ +static int dbm_sigtemp; /* For the use of sigprocmask */ /* Repeated test of oset != NULL is to avoid "*0". */ #define sigprocmask(how, set, oset) \ - ((__sigtemp = \ + ((dbm_sigtemp = \ (((how) == SIG_BLOCK) ? sigblock(0) | *(set) : (((how) == SIG_UNBLOCK) ? sigblock(0) & ~(*(set)) : ((how) == SIG_SETMASK ? *(set) : sigblock(0))))), \ - ((oset) ? (*(oset ? oset : set) = sigsetmask(__sigtemp)) : sigsetmask(__sigtemp)), 0) + ((oset) ? (*(oset ? oset : set) = sigsetmask(dbm_sigtemp)) : sigsetmask(dbm_sigtemp)), 0) #endif /* diff --git a/security/nss/lib/dbm/src/db.c b/security/nss/lib/dbm/src/db.c index 5c35bbd48..4b5810760 100644 --- a/security/nss/lib/dbm/src/db.c +++ b/security/nss/lib/dbm/src/db.c @@ -92,16 +92,16 @@ dbopen(const char *fname, int flags, int mode, DBTYPE type, const void *openinfo /* we don't need btree and recno right now */ #if 0 case DB_BTREE: - return (__bt_open(fname, flags & USE_OPEN_FLAGS, + return (dbm_bt_open(fname, flags & USE_OPEN_FLAGS, mode, openinfo, flags & DB_FLAGS)); case DB_RECNO: - return (__rec_open(fname, flags & USE_OPEN_FLAGS, + return (dbm_rec_open(fname, flags & USE_OPEN_FLAGS, mode, openinfo, flags & DB_FLAGS)); #endif case DB_HASH: - return (__hash_open(fname, flags & USE_OPEN_FLAGS, - mode, (const HASHINFO *)openinfo, flags & DB_FLAGS)); + return (dbm_hash_open(fname, flags & USE_OPEN_FLAGS, + mode, (const HASHINFO *)openinfo, flags & DB_FLAGS)); default: break; } @@ -110,7 +110,7 @@ dbopen(const char *fname, int flags, int mode, DBTYPE type, const void *openinfo } static int -__dberr() +dbm_dberr() { return (RET_ERROR); } @@ -122,13 +122,14 @@ __dberr() * dbp: pointer to the DB structure. */ void -__dbpanic(DB *dbp) +dbm_dbpanic(DB *dbp) { /* The only thing that can succeed is a close. */ - dbp->del = (int (*)(const struct __db *, const DBT *, uint))__dberr; - dbp->fd = (int (*)(const struct __db *))__dberr; - dbp->get = (int (*)(const struct __db *, const DBT *, DBT *, uint))__dberr; - dbp->put = (int (*)(const struct __db *, DBT *, const DBT *, uint))__dberr; - dbp->seq = (int (*)(const struct __db *, DBT *, DBT *, uint))__dberr; - dbp->sync = (int (*)(const struct __db *, uint))__dberr; + dbp->del = (int (*)(const struct dbm_db *, const DBT *, uint))dbm_dberr; + dbp->fd = (int (*)(const struct dbm_db *))dbm_dberr; + dbp->get = (int (*)(const struct dbm_db *, const DBT *, DBT *, uint))dbm_dberr; + dbp->put = (int (*)(const struct dbm_db *, DBT *, const DBT *, uint))dbm_dberr; + dbp->seq = (int (*)(const struct dbm_db *, DBT *, DBT *, uint))dbm_dberr; + dbp->sync = (int (*)(const struct dbm_db *, uint))dbm_dberr; + } diff --git a/security/nss/lib/dbm/src/h_bigkey.c b/security/nss/lib/dbm/src/h_bigkey.c index 6edfe7f5a..795c7a09d 100644 --- a/security/nss/lib/dbm/src/h_bigkey.c +++ b/security/nss/lib/dbm/src/h_bigkey.c @@ -85,7 +85,7 @@ static int collect_data(HTAB *, BUFHEAD *, int, int); *-1 ==> ERROR */ extern int -__big_insert(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val) +dbm_big_insert(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val) { register uint16 *p; uint key_size, n, val_size; @@ -114,7 +114,7 @@ __big_insert(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val) FREESPACE(p) = off - PAGE_META(n); OFFSET(p) = off; p[n] = PARTIAL_KEY; - bufp = __add_ovflpage(hashp, bufp); + bufp = dbm_add_ovflpage(hashp, bufp); if (!bufp) return (-1); n = p[0]; @@ -158,7 +158,7 @@ __big_insert(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val) OFFSET(p) = off; if (val_size) { p[n] = FULL_KEY; - bufp = __add_ovflpage(hashp, bufp); + bufp = dbm_add_ovflpage(hashp, bufp); if (!bufp) return (-1); cp = bufp->page; @@ -182,7 +182,7 @@ __big_insert(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val) *-1 => ERROR */ extern int -__big_delete(HTAB *hashp, BUFHEAD *bufp) +dbm_big_delete(HTAB *hashp, BUFHEAD *bufp) { register BUFHEAD *last_bfp, *rbufp; uint16 *bp, pageno; @@ -207,9 +207,9 @@ __big_delete(HTAB *hashp, BUFHEAD *bufp) break; pageno = bp[bp[0] - 1]; rbufp->flags |= BUF_MOD; - rbufp = __get_buf(hashp, pageno, rbufp, 0); + rbufp = dbm_get_buf(hashp, pageno, rbufp, 0); if (last_bfp) - __free_ovflpage(hashp, last_bfp); + dbm_free_ovflpage(hashp, last_bfp); last_bfp = rbufp; if (!rbufp) return (-1); /* Error. */ @@ -244,9 +244,9 @@ __big_delete(HTAB *hashp, BUFHEAD *bufp) bufp->flags |= BUF_MOD; if (rbufp) - __free_ovflpage(hashp, rbufp); + dbm_free_ovflpage(hashp, rbufp); if (last_bfp != rbufp) - __free_ovflpage(hashp, last_bfp); + dbm_free_ovflpage(hashp, last_bfp); hashp->NKEYS--; return (0); @@ -259,7 +259,7 @@ __big_delete(HTAB *hashp, BUFHEAD *bufp) * -3 error */ extern int -__find_bigpair(HTAB *hashp, BUFHEAD *bufp, int ndx, char *key, int size) +dbm_find_bigpair(HTAB *hashp, BUFHEAD *bufp, int ndx, char *key, int size) { register uint16 *bp; register char *p; @@ -279,7 +279,7 @@ __find_bigpair(HTAB *hashp, BUFHEAD *bufp, int ndx, char *key, int size) return (-2); kkey += bytes; ksize -= bytes; - bufp = __get_buf(hashp, bp[ndx + 2], bufp, 0); + bufp = dbm_get_buf(hashp, bp[ndx + 2], bufp, 0); if (!bufp) return (-3); p = bufp->page; @@ -306,7 +306,7 @@ __find_bigpair(HTAB *hashp, BUFHEAD *bufp, int ndx, char *key, int size) * bucket) */ extern uint16 -__find_last_page(HTAB *hashp, BUFHEAD **bpp) +dbm_find_last_page(HTAB *hashp, BUFHEAD **bpp) { BUFHEAD *bufp; uint16 *bp, pageno; @@ -332,7 +332,7 @@ __find_last_page(HTAB *hashp, BUFHEAD **bpp) return (0); pageno = bp[n - 1]; - bufp = __get_buf(hashp, pageno, bufp, 0); + bufp = dbm_get_buf(hashp, pageno, bufp, 0); if (!bufp) return (0); /* Need to indicate an error! */ bp = (uint16 *)bufp->page; @@ -350,7 +350,7 @@ __find_last_page(HTAB *hashp, BUFHEAD **bpp) * index (index should always be 1). */ extern int -__big_return( +dbm_big_return( HTAB *hashp, BUFHEAD *bufp, int ndx, @@ -364,7 +364,7 @@ __big_return( bp = (uint16 *)bufp->page; while (bp[ndx + 1] == PARTIAL_KEY) { - bufp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0); + bufp = dbm_get_buf(hashp, bp[bp[0] - 1], bufp, 0); if (!bufp) return (-1); bp = (uint16 *)bufp->page; @@ -372,7 +372,7 @@ __big_return( } if (bp[ndx + 1] == FULL_KEY) { - bufp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0); + bufp = dbm_get_buf(hashp, bp[bp[0] - 1], bufp, 0); if (!bufp) return (-1); bp = (uint16 *)bufp->page; @@ -392,7 +392,7 @@ __big_return( len = bp[1] - off; save_p = bufp; save_addr = bufp->addr; - bufp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0); + bufp = dbm_get_buf(hashp, bp[bp[0] - 1], bufp, 0); if (!bufp) return (-1); bp = (uint16 *)bufp->page; @@ -409,8 +409,8 @@ __big_return( hashp->cbucket++; hashp->cndx = 1; } else { - hashp->cpage = __get_buf(hashp, - bp[bp[0] - 1], bufp, 0); + hashp->cpage = dbm_get_buf(hashp, + bp[bp[0] - 1], bufp, 0); if (!hashp->cpage) return (-1); hashp->cndx = 1; @@ -470,7 +470,7 @@ collect_data( save_bufp->flags |= BUF_PIN; /* read the length of the buffer */ - for (totlen = len; bufp; bufp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0)) { + for (totlen = len; bufp; bufp = dbm_get_buf(hashp, bp[bp[0] - 1], bufp, 0)) { bp = (uint16 *)bufp->page; mylen = hashp->BSIZE - bp[1]; @@ -502,7 +502,7 @@ collect_data( /* copy the buffers back into temp buf */ for (bufp = save_bufp; bufp; - bufp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0)) { + bufp = dbm_get_buf(hashp, bp[bp[0] - 1], bufp, 0)) { bp = (uint16 *)bufp->page; mylen = hashp->BSIZE - bp[1]; memmove(&hashp->tmp_buf[len], (bufp->page) + bp[1], (size_t)mylen); @@ -522,7 +522,7 @@ collect_data( hashp->cpage = NULL; hashp->cbucket++; } else { - hashp->cpage = __get_buf(hashp, bp[bp[0] - 1], bufp, 0); + hashp->cpage = dbm_get_buf(hashp, bp[bp[0] - 1], bufp, 0); if (!hashp->cpage) return (-1); else if (!((uint16 *)hashp->cpage->page)[0]) { @@ -538,7 +538,7 @@ collect_data( * Fill in the key and data for this big pair. */ extern int -__big_keydata( +dbm_big_keydata( HTAB *hashp, BUFHEAD *bufp, DBT *key, DBT *val, @@ -579,10 +579,10 @@ collect_key( free(hashp->tmp_key); if ((hashp->tmp_key = (char *)malloc((size_t)totlen)) == NULL) return (-1); - if (__big_return(hashp, bufp, 1, val, set)) + if (dbm_big_return(hashp, bufp, 1, val, set)) return (-1); } else { - xbp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0); + xbp = dbm_get_buf(hashp, bp[bp[0] - 1], bufp, 0); if (!xbp || ((totlen = collect_key(hashp, xbp, totlen, val, set)) < 1)) return (-1); @@ -601,7 +601,7 @@ collect_key( * -1 => error */ extern int -__big_split( +dbm_big_split( HTAB *hashp, BUFHEAD *op, /* Pointer to where to put keys that go in old bucket */ BUFHEAD *np, /* Pointer to new bucket page */ @@ -621,13 +621,13 @@ __big_split( bp = big_keyp; /* Now figure out where the big key/data goes */ - if (__big_keydata(hashp, big_keyp, &key, &val, 0)) + if (dbm_big_keydata(hashp, big_keyp, &key, &val, 0)) return (-1); - change = (__call_hash(hashp, (char *)key.data, key.size) != obucket); + change = (dbm_call_hash(hashp, (char *)key.data, key.size) != obucket); - if ((ret->next_addr = __find_last_page(hashp, &big_keyp))) { + if ((ret->next_addr = dbm_find_last_page(hashp, &big_keyp))) { if (!(ret->nextp = - __get_buf(hashp, ret->next_addr, big_keyp, 0))) + dbm_get_buf(hashp, ret->next_addr, big_keyp, 0))) return (-1); ; } else @@ -692,7 +692,7 @@ __big_split( tp[0] -= 2; FREESPACE(tp) = free_space + OVFLSIZE; OFFSET(tp) = off; - tmpp = __add_ovflpage(hashp, big_keyp); + tmpp = dbm_add_ovflpage(hashp, big_keyp); if (!tmpp) return (-1); tp[4] = n; @@ -704,4 +704,5 @@ __big_split( else ret->oldp = tmpp; return (0); + } diff --git a/security/nss/lib/dbm/src/h_func.c b/security/nss/lib/dbm/src/h_func.c index 0d8734e8b..897060992 100644 --- a/security/nss/lib/dbm/src/h_func.c +++ b/security/nss/lib/dbm/src/h_func.c @@ -52,7 +52,7 @@ static uint32 hash3(const void *, size_t); static uint32 hash4(const void *, size_t); /* Global default hash function */ -uint32 (*__default_hash)(const void *, size_t) = hash4; +uint32 (*dbm_default_hash)(const void *, size_t) = hash4; /* * HASH FUNCTIONS @@ -205,3 +205,4 @@ hash4(const void *keyarg, register size_t len) } return (h); } + diff --git a/security/nss/lib/dbm/src/h_log2.c b/security/nss/lib/dbm/src/h_log2.c index a42b51a99..0e91fd042 100644 --- a/security/nss/lib/dbm/src/h_log2.c +++ b/security/nss/lib/dbm/src/h_log2.c @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)hash_log2.c 8.2 (Berkeley) 5/31/94"; #include "mcom_db.h" uint32 -__log2(uint32 num) +dbm_log2(uint32 num) { register uint32 i, limit; @@ -51,4 +51,5 @@ __log2(uint32 num) for (i = 0; limit < num; limit = limit << 1, i++) { } return (i); + } diff --git a/security/nss/lib/dbm/src/h_page.c b/security/nss/lib/dbm/src/h_page.c index e5623224b..e6f61c623 100644 --- a/security/nss/lib/dbm/src/h_page.c +++ b/security/nss/lib/dbm/src/h_page.c @@ -204,7 +204,7 @@ putpair(char *p, const DBT *key, DBT *val) * -1 error */ extern int -__delpair(HTAB *hashp, BUFHEAD *bufp, int ndx) +dbm_delpair(HTAB *hashp, BUFHEAD *bufp, int ndx) { register uint16 *bp, newoff; register int n; @@ -214,7 +214,7 @@ __delpair(HTAB *hashp, BUFHEAD *bufp, int ndx) n = bp[0]; if (bp[ndx + 1] < REAL_KEY) - return (__big_delete(hashp, bufp)); + return (dbm_big_delete(hashp, bufp)); if (ndx != 1) newoff = bp[ndx - 1]; else @@ -277,7 +277,7 @@ __delpair(HTAB *hashp, BUFHEAD *bufp, int ndx) * -1 ==> Error */ extern int -__split_page(HTAB *hashp, uint32 obucket, uint32 nbucket) +dbm_split_page(HTAB *hashp, uint32 obucket, uint32 nbucket) { register BUFHEAD *new_bufp, *old_bufp; register uint16 *ino; @@ -292,10 +292,10 @@ __split_page(HTAB *hashp, uint32 obucket, uint32 nbucket) copyto = (uint16)hashp->BSIZE; off = (uint16)hashp->BSIZE; - old_bufp = __get_buf(hashp, obucket, NULL, 0); + old_bufp = dbm_get_buf(hashp, obucket, NULL, 0); if (old_bufp == NULL) return (-1); - new_bufp = __get_buf(hashp, nbucket, NULL, 0); + new_bufp = dbm_get_buf(hashp, nbucket, NULL, 0); if (new_bufp == NULL) return (-1); @@ -331,7 +331,7 @@ __split_page(HTAB *hashp, uint32 obucket, uint32 nbucket) assert(((int)key.size) > -1); #endif - if (__call_hash(hashp, (char *)key.data, key.size) == obucket) { + if (dbm_call_hash(hashp, (char *)key.data, key.size) == obucket) { /* Don't switch page */ diff = copyto - off; if (diff) { @@ -443,8 +443,8 @@ ugly_split(HTAB *hashp, uint32 obucket, BUFHEAD *old_bufp, return DATABASE_CORRUPTED_ERROR; if (ino[2] < REAL_KEY && ino[2] != OVFLPAGE) { - if ((status = __big_split(hashp, old_bufp, - new_bufp, bufp, bufp->addr, obucket, &ret))) + if ((status = dbm_big_split(hashp, old_bufp, + new_bufp, bufp, bufp->addr, obucket, &ret))) return (status); old_bufp = ret.oldp; if (!old_bufp) @@ -477,7 +477,7 @@ ugly_split(HTAB *hashp, uint32 obucket, BUFHEAD *old_bufp, scopyto - sizeof(uint16) * (ino[0] + 3); OFFSET(ino) = scopyto; - bufp = __get_buf(hashp, ov_addr, bufp, 0); + bufp = dbm_get_buf(hashp, ov_addr, bufp, 0); if (!bufp) return (-1); @@ -487,7 +487,7 @@ ugly_split(HTAB *hashp, uint32 obucket, BUFHEAD *old_bufp, moved = 0; if (last_bfp) - __free_ovflpage(hashp, last_bfp); + dbm_free_ovflpage(hashp, last_bfp); last_bfp = bufp; } /* Move regular sized pairs of there are any */ @@ -506,13 +506,13 @@ ugly_split(HTAB *hashp, uint32 obucket, BUFHEAD *old_bufp, val.size = ino[n] - ino[n + 1]; off = ino[n + 1]; - if (__call_hash(hashp, (char *)key.data, key.size) == obucket) { + if (dbm_call_hash(hashp, (char *)key.data, key.size) == obucket) { /* Keep on old page */ if (PAIRFITS(op, (&key), (&val))) putpair((char *)op, &key, &val); else { old_bufp = - __add_ovflpage(hashp, old_bufp); + dbm_add_ovflpage(hashp, old_bufp); if (!old_bufp) return (-1); op = (uint16 *)old_bufp->page; @@ -525,7 +525,7 @@ ugly_split(HTAB *hashp, uint32 obucket, BUFHEAD *old_bufp, putpair((char *)np, &key, &val); else { new_bufp = - __add_ovflpage(hashp, new_bufp); + dbm_add_ovflpage(hashp, new_bufp); if (!new_bufp) return (-1); np = (uint16 *)new_bufp->page; @@ -536,7 +536,7 @@ ugly_split(HTAB *hashp, uint32 obucket, BUFHEAD *old_bufp, } } if (last_bfp) - __free_ovflpage(hashp, last_bfp); + dbm_free_ovflpage(hashp, last_bfp); return (0); } @@ -548,7 +548,7 @@ ugly_split(HTAB *hashp, uint32 obucket, BUFHEAD *old_bufp, * 1 ==> failure */ extern int -__addel(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val) +dbm_addel(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val) { register uint16 *bp, *sop; int do_expand; @@ -562,7 +562,7 @@ __addel(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val) and we need to add another page */ break; else if (bp[2] < REAL_KEY && bp[bp[0]] != OVFLPAGE) { - bufp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0); + bufp = dbm_get_buf(hashp, bp[bp[0] - 1], bufp, 0); if (!bufp) { #ifdef DEBUG assert(0); @@ -585,7 +585,7 @@ __addel(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val) return (0); } } else { - bufp = __get_buf(hashp, bp[bp[0] - 1], bufp, 0); + bufp = dbm_get_buf(hashp, bp[bp[0] - 1], bufp, 0); if (!bufp) { #ifdef DEBUG assert(0); @@ -599,7 +599,7 @@ __addel(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val) putpair(bufp->page, key, (DBT *)val); else { do_expand = 1; - bufp = __add_ovflpage(hashp, bufp); + bufp = dbm_add_ovflpage(hashp, bufp); if (!bufp) { #ifdef DEBUG assert(0); @@ -610,7 +610,7 @@ __addel(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val) if (PAIRFITS(sop, key, val)) putpair((char *)sop, key, (DBT *)val); - else if (__big_insert(hashp, bufp, key, val)) { + else if (dbm_big_insert(hashp, bufp, key, val)) { #ifdef DEBUG assert(0); #endif @@ -625,7 +625,7 @@ __addel(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val) hashp->NKEYS++; if (do_expand || (hashp->NKEYS / (hashp->MAX_BUCKET + 1) > hashp->FFACTOR)) - return (__expand_table(hashp)); + return (dbm_expand_table(hashp)); return (0); } @@ -636,7 +636,7 @@ __addel(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val) * NULL on error */ extern BUFHEAD * -__add_ovflpage(HTAB *hashp, BUFHEAD *bufp) +dbm_add_ovflpage(HTAB *hashp, BUFHEAD *bufp) { register uint16 *sp; uint16 ndx, ovfl_num; @@ -657,7 +657,7 @@ __add_ovflpage(HTAB *hashp, BUFHEAD *bufp) tmp1 = bufp->addr; tmp2 = bufp->ovfl ? bufp->ovfl->addr : 0; #endif - if (!ovfl_num || !(bufp->ovfl = __get_buf(hashp, ovfl_num, bufp, 1))) + if (!ovfl_num || !(bufp->ovfl = dbm_get_buf(hashp, ovfl_num, bufp, 1))) return (NULL); bufp->ovfl->flags |= BUF_MOD; #ifdef DEBUG1 @@ -687,12 +687,12 @@ __add_ovflpage(HTAB *hashp, BUFHEAD *bufp) * -1 indicates FAILURE */ extern int -__get_page(HTAB *hashp, - char *p, - uint32 bucket, - int is_bucket, - int is_disk, - int is_bitmap) +dbm_get_page(HTAB *hashp, + char *p, + uint32 bucket, + int is_bucket, + int is_disk, + int is_bitmap) { register int fd, page; size_t size; @@ -805,7 +805,7 @@ __get_page(HTAB *hashp, * -1 ==>failure */ extern int -__put_page(HTAB *hashp, char *p, uint32 bucket, int is_bucket, int is_bitmap) +dbm_put_page(HTAB *hashp, char *p, uint32 bucket, int is_bucket, int is_bitmap) { register int fd, page; size_t size; @@ -895,7 +895,7 @@ __put_page(HTAB *hashp, char *p, uint32 bucket, int is_bucket, int is_bitmap) * once they are read in. */ extern int -__ibitmap(HTAB *hashp, int pnum, int nbits, int ndx) +dbm_ibitmap(HTAB *hashp, int pnum, int nbits, int ndx) { uint32 *ip; size_t clearbytes, clearints; @@ -1011,8 +1011,8 @@ overflow_page(HTAB *hashp) * don't have to if we tell init_bitmap not to leave it clear * in the first place. */ - if (__ibitmap(hashp, - (int)OADDR_OF(splitnum, offset), 1, free_page)) + if (dbm_ibitmap(hashp, + (int)OADDR_OF(splitnum, offset), 1, free_page)) return (0); hashp->SPARES[splitnum]++; #ifdef DEBUG2 @@ -1084,7 +1084,7 @@ found: * Mark this overflow page as free. */ extern void -__free_ovflpage(HTAB *hashp, BUFHEAD *obufp) +dbm_free_ovflpage(HTAB *hashp, BUFHEAD *obufp) { uint16 addr; uint32 *freep; @@ -1125,7 +1125,7 @@ __free_ovflpage(HTAB *hashp, BUFHEAD *obufp) (void)fprintf(stderr, "FREE_OVFLPAGE: ADDR: %d BIT: %d PAGE %d\n", obufp->addr, free_bit, free_page); #endif - __reclaim_buf(hashp, obufp); + dbm_reclaim_buf(hashp, obufp); } /* @@ -1236,8 +1236,8 @@ fetch_bitmap(HTAB *hashp, uint32 ndx) return (NULL); if ((hashp->mapp[ndx] = (uint32 *)malloc((size_t)hashp->BSIZE)) == NULL) return (NULL); - if (__get_page(hashp, - (char *)hashp->mapp[ndx], hashp->BITMAPS[ndx], 0, 1, 1)) { + if (dbm_get_page(hashp, + (char *)hashp->mapp[ndx], hashp->BITMAPS[ndx], 0, 1, 1)) { free(hashp->mapp[ndx]); hashp->mapp[ndx] = NULL; /* NEW: 9-11-95 */ return (NULL); @@ -1253,15 +1253,16 @@ print_chain(int addr) short *bp, oaddr; (void)fprintf(stderr, "%d ", addr); - bufp = __get_buf(hashp, addr, NULL, 0); + bufp = dbm_get_buf(hashp, addr, NULL, 0); bp = (short *)bufp->page; while (bp[0] && ((bp[bp[0]] == OVFLPAGE) || ((bp[0] > 2) && bp[2] < REAL_KEY))) { oaddr = bp[bp[0] - 1]; (void)fprintf(stderr, "%d ", (int)oaddr); - bufp = __get_buf(hashp, (int)oaddr, bufp, 0); + bufp = dbm_get_buf(hashp, (int)oaddr, bufp, 0); bp = (short *)bufp->page; } (void)fprintf(stderr, "\n"); } + #endif diff --git a/security/nss/lib/dbm/src/hash.c b/security/nss/lib/dbm/src/hash.c index 98b1c07c7..100bbad27 100644 --- a/security/nss/lib/dbm/src/hash.c +++ b/security/nss/lib/dbm/src/hash.c @@ -118,7 +118,7 @@ int hash_accesses, hash_collisions, hash_expansions, hash_overflows; * This closes the file, flushing buffers as appropriate. */ static void -__remove_database(DB *dbp) +dbm_remove_database(DB *dbp) { HTAB *hashp = (HTAB *)dbp->internal; @@ -134,7 +134,7 @@ __remove_database(DB *dbp) /* OPEN/CLOSE */ extern DB * -__hash_open(const char *file, int flags, int mode, const HASHINFO *info, int dflags) +dbm_hash_open(const char *file, int flags, int mode, const HASHINFO *info, int dflags) { HTAB *hashp = NULL; struct stat statbuf; @@ -199,7 +199,7 @@ __hash_open(const char *file, int flags, int mode, const HASHINFO *info, int dfl if (info && info->hash) hashp->hash = info->hash; else - hashp->hash = __default_hash; + hashp->hash = dbm_default_hash; hdrsize = read(hashp->fp, (char *)&hashp->hdr, sizeof(HASHHDR)); if (hdrsize == -1) @@ -243,9 +243,9 @@ __hash_open(const char *file, int flags, int mode, const HASHINFO *info, int dfl /* Initialize Buffer Manager */ if (info && info->cachesize) - __buf_init(hashp, (int32)info->cachesize); + dbm_buf_init(hashp, (int32)info->cachesize); else - __buf_init(hashp, DEF_BUFSIZE); + dbm_buf_init(hashp, DEF_BUFSIZE); hashp->new_file = new_table; #ifdef macintosh @@ -331,7 +331,7 @@ init_hash(HTAB *hashp, const char *file, HASHINFO *info) hashp->SSHIFT = DEF_SEGSIZE_SHIFT; hashp->DSIZE = DEF_DIRSIZE; hashp->FFACTOR = DEF_FFACTOR; - hashp->hash = __default_hash; + hashp->hash = dbm_default_hash; memset(hashp->SPARES, 0, sizeof(hashp->SPARES)); memset(hashp->BITMAPS, 0, sizeof(hashp->BITMAPS)); @@ -353,13 +353,13 @@ init_hash(HTAB *hashp, const char *file, HASHINFO *info) if (hashp->BSIZE > MAX_BSIZE) hashp->BSIZE = MAX_BSIZE; #endif - hashp->BSHIFT = __log2((uint32)hashp->BSIZE); + hashp->BSHIFT = dbm_log2((uint32)hashp->BSIZE); } if (info) { if (info->bsize) { /* Round pagesize up to power of 2 */ - hashp->BSHIFT = __log2(info->bsize); + hashp->BSHIFT = dbm_log2(info->bsize); hashp->BSIZE = 1 << hashp->BSHIFT; if (hashp->BSIZE > MAX_BSIZE) { errno = EINVAL; @@ -406,7 +406,7 @@ init_htab(HTAB *hashp, int nelem) */ nelem = (nelem - 1) / hashp->FFACTOR + 1; - l2 = __log2((uint32)PR_MAX(nelem, 2)); + l2 = dbm_log2((uint32)PR_MAX(nelem, 2)); nbuckets = 1 << l2; hashp->SPARES[l2] = l2 + 1; @@ -415,7 +415,7 @@ init_htab(HTAB *hashp, int nelem) hashp->LAST_FREED = 2; /* First bitmap page is at: splitpoint l2 page offset 1 */ - if (__ibitmap(hashp, (int)OADDR_OF(l2, 1), l2 + 1, 0)) + if (dbm_ibitmap(hashp, (int)OADDR_OF(l2, 1), l2 + 1, 0)) return (-1); hashp->MAX_BUCKET = hashp->LOW_MASK = nbuckets - 1; @@ -425,7 +425,7 @@ init_htab(HTAB *hashp, int nelem) 1; nsegs = (nbuckets - 1) / hashp->SGSIZE + 1; - nsegs = 1 << __log2((uint32)nsegs); + nsegs = 1 << dbm_log2((uint32)nsegs); if (nsegs > hashp->DSIZE) hashp->DSIZE = nsegs; @@ -463,7 +463,7 @@ hdestroy(HTAB *hashp) * Call on buffer manager to free buffers, and if required, * write them to disk. */ - if (__buf_free(hashp, 1, hashp->save_file)) + if (dbm_buf_free(hashp, 1, hashp->save_file)) save_errno = errno; if (hashp->dir) { free(*hashp->dir); /* Free initial segments */ @@ -585,7 +585,7 @@ hash_sync(const DB *dbp, uint flags) if (!hashp->save_file) return (0); - if (__buf_free(hashp, 0, 1) || flush_meta(hashp)) + if (dbm_buf_free(hashp, 0, 1) || flush_meta(hashp)) return (DBM_ERROR); #if defined(_WIN32) || defined(_WINDOWS) if (hashp->updateEOF && hashp->filename && !hashp->is_temp) { @@ -635,8 +635,8 @@ flush_meta(HTAB *hashp) } for (i = 0; i < NCACHED; i++) if (hashp->mapp[i]) - if (__put_page(hashp, (char *)hashp->mapp[i], - hashp->BITMAPS[i], 0, 1)) + if (dbm_put_page(hashp, (char *)hashp->mapp[i], + hashp->BITMAPS[i], 0, 1)) return (-1); return (0); } @@ -675,7 +675,7 @@ hash_get( #if defined(unix) && defined(DEBUG) printf("\n\nDBM Database has been corrupted, tell Lou...\n\n"); #endif - __remove_database((DB *)dbp); + dbm_remove_database((DB *)dbp); } return (rv); @@ -711,7 +711,7 @@ hash_put( #if defined(unix) && defined(DEBUG) printf("\n\nDBM Database has been corrupted, tell Lou...\n\n"); #endif - __remove_database((DB *)dbp); + dbm_remove_database((DB *)dbp); } return (rv); @@ -744,7 +744,7 @@ hash_delete( #if defined(unix) && defined(DEBUG) printf("\n\nDBM Database has been corrupted, tell Lou...\n\n"); #endif - __remove_database((DB *)dbp); + dbm_remove_database((DB *)dbp); } return (rv); @@ -777,7 +777,7 @@ hash_access( off = hashp->BSIZE; size = key->size; kp = (char *)key->data; - rbufp = __get_buf(hashp, __call_hash(hashp, kp, size), NULL, 0); + rbufp = dbm_get_buf(hashp, dbm_call_hash(hashp, kp, size), NULL, 0); if (!rbufp) return (DATABASE_CORRUPTED_ERROR); save_bufp = rbufp; @@ -805,7 +805,7 @@ hash_access( last_overflow_page_no = *bp; - rbufp = __get_buf(hashp, *bp, rbufp, 0); + rbufp = dbm_get_buf(hashp, *bp, rbufp, 0); if (!rbufp) { save_bufp->flags &= ~BUF_PIN; return (DBM_ERROR); @@ -822,17 +822,17 @@ hash_access( off = hashp->BSIZE; } else if (bp[1] < REAL_KEY) { if ((ndx = - __find_bigpair(hashp, rbufp, ndx, kp, (int)size)) > 0) + dbm_find_bigpair(hashp, rbufp, ndx, kp, (int)size)) > 0) goto found; if (ndx == -2) { bufp = rbufp; if (!(pageno = - __find_last_page(hashp, &bufp))) { + dbm_find_last_page(hashp, &bufp))) { ndx = 0; rbufp = bufp; break; /* FOR */ } - rbufp = __get_buf(hashp, pageno, bufp, 0); + rbufp = dbm_get_buf(hashp, pageno, bufp, 0); if (!rbufp) { save_bufp->flags &= ~BUF_PIN; return (DBM_ERROR); @@ -853,7 +853,7 @@ hash_access( switch (action) { case HASH_PUT: case HASH_PUTNEW: - if (__addel(hashp, rbufp, key, val)) { + if (dbm_addel(hashp, rbufp, key, val)) { save_bufp->flags &= ~BUF_PIN; return (DBM_ERROR); } else { @@ -875,7 +875,7 @@ found: case HASH_GET: bp = (uint16 *)rbufp->page; if (bp[ndx + 1] < REAL_KEY) { - if (__big_return(hashp, rbufp, ndx, val, 0)) + if (dbm_big_return(hashp, rbufp, ndx, val, 0)) return (DBM_ERROR); } else { val->data = (uint8 *)rbufp->page + (int)bp[ndx + 1]; @@ -883,14 +883,14 @@ found: } break; case HASH_PUT: - if ((__delpair(hashp, rbufp, ndx)) || - (__addel(hashp, rbufp, key, val))) { + if ((dbm_delpair(hashp, rbufp, ndx)) || + (dbm_addel(hashp, rbufp, key, val))) { save_bufp->flags &= ~BUF_PIN; return (DBM_ERROR); } break; case HASH_DELETE: - if (__delpair(hashp, rbufp, ndx)) + if (dbm_delpair(hashp, rbufp, ndx)) return (DBM_ERROR); break; default: @@ -933,7 +933,7 @@ hash_seq( for (bucket = hashp->cbucket; bucket <= (uint32)hashp->MAX_BUCKET; bucket++, hashp->cndx = 1) { - bufp = __get_buf(hashp, bucket, NULL, 0); + bufp = dbm_get_buf(hashp, bucket, NULL, 0); if (!bufp) return (DBM_ERROR); hashp->cpage = bufp; @@ -955,7 +955,7 @@ hash_seq( #endif while (bp[hashp->cndx + 1] == OVFLPAGE) { bufp = hashp->cpage = - __get_buf(hashp, bp[hashp->cndx], bufp, 0); + dbm_get_buf(hashp, bp[hashp->cndx], bufp, 0); if (!bufp) return (DBM_ERROR); bp = (uint16 *)(bufp->page); @@ -968,7 +968,7 @@ hash_seq( } ndx = hashp->cndx; if (bp[ndx + 1] < REAL_KEY) { - if (__big_keydata(hashp, bufp, key, data, 1)) + if (dbm_big_keydata(hashp, bufp, key, data, 1)) return (DBM_ERROR); } else { key->data = (uint8 *)hashp->cpage->page + bp[ndx]; @@ -994,7 +994,7 @@ hash_seq( * -1 ==> Error */ extern int -__expand_table(HTAB *hashp) +dbm_expand_table(HTAB *hashp) { uint32 old_bucket, new_bucket; int new_segnum, spare_ndx; @@ -1029,7 +1029,7 @@ __expand_table(HTAB *hashp) * * increases), we need to copy the current contents of the spare * split bucket to the next bucket. */ - spare_ndx = __log2((uint32)(hashp->MAX_BUCKET + 1)); + spare_ndx = dbm_log2((uint32)(hashp->MAX_BUCKET + 1)); if (spare_ndx > hashp->OVFL_POINT) { hashp->SPARES[spare_ndx] = hashp->SPARES[hashp->OVFL_POINT]; hashp->OVFL_POINT = spare_ndx; @@ -1041,7 +1041,7 @@ __expand_table(HTAB *hashp) hashp->HIGH_MASK = new_bucket | hashp->LOW_MASK; } /* Relocate records to the new bucket */ - return (__split_page(hashp, old_bucket, new_bucket)); + return (dbm_split_page(hashp, old_bucket, new_bucket)); } /* @@ -1065,7 +1065,7 @@ hash_realloc( } extern uint32 -__call_hash(HTAB *hashp, char *k, size_t len) +dbm_call_hash(HTAB *hashp, char *k, size_t len) { uint32 n, bucket; @@ -1168,4 +1168,5 @@ swap_header(HTAB *hashp) M_16_SWAP(hdrp->bitmaps[i]); } } + #endif diff --git a/security/nss/lib/dbm/src/hash_buf.c b/security/nss/lib/dbm/src/hash_buf.c index a7cd2d076..02deb81c5 100644 --- a/security/nss/lib/dbm/src/hash_buf.c +++ b/security/nss/lib/dbm/src/hash_buf.c @@ -104,7 +104,7 @@ static BUFHEAD *newbuf(HTAB *, uint32, BUFHEAD *); * address you are seeking. */ extern BUFHEAD * -__get_buf(HTAB *hashp, uint32 addr, BUFHEAD *prev_bp, int newpage) +dbm_get_buf(HTAB *hashp, uint32 addr, BUFHEAD *prev_bp, int newpage) /* If prev_bp set, indicates a new overflow page. */ { register BUFHEAD *bp; @@ -124,7 +124,7 @@ __get_buf(HTAB *hashp, uint32 addr, BUFHEAD *prev_bp, int newpage) /* Grab buffer out of directory */ segment_ndx = addr & (hashp->SGSIZE - 1); - /* valid segment ensured by __call_hash() */ + /* valid segment ensured by dbm_call_hash() */ segp = hashp->dir[addr >> hashp->SSHIFT]; #ifdef DEBUG assert(segp != NULL); @@ -140,7 +140,7 @@ __get_buf(HTAB *hashp, uint32 addr, BUFHEAD *prev_bp, int newpage) bp = newbuf(hashp, addr, prev_bp); if (!bp) return (NULL); - if (__get_page(hashp, bp->page, addr, !prev_bp, is_disk, 0)) { + if (dbm_get_page(hashp, bp->page, addr, !prev_bp, is_disk, 0)) { /* free bp and its page */ if (prev_bp) { /* if prev_bp is set then the new page that @@ -242,8 +242,8 @@ newbuf(HTAB *hashp, uint32 addr, BUFHEAD *prev_bp) } oaddr = shortp[shortp[0] - 1]; } - if ((bp->flags & BUF_MOD) && __put_page(hashp, bp->page, - bp->addr, (int)IS_BUCKET(bp->flags), 0)) + if ((bp->flags & BUF_MOD) && dbm_put_page(hashp, bp->page, + bp->addr, (int)IS_BUCKET(bp->flags), 0)) return (NULL); /* * Update the pointer to this page (i.e. invalidate it). @@ -298,8 +298,8 @@ newbuf(HTAB *hashp, uint32 addr, BUFHEAD *prev_bp) /* set before __put_page */ oaddr = shortp[shortp[0] - 1]; } - if ((xbp->flags & BUF_MOD) && __put_page(hashp, - xbp->page, xbp->addr, 0, 0)) + if ((xbp->flags & BUF_MOD) && dbm_put_page(hashp, + xbp->page, xbp->addr, 0, 0)) return (NULL); xbp->addr = 0; xbp->flags = 0; @@ -335,7 +335,7 @@ newbuf(HTAB *hashp, uint32 addr, BUFHEAD *prev_bp) } extern void -__buf_init(HTAB *hashp, int32 nbytes) +dbm_buf_init(HTAB *hashp, int32 nbytes) { BUFHEAD *bfp; int npages; @@ -358,7 +358,7 @@ __buf_init(HTAB *hashp, int32 nbytes) } extern int -__buf_free(HTAB *hashp, int do_free, int to_disk) +dbm_buf_free(HTAB *hashp, int do_free, int to_disk) { BUFHEAD *bp; int status = -1; @@ -370,8 +370,8 @@ __buf_free(HTAB *hashp, int do_free, int to_disk) /* Check that the buffer is valid */ if (bp->addr || IS_BUCKET(bp->flags)) { if (to_disk && (bp->flags & BUF_MOD) && - (status = __put_page(hashp, bp->page, - bp->addr, IS_BUCKET(bp->flags), 0))) { + (status = dbm_put_page(hashp, bp->page, + bp->addr, IS_BUCKET(bp->flags), 0))) { if (do_free) { if (bp->page) @@ -397,11 +397,12 @@ __buf_free(HTAB *hashp, int do_free, int to_disk) } extern void -__reclaim_buf(HTAB *hashp, BUFHEAD *bp) +dbm_reclaim_buf(HTAB *hashp, BUFHEAD *bp) { bp->ovfl = 0; bp->addr = 0; bp->flags = 0; BUF_REMOVE(bp); LRU_INSERT(bp); + } -- cgit v1.2.3 From beea314ffe6c9cefeb232e9b38fcecf66154854f Mon Sep 17 00:00:00 2001 From: athenian200 Date: Wed, 2 Oct 2019 19:51:00 -0500 Subject: MoonchildProductions#1251 - Part 17: All the libffi and libxul.so issues, resolved. https://bugzilla.mozilla.org/show_bug.cgi?id=1185424 http://www.mindfruit.co.uk/2012/06/relocations-relocations.html The libxul.so fix was implemented by Mozilla in Firefox 57 and personally recommended to me by an Oracle employee on the OpenIndiana mailing list. It can easily be made ifdef XP_SOLARIS, but it seems like the new way is considered a better solution overall by the original author of the code that had it use that null pointer hack to begin with. I can't link where I found the fix for libffi because I came up with it myself while looking at the way sysv.S does things. Something clicked in my brain while reading that mindfruit link above, though, and gave me enough of a sense of what was going on to be able to fix libffi. The libffi fix looks a bit hairy because of all the FDE_ENCODE statements, but if you examine the code closely, you should find that it does exactly what it did before on all platforms besides Solaris. I later discovered that people who originally ported Firefox to Solaris never figured this out during the Firefox 52 era and had to use GNU LD for linking libxul.so while using the Sun LD for the rest of the build to make it work. For whatever reason, it works for me now without the GNU LD trick. --- config/external/ffi/moz.build | 21 +++++++++++++--- js/src/ctypes/libffi/src/x86/win32.S | 28 +++++++++++++++++----- .../StaticXULComponentsEnd.cpp | 5 +++- toolkit/library/StaticXULComponentsStart.cpp | 5 +++- 4 files changed, 48 insertions(+), 11 deletions(-) diff --git a/config/external/ffi/moz.build b/config/external/ffi/moz.build index e9ef07de3..3a5478967 100644 --- a/config/external/ffi/moz.build +++ b/config/external/ffi/moz.build @@ -35,9 +35,17 @@ else: 'FFI_NO_RAW_API': True, 'HAVE_AS_ASCII_PSEUDO_OP': True, 'HAVE_AS_STRING_PSEUDO_OP': True, - 'HAVE_AS_X86_64_UNWIND_SECTION_TYPE': True, }) +# This should NEVER be true on 32-bit x86 systems. It's called x86_64 unwind +# section type for a reason. By rights the way it was before should have broken +# all 32-bit builds on x86. + + if CONFIG['FFI_TARGET'] == 'X86': + DEFINES['HAVE_AS_X86_64_UNWIND_SECTION_TYPE'] = False + else: + DEFINES['HAVE_AS_X86_64_UNWIND_SECTION_TYPE'] = True + if CONFIG['MOZ_DEBUG']: DEFINES['FFI_DEBUG'] = True if not CONFIG['MOZ_NO_DEBUG_RTL']: @@ -49,13 +57,20 @@ else: if CONFIG['OS_TARGET'] not in ('WINNT', 'Darwin'): DEFINES['HAVE_HIDDEN_VISIBILITY_ATTRIBUTE'] = True - if CONFIG['INTEL_ARCHITECTURE']: +# Solaris uses datarel encoding for x86. This causes a lot of really stupid +# problems, like the vast majority of x86 assembler not being considered PIC +# on Solaris. + + if CONFIG['INTEL_ARCHITECTURE'] and CONFIG['OS_TARGET'] != 'SunOS': DEFINES['HAVE_AS_X86_PCREL'] = True # Don't bother setting EH_FRAME_FLAGS on Windows. # Quoted defines confuse msvcc.sh, and the value isn't used there. if CONFIG['OS_TARGET'] != 'WINNT': - if CONFIG['FFI_TARGET'] == 'ARM': + # Solaris seems to require EH_FRAME to be writable even on x86. + # It works fine most of the time and there's no rule against it, + # but it causes a lot of weird problems. + if CONFIG['FFI_TARGET'] == 'ARM' or CONFIG['OS_ARCH'] == 'SunOS': DEFINES['EH_FRAME_FLAGS'] = '"aw"' else: DEFINES['EH_FRAME_FLAGS'] = '"a"' diff --git a/js/src/ctypes/libffi/src/x86/win32.S b/js/src/ctypes/libffi/src/x86/win32.S index daf0e799c..4f702e8b1 100644 --- a/js/src/ctypes/libffi/src/x86/win32.S +++ b/js/src/ctypes/libffi/src/x86/win32.S @@ -1158,8 +1158,24 @@ L_ffi_closure_SYSV_inner$stub: .byte 0x7c /* .sleb128 -4; CIE Data Alignment Factor */ .byte 0x8 /* CIE RA Column */ #ifdef __PIC__ - .byte 0x1 /* .uleb128 0x1; Augmentation size */ - .byte 0x1b /* FDE Encoding (pcrel sdata4) */ +# if defined __sun__ && defined __svr4__ +/* 32-bit Solaris 2/x86 uses datarel encoding for PIC. GNU ld before 2.22 + doesn't correctly sort .eh_frame_hdr with mixed encodings, so match this. */ +# define FDE_ENCODING 0x30 /* datarel */ +# define FDE_ENCODE(X) X@GOTOFF +# else +# define FDE_ENCODING 0x1b /* pcrel sdata4 */ +# if defined HAVE_AS_X86_PCREL +# define FDE_ENCODE(X) X-. +# else +# define FDE_ENCODE(X) X@rel +# endif +# endif +#else +# define FDE_ENCODING 0 /* absolute */ +# define FDE_ENCODE(X) X +.byte 0x1 /* .uleb128 0x1; Augmentation size */ +.byte FDE_ENCODING #endif .byte 0xc /* DW_CFA_def_cfa CFA = r4 + 4 = 4(%esp) */ .byte 0x4 /* .uleb128 0x4 */ @@ -1176,7 +1192,7 @@ L_ffi_closure_SYSV_inner$stub: #if defined __PIC__ && defined HAVE_AS_X86_PCREL .long .LFB1-. /* FDE initial location */ #else - .long .LFB1 + .long FDE_ENCODE(.LFB1) #endif .long .LFE1-.LFB1 /* FDE address range */ #ifdef __PIC__ @@ -1207,7 +1223,7 @@ L_ffi_closure_SYSV_inner$stub: #if defined __PIC__ && defined HAVE_AS_X86_PCREL .long .LFB3-. /* FDE initial location */ #else - .long .LFB3 + .long FDE_ENCODE(.LFB3) #endif .long .LFE3-.LFB3 /* FDE address range */ #ifdef __PIC__ @@ -1240,7 +1256,7 @@ L_ffi_closure_SYSV_inner$stub: #if defined __PIC__ && defined HAVE_AS_X86_PCREL .long .LFB4-. /* FDE initial location */ #else - .long .LFB4 + .long FDE_ENCODE(.LFB4) #endif .long .LFE4-.LFB4 /* FDE address range */ #ifdef __PIC__ @@ -1278,7 +1294,7 @@ L_ffi_closure_SYSV_inner$stub: #if defined __PIC__ && defined HAVE_AS_X86_PCREL .long .LFB5-. /* FDE initial location */ #else - .long .LFB5 + .long FDE_ENCODE(.LFB5) #endif .long .LFE5-.LFB5 /* FDE address range */ #ifdef __PIC__ 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); -- cgit v1.2.3 From 7e5ff857eefd66008c78f2bcda62b28316e71f09 Mon Sep 17 00:00:00 2001 From: athenian200 Date: Wed, 2 Oct 2019 20:36:49 -0500 Subject: MoonchildProductions#1251 - Part 18: (Hopefully) final version of build system fixes. I hope I can just apply these nice, clean changes and have everything work without having to make a mess again. --- old-configure.in | 4 ++++ toolkit/library/libxul.mk | 12 ++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/old-configure.in b/old-configure.in index 1525ecc9b..f8fb9245b 100644 --- a/old-configure.in +++ b/old-configure.in @@ -1197,6 +1197,10 @@ case "$target" in fi ;; +*-solaris* + MOZ_FIX_LINK_PATHS="-L${DIST}/bin" + ;; + esac AC_SUBST_LIST(MMX_FLAGS) diff --git a/toolkit/library/libxul.mk b/toolkit/library/libxul.mk index 9e7e8beee..8533a015d 100644 --- a/toolkit/library/libxul.mk +++ b/toolkit/library/libxul.mk @@ -4,7 +4,7 @@ EXTRA_DEPS += $(topsrcdir)/toolkit/library/libxul.mk -ifeq (Linux,$(OS_ARCH)) +ifeq (Linux,$(OS_ARCH)) ifneq (Android,$(OS_TARGET)) OS_LDFLAGS += -Wl,-version-script,symverscript @@ -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 -- cgit v1.2.3 From e51afbcc2fe7360bbcf5654f6e31752c48098ca0 Mon Sep 17 00:00:00 2001 From: athenian200 Date: Fri, 4 Oct 2019 02:59:26 -0500 Subject: MoonchildProductions#1251 - Part 19: Make the unpreprocessed file script work on Solaris. https://www.tachytelic.net/2019/01/grep-recursively/ During testing, I tried simply replacing grep with ggrep, which was non-portable but worked fine. Using an environment variable with os.getenv set to 'g' also worked, but the problem with that approach is that you have to set it manually and some times the script will mess up if you don't explictly define it to an empty string for platforms that don't need it. Setting TOOLCHAIN_PREFIX to 'g' seemed to solve all of my problems except this one, and it appears to be the only non-portable use of GNU grep in the whole tree. To understand what I tried to do here, let me present with you with two commands that yield the same output on my machine: find . -name '*.xul' | xargs grep -E "#include" ggrep -E -r "#include" --include="*.xul" . I just tried to make the Python script follow the logic of those two commands, though I'm not sure how well I succeeded since I got no errors. I visualized everything this way: ggrep -E -r "" --include="" find -name '' | xargs grep -E "" And arranged it all accordingly to the best of my ability, though I should point out that Python is not my strong suit. --- python/mozbuild/mozbuild/mach_commands.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/python/mozbuild/mozbuild/mach_commands.py b/python/mozbuild/mozbuild/mach_commands.py index a45656b37..c2e1a3e89 100644 --- a/python/mozbuild/mozbuild/mach_commands.py +++ b/python/mozbuild/mozbuild/mach_commands.py @@ -544,9 +544,14 @@ class Build(MachCommandBase): # Check if there are any unpreprocessed files in '@MOZ_OBJDIR@/dist/bin' # See python/mozbuild/mozbuild/preprocessor.py#L293-L309 for the list of directives # We skip if, ifdef, ifndef, else, elif, elifdef and elifndef, because they are never used alone - grepcmd = 'grep -E -r "^(#|%)(define|endif|error|expand|filter|include|literal|undef|unfilter)" '\ - + '--include=\*.{css,dtd,html,js,jsm,xhtml,xml,xul,manifest,properties,rdf} '\ - + self.topobjdir + '/dist/bin | awk "/\.css:%/ || (!/\.css/ && /:#/)"' + # + # The original version of this script only worked with GNU grep because of the --include flag. + # Not a problem in and of itself, except that it didn't take TOOLCHAIN_PREFIX and simply assumed + # all operating systems use GNU grep as the system grep (often it's called ggrep or something). + # This script is a bit slower, but should do the same thing on all Unix platforms. + + grepcmd = 'find ' + self.topobjdir + '/dist/bin' + ' -name \'\*.{css,dtd,html,js,jsm,xhtml,xml,xul,manifest,properties,rdf}\' ' + '| xargs grep -E "^(#|%)(define|endif|error|expand|filter|include|literal|undef|unfilter)" '\ + + '| awk "/\.css:%/ || (!/\.css/ && /:#/)"' grepresult = subprocess.Popen(grepcmd, stdout=subprocess.PIPE, shell=True).communicate()[0] if grepresult: print('\nERROR: preprocessor was not applied to the following files:\n\n' + grepresult) -- cgit v1.2.3 From db34ef993c3b0a25619ec56d98303933b61169bc Mon Sep 17 00:00:00 2001 From: athenian200 Date: Fri, 4 Oct 2019 04:35:10 -0500 Subject: MoonchildProductions#1251 - Part 20: Add atomic.h to system-headers. https://bugzilla.mozilla.org/show_bug.cgi?id=1369061 OpenIndiana used a much messier fix for this, but this one was used by Mozilla and looks a lot cleaner. It shouldn't interfere with any other targets, but if it does, the messy version of this fix basically involves rewriting the Solaris version of atomicops_internals_solaris.h to use GCC compiler intrinsics for atomic operations directly. It absolutely works, but it's gross to look at. https://github.com/OpenIndiana/oi-userland/blob/3b246b0b385735b092a88f58f9baa9799ee34761/components/web/firefox/patches/01-FF43.0b3_OpenSXCE_x86_x64.patch Another fix may be possible by preventing config/gcc-hidden.h from being included, or possibly using well-placed GCC pragmas to solve the visibility issues. --- config/system-headers | 1 + 1 file changed, 1 insertion(+) diff --git a/config/system-headers b/config/system-headers index 683c9d337..b4f901792 100644 --- a/config/system-headers +++ b/config/system-headers @@ -1,3 +1,4 @@ +atomic.h nspr.h plarena.h plarenas.h -- cgit v1.2.3 From 575f51a27d6b3627ae5675cc8e920c8dcae073bd Mon Sep 17 00:00:00 2001 From: athenian200 Date: Fri, 4 Oct 2019 04:37:51 -0500 Subject: Fix a bunch of dumb typos and omissions. --- config/external/nspr/pr/moz.build | 2 +- dom/plugins/ipc/PluginModuleChild.cpp | 2 +- ipc/chromium/src/base/message_pump_glib.cc | 2 +- ipc/chromium/src/chrome/common/transport_dib.h | 2 +- js/src/jsnativestack.cpp | 3 ++- media/libpng/moz.build | 4 ++-- old-configure.in | 2 +- toolkit/library/moz.build | 1 + toolkit/xre/nsSigHandlers.cpp | 1 - xpcom/base/nsMemoryReporterManager.cpp | 2 +- xpcom/io/nsLocalFileUnix.cpp | 1 - xpcom/reflect/xptcall/md/unix/moz.build | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/config/external/nspr/pr/moz.build b/config/external/nspr/pr/moz.build index 02811aae8..84d6e7903 100644 --- a/config/external/nspr/pr/moz.build +++ b/config/external/nspr/pr/moz.build @@ -63,7 +63,7 @@ elif CONFIG['OS_TARGET'] == 'SunOS': if CONFIG['CPU_ARCH'] == 'x86_64': SOURCES += ['/nsprpub/pr/src/md/unix/os_SunOS_x86_64.s'] elif CONFIG['CPU_ARCH'] == 'x86': - SOURCES += ['/nsprpub/pr/src/md/unix/os_SunOS/x86.s'] + SOURCES += ['/nsprpub/pr/src/md/unix/os_SunOS_x86.s'] elif CONFIG['OS_TARGET'] == 'WINNT': OS_LIBS += [ 'advapi32', diff --git a/dom/plugins/ipc/PluginModuleChild.cpp b/dom/plugins/ipc/PluginModuleChild.cpp index 102c44a5e..f943dfc42 100644 --- a/dom/plugins/ipc/PluginModuleChild.cpp +++ b/dom/plugins/ipc/PluginModuleChild.cpp @@ -286,7 +286,7 @@ PluginModuleChild::InitForChrome(const std::string& aPluginFilename, // TODO: use PluginPRLibrary here -#if defined(OS_LINUX) || defined(OS_BSD) +#if defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS) mShutdownFunc = (NP_PLUGINSHUTDOWN) PR_FindFunctionSymbol(mLibrary, "NP_Shutdown"); diff --git a/ipc/chromium/src/base/message_pump_glib.cc b/ipc/chromium/src/base/message_pump_glib.cc index a5e719c72..f92378f3b 100644 --- a/ipc/chromium/src/base/message_pump_glib.cc +++ b/ipc/chromium/src/base/message_pump_glib.cc @@ -138,7 +138,7 @@ MessagePumpForUI::MessagePumpForUI() int flags = fcntl(fds[0], F_GETFL,0); if (flags == -1) flags = 0; - fntl(fds[0], F_SETFL, flags | O_NDELAY); + fcntl(fds[0], F_SETFL, flags | O_NDELAY); #endif wakeup_pipe_read_ = fds[0]; wakeup_pipe_write_ = fds[1]; diff --git a/ipc/chromium/src/chrome/common/transport_dib.h b/ipc/chromium/src/chrome/common/transport_dib.h index e3c40768c..f40a97d17 100644 --- a/ipc/chromium/src/chrome/common/transport_dib.h +++ b/ipc/chromium/src/chrome/common/transport_dib.h @@ -15,7 +15,7 @@ #if defined(OS_WIN) #include -#elif defined(OS_LINUX) +#elif defined(OS_LINUX) || defined(OS_SOLARIS) #include "chrome/common/x11_util.h" #endif diff --git a/js/src/jsnativestack.cpp b/js/src/jsnativestack.cpp index 389d7e657..4e96e01e8 100644 --- a/js/src/jsnativestack.cpp +++ b/js/src/jsnativestack.cpp @@ -73,7 +73,8 @@ js::GetNativeStackBaseImpl() JS_STATIC_ASSERT(JS_STACK_GROWTH_DIRECTION < 0); -void js::GetNativeStackBaseImpl() +void* +js::GetNativeStackBaseImpl() { stack_t st; stack_getbounds(&st); diff --git a/media/libpng/moz.build b/media/libpng/moz.build index 782aa93df..f2538484b 100644 --- a/media/libpng/moz.build +++ b/media/libpng/moz.build @@ -52,5 +52,5 @@ FINAL_LIBRARY = 'gkmedias' # We allow warnings for third-party code that can be updated from upstream. ALLOW_COMPILER_WARNINGS = True -if CONFIG['GNU_CC'] - CFLAGS += ['std=c89'] +if CONFIG['GNU_CC']: + CFLAGS += ['-std=c89'] diff --git a/old-configure.in b/old-configure.in index f8fb9245b..c5b4f1efb 100644 --- a/old-configure.in +++ b/old-configure.in @@ -1197,7 +1197,7 @@ case "$target" in fi ;; -*-solaris* +*-solaris*) MOZ_FIX_LINK_PATHS="-L${DIST}/bin" ;; diff --git a/toolkit/library/moz.build b/toolkit/library/moz.build index cd900a615..293c2feaf 100644 --- a/toolkit/library/moz.build +++ b/toolkit/library/moz.build @@ -274,6 +274,7 @@ if CONFIG['OS_ARCH'] == 'SunOS': OS_LIBS += [ 'elf', 'demangle', + 'sendfile', ] if CONFIG['OS_ARCH'] == 'FreeBSD': diff --git a/toolkit/xre/nsSigHandlers.cpp b/toolkit/xre/nsSigHandlers.cpp index bcbcb6e3d..a3a366f95 100644 --- a/toolkit/xre/nsSigHandlers.cpp +++ b/toolkit/xre/nsSigHandlers.cpp @@ -225,7 +225,6 @@ static void fpehandler(int signum, siginfo_t *si, void *context) #endif #endif } -} #endif void InstallSignalHandlers(const char *aProgname) diff --git a/xpcom/base/nsMemoryReporterManager.cpp b/xpcom/base/nsMemoryReporterManager.cpp index 9c2d620cc..dcbad171e 100644 --- a/xpcom/base/nsMemoryReporterManager.cpp +++ b/xpcom/base/nsMemoryReporterManager.cpp @@ -1151,7 +1151,7 @@ ResidentPeakDistinguishedAmount(int64_t* aN) #ifdef XP_MACOSX *aN = usage.ru_maxrss; #elif defined(XP_SOLARIS) - *aN = usage.ru.maxrss * getpagesize(); + *aN = usage.ru_maxrss * getpagesize(); #else *aN = usage.ru_maxrss * 1024; #endif diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp index c0b5c0f48..06706235d 100644 --- a/xpcom/io/nsLocalFileUnix.cpp +++ b/xpcom/io/nsLocalFileUnix.cpp @@ -1607,7 +1607,6 @@ nsLocalFile::IsExecutable(bool* aResult) return NSRESULT_FOR_ERRNO(); } #endif - if (*aResult || errno == EACCES) { if (*aResult || errno == EACCES) { return NS_OK; } diff --git a/xpcom/reflect/xptcall/md/unix/moz.build b/xpcom/reflect/xptcall/md/unix/moz.build index c5cba0c8d..a00588028 100644 --- a/xpcom/reflect/xptcall/md/unix/moz.build +++ b/xpcom/reflect/xptcall/md/unix/moz.build @@ -56,7 +56,7 @@ if CONFIG['OS_ARCH'] == 'SunOS': 'xptcinvoke_x86_64_unix.cpp', 'xptcstubs_x86_64_linux.cpp' ] - elif CONFIG['OS_TEST'] == 'x86': + elif '86' in CONFIG['OS_TEST']: SOURCES += [ 'xptcinvoke_gcc_x86_unix.cpp', 'xptcstubs_gcc_x86_unix.cpp' -- cgit v1.2.3 From 5a4a4990cd9f5d0b56d515b0246bc09da7109eb3 Mon Sep 17 00:00:00 2001 From: athenian200 Date: Mon, 7 Oct 2019 03:09:28 -0500 Subject: MoonchildProductions#1251 - Part 21: Fix Flash player and some extensions being incompatible. https://github.com/oracle/solaris-userland/blob/82dd4adb0eca729372074d62435e00a783d95b1f/components/desktop/firefox/patches/firefox-49-npapi.patch The first fix was something I found on Oracle's patchset and allowed me to use the last Flash Player compiled for Solaris, from all the way back in 2012. Still works with most Flash content. The second is an evolution of what I had to do to get Interlink to compile. For Interlink, I basically had to copy the contents of any boolean values from confvars.sh into the empty moz.configure file, otherwise nothing would get configured. I decided to test whether Pale Moon had the same issue, and it turned out that it wasn't as bad as on Interlink, but it was still pure luck that the browser component built at all, because MOZ_PHOENIX and other important flags were apparently not being defined at all, hence why I couldn't get half the extensions to be compatible at first. I don't know why this is the case, but apparently configure.in isn't able to import values from confvars.sh. old-configure.in seems immune to the problem that application-specific configure.in files were experiencing, though. confvars.sh itself seems to work fine with values that aren't passed along via configure.in, though. So it's the interface between those two files that is messed up. --- application/palemoon/moz.configure | 46 ++++++++++++++++++++++++++++++++++++++ dom/plugins/base/npapi.h | 7 ++++-- 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/application/palemoon/moz.configure b/application/palemoon/moz.configure index 72236254f..30ad4bfe5 100644 --- a/application/palemoon/moz.configure +++ b/application/palemoon/moz.configure @@ -5,3 +5,49 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. include('../../toolkit/moz.configure') + +# configure.in is unreliable on Solaris. The build system only picks up about +# half the boolean values defined there. Doing this instead +# works consistently. Most of the ones that use AC_DEFINE without a +# MOZ_ARG_BOOL in this directory's configure.in fail, but all the ones in +# old-configure.in work just fine and say there's a duplicate if I try and +# define them here. + +if target_is_solaris: + + set_define('HAVE_SIDEBAR', True) + set_config('HAVE_SIDEBAR', True) + + set_define('MC_PALEMOON', True) + set_config('MC_PALEMOON', True) + + set_define('MOZ_PHOENIX', True) + set_config('MOZ_PHOENIX', True) + + set_define('MOZ_PERSONAS', True) + set_config('MOZ_PERSONAS', True) + +# set_define('MOZ_DEVTOOLS', True) +# set_config('MOZ_DEVTOOLS', True) + + set_define('MOZ_PHOENIX_EXTENSIONS', True) + set_config('MOZ_PHOENIX_EXTENSIONS', True) + + set_define('MOZ_SERVICES_COMMON', True) + set_config('MOZ_SERVICES_COMMON', True) + +# set_define('MOZ_SERVICES_SYNC', True) +# set_config('MOZ_SERVICES_SYNC', True) + +# set_define('MOZ_JSDOWNLOADS', True) +# set_config('MOZ_JSDOWNLOADS', True) + +# set_define('MOZ_WEBGL_CONFORMANT', True) +# set_config('MOZ_WEBGL_CONFORMANT', True) + +# set_define('MOZ_ADDON_SIGNING', False) +# set_config('MOZ_ADDON_SIGNING', False) + +# set_define('MOZ_REQUIRE_SIGNING', False) +# set_config('MOZ_REQUIRE_SIGNING', False) + diff --git a/dom/plugins/base/npapi.h b/dom/plugins/base/npapi.h index 12ac635c7..e554aaabc 100644 --- a/dom/plugins/base/npapi.h +++ b/dom/plugins/base/npapi.h @@ -327,9 +327,12 @@ typedef enum { #define NP_ABI_GCC3_MASK 0x10000000 /* * gcc 3.x generated vtables on UNIX and OSX are incompatible with - * previous compilers. + * previous compilers. Flash plugin binaries for Solaris were compiled + * with Sun Studio, so this has to be false to make things work. This may + * become a problem in the future when/if new plugins are compiled with + * GCC, however. */ -#if (defined(XP_UNIX) && defined(__GNUC__) && (__GNUC__ >= 3)) +#if (defined(XP_UNIX) && defined(__GNUC__) && (__GNUC__ >= 3) && !defined(XP_SOLARIS)) #define _NP_ABI_MIXIN_FOR_GCC3 NP_ABI_GCC3_MASK #else #define _NP_ABI_MIXIN_FOR_GCC3 0 -- cgit v1.2.3 From 7d65eb2b3a345abe22f42361e00c97da2e968009 Mon Sep 17 00:00:00 2001 From: athenian200 Date: Mon, 7 Oct 2019 03:27:01 -0500 Subject: MoonchildProductions#1251 - Part 22: Remove some unused type declarations from IPC process_util. https://bugzilla.mozilla.org/show_bug.cgi?id=1397928 Was looking into that _POSIX_PATH_MAX/NAME_MAX issue earlier because it didn't make a lot of sense and I was thinking of other approaches besides char arrays, and I wanted to make sure it didn't cause problems after they did it. Turns out that one commit after this was added, Mozilla determined the code I was working on fixing to be dead code as of Firefox 58. I don't know if it's dead code in Pale Moon as well, but given that it compiles fine without it and I can't find any other references to szExeFile in the IPC code, that seems like a safe bet. Besides, I determined config/pathsub.c already seems to do what this code looks like it's trying to do, and implements the solution of just defining NAME_MAX to 256 and having done with it that I nearly adopted after realizing that even OS/2 and BeOS, let alone Unix/Linux systems, all basically use that value and there's just disagreement on which system header to check for it. --- ipc/chromium/src/base/process_util.h | 23 +---------------------- ipc/chromium/src/base/process_util_linux.cc | 5 ----- widget/GfxInfoX11.cpp | 2 +- 3 files changed, 2 insertions(+), 28 deletions(-) diff --git a/ipc/chromium/src/base/process_util.h b/ipc/chromium/src/base/process_util.h index 9b1e4fed5..4bb125681 100644 --- a/ipc/chromium/src/base/process_util.h +++ b/ipc/chromium/src/base/process_util.h @@ -39,28 +39,7 @@ #include "base/command_line.h" #include "base/process.h" -#if defined(OS_WIN) -typedef PROCESSENTRY32 ProcessEntry; -typedef IO_COUNTERS IoCounters; -#elif defined(OS_POSIX) -// TODO(port): we should not rely on a Win32 structure. -// Using NAME_MAX here would raise POSIX compliance issues -// (see Mozilla bug 1364865). -struct ProcessEntry { - int pid; - int ppid; - char szExeFile[_POSIX_PATH_MAX + 1]; -}; - -struct IoCounters { - unsigned long long ReadOperationCount; - unsigned long long WriteOperationCount; - unsigned long long OtherOperationCount; - unsigned long long ReadTransferCount; - unsigned long long WriteTransferCount; - unsigned long long OtherTransferCount; -}; - +#if defined(OS_POSIX) #include "base/file_descriptor_shuffle.h" #endif diff --git a/ipc/chromium/src/base/process_util_linux.cc b/ipc/chromium/src/base/process_util_linux.cc index 57388ccb0..a0d5ae816 100644 --- a/ipc/chromium/src/base/process_util_linux.cc +++ b/ipc/chromium/src/base/process_util_linux.cc @@ -34,11 +34,6 @@ namespace { -enum ParsingState { - KEY_NAME, - KEY_VALUE -}; - static mozilla::EnvironmentLog gProcessLog("MOZ_PROCESS_LOG"); } // namespace diff --git a/widget/GfxInfoX11.cpp b/widget/GfxInfoX11.cpp index 98a4bb965..05a2cab1a 100644 --- a/widget/GfxInfoX11.cpp +++ b/widget/GfxInfoX11.cpp @@ -192,7 +192,7 @@ GfxInfo::GetData() // and a buffer as some kind of workaround. They've been implementing // missing functions lately, though, so this may not be needed much longer. -#if defined(XP_SOLARIS) +#ifndef strcasestr #define strcasestr PL_strcasestr #endif -- cgit v1.2.3 From 2f4488521db663520c703a9a836d5549d679266c Mon Sep 17 00:00:00 2001 From: athenian200 Date: Thu, 10 Oct 2019 15:38:27 -0500 Subject: MoonchildProductions#1251 - Part 23: Allow AMD64 build to work. https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Compiling_32-bit_Firefox_on_a_Linux_64-bit_OS Setting this up turned out to be easier than I thought it would be. All I had to do was apply these instructions in reverse and add the following to my .mozconfig file: CC="gcc -m64" CXX="g++ -m64" AS="gas --64" ac_add_options --target=x86_64-pc-solaris2.11 export PKG_CONFIG_PATH=/usr/lib/amd64/pkgconfig ac_add_options --libdir=/usr/lib/amd64 ac_add_options --x-libraries=/usr/lib/amd64 Most of these changes were fairly trivial, just requiring me to make a few of the changes I made earlier conditional on a 32-bit build. The biggest challenge was figuring out why the JavaScript engine triggered a segfault everytime it tried to allocate memory. But this patch fixes it: https://github.com/OpenIndiana/oi-userland/blob/oi/hipster/components/web/firefox/patches/patch-js_src_gc_Memory.cpp.patch Turns out that Solaris on AMD64 handles memory management in a fairly unusual way with a segmented memory model, but it's not that different from what we see on other 64-bit processors. In fact, I saw a SPARC crash for a similar reason, and noticed that it looked just like mine except the numbers in the first segment were reversed. Having played around with hex editors before, I had a feeling I might be dealing with a little-endian version of a big-endian problem, but I didn't expect that knowledge to actually yield an easy solution. https://bugzilla.mozilla.org/show_bug.cgi?id=577056 https://www.oracle.com/technetwork/server-storage/solaris10/solaris-memory-135224.html As far as I can tell, this was the last barrier to an AMD64 Solaris build of Pale Moon. --- config/external/ffi/moz.build | 9 ++- config/external/nspr/pr/moz.build | 1 + ipc/chromium/src/base/message_pump_libevent.cc | 2 +- .../libevent/solaris/event2/event-config.h | 4 -- js/src/gc/Memory.cpp | 11 +++- xpcom/reflect/xptcall/md/unix/moz.build | 2 +- .../xptcall/md/unix/xptcinvoke_x86_64_solaris.cpp | 75 ++++++++++++++++++++++ xpcom/string/nsTSubstring.h | 9 ++- 8 files changed, 102 insertions(+), 11 deletions(-) create mode 100644 xpcom/reflect/xptcall/md/unix/xptcinvoke_x86_64_solaris.cpp diff --git a/config/external/ffi/moz.build b/config/external/ffi/moz.build index 3a5478967..01ccd0547 100644 --- a/config/external/ffi/moz.build +++ b/config/external/ffi/moz.build @@ -64,13 +64,20 @@ else: if CONFIG['INTEL_ARCHITECTURE'] and CONFIG['OS_TARGET'] != 'SunOS': DEFINES['HAVE_AS_X86_PCREL'] = True +# Which is why they apparently don't do this anymore on amd64. + + if CONFIG['FFI_TARGET'] == 'X86_64' and CONFIG['OS_TARGET'] == 'SunOS': + DEFINES['HAVE_AS_X86_PCREL'] = True + # Don't bother setting EH_FRAME_FLAGS on Windows. # Quoted defines confuse msvcc.sh, and the value isn't used there. if CONFIG['OS_TARGET'] != 'WINNT': # Solaris seems to require EH_FRAME to be writable even on x86. # It works fine most of the time and there's no rule against it, # but it causes a lot of weird problems. - if CONFIG['FFI_TARGET'] == 'ARM' or CONFIG['OS_ARCH'] == 'SunOS': + if CONFIG['FFI_TARGET'] == 'ARM': + DEFINES['EH_FRAME_FLAGS'] = '"aw"' + elif CONFIG['FFI_TARGET'] == 'X86' and CONFIG['OS_TARGET'] == 'SunOS': DEFINES['EH_FRAME_FLAGS'] = '"aw"' else: DEFINES['EH_FRAME_FLAGS'] = '"a"' diff --git a/config/external/nspr/pr/moz.build b/config/external/nspr/pr/moz.build index 84d6e7903..1d2df3099 100644 --- a/config/external/nspr/pr/moz.build +++ b/config/external/nspr/pr/moz.build @@ -62,6 +62,7 @@ elif CONFIG['OS_TARGET'] == 'SunOS': SOURCES += ['/nsprpub/pr/src/md/unix/solaris.c'] if CONFIG['CPU_ARCH'] == 'x86_64': SOURCES += ['/nsprpub/pr/src/md/unix/os_SunOS_x86_64.s'] + DEFINES['USE_64'] = True elif CONFIG['CPU_ARCH'] == 'x86': SOURCES += ['/nsprpub/pr/src/md/unix/os_SunOS_x86.s'] elif CONFIG['OS_TARGET'] == 'WINNT': diff --git a/ipc/chromium/src/base/message_pump_libevent.cc b/ipc/chromium/src/base/message_pump_libevent.cc index daba7c2fe..20d529707 100644 --- a/ipc/chromium/src/base/message_pump_libevent.cc +++ b/ipc/chromium/src/base/message_pump_libevent.cc @@ -24,7 +24,7 @@ #include "mozilla/UniquePtr.h" // This macro checks that the _EVENT_SIZEOF_* constants defined in -// ipc/chromiume/src/third_party//event2/event-config.h are correct. +// ipc/chromium/src/third_party//event2/event-config.h are correct. #if defined(_EVENT_SIZEOF_SHORT) #define CHECK_EVENT_SIZEOF(TYPE, type) \ static_assert(_EVENT_SIZEOF_##TYPE == sizeof(type), \ diff --git a/ipc/chromium/src/third_party/libevent/solaris/event2/event-config.h b/ipc/chromium/src/third_party/libevent/solaris/event2/event-config.h index 73000106b..cc4fb1eb1 100644 --- a/ipc/chromium/src/third_party/libevent/solaris/event2/event-config.h +++ b/ipc/chromium/src/third_party/libevent/solaris/event2/event-config.h @@ -417,11 +417,7 @@ #define _EVENT_SIZEOF_LONG_LONG 8 /* The size of `pthread_t', as computed by sizeof. */ -#ifdef __LP64__ -#define _EVENT_SIZEOF_PTHREAD_T 8 -#else #define _EVENT_SIZEOF_PTHREAD_T 4 -#endif /* The size of `short', as computed by sizeof. */ #define _EVENT_SIZEOF_SHORT 2 diff --git a/js/src/gc/Memory.cpp b/js/src/gc/Memory.cpp index 5cf0cd2f7..2bc1b9f50 100644 --- a/js/src/gc/Memory.cpp +++ b/js/src/gc/Memory.cpp @@ -415,8 +415,15 @@ InitMemorySubsystem() static inline void* MapMemoryAt(void* desired, size_t length, int prot = PROT_READ | PROT_WRITE, int flags = MAP_PRIVATE | MAP_ANON, int fd = -1, off_t offset = 0) + +// Solaris manages 64-bit address space in a different manner from every other +// AMD64 operating system, but fortunately the fix is the same one +// required for every operating system on 64-bit SPARC, Itanium, and ARM. +// Most people's intuition failed them here and they thought this couldn't +// possibly be correct on AMD64, but for Solaris/illumos it is. + { -#if defined(__ia64__) || (defined(__sparc64__) && defined(__NetBSD__)) || defined(__aarch64__) +#if defined(__ia64__) || (defined(__sparc64__) && defined(__NetBSD__)) || defined(__aarch64__) || (defined(__sun) && defined(__x86_64__)) MOZ_ASSERT((0xffff800000000000ULL & (uintptr_t(desired) + length - 1)) == 0); #endif void* region = mmap(desired, length, prot, flags, fd, offset); @@ -466,7 +473,7 @@ MapMemory(size_t length, int prot = PROT_READ | PROT_WRITE, return nullptr; } return region; -#elif defined(__aarch64__) +#elif defined(__aarch64__) || (defined(__sun) && defined(__x86_64__)) /* * There might be similar virtual address issue on arm64 which depends on * hardware and kernel configurations. But the work around is slightly diff --git a/xpcom/reflect/xptcall/md/unix/moz.build b/xpcom/reflect/xptcall/md/unix/moz.build index a00588028..8ee7b3181 100644 --- a/xpcom/reflect/xptcall/md/unix/moz.build +++ b/xpcom/reflect/xptcall/md/unix/moz.build @@ -53,7 +53,7 @@ if CONFIG['OS_ARCH'] == 'SunOS': if CONFIG['OS_TEST'] == 'x86_64': SOURCES += [ 'xptcinvoke_asm_x86_64_unix.S', - 'xptcinvoke_x86_64_unix.cpp', + 'xptcinvoke_x86_64_solaris.cpp', 'xptcstubs_x86_64_linux.cpp' ] elif '86' in CONFIG['OS_TEST']: diff --git a/xpcom/reflect/xptcall/md/unix/xptcinvoke_x86_64_solaris.cpp b/xpcom/reflect/xptcall/md/unix/xptcinvoke_x86_64_solaris.cpp new file mode 100644 index 000000000..a9db2a693 --- /dev/null +++ b/xpcom/reflect/xptcall/md/unix/xptcinvoke_x86_64_solaris.cpp @@ -0,0 +1,75 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// Platform specific code to invoke XPCOM methods on native objects + +#include "xptcprivate.h" + +// 6 integral parameters are passed in registers, but 1 is |this| which isn't +// considered here. +const uint32_t GPR_COUNT = 5; + +// 8 floating point parameters are passed in SSE registers +const uint32_t FPR_COUNT = 8; + +extern "C" void +InvokeCopyToStack(uint64_t * gpregs, double * fpregs, + uint32_t paramCount, nsXPTCVariant * s, + uint64_t* d) +{ + uint32_t nr_gpr = 0u; // skip one GP register for 'that' + uint32_t nr_fpr = 0u; + uint64_t value = 0u; + + for (uint32_t i = 0; i < paramCount; i++, s++) { + if (s->IsPtrData()) + value = (uint64_t) s->ptr; + else { + switch (s->type) { + case nsXPTType::T_FLOAT: break; + case nsXPTType::T_DOUBLE: break; + case nsXPTType::T_I8: value = s->val.i8; break; + case nsXPTType::T_I16: value = s->val.i16; break; + case nsXPTType::T_I32: value = s->val.i32; break; + case nsXPTType::T_I64: value = s->val.i64; break; + case nsXPTType::T_U8: value = s->val.u8; break; + case nsXPTType::T_U16: value = s->val.u16; break; + case nsXPTType::T_U32: value = s->val.u32; break; + case nsXPTType::T_U64: value = s->val.u64; break; + case nsXPTType::T_BOOL: value = s->val.b; break; + case nsXPTType::T_CHAR: value = s->val.c; break; + case nsXPTType::T_WCHAR: value = s->val.wc; break; + default: value = (uint64_t) s->val.p; break; + } + } + + if (!s->IsPtrData() && s->type == nsXPTType::T_DOUBLE) { + if (nr_fpr < FPR_COUNT) + fpregs[nr_fpr++] = s->val.d; + else { + *((double *)d) = s->val.d; + d++; + } + } + else if (!s->IsPtrData() && s->type == nsXPTType::T_FLOAT) { + if (nr_fpr < FPR_COUNT) + // The value in %xmm register is already prepared to + // be retrieved as a float. Therefore, we pass the + // value verbatim, as a double without conversion. + fpregs[nr_fpr++] = s->val.d; + else { + *((float *)d) = s->val.f; + d++; + } + } + else { + if (nr_gpr < GPR_COUNT) + gpregs[nr_gpr++] = value; + else + *d++ = value; + } + } +} diff --git a/xpcom/string/nsTSubstring.h b/xpcom/string/nsTSubstring.h index 2b0723c04..537889d5c 100644 --- a/xpcom/string/nsTSubstring.h +++ b/xpcom/string/nsTSubstring.h @@ -9,7 +9,12 @@ #include "mozilla/MemoryReporting.h" #include "mozilla/IntegerTypeTraits.h" #include "mozilla/Span.h" -#ifdef XP_SOLARIS + +// Solaris defines pid_t to be long on ILP32 and int on LP64. I checked in +// sys/types.h. AMD64 and SPARC64 builds don't need this fix at all, +// while all 32-bit builds do. + +#if defined(XP_SOLARIS) && !defined(__LP64__) #include #endif @@ -590,7 +595,7 @@ public: const char* fmt = aRadix == 10 ? "%d" : aRadix == 8 ? "%o" : "%x"; AppendPrintf(fmt, aInteger); } -#ifdef XP_SOLARIS +#if defined(XP_SOLARIS) && !defined(__LP64__) void AppendInt(pid_t aInteger) { AppendPrintf("%lu", aInteger); -- cgit v1.2.3 From 9cd92944e2c772fbb2e9856d5948553ae9233c9a Mon Sep 17 00:00:00 2001 From: athenian200 Date: Fri, 11 Oct 2019 15:36:33 -0500 Subject: MoonchildProductions#1251 - Part 24: Remove temporary GNU M4 workaround. We finally found where configure was failing. Apparently they just invoked m4 without regard for TOOLCHAIN_PREFIX. Easy to fix, difficult to find. --- application/palemoon/moz.configure | 44 -------------------------------------- old-configure.in | 4 ++-- 2 files changed, 2 insertions(+), 46 deletions(-) diff --git a/application/palemoon/moz.configure b/application/palemoon/moz.configure index 30ad4bfe5..de9b10b16 100644 --- a/application/palemoon/moz.configure +++ b/application/palemoon/moz.configure @@ -6,48 +6,4 @@ include('../../toolkit/moz.configure') -# configure.in is unreliable on Solaris. The build system only picks up about -# half the boolean values defined there. Doing this instead -# works consistently. Most of the ones that use AC_DEFINE without a -# MOZ_ARG_BOOL in this directory's configure.in fail, but all the ones in -# old-configure.in work just fine and say there's a duplicate if I try and -# define them here. - -if target_is_solaris: - - set_define('HAVE_SIDEBAR', True) - set_config('HAVE_SIDEBAR', True) - - set_define('MC_PALEMOON', True) - set_config('MC_PALEMOON', True) - - set_define('MOZ_PHOENIX', True) - set_config('MOZ_PHOENIX', True) - - set_define('MOZ_PERSONAS', True) - set_config('MOZ_PERSONAS', True) - -# set_define('MOZ_DEVTOOLS', True) -# set_config('MOZ_DEVTOOLS', True) - - set_define('MOZ_PHOENIX_EXTENSIONS', True) - set_config('MOZ_PHOENIX_EXTENSIONS', True) - - set_define('MOZ_SERVICES_COMMON', True) - set_config('MOZ_SERVICES_COMMON', True) - -# set_define('MOZ_SERVICES_SYNC', True) -# set_config('MOZ_SERVICES_SYNC', True) - -# set_define('MOZ_JSDOWNLOADS', True) -# set_config('MOZ_JSDOWNLOADS', True) - -# set_define('MOZ_WEBGL_CONFORMANT', True) -# set_config('MOZ_WEBGL_CONFORMANT', True) - -# set_define('MOZ_ADDON_SIGNING', False) -# set_config('MOZ_ADDON_SIGNING', False) - -# set_define('MOZ_REQUIRE_SIGNING', False) -# set_config('MOZ_REQUIRE_SIGNING', False) diff --git a/old-configure.in b/old-configure.in index c5b4f1efb..253084216 100644 --- a/old-configure.in +++ b/old-configure.in @@ -761,7 +761,7 @@ case "$host" in HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX" HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}" ;; - + *) HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX" HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}" @@ -4146,7 +4146,7 @@ if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then _subconfigure_config_args="$ac_configure_args" } tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1 - m4 "${srcdir}/build/autoconf/subconfigure.m4" \ + ${TOOLCHAIN_PREFIX}m4 "${srcdir}/build/autoconf/subconfigure.m4" \ "${srcdir}/build/autoconf/altoptions.m4" \ "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript . $tmpscript -- cgit v1.2.3 From 21146d0d5e4b6c985a3dce26460a5f495f1deb6e Mon Sep 17 00:00:00 2001 From: athenian200 Date: Thu, 17 Oct 2019 17:26:58 -0500 Subject: MoonchildProductions#1251 - Part 25: Fix link paths. This fix is a bit ugly and may need to be changed later if we switch a new GCC version, but the fact is that we use an architecture-specific path for GCC libraries on Solaris, so knowing the right prefix for GCC would only help so much, because it would still need to decide between ${gccdir}/lib and ${gccdir}/lib/amd64. The MOZ_FIX_LINK_PATHS variable puts the search paths into the right order without the need for me to use elfedit on the binaries afterwards. --- js/src/old-configure.in | 8 ++++++++ old-configure.in | 8 ++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/js/src/old-configure.in b/js/src/old-configure.in index 45108ee59..6566ce05e 100644 --- a/js/src/old-configure.in +++ b/js/src/old-configure.in @@ -923,6 +923,14 @@ case "$target" in fi ;; +i*86-*-solaris*) + MOZ_FIX_LINK_PATHS="-L${DIST}/bin -R'\$\$ORIGIN':/usr/gcc/7/lib" + ;; + +x86_64-*-solaris*) + MOZ_FIX_LINK_PATHS="-L${DIST}/bin -R'\$\$ORIGIN':/usr/gcc/7/lib/amd64" + ;; + esac dnl Only one oddball right now (QNX), but this gives us flexibility diff --git a/old-configure.in b/old-configure.in index 253084216..dae43d6f1 100644 --- a/old-configure.in +++ b/old-configure.in @@ -1197,8 +1197,12 @@ case "$target" in fi ;; -*-solaris*) - MOZ_FIX_LINK_PATHS="-L${DIST}/bin" +i*86-*-solaris*) + MOZ_FIX_LINK_PATHS="-L${DIST}/bin -R'\$\$ORIGIN':/usr/gcc/7/lib" + ;; + +x86_64-*-solaris*) + MOZ_FIX_LINK_PATHS="-L${DIST}/bin -R'\$\$ORIGIN':/usr/gcc/7/lib/amd64" ;; esac -- cgit v1.2.3 From e4f90cbb56b3cdcde52396b1aaa476cc8c5f07e5 Mon Sep 17 00:00:00 2001 From: athenian200 Date: Thu, 17 Oct 2019 19:55:19 -0500 Subject: MoonchildProductions#1251 - Part 26: Oracle Solaris gsed/ICU fix. OpenIndiana didn't need this for some reason, but on Oracle Solaris, we need this to make sure we're using gsed (GNU sed) here. It's probably a safer bet anyway. --- build/autoconf/icu.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/autoconf/icu.m4 b/build/autoconf/icu.m4 index 89c53c52c..d3cc3113d 100644 --- a/build/autoconf/icu.m4 +++ b/build/autoconf/icu.m4 @@ -35,7 +35,7 @@ if test -n "$USE_ICU"; then fi fi - version=`sed -n 's/^[[[:space:]]]*#[[:space:]]*define[[:space:]][[:space:]]*U_ICU_VERSION_MAJOR_NUM[[:space:]][[:space:]]*\([0-9][0-9]*\)[[:space:]]*$/\1/p' "$icudir/common/unicode/uvernum.h"` + version=`${TOOLCHAIN_PREFIX}sed -n 's/^[[[:space:]]]*#[[:space:]]*define[[:space:]][[:space:]]*U_ICU_VERSION_MAJOR_NUM[[:space:]][[:space:]]*\([0-9][0-9]*\)[[:space:]]*$/\1/p' "$icudir/common/unicode/uvernum.h"` if test x"$version" = x; then AC_MSG_ERROR([cannot determine icu version number from uvernum.h header file $lineno]) fi -- cgit v1.2.3 From 687a798e6dedacb8b42826debcd8e89baa69ce94 Mon Sep 17 00:00:00 2001 From: athenian200 Date: Sat, 19 Oct 2019 14:24:49 -0500 Subject: MoonchildProductions#1251 - Part 27: Fix ifdef style. This should do it for all the commits to files I changed, but while I'm in here I could probably go ahead and turn ALL the singular if defined statements into ifdef statements by using grep/find on the tree. On the other hand, perhaps we should do that as a separate issue so that this doesn't become a case of scope creep. --- dom/base/nsContentUtils.h | 4 ++-- dom/media/AudioStream.h | 2 +- dom/plugins/base/nsPluginsDirUnix.cpp | 4 ++-- ipc/chromium/src/base/message_pump_glib.cc | 6 +++--- ipc/chromium/src/base/message_pump_libevent.cc | 2 +- ipc/chromium/src/base/sys_info_posix.cc | 4 ++-- ipc/chromium/src/base/time.h | 8 ++++---- ipc/chromium/src/base/time_posix.cc | 2 +- ipc/glue/MessageLink.cpp | 4 ++-- js/src/builtin/TestingFunctions.cpp | 2 +- js/src/gc/Memory.cpp | 2 +- modules/libjar/nsZipArchive.cpp | 2 +- toolkit/components/terminator/nsTerminator.cpp | 4 ++-- toolkit/xre/nsSigHandlers.cpp | 4 ++-- xpcom/ds/nsMathUtils.h | 2 +- 15 files changed, 26 insertions(+), 26 deletions(-) diff --git a/dom/base/nsContentUtils.h b/dom/base/nsContentUtils.h index 26635acd6..606d67de9 100644 --- a/dom/base/nsContentUtils.h +++ b/dom/base/nsContentUtils.h @@ -9,11 +9,11 @@ #ifndef nsContentUtils_h___ #define nsContentUtils_h___ -#if defined(XP_WIN) +#ifdef XP_WIN #include #endif -#if defined(XP_SOLARIS) +#ifdef XP_SOLARIS #include #endif diff --git a/dom/media/AudioStream.h b/dom/media/AudioStream.h index 13cbb0c75..199314d4b 100644 --- a/dom/media/AudioStream.h +++ b/dom/media/AudioStream.h @@ -17,7 +17,7 @@ #include "mozilla/UniquePtr.h" #include "CubebUtils.h" #include "soundtouch/SoundTouchFactory.h" -#if defined(XP_SOLARIS) +#ifdef XP_SOLARIS #include "soundtouch/SoundTouch.h" #endif diff --git a/dom/plugins/base/nsPluginsDirUnix.cpp b/dom/plugins/base/nsPluginsDirUnix.cpp index 22d6bd44b..de3b7a2d1 100644 --- a/dom/plugins/base/nsPluginsDirUnix.cpp +++ b/dom/plugins/base/nsPluginsDirUnix.cpp @@ -19,7 +19,7 @@ #include "nsIPrefService.h" #define LOCAL_PLUGIN_DLL_SUFFIX ".so" -#if defined(XP_SOLARIS) +#ifdef XP_SOLARIS #define DEFAULT_X11_PATH "/usr/openwin/lib" #elif defined(LINUX) #define DEFAULT_X11_PATH "/usr/X11R6/lib/" @@ -94,7 +94,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 (XP_SOLARIS) +#ifdef XP_SOLARIS #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 diff --git a/ipc/chromium/src/base/message_pump_glib.cc b/ipc/chromium/src/base/message_pump_glib.cc index f92378f3b..24081bd8b 100644 --- a/ipc/chromium/src/base/message_pump_glib.cc +++ b/ipc/chromium/src/base/message_pump_glib.cc @@ -9,7 +9,7 @@ #include #include -#if defined(OS_SOLARIS) +#ifdef OS_SOLARIS #include #endif #include @@ -134,7 +134,7 @@ MessagePumpForUI::MessagePumpForUI() // Create our wakeup pipe, which is used to flag when work was scheduled. int fds[2]; CHECK(pipe(fds) == 0); -#if defined(OS_SOLARIS) +#ifdef OS_SOLARIS int flags = fcntl(fds[0], F_GETFL,0); if (flags == -1) flags = 0; @@ -324,7 +324,7 @@ void MessagePumpForUI::ScheduleWork() { // variables as we would then need locks all over. This ensures that if // we are sleeping in a poll that we will wake up. char msg = '!'; -#if defined(OS_SOLARIS) +#ifdef OS_SOLARIS char buf[32]; while (HANDLE_EINTR(read(wakeup_pipe_read_, &buf, 32))); #endif diff --git a/ipc/chromium/src/base/message_pump_libevent.cc b/ipc/chromium/src/base/message_pump_libevent.cc index 20d529707..51d3205b8 100644 --- a/ipc/chromium/src/base/message_pump_libevent.cc +++ b/ipc/chromium/src/base/message_pump_libevent.cc @@ -8,7 +8,7 @@ #include #include -#if defined(OS_SOLARIS) +#ifdef OS_SOLARIS #include #endif #if defined(ANDROID) || defined(OS_POSIX) diff --git a/ipc/chromium/src/base/sys_info_posix.cc b/ipc/chromium/src/base/sys_info_posix.cc index 6adbb1c06..f29c85092 100644 --- a/ipc/chromium/src/base/sys_info_posix.cc +++ b/ipc/chromium/src/base/sys_info_posix.cc @@ -121,7 +121,7 @@ std::wstring SysInfo::GetEnvVar(const wchar_t* var) { // static std::string SysInfo::OperatingSystemName() { -#if !defined(XP_SOLARIS) +#ifndef XP_SOLARIS) utsname info; #else struct utsname info; @@ -139,7 +139,7 @@ std::string SysInfo::OperatingSystemName() { // static std::string SysInfo::CPUArchitecture() { -#if !defined(XP_SOLARIS) +#ifndef XP_SOLARIS utsname info; #else struct utsname info; diff --git a/ipc/chromium/src/base/time.h b/ipc/chromium/src/base/time.h index 6a5c92d14..cee463579 100644 --- a/ipc/chromium/src/base/time.h +++ b/ipc/chromium/src/base/time.h @@ -28,7 +28,7 @@ #include "base/basictypes.h" -#if defined(OS_WIN) +#ifdef OS_WIN // For FILETIME in FromFileTime, until it moves to a new converter class. // See TODO(iyengar) below. #include @@ -64,7 +64,7 @@ class TimeDelta { return delta_; } -#if defined(OS_SOLARIS) +#ifdef OS_SOLARIS struct timespec ToTimeSpec() const; #endif @@ -230,11 +230,11 @@ class Time { static Time FromDoubleT(double dt); double ToDoubleT() const; -#if defined(OS_SOLARIS) +#ifdef OS_SOLARIS struct timeval ToTimeVal() const; #endif -#if defined(OS_WIN) +#ifdef OS_WIN static Time FromFileTime(FILETIME ft); FILETIME ToFileTime() const; #endif diff --git a/ipc/chromium/src/base/time_posix.cc b/ipc/chromium/src/base/time_posix.cc index 419cc8afb..5e0a922d9 100644 --- a/ipc/chromium/src/base/time_posix.cc +++ b/ipc/chromium/src/base/time_posix.cc @@ -202,7 +202,7 @@ TimeTicks TimeTicks::HighResNow() { return Now(); } -#if defined(OS_SOLARIS) +#ifdef OS_SOLARIS struct timespec TimeDelta::ToTimeSpec() const { int64_t microseconds = InMicroseconds(); time_t seconds = 0; diff --git a/ipc/glue/MessageLink.cpp b/ipc/glue/MessageLink.cpp index 8c6d9b890..14d885544 100644 --- a/ipc/glue/MessageLink.cpp +++ b/ipc/glue/MessageLink.cpp @@ -278,7 +278,7 @@ ProcessLink::OnChannelOpened() #ifdef DEBUG if (mExistingListener) { -#if defined(XP_SOLARIS) +#ifdef XP_SOLARIS std::queue pending; #else queue pending; @@ -298,7 +298,7 @@ void ProcessLink::OnTakeConnectedChannel() { AssertIOThread(); -#if defined(XP_SOLARIS) +#ifdef XP_SOLARIS std::queue pending; #else queue pending; diff --git a/js/src/builtin/TestingFunctions.cpp b/js/src/builtin/TestingFunctions.cpp index 6beb82932..4363c7aed 100644 --- a/js/src/builtin/TestingFunctions.cpp +++ b/js/src/builtin/TestingFunctions.cpp @@ -239,7 +239,7 @@ GetBuildConfiguration(JSContext* cx, unsigned argc, Value* vp) value = BooleanValue(true); if (!JS_SetProperty(cx, info, "intl-api", value)) return false; -#if defined(XP_SOLARIS) +#ifdef XP_SOLARIS value = BooleanValue(false); #else value = BooleanValue(true); diff --git a/js/src/gc/Memory.cpp b/js/src/gc/Memory.cpp index 2bc1b9f50..418984057 100644 --- a/js/src/gc/Memory.cpp +++ b/js/src/gc/Memory.cpp @@ -685,7 +685,7 @@ MarkPagesUnused(void* p, size_t size) return false; MOZ_ASSERT(OffsetFromAligned(p, pageSize) == 0); -#if defined(XP_SOLARIS) +#ifdef XP_SOLARIS int result = posix_madvise(p, size, POSIX_MADV_DONTNEED); #else int result = madvise(p, size, MADV_DONTNEED); diff --git a/modules/libjar/nsZipArchive.cpp b/modules/libjar/nsZipArchive.cpp index 24da13072..841503ebf 100644 --- a/modules/libjar/nsZipArchive.cpp +++ b/modules/libjar/nsZipArchive.cpp @@ -688,7 +688,7 @@ MOZ_WIN_MEM_TRY_BEGIN // Success means optimized jar layout from bug 559961 is in effect uint32_t readaheadLength = xtolong(startp); if (readaheadLength) { -#if defined(XP_SOLARIS) +#ifdef XP_SOLARIS posix_madvise(const_cast(startp), readaheadLength, POSIX_MADV_WILLNEED); #elif defined(XP_UNIX) madvise(const_cast(startp), readaheadLength, MADV_WILLNEED); diff --git a/toolkit/components/terminator/nsTerminator.cpp b/toolkit/components/terminator/nsTerminator.cpp index 007885b8d..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 #else #include @@ -385,7 +385,7 @@ nsTerminator::StartWatchdog() } UniquePtr options(new Options()); -#if !defined(XP_SOLARIS) +#ifdef XP_SOLARIS const PRIntervalTime ticksDuration = PR_MillisecondsToInterval(1000); #else const PRIntervalTime ticksDuration = 1000; diff --git a/toolkit/xre/nsSigHandlers.cpp b/toolkit/xre/nsSigHandlers.cpp index a3a366f95..660af4522 100644 --- a/toolkit/xre/nsSigHandlers.cpp +++ b/toolkit/xre/nsSigHandlers.cpp @@ -32,7 +32,7 @@ #endif #endif -#if defined(XP_SOLARIS) +#ifdef XP_SOLARIS #include #include #endif @@ -286,7 +286,7 @@ void InstallSignalHandlers(const char *aProgname) } #endif -#if defined(XP_SOLARIS) +#ifdef XP_SOLARIS #define NOFILES 512 // Boost Solaris file descriptors diff --git a/xpcom/ds/nsMathUtils.h b/xpcom/ds/nsMathUtils.h index 61eb47501..e3f423c8f 100644 --- a/xpcom/ds/nsMathUtils.h +++ b/xpcom/ds/nsMathUtils.h @@ -11,7 +11,7 @@ #include #include -#if defined(XP_SOLARIS) +#ifdef XP_SOLARIS #include #include #endif -- cgit v1.2.3 From a9dc528a4a7b0aaad5308aff70963485ec3e9bec Mon Sep 17 00:00:00 2001 From: athenian200 Date: Thu, 31 Oct 2019 19:35:03 -0500 Subject: Fix nits. I hope this addresses everything. --- ipc/chromium/src/base/sys_info_posix.cc | 2 +- toolkit/library/libxul.mk | 2 +- .../xptcall/md/unix/xptcinvoke_sparc_solaris.cpp | 30 ++++++++++++++-------- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/ipc/chromium/src/base/sys_info_posix.cc b/ipc/chromium/src/base/sys_info_posix.cc index f29c85092..632aa2f37 100644 --- a/ipc/chromium/src/base/sys_info_posix.cc +++ b/ipc/chromium/src/base/sys_info_posix.cc @@ -134,7 +134,7 @@ std::string SysInfo::OperatingSystemName() { } // Solaris contains "extern struct utsname utsname;" -// As a consequence, any use of utsname has to be proceeded with struct on +// As a consequence, any use of utsname has to be preceded with struct on // Solaris. See Mozilla bugs 758483 and 1353332. // static diff --git a/toolkit/library/libxul.mk b/toolkit/library/libxul.mk index 8533a015d..80f934e60 100644 --- a/toolkit/library/libxul.mk +++ b/toolkit/library/libxul.mk @@ -4,7 +4,7 @@ EXTRA_DEPS += $(topsrcdir)/toolkit/library/libxul.mk -ifeq (Linux,$(OS_ARCH)) +ifeq (Linux,$(OS_ARCH)) ifneq (Android,$(OS_TARGET)) OS_LDFLAGS += -Wl,-version-script,symverscript diff --git a/xpcom/reflect/xptcall/md/unix/xptcinvoke_sparc_solaris.cpp b/xpcom/reflect/xptcall/md/unix/xptcinvoke_sparc_solaris.cpp index 126ef1dad..c1b679779 100644 --- a/xpcom/reflect/xptcall/md/unix/xptcinvoke_sparc_solaris.cpp +++ b/xpcom/reflect/xptcall/md/unix/xptcinvoke_sparc_solaris.cpp @@ -104,22 +104,32 @@ invoke_copy_to_stack(uint32_t* d, uint32_t paramCount, nsXPTCVariant* s) } switch(l_s->type) { - case nsXPTType::T_I8 : *((int32_t*) l_d) = l_s->val.i8; break; - case nsXPTType::T_I16 : *((int32_t*) l_d) = l_s->val.i16; break; - case nsXPTType::T_I32 : *((int32_t*) l_d) = l_s->val.i32; break; + case nsXPTType::T_I8 : *((int32_t*) l_d) = l_s->val.i8; + break; + case nsXPTType::T_I16 : *((int32_t*) l_d) = l_s->val.i16; + break; + case nsXPTType::T_I32 : *((int32_t*) l_d) = l_s->val.i32; + break; case nsXPTType::T_I64 : case nsXPTType::T_U64 : case nsXPTType::T_DOUBLE : *((uint32_t*) l_d++) = ((DU *)l_s)->hi; if (regCount < 5) regCount++; *((uint32_t*) l_d) = ((DU *)l_s)->lo; break; - case nsXPTType::T_U8 : *((uint32_t*) l_d) = l_s->val.u8; break; - case nsXPTType::T_U16 : *((uint32_t*) l_d) = l_s->val.u16; break; - case nsXPTType::T_U32 : *((uint32_t*) l_d) = l_s->val.u32; break; - case nsXPTType::T_FLOAT : *((float*) l_d) = l_s->val.f; break; - case nsXPTType::T_BOOL : *((uint32_t*) l_d) = l_s->val.b; break; - case nsXPTType::T_CHAR : *((uint32_t*) l_d) = l_s->val.c; break; - case nsXPTType::T_WCHAR : *((int32_t*) l_d) = l_s->val.wc; break; + case nsXPTType::T_U8 : *((uint32_t*) l_d) = l_s->val.u8; + break; + case nsXPTType::T_U16 : *((uint32_t*) l_d) = l_s->val.u16; + break; + case nsXPTType::T_U32 : *((uint32_t*) l_d) = l_s->val.u32; + break; + case nsXPTType::T_FLOAT : *((float*) l_d) = l_s->val.f; + break; + case nsXPTType::T_BOOL : *((uint32_t*) l_d) = l_s->val.b; + break; + case nsXPTType::T_CHAR : *((uint32_t*) l_d) = l_s->val.c; + break; + case nsXPTType::T_WCHAR : *((int32_t*) l_d) = l_s->val.wc; + break; default: // all the others are plain pointer types *((void**)l_d) = l_s->val.p; -- cgit v1.2.3