pass: Remove unused code and modify the prefix for pass
authorChanwoo Choi <cw00.choi@samsung.com>
Mon, 16 Jan 2017 07:27:12 +0000 (16:27 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Mon, 23 Jan 2017 11:05:57 +0000 (20:05 +0900)
The pass is developed based on deviced source. There are the specific
features and codes for deviced. This patch removes the unused
features and if there is the used feature for pass, this patch
modifies the naming prefix for pass.

Change-Id: Id078a9070e30b2a1ee87e374bbceaf731ebc7036
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
67 files changed:
CMakeLists.txt
CREDITS
packaging/libpass.manifest [new file with mode: 0644]
packaging/pass.spec
src/apps/apps.c [deleted file]
src/apps/apps.h [deleted file]
src/control/control.c [deleted file]
src/core/boot.c
src/core/boot.h
src/core/common.c
src/core/common.h
src/core/config-parser.c
src/core/config-parser.h
src/core/device-idler.c
src/core/device-idler.h
src/core/device-notifier.c
src/core/device-notifier.h
src/core/devices.c
src/core/devices.h
src/core/edbus-handler.c
src/core/edbus-handler.h
src/core/execute.c
src/core/launch.c [deleted file]
src/core/launch.h [deleted file]
src/core/list.h
src/core/log.c
src/core/log.h
src/core/main.c
src/core/sig-handler.c
src/core/udev.c
src/core/udev.h
src/deviced/dd-common.h [deleted file]
src/deviced/dd-control.h [deleted file]
src/deviced/dd-deviced-managed.h [deleted file]
src/deviced/dd-deviced.h [deleted file]
src/deviced/deviced_doc.h [deleted file]
src/pass/pass-core.c
src/pass/pass-core.h
src/pass/pass-gov-radiation.c
src/pass/pass-gov-step.c
src/pass/pass-gov.h
src/pass/pass-plugin.c
src/pass/pass-plugin.h
src/pass/pass-pmqos.c
src/pass/pass-pmqos.h
src/pass/pass-util.h
src/pass/pass.c
src/pass/pass.conf
src/pass/pass.h
src/pmqos/pmqos-parser.c
src/pmqos/pmqos.c
src/pmqos/pmqos.h
src/proc/cpu-info.c [deleted file]
src/proc/proc-handler.c [deleted file]
src/shared/CMakeLists.txt
src/shared/common.h
src/shared/dbus.c
src/shared/dbus.h
src/shared/deviced-internal.h [deleted file]
src/shared/deviced-priv.h
src/shared/deviced-systemd.c [deleted file]
src/shared/deviced-systemd.h [deleted file]
src/shared/log-macro.h
src/shared/log.h
src/shared/pass-systemd.c [new file with mode: 0644]
src/shared/pass-systemd.h [new file with mode: 0644]
src/shared/score-defines.h

index f3eab29a6b70a8003821654ea034d750c4b1fc0b..dbaad06dff28719d1f2ca13286fcc135034d8395 100644 (file)
@@ -17,7 +17,7 @@ ELSEIF("${ARCH_BIT}" STREQUAL "64")
 ENDIF()
 
 ########################################################
-# Deviced Macros
+# PASS Macros
 ########################################################
 
 MACRO(ADD_SOURCE DIR OUT)
@@ -45,13 +45,13 @@ MACRO(INSTALL_CONF DIR CONF)
        ENDIF()
        IF(DEFINED T_CONF)
                INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${T_CONF}
-                       DESTINATION /etc/deviced
+                       DESTINATION /etc/pass
                        RENAME ${CONF}.conf)
        ENDIF()
 ENDMACRO()
 
 ########################################################
-# Deviced CMakeLists.txt
+# PASS CMakeLists.txt
 ########################################################
 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
 SET(EXEC_PREFIX "${PREFIX}/bin")
@@ -61,38 +61,32 @@ SET(CONFDIR "/etc/${PROJECT_NAME}")
 SET(VERSION 0.1.0)
 
 SET(SRCS
-       src/apps/apps.c
-       src/control/control.c
+       src/pass/pass.c
+       src/pass/pass-core.c
+       src/pass/pass-gov-radiation.c
+       src/pass/pass-gov-step.c
+       src/pass/pass-parser.c
+       src/pass/pass-plugin.c
+       src/pass/pass-pmqos.c
+       src/pmqos/pmqos.c
+       src/pmqos/pmqos-parser.c
+       src/shared/pass-systemd.c
        src/core/common.c
        src/core/config-parser.c
        src/core/device-idler.c
        src/core/device-notifier.c
        src/core/devices.c
        src/core/edbus-handler.c
-       src/core/execute.c
-       src/core/launch.c
        src/core/log.c
        src/core/main.c
        src/core/sig-handler.c
        src/core/udev.c
        src/core/boot.c
-       src/proc/cpu-info.c
-       src/proc/proc-handler.c
 )
 
-IF(PASS_MODULE STREQUAL on)
-       ADD_SOURCE(src/pass PASS_SRCS)
-       SET(SRCS ${SRCS} ${PASS_SRCS})
-ENDIF()
-
-IF(PMQOS_MODULE STREQUAL on)
-       ADD_SOURCE(src/pmqos PMQOS_SRCS)
-       SET(SRCS ${SRCS} ${PMQOS_SRCS})
-ENDIF()
-
 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src/deviced)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src/pass)
 
 SET(PKG_MODULES
        ecore
@@ -107,7 +101,6 @@ SET(PKG_MODULES
        gio-2.0
        eventsystem
        libtzplatform-config
-       hwcommon
        mount
 )
 
@@ -126,8 +119,8 @@ SET(CMAKE_EXE_LINKER_FLAGS "-pie")
 ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
 ADD_DEFINITIONS("-DFACTORYFS=\"$ENV{FACTORYFS}\"")
 ADD_DEFINITIONS("-DLIBPATH=\"${LIB_INSTALL_DIR}\"")
-ADD_DEFINITIONS("-DENABLE_DEVICED_DLOG")
-ADD_DEFINITIONS("-DENABLE_LIBDEVICED_DLOG")
+ADD_DEFINITIONS("-DENABLE_PASS_DLOG")
+ADD_DEFINITIONS("-DENABLE_LIBPASS_DLOG")
 ADD_DEFINITIONS("-DENABLE_PM_LOG")
 IF(ENGINEER_MODE STREQUAL on)
 ADD_DEFINITIONS("-DENGINEER_MODE")
@@ -151,16 +144,16 @@ ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} "-ldl" "-lm" shared)
 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
 
-INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/deviced/ DESTINATION include/${PROJECT_NAME}
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/pass/ DESTINATION include/${PROJECT_NAME}
                FILES_MATCHING
                PATTERN "*_doc.h" EXCLUDE
                PATTERN "*.h")
 
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/${PROJECT_NAME}.conf DESTINATION /etc/dbus-1/system.d)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/pass/pass.conf DESTINATION /etc/deviced)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/pass/pass-cluster0.conf DESTINATION /etc/deviced)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/pass/pass-cluster1.conf DESTINATION /etc/deviced)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/pmqos/pmqos.conf DESTINATION /etc/deviced)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/pass/pass.conf DESTINATION /etc/pass)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/pass/pass-cluster0.conf DESTINATION /etc/pass)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/pass/pass-cluster1.conf DESTINATION /etc/pass)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/pmqos/pmqos.conf DESTINATION /etc/pass)
 
 CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
diff --git a/CREDITS b/CREDITS
index c06cb19210e994a6869ee6261490018ac4961217..d54df9cc403d4cf7dbb91a37068bd9c3b3d9b6e4 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -1,4 +1,4 @@
-Thanks to the follow people for contributing to deviced by reporting
+Thanks to the follow people for contributing to PASS by reporting
 bugs, providing fixes, providing information, providing resources or
 porting to new systems:
 
@@ -6,10 +6,4 @@ The names are sorted alphabetically by last name.
 Names taken from sources and from version control system.
 
 ChanWoo Choi <cw00.choi@samsung.com>
-Byung-Soo Kim <bs1770.kim@samsung.com>
-Taeyoung Kim <ty317.kim@samsung.com>
-Gi-Yeol Ok <giyeol.ok@samsung.com>
-Kyungmin Park <kyungmin.park@samsung.com>
-SeungHun Pi <sh.pi@samsung.com>
-Juho Son <juho80.son@samsung.com>
-Jiyoung Yun <jy910.yun@samsung.com>
+Wook Song <wook16.song@samsung.com>
diff --git a/packaging/libpass.manifest b/packaging/libpass.manifest
new file mode 100644 (file)
index 0000000..97e8c31
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+       <request>
+               <domain name="_"/>
+       </request>
+</manifest>
index 4ba07667b9047afe5bc8f76c18b51c6977460b13..ba24cf263ae42132025460ec8c016141bb1d5a48 100644 (file)
@@ -1,19 +1,6 @@
 
-#These options are DEACTIVATED by default.
-%bcond_with x
-%bcond_with wayland
-%bcond_with emulator
-
 %define _unpackaged_files_terminate_build 0
 %define daemon_name pass
-%define libdaemon_name lib%{daemon_name}
-
-# display, extcon, power, usb are always enable
-
-# Support two pattern combination vibration
-%define standard_mix off
-%define pass_module on
-%define pmqos_module on
 
 %if "%{?profile}" == "mobile"
 %endif
 %endif
 
 Name:       %{daemon_name}
-Summary:    PASS
+Summary:    Power Aware System Service
 Version:    0.0.1
 Release:    1
-Group:      System/Management
+Group:      System/Kernel
 License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
 Source1:    %{name}.manifest
@@ -51,10 +38,6 @@ BuildRequires:  pkgconfig(gio-2.0)
 BuildRequires:  pkgconfig(glib-2.0)
 BuildRequires: pkgconfig(eventsystem)
 BuildRequires:  pkgconfig(libtzplatform-config)
-BuildRequires:  pkgconfig(hwcommon)
-#Requires: %{name}-tools = %{version}-%{release}
-%{?systemd_requires}
-Requires(post): /usr/bin/vconftool
 
 %description
 PASS  (Power-Aware System Service)
@@ -84,14 +67,6 @@ PASS systemd daemon.
        %define ARCH_BIT 64
 %endif
 
-%define DPMS none
-%if %{with x}
-%define DPMS x
-%endif
-%if %{with wayland}
-%define DPMS wayland
-%endif
-
 %if 0%{?tizen_build_devel_mode} == 1
 %define engineer_mode on
 %else
@@ -103,12 +78,8 @@ PASS systemd daemon.
        -DCMAKE_INSTALL_PREFIX=%{_prefix} \
        -DARCH=%{ARCH} \
        -DARCH_BIT=%{ARCH_BIT} \
-       -DDPMS=%{DPMS} \
        -DENGINEER_MODE=%{engineer_mode} \
        -DPROFILE=%{profile} \
-       -DSTANDARD_MIX=%{standard_mix} \
-       -DPASS_MODULE=%{pass_module} \
-       -DPMQOS_MODULE=%{pmqos_module} \
        #eol
 
 %build
@@ -123,8 +94,6 @@ rm -rf %{buildroot}
 %install_service sockets.target.wants %{daemon_name}.socket
 
 %post
-#memory type vconf key init
-users_gid=$(getent group %{TZ_SYS_USER_GROUP} | cut -f3 -d':')
 
 systemctl daemon-reload
 if [ "$1" == "1" ]; then
@@ -142,11 +111,10 @@ systemctl daemon-reload
 %files -n %{daemon_name}
 %manifest %{name}.manifest
 %license LICENSE
-%config %{_sysconfdir}/dbus-1/system.d/%{daemon_name}.conf
-%config %{_sysconfdir}/deviced/pass.conf
-%config %{_sysconfdir}/deviced/pass-cluster0.conf
-%config %{_sysconfdir}/deviced/pass-cluster1.conf
-%config %{_sysconfdir}/deviced/pmqos.conf
+%config %{_sysconfdir}/pass/pass.conf
+%config %{_sysconfdir}/pass/pass-cluster0.conf
+%config %{_sysconfdir}/pass/pass-cluster1.conf
+%config %{_sysconfdir}/pass/pmqos.conf
 %{_bindir}/%{daemon_name}
 %{_unitdir}/multi-user.target.wants/%{daemon_name}.service
 %{_unitdir}/sockets.target.wants/%{daemon_name}.socket
