seccomp: install output atomically

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-03-17 01:09:12 +09:00
parent 44277dc0f1
commit ee10860357
10 changed files with 59 additions and 39 deletions

View File

@@ -13,8 +13,6 @@ import (
"syscall"
)
var CPrintln func(v ...any)
// LibraryError represents a libseccomp error.
type LibraryError struct {
Prefix string
@@ -99,7 +97,7 @@ func buildFilter(fd int, opts SyscallOpts) error {
// this removes repeated transitions between C and Go execution
// when producing log output via F_println and CPrintln is nil
if CPrintln != nil {
if fp := printlnP.Load(); fp != nil {
opts |= flagVerbose
}
@@ -114,10 +112,3 @@ func buildFilter(fd int, opts SyscallOpts) error {
}
return err
}
//export F_println
func F_println(v *C.char) {
if CPrintln != nil {
CPrintln(C.GoString(v))
}
}