Lines Matching defs:path

35 int Process::readSymLink(const char *path, char *link, size_t max) {
39 if (lstat(path, &s) < 0)
45 length = readlink(path, link, max- 1);
52 int Process::pathMatchesMountPoint(const char* path, const char* mountPoint) {
54 if (length > 1 && strncmp(path, mountPoint, length) == 0) {
59 // there is one in the path to avoid partial matches.
60 return (path[length] == 0 || path[length] == '/');
86 // compute path to process's directory of open files
87 char path[PATH_MAX];
88 sprintf(path, "/proc/%d/fd", pid);
89 DIR *dir = opendir(path);
93 // remember length of the path
94 int parent_length = strlen(path);
96 path[parent_length++] = '/';
105 path[parent_length] = 0;
106 strcat(path, de->d_name);
110 if (readSymLink(path, link, sizeof(link)) && pathMatchesMountPoint(link, mountPoint)) {
138 // skip to the path
139 const char* path = strchr(buffer, '/');
140 if (path && pathMatchesMountPoint(path, mountPoint)) {
143 strncpy(openFilename, path, max-1);
155 char path[PATH_MAX];
158 sprintf(path, "/proc/%d/%s", pid, name);
159 if (readSymLink(path, link, sizeof(link)) && pathMatchesMountPoint(link, mountPoint))
180 void Process::killProcessesWithOpenFiles(const char *path, int action) {
200 if (checkFileDescriptorSymLinks(pid, path, openfile, sizeof(openfile))) {
202 } else if (checkFileMaps(pid, path, openfile, sizeof(openfile))) {
204 } else if (checkSymLink(pid, path, "cwd")) {
205 SLOGE("Process %s (%d) has cwd within %s", name, pid, path);
206 } else if (checkSymLink(pid, path, "root")) {
207 SLOGE("Process %s (%d) has chroot within %s", name, pid, path);
208 } else if (checkSymLink(pid, path, "exe")) {
209 SLOGE("Process %s (%d) has executable path within %s", name, pid, path);