aboutsummaryrefslogtreecommitdiffhomepage
path: root/container/seccomp/libseccomp.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-11-05 05:48:59 +0900
committerOphestra <cat@gensokyo.uk>2025-11-05 05:48:59 +0900
commit7f27a6dc5173bc6c4b71918b98a2d6b72bd37d30 (patch)
tree4c97c7c4d8d892976719841f2b73ccc1f0ac81c0 /container/seccomp/libseccomp.go
parentb65aba94467e9d8f3400c3e3de5f403e82bc99e7 (diff)
container/seccomp: use native types
This prepares NativeRule for relocation to std for #15. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'container/seccomp/libseccomp.go')
-rw-r--r--container/seccomp/libseccomp.go26
1 files changed, 18 insertions, 8 deletions
diff --git a/container/seccomp/libseccomp.go b/container/seccomp/libseccomp.go
index 345586bd..c3550291 100644
--- a/container/seccomp/libseccomp.go
+++ b/container/seccomp/libseccomp.go
@@ -54,10 +54,19 @@ func (e *LibraryError) Is(err error) bool {
}
type (
+ // scmpUint is equivalent to [ScmpUint].
+ scmpUint = C.uint
+ // ScmpUint is equivalent to C.uint.
+ ScmpUint uint32
+ // scmpInt is equivalent to [ScmpInt].
+ scmpInt = C.int
+ // ScmpInt is equivalent to C.int.
+ ScmpInt int32
+
// ScmpSyscall represents a syscall number passed to libseccomp via [NativeRule.Syscall].
- ScmpSyscall C.int
+ ScmpSyscall ScmpInt
// ScmpErrno represents an errno value passed to libseccomp via [NativeRule.Errno].
- ScmpErrno C.int
+ ScmpErrno ScmpInt
// A NativeRule specifies an arch-specific action taken by seccomp under certain conditions.
NativeRule struct {
@@ -182,9 +191,12 @@ func Export(rules []NativeRule, flags ExportFlag) (data []byte, err error) {
// Errors returned by libseccomp is wrapped in [LibraryError].
func Load(rules []NativeRule, flags ExportFlag) error { return makeFilter(rules, flags, nil) }
-// ScmpCompare is the equivalent of scmp_compare;
-// Comparison operators
-type ScmpCompare = C.enum_scmp_compare
+type (
+ // Comparison operators.
+ scmpCompare = C.enum_scmp_compare
+ // ScmpCompare is equivalent to enum scmp_compare;
+ ScmpCompare ScmpUint
+)
const (
_SCMP_CMP_MIN = C._SCMP_CMP_MIN
@@ -210,17 +222,15 @@ const (
type (
// Argument datum.
scmpDatum = C.scmp_datum_t
-
// ScmpDatum is equivalent to scmp_datum_t.
ScmpDatum uint64
// Argument / Value comparison definition.
scmpArgCmp = C.struct_scmp_arg_cmp
-
// ScmpArgCmp is equivalent to struct scmp_arg_cmp.
ScmpArgCmp struct {
// argument number, starting at 0
- Arg C.uint
+ Arg ScmpUint
// the comparison op, e.g. SCMP_CMP_*
Op ScmpCompare