#include <dbus/dbus.h>
#include <dbus/dbus-glib-lowlevel.h>
#include <ail.h>
-#include <vconf.h>
#include <db-util.h>
#include <pkgmgr-info.h>
#include <iniparser.h>
static int __sync_process(char *req_key)
{
+ int ret;
char info_file[PKG_STRING_LEN_MAX] = {'\0', };
- int result = 0;
+ int result = -1;
int check_cnt = 0;
+ FILE *fp;
+ char buf[PKG_STRING_LEN_MAX] = {0, };
- snprintf(info_file, PKG_STRING_LEN_MAX, "%s/%s", PKG_TMP_PATH, req_key);
+ snprintf(info_file, PKG_STRING_LEN_MAX, "%s/%s", PKG_SIZE_INFO_PATH, req_key);
while(1)
{
- check_cnt ++;
+ check_cnt++;
+
+ if (access(info_file, F_OK) == 0) {
+ fp = fopen(info_file, "r");
+ if (fp == NULL){
+ DBG("file is not generated yet.... wait\n");
+ usleep(100 * 1000); /* 100ms sleep*/
+ continue;
+ }
- vconf_get_int(VCONFKEY_PKGMGR_STATUS, &result);
- if (result < 0) {
- DBG("file is not generated yet.... wait\n");
- usleep(10 * 1000); /* 10ms sleep*/
- } else {
- DBG("info_file file is generated, result = %d. \n", result);
+ fgets(buf, PKG_STRING_LEN_MAX, fp);
+ fclose(fp);
+
+ DBG("info_file file is generated, result = %s. \n", buf);
+ result = atoi(buf);
break;
}
- if (check_cnt > 6000) { /* 60s time over*/
- DBG("wait time over!!\n");
+ DBG("file is not generated yet.... wait\n");
+ usleep(100 * 1000); /* 100ms sleep*/
+
+ if (check_cnt > 6000) { /* 60s * 10 time over*/
+ ERR("wait time over!!\n");
break;
}
}
- vconf_set_int(VCONFKEY_PKGMGR_STATUS, -1);
+ ret = remove(info_file);
+ if (ret < 0)
+ ERR("file is can not remove[%s, %d]\n", info_file, ret);
return result;
}
char *temp = NULL;
int i = 0;
char buf[128] = {'\0'};
- char info_file[PKG_STRING_LEN_MAX] = {'\0', };
pkgmgr_client_t *mpc = (pkgmgr_client_t *) pc;
retvm_if(mpc->ctype != PC_REQUEST, PKGMGR_R_EINVAL, "mpc->ctype is not PC_REQUEST\n");
if (ret < 0)
ERR("comm_client_request failed, ret=%d\n", ret);
- snprintf(info_file, PKG_STRING_LEN_MAX, "app2sd_%s", pkgid);
- ret = __sync_process(info_file);
+ ret = __sync_process(pkgid);
if (ret != 0)
ERR("move pkg failed, ret=%d\n", ret);
if (ret < 0)
ERR("request failed, ret=%d\n", ret);
- pid = __sync_process(req_key);
+ pid = __sync_process(pkgid);
* (int *) data = pid;
catch:
/* Check for NULL value of service type */
retvm_if(service_type > PM_REQUEST_MAX, PKGMGR_R_EINVAL, "service type is not defined\n");
retvm_if(service_type < 0, PKGMGR_R_EINVAL, "service type is error\n");
- vconf_set_int(VCONFKEY_PKGMGR_STATUS, -1);
switch (service_type) {
case PM_REQUEST_CSC:
#include <cynara-client.h>
-#include <vconf.h>
-
/* For multi-user support */
#include <tzplatform_config.h>
return 0;
}
+static void __make_pid_info_file(char *req_key, int pid)
+{
+ FILE* file;
+ int fd;
+ char buf[MAX_PKG_TYPE_LEN] = {0};
+ char info_file[PATH_MAX] = {'\0'};
+
+ if(req_key == NULL)
+ return;
+
+ snprintf(info_file, PATH_MAX, "/tmp/%s", req_key);
+
+ DBG("info_path(%s)", info_file);
+ file = fopen(info_file, "w");
+ if (file == NULL) {
+ ERR("Couldn't open the file(%s)", info_file);
+ return;
+ }
+
+ snprintf(buf, MAX_PKG_TYPE_LEN, "%d\n", pid);
+ fwrite(buf, 1, strlen(buf), file);
+
+ fflush(file);
+ fd = fileno(file);
+ fsync(fd);
+ fclose(file);
+}
+
static int __pkgcmd_app_cb(const pkgmgrinfo_appinfo_h handle, void *user_data)
{
- char *exec = NULL;
- int ret = 0;
+ char *pkgid;
+ char *exec;
+ int ret;
int pid = -1;
+
if (handle == NULL) {
perror("appinfo handle is NULL\n");
- vconf_set_int(VCONFKEY_PKGMGR_STATUS, 0);
exit(1);
}
ret = pkgmgrinfo_appinfo_get_exec(handle, &exec);
if (ret) {
perror("Failed to get app exec path\n");
- vconf_set_int(VCONFKEY_PKGMGR_STATUS, 0);
+ exit(1);
+ }
+ ret = pkgmgrinfo_appinfo_get_pkgid(handle, &pkgid);
+ if (ret) {
+ perror("Failed to get pkgid\n");
exit(1);
}
else if(strcmp(user_data, "check") == 0)
pid = __pkgcmd_proc_iter_kill_cmdline(exec, 0);
- vconf_set_int(VCONFKEY_PKGMGR_STATUS, pid);
+ __make_pid_info_file(pkgid, pid);
return 0;
}
ENDFOREACH(flag)
-pkg_check_modules(pkgs_test REQUIRED dbus-1 ail libxml-2.0 bundle pkgmgr-parser vconf pkgmgr-info libtzplatform-config security-manager)
+pkg_check_modules(pkgs_test REQUIRED dbus-1 ail libxml-2.0 bundle pkgmgr-parser pkgmgr-info libtzplatform-config security-manager)
FOREACH(flag ${pkgs_test_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)
-pkg_check_modules(toolpkgs REQUIRED dlog bundle glib-2.0 pkgmgr-parser vconf pkgmgr-info libtzplatform-config)
-FOREACH(flag ${toolpkgs_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Wl,-zdefs" )
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden")