$OpenBSD: patch-hotspot_src_os_bsd_vm_os_bsd_inline_hpp,v 1.3 2009/06/10 19:01:09 kurt Exp $
--- hotspot/src/os/bsd/vm/os_bsd.inline.hpp.orig	Sat May 30 10:11:57 2009
+++ hotspot/src/os/bsd/vm/os_bsd.inline.hpp	Sat May 30 10:15:39 2009
@@ -61,7 +61,15 @@ inline bool os::uses_stack_guard_pages() {
 
 inline bool os::allocate_stack_guard_pages() {
   assert(uses_stack_guard_pages(), "sanity check");
+#if !defined(__FreeBSD__) || __FreeBSD__ < 5
+  // Since FreeBSD 4 uses malloc() for allocating the thread stack
+  // there is no need to do anything extra to allocate the guard pages
+  return false;
+#else
+  // FreeBSD 5+ uses mmap MAP_STACK for allocating the thread stacks.
+  // Must 'allocate' them or guard pages are ignored.
   return true;
+#endif
 }
 
 
