{
int r;
- r = pkgmgrinfo_appinfo_get_installed_list(__app_info_insert_handler, cf);
+ r = pkgmgrinfo_appinfo_get_install_list(__app_info_insert_handler, cf);
return r;
}
GSList *entry;
int *pid_data;
- for (entry = key_pid_list; entry; entry = entry->next) {
+ for (entry = key_pid_list; entry;) {
if (entry->data) {
pid_data = (int *) entry->data;
+ entry = entry->next;
if(pid == *pid_data) {
- key_pid_list = g_slist_remove(key_pid_list, entry->data);
+ key_pid_list = g_slist_remove(key_pid_list, pid_data);
free(pid_data);
}
}
{
int pid;
int ret = -1;
+ int dummy;
if (pkg_name == NULL)
return -1;
case APP_KILL_BY_PID:
if ((ret = _send_to_sigkill(pid)) < 0)
_E("fail to killing - %d\n", pid);
+ break;
+ case APP_TERM_REQ_BY_PID:
+ if ((ret = __app_send_raw(pid, APP_TERM_REQ_BY_PID, (unsigned char *)&dummy, sizeof(int))) < 0) {
+ _D("terminate req packet send error");
+ }
}
return ret;
case APP_TERM_BY_PID:
case APP_RESUME_BY_PID:
case APP_KILL_BY_PID:
+ case APP_TERM_REQ_BY_PID:
kb = bundle_decode(pkt->data, pkt->len);
appid = (char *)bundle_get_val(kb, AUL_K_PKG_NAME);
ret = __app_process_by_pid(pkt->cmd, appid, &cr);
APP_KEY_RELEASE,
APP_STATUS_UPDATE,
APP_RELEASED,
- APP_RUNNING_LIST_UPDATE
+ APP_RUNNING_LIST_UPDATE,
+ APP_TERM_REQ_BY_PID
};
#define AUL_SOCK_PREFIX "/tmp/alaunch"
*/
int aul_listen_app_launch_signal(int (*func) (int, void *), void *data);
+
+typedef int (*subapp_fn)(void *data);
+
+int aul_set_subapp(subapp_fn cb, void *data);
+int aul_subapp_terminate_request_pid(int pid);
+int aul_is_subapp(void);
+
+
/** @} */
static inline void __set_sock_option(int fd, int cli)
{
int size;
- struct timeval tv = { 3, 200 * 1000 }; /* 3.2 sec */
+ struct timeval tv = { 5, 200 * 1000 }; /* 5.2 sec */
size = AUL_SOCK_MAXBUFF;
setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &size, sizeof(size));
len = recv(fd, &res, sizeof(int), 0);
if (len == -1) {
if (errno == EAGAIN) {
- _E("recv timeout \n");
+ _E("recv timeout : %s", strerror(errno));
res = -EAGAIN;
} else {
- _E("recv error\n");
+ _E("recv error : %s", strerror(errno));
res = -ECOMM;
}
}
return 0;
}
+
/**
* @brief encode kb and send it to 'pid'
* @param[in] pid receiver's pid
app_terminate();
break;
+ case APP_TERM_REQ_BY_PID: /* run in callee */
+ app_subapp_terminate_request();
+ break;
+
case APP_RESULT: /* run in caller */
case APP_CANCEL:
kbundle = bundle_decode(pkt->data, pkt->len);
static int latest_caller_pid = -1;
static app_resultcb_info_t *rescb_head = NULL;
+static int is_subapp = 0;
+subapp_fn subapp_cb = NULL;
+void *subapp_data = NULL;
+
+
static void __add_resultcb(int pid, void (*cbfunc) (bundle *, int, void *),
void *data);
static app_resultcb_info_t *__find_resultcb(int pid);
return ret;
}
+int app_subapp_terminate_request()
+{
+ if(is_subapp) {
+ subapp_cb(subapp_data);
+ }
+ return 0;
+}
+
+SLPAPI int aul_set_subapp(subapp_fn cb, void *data)
+{
+ is_subapp = 1;
+ subapp_cb = cb;
+ subapp_data = data;
+
+ return 0;
+}
+
+SLPAPI int aul_subapp_terminate_request_pid(int pid)
+{
+ char pid_str[MAX_PID_STR_BUFSZ];
+ int ret;
+
+ if (pid <= 0)
+ return AUL_R_EINVAL;
+
+ snprintf(pid_str, MAX_PID_STR_BUFSZ, "%d", pid);
+ ret = app_request_to_launchpad(APP_TERM_REQ_BY_PID, pid_str, NULL);
+ return ret;
+}
+
+SLPAPI int aul_is_subapp()
+{
+ return is_subapp;
+}
#define BINSH_NAME "/bin/sh"
#define BINSH_SIZE 7
+#define VALGRIND_NAME "/home/developer/sdk_tools/valgrind/usr/bin/valgrind"
+#define VALGRIND_SIZE 51
+
#define PROC_STAT_GID_POS 5
/* support app launched by shell script*/
if (strncmp(buf, BINSH_NAME, BINSH_SIZE) == 0)
return strdup(&buf[BINSH_SIZE + 1]);
+ else if (strncmp(buf, VALGRIND_NAME, VALGRIND_SIZE) == 0)
+ return strdup(&buf[VALGRIND_SIZE + 1]);
else
return strdup(buf);
}
return aul_terminate_pid(apn_pid);
}
+int term_req_pid_test()
+{
+ static int num = 0;
+ printf("[aul_subapp_terminate_request_pid %d test] %d \n", num++, apn_pid);
+ return aul_subapp_terminate_request_pid(apn_pid);
+}
+
static test_func_t scn_func[] = {
{"n", launch_test, "launch_test", ""},
{"n", launch_test, "launch_test", ""},
"[usage] resume_pid <pid>" },
{"term_pid", term_pid_test,"aul_terminate_pid test",
"[usage] term_pid <pid>" },
+ {"term_req_pid", term_req_pid_test,"aul_subapp_terminate_request_pid test",
+ "[usage] term_req_pid <pid>" },
{"dbuslaunch", dbus_launch_test,"launch by dbus auto activation",
"[usage] term_pid <pid>" },
{"all",all_test,"test based on predefine scenario",