MCPcopy
hub / github.com/keploy/keploy / uniqueProcessGroups

Function uniqueProcessGroups

utils/utils.go:1021–1037  ·  view source on GitHub ↗
(pids []int)

Source from the content-addressed store, hash-verified

1019}
1020
1021func 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
1039func getProcessGroupID(pid int) (int, error) {
1040 statusPath := filepath.Join("/proc", strconv.Itoa(pid), "status")

Callers 1

InterruptProcessTreeFunction · 0.85

Calls 1

getProcessGroupIDFunction · 0.85

Tested by

no test coverage detected