shithub: mc

Download patch

ref: 17cb502c1578b8e1a94f02b84cf47acfef6b20b1
parent: 530c197b17925e2166b849d566d2d3588bb87369
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Mar 24 14:00:42 EDT 2018

Add support for OpenBSD's MAP_STACK mmap flags, use it in libthread

--- a/lib/sys/sys+openbsd-x64.myr
+++ b/lib/sys/sys+openbsd-x64.myr
@@ -215,6 +215,7 @@
 	const Mfixed	: mopt = 0x10
 	const Mfile	: mopt = 0x0
 	const Manon	: mopt = 0x1000
+	const Mstack	: mopt = 0x4000
 	const Mnoreplace	: mopt = 0x0800
 
 	/* file types */
--- a/lib/sys/sys+openbsd:6.2-x64.myr
+++ b/lib/sys/sys+openbsd:6.2-x64.myr
@@ -348,6 +348,7 @@
 	const Mfixed	: mopt = 0x10
 	const Mfile	: mopt = 0x0
 	const Manon	: mopt = 0x1000
+	const Mstack	: mopt = 0x4000
 	const Mnoreplace	: mopt = 0x0800
 	
 	/* file types */
--- a/lib/sys/sys+openbsd:6.3-x64.myr
+++ b/lib/sys/sys+openbsd:6.3-x64.myr
@@ -354,6 +354,7 @@
 	const Mfixed	: mopt = 0x10
 	const Mfile	: mopt = 0x0
 	const Manon	: mopt = 0x1000
+	const Mstack	: mopt = 0x4000
 	const Mnoreplace	: mopt = 0x0800
 	
 	/* file types */
--- a/lib/thread/spawn+openbsd.myr
+++ b/lib/thread/spawn+openbsd.myr
@@ -53,7 +53,7 @@
 const getstk = {sz
 	var p, m
 
-	p = sys.mmap((0 : byte#), sz, sys.Mprotrw, sys.Mpriv | sys.Manon, -1, 0)
+	p = sys.mmap((0 : byte#), sz, sys.Mprotrw, sys.Mpriv | sys.Manon | sys.Mstack, -1, 0)
 	if p == sys.Mapbad
 		-> p
 	;;
--- a/support/syscall-gen/types+openbsd:6.3-x64.frag
+++ b/support/syscall-gen/types+openbsd:6.3-x64.frag
@@ -348,6 +348,7 @@
 const Mfixed	: mopt = 0x10
 const Mfile	: mopt = 0x0
 const Manon	: mopt = 0x1000
+const Mstack    : mopt = 0x4000
 const Mnoreplace	: mopt = 0x0800
 
 /* file types */