Module name changed.
* low_memory_killer -> resourced-memory-lmk
* According to this, the name of library, source directory, source file
name, and symbols are modified.
Governor source code added.
Dlog feature is added.
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.Apache-2.0
DESTINATION ${PLUGIN_LICENSE_DIR})
-ADD_SUBDIRECTORY(src/low_memory_killer)
+ADD_SUBDIRECTORY(src/resourced-memory-lmk)
-%define PLUGIN_LIBDIR %{_libdir}/plugin/%{name}
+%define PLUGIN_LIBDIR %{_libdir}/plugin
%define PLUGIN_LICENSEDIR /usr/share/plugin/%{name}
Name: plugin-backend-resourced-rpi
/sbin/ldconfig
%files
-%{PLUGIN_LIBDIR}/libplugin-backend-resourced-low_memory_killer.so
+%{PLUGIN_LIBDIR}/libplugin-backend-resourced-memory-lmk.so
%manifest %{name}.manifest
%{PLUGIN_LICENSEDIR}/LICENSE.Apache-2.0
+++ /dev/null
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(plugin-backend-resourced-low_memory_killer C)
-
-SET(PREFIX ${CMAKE_INSTALL_PREFIX})
-
-SET(PKG_MODULES
- libsyscommon)
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs REQUIRED ${PKG_MODULES})
-FOREACH(flag ${pkgs_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
-
-ADD_LIBRARY(${PROJECT_NAME} SHARED low_memory_killer.c)
-MESSAGE("pkgs_LDFLAGS: ${pkgs_LDFLAGS}")
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS})
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${PLUGIN_LIB_DIR} COMPONENT RuntimeLibraries)
+++ /dev/null
-#include <stdlib.h>
-
-#include <plugin/plugin-common-interface.h>
-#include <plugin/plugin-low_memory_killer-interface.h>
-
-#define EXPORT __attribute__ ((visibility("default")))
-
-GArray *get_kill_candidates(GSList *proc_app_list, int start_oom, int end_oom, int killer_flags)
-{
- return (GArray *)100;
-}
-
-int low_memory_killer_init(void **data)
-{
- plugin_backend_low_memory_killer_funcs *funcs = NULL;
-
- funcs = calloc(1, sizeof(*funcs));
- if (!funcs)
- return -ENOMEM;
-
- funcs->get_kill_candidates = get_kill_candidates;
-
- *data = (void *)funcs;
-
- return 0;
-}
-
-int low_memory_killer_exit(void *data)
-{
- free(data);
- return 0;
-}
-
-plugin_backend EXPORT plugin_backend_resourced_low_memory_killer_data = {
- .name = "low_memory_killer",
- .vendor = "Samsung",
- .abi_version = PLUGIN_ABI_VERSION_TIZEN_7_5,
- .init = low_memory_killer_init,
- .exit = low_memory_killer_exit,
-};
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(plugin-backend-resourced-memory-lmk C)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+
+if (${PLUGIN_BACKEND_RESOURCED_MEMORY_LMK_ENABLE_DLOG})
+ SET(PKG_MODULES
+ libsyscommon
+ glib-2.0)
+ ADD_DEFINITIONS("-DENABLE_DLOG")
+ ADD_DEFINITIONS("-DLOG_TAG=\"PLUGIN_BACKEND_RESOURCED_MEMORY_LMK\"")
+else()
+ SET(PKG_MODULES
+ libsyscommon)
+endif()
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(pkgs REQUIRED ${PKG_MODULES})
+FOREACH(flag ${pkgs_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+
+ADD_LIBRARY(${PROJECT_NAME} SHARED resourced-memory-lmk.c)
+MESSAGE("pkgs_LDFLAGS: ${pkgs_LDFLAGS}")
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS})
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${PLUGIN_LIB_DIR} COMPONENT RuntimeLibraries)
--- /dev/null
+/**
+ * plugin-backend-resourced-rpi
+ *
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __COMMON_H__
+#define __COMMON_H__
+
+#ifdef ENABLE_DLOG
+#include <dlog.h>
+
+#define _D(fmt, args...) SLOGD(fmt, ##args)
+#define _I(fmt, args...) SLOGI(fmt, ##args)
+#define _W(fmt, args...) SLOGW(fmt, ##args)
+#define _E(fmt, args...) SLOGE(fmt, ##args)
+#else
+#define _D(fmt, args...) do { } while(0)
+#define _I(fmt, args...) do { } while(0)
+#define _W(fmt, args...) do { } while(0)
+#define _E(fmt, args...) do { } while(0)
+#endif
+
+#endif /* __COMMON_H__ */
--- /dev/null
+/**
+ * plugin-backend-resourced-rpi
+ *
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <glib.h>
+
+#include "common.h"
+#include "resourced-memory-lmk-governor.h"
+
+GArray *lowmem_governor_get_kill_candidates(GSList *proc_app_list, int start_oom, int end_oom, int killer_flags)
+{
+ _D("lowmem_governor_get_kill_candidates called");
+
+ return NULL;
+}
--- /dev/null
+/**
+ * plugin-backend-resourced-rpi
+ *
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __RESOURCED_MEMORY_LMK_GOVERNOR_H__
+#define __RESOURCED_MEMORY_LMK_GOVERNOR_H__
+
+GArray *lowmem_governor_get_kill_candidates(GSList *proc_app_list, int start_oom, int end_oom, int killer_flags);
+
+#endif /* __RESOURCED_MEMORY_LMK_GOVERNOR_H__ */
--- /dev/null
+/**
+ * plugin-backend-resourced-rpi
+ *
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+
+#include <plugin/plugin-common-interface.h>
+#include <plugin/plugin-resourced-memory-lmk-interface.h>
+
+#include "common.h"
+#include "resourced-memory-lmk-governor.h" /* TODO: Remove this line */
+
+#define EXPORT __attribute__ ((visibility("default")))
+
+/*
+GArray *get_kill_candidates(GSList *proc_app_list, int start_oom, int end_oom, int killer_flags)
+{
+ return NULL;
+}
+*/
+
+int resourced_memory_lmk_init(void **data)
+{
+ plugin_backend_resourced_memory_lmk_funcs *funcs = NULL;
+
+ funcs = calloc(1, sizeof(*funcs));
+ if (!funcs)
+ return -ENOMEM;
+
+ /* funcs->get_kill_candidates = get_kill_candidates; */ /* TODO: Use this line instead of a line below */
+ funcs->get_kill_candidates = lowmem_governor_get_kill_candidates; /* TODO: Remove this line */
+
+ *data = (void *)funcs;
+
+ return 0;
+}
+
+int resourced_memory_lmk_exit(void *data)
+{
+ free(data);
+ return 0;
+}
+
+plugin_backend EXPORT plugin_backend_resourced_memory_lmk_data = {
+ .name = "resourced-memory-lmk",
+ .vendor = "Samsung",
+ .abi_version = PLUGIN_ABI_VERSION_TIZEN_7_5,
+ .init = resourced_memory_lmk_init,
+ .exit = resourced_memory_lmk_exit,
+};