(pids []int)
| 1019 | } |
| 1020 | |
| 1021 | func uniqueProcessGroups(pids []int) ([]int, error) { |
| 1022 | uniqueGroups := make(map[int]bool) |
| 1023 | var uniqueGPIDs []int |
| 1024 | |
| 1025 | for _, pid := range pids { |
| 1026 | pgid, err := getProcessGroupID(pid) |
| 1027 | if err != nil { |
| 1028 | return nil, err |
| 1029 | } |
| 1030 | if !uniqueGroups[pgid] { |
| 1031 | uniqueGroups[pgid] = true |
| 1032 | uniqueGPIDs = append(uniqueGPIDs, pgid) |
| 1033 | } |
| 1034 | } |
| 1035 | |
| 1036 | return uniqueGPIDs, nil |
| 1037 | } |
| 1038 | |
| 1039 | func getProcessGroupID(pid int) (int, error) { |
| 1040 | statusPath := filepath.Join("/proc", strconv.Itoa(pid), "status") |
no test coverage detected