blob: e745ca40caed6866b58e77ab2057c4500341b71e [file] [log] [blame]
San Mehat586536c2010-02-16 17:12:00 -08001/*
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
jessica_yu3f14fe42014-09-22 15:57:40 +080020#ifdef __cplusplus
21
San Mehat586536c2010-02-16 17:12:00 -080022class Process {
23public:
24 static void killProcessesWithOpenFiles(const char *path, int action);
25 static int getPid(const char *s);
26 static int checkSymLink(int pid, const char *path, const char *name);
27 static int checkFileMaps(int pid, const char *path);
28 static int checkFileMaps(int pid, const char *path, char *openFilename, size_t max);
29 static int checkFileDescriptorSymLinks(int pid, const char *mountPoint);
30 static int checkFileDescriptorSymLinks(int pid, const char *mountPoint, char *openFilename, size_t max);
31 static void getProcessName(int pid, char *buffer, size_t max);
32private:
33 static int readSymLink(const char *path, char *link, size_t max);
34 static int pathMatchesMountPoint(const char *path, const char *mountPoint);
35};
36
jessica_yu3f14fe42014-09-22 15:57:40 +080037extern "C" {
38#endif /* __cplusplus */
39 void vold_killProcessesWithOpenFiles(const char *path, int action);
40#ifdef __cplusplus
41}
42#endif
43
San Mehat586536c2010-02-16 17:12:00 -080044#endif