Sync with the latest tizen 2.4 82/44682/1
authorSung-jae Park <nicesj.park@samsung.com>
Fri, 24 Jul 2015 13:50:18 +0000 (22:50 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Fri, 24 Jul 2015 13:50:18 +0000 (22:50 +0900)
Change-Id: If420d44f120a3e71494dd15f4da225990a66c969

35 files changed:
CMakeLists.txt
data/CMakeLists.txt
data/data-provider-master-badge.socket [new file with mode: 0644]
data/data-provider-master-client.socket [new file with mode: 0644]
data/data-provider-master-fd.socket [new file with mode: 0644]
data/data-provider-master-notification.socket [new file with mode: 0644]
data/data-provider-master-provider.socket [new file with mode: 0644]
data/data-provider-master-service.socket [new file with mode: 0644]
data/data-provider-master-shortcut.socket [new file with mode: 0644]
data/data-provider-master-utility.socket [new file with mode: 0644]
data/data-provider-master.target [new file with mode: 0644]
data/device/abi.ini
data/emulator/abi.ini
include/client_life.h
include/package.h
include/service_common.h
include/shared_fd_service.h [new file with mode: 0644]
include/slave_life.h
include/util.h
packaging/data-provider-master.spec
pkgmgr_widget/common/src/common.c
pkgmgr_widget/watch/src/service_watchapp.c
pkgmgr_widget/widget-application/src/service_widget.c
pkgmgr_widget/widget/src/service_widget.c
src/client_life.c
src/dead_monitor.c
src/instance.c
src/main.c
src/package.c
src/server.c
src/service_common.c
src/shared_fd_service.c [new file with mode: 0644]
src/slave_life.c
src/util.c
src/utility_service.c

index d7ca326..8ca3785 100644 (file)
@@ -64,9 +64,11 @@ ADD_DEFINITIONS("-D_GNU_SOURCE")
 ADD_DEFINITIONS("-D_FILE_OFFSET_BITS=64")
 
 ADD_DEFINITIONS("-DINFO_SOCKET=\"/opt/usr/share/live_magazine/.live.socket\"")
-ADD_DEFINITIONS("-DCLIENT_SOCKET=\"/opt/usr/share/live_magazine/.client.socket\"")
-ADD_DEFINITIONS("-DSLAVE_SOCKET=\"/opt/usr/share/live_magazine/.slave.socket\"")
-ADD_DEFINITIONS("-DSERVICE_SOCKET=\"/opt/usr/share/live_magazine/.service.socket\"")
+ADD_DEFINITIONS("-DCLIENT_SOCKET=\"/tmp/.data-provider-master-client.socket\"")
+ADD_DEFINITIONS("-DSLAVE_SOCKET=\"/tmp/.data-provider-master-slave.socket\"")
+ADD_DEFINITIONS("-DSERVICE_SOCKET=\"/tmp/.data-provider-master-service.socket\"")
+ADD_DEFINITIONS("-DSHARED_SOCKET=\"/tmp/.data-provider-master-fd.socket\"")
+
 ADD_DEFINITIONS("-DCATEGORY_WATCH_CLOCK=\"http://tizen.org/category/wearable_clock\"")
 
 ADD_DEFINITIONS("-DCLIENT_PORT=\"8208\"")
@@ -130,11 +132,12 @@ IF (LIVEBOX)
                src/file_service.c
                src/conf.c
                src/monitor.c
+               src/shared_fd_service.c
        )
 
        IF (WAYLAND_SUPPORT)
                ADD_DEFINITIONS("-DHAVE_WAYLAND")
