github.com/sijibomii/docker@v0.0.0-20231230191044-5cf6ca554647/daemon/top_windows.go (about) 1 package daemon 2 3 import ( 4 "errors" 5 "strconv" 6 7 "github.com/docker/engine-api/types" 8 ) 9 10 // ContainerTop is a minimal implementation on Windows currently. 11 // TODO Windows: This needs more work, but needs platform API support. 12 // All we can currently return (particularly in the case of Hyper-V containers) 13 // is a PID and the command. 14 func (daemon *Daemon) ContainerTop(containerID string, psArgs string) (*types.ContainerProcessList, error) { 15 16 // It's really not an equivalent to linux 'ps' on Windows 17 if psArgs != "" { 18 return nil, errors.New("Windows does not support arguments to top") 19 } 20 21 s, err := daemon.containerd.Summary(containerID) 22 if err != nil { 23 return nil, err 24 } 25 26 procList := &types.ContainerProcessList{} 27 28 for _, v := range s { 29 procList.Titles = append(procList.Titles, strconv.Itoa(int(v.Pid))+" "+v.Command) 30 } 31 return procList, nil 32 }