Skip to content

Commit

Permalink
Fix broken build at Freebsd
Browse files Browse the repository at this point in the history
  • Loading branch information
hodduc committed Sep 21, 2016
1 parent 0c4d31e commit 8954789
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 21 deletions.
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down
48 changes: 29 additions & 19 deletions patch/freebsd.patch
Original file line number Diff line number Diff line change
@@ -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 <signal.h>
+#endif
+
#if defined(OS_MACOSX)
#include <sys/event.h>
#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<int64_t>(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<uint64_t>(limit);
}
+#endif

#if !defined(OS_NACL)
// On FreeBSD we can get the thread names to show up in the debugger by
} // namespace base
4 changes: 4 additions & 0 deletions src/base/process/process_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
#include "build/build_config.h"

#if defined(OS_FREEBSD)
#include <signal.h>
#endif

#if defined(OS_MACOSX)
#include <sys/event.h>
#endif
Expand Down
2 changes: 2 additions & 0 deletions src/base/sys_info_freebsd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ int64_t SysInfo::AmountOfPhysicalMemory() {
return static_cast<int64_t>(pages) * page_size;
}

#if 0
// static
uint64_t SysInfo::MaxSharedMemorySize() {
size_t limit;
Expand All @@ -34,5 +35,6 @@ uint64_t SysInfo::MaxSharedMemorySize() {
}
return static_cast<uint64_t>(limit);
}
#endif

} // namespace base

0 comments on commit 8954789

Please sign in to comment.