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\"")
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
IF (X11_SUPPORT)
ADD_DEFINITIONS("-DHAVE_X11")
- SET(BUILD_SOURCE
+ SET(BUILD_SOURCE
${BUILD_SOURCE}
src/xmonitor.c
src/buffer_handler.c
IF (WAYLAND_SUPPORT)
ADD_DEFINITIONS("-DHAVE_WAYLAND")
- SET(BUILD_SOURCE
+ SET(BUILD_SOURCE
${BUILD_SOURCE}
src/util_wayland.c
)
IF (X11_SUPPORT)
ADD_DEFINITIONS("-DHAVE_X11")
- SET(BUILD_SOURCE
+ SET(BUILD_SOURCE
${BUILD_SOURCE}
src/util_x11.c
)
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)
--- /dev/null
+[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
--- /dev/null
+[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
--- /dev/null
+[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
--- /dev/null
+[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
--- /dev/null
+[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
--- /dev/null
+[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
--- /dev/null
+[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
--- /dev/null
+[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
--- /dev/null
+[Unit]
+Description=data-provider-master sockets
+DefaultDependencies=true
[svc]
package=org.tizen.data-provider-slave.svc
+
+[meta]
+package=meta-key
[svc]
package=org.tizen.data-provider-slave.svc
+
+[meta]
+package=meta-key
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);
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 */
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);
--- /dev/null
+/*
+ * 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 */
};
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,
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 */
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);
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
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
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
%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/*
#include <widget_service.h>
#include <widget_service_internal.h>
+#include <widget_abi.h>
#include "dlist.h"
#include "common.h"
sqlite3_finalize(stmt);
return ret;
}
+
static int db_insert_provider(struct widget *widget)
{
static const char *dml;
}
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")) {
}
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);
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;
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);
}
*/
#include "common.h"
+#include <widget_abi.h>
#define WATCH_APP_TAG "watch-application"
#define EAPI __attribute__((visibility("default")))
EAPI int PKGMGR_PARSER_PLUGIN_PRE_INSTALL(const char *appid)
{
+ widget_abi_init();
ErrPrintWithConsole("%s\n", appid);
if (!db_check()) {
{
ErrPrintWithConsole("[%s]\n", appid);
db_fini();
+ widget_abi_fini();
return 0;
}
EAPI int PKGMGR_PARSER_PLUGIN_PRE_UPGRADE(const char *appid)
{
+ widget_abi_init();
ErrPrintWithConsole("[%s]\n", appid);
if (!db_check()) {
{
ErrPrintWithConsole("[%s]\n", appid);
db_fini();
+ widget_abi_fini();
return 0;
}
EAPI int PKGMGR_PARSER_PLUGIN_PRE_UNINSTALL(const char *appid)
{
+ widget_abi_init();
ErrPrintWithConsole("[%s]\n", appid);
if (!db_check()) {
remove_all_watch(appid);
db_fini();
+ widget_abi_fini();
return 0;
}
#include <libxml/parser.h>
#include <libxml/tree.h>
+#include <widget_abi.h>
#include "common.h"
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");
{
ErrPrintWithConsole("[%s]\n", appid);
db_fini();
+ widget_abi_fini();
return 0;
}
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");
{
ErrPrintWithConsole("[%s]\n", appid);
db_fini();
+ widget_abi_fini();
return 0;
}
EAPI int PKGMGR_PARSER_PLUGIN_PRE_UNINSTALL(const char *appid)
{
+ widget_abi_init();
ErrPrintWithConsole("[%s]\n", appid);
if (!db_check()) {
ret = remove_all_widgets(appid);
db_fini();
+ widget_abi_fini();
return ret;
}
#include <libxml/parser.h>
#include <libxml/tree.h>
+#include <widget_abi.h>
#include "common.h"
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");
{
ErrPrintWithConsole("[%s]\n", appid);
db_fini();
+ widget_abi_fini();
return 0;
}
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");
{
ErrPrintWithConsole("[%s]\n", appid);
db_fini();
+ widget_abi_fini();
return 0;
}
EAPI int PKGMGR_PARSER_PLUGIN_PRE_UNINSTALL(const char *appid)
{
+ widget_abi_init();
ErrPrintWithConsole("[%s]\n", appid);
if (!db_check()) {
ret = remove_all_widgets(appid);
db_fini();
+ widget_abi_fini();
return ret;
}
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)
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);
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);
}
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);
}
}
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)
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 */
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;
}
}
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;
}
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;
}
#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"
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,
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);
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?
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);
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);
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);
}
}
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);
+ }
}
}
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;
}
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;
int client_fd;
int service_fd;
int slave_fd;
- int remote_client_fd;
Eina_List *hello_sync_ctx_list;
} s_info = {
.client_fd = -1,
.service_fd = -1,
.slave_fd = -1,
- .remote_client_fd = -1,
.hello_sync_ctx_list = NULL,
};
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.
double timestamp;
const char *pkgname = NULL;
- ret = packet_get(packet, "dissss", ×tamp, &secured, &slavename, &slave_pkgname, &acceleration, &abi);
- if (ret != 6) {
+ ret = packet_get(packet, "disssss", ×tamp, &secured, &slavename, &slave_pkgname, &acceleration, &abi, &widget_id);
+ if (ret != 7) {
ErrPrint("Parameter is not matched\n");
ret = WIDGET_ERROR_INVALID_PARAMETER;
goto out;
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;
}
pkgid = widget_service_get_package_id(widget_id);
if (!pkgid) {
- DbgFree(widget_id);
goto out;
}
info = package_create(pkgid, widget_id);
DbgFree(pkgid);
- DbgFree(widget_id);
ret = WIDGET_ERROR_FAULT;
goto out;
}
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;
}
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;
}
*/
(void)instance_watch_recover_visible_state(inst);
}
-
- DbgFree(widget_id);
}
out:
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");
}
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;
}
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;
Eina_List *tcb_create_cb_list;
Eina_List *tcb_destroy_cb_list;
+
+ int processing_service_handler;
};
struct packet_info {
}
}
+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
* 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);
}
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);
}
* \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.
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);
}
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;
--- /dev/null
+/*
+ * 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 */
unsigned int hard;
} memory;
} resources;
+
+ int wait_deactivation;
};
struct event {
}
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.
*/
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
*/
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;
+ }
}
}
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 */
#define DELIM ';'
-static struct info {
- int emergency_mounted;
-} s_info = {
- .emergency_mounted = 0,
-};
-
int errno;
HAPI unsigned long util_string_hash(const char *str)
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;
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;