From: Hyotaek Shim Date: Thu, 8 Mar 2018 02:42:57 +0000 (+0900) Subject: Revert "Revert "Remove deviced_conf_set_mempolicy_bypid and deviced_conf_set_mempolicy."" X-Git-Tag: accepted/tizen/unified/20180308.070205^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f1344fc12ecc8e9412c0c3d6718c00dbf860b161;p=platform%2Fcore%2Fsystem%2Fdeviced.git Revert "Revert "Remove deviced_conf_set_mempolicy_bypid and deviced_conf_set_mempolicy."" This reverts commit 932451c3313518a0033aa9169ee9df54ecee56b9. Change-Id: Ibc79de3bccdf864037914486d0f11f59f5693a19 Signed-off-by: Hyotaek Shim --- diff --git a/src/deviced/dd-deviced.h b/src/deviced/dd-deviced.h old mode 100644 new mode 100755 index 7bb3a63..e9d3f98 --- a/src/deviced/dd-deviced.h +++ b/src/deviced/dd-deviced.h @@ -95,32 +95,6 @@ int deviced_get_apppath(pid_t pid, char *app_path, size_t app_path_size); /* sysconf */ /** - * @fn int deviced_conf_set_mempolicy(enum mem_policy mempol) - * @brief This API is used to set the policy of the current process when the phone has low available memory. - * @param[in] mempol oom adjust value which you want to set - * @return 0 on success, -1 if failed. - * @see deviced_conf_set_mempolicy_bypid() - * @retval -1 operation error - * @retval -EBADMSG - dbus error (in case of any error on the bus) - * @retval -EINVAL no mandatory parameters - * @retval -ESRCH incorrect sender process id - */ -int deviced_conf_set_mempolicy(enum mem_policy mempol); - -/** - * @fn int deviced_conf_set_mempolicy_bypid(pid_t pid, enum mem_policy mempol) - * @brief This API is used to set the policy of the given process when the phone has low available memory. - * @param[in] pid process id which you want to set - * @param[in] mempol oom adjust value which you want to set - * @return 0 on success, -1 if failed. - * @retval -1 operation error - * @retval -EBADMSG - dbus error (in case of any error on the bus) - * @retval -EINVAL no mandatory parameters - * @retval -ESRCH incorrect sender process id - */ -int deviced_conf_set_mempolicy_bypid(pid_t pid, enum mem_policy mempol); - -/** * @fn int deviced_set_timezone(char *tzpath_str) * @brief This API sets system timezone. * @param[in] tzpath_str path to timezone definition file diff --git a/src/libdeviced/CMakeLists.txt b/src/libdeviced/CMakeLists.txt old mode 100644 new mode 100755 index 8bc9e5c..55a60c5 --- a/src/libdeviced/CMakeLists.txt +++ b/src/libdeviced/CMakeLists.txt @@ -9,7 +9,6 @@ SET(LIBDEVICED_SRCS mmc.c storage.c usbhost.c - deviced-conf.c deviced-noti.c deviced-util.c ) diff --git a/src/libdeviced/deviced-conf.c b/src/libdeviced/deviced-conf.c deleted file mode 100644 index d6e8bc5..0000000 --- a/src/libdeviced/deviced-conf.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * deviced - * - * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. - * - * 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 -#include -#include -#include -#include -#include -#include -#include - -#include "log.h" -#include "deviced-priv.h" -#include "dd-deviced.h" -#include "dbus.h" -#include "score-defines.h" - -#define PERMANENT_DIR "/tmp/permanent" -#define VIP_DIR "/tmp/vip" - -#define OOMADJ_SET "oomadj_set" -#define PROCESS_GROUP_SET "process_group_set" -#define PROCESS_VIP "process_vip" -#define PROCESS_PERMANENT "process_permanent" - -enum mp_entry_type { - MP_VIP, - MP_PERMANENT, - MP_NONE -}; - -int util_oomadj_set(int pid, int oomadj_val) -{ - GVariant *msg; - char buf1[SYSTEM_NOTI_MAXARG]; - char buf2[SYSTEM_NOTI_MAXARG]; - int val; - - snprintf(buf1, sizeof(buf1), "%d", pid); - snprintf(buf2, sizeof(buf2), "%d", oomadj_val); - - msg = dbus_handle_method_sync_with_reply_var(DEVICED_BUS_NAME, - DEVICED_PATH_PROCESS, - DEVICED_INTERFACE_PROCESS, - OOMADJ_SET, - g_variant_new("(siss)", OOMADJ_SET, 2, buf1, buf2)); - if (!msg) - return -EBADMSG; - - if (!dh_get_param_from_var(msg, "(i)", &val)) { - _E("fail (signature:%s): no message", g_variant_get_type_string(msg)); - val = -EBADMSG; - goto out; - } - - _D("%s-%s : %d", DEVICED_INTERFACE_PROCESS, OOMADJ_SET, val); - -out: - g_variant_unref(msg); - return val; -} - -API int deviced_conf_set_mempolicy_bypid(int pid, enum mem_policy mempol) -{ - if (pid < 1) - return -1; - - int oomadj_val = 0; - - switch (mempol) { - case OOM_LIKELY: - oomadj_val = OOMADJ_BACKGRD_UNLOCKED; - break; - case OOM_IGNORE: - oomadj_val = OOMADJ_SU; - break; - default: - return -1; - } - - return util_oomadj_set(pid, oomadj_val); -} - -API int deviced_conf_set_mempolicy(enum mem_policy mempol) -{ - return deviced_conf_set_mempolicy_bypid(getpid(), mempol); -}