Merge remote-tracking branch 'origin/master' into custom

This commit is contained in:
Roy Tam 2019-11-04 11:56:53 +08:00
commit 09a00ad3bd
116 changed files with 2480 additions and 146 deletions

View file

@ -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

View file

@ -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);
////////////////////////////////////////////////////////////////////////////////

View file

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

View file

@ -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);

View file

@ -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: [ ] },

View file

@ -708,6 +708,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

View file

@ -301,6 +301,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

View file

@ -5,3 +5,5 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
include('../../toolkit/moz.configure')

View file

@ -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

View file

@ -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',

View file

@ -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',

View file

@ -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')

View file

@ -215,6 +215,7 @@ def old_configure_options(*options):
'--enable-pref-extensions',
'--enable-private-build',
'--enable-pulseaudio',
'--enable-sndio',
'--enable-raw',
'--enable-readline',
'--enable-reflow-perf',

View file

@ -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,14 +57,28 @@ 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
# 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':
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"'

View file

@ -51,6 +51,20 @@ 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']
DEFINES['USE_64'] = True
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 +238,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',
]

View file

@ -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

View file

@ -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))) \

View file

@ -1,3 +1,4 @@
atomic.h
nspr.h
plarena.h
plarenas.h
@ -909,7 +910,9 @@ signal.h
SimpleGameSound.h
SIOUX.h
size_t.h
#ifdef MOZ_SNDIO
sndio.h
#endif
someincludefile.h
Sound.h
soundcard.h

View file

@ -9,10 +9,14 @@
#ifndef nsContentUtils_h___
#define nsContentUtils_h___
#if defined(XP_WIN)
#ifdef XP_WIN
#include <float.h>
#endif
#ifdef XP_SOLARIS
#include <ieeefp.h>
#endif
#include "js/TypeDecls.h"
#include "js/Value.h"
#include "js/RootingAPI.h"

View file

@ -17,6 +17,10 @@
#include "mozilla/UniquePtr.h"
#include "CubebUtils.h"
#include "soundtouch/SoundTouchFactory.h"
#ifdef XP_SOLARIS
#include "soundtouch/SoundTouch.h"
#endif
namespace mozilla {

View file

@ -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

View file

@ -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 <inttypes.h>
#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

View file

@ -19,7 +19,9 @@
#include "nsIPrefService.h"
#define LOCAL_PLUGIN_DLL_SUFFIX ".so"
#if defined(LINUX)
#ifdef 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"
#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
#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

View file

@ -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;

View file

@ -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");
@ -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);

View file

@ -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;

View file

