blob: 62a9313237c8de04b991f5bbe6b96b1756fb18a4 [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:
Jeff Sharkey89f74fb2015-10-21 12:16:12 -070024 static int killProcessesWithOpenFiles(const char *path, int signal);
San Mehat586536c2010-02-16 17:12:00 -080025 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 */
Jeff Sharkey36801cc2015-03-13 16:09:20 -070039 void vold_killProcessesWithOpenFiles(const char *path, int signal);
jessica_yu3f14fe42014-09-22 15:57:40 +080040#ifdef __cplusplus
41}
42#endif
43
San Mehat586536c2010-02-16 17:12:00 -080044#endif