diff --git a/src/apps/apps.c b/src/apps/apps.c
deleted file mode 100755 (executable)
index 3e2433b..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * deviced
- *
- * Copyright (c) 2012 - 2015 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 <stdarg.h>
-#include "core/log.h"
-#include "core/common.h"
-#include "apps.h"
-#include "core/edbus-handler.h"
-
-#define POPUP_METHOD "PopupLaunch"
-
-static const struct app_dbus_match {
-       const char *type;
-       const char *bus;
-       const char *path;
-       const char *iface;
-       const char *method;
-} app_match[] = {
-       { APP_DEFAULT , POPUP_BUS_NAME, POPUP_PATH_SYSTEM  , POPUP_INTERFACE_SYSTEM  , POPUP_METHOD },
-       { APP_POWERKEY, POPUP_BUS_NAME, POPUP_PATH_POWERKEY, POPUP_INTERFACE_POWERKEY, POPUP_METHOD },
-};
-
-int launch_system_app(char *type, int num, ...)
-{
-       char *app_type;
-       va_list args;
-       int i, match, ret;
-
-       if (type)
-               app_type = type;
-       else
-               app_type = APP_DEFAULT;
-
-       match = -1;
-       for (i = 0 ; i < ARRAY_SIZE(app_match) ; i++) {
-               if (strncmp(app_type, app_match[i].type, strlen(app_type)))
-                       continue;
-               match = i;
-               break;
-       }
-       if (match < 0) {
-               _E("Failed to find app matched (%s)", app_type);
-               return -EINVAL;
-       }
-
-       va_start(args, num);
-
-       ret = dbus_method_sync_pairs(app_match[match].bus,
-                       app_match[match].path,
-                       app_match[match].iface,
-                       app_match[match].method,
-                       num, args);
-
-       va_end(args);
-
-       return ret;
-}
-
-int launch_message_post(char *type)
-{
-       char *param[1];
-
-       if (!type)
-               return -EINVAL;
-
-       param[0] = type;
-
-       return dbus_method_sync(POPUP_BUS_NAME,
-                       POPUP_PATH_NOTI,
-                       POPUP_INTERFACE_NOTI,
-                       "MessagePostOn",
-                       "s", param);
-}
-
-int add_notification(char *type)
-{
-       if (!type)
-               return -EINVAL;
-
-       return dbus_method_sync(POPUP_BUS_NAME,
-                       POPUP_PATH_NOTI,
-                       POPUP_INTERFACE_NOTI,
-                       type, NULL, NULL);
-}
-
-int remove_notification(char *type, int id)
-{
-       char *param[1];
-       char id_str[16];
-
-       if (!type || id < 0)
-               return -EINVAL;
-
-       snprintf(id_str, sizeof(id_str), "%d", id);
-       param[0] = id_str;
-
-       return dbus_method_sync(POPUP_BUS_NAME,
-                       POPUP_PATH_NOTI,
-                       POPUP_INTERFACE_NOTI,
-                       type, "i", param);
-}
diff --git a/src/apps/apps.h b/src/apps/apps.h
deleted file mode 100755 (executable)
index 2d7b35a..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * deviced
- *
- * Copyright (c) 2012 - 2015 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.
- */
-
-#ifndef __APPS_H__
-#define __APPS_H__
-
-
-#include "core/edbus-handler.h"
-#include "core/common.h"
-
-#define APP_POWERKEY "powerkey"
-#define APP_DEFAULT  "system"
-#define APP_KEY_TYPE "_SYSPOPUP_CONTENT_"
-
-int launch_system_app(char *type, int num, ...);
-int launch_message_post(char *type);
-int add_notification(char *type);
-int remove_notification(char *type, int id);
-
-#endif /* __APPS_H__ */
diff --git a/src/control/control.c b/src/control/control.c
deleted file mode 100644 (file)
index ffc09d2..0000000
+++ /dev/null
@@ -1,227 +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 <stdio.h>
-#include <errno.h>
-#include <assert.h>
-#include <sys/types.h>
-#include <dd-control.h>
-
-#include "core/log.h"
-#include "core/common.h"
-#include "core/devices.h"
-#include "core/edbus-handler.h"
-
-#define CONTROL_HANDLER_NAME           "control"
-#define CONTROL_GETTER_NAME                    "getcontrol"
-
-static const struct control_device {
-       const int id;
-       const char *name;
-} devices[] = {
-       /* Add id & ops to provide start/stop control */
-       { DEVICE_CONTROL_MMC,               "mmc" },
-       { DEVICE_CONTROL_USBCLIENT,   "usbclient" },
-       { DEVICE_CONTROL_BLOCK,           "block" },
-};
-
-static int control_handler(int argc, char **argv)
-{
-       int i;
-       int pid;
-       int device;
-       bool enable;
-       int ret;
-       const struct device_ops *dev_ops = NULL;
-
-       _I("argc : %d", argc);
-       for (i = 0; i < argc; ++i)
-               _I("[%2d] %s", i, argv[i]);
-
-       if (argc > 5) {
-               _E("Invalid argument");
-               errno = EINVAL;
-               return -1;
-       }
-
-       pid = atoi(argv[0]);
-       device = atoi(argv[1]);
-       enable = atoi(argv[2]);
-       _I("pid : %d, device : %d, enable :%d", pid, device, enable);
-
-       for (i = 0; i < ARRAY_SIZE(devices); i++)
-               if (devices[i].id == device)
-                       break;
-
-       if (i >= ARRAY_SIZE(devices))
-               return -EINVAL;
-       FIND_DEVICE_INT(dev_ops, devices[i].name);
-       if (enable)
-               ret = device_start(dev_ops);
-       else
-               ret = device_stop(dev_ops);
-
-       return ret;
-}
-
-static int get_control_handler(int argc, char **argv)
-{
-       int i;
-       int pid;
-       int device;
-       const struct device_ops *dev_ops = NULL;
-
-       _I("argc : %d", argc);
-       for (i = 0; i < argc; ++i)
-               _I("[%2d] %s", i, argv[i]);
-
-       if (argc > 4) {
-               _E("Invalid argument");
-               errno = EINVAL;
-               return -1;
-       }
-
-       pid = atoi(argv[0]);
-       device = atoi(argv[1]);
-       _I("pid : %d, device : %d", pid, device);
-
-       for (i = 0; i < ARRAY_SIZE(devices); i++)
-               if (devices[i].id == device)
-                       break;
-
-       if (i >= ARRAY_SIZE(devices))
-               return -EINVAL;
-
-       FIND_DEVICE_INT(dev_ops, devices[i].name);
-
-       return device_get_status(dev_ops);
-}
-
-
-static DBusMessage *dbus_control_handler(E_DBus_Object *obj, DBusMessage *msg)
-{
-       DBusError err;
-       DBusMessageIter iter;
-       DBusMessage *reply;
-       pid_t pid;
-       int ret;
-       int argc;
-       char *type_str;
-       char *argv[3];
-
-       dbus_error_init(&err);
-
-       if (!dbus_message_get_args(msg, &err,
-                   DBUS_TYPE_STRING, &type_str,
-                   DBUS_TYPE_INT32, &argc,
-                   DBUS_TYPE_STRING, &argv[0],
-                   DBUS_TYPE_STRING, &argv[1],
-                   DBUS_TYPE_STRING, &argv[2], DBUS_TYPE_INVALID)) {
-               _E("there is no message");
-               ret = -EINVAL;
-               goto out;
-       }
-
-       if (argc < 0) {
-               _E("message is invalid!");
-               ret = -EINVAL;
-               goto out;
-       }
-
-       pid = get_edbus_sender_pid(msg);
-       if (kill(pid, 0) == -1) {
-               _E("%d process does not exist, dbus ignored!", pid);
-               ret = -ESRCH;
-               goto out;
-       }
-
-       ret = control_handler(argc, (char **)&argv);
-out:
-       reply = dbus_message_new_method_return(msg);
-       dbus_message_iter_init_append(reply, &iter);
-       dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &ret);
-
-       return reply;
-}
-
-static DBusMessage *dbus_get_control_handler(E_DBus_Object *obj, DBusMessage *msg)
-{
-       DBusError err;
-       DBusMessageIter iter;
-       DBusMessage *reply;
-       pid_t pid;
-       int ret;
-       int argc;
-       char *type_str;
-       char *argv[2];
-
-       dbus_error_init(&err);
-
-       if (!dbus_message_get_args(msg, &err,
-                   DBUS_TYPE_STRING, &type_str,
-                   DBUS_TYPE_INT32, &argc,
-                   DBUS_TYPE_STRING, &argv[0],
-                   DBUS_TYPE_STRING, &argv[1], DBUS_TYPE_INVALID)) {
-               _E("there is no message");
-               ret = -EINVAL;
-               goto out;
-       }
-
-       if (argc < 0) {
-               _E("message is invalid!");
-               ret = -EINVAL;
-               goto out;
-       }
-
-       pid = get_edbus_sender_pid(msg);
-       if (kill(pid, 0) == -1) {
-               _E("%d process does not exist, dbus ignored!", pid);
-               ret = -ESRCH;
-               goto out;
-       }
-
-       ret = get_control_handler(argc, (char **)&argv);
-out:
-       reply = dbus_message_new_method_return(msg);
-       dbus_message_iter_init_append(reply, &iter);
-       dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &ret);
-
-       return reply;
-}
-
-static const struct edbus_method edbus_methods[] = {
-       { CONTROL_HANDLER_NAME, "sisss", "i", dbus_control_handler     },
-       { CONTROL_GETTER_NAME ,  "siss", "i", dbus_get_control_handler },
-};
-
-static void control_init(void *data)
-{
-       int ret;
-
-       ret = register_edbus_method(DEVICED_PATH_SYSNOTI, edbus_methods, ARRAY_SIZE(edbus_methods));
-       if (ret < 0)
-               _E("fail to init edbus method(%d)", ret);
-}
-
-static const struct device_ops control_device_ops = {
-       .name     = "control",
-       .init     = control_init,
-};
-
-DEVICE_OPS_REGISTER(&control_device_ops)
index 9082feae4374e76dd84646201892fc10f76fd158..c1cbb615fdb25e41e0924faa786e006e06645be9 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * deviced
+ * PASS
  *
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -25,7 +25,7 @@
 #include "core/device-notifier.h"
 #include "core/common.h"
 #include "core/edbus-handler.h"
-#include "shared/deviced-systemd.h"
+#include "shared/pass-systemd.h"
 
 #define SIGNAL_BOOTING_DONE            "BootingDone"
 
@@ -40,7 +40,7 @@ int booting_finished(void)
        int ret;
        size_t len;
 
-       ret = deviced_systemd_get_manager_property_as_string(
+       ret = pass_systemd_get_manager_property_as_string(
                        SYSTEMD_DBUS_IFACE_MANAGER,
                        SYSTEMD_DBUS_METHOD_SYSTEM_STATE,
                        &state);
index ff20faccde2e2cacfb8580a56624242077efe8df..7562e76877f842414df7f3043c48814e6fd0008c 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * deviced
+ * PASS
  *
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
  * limitations under the License.
  */
 
-#ifndef __DEVICED_BOOT_H__
-#define __DEVICED_BOOT_H__
+#ifndef __PASS_BOOT_H__
+#define __PASS_BOOT_H__
 
 int booting_finished(void);
 void add_booting_done_handler(void *data);
 void remove_booting_done_handler(void *data);
 
-#endif /* __DEVICED_BOOT_H__ */
+#endif /* __PASS_BOOT_H__ */
index 3cb598f219569c521f949125a7cd59aca86e332f..3d22461fe33b54c2be144497f71a36cda431b19f 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * deviced
+ * PASS
  *
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
 #include "log.h"
 #include "common.h"
 
-#define PERMANENT_DIR   "/tmp/permanent"
-#define VIP_DIR         "/tmp/vip"
-#define BUFF_MAX        255
-
-#define APP_ATTR_PATH "/proc/%d/attr/current"
-
-/**
- * Opens "/proc/$pid/oom_score_adj" file for w/r;
- * Return: FILE pointer or NULL
- */
-FILE *open_proc_oom_score_adj_file(int pid, const char *mode)
-{
-       char buf[32];
-       FILE *fp;
-
-       snprintf(buf, sizeof(buf), "/proc/%d/oom_score_adj", pid);
-       fp = fopen(buf, mode);
-       return fp;
-}
-
-int get_exec_pid(const char *execpath)
-{
-       DIR *dp;
-       struct dirent entry;
-       struct dirent *dentry;
-       int pid = -1, fd;
-       int ret;
-       int len;
-       char buf[PATH_MAX];
-       char buf2[PATH_MAX];
-
-       dp = opendir("/proc");
-       if (!dp) {
-               _E("FAIL: open /proc");
-               return -1;
-       }
-
-       len = strlen(execpath) + 1;
-       while (1) {
-               ret = readdir_r(dp, &entry, &dentry);
-               if (ret != 0 || dentry == NULL)
-                       break;
-
-               if (!isdigit(dentry->d_name[0]))
-                       continue;
-
-               pid = atoi(dentry->d_name);
-
-               snprintf(buf, PATH_MAX, "/proc/%d/cmdline", pid);
-               fd = open(buf, O_RDONLY);
-               if (fd < 0)
-                       continue;
-               ret = read(fd, buf2, PATH_MAX);
-               close(fd);
-
-               if (ret < 0 || ret >= PATH_MAX)
-                       continue;
-
-               buf2[ret] = '\0';
-
-               if (!strncmp(buf2, execpath, len)) {
-                       closedir(dp);
-                       return pid;
-               }
-       }
-
-       errno = ESRCH;
-       closedir(dp);
-       return -1;
-}
+#define BUFF_MAX       255
 
 int get_cmdline_name(pid_t pid, char *cmdline, size_t cmdline_size)
 {
@@ -144,86 +75,6 @@ int get_cmdline_name(pid_t pid, char *cmdline, size_t cmdline_size)
        return 0;
 }
 
-int is_vip(int pid)
-{
-       if (pid < 1)
-               return -1;
-
-       char buf[PATH_MAX];
-
-       snprintf(buf, PATH_MAX, "%s/%d", VIP_DIR, pid);
-
-       if (access(buf, R_OK) == 0)
-               return 1;
-       else
-               return 0;
-}
-
-static int remove_dir_internal(int fd)
-{
-       DIR *dir;
-       struct dirent entry;
-       struct dirent *de;
-       int subfd, ret = 0;
-
-       dir = fdopendir(fd);
-       if (!dir)
-               return -1;
-       while (1) {
-               ret = readdir_r(dir, &entry, &de);
-               if (ret != 0 || de == NULL)
-                       break;
-               if (de->d_type == DT_DIR) {
-                       if (!strncmp(de->d_name, ".", 2) || !strncmp(de->d_name, "..", 3))
-                               continue;
-                       subfd = openat(fd, de->d_name, O_RDONLY | O_DIRECTORY);
-                       if (subfd < 0) {
-                               _SE("Couldn't openat %s: %d\n", de->d_name, errno);
-                               ret = -1;
-                               continue;
-                       }
-                       if (remove_dir_internal(subfd))
-                               ret = -1;
-
-                       close(subfd);
-                       if (unlinkat(fd, de->d_name, AT_REMOVEDIR) < 0) {
-                               _SE("Couldn't unlinkat %s: %d\n", de->d_name, errno);
-                               ret = -1;
-                       }
-               } else {
-                       if (unlinkat(fd, de->d_name, 0) < 0) {
-                               _SE("Couldn't unlinkat %s: %d\n", de->d_name, errno);
-                               ret = -1;
-                       }
-               }
-       }
-       closedir(dir);
-       return ret;
-}
-
-int remove_dir(const char *path, int del_dir)
-{
-       int fd, ret = 0;
-
-       if (!path)
-               return -1;
-       fd = open(path, O_RDONLY | O_NONBLOCK | O_DIRECTORY | O_CLOEXEC | O_NOFOLLOW);
-       if (fd < 0) {
-               _SE("Couldn't opendir %s: %d\n", path, errno);
-               return -errno;
-       }
-       ret = remove_dir_internal(fd);
-       close(fd);
-
-       if (del_dir) {
-               if (rmdir(path)) {
-                       _SE("Couldn't rmdir %s: %d\n", path, errno);
-                       ret = -1;
-               }
-       }
-       return ret;
-}
-
 /*
  * Helper function
  * - Read from sysfs entry
@@ -332,79 +183,3 @@ int sys_set_str(char *fname, char *val)
 
        return r;
 }
-
-int terminate_process(const char *partition, bool force)
-{
-       const char *argv[7] = {"/usr/bin/fuser", "-m", "-k", "-s", NULL, NULL, NULL};
-       int argc;
-
-       if (force)
-               argv[4] = "-SIGKILL";
-       else
-               argv[4] = "-SIGTERM";
-       argv[5] = partition;
-       argc = sizeof(argv) / sizeof(argv[0]);
-       return run_child(argc, argv);
-}
-
-int mount_check(const char *path)
-{
-       int ret = false;
-       struct mntent *mnt;
-       const char *table = "/etc/mtab";
-       FILE *fp;
-       int len;
-
-       fp = setmntent(table, "r");
-       if (!fp)
-               return ret;
-
-       len = strlen(path) + 1;
-       while (1) {
-               mnt = getmntent(fp);
-               if (mnt == NULL)
-                       break;
-               if (!strncmp(mnt->mnt_dir, path, len)) {
-                       ret = true;
-                       break;
-               }
-       }
-       endmntent(fp);
-       return ret;
-}
-
-void print_time(const char *prefix)
-{
-       struct timeval tv;
-       struct tm tm;
-       struct tm *ret;
-       gettimeofday(&tv, NULL);
-       ret = localtime_r(&(tv.tv_sec), &tm);
-       if (ret)
-               _D("%s --> %d:%02d:%02d %d",
-                               prefix, tm.tm_hour, tm.tm_min, tm.tm_sec, tv.tv_usec);
-}
-
-int get_privilege(pid_t pid, char *name, size_t len)
-{
-       char path[PATH_MAX];
-       char attr[BUFF_MAX];
-       size_t attr_len;
-       FILE *fp;
-
-       snprintf(path, sizeof(path), APP_ATTR_PATH, pid);
-
-       fp = fopen(path, "r");
-       if (!fp)
-               return -errno;
-
-       attr_len = fread(attr, 1, sizeof(attr) - 1, fp);
-       fclose(fp);
-       if (attr_len == 0)
-               return -ENOENT;
-
-       attr[attr_len] = '\0';
-
-       snprintf(name, len, "%s", attr);
-       return 0;
-}
index c0096b8ba3f86ffc841055bb20d276d66cc9015c..86525cb85321c5e8285f9fc542db6a154048a8d4 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * deviced
+ * PASS
  *
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
index 4018b886d43558f9c6fab62e9b1bac7a3bb384be..3278efef203677178fa6866559acded5d5c5e72f 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * deviced
+ * PASS
  *
- * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
index 7df70e61ca343713c74a0704e8f6933bb65c06b4..66b72ecce9ee0e444864eb7d53b04b5795b5bb2a 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * deviced
+ * PASS
  *
- * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
index e399bf25be6eb5262a933cd266358c404f6c5a1e..79582a8b4c7077f921519f571389fcb85fcf65cd 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * deviced
+ * PASS
  *
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
index 411e4bbf49b717bcd655afa6f8934de4fc968a82..c3efc038d686a586d76f8ce16d8f0a6252728224 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * deviced
+ * PASS
  *
- * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2017 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.
index ff066c0c3faaa9cb5c6101f44d92d4b4f0f2cc01..e989c336fb2c8a0dc3aad410cf97ac74831de3ea 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * deviced
+ * PASS
  *
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
index cef4cb74b42de548111a3db8d5bbba23d6289ac3..4ac22bc7c94a604407190f25e8a2c5e3e4e0f05a 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * deviced
+ * PASS
  *
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2017 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.
 
 enum device_notifier_type {
        DEVICE_NOTIFIER_BOOTING_DONE,
-       DEVICE_NOTIFIER_LCD,
-       DEVICE_NOTIFIER_TA,
-       DEVICE_NOTIFIER_LOWBAT,
-       DEVICE_NOTIFIER_FULLBAT,
-       DEVICE_NOTIFIER_TOUCH_HARDKEY,
-       DEVICE_NOTIFIER_PROCESS_TERMINATED,
-       DEVICE_NOTIFIER_POWER_SUPPLY,
-       DEVICE_NOTIFIER_BATTERY_HEALTH,
-       DEVICE_NOTIFIER_BATTERY_PRESENT,
-       DEVICE_NOTIFIER_BATTERY_OVP,
-       DEVICE_NOTIFIER_BATTERY_CHARGING,
-       DEVICE_NOTIFIER_DISPLAY_LOCK,
-       DEVICE_NOTIFIER_POWER_RESUME,
-       DEVICE_NOTIFIER_POWEROFF,
-       DEVICE_NOTIFIER_POWEROFF_HAPTIC,
-       DEVICE_NOTIFIER_PMQOS_OOM,
        DEVICE_NOTIFIER_PMQOS,
-       DEVICE_NOTIFIER_PROCESS_BACKGROUND,
-       DEVICE_NOTIFIER_PROCESS_FOREGROUND,
-       DEVICE_NOTIFIER_USB_TETHERING_MODE,
+       DEVICE_NOTIFIER_POWEROFF,
        DEVICE_NOTIFIER_MAX,
 };
 
index 3ff5a8d04422fd814363d92cec7f781b54c1c15a..837f656e877516c3fd956688d097f87e7738353d 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * deviced
+ * PASS (Power Aware System Service)
  *
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
index c49499accf4f93a768fac1f57ad8dca8c9711640..d7b8d9a8bdfea655ee3f984c533a38034104df88 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * deviced
+ * PASS
  *
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -30,18 +30,6 @@ enum device_priority {
 
 enum device_flags {
        NORMAL_MODE                   = 0x00000001,
-       CORE_LOGIC_MODE               = 0x00010000,
-       TOUCH_SCREEN_OFF_MODE         = 0x00020000,
-       LCD_PANEL_OFF_MODE            = 0x00040000,
-       LCD_PHASED_TRANSIT_MODE       = 0x00080000,
-       LCD_ON_BY_GESTURE             = 0x00100000,
-       LCD_ON_BY_POWER_KEY           = 0x00200000,
-       LCD_ON_BY_EVENT               = 0x00400000,
-       LCD_ON_BY_TOUCH               = 0x00800000,
-       LCD_OFF_BY_POWER_KEY          = 0x01000000,
-       LCD_OFF_BY_TIMEOUT            = 0x02000000,
-       LCD_OFF_BY_EVENT              = 0x04000000,
-       LCD_OFF_LATE_MODE             = 0x08000000,
 };
 
 struct device_ops {
index aa36b5fa1a84624029972f0e0fc5b0984ee17c25..eec24613a43d90e03c2d0cc29259f472837737e6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * deviced
+ * PASS
  *
  * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
  *
@@ -48,13 +48,7 @@ static struct edbus_object {
        E_DBus_Interface *iface;
 } edbus_objects[] = {
        { DEVICED_PATH_CORE   , DEVICED_INTERFACE_CORE   , NULL, NULL },
-       { DEVICED_PATH_DISPLAY, DEVICED_INTERFACE_DISPLAY, NULL, NULL },
-       { DEVICED_PATH_POWER  , DEVICED_INTERFACE_POWER  , NULL, NULL },
-       { DEVICED_PATH_STORAGE, DEVICED_INTERFACE_STORAGE, NULL, NULL },
-       { DEVICED_PATH_PROCESS, DEVICED_INTERFACE_PROCESS, NULL, NULL },
-       { DEVICED_PATH_KEY    , DEVICED_INTERFACE_KEY    , NULL, NULL },
        { DEVICED_PATH_SYSNOTI, DEVICED_INTERFACE_SYSNOTI, NULL, NULL },
-       { DEVICED_PATH_USB    , DEVICED_INTERFACE_USB    , NULL, NULL },
        { DEVICED_PATH_PMQOS  , DEVICED_INTERFACE_PMQOS    , NULL, NULL },
        /* Add new object & interface here*/
 };
