There is divergence of codes regarding log message.
Use unified header(package-manager-debug.h) and set tag separately.
Change-Id: I57bc25b85c1779d1e418cf4ff8b95b0644486023
Signed-off-by: Wonguk Jeong <wonguk.jeong@samsung.com>
#ifndef __PKGMGR_DEBUG_H__
#define __PKGMGR_DEBUG_H__
-#include <dlog.h>
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif /* LOG_TAG */
+#define LOG_TAG "PKGMGR"
-#define _LOGE(fmt, arg...) LOGE(fmt, ##arg)
-#define _LOGD(fmt, arg...) LOGD(fmt, ##arg)
+#include "package-manager-debug.h"
-
-#define COLOR_RED "\033[0;31m"
-#define COLOR_BLUE "\033[0;34m"
-#define COLOR_END "\033[0;m"
-
-#define PKGMGR_DEBUG(fmt, ...)\
- do\
- {\
- LOGD("[%s(): %d]" fmt, __FUNCTION__, __LINE__,##__VA_ARGS__);\
+#define ret_if(expr) \
+ do { \
+ if (expr) { \
+ ERR("(%s) ", #expr); \
+ return; \
+ } \
} while (0)
-#define PKGMGR_DEBUG_ERR(fmt, ...)\
- do\
- {\
- LOGE(COLOR_RED"[%s(): %d]" fmt COLOR_END, __FUNCTION__, __LINE__,##__VA_ARGS__);\
- }while (0)
-
-#define PKGMGR_BEGIN() \
- do\
- {\
- LOGD(COLOR_BLUE"[%s(): %d] BEGIN >>>>"COLOR_END, __FUNCTION__ ,__LINE__);\
- } while( 0 )
-
-#define PKGMGR_END() \
- do\
- {\
- LOGD(COLOR_BLUE"[%s(): %d] END <<<<"COLOR_END, __FUNCTION__,__LINE__ );\
- } \
- while( 0 )
-
-#define ret_if(expr) do { \
- if (expr) { \
- PKGMGR_DEBUG_ERR("(%s) ", #expr); \
- PKGMGR_END();\
- return; \
- } \
-} while (0)
-
-#define retm_if(expr, fmt, arg...) do { \
- if (expr) { \
- PKGMGR_DEBUG_ERR("(%s) "fmt, #expr, ##arg); \
- PKGMGR_END();\
- return; \
- } \
- } while (0)
+#define retm_if(expr, fmt, arg...) \
+ do { \
+ if (expr) { \
+ ERR("(%s) "fmt, #expr, ##arg); \
+ return; \
+ } \
+ } while (0)
-#define retv_if(expr, val) do { \
+#define retv_if(expr, val) \
+ do { \
if (expr) { \
- PKGMGR_DEBUG_ERR("(%s) ", #expr); \
- PKGMGR_END();\
+ ERR("(%s) ", #expr); \
return (val); \
} \
} while (0)
-#define retvm_if(expr, val, fmt, arg...) do { \
- if (expr) { \
- PKGMGR_DEBUG_ERR("(%s) "fmt, #expr, ##arg); \
- PKGMGR_END();\
- return (val); \
- } \
-} while (0)
+#define retvm_if(expr, val, fmt, arg...) \
+ do { \
+ if (expr) { \
+ ERR("(%s) "fmt, #expr, ##arg); \
+ return (val); \
+ } \
+ } while (0)
-#define trym_if(expr, fmt, arg...) do { \
- if (expr) { \
- PKGMGR_DEBUG_ERR("(%s) "fmt, #expr, ##arg); \
- goto catch; \
- } \
- } while (0)
+#define trym_if(expr, fmt, arg...) \
+ do { \
+ if (expr) { \
+ ERR("(%s) "fmt, #expr, ##arg); \
+ goto catch; \
+ } \
+ } while (0)
-#define tryvm_if(expr, val, fmt, arg...) do { \
- if (expr) { \
- PKGMGR_DEBUG_ERR("(%s) "fmt, #expr, ##arg); \
- val; \
- goto catch; \
- } \
- } while (0)
+#define tryvm_if(expr, val, fmt, arg...) \
+ do { \
+ if (expr) { \
+ ERR("(%s) "fmt, #expr, ##arg); \
+ val; \
+ goto catch; \
+ } \
+ } while (0)
#endif /* __PKGMGR_DEBUG_H__ */
#include "package-manager.h"
#include <pkgmgr-info.h>
-#undef LOG_TAG
-#ifndef LOG_TAG
-#define LOG_TAG "PKGMGR"
-#endif /* LOG_TAG */
-
#define GLOBAL_USER tzplatform_getuid(TZ_SYS_GLOBALAPP_USER)
#define IS_WHITESPACE(CHAR) \
strncpy(pkg_path, input_path, PKG_STRING_LEN_MAX - 1);
}
- _LOGD("pkg_path[%s]\n", pkg_path);
+ DBG("pkg_path[%s]\n", pkg_path);
fp = fopen(PKG_CONF_PATH, "r");
if (fp == NULL) {
_app_str_trim(buffer);
if ((path = strstr(buffer, PKG_BACKEND)) != NULL) {
- _LOGD("[%s]\n", buffer);
- _LOGD("[%s]\n", path);
+ DBG("[%s]\n", buffer);
+ DBG("[%s]\n", path);
path = path + strlen(PKG_BACKEND);
- _LOGD("[%s]\n", path);
+ DBG("[%s]\n", path);
break;
}
snprintf(installer_path, PKG_STRING_LEN_MAX - 1,
"%s%s", backend_path, type);
- _LOGD("installer_path[%s]\n", installer_path);
+ DBG("installer_path[%s]\n", installer_path);
if (access(installer_path, F_OK) != 0)
return NULL;
char installer_path[PKG_STRING_LEN_MAX] = { '\0', };
char backend_path[PKG_STRING_LEN_MAX] = { '\0', };
- _LOGD("type[%s]\n", type);
+ DBG("type[%s]\n", type);
fp = fopen(PKG_CONF_PATH, "r");
if (fp == NULL) {
_app_str_trim(buffer);
if ((path = strstr(buffer, PKG_BACKEND)) != NULL) {
- _LOGD("[%s]\n", buffer);
- _LOGD("[%s]\n", path);
+ DBG("[%s]\n", buffer);
+ DBG("[%s]\n", path);
path = path + strlen(PKG_BACKEND);
- _LOGD("[%s]\n", path);
+ DBG("[%s]\n", path);
break;
}
snprintf(installer_path, PKG_STRING_LEN_MAX - 1,
"%s%s", backend_path, type);
- _LOGD("installer_path[%s]\n", installer_path);
+ DBG("installer_path[%s]\n", installer_path);
if (access(installer_path, F_OK) != 0) {
char extlist[256] = { '\0', };
_get_mime_extension(type, extlist, sizeof(extlist));
- _LOGD("extlist[%s]\n", extlist);
+ DBG("extlist[%s]\n", extlist);
if (strlen(extlist) == 0)
return NULL;
bool(*on_load) (pkg_plugin_set *plugin);
if (library_path == NULL) {
- _LOGE("pkg library path = [%s] \n", library_path);
+ ERR("pkg library path = [%s] \n", library_path);
return NULL;
}
if ((library_handle = dlopen(library_path, RTLD_LAZY)) == NULL) {
- _LOGE("dlopen is failed library_path[%s]\n", library_path);
+ ERR("dlopen is failed library_path[%s]\n", library_path);
return NULL;
}
if ((on_load = dlsym(library_handle, "pkg_plugin_on_load")) == NULL ||
dlerror() != NULL) {
- _LOGE("can not find symbol \n");
+ ERR("can not find symbol \n");
dlclose(library_handle);
return NULL;
}
for (i = 0; plugin_set_list[i]; i++) {
if (strcmp(plugin_set_list[i]->pkg_type, pkg_type) == 0) {
- _LOGD("already loaded [%s] is done well \n",
+ DBG("already loaded [%s] is done well \n",
library_path);
goto END;
}
plugin_set_list[i] = (pkg_plugin_set *) malloc(sizeof(pkg_plugin_set));
if (plugin_set_list[i] == NULL) {
- _LOGE("malloc of the plugin_set_list element is failed \n");
+ ERR("malloc of the plugin_set_list element is failed \n");
dlclose(library_handle);
return NULL;
}
memset(plugin_set_list[i], 0x0, sizeof(pkg_plugin_set));
if (on_load(plugin_set_list[i]) != 0) {
- _LOGE("on_load is failed \n");
+ ERR("on_load is failed \n");
dlclose(library_handle);
strncpy(plugin_set_list[i]->pkg_type, pkg_type,
PKG_TYPE_STRING_LEN_MAX - 1);
- _LOGD("load library [%s] is done well \n", library_path);
+ DBG("load library [%s] is done well \n", library_path);
END:
return plugin_set_list[i];
char buffer[1024] = { 0 };
if (pkg_type == NULL || library_path == NULL) {
- _LOGE("invalid argument\n");
+ ERR("invalid argument\n");
return -1;
}
fp = fopen(PKG_CONF_PATH, "r");
if (fp == NULL) {
- _LOGE("no matching backendlib\n");
+ ERR("no matching backendlib\n");
return PKGMGR_R_ERROR;
}
_app_str_trim(buffer);
if ((path = strstr(buffer, PKG_BACKENDLIB)) != NULL) {
- _LOGD("[%s]\n", buffer);
- _LOGD("[%s]\n", path);
+ DBG("[%s]\n", buffer);
+ DBG("[%s]\n", path);
path = path + strlen(PKG_BACKENDLIB);
- _LOGD("[%s]\n", path);
+ DBG("[%s]\n", path);
break;
}
fclose(fp);
if (path == NULL) {
- _LOGE("no matching backendlib\n");
+ ERR("no matching backendlib\n");
return PKGMGR_R_ERROR;
}
pkg_plugin_set *plugin_set = NULL;
if (pkg_type == NULL) {
- _LOGE("can not load library - pkg_type is null\n");
+ ERR("can not load library - pkg_type is null\n");
return NULL;
}
PKGMGR_R_OK) {
plugin_set = _pkg_plugin_load_library(pkg_type, package_path);
if (plugin_set == NULL) {
- _LOGE("can not load library \n");
+ ERR("can not load library \n");
return NULL;
}
} else {
- _LOGE("can not find path \n");
+ ERR("can not find path \n");
return NULL;
}
#include "comm_client.h"
#include "comm_status_broadcast_server.h"
-#undef LOG_TAG
-#ifndef LOG_TAG
-#define LOG_TAG "PKGMGR"
-#endif /* LOG_TAG */
-
#define PKG_TMP_PATH tzplatform_mkpath(TZ_USER_APP, "tmp")
#define BINSH_NAME "/bin/sh"
cb_info = (req_cb_info *) calloc(1, sizeof(req_cb_info));
if (cb_info == NULL) {
- _LOGD("calloc failed");
+ DBG("calloc failed");
return;
}
cb_info->request_id = request_id;
tmp = pc->info.request.rhead;
if (tmp == NULL) {
- _LOGE("tmp is NULL");
+ ERR("tmp is NULL");
return NULL;
}
- _LOGD("tmp->req_key %s, req_key %s", tmp->req_key, req_key);
+ DBG("tmp->req_key %s, req_key %s", tmp->req_key, req_key);
while (tmp) {
if (strncmp(tmp->req_key, req_key, strlen(tmp->req_key)) == 0)
cb_info = (listen_cb_info *) calloc(1, sizeof(listen_cb_info));
if (cb_info == NULL) {
- _LOGD("calloc failed");
+ DBG("calloc failed");
return;
}
cb_info->request_id = request_id;
pkgmgr_client_t *pc;
req_cb_info *cb_info;
- _LOGD("__operation_callback() req_id[%s] pkg_type[%s] pkgid[%s]"
+ DBG("__operation_callback() req_id[%s] pkg_type[%s] pkgid[%s]"
"key[%s] val[%s]\n", req_id, pkg_type, pkgid, key, val);
pc = (pkgmgr_client_t *) cb_data;
if (cb_info == NULL)
return;
- _LOGD("__find_op_cbinfo");
+ DBG("__find_op_cbinfo");
/* call callback */
if (cb_info->event_cb) {
cb_info->event_cb(cb_info->request_id, pkg_type, pkgid, key,
val, NULL, cb_info->data);
- _LOGD("event_cb is called");
+ DBG("event_cb is called");
}
/*remove callback for last call
if (strcmp(key, "end") == 0) {
__remove_op_cbinfo(pc, cb_info);
- _LOGD("__remove_op_cbinfo");
+ DBG("__remove_op_cbinfo");
}
*/
pkgmgr_client_t *pc;
listen_cb_info *tmp;
- _LOGD("__status_callback() req_id[%s] pkg_type[%s] pkgid[%s]"
+ DBG("__status_callback() req_id[%s] pkg_type[%s] pkgid[%s]"
"key[%s] val[%s]\n", req_id, pkg_type, pkgid, key, val);
pc = (pkgmgr_client_t *) cb_data;
size = strlen(pkg_path) + strlen(timestr) + 2;
str_req_key = (char *)calloc(size, sizeof(char));
if (str_req_key == NULL) {
- _LOGD("calloc failed");
+ DBG("calloc failed");
return NULL;
}
snprintf(str_req_key, size, "%s_%s", pkg_path, timestr);
ret = _get_mime_from_file(pkg_path, mimetype, sizeof(mimetype));
if (ret) {
- _LOGE("_get_mime_from_file() failed - error code[%d]\n",
+ ERR("_get_mime_from_file() failed - error code[%d]\n",
ret);
return NULL;
}
ret = _get_mime_extension(mimetype, extlist, sizeof(extlist));
if (ret) {
- _LOGE("_get_mime_extension() failed - error code[%d]\n",
+ ERR("_get_mime_extension() failed - error code[%d]\n",
ret);
return NULL;
}
char *caller_pkgid = NULL;
if (__get_appid_bypid(getpid(), caller_appid, sizeof(caller_appid), uid) < 0) {
- _LOGE("get appid fail!!!\n");
+ ERR("get appid fail!!!\n");
return NULL;
}
if (__get_pkgid_by_appid(caller_appid, &caller_pkgid) < 0){
- _LOGE("get pkgid fail!!!\n");
+ ERR("get pkgid fail!!!\n");
return NULL;
}
vconf_get_int(VCONFKEY_PKGMGR_STATUS, &result);
if (result < 0) {
- _LOGD("file is not generated yet.... wait\n");
+ DBG("file is not generated yet.... wait\n");
usleep(10 * 1000); /* 10ms sleep*/
} else {
- _LOGD("info_file file is generated, result = %d. \n", result);
+ DBG("info_file file is generated, result = %d. \n", result);
break;
}
if (check_cnt > 6000) { /* 60s time over*/
- _LOGD("wait time over!!\n");
+ DBG("wait time over!!\n");
break;
}
}
strncat(args, temp, strlen(temp));
g_free(temp);
}
- _LOGD("[args] %s [len] %d\n", args, len);
+ DBG("[args] %s [len] %d\n", args, len);
/* get cookie from security-server */
cookie = __get_cookie_from_security_server();
/* request */
ret = comm_client_request(mpc->info.request.cc, req_key, COMM_REQ_GET_SIZE, pkgtype, pkgid, args, cookie, uid, 1);
if (ret < 0)
- _LOGE("comm_client_request failed, ret=%d\n", ret);
+ ERR("comm_client_request failed, ret=%d\n", ret);
ret = __sync_process(req_key);
if (ret < 0)
- _LOGE("get size failed, ret=%d\n", ret);
+ ERR("get size failed, ret=%d\n", ret);
catch:
for (i = 0; i < argcnt; i++)
strncat(args, temp, strlen(temp));
g_free(temp);
}
- _LOGD("[args] %s [len] %d\n", args, len);
+ DBG("[args] %s [len] %d\n", args, len);
/* get cookie from security-server */
cookie = __get_cookie_from_security_server();
/* 6. request */
ret = comm_client_request(mpc->info.request.cc, req_key, COMM_REQ_TO_MOVER, pkgtype, pkgid, args, cookie,uid, 1);
if (ret < 0)
- _LOGE("comm_client_request failed, ret=%d\n", ret);
+ ERR("comm_client_request failed, ret=%d\n", ret);
snprintf(info_file, PKG_STRING_LEN_MAX, "app2sd_%s", pkgid);
ret = __sync_process(info_file);
if (ret != 0)
- _LOGE("move pkg failed, ret=%d\n", ret);
+ ERR("move pkg failed, ret=%d\n", ret);
catch:
for (i = 0; i < argcnt; i++)
ret = comm_client_request(mpc->info.request.cc, req_key, COMM_REQ_CHECK_APP, pkgtype, pkgid, NULL, NULL, uid, 1);
if (ret < 0)
- _LOGE("request failed, ret=%d\n", ret);
+ ERR("request failed, ret=%d\n", ret);
pid = __sync_process(req_key);
* (int *) data = pid;
comm_status_broadcast_server_disconnect(mpc->info.broadcast.bc);
ret = 0;
} else {
- _LOGE("Invalid client type\n");
+ ERR("Invalid client type\n");
return PKGMGR_R_EINVAL;
}
caller_pkgid = __get_caller_pkgid(uid);
if (caller_pkgid == NULL)
- _LOGE("caller dont have pkgid..\n");
+ ERR("caller dont have pkgid..\n");
/* Check for NULL value of pc */
retvm_if(pc == NULL, PKGMGR_R_EINVAL, "package manager client handle is NULL");
}
if (installer_path == NULL) {
free(pkgtype);
- _LOGE("installer_path is NULL\n");
+ ERR("installer_path is NULL\n");
return PKGMGR_R_EINVAL;
}
strncat(args, temp, strlen(temp));
g_free(temp);
}
- _LOGD("[args] %s [len] %d\n", args, len);
+ DBG("[args] %s [len] %d\n", args, len);
/* get cookie from security-server */
cookie = __get_cookie_from_security_server();
strncat(args, temp, strlen(temp));
g_free(temp);
}
- _LOGD("[args] %s [len] %d\n", args, len);
+ DBG("[args] %s [len] %d\n", args, len);
/* get cookie from security-server */
cookie = __get_cookie_from_security_server();
caller_pkgid = __get_caller_pkgid(uid);
if (caller_pkgid == NULL)
- _LOGD("caller dont have pkgid..\n");
+ DBG("caller dont have pkgid..\n");
/* Check for NULL value of pc */
retvm_if(pc == NULL, PKGMGR_R_EINVAL, "package manager client handle is NULL\n");
strncat(args, temp, strlen(temp));
g_free(temp);
}
- _LOGD("[args] %s [len] %d\n", args, len);
+ DBG("[args] %s [len] %d\n", args, len);
/* get cookie from security-server */
cookie = __get_cookie_from_security_server();
free(cookie);
pkgmgr_pkginfo_destroy_pkginfo(handle);
- PKGMGR_END();\
return ret;
}
/* Check for NULL value of pc */
if (pc == NULL) {
- _LOGD("package manager client handle is NULL\n");
+ DBG("package manager client handle is NULL\n");
return PKGMGR_R_EINVAL;
}
pkgmgr_client_t *mpc = (pkgmgr_client_t *) pc;
args = (char *)calloc(len, sizeof(char));
if (args == NULL) {
- _LOGD("calloc failed");
+ DBG("calloc failed");
for (i = 0; i < argcnt; i++)
free(argv[i]);
strncat(args, temp, strlen(temp));
g_free(temp);
}
- _LOGD("[args] %s [len] %d\n", args, len);
+ DBG("[args] %s [len] %d\n", args, len);
/******************* end of quote ************************/
/* 6. request install */
COMM_REQ_TO_MOVER, pkgtype, pkgid,
args, cookie, uid, 1);
if (ret < 0) {
- _LOGE("request failed, ret=%d\n", ret);
+ ERR("request failed, ret=%d\n", ret);
for (i = 0; i < argcnt; i++)
free(argv[i]);
strncat(args, temp, strlen(temp));
g_free(temp);
}
- _LOGD("[args] %s [len] %d\n", args, len);
+ DBG("[args] %s [len] %d\n", args, len);
/* get cookie from security-server */
cookie = __get_cookie_from_security_server();
free(cookie);
pkgmgr_pkginfo_destroy_pkginfo(handle);
- PKGMGR_END();\
return ret;
}
strncat(argsr, args, strlen(args));
}
- _LOGD("argsr [%s]\n", argsr);
+ DBG("argsr [%s]\n", argsr);
/******************* end of quote ************************/
/* 3. request activate */
/* Check for NULL value of pc */
if (pc == NULL) {
- _LOGD("package manager client handle is NULL\n");
+ DBG("package manager client handle is NULL\n");
return PKGMGR_R_EINVAL;
}
pkgmgr_client_t *mpc = (pkgmgr_client_t *) pc;
args = (char *)calloc(len, sizeof(char));
if (args == NULL) {
- _LOGD("calloc failed");
+ DBG("calloc failed");
for (i = 0; i < argcnt; i++)
free(argv[i]);
strncat(args, temp, strlen(temp));
g_free(temp);
}
- _LOGD("[args] %s [len] %d\n", args, len);
+ DBG("[args] %s [len] %d\n", args, len);
/******************* end of quote ************************/
/* 6. request clear */
COMM_REQ_TO_CLEARER, pkgtype, appid,
args, cookie, uid, 1);
if (ret < 0) {
- _LOGE("request failed, ret=%d\n", ret);
+ ERR("request failed, ret=%d\n", ret);
for (i = 0; i < argcnt; i++)
free(argv[i]);
{
/* Check for NULL value of pc */
if (pc == NULL) {
- _LOGD("package manager client handle is NULL\n");
+ DBG("package manager client handle is NULL\n");
return PKGMGR_R_EINVAL;
}
/* Check for valid arguments. NULL parameter causes DBUS to abort */
if (pkgid == NULL || pkg_type == NULL || key == NULL || val == NULL) {
- _LOGD("Argument supplied is NULL\n");
+ DBG("Argument supplied is NULL\n");
return PKGMGR_R_EINVAL;
}
pkgmgr_client_t *mpc = (pkgmgr_client_t *) pc;
ret = __csc_process(custom_info, (char *)data);
if (ret < 0)
- _LOGE("__csc_process fail \n");
+ ERR("__csc_process fail \n");
else
ret = PKGMGR_R_OK;
ret = __check_app_process(service_type, pc, pkgid, uid, data);
if (ret < 0)
- _LOGE("__check_app_process fail \n");
+ ERR("__check_app_process fail \n");
else
ret = PKGMGR_R_OK;
break;
default:
- _LOGE("Wrong Request\n");
+ ERR("Wrong Request\n");
ret = -1;
break;
}
strncat(args, temp, strlen(temp));
g_free(temp);
}
- _LOGD("[args] %s [len] %d\n", args, len);
+ DBG("[args] %s [len] %d\n", args, len);
/* get cookie from security-server */
cookie = __get_cookie_from_security_server();
/* request */
ret = comm_client_request(mpc->info.request.cc, req_key, COMM_REQ_GET_SIZE, pkgtype, pkgid, args, cookie, uid, 1);
if (ret < 0)
- _LOGE("comm_client_request failed, ret=%d\n", ret);
+ ERR("comm_client_request failed, ret=%d\n", ret);
catch:
for (i = 0; i < argcnt; i++)
iter_data *udata = calloc(1, sizeof(iter_data));
if (udata == NULL) {
- _LOGE("calloc failed");
+ ERR("calloc failed");
ail_filter_destroy(filter);
return PKGMGR_R_ERROR;
pkg_detail_info = calloc(1, sizeof(package_manager_pkg_detail_info_t));
if (pkg_detail_info == NULL) {
- _LOGE("*** Failed to alloc package_handler_info.\n");
+ ERR("*** Failed to alloc package_handler_info.\n");
return NULL;
}
plugin_set = _package_manager_load_library(pkgtype);
if (plugin_set == NULL) {
- _LOGE("*** Failed to load library");
+ ERR("*** Failed to load library");
free(pkg_detail_info);
return NULL;
}
if (plugin_set->pkg_is_installed) {
if (plugin_set->pkg_is_installed(pkgid) != 0) {
- _LOGE("*** Failed to call pkg_is_installed()");
+ ERR("*** Failed to call pkg_is_installed()");
free(pkg_detail_info);
return NULL;
}
if (plugin_set->get_pkg_detail_info) {
if (plugin_set->get_pkg_detail_info(pkgid,
pkg_detail_info) != 0) {
- _LOGE("*** Failed to call get_pkg_detail_info()");
+ ERR("*** Failed to call get_pkg_detail_info()");
free(pkg_detail_info);
return NULL;
}
package_manager_pkg_detail_info_t *pkg_detail_info = NULL;
char *pkgtype;
if (pkg_path == NULL) {
- _LOGE("pkg_path is NULL\n");
+ ERR("pkg_path is NULL\n");
return NULL;
}
if (strlen(pkg_path) > PKG_URL_STRING_LEN_MAX) {
- _LOGE("length of pkg_path is too long - %d.\n",
+ ERR("length of pkg_path is too long - %d.\n",
strlen(pkg_path));
return NULL;
}
pkg_detail_info = calloc(1, sizeof(package_manager_pkg_detail_info_t));
if (pkg_detail_info == NULL) {
- _LOGE("*** Failed to alloc package_handler_info.\n");
+ ERR("*** Failed to alloc package_handler_info.\n");
return NULL;
}
#include "comm_pkg_mgr_client_dbus_bindings.h"
#include "comm_status_broadcast_client_dbus_bindings.h"
#include "comm_status_broadcast_signal_marshaller.h"
+#include "comm_debug.h"
#include <stdlib.h>
#include <string.h>
{
comm_client *cc = (comm_client *) data;
- dbg("Got signal: %s/%s/%s/%s/%s", req_id, pkg_type,
+ DBG("Got signal: %s/%s/%s/%s/%s", req_id, pkg_type,
pkgid, key, val);
if (cc->signal_cb) {
if (cc->pkgid && pkgid &&
0 == strncmp(cc->pkgid, pkgid,
strlen(cc->pkgid))) {
- dbg("Run signal handler");
+ DBG("Run signal handler");
cc->signal_cb(cc->signal_cb_data, req_id, pkg_type,
pkgid, key, val);
} else {
- dbg("pkgid is different. (My pkgid:%s)"
+ DBG("pkgid is different. (My pkgid:%s)"
" Though pass signal to user callback.", cc->pkgid);
cc->signal_cb(cc->signal_cb_data, req_id, pkg_type,
pkgid, key, val);
}
} else {
- dbg("No signal handler is set. Do nothing.");
+ DBG("No signal handler is set. Do nothing.");
}
}
gboolean r;
gint ret = COMM_RET_ERROR;
- dbg("got request:%s/%d/%s/%s/%s/%s\n", req_id, req_type, pkg_type,
+ DBG("got request:%s/%d/%s/%s/%s/%s\n", req_id, req_type, pkg_type,
pkgid, args, cookie);
if (!pkgid)
}
return ret;
}
- dbg("request sent");
+ DBG("request sent");
if (cc->pkgid) {
- dbg("freeing pkgid");
+ DBG("freeing pkgid");
free(cc->pkgid);
- dbg("freed pkgid");
+ DBG("freed pkgid");
}
cc->pkgid = strdup(pkgid);
- dbg("ret:%d", ret);
+ DBG("ret:%d", ret);
return ret;
}
{
/* set callback */
if (!cc->signal_proxy) {
- dbg("signal_proxy is NULL. Try to create a proxy for signal.");
+ DBG("signal_proxy is NULL. Try to create a proxy for signal.");
cc->signal_proxy = dbus_g_proxy_new_for_name(cc->conn,
COMM_STATUS_BROADCAST_DBUS_SERVICE_PREFIX,
COMM_STATUS_BROADCAST_DBUS_PATH,
cc->signal_cb = cb;
cc->signal_cb_data = cb_data;
- dbg("Register signal-type marshaller.");
+ DBG("Register signal-type marshaller.");
dbus_g_object_register_marshaller(
g_cclosure_user_marshal_VOID__STRING_STRING_STRING_STRING_STRING,
/* marshaller */
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); /* termination flag */
- dbg("Add signal to proxy.");
+ DBG("Add signal to proxy.");
dbus_g_proxy_add_signal(cc->signal_proxy,
COMM_STATUS_BROADCAST_SIGNAL_STATUS,
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
- dbg("Connect signal to proxy.");
+ DBG("Connect signal to proxy.");
dbus_g_proxy_connect_signal(cc->signal_proxy,
COMM_STATUS_BROADCAST_SIGNAL_STATUS,
#include "comm_config.h"
#include "comm_client.h"
#include "comm_pkg_mgr_client_gdbus_generated.h"
+#include "comm_debug.h"
/*******************
* ADT description
strcmp(interface_name, COMM_STATUS_BROADCAST_DBUS_UPGRADE_INTERFACE) &&
strcmp(interface_name, COMM_STATUS_BROADCAST_DBUS_MOVE_INTERFACE) &&
strcmp(interface_name, COMM_STATUS_BROADCAST_DBUS_INSTALL_PROGRESS_INTERFACE)) {
- dbg("Interface name did not match. Drop the message");
+ DBG("Interface name did not match. Drop the message");
return;
}
if (signal_name && strcmp(signal_name, COMM_STATUS_BROADCAST_SIGNAL_STATUS) &&
strcmp(signal_name, COMM_STATUS_BROADCAST_EVENT_UPGRADE) &&
strcmp(signal_name, COMM_STATUS_BROADCAST_EVENT_MOVE) &&
strcmp(signal_name, COMM_STATUS_BROADCAST_EVENT_INSTALL_PROGRESS)) {
- dbg("Signal name did not match. Drop the message");
+ DBG("Signal name did not match. Drop the message");
return;
}
/* Values to be received by signal */
if (sig_cb_data && sig_cb_data->cb) {
sig_cb_data->cb(sig_cb_data->cb_data, req_id,
pkg_type, pkgid, key, val);
- dbg("callback function is end");
+ DBG("callback function is end");
}
- dbg("Handled signal. Exit function");
+ DBG("Handled signal. Exit function");
return;
}
*
*/
-
-
-
-
#ifndef __COMM_CONFIG_H__
#define __COMM_CONFIG_H__
#define API __attribute__ ((visibility("default")))
#endif
-/* Debug message macro */
-#define USE_DLOG 1 /* Use dlog! */
-
-#ifndef NDEBUG
-#ifdef USE_DLOG
-#undef LOG_TAG
-#ifndef LOG_TAG
-#define LOG_TAG "PKGMGR"
-#endif /* LOG_TAG */
-#include <dlog.h>
-
-#define dbg(fmt, arg...) LOGD(fmt, ##arg)
-#define ERR(fmt, arg...) LOGE(fmt, ##arg)
-
-#else
-#include <stdio.h>
-#include <sys/types.h>
-#include <unistd.h>
-#define dbg(fmtstr, args...) \
- do {
- fprintf(stdout, "[%d:comm]%s:%d:%s(): " \
- fmtstr "\n", getpid(),\
- basename(__FILE__), __LINE__, __func__, ##args);\
- } while (0)
-
-#define ERR(fmtstr, args...) \
- do {
- fprintf(stderr, "[%d:comm]%s:%d:%s(): " \
- fmtstr "\n", getpid(),\
- basename(__FILE__), __LINE__, __func__, ##args);\
- } while (0)
-#endif /* USE_DLOG */
-#else
-#define dbg(fmtstr, args...)
-#endif
-
/* from comm_pkg_mgr.xml
*/
#define COMM_PKG_MGR_DBUS_SERVICE "org.tizen.slp.pkgmgr"
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ *
+ */
+
+#ifndef __COMM_DEBUG_H__
+#define __COMM_DEBUG_H__
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif /* LOG_TAG */
+#define LOG_TAG "PKGMGR"
+
+#include "package-manager-debug.h"
+
+#endif /* __COMM_DEBUG_H__ */
#include <unistd.h>
#include "comm_pkg_mgr_server.h"
+#include "comm_debug.h"
/* object class def: do nothing on this */
struct PkgMgrObjectClass {
static void pkg_mgr_object_class_init(PkgMgrObjectClass *klass);
static void pkg_mgr_object_init(PkgMgrObject *obj)
{
- dbg("called");
+ DBG("called");
g_assert(NULL != obj);
GError *err = NULL;
/* Establish dbus session */
obj->bus = dbus_g_bus_get(DBUS_BUS_SYSTEM, &err);
if (NULL == obj->bus) {
- dbg("Failed to open connection to dbus: %s", err->message);
+ DBG("Failed to open connection to dbus: %s", err->message);
return;
}
DBUS_SERVICE_DBUS,
DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS);
if (NULL == proxy) {
- dbg("Failed to get a proxy");
+ DBG("Failed to get a proxy");
return;
}
/* Register service name
g_printerr("dbus RequestName RPC failed %s %d", err->message, TRUE);
return;
}
- dbg("RequestName returns: %d", result);
+ DBG("RequestName returns: %d", result);
dbus_g_connection_register_g_object(obj->bus,
COMM_PKG_MGR_DBUS_PATH,
G_OBJECT(obj));
- dbg("Ready to serve requests");
+ DBG("Ready to serve requests");
g_object_unref(proxy);
- dbg("done");
+ DBG("done");
}
static void pkg_mgr_object_class_init(PkgMgrObjectClass *klass)
{
- dbg("called");
+ DBG("called");
g_assert(NULL != klass);
dbus_g_object_type_install_info(PKG_MGR_TYPE_OBJECT,
&dbus_glib_pkgmgr_object_info);
- dbg("done");
+ DBG("done");
}
static void pkg_mgr_object_finalize(GObject *self)
const gchar *args,
const gchar *cookie, uid_t uid, gint *ret, GError *err)
{
- dbg("Called");
+ DBG("Called");
*ret = COMM_RET_OK; /* TODO: fix this! */
/* TODO: Add business logic
* */
if (obj->req_cb) {
- dbg("Call request callback(obj, %lu, %s, %d, %s, %s, %s, *ret)",
+ DBG("Call request callback(obj, %lu, %s, %d, %s, %s, %s, *ret)",
uid, req_id, req_type, pkg_type, pkgid, args);
obj->req_cb(obj->req_cb_data, uid, req_id, req_type, pkg_type,
pkgid, args, cookie, ret);
} else {
- dbg("Attempt to call request callback,"
+ DBG("Attempt to call request callback,"
" but request callback is not set. Do nothing.\n"
"Use pkg_mgr_set_request_callback()"
" to register your callback.");
#include <dbus/dbus.h>
#include "comm_status_broadcast_server.h"
+#include "comm_debug.h"
/***************************
* dbus-glib API for server
static void
__status_broadcast_object_class_init(StatusBroadcastObjectClass *klass)
{
- dbg("called");
+ DBG("called");
g_assert(NULL != klass);
dbus_g_object_type_install_info(STATUS_BROADCAST_TYPE_OBJECT,
&dbus_glib_status_broadcast_object_info);
- dbg("done");
+ DBG("done");
}
static void __status_broadcast_object_init(StatusBroadcastObject *obj)
{
- dbg("called");
+ DBG("called");
g_assert(NULL != obj);
GError *err = NULL;
/* Establish dbus session */
obj->bus = dbus_g_bus_get(DBUS_BUS_SYSTEM, &err);
if (NULL == obj->bus) {
- dbg("Failed to open connection to dbus: %s", err->message);
+ DBG("Failed to open connection to dbus: %s", err->message);
return;
}
DBUS_SERVICE_DBUS,
DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS);
if (NULL == proxy) {
- dbg("Failed to get a proxy");
+ DBG("Failed to get a proxy");
return;
}
/* Register service name
g_printerr("dbus RequestName RPC failed", err->message, TRUE);
return;
}
- dbg("RequestName returns: %d", result);
+ DBG("RequestName returns: %d", result);
dbus_g_connection_register_g_object(obj->bus,
COMM_STATUS_BROADCAST_DBUS_PATH,
G_OBJECT(obj));
- dbg("Ready to serve requests");
+ DBG("Ready to serve requests");
g_object_unref(proxy);
- dbg("done");
+ DBG("done");
}
static void __status_broadcast_object_finalize(GObject *self)
StatusBroadcastObjectClass *klass;
klass = STATUS_BROADCAST_OBJECT_GET_CLASS(obj);
- dbg("Send signal: %s/%s/%s", pkg, key, val);
+ DBG("Send signal: %s/%s/%s", pkg, key, val);
g_signal_emit(obj, klass->signal, 0, pkg, key, val);
}
#include "comm_config.h"
#include "comm_status_broadcast_server.h"
+#include "comm_debug.h"
#include <dbus/dbus.h>
/********************************************
conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err);
if (dbus_error_is_set(&err)) {
- dbg("Connection error: %s", err.message);
+ DBG("Connection error: %s", err.message);
dbus_error_free(&err);
}
dbus_error_free(&err);
if (NULL == conn) {
- dbg("conn is NULL");
+ DBG("conn is NULL");
return NULL;
}
dbus_bus_request_name(conn, __get_prifix(status_type), DBUS_NAME_FLAG_ALLOW_REPLACEMENT, &err);
if (dbus_error_is_set(&err)) {
- dbg("Failed to request name: %s", err.message);
+ DBG("Failed to request name: %s", err.message);
dbus_error_free(&err);
return NULL;
}
int i;
if (conn == NULL) {
- dbg("dbus conn is NULL");
+ DBG("dbus conn is NULL");
return;
}
msg = dbus_message_new_signal(__get_path(comm_status_type), __get_interface(comm_status_type), __get_name(comm_status_type));
if (NULL == msg) {
- dbg("msg NULL");
+ DBG("msg NULL");
return;
}
for (i = 0; i < 5; i++) {
if (!dbus_message_iter_append_basic
(&args, DBUS_TYPE_STRING, &(values[i]))) {
- dbg("dbus_message_iter_append_basic failed:"
+ DBG("dbus_message_iter_append_basic failed:"
" Out of memory");
return;
}
}
if (!dbus_connection_send(conn, msg, &serial)) {
- dbg("dbus_connection_send failed: Out of memory");
+ DBG("dbus_connection_send failed: Out of memory");
return;
}
dbus_connection_flush(conn);
#include "comm_config.h"
#include "comm_socket.h"
#include "comm_status_broadcast_server.h"
+#include "comm_debug.h"
#include "error_report.h"
#include <db-util.h>
#include <pkgmgr-info.h>
-
#undef LOG_TAG
#ifndef LOG_TAG
#define LOG_TAG "PKGMGR_INSTALLER"
-#endif /* LOG_TAG */
+#endif /* LOG_TAG */
#define MAX_STRLEN 1024
#define MAX_QUERY_LEN 4096
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: junsuk. oh <junsuk77.oh@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ *
+ */
+
+#ifndef __PKG_MANAGER_DEBUG_H__
+#define __PKG_MANAGER_DEBUG_H__
+
+#include <dlog.h>
+
+#ifndef ERR
+#define ERR(fmt, args...) LOGE("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
+#endif
+
+#ifndef DBG
+#define DBG(fmt, args...) LOGD("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
+#endif
+
+#ifndef INFO
+#define INFO(fmt, args...) LOGI("[%s:%d] "fmt"\n", __func__, __LINE__, ##args)
+#endif
+
+#endif /* __PKG_MANAGER_DEBUG_H__ */
*
*/
-
-
-
-
#ifndef _PKGMGR_SERVER_H_
#define _PKGMGR_SERVER_H_
-#define CONF_FILE "/etc/package-manager/server/.config"
-#define DESKTOP_FILE_DIRS "/usr/share/install-info/desktop.conf"
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif /* LOG_TAG */
+#define LOG_TAG "PKGMGR_SERVER"
+#include "package-manager-debug.h"
+
+#define CONF_FILE "/etc/package-manager/server/.config"
+#define DESKTOP_FILE_DIRS "/usr/share/install-info/desktop.conf"
-#define PKG_BACKEND "backend:"
-#define PKG_CONF_PATH "/etc/package-manager/pkg_path.conf"
+#define PKG_BACKEND "backend:"
+#define PKG_CONF_PATH "/etc/package-manager/pkg_path.conf"
-#define MAX_REQ_ID_LEN 256
-#define MAX_PKG_TYPE_LEN 128
-#define MAX_PKG_NAME_LEN 256
-#define MAX_PKG_ARGS_LEN 4096
-#define MAX_COOKIE_LEN 32
-#define DESKTOP_FILE_DIRS_NUM 1024
+#define MAX_REQ_ID_LEN 256
+#define MAX_PKG_TYPE_LEN 128
+#define MAX_PKG_NAME_LEN 256
+#define MAX_PKG_ARGS_LEN 4096
+#define MAX_COOKIE_LEN 32
+#define DESKTOP_FILE_DIRS_NUM 1024
typedef struct {
char req_id[MAX_REQ_ID_LEN];
char pkgtype[MAX_PKG_TYPE_LEN];
char pkgid[MAX_PKG_NAME_LEN];
char args[MAX_PKG_ARGS_LEN];
-}backend_info;
+} backend_info;
struct pm_inotify_paths_t {
int wd;
void _pm_desktop_file_monitor_fini();
int _pm_desktop_file_dir_search(pm_inotify_paths *paths, int number);
-#endif /* _PKGMGR_SERVER_H_ */
+#endif/* _PKGMGR_SERVER_H_ */
#include "pm-queue.h"
#include "comm_config.h"
-/* debug output */
-#if defined(NDEBUG)
-#define DBG(fmt, args...)
-#define __SET_DBG_OUTPUT(fp)
-#elif defined(PRINT)
-#include <stdio.h>
-FILE *___log = NULL;
-#define DBG(fmt, args...) \
- {if (!___log) ___log = stderr; \
- fprintf(___log, "[DBG:PMS]%s:%d:%s(): " fmt "\n",\
- basename(__FILE__), __LINE__, __func__, ##args); fflush(___log); }
-#define __SET_DBG_OUTPUT(fp) \
- (___log = fp)
-#else
-#include <dlog.h>
-#undef LOG_TAG
-#define LOG_TAG "PKGMGR_SERVER"
-
-#define DBGE(fmt, arg...) LOGE(fmt,##arg)
-#define DBG(fmt, arg...) LOGD(fmt,##arg)
-#endif
-
-#if !defined(PACKAGE)
-#define PACKAGE "package-manager"
-#endif
-
-#if !defined(LOCALEDIR)
-#define LOCALEDIR "/usr/share/locale"
-#endif
-
#define PACKAGE_RECOVERY_DIR tzplatform_mkpath(TZ_SYS_RW_PACKAGES, ".recovery/pkgmgr")
-
-#define DESKTOP_W 720.0
-
#define NO_MATCHING_FILE 11
static int backend_flag = 0; /* 0 means that backend process is not running */
ret = ail_package_get_appinfo(pkgid, &handle);
if (ret != AIL_ERROR_OK) {
- DBGE("ail_package_get_appinfo() failed");
+ ERR("ail_package_get_appinfo() failed");
return NULL;
}
ret = ail_appinfo_get_str(handle, AIL_PROP_X_SLP_EXE_PATH, &str);
if (ret != AIL_ERROR_OK) {
- DBGE("ail_appinfo_get_str() failed");
+ ERR("ail_appinfo_get_str() failed");
ail_package_destroy_appinfo(handle);
return NULL;
}
exe_path = strdup(str);
if (exe_path == NULL) {
- DBGE("strdup() failed");
+ ERR("strdup() failed");
ail_package_destroy_appinfo(handle);
return NULL;
}
ret = ail_package_destroy_appinfo(handle);
if (ret != AIL_ERROR_OK) {
- DBGE("ail_package_destroy_appinfo() failed");
+ ERR("ail_package_destroy_appinfo() failed");
free(exe_path);
return NULL;
}
DBG("activated label %s", label);
break;
default: /* '?' */
- DBGE("Incorrect argument %s\n", item->args);
+ ERR("Incorrect argument %s\n", item->args);
exit(1);
}
}
exit(1);
}
} else { /* in case of package */
- DBGE("(De)activate PKG[pkgid=%s, val=%d]", item->pkgid, val);
+ ERR("(De)activate PKG[pkgid=%s, val=%d]", item->pkgid, val);
char *manifest = NULL;
manifest = pkgmgr_parser_get_manifest_file(item->pkgid);
if (manifest == NULL) {
- DBGE("Failed to fetch package manifest file\n");
+ ERR("Failed to fetch package manifest file\n");
exit(1);
}
- DBGE("manifest : %s\n", manifest);
+ ERR("manifest : %s\n", manifest);
if (val) {
pkgmgrinfo_pkginfo_h handle;
if (ret < 0) {
ret = pkgmgr_parser_parse_usr_manifest_for_installation(manifest,item->uid, NULL);
if (ret < 0) {
- DBGE("insert in db failed\n");
+ ERR("insert in db failed\n");
}
ret = ail_usr_desktop_add(item->pkgid, item->uid);
if (ret != AIL_ERROR_OK) {
- DBGE("fail to ail_desktop_add");
+ ERR("fail to ail_desktop_add");
}
} else {
pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
ret = pkgmgr_parser_parse_usr_manifest_for_uninstallation(manifest, item->uid, NULL);
if (ret < 0) {
- DBGE("insert in db failed\n");
+ ERR("insert in db failed\n");
exit(1);
}
}
*
*/
-
-
-
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef DEBUG_INFO
/*Debug info*/
- printf("Queue Info Map\n");
- printf("Number of Backends is %d\n", num_of_backends);
- printf("Number of Entries is %d\n", entries);
- printf("Backend\tType\tSlot\tHead\n");
+ DBG("Queue Info Map");
+ DBG("Number of Backends is %d", num_of_backends);
+ DBG("Number of Entries is %d", entries);
+ DBG("Backend\tType\tSlot\tHead");
ptr = start;
for(n = 0; n < entries; n++)
{
- printf("%s\t%s\t%d\t%p\n", ptr->backend, ptr->pkgtype, ptr->queue_slot, ptr->head);
+ DBG("%s\t%s\t%d\t%p", ptr->backend, ptr->pkgtype, ptr->queue_slot, ptr->head);
ptr++;
}
#endif
tmp = cur;
data = _add_node();
- if (!data) { /* fail to allocate mem */
- fprintf(stderr, "Fail to allocate memory\n");
+ if (!data) { /* fail to allocate mem */
+ ERR("Fail to allocate memory\n");
pthread_mutex_unlock(&pm_mutex);
return -1;
}
ret = (pm_dbus_msg *) malloc(sizeof(pm_dbus_msg));
if (!ret) {
- fprintf(stderr, "Mem alloc error\n");
+ ERR("Mem alloc error");
return NULL;
}
memset(ret, 0x00, sizeof(pm_dbus_msg));
c = 0;
while(c < num_of_backends) {
- if (!head[c]) { /* in case of head is NULL */
- fprintf(stderr, "queue is NULL\n");
+ if (!head[c]) { /* in case of head is NULL */
+ ERR("queue is NULL");
c = c + 1;
continue;
}
pm_queue_data *newnode = NULL;
newnode = (pm_queue_data *) malloc(sizeof(pm_queue_data));
- if (!newnode) { /* if NULL */
- fprintf(stderr, "Mem alloc error\n");
+ if (!newnode) { /* if NULL */
+ ERR("Mem alloc error");
return NULL;
}
memset(newnode, 0x00, sizeof(pm_queue_data));
newnode->msg = (pm_dbus_msg *) malloc(sizeof(pm_dbus_msg));
if (!newnode->msg) {
- fprintf(stderr, "Mem alloc error\n");
+ ERR("Mem alloc error");
free(newnode);
return NULL;
}
fp_status = fopen(STATUS_FILE, "w"); /* overwrite always */
if (!fp_status) {
- fprintf(stderr, "Can't open status file:%s\n", STATUS_FILE);
+ ERR("Can't open status file:%s", STATUS_FILE);
return;
}
#include "package-manager.h"
#include "pkgmgr_installer.h"
-#undef LOG_TAG
-#ifndef LOG_TAG
-#define LOG_TAG "PKGMGR"
-#endif /* LOG_TAG */
#define MAX_PKG_BUF_LEN 1024
#define BLOCK_SIZE 4096 /*in bytes*/
dir = fdopendir(dfd);
if (dir == NULL) {
- _LOGE("Couldn't open the directory\n");
+ ERR("Couldn't open the directory\n");
close(dfd);
return 0;
}
int dfd;
struct stat f_stat;
if (path == NULL){
- _LOGE("path is NULL");
+ ERR("path is NULL");
return -1;
}
if (!S_ISLNK(f_stat.st_mode)) {
dir = opendir(path);
if (dir == NULL) {
- _LOGE("Couldn't open the directory %s \n", path);
+ ERR("Couldn't open the directory %s \n", path);
return -1;
}
dfd = dirfd(dir);
size = size + f_stat.st_blocks * 512;
}
else {
- _LOGE("Couldn't open the directory\n");
+ ERR("Couldn't open the directory\n");
return -1;
}
}
}
else {
- _LOGE("Couldn't lstat the directory %s %d \n", path, errno);
+ ERR("Couldn't lstat the directory %s %d \n", path, errno);
return -1;
}
* (int *) user_data += size;
- _LOGD("pkg=[%s], size=[%d]\n", pkgid, size);
+ DBG("pkg=[%s], size=[%d]\n", pkgid, size);
return 0;
}
ret = pkgmgrinfo_pkginfo_get_list(__pkg_list_cb, &size);
}
if (ret < 0)
- _LOGD("_pkg_getsize fail \n");
+ DBG("_pkg_getsize fail \n");
else
- _LOGD("_pkg_getsize success \n");
+ DBG("_pkg_getsize success \n");
pi = pkgmgr_installer_new();
if (!pi) {
- _LOGD("Failure in creating the pkgmgr_installer object");
+ DBG("Failure in creating the pkgmgr_installer object");
} else {
pkgmgr_installer_receive_request(pi, argc, argv);
snprintf(buf, MAX_PKG_BUF_LEN - 1, "%d", size);