()
| 915 | } |
| 916 | |
| 917 | func (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 | |
| 967 | func (c *Container) currentOCIState() (*specs.State, error) { |
| 968 | bundle, annotations := utils.Annotations(c.config.Labels) |
no test coverage detected