$OpenBSD: patch-base_threading_platform_thread_linux_cc,v 1.18 2019/02/06 16:41:55 robert Exp $

Index: base/threading/platform_thread_linux.cc
--- base/threading/platform_thread_linux.cc.orig
+++ base/threading/platform_thread_linux.cc
@@ -18,7 +18,9 @@
 
 #if !defined(OS_NACL) && !defined(OS_AIX)
 #include <pthread.h>
+#if !defined(OS_BSD)
 #include <sys/prctl.h>
+#endif
 #include <sys/resource.h>
 #include <sys/time.h>
 #include <sys/types.h>
@@ -27,7 +29,7 @@
 
 namespace base {
 namespace {
-#if !defined(OS_NACL)
+#if !defined(OS_NACL) && !defined(OS_BSD)
 const FilePath::CharType kCgroupDirectory[] =
     FILE_PATH_LITERAL("/sys/fs/cgroup");
 
@@ -99,7 +101,7 @@ const ThreadPriorityToNiceValuePair kThreadPriorityToN
 
 Optional<bool> CanIncreaseCurrentThreadPriorityForPlatform(
     ThreadPriority priority) {
-#if !defined(OS_NACL)
+#if !defined(OS_NACL) && !defined(OS_BSD)
   // A non-zero soft-limit on RLIMIT_RTPRIO is required to be allowed to invoke
   // pthread_setschedparam in SetCurrentThreadPriorityForPlatform().
   struct rlimit rlim;
@@ -112,7 +114,7 @@ Optional<bool> CanIncreaseCurrentThreadPriorityForPlat
 }
 
 bool SetCurrentThreadPriorityForPlatform(ThreadPriority priority) {
-#if !defined(OS_NACL)
+#if !defined(OS_NACL) && !defined(OS_BSD)
   SetThreadCgroupsForThreadPriority(PlatformThread::CurrentId(), priority);
   return priority == ThreadPriority::REALTIME_AUDIO &&
          pthread_setschedparam(pthread_self(), SCHED_RR, &kRealTimePrio) == 0;
@@ -141,7 +143,7 @@ Optional<ThreadPriority> GetCurrentThreadPriorityForPl
 void PlatformThread::SetName(const std::string& name) {
   ThreadIdNameManager::GetInstance()->SetName(name);
 
-#if !defined(OS_NACL) && !defined(OS_AIX)
+#if !defined(OS_NACL) && !defined(OS_AIX) && !defined(OS_BSD)
   // On linux we can get the thread names to show up in the debugger by setting
   // the process name for the LWP.  We don't want to do this for the main
   // thread because that would rename the process, causing tools like killall
@@ -170,7 +172,9 @@ void PlatformThread::SetThreadPriority(PlatformThreadI
   // priority.
   CHECK_NE(thread_id, getpid());
 
+#if !defined(OS_BSD)
   SetThreadCgroupsForThreadPriority(thread_id, priority);
+#endif
 
   const int nice_setting = internal::ThreadPriorityToNiceValue(priority);
   if (setpriority(PRIO_PROCESS, thread_id, nice_setting)) {
