2 * Copyright (c) 2017 Samsung Electronics Co., Ltd. All rights reserved.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #ifndef __HELPER_PROCFS_H__
19 #define __HELPER_PROCFS_H__
23 #define PROC_BUF_MAX 64
26 * @desc get command line from /proc/{pid}/cmdline
27 * @return negative value if error
29 int proc_get_cmdline(pid_t pid, char *cmdline);
32 * @desc find pid with /proc/{pid}/cmdline
33 * it returns first entry when many pids have same cmdline
34 * @return negative value if error
36 pid_t find_pid_from_cmdline(char *cmdline);
39 * @desc get smack subject label from /proc/{pid}/attr/current
40 * this label can indicate package name about child processes
41 * @return negative value if error or pid doesn't exist
43 int proc_get_label(pid_t pid, char *label);
46 * @desc get command line from /proc/{pid}/cmdline without any truncation
47 * @return negative value if error
49 int proc_get_raw_cmdline(pid_t pid, char *buf, int len);
52 * @desc get symblolic link about /proc/{pid}/exe
53 * @return negative value if error
55 int proc_get_exepath(pid_t pid, char *buf, int len);
58 * @desc get status from /proc/{pid}/status
59 * @return negative value if error
61 int proc_get_status(pid_t pid, char status[][PROC_BUF_MAX]);
63 #endif /*__HELPER_PROCFS_H__*/