1/*
2 * Copyright (C) 2008 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef _PROCESS_H
18#define _PROCESS_H
19
20class Process {
21public:
22    static void killProcessesWithOpenFiles(const char *path, int action);
23    static int getPid(const char *s);
24    static int checkSymLink(int pid, const char *path, const char *name);
25    static int checkFileMaps(int pid, const char *path);
26    static int checkFileMaps(int pid, const char *path, char *openFilename, size_t max);
27    static int checkFileDescriptorSymLinks(int pid, const char *mountPoint);
28    static int checkFileDescriptorSymLinks(int pid, const char *mountPoint, char *openFilename, size_t max);
29    static void getProcessName(int pid, char *buffer, size_t max);
30private:
31    static int readSymLink(const char *path, char *link, size_t max);
32    static int pathMatchesMountPoint(const char *path, const char *mountPoint);
33};
34
35#endif
36