about summary refs log tree commit diff stats
path: root/src/bindings
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-03-28 01:36:29 +0100
committerbptato <nincsnevem662@gmail.com>2024-03-28 01:36:29 +0100
commitb530ccc899a8cc8c63bad29abe1e479eb999b167 (patch)
tree07062947dfda3ac4356b0ce26de1cbe4e4c87ebd /src/bindings
parent52c415762fda7b9369ed4cf88783a6639574e3ea (diff)
downloadchawan-b530ccc899a8cc8c63bad29abe1e479eb999b167.tar.gz
Add capsicum support
It's the sandboxing system of FreeBSD. Quite pleasant to work with.

(Just trying to figure out the basics with this one before tackling the
abomination that is seccomp.)

Indeed, the only non-trivial part was getting newSelector to work with
Capsicum. Long story short it doesn't, so we use an ugly pointer cast +
assignment. But even that is stdlib's "fault", not Capsicum's.

This also gets rid of that ugly SocketPath global.
Diffstat (limited to 'src/bindings')
-rw-r--r--src/bindings/capsicum.nim6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/bindings/capsicum.nim b/src/bindings/capsicum.nim
new file mode 100644
index 00000000..e01c3efb
--- /dev/null
+++ b/src/bindings/capsicum.nim
@@ -0,0 +1,6 @@
+{.push header: "sys/capsicum.h", importc.}
+
+proc cap_enter*(): cint
+proc cap_getmode*(modep: ptr cuint): cint
+
+{.pop.}