aboutsummaryrefslogtreecommitdiffhomepage
path: root/container/std
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-11-05 06:00:39 +0900
committerOphestra <cat@gensokyo.uk>2025-11-05 06:00:39 +0900
commitfba201c9953a490da914b09e09eaaa697a4b36e1 (patch)
tree9aa54e81577b6e3e580176f266d70a286ed52d9e /container/std
parent7f27a6dc5173bc6c4b71918b98a2d6b72bd37d30 (diff)
container/std: relocate rule types
This enables its use in hst for #15. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'container/std')
-rw-r--r--container/std/seccomp.go38
1 files changed, 38 insertions, 0 deletions
diff --git a/container/std/seccomp.go b/container/std/seccomp.go
new file mode 100644
index 00000000..f3189ca5
--- /dev/null
+++ b/container/std/seccomp.go
@@ -0,0 +1,38 @@
+package std
+
+type (
+ // ScmpUint is equivalent to C.uint.
+ ScmpUint uint32
+ // ScmpInt is equivalent to C.int.
+ ScmpInt int32
+
+ // ScmpSyscall represents a syscall number passed to libseccomp via [NativeRule.Syscall].
+ ScmpSyscall ScmpInt
+ // ScmpErrno represents an errno value passed to libseccomp via [NativeRule.Errno].
+ ScmpErrno ScmpInt
+
+ // ScmpCompare is equivalent to enum scmp_compare;
+ ScmpCompare ScmpUint
+ // ScmpDatum is equivalent to scmp_datum_t.
+ ScmpDatum uint64
+
+ // ScmpArgCmp is equivalent to struct scmp_arg_cmp.
+ ScmpArgCmp struct {
+ // argument number, starting at 0
+ Arg ScmpUint
+ // the comparison op, e.g. SCMP_CMP_*
+ Op ScmpCompare
+
+ DatumA, DatumB ScmpDatum
+ }
+
+ // A NativeRule specifies an arch-specific action taken by seccomp under certain conditions.
+ NativeRule struct {
+ // Syscall is the arch-dependent syscall number to act against.
+ Syscall ScmpSyscall
+ // Errno is the errno value to return when the condition is satisfied.
+ Errno ScmpErrno
+ // Arg is the optional struct scmp_arg_cmp passed to libseccomp.
+ Arg *ScmpArgCmp
+ }
+)