26
26
rPos = regexp .MustCompile (`^pos:\s+(\d+)$` )
27
27
rFlags = regexp .MustCompile (`^flags:\s+(\d+)$` )
28
28
rMntID = regexp .MustCompile (`^mnt_id:\s+(\d+)$` )
29
+ rIno = regexp .MustCompile (`^ino:\s+(\d+)$` )
29
30
rInotify = regexp .MustCompile (`^inotify` )
30
31
rInotifyParts = regexp .MustCompile (`^inotify\s+wd:([0-9a-f]+)\s+ino:([0-9a-f]+)\s+sdev:([0-9a-f]+)(?:\s+mask:([0-9a-f]+))?` )
31
32
)
@@ -40,6 +41,8 @@ type ProcFDInfo struct {
40
41
Flags string
41
42
// Mount point ID
42
43
MntID string
44
+ // Inode number
45
+ Ino string
43
46
// List of inotify lines (structured) in the fdinfo file (kernel 3.8+ only)
44
47
InotifyInfos []InotifyInfo
45
48
}
@@ -51,7 +54,7 @@ func (p Proc) FDInfo(fd string) (*ProcFDInfo, error) {
51
54
return nil , err
52
55
}
53
56
54
- var text , pos , flags , mntid string
57
+ var text , pos , flags , mntid , ino string
55
58
var inotify []InotifyInfo
56
59
57
60
scanner := bufio .NewScanner (bytes .NewReader (data ))
@@ -63,6 +66,8 @@ func (p Proc) FDInfo(fd string) (*ProcFDInfo, error) {
63
66
flags = rFlags .FindStringSubmatch (text )[1 ]
64
67
} else if rMntID .MatchString (text ) {
65
68
mntid = rMntID .FindStringSubmatch (text )[1 ]
69
+ } else if rIno .MatchString (text ) {
70
+ ino = rIno .FindStringSubmatch (text )[1 ]
66
71
} else if rInotify .MatchString (text ) {
67
72
newInotify , err := parseInotifyInfo (text )
68
73
if err != nil {
@@ -77,6 +82,7 @@ func (p Proc) FDInfo(fd string) (*ProcFDInfo, error) {
77
82
Pos : pos ,
78
83
Flags : flags ,
79
84
MntID : mntid ,
85
+ Ino : ino ,
80
86
InotifyInfos : inotify ,
81
87
}
82
88
0 commit comments