@ -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()
{

View file

@ -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";

View file

@ -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

View file

@ -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,

View file

@ -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 += [

View file

@ -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) {

View file

@ -9,6 +9,9 @@
#include <fcntl.h>
#include <math.h>
#ifdef OS_SOLARIS
#include <unistd.h>
#endif
#include <gtk/gtk.h>
#include <glib.h>
@ -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);
#ifdef OS_SOLARIS
int flags = fcntl(fds[0], F_GETFL,0);
if (flags == -1)
flags = 0;
fcntl(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 = '!';
#ifdef 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!";
}

View file

@ -8,6 +8,9 @@
#include <errno.h>
#include <fcntl.h>
#ifdef OS_SOLARIS
#include <sys/stat.h>
#endif
#if defined(ANDROID) || defined(OS_POSIX)
#include <unistd.h>
#endif
@ -21,7 +24,7 @@
#include "mozilla/UniquePtr.h"
// This macro checks that the _EVENT_SIZEOF_* constants defined in
// ipc/chromiume/src/third_party/<platform>/event2/event-config.h are correct.
// ipc/chromium/src/third_party/<platform>/event2/event-config.h are correct.
#if defined(_EVENT_SIZEOF_SHORT)
#define CHECK_EVENT_SIZEOF(TYPE, type) \
static_assert(_EVENT_SIZEOF_##TYPE == sizeof(type), \

View file

@ -24,7 +24,7 @@ typedef void* PlatformThreadHandle; // HANDLE
#elif defined(OS_POSIX)
#include <pthread.h>
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 <unistd.h>
typedef pid_t PlatformThreadId;
#elif defined(OS_BSD)

View file

@ -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
}

View file

@ -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 <dirent.h>
#include <limits.h>
#include <sys/types.h>
@ -39,26 +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.
struct ProcessEntry {
int pid;
int ppid;
char szExeFile[NAME_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

View file

@ -34,11 +34,6 @@
namespace {
enum ParsingState {
KEY_NAME,
KEY_VALUE
};
static mozilla::EnvironmentLog gProcessLog("MOZ_PROCESS_LOG");
} // namespace

View file

@ -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";

View file

@ -121,7 +121,11 @@ std::wstring SysInfo::GetEnvVar(const wchar_t* var) {
// static
std::string SysInfo::OperatingSystemName() {
#ifndef XP_SOLARIS)
utsname info;
#else
struct utsname info;
#endif
if (uname(&info) < 0) {
NOTREACHED();
return "";
@ -129,9 +133,17 @@ std::string SysInfo::OperatingSystemName() {
return std::string(info.sysname);
}
// Solaris <sys/utsname.h> contains "extern struct utsname utsname;"
// As a consequence, any use of utsname has to be preceded with struct on
// Solaris. See Mozilla bugs 758483 and 1353332.
// static
std::string SysInfo::CPUArchitecture() {
#ifndef XP_SOLARIS
utsname info;
#else
struct utsname info;
#endif
if (uname(&info) < 0) {
NOTREACHED();
return "";

View file

@ -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 <windows.h>
@ -64,6 +64,10 @@ class TimeDelta {
return delta_;
}
#ifdef 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,8 +230,11 @@ class Time {
static Time FromDoubleT(double dt);
double ToDoubleT() const;
#ifdef OS_SOLARIS
struct timeval ToTimeVal() const;
#endif
#if defined(OS_WIN)
#ifdef OS_WIN
static Time FromFileTime(FILETIME ft);
FILETIME ToFileTime() const;
#endif

View file

@ -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(&timestruct);
#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();
}
#ifdef 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

View file

@ -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

View file

@ -8,6 +8,7 @@
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#if defined(OS_MACOSX)
#include <sched.h>
#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"

View file

@ -15,7 +15,7 @@
#if defined(OS_WIN)
#include <windows.h>
#elif defined(OS_LINUX)
#elif defined(OS_LINUX) || defined(OS_SOLARIS)
#include "chrome/common/x11_util.h"
#endif
@ -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

View file

@ -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
/*

View file

@ -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

View file

@ -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)
{

View file

@ -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

View file

@ -0,0 +1,476 @@
/* 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 <arpa/inet.h> 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 <dlfcn.h> 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 <fcntl.h> 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 <inttypes.h> 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 <memory.h> 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 <netdb.h> header file. */
#define _EVENT_HAVE_NETDB_H 1
/* Define to 1 if you have the <netinet/in6.h> header file. */
/* #undef _EVENT_HAVE_NETINET_IN6_H */
/* Define to 1 if you have the <netinet/in.h> 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 <openssl/bio.h> 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 <poll.h> 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 <port.h> 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 <fcntl.h> */
#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 <stdarg.h> header file. */
#define _EVENT_HAVE_STDARG_H 1
/* Define to 1 if you have the <stddef.h> header file. */
#define _EVENT_HAVE_STDDEF_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#define _EVENT_HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define _EVENT_HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define _EVENT_HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> 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 <sys/devpoll.h> header file. */
#define _EVENT_HAVE_SYS_DEVPOLL_H 1
/* Define to 1 if you have the <sys/epoll.h> header file. */
/* #undef _EVENT_HAVE_SYS_EPOLL_H */
/* Define to 1 if you have the <sys/eventfd.h> header file. */
/* #undef _EVENT_HAVE_SYS_EVENTFD_H */
/* Define to 1 if you have the <sys/event.h> header file. */
/* #undef _EVENT_HAVE_SYS_EVENT_H */
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#define _EVENT_HAVE_SYS_IOCTL_H 1
/* Define to 1 if you have the <sys/mman.h> header file. */
#define _EVENT_HAVE_SYS_MMAN_H 1
/* Define to 1 if you have the <sys/param.h> header file. */
#define _EVENT_HAVE_SYS_PARAM_H 1
/* Define to 1 if you have the <sys/queue.h> header file. */
#define _EVENT_HAVE_SYS_QUEUE_H 1
/* Define to 1 if you have the <sys/select.h> header file. */
#define _EVENT_HAVE_SYS_SELECT_H 1
/* Define to 1 if you have the <sys/sendfile.h> header file. */
#define _EVENT_HAVE_SYS_SENDFILE_H 1
/* Define to 1 if you have the <sys/socket.h> header file. */
#define _EVENT_HAVE_SYS_SOCKET_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define _EVENT_HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/sysctl.h> header file. */
#undef _EVENT_HAVE_SYS_SYSCTL_H
/* Define to 1 if you have the <sys/time.h> header file. */
#define _EVENT_HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define _EVENT_HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/uio.h> header file. */
#define _EVENT_HAVE_SYS_UIO_H 1
/* Define to 1 if you have the <sys/wait.h> header file. */
#define _EVENT_HAVE_SYS_WAIT_H 1
/* Define if TAILQ_FOREACH is defined in <sys/queue.h> */
#define _EVENT_HAVE_TAILQFOREACH 1
/* Define if timeradd is defined in <sys/time.h> */
#define _EVENT_HAVE_TIMERADD 1
/* Define if timerclear is defined in <sys/time.h> */
#define _EVENT_HAVE_TIMERCLEAR 1
/* Define if timercmp is defined in <sys/time.h> */
#define _EVENT_HAVE_TIMERCMP 1
/* Define if timerisset is defined in <sys/time.h> */
#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 <unistd.h> 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 <zlib.h> 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. */
#define _EVENT_SIZEOF_PTHREAD_T 4
/* 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 <sys/time.h> and <time.h>. */
#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 <sys/types.h> does not define. */
/* #undef _EVENT_pid_t */
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef _EVENT_size_t */
/* Define to unsigned int if you dont have it */
/* #undef _EVENT_socklen_t */
/* Define to `int' if <sys/types.h> does not define. */
/* #undef _EVENT_ssize_t */
#endif /* event2/event-config.h */

View file

@ -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':

View file

@ -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

View file

@ -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
};

View file

@ -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.

View file

@ -599,7 +599,7 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& 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<std::string>& 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);

View file

@ -16,6 +16,9 @@
#include "nsDebug.h"
#include "nsISupportsImpl.h"
#include "nsXULAppAPI.h"
#if defined(__sun__) || defined(__sun)
#include <unistd.h>
#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) {
#ifdef XP_SOLARIS
std::queue<Message> pending;
#else
queue<Message> pending;
#endif
mExistingListener->GetQueuedMessages(pending);
MOZ_ASSERT(pending.empty());
}
@ -285,8 +298,11 @@ void
ProcessLink::OnTakeConnectedChannel()
{
AssertIOThread();
#ifdef XP_SOLARIS
std::queue<Message> pending;
#else
queue<Message> pending;
#endif
{
MonitorAutoLock lock(*mChan->mMonitor);

View file

@ -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 $^ $@

View file

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

View file

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

View file

@ -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__

View file

@ -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
@ -678,7 +685,11 @@ MarkPagesUnused(void* p, size_t size)
return false;
MOZ_ASSERT(OffsetFromAligned(p, pageSize) == 0);
int result = madvise(p, size, MADV_DONTNEED);
#ifdef XP_SOLARIS
int result = posix_madvise(p, size, POSIX_MADV_DONTNEED);
#else
int result = madvise(p, size, MADV_DONTNEED);
#endif
return result != -1;
}

View file

@ -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)

View file

@ -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());
}

View file

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

View file

@ -720,6 +720,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']

View file

@ -933,6 +933,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

View file

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

View file

@ -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
* <ucontext.h> should provide the register index defines in regset.h or
* require applications to request them specifically, and we need them here. */
#include <ucontext.h>
#include <sys/regset.h>
# 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

View file

@ -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();
}

View file

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

View file

@ -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;

View file

@ -245,7 +245,7 @@ sndio_stream_init(cubeb * context,
s->data_cb = data_callback;
s->state_cb = state_callback;
s->arg = user_ptr;
s->mtx = PTHREAD_MUTEX_INITIALIZER;
s->mtx = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;
s->rdpos = s->wrpos = 0;
if (output_stream_params->format == CUBEB_SAMPLE_FLOAT32LE) {
s->conv = 1;

View file

@ -0,0 +1,504 @@
/*
* Copyright (c) 2013, 2017 Ginn Chen <ginnchen@gmail.com>
*
* This program is made available under an ISC-style license. See the
* accompanying file LICENSE for details.
*/
#include <poll.h>
#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/audio.h>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/stropts.h>
#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
};

View file

@ -39,12 +39,18 @@ if CONFIG['MOZ_JACK']:
]
DEFINES['USE_JACK'] = True
if CONFIG['OS_ARCH'] == 'OpenBSD':
if CONFIG['MOZ_SNDIO']:
SOURCES += [
'cubeb_sndio.c',
]
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',

View file

@ -68,7 +68,7 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'uikit':
'-framework CoreFoundation',
'-framework AudioToolbox',
]
elif CONFIG['OS_TARGET'] == 'OpenBSD':
elif CONFIG['MOZ_SNDIO']:
OS_LIBS += [
'sndio',
]