-               SET(BUILD_SOURCE 
+               SET(BUILD_SOURCE
                        ${BUILD_SOURCE}
                        src/xmonitor_wayland.c
                        src/buffer_handler_wayland.c
@@ -144,7 +147,7 @@ IF (LIVEBOX)
 
        IF (X11_SUPPORT)
                ADD_DEFINITIONS("-DHAVE_X11")
-               SET(BUILD_SOURCE 
+               SET(BUILD_SOURCE
                        ${BUILD_SOURCE}
                        src/xmonitor.c
                        src/buffer_handler.c
@@ -155,7 +158,7 @@ ENDIF (LIVEBOX)
 
 IF (WAYLAND_SUPPORT)
        ADD_DEFINITIONS("-DHAVE_WAYLAND")
-       SET(BUILD_SOURCE 
+       SET(BUILD_SOURCE
                ${BUILD_SOURCE}
                src/util_wayland.c
        )
@@ -163,7 +166,7 @@ ENDIF (WAYLAND_SUPPORT)
 
 IF (X11_SUPPORT)
        ADD_DEFINITIONS("-DHAVE_X11")
-       SET(BUILD_SOURCE 
+       SET(BUILD_SOURCE
                ${BUILD_SOURCE}
                src/util_x11.c
        )
index ef51d99..aa56f64 100644 (file)
@@ -4,3 +4,13 @@ INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}.path DESTINATION /usr/lib
 IF (LIVEBOX)
 INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/dump_widget.sh DESTINATION /opt/etc/dump.d/module.d/ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
 ENDIF (LIVEBOX)
+
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}.target DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-client.socket DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-provider.socket DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-fd.socket DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-service.socket DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-badge.socket DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-notification.socket DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-shortcut.socket DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-utility.socket DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
diff --git a/data/data-provider-master-badge.socket b/data/data-provider-master-badge.socket
new file mode 100644 (file)
index 0000000..bbfd3fa
--- /dev/null
@@ -0,0 +1,16 @@
+[Socket]
+SocketUser=system
+SocketGroup=system
+ListenStream=/tmp/.badge.service
+SocketMode=0666
+SmackLabelIPIn=data-provider-master::badge
+SmackLabelIPOut=@
+
+Service=data-provider-master.service
+
+[Unit]
+Wants=data-provider-master.target
+Before=data-provider-master.target
+
+[Install]
+WantedBy=sockets.target
diff --git a/data/data-provider-master-client.socket b/data/data-provider-master-client.socket
new file mode 100644 (file)
index 0000000..97727d1
--- /dev/null
@@ -0,0 +1,16 @@
+[Socket]
+SocketUser=system
+SocketGroup=system
+ListenStream=/tmp/.data-provider-master-client.socket
+SocketMode=0666
+SmackLabelIPIn=data-provider-master::client
+SmackLabelIPOut=@
+
+Service=data-provider-master.service
+
+[Unit]
+Wants=data-provider-master.target
+Before=data-provider-master.target
+
+[Install]
+WantedBy=sockets.target
diff --git a/data/data-provider-master-fd.socket b/data/data-provider-master-fd.socket
new file mode 100644 (file)
index 0000000..0c29dba
--- /dev/null
@@ -0,0 +1,16 @@
+[Socket]
+SocketUser=system
+SocketGroup=system
+ListenStream=/tmp/.data-provider-master-fd.socket
+SocketMode=0666
+SmackLabelIPIn=data-provider-master::fd
+SmackLabelIPOut=@
+
+Service=data-provider-master.service
+
+[Unit]
+Wants=data-provider-master.target
+Before=data-provider-master.target
+
+[Install]
+WantedBy=sockets.target
diff --git a/data/data-provider-master-notification.socket b/data/data-provider-master-notification.socket
new file mode 100644 (file)
index 0000000..b535537
--- /dev/null
@@ -0,0 +1,16 @@
+[Socket]
+SocketUser=system
+SocketGroup=system
+ListenStream=/tmp/.notification.service
+SocketMode=0666
+SmackLabelIPIn=data-provider-master::notification
+SmackLabelIPOut=@
+
+Service=data-provider-master.service
+
+[Unit]
+Wants=data-provider-master.target
+Before=data-provider-master.target
+
+[Install]
+WantedBy=sockets.target
diff --git a/data/data-provider-master-provider.socket b/data/data-provider-master-provider.socket
new file mode 100644 (file)
index 0000000..2428301
--- /dev/null
@@ -0,0 +1,16 @@
+[Socket]
+SocketUser=system
+SocketGroup=system
+ListenStream=/tmp/.data-provider-master-slave.socket
+SocketMode=0666
+SmackLabelIPIn=data-provider-master::provider
+SmackLabelIPOut=@
+
+Service=data-provider-master.service
+
+[Unit]
+Wants=data-provider-master.target
+Before=data-provider-master.target
+
+[Install]
+WantedBy=sockets.target
diff --git a/data/data-provider-master-service.socket b/data/data-provider-master-service.socket
new file mode 100644 (file)
index 0000000..c3f7166
--- /dev/null
@@ -0,0 +1,16 @@
+[Socket]
+SocketUser=system
+SocketGroup=system
+ListenStream=/tmp/.data-provider-master-service.socket
+SocketMode=0666
+SmackLabelIPIn=data-provider-master
+SmackLabelIPOut=@
+
+Service=data-provider-master.service
+
+[Unit]
+Wants=data-provider-master.target
+Before=data-provider-master.target
+
+[Install]
+WantedBy=sockets.target
diff --git a/data/data-provider-master-shortcut.socket b/data/data-provider-master-shortcut.socket
new file mode 100644 (file)
index 0000000..0c3dacd
--- /dev/null
@@ -0,0 +1,16 @@
+[Socket]
+SocketUser=system
+SocketGroup=system
+ListenStream=/tmp/.shortcut.service
+SocketMode=0666
+SmackLabelIPIn=data-provider-master::shortcut
+SmackLabelIPOut=@
+
+Service=data-provider-master.service
+
+[Unit]
+Wants=data-provider-master.target
+Before=data-provider-master.target
+
+[Install]
+WantedBy=sockets.target
diff --git a/data/data-provider-master-utility.socket b/data/data-provider-master-utility.socket
new file mode 100644 (file)
index 0000000..33d25fd
--- /dev/null
@@ -0,0 +1,16 @@
+[Socket]
+SocketUser=system
+SocketGroup=system
+ListenStream=/tmp/.utility.service
+SocketMode=0666
+SmackLabelIPIn=data-provider-master::utility
+SmackLabelIPOut=@
+
+Service=data-provider-master.service
+
+[Unit]
+Wants=data-provider-master.target
+Before=data-provider-master.target
+
+[Install]
+WantedBy=sockets.target
diff --git a/data/data-provider-master.target b/data/data-provider-master.target
new file mode 100644 (file)
index 0000000..cc07318
--- /dev/null
@@ -0,0 +1,3 @@
+[Unit]
+Description=data-provider-master sockets
+DefaultDependencies=true
index 048f85e..3b57cd0 100644 (file)
@@ -15,3 +15,6 @@ package=/APPID/
 
 [svc]
 package=org.tizen.data-provider-slave.svc
+
+[meta]
+package=meta-key
index 048f85e..3b57cd0 100644 (file)
@@ -15,3 +15,6 @@ package=/APPID/
 
 [svc]
 package=org.tizen.data-provider-slave.svc
+
+[meta]
+package=meta-key
index 93d7cb6..e96d103 100644 (file)
@@ -112,6 +112,9 @@ extern int client_browse_category_list(const char *category, int (*cb)(struct cl
 extern int client_broadcast(struct inst_info *inst, struct packet *packet);
 
 extern const char *client_direct_addr(const struct client_node *client);
+extern struct client_node *client_find_by_direct_addr(const char *direct_addr);
+extern void client_set_direct_fd(struct client_node *client, int fd);
+extern int client_direct_fd(struct client_node *client);
 
 extern int client_orientation(const struct client_node *client);
 extern void client_set_orientation(struct client_node *client, int orientation);
index 9159803..fe6e9c4 100644 (file)
@@ -121,4 +121,6 @@ extern int package_faulted(struct pkg_info *info, int broadcast);
 extern char *package_get_pkgid(const char *appid);
 
 extern int package_instance_count(struct pkg_info *info);
+extern char *package_meta_tag(const char *appid, const char *meta_tag);
+
 /* End of a file */
index de3a0ba..188435a 100644 (file)
@@ -47,6 +47,7 @@ extern int tcb_is_valid(struct service_context *svc_ctx, struct tcb *tcb);
 
 extern struct service_context *service_common_create(const char *addr, const char *label, int (*service_thread_main)(struct tcb *tcb, struct packet *packet, void *data), void *data);
 extern int service_common_destroy(struct service_context *svc_ctx);
+extern int service_common_destroy_tcb(struct service_context *svc_ctx, struct tcb *tcb);
 
 extern int service_common_multicast_packet(struct tcb *tcb, struct packet *packet, int type);
 extern int service_common_unicast_packet(struct tcb *tcb, struct packet *packet);
diff --git a/include/shared_fd_service.h b/include/shared_fd_service.h
new file mode 100644 (file)
index 0000000..4c2475c
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2013  Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+extern int shared_fd_service_init(void);
+extern int shared_fd_service_fini(void);
+
+/* End of a file */
index db52ebd..aebc949 100644 (file)
@@ -34,39 +34,40 @@ enum slave_event {
 };
 
 enum slave_state {
-       /*!
+       /**
+        * @note
         * Launch the slave but not yet receives "hello" packet
         */
        SLAVE_REQUEST_TO_LAUNCH,
 
-       /*!
-        * \note
+       /**
+        * @note
         * Terminate the slave but not yet receives dead signal
         */
        SLAVE_REQUEST_TO_TERMINATE,
 
-       /*!
-        * \note
+       /**
+        * @note
         * No slave process exists, just slave object created
         */
        SLAVE_TERMINATED,
 
-       /*!
-        * \note
+       /**
+        * @note
         * State change request is sent,
         */
        SLAVE_REQUEST_TO_PAUSE,
        SLAVE_REQUEST_TO_RESUME,
 
-       /*!
-        * \note
+       /**
+        * @note
         * Request an action for disconnecting to master from the provider side.
         * This flag should be treated as an activated state.
         */
        SLAVE_REQUEST_TO_DISCONNECT,
 
-       /*!
-        * \note
+       /**
+        * @note
         * SLAVE_ACTIVATED = { SLAVE_PAUSED, SLAVE_RESUMED }
         */
        SLAVE_PAUSED,
@@ -227,4 +228,7 @@ extern void slave_set_is_watch(struct slave_node *slave, int flag);
 extern int slave_set_resource_limit(struct slave_node *slave, unsigned int soft, unsigned int hard);
 extern int slave_get_resource_limit(struct slave_node *slave, unsigned int *soft, unsigned int *hard);
 
+extern void slave_set_wait_deactivation(struct slave_node *slave, int wait);
+extern int slave_wait_deactivation(struct slave_node *slave);
+
 /* End of a file */
index 132bfda..3aa09d2 100644 (file)
@@ -26,9 +26,6 @@ extern void *util_timer_add(double interval, Eina_Bool (*cb)(void *data), void *
 extern void util_timer_interval_set(void *timer, double interval);
 extern double util_time_delay_for_compensation(double period);
 extern void util_setup_log_disk(void);
-extern void util_remove_emergency_disk(void);
-extern void util_prepare_emergency_disk(void);
-extern int util_emergency_disk_is_mounted(void);
 extern int util_service_is_enabled(const char *tag);
 extern int util_string_is_in_list(const char *str, const char *haystack);
 
index 5d011b9..2dd01ac 100644 (file)
@@ -2,7 +2,7 @@
 
 Name: data-provider-master
 Summary: Master service provider for widgetes
-Version: 1.1.8
+Version: 1.1.10
 Release: 1
 Group: Applications/Core Applications
 License: Flora-1.1
@@ -112,6 +112,16 @@ mkdir -p %{buildroot}/%{_datarootdir}/license
 mkdir -p %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants
 ln -sf ../%{name}.service %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}.service
 ln -sf ../%{name}.path %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}.path
+ln -sf ../%{name}.target %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}.target
+ln -sf ../%{name}-client.socket %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}-client.socket
+ln -sf ../%{name}-provider.socket %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}-provider.socket
+ln -sf ../%{name}-service.socket %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}-service.socket
+ln -sf ../%{name}-badge.socket %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}-badge.socket
+ln -sf ../%{name}-notification.socket %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}-notification.socket
+ln -sf ../%{name}-shortcut.socket %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}-shortcut.socket
+ln -sf ../%{name}-utility.socket %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}-utility.socket
+ln -sf ../%{name}-fd.socket %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}-fd.socket
+
 mkdir -p %{buildroot}/opt/usr/share/live_magazine
 mkdir -p %{buildroot}/opt/usr/share/live_magazine/log
 mkdir -p %{buildroot}/opt/usr/share/live_magazine/reader
@@ -162,7 +172,6 @@ else
 fi
 
 chown ${APP_UID}:${APP_GID} /opt/usr/share/live_magazine
-
 # System tool(widget-mgr) should be able to access this folder.
 # So give the "rx" permission to the other group. (750 -> 755)
 chmod 755 /opt/usr/share/live_magazine
@@ -189,10 +198,28 @@ echo "Successfully installed. Please start a daemon again manually"
 %manifest %{name}.manifest
 %defattr(-,root,root,-)
 %caps(cap_chown,cap_dac_override,cap_dac_read_search,cap_sys_admin,cap_sys_nice,cap_mac_override,cap_mac_admin+ep) %{_bindir}/%{name}
-%{_prefix}/lib/systemd/user/default.target.wants/%{name}.service
-%{_prefix}/lib/systemd/user/default.target.wants/%{name}.path
+%{_prefix}/lib/systemd/user/%{name}.target
+%{_prefix}/lib/systemd/user/%{name}-client.socket
+%{_prefix}/lib/systemd/user/%{name}-provider.socket
+%{_prefix}/lib/systemd/user/%{name}-service.socket
+%{_prefix}/lib/systemd/user/%{name}-badge.socket
+%{_prefix}/lib/systemd/user/%{name}-notification.socket
+%{_prefix}/lib/systemd/user/%{name}-shortcut.socket
+%{_prefix}/lib/systemd/user/%{name}-utility.socket
+%{_prefix}/lib/systemd/user/%{name}-fd.socket
 %{_prefix}/lib/systemd/user/%{name}.service
 %{_prefix}/lib/systemd/user/%{name}.path
