github.com/apptainer/singularity@v3.1.1+incompatible/internal/pkg/security/seccomp/seccomp_unsupported.go (about)

     1  // Copyright (c) 2018, Sylabs Inc. All rights reserved.
     2  // This software is licensed under a 3-clause BSD license. Please consult the
     3  // LICENSE.md file distributed with the sources of this project regarding your
     4  // rights to use or distribute this software.
     5  
     6  // +build !seccomp OR !linux
     7  
     8  package seccomp
     9  
    10  import (
    11  	"fmt"
    12  	"runtime"
    13  
    14  	specs "github.com/opencontainers/runtime-spec/specs-go"
    15  	"github.com/opencontainers/runtime-tools/generate"
    16  )
    17  
    18  // Enabled returns wether seccomp is enabled or not
    19  func Enabled() bool {
    20  	return false
    21  }
    22  
    23  // LoadSeccompConfig returns an error for unsupported platforms or without seccomp support
    24  func LoadSeccompConfig(config *specs.LinuxSeccomp, noNewPrivs bool) error {
    25  	if runtime.GOOS == "linux" {
    26  		return fmt.Errorf("can't load seccomp filter: not enabled at compilation time")
    27  	}
    28  	return fmt.Errorf("can't load seccomp filter: not supported by OS")
    29  }
    30  
    31  // LoadProfileFromFile does nothing for unsupported platforms
    32  func LoadProfileFromFile(profile string, generator *generate.Generator) error {
    33  	return nil
    34  }