4 * Copyright (c) 2023 Samsung Electronics Co., Ltd.
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is furnished
11 * to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27 #include "syscommon-plugin-common.h"
30 #include "syscommon-plugin-resourced-memory-lmk.h"
31 #include "syscommon-plugin-resourced-memory-lmk-interface.h"
34 #define EXPORT __attribute__((visibility("default")))
37 static syscommon_plugin_backend_resourced_memory_lmk_funcs *funcs = NULL;
40 int syscommon_plugin_resourced_memory_lmk_get_backend(void)
47 ret = syscommon_plugin_common_get_backend(
48 SYSCOMMON_PLUGIN_MODULE_RESOURCED_MEMORY_LMK,
51 _E("Failed to get resourced_memory_lmk backend: %d", ret);
55 _I("Success to get resourced_memory_lmk backend: %d", ret);
61 int syscommon_plugin_resourced_memory_lmk_put_backend(void)
68 ret = syscommon_plugin_common_put_backend(
69 SYSCOMMON_PLUGIN_MODULE_RESOURCED_MEMORY_LMK,
72 _E("Failed to put resourced_memory_lmk backend: %d", ret);
77 _I("Success to put resourced_memory_lmk backend: %d", ret);
83 int syscommon_plugin_resourced_memory_lmk_get_kill_candidates(
85 GArray *task_info_app_array,
86 GArray *task_info_proc_array,
87 unsigned long totalram_kb)
92 ret = syscommon_plugin_resourced_memory_lmk_get_backend();
97 if (!funcs || !funcs->get_kill_candidates) {
98 _E("No backend or no \"get_kill_candidates\" function");
102 return funcs->get_kill_candidates(candidates,
104 task_info_proc_array,