blob: 62a9313237c8de04b991f5bbe6b96b1756fb18a4
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 | |
20 | #ifdef __cplusplus |
21 | |
22 | class Process { |
23 | public: |
24 | static int killProcessesWithOpenFiles(const char *path, int signal); |
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); |
32 | private: |
33 | static int readSymLink(const char *path, char *link, size_t max); |
34 | static int pathMatchesMountPoint(const char *path, const char *mountPoint); |
35 | }; |
36 | |
37 | extern "C" { |
38 | #endif /* __cplusplus */ |
39 | void vold_killProcessesWithOpenFiles(const char *path, int signal); |
40 | #ifdef __cplusplus |
41 | } |
42 | #endif |
43 | |
44 | #endif |
45 |