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

     1  package libseccomp
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/elastic/go-seccomp-bpf/arch"
     7  )
     8  
     9  var info, errInfo = arch.GetInfo("")
    10  
    11  // ToSyscallName convert syscallno to syscall name
    12  func ToSyscallName(sysno uint) (string, error) {
    13  	if errInfo != nil {
    14  		return "", errInfo
    15  	}
    16  	n, ok := info.SyscallNumbers[int(sysno)]
    17  	if !ok {
    18  		return "", fmt.Errorf("syscall no %d does not exits", sysno)
    19  	}
    20  	return n, nil
    21  }