github.com/opencontainers/runtime-tools@v0.9.0/validation/util/linux_namespace.go (about)

     1  package util
     2  
     3  // ProcNamespaces defines a list of namespaces to be found under /proc/*/ns/.
     4  // NOTE: it is not the same as generate.Namespaces, because of naming
     5  // mismatches like "mnt" vs "mount" or "net" vs "network".
     6  var ProcNamespaces = []string{
     7  	"cgroup",
     8  	"ipc",
     9  	"mnt",
    10  	"net",
    11  	"pid",
    12  	"user",
    13  	"uts",
    14  }
    15  
    16  // GetRuntimeToolsNamespace converts a namespace type string for /proc into
    17  // a string for runtime-tools. It deals with exceptional cases of "net" and
    18  // "mnt", because those strings cannot be recognized by mapStrToNamespace(),
    19  // which actually expects "network" and "mount" respectively.
    20  func GetRuntimeToolsNamespace(ns string) string {
    21  	switch ns {
    22  	case "net":
    23  		return "network"
    24  	case "mnt":
    25  		return "mount"
    26  	}
    27  
    28  	// In other cases, return just the original string
    29  	return ns
    30  }