github.com/containers/podman/v5@v5.1.0-rc1/test/checkseccomp/checkseccomp.go (about)

     1  //go:build seccomp
     2  
     3  package main
     4  
     5  import (
     6  	"os"
     7  
     8  	"golang.org/x/sys/unix"
     9  )
    10  
    11  func main() {
    12  	// Check if Seccomp is supported, via CONFIG_SECCOMP.
    13  	if err := unix.Prctl(unix.PR_GET_SECCOMP, 0, 0, 0, 0); err != unix.EINVAL {
    14  		// Make sure the kernel has CONFIG_SECCOMP_FILTER.
    15  		if err := unix.Prctl(unix.PR_SET_SECCOMP, unix.SECCOMP_MODE_FILTER, 0, 0, 0); err != unix.EINVAL {
    16  			os.Exit(0)
    17  		}
    18  	}
    19  	os.Exit(1)
    20  }