1586536c60b773e3517531ad8a6cb0de6722c67fcSan Mehat/* 2586536c60b773e3517531ad8a6cb0de6722c67fcSan Mehat * Copyright (C) 2008 The Android Open Source Project 3586536c60b773e3517531ad8a6cb0de6722c67fcSan Mehat * 4586536c60b773e3517531ad8a6cb0de6722c67fcSan Mehat * Licensed under the Apache License, Version 2.0 (the "License"); 5586536c60b773e3517531ad8a6cb0de6722c67fcSan Mehat * you may not use this file except in compliance with the License. 6586536c60b773e3517531ad8a6cb0de6722c67fcSan Mehat * You may obtain a copy of the License at 7586536c60b773e3517531ad8a6cb0de6722c67fcSan Mehat * 8586536c60b773e3517531ad8a6cb0de6722c67fcSan Mehat * http://www.apache.org/licenses/LICENSE-2.0 9586536c60b773e3517531ad8a6cb0de6722c67fcSan Mehat * 10586536c60b773e3517531ad8a6cb0de6722c67fcSan Mehat * Unless required by applicable law or agreed to in writing, software 11586536c60b773e3517531ad8a6cb0de6722c67fcSan Mehat * distributed under the License is distributed on an "AS IS" BASIS, 12586536c60b773e3517531ad8a6cb0de6722c67fcSan Mehat * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13586536c60b773e3517531ad8a6cb0de6722c67fcSan Mehat * See the License for the specific language governing permissions and 14586536c60b773e3517531ad8a6cb0de6722c67fcSan Mehat * limitations under the License. 15586536c60b773e3517531ad8a6cb0de6722c67fcSan Mehat */ 16586536c60b773e3517531ad8a6cb0de6722c67fcSan Mehat 17586536c60b773e3517531ad8a6cb0de6722c67fcSan Mehat#ifndef _PROCESS_H 18586536c60b773e3517531ad8a6cb0de6722c67fcSan Mehat#define _PROCESS_H 19586536c60b773e3517531ad8a6cb0de6722c67fcSan Mehat 20586536c60b773e3517531ad8a6cb0de6722c67fcSan Mehatclass Process { 21586536c60b773e3517531ad8a6cb0de6722c67fcSan Mehatpublic: 22586536c60b773e3517531ad8a6cb0de6722c67fcSan Mehat static void killProcessesWithOpenFiles(const char *path, int action); 23586536c60b773e3517531ad8a6cb0de6722c67fcSan Mehat static int getPid(const char *s); 24586536c60b773e3517531ad8a6cb0de6722c67fcSan Mehat static int checkSymLink(int pid, const char *path, const char *name); 25586536c60b773e3517531ad8a6cb0de6722c67fcSan Mehat static int checkFileMaps(int pid, const char *path); 26586536c60b773e3517531ad8a6cb0de6722c67fcSan Mehat static int checkFileMaps(int pid, const char *path, char *openFilename, size_t max); 27586536c60b773e3517531ad8a6cb0de6722c67fcSan Mehat static int checkFileDescriptorSymLinks(int pid, const char *mountPoint); 28586536c60b773e3517531ad8a6cb0de6722c67fcSan Mehat static int checkFileDescriptorSymLinks(int pid, const char *mountPoint, char *openFilename, size_t max); 29586536c60b773e3517531ad8a6cb0de6722c67fcSan Mehat static void getProcessName(int pid, char *buffer, size_t max); 30586536c60b773e3517531ad8a6cb0de6722c67fcSan Mehatprivate: 31586536c60b773e3517531ad8a6cb0de6722c67fcSan Mehat static int readSymLink(const char *path, char *link, size_t max); 32586536c60b773e3517531ad8a6cb0de6722c67fcSan Mehat static int pathMatchesMountPoint(const char *path, const char *mountPoint); 33586536c60b773e3517531ad8a6cb0de6722c67fcSan Mehat}; 34586536c60b773e3517531ad8a6cb0de6722c67fcSan Mehat 35586536c60b773e3517531ad8a6cb0de6722c67fcSan Mehat#endif 36