From owner-freebsd-gecko@FreeBSD.ORG Wed Jul 4 01:41:31 2012 Return-Path: Delivered-To: freebsd-gecko@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A839106564A for ; Wed, 4 Jul 2012 01:41:31 +0000 (UTC) (envelope-from svn-freebsd-gecko@chruetertee.ch) Received: from trillian.chruetertee.ch (trillian.chruetertee.ch [217.150.245.56]) by mx1.freebsd.org (Postfix) with ESMTP id 60C318FC08 for ; Wed, 4 Jul 2012 01:41:28 +0000 (UTC) Received: from trillian.chruetertee.ch (trillian [217.150.245.56]) by trillian.chruetertee.ch (8.14.4/8.14.3) with ESMTP id q641fRCJ096599 for ; Wed, 4 Jul 2012 01:41:27 GMT (envelope-from svn-freebsd-gecko@chruetertee.ch) Received: (from www@localhost) by trillian.chruetertee.ch (8.14.4/8.14.3/Submit) id q641fMEf094876 for freebsd-gecko@freebsd.org; Wed, 4 Jul 2012 01:41:22 GMT (envelope-from svn-freebsd-gecko@chruetertee.ch) Date: Wed, 4 Jul 2012 01:41:22 GMT Message-Id: <201207040141.q641fMEf094876@trillian.chruetertee.ch> X-Authentication-Warning: trillian.chruetertee.ch: www set sender to svn-freebsd-gecko@chruetertee.ch using -f From: svn-freebsd-gecko@chruetertee.ch To: freebsd-gecko@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [SVN-Commit] r838 - in branches/experimental/www/firefox-nightly: . files X-BeenThere: freebsd-gecko@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd-gecko@freebsd.org List-Id: Gecko Rendering Engine issues List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jul 2012 01:41:31 -0000 Author: jbeich Date: Wed Jul 4 01:41:22 2012 New Revision: 838 Log: [test/plugins] try teamplay with other BSDs This shares less code with OS_LINUX and is an attempt to land IPC changes upstream. Obtained from: pkgsrc via bug#753046 Added: branches/experimental/www/firefox-nightly/files/patch-bug753046 Deleted: branches/experimental/www/firefox-nightly/files/patch-ipc-chromium-src-base-dir_reader_linux.h branches/experimental/www/firefox-nightly/files/patch-ipc-chromium-src-base-file_util_linux.cc branches/experimental/www/firefox-nightly/files/patch-ipc-chromium-src-base-file_util_posix.cc branches/experimental/www/firefox-nightly/files/patch-ipc-chromium-src-base-platform_thread_posix.cc branches/experimental/www/firefox-nightly/files/patch-ipc-chromium-src-build-build_config.h Modified: branches/experimental/www/firefox-nightly/Makefile branches/experimental/www/firefox-nightly/files/patch-toolkit_library_Makefile.in Modified: branches/experimental/www/firefox-nightly/Makefile ============================================================================== --- branches/experimental/www/firefox-nightly/Makefile Tue Jul 3 18:24:14 2012 (r837) +++ branches/experimental/www/firefox-nightly/Makefile Wed Jul 4 01:41:22 2012 (r838) @@ -21,7 +21,6 @@ ${PYTHON_SITELIBDIR}/_sqlite3.so:${PORTSDIR}/databases/py-sqlite3 \ cairo>=1.10.2_1,1:${PORTSDIR}/graphics/cairo \ unzip:${PORTSDIR}/archivers/unzip -LIB_DEPENDS= execinfo.1:${PORTSDIR}/devel/libexecinfo CONFLICTS_BUILD= spidermonkey-* @@ -143,9 +142,6 @@ <${FILESDIR}/firefox.desktop.in >${WRKDIR}/${MOZILLA}.desktop post-patch: - @${GREP} -Flr \"/proc ${WRKSRC}/ipc/chromium/src/base | ${XARGS} ${REINPLACE_CMD} \ - -e 's|/proc/self/fd|/dev/fd|' \ - -e 's|/proc["/]|/compat/linux&|' @${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \ ${WRKSRC}/browser/app/nsBrowserApp.cpp Added: branches/experimental/www/firefox-nightly/files/patch-bug753046 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ branches/experimental/www/firefox-nightly/files/patch-bug753046 Wed Jul 4 01:41:22 2012 (r838) @@ -0,0 +1,1226 @@ +# Bug 753046 - Add support for DragonFly/NetBSD + +$NetBSD: patch-dom_plugins_ipc_PluginModuleChild.cpp,v 1.1 2012/03/06 12:34:09 ryoon Exp $ + +--- dom/plugins/ipc/PluginModuleChild.cpp.orig 2011-12-20 23:28:14.000000000 +0000 ++++ dom/plugins/ipc/PluginModuleChild.cpp +@@ -228,7 +228,7 @@ PluginModuleChild::Init(const std::strin + + // TODO: use PluginPRLibrary here + +-#if defined(OS_LINUX) ++#if defined(OS_LINUX) || defined(OS_BSD) + mShutdownFunc = + (NP_PLUGINSHUTDOWN) PR_FindFunctionSymbol(mLibrary, "NP_Shutdown"); + +@@ -1790,7 +1790,7 @@ PluginModuleChild::AnswerNP_GetEntryPoin + PLUGIN_LOG_DEBUG_METHOD; + AssertPluginThread(); + +-#if defined(OS_LINUX) ++#if defined(OS_LINUX) || defined(OS_BSD) + return true; + #elif defined(OS_WIN) || defined(OS_MACOSX) + *_retval = mGetEntryPointsFunc(&mFunctions); +@@ -1823,7 +1823,7 @@ PluginModuleChild::AnswerNP_Initialize(N + SendBackUpXResources(FileDescriptor(xSocketFd, false/*don't close*/)); + #endif + +-#if defined(OS_LINUX) ++#if defined(OS_LINUX) || defined(OS_BSD) + *_retval = mInitializeFunc(&sBrowserFuncs, &mFunctions); + return true; + #elif defined(OS_WIN) || defined(OS_MACOSX) +$NetBSD: patch-dom_plugins_ipc_PluginModuleChild.h,v 1.1 2012/03/06 12:34:09 ryoon Exp $ + +--- dom/plugins/ipc/PluginModuleChild.h.orig 2011-12-20 23:28:14.000000000 +0000 ++++ dom/plugins/ipc/PluginModuleChild.h +@@ -340,7 +340,7 @@ private: + + // we get this from the plugin + NP_PLUGINSHUTDOWN mShutdownFunc; +-#ifdef OS_LINUX ++#if defined(OS_LINUX) || defined(OS_BSD) + NP_PLUGINUNIXINIT mInitializeFunc; + #elif defined(OS_WIN) || defined(OS_MACOSX) + NP_PLUGININIT mInitializeFunc; +$NetBSD: patch-ipc_chromium_Makefile.in,v 1.1 2012/03/06 12:34:09 ryoon Exp $ + +--- ipc/chromium/Makefile.in.orig 2012-02-16 06:40:33.000000000 +0000 ++++ ipc/chromium/Makefile.in +@@ -278,6 +278,34 @@ endif + + endif # } OS_LINUX + ++ifdef OS_BSD # { ++ ++CPPSRCS += \ ++ atomicops_internals_x86_gcc.cc \ ++ file_util_bsd.cc \ ++ process_util_bsd.cc \ ++ time_posix.cc \ ++ $(NULL) ++ ++ifdef MOZ_ENABLE_GTK2 ++CPPSRCS += \ ++ message_pump_glib.cc \ ++ $(NULL) ++endif ++ ++ifdef MOZ_ENABLE_QT ++MOCSRCS = \ ++ moc_message_pump_qt.cc \ ++ $(NULL) ++ ++CPPSRCS += \ ++ $(MOCSRCS) \ ++ message_pump_qt.cc \ ++ $(NULL) ++endif ++ ++endif # } OS_BSD ++ + # libevent + + ifndef MOZ_NATIVE_LIBEVENT # { +$NetBSD: patch-ipc_chromium_chromium-config.mk,v 1.2 2012/03/15 08:30:06 ryoon Exp $ + +--- ipc/chromium/chromium-config.mk.orig 2012-02-16 07:40:33.000000000 +0100 ++++ ipc/chromium/chromium-config.mk 2012-03-11 11:05:40.397182000 +0100 +@@ -56,17 +56,6 @@ + -I$(DEPTH)/ipc/ipdl/_ipdlheaders \ + $(NULL) + +-ifeq ($(OS_ARCH),Darwin) # { +- +-OS_MACOSX = 1 +-OS_POSIX = 1 +- +-DEFINES += \ +- -DOS_MACOSX=1 \ +- -DOS_POSIX=1 \ +- $(NULL) +- +-else # } { + ifeq ($(OS_ARCH),WINNT) # { + OS_LIBS += $(call EXPAND_LIBNAME,psapi shell32 dbghelp) + +@@ -93,13 +82,64 @@ + endif + + else # } { +- +-OS_LINUX = 1 + OS_POSIX = 1 ++DEFINES += -DOS_POSIX=1 ++ ++ifeq ($(OS_ARCH),Darwin) # { ++ ++OS_MACOSX = 1 ++DEFINES += \ ++ -DOS_MACOSX=1 \ ++ $(NULL) ++ ++else # } { ++ifeq ($(OS_ARCH),DragonFly) # { ++ ++OS_DRAGONFLY = 1 ++OS_BSD = 1 ++OS_LIBS += $(call EXPAND_LIBNAME,kvm) ++DEFINES += \ ++ -DOS_DRAGONFLY=1 \ ++ -DOS_BSD=1 \ ++ $(NULL) ++ ++else # } { ++ifeq ($(OS_ARCH),FreeBSD) # { ++ ++OS_FREEBSD = 1 ++OS_BSD = 1 ++OS_LIBS += $(call EXPAND_LIBNAME,kvm) ++DEFINES += \ ++ -DOS_FREEBSD=1 \ ++ -DOS_BSD=1 \ ++ $(NULL) + ++else # } { ++ifeq ($(OS_ARCH),NetBSD) # { ++ ++OS_NETBSD = 1 ++OS_BSD = 1 ++OS_LIBS += $(call EXPAND_LIBNAME,kvm) ++DEFINES += \ ++ -DOS_NETBSD=1 \ ++ -DOS_BSD=1 \ ++ $(NULL) ++ ++else # } { ++ifeq ($(OS_ARCH),OpenBSD) # { ++ ++OS_OPENBSD = 1 ++OS_BSD = 1 ++DEFINES += \ ++ -DOS_OPENBSD=1 \ ++ -DOS_BSD=1 \ ++ $(NULL) ++ ++else # } { ++ ++OS_LINUX = 1 + DEFINES += \ + -DOS_LINUX=1 \ +- -DOS_POSIX=1 \ + $(NULL) + + # NB: to stop gcc warnings about exporting template instantiation +@@ -107,4 +147,8 @@ + + endif # } + endif # } ++endif # } ++endif # } ++endif # } ++endif # } + +$NetBSD: patch-ipc_chromium_src_base_base__paths.h,v 1.1 2012/03/06 12:34:09 ryoon Exp $ + +--- ipc/chromium/src/base/base_paths.h.orig 2011-12-20 23:28:19.000000000 +0000 ++++ ipc/chromium/src/base/base_paths.h +@@ -13,7 +13,7 @@ + #include "base/base_paths_win.h" + #elif defined(OS_MACOSX) + #include "base/base_paths_mac.h" +-#elif defined(OS_LINUX) ++#elif defined(OS_LINUX) || defined(OS_BSD) + #include "base/base_paths_linux.h" + #endif + #include "base/path_service.h" +$NetBSD: patch-ipc_chromium_src_base_debug__util__posic.cc,v 1.3 2012/04/01 15:18:45 ryoon Exp $ + +--- ipc/chromium/src/base/debug_util_posix.cc.orig 2012-03-13 01:36:53.000000000 +0000 ++++ ipc/chromium/src/base/debug_util_posix.cc +@@ -5,7 +5,7 @@ + #include "build/build_config.h" + #include "base/debug_util.h" + +-#define MOZ_HAVE_EXECINFO_H (!defined(ANDROID) && !defined(__OpenBSD__)) ++#define MOZ_HAVE_EXECINFO_H (defined(OS_LINUX) && !defined(ANDROID)) + + #include + #include +@@ -17,8 +17,13 @@ + #include + #if MOZ_HAVE_EXECINFO_H + #include +-#include + #endif ++#if defined(OS_DRAGONFLY) || defined(OS_FREEBSD) ++#include ++#elif defined(OS_FREEBSD) ++#include ++#endif ++#include + + #include "base/basictypes.h" + #include "base/eintr_wrapper.h" +@@ -32,7 +37,7 @@ bool DebugUtil::SpawnDebuggerOnProcess(u + return false; + } + +-#if defined(OS_MACOSX) ++#if defined(OS_MACOSX) || defined(OS_BSD) + + // Based on Apple's recommended method as described in + // http://developer.apple.com/qa/qa2004/qa1361.html +@@ -71,7 +76,13 @@ bool DebugUtil::BeingDebugged() { + + // This process is being debugged if the P_TRACED flag is set. + is_set = true; ++#if defined(OS_DRAGONFLY) ++ being_debugged = (info.kp_flags & P_TRACED) != 0; ++#elif defined(OS_FREEBSD) ++ being_debugged = (info.ki_flag & P_TRACED) != 0; ++#else + being_debugged = (info.kp_proc.p_flag & P_TRACED) != 0; ++#endif + return being_debugged; + } + +$NetBSD: patch-ipc_chromium_src_base_file__util.h,v 1.2 2012/03/06 12:34:09 ryoon Exp $ + +--- ipc/chromium/src/base/file_util.h.orig 2011-12-20 23:28:19.000000000 +0000 +diff --git ipc/chromium/src/base/dir_reader_bsd.h ipc/chromium/src/base/dir_reader_bsd.h +new file mode 100644 +index 0000000..3fc1a87 +--- /dev/null ++++ ipc/chromium/src/base/dir_reader_bsd.h +@@ -0,0 +1,98 @@ ++// Copyright (c) 2010 The Chromium Authors. All rights reserved. ++// Use of this source code is governed by a BSD-style license that can be ++// found in the LICENSE file. ++ ++// derived from dir_reader_linux.h ++ ++#ifndef BASE_DIR_READER_BSD_H_ ++#define BASE_DIR_READER_BSD_H_ ++#pragma once ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include "base/logging.h" ++#include "base/eintr_wrapper.h" ++ ++// See the comments in dir_reader_posix.h about this. ++ ++namespace base { ++ ++class DirReaderBSD { ++ public: ++ explicit DirReaderBSD(const char* directory_path) ++#ifdef O_DIRECTORY ++ : fd_(open(directory_path, O_RDONLY | O_DIRECTORY)), ++#else ++ : fd_(open(directory_path, O_RDONLY)), ++#endif ++ offset_(0), ++ size_(0) { ++ memset(buf_, 0, sizeof(buf_)); ++ } ++ ++ ~DirReaderBSD() { ++ if (fd_ >= 0) { ++ if (HANDLE_EINTR(close(fd_))) ++ DLOG(ERROR) << "Failed to close directory handle"; ++ } ++ } ++ ++ bool IsValid() const { ++ return fd_ >= 0; ++ } ++ ++ // Move to the next entry returning false if the iteration is complete. ++ bool Next() { ++ if (size_) { ++ struct dirent* dirent = reinterpret_cast(&buf_[offset_]); ++ offset_ += dirent->d_reclen; ++ } ++ ++ if (offset_ != size_) ++ return true; ++ ++ const int r = getdirentries(fd_, buf_, sizeof(buf_), basep_); ++ if (r == 0) ++ return false; ++ if (r == -1) { ++ DLOG(ERROR) << "getdirentries returned an error: " << errno; ++ return false; ++ } ++ size_ = r; ++ offset_ = 0; ++ return true; ++ } ++ ++ const char* name() const { ++ if (!size_) ++ return NULL; ++ ++ const struct dirent* dirent = ++ reinterpret_cast(&buf_[offset_]); ++ return dirent->d_name; ++ } ++ ++ int fd() const { ++ return fd_; ++ } ++ ++ static bool IsFallback() { ++ return false; ++ } ++ ++ private: ++ const int fd_; ++ char buf_[512]; ++ long *basep_; ++ size_t offset_, size_; ++ ++ DISALLOW_COPY_AND_ASSIGN(DirReaderBSD); ++}; ++ ++} // namespace base ++ ++#endif // BASE_DIR_READER_BSD_H_ +diff --git ipc/chromium/src/base/dir_reader_posix.h ipc/chromium/src/base/dir_reader_posix.h +index 9a34492..62b280c 100644 +--- ipc/chromium/src/base/dir_reader_posix.h ++++ ipc/chromium/src/base/dir_reader_posix.h +@@ -18,16 +18,20 @@ + // seems worse than falling back to enumerating all file descriptors so we will + // probably never implement this on the Mac. + +-#if defined(OS_LINUX) && !defined(OS_OPENBSD) ++#if defined(OS_LINUX) + #include "base/dir_reader_linux.h" ++#elif defined(OS_BSD) ++#include "base/dir_reader_bsd.h" + #else + #include "base/dir_reader_fallback.h" + #endif + + namespace base { + +-#if defined(OS_LINUX) && !defined(OS_OPENBSD) ++#if defined(OS_LINUX) + typedef DirReaderLinux DirReaderPosix; ++#elif defined(OS_BSD) ++typedef DirReaderBSD DirReaderPosix; + #else + typedef DirReaderFallback DirReaderPosix; + #endif +diff --git ipc/chromium/src/base/file_util.h ipc/chromium/src/base/file_util.h +index 71124ed..a10fcc2 100644 +--- ipc/chromium/src/base/file_util.h ++++ ipc/chromium/src/base/file_util.h +@@ -16,8 +16,8 @@ + #include + #elif defined(OS_POSIX) + #include +-#include + #include ++#include + #endif + + #include +$NetBSD: patch-ipc_chromium_src_base_file__util__bsd.cc,v 1.1 2012/03/06 12:34:09 ryoon Exp $ + +--- ipc/chromium/src/base/file_util_bsd.cc.orig 2012-01-07 18:21:18.000000000 +0000 ++++ ipc/chromium/src/base/file_util_bsd.cc +@@ -0,0 +1,80 @@ ++// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. ++// Use of this source code is governed by a BSD-style license that can be ++// found in the LICENSE file. ++ ++// this is a derivative of file_util_linux.cc ++ ++#include "base/file_util.h" ++ ++#include ++#include ++ ++#include ++#include ++ ++#include "base/eintr_wrapper.h" ++#include "base/file_path.h" ++#include "base/string_util.h" ++ ++namespace file_util { ++ ++bool GetTempDir(FilePath* path) { ++ const char* tmp = getenv("TMPDIR"); ++ if (tmp) ++ *path = FilePath(tmp); ++ else ++ *path = FilePath("/tmp"); ++ return true; ++} ++ ++bool GetShmemTempDir(FilePath* path) { ++ return GetTempDir(path); ++} ++ ++bool CopyFile(const FilePath& from_path, const FilePath& to_path) { ++ int infile = open(from_path.value().c_str(), O_RDONLY); ++ if (infile < 0) ++ return false; ++ ++ int outfile = creat(to_path.value().c_str(), 0666); ++ if (outfile < 0) { ++ close(infile); ++ return false; ++ } ++ ++ const size_t kBufferSize = 32768; ++ std::vector buffer(kBufferSize); ++ bool result = true; ++ ++ while (result) { ++ ssize_t bytes_read = HANDLE_EINTR(read(infile, &buffer[0], buffer.size())); ++ if (bytes_read < 0) { ++ result = false; ++ break; ++ } ++ if (bytes_read == 0) ++ break; ++ // Allow for partial writes ++ ssize_t bytes_written_per_read = 0; ++ do { ++ ssize_t bytes_written_partial = HANDLE_EINTR(write( ++ outfile, ++ &buffer[bytes_written_per_read], ++ bytes_read - bytes_written_per_read)); ++ if (bytes_written_partial < 0) { ++ result = false; ++ break; ++ } ++ bytes_written_per_read += bytes_written_partial; ++ } while (bytes_written_per_read < bytes_read); ++ } ++ ++ if (HANDLE_EINTR(close(infile)) < 0) ++ result = false; ++ if (HANDLE_EINTR(close(outfile)) < 0) ++ result = false; ++ ++ return result; ++} ++ ++} // namespace file_util +$NetBSD: patch-ipc_chromium_src_base_file__util__posix.cc,v 1.2 2012/03/06 12:34:09 ryoon Exp $ + +--- ipc/chromium/src/base/file_util_posix.cc.orig 2011-12-20 23:28:19.000000000 +0000 ++++ ipc/chromium/src/base/file_util_posix.cc +@@ -31,7 +31,7 @@ + #include "base/time.h" + + // FreeBSD/OpenBSD lacks stat64, but its stat handles files >2GB just fine +-#if defined(OS_FREEBSD) || defined(OS_OPENBSD) ++#ifndef OS_LINUX + #define stat64 stat + #endif + +$NetBSD: patch-ipc_chromium_src_base_message__loop.cc,v 1.1 2012/03/06 12:34:09 ryoon Exp $ + +--- ipc/chromium/src/base/message_loop.cc.orig 2012-02-16 07:40:33.000000000 +0100 ++++ ipc/chromium/src/base/message_loop.cc 2012-02-21 21:24:41.000000000 +0100 +@@ -19,7 +19,7 @@ + #if defined(OS_POSIX) + #include "base/message_pump_libevent.h" + #endif +-#if defined(OS_LINUX) ++#if defined(OS_LINUX) || defined(OS_BSD) + #ifdef MOZ_WIDGET_GTK2 + #include "base/message_pump_glib.h" + #endif +@@ -119,7 +119,7 @@ + if (type_ == TYPE_UI) { + #if defined(OS_MACOSX) + pump_ = base::MessagePumpMac::Create(); +-#elif defined(OS_LINUX) ++#elif defined(OS_LINUX) || defined(OS_BSD) + pump_ = new base::MessagePumpForUI(); + #endif // OS_LINUX + } else if (type_ == TYPE_IO) { +$NetBSD: patch-ipc_chromium_src_base_platform__file__posix.cc,v 1.1 2011/07/12 15:12:36 tnn Exp $ + +--- ipc/chromium/src/base/platform_file_posix.cc.orig 2011-06-15 21:57:27.000000000 +0000 ++++ ipc/chromium/src/base/platform_file_posix.cc +@@ -9,6 +9,7 @@ + #ifdef ANDROID + #include + #endif ++#include /* for S_IRUSR */ + + #include "base/logging.h" + #include "base/string_util.h" +$NetBSD: patch-ipc_chromium_src_base_platform__thread.h,v 1.1 2012/03/06 12:34:09 ryoon Exp $ + +--- ipc/chromium/src/base/platform_thread.h.orig 2011-12-20 23:28:19.000000000 +0000 ++++ ipc/chromium/src/base/platform_thread.h +@@ -25,6 +25,8 @@ typedef pthread_t PlatformThreadHandle; + #if defined(OS_LINUX) + #include + typedef pid_t PlatformThreadId; ++#elif defined(OS_FREEBSD) || defined(OS_DRAGONFLY) || defined (OS_NETBSD) ++typedef lwpid_t PlatformThreadId; + #elif defined(OS_MACOSX) + #include + typedef mach_port_t PlatformThreadId; +$NetBSD: patch-ipc_chromium_src_base_platform__thread__posix.cc,v 1.4 2012/04/01 15:18:45 ryoon Exp $ + +--- ipc/chromium/src/base/platform_thread_posix.cc.orig 2012-03-13 01:36:53.000000000 +0000 ++++ ipc/chromium/src/base/platform_thread_posix.cc +@@ -9,16 +9,25 @@ + + #if defined(OS_MACOSX) + #include ++#elif defined(OS_NETBSD) ++#include + #elif defined(OS_LINUX) + #include +-#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(__DragonFly__) + #include +-#elif !defined(__NetBSD__) +-#include ++#elif defined(OS_FREEBSD) ++_Pragma("GCC visibility push(default)") ++extern "C" int thr_self(long *); // XXX #include ++_Pragma("GCC visibility pop") + #endif ++ ++#if !defined(OS_MACOSX) + #include + #endif + ++#if defined(OS_BSD) && !defined(OS_NETBSD) ++#include ++#endif ++ + #if defined(OS_MACOSX) + namespace base { + void InitThreading(); +@@ -38,7 +45,19 @@ PlatformThreadId PlatformThread::CurrentId() { + // into the kernel. + #if defined(OS_MACOSX) + return mach_thread_self(); +-#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) ++#elif defined(OS_NETBSD) ++ return _lwp_self(); ++#elif defined(OS_DRAGONFLY) ++ return lwp_gettid(); ++#elif defined(OS_FREEBSD) ++# if __FreeBSD_version > 900030 ++ return pthread_getthreadid_np(); ++# else ++ long lwpid; ++ thr_self(&lwpid); ++ return lwpid; ++# endif ++#elif defined(OS_OPENBSD) + // TODO(BSD): find a better thread ID + return (intptr_t)(pthread_self()); + #elif defined(OS_LINUX) +@@ -102,9 +102,9 @@ void PlatformThread::SetName(const char* name) { + // Note that glibc also has a 'pthread_setname_np' api, but it may not be + // available everywhere and it's only benefit over using prctl directly is + // that it can set the name of threads other than the current thread. +-#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) ++#if defined(OS_BSD) && !defined(OS_NETBSD) + pthread_set_name_np(pthread_self(), name); +-#elif defined(__NetBSD__) ++#elif defined(OS_NETBSD) + pthread_setname_np(pthread_self(), "%s", name); + #else + prctl(PR_SET_NAME, reinterpret_cast(name), 0, 0, 0); +$NetBSD: patch-ipc_chromium_src_base_process__util.h,v 1.1 2012/03/06 12:34:09 ryoon Exp $ + +--- ipc/chromium/src/base/process_util.h.orig 2011-12-21 00:28:19.000000000 +0100 ++++ ipc/chromium/src/base/process_util.h 2012-01-31 13:14:54.000000000 +0100 +@@ -280,6 +280,7 @@ class NamedProcessIterator { + const ProcessEntry* NextProcessEntry(); + + private: ++#if !defined(OS_BSD) + // Determines whether there's another process (regardless of executable) + // left in the list of all processes. Returns true and sets entry_ to + // that process's info if there is one, false otherwise. +@@ -292,18 +292,24 @@ + void InitProcessEntry(ProcessEntry* entry); + + std::wstring executable_name_; ++#endif + + #if defined(OS_WIN) + HANDLE snapshot_; + bool started_iteration_; + #elif defined(OS_LINUX) + DIR *procfs_dir_; ++#elif defined(OS_BSD) ++ std::vector content; ++ size_t nextEntry; + #elif defined(OS_MACOSX) + std::vector kinfo_procs_; + size_t index_of_kinfo_proc_; + #endif ++#if !defined(OS_BSD) + ProcessEntry entry_; + const ProcessFilter* filter_; ++#endif + + DISALLOW_EVIL_CONSTRUCTORS(NamedProcessIterator); + }; +$NetBSD: patch-ipc_chromium_src_base_process__util__bsd.cc,v 1.4 2012/04/01 15:18:45 ryoon Exp $ + +--- ipc/chromium/src/base/process_util_bsd.cc.orig 2012-04-01 00:04:28.000000000 +0000 ++++ ipc/chromium/src/base/process_util_bsd.cc +@@ -0,0 +1,326 @@ ++// Copyright (c) 2008 The Chromium Authors. All rights reserved. ++// Use of this source code is governed by a BSD-style license that can be ++// found in the LICENSE file. ++ ++// derived from process_util_linux.cc and process_util_mac.cc ++ ++#include "base/process_util.h" ++ ++#include ++#include ++#include ++#include ++#if defined(OS_DRAGONFLY) || defined(OS_FREEBSD) ++/* DragonFly, as of v3.0.1, and FreeBSD 9.0-RELEASE do not explicitly mark symbols public */ ++#define PRE_SYS_INCLUDE _Pragma("GCC visibility push(default)") ++#define POST_SYS_INCLUDE _Pragma("GCC visibility pop") ++#else ++#define PRE_SYS_INCLUDE ++#define POST_SYS_INCLUDE ++#endif ++PRE_SYS_INCLUDE ++#include ++POST_SYS_INCLUDE ++#include ++#include ++#include ++#if defined(OS_DRAGONFLY) ++PRE_SYS_INCLUDE ++#include ++POST_SYS_INCLUDE ++#define HAVE_POSIX_SPAWN 1 ++#endif ++#if defined(OS_FREEBSD) ++PRE_SYS_INCLUDE ++#include ++POST_SYS_INCLUDE ++#endif ++ ++#include "base/debug_util.h" ++#include "base/eintr_wrapper.h" ++#include "base/file_util.h" ++#include "base/logging.h" ++#include "base/string_tokenizer.h" ++#include "base/string_util.h" ++ ++#if defined(OS_NETBSD) ++#include ++#if __NetBSD_Version__ >= 600000000 ++#define HAVE_POSIX_SPAWN 1 ++#endif ++#endif ++ ++#ifdef HAVE_POSIX_SPAWN ++PRE_SYS_INCLUDE ++#include ++POST_SYS_INCLUDE ++extern "C" char **environ __dso_public; ++#endif ++ ++namespace { ++ ++enum ParsingState { ++ KEY_NAME, ++ KEY_VALUE ++}; ++ ++static mozilla::EnvironmentLog gProcessLog("MOZ_PROCESS_LOG"); ++ ++} // namespace ++ ++namespace base { ++ ++#ifdef HAVE_POSIX_SPAWN ++ ++void FreeEnvVarsArray(char* array[], int length) ++{ ++ for (int i = 0; i < length; i++) { ++ free(array[i]); ++ } ++ delete[] array; ++} ++ ++bool LaunchApp(const std::vector& argv, ++ const file_handle_mapping_vector& fds_to_remap, ++ bool wait, ProcessHandle* process_handle) { ++ return LaunchApp(argv, fds_to_remap, environment_map(), ++ wait, process_handle); ++} ++ ++bool LaunchApp(const std::vector& argv, ++ const file_handle_mapping_vector& fds_to_remap, ++ const environment_map& env_vars_to_set, ++ bool wait, ProcessHandle* process_handle, ++ ProcessArchitecture arch) { ++ bool retval = true; ++ ++ char* argv_copy[argv.size() + 1]; ++ for (size_t i = 0; i < argv.size(); i++) { ++ argv_copy[i] = const_cast(argv[i].c_str()); ++ } ++ argv_copy[argv.size()] = NULL; ++ ++ // Make sure we don't leak any FDs to the child process by marking all FDs ++ // as close-on-exec. ++ SetAllFDsToCloseOnExec(); ++ ++ // Copy environment to a new char array and add the variables ++ // in env_vars_to_set. ++ // Existing variables are overwritten by env_vars_to_set. ++ int pos = 0; ++ environment_map combined_env_vars = env_vars_to_set; ++ while(environ[pos] != NULL) { ++ std::string varString = environ[pos]; ++ std::string varName = varString.substr(0, varString.find_first_of('=')); ++ std::string varValue = varString.substr(varString.find_first_of('=') + 1); ++ if (combined_env_vars.find(varName) == combined_env_vars.end()) { ++ combined_env_vars[varName] = varValue; ++ } ++ pos++; ++ } ++ int varsLen = combined_env_vars.size() + 1; ++ ++ char** vars = new char*[varsLen]; ++ int i = 0; ++ for (environment_map::const_iterator it = combined_env_vars.begin(); ++ it != combined_env_vars.end(); ++it) { ++ std::string entry(it->first); ++ entry += "="; ++ entry += it->second; ++ vars[i] = strdup(entry.c_str()); ++ i++; ++ } ++ vars[i] = NULL; ++ ++ posix_spawn_file_actions_t file_actions; ++ if (posix_spawn_file_actions_init(&file_actions) != 0) { ++ FreeEnvVarsArray(vars, varsLen); ++ return false; ++ } ++ ++ // Turn fds_to_remap array into a set of dup2 calls. ++ for (file_handle_mapping_vector::const_iterator it = fds_to_remap.begin(); ++ it != fds_to_remap.end(); ++ ++it) { ++ int src_fd = it->first; ++ int dest_fd = it->second; ++ ++ if (src_fd == dest_fd) { ++ int flags = fcntl(src_fd, F_GETFD); ++ if (flags != -1) { ++ fcntl(src_fd, F_SETFD, flags & ~FD_CLOEXEC); ++ } ++ } else { ++ if (posix_spawn_file_actions_adddup2(&file_actions, src_fd, dest_fd) != 0) { ++ posix_spawn_file_actions_destroy(&file_actions); ++ FreeEnvVarsArray(vars, varsLen); ++ return false; ++ } ++ } ++ } ++ ++ pid_t pid = 0; ++ int spawn_succeeded = (posix_spawnp(&pid, ++ argv_copy[0], ++ &file_actions, ++ NULL, ++ argv_copy, ++ vars) == 0); ++ ++ FreeEnvVarsArray(vars, varsLen); ++ ++ posix_spawn_file_actions_destroy(&file_actions); ++ ++ bool process_handle_valid = pid > 0; ++ if (!spawn_succeeded || !process_handle_valid) { ++ retval = false; ++ } else { ++ if (wait) ++ HANDLE_EINTR(waitpid(pid, 0, 0)); ++ ++ if (process_handle) ++ *process_handle = pid; ++ } ++ ++ return retval; ++} ++ ++bool LaunchApp(const CommandLine& cl, ++ bool wait, bool start_hidden, ProcessHandle* process_handle) { ++ // TODO(playmobil): Do we need to respect the start_hidden flag? ++ file_handle_mapping_vector no_files; ++ return LaunchApp(cl.argv(), no_files, wait, process_handle); ++} ++ ++#else // no posix_spawn, use fork/exec ++ ++bool LaunchApp(const std::vector& argv, ++ const file_handle_mapping_vector& fds_to_remap, ++ bool wait, ProcessHandle* process_handle) { ++ return LaunchApp(argv, fds_to_remap, environment_map(), ++ wait, process_handle); ++} ++ ++bool LaunchApp(const std::vector& argv, ++ const file_handle_mapping_vector& fds_to_remap, ++ const environment_map& env_vars_to_set, ++ bool wait, ProcessHandle* process_handle, ++ ProcessArchitecture arch) { ++ scoped_array argv_cstr(new char*[argv.size() + 1]); ++ // Illegal to allocate memory after fork and before execvp ++ InjectiveMultimap fd_shuffle1, fd_shuffle2; ++ fd_shuffle1.reserve(fds_to_remap.size()); ++ fd_shuffle2.reserve(fds_to_remap.size()); ++ ++ pid_t pid = fork(); ++ if (pid < 0) ++ return false; ++ ++ if (pid == 0) { ++ for (file_handle_mapping_vector::const_iterator ++ it = fds_to_remap.begin(); it != fds_to_remap.end(); ++it) { ++ fd_shuffle1.push_back(InjectionArc(it->first, it->second, false)); ++ fd_shuffle2.push_back(InjectionArc(it->first, it->second, false)); ++ } ++ ++ if (!ShuffleFileDescriptors(&fd_shuffle1)) ++ _exit(127); ++ ++ CloseSuperfluousFds(fd_shuffle2); ++ ++ for (environment_map::const_iterator it = env_vars_to_set.begin(); ++ it != env_vars_to_set.end(); ++it) { ++ if (setenv(it->first.c_str(), it->second.c_str(), 1/*overwrite*/)) ++ _exit(127); ++ } ++ ++ for (size_t i = 0; i < argv.size(); i++) ++ argv_cstr[i] = const_cast(argv[i].c_str()); ++ argv_cstr[argv.size()] = NULL; ++ execvp(argv_cstr[0], argv_cstr.get()); ++ // if we get here, we're in serious trouble and should complain loudly ++ DLOG(ERROR) << "FAILED TO exec() CHILD PROCESS, path: " << argv_cstr[0]; ++ exit(127); ++ } else { ++ gProcessLog.print("==> process %d launched child process %d\n", ++ GetCurrentProcId(), pid); ++ if (wait) ++ HANDLE_EINTR(waitpid(pid, 0, 0)); ++ ++ if (process_handle) ++ *process_handle = pid; ++ } ++ ++ return true; ++} ++ ++bool LaunchApp(const CommandLine& cl, ++ bool wait, bool start_hidden, ++ ProcessHandle* process_handle) { ++ file_handle_mapping_vector no_files; ++ return LaunchApp(cl.argv(), no_files, wait, process_handle); ++} ++ ++#endif ++ ++NamedProcessIterator::NamedProcessIterator(const std::wstring& executable_name, ++ const ProcessFilter* filter) ++{ ++ int numEntries; ++ kvm_t *kvm; ++ std::string exe(WideToASCII(executable_name)); ++ ++#if defined(OS_DRAGONFLY) || defined(OS_FREEBSD) ++ kvm = kvm_open(NULL, NULL, NULL, O_RDONLY, NULL); ++ struct kinfo_proc* procs = kvm_getprocs(kvm, KERN_PROC_UID, getuid(), &numEntries); ++ if (procs != NULL && numEntries > 0) { ++ for (int i = 0; i < numEntries; i++) { ++# if defined(OS_DRAGONFLY) ++ if (exe != procs[i].kp_comm) continue; ++ if (filter && !filter->Includes(procs[i].kp_pid, procs[i].kp_ppid)) continue; ++ ProcessEntry e; ++ e.pid = procs[i].kp_pid; ++ e.ppid = procs[i].kp_ppid; ++ strlcpy(e.szExeFile, procs[i].kp_comm, sizeof e.szExeFile); ++ content.push_back(e); ++# elif defined(OS_FREEBSD) ++ if (exe != procs[i].ki_comm) continue; ++ if (filter && !filter->Includes(procs[i].ki_pid, procs[i].ki_ppid)) continue; ++ ProcessEntry e; ++ e.pid = procs[i].ki_pid; ++ e.ppid = procs[i].ki_ppid; ++ strlcpy(e.szExeFile, procs[i].ki_comm, sizeof e.szExeFile); ++ content.push_back(e); ++# endif ++#else ++ kvm = kvm_open(NULL, NULL, NULL, KVM_NO_FILES, NULL); ++ struct kinfo_proc2* procs = kvm_getproc2(kvm, KERN_PROC_UID, getuid(), sizeof(struct kinfo_proc2), &numEntries); ++ if (procs != NULL && numEntries > 0) { ++ for (int i = 0; i < numEntries; i++) { ++ if (exe != procs[i].p_comm) continue; ++ if (filter && !filter->Includes(procs[i].p_pid, procs[i].p_ppid)) continue; ++ ProcessEntry e; ++ e.pid = procs[i].p_pid; ++ e.ppid = procs[i].p_ppid; ++ strlcpy(e.szExeFile, procs[i].p_comm, sizeof e.szExeFile); ++ content.push_back(e); ++#endif ++ } ++ } ++ nextEntry = 0; ++ kvm_close(kvm); ++} ++ ++NamedProcessIterator::~NamedProcessIterator() { ++} ++ ++const ProcessEntry* NamedProcessIterator::NextProcessEntry() { ++ if (nextEntry >= content.size()) return NULL; ++ return &content[nextEntry++]; ++} ++ ++bool ProcessMetrics::GetIOCounters(IoCounters* io_counters) const { ++ return false; ++} ++ ++} // namespace base +$NetBSD: patch-ipc_chromium_src_base_process__util__posix.cc,v 1.1 2012/03/06 12:34:09 ryoon Exp $ + +--- ipc/chromium/src/base/process_util_posix.cc.orig 2011-12-20 23:28:19.000000000 +0000 ++++ ipc/chromium/src/base/process_util_posix.cc +@@ -116,6 +116,11 @@ void CloseSuperfluousFds(const base::Inj + #elif defined(OS_MACOSX) + static const rlim_t kSystemDefaultMaxFds = 256; + static const char kFDDir[] = "/dev/fd"; ++#elif defined(OS_BSD) ++ // the getrlimit below should never fail, so whatever .. ++ static const rlim_t kSystemDefaultMaxFds = 1024; ++ // at least /dev/fd will exist ++ static const char kFDDir[] = "/dev/fd"; + #endif + + // Get the maximum number of FDs possible. +@@ -199,7 +204,7 @@ void CloseSuperfluousFds(const base::Inj + void SetAllFDsToCloseOnExec() { + #if defined(OS_LINUX) + const char fd_dir[] = "/proc/self/fd"; +-#elif defined(OS_MACOSX) ++#elif defined(OS_MACOSX) || defined(OS_BSD) + const char fd_dir[] = "/dev/fd"; + #endif + ScopedDIR dir_closer(opendir(fd_dir)); +$NetBSD: patch-ipc_chromium_src_base_sys__info__posix.cc,v 1.2 2011/11/27 13:09:00 tnn Exp $ + +--- ipc/chromium/src/base/sys_info_posix.cc.orig 2011-11-04 21:34:00.000000000 +0000 ++++ ipc/chromium/src/base/sys_info_posix.cc +@@ -18,6 +18,11 @@ + #include + #endif + ++#if defined(OS_NETBSD) ++#include ++#include ++#endif ++ + #include "base/logging.h" + #include "base/string_util.h" + +@@ -26,7 +31,11 @@ namespace base { + int SysInfo::NumberOfProcessors() { + // It seems that sysconf returns the number of "logical" processors on both + // mac and linux. So we get the number of "online logical" processors. ++#ifdef _SC_NPROCESSORS_ONLN + static long res = sysconf(_SC_NPROCESSORS_ONLN); ++#else ++ static long res = 1; ++#endif + if (res == -1) { + NOTREACHED(); + return 1; +@@ -52,6 +61,20 @@ int64 SysInfo::AmountOfPhysicalMemory() + } + + return static_cast(hostinfo.max_mem); ++#elif defined(OS_NETBSD) ++ int mib[2]; ++ int rc; ++ int64_t memSize; ++ size_t len = sizeof(memSize); ++ ++ mib[0] = CTL_HW; ++ mib[1] = HW_PHYSMEM64; ++ rc = sysctl( mib, 2, &memSize, &len, NULL, 0 ); ++ if (-1 != rc) { ++ return memSize; ++ } ++ return 0; ++ + #else + long pages = sysconf(_SC_PHYS_PAGES); + long page_size = sysconf(_SC_PAGE_SIZE); +diff --git ipc/chromium/src/base/time_posix.cc ipc/chromium/src/base/time_posix.cc +index abf2a56..48791f6 100644 +--- ipc/chromium/src/base/time_posix.cc ++++ ipc/chromium/src/base/time_posix.cc +@@ -167,7 +167,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(__OpenBSD__) || defined(OS_POSIX) && \ ++#elif defined(OS_OPENBSD) || defined(OS_POSIX) && \ + defined(_POSIX_MONOTONIC_CLOCK) && _POSIX_MONOTONIC_CLOCK >= 0 + + struct timespec ts; +$NetBSD: patch-ipc_chromium_src_build_build__config.h,v 1.4 2012/04/01 15:18:45 ryoon Exp $ + +--- ipc/chromium/src/build/build_config.h.orig 2012-03-13 01:36:53.000000000 +0000 ++++ ipc/chromium/src/build/build_config.h +@@ -19,17 +19,23 @@ + #define OS_MACOSX 1 + #elif defined(__linux__) || defined(ANDROID) + #define OS_LINUX 1 ++#elif defined(__NetBSD__) ++#define OS_NETBSD 1 ++#elif defined(__DragonFly__) ++#define OS_DRAGONFLY 1 + #elif defined(__OpenBSD__) + #define OS_OPENBSD 1 + #elif defined(_WIN32) + #define OS_WIN 1 ++#elif defined(__FreeBSD__) ++#define OS_FREEBSD 1 + #else + #error Please add support for your platform in build/build_config.h + #endif + + // For access to standard POSIX features, use OS_POSIX instead of a more + // specific macro. +-#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_OPENBSD) ++#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_BSD) + #define OS_POSIX 1 + #endif + +diff --git ipc/chromium/src/chrome/common/ipc_channel_posix.cc ipc/chromium/src/chrome/common/ipc_channel_posix.cc +index bd866ee..2ea5b19 100644 +--- ipc/chromium/src/chrome/common/ipc_channel_posix.cc ++++ ipc/chromium/src/chrome/common/ipc_channel_posix.cc +@@ -7,6 +7,7 @@ + #include + #include + #include ++#include + #include + #include + #include +$NetBSD: patch-ipc_chromium_src_chrome_common_ipc__channel__posix.h,v 1.1 2011/07/11 12:46:14 tnn Exp $ + +--- ipc/chromium/src/chrome/common/ipc_channel_posix.h.orig 2011-06-15 21:57:27.000000000 +0000 ++++ ipc/chromium/src/chrome/common/ipc_channel_posix.h +@@ -92,7 +92,7 @@ class Channel::ChannelImpl : public Mess + }; + + // This is a control message buffer large enough to hold kMaxReadFDs +-#if defined(OS_MACOSX) ++#if defined(OS_MACOSX) || defined(OS_NETBSD) + // TODO(agl): OSX appears to have non-constant CMSG macros! + char input_cmsg_buf_[1024]; + #else +$NetBSD: patch-ipc_chromium_src_chrome_common_ipc__message__utils.h,v 1.1 2012/03/06 12:34:09 ryoon Exp $ + +--- ipc/chromium/src/chrome/common/ipc_message_utils.h.orig 2011-12-20 23:28:19.000000000 +0000 ++++ ipc/chromium/src/chrome/common/ipc_message_utils.h +@@ -195,7 +195,7 @@ + }; + #endif + +-#if !(defined(OS_MACOSX) || defined(OS_OPENBSD) || defined(OS_WIN) || (defined(OS_LINUX) && defined(ARCH_CPU_64_BITS)) || defined(ARCH_CPU_S390)) ++#if !(defined(OS_MACOSX) || defined(OS_OPENBSD) || defined(OS_WIN) || ((defined(OS_FREEBSD) || defined(OS_DRAGONFLY) || defined(OS_NETBSD) || defined(OS_LINUX)) && defined(ARCH_CPU_64_BITS)) || defined(ARCH_CPU_S390)) + // There size_t is a synonym for |unsigned long| ... + template <> + struct ParamTraits { +@@ -248,7 +248,7 @@ + }; + #endif // defined(OS_MACOSX) + +-#if !(defined(OS_LINUX) && defined(ARCH_CPU_64_BITS)) ++#if !((defined(OS_FREEBSD) || defined(OS_DRAGONFLY) || defined(OS_NETBSD) || defined(OS_LINUX)) && defined(ARCH_CPU_64_BITS)) + // int64 is |long int| on 64-bit systems, uint64 is |unsigned long| + template <> + struct ParamTraits { +$NetBSD: patch-ipc_chromium_src_chrome_common_transport__dib.h,v 1.1 2012/03/06 12:34:09 ryoon Exp $ + +--- ipc/chromium/src/chrome/common/transport_dib.h.orig 2011-12-20 23:28:19.000000000 +0000 ++++ ipc/chromium/src/chrome/common/transport_dib.h +@@ -7,7 +7,7 @@ + + #include "base/basictypes.h" + +-#if defined(OS_WIN) || defined(OS_MACOSX) ++#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_BSD) + #include "base/shared_memory.h" + #endif + +@@ -66,7 +66,7 @@ class TransportDIB { + uint32 sequence_num; + }; + typedef HandleAndSequenceNum Id; +-#elif defined(OS_MACOSX) ++#elif defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_BSD) + typedef base::SharedMemoryHandle Handle; + // On Mac, the inode number of the backing file is used as an id. + typedef base::SharedMemoryId Id; +@@ -108,7 +108,7 @@ class TransportDIB { + + private: + TransportDIB(); +-#if defined(OS_WIN) || defined(OS_MACOSX) ++#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_BSD) + explicit TransportDIB(base::SharedMemoryHandle dib); + base::SharedMemory shared_memory_; + uint32 sequence_num_; +$NetBSD: patch-ipc_glue_GeckoChildProcessHost.cpp,v 1.2 2012/03/15 08:30:06 ryoon Exp $ + +--- ipc/glue/GeckoChildProcessHost.cpp.orig 2011-12-20 23:28:19.000000000 +0000 ++++ ipc/glue/GeckoChildProcessHost.cpp +@@ -430,7 +430,7 @@ + // and passing wstrings from one config to the other is unsafe. So + // we split the logic here. + +-#if defined(OS_LINUX) || defined(OS_MACOSX) ++#if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_BSD) + base::environment_map newEnvVars; + // XPCOM may not be initialized in some subprocesses. We don't want + // to initialize XPCOM just for the directory service, especially +@@ -445,8 +445,8 @@ + if (NS_SUCCEEDED(rv)) { + nsCString path; + greDir->GetNativePath(path); +-# ifdef OS_LINUX +-# ifdef MOZ_WIDGET_ANDROID ++# if defined(OS_LINUX) || defined(OS_BSD) ++# if defined(MOZ_WIDGET_ANDROID) || defined(OS_BSD) + path += "/lib"; + # endif // MOZ_WIDGET_ANDROID + const char *ld_library_path = PR_GetEnv("LD_LIBRARY_PATH"); +@@ -557,7 +557,7 @@ + childArgv.push_back(pidstring); + + #if defined(MOZ_CRASHREPORTER) +-# if defined(OS_LINUX) ++# if defined(OS_LINUX) || defined(OS_BSD) + int childCrashFd, childCrashRemapFd; + if (!CrashReporter::CreateNotificationPipeForChild( + &childCrashFd, &childCrashRemapFd)) +@@ -594,7 +594,7 @@ + #endif + + base::LaunchApp(childArgv, mFileMap, +-#if defined(OS_LINUX) || defined(OS_MACOSX) ++#if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_BSD) + newEnvVars, + #endif + false, &process, arch); +$NetBSD: patch-mm,v 1.13 2012/06/05 18:09:21 ryoon Exp $ + +--- toolkit/library/Makefile.in.orig 2012-05-23 18:57:09.000000000 +0000 ++++ toolkit/library/Makefile.in +@@ -534,6 +538,10 @@ EXTRA_DSO_LDOPTS += -lelf -ldemangle + endif + endif + ++ifneq (,$(filter DragonFly FreeBSD NetBSD,$(OS_ARCH))) ++OS_LIBS += $(call EXPAND_LIBNAME,kvm) ++endif ++ + ifeq ($(OS_ARCH),WINNT) + OS_LIBS += $(call EXPAND_LIBNAME,shell32 ole32 version winspool comdlg32 imm32 msimg32 shlwapi psapi ws2_32 dbghelp rasapi32 rasdlg iphlpapi uxtheme setupapi secur32 sensorsapi portabledeviceguids windowscodecs wininet) + ifdef ACCESSIBILITY Deleted: branches/experimental/www/firefox-nightly/files/patch-ipc-chromium-src-base-dir_reader_linux.h ============================================================================== --- branches/experimental/www/firefox-nightly/files/patch-ipc-chromium-src-base-dir_reader_linux.h Wed Jul 4 01:41:22 2012 (r837) +++ /dev/null 00:00:00 1970 (deleted) @@ -1,52 +0,0 @@ ---- ipc/chromium/src/base/dir_reader_linux.h~ -+++ ipc/chromium/src/base/dir_reader_linux.h -@@ -12,6 +12,10 @@ - #include - #include - -+#if defined(__FreeBSD__) -+#include -+#endif -+ - #include "base/logging.h" - #include "base/eintr_wrapper.h" - -@@ -19,6 +23,9 @@ - - namespace base { - -+#if defined(__FreeBSD__) -+#define linux_dirent struct dirent -+#else - struct linux_dirent { - uint64_t d_ino; - int64_t d_off; -@@ -26,11 +33,16 @@ struct linux_dirent { - unsigned char d_type; - char d_name[0]; - }; -+#endif - - class DirReaderLinux { - public: - explicit DirReaderLinux(const char* directory_path) -+#ifdef O_DIRECTORY - : fd_(open(directory_path, O_RDONLY | O_DIRECTORY)), -+#else -+ : fd_(open(directory_path, O_RDONLY)), -+#endif - offset_(0), - size_(0) { - memset(buf_, 0, sizeof(buf_)); -@@ -57,7 +69,11 @@ class DirReaderLinux { - if (offset_ != size_) - return true; - -+#if !defined(__FreeBSD__) - const int r = syscall(__NR_getdents64, fd_, buf_, sizeof(buf_)); -+#else -+ const int r = syscall(SYS_getdents, fd_, buf_, sizeof(buf_)); -+#endif - if (r == 0) - return false; - if (r == -1) { Deleted: branches/experimental/www/firefox-nightly/files/patch-ipc-chromium-src-base-file_util_linux.cc ============================================================================== --- branches/experimental/www/firefox-nightly/files/patch-ipc-chromium-src-base-file_util_linux.cc Wed Jul 4 01:41:22 2012 (r837) +++ /dev/null 00:00:00 1970 (deleted) @@ -1,11 +0,0 @@ ---- ipc/chromium/src/base/file_util_linux.cc~ -+++ ipc/chromium/src/base/file_util_linux.cc -@@ -28,7 +29,7 @@ bool GetShmemTempDir(FilePath* path) { - #ifdef ANDROID - return GetTempDir(path); - #else -- *path = FilePath("/dev/shm"); -+ *path = FilePath("/tmp"); - return true; - #endif - } Deleted: branches/experimental/www/firefox-nightly/files/patch-ipc-chromium-src-base-file_util_posix.cc ============================================================================== --- branches/experimental/www/firefox-nightly/files/patch-ipc-chromium-src-base-file_util_posix.cc Wed Jul 4 01:41:22 2012 (r837) +++ /dev/null 00:00:00 1970 (deleted) @@ -1,11 +0,0 @@ ---- ipc/chromium/src/base/file_util_posix.cc~ -+++ ipc/chromium/src/base/file_util_posix.cc -@@ -31,7 +31,7 @@ - #include "base/time.h" - - // FreeBSD/OpenBSD lacks stat64, but its stat handles files >2GB just fine --#if defined(OS_FREEBSD) || defined(OS_OPENBSD) -+#if defined(__FreeBSD__) || defined(OS_OPENBSD) - #define stat64 stat - #endif - Deleted: branches/experimental/www/firefox-nightly/files/patch-ipc-chromium-src-base-platform_thread_posix.cc ============================================================================== --- branches/experimental/www/firefox-nightly/files/patch-ipc-chromium-src-base-platform_thread_posix.cc Wed Jul 4 01:41:22 2012 (r837) +++ /dev/null 00:00:00 1970 (deleted) @@ -1,17 +0,0 @@ ---- ipc/chromium/src/base/platform_thread_posix.cc~ -+++ ipc/chromium/src/base/platform_thread_posix.cc -@@ -38,7 +38,13 @@ PlatformThreadId PlatformThread::Current - // into the kernel. - #if defined(OS_MACOSX) - return mach_thread_self(); --#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) -+#elif defined(__FreeBSD__) && __FreeBSD_version > 900030 -+ return pthread_getthreadid_np(); -+#elif defined(__FreeBSD__) -+ long tid; -+ syscall(SYS_thr_self, &tid); -+ return tid; -+#elif defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) - // TODO(BSD): find a better thread ID - return (intptr_t)(pthread_self()); - #elif defined(OS_LINUX) Deleted: branches/experimental/www/firefox-nightly/files/patch-ipc-chromium-src-build-build_config.h ============================================================================== --- branches/experimental/www/firefox-nightly/files/patch-ipc-chromium-src-build-build_config.h Wed Jul 4 01:41:22 2012 (r837) +++ /dev/null 00:00:00 1970 (deleted) @@ -1,11 +0,0 @@ ---- ipc/chromium/src/build/build_config.h~ -+++ ipc/chromium/src/build/build_config.h -@@ -17,7 +17,7 @@ - // A set of macros to use for platform detection. - #if defined(__APPLE__) - #define OS_MACOSX 1 --#elif defined(__linux__) || defined(ANDROID) -+#elif defined(__linux__) || defined(ANDROID) || defined(__FreeBSD__) - #define OS_LINUX 1 - #elif defined(__OpenBSD__) - #define OS_OPENBSD 1 Modified: branches/experimental/www/firefox-nightly/files/patch-toolkit_library_Makefile.in ============================================================================== --- branches/experimental/www/firefox-nightly/files/patch-toolkit_library_Makefile.in Tue Jul 3 18:24:14 2012 (r837) +++ branches/experimental/www/firefox-nightly/files/patch-toolkit_library_Makefile.in Wed Jul 4 01:41:22 2012 (r838) @@ -11,12 +11,3 @@ ifeq (android,$(MOZ_WIDGET_TOOLKIT)) OS_LIBS += -lGLESv2 endif -@@ -445,7 +449,7 @@ endif - endif - endif - --EXTRA_DSO_LDOPTS += $(LIBS_DIR) $(EXTRA_DSO_LIBS) -+EXTRA_DSO_LDOPTS += $(LIBS_DIR) $(EXTRA_DSO_LIBS) -lexecinfo - - DEFINES += -DIMPL_XREAPI -