From 8954789a056d8e7d5fcb6452fd1572ca57eb5c4e Mon Sep 17 00:00:00 2001 From: Joonsung Lee Date: Thu, 22 Sep 2016 01:30:10 +0900 Subject: [PATCH] Fix broken build at Freebsd --- CMakeLists.txt | 7 ++++- DEPS | 3 +- patch/freebsd.patch | 48 +++++++++++++++++++------------ src/base/process/process_posix.cc | 4 +++ src/base/sys_info_freebsd.cc | 2 ++ 5 files changed, 43 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 412e7f4e..4b047d6a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -230,8 +230,13 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") src/base/threading/platform_thread_internal_posix.cc src/base/strings/sys_string_conversions_posix.cc src/base/process/process_handle_freebsd.cc + src/base/process/process_metrics_posix.cc src/base/memory/shared_memory_posix.cc - src/base/sys_info_freebsd.mm + src/base/sys_info_freebsd.cc + src/base/files/file_util.cc + src/base/files/file_util_posix.cc + src/base/files/file_enumerator.cc + src/base/files/file_enumerator_posix.cc ) elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") FIND_LIBRARY(COREFOUNDATION_LIBRARY CoreFoundation) diff --git a/DEPS b/DEPS index cfed0fb7..a21365c2 100644 --- a/DEPS +++ b/DEPS @@ -100,7 +100,8 @@ "patch/process_posix_disable_valgrind_related.patch", "patch/shared_memory_disable_scoped_tracker.patch", "patch/sys_info_disable_field_trial.patch", - "patch/thread_checker_impl_skip_one_check.patch" + "patch/thread_checker_impl_skip_one_check.patch", + "patch/freebsd.patch" ], "custom_files": [ {"from": "custom/debugger.h", "to": "base/debug/debugger.h"}, diff --git a/patch/freebsd.patch b/patch/freebsd.patch index b78dbb29..fa6e0de9 100644 --- a/patch/freebsd.patch +++ b/patch/freebsd.patch @@ -1,24 +1,34 @@ -diff --git a/src/base/threading/platform_thread_freebsd.cc b/src/base/threading/platform_thread_freebsd.cc -index bce1ccf..0b35e5d 100644 ---- a/src/base/threading/platform_thread_freebsd.cc -+++ b/src/base/threading/platform_thread_freebsd.cc -@@ -12,7 +12,9 @@ - #include "base/logging.h" - #include "base/threading/platform_thread_internal_posix.h" - #include "base/threading/thread_id_name_manager.h" -+#if 0 - #include "base/tracked_objects.h" -+#endif +diff --git a/src/base/process/process_posix.cc b/src/base/process/process_posix.cc +index 914bce8..65dbce7 100644 +--- a/src/base/process/process_posix.cc ++++ b/src/base/process/process_posix.cc +@@ -17,6 +17,10 @@ + #include "base/third_party/dynamic_annotations/dynamic_annotations.h" #include "build/build_config.h" - #if !defined(OS_NACL) -@@ -67,7 +69,9 @@ bool GetCurrentThreadPriorityForPlatform(ThreadPriority* priority) { - // static - void PlatformThread::SetName(const std::string& name) { - ThreadIdNameManager::GetInstance()->SetName(CurrentId(), name); ++#if defined(OS_FREEBSD) ++#include ++#endif ++ + #if defined(OS_MACOSX) + #include + #endif +diff --git a/src/base/sys_info_freebsd.cc b/src/base/sys_info_freebsd.cc +index 0b2008d..e196b55 100644 +--- a/src/base/sys_info_freebsd.cc ++++ b/src/base/sys_info_freebsd.cc +@@ -24,6 +24,7 @@ int64_t SysInfo::AmountOfPhysicalMemory() { + return static_cast(pages) * page_size; + } + +#if 0 - tracked_objects::ThreadData::InitializeThreadContext(name); + // static + uint64_t SysInfo::MaxSharedMemorySize() { + size_t limit; +@@ -34,5 +35,6 @@ uint64_t SysInfo::MaxSharedMemorySize() { + } + return static_cast(limit); + } +#endif - #if !defined(OS_NACL) - // On FreeBSD we can get the thread names to show up in the debugger by + } // namespace base diff --git a/src/base/process/process_posix.cc b/src/base/process/process_posix.cc index 914bce84..65dbce7c 100644 --- a/src/base/process/process_posix.cc +++ b/src/base/process/process_posix.cc @@ -17,6 +17,10 @@ #include "base/third_party/dynamic_annotations/dynamic_annotations.h" #include "build/build_config.h" +#if defined(OS_FREEBSD) +#include +#endif + #if defined(OS_MACOSX) #include #endif diff --git a/src/base/sys_info_freebsd.cc b/src/base/sys_info_freebsd.cc index 0b2008d5..e196b550 100644 --- a/src/base/sys_info_freebsd.cc +++ b/src/base/sys_info_freebsd.cc @@ -24,6 +24,7 @@ int64_t SysInfo::AmountOfPhysicalMemory() { return static_cast(pages) * page_size; } +#if 0 // static uint64_t SysInfo::MaxSharedMemorySize() { size_t limit; @@ -34,5 +35,6 @@ uint64_t SysInfo::MaxSharedMemorySize() { } return static_cast(limit); } +#endif } // namespace base