Changeset View
Changeset View
Standalone View
Standalone View
plugins/process/network/helper/ConnectionMapping.cpp
Show First 20 Lines • Show All 132 Lines • ▼ Show 20 Line(s) | 131 | for (auto pid : pids) { | |||
---|---|---|---|---|---|
133 | auto dir = opendir(fdPath.data()); | 133 | auto dir = opendir(fdPath.data()); | ||
134 | if (dir == NULL) { | 134 | if (dir == NULL) { | ||
135 | continue; | 135 | continue; | ||
136 | } | 136 | } | ||
137 | 137 | | |||
138 | dirent *fd = nullptr; | 138 | dirent *fd = nullptr; | ||
139 | while ((fd = readdir(dir))) { | 139 | while ((fd = readdir(dir))) { | ||
140 | memset(buffer, 0, 100); | 140 | memset(buffer, 0, 100); | ||
141 | readlinkat(dirfd(dir), fd->d_name, buffer, 100); | 141 | readlinkat(dirfd(dir), fd->d_name, buffer, 99); | ||
142 | auto target = std::string(buffer); | 142 | auto target = std::string(buffer); | ||
143 | if (target.find("socket:") == std::string::npos) | 143 | if (target.find("socket:") == std::string::npos) | ||
144 | continue; | 144 | continue; | ||
145 | 145 | | |||
146 | auto inode = std::stoi(target.substr(8)); | 146 | auto inode = std::stoi(target.substr(8)); | ||
147 | m_inodeToPid.insert(std::make_pair(inode, pid)); | 147 | m_inodeToPid.insert(std::make_pair(inode, pid)); | ||
148 | } | 148 | } | ||
149 | 149 | | |||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |