diff --git a/crit/explore.go b/crit/explore.go index 4a539c741..3d2b98799 100644 --- a/crit/explore.go +++ b/crit/explore.go @@ -77,6 +77,7 @@ type Fd struct { // File represents a single opened file type File struct { Fd string `json:"fd"` + Type string `json:"type,omitempty"` Path string `json:"path"` } @@ -114,6 +115,7 @@ func (c *crit) ExploreFds() ([]*Fd, error) { } file := File{ Fd: strconv.FormatUint(uint64(fdInfo.GetFd()), 10), + Type: fdInfo.GetType().String(), Path: filePath, } fdEntry.Files = append(fdEntry.Files, &file) diff --git a/crit/utils.go b/crit/utils.go index e0e173bbe..f76c3a7df 100644 --- a/crit/utils.go +++ b/crit/utils.go @@ -139,7 +139,7 @@ func getFilePath(dir string, fID uint32, fType fdinfo.FdTypes) (string, error) { case fdinfo.FdTypes_UNIXSK: filePath, err = getUnixSkFilePath(dir, file, fID) default: - filePath = fmt.Sprintf("%s.%d", fdinfo.FdTypes_name[int32(fType)], fID) + filePath = fmt.Sprintf("%s.%d", fType.String(), fID) } return filePath, err