github.com/criyle/go-sandbox@v0.10.3/pkg/seccomp/libseccomp/action_linux.go (about)

     1  package libseccomp
     2  
     3  import (
     4  	libseccomp "github.com/elastic/go-seccomp-bpf"
     5  )
     6  
     7  // ToSeccompAction convert action to libseccomp compatible action
     8  func ToSeccompAction(a Action) libseccomp.Action {
     9  	var action libseccomp.Action
    10  	switch a.Action() {
    11  	case ActionAllow:
    12  		action = libseccomp.ActionAllow
    13  	case ActionErrno:
    14  		action = libseccomp.ActionErrno
    15  	case ActionTrace:
    16  		action = libseccomp.ActionTrace
    17  	default:
    18  		action = libseccomp.ActionKillProcess
    19  	}
    20  	// the least 16 bit of ret value is SECCOMP_RET_DATA
    21  	// although it might not officially supported by go-seccomp-bpf
    22  	// action = action.WithReturnData(int(a.ReturnCode()))
    23  	return action
    24  }