$OpenBSD: patch-src_ptlib_unix_tlibthrd_cxx,v 1.2 2018/03/07 15:09:20 ajacoutot Exp $
Index: src/ptlib/unix/tlibthrd.cxx
--- src/ptlib/unix/tlibthrd.cxx.orig
+++ src/ptlib/unix/tlibthrd.cxx
@@ -37,6 +37,7 @@
 #include <sched.h>
 #include <pthread.h>
 #include <sys/resource.h>
+#include <unistd.h>
 
 #ifdef P_RTEMS
 #define SUSPEND_SIG SIGALRM
@@ -60,6 +61,8 @@ static pthread_t baseThread;
 #include "semaphore.h"
 #endif
 
+static PINDEX const PThreadMinimumStack = 16*PTHREAD_STACK_MIN; // Set a decent stack size that won't eat all virtual memory, or crash
+
 int PX_NewHandle(const char *, int);
 
 
@@ -280,7 +283,7 @@ PThread::PThread(PINDEX stackSize,
                  Priority priorityLevel,
                  const PString & name)
   : m_type(deletion == AutoDeleteThread ? e_IsAutoDelete : e_IsManualDelete)
-  , m_originalStackSize(std::max(stackSize, 16*PTHREAD_STACK_MIN)) // Set a decent (256K) stack size that won't eat all virtual memory
+  , m_originalStackSize(std::max(stackSize, PThreadMinimumStack))
   , m_threadName(name)
   , m_threadId(PNullThreadIdentifier)  // indicates thread has not started
   , PX_priority(priorityLevel)
