snprintf(tmp_pid, MAX_PID_STR_BUFSZ, "%d", caller_pid);
bundle_add(kb, AUL_K_CALLER_PID, tmp_pid);
- pid = _status_app_is_running(appid);
+ pid = _status_app_is_running_v2(appid);
if (pid > 0) {
if (caller_pid == pid) {
__real_send(fd, pid);
if(pid > 0) {
- _status_add_app_info_list(appid, app_path, pid);
+ //_status_add_app_info_list(appid, app_path, pid);
ac_server_check_launch_privilege(appid, "rpm", pid);
}
if (componet && strncmp(componet, "ui", 2) == 0) {
multiple = appinfo_get_value(ai, AIT_MULTI);
if (!multiple || strncmp(multiple, "false", 5) == 0) {
- pid = _status_app_is_running(appid);
+ pid = _status_app_is_running_v2(appid);
}
if (pid > 0) {
//_add_cgroup(_lcg, appid, pid);
}
} else if (componet && strncmp(componet, "svc", 3) == 0) {
- pid = _status_app_is_running(appid);
+ pid = _status_app_is_running_v2(appid);
if (pid > 0) {
if ((ret = __nofork_processing(cmd, pid, kb)) < 0) {
pid = ret;
__real_send(fd, pid);
if(pid > 0) {
- _status_add_app_info_list(appid, app_path, pid);
+ //_status_add_app_info_list(appid, app_path, pid);
ac_server_check_launch_privilege(appid, appinfo_get_value(ai, AIT_TYPE), pid);
}
cgutil_create(MOUNT_PATH, AGENT_PATH, &amd.cg);
_requset_init(&amd);
_launch_init(&amd);
+ _status_init(&amd);
#ifndef __i386__
_key_init();
free(pkt);
break;
case APP_RUNNING_INFO:
- _status_send_running_appinfo(clifd);
+ _status_send_running_appinfo_v2(clifd);
free(pkt);
break;
case APP_IS_RUNNING:
appid = malloc(MAX_PACKAGE_STR_SIZE);
strncpy(appid, (const char*)pkt->data, MAX_PACKAGE_STR_SIZE-1);
- ret = _status_app_is_running(appid);
+ ret = _status_app_is_running_v2(appid);
_D("APP_IS_RUNNING : %s : %d",appid, ret);
__send_result_to_client(clifd, ret);
free(pkt);
free(pkt);
break;
case APP_RUNNING_LIST_UPDATE:
- kb = bundle_decode(pkt->data, pkt->len);
+ /*kb = bundle_decode(pkt->data, pkt->len);
appid = (char *)bundle_get_val(kb, AUL_K_APPID);
app_path = (char *)bundle_get_val(kb, AUL_K_EXEC);
tmp_pid = (char *)bundle_get_val(kb, AUL_K_PID);
pid = atoi(tmp_pid);
- ret = _status_add_app_info_list(appid, app_path, pid);
+ ret = _status_add_app_info_list(appid, app_path, pid);*/
+ ret = 0;
__send_result_to_client(clifd, ret);
free(pkt);
break;
#include "amd_config.h"
#include "amd_status.h"
+#include "amd_appinfo.h"
#include "aul_util.h"
#include "simple_util.h"
#include "app_sock.h"
+#include "menu_db_util.h"
GSList *app_status_info_list = NULL;
+struct appinfomgr *_saf = NULL;
+
int _status_add_app_info_list(char *appid, char *app_path, int pid)
{
GSList *iter = NULL;
return 0;
}
+int _status_app_is_running_v2(char *appid)
+{
+ char *apppath = NULL;
+ int ret = 0;
+ int i = 0;
+ struct appinfo *ai;
+
+ if(appid == NULL)
+ return -1;
+
+ ai = appinfo_find(_saf, appid);
+
+ if(ai == NULL)
+ return -1;
+
+ apppath = strdup(appinfo_get_value(ai, AIT_EXEC));
+
+ /*truncate apppath if it includes default bundles */
+ while (apppath[i] != 0) {
+ if (apppath[i] == ' ' || apppath[i] == '\t') {
+ apppath[i]='\0';
+ break;
+ }
+ i++;
+ }
+
+ ret = __proc_iter_cmdline(NULL, apppath);
+
+ free(apppath);
+
+ return ret;
+}
+
+static int __get_pkginfo(const char *dname, const char *cmdline, void *priv)
+{
+ app_info_from_db *menu_info;
+ char *r_info;
+
+ r_info = (char *)priv;
+
+ if ((menu_info = _get_app_info_from_db_by_apppath(cmdline)) == NULL)
+ goto out;
+ else {
+ strncat(r_info, dname, 8);
+ strncat(r_info, ":", 1);
+ strncat(r_info, _get_pkgname(menu_info), MAX_PACKAGE_STR_SIZE);
+ strncat(r_info, ":", 1);
+ strncat(r_info, _get_app_path(menu_info), MAX_PACKAGE_APP_PATH_SIZE);
+ strncat(r_info, ";", 1);
+ }
+
+ out:
+ if (menu_info != NULL)
+ _free_app_info_from_db(menu_info);
+ return 0;
+}
+
+int _status_send_running_appinfo_v2(int fd)
+{
+ app_pkt_t *pkt = NULL;
+ int len;
+
+ pkt = (app_pkt_t *) malloc(sizeof(char) * AUL_SOCK_MAXBUFF);
+ if(!pkt) {
+ _E("malloc fail");
+ close(fd);
+ return 0;
+ }
+
+ memset(pkt, 0, AUL_SOCK_MAXBUFF);
+
+ __proc_iter_cmdline(__get_pkginfo, pkt->data);
+
+ pkt->cmd = APP_RUNNING_INFO_RESULT;
+ pkt->len = strlen((char *)pkt->data) + 1;
+
+ if ((len = send(fd, pkt, pkt->len + 8, 0)) != pkt->len + 8) {
+ if (errno == EPIPE)
+ _E("send failed due to EPIPE.\n");
+ _E("send fail to client");
+ }
+
+ if(pkt)
+ free(pkt);
+
+ close(fd);
+
+ return 0;
+}
+
+int _status_init(struct amdmgr* amd)
+{
+ _saf = amd->af;
+
+ return 0;
+}
+
int _status_remove_app_info_list(int pid);
int _status_app_is_running(char *appid);
int _status_send_running_appinfo(int fd);
+int _status_app_is_running_v2(char *appid);
+int _status_send_running_appinfo_v2(int fd);
+
//TODO : remove
Name: aul
Summary: App utility library
-Version: 0.0.214
+Version: 0.0.218
Release: 1
Group: System/Libraries
License: Apache License, Version 2.0