@@ -1055,19 +1049,6 @@ void edbus_init(void *data)
                retry++;
        } while (retry <= EDBUS_INIT_RETRY_COUNT);
 
-       retry = 0;
-       do {
-               edbus_request_name = e_dbus_request_name(edbus_conn_block, STORAGE_BUS_NAME,
-                               DBUS_NAME_FLAG_REPLACE_EXISTING, request_name_cb, NULL);
-               if (edbus_request_name)
-                       break;
-               if (retry == EDBUS_INIT_RETRY_COUNT) {
-                       _E("fail to request edbus name");
-                       goto out3;
-               }
-               retry++;
-       } while (retry <= EDBUS_INIT_RETRY_COUNT);
-
        for (i = 0; i < ARRAY_SIZE(edbus_objects); i++) {
                ret = register_edbus_interface(&edbus_objects[i]);
                if (ret < 0) {
index 17eb9560e5c6f42d52b644f54f5be4f9f56a622b..13224af016744120ac4aab5bebf0d3ec30d0e776 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * deviced
+ * PASS
  *
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
index 1996c4dd2d0541b4ebe3a2736758b6392126e196..224ea58cb0b2b51ac60ca0868f20f5407013dd6b 100755 (executable)
@@ -1,7 +1,7 @@
 /*
- * deviced
+ * PASS
  *
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
diff --git a/src/core/launch.c b/src/core/launch.c
deleted file mode 100644 (file)
index f481357..0000000
+++ /dev/null
@@ -1,338 +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 <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <signal.h>
-#include <string.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <vconf.h>
-
-#include "log.h"
-#include "launch.h"
-#include "common.h"
-
-#define MAX_ARGS 255
-
-#define _S(str) ((str == NULL) ? "" : str)
-
-static int set_current_lang(void)
-{
-       char *lang;
-       int ret;
-
-       lang = vconf_get_str(VCONFKEY_LANGSET);
-       if (lang == NULL)
-               return -1;
-       ret = setenv("LANG", lang, 1);
-       if (ret < 0)
-               return -1;
-       free(lang);
-       return 0;
-}
-
-
-static void prepare_exec(void)
-{
-       int i;
-       int maxfd;
-
-       maxfd = getdtablesize();
-       for (i = 3; i < maxfd; i++)
-               close(i);
-
-       for (i = 0; i < _NSIG; i++)
-               signal(i, SIG_DFL);
-}
-
-static int parse_cmd(const char *cmdline, char **argv, int max_args)
-{
-       const char *p;
-       char *buf, *bufp;
-       int nargs = 0;
-       int escape = 0, squote = 0, dquote = 0;
-       int bufsize;
-
-       if (cmdline == NULL || cmdline[0] == '\0')
-               return -1;
-       bufsize = strlen(cmdline)+1;
-       bufp = buf = malloc(bufsize);
-       if (bufp == NULL || buf == NULL)
-               return -1;
-       memset(buf, 0, bufsize);
-       p = cmdline;
-
-       while (*p) {
-               if (escape) {
-                       *bufp++ = *p;
-                       escape = 0;
-               } else {
-                       switch (*p) {
-                       case '\\':
-                               escape = 1;
-                               break;
-                       case '"':
-                               if (squote)
-                                       *bufp++ = *p;
-                               else
-                                       dquote = !dquote;
-                               break;
-                       case '\'':
-                               if (dquote)
-                                       *bufp++ = *p;
-                               else
-                                       squote = !squote;
-                               break;
-                       case ' ':
-                               if (!squote && !dquote) {
-                                       *bufp = '\0';
-                                       if (nargs < max_args)
-                                               argv[nargs++] = strdup(buf);
-                                       bufp = buf;
-                                       break;
-                               }
-                       default:
-                               *bufp++ = *p;
-                               break;
-                       }
-               }
-               p++;
-       }
-
-       if (bufp != buf) {
-               *bufp = '\0';
-               if (nargs < max_args)
-                       argv[nargs++] = strdup(buf);
-       }
-
-       argv[nargs++] = NULL;
-
-       free(buf);
-       return nargs;
-}
-
-int launch_app_with_nice(const char *file, char *const argv[], pid_t *pid, int _nice)
-{
-       int ret;
-       int _pid;
-
-       if (file == NULL || access(file, X_OK) != 0) {
-               _E("launch app error: Invalid input");
-               errno = EINVAL;
-               return -1;
-       }
-
-       if (pid && (*pid > 0 && kill(*pid, 0) != -1))
-               return *pid;
-
-       _pid = fork();
-
-       if (_pid == -1) {
-               _E("fork error: %d", errno);
-               /* keep errno */
-               return -1;
-       }
-
-       if (_pid > 0) {     /* parent */
-               if (pid)
-                       *pid = _pid;
-               return _pid;
-       }
-
-       /* child */
-       prepare_exec();
-
-       ret = nice(_nice);
-
-       if (ret == -1 && errno != 0)
-               _E("nice error: %d", errno);
-
-       ret = execvp(file, argv);
-
-       /* If failed... */
-       _E("exec. error: %s", errno);
-       return -2;
-}
-
-int launch_app_cmd_with_nice(const char *cmdline, int _nice)
-{
-       int i;
-       int nargs;
-       int ret;
-       char *argv[MAX_ARGS + 1];
-
-       nargs = parse_cmd(cmdline, argv, MAX_ARGS + 1);
-       if (nargs == -1) {
-               _E("launch app error: Invalid input");
-               errno = EINVAL;
-               return -1;
-       }
-
-       ret = launch_app_with_nice(argv[0], argv, NULL, _nice);
-
-       for (i = 0; i < nargs; i++)
-               free(argv[i]);
-
-       return ret;
-}
-
-int launch_app_cmd(const char *cmdline)
-{
-       return launch_app_cmd_with_nice(cmdline, 0);
-}
-
-int launch_if_noexist(const char *execpath, const char *arg, ...)
-{
-       char *buf;
-       int pid;
-       int nice_value = 0;
-       int flag = 0;
-       int buf_size = -1;
-       va_list argptr;
-
-       if (execpath == NULL) {
-               errno = EINVAL;
-               return -1;
-       }
-       pid = get_exec_pid(execpath);
-       if (pid > 0)
-               return pid;
-
-       va_start(argptr, arg);
-       flag = va_arg(argptr, int);
-
-       if (flag & LAUNCH_NICE)
-               nice_value = va_arg(argptr, int);
-
-       va_end(argptr);
-
-       set_current_lang();
-       arg = _S(arg);
-
-       buf_size = strlen(execpath) + strlen(arg) + 10;
-       buf = malloc(buf_size);
-       if (buf == NULL) {
-               /* Do something for not enought memory error */
-               _E("Malloc failed");
-               return -1;
-       }
-
-       snprintf(buf, buf_size, "%s %s", execpath, arg);
-       pid = launch_app_cmd_with_nice(buf, nice_value);
-       if (pid == -2)
-               exit(EXIT_FAILURE);
-       free(buf);
-
-       return pid;
-}
-
-int launch_evenif_exist(const char *execpath, const char *arg, ...)
-{
-       char *buf;
-       int pid;
-       int nice_value = 0;
-       int flag = 0;
-       int buf_size = -1;
-
-       va_list argptr;
-
-       if (execpath == NULL) {
-               errno = EINVAL;
-               return -1;
-       }
-
-       va_start(argptr, arg);
-       flag = va_arg(argptr, int);
-
-       if (flag & LAUNCH_NICE)
-               nice_value = va_arg(argptr, int);
-
-       va_end(argptr);
-
-       set_current_lang();
-
-       arg = _S(arg);
-
-       buf_size = strlen(execpath) + strlen(arg) + 10;
-       buf = malloc(buf_size);
-       if (buf == NULL) {
-               _E("Malloc failed");
-               return -1;
-       }
-
-       snprintf(buf, buf_size, "%s %s", execpath, arg);
-       pid = launch_app_cmd_with_nice(buf, nice_value);
-       if (pid == -2)
-               exit(EXIT_FAILURE);
-       free(buf);
-
-       return pid;
-}
-
-int launch_after_kill_if_exist(const char *execpath, const char *arg, ...)
-{
-       char *buf;
-       int pid;
-       int flag;
-       int buf_size;
-       int exist_pid;
-       va_list argptr;
-       int nice_value = 0;
-
-       if (execpath == NULL) {
-               errno = EINVAL;
-               return -1;
-       }
-
-       exist_pid = get_exec_pid(execpath);
-       if (exist_pid > 0)
-               kill(exist_pid, SIGTERM);
-
-       va_start(argptr, arg);
-       flag = va_arg(argptr, int);
-
-       if (flag & LAUNCH_NICE)
-               nice_value = va_arg(argptr, int);
-
-       va_end(argptr);
-
-       set_current_lang();
-
-       arg = _S(arg);
-
-       buf_size = strlen(execpath) + strlen(arg) + 10;
-       buf = malloc(buf_size);
-       if (buf == NULL) {
-               /* Do something for not enought memory error */
-               _E("Malloc Failed");
-               return -1;
-       }
-
-       snprintf(buf, buf_size, "%s %s", execpath, arg);
-       pid = launch_app_cmd_with_nice(buf, nice_value);
-       if (pid == -2)          /* It means that the 'execvp' return -1 */
-               exit(EXIT_FAILURE);
-       free(buf);
-
-       return pid;
-
-}
diff --git a/src/core/launch.h b/src/core/launch.h
deleted file mode 100644 (file)
index 7c6d0dd..0000000
+++ /dev/null
@@ -1,32 +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.
- */
-
-
-#ifndef __LAUNCH_H__
-#define __LAUNCH_H__
-
-#define LAUNCH_NICE          0x0002
-
-int launch_if_noexist(const char *execpath, const char *arg, ...);
-int launch_evenif_exist(const char *execpath, const char *arg, ...);
-int launch_after_kill_if_exist(const char *execpath, const char *arg, ...);
-
-int launch_app_cmd(const char *cmdline);
-int launch_app_cmd_with_nice(const char *cmdline, int _nice);
-
-#endif /* __LAUNCH_H__ */
index 9555737494d10db4c42091497646f91b8608e73c..c57452a140cd675d95a9c4cf9d49612fb31658c9 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * deviced
+ * PASS
  *
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2017 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.
index 86310cdf1637ba54b8cc9960c009dce89a0f4739..2a91d05f77a0167d207d7500f70c291fe4270d4e 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * deviced
+ * PASS
  *
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
index f3c3bea9c166014db967a5ed7843438d7f00f36a..74b866ac44d40d66fc2c8858ed11e846e23a777c 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * deviced
+ * PASS
  *
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -20,7 +20,7 @@
 #ifndef __LOG_H__
 #define __LOG_H__
 
-#ifdef ENABLE_DEVICED_DLOG
+#ifdef ENABLE_PASS_DLOG
 #define ENABLE_DLOG
 #endif
 
index c9de427dd6c27c5016cf84c70136533570c3b578..78e9680af55c0f84b3d950872bef1626212ca6af 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * deviced
+ * PASS (Power Aware System Service)
  *
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -29,7 +29,7 @@
 #include "boot.h"
 #include "device-notifier.h"
 