+%{_prefix}/lib/systemd/user/default.target.wants/%{name}.target
+%{_prefix}/lib/systemd/user/default.target.wants/%{name}-client.socket
+%{_prefix}/lib/systemd/user/default.target.wants/%{name}-provider.socket
+%{_prefix}/lib/systemd/user/default.target.wants/%{name}-service.socket
+%{_prefix}/lib/systemd/user/default.target.wants/%{name}-badge.socket
+%{_prefix}/lib/systemd/user/default.target.wants/%{name}-notification.socket
+%{_prefix}/lib/systemd/user/default.target.wants/%{name}-shortcut.socket
+%{_prefix}/lib/systemd/user/default.target.wants/%{name}-utility.socket
+%{_prefix}/lib/systemd/user/default.target.wants/%{name}-fd.socket
+%{_prefix}/lib/systemd/user/default.target.wants/%{name}.service
+%{_prefix}/lib/systemd/user/default.target.wants/%{name}.path
 %{_datarootdir}/license/*
 %if 0%{?tizen_build_binary_release_type_eng}
 /opt/usr/devel/usr/bin/*
index 62b10a0..1175467 100644 (file)
@@ -31,6 +31,7 @@
 
 #include <widget_service.h>
 #include <widget_service_internal.h>
+#include <widget_abi.h>
 
 #include "dlist.h"
 #include "common.h"
@@ -880,6 +881,7 @@ out:
        sqlite3_finalize(stmt);
        return ret;
 }
+
 static int db_insert_provider(struct widget *widget)
 {
        static const char *dml;
@@ -2356,7 +2358,7 @@ static void update_support_size(struct widget *widget, xmlNodePtr node)
        }
 
        widget->default_mouse_event = 0;
-       widget->default_touch_effect = 1;
+       widget->default_touch_effect = 0;
        widget->default_need_frame = 0;
 
        if (xmlHasProp(node, (const xmlChar *)"mode")) {
@@ -2478,14 +2480,14 @@ static void update_box(struct widget *widget, xmlNodePtr node)
        }
 
        if (!xmlHasProp(node, (const xmlChar *)"touch_effect")) {
-               widget->default_touch_effect = 1;
+               widget->default_touch_effect = 0;
        } else {
                xmlChar *touch_effect;
 
                touch_effect = xmlGetProp(node, (const xmlChar *)"touch_effect");
                if (!touch_effect) {
                        ErrPrint("default touch_effect is NIL\n");
-                       widget->default_touch_effect = 1;
+                       widget->default_touch_effect = 0;
                } else {
                        widget->default_touch_effect = !xmlStrcasecmp(touch_effect, (const xmlChar *)"true");
                        xmlFree(touch_effect);
@@ -3035,6 +3037,34 @@ errout:
        return ret;
 }
 
+static int has_meta_tag(const char *appid, const char *meta_tag)
+{
+       int ret;
+       char *value = NULL;
+       pkgmgrinfo_appinfo_h handle;
+
+       if (!meta_tag) {
+               ErrPrint("meta ABI is not valid (%s)\n", appid);
+               return 0;
+       }
+
+       ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+       if (ret != PMINFO_R_OK) {
+               return 0;
+       }
+
+       ret = pkgmgrinfo_appinfo_get_metadata_value(handle, meta_tag, &value);
+       if (ret != PMINFO_R_OK) {
+               pkgmgrinfo_appinfo_destroy_appinfo(handle);
+               return 0;
+       }
+
+       ret = value && value[0] != '\0';
+
+       pkgmgrinfo_appinfo_destroy_appinfo(handle);
+       return ret;
+}
+
 int db_install_widget(xmlNodePtr node, const char *appid)
 {
        struct widget *widget;
@@ -3361,6 +3391,20 @@ int db_install_widget(xmlNodePtr node, const char *appid)
                DbgPrint("Default MAIN UI-APP: [%s]\n", (char *)widget->uiapp);
        }
 
+       /**
+        * Check the "meta" tag of this widget.
+        * If it has speicific meta tag, replace "abi" with "meta".
+        */
+       if (has_meta_tag((const char *)widget->pkgid, widget_abi_get_pkgname_by_abi("meta"))) {
+               DbgPrint("Meta tag is overrided: %s -> meta\n", (char *)widget->abi);
+
+               if (widget->abi) {
+                       xmlFree(widget->abi);
+               }
+
+               widget->abi = xmlStrdup((xmlChar *)"meta");
+       }
+
        return db_insert_widget(widget, appid);
 }
 
index fe36772..efbfc62 100644 (file)
@@ -15,6 +15,7 @@
  */
 
 #include "common.h"
+#include <widget_abi.h>
 
 #define WATCH_APP_TAG  "watch-application"
 #define EAPI __attribute__((visibility("default")))
