summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2018-06-08 08:10:35 -0700
committerOri Bernstein <ori@eigenstate.org>2018-06-08 08:10:35 -0700
commit92840bc1ade4d670ce1b6cd3dc7be48b16148a5e (patch)
tree1a3b2759aca4457e9aaf53df03a6a7c4d6a704ec
parent3d9e396e9696c1aa2290fce09626c33d15e1ea03 (diff)
downloadmc-92840bc1ade4d670ce1b6cd3dc7be48b16148a5e.tar.gz
Add pledge support.
-rw-r--r--lib/std/bld.sub3
-rw-r--r--lib/std/pledge+openbsd.myr9
-rw-r--r--lib/std/pledge.myr8
3 files changed, 20 insertions, 0 deletions
diff --git a/lib/std/bld.sub b/lib/std/bld.sub
index e6e8b73..093e242 100644
--- a/lib/std/bld.sub
+++ b/lib/std/bld.sub
@@ -86,6 +86,9 @@ lib std =
varargs.myr
writeall.myr
+ pledge.myr
+ pledge+openbsd.myr
+
# asm optimizations
memops.myr
memops-impl.myr
diff --git a/lib/std/pledge+openbsd.myr b/lib/std/pledge+openbsd.myr
new file mode 100644
index 0000000..dde6841
--- /dev/null
+++ b/lib/std/pledge+openbsd.myr
@@ -0,0 +1,9 @@
+use sys
+
+pkg std =
+ const pledge : (promise : byte[:], epromise : byte[:] -> void)
+;;
+
+const pledge = {promise, epromise
+ sys.pledge(sys.cstring(promise), sys.cstring(epromise))
+}
diff --git a/lib/std/pledge.myr b/lib/std/pledge.myr
new file mode 100644
index 0000000..4e58661
--- /dev/null
+++ b/lib/std/pledge.myr
@@ -0,0 +1,8 @@
+use sys
+
+pkg std =
+ const pledge : (promise : byte[:], epromise : byte[:] -> void)
+;;
+
+const pledge = {promise, epromise
+}