4 * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
21 * @file proc_process.h
22 * @desc grouping process and setting oom adj value
25 #ifndef __PROC_PROCESS_H__
26 #define __PROC_PROCESS_H__
28 #include <proc_stat.h>
30 #define OOMADJ_DISABLE (-1000)
31 #define OOMADJ_SERVICE_MIN (-900)
33 #define OOMADJ_INIT (100)
34 #define OOMADJ_FOREGRD_LOCKED (150)
35 #define OOMADJ_FOREGRD_UNLOCKED (200)
36 #define OOMADJ_BACKGRD_LOCKED (250)
37 #define OOMADJ_BACKGRD_UNLOCKED (300)
38 #define OOMADJ_APP_LIMIT OOMADJ_INIT
39 #define OOMADJ_APP_MAX (990)
40 #define OOMADJ_APP_INCREASE (30)
41 #define OOMADJ_SERVICE_GAP (10)
42 #define OOMADJ_SERVICE_DEFAULT (OOMADJ_BACKGRD_LOCKED - OOMADJ_SERVICE_GAP)
43 #define OOMADJ_SERVICE_FOREGRD (OOMADJ_FOREGRD_UNLOCKED - OOMADJ_SERVICE_GAP)
44 #define OOMADJ_SERVICE_BACKGRD (OOMADJ_BACKGRD_UNLOCKED - OOMADJ_SERVICE_GAP)
47 enum proc_sweep_type {
48 PROC_SWEEP_EXCLUDE_ACTIVE,
49 PROC_SWEEP_INCLUDE_ACTIVE,
52 int proc_get_cmdline(pid_t pid, char *cmdline);
53 int proc_sweep_memory(enum proc_sweep_type type, pid_t callpid);
55 int proc_get_oom_score_adj(int pid, int *oom_score_adj);
56 int proc_set_oom_score_adj(int pid, int oom_score_adj);
58 int proc_set_foregrd(int pid, int oom_score_adj);
59 int proc_set_backgrd(int pid, int oom_score_adj);
61 int proc_set_active(int pid, int oom_score_adj);
62 int proc_set_inactive(int pid, int oom_score_adj);
64 pid_t find_pid_from_cmdline(char *cmdline);
66 void proc_set_group(pid_t onwerpid, pid_t childpid);
68 #endif /*__PROC_PROCESS_H__*/