/* 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
+++ /dev/null
-/*
- * 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 <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <dlfcn.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <errno.h>
-
-#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);
-}