View file

@ -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']

View file

@ -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':

View file

@ -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] = {};

View file

@ -283,7 +283,9 @@ typedef long ssize_t;
#define JEMALLOC_RECYCLE
#ifndef MOZ_MEMORY_WINDOWS
#ifndef MOZ_MEMORY_SOLARIS
#include <sys/cdefs.h>
#endif
#ifndef __DECONST
# define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var))
#endif
@ -309,7 +311,7 @@ __FBSDID("$FreeBSD: head/lib/libc/stdlib/malloc.c 180599 2008-07-18 19:35:44Z ja
#endif
#include <sys/time.h>
#include <sys/types.h>
#if !defined(MOZ_MEMORY_ANDROID)
#if !defined(MOZ_MEMORY_SOLARIS) && !defined(MOZ_MEMORY_ANDROID)
#include <sys/sysctl.h>
#endif
#include <sys/uio.h>
@ -411,6 +413,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
@ -1037,7 +1043,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__)
@ -2645,8 +2651,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
@ -3602,9 +3613,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
@ -5125,6 +5141,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)
@ -5921,9 +5944,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

View file

@ -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<void*>(aRegion), aSize, POSIX_MADV_NORMAL)) {
#else
if (madvise(reinterpret_cast<void*>(aRegion), aSize, MADV_NORMAL)) {
#endif
return true;
} else {
return false;

View file

@ -266,7 +266,11 @@ ReleaseRegion(void* aPage)
static bool
ProbeRegion(uintptr_t aPage)
{
#ifdef XP_SOLARIS
return !!posix_madvise(reinterpret_cast<void*>(aPage), PageSize(), POSIX_MADV_NORMAL);
#else
return !!madvise(reinterpret_cast<void*>(aPage), PageSize(), MADV_NORMAL);
#endif
}
static int

View file

@ -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
+

View file

@ -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

View file

@ -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)
#ifdef XP_SOLARIS
posix_madvise(const_cast<uint8_t*>(startp), readaheadLength, POSIX_MADV_WILLNEED);
#elif defined(XP_UNIX)
madvise(const_cast<uint8_t*>(startp), readaheadLength, MADV_WILLNEED);
#elif defined(XP_WIN)
if (aFd) {

View file

@ -13,7 +13,7 @@
#endif
#endif
// Expands to all the defines from configure.
/* Expands to all the defines from configure. */
#undef ALLDEFINES
/*

View file

@ -765,7 +765,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}"
@ -1206,6 +1206,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
AC_SUBST_LIST(MMX_FLAGS)
@ -3142,6 +3150,23 @@ fi
AC_SUBST(MOZ_PULSEAUDIO)
dnl ========================================================
dnl = Enable sndio
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(sndio,
[ --enable-sndio Enable sndio support],
MOZ_SNDIO=1,
MOZ_SNDIO= )
if test -n "$MOZ_SNDIO"; then
AC_DEFINE(MOZ_SNDIO)
MOZ_CHECK_HEADER([sndio.h], [],
AC_MSG_ERROR(
[--enable-sndio specified but it requires sndio development headers]))
AC_DEFINE(MOZ_SNDIO)
fi
AC_SUBST(MOZ_SNDIO)
dnl ========================================================
dnl NegotiateAuth
dnl ========================================================
@ -4225,7 +4250,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

View file

@ -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__',
}

View file

@ -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)

View file

@ -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"

View file

@ -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",

View file

@ -30,7 +30,7 @@
#include "nsIObserverService.h"
#include "nsIPrefService.h"
#if defined(XP_WIN)
#ifdef XP_WIN
#include <windows.h>
#else
#include <unistd.h>
@ -385,7 +385,11 @@ nsTerminator::StartWatchdog()
}
UniquePtr<Options> options(new Options());
#ifdef XP_SOLARIS
const PRIntervalTime ticksDuration = PR_MillisecondsToInterval(1000);
#else
const PRIntervalTime ticksDuration = 1000;
#endif
options->crashAfterTicks = crashAfterMS / ticksDuration;
DebugOnly<PRThread*> watchdogThread = CreateSystemThread(RunWatchdog,

View file

@ -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);

View file

@ -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);

View file

@ -26,10 +26,10 @@ endif
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
@ -37,6 +37,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
@ -60,6 +64,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

View file

@ -241,7 +241,7 @@ OS_LIBS += CONFIG['ICONV_LIBS']
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('cocoa', 'uikit'):
OS_LIBS += CONFIG['TK_LIBS']
if CONFIG['OS_ARCH'] == 'OpenBSD':
if CONFIG['MOZ_SNDIO']:
OS_LIBS += [
'sndio',
]
@ -270,6 +270,13 @@ if CONFIG['MOZ_ENABLE_STARTUP_NOTIFICATION']:
if CONFIG['MOZ_ENABLE_LIBPROXY']:
OS_LIBS += CONFIG['MOZ_LIBPROXY_LIBS']
if CONFIG['OS_ARCH'] == 'SunOS':
OS_LIBS += [
'elf',
'demangle',
'sendfile',
]
if CONFIG['OS_ARCH'] == 'FreeBSD':
OS_LIBS += [
'util',

View file

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

View file

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

View file

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

View file

@ -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.
#ifndef strcasestr
#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);

View file

@ -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

Some files were not shown because too many files have changed in this diff Show more