-#define PIDFILE_PATH           "/var/run/.deviced.pid"
+#define PIDFILE_PATH           "/var/run/.pass.pid"
 
 static void writepid(char *pidpath)
 {
@@ -49,12 +49,12 @@ static void sig_quit(int signo)
 
 static void sig_usr1(int signo)
 {
-       _D("received SIGUSR1 signal %d, deviced'll be finished!", signo);
+       _D("received SIGUSR1 signal %d, PASS'll be finished!", signo);
 
        ecore_main_loop_quit();
 }
 
-static int deviced_main(int argc, char **argv)
+static int pass_main(int argc, char **argv)
 {
        int ret;
 
@@ -81,5 +81,5 @@ int main(int argc, char **argv)
 {
        writepid(PIDFILE_PATH);
        ecore_init();
-       return deviced_main(argc, argv);
+       return pass_main(argc, argv);
 }
index 17b0dfc14e19f6ed3269d629bf99343abe9f8d5b..9d31cc2fa0c10ad15b14cf625fa97e267c84cac3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * deviced
+ * PASS
  *
  * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
  *
index f11ea9bc147e85f158a381a542ee1fc25c6979c0..71d72be761e3e6315f000c219d3893107bb22085 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * deviced
+ * PASS (Power Aware System Service)
  *
- * Copyright (c) 2012 - 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
index 494e90550e99f658fdabe031e43bc6a579ce3047..66fc130d07ce19984f03ad36b9dad71423468603 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * deviced
+ * PASS
  *
- * Copyright (c) 2012 - 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
 #define UDEV_DEVPATH            "DEVPATH"
 #define UDEV_DEVTYPE            "DEVTYPE"
 
-/* battery device */
-#define POWER_SUBSYSTEM         "power_supply"
-#define POWER_PATH              "/sys/class/power_supply/battery"
-#define POWER_SUPPLY_UEVENT     POWER_PATH"/uevent"
-#define CAPACITY                "POWER_SUPPLY_CAPACITY"
-#define CHARGE_HEALTH           "POWER_SUPPLY_HEALTH"
-#define CHARGE_PRESENT          "POWER_SUPPLY_PRESENT"
-#define CHARGE_NAME             "POWER_SUPPLY_NAME"
-#define CHARGE_STATUS           "POWER_SUPPLY_STATUS"
-#define CHARGE_ONLINE           "POWER_SUPPLY_ONLINE"
-
-/* extcon */
-#define EXTCON_SUBSYSTEM        "extcon"
-
-/* usb */
-#define USB_SUBSYSTEM           "usb"
-#define USB_INTERFACE_DEVTYPE   "usb_interface"
-#define USB_DEVICE_DEVTYPE      "usb_device"
-
-/* block */
-#define BLOCK_SUBSYSTEM         "block"
-#define BLOCK_DEVTYPE_DISK      "disk"
-#define BLOCK_DEVTYPE_PARTITION "partition"
-
-/* power supply status */
-enum {
-       POWER_SUPPLY_STATUS_UNKNOWN = 0,
-       POWER_SUPPLY_STATUS_CHARGING,
-       POWER_SUPPLY_STATUS_DISCHARGING,
-       POWER_SUPPLY_STATUS_NOT_CHARGING,
-       POWER_SUPPLY_STATUS_FULL,
-};
-
-enum {
-        POWER_SUPPLY_TYPE_UNKNOWN = 0,
-        POWER_SUPPLY_TYPE_BATTERY,
-        POWER_SUPPLY_TYPE_UPS,
-        POWER_SUPPLY_TYPE_MAINS,
-        POWER_SUPPLY_TYPE_USB,
-};
-
-enum dock_type {
-       DOCK_NONE   = 0,
-       DOCK_SOUND  = 7,
-};
-
 struct uevent_handler {
        char *subsystem;
        void (*uevent_func)(struct udev_device *dev);
diff --git a/src/deviced/dd-common.h b/src/deviced/dd-common.h
deleted file mode 100644 (file)
index fdfc2ac..0000000
+++ /dev/null
@@ -1,39 +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.
- */
-
-
-#ifndef __DD_COMMON_H__
-#define __DD_COMMON_H__
-
-/**
- * @file        dd-common.h
- * @ingroup     CAPI_SYSTEM_DEVICED
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef DEPRECATED
-#define DEPRECATED __attribute__((deprecated))
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-#endif                         /* __DD_COMMON_H__ */
diff --git a/src/deviced/dd-control.h b/src/deviced/dd-control.h
deleted file mode 100644 (file)
index 120ed6c..0000000
+++ /dev/null
@@ -1,103 +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.
- */
-
-
-#ifndef __DD_CONTROL_H__
-#define __DD_CONTROL_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdbool.h>
-
-/**
- * @file        dd-control.h
- * @defgroup    CAPI_SYSTEM_DEVICED_CONTROL_MODULE Control
- * @ingroup     CAPI_SYSTEM_DEVICED
- * @brief       This file provides the API to enable/disable devices
- * @section CAPI_SYSTEM_DEVICED_CONTROL_MODULE_HEADER Required Header
- *   \#include <dd-control.h>
- */
-
-/**
- * @addtogroup CAPI_SYSTEM_DEVICED_CONTROL_MODULE
- * @{
- */
-
-/**
- * @par Description
- * Control Device type
- */
-enum control_device_type {
-/* Add device define here  */
-       DEVICE_CONTROL_MMC,
-       DEVICE_CONTROL_USBCLIENT,
-       DEVICE_CONTROL_BLOCK,
-       DEVICE_CONTROL_MAX,
-};
-
-/**
- * @par Description:
- *  This API is used to enable/disable mmc device.\n
- * @param[in] enable enable/disable mmc device
- * @return 0 on success, -1 if failed
- * @par Example
- * @code
- *  ...
- *  if( deviced_mmc_control(1) < 0 )
- *      printf("Enable mmc device failed\n");
- *  ...
- * @endcode
- */
-int deviced_mmc_control(bool enable);
-
-/**
- * @par Description:
- *  This API is used to enable/disable usb device.\n
- * @param[in] enable enable/disable usb device
- * @return 0 on success, -1 if failed
- * @par Example
- * @code
- *  ...
- *  if( deviced_usb_control(1) < 0 )
- *      printf("Enable usb device failed\n");
- *  ...
- * @endcode
- */
-int deviced_usb_control(bool enable);
-
-/* Only USB-manager will use the api */
-/**
- * @par Description:
- * @return
- * @par Example
- * @code
- * @endcode
- * @todo describe function
- */
-int deviced_get_usb_control(void);
-
-/**
- * @} // end of CAPI_SYSTEM_DEVICED_CONTROL_MODULE
- */
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/src/deviced/dd-deviced-managed.h b/src/deviced/dd-deviced-managed.h
deleted file mode 100644 (file)
index ba0af77..0000000
+++ /dev/null
@@ -1,65 +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.
- */
-
-
-#ifndef __DD_DEVICED_MANAGED_H__
-#define __DD_DEVICED_MANAGED_H__
-
-#include <sys/time.h>
-#include "dd-mmc.h"
-
-/**
- * @file        dd-deviced-managed.h
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup CAPI_SYSTEM_DEVICED
- * @{
- */
-
-/**
- * @fn int deviced_get_pid(const char *execpath)
- * @brief This API is used to get the pid of the process which has the specified execpath.\n
- *             Internally, this API searches /proc/{pid}/cmdline and compares the parameter execpath with 1st argument of cmdline. \n
- *             If there is no process that has same execpath in /proc/{pid}/cmdline, it will return -1.
- * @param[in] execpath program path which you want to know whether it is run or not
- * @return pid when the program is running, -1 if it is not.
- */
-int deviced_get_pid(const char *execpath);
-
-/**
- * @fn int deviced_set_datetime(time_t timet)
- * @brief This API is used to set date time.\n
- *             Internally, this API call predefined action API. That is send a notify message. \n
- * @param[in] timet type of time which you want to set.
- * @return pid when the program is running, -1 if param is less than 0 or when failed set datetime.
- */
-int deviced_set_datetime(time_t timet);
-
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __DD_DEVICED_MANAGED_H__ */
diff --git a/src/deviced/dd-deviced.h b/src/deviced/dd-deviced.h
deleted file mode 100644 (file)
index be62a03..0000000
+++ /dev/null
@@ -1,362 +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.
- */
-
-
-#ifndef __DD_DEVICED__
-#define __DD_DEVICED__
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include "dd-deviced-managed.h"
-
-/**
- * @file        dd-deviced.h
- * @defgroup    CAPI_SYSTEM_DEVICED_UTIL_MODULE Util
- * @ingroup     CAPI_SYSTEM_DEVICED
- * @section CAPI_SYSTEM_DEVICED_UTIL_MODULE_HEADER Required Header
- *   \#include <dd-deviced.h>
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup CAPI_SYSTEM_DEVICED_UTIL_MODULE
- * @{
- */
-
-/**
- * @brief Policy for low memory
- */
-enum mem_policy {
-       OOM_LIKELY,     /**< For miscellaneous applications */
-       OOM_IGNORE      /**< For daemons */
-};
-
-/* deviced_util */
-
-/**
- * @fn int deviced_get_cmdline_name(pid_t pid, char *cmdline, size_t cmdline_size)
- * @brief This API is used to get the file name of command line of the process from the proc fs.
- *             Caller process MUST allocate enough memory for the cmdline parameter. \n
- *             Its size should be assigned to cmdline_size. \n
- *             Internally it reads the 1st argument of /proc/{pid}/cmdline and copies it to cmdline.
- * @param[in] pid pid of the process that you want to get the file name of command line
- * @param[out] cmdline command line of the process that you want to get the file name <br>
- *                     Callers should allocate memory to this parameter before calling this function.
- *                     The allocated memory size must be large enough to store the file name.
- *                     The result will include the terminating null byte('\0') at the end of the string.
- * @param[in] cmdline_size
- * @return 0 on success, negative value if failed.\n
- *         If the size of cmdline is smaller than the result, it will return -75 and  \n
- *         errno will be set as EOVERFLOW. \n
- *         If the function cannot open /proc/%d/cmdline file then it will return -3 and \n
- *         errno will be set as ESRCH.
- */
-int deviced_get_cmdline_name(pid_t pid, char *cmdline,
-                                   size_t cmdline_size);
-
-/**
- * @fn int deviced_get_apppath(pid_t pid, char *app_path, size_t app_path_size)
- * @brief This API is used to get the execution path of the process specified by the pid parameter.\n
- *             Caller process MUST allocate enough memory for the app_path parameter. \n
- *             Its size should be assigned to app_path_size. \n
- *             Internally it reads a link of /proc/{pid}/exe and copies the path to app_path.
- * @param[in] pid pid of the process that you want to get the executed path
- * @param[out] app_path the executed file path of the process <br>
- *                     Callers should allocate memory to this parameter before calling this function.
- *                     The allocated memory size must be large enough to store the executed file path.
- *                     The result will include the terminating null byte('\0') at the end of the string.
- * @param[in] app_path_size allocated memory size of char *app_path
- * @return 0 on success, -1 if failed. \n
- *         If the size of app_path is smaller than the result, it will return -1 and \n
- *         errno will be set as EOVERFLOW.
- */
-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_conf_set_permanent(void)
- * @brief This API is used to set itself as a permanent process.\n
- *             If the permanent process is dead, system server will relaunch the process automatically.
- * @return 0 on success, -1 if failed.
- * @see deviced_conf_set_permanent_bypid()
- * @par Example
- * @code
- *  ...
- *  ret = deviced_conf_set_permanent();
- *  if( ret < 0 )
- *      printf("Fail to set a process as permanent\n");
- *  ...
- * @endcode
- */
-int deviced_conf_set_permanent(void);
-
-/**
- * @fn int deviced_conf_set_permanent_bypid(pid_t pid)
- * @brief This API is used to set a given process as permanent.\n
- *       If the permanent process is dead, system server will relaunch the process automatically.
- * @param[in] pid proces id
- * @return 0 on success, -1 if failed.
- * @see deviced_set_permanent()
- * @par Example
- * @code
- *  ...
- *  ret = deviced_conf_set_permanent_bypid(pid);
- *  if( ret < 0 )
- *      printf("Fail to set a process(%d) as permanent\n",pid);
- *  ...
- * @endcode
- */
-int deviced_conf_set_permanent_bypid(pid_t pid);
-
-/**
- * @fn int deviced_conf_set_vip(pid_t pid)
- * @brief This API is used to set a process which has pid as Very Important Process(VIP) .\n
- *             If the VIP process is dead, restarter program will be run. \n
- *             Restarter program may kill almost processes and run rc.local scripts again.
- * @param[in] pid process id to be vip
- * @return 0 on success, -1 if failed.
- * @see sysconf_is_vip
- * @par Example
- * @code
- *     ...
- *     ret = deviced_conf_set_vip(pid);
- *     if( ret < 0 )
- *             printf("Fail to set a process(%d) as VIP\n",pid);
- *     ...
- * @endcode
- */
-int deviced_conf_set_vip(pid_t pid);
-
-/**
- * @fn int deviced_conf_is_vip(pid_t pid)
- * @brief This API is used to verify that process which has pid is Very Important Process(VIP) or not.
- * @param[in] pid process id to be vip
- * @return 1 if given process if vip process, otherwise 0 is returned.
- * @see deviced_conf_set_vip
- * @par Example
- * @code
- *     ...
- *     ret = deviced_conf_is_vip(pid);
- *     if(ret)
- *             printf("process(%d) is Very Important Process\n",pid);
- *     ...
- * @endcode
- */
-int deviced_conf_is_vip(pid_t pid);
-
-/**
- * @fn int deviced_set_timezone(char *tzpath_str)
- * @brief This API sets system timezone.
- * @param[in] tzpath_str path to timezone definition file
- * @return 0 on success, negative value 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_set_timezone(char *tzpath_str);
-
-/**
- * @fn int deviced_call_predef_action(const char *type, int num, ...)
- * @brief This API calls predefined systemd action.
- *             Internally it send message through SYSTEM_NOTI_SOCKET_PATH (/tmp/sn) UNIX socket to systemd.
- * @param[in] type systemd action type name
- * @param[in] num input parameters count. num cannot exceed SYSTEM_NOTI_MAXARG (16).
- * @param[in] ... action input parameters. List of the parameters depends on action type.
- * @return 0 on success, -1 if failed.
- *         If the action type is not set (is blank) or num > SYSTEM_NOTI_MAXARG it will return -1
- *         and errno will be set as EINVAL.
- */
-int deviced_call_predef_action(const char *type, int num, ...);
-
-/**
- * @fn int deviced_change_flightmode(int mode)
- * @brief This API call notifies about flight mode.
- * @return 0 or positive value on success and negative value 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_change_flightmode(int mode);
-
-/**
- * @fn int deviced_inform_foregrd(void)
- * @brief This API call notifies that current process is running in foreground.
- * @return 0 or positive value on success and negative value 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_inform_foregrd(void);
-
-/**
- * @fn int deviced_inform_backgrd(void)
- * @brief This API call notifies that current process is running in background.
- * @return 0 or positive value on success and negative value 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_inform_backgrd(void);
-
-/**
- * @fn int deviced_inform_active(pid_t pid)
- * @brief This API call notifies deviced daemon that given process (pid) is active.
- * @param[in] pid process pid
- * @return 0 or positive value on success and negative value 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_inform_active(pid_t pid);
-
-/**
- * @fn int deviced_inform_active(pid_t pid)
- * @brief This API call notifies deviced daemon that given process (pid) is inactive.
- * @param[in] pid process pid
- * @return 0 or positive value on success and negative value 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_inform_inactive(pid_t pid);
-
-/**
- * @fn int deviced_request_poweroff(void)
- * @brief This API call requests deviced daemon to launch "system poweroff popup".
- * @return 0 or positive value on success and negative value 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_request_poweroff(void);
-
-/**
- * @fn deviced_request_entersleep(void)
- * @brief This API call requests deviced daemon to enter system into sleep mode.
- * @return 0 or positive value on success and negative value if failed.
- * @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_request_entersleep(void);
-
-/**
- * @fn int deviced_request_leavesleep(void)
- * @brief This API calls requests deviced daemon to leave by system "sleep" mode and enter into "normal" mode.
- * @return 0 or positive value on success and negative value if failed.
- * @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_request_leavesleep(void);
-
-/**
- * @fn int deviced_request_reboot(void)
- * @brief This API call requests deviced daemon to initiate system reboot.
- * @return 0 on success and negative value if failed.
- * @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_request_reboot(void);
-
-/**
- * @fn int deviced_request_set_cpu_max_frequency(int val)
- * @brief This API call requests deviced daemon to set maximum CPU frequency.
- * @param[in] val maximum CPU frequency to be set.
- * @return 0 or positive value on success and negative value if failed.
- * @retval -1 operation error
- * @retval -EBADMSG - dbus error (in case of any error on the bus)
- */
-int deviced_request_set_cpu_max_frequency(int val);
-
-/**
- * @fn int deviced_request_set_cpu_min_frequency(int val)
- * @brief This API call requests deviced daemon to set minimum CPU frequency.
- * @param[in] val minimum CPU frequency to be set
- * @return 0 or positive value on success and negative value if failed.
- * @retval -1 operation error
- * @retval -EBADMSG dbus error (in case of any error on the bus)
- */
-int deviced_request_set_cpu_min_frequency(int val);
-
-/**
- * @fn int deviced_release_cpu_max_frequency(void)
- * @brief This API call releases limit of maximum CPU frequency set by deviced_request_set_cpu_max_frequency() API.
- * @return 0 or positive value on success and negative value if failed.
- * @retval -1 operation error
- * @retval -EBADMSG dbus error (in case of any error on the bus)
- */
-int deviced_release_cpu_max_frequency(void);
-
-/**
- * @fn int deviced_release_cpu_min_frequency(void)
- * @brief This API calls releases limit of minimum CPU frequency set by deviced_request_set_cpu_min_frequency() API.
- * @return 0 or positive value on success and negative value if failed.
- * @retval -1 operation error
- * @retval -EBADMSG dbus error (in case of any error on the bus)
- */
-int deviced_release_cpu_min_frequency(void);
-
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-#endif                         /* __DD_DEVICED__ */
diff --git a/src/deviced/deviced_doc.h b/src/deviced/deviced_doc.h
deleted file mode 100644 (file)
index 6a478a3..0000000
+++ /dev/null
@@ -1,42 +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.
- */
-
-
-#ifndef __TIZEN_SYSTEM_DEVICED_DOC_H__
-#define __TIZEN_SYSTEM_DEVICED_DOC_H__
-
-/**
- * @defgroup CAPI_SYSTEM_DEVICED deviced
- * @brief  The deviced APIs provide functions to control devices.
- * @ingroup CAPI_SYSTEM_FRAMEWORK
- * @section CAPI_SYSTEM_DEVICED_HEADER Required Header
- *   \#include <dd-deviced-managed.h>
- *
- * @section CAPI_SYSTEM_SYSTEM_DEVICED_OVERVIEW Overview
- * Provides access to a set of device like battery, display, haptic, LED, etc.
- * The state of the device is changed or obtained by using APIs provided.
- *
- * - battery percentage, full charging state, etc.
- * - brightness control, enhance mode setting, display lock/unlock, etc.
- * - haptic play
- * - service led control
- * - other devices
- *
- */
-
-#endif /* __TIZEN_SYSTEM_DEVICED_DOC_H__ */
index 34b143cd3200c2d41faa61f52cf426b0495479d9..d1067be9db1dc5c4908a9cc07d340691e1b046ab 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * deviced
+ * PASS (Power Aware System Service)
  *
- * Copyright (c) 2012 - 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2012 - 2017 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.
@@ -32,9 +32,9 @@
 #define PASS_CPU_STATS_MAX_COUNT       20
 
 /*
- * FIXME: Current notifier of deviced didn't pass separate user_data parameter
+ * FIXME: Current notifier of PASS didn't pass separate user_data parameter
  * on callback function. So, PASS must need global pass_policy instance. This
- * code must be modified after changing deviced's notifier feature.
+ * code must be modified after changing PASS's notifier feature.
  */
 static struct pass_policy *policy_pmqos[PASS_CLUSTER_MAX];
 static int num_policy_pmqos = 0;
@@ -112,9 +112,9 @@ static int pass_notifier_init(struct pass_policy *policy)
                          pass_notifier_booting_done);
 
        /*
-        * FIXME: Current notifier of deviced didn't pass separate user_data
+        * FIXME: Current notifier of PASS didn't pass separate user_data
         * parameter on callback function. So, PASS must need global pass_policy
-        * instance. This code must be modified after changing deviced's
+        * instance. This code must be modified after changing PASS's
         * notifier feature.
         */
        policy_pmqos[num_policy_pmqos++] = policy;
index 78defab9db5a8b3f4f761c5236589835b5ec851b..bbec55875aa8558674132900ec76af4da1c0959e 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * deviced
+ * PASS (Power Aware System Service)
  *
- * Copyright (c) 2012 - 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2012 - 2017 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.
index c4039598dc5899eced3b712703e67821e4a467b5..27b0b4ae92bf4ebcf41cd1117ebba0579f6f1137 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * deviced
+ * PASS (Power Aware Systerm Service)
  *
- * Copyright (c) 2012 - 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2012 - 2017 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.
index 48d565e44cecad6ca9ec0237bf94a0eb196294a9..e4e86865175a237482ca26bab9971d2ded4c659d 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * deviced
+ * PASS (Power Aware System Service)
  *
- * Copyright (c) 2012 - 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2012 - 2017 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.
index 6b1aee97122f13089edd151ff52c7e55fbf6feea..1caa07b038cf1df78778e51d566fe0f1b9946178 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * deviced
+ * PASS (Power Aware System Service)
  *
- * Copyright (c) 2012 - 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2012 - 2017 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.
index 18c15bea00994da682c1aeba940707c6abbe3c88..6924213fdab1e043e6b74782d234fd9e428428dc 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * deviced
+ * PASS (Power Aware System Service)
  *
- * Copyright (c) 2012 - 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2012 - 2017 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.
index 629af7c236cd5fafae3e3e6d76741d79bfbc99c0..0c907bb1e80a939698166f3186d900aae9ceb301 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * deviced
+ * PASS (Power Aware System Service)
  *
- * Copyright (c) 2012 - 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2012 - 2017 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.
index 610251aaefc460979552ab15277d4f02dd03f75d..cb14eec9d1f13d1556c5fd030d7c3bf2bfb93419 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * deviced
+ * PASS (Power Aware System Service)
  *
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
index a6991c1c77f2c72fa42179441a45842fde786807..6662bd32b37f04b8c7c84ae3c2617a8b531c38f7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * deviced
+ * PASS (Power Aware System Service)
  *
  * Copyright (c) 2016 Samsung Electronics Co., Ltd.
  *
index 918a284cea7db3347d33164dd53c03b91cc30854..bd23ecc79056d543c498e34fa1c7aedf9b6e1f98 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * deviced
+ * PASS (Power Aware System Service)
  *
- * Copyright (c) 2012 - 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2012 - 2017 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.
index 38d214dee71033d70e9ab9e6940f96acc6ea9807..7e50636f1cf5b6bf88c3371b1a06fb2649113bf0 100644 (file)
@@ -239,9 +239,9 @@ static void pass_init(void *data2)
        /*
         * Initialize pass cluster data by parsing pass.conf
         */
-       ret = get_pass_cluster(&cluster, "/etc/deviced/pass.conf");
+       ret = get_pass_cluster(&cluster, "/etc/pass/pass.conf");
        if (ret < 0) {
-               _E("cannot parse /etc/deviced/pass.conf\n");
+               _E("cannot parse /etc/pass/pass.conf\n");
                return;
        }
 
index 528500df331b7a8bf362558bad1068d0abba9d11..77ddd4316d42b5ca9217d989c6ab6ddde5ba72bc 100644 (file)
@@ -8,11 +8,11 @@ pass_num_cpu_clusters=2
 [CpuCluster0]
 pass_cpu_cluster_id=0
 pass_cpu_cluster_first_cpu=0
-pass_cpu_cluster_path_conf_file=/etc/deviced/pass-cluster0.conf
+pass_cpu_cluster_path_conf_file=/etc/pass/pass-cluster0.conf
 pass_cpu_cluster_path_load_table=/sys/kernel/debug/cpufreq/cpu0/load_table
 
 [CpuCluster1]
 pass_cpu_cluster_id=1
 pass_cpu_cluster_first_cpu=4
-pass_cpu_cluster_path_conf_file=/etc/deviced/pass-cluster1.conf
+pass_cpu_cluster_path_conf_file=/etc/pass/pass-cluster1.conf
 pass_cpu_cluster_path_load_table=/sys/kernel/debug/cpufreq/cpu4/load_table
index 072972bba4bf6f81dae246e314a41a138d5abd3c..631a5e434131822344451897d9830cde10d783bb 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * deviced
+ * PASS (Power Aware System Service)
  *
- * Copyright (c) 2012 - 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2012 - 2017 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.
index 563491a250e8513b4001c0bc58cdf455fe53a43f..f0baf8b9fbd613982be15cfaa0ed886ce80ee79d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * PASS
+ * PASS (Power Aware System Service)
  *
  * Copyright (c) 2012 - 2017 Samsung Electronics Co., Ltd.
  *
index 1fc091f13e6f44e55876fe03c0231376a411764b..a1c5b3f41a062a3b46adf8bc19a30d94882442be 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * deviced
+ * PASS (Power Aware System Service)
  *
  * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
  *
@@ -33,7 +33,7 @@
 
 #define DEFAULT_PMQOS_TIMER            3000
 
-#define PMQOS_CONF_PATH                "/etc/deviced/pmqos.conf"
+#define PMQOS_CONF_PATH                "/etc/pass/pmqos.conf"
 #define MILLISECONDS(tv)       ((tv.tv_sec)*1000 + (tv.tv_nsec)/1000000)
 #define DELTA(a, b)            (MILLISECONDS(a) - MILLISECONDS(b))
 
@@ -427,7 +427,8 @@ static int booting_done(void *data)
        _I("booting done");
 
        /* register edbus methods */
-       ret = register_edbus_method(DEVICED_PATH_PMQOS, edbus_methods, ARRAY_SIZE(edbus_methods));
+       ret = register_edbus_method(DEVICED_PATH_PMQOS, edbus_methods,
+                                       ARRAY_SIZE(edbus_methods));
        if (ret < 0)
                _E("fail to init edbus method(%d)", ret);
 
index 531847cdf5d42b181edab34d10d86e7acf445b03..9de6b1d37761460ce9827894a44891e40fa71516 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * deviced
+ * PASS (Power Aware System Service)
  *
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
diff --git a/src/proc/cpu-info.c b/src/proc/cpu-info.c
deleted file mode 100644 (file)
index 48795f1..0000000
+++ /dev/null
@@ -1,155 +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 <fcntl.h>
-
-#include "core/log.h"
-#include "core/devices.h"
-#include "core/edbus-handler.h"
-#include "core/common.h"
-
-#define METHOD_GET_REVISION    "GetRevision"
-#define PATH_NAME              "/proc/cpuinfo"
-#define REVISION_NAME  "Revision"
-#define TOK_DELIMITER  ":"
-#define END_DELIMITER  " \n"
-
-#define CONVERT_TYPE   10
-#define REVISION_SIZE  4
-#define FILE_BUFF_MAX  1024
-#define NOT_INITIALIZED        (-1)
-
-static int read_from_file(const char *path, char *buf, size_t size)
-{
-       int fd;
-       size_t count;
-
-       if (!path)
-               return -1;
-
-       fd = open(path, O_RDONLY, 0);
-       if (fd == -1) {
-               _E("Could not open '%s'", path);
-               return -1;
-       }
-
-       count = read(fd, buf, size);
-
-       if ((int)count != -1 && count > 0) {
-               count = (count < size) ? count : size - 1;
-               while (count > 0 && buf[count - 1] == '\n')
-                       count--;
-               buf[count] = '\0';
-       } else {
-               buf[0] = '\0';
-       }
-
-       close(fd);
-
-       return 0;
-}
-
-static int get_revision(char *rev, int len)
-{
-       char buf[FILE_BUFF_MAX];
-       char *tag;
-       char *start, *ptr;
-       char *saveptr;
-       long rev_num;
-       const int radix = 16;
-
-       if (rev == NULL || len <= 0) {
-               _E("Invalid argument !\n");
-               return -1;
-       }
-
-       if (read_from_file(PATH_NAME, buf, FILE_BUFF_MAX) < 0) {
-               _E("fail to read %s\n", PATH_NAME);
-               return -1;
-       }
-
-       tag = strstr(buf, REVISION_NAME);
-       if (tag == NULL) {
-               _E("cannot find Hardware in %s\n", PATH_NAME);
-               return -1;
-       }
-
-       start = strstr(tag, TOK_DELIMITER);
-       if (start == NULL) {
-               _E("cannot find Hardware in %s\n", PATH_NAME);
-               return -1;
-       }
-
-       start++;
-       ptr = strtok_r(start, END_DELIMITER, &saveptr);
-       if (!ptr) {
-               _E("fail to extract tokens");
-               return -1;
-       }
-       ptr += strlen(ptr);
-       ptr -= 2;
-
-       memset(rev, 0x00, REVISION_SIZE);
-       rev_num = strtol(ptr, NULL, radix);
-       snprintf(rev, len, "%ld", rev_num);
-
-       return 0;
-}
-
-static DBusMessage *dbus_revision_handler(E_DBus_Object *obj, DBusMessage *msg)
-{
-       DBusMessageIter iter;
-       DBusMessage *reply;
-       char rev[FILE_BUFF_MAX];
-       char *ptr;
-       static int ret = NOT_INITIALIZED;
-
-       if (ret != NOT_INITIALIZED)
-               goto out;
-       ret = get_revision(rev, sizeof(rev));
-       if (ret == 0)
-               ret = strtol(rev, &ptr, CONVERT_TYPE);
-out:
-       _D("rev : %d", ret);
-
-       reply = dbus_message_new_method_return(msg);
-       dbus_message_iter_init_append(reply, &iter);
-       dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &ret);
-       return reply;
-}
-
-static const struct edbus_method edbus_methods[] = {
-       { METHOD_GET_REVISION, NULL, "i", dbus_revision_handler },
-};
-
-static void cpu_info_init(void *data)
-{
-       int ret;
-
-       ret = register_edbus_method(DEVICED_PATH_SYSNOTI, edbus_methods, ARRAY_SIZE(edbus_methods));
-       if (ret < 0)
-               _E("fail to init edbus method(%d)", ret);
-}
-
-static const struct device_ops cpu_info_device_ops = {
-       .name     = "cpu_info",
-       .init     = cpu_info_init,
-};
-
-DEVICE_OPS_REGISTER(&cpu_info_device_ops)
diff --git a/src/proc/proc-handler.c b/src/proc/proc-handler.c
deleted file mode 100644 (file)
index 6d3f43c..0000000
+++ /dev/null
@@ -1,217 +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 <stdio.h>
-#include <unistd.h>
-//#include <dirent.h>
-//#include <sys/types.h>
-//#include <device-node.h>
-//#include <sys/un.h>
-//#include <stdarg.h>
-#include <errno.h>
-#include <vconf.h>
-//#include <fcntl.h>
-
-#include "core/log.h"
-#include "core/common.h"
-#include "core/devices.h"
-#include "core/device-notifier.h"
-#include "core/edbus-handler.h"
-#include "shared/score-defines.h"
-
-#define OOMADJ_SET                     "oomadj_set"
-#define OOM_PMQOS_TIME         2000 /* ms */
-#define SIGNAL_PROC_STATUS     "ProcStatus"
-
-enum proc_status_type {
-       PROC_STATUS_LAUNCH,
-       PROC_STATUS_RESUME,
-       PROC_STATUS_TERMINATE,
-       PROC_STATUS_FOREGROUND,
-       PROC_STATUS_BACKGROUND,
-};
-
-static void memcg_move_group(int pid, int oom_score_adj)
-{
-       char buf[100];
-       FILE *f;
-       int size;
-       char exe_name[PATH_MAX];
-
-       if (get_cmdline_name(pid, exe_name, PATH_MAX) != 0) {
-               _E("fail to get process name(%d)", pid);
-               return;
-       }
-
-       _SD("memcg_move_group : %s, pid = %d", exe_name, pid);
-       if (oom_score_adj >= OOMADJ_BACKGRD_LOCKED)
-               snprintf(buf, sizeof(buf), "/sys/fs/cgroup/memory/background/cgroup.procs");
-       else if (oom_score_adj >= OOMADJ_FOREGRD_LOCKED && oom_score_adj < OOMADJ_BACKGRD_LOCKED)
-               snprintf(buf, sizeof(buf), "/sys/fs/cgroup/memory/foreground/cgroup.procs");
-       else
-               return;
-
-       f = fopen(buf, "w");
-       if (f == NULL)
-               return;
-       size = snprintf(buf, sizeof(buf), "%d", pid);
-       if (fwrite(buf, size, 1, f) != 1)
-               _E("fwrite cgroup tasks : %d", pid);
-       fclose(f);
-}
-
-int set_oom_score_adj_action(int argc, char **argv)
-{
-       FILE *fp;
-       int pid = -1;
-       int new_oom_score_adj = 0;
-
-       if (argc < 2)
-               return -1;
-       pid = atoi(argv[0]);
-       new_oom_score_adj = atoi(argv[1]);
-       if (pid < 0 || new_oom_score_adj <= -20)
-               return -1;
-
-       _I("OOMADJ_SET : pid %d, new_oom_score_adj %d", pid, new_oom_score_adj);
-
-       fp = open_proc_oom_score_adj_file(pid, "w");
-       if (fp == NULL)
-               return -1;
-       if (new_oom_score_adj < OOMADJ_SU)
-               new_oom_score_adj = OOMADJ_SU;
-       fprintf(fp, "%d", new_oom_score_adj);
-       fclose(fp);
-
-       memcg_move_group(pid, new_oom_score_adj);
-       return 0;
-}
-
-static DBusMessage *dbus_oom_handler(E_DBus_Object *obj, DBusMessage *msg)
-{
-       DBusError err;
-       DBusMessageIter iter;
-       DBusMessage *reply;
-       pid_t pid;
-       int ret;
-       int argc;
-       char *type_str;
-       char *argv[2];
-
-       dbus_error_init(&err);
-
-       if (!dbus_message_get_args(msg, &err,
-                   DBUS_TYPE_STRING, &type_str,
-                   DBUS_TYPE_INT32, &argc,
-                   DBUS_TYPE_STRING, &argv[0],
-                   DBUS_TYPE_STRING, &argv[1], DBUS_TYPE_INVALID)) {
-               _E("there is no message");
-               ret = -EINVAL;
-               goto out;
-       }
-
-       if (argc < 0) {
-               _E("message is invalid!");
-               ret = -EINVAL;
-               goto out;
-       }
-
-       pid = get_edbus_sender_pid(msg);
-       if (kill(pid, 0) == -1) {
-               _E("%d process does not exist, dbus ignored!", pid);
-               ret = -ESRCH;
-               goto out;
-       }
-
-       if (strncmp(type_str, OOMADJ_SET, strlen(OOMADJ_SET)) == 0)
-               ret = set_oom_score_adj_action(argc, (char **)&argv);
-       else
-               ret = -EINVAL;
-
-out:
-       reply = dbus_message_new_method_return(msg);
-       dbus_message_iter_init_append(reply, &iter);
-       dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &ret);
-
-       return reply;
-}
-
-static void proc_signal_handler(void *data, DBusMessage *msg)
-{
-       DBusError err;
-       int ret, type;
-       pid_t pid;
-
-       ret = dbus_message_is_signal(msg, RESOURCED_INTERFACE_PROCESS,
-           SIGNAL_PROC_STATUS);
-       if (!ret) {
-               _E("It's not active signal!");
-               return;
-       }
-
-       dbus_error_init(&err);
-
-       if (dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &type,
-           DBUS_TYPE_INT32, &pid, DBUS_TYPE_INVALID) == 0) {
-               _E("There's no arguments!");
-               return;
-       }
-
-       if (type == PROC_STATUS_BACKGROUND)
-               device_notify(DEVICE_NOTIFIER_PROCESS_BACKGROUND, &pid);
-       if (type == PROC_STATUS_FOREGROUND)
-               device_notify(DEVICE_NOTIFIER_PROCESS_FOREGROUND, &pid);
-}
-
-static const struct edbus_method edbus_methods[] = {
-       { OOMADJ_SET, "siss", "i", dbus_oom_handler },
-};
-
-static void proc_change_lowmemory(keynode_t *key, void *data)
-{
-       int state = 0;
-
-       if (vconf_get_int(VCONFKEY_SYSMAN_LOW_MEMORY, &state))
-               return;
-
-       if (state == VCONFKEY_SYSMAN_LOW_MEMORY_HARD_WARNING)
-               device_notify(DEVICE_NOTIFIER_PMQOS_OOM, (void *)OOM_PMQOS_TIME);
-}
-
-static void process_init(void *data)
-{
-       int ret;
-
-       register_edbus_signal_handler(RESOURCED_PATH_PROCESS,
-           RESOURCED_INTERFACE_PROCESS, SIGNAL_PROC_STATUS, proc_signal_handler);
-
-       ret = register_edbus_method(DEVICED_PATH_PROCESS, edbus_methods, ARRAY_SIZE(edbus_methods));
-       if (ret < 0)
-               _E("fail to init edbus method(%d)", ret);
-
-       vconf_notify_key_changed(VCONFKEY_SYSMAN_LOW_MEMORY,
-                       proc_change_lowmemory, NULL);
-}
-
-static const struct device_ops process_device_ops = {
-       .name     = "process",
-       .init     = process_init,
-};
-
-DEVICE_OPS_REGISTER(&process_device_ops)
index 5c6284f7a3de42a6de34ce2c462c362423f02add..2d331f8ae094d060bc5cd54392285f2e8181d829 100755 (executable)
@@ -2,7 +2,6 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
 
 SET(SHARED_SRCS
        dbus.c
-       deviced-systemd.c
 )
 
 INCLUDE(FindPkgConfig)
index 5a3ef239923a3ce5b780e7de78f557f4c6c7cc43..73f12dd52ef5099aa925b483f9ae4e47894312f0 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * deviced
+ * PASS (Power Aware System Service)
  *
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2017 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.
index e97d8d5efdc4a376e33f0f099e19555dba4b3353..98b7907434485b3b0c640b1723fcc79964cd5f19 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * deviced
+ * PASS (Power Aware System Service)
  *
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -380,7 +380,7 @@ static void cb_pending(DBusPendingCall *pending, void *user_data)
                _E("no message : [%s:%s]", err.name, err.message);
 
                if (data->func) {
-                       dbus_set_error(&err, "org.tizen.system.deviced.NoReply",
+                       dbus_set_error(&err, "org.tizen.system.pass.NoReply",
                                        "There was no reply to this method call");
                        data->func(data->data, NULL, &err);
                        dbus_error_free(&err);
index 62bff11824b5542f6afc73ad31f13f0d193aaa90..975975eece790440c78a2802640d35f6061bb41e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * deviced
+ * PASS
  *
  * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
  *
 /*
  * Device daemon
  */
-#define DEVICED_BUS_NAME                    "org.tizen.system.pass"
-#define DEVICED_OBJECT_PATH                 "/Org/Tizen/System/Pass"
+#define DEVICED_BUS_NAME                    "org.tizen.system.deviced"
+#define DEVICED_OBJECT_PATH                 "/Org/Tizen/System/Deviced"
 #define DEVICED_INTERFACE_NAME              DEVICED_BUS_NAME
 /* Core service: get/set device status operations about device */
 #define DEVICED_PATH_CORE                   DEVICED_OBJECT_PATH"/Core"
 #define DEVICED_INTERFACE_CORE              DEVICED_INTERFACE_NAME".core"
-/* Display service: start/stop display(pm), get/set brightness operations about display */
-#define DEVICED_PATH_DISPLAY                DEVICED_OBJECT_PATH"/Display"
-#define DEVICED_INTERFACE_DISPLAY           DEVICED_INTERFACE_NAME".display"
-/* Pass service: start/stop pass operations about pass */
+/* PASS service: start/stop pass operations about pass */
 #define DEVICED_PATH_PASS                   DEVICED_OBJECT_PATH"/Pass"
 #define DEVICED_INTERFACE_PASS              DEVICED_INTERFACE_NAME".pass"
-/* Hall service: get hall status operations about hall */
-#define DEVICED_PATH_HALL                   DEVICED_OBJECT_PATH"/Hall"
-#define DEVICED_INTERFACE_HALL              DEVICED_INTERFACE_NAME".hall"
-/* Power service: set resetkey disable operations about power */
-#define DEVICED_PATH_POWER                  DEVICED_OBJECT_PATH"/Power"
-#define DEVICED_INTERFACE_POWER             DEVICED_INTERFACE_NAME".power"
-/* Storage service: get storage size operatioins about storage */
-#define DEVICED_PATH_STORAGE                DEVICED_OBJECT_PATH"/Storage"
-#define DEVICED_INTERFACE_STORAGE           DEVICED_INTERFACE_NAME".storage"
-/* ODE service: request ode popup result operatioins about storage */
-#define DEVICED_PATH_ODE                    DEVICED_OBJECT_PATH"/Ode"
-#define DEVICED_INTERFACE_ODE               DEVICED_INTERFACE_NAME".ode"
-/* Lowmem service: get critical low status operations about Lowmem */
-#define DEVICED_PATH_LOWMEM                 DEVICED_OBJECT_PATH"/Lowmem"
-#define DEVICED_INTERFACE_LOWMEM            DEVICED_INTERFACE_NAME".lowmem"
-/* Poweroff service: get power off status operations about Poweroff */
-#define DEVICED_PATH_POWEROFF               DEVICED_OBJECT_PATH"/PowerOff"
-#define DEVICED_INTERFACE_POWEROFF          DEVICED_INTERFACE_NAME".PowerOff"
-/* Led service: play/stop led operations about led */
-#define DEVICED_PATH_LED                    DEVICED_OBJECT_PATH"/Led"
-#define DEVICED_INTERFACE_LED               DEVICED_INTERFACE_NAME".Led"
-/* Block service: manage block device */
-#define STORAGE_BUS_NAME                    "org.tizen.system.storage"
-#define STORAGE_OBJECT_PATH                 "/Org/Tizen/System/Storage"
-#define STORAGE_INTERFACE_NAME              STORAGE_BUS_NAME
-#define DEVICED_PATH_BLOCK                  STORAGE_OBJECT_PATH"/Block"
-#define DEVICED_PATH_BLOCK_MANAGER          DEVICED_PATH_BLOCK"/Manager"
-#define DEVICED_INTERFACE_BLOCK_MANAGER     STORAGE_INTERFACE_NAME".BlockManager"
-/* MMC service: mount/unmount/format mmc operations about mmc */
-#define DEVICED_PATH_MMC                    DEVICED_OBJECT_PATH"/Mmc"
-#define DEVICED_INTERFACE_MMC               DEVICED_INTERFACE_NAME".Mmc"
-/* Process service: operations about process */
-#define DEVICED_PATH_PROCESS                DEVICED_OBJECT_PATH"/Process"
-#define DEVICED_INTERFACE_PROCESS           DEVICED_INTERFACE_NAME".Process"
-/* Key service: operations about key */
-#define DEVICED_PATH_KEY                    DEVICED_OBJECT_PATH"/Key"
-#define DEVICED_INTERFACE_KEY               DEVICED_INTERFACE_NAME".Key"
-/* USB client service: change usb connection mode */
-#define DEVICED_PATH_USB                    DEVICED_OBJECT_PATH"/Usb"
-#define DEVICED_INTERFACE_USB               DEVICED_INTERFACE_NAME".Usb"
-/* USB start/stop service: operations about usb start/stop */
-#define DEVICED_PATH_USB_CONTROL            DEVICED_OBJECT_PATH"/UsbControl"
-#define DEVICED_INTERFACE_USB_CONTROL       DEVICED_INTERFACE_NAME".UsbControl"
-/* USB host service: operations about usb start/stop */
-#define DEVICED_PATH_USBHOST                DEVICED_OBJECT_PATH"/Usbhost"
-#define DEVICED_INTERFACE_USBHOST           DEVICED_INTERFACE_NAME".Usbhost"
-/* Cpu service: operations about cpu */
+
 #define DEVICED_PATH_CPU                    DEVICED_OBJECT_PATH"/Cpu"
 #define DEVICED_INTERFACE_CPU               DEVICED_INTERFACE_NAME".Cpu"
 /* PmQos service: operations about pmqos */
 /* Sysnoti service */
 #define DEVICED_PATH_SYSNOTI                DEVICED_OBJECT_PATH"/SysNoti"
 #define DEVICED_INTERFACE_SYSNOTI           DEVICED_INTERFACE_NAME".SysNoti"
-/* ExtCon service */
-#define DEVICED_PATH_EXTCON                 DEVICED_OBJECT_PATH"/ExtCon"
-#define DEVICED_INTERFACE_EXTCON            DEVICED_INTERFACE_NAME".ExtCon"
-/* Battery service */
-#define DEVICED_PATH_BATTERY                DEVICED_OBJECT_PATH"/Battery"
-#define DEVICED_INTERFACE_BATTERY           DEVICED_INTERFACE_NAME".Battery"
-/* Time service */
-#define DEVICED_PATH_TIME                   DEVICED_OBJECT_PATH"/Time"
-#define DEVICED_INTERFACE_TIME              DEVICED_INTERFACE_NAME".Time"
-/* IR service */
-#define DEVICED_PATH_IR                     DEVICED_OBJECT_PATH"/Ir"
-#define DEVICED_INTERFACE_IR                DEVICED_INTERFACE_NAME".ir"
-/* USB_HOST_TEST service */
-#define DEVICED_PATH_USB_HOST_TEST          DEVICED_OBJECT_PATH"/UsbHostTest"
-#define DEVICED_INTERFACE_USB_HOST_TEST     DEVICED_INTERFACE_NAME".UsbHostTest"
-
-/* Apps service */
-#define DEVICED_PATH_APPS               DEVICED_OBJECT_PATH"/Apps"
-#define DEVICED_INTERFACE_APPS           DEVICED_INTERFACE_NAME".Apps"
-
-/* GPIO service: status check about gpio */
-#define DEVICED_PATH_GPIO                    DEVICED_OBJECT_PATH"/Gpio"
-#define DEVICED_INTERFACE_GPIO               DEVICED_INTERFACE_NAME".Gpio"
-
-/* HDMICEC service: status check about gpio */
-#define DEVICED_PATH_HDMICEC                    DEVICED_OBJECT_PATH"/HdmiCec"
-#define DEVICED_INTERFACE_HDMICEC               DEVICED_INTERFACE_NAME".HdmiCec"
-
-/* Tzip service: Archive file system */
-#define DEVICED_PATH_TZIP                    DEVICED_OBJECT_PATH"/Tzip"
-#define DEVICED_INTERFACE_TZIP               DEVICED_INTERFACE_NAME".Tzip"
-
-/*
- * Vibrator daemon
- */
-#define VIBRATOR_BUS_NAME                   "org.tizen.system.vibrator"
-#define VIBRATOR_OBJECT_PATH                "/Org/Tizen/System/Vibrator"
-#define VIBRATOR_INTERFACE_NAME              VIBRATOR_BUS_NAME
-/* Core service: get/set device status operations about device */
-#define VIBRATOR_PATH_CORE                   VIBRATOR_OBJECT_PATH"/Core"
-#define VIBRATOR_INTERFACE_CORE              VIBRATOR_INTERFACE_NAME".core"
-
-#define VIBRATOR_PATH_HAPTIC                 VIBRATOR_OBJECT_PATH"/Haptic"
-#define VIBRATOR_INTERFACE_HAPTIC            VIBRATOR_INTERFACE_NAME".haptic"
-
-/*
- * Resource daemon
- */
-#define RESOURCED_BUS_NAME                  "org.tizen.resourced"
-#define RESOURCED_OBJECT_PATH               "/Org/Tizen/ResourceD"
-#define RESOURCED_INTERFACE_NAME            RESOURCED_BUS_NAME
-
-#define RESOURCED_PATH_PROCESS              RESOURCED_OBJECT_PATH"/Process"
-#define RESOURCED_INTERFACE_PROCESS         RESOURCED_INTERFACE_NAME".process"
-#define RESOURCED_METHOD_ACTIVE             "Active"
-
-/*
- * Popup launcher
- */
-#define POPUP_BUS_NAME                      "org.tizen.system.popup"
-#define POPUP_OBJECT_PATH                   "/Org/Tizen/System/Popup"
-#define POPUP_INTERFACE_NAME                POPUP_BUS_NAME
-/* LED */
-#define POPUP_PATH_LED                      POPUP_OBJECT_PATH"/Led"
-#define POPUP_INTERFACE_LED                 POPUP_INTERFACE_NAME".Led"
-/* Notification */
-#define POPUP_PATH_NOTI                     POPUP_OBJECT_PATH"/Noti"
-#define POPUP_INTERFACE_NOTI                POPUP_INTERFACE_NAME".Noti"
-/* Power key longpress */
-#define POPUP_PATH_POWERKEY                 POPUP_OBJECT_PATH"/Powerkey"
-#define POPUP_INTERFACE_POWERKEY            POPUP_INTERFACE_NAME".Powerkey"
-/* Low battery */
-#define POPUP_PATH_LOWBAT                   POPUP_OBJECT_PATH"/Lowbat"
-#define POPUP_INTERFACE_LOWBAT              POPUP_INTERFACE_NAME".Lowbat"
-/* Low memory */
-#define POPUP_PATH_LOWMEM                   POPUP_OBJECT_PATH"/Lowmem"
-#define POPUP_INTERFACE_LOWMEM              POPUP_INTERFACE_NAME".Lowmem"
-/* MMC */
-#define POPUP_PATH_MMC                      POPUP_OBJECT_PATH"/Mmc"
-#define POPUP_INTERFACE_MMC                 POPUP_INTERFACE_NAME".Mmc"
-/* USB */
-#define POPUP_PATH_USB                      POPUP_OBJECT_PATH"/Usb"
-#define POPUP_INTERFACE_USB                 POPUP_INTERFACE_NAME".Usb"
-/* USB otg */
-#define POPUP_PATH_USBOTG                   POPUP_OBJECT_PATH"/Usbotg"
-#define POPUP_INTERFACE_USBOTG              POPUP_INTERFACE_NAME".Usbotg"
-/* USB host */
-#define POPUP_PATH_USBHOST                  POPUP_OBJECT_PATH"/Usbhost"
-#define POPUP_INTERFACE_USBHOST             POPUP_INTERFACE_NAME".Usbhost"
-/* System */
-#define POPUP_PATH_SYSTEM                   POPUP_OBJECT_PATH"/System"
-#define POPUP_INTERFACE_SYSTEM              POPUP_INTERFACE_NAME".System"
-/* Crash */
-#define POPUP_PATH_CRASH                    POPUP_OBJECT_PATH"/Crash"
-#define POPUP_INTERFACE_CRASH               POPUP_INTERFACE_NAME".Crash"
-/* ODE */
-#define POPUP_PATH_ODE                      POPUP_OBJECT_PATH"/Ode"
-#define POPUP_INTERFACE_ODE                 POPUP_INTERFACE_NAME".Ode"
-/* Servant */
-#define POPUP_PATH_SERVANT                  POPUP_OBJECT_PATH"/Servant"
-#define POPUP_IFACE_SERVANT                 POPUP_INTERFACE_NAME".Servant"
-
-#define POPUP_PATH_APP                      POPUP_OBJECT_PATH"/Apps"
-#define POPUP_IFACE_APP                     POPUP_BUS_NAME".Apps"
-
-#define POPUP_METHOD_LAUNCH                 "PopupLaunch"
-#define POPUP_METHOD_TERMINATE              "AppTerminateByPid"
-#define POPUP_KEY_CONTENT                   "_SYSPOPUP_CONTENT_"
-
-/*
- * Crash daemon
- */
-#define CRASHD_BUS_NAME                     "org.tizen.system.crashd"
-#define CRASHD_OBJECT_PATH                  "/Org/Tizen/System/CrashD"
-#define CRASHD_INTERFACE_NAME               CRASHD_BUS_NAME
-
-#define CRASHD_PATH_CRASH                   CRASHD_OBJECT_PATH"/Crash"
-#define CRASHD_INTERFACE_CRASH              CRASHD_INTERFACE_NAME".Crash"
 
 struct dbus_byte {
        const unsigned char *data;
diff --git a/src/shared/deviced-internal.h b/src/shared/deviced-internal.h
deleted file mode 100644 (file)
index b26d67e..0000000
+++ /dev/null
@@ -1,38 +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.
- */
-
-
-#ifndef ___DEVICED_INTERNAL___
-#define ___DEVICED_INTERNAL___
-#include <sys/types.h>
-#include "dd-deviced.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* This file will be removed */
-
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-#endif                         /* ___DEVICED_INTERNAL___ */
index 0adb00fb21ef19ab70f440c960d244c6eaec2e00..6fab212bd360fa4b0c61fe53d66bcb9c01d5299c 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * deviced
+ * PASS (Power Aware System Service)
  *
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
diff --git a/src/shared/deviced-systemd.c b/src/shared/deviced-systemd.c
deleted file mode 100644 (file)
index 8358256..0000000
+++ /dev/null
@@ -1,407 +0,0 @@
-/*
- * deviced
- *
- * Copyright (c) 2014 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.
- */
-
-#define _GNU_SOURCE
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <assert.h>
-#include <dbus/dbus.h>
-#include <gio/gio.h>
-
-#include "common.h"
-#include "dbus.h"
-#include "deviced-systemd.h"
-
-#include "core/log.h"
-
-
-#define SYSTEMD_UNIT_ESCAPE_CHAR       ".-"
-
-typedef unsigned int uint;
-typedef long long int64;
-typedef unsigned long long uint64;
-
-#define g_variant_type_int32           G_VARIANT_TYPE_INT32
-#define g_variant_type_int64           G_VARIANT_TYPE_INT64
-#define g_variant_type_uint32          G_VARIANT_TYPE_UINT32
-#define g_variant_type_uint64          G_VARIANT_TYPE_UINT64
-#define g_variant_type_string          G_VARIANT_TYPE_STRING
-
-#define g_variant_get_function_int32(v)                g_variant_get_int32(v)
-#define g_variant_get_function_int64(v)                g_variant_get_int64(v)
-#define g_variant_get_function_uint32(v)       g_variant_get_uint32(v)
-#define g_variant_get_function_uint64(v)       g_variant_get_uint64(v)
-#define g_variant_get_function_string(v)       g_variant_dup_string(v, NULL)
-
-
-static int deviced_systemd_proxy_call_sync(const char *name,
-                                          const char *path,
-                                          const char *iface,
-                                          const char *method,
-                                          GVariant *variant,
-                                          GVariant **reply)
-{
-       GVariant *gvar;
-       GError *error;
-       GDBusProxy *proxy;
-       int ret = 0;
-
-#if (GLIB_MAJOR_VERSION <= 2 && GLIB_MINOR_VERSION < 36)
-       g_type_init();
-#endif
-
-       error = NULL;
-       proxy = g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM,
-                                             G_DBUS_PROXY_FLAGS_NONE,
-                                             NULL, /* GDBusInterfaceInfo */
-                                             name,
-                                             path,
-                                             iface,
-                                             NULL, /* GCancellable */
-                                             &error);
-
-       if (proxy == NULL) {
-               _E("Error creating proxy: %s", error->message);
-               ret = error->code;
-               g_error_free(error);
-               return ret;
-       }
-
-       error = NULL;
-       gvar = g_dbus_proxy_call_sync(proxy,
-                                     method,
-                                     variant,
-                                     G_DBUS_CALL_FLAGS_NONE,
-                                     -1,
-                                     NULL, /* GCancellable */
-                                     &error);
-
-       if (error) {
-               _E("Error proxy call sync: %s", error->message);
-               ret = error->code;
-               g_error_free(error);
-               return -ret;
-       }
-
-       g_assert(gvar != NULL);
-       *reply = gvar;
-       g_clear_error(&error);
-       g_object_unref(proxy);
-
-       return 0;
-}
-
-static int deviced_systemd_start_or_stop_unit(char *method, char *name)
-{
-       int ret;
-       GVariant *reply = NULL;
-
-       _I("Starting: %s %s", method, name);
-       ret = deviced_systemd_proxy_call_sync(SYSTEMD_DBUS_DEST,
-                                             SYSTEMD_DBUS_PATH,
-                                             SYSTEMD_DBUS_IFACE_MANAGER,
-                                             method,
-                                             g_variant_new("(ss)",
-                                                           name,
-                                                           "replace"),
-                                             &reply);
-       if (ret < 0)
-               goto finish;
-
-       if (!g_variant_is_of_type(reply, G_VARIANT_TYPE("(o)"))) {
-               ret = -EBADMSG;
-               goto finish;
-       }
-
-       ret = 0;
-finish:
-       _I("Finished(%d): %s %s", ret, method, name);
-
-       if (reply)
-               g_variant_unref(reply);
-
-       return ret;
-}
-
-int deviced_systemd_start_unit(char *name)
-{
-       assert(name);
-
-       return deviced_systemd_start_or_stop_unit("StartUnit", name);
-}
-
-int deviced_systemd_stop_unit(char *name)
-{
-       assert(name);
-
-       return deviced_systemd_start_or_stop_unit("StopUnit", name);
-}
-
-static char *deviced_systemd_get_unit_dbus_path(const char *unit)
-{
-       char *path = NULL;
-       int i;
-       size_t p, k, prefix_len, unit_len = strlen(unit);
-       size_t path_len, len, escape;
-
-       assert(unit);
-
-       for (escape = 0, p = 0; p < unit_len; escape++) {
-               k = strcspn(unit+p, SYSTEMD_UNIT_ESCAPE_CHAR);
-               if (p+k >= unit_len)
-                       break;
-               p += k+1;
-       }
-
-       prefix_len = strlen(SYSTEMD_DBUS_UNIT_PATH);
-       /* assume we try to get object path of foo-bar.service then
-       * the object path will be
-       * "/org/freedesktop/systemd1/unit/foo_2dbar_2eservice\n". In
-       * this case we can find two escape characters, one of escape
-       * char('-') is changed to three of char("_2d"). So the total
-       * length will be: */
-       /* (PREFIX) + (unit - escape + 3*escape) + NULL */
-       path_len = prefix_len + (unit_len - escape)
-               + (escape * 3 * sizeof(char)) + 1;
-       path = (char *)calloc(path_len, sizeof(char));
-       if (!path)
-               return NULL;
-
-       strncpy(path, SYSTEMD_DBUS_UNIT_PATH, prefix_len + 1);
-       for (i = 0, p = 0; i <= escape; i++) {
-               k = strcspn(unit + p, SYSTEMD_UNIT_ESCAPE_CHAR);
-               strncpy(path + prefix_len, unit + p, k);
-               if (k < strlen(unit + p)) {
-                       len = path_len - (prefix_len + k);
-                       snprintf(path + prefix_len + k, len,
-                                       "_%x", *(unit + p + k) & 0xff);
-                       prefix_len += k+3;
-                       p += k+1;
-               }
-       }
-
-       return path;
-}
-
-static int deviced_systemd_get_property(const char *name,
-                                       const char *path,
-                                       const char *iface,
-                                       const char *method,
-                                       const char *interface,
-                                       const char *property,
-                                       GVariant **reply)
-{
-       int ret;
-       GVariant *variant;
-
-       variant = g_variant_new("(ss)",
-                               interface,
-                               property);
-
-       ret = deviced_systemd_proxy_call_sync(name,
-                                             path,
-                                             iface,
-                                             method,
-                                             variant,
-                                             reply);
-
-       return ret;
-}
-
-int deviced_systemd_get_manager_property(const char *iface,
-                                        const char *property,
-                                        GVariant **variant)
-{
-       assert(iface);
-       assert(property);
-
-       return deviced_systemd_get_property(SYSTEMD_DBUS_DEST,
-                                           SYSTEMD_DBUS_PATH,
-                                           DBUS_IFACE_DBUS_PROPERTIES,
-                                           "Get",
-                                           iface,
-                                           property,
-                                           variant);
-}
-
-int deviced_systemd_get_unit_property(const char *unit,
-                                     const char *property,
-                                     GVariant **variant)
-{
-       int r;
-       char *escaped;
-
-       assert(unit);
-       assert(property);
-
-       escaped = deviced_systemd_get_unit_dbus_path(unit);
-
-       r = deviced_systemd_get_property(SYSTEMD_DBUS_DEST,
-                                        escaped,
-                                        DBUS_IFACE_DBUS_PROPERTIES,
-                                        "Get",
-                                        SYSTEMD_DBUS_IFACE_UNIT,
-                                        property,
-                                        variant);
-       free(escaped);
-       return r;
-}
-
-int deviced_systemd_get_service_property(const char *unit,
-                                        const char *property,
-                                        GVariant **variant)
-{
-       int ret;
-       char *escaped;
-
-       assert(unit);
-       assert(property);
-
-       escaped = deviced_systemd_get_unit_dbus_path(unit);
-
-       ret = deviced_systemd_get_property(SYSTEMD_DBUS_DEST,
-                                          escaped,
-                                          DBUS_IFACE_DBUS_PROPERTIES,
-                                          "Get",
-                                          SYSTEMD_DBUS_IFACE_SERVICE,
-                                          property,
-                                          variant);
-       free(escaped);
-       return ret;
-}
-
-#define DEFINE_SYSTEMD_GET_PROPERTY(iface, type, value)                        \
-       int deviced_systemd_get_##iface##_property_as_##type(           \
-                       const char *target,                             \
-                       const char *property,                           \
-                       value*result)                                   \
-       {                                                               \
-                                                                       \
-               GVariant *var;                                          \
-               GVariant *inner;                                        \
-               int r;                                                  \
-                                                                       \
-               r = deviced_systemd_get_##iface##_property(target,      \
-                                                          property,    \
-                                                          &var);       \
-               if (r < 0) {                                            \
-                       _E("Failed to get property:\n"                  \
-                          "  target: %s\n"                             \
-                          "  property: %s",                            \
-                          target, property);                           \
-                       return r;                                       \
-               }                                                       \
-                                                                       \
-               if (!g_variant_is_of_type(var,                          \
-                                         G_VARIANT_TYPE("(v)")))       \
-                       return -EBADMSG;                                \
-                                                                       \
-               g_variant_get(var, "(v)", &inner);                      \
-               if (!g_variant_is_of_type(inner,                        \
-                                         g_variant_type_##type))       \
-                       return -EBADMSG;                                \
-                                                                       \
-               *result = g_variant_get_function_##type(inner);         \
-               g_variant_unref(var);                                   \
-                                                                       \
-               return 0;                                               \
-       }
-
-/* int deviced_systemd_get_manager_property_as_int32(const char *iface, const char *property, int *result); */
-DEFINE_SYSTEMD_GET_PROPERTY(manager, int32, int)
-/* int deviced_systemd_get_manager_property_as_uint32(const char *iface, const char *property, unsigned int *result); */
-DEFINE_SYSTEMD_GET_PROPERTY(manager, uint32, uint)
-/* int deviced_systemd_get_manager_property_as_int64(const char *iface, const char *property, long long *result); */
-DEFINE_SYSTEMD_GET_PROPERTY(manager, int64, long long)
-/* int deviced_systemd_get_manager_property_as_uint64(const char *iface, const char *property, unsigned long long *result); */
-DEFINE_SYSTEMD_GET_PROPERTY(manager, uint64, unsigned long long)
-/* int deviced_systemd_get_manager_property_as_string(const char *iface, const char *property, char **result); */
-DEFINE_SYSTEMD_GET_PROPERTY(manager, string, char*)
-/* int deviced_systemd_get_unit_property_as_int32(const char *unit, const char *property, int *result); */
-DEFINE_SYSTEMD_GET_PROPERTY(unit, int32, int)
-/* int deviced_systemd_get_unit_property_as_uint32(const char *unit, const char *property, unsigned int *result); */
-DEFINE_SYSTEMD_GET_PROPERTY(unit, uint32, uint)
-/* int deviced_systemd_get_unit_property_as_int64(const char *unit, const char *property, long long *result); */
-DEFINE_SYSTEMD_GET_PROPERTY(unit, int64, long long)
-/* int deviced_systemd_get_unit_property_as_uint64(const char *unit, const char *property, unsigned long long *result); */
-DEFINE_SYSTEMD_GET_PROPERTY(unit, uint64, unsigned long long)
-/* int deviced_systemd_get_unit_property_as_string(const char *unit, const char *property, char **result); */
-DEFINE_SYSTEMD_GET_PROPERTY(unit, string, char*)
-/* int deviced_systemd_get_service_property_as_int32(const char *unit, const char *property, int *result); */
-DEFINE_SYSTEMD_GET_PROPERTY(service, int32, int)
-/* int deviced_systemd_get_service_property_as_uint32(const char *unit, const char *property, unsigned int *result); */
-DEFINE_SYSTEMD_GET_PROPERTY(service, uint32, uint)
-/* int deviced_systemd_get_service_property_as_int64(const char *unit, const char *property, long long *result); */
-DEFINE_SYSTEMD_GET_PROPERTY(service, int64, long long)
-/* int deviced_systemd_get_service_property_as_uint64(const char *unit, const char *property, unsigned long long *result); */
-DEFINE_SYSTEMD_GET_PROPERTY(service, uint64, unsigned long long)
-/* int deviced_systemd_get_service_property_as_string(const char *unit, const char *property, char **result); */
-DEFINE_SYSTEMD_GET_PROPERTY(service, string, char*)
-
-int deviced_systemd_instance_new_from_template(const char *template,
-                                              const char *instance,
-                                              const char **name)
-{
-       /* p point '@' */
-       /* e point '.' */
-       const char *p, *e;
-       char *prefix = NULL, *n = NULL;
-       int r;
-
-       assert(template);
-       p = strchr(template, '@');
-       if (!p) {
-               r = -EINVAL;
-               goto finish;
-       }
-
-       prefix = strndup(template, p - template + 1);
-       if (!prefix) {
-               r = -ENOMEM;
-               goto finish;
-       }
-
-       e = strrchr(p + 1, '.');
-       if (!e) {
-               r = -EINVAL;
-               goto finish;
-       }
-
-       /* verifying template. prefix@.service */
-       if (e != p + 1) {
-               r = -EINVAL;
-               goto finish;
-       }
-
-       r = asprintf(&n, "%s%s%s", prefix, instance, e);
-       if (r < 0) {
-               r = -ENOMEM;
-               goto finish;
-       }
-
-       *name = n;
-       r = 0;
-finish:
-       if (prefix)
-               free(prefix);
-
-       return r;
-}
diff --git a/src/shared/deviced-systemd.h b/src/shared/deviced-systemd.h
deleted file mode 100644 (file)
index 4dabe0a..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * deviced
- *
- * Copyright (c) 2014 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.
- */
-
-
-#ifndef __DEVICED_SYSTEMD_H__
-#define __DEVICED_SYSTEMD_H__
-
-#include <dbus/dbus.h>
-#include <gio/gio.h>
-
-#define DBUS_IFACE_DBUS_PROPERTIES  DBUS_SERVICE_DBUS ".Properties"
-
-#define SYSTEMD_DBUS_DEST       "org.freedesktop.systemd1"
-#define SYSTEMD_DBUS_IFACE_MANAGER  SYSTEMD_DBUS_DEST ".Manager"
-#define SYSTEMD_DBUS_IFACE_UNIT     SYSTEMD_DBUS_DEST ".Unit"
-#define SYSTEMD_DBUS_IFACE_SERVICE  SYSTEMD_DBUS_DEST ".Service"
-#define SYSTEMD_DBUS_IFACE_TARGET   SYSTEMD_DBUS_DEST ".Target"
-
-#define SYSTEMD_DBUS_PATH       "/org/freedesktop/systemd1"
-#define SYSTEMD_DBUS_UNIT_PATH      SYSTEMD_DBUS_PATH "/unit/"
-
-int deviced_systemd_start_unit(char *name);
-int deviced_systemd_stop_unit(char *name);
-
-int deviced_systemd_get_manager_property(const char *iface, const char *property, GVariant **variant);
-int deviced_systemd_get_unit_property(const char *unit, const char *property, GVariant **variant);
-int deviced_systemd_get_service_property(const char* unit, const char* property, GVariant **variant);
-
-int deviced_systemd_get_manager_property_as_int32(const char *iface, const char *property, int *result);
-int deviced_systemd_get_manager_property_as_uint32(const char *iface, const char *property, unsigned int *result);
-int deviced_systemd_get_manager_property_as_int64(const char *iface, const char *property, long long *result);
-int deviced_systemd_get_manager_property_as_uint64(const char *iface, const char *property, unsigned long long *result);
-int deviced_systemd_get_manager_property_as_string(const char *iface, const char *property, char **result);
-int deviced_systemd_get_unit_property_as_int32(const char *unit, const char *property, int *result);
-int deviced_systemd_get_unit_property_as_uint32(const char *unit, const char *property, unsigned int *result);
-int deviced_systemd_get_unit_property_as_int64(const char *unit, const char *property, long long *result);
-int deviced_systemd_get_unit_property_as_uint64(const char *unit, const char *property, unsigned long long *result);
-int deviced_systemd_get_unit_property_as_string(const char *unit, const char *property, char **result);
-int deviced_systemd_get_service_property_as_int32(const char *unit, const char *property, int *result);
-int deviced_systemd_get_service_property_as_uint32(const char *unit, const char *property, unsigned int *result);
-int deviced_systemd_get_service_property_as_int64(const char *unit, const char *property, long long *result);
-int deviced_systemd_get_service_property_as_uint64(const char *unit, const char *property, unsigned long long *result);
-int deviced_systemd_get_service_property_as_string(const char *unit, const char *property, char **result);
-
-int deviced_systemd_instance_new_from_template(const char *template, const char *instance, const char **name);
-
-#endif
index 407995e13b96397c1310ba6f11115e17d795187f..ab42821c94b383872bc56130fd258ebe660d93bb 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * deviced
+ * PASS (Power Aware System Service)
  *
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
index 29b6c855ba31a2ef409f0c580103ad06e6256467..5850d15d0e1b43d701102881e0d89f1b7692fe83 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * deviced
+ * PASS (Power Aware System Service)
  *
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
 #ifndef __LOG_H__
 #define __LOG_H__
 
-#ifdef ENABLE_LIBDEVICED_DLOG
+#ifdef ENABLE_LIBPASS_DLOG
 #define ENABLE_DLOG
 #endif
 
-#define LOG_TAG "DEVICED"
+#define LOG_TAG "PASS"
 #include "shared/log-macro.h"
 
 #endif
diff --git a/src/shared/pass-systemd.c b/src/shared/pass-systemd.c
new file mode 100644 (file)
index 0000000..e7f5f6f
--- /dev/null
@@ -0,0 +1,407 @@
+/*
+ * PASS
+ *
+ * Copyright (c) 2014 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.
+ */
+
+#define _GNU_SOURCE
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <assert.h>
+#include <dbus/dbus.h>
+#include <gio/gio.h>
+
+#include "common.h"
+#include "dbus.h"
+#include "pass-systemd.h"
+
+#include "core/log.h"
+
+
+#define SYSTEMD_UNIT_ESCAPE_CHAR       ".-"
+
+typedef unsigned int uint;
+typedef long long int64;
+typedef unsigned long long uint64;
+
+#define g_variant_type_int32           G_VARIANT_TYPE_INT32
+#define g_variant_type_int64           G_VARIANT_TYPE_INT64
+#define g_variant_type_uint32          G_VARIANT_TYPE_UINT32
+#define g_variant_type_uint64          G_VARIANT_TYPE_UINT64
+#define g_variant_type_string          G_VARIANT_TYPE_STRING
+
+#define g_variant_get_function_int32(v)                g_variant_get_int32(v)
+#define g_variant_get_function_int64(v)                g_variant_get_int64(v)
+#define g_variant_get_function_uint32(v)       g_variant_get_uint32(v)
+#define g_variant_get_function_uint64(v)       g_variant_get_uint64(v)
+#define g_variant_get_function_string(v)       g_variant_dup_string(v, NULL)
+
+
+static int pass_systemd_proxy_call_sync(const char *name,
+                                          const char *path,
+                                          const char *iface,
+                                          const char *method,
+                                          GVariant *variant,
+                                          GVariant **reply)
+{
+       GVariant *gvar;
+       GError *error;
+       GDBusProxy *proxy;
+       int ret = 0;
+
+#if (GLIB_MAJOR_VERSION <= 2 && GLIB_MINOR_VERSION < 36)
+       g_type_init();
+#endif
+
+       error = NULL;
+       proxy = g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM,
+                                             G_DBUS_PROXY_FLAGS_NONE,
+                                             NULL, /* GDBusInterfaceInfo */
+                                             name,
+                                             path,
+                                             iface,
+                                             NULL, /* GCancellable */
+                                             &error);
+
+       if (proxy == NULL) {
+               _E("Error creating proxy: %s", error->message);
+               ret = error->code;
+               g_error_free(error);
+               return ret;
+       }
+
+       error = NULL;
+       gvar = g_dbus_proxy_call_sync(proxy,
+                                     method,
+                                     variant,
+                                     G_DBUS_CALL_FLAGS_NONE,
+                                     -1,
+                                     NULL, /* GCancellable */
+                                     &error);
+
+       if (error) {
+               _E("Error proxy call sync: %s", error->message);
+               ret = error->code;
+               g_error_free(error);
+               return -ret;
+       }
+
+       g_assert(gvar != NULL);
+       *reply = gvar;
+       g_clear_error(&error);
+       g_object_unref(proxy);
+
+       return 0;
+}
+
+static int pass_systemd_start_or_stop_unit(char *method, char *name)
+{
+       int ret;
+       GVariant *reply = NULL;
+
+       _I("Starting: %s %s", method, name);
+       ret = pass_systemd_proxy_call_sync(SYSTEMD_DBUS_DEST,
+                                             SYSTEMD_DBUS_PATH,
+                                             SYSTEMD_DBUS_IFACE_MANAGER,
+                                             method,
+                                             g_variant_new("(ss)",
+                                                           name,
+                                                           "replace"),
+                                             &reply);
+       if (ret < 0)
+               goto finish;
+
+       if (!g_variant_is_of_type(reply, G_VARIANT_TYPE("(o)"))) {
+               ret = -EBADMSG;
+               goto finish;
+       }
+
+       ret = 0;
+finish:
+       _I("Finished(%d): %s %s", ret, method, name);
+
+       if (reply)
+               g_variant_unref(reply);
+
+       return ret;
+}
+
+int pass_systemd_start_unit(char *name)
+{
+       assert(name);
+
+       return pass_systemd_start_or_stop_unit("StartUnit", name);
+}
+
+int pass_systemd_stop_unit(char *name)
+{
+       assert(name);
+
+       return pass_systemd_start_or_stop_unit("StopUnit", name);
+}
+
+static char *pass_systemd_get_unit_dbus_path(const char *unit)
+{
+       char *path = NULL;
+       int i;
+       size_t p, k, prefix_len, unit_len = strlen(unit);
+       size_t path_len, len, escape;
+
+       assert(unit);
+
+       for (escape = 0, p = 0; p < unit_len; escape++) {
+               k = strcspn(unit+p, SYSTEMD_UNIT_ESCAPE_CHAR);
+               if (p+k >= unit_len)
+                       break;
+               p += k+1;
+       }
+
+       prefix_len = strlen(SYSTEMD_DBUS_UNIT_PATH);
+       /* assume we try to get object path of foo-bar.service then
+       * the object path will be
+       * "/org/freedesktop/systemd1/unit/foo_2dbar_2eservice\n". In
+       * this case we can find two escape characters, one of escape
+       * char('-') is changed to three of char("_2d"). So the total
+       * length will be: */
+       /* (PREFIX) + (unit - escape + 3*escape) + NULL */
+       path_len = prefix_len + (unit_len - escape)
+               + (escape * 3 * sizeof(char)) + 1;
+       path = (char *)calloc(path_len, sizeof(char));
+       if (!path)
+               return NULL;
+
+       strncpy(path, SYSTEMD_DBUS_UNIT_PATH, prefix_len + 1);
+       for (i = 0, p = 0; i <= escape; i++) {
+               k = strcspn(unit + p, SYSTEMD_UNIT_ESCAPE_CHAR);
+               strncpy(path + prefix_len, unit + p, k);
+               if (k < strlen(unit + p)) {
+                       len = path_len - (prefix_len + k);
+                       snprintf(path + prefix_len + k, len,
+                                       "_%x", *(unit + p + k) & 0xff);
+                       prefix_len += k+3;
+                       p += k+1;
+               }
+       }
+
+       return path;
+}
+
+static int pass_systemd_get_property(const char *name,
+                                       const char *path,
+                                       const char *iface,
+                                       const char *method,
+                                       const char *interface,
+                                       const char *property,
+                                       GVariant **reply)
+{
+       int ret;
+       GVariant *variant;
+
+       variant = g_variant_new("(ss)",
+                               interface,
+                               property);
+
+       ret = pass_systemd_proxy_call_sync(name,
+                                             path,
+                                             iface,
+                                             method,
+                                             variant,
+                                             reply);
+
+       return ret;
+}
+
+int pass_systemd_get_manager_property(const char *iface,
+                                        const char *property,
+                                        GVariant **variant)
+{
+       assert(iface);
+       assert(property);
+
+       return pass_systemd_get_property(SYSTEMD_DBUS_DEST,
+                                           SYSTEMD_DBUS_PATH,
+                                           DBUS_IFACE_DBUS_PROPERTIES,
+                                           "Get",
+                                           iface,
+                                           property,
+                                           variant);
+}
+
+int pass_systemd_get_unit_property(const char *unit,
+                                     const char *property,
+                                     GVariant **variant)
+{
+       int r;
+       char *escaped;
+
+       assert(unit);
+       assert(property);
+
+       escaped = pass_systemd_get_unit_dbus_path(unit);
+
+       r = pass_systemd_get_property(SYSTEMD_DBUS_DEST,
+                                        escaped,
+                                        DBUS_IFACE_DBUS_PROPERTIES,
+                                        "Get",
+                                        SYSTEMD_DBUS_IFACE_UNIT,
+                                        property,
+                                        variant);
+       free(escaped);
+       return r;
+}
+
+int pass_systemd_get_service_property(const char *unit,
+                                        const char *property,
+                                        GVariant **variant)
+{
+       int ret;
+       char *escaped;
+
+       assert(unit);
+       assert(property);
+
+       escaped = pass_systemd_get_unit_dbus_path(unit);
+
+       ret = pass_systemd_get_property(SYSTEMD_DBUS_DEST,
+                                          escaped,
+                                          DBUS_IFACE_DBUS_PROPERTIES,
+                                          "Get",
+                                          SYSTEMD_DBUS_IFACE_SERVICE,
+                                          property,
+                                          variant);
+       free(escaped);
+       return ret;
+}
+
+#define DEFINE_SYSTEMD_GET_PROPERTY(iface, type, value)                        \
+       int pass_systemd_get_##iface##_property_as_##type(              \
+                       const char *target,                             \
+                       const char *property,                           \
+                       value*result)                                   \
+       {                                                               \
+                                                                       \
+               GVariant *var;                                          \
+               GVariant *inner;                                        \
+               int r;                                                  \
+                                                                       \
+               r = pass_systemd_get_##iface##_property(target, \
+                                                          property,    \
+                                                          &var);       \
+               if (r < 0) {                                            \
+                       _E("Failed to get property:\n"                  \
+                          "  target: %s\n"                             \
+                          "  property: %s",                            \
+                          target, property);                           \
+                       return r;                                       \
+               }                                                       \
+                                                                       \
+               if (!g_variant_is_of_type(var,                          \
+                                         G_VARIANT_TYPE("(v)")))       \
+                       return -EBADMSG;                                \
+                                                                       \
+               g_variant_get(var, "(v)", &inner);                      \
+               if (!g_variant_is_of_type(inner,                        \
+                                         g_variant_type_##type))       \
+                       return -EBADMSG;                                \
+                                                                       \
+               *result = g_variant_get_function_##type(inner);         \
+               g_variant_unref(var);                                   \
+                                                                       \
+               return 0;                                               \
+       }
+
+/* int pass_systemd_get_manager_property_as_int32(const char *iface, const char *property, int *result); */
+DEFINE_SYSTEMD_GET_PROPERTY(manager, int32, int)
+/* int pass_systemd_get_manager_property_as_uint32(const char *iface, const char *property, unsigned int *result); */
+DEFINE_SYSTEMD_GET_PROPERTY(manager, uint32, uint)
+/* int pass_systemd_get_manager_property_as_int64(const char *iface, const char *property, long long *result); */
+DEFINE_SYSTEMD_GET_PROPERTY(manager, int64, long long)
+/* int pass_systemd_get_manager_property_as_uint64(const char *iface, const char *property, unsigned long long *result); */
+DEFINE_SYSTEMD_GET_PROPERTY(manager, uint64, unsigned long long)
+/* int pass_systemd_get_manager_property_as_string(const char *iface, const char *property, char **result); */
+DEFINE_SYSTEMD_GET_PROPERTY(manager, string, char*)
+/* int pass_systemd_get_unit_property_as_int32(const char *unit, const char *property, int *result); */
+DEFINE_SYSTEMD_GET_PROPERTY(unit, int32, int)
+/* int pass_systemd_get_unit_property_as_uint32(const char *unit, const char *property, unsigned int *result); */
+DEFINE_SYSTEMD_GET_PROPERTY(unit, uint32, uint)
+/* int pass_systemd_get_unit_property_as_int64(const char *unit, const char *property, long long *result); */
+DEFINE_SYSTEMD_GET_PROPERTY(unit, int64, long long)
+/* int pass_systemd_get_unit_property_as_uint64(const char *unit, const char *property, unsigned long long *result); */
+DEFINE_SYSTEMD_GET_PROPERTY(unit, uint64, unsigned long long)
+/* int pass_systemd_get_unit_property_as_string(const char *unit, const char *property, char **result); */
+DEFINE_SYSTEMD_GET_PROPERTY(unit, string, char*)
+/* int pass_systemd_get_service_property_as_int32(const char *unit, const char *property, int *result); */
+DEFINE_SYSTEMD_GET_PROPERTY(service, int32, int)
+/* int pass_systemd_get_service_property_as_uint32(const char *unit, const char *property, unsigned int *result); */
+DEFINE_SYSTEMD_GET_PROPERTY(service, uint32, uint)
+/* int pass_systemd_get_service_property_as_int64(const char *unit, const char *property, long long *result); */
+DEFINE_SYSTEMD_GET_PROPERTY(service, int64, long long)
+/* int pass_systemd_get_service_property_as_uint64(const char *unit, const char *property, unsigned long long *result); */
+DEFINE_SYSTEMD_GET_PROPERTY(service, uint64, unsigned long long)
+/* int pass_systemd_get_service_property_as_string(const char *unit, const char *property, char **result); */
+DEFINE_SYSTEMD_GET_PROPERTY(service, string, char*)
+
+int pass_systemd_instance_new_from_template(const char *template,
+                                              const char *instance,
+                                              const char **name)
+{
+       /* p point '@' */
+       /* e point '.' */
+       const char *p, *e;
+       char *prefix = NULL, *n = NULL;
+       int r;
+
+       assert(template);
+       p = strchr(template, '@');
+       if (!p) {
+               r = -EINVAL;
+               goto finish;
+       }
+
+       prefix = strndup(template, p - template + 1);
+       if (!prefix) {
+               r = -ENOMEM;
+               goto finish;
+       }
+
+       e = strrchr(p + 1, '.');
+       if (!e) {
+               r = -EINVAL;
+               goto finish;
+       }
+
+       /* verifying template. prefix@.service */
+       if (e != p + 1) {
+               r = -EINVAL;
+               goto finish;
+       }
+
+       r = asprintf(&n, "%s%s%s", prefix, instance, e);
+       if (r < 0) {
+               r = -ENOMEM;
+               goto finish;
+       }
+
+       *name = n;
+       r = 0;
+finish:
+       if (prefix)
+               free(prefix);
+
+       return r;
+}
diff --git a/src/shared/pass-systemd.h b/src/shared/pass-systemd.h
new file mode 100644 (file)
index 0000000..4374df0
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * PASS
+ *
+ * Copyright (c) 2014 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.
+ */
+
+
+#ifndef __PASS_SYSTEMD_H__
+#define __PASS_SYSTEMD_H__
+
+#include <dbus/dbus.h>
+#include <gio/gio.h>
+
+#define DBUS_IFACE_DBUS_PROPERTIES  DBUS_SERVICE_DBUS ".Properties"
+
+#define SYSTEMD_DBUS_DEST       "org.freedesktop.systemd1"
+#define SYSTEMD_DBUS_IFACE_MANAGER  SYSTEMD_DBUS_DEST ".Manager"
+#define SYSTEMD_DBUS_IFACE_UNIT     SYSTEMD_DBUS_DEST ".Unit"
+#define SYSTEMD_DBUS_IFACE_SERVICE  SYSTEMD_DBUS_DEST ".Service"
+#define SYSTEMD_DBUS_IFACE_TARGET   SYSTEMD_DBUS_DEST ".Target"
+
+#define SYSTEMD_DBUS_PATH       "/org/freedesktop/systemd1"
+#define SYSTEMD_DBUS_UNIT_PATH      SYSTEMD_DBUS_PATH "/unit/"
+
+int pass_systemd_start_unit(char *name);
+int pass_systemd_stop_unit(char *name);
+
+int pass_systemd_get_manager_property(const char *iface, const char *property, GVariant **variant);
+int pass_systemd_get_unit_property(const char *unit, const char *property, GVariant **variant);
+int pass_systemd_get_service_property(const char* unit, const char* property, GVariant **variant);
+
+int pass_systemd_get_manager_property_as_int32(const char *iface, const char *property, int *result);
+int pass_systemd_get_manager_property_as_uint32(const char *iface, const char *property, unsigned int *result);
+int pass_systemd_get_manager_property_as_int64(const char *iface, const char *property, long long *result);
+int pass_systemd_get_manager_property_as_uint64(const char *iface, const char *property, unsigned long long *result);
+int pass_systemd_get_manager_property_as_string(const char *iface, const char *property, char **result);
+int pass_systemd_get_unit_property_as_int32(const char *unit, const char *property, int *result);
+int pass_systemd_get_unit_property_as_uint32(const char *unit, const char *property, unsigned int *result);
+int pass_systemd_get_unit_property_as_int64(const char *unit, const char *property, long long *result);
+int pass_systemd_get_unit_property_as_uint64(const char *unit, const char *property, unsigned long long *result);
+int pass_systemd_get_unit_property_as_string(const char *unit, const char *property, char **result);
+int pass_systemd_get_service_property_as_int32(const char *unit, const char *property, int *result);
+int pass_systemd_get_service_property_as_uint32(const char *unit, const char *property, unsigned int *result);
+int pass_systemd_get_service_property_as_int64(const char *unit, const char *property, long long *result);
+int pass_systemd_get_service_property_as_uint64(const char *unit, const char *property, unsigned long long *result);
+int pass_systemd_get_service_property_as_string(const char *unit, const char *property, char **result);
+
+int pass_systemd_instance_new_from_template(const char *template, const char *instance, const char **name);
+
+#endif
index 44638e7e795a49db915a38d53b8cd680a81a5af1..c3163f68154132831c6d26c33578b83035caa1dc 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * deviced
+ * PASS (Power Aware System Service)
  *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2017 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.