Support modern Solaris.

This commit is contained in:
Fedor 2019-12-25 15:43:27 +03:00
parent 69f4608677
commit ec5b99da7e
124 changed files with 2656 additions and 335 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

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

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

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

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

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

View File

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

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

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

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}"
@ -1205,6 +1205,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)
@ -4224,7 +4232,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

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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

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