MCPcopy
hub / github.com/opencontainers/runc / currentState

Method currentState

libcontainer/container_linux.go:917–965  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

915}
916
917func (c *Container) currentState() *State {
918 var (
919 startTime uint64
920 externalDescriptors []string
921 pid = -1
922 )
923 if c.initProcess != nil {
924 pid = c.initProcess.pid()
925 startTime, _ = c.initProcess.startTime()
926 externalDescriptors = c.initProcess.externalDescriptors()
927 }
928
929 intelRdtPath := ""
930 intelRdtMonPath := ""
931 if c.intelRdtManager != nil {
932 intelRdtPath = c.intelRdtManager.GetPath()
933 intelRdtMonPath = c.intelRdtManager.GetMonPath()
934 }
935 state := &State{
936 BaseState: BaseState{
937 ID: c.ID(),
938 Config: *c.config,
939 InitProcessPid: pid,
940 InitProcessStartTime: startTime,
941 Created: c.created,
942 },
943 Rootless: c.config.RootlessEUID && c.config.RootlessCgroups,
944 CgroupPaths: c.cgroupManager.GetPaths(),
945 IntelRdtPath: intelRdtPath,
946 IntelRdtMonPath: intelRdtMonPath,
947 NamespacePaths: make(map[configs.NamespaceType]string),
948 ExternalDescriptors: externalDescriptors,
949 }
950 if pid > 0 {
951 for _, ns := range c.config.Namespaces {
952 state.NamespacePaths[ns.Type] = ns.GetPath(pid)
953 }
954 for _, nsType := range configs.NamespaceTypes() {
955 if !configs.IsNamespaceSupported(nsType) {
956 continue
957 }
958 if _, ok := state.NamespacePaths[nsType]; !ok {
959 ns := configs.Namespace{Type: nsType}
960 state.NamespacePaths[ns.Type] = ns.GetPath(pid)
961 }
962 }
963 }
964 return state
965}
966
967func (c *Container) currentOCIState() (*specs.State, error) {
968 bundle, annotations := utils.Annotations(c.config.Labels)

Callers 3

StateMethod · 0.95
newSetnsProcessMethod · 0.95
updateStateMethod · 0.95

Calls 10

IDMethod · 0.95
GetPathMethod · 0.95
NamespaceTypesFunction · 0.92
IsNamespaceSupportedFunction · 0.92
GetMonPathMethod · 0.80
GetPathsMethod · 0.80
pidMethod · 0.65
startTimeMethod · 0.65
externalDescriptorsMethod · 0.65
GetPathMethod · 0.45

Tested by

no test coverage detected