Lines Matching refs:pid

66 void Process::getProcessName(int pid, char *buffer, size_t max) {
68 snprintf(buffer, max, "/proc/%d/cmdline", pid);
79 int Process::checkFileDescriptorSymLinks(int pid, const char *mountPoint) {
80 return checkFileDescriptorSymLinks(pid, mountPoint, NULL, 0);
83 int Process::checkFileDescriptorSymLinks(int pid, const char *mountPoint, char *openFilename, size_t max) {
88 sprintf(path, "/proc/%d/fd", pid);
124 int Process::checkFileMaps(int pid, const char *mountPoint) {
125 return checkFileMaps(pid, mountPoint, NULL, 0);
128 int Process::checkFileMaps(int pid, const char *mountPoint, char *openFilename, size_t max) {
132 sprintf(buffer, "/proc/%d/maps", pid);
154 int Process::checkSymLink(int pid, const char *mountPoint, const char *name) {
158 sprintf(path, "/proc/%d/%s", pid, name);
191 int pid = getPid(de->d_name);
194 if (pid == -1)
196 getProcessName(pid, name, sizeof(name));
200 if (checkFileDescriptorSymLinks(pid, path, openfile, sizeof(openfile))) {
201 SLOGE("Process %s (%d) has open file %s", name, pid, openfile);
202 } else if (checkFileMaps(pid, path, openfile, sizeof(openfile))) {
203 SLOGE("Process %s (%d) has open filemap for %s", name, pid, 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);
214 SLOGW("Sending SIGHUP to process %d", pid);
215 kill(pid, SIGTERM);
217 SLOGE("Sending SIGKILL to process %d", pid);
218 kill(pid, SIGKILL);