@@ -36,6 +37,7 @@ static inline int remove_all_watch(const char *appid)
 
 EAPI int PKGMGR_PARSER_PLUGIN_PRE_INSTALL(const char *appid)
 {
+       widget_abi_init();
     ErrPrintWithConsole("%s\n", appid);
 
     if (!db_check()) {
@@ -54,6 +56,7 @@ EAPI int PKGMGR_PARSER_PLUGIN_POST_INSTALL(const char *appid)
 {
     ErrPrintWithConsole("[%s]\n", appid);
     db_fini();
+       widget_abi_fini();
     return 0;
 }
 
@@ -90,6 +93,7 @@ EAPI int PKGMGR_PARSER_PLUGIN_INSTALL(xmlDocPtr docPtr, const char *appid)
 
 EAPI int PKGMGR_PARSER_PLUGIN_PRE_UPGRADE(const char *appid)
 {
+       widget_abi_init();
     ErrPrintWithConsole("[%s]\n", appid);
 
     if (!db_check()) {
@@ -108,6 +112,7 @@ EAPI int PKGMGR_PARSER_PLUGIN_POST_UPGRADE(const char *appid)
 {
     ErrPrintWithConsole("[%s]\n", appid);
     db_fini();
+       widget_abi_fini();
     return 0;
 }
 
@@ -143,6 +148,7 @@ EAPI int PKGMGR_PARSER_PLUGIN_UPGRADE(xmlDocPtr docPtr, const char *appid)
 
 EAPI int PKGMGR_PARSER_PLUGIN_PRE_UNINSTALL(const char *appid)
 {
+       widget_abi_init();
     ErrPrintWithConsole("[%s]\n", appid);
 
     if (!db_check()) {
@@ -167,6 +173,7 @@ EAPI int PKGMGR_PARSER_PLUGIN_POST_UNINSTALL(const char *appid)
        remove_all_watch(appid);
 
     db_fini();
+       widget_abi_fini();
     return 0;
 }
 
index 4c812fc..2fbe654 100644 (file)
@@ -16,6 +16,7 @@
 
 #include <libxml/parser.h>
 #include <libxml/tree.h>
+#include <widget_abi.h>
 
 #include "common.h"
 
@@ -41,6 +42,7 @@ static inline int remove_all_widgets(const char *appid)
 
 EAPI int PKGMGR_PARSER_PLUGIN_PRE_INSTALL(const char *appid)
 {
+       widget_abi_init();
     if (!db_check()) {
                if (db_init() < 0) {
                        ErrPrintWithConsole("Failed to init DB\n");
@@ -57,6 +59,7 @@ EAPI int PKGMGR_PARSER_PLUGIN_POST_INSTALL(const char *appid)
 {
     ErrPrintWithConsole("[%s]\n", appid);
     db_fini();
+       widget_abi_fini();
     return 0;
 }
 
@@ -93,6 +96,7 @@ EAPI int PKGMGR_PARSER_PLUGIN_INSTALL(xmlDocPtr docPtr, const char *appid)
 
 EAPI int PKGMGR_PARSER_PLUGIN_PRE_UPGRADE(const char *appid)
 {
+       widget_abi_init();
     if (!db_check()) {
                if (db_init() < 0) {
                        ErrPrintWithConsole("Failed to init DB\n");
@@ -109,6 +113,7 @@ EAPI int PKGMGR_PARSER_PLUGIN_POST_UPGRADE(const char *appid)
 {
     ErrPrintWithConsole("[%s]\n", appid);
     db_fini();
+       widget_abi_fini();
     return 0;
 }
 
@@ -144,6 +149,7 @@ EAPI int PKGMGR_PARSER_PLUGIN_UPGRADE(xmlDocPtr docPtr, const char *appid)
 
 EAPI int PKGMGR_PARSER_PLUGIN_PRE_UNINSTALL(const char *appid)
 {
+       widget_abi_init();
     ErrPrintWithConsole("[%s]\n", appid);
 
     if (!db_check()) {
@@ -165,6 +171,7 @@ EAPI int PKGMGR_PARSER_PLUGIN_POST_UNINSTALL(const char *appid)
        ret = remove_all_widgets(appid);
 
     db_fini();
+       widget_abi_fini();
     return ret;
 }
 
index 48be3ef..231efcc 100644 (file)
@@ -16,6 +16,7 @@
 
 #include <libxml/parser.h>
 #include <libxml/tree.h>
+#include <widget_abi.h>
 
 #include "common.h"
 
@@ -41,6 +42,7 @@ static inline int remove_all_widgets(const char *appid)
 
 EAPI int PKGMGR_PARSER_PLUGIN_PRE_INSTALL(const char *appid)
 {
+       widget_abi_init();
     if (!db_check()) {
                if (db_init() < 0) {
                        ErrPrintWithConsole("Failed to init DB\n");
@@ -57,6 +59,7 @@ EAPI int PKGMGR_PARSER_PLUGIN_POST_INSTALL(const char *appid)
 {
     ErrPrintWithConsole("[%s]\n", appid);
     db_fini();
+       widget_abi_fini();
     return 0;
 }
 
@@ -93,6 +96,7 @@ EAPI int PKGMGR_PARSER_PLUGIN_INSTALL(xmlDocPtr docPtr, const char *appid)
 
 EAPI int PKGMGR_PARSER_PLUGIN_PRE_UPGRADE(const char *appid)
 {
+       widget_abi_init();
     if (!db_check()) {
                if (db_init() < 0) {
                        ErrPrintWithConsole("Failed to init DB\n");
@@ -109,6 +113,7 @@ EAPI int PKGMGR_PARSER_PLUGIN_POST_UPGRADE(const char *appid)
 {
     ErrPrintWithConsole("[%s]\n", appid);
     db_fini();
+       widget_abi_fini();
     return 0;
 }
 
@@ -144,6 +149,7 @@ EAPI int PKGMGR_PARSER_PLUGIN_UPGRADE(xmlDocPtr docPtr, const char *appid)
 
 EAPI int PKGMGR_PARSER_PLUGIN_PRE_UNINSTALL(const char *appid)
 {
+       widget_abi_init();
     ErrPrintWithConsole("[%s]\n", appid);
 
     if (!db_check()) {
@@ -165,6 +171,7 @@ EAPI int PKGMGR_PARSER_PLUGIN_POST_UNINSTALL(const char *appid)
        ret = remove_all_widgets(appid);
 
     db_fini();
+       widget_abi_fini();
     return ret;
 }
 
index e5f8228..fb3c99d 100644 (file)
@@ -112,9 +112,12 @@ struct client_node {
        Eina_List *category_subscribe_list;
 
        int faulted;
-       char *direct_addr;
        int orientation;
        int is_sdk_viewer;
+       struct _direct {
+               char *addr;
+               int fd;
+       } direct;
 };
 
 static inline void invoke_global_destroyed_cb(struct client_node *client)
@@ -259,9 +262,15 @@ static inline void destroy_client_data(struct client_node *client)
                s_info.nr_of_paused_clients--;
        }
 
-       if (client->direct_addr) {
-               (void)unlink(client->direct_addr);
-               DbgFree(client->direct_addr);
+       if (client->direct.addr) {
+               (void)unlink(client->direct.addr);
+               DbgFree(client->direct.addr);
+       }
+
+       if (client->direct.fd >= 0) {
+               if (close(client->direct.fd) < 0) {
+                       ErrPrint("Client FD: %d\n", errno);
+               }
        }
 
        DbgFree(client->appid);
@@ -290,6 +299,7 @@ static struct client_node *create_client_data(pid_t pid, const char *direct_addr
 
        client->pid = pid;
        client->refcnt = 1;
+       client->direct.fd = -1;
 
        if (aul_app_get_pkgname_bypid(pid, pid_pkgname, sizeof(pid_pkgname)) == AUL_R_OK) {
                client->appid = strdup(pid_pkgname);
@@ -303,8 +313,8 @@ static struct client_node *create_client_data(pid_t pid, const char *direct_addr
        }
 
        if (direct_addr && direct_addr[0]) {
-               client->direct_addr = strdup(direct_addr);
-               if (!client->direct_addr) {
+               client->direct.addr = strdup(direct_addr);
+               if (!client->direct.addr) {
                        ErrPrint("Failed to allocate direct_addr (%s)\n", direct_addr);
                }
        }
@@ -1040,7 +1050,7 @@ HAPI int client_broadcast(struct inst_info *inst, struct packet *packet)
 
 HAPI const char *client_direct_addr(const struct client_node *client)
 {
-       return client ? client->direct_addr : NULL;
+       return client ? client->direct.addr : NULL;
 }
 
 HAPI void client_set_orientation(struct client_node *client, int orientation)
@@ -1063,4 +1073,32 @@ HAPI int client_is_sdk_viewer(const struct client_node *client)
        return client ? client->is_sdk_viewer : 0;
 }
 
+HAPI struct client_node *client_find_by_direct_addr(const char *direct_addr)
+{
+       Eina_List *l;
+       struct client_node *client;
+
+       if (!direct_addr) {
+               return NULL;
+       }
+
+       EINA_LIST_FOREACH(s_info.client_list, l, client) {
+               if (client->direct.addr && !strcmp(client->direct.addr, direct_addr)) {
+                       return client;
+               }
+       }
+
+       return NULL;
+}
+
+HAPI void client_set_direct_fd(struct client_node *client, int fd)
+{
+       client->direct.fd = fd;
+}
+
+HAPI int client_direct_fd(struct client_node *client)
+{
+       return client->direct.fd;
+}
+
 /* End of a file */
index 706a809..ad6b2e7 100644 (file)
@@ -74,7 +74,22 @@ static int evt_cb(int handle, void *data)
                                slave = slave_deactivated(slave);
                                break;
                        default:
-                               slave = slave_deactivated_by_fault(slave);
+                               if (slave_wait_deactivation(slave)) {
+                                       /**
+                                        * @note
+                                        * Slave is waiting the termination,
+                                        * in this case, it should be dealt as a normal termination.
+                                        */
+
+                                       DbgPrint("Slave is waiting deactivation, Do not re-activate automatically in this case\n");
+                                       slave_set_wait_deactivation(slave, 0);
+                                       slave_set_reactivation(slave, 0);
+                                       slave_set_reactivate_instances(slave, 1);
+
+                                       slave = slave_deactivated(slave);
+                               } else {
+                                       slave = slave_deactivated_by_fault(slave);
+                               }
                                break;
                        }
                }
index 9fcc87b..d9e0d0b 100644 (file)
@@ -1700,6 +1700,48 @@ HAPI int instance_destroy(struct inst_info *inst, widget_destroy_type_e type)
                inst->requested_state = INST_DESTROYED;
                return WIDGET_ERROR_NONE;
        default:
+               if (type == WIDGET_DESTROY_TYPE_UNINSTALL || type == WIDGET_DESTROY_TYPE_UPGRADE) {
+                       struct pkg_info *pkg;
+
+                       /**
+                        * @note
+                        * In this case, we cannot re-activate the slave.
+                        * Because it is already uninstalled so there is no widget application anymore.
+                        * So just clear the instances from the homescreen
+                        */
+                       pkg = instance_package(inst);
+                       if (pkg) {
+                               struct slave_node *slave;
+
+                               slave = package_slave(pkg);
+                               if (slave) {
+                                       /**
+                                        * @note
+                                        * If a slave is not activated, (already deactivated)
+                                        * We don't need to try to destroy an instance.
+                                        * Just delete an instance from here.
+                                        */
+                                       if (!slave_is_activated(slave)) {
+                                               /**
+                                                * @note
+                                                * Notify deleted instance information to the viewer.
+                                                */
+                                               if (inst->unicast_delete_event) {
+                                                       instance_unicast_deleted_event(inst, NULL, WIDGET_ERROR_NONE);
+                                               } else {
+                                                       instance_broadcast_deleted_event(inst, WIDGET_ERROR_NONE);
+                                               }
+
+                                               DbgPrint("Slave is deactivated, delete an instance\n");
+                                               inst->state = INST_DESTROYED;
+                                               inst->requested_state = INST_DESTROYED;
+                                               (void)instance_unref(inst);
+                                               return WIDGET_ERROR_NONE;
+                                       }
+                               }
+                       }
+               }
+
                break;
        }
 
@@ -1744,6 +1786,33 @@ HAPI int instance_reload(struct inst_info *inst, widget_destroy_type_e type)
                DbgPrint("Instance is destroying now\n");
                return WIDGET_ERROR_NONE;
        default:
+               if (type == WIDGET_DESTROY_TYPE_UNINSTALL || type == WIDGET_DESTROY_TYPE_UPGRADE) {
+                       struct pkg_info *pkg;
+
+                       pkg = instance_package(inst);
+                       if (pkg) {
+                               struct slave_node *slave;
+
+                               slave = package_slave(pkg);
+                               if (slave) {
+                                       /**
+                                        * @note
+                                        * If a slave is not activated, (already deactivated)
+                                        * We don't need to try to destroy an instance.
+                                        * Just re-activate an instance from here.
+                                        */
+                                       if (!slave_is_activated(slave)) {
+                                               inst->state = INST_INIT;
+                                               DbgPrint("Slave is deactivated, just activate an instasnce\n");
+                                               ret = instance_activate(inst);
+                                               if (ret < 0) {
+                                                       ErrPrint("Failed to activate instance: %d (%s)\n", ret, instance_id(inst));
+                                               }
+                                               return WIDGET_ERROR_NONE;
+                                       }
+                               }
+                       }
+               }
                break;
        }
 
index c5cc9f8..748b5f6 100644 (file)
@@ -67,6 +67,7 @@
 #include "shortcut_service.h"
 #include "notification_service.h"
 #include "badge_service.h"
+#include "shared_fd_service.h"
 
 #if defined(FLOG)
 #define TMP_LOG_FILE "/tmp/live.log"
@@ -139,6 +140,11 @@ static inline int app_create(void)
                DbgPrint("Buffer handler init is done: %d\n", ret);
        }
 
+       ret = shared_fd_service_init();
+       if (ret < 0) {
+               DbgPrint("Shared FD service init is done: %d\n", ret);
+       }
+
        /*!
         * \note
         * After initiate all other sub-systtems,
@@ -215,6 +221,11 @@ static inline int app_terminate(void)
                DbgPrint("Finalize server: %d\n", ret);
        }
 
+       ret = shared_fd_service_fini();
+       if (ret < 0) {
+               DbgPrint("Finalize shared service: %d\n", ret);
+       }
+
        ret = dead_fini();
        if (ret < 0) {
                DbgPrint("dead signal handler finalized: %d\n", ret);
@@ -369,6 +380,19 @@ int main(int argc, char *argv[])
        widget_conf_load();
        widget_abi_init();
 
+       if (vconf_get_int(VCONFKEY_MASTER_RESTART_COUNT, &restart_count) < 0 || restart_count == 0) {
+               /*!
+                * \note
+                * Clear old contents files before start the master provider.
+                */
+               (void)util_unlink_files(WIDGET_CONF_ALWAYS_PATH);
+               (void)util_unlink_files(WIDGET_CONF_READER_PATH);
+               (void)util_unlink_files(WIDGET_CONF_IMAGE_PATH);
+               (void)util_unlink_files(WIDGET_CONF_LOG_PATH);
+       }
+
+       util_setup_log_disk();
+
        /*!
         * How could we care this return values?
         * Is there any way to print something on the screen?
@@ -378,22 +402,6 @@ int main(int argc, char *argv[])
                ErrPrint("Failed to init the critical log\n");
        }
 
-       /*!
-        * \note
-        * Clear old contents files before start the master provider.
-        */
-       (void)util_unlink_files(WIDGET_CONF_ALWAYS_PATH);
-       (void)util_unlink_files(WIDGET_CONF_READER_PATH);
-       (void)util_unlink_files(WIDGET_CONF_IMAGE_PATH);
-       (void)util_unlink_files(WIDGET_CONF_LOG_PATH);
-
-       if (util_free_space(WIDGET_CONF_IMAGE_PATH) < WIDGET_CONF_MINIMUM_SPACE) {
-               util_remove_emergency_disk();
-               util_prepare_emergency_disk();
-       }
-
-       util_setup_log_disk();
-
        sigemptyset(&mask);
 
        ret = sigaddset(&mask, SIGTERM);
@@ -427,7 +435,6 @@ int main(int argc, char *argv[])
        app_create();
        sd_notify(0, "READY=1");
 
-       vconf_get_int(VCONFKEY_MASTER_RESTART_COUNT, &restart_count);
        restart_count++;
        vconf_set_int(VCONFKEY_MASTER_RESTART_COUNT, restart_count);
 
index 8b534a1..e88526c 100644 (file)
@@ -1401,13 +1401,20 @@ static inline void reload_package_info(struct pkg_info *info)
        EINA_LIST_FOREACH_SAFE(info->inst_list, l, n, inst) {
                width = instance_widget_width(inst);
                height = instance_widget_height(inst);
-               widget_service_get_size_type(width, height, &size_type);
-               if (info->widget.size_list & size_type) {
-                       if (instance_period(inst) == old_period) {
-                               instance_reload_period(inst, package_period(info));
+               DbgPrint("%dx%d\n", width, height);
+               if (widget_service_get_size_type(width, height, &size_type) == WIDGET_ERROR_NONE) {
+                       if ((info->widget.size_list & size_type) == size_type) {
+                               DbgPrint("Supported size type: %x\n", size_type);
+                               if (instance_period(inst) == old_period) {
+                                       instance_reload_period(inst, package_period(info));
+                               }
+                               instance_reload(inst, WIDGET_DESTROY_TYPE_UPGRADE);
+                       } else {
+                               DbgPrint("Unsupported size type: %x\n", size_type);
+                               instance_destroy(inst, WIDGET_DESTROY_TYPE_UNINSTALL);
                        }
-                       instance_reload(inst, WIDGET_DESTROY_TYPE_UPGRADE);
                } else {
+                       DbgPrint("Invalid size\n");
                        instance_destroy(inst, WIDGET_DESTROY_TYPE_UNINSTALL);
                }
        }
@@ -1437,17 +1444,40 @@ static int io_install_cb(const char *pkgid, const char *widget_id, int prime, vo
 
 static int uninstall_cb(const char *pkgname, enum pkgmgr_status status, double value, void *data)
 {
-       Eina_List *l;
-       Eina_List *n;
-       struct pkg_info *info;
+       if (status == PKGMGR_STATUS_START) {
+               Eina_List *l;
+               Eina_List *n;
+               struct pkg_info *info;
 
-       if (status != PKGMGR_STATUS_END) {
-               return 0;
-       }
+               EINA_LIST_FOREACH_SAFE(s_info.pkg_list, l, n, info) {
+                       if (!strcmp(info->pkgid, pkgname)) {
+                               struct slave_node *slave;
+                               /**
+                                * @note
+                                * While updating packages, the slave can be terminated,
+                                * Even if a slave is terminated, do not handles it as a faulted one.
+                                */
+                               slave = package_slave(info);
+                               DbgPrint("Update slave state : %p\n", slave);
+                               if (slave) {
+                                       slave_set_wait_deactivation(slave, 1);
+                               }
+                       }
+               }
+       } else if (status == PKGMGR_STATUS_END) {
+               Eina_List *l;
+               Eina_List *n;
+               struct pkg_info *info;
 
-       EINA_LIST_FOREACH_SAFE(s_info.pkg_list, l, n, info) {
-               if (!strcmp(info->pkgid, pkgname)) {
-                       io_uninstall_cb(pkgname, info->widget_id, -1, NULL);
+               EINA_LIST_FOREACH_SAFE(s_info.pkg_list, l, n, info) {
+                       if (!strcmp(info->pkgid, pkgname)) {
+                               struct slave_node *slave;
+                               slave = package_slave(info);
+                               if (slave) {
+                                       slave_set_wait_deactivation(slave, 0);
+                               }
+                               io_uninstall_cb(pkgname, info->widget_id, -1, NULL);
+                       }
                }
        }
 
@@ -1456,26 +1486,52 @@ static int uninstall_cb(const char *pkgname, enum pkgmgr_status status, double v
 
 static int update_cb(const char *pkgname, enum pkgmgr_status status, double value, void *data)
 {
-       Eina_List *l;
-       Eina_List *n;
-       struct pkg_info *info;
+       if (status == PKGMGR_STATUS_START) {
+               Eina_List *l;
+               Eina_List *n;
+               struct pkg_info *info;
 
-       if (status != PKGMGR_STATUS_END) {
-               return 0;
-       }
+               EINA_LIST_FOREACH_SAFE(s_info.pkg_list, l, n, info) {
+                       if (!strcmp(info->pkgid, pkgname)) {
+                               struct slave_node *slave;
+                               /**
+                                * @note
+                                * While updating packages, the slave can be terminated,
+                                * Even if a slave is terminated, do not handles it as a faulted one.
+                                */
+                               slave = package_slave(info);
+                               DbgPrint("Update slave state : %p\n", slave);
+                               if (slave) {
+                                       slave_set_wait_deactivation(slave, 1);
+                               }
+                       }
+               }
+       } else if (status == PKGMGR_STATUS_END) {
+               Eina_List *l;
+               Eina_List *n;
+               struct pkg_info *info;
 
-       EINA_LIST_FOREACH_SAFE(s_info.pkg_list, l, n, info) {
-               if (!strcmp(info->pkgid, pkgname)) {
-                       DbgPrint("Update widget_id: %s\n", info->widget_id);
-                       if (io_is_exists(info->widget_id) == 1) {
-                               reload_package_info(info);
-                       } else {
-                               io_uninstall_cb(pkgname, info->widget_id, -1, NULL);
+               EINA_LIST_FOREACH_SAFE(s_info.pkg_list, l, n, info) {
+                       if (!strcmp(info->pkgid, pkgname)) {
+                               struct slave_node *slave;
+
+                               slave = package_slave(info);
+                               if (slave) {
+                                       slave_set_wait_deactivation(slave, 0);
+                               }
+
+                               DbgPrint("Update widget_id: %s\n", info->widget_id);
+                               if (io_is_exists(info->widget_id) == 1) {
+                                       reload_package_info(info);
+                               } else {
+                                       io_uninstall_cb(pkgname, info->widget_id, -1, NULL);
+                               }
                        }
                }
+
+               (void)io_update_widget_package(pkgname, io_install_cb, NULL);
        }
 
-       (void)io_update_widget_package(pkgname, io_install_cb, NULL);
        return 0;
 }
 
@@ -1700,6 +1756,37 @@ HAPI int package_is_enabled(const char *appid)
        return enabled == true;
 }
 
+HAPI char *package_meta_tag(const char *appid, const char *meta_tag)
+{
+       char *ret = NULL;
+       char *value = NULL;
+       int status;
+       pkgmgrinfo_appinfo_h handle;
+
+       if (!meta_tag || !appid) {
+               ErrPrint("meta(%s) is not valid (%s)\n", meta_tag, appid);
+               return NULL;
+       }
+
+       status = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+       if (status != PMINFO_R_OK) {
+               return NULL;
+       }
+
+       status = pkgmgrinfo_appinfo_get_metadata_value(handle, meta_tag, &value);
+       if (status != PMINFO_R_OK) {
+               pkgmgrinfo_appinfo_destroy_appinfo(handle);
+               return NULL;
+       }
+
+       if (value && value[0] != '\0') {
+               ret = strdup(value);
+       }
+
+       pkgmgrinfo_appinfo_destroy_appinfo(handle);
+       return ret;
+}
+
 HAPI int package_faulted(struct pkg_info *pkg, int broadcast)
 {
        Eina_List *l;
index dfded9c..37cfc9b 100644 (file)
@@ -89,7 +89,6 @@ static struct info {
        int client_fd;
        int service_fd;
        int slave_fd;
-       int remote_client_fd;
 
        Eina_List *hello_sync_ctx_list;
 } s_info = {
@@ -97,7 +96,6 @@ static struct info {
        .client_fd = -1,
        .service_fd = -1,
        .slave_fd = -1,
-       .remote_client_fd = -1,
        .hello_sync_ctx_list = NULL,
 };
 
@@ -194,6 +192,18 @@ static char *is_valid_slave(pid_t pid, const char *abi, const char *provider_pkg
                return NULL;
        }
 
+       if (!strcmp(abi, "meta")) {
+               converted_provider_pkgname = package_meta_tag(provider_pkgname, abi_pkgname);
+               if (!converted_provider_pkgname || strcmp(converted_provider_pkgname, pid_pkgname)) {
+                       DbgPrint("Meta tag is not matched: %s <> %s (%s)\n", converted_provider_pkgname, pid_pkgname, abi_pkgname);
+                       DbgFree(converted_provider_pkgname);
+                       return NULL;
+               }
+
+               DbgPrint("Meta package detected: %s\n", converted_provider_pkgname);
+               return converted_provider_pkgname;
+       }
+
        if (!strcmp(abi_pkgname, pid_pkgname)) {
                /*!
                 * This request is comes from predefined service provider.
@@ -8192,8 +8202,8 @@ static struct packet *slave_hello_sync(pid_t pid, int handle, const struct packe
        double timestamp;
        const char *pkgname = NULL;
 
-       ret = packet_get(packet, "dissss", &timestamp, &secured, &slavename, &slave_pkgname, &acceleration, &abi);
-       if (ret != 6) {
+       ret = packet_get(packet, "disssss", &timestamp, &secured, &slavename, &slave_pkgname, &acceleration, &abi, &widget_id);
+       if (ret != 7) {
                ErrPrint("Parameter is not matched\n");
                ret = WIDGET_ERROR_INVALID_PARAMETER;
                goto out;
@@ -8330,15 +8340,21 @@ static struct packet *slave_hello_sync(pid_t pid, int handle, const struct packe
                int width, height;
                unsigned int widget_size;
                Eina_List *inst_list;
+               char *tmp_widget_id;
 
-               widget_id = is_valid_slave(pid, abi, pkgname);
-               if (!widget_id) {
+               tmp_widget_id = is_valid_slave(pid, abi, pkgname);
+               if (!tmp_widget_id) {
                        goto out;
                }
 
+               if (strcmp(widget_id, tmp_widget_id)) {
+                       DbgPrint("[%s] <> [%s]\n", widget_id, tmp_widget_id);
+               }
+
+               DbgFree(tmp_widget_id);
+
                if (!slave_is_watch(slave)) {
                        ErrPrint("Slave is not watch(only watch can use hello_sync) [%s]\n", widget_id);
-                       DbgFree(widget_id);
                        goto out;
                }
 
@@ -8348,7 +8364,6 @@ static struct packet *slave_hello_sync(pid_t pid, int handle, const struct packe
 
                        pkgid = widget_service_get_package_id(widget_id);
                        if (!pkgid) {
-                               DbgFree(widget_id);
                                goto out;
                        }
 
@@ -8356,7 +8371,6 @@ static struct packet *slave_hello_sync(pid_t pid, int handle, const struct packe
                        info = package_create(pkgid, widget_id);
                        DbgFree(pkgid);
 
-                       DbgFree(widget_id);
                        ret = WIDGET_ERROR_FAULT;
                        goto out;
                }
@@ -8365,7 +8379,6 @@ static struct packet *slave_hello_sync(pid_t pid, int handle, const struct packe
                inst = eina_list_nth(inst_list, 0);
                if (!inst) {
                        ErrPrint("Instance is not available for [%s]\n", widget_id);
-                       DbgFree(widget_id);
                        ret = WIDGET_ERROR_FAULT;
                        goto out;
                }
@@ -8379,7 +8392,6 @@ static struct packet *slave_hello_sync(pid_t pid, int handle, const struct packe
                                        ret = aul_terminate_pid_async(pid);
                                        CRITICAL_LOG("Terminate %d (ret: %d)\n", pid, ret);
                                }
-                               DbgFree(widget_id);
                                ret = WIDGET_ERROR_NOT_EXIST;
                                goto out;
                        }
@@ -8432,8 +8444,6 @@ static struct packet *slave_hello_sync(pid_t pid, int handle, const struct packe
                         */
                        (void)instance_watch_recover_visible_state(inst);
                }
-
-               DbgFree(widget_id);
        }
 
 out:
@@ -9858,44 +9868,22 @@ HAPI int server_init(void)
                ErrPrint("unlink info: %d\n", errno);
        }
 
-       if (unlink(SLAVE_SOCKET) < 0) {
-               ErrPrint("unlink slave: %d\n", errno);
-       }
-
-       if (unlink(CLIENT_SOCKET) < 0) {
-               ErrPrint("unlink client: %d\n", errno);
-       }
-
-       if (unlink(SERVICE_SOCKET) < 0) {
-               ErrPrint("unlink service: %d\n", errno);
-       }
-
        s_info.info_fd = com_core_packet_server_init(INFO_SOCKET, s_info_table);
        if (s_info.info_fd < 0) {
                ErrPrint("Failed to create a info socket\n");
        }
 
-       s_info.slave_fd = com_core_packet_server_init_with_permission(SLAVE_SOCKET, s_slave_table, "data-provider-master::provider");
+       s_info.slave_fd = com_core_packet_server_init_with_permission("sdlocal://"SLAVE_SOCKET, s_slave_table, NULL);
        if (s_info.slave_fd < 0) {
                ErrPrint("Failed to create a slave socket\n");
        }
 
-       s_info.client_fd = com_core_packet_server_init_with_permission(CLIENT_SOCKET, s_client_table, "data-provider-master::client");
+       s_info.client_fd = com_core_packet_server_init_with_permission("sdlocal://"CLIENT_SOCKET, s_client_table, NULL);
        if (s_info.client_fd < 0) {
                ErrPrint("Failed to create a client socket\n");
        }
 
-       /*!
-        * \note
-        * remote://:8208
-        * Skip address to use the NULL.
-        */
-       s_info.remote_client_fd = com_core_packet_server_init_with_permission("remote://:"CLIENT_PORT, s_client_table, "data-provider-master::client");
-       if (s_info.client_fd < 0) {
-               ErrPrint("Failed to create a remote client socket\n");
-       }
-
-       s_info.service_fd = com_core_packet_server_init_with_permission(SERVICE_SOCKET, s_service_table, "data-provider-master");
+       s_info.service_fd = com_core_packet_server_init_with_permission("sdlocal://"SERVICE_SOCKET, s_service_table, NULL);
        if (s_info.service_fd < 0) {
                ErrPrint("Faild to create a service socket\n");
        }
@@ -9904,18 +9892,6 @@ HAPI int server_init(void)
                ErrPrint("chmod info: %d\n", errno);
        }
 
-       if (chmod(SLAVE_SOCKET, 0666) < 0) {
-               ErrPrint("chmod slave: %d\n", errno);
-       }
-
-       if (chmod(CLIENT_SOCKET, 0666) < 0) {
-               ErrPrint("chmod client: %d\n", errno);
-       }
-
-       if (chmod(SERVICE_SOCKET, 0666) < 0) {
-               ErrPrint("chmod service: %d\n", errno);
-       }
-
        return 0;
 }
 
@@ -9936,11 +9912,6 @@ HAPI int server_fini(void)
                s_info.client_fd = -1;
        }
 
-       if (s_info.remote_client_fd > 0) {
-               com_core_packet_server_fini(s_info.remote_client_fd);
-               s_info.remote_client_fd = -1;
-       }
-
        if (s_info.service_fd > 0) {
                com_core_packet_server_fini(s_info.service_fd);
                s_info.service_fd = -1;
index 65b300f..f65e382 100644 (file)
@@ -89,6 +89,8 @@ struct service_context {
 
        Eina_List *tcb_create_cb_list;
        Eina_List *tcb_destroy_cb_list;
+
+       int processing_service_handler;
 };
 
 struct packet_info {
@@ -543,6 +545,22 @@ static inline void tcb_teminate_all(struct service_context *svc_ctx)
        }
 }
 
+HAPI int service_common_destroy_tcb(struct service_context *svc_ctx, struct tcb *tcb)
+{
+       if (!svc_ctx || !tcb) {
+               return WIDGET_ERROR_INVALID_PARAMETER;
+       }
+       /**
+        * @note
+        * In this case, we just need to push terminate event to pipe.
+        */
+       if (write(svc_ctx->tcb_pipe[PIPE_WRITE], &tcb, sizeof(tcb)) != sizeof(tcb)) {
+               ErrPrint("write: %d\n", errno);
+       }
+
+       return WIDGET_ERROR_NONE;
+}
+
 /*!
  * \note
  * SERVER THREAD
@@ -754,7 +772,9 @@ static void *server_main(void *data)
                                 * What happens if the client thread is terminated, so the packet_info->tcb is deleted
                                 * while processing svc_ctx->service_thread_main?
                                 */
+                               svc_ctx->processing_service_handler = 1;
                                ret = svc_ctx->service_thread_main(packet_info->tcb, packet_info->packet, svc_ctx->service_thread_data);
+                               svc_ctx->processing_service_handler = 0;
                                if (ret < 0) {
                                        ErrPrint("Service thread returns: %d\n", ret);
                                }
@@ -805,7 +825,9 @@ static void *server_main(void *data)
                        EINA_LIST_FREE(lockfree_packet_list, packet_info) {
                                ret = read(svc_ctx->evt_pipe[PIPE_READ], &evt_ch, sizeof(evt_ch));
                                DbgPrint("Flushing filtered pipe: %d (%c)\n", ret, evt_ch);
+                               svc_ctx->processing_service_handler = 1;
                                ret = svc_ctx->service_thread_main(packet_info->tcb, packet_info->packet, svc_ctx->service_thread_data);
+                               svc_ctx->processing_service_handler = 0;
                                if (ret < 0) {
                                        ErrPrint("Service thread returns: %d\n", ret);
                                }
@@ -817,7 +839,9 @@ static void *server_main(void *data)
                         * \note
                         * Invoke the service thread main, to notify the termination of a TCB
                         */
+                       svc_ctx->processing_service_handler = 1;
                        ret = svc_ctx->service_thread_main(tcb, NULL, svc_ctx->service_thread_data);
+                       svc_ctx->processing_service_handler = 0;
 
                        /*!
                         * at this time, the client thread can access this tcb.
@@ -843,7 +867,9 @@ static void *server_main(void *data)
        EINA_LIST_FREE(svc_ctx->packet_list, packet_info) {
                ret = read(svc_ctx->evt_pipe[PIPE_READ], &evt_ch, sizeof(evt_ch));
                DbgPrint("Flushing pipe: %d (%c)\n", ret, evt_ch);
+               svc_ctx->processing_service_handler = 1;
                ret = svc_ctx->service_thread_main(packet_info->tcb, packet_info->packet, svc_ctx->service_thread_data);
+               svc_ctx->processing_service_handler = 0;
                if (ret < 0) {
                        ErrPrint("Service thread returns: %d\n", ret);
                }
@@ -870,9 +896,18 @@ HAPI struct service_context *service_common_create(const char *addr, const char
                return NULL;
        }
 
-       if (strncmp(addr, COM_CORE_REMOTE_SCHEME, strlen(COM_CORE_REMOTE_SCHEME))) {
-               int offset = 0;
+       /**
+        * @note
+        * Do not try to delete a URI file if it is created for a remote service or by the systemd service.
+        */
+       if (strncmp(addr, COM_CORE_REMOTE_SCHEME, strlen(COM_CORE_REMOTE_SCHEME)) && strncmp(addr, COM_CORE_SD_LOCAL_SCHEME, strlen(COM_CORE_SD_LOCAL_SCHEME))) {
+               int offset;
 
+               /**
+                * @note
+                * If the address is not for the REMOTE or SD_LOCAL, we can assume it just a local(unix) domain socket file.
+                * So, find the scheme length first and then "unlink" it.
+                */
                offset = strlen(COM_CORE_LOCAL_SCHEME);
                if (strncmp(addr, COM_CORE_LOCAL_SCHEME, offset)) {
                        offset = 0;
diff --git a/src/shared_fd_service.c b/src/shared_fd_service.c
new file mode 100644 (file)
index 0000000..d153882
--- /dev/null
@@ -0,0 +1,158 @@
+/*
+ * Copyright 2013  Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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 <pthread.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+#include <Eina.h>
+
+#include <dlog.h>
+
+#include <widget_errno.h>
+#include <widget_cmd_list.h>
+#include <widget_service.h>
+#include <packet.h>
+#include <com-core_packet.h>
+
+#include "shared_fd_service.h"
+#include "service_common.h"
+#include "client_life.h"
+#include "client_rpc.h"
+#include "debug.h"
+#include "util.h"
+#include "conf.h"
+
+static struct info {
+       int fd;
+} s_info = {
+       .fd = -1,
+};
+
+static struct packet *direct_hello_handler(pid_t pid, int handle, const struct packet *packet)
+{
+       const char *direct_addr;
+       struct client_node *client;
+
+       if (!packet) {
+               ErrPrint("%d is disconnected (%d)\n", pid, handle);
+               return NULL;
+       }
+
+       if (packet_get(packet, "s", &direct_addr) != 1) {
+               ErrPrint("Packet is not valid\n");
+               return NULL;
+       }
+
+       client = client_find_by_direct_addr(direct_addr);
+       if (!client) {
+               ErrPrint("Client is not exists: %s\n", direct_addr);
+               return NULL;
+       }
+
+       DbgPrint("Client Direct Handler is updated: %d\n", handle);
+       client_set_direct_fd(client, handle);
+       return NULL;
+}
+
+static struct packet *direct_connected_handler(pid_t pid, int handle, const struct packet *packet)
+{
+       struct packet *result;
+       const char *direct_addr;
+       struct client_node *client;
+
+       if (!packet) {
+               ErrPrint("%d is disconnected (%d)\n", pid, handle);
+               return NULL;
+       }
+
+       if (packet_get(packet, "s", &direct_addr) != 1) {
+               ErrPrint("Packet is not valid\n");
+               result = packet_create_reply(packet, "i", WIDGET_ERROR_INVALID_PARAMETER);
+               return result;
+       }
+
+       client = client_find_by_direct_addr(direct_addr);
+       if (!client) {
+               ErrPrint("Client is not exists: %s\n", direct_addr);
+               result = packet_create_reply(packet, "i", WIDGET_ERROR_NOT_EXIST);
+               return result;
+       }
+
+       result = packet_create_reply(packet, "i", WIDGET_ERROR_NONE);
+       packet_set_fd(result, client_direct_fd(client));
+       DbgPrint("Set FD Handle for (%s): %d\n", direct_addr, client_direct_fd(client));
+       return result;
+}
+
+static struct method s_table[] = {
+       {
+               .cmd = CMD_STR_DIRECT_HELLO,
+               .handler = direct_hello_handler,
+       },
+       {
+               .cmd = CMD_STR_DIRECT_CONNECTED,
+               .handler = direct_connected_handler,
+       },
+       {
+               .cmd = NULL,
+               .handler = NULL,
+       },
+};
+
+/**
+ * @note
+ * MAIN THREAD
+ */
+HAPI int shared_fd_service_init(void)
+{
+       DbgPrint("Successfully initiated\n");
+       /**
+        * @todo
+        * 1. Accept FD (Get a new connection handle)
+        * 2. Waiting "hello" message from viewer.
+        * 3. Waiting "connected" message from provider
+        * 4. Send accepted FD to provider via result packet.
+        * 5. Provider will send a packet to the viewer via that FD.
+        */
+       s_info.fd = com_core_packet_server_init("sdlocal://"SHARED_SOCKET, s_table);
+       if (s_info.fd < 0) {
+               ErrPrint("Failed to make a server for %s\n", "sdlocal://"SHARED_SOCKET);
+       }
+
+       return WIDGET_ERROR_NONE;
+}
+
+/**
+ * @note
+ * MAIN THREAD
+ */
+HAPI int shared_fd_service_fini(void)
+{
+       if (s_info.fd >= 0) {
+               com_core_packet_server_fini(s_info.fd);
+               s_info.fd = -1;
+       }
+
+       DbgPrint("Successfully Finalized\n");
+       return WIDGET_ERROR_NONE;
+}
+
+/* End of a file */
index 58b2262..d03f86c 100644 (file)
@@ -127,6 +127,8 @@ struct slave_node {
                        unsigned int hard;
                } memory;
        } resources;
+
+       int wait_deactivation;
 };
 
 struct event {
@@ -1119,8 +1121,8 @@ HAPI struct slave_node *slave_deactivated(struct slave_node *slave)
        }
 
        if ((slave->ctrl_option & PROVIDER_CTRL_MANUAL_REACTIVATION) == PROVIDER_CTRL_MANUAL_REACTIVATION) {
-               /*!
-                * \note
+               /**
+                * @note
                 * In this case, the provider(Slave) should be reactivated by itself or user.
                 * The master will not reactivate it automatically.
                 */
@@ -1134,8 +1136,8 @@ HAPI struct slave_node *slave_deactivated(struct slave_node *slave)
                        ErrPrint("Failed to reactivate a slave\n");
                }
        } else if (slave_loaded_instance(slave) == 0) {
-               /*!
-                * \note
+               /**
+                * @note
                 * If a slave has no more instances,
                 * Destroy it
                 */
@@ -1617,13 +1619,21 @@ HAPI char *slave_package_name(const char *abi, const char *lbid)
                return NULL;
        }
 
-       s_pkgname = widget_util_replace_string(tmp, WIDGET_CONF_REPLACE_TAG_APPID, lbid);
-       if (!s_pkgname) {
-               DbgPrint("Failed to get replaced string\n");
-               s_pkgname = strdup(tmp);
+       if (!strcasecmp(abi, "meta")) {
+               s_pkgname = package_meta_tag(lbid, tmp);
                if (!s_pkgname) {
-                       ErrPrint("strdup: %d\n", errno);
-                       return NULL;
+                       s_pkgname = strdup(lbid);
+                       ErrPrint("Meta tag is not valid[%s] - [%s], use [%s]\n", lbid, tmp, s_pkgname);
+               }
+       } else {
+               s_pkgname = widget_util_replace_string(tmp, WIDGET_CONF_REPLACE_TAG_APPID, lbid);
+               if (!s_pkgname) {
+                       DbgPrint("Failed to get replaced string\n");
+                       s_pkgname = strdup(tmp);
+                       if (!s_pkgname) {
+                               ErrPrint("strdup: %d\n", errno);
+                               return NULL;
+                       }
                }
        }
 
@@ -2196,4 +2206,14 @@ HAPI int slave_get_resource_limit(struct slave_node *slave, unsigned int *soft,
        return WIDGET_ERROR_NONE;
 }
 
+HAPI void slave_set_wait_deactivation(struct slave_node *slave, int wait)
+{
+       slave->wait_deactivation = !!wait;
+}
+
+HAPI int slave_wait_deactivation(struct slave_node *slave)
+{
+       return slave->wait_deactivation;
+}
+
 /* End of a file */
index af1d6b8..49960cc 100644 (file)
 
 #define DELIM ';'
 
-static struct info {
-       int emergency_mounted;
-} s_info = {
-       .emergency_mounted = 0,
-};
-
 int errno;
 
 HAPI unsigned long util_string_hash(const char *str)
@@ -301,222 +295,6 @@ HAPI int util_unlink_files(const char *folder)
        return WIDGET_ERROR_NONE;
 }
 
-HAPI void util_remove_emergency_disk(void)
-{
-       int ret;
-       ret = umount(WIDGET_CONF_IMAGE_PATH);
-       if (ret < 0) {
-               ErrPrint("umount: %d\n", errno);
-       }
-
-       DbgPrint("Try to unmount[%s] %d\n", WIDGET_CONF_IMAGE_PATH, ret);
-       s_info.emergency_mounted = 0;
-}
-
-HAPI void util_prepare_emergency_disk(void)
-{
-       char *buf;
-       char *source = NULL;
-       char *type = NULL;
-       char *option = NULL;
-       char *ptr;
-       char *rollback_ptr;
-       int tag_idx;
-       int idx;
-       int len;
-       int ret;
-       static const char *tag[] = {
-               "source",
-               "type",
-               "option",
-               NULL,
-       };
-       enum tag_type {
-               TAG_SOURCE,
-               TAG_TYPE,
-               TAG_OPTION,
-               TAG_ERROR
-       };
-
-       buf = strdup(WIDGET_CONF_EMERGENCY_DISK);
-       if (!buf) {
-               ErrPrint("Failed to prepare emergency disk info\n");
-               return;
-       }
-
-       rollback_ptr = ptr = buf;
-       idx = 0;
-       tag_idx = 0;
-       len = strlen(ptr);
-
-       while (tag[tag_idx] != NULL && ptr != (buf + len)) {
-               if (tag[tag_idx][idx] == '\0') {
-                       if (*ptr == '=' || isblank(*ptr)) {
-                               switch (tag_idx) {
-                               case TAG_SOURCE:
-                                       if (source) {
-                                               ErrPrint("source[%s] is overrided\n", source);
-                                       }
-
-                                       while ((*ptr != '\0' && *ptr != ';') && (*ptr == '=' || isblank(*ptr))) {
-                                               ptr++;
-                                       }
-
-                                       source = ptr;
-                                       while (*ptr != '\0' && *ptr != ';') {
-                                               ptr++;
-                                       }
-
-                                       if (*source == '\0') {
-                                               type = NULL;
-                                       }
-
-                                       *ptr = '\0';
-                                       rollback_ptr = ptr + 1;
-                                       idx = 0;
-                                       break;
-                               case TAG_TYPE:
-                                       if (type) {
-                                               ErrPrint("type[%s] is overrided\n", type);
-                                       }
-
-                                       while ((*ptr != '\0' && *ptr != ';') && (*ptr == '=' || isblank(*ptr))) {
-                                               ptr++;
-                                       }
-
-                                       type = ptr;
-                                       while (*ptr != '\0' && *ptr != ';') {
-                                               ptr++;
-                                       }
-
-                                       if (*type == '\0') {
-                                               type = NULL;
-                                       }
-
-                                       *ptr = '\0';
-                                       rollback_ptr = ptr + 1;
-                                       idx = 0;
-                                       break;
-                               case TAG_OPTION:
-                                       if (option) {
-                                               ErrPrint("option[%s] is overrided\n", option);
-                                       }
-
-                                       while ((*ptr != '\0' && *ptr != ';') && (*ptr == '=' || isblank(*ptr))) {
-                                               ptr++;
-                                       }
-
-                                       option = ptr;
-                                       while (*ptr != '\0' && *ptr != ';') {
-                                               ptr++;
-                                       }
-
-                                       if (*option == '\0') {
-                                               option = NULL;
-                                       }
-
-                                       *ptr = '\0';
-                                       rollback_ptr = ptr + 1;
-                                       idx = 0;
-                                       break;
-                               default:
-                                       break;
-                               }
-                       } else {
-                               ptr = rollback_ptr;
-                               tag_idx++;
-                               idx = 0;
-                       }
-               } else if (tag[tag_idx][idx] != *ptr) {
-                       ptr = rollback_ptr;
-                       tag_idx++;
-                       idx = 0;
-               } else {
-                       ptr++;
-                       idx++;
-               } // tag
-       }
-
-       DbgPrint("source[%s] type[%s] option[%s]\n", source, type, option);
-
-       ret = mount(source, WIDGET_CONF_IMAGE_PATH, type, MS_NOSUID | MS_NOEXEC, option);
-       DbgFree(buf);
-       if (ret < 0) {
-               ErrPrint("Failed to mount: %d\n", errno);
-               return;
-       }
-
-       ErrPrint("Disk space is not enough, use the tmpfs. Currently required minimum space is %lu bytes\n", WIDGET_CONF_MINIMUM_SPACE);
-       if (chmod(WIDGET_CONF_IMAGE_PATH, 0750) < 0) {
-               ErrPrint("chmod: %d\n", errno);
-       }
-
-       if (chown(WIDGET_CONF_IMAGE_PATH, 5000, 5000) < 0) {
-               ErrPrint("chown: %d\n", errno);
-       }
-
-       if (!!DATA_SHARE_LABEL) {
-               ret = smack_setlabel(WIDGET_CONF_IMAGE_PATH, DATA_SHARE_LABEL, SMACK_LABEL_ACCESS);
-               if (ret != 0) {
-                       ErrPrint("Failed to set SMACK for %s (%d)\n", WIDGET_CONF_IMAGE_PATH, ret);
-               } else {
-                       ret = smack_setlabel(WIDGET_CONF_IMAGE_PATH, "1", SMACK_LABEL_TRANSMUTE);
-                       DbgPrint("[%s] is successfully created (t: %d)\n", WIDGET_CONF_IMAGE_PATH, ret);
-               }
-       }
-
-       if (mkdir(WIDGET_CONF_ALWAYS_PATH, 0755) < 0) {
-               ErrPrint("mkdir: (%s) %d\n", WIDGET_CONF_ALWAYS_PATH, errno);
-       } else {
-               if (chmod(WIDGET_CONF_ALWAYS_PATH, 0750) < 0) {
-                       ErrPrint("chmod: %d\n", errno);
-               }
-
-               if (chown(WIDGET_CONF_ALWAYS_PATH, 5000, 5000) < 0) {
-                       ErrPrint("chown: %d\n", errno);
-               }
-
-               if (!!DATA_SHARE_LABEL) {
-                       ret = smack_setlabel(WIDGET_CONF_ALWAYS_PATH, DATA_SHARE_LABEL, SMACK_LABEL_ACCESS);
-                       if (ret != 0) {
-                               ErrPrint("Failed to set SMACK for %s (%d)\n", WIDGET_CONF_ALWAYS_PATH, ret);
-                       } else {
-                               ret = smack_setlabel(WIDGET_CONF_ALWAYS_PATH, "1", SMACK_LABEL_TRANSMUTE);
-                               DbgPrint("[%s] is successfully created (t: %d)\n", WIDGET_CONF_ALWAYS_PATH, ret);
-                       }
-               }
-       }
-
-       if (mkdir(WIDGET_CONF_READER_PATH, 0755) < 0) {
-               ErrPrint("mkdir: (%s) %d\n", WIDGET_CONF_READER_PATH, errno);
-       } else {
-               if (chmod(WIDGET_CONF_READER_PATH, 0750) < 0) {
-                       ErrPrint("chmod: %d\n", errno);
-               }
-
-               if (chown(WIDGET_CONF_READER_PATH, 5000, 5000) < 0) {
-                       ErrPrint("chown: %d\n", errno);
-               }
-
-               if (!!DATA_SHARE_LABEL) {
-                       ret = smack_setlabel(WIDGET_CONF_READER_PATH, DATA_SHARE_LABEL, SMACK_LABEL_ACCESS);
-                       if (ret != 0) {
-                               ErrPrint("Failed to set SMACK for %s (%d)\n", WIDGET_CONF_READER_PATH, ret);
-                       } else {
-                               ret = smack_setlabel(WIDGET_CONF_READER_PATH, "1", SMACK_LABEL_TRANSMUTE);
-                               DbgPrint("[%s] is successfully created (t: %d)\n", WIDGET_CONF_READER_PATH, ret);
-                       }
-               }
-       }
-
-       s_info.emergency_mounted = 1;
-}
-
-HAPI int util_emergency_disk_is_mounted(void)
-{
-       return s_info.emergency_mounted;
-}
-
 HAPI void util_setup_log_disk(void)
 {
        int ret;
index f66053c..fa3d2d8 100644 (file)
@@ -409,7 +409,7 @@ int utility_service_init(void)
                return WIDGET_ERROR_ALREADY_STARTED;
        }
 
-       s_info.svc_ctx = service_common_create(UTILITY_SOCKET, UTILITY_SMACK_LABEL, service_thread_main, NULL);
+       s_info.svc_ctx = service_common_create("sdlocal://"UTILITY_SOCKET, UTILITY_SMACK_LABEL, service_thread_main, NULL);
        if (!s_info.svc_ctx) {
                ErrPrint("Unable to activate service thread\n");
                return WIDGET_ERROR_FAULT;