- there are many log macro in system-server:PRT_TRACE, PRT_ERR, ERR and so on.
- from now on, system-server uses just _D,_E,_I,_W,_SD,_SE,_SI and _SW.
Change-Id: I1101a3ae4a19cee74d258dae5c7f1f13d8e22e5e
Signed-off-by: jy910.yun <jy910.yun@samsung.com>
+* Mon Oct 28 2013 jy910.yun <jy910.yun@samsung.com> accepted/tizen/20130912.195534@b3501d1
+- change the log macro to be simply
+
* Mon Oct 27 2013 Jiyoung Yun <jy910.yun@samsung.com> accepted/tizen/20130912.195534@09ee5a9
- refactoring system-server code structure
-* Thu Aug 22 2013 Maciej Wereski <m.wereski@partner.samsung.com> accepted/tizen/20130710.221248@1177917
-- Move rc.shutdown from system-plugin-slp
-
* Sun Aug 25 2013 Chengwei Yang <chengwei.yang@intel.com>
- Remove debian packaging stuff
+* Thu Aug 22 2013 Maciej Wereski <m.wereski@partner.samsung.com> accepted/tizen/20130710.221248@1177917
+- Move rc.shutdown from system-plugin-slp
+
* Thu Aug 22 2013 Maciej Wereski <m.wereski@partner.samsung.com> accepted/tizen/20130710.221248@a1019c4
- fix typo in udev rules
#if 0
int i;
for (i = 0; i < BAT_MON_SAMPLES; i++)
- PRT_TRACE("\t%d", recent_bat_percent[i]);
+ _D("\t%d", recent_bat_percent[i]);
#endif
}
int ss_lowbat_set_charge_on(int onoff)
{
if(vconf_set_int(VCONFKEY_SYSMAN_BATTERY_CHARGE_NOW, onoff)!=0) {
- PRT_TRACE_ERR("fail to set charge vconf value");
+ _E("fail to set charge vconf value");
return -1;
}
return 0;
{
int val = 0;
if (device_get_property(DEVICE_TYPE_POWER, PROP_POWER_CHARGE_NOW, &val) < 0) {
- PRT_TRACE_ERR("fail to read charge now from kernel");
+ _E("fail to read charge now from kernel");
ss_lowbat_set_charge_on(0);
return 0;
}
if (new_bat_capacity < 0)
return -1;
if (new_bat_capacity != cur_bat_capacity) {
- PRT_TRACE("[BAT_MON] cur = %d new = %d", cur_bat_capacity, new_bat_capacity);
+ _D("[BAT_MON] cur = %d new = %d", cur_bat_capacity, new_bat_capacity);
if (vconf_set_int(VCONFKEY_SYSMAN_BATTERY_CAPACITY, new_bat_capacity) == 0)
cur_bat_capacity = new_bat_capacity;
}
if (vconf_get_int(VCONFKEY_SYSMAN_BATTERY_STATUS_LOW, &vconf_state) < 0) {
- PRT_TRACE_ERR("vconf_get_int() failed");
+ _E("vconf_get_int() failed");
return -1;
}
if (new_bat_capacity <= BATTERY_REAL_POWER_OFF) {
if (device_get_property(DEVICE_TYPE_POWER, PROP_POWER_CHARGE_NOW, &val) < 0) {
- PRT_TRACE_ERR("fail to read charge now from kernel");
+ _E("fail to read charge now from kernel");
}
- PRT_TRACE("charge_now status %d",val);
+ _D("charge_now status %d",val);
if (val == 1) {
new_bat_state = BATTERY_POWER_OFF;
if (vconf_state != VCONFKEY_SYSMAN_BAT_POWER_OFF)
}
}
- PRT_TRACE("[BATMON] Unknown battery state cur:%d new:%d",cur_bat_state,new_bat_state);
+ _D("[BATMON] Unknown battery state cur:%d new:%d",cur_bat_state,new_bat_state);
cur_bat_state = new_bat_state;
if (new_bat_capacity != cur_bat_capacity)
return;
if (vconf_get_int(VCONFKEY_SYSMAN_BATTERY_LEVEL_STATUS, &prev) < 0) {
- PRT_TRACE_ERR("vconf_get_int() failed");
+ _E("vconf_get_int() failed");
return;
}
ecore_timer_interval_set(lowbat_timer, BAT_MON_INTERVAL_MIN);
bat_err_count++;
if (bat_err_count > MAX_BATTERY_ERROR) {
- PRT_TRACE_ERR
+ _E
("[BATMON] Cannot read battery gage. stop read fuel gage");
return -ENODEV;
}
int ret = -1;
if (device_get_property(DEVICE_TYPE_POWER, PROP_POWER_PRESENT, &ret) < 0) {
- PRT_TRACE_ERR("[BATMON] battery check : %d", ret);
+ _E("[BATMON] battery check : %d", ret);
}
- PRT_TRACE("[BATMON] battery check : %d", ret);
+ _D("[BATMON] battery check : %d", ret);
return ret;
}
struct group *group_entry;
mode_t old_mask;
- PRT_TRACE("Make Noti File");
+ _D("Make Noti File");
snprintf(buf, sizeof(buf), "%s/%s", path, file); /* buf - full path to file */
if (access(buf, F_OK) == 0) /* if file exists then return -1 */
return -1;
gid_t group_id;
struct group *group_entry;
- PRT_TRACE("Make core dump directory");
+ _D("Make core dump directory");
if (access(CRASH_COREDUMP_PATH, F_OK) == 0) /* if file exists then return -1 */
return -1;
gid_t group_id;
struct group *group_entry;
- PRT_TRACE("Make crash info directory");
+ _D("Make crash info directory");
if (access(CRASH_INFO_PATH, F_OK) == 0) /* if file exists then return -1 */
return -1;
int dfd;
dir = opendir(CRASH_COREDUMP_PATH);
if (!dir) {
- PRT_TRACE_ERR("opendir failed");
+ _E("opendir failed");
return 0;
}
dfd = dirfd(dir);
if ((name[1] == '.') && (name[2] == 0)) continue;
}
if (unlinkat(dfd, name, 0) < 0) {
- PRT_TRACE_ERR("clean_coredump_dir (%s)",name);
+ _E("clean_coredump_dir (%s)",name);
continue;
}
}
dir = opendir(CRASH_DUMP_PATH);
if (!dir) {
- PRT_TRACE_ERR("opendir failed");
+ _E("opendir failed");
return 0;
}
while ((dp = readdir(dir)) != NULL) {
}
snprintf(dirname, sizeof(dirname), "%s/%s", CRASH_DUMP_PATH, name);
if (ecore_file_recursive_rm(dirname) == EINA_FALSE) {
- PRT_TRACE_ERR("clean_dump_dir (%s)",dirname);
+ _E("clean_dump_dir (%s)",dirname);
continue;
}
}
int dfd;
dir = opendir(CRASH_INFO_PATH);
if (!dir) {
- PRT_TRACE_ERR("opendir failed");
+ _E("opendir failed");
return 0;
}
dfd = dirfd(dir);
if ((name[1] == '.') && (name[2] == 0)) continue;
}
if (unlinkat(dfd, name, 0) < 0) {
- PRT_TRACE_ERR("clean_info_dir (%s)",name);
+ _E("clean_info_dir (%s)",name);
continue;
}
}
int verify_arg_num = 0;
if (linebuffer == NULL || arg == NULL) {
- PRT_TRACE_ERR("crash_arg_parser input arguments is NULL");
+ _E("crash_arg_parser input arguments is NULL");
return -1;
}
ptr = strtok(linebuffer, CRASH_DELIMITER);
if (ptr == NULL) {
- PRT_TRACE_ERR("can't strtok linebuffer ptr(%s)", ptr);
+ _E("can't strtok linebuffer ptr(%s)", ptr);
return -1;
}
snprintf(arg->crash_mode, CRASH_MODE_MAX, "%s", ptr);
ptr = strtok(NULL, CRASH_DELIMITER);
if (ptr == NULL) {
- PRT_TRACE_ERR("can't strtok linebuffer ptr(%s)", ptr);
+ _E("can't strtok linebuffer ptr(%s)", ptr);
return -1;
}
snprintf(arg->crash_processname, CRASH_PROCESSNAME_MAX, "%s", ptr);
ptr = strtok(NULL, CRASH_DELIMITER);
if (ptr == NULL) {
- PRT_TRACE_ERR("can't strtok linebuffer ptr(%s)", ptr);
+ _E("can't strtok linebuffer ptr(%s)", ptr);
return -1;
}
snprintf(arg->crash_timestr, CRASH_TIME_MAX, "%s", ptr);
ptr = strtok(NULL, CRASH_DELIMITER);
if (ptr == NULL) {
- PRT_TRACE_ERR("can't strtok linebuffer ptr(%s)", ptr);
+ _E("can't strtok linebuffer ptr(%s)", ptr);
return -1;
}
snprintf(arg->crash_pid, CRASH_PID_MAX, "%s", ptr);
ptr = strtok(NULL, CRASH_DELIMITER);
if (ptr == NULL) {
- PRT_TRACE_ERR("can't strtok linebuffer ptr(%s)", ptr);
+ _E("can't strtok linebuffer ptr(%s)", ptr);
return -1;
}
snprintf(arg->crash_exepath, CRASH_EXEPATH_MAX, "%s", ptr);
ptr = strtok(NULL, CRASH_DELIMITER);
if (ptr == NULL) {
- PRT_TRACE_ERR("can't strtok linebuffer ptr(%s)", ptr);
+ _E("can't strtok linebuffer ptr(%s)", ptr);
return -1;
}
snprintf(arg->crash_verify, CRASH_VERIFY_MAX, "%s", ptr);
verify_num = strlen(arg->crash_processname) + strlen(arg->crash_exepath);
verify_arg_num = atoi(arg->crash_verify);
- PRT_TRACE("vnum %d vanum %d", verify_num, verify_arg_num);
+ _D("vnum %d vanum %d", verify_num, verify_arg_num);
if (verify_num == verify_arg_num)
return 1;
else
while (fgets(linebuffer, CRASH_ARG_MAX, fp) != NULL) {
len = strlen(linebuffer);
if (!len || linebuffer[len - 1] != '\n') {
- PRT_TRACE_ERR("crash inoti msg must be terminated with new line character\n");
+ _E("crash inoti msg must be terminated with new line character\n");
break;
}
/* change last caracter from \n to \0 */
snprintf(crash_worker_args, sizeof(crash_worker_args), "%s %s %s %s %s",
parsing_arg.crash_mode, parsing_arg.crash_processname,
parsing_arg.crash_timestr, parsing_arg.crash_pid, parsing_arg.crash_exepath);
- PRT_TRACE("crash_worker args(%s)", crash_worker_args);
- PRT_TRACE("(%s%s%s)", parsing_arg.crash_mode,
+ _D("crash_worker args(%s)", crash_worker_args);
+ _D("(%s%s%s)", parsing_arg.crash_mode,
parsing_arg.crash_processname, parsing_arg.crash_timestr);
ret = ss_launch_evenif_exist (CRASH_WORKER_PATH, crash_worker_args);
if (ret > 0) {
}
if (popup_pid < 0) {
- PRT_TRACE_ERR("popup failed)\n");
+ _E("popup failed)\n");
break;
}
}
int ss_bs_init(void)
{
if (make_noti_file(CRASH_NOTI_DIR, CRASH_NOTI_FILE) < 0) {
- PRT_TRACE_ERR("make_noti_file() failed");
+ _E("make_noti_file() failed");
launch_crash_worker(CRASH_NOTI_PATH, CRASH_POPUP_OFF);
}
if (make_info_dir() < 0) {
clean_dump_dir();
if (ecore_file_init() == 0) {
- PRT_TRACE_ERR("ecore_file_init() failed");
+ _E("ecore_file_init() failed");
launch_crash_worker(CRASH_NOTI_PATH, CRASH_POPUP_OFF);
}
crash_file_monitor = ecore_file_monitor_add(CRASH_NOTI_PATH,(void *) __crash_file_cb, NULL);
if (!crash_file_monitor) {
- PRT_TRACE_ERR("ecore_file_monitor_add() failed");
+ _E("ecore_file_monitor_add() failed");
launch_crash_worker(CRASH_NOTI_PATH, CRASH_POPUP_OFF);
return -1;
}
ret = act_entry->predefine_action(rq_entry->argc, rq_entry->argv);
if (ret <= 0) {
if (ret < 0)
- PRT_TRACE_ERR("[SYSMAN] predefine action failed");
+ _E("[SYSMAN] predefine action failed");
goto fast_done;
} else {
snprintf(tmp, sizeof(tmp), "/proc/%d/status", ret);
int retry_count = 0;
int r = -1;
if (!ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ)) {
- PRT_TRACE_ERR
+ _E
("ecore_main_fd_handler_active_get error , return\n");
return 1;
}
r = read(core_pipe[0], &p_msg, sizeof(struct _internal_msg));
if (r < 0) {
if (errno == EINTR) {
- PRT_TRACE_ERR("Re-read for error(EINTR)");
+ _E("Re-read for error(EINTR)");
retry_count++;
continue;
} else {
__pipe_stop(core_pipe[0]);
__pipe_stop(core_pipe[1]);
- PRT_TRACE_ERR("restart pipe fd");
+ _E("restart pipe fd");
__pipe_start(ad);
}
} else {
__pipe_stop(core_pipe[1]);
if (__pipe_start(ad) == -1) {
- PRT_TRACE_ERR("fail pipe control fd init");
+ _E("fail pipe control fd init");
return -1;
}
return 0;
static int __pipe_start(struct ss_main_data *ad)
{
if (pipe(core_pipe) < 0) {
- PRT_TRACE_ERR("pipe cannot create");
+ _E("pipe cannot create");
exit(EXIT_FAILURE);
}
g_pipe_efd = ecore_main_fd_handler_add(core_pipe[0], ECORE_FD_READ,
core_pipe_cb, ad, NULL, NULL);
if (!g_pipe_efd) {
- PRT_TRACE_ERR("error ecore_main_fd_handler_add");
+ _E("error ecore_main_fd_handler_add");
return -1;
}
return 0;
bundle_add(b, "_SYSPOPUP_CONTENT_", "warning");
ret = syspopup_launch("lowbat-syspopup", b);
if (ret < 0) {
- PRT_TRACE_EM("popup lauch failed\n");
+ _I("popup lauch failed\n");
}
bundle_free(b);
}
} else {
- PRT_TRACE_ERR("failed to get vconf key");
+ _E("failed to get vconf key");
return -1;
}
}
ss_lowbat_monitor(NULL);
ss_action_entry_call_internal(PREDEF_USBCON, 0);
if (device_get_property(DEVICE_TYPE_EXTCON, PROP_EXTCON_USB_ONLINE, &val) == 0) {
- PRT_TRACE("jack - usb changed %d",val);
+ _D("jack - usb changed %d",val);
check_lowbat_charge_device(val);
if (val==1) {
snprintf(params, sizeof(params), "%d", CB_NOTI_BATT_CHARGE);
ss_launch_if_noexist("/usr/bin/sys_device_noti", params);
- PRT_TRACE("usb device notification");
+ _D("usb device notification");
}
} else {
- PRT_TRACE_ERR("fail to get usb_online status");
+ _E("fail to get usb_online status");
}
}
ss_lowbat_monitor(NULL);
if (device_get_property(DEVICE_TYPE_EXTCON, PROP_EXTCON_TA_ONLINE, &val) == 0) {
- PRT_TRACE("jack - ta changed %d",val);
+ _D("jack - ta changed %d",val);
check_lowbat_charge_device(val);
vconf_set_int(VCONFKEY_SYSMAN_CHARGER_STATUS, val);
if (val == 0) {
pm_lock_state(LCD_OFF, STAY_CUR_STATE, 0);
snprintf(params, sizeof(params), "%d", CB_NOTI_BATT_CHARGE);
ss_launch_if_noexist("/usr/bin/sys_device_noti", params);
- PRT_TRACE("ta device notification");
+ _D("ta device notification");
}
__sync_usb_status();
}
else
- PRT_TRACE_ERR("failed to get ta status\n");
+ _E("failed to get ta status\n");
}
static void earjack_chgdet_cb(struct ss_main_data *ad)
{
- PRT_TRACE("jack - earjack changed\n");
+ _D("jack - earjack changed\n");
ss_action_entry_call_internal(PREDEF_EARJACKCON, 0);
}
static void earkey_chgdet_cb(struct ss_main_data *ad)
{
int val;
- PRT_TRACE("jack - earkey changed\n");
+ _D("jack - earkey changed\n");
if (device_get_property(DEVICE_TYPE_EXTCON, PROP_EXTCON_EARKEY_ONLINE, &val) == 0)
vconf_set_int(VCONFKEY_SYSMAN_EARJACKKEY, val);
}
static void tvout_chgdet_cb(struct ss_main_data *ad)
{
- PRT_TRACE("jack - tvout changed\n");
+ _D("jack - tvout changed\n");
pm_change_state(LCD_NORMAL);
}
pm_change_state(LCD_NORMAL);
if (device_get_property(DEVICE_TYPE_EXTCON, PROP_EXTCON_HDMI_SUPPORT, &val) == 0) {
if (val!=1) {
- PRT_TRACE_ERR("target is not support HDMI");
+ _E("target is not support HDMI");
vconf_set_int(VCONFKEY_SYSMAN_HDMI, HDMI_NOT_SUPPORTED);
return;
}
}
if (device_get_property(DEVICE_TYPE_EXTCON, PROP_EXTCON_HDMI_ONLINE, &val) == 0) {
- PRT_TRACE("jack - hdmi changed %d",val);
+ _D("jack - hdmi changed %d",val);
vconf_set_int(VCONFKEY_SYSMAN_HDMI,val);
if(val == 1)
pm_lock_state(LCD_NORMAL, GOTO_STATE_NOW, 0);
else
pm_unlock_state(LCD_NORMAL, PM_SLEEP_MARGIN);
} else {
- PRT_TRACE_ERR("failed to get hdmi_online status");
+ _E("failed to get hdmi_online status");
}
}
int val = -1;
if (device_get_property(DEVICE_TYPE_EXTCON, PROP_EXTCON_KEYBOARD_ONLINE, &val) == 0) {
- PRT_TRACE("jack - keyboard changed %d",val);
+ _D("jack - keyboard changed %d",val);
if(val != 1)
val = 0;
vconf_set_int(VCONFKEY_SYSMAN_SLIDING_KEYBOARD, val);
if (!inserted)
return;
inserted = false;
- PRT_TRACE("mmc removed");
+ _D("mmc removed");
ss_mmc_removed();
} else {
/* when inserted mmc, emul kernel notify twice(insert, changed)
if (inserted)
return;
inserted = true;
- PRT_TRACE("mmc added");
+ _D("mmc added");
ret = ss_mmc_inserted();
if (ret == -1) {
vconf_get_int(VCONFKEY_SYSMAN_MMC_MOUNT,&val);
bundle *b = NULL;
b = bundle_create();
if (b == NULL) {
- PRT_TRACE_ERR("error bundle_create()");
+ _E("error bundle_create()");
return;
}
bundle_add(b, "_SYSPOPUP_CONTENT_", "mounterr");
ret = syspopup_launch("mmc-syspopup", b);
if (ret < 0) {
- PRT_TRACE_ERR("popup launch failed");
+ _E("popup launch failed");
}
bundle_free(b);
} else if (val == VCONFKEY_SYSMAN_MMC_MOUNT_COMPLETED) {
bundle *b = NULL;
b = bundle_create();
if (b == NULL) {
- PRT_TRACE_ERR("error bundle_create()");
+ _E("error bundle_create()");
return;
}
bundle_add(b, "_SYSPOPUP_CONTENT_", "mountrdonly");
ret = syspopup_launch("mmc-syspopup", b);
if (ret < 0) {
- PRT_TRACE_ERR("popup launch failed");
+ _E("popup launch failed");
}
bundle_free(b);
}
if (device_get_property(DEVICE_TYPE_POWER, PROP_POWER_CHARGE_NOW, &charge_now) != 0 ||
device_get_property(DEVICE_TYPE_POWER, PROP_POWER_CAPACITY, &capacity) != 0)
- PRT_TRACE_ERR("fail to get battery node value");
+ _E("fail to get battery node value");
if (charge_now == 0 && capacity == 0) {
- PRT_TRACE_ERR("target will be shut down");
+ _E("target will be shut down");
ss_action_entry_call_internal(PREDEF_LOWBAT, 1, POWER_OFF_BAT_ACT);
return;
}
if (device_get_property(DEVICE_TYPE_POWER, PROP_POWER_HEALTH, &val) == 0) {
if (val==BATTERY_OVERHEAT || val==BATTERY_COLD) {
- PRT_TRACE_ERR("Battery health status is not good (%d)", val);
+ _E("Battery health status is not good (%d)", val);
if (__check_abnormal_popup_launch() != 0)
return;
return;
}
} else {
- PRT_TRACE_ERR("failed to get battery health status");
+ _E("failed to get battery health status");
}
device_get_property(DEVICE_TYPE_POWER, PROP_POWER_CHARGE_FULL, &val);
if (val==0) {
} else {
if (val==1 && bat_full_noti==0) {
bat_full_noti = 1;
- PRT_TRACE("battery full noti");
+ _D("battery full noti");
snprintf(params, sizeof(params), "%d %d", CB_NOTI_BATT_FULL, CB_NOTI_ON);
ss_launch_if_noexist("/usr/bin/sys_device_noti", params);
}
static void usb_host_chgdet_cb(keynode_t *in_key, struct ss_main_data *ad)
{
- PRT_TRACE("ENTER: usb_host_chgdet_cb()");
+ _D("ENTER: usb_host_chgdet_cb()");
int status;
int ret = vconf_get_int(VCONFKEY_SYSMAN_USB_HOST_STATUS, &status);
if (ret != 0) {
- PRT_TRACE_ERR("vconf get failed(VCONFKEY_SYSMAN_USB_HOST_STATUS)\n");
+ _E("vconf get failed(VCONFKEY_SYSMAN_USB_HOST_STATUS)\n");
return ;
}
if(VCONFKEY_SYSMAN_USB_HOST_CONNECTED == status) {
int pid = ss_launch_if_noexist(USBCON_EXEC_PATH, NULL);
if (pid < 0) {
- PRT_TRACE("usb-server launching failed\n");
+ _D("usb-server launching failed\n");
return;
}
}
- PRT_TRACE("EXIT: usb_host_chgdet_cb()");
+ _D("EXIT: usb_host_chgdet_cb()");
}
static void usb_host_add_cb()
{
- PRT_TRACE("ENTER: usb_host_add_cb()\n");
+ _D("ENTER: usb_host_add_cb()\n");
int status;
int ret = vconf_get_int(VCONFKEY_SYSMAN_USB_HOST_STATUS, &status);
if (ret != 0) {
- PRT_TRACE("vconf get failed ()\n");
+ _D("vconf get failed ()\n");
return;
}
if (-1 == status) { /* '-1' means that USB host mode is not loaded yet */
- PRT_TRACE("This usb device is connected defaultly\n");
+ _D("This usb device is connected defaultly\n");
ret = system(STORE_DEFAULT_USB_INFO);
- PRT_TRACE("Return value of usb-devices: %d\n", ret);
+ _D("Return value of usb-devices: %d\n", ret);
if (0 != access(DEFAULT_USB_INFO_PATH, F_OK)) {
ret = system(STORE_DEFAULT_USB_INFO);
- PRT_TRACE("Return value of usb-devices: %d\n", ret);
+ _D("Return value of usb-devices: %d\n", ret);
}
}
- PRT_TRACE("EXIT: usb_host_add_cb()\n");
+ _D("EXIT: usb_host_add_cb()\n");
}
static int uevent_control_stop(int ufd)
udev = udev_new();
if (!udev) {
- PRT_TRACE_ERR("error create udev");
+ _E("error create udev");
return -1;
}
mon = udev_monitor_new_from_netlink(udev, "kernel");
if (mon == NULL) {
- PRT_TRACE_ERR("error udev_monitor create");
+ _E("error udev_monitor create");
uevent_control_stop(-1);
return -1;
}
udev_monitor_set_receive_buffer_size(mon, 1024);
if (udev_monitor_filter_add_match_subsystem_devtype(mon, "platform", NULL) < 0) {
- PRT_TRACE_ERR("error apply subsystem filter");
+ _E("error apply subsystem filter");
uevent_control_stop(-1);
return -1;
}
ufd = udev_monitor_get_fd(mon);
if (ufd == -1) {
- PRT_TRACE_ERR("error udev_monitor_get_fd");
+ _E("error udev_monitor_get_fd");
uevent_control_stop(ufd);
return -1;
}
ufdh = ecore_main_fd_handler_add(ufd, ECORE_FD_READ, uevent_control_cb, NULL, NULL, NULL);
if (!ufdh) {
- PRT_TRACE_ERR("error ecore_main_fd_handler_add");
+ _E("error ecore_main_fd_handler_add");
uevent_control_stop(ufd);
return -1;
}
if (udev_monitor_enable_receiving(mon) < 0) {
- PRT_TRACE_ERR("error unable to subscribe to udev events");
+ _E("error unable to subscribe to udev events");
uevent_control_stop(ufd);
return -1;
}
return -1;
}
- PRT_TRACE("UEVENT DETECTED (%s)",env_value);
+ _D("UEVENT DETECTED (%s)",env_value);
ss_action_entry_call_internal(PREDEF_DEVICE_CHANGED,1,env_value);
udev_device_unref(dev);
int changed_device_def_predefine_action(int argc, char **argv)
{
if (argc != 1 || argv[0] == NULL) {
- PRT_TRACE_ERR("param is failed");
+ _E("param is failed");
return -1;
}
static void pci_keyboard_add_cb(struct ss_main_data *ad)
{
char params[BUFF_MAX];
- PRT_TRACE("pci- keyboard inserted\n");
+ _D("pci- keyboard inserted\n");
pm_change_state(LCD_NORMAL);
snprintf(params, sizeof(params), "%d", CB_NOTI_PCI_INSERTED);
static void pci_keyboard_remove_cb(struct ss_main_data *ad)
{
char params[BUFF_MAX];
- PRT_TRACE("pci- keyboard removed\n");
+ _D("pci- keyboard removed\n");
pm_change_state(LCD_NORMAL);
snprintf(params, sizeof(params), "%d", CB_NOTI_PCI_REMOVED);
ss_action_entry_add_internal(PREDEF_DEVICE_CHANGED, changed_device_def_predefine_action, NULL, NULL);
if (uevent_control_start() == -1) {
- PRT_TRACE_ERR("fail uevent control init");
+ _E("fail uevent control init");
return -1;
}
/* for simple noti change cb */
ss_noti_add("device_pci_keyboard_remove", (void *)pci_keyboard_remove_cb, (void *)ad);
if (vconf_notify_key_changed(VCONFKEY_SYSMAN_USB_HOST_STATUS, usb_host_chgdet_cb, NULL) < 0) {
- PRT_TRACE_ERR("vconf key notify failed(VCONFKEY_SYSMAN_USB_HOST_STATUS)");
+ _E("vconf key notify failed(VCONFKEY_SYSMAN_USB_HOST_STATUS)");
}
/* dbus noti change cb */
#ifdef ENABLE_EDBUS_USE
e_dbus_init();
conn = e_dbus_bus_get(DBUS_BUS_SYSTEM);
if (!conn)
- PRT_TRACE_ERR("check system dbus running!\n");
+ _E("check system dbus running!\n");
e_dbus_signal_handler_add(conn, NULL, "/system/uevent/xxxxx",
"system.uevent.xxxxx",
int _pid;
if (file == NULL || access(file, X_OK) != 0) {
- PRT_TRACE_ERR("launch app error: Invalid input");
+ _E("launch app error: Invalid input");
errno = EINVAL;
return -1;
}
_pid = fork();
if (_pid == -1) {
- PRT_TRACE_ERR("fork error: %s", strerror(errno));
+ _E("fork error: %s", strerror(errno));
/* keep errno */
return -1;
}
ret = nice(_nice);
if (ret == -1 && errno != 0)
- PRT_TRACE_ERR("nice error: %s", strerror(errno));
+ _E("nice error: %s", strerror(errno));
ret = execvp(file, argv);
/* If failed... */
- PRT_TRACE_ERR("exec. error: %s", strerror(errno));
+ _E("exec. error: %s", strerror(errno));
return -2;
}
nargs = parse_cmd(cmdline, argv, MAX_ARGS + 1);
if (nargs == -1) {
- PRT_TRACE_ERR("launch app error: Invalid input");
+ _E("launch app error: Invalid input");
errno = EINVAL;
return -1;
}
buf = malloc(buf_size);
if (buf == NULL) {
/* Do something for not enought memory error */
- PRT_TRACE_ERR("Malloc failed");
+ _E("Malloc failed");
return -1;
}
buf = malloc(buf_size);
if (buf == NULL) {
// Do something for not enought memory error
- PRT_TRACE_ERR("Malloc failed");
+ _E("Malloc failed");
return -1;
}
buf = malloc(buf_size);
if (buf == NULL) {
/* Do something for not enought memory error */
- PRT_TRACE_ERR("Malloc Failed");
+ _E("Malloc Failed");
return -1;
}
/*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ * deviced
*
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
+ *
+ * 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
+ * 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,
#ifndef __LOG_H__
#define __LOG_H__
-#include <stdio.h>
-
-#if defined(ENABLE_DLOG_OUT)
-#define LOG_TAG "SYSTEM_SERVER"
-#include <dlog.h>
-#define DLOG_ERR DLOG_ERROR
-#define __LOG(prio, fmt, arg...) \
- do { SLOG(prio, LOG_TAG, fmt, ##arg); } while (0)
-#define __LOGD(prio, fmt, arg...) \
- do { SLOG(prio, LOG_TAG, "%s: %s(%d) > " fmt, __MODULE__, __func__, __LINE__, ##arg); } while (0)
-#define __PRT(prio, fmt, arg...) \
- do { fprintf(((D##prio) == DLOG_ERR ? stderr : stdout), fmt"\n", ##arg); } while (0)
-#define __PRTD(prio, fmt, arg...) \
- do { \
- fprintf(((D##prio) == DLOG_ERR ? stderr : stdout), \
- "%s: %s(%d) > "fmt"\n", __MODULE__, __func__, __LINE__, ##arg); \
- } while (0)
-#else
-#include <syslog.h>
-#define __LOG(prio, fmt, arg...) \
- do { syslog(prio, fmt, ##arg); } while (0)
-#define __LOGD(prio, fmt, arg...) \
- do { syslog(prio, "%s: %s(%d) > "fmt"\n", __MODULE__, __func__, __LINE__, ##arg); } while (0)
-#define __PRT(prio, fmt, arg...) \
- do { fprintf(((prio) == LOG_ERR ? stderr : stdout), fmt"\n", ##arg); } while (0)
-#define __PRTD(prio, fmt, arg...) \
- do { \
- fprintf(((prio) == LOG_ERR ? stderr : stdout), \
- "%s: %s(%d) > "fmt"\n", __MODULE__, __func__, __LINE__, ##arg); \
- } while (0)
-#endif
-
-#ifdef DEBUG
-extern int g_trace_depth;
-#define __PRT_TRACE(prio, fmt, arg...) \
- do { __LOGD(prio, fmt, ##arg); } while (0)
-/* do { \
- int ___i;\
- for(___i=0;___i<g_trace_depth;___i++)\
- {\
- fprintf(stdout, " "); \
- }\
- fprintf(stdout,\
- "[%s:%d] "fmt"\n", __FUNCTION__, __LINE__,##arg); \
- __LOGD(prio, fmt, ##arg); \
- } while (0) */
-#define __PRT_TRACE_ERR(prio, fmt, arg...) \
- do { __LOGD(prio, fmt, ##arg); } while (0)
-/* do { \
- int ___i;\
- for(___i=0;___i<g_trace_depth;___i++)\
- {\
- fprintf(stdout, " "); \
- }\
- printf(\
- "%c[1;31m[%s:%d] "fmt"%c[0m\n",27, __FUNCTION__, __LINE__,##arg,27); \
- __LOGD(prio, fmt, ##arg); \
- } while (0)*/
-#define __PRT_TRACE_EM(prio, fmt, arg...) \
- do { __LOGD(prio, fmt, ##arg); } while (0)
-/* do { \
- int ___i;\
- for(___i=0;___i<g_trace_depth;___i++)\
- {\
- fprintf(stdout, " "); \
- }\
- printf(\
- "%c[1;34m[%s:%d] "fmt"%c[0m\n",27, __FUNCTION__, __LINE__,##arg,27); \
- __LOGD(prio, fmt, ##arg); \
- } while (0)*/
+#ifndef FEATURE_DEVICE_DAEMON_DLOG
+#define FEATURE_DEVICE_DAEMON_DLOG
#endif
-#define _NOUT(prio, fmt, arg...) do { } while (0)
-
-#ifdef DEBUG
-# define _LOGD __LOGD
-# define _LOG __LOGD
-# define _PRTD __PRTD
-# define _PRT __PRTD
-# define _PRT_TRACE __PRT_TRACE
-# define _PRT_TRACE_ERR __PRT_TRACE_ERR
-# define _PRT_TRACE_EM __PRT_TRACE_EM
-#else
-# define _LOGD _NOUT
-# define _LOG __LOG
-# define _PRTD _NOUT
-# define _PRT __PRT
-# define _PRT_TRACE _NOUT
-# define _PRT_TRACE_ERR _NOUT
-# define _PRT_TRACE_EM _NOUT
-#endif
-
-#define PRT_INFO(fmt, arg...) _PRT(LOG_INFO, fmt, ##arg)
-#define PRT_ERR(fmt, arg...) _PRT(LOG_ERR, fmt, ##arg)
-#define PRT_DBG(fmt, arg...) _PRTD(LOG_DEBUG, fmt, ##arg)
-#define PRT_TRACE(fmt, arg...) _PRT_TRACE(LOG_DEBUG, fmt, ##arg)
-#define PRT_TRACE_ERR(fmt, arg...) _PRT_TRACE_ERR(LOG_ERR, fmt, ##arg)
-#define PRT_TRACE_EM(fmt, arg...) _PRT_TRACE_EM(LOG_DEBUG, fmt, ##arg)
-
-#if defined(SYSLOG_OUT)
-# define SYSLOG_INFO(fmt, arg...) _LOG(LOG_INFO, fmt, ##arg)
-# define SYSLOG_ERR(fmt, arg...) _LOG(LOG_ERR, fmt, ##arg)
-# define SYSLOG_DBG(fmt, arg...) _LOGD(LOG_DEBUG, fmt, ##arg)
-# define INFO SYSLOG_INFO
-# define ERR SYSLOG_ERR
-# define DBG SYSLOG_DBG
-#elif defined(ENABLE_DLOG_OUT)
-# define INFO SLOGI
-# define ERR SLOGE
-# define DBG SLOGD
+#ifdef FEATURE_DEVICE_DAEMON_DLOG
+#define LOG_TAG "SYSTEM_SERVER"
+#include <dlog.h>
+#define _D(fmt, arg...) \
+ do { SLOGD(fmt, ##arg); } while(0)
+#define _I(fmt, arg...) \
+ do { SLOGI(fmt, ##arg); } while(0)
+#define _W(fmt, arg...) \
+ do { SLOGW(fmt, ##arg); } while(0)
+#define _E(fmt, arg...) \
+ do { SLOGE(fmt, ##arg); } while(0)
+#define _SD(fmt, arg...) \
+ do { SECURE_SLOGD(fmt, ##arg); } while(0)
+#define _SI(fmt, arg...) \
+ do { SECURE_SLOGI(fmt, ##arg); } while(0)
+#define _SW(fmt, arg...) \
+ do { SECURE_SLOGW(fmt, ##arg); } while(0)
+#define _SE(fmt, arg...) \
+ do { SECURE_SLOGE(fmt, ##arg); } while(0)
#else
-# define INFO PRT_INFO
-# define ERR PRT_ERR
-# define DBG PRT_DBG
+#define _D(x, ...) do { } while (0)
+#define _I(x, ...) do { } while (0)
+#define _W(x, ...) do { } while (0)
+#define _E(x, ...) do { } while (0)
+#define _SD(fmt, args...) do { } while (0)
+#define _SI(fmt, args...) do { } while (0)
+#define _SW(fmt, args...) do { } while (0)
+#define _SE(fmt, args...) do { } while (0)
#endif
#endif
{
ad->sysnoti_fd = ss_sysnoti_init();
if (ss_noti_init() < 0)
- PRT_TRACE_ERR("init noti error");
+ _E("init noti error");
ss_queue_init();
ss_core_init(ad);
#define SS_PIDFILE_PATH "/var/run/.system_server.pid"
static void sig_quit(int signo)
{
- PRT_TRACE_ERR("received SIGTERM signal %d", signo);
+ _E("received SIGTERM signal %d", signo);
if (is_power_off() == 1)
reboot(RB_POWER_OFF);
}
init_ad(&ad);
if ((ad.noti_fd = heynoti_init()) < 0) {
- PRT_TRACE_ERR("Hey Notification Initialize failed");
+ _E("Hey Notification Initialize failed");
fini(&ad);
return 0;
}
if (heynoti_attach_handler(ad.noti_fd) != 0) {
- PRT_TRACE_ERR("fail to attach hey noti handler");
+ _E("fail to attach hey noti handler");
fini(&ad);
return 0;
}
{
noti_fd = heynoti_init();
if (noti_fd < 0) {
- PRT_TRACE_ERR("heynoti_init error");
+ _E("heynoti_init error");
return -1;
}
if (heynoti_attach_handler(noti_fd) < 0) {
- PRT_TRACE_ERR("heynoti_attach_handler error");
+ _E("heynoti_attach_handler error");
return -1;
}
dp = opendir("/proc");
if (!dp) {
- PRT_TRACE_ERR("open /proc");
+ _E("open /proc");
return -1;
}
now = time(NULL);
cur_tm = (struct tm *)malloc(sizeof(struct tm));
if (cur_tm == NULL) {
- PRT_TRACE_ERR("Fail to memory allocation");
+ _E("Fail to memory allocation");
return;
}
if (localtime_r(&now, cur_tm) == NULL) {
- PRT_TRACE_ERR("Fail to get localtime");
+ _E("Fail to get localtime");
free(cur_tm);
return;
}
- PRT_TRACE("%s_%s_%d_%.4d%.2d%.2d_%.2d%.2d%.2d.log", file, victim_name,
+ _D("%s_%s_%d_%.4d%.2d%.2d_%.2d%.2d%.2d.log", file, victim_name,
pid, (1900 + cur_tm->tm_year), 1 + cur_tm->tm_mon,
cur_tm->tm_mday, cur_tm->tm_hour, cur_tm->tm_min,
cur_tm->tm_sec);
int fd;
if (device_get_property(DEVICE_TYPE_MEMORY, PROP_MEMORY_VICTIM_TASK, &pid) < 0) {
- PRT_TRACE_ERR("Get victim task failed");
+ _E("Get victim task failed");
return -1;
}
if (pid > 0 && pid != sysman_get_pid(LOWMEM_EXEC_PATH) && pid != sysman_get_pid(MEMPS_EXEC_PATH)) {
if ((sysman_get_cmdline_name(pid, appname, PATH_MAX)) ==
0) {
- PRT_TRACE_EM
+ _I
("we will kill, lowmem lv2 = %d (%s)\n",
pid, appname);
make_memps_log(MEMPS_LOG_FILE, pid, appname);
if(get_app_oomadj(pid, &oom_adj) < 0) {
- PRT_TRACE_ERR("Failed to get oom_adj");
+ _E("Failed to get oom_adj");
return -1;
}
- PRT_TRACE("%d will be killed with %d oom_adj value", pid, oom_adj);
+ _D("%d will be killed with %d oom_adj value", pid, oom_adj);
kill(pid, SIGTERM);
ret = syspopup_launch("lowmem-syspopup", b);
bundle_free(b);
if (ret < 0) {
- PRT_TRACE_EM("popup lauch failed\n");
+ _I("popup lauch failed\n");
return -1;
}
if (set_app_oomadj(ret, OOMADJ_SU) < 0) {
- PRT_TRACE_ERR("Failed to set oom_adj");
+ _E("Failed to set oom_adj");
}
}
}
pm_lock_state(LCD_OFF, STAY_CUR_STATE, 0);
pid = ss_launch_if_noexist(USBCON_EXEC_PATH, NULL);
if (pid < 0) {
- PRT_TRACE_ERR("usb predefine action failed\n");
+ _E("usb predefine action failed\n");
return -1;
}
return pid;
}
- PRT_TRACE_ERR("failed to get usb status\n");
+ _E("failed to get usb status\n");
return -1;
}
{
int val;
- PRT_TRACE_EM("earjack_normal predefine action\n");
+ _I("earjack_normal predefine action\n");
if (device_get_property(DEVICE_TYPE_EXTCON, PROP_EXTCON_EARJACK_ONLINE, &val) == 0) {
return vconf_set_int(VCONFKEY_SYSMAN_EARJACK, val);
}
ret = syspopup_launch("lowbat-syspopup", b);
if (ret < 0) {
- PRT_TRACE_EM("popup lauch failed\n");
+ _I("popup lauch failed\n");
bundle_free(b);
return 1;
}
lowbat_popup_option = 0;
bundle_free(b);
} else {
- PRT_TRACE_EM("boot-animation running yet");
+ _I("boot-animation running yet");
return 1;
}
//lowbat-popup
if (strncmp(name, LOWBAT_POPUP_NAME, strlen(LOWBAT_POPUP_NAME)) == 0) {
if (launched_poweroff == 1) {
- PRT_TRACE_ERR("will be foreced power off");
+ _E("will be foreced power off");
internal_poweroff_def_predefine_action(0,NULL);
return 0;
}
pid = __predefine_get_pid(LOWBAT_EXEC_PATH);
if (pid > 0) {
- PRT_TRACE_ERR("pre launched %s destroy", LOWBAT_EXEC_PATH);
+ _E("pre launched %s destroy", LOWBAT_EXEC_PATH);
kill(pid, SIGTERM);
}
if (syspopup_launch(name, b) < 0)
ret = vconf_get_int(VCONFKEY_STARTER_SEQUENCE, &state);
if (state == 1 || ret != 0) {
if (predefine_control_launch("lowbat-syspopup", b) < 0) {
- PRT_TRACE_ERR("popup lauch failed\n");
+ _E("popup lauch failed\n");
bundle_free(b);
lowbat_popup_option = 0;
return -1;
}
} else {
- PRT_TRACE_EM("boot-animation running yet");
+ _I("boot-animation running yet");
lowbat_popup_id = ecore_timer_add(1, lowbat_popup, NULL);
}
bundle_free(b);
gettimeofday(&now, NULL);
}
- PRT_TRACE("Power off by force\n");
+ _D("Power off by force\n");
/* give a chance to be terminated for each process */
power_off = 1;
sync();
tel_deinit(tapi_handle);
tapi_handle = NULL;
}
- PRT_TRACE("Power off \n");
+ _D("Power off \n");
/* Getting poweroff duration */
buf = getenv("PWROFF_DUR");
}
static void powerdown_res_cb(TapiHandle *handle, int result, void *data, void *user_data)
{
- PRT_TRACE("poweroff command request : %d",result);
+ _D("poweroff command request : %d",result);
}
int poweroff_def_predefine_action(int argc, char **argv)
while (retry_count < MAX_RETRY) {
if (ss_action_entry_call_internal(PREDEF_INTERNAL_POWEROFF, 0) < 0) {
- PRT_TRACE_ERR("failed to request poweroff to system_server \n");
+ _E("failed to request poweroff to system_server \n");
retry_count++;
continue;
}
ret = tel_register_noti_event(tapi_handle, TAPI_NOTI_MODEM_POWER, powerdown_ap, NULL);
if (ret != TAPI_API_SUCCESS) {
- PRT_TRACE_ERR
+ _E
("tel_register_event is not subscribed. error %d\n", ret);
powerdown_ap_by_force(NULL);
return 0;
ret = tel_process_power_command(tapi_handle, TAPI_PHONE_POWER_OFF, powerdown_res_cb, NULL);
if (ret != TAPI_API_SUCCESS) {
- PRT_TRACE_ERR("tel_process_power_command() error %d\n", ret);
+ _E("tel_process_power_command() error %d\n", ret);
powerdown_ap_by_force(NULL);
return 0;
}
{
int bCurFlightMode = 0;
if (result != TAPI_POWER_FLIGHT_MODE_ENTER) {
- PRT_TRACE_ERR("flight mode enter failed %d",result);
+ _E("flight mode enter failed %d",result);
} else {
- PRT_TRACE("enter flight mode result : %d",result);
+ _D("enter flight mode result : %d",result);
if (vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE,&bCurFlightMode) == 0) {
- PRT_TRACE("Flight Mode is %d", bCurFlightMode);
+ _D("Flight Mode is %d", bCurFlightMode);
} else {
- PRT_TRACE_ERR("failed to get vconf key");
+ _E("failed to get vconf key");
}
}
}
{
int bCurFlightMode = 0;
if (result != TAPI_POWER_FLIGHT_MODE_LEAVE) {
- PRT_TRACE_ERR("flight mode leave failed %d",result);
+ _E("flight mode leave failed %d",result);
} else {
- PRT_TRACE("leave flight mode result : %d",result);
+ _D("leave flight mode result : %d",result);
if (vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE,&bCurFlightMode) == 0) {
- PRT_TRACE("Flight Mode is %d", bCurFlightMode);
+ _D("Flight Mode is %d", bCurFlightMode);
} else {
- PRT_TRACE_ERR("failed to get vconf key");
+ _E("failed to get vconf key");
}
}
}
sync();
ret = tel_set_flight_mode(tapi_handle, TAPI_POWER_FLIGHT_MODE_ENTER, enter_flight_mode_cb, NULL);
- PRT_TRACE_ERR("request for changing into flight mode : %d\n", ret);
+ _E("request for changing into flight mode : %d\n", ret);
system("/etc/rc.d/rc.entersleep");
pm_change_state(POWER_OFF);
sync();
ret = tel_set_flight_mode(tapi_handle, TAPI_POWER_FLIGHT_MODE_LEAVE, leave_flight_mode_cb, NULL);
- PRT_TRACE_ERR("request for changing into flight mode : %d\n", ret);
+ _E("request for changing into flight mode : %d\n", ret);
return 0;
}
tapi_handle = NULL;
}
- PRT_INFO("Restart\n");
+ _I("Restart\n");
vconf_ignore_key_changed(VCONFKEY_SYSMAN_POWER_OFF_STATUS, (void*)poweroff_control_cb);
power_off = 1;
sync();
tapi_handle = NULL;
}
- PRT_INFO("Restart\n");
+ _I("Restart\n");
power_off = 1;
sync();
ret =
tel_register_noti_event(tapi_handle, TAPI_NOTI_MODEM_POWER, restart_ap, NULL);
if (ret != TAPI_API_SUCCESS) {
- PRT_TRACE_ERR
+ _E
("tel_register_event is not subscribed. error %d\n", ret);
restart_ap_by_force((void *)-1);
return 0;
ret = tel_process_power_command(tapi_handle, TAPI_PHONE_POWER_OFF, powerdown_res_cb, NULL);
if (ret != TAPI_API_SUCCESS) {
- PRT_TRACE_ERR("tel_process_power_command() error %d\n", ret);
+ _E("tel_process_power_command() error %d\n", ret);
restart_ap_by_force((void *)-1);
return 0;
}
/* current just launching poweroff-popup */
if (predefine_control_launch("poweroff-syspopup", NULL) < 0) {
- PRT_TRACE_ERR("poweroff-syspopup launch failed");
+ _E("poweroff-syspopup launch failed");
return -1;
}
return 0;
int bCurFlightMode;
int err = TAPI_API_SUCCESS;
if (argc != 1 || argv[0] == NULL) {
- PRT_TRACE_ERR("FlightMode Set predefine action failed");
+ _E("FlightMode Set predefine action failed");
return -1;
}
bCurFlightMode = atoi(argv[0]);
err = tel_set_flight_mode(tapi_handle, TAPI_POWER_FLIGHT_MODE_ENTER, enter_flight_mode_cb, NULL);
}
if (err != TAPI_API_SUCCESS)
- PRT_TRACE_ERR("FlightMode tel api action failed %d",err);
+ _E("FlightMode tel api action failed %d",err);
return 0;
}
dp = opendir(PREDEFINE_SO_DIR);
if (!dp) {
- ERR("fail open %s", PREDEFINE_SO_DIR);
+ _E("fail open %s", PREDEFINE_SO_DIR);
return;
}
msg = malloc(sizeof(struct sysnoti));
if (msg == NULL) {
- ERR("Malloc failed");
+ _E("Malloc failed");
closedir(dp);
return;
}
vconf_ignore_key_changed(VCONFKEY_TELEPHONY_READY, (void*)__tel_init_cb);
tapi_handle = tel_init(NULL);
if (tapi_handle == NULL) {
- PRT_TRACE_ERR("tapi init error");
+ _E("tapi init error");
}
} else {
- PRT_TRACE_ERR("tapi is not ready yet");
+ _E("tapi is not ready yet");
}
}
static void poweroff_control_cb(keynode_t *in_key, struct ss_main_data *ad)
if (bTelReady == 1) {
tapi_handle = tel_init(NULL);
if (tapi_handle == NULL) {
- PRT_TRACE_ERR("tapi init error");
+ _E("tapi init error");
}
} else {
vconf_notify_key_changed(VCONFKEY_TELEPHONY_READY, (void *)__tel_init_cb, NULL);
}
} else {
- PRT_TRACE_ERR("failed to get tapi vconf key");
+ _E("failed to get tapi vconf key");
}
#ifdef NOUSE
ss_action_entry_add_internal(PREDEF_CALL, call_predefine_action, NULL,
NULL, NULL);
if (vconf_notify_key_changed(VCONFKEY_SYSMAN_POWER_OFF_STATUS, (void *)poweroff_control_cb, NULL) < 0) {
- PRT_TRACE_ERR("Vconf notify key chaneged failed: KEY(%s)", VCONFKEY_SYSMAN_POWER_OFF_STATUS);
+ _E("Vconf notify key chaneged failed: KEY(%s)", VCONFKEY_SYSMAN_POWER_OFF_STATUS);
}
ss_action_entry_load_from_sodir();
data = malloc(sizeof(struct ss_action_entry));
if (data == NULL) {
- PRT_TRACE_ERR("Malloc failed");
+ _E("Malloc failed");
return -1;
}
predef_act_list = eina_list_prepend(predef_act_list, data);
- PRT_TRACE_ERR("[SYSMAN] add predefine action entry suceessfully - %s",
+ _E("[SYSMAN] add predefine action entry suceessfully - %s",
data->type);
return 0;
err:
if (data->type != NULL)
- PRT_TRACE_ERR("[SYSMAN] add predefine action entry -%s",
+ _E("[SYSMAN] add predefine action entry -%s",
data->type);
free(data);
return -1;
data = malloc(sizeof(struct ss_action_entry));
if (data == NULL) {
- PRT_TRACE_ERR("Malloc failed");
+ _E("Malloc failed");
return -1;
}
data->handle = dlopen(msg->path, RTLD_LAZY);
if (!data->handle) {
- PRT_TRACE_ERR("cannot find such library");
+ _E("cannot find such library");
goto err;
}
data->predefine_action = dlsym(data->handle, SS_PREDEFINE_ACT_FUNC_STR);
if (data->predefine_action == NULL) {
- PRT_TRACE_ERR("cannot find predefine_action symbol : %s",
+ _E("cannot find predefine_action symbol : %s",
SS_PREDEFINE_ACT_FUNC_STR);
goto err;
}
predef_act_list = eina_list_prepend(predef_act_list, data);
- PRT_TRACE_ERR("[SYSMAN]add predefine action entry suceessfully - %s",
+ _E("[SYSMAN]add predefine action entry suceessfully - %s",
data->type);
return 0;
err:
- PRT_TRACE_ERR("[SYSMAN] FAIL predefine action entry - %s", msg->type);
+ _E("[SYSMAN] FAIL predefine action entry - %s", msg->type);
free(data);
return -1;
}
int ret;
ret=ss_run_queue_add(data, argc, argv);
- PRT_TRACE_ERR("ss_run_queue_add : %d",ret);
+ _E("ss_run_queue_add : %d",ret);
ret=ss_core_action_run();
- PRT_TRACE_ERR("ss_core_action_run : %d",ret);
+ _E("ss_core_action_run : %d",ret);
return 0;
}
}
if ((data != NULL) && (!strcmp(data->type, msg->type))) {
if (data->is_accessible != NULL
&& data->is_accessible(sockfd) == 0) {
- PRT_TRACE_ERR
+ _E
("%d cannot call that predefine module",
msg->pid);
return -1;
}
int ret;
ret=ss_run_queue_add(data, msg->argc, msg->argv);
- PRT_TRACE_ERR("ss_run_queue_add : %d",ret);
+ _E("ss_run_queue_add : %d",ret);
ret=ss_core_action_run();
- PRT_TRACE_ERR("ss_core_action_run : %d",ret);
+ _E("ss_core_action_run : %d",ret);
return 0;
}
}
- PRT_TRACE_EM("[SYSMAN] cannot found action");
+ _I("[SYSMAN] cannot found action");
return -1;
}
rq_entry = malloc(sizeof(struct ss_run_queue_entry));
if (rq_entry == NULL) {
- PRT_TRACE_ERR("Malloc failed");
+ _E("Malloc failed");
return -1;
}
run_queue = eina_list_prepend(run_queue, rq_entry);
- PRT_TRACE_EM("[SYSMAN] new action called : %s", act_entry->type);
+ _I("[SYSMAN] new action called : %s", act_entry->type);
return 0;
}
EINA_LIST_FOREACH_SAFE(run_queue, tmp, tmp_next, rq_entry) {
if ((rq_entry != NULL) && (rq_entry == entry)) {
run_queue = eina_list_remove(run_queue, rq_entry);
- PRT_TRACE_EM("[SYSMAN] action deleted : %s",
+ _I("[SYSMAN] action deleted : %s",
rq_entry->action_entry->type);
for (i = 0; i < rq_entry->argc; i++) {
if (rq_entry->argv[i])
EINA_LIST_FOREACH_SAFE(run_queue, tmp, tmp_next, rq_entry) {
if ((rq_entry != NULL) && (rq_entry->forked_pid == pid)) {
run_queue = eina_list_remove(run_queue, rq_entry);
- PRT_TRACE_EM("[SYSMAN] action deleted : %s",
+ _I("[SYSMAN] action deleted : %s",
rq_entry->action_entry->type);
for (i = 0; i < rq_entry->argc; i++) {
if (rq_entry->argv[i])
#include <sys/wait.h>
#include "core.h"
-#define PRT_TRACE_ERR(format, args...) do { \
+#define _E(format, args...) do { \
char buf[255];\
snprintf(buf, 255, format, ##args);\
write(2, buf, strlen(buf));\
} while (0);
-#define PRT_TRACE(format, args...) do { \
+#define _D(format, args...) do { \
char buf[255];\
snprintf(buf, 255, format, ##args);\
write(1, buf, strlen(buf));\
pid = waitpid(info->si_pid, &status, 0);
if (pid == -1) {
- PRT_TRACE_ERR("SIGCHLD received\n");
+ _E("SIGCHLD received\n");
return;
}
- PRT_TRACE("sig child actend call - %d\n", info->si_pid);
+ _D("sig child actend call - %d\n", info->si_pid);
ss_core_action_clear(info->si_pid);
}
if (sysman_get_cmdline_name(msg->pid, exe_name, PATH_MAX) < 0)
snprintf(exe_name, sizeof(exe_name), "Unknown (maybe dead)");
- PRT_TRACE_ERR("pid : %d name: %s cmd : %d type : %s path : %s",
+ _E("pid : %d name: %s cmd : %d type : %s path : %s",
msg->pid, exe_name, msg->cmd, msg->type, msg->path);
}
r = read(fd, &val, sizeof(int));
if (r < 0) {
if(errno == EINTR) {
- PRT_TRACE_ERR("Re-read for error(EINTR)");
+ _E("Re-read for error(EINTR)");
retry_count++;
continue;
}
else {
- PRT_TRACE_ERR("Read fail for int");
+ _E("Read fail for int");
return -1;
}
} else {
r = read(fd, &len, sizeof(int));
if (r < 0) {
if(errno == EINTR) {
- PRT_TRACE_ERR("Re-read for error(EINTR)");
+ _E("Re-read for error(EINTR)");
retry_count++;
continue;
}
else {
- PRT_TRACE_ERR("Read fail for str length");
+ _E("Read fail for str length");
return NULL;
}
} else
break;
}
if (retry_count == RETRY_READ_COUNT) {
- PRT_TRACE_ERR("Read retry failed");
+ _E("Read retry failed");
return NULL;
}
if (len <= 0) {
- PRT_TRACE_ERR("str is null");
+ _E("str is null");
return NULL;
}
if (len >= INT_MAX) {
- PRT_TRACE_ERR("size is over INT_MAX");
+ _E("size is over INT_MAX");
return NULL;
}
str = (char *)malloc(len + 1);
if (str == NULL) {
- PRT_TRACE_ERR("Not enough memory");
+ _E("Not enough memory");
return NULL;
}
r = read(fd, str, len);
if(r < 0) {
if(errno == EINTR) {
- PRT_TRACE_ERR("Re-read for error(EINTR)");
+ _E("Re-read for error(EINTR)");
retry_count++;
continue;
}
else {
- PRT_TRACE_ERR("Read fail for str");
+ _E("Read fail for str");
free(str);
str = NULL;
return NULL;
break;
}
if (retry_count == RETRY_READ_COUNT) {
- PRT_TRACE_ERR("Read retry failed");
+ _E("Read retry failed");
free(str);
str = NULL;
return NULL;
if (sysman_get_cmdline_name(msg->pid, path, PATH_MAX) < 0)
return true;
- PRT_TRACE_ERR("path : %s, type : %s", path, msg->type);
+ _E("path : %s, type : %s", path, msg->type);
if (!strcmp(path, POWER_MANAGER_STR) &&
(!strcmp(msg->type, INACTIVE_STR) || !strcmp(msg->type, ACTIVE_STR)))
return false;
bool sync;
if (!ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ)) {
- PRT_TRACE_ERR
+ _E
("ecore_main_fd_handler_active_get error , return\n");
return 1;
}
fd = ecore_main_fd_handler_fd_get(fd_handler);
msg = malloc(sizeof(struct sysnoti));
if (msg == NULL) {
- PRT_TRACE_ERR("%s : Not enough memory", __FUNCTION__);
+ _E("%s : Not enough memory", __FUNCTION__);
return 1;
}
client_sockfd = accept(fd, (struct sockaddr *)&client_address, (socklen_t *)&client_len);
if (client_sockfd == -1) {
- PRT_TRACE_ERR("socket accept error");
+ _E("socket accept error");
free(msg);
return -1;
}
if (read_message(client_sockfd, msg) < 0) {
- PRT_TRACE_ERR("%s : recv error msg", __FUNCTION__);
+ _E("%s : recv error msg", __FUNCTION__);
print_sysnoti_msg(__FUNCTION__, msg);
free_message(msg);
write(client_sockfd, &ret, sizeof(int));
print_sysnoti_msg(__FUNCTION__, msg);
if (msg->argc > SYSMAN_MAXARG) {
- PRT_TRACE_ERR("%s : error argument", __FUNCTION__);
+ _E("%s : error argument", __FUNCTION__);
free_message(msg);
if (sync)
write(client_sockfd, &ret, sizeof(int));
fd = socket(AF_UNIX, SOCK_STREAM, 0);
if (fd < 0) {
- PRT_ERR("%s: socket create failed\n", __FUNCTION__);
+ _E("%s: socket create failed\n", __FUNCTION__);
return -1;
}
if((fsetxattr(fd, "security.SMACK64IPOUT", "@", 2, 0)) < 0 ) {
- PRT_ERR("%s: Socket SMACK labeling failed\n", __FUNCTION__);
+ _E("%s: Socket SMACK labeling failed\n", __FUNCTION__);
if(errno != EOPNOTSUPP) {
close(fd);
return -1;
}
if((fsetxattr(fd, "security.SMACK64IPIN", "*", 2, 0)) < 0 ) {
- PRT_ERR("%s: Socket SMACK labeling failed\n", __FUNCTION__);
+ _E("%s: Socket SMACK labeling failed\n", __FUNCTION__);
if(errno != EOPNOTSUPP) {
close(fd);
return -1;
sizeof(serveraddr.sun_path));
if (bind(fd, (struct sockaddr *)&serveraddr, sizeof(struct sockaddr)) < 0) {
- PRT_ERR("%s: socket bind failed\n", __FUNCTION__);
+ _E("%s: socket bind failed\n", __FUNCTION__);
close(fd);
return -1;
}
if (chmod(SYSNOTI_SOCKET_PATH, (S_IRWXU | S_IRWXG | S_IRWXO)) < 0) /* 0777 */
- PRT_ERR("failed to change the socket permission");
+ _E("failed to change the socket permission");
if (listen(fd, 5) < 0) {
- PRT_ERR("failed to listen");
+ _E("failed to listen");
close(fd);
return -1;
}
- PRT_INFO("socket create & listen ok\n");
+ _I("socket create & listen ok\n");
return fd;
}
sysnoti_efd = ecore_main_fd_handler_add(fd, ECORE_FD_READ, sysnoti_cb, NULL, NULL,
NULL);
if (!sysnoti_efd) {
- PRT_TRACE_ERR("error ecore_main_fd_handler_add");
+ _E("error ecore_main_fd_handler_add");
return -1;
}
return fd;
r = __add_entry_to_max_cpu_freq_list(atoi(argv[0]), atoi(argv[1]));
if (r < 0) {
- PRT_TRACE_ERR("Add entry failed");
+ _E("Add entry failed");
return -1;
}
r = __write_max_cpu_freq(cur_max_cpu_freq);
if (r < 0) {
- PRT_TRACE_ERR("Write entry failed");
+ _E("Write entry failed");
return -1;
}
r = __add_entry_to_min_cpu_freq_list(atoi(argv[0]), atoi(argv[1]));
if (r < 0) {
- PRT_TRACE_ERR("Add entry failed");
+ _E("Add entry failed");
return -1;
}
r = __write_min_cpu_freq(cur_min_cpu_freq);
if (r < 0) {
- PRT_TRACE_ERR("Write entry failed");
+ _E("Write entry failed");
return -1;
}
r = __remove_entry_from_max_cpu_freq_list(atoi(argv[0]));
if (r < 0) {
- PRT_TRACE_ERR("Remove entry failed");
+ _E("Remove entry failed");
return -1;
}
r = __write_max_cpu_freq(cur_max_cpu_freq);
if (r < 0) {
- PRT_TRACE_ERR("Write freq failed");
+ _E("Write freq failed");
return -1;
}
r = __remove_entry_from_min_cpu_freq_list(atoi(argv[0]));
if (r < 0) {
- PRT_TRACE_ERR("Remove entry failed");
+ _E("Remove entry failed");
return -1;
}
r = __write_min_cpu_freq(cur_min_cpu_freq);
if (r < 0) {
- PRT_TRACE_ERR("Write entry failed");
+ _E("Write entry failed");
return -1;
}
if (power_saving_cpu_stat == 1) {
ret = __add_entry_to_max_cpu_freq_list(getpid(), POWER_SAVING_CPUFREQ);
if (ret < 0) {
- PRT_TRACE_ERR("Add entry failed");
+ _E("Add entry failed");
return -1;
}
}
} else {
- PRT_TRACE_ERR("failed to get vconf key");
+ _E("failed to get vconf key");
return -1;
}
} else {
ret = __remove_entry_from_max_cpu_freq_list(getpid());
if (ret < 0) {
- PRT_TRACE_ERR("Remove entry failed");
+ _E("Remove entry failed");
return -1;
}
if (cur_max_cpu_freq == INT_MIN)
}
ret = __write_max_cpu_freq(cur_max_cpu_freq);
if (ret < 0) {
- PRT_TRACE_ERR("Write failed");
+ _E("Write failed");
return -1;
}
if (power_saving_cpu_stat == 1) {
ret = __add_entry_to_max_cpu_freq_list(getpid(), POWER_SAVING_CPUFREQ);
if (ret < 0) {
- PRT_TRACE_ERR("Add entry failed");
+ _E("Add entry failed");
return -1;
}
} else {
ret = __remove_entry_from_max_cpu_freq_list(getpid());
if (ret < 0) {
- PRT_TRACE_ERR("Remove entry failed");
+ _E("Remove entry failed");
return -1;
}
if (cur_max_cpu_freq == INT_MAX)
}
ret = __write_max_cpu_freq(cur_max_cpu_freq);
if (ret < 0) {
- PRT_TRACE_ERR("Write failed");
+ _E("Write failed");
return -1;
}
}
} else {
- PRT_TRACE_ERR("failed to get vconf key");
+ _E("failed to get vconf key");
return -1;
}
ret = device_get_property(DEVICE_TYPE_CPU, PROP_CPU_CPUINFO_MAX_FREQ, &max_cpu_freq_limit);
if (ret < 0) {
- PRT_TRACE_ERR("get cpufreq cpuinfo max readerror: %s", strerror(errno));
+ _E("get cpufreq cpuinfo max readerror: %s", strerror(errno));
max_cpu_freq_limit = DEFAULT_MAX_CPU_FREQ;
}
ret = device_get_property(DEVICE_TYPE_CPU, PROP_CPU_CPUINFO_MIN_FREQ, &min_cpu_freq_limit);
if (ret < 0) {
- PRT_TRACE_ERR("get cpufreq cpuinfo min readerror: %s", strerror(errno));
+ _E("get cpufreq cpuinfo min readerror: %s", strerror(errno));
min_cpu_freq_limit = DEFAULT_MIN_CPU_FREQ;
}
if (power_saving_cpu_stat == 1) {
ret = __add_entry_to_max_cpu_freq_list(getpid(), POWER_SAVING_CPUFREQ);
if (ret < 0) {
- PRT_TRACE_ERR("Add entry failed");
+ _E("Add entry failed");
return;
}
ret = __write_max_cpu_freq(cur_max_cpu_freq);
if (ret < 0) {
- PRT_TRACE_ERR("Write entry failed");
+ _E("Write entry failed");
return;
}
}
} else {
- PRT_TRACE_ERR("failed to get vconf key");
+ _E("failed to get vconf key");
}
}
} else {
- PRT_TRACE_ERR("failed to get vconf key");
+ _E("failed to get vconf key");
}
}
r = __remove_entry_from_max_cpu_freq_list(pid);
if (r < 0) {
- PRT_TRACE_ERR("Remove duplicated entry failed");
+ _E("Remove duplicated entry failed");
}
if (freq < cur_max_cpu_freq) {
entry = malloc(sizeof(struct cpu_freq_entry));
if (!entry) {
- PRT_TRACE_ERR("Malloc failed");
+ _E("Malloc failed");
return -1;
}
max_cpu_freq_list = eina_list_prepend(max_cpu_freq_list, entry);
if (!max_cpu_freq_list) {
- PRT_TRACE_ERR("eina_list_prepend failed");
+ _E("eina_list_prepend failed");
return -1;
}
r = __remove_entry_from_min_cpu_freq_list(pid);
if (r < 0) {
- PRT_TRACE_ERR("Remove duplicated entry failed");
+ _E("Remove duplicated entry failed");
}
if (freq > cur_min_cpu_freq) {
entry = malloc(sizeof(struct cpu_freq_entry));
if (!entry) {
- PRT_TRACE_ERR("Malloc failed");
+ _E("Malloc failed");
return -1;
}
min_cpu_freq_list = eina_list_prepend(min_cpu_freq_list, entry);
if (!min_cpu_freq_list) {
- PRT_TRACE_ERR("eina_list_prepend failed");
+ _E("eina_list_prepend failed");
return -1;
}
ret = device_set_property(DEVICE_TYPE_CPU, PROP_CPU_SCALING_MAX_FREQ, freq);
if (ret < 0) {
- PRT_TRACE_ERR("set cpufreq max freq write error: %s", strerror(errno));
+ _E("set cpufreq max freq write error: %s", strerror(errno));
return -1;
}
ret = device_set_property(DEVICE_TYPE_CPU, PROP_CPU_SCALING_MIN_FREQ, freq);
if (ret < 0) {
- PRT_TRACE_ERR("set cpufreq min freq write error: %s", strerror(errno));
+ _E("set cpufreq min freq write error: %s", strerror(errno));
return -1;
}
if (ret == 0 && sfs.f_type == SMACKFS_MAGIC)
smack = 1;
- PRT_TRACE_ERR("smackfs check %d", smack);
+ _E("smackfs check %d", smack);
}
static int exec_process(const char **argv)
signal(i, SIG_DFL);
r = execv(argv[0], argv);
if (r == -1) {
- PRT_TRACE_ERR("execv() error");
+ _E("execv() error");
exit(EXIT_FAILURE);
}
}
int mmc_dev_changed = 0;
if ((dp = opendir("/sys/block")) == NULL) {
- PRT_TRACE_ERR("Can not open directory..\n");
+ _E("Can not open directory..\n");
return -1;
}
chdir("/sys/block");
fd = open(buf, O_RDONLY);
if (fd == -1) {
- PRT_TRACE_ERR("%s open error: %s", buf,
+ _E("%s open error: %s", buf,
strerror(errno));
continue;
}
if ((r >= 0) && (r < 10))
buf[r] = '\0';
else
- PRT_TRACE_ERR("%s read error: %s", buf,
+ _E("%s read error: %s", buf,
strerror(errno));
close(fd);
if (strncmp("SD", buf, 2) == 0) {
char *str_mmcblk_num = strndup((dir->d_name) + 6, 1);
if (str_mmcblk_num == NULL) {
- PRT_TRACE_ERR("Memory Allocation Failed");
+ _E("Memory Allocation Failed");
closedir(dp);
return -1;
}
free(str_mmcblk_num);
closedir(dp);
- PRT_TRACE("%d \n", mmcblk_num);
+ _D("%d \n", mmcblk_num);
snprintf(buf, 255, "/sys/block/%s/device/cid", dir->d_name);
fd = open(buf, O_RDONLY);
if (fd == -1) {
- PRT_TRACE_ERR("%s open error", buf, strerror(errno));
+ _E("%s open error", buf, strerror(errno));
return mmcblk_num;
}
r = read(fd, buf, 255);
if ((r >=0) && (r < 255)) {
buf[r] = '\0';
} else {
- PRT_TRACE_ERR("%s read error: %s", buf,strerror(errno));
+ _E("%s read error: %s", buf,strerror(errno));
}
close(fd);
pre_mmc_device_id = vconf_get_str(VCONFKEY_INTERNAL_PRIVATE_MMC_ID);
}
free(pre_mmc_device_id);
} else {
- PRT_TRACE_ERR("failed to get pre_mmc_device_id");
+ _E("failed to get pre_mmc_device_id");
}
return mmcblk_num;
}
}
}
closedir(dp);
- PRT_TRACE_ERR("Failed to find mmc block number\n");
+ _E("Failed to find mmc block number\n");
return -1;
}
{
int ret;
if ((ret = umount2(MMC_MOUNT_POINT, MNT_DETACH)) != 0) {
- PRT_TRACE_ERR("Failed to unmount mmc card : %s\n", strerror(errno));
+ _E("Failed to unmount mmc card : %s\n", strerror(errno));
}
return ret;
}
inserted_type = FS_TYPE_NONE;
if ((fd = open(path, O_RDONLY)) < 0) {
- PRT_TRACE_ERR("can't open the '%s': %s", path, strerror(errno));
+ _E("can't open the '%s': %s", path, strerror(errno));
return -1;
}
while (len != 0 && (ret = read(fd, tmpbuf, len)) != 0) {
if (ret == -1) {
if (errno == EINTR) {
- PRT_TRACE_ERR("check_mmc_fs error(%d)", errno);
+ _E("check_mmc_fs error(%d)", errno);
continue;
}
- PRT_TRACE_ERR("Can't read the '%s': %s", path, strerror(errno));
+ _E("Can't read the '%s': %s", path, strerror(errno));
inserted_type = FS_TYPE_FAT;
goto check_return;
}
tmpbuf += ret;
cnr += ret;
}
- PRT_TRACE("mmc search path: %s, %s", path, buf);
+ _D("mmc search path: %s, %s", path, buf);
/* check fs type with magic code */
for (i = 0; i < ARRAY_SIZE(fs_types); i++)
ret = read(fd, buf, 2);
if (ret < 0)
goto check_return;
- PRT_TRACE("mmc search magic : 0x%2x, 0x%2x", buf[0],buf[1]);
+ _D("mmc search magic : 0x%2x, 0x%2x", buf[0],buf[1]);
if (!memcmp(buf, fs_types[i].magic, fs_types[i].magic_sz)) {
inserted_type = fs_types[i].type;
- PRT_TRACE("mmc type : %s", fs_types[i].name);
+ _D("mmc type : %s", fs_types[i].name);
goto check_return;
}
}
unsigned int size;
if (__check_mmc_fs_type(path) != 0) {
- PRT_TRACE_ERR("fail to check mount point %s", path);
+ _E("fail to check mount point %s", path);
return -1;
}
if (inserted_type == FS_TYPE_EXT4)
snprintf(mount_path, sizeof(mount_path), "%s", MMC_MOUNT_POINT);
if (stat(mount_path, &mount_stat) != 0 || stat(parent_path, &parent_stat) != 0) {
- PRT_TRACE_ERR("get stat error");
+ _E("get stat error");
return 0;
}
if (mount_stat.st_dev == parent_stat.st_dev) {
- PRT_TRACE_ERR("state : UNMOUNT");
+ _E("state : UNMOUNT");
return 0;
}
- PRT_TRACE_ERR("state : MOUNT");
+ _E("state : MOUNT");
return 1;
}
int r;
if (path == NULL) {
- PRT_TRACE_ERR("Invalid parameter");
+ _E("Invalid parameter");
return -1;
}
argv = get_argument(path, fs);
if (argv == NULL) {
- PRT_TRACE_ERR("get_argument fail");
+ _E("get_argument fail");
return -1;
}
mkfs_pid = exec_process(argv);
if (mkfs_pid < 0) {
- PRT_TRACE_ERR("%s fail");
+ _E("%s fail");
return -1;
}
snprintf(buf, sizeof(buf), "%s%d", "/proc/", mkfs_pid);
- PRT_TRACE_ERR("child process : %s", buf);
+ _E("child process : %s", buf);
while (1) {
sleep(1);
- PRT_TRACE_ERR("formatting....");
+ _E("formatting....");
if (access(buf, R_OK) != 0)
break;
}
int fs, r;
if (check_mount_state() == 1) {
- PRT_TRACE_ERR("Mounted, will be unmounted");
+ _E("Mounted, will be unmounted");
r = __umount_fs();
if (r != 0) {
- PRT_TRACE_ERR("unmount_mmc fail");
+ _E("unmount_mmc fail");
vconf_set_int(VCONFKEY_SYSMAN_MMC_FORMAT, VCONFKEY_SYSMAN_MMC_FORMAT_FAILED);
return -1;
}
snprintf(dev_mmcblk, sizeof(dev_mmcblk), "%s%d", MMC_DEV, blknum);
snprintf(dev_mmcblkp, sizeof(dev_mmcblkp), "%sp1", dev_mmcblk);
if (access(dev_mmcblkp, R_OK) < 0) {
- PRT_TRACE_ERR("%s is not valid, create the primary partition", dev_mmcblkp);
+ _E("%s is not valid, create the primary partition", dev_mmcblkp);
r = create_partition(dev_mmcblk);
if (r < 0) {
- PRT_TRACE_ERR("create_partition failed");
+ _E("create_partition failed");
vconf_set_int(VCONFKEY_SYSMAN_MMC_FORMAT, VCONFKEY_SYSMAN_MMC_FORMAT_FAILED);
heynoti_publish("mmcblk_remove");
return -1;
}
}
- PRT_TRACE_ERR("insert type : %d", inserted_type);
+ _E("insert type : %d", inserted_type);
r = format_mmc(dev_mmcblkp, inserted_type);
if (r < 0) {
- PRT_TRACE_ERR("%s format fail", dev_mmcblkp);
+ _E("%s format fail", dev_mmcblkp);
vconf_set_int(VCONFKEY_SYSMAN_MMC_FORMAT, VCONFKEY_SYSMAN_MMC_FORMAT_FAILED);
heynoti_publish("mmcblk_remove");
return -1;
}
- PRT_TRACE_ERR("Format Successful");
+ _E("Format Successful");
vconf_set_int(VCONFKEY_SYSMAN_MMC_FORMAT, VCONFKEY_SYSMAN_MMC_FORMAT_COMPLETED);
return 0;
}
params = get_check_argument((const char*)argv[1]);
if ((pid = exec_process(params)) < 0) {
- PRT_TRACE_ERR("mmc checker failed");
+ _E("mmc checker failed");
goto run_mount;
}
snprintf(buf, sizeof(buf), "%s%d", "/proc/", pid);
- PRT_TRACE_ERR("child process : %s", buf);
+ _E("child process : %s", buf);
while (1) {
sleep(1);
- PRT_TRACE_ERR("mmc checking ....");
+ _E("mmc checking ....");
if (access(buf, R_OK) != 0)
break;
}
int option = -1;
int mmc_err = 0;
if (argc < 1) {
- PRT_TRACE_ERR("Option is wong");
+ _E("Option is wong");
return -1;
}
if ((option = atoi(argv[0])) < 0) {
- PRT_TRACE_ERR("Option is wong : %d", option);
+ _E("Option is wong : %d", option);
return -1;
}
if (umount2(MMC_MOUNT_POINT, option) != 0) {
mmc_err = errno;
- PRT_TRACE_ERR("Failed to unmount mmc card\n");
+ _E("Failed to unmount mmc card\n");
vconf_set_int(VCONFKEY_SYSMAN_MMC_UNMOUNT,
VCONFKEY_SYSMAN_MMC_UNMOUNT_FAILED);
vconf_set_int(VCONFKEY_SYSMAN_MMC_ERR_STATUS,
ret = vconf_get_int(VCONFKEY_STARTER_SEQUENCE, &val);
if (val == 1 || ret != 0) {
if ((mmc_popup_pid = syspopup_launch("mmc-syspopup", b)) < 0) {
- PRT_TRACE_EM("popup launch failed\n");
+ _I("popup launch failed\n");
}
}
bundle_free(b);
if (ss_action_entry_call_internal(PREDEF_CHECK_SMACK_MMC, 0) < 0) {
- PRT_TRACE_ERR("fail to launch mmc checker,direct mount mmc");
+ _E("fail to launch mmc checker,direct mount mmc");
}
return 0;
do {
if ((ret = mount(path, MMC_MOUNT_POINT, fs_name, 0, mount_data)) == 0) {
- PRT_TRACE_ERR("Mounted mmc card %s", fs_name);
+ _E("Mounted mmc card %s", fs_name);
return 0;
}
usleep(100000);
if (access(MMC_MOUNT_POINT, R_OK) != 0) {
if (mkdir(MMC_MOUNT_POINT, 0755) < 0) {
- PRT_TRACE_ERR("Make Directory is failed");
+ _E("Make Directory is failed");
return errno;
}
}
blk_num = get_mmcblk_num();
if (blk_num == -1) {
- PRT_TRACE_ERR("fail to check mmc block");
+ _E("fail to check mmc block");
return -1;
}
snprintf(buf, sizeof(buf), "%s%dp1", MMC_DEV, blk_num);
fd = open(buf, O_RDONLY);
if (fd < 0) {
- PRT_TRACE_ERR("can't open the '%s': %s", buf, strerror(errno));
+ _E("can't open the '%s': %s", buf, strerror(errno));
snprintf(buf, sizeof(buf), "%s%d", MMC_DEV, blk_num);
} else
close(fd);
vconf_set_int(VCONFKEY_SYSMAN_MMC_STATUS, VCONFKEY_SYSMAN_MMC_INSERTED_NOT_MOUNTED);
vconf_set_int(VCONFKEY_SYSMAN_MMC_MOUNT, VCONFKEY_SYSMAN_MMC_MOUNT_FAILED);
vconf_set_int(VCONFKEY_SYSMAN_MMC_ERR_STATUS, errno);
- PRT_TRACE_ERR("Failed to mount mmc card\n");
+ _E("Failed to mount mmc card\n");
return -1;
mount_complete:
vconf_set_int(VCONFKEY_SYSMAN_MMC_ERR_STATUS, VCONFKEY_SYSMAN_MMC_EINVAL);
return 0;
mount_wait:
- PRT_TRACE_ERR("wait ext4 smack rule checking");
+ _E("wait ext4 smack rule checking");
return 0;
}
if (access(MMC_MOUNT_POINT, R_OK) != 0) {
if (mkdir(MMC_MOUNT_POINT, 0755) < 0) {
- PRT_TRACE_ERR("Make Directory is failed");
+ _E("Make Directory is failed");
return errno;
}
}
blk_num = get_mmcblk_num();
if (blk_num == -1) {
- PRT_TRACE_ERR("fail to check mmc block");
+ _E("fail to check mmc block");
return -1;
}
snprintf(buf, sizeof(buf), "%s%dp1", MMC_DEV, blk_num);
fd = open(buf, O_RDONLY);
if (fd < 0) {
- PRT_TRACE_ERR("can't open the '%s': %s", buf, strerror(errno));
+ _E("can't open the '%s': %s", buf, strerror(errno));
snprintf(buf, sizeof(buf), "%s%d", MMC_DEV, blk_num);
}
else
close(fd);
if (__check_mmc_fs_type(buf) != 0) {
- PRT_TRACE_ERR("fail to check mount point %s", buf);
+ _E("fail to check mount point %s", buf);
return -1;
}
snprintf(params, sizeof(params), "%d", inserted_type);
if (ss_action_entry_call_internal(PREDEF_CHECK_MMC_PROC, 2, params, buf) < 0) {
- PRT_TRACE_ERR("fail to launch mmc checker,direct mount mmc");
+ _E("fail to launch mmc checker,direct mount mmc");
ret = mmc_check_mount(0, NULL);
}
return ret;
vconf_get_int(VCONFKEY_SYSMAN_MMC_STATUS, &mmc_status);
if (mmc_status == VCONFKEY_SYSMAN_MMC_MOUNTED) {
- PRT_DBG("Mmc is already mounted.\n");
+ _D("Mmc is already mounted.\n");
vconf_set_int(VCONFKEY_SYSMAN_MMC_MOUNT, VCONFKEY_SYSMAN_MMC_MOUNT_ALREADY);
return 0;
}
if ((ret = __check_mmc_fs()) != 0)
- PRT_TRACE_ERR("fail to check mmc");
+ _E("fail to check mmc");
return ret;
}
static int ss_mmc_format(int argc, char **argv)
{
- PRT_TRACE_ERR("mmc format called");
+ _E("mmc format called");
__umount_fs();
vconf_set_int(VCONFKEY_SYSMAN_MMC_FORMAT_PROGRESS, VCONFKEY_SYSMAN_MMC_FORMAT_PROGRESS_NOW);
vconf_set_int(VCONFKEY_SYSMAN_MMC_FORMAT_PROGRESS, VCONFKEY_SYSMAN_MMC_FORMAT_PROGRESS_NONE);
if (__check_mmc_fs() != 0)
- PRT_TRACE_ERR("fail to check mmc");
+ _E("fail to check mmc");
return 0;
}
{
int pid;
system(FS_EXT4_SMACK_LABEL);
- PRT_TRACE_ERR("smack labeling script is run");
+ _E("smack labeling script is run");
vconf_set_int(VCONFKEY_SYSMAN_MMC_STATUS, VCONFKEY_SYSMAN_MMC_MOUNTED);
vconf_set_int(VCONFKEY_SYSMAN_MMC_MOUNT, VCONFKEY_SYSMAN_MMC_MOUNT_COMPLETED);
if (mmc_popup_pid > 0) {
- PRT_TRACE_ERR("will be killed mmc-popup(%d)", mmc_popup_pid);
+ _E("will be killed mmc-popup(%d)", mmc_popup_pid);
kill(mmc_popup_pid, SIGTERM);
}
return 0;
ss_action_entry_add_internal(PREDEF_CHECK_MMC_PROC, mmc_check_process_launch, NULL, NULL);
/* mmc card mount */
if (__check_mmc_fs() != 0)
- PRT_TRACE_ERR("fail to check mmc");
+ _E("fail to check mmc");
return 0;
}
maxid = shmctl(0, SHM_INFO, (struct shmid_ds *)(void *)&shm_info);
if (maxid < 0) {
- PRT_TRACE_ERR("shared mem error\n");
+ _E("shared mem error\n");
return -1;
}
if (shmid < 0)
continue;
if (shmseg.shm_nattch == 0) {
- PRT_TRACE("shared memory killer ==> %d killed\n",
+ _D("shared memory killer ==> %d killed\n",
shmid);
shmctl(shmid, IPC_RMID, NULL);
}
static void print_lowmem_state(unsigned int mem_state)
{
- PRT_TRACE("[LOW MEM STATE] %s ==> %s", convert_to_str(cur_mem_state),
+ _D("[LOW MEM STATE] %s ==> %s", convert_to_str(cur_mem_state),
convert_to_str(mem_state));
}
#define BUF_MAX 1024
fp = fopen("/sys/class/memnotify/meminfo", "r");
if (fp == NULL)
return -1;
- PRT_TRACE("make LOWMEM_LOG");
+ _D("make LOWMEM_LOG");
fprintf(output_fp,
"====================================================================\n");
fprintf(output_fp, "MEMORY INFO by lowmemnotify\n");
while (fgets(line, BUF_MAX, fp) != NULL) {
- PRT_TRACE("%s",line);
+ _D("%s",line);
fputs(line, output_fp);
}
fclose(fp);
now = time(NULL);
cur_tm = (struct tm *)malloc(sizeof(struct tm));
if (cur_tm == NULL) {
- PRT_TRACE_ERR("Fail to memory allocation");
+ _E("Fail to memory allocation");
return;
}
if (localtime_r(&now, cur_tm) == NULL) {
- PRT_TRACE_ERR("Fail to get localtime");
+ _E("Fail to get localtime");
free(cur_tm);
return;
}
- PRT_TRACE("%s_%s_%d_%.4d%.2d%.2d_%.2d%.2d%.2d.log", file, victim_name,
+ _D("%s_%s_%d_%.4d%.2d%.2d_%.2d%.2d%.2d.log", file, victim_name,
pid, (1900 + cur_tm->tm_year), 1 + cur_tm->tm_mon,
cur_tm->tm_mday, cur_tm->tm_hour, cur_tm->tm_min,
cur_tm->tm_sec);
output_file = fopen(new_log, "w+");
if(!output_file) {
- PRT_TRACE_ERR("cannot open output file(%s)",new_log);
+ _E("cannot open output file(%s)",new_log);
free(cur_tm);
return;
}
{
char lowmem_noti_name[NAME_MAX];
- PRT_TRACE("[LOW MEM STATE] memory low state");
+ _D("[LOW MEM STATE] memory low state");
make_LMM_log("/var/log/memps", 1, "LOWMEM_WARNING");
remove_shm();
unsigned int cur_time;
char lowmem_noti_name[NAME_MAX];
- PRT_TRACE("[LOW MEM STATE] memory oom state");
+ _D("[LOW MEM STATE] memory oom state");
cur_time = time(NULL);
- PRT_TRACE("cur=%d, old=%d, cur-old=%d", cur_time, oom_delete_sm_time,
+ _D("cur=%d, old=%d, cur-old=%d", cur_time, oom_delete_sm_time,
cur_time - oom_delete_sm_time);
if (cur_time - oom_delete_sm_time > 15) {
remove_shm();
static int memory_normal_act(void *data)
{
- PRT_TRACE("[LOW MEM STATE] memory normal state");
+ _D("[LOW MEM STATE] memory normal state");
vconf_set_int(VCONFKEY_SYSMAN_LOW_MEMORY,
VCONFKEY_SYSMAN_LOW_MEMORY_NORMAL);
return 0;
unsigned int mem_state;
if (!ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ)) {
- PRT_TRACE_ERR
+ _E
("ecore_main_fd_handler_active_get error , return\n");
return 1;
}
fd = ecore_main_fd_handler_fd_get(fd_handler);
if (fd < 0) {
- PRT_TRACE_ERR("ecore_main_fd_handler_fd_get error , return");
+ _E("ecore_main_fd_handler_fd_get error , return");
return 1;
}
mem_state = lowmem_read(fd);
static int set_threshold()
{
if (device_set_property(DEVICE_TYPE_MEMORY, PROP_MEMORY_THRESHOLD_LV1, MEM_THRESHOLD_LV1) < 0) {
- PRT_TRACE_ERR("Set memnorify threshold lv1 failed");
+ _E("Set memnorify threshold lv1 failed");
return -1;
}
if (device_set_property(DEVICE_TYPE_MEMORY, PROP_MEMORY_THRESHOLD_LV2, MEM_THRESHOLD_LV2) < 0) {
- PRT_TRACE_ERR("Set memnorify threshold lv2 failed");
+ _E("Set memnorify threshold lv2 failed");
return -1;
}
char lowmem_dev_node[PATH_MAX];
if (device_get_property(DEVICE_TYPE_MEMORY, PROP_MEMORY_NODE, lowmem_dev_node) < 0) {
- PRT_TRACE_ERR("Low memory handler fd init failed");
+ _E("Low memory handler fd init failed");
return -1;
}
lowmem_fd = open(lowmem_dev_node, O_RDONLY);
if (lowmem_fd < 0) {
- PRT_TRACE_ERR("ss_lowmem_init fd open failed");
+ _E("ss_lowmem_init fd open failed");
return -1;
}
ecore_main_fd_handler_add(lowmem_fd, ECORE_FD_READ, lowmem_cb, ad, NULL,
NULL);
if (set_threshold() < 0) {
- PRT_TRACE_ERR("Setting lowmem threshold is failed");
+ _E("Setting lowmem threshold is failed");
return -1;
}
snprintf(buf, sizeof(buf), "%s/%d", PMON_PERMANENT_DIR, pid);
fd = open(buf, O_RDONLY);
if (fd == -1) {
- PRT_TRACE_ERR("file open error");
+ _E("file open error");
return NULL;
}
if (fstat(fd, &st) < 0) {
- PRT_TRACE_ERR("fstat error");
+ _E("fstat error");
close(fd);
return NULL;
}
- PRT_TRACE("size = %d", (int)st.st_size);
+ _D("size = %d", (int)st.st_size);
cmdline = malloc(st.st_size + 1);
if (cmdline == NULL) {
- PRT_TRACE_ERR("Not enough memory");
+ _E("Not enough memory");
close(fd);
return NULL;
}
static void print_pmon_state(unsigned int dead_pid)
{
- PRT_TRACE("[Process MON] %d killed", dead_pid);
+ _D("[Process MON] %d killed", dead_pid);
}
static int pmon_process(int pid, void *ad)
int r;
if (sysconf_is_vip(pid)) {
- PRT_TRACE_ERR("=======================================");
- PRT_TRACE_ERR("[Process MON] VIP process dead.");
- PRT_TRACE_ERR("=======================================");
+ _E("=======================================");
+ _E("[Process MON] VIP process dead.");
+ _E("=======================================");
}
/* If there is NOT a .hibernation_start file, run following codes
* On hibernation processing, just ignore relaunching */
else if (access("/tmp/.hibernation_start", R_OK) != 0) {
cmdline = pmon_get_permanent_pname(pid);
if (cmdline != NULL) {
- PRT_TRACE("[Process MON] %s relaunch", cmdline);
+ _D("[Process MON] %s relaunch", cmdline);
new_pid = ss_launch_evenif_exist(cmdline, "");
free(cmdline);
if (new_pid > 0) {
int cnt;
if (access(PMON_PERMANENT_DIR, R_OK) < 0) {
- PRT_TRACE("no predefined matrix dir = %s, so created", PMON_PERMANENT_DIR);
+ _D("no predefined matrix dir = %s, so created", PMON_PERMANENT_DIR);
r = mkdir(PMON_PERMANENT_DIR, 0777);
if(r < 0) {
- PRT_TRACE("Make Directory is failed");
+ _D("Make Directory is failed");
return -1;
}
}
snprintf(filepath, sizeof(filepath), "%s/%d", PMON_PERMANENT_DIR, pid);
fd = open(filepath, O_RDONLY);
if (fd == -1) {
- PRT_TRACE("Failed to open");
+ _D("Failed to open");
return -1;
}
cnt = read(fd, buf, PATH_MAX);
close(fd);
if (cnt <= 0) {
- PRT_TRACE("Failed to read");
+ _D("Failed to read");
return -1;
}
fd = open(filepath, O_CREAT | O_WRONLY, 0644);
if (fd == -1) {
- PRT_TRACE("Failed to open");
+ _D("Failed to open");
return -1;
}
if (write(fd, buf, cnt) == -1) {
- PRT_TRACE("Failed to write");
+ _D("Failed to write");
close(fd);
return -1;
}
close(fd);
if ( device_set_property(DEVICE_TYPE_PROCESS, PROP_PROCESS_MP_PNP, new_pid) < 0) {
- PRT_TRACE_ERR("Write new pid failed");
+ _E("Write new pid failed");
}
- PRT_TRACE("[Process MON] %d ", new_pid);
+ _D("[Process MON] %d ", new_pid);
FILE *fp;
- PRT_TRACE
+ _D
("[Process MON] OOMADJ_SET : pid %d, new_oomadj %d",
new_pid, (-17));
PMON_PERMANENT_DIR, pid);
unlink(old_file);
} else {
- PRT_TRACE_ERR("[Process MON] failed relaunching");
+ _E("[Process MON] failed relaunching");
}
}
}
struct ss_main_data *ad = (struct ss_main_data *)data;
int dead_pid;
if (!ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ)) {
- PRT_TRACE_ERR
+ _E
("ecore_main_fd_handler_active_get error , return\n");
return -1;
}
fd = ecore_main_fd_handler_fd_get(fd_handler);
if (fd < 0) {
- PRT_TRACE_ERR("ecore_main_fd_handler_fd_get error , return");
+ _E("ecore_main_fd_handler_fd_get error , return");
return -1;
}
if (read(fd, &dead_pid, sizeof(dead_pid)) < 0) {
__pmon_stop(fd);
- PRT_TRACE_ERR("Reading DEAD_PID failed, restart ecore fd");
+ _E("Reading DEAD_PID failed, restart ecore fd");
__pmon_start(ad);
return -1;
}
pmon_efd = NULL;
}
if (__pmon_start(ad) == -1) {
- PRT_TRACE_ERR("fail pmon control fd init");
+ _E("fail pmon control fd init");
return -1;
}
return 0;
char pmon_dev_node[PATH_MAX];
if (device_get_property(DEVICE_TYPE_PROCESS, PROP_PROCESS_NODE, pmon_dev_node) < 0) {
- PRT_TRACE_ERR("ss_pmon_init get dev node path failed");
+ _E("ss_pmon_init get dev node path failed");
return -1;
}
pmon_fd = open(pmon_dev_node, O_RDONLY);
if (pmon_fd < 0) {
- PRT_TRACE_ERR("ss_pmon_init fd open failed");
+ _E("ss_pmon_init fd open failed");
return -1;
}
pmon_efd = ecore_main_fd_handler_add(pmon_fd, ECORE_FD_READ, pmon_cb, ad, NULL, NULL);
if (!pmon_efd) {
- PRT_TRACE_ERR("error ecore_main_fd_handler_add");
+ _E("error ecore_main_fd_handler_add");
return -1;
}
return 0;
}
old_oomadj = atoi(buf);
fclose(fp);
- PRT_TRACE_EM("Process %s, pid %d, old_oomadj %d", exe_name, pid,
+ _I("Process %s, pid %d, old_oomadj %d", exe_name, pid,
old_oomadj);
if (old_oomadj < OOMADJ_APP_LIMIT)
return 0;
- PRT_TRACE_EM("Process %s, pid %d, new_oomadj %d", exe_name, pid,
+ _I("Process %s, pid %d, new_oomadj %d", exe_name, pid,
new_oomadj);
snprintf(buf, sizeof(buf), "/proc/%d/oom_adj", pid);
fp = fopen(buf, "w");
char buf[255];
FILE *fp;
- PRT_TRACE_EM("OOMADJ_SET : pid %d, new_oomadj %d", pid, new_oomadj);
+ _I("OOMADJ_SET : pid %d, new_oomadj %d", pid, new_oomadj);
snprintf(buf, sizeof(buf), "/proc/%d/oom_adj", pid);
fp = fopen(buf, "w");
if (fp == NULL)
dp = opendir("/proc");
if (!dp) {
- PRT_TRACE_EM("BACKGRD MANAGE : fail to open /proc : %s", strerror(errno));
+ _I("BACKGRD MANAGE : fail to open /proc : %s", strerror(errno));
return -1;
}
break;
}
if (i >= LIMITED_BACKGRD_NUM)
- PRT_TRACE_EM("BACKGRB MANAGE : background applications(oom_adj %d) exceeds limitation", i);
+ _I("BACKGRB MANAGE : background applications(oom_adj %d) exceeds limitation", i);
else
bucket[i] = pid;
}
if(oomadj > OOMADJ_BACKGRD_UNLOCKED) {
ret = set_app_oomadj((pid_t) pid, OOMADJ_BACKGRD_LOCKED);
} else {
- PRT_TRACE_EM("Unknown oomadj value (%d) !", oomadj);
+ _I("Unknown oomadj value (%d) !", oomadj);
ret = -1;
}
break;
if(oomadj > OOMADJ_BACKGRD_UNLOCKED) {
ret = 0;
} else {
- PRT_TRACE_EM("Unknown oomadj value (%d) !", oomadj);
+ _I("Unknown oomadj value (%d) !", oomadj);
ret = -1;
}
break;
if(oomadj > OOMADJ_BACKGRD_UNLOCKED) {
ret = set_app_oomadj((pid_t) pid, OOMADJ_FOREGRD_UNLOCKED);
} else {
- PRT_TRACE_EM("Unknown oomadj value (%d) !", oomadj);
+ _I("Unknown oomadj value (%d) !", oomadj);
ret = -1;
}
break;
if(oomadj > OOMADJ_BACKGRD_UNLOCKED) {
ret = 0;
} else {
- PRT_TRACE_EM("Unknown oomadj value (%d) !", oomadj);
+ _I("Unknown oomadj value (%d) !", oomadj);
ret = -1;
}
break;
ret = device_set_property(DEVICE_TYPE_PROCESS, PROP_PROCESS_MP_PNP, pid);
if (ret == 0)
- PRT_TRACE_ERR("%s : pid %d", argv[1], pid);
+ _E("%s : pid %d", argv[1], pid);
else
- PRT_TRACE_ERR("fail to set %s : pid %d",argv[1], pid);
+ _E("fail to set %s : pid %d",argv[1], pid);
return 0;
}
/*
* deviced
+ *
* Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the License);
#ifndef __LOG_H__
#define __LOG_H__
-#include <stdio.h>
-
-#if defined(ENABLE_DLOG_OUT)
-#define LOG_TAG "DEVICED"
-#include <dlog.h>
-#define DLOG_ERR DLOG_ERROR
-#define __LOG(prio, fmt, arg...) \
- do { SLOG(prio, LOG_TAG, fmt, ##arg); } while (0)
-#define __LOGD(prio, fmt, arg...) \
- do { SLOG(prio, LOG_TAG, "%s: %s(%d) > " fmt, __MODULE__, __func__, __LINE__, ##arg); } while (0)
-#define __PRT(prio, fmt, arg...) \
- do { fprintf(((D##prio) == DLOG_ERR ? stderr : stdout), fmt"\n", ##arg); } while (0)
-#define __PRTD(prio, fmt, arg...) \
- do { \
- fprintf(((D##prio) == DLOG_ERR ? stderr : stdout), \
- "%s: %s(%d) > "fmt"\n", __MODULE__, __func__, __LINE__, ##arg); \
- } while (0)
-#else
-#include <syslog.h>
-#define __LOG(prio, fmt, arg...) \
- do { syslog(prio, fmt, ##arg); } while (0)
-#define __LOGD(prio, fmt, arg...) \
- do { syslog(prio, "%s: %s(%d) > "fmt"\n", __MODULE__, __func__, __LINE__, ##arg); } while (0)
-#define __PRT(prio, fmt, arg...) \
- do { fprintf(((prio) == LOG_ERR ? stderr : stdout), fmt"\n", ##arg); } while (0)
-#define __PRTD(prio, fmt, arg...) \
- do { \
- fprintf(((prio) == LOG_ERR ? stderr : stdout), \
- "%s: %s(%d) > "fmt"\n", __MODULE__, __func__, __LINE__, ##arg); \
- } while (0)
-#endif
-
-#ifdef DEBUG
-extern int g_trace_depth;
-#define __PRT_TRACE(prio, fmt, arg...) \
- do { __LOGD(prio, fmt, ##arg); } while (0)
-/* do { \
- int ___i;\
- for(___i=0;___i<g_trace_depth;___i++)\
- {\
- fprintf(stdout, " "); \
- }\
- fprintf(stdout,\
- "[%s:%d] "fmt"\n", __FUNCTION__, __LINE__,##arg); \
- __LOGD(prio, fmt, ##arg); \
- } while (0) */
-#define __PRT_TRACE_ERR(prio, fmt, arg...) \
- do { __LOGD(prio, fmt, ##arg); } while (0)
-/* do { \
- int ___i;\
- for(___i=0;___i<g_trace_depth;___i++)\
- {\
- fprintf(stdout, " "); \
- }\
- printf(\
- "%c[1;31m[%s:%d] "fmt"%c[0m\n",27, __FUNCTION__, __LINE__,##arg,27); \
- __LOGD(prio, fmt, ##arg); \
- } while (0)*/
-#define __PRT_TRACE_EM(prio, fmt, arg...) \
- do { __LOGD(prio, fmt, ##arg); } while (0)
-/* do { \
- int ___i;\
- for(___i=0;___i<g_trace_depth;___i++)\
- {\
- fprintf(stdout, " "); \
- }\
- printf(\
- "%c[1;34m[%s:%d] "fmt"%c[0m\n",27, __FUNCTION__, __LINE__,##arg,27); \
- __LOGD(prio, fmt, ##arg); \
- } while (0)*/
+#ifndef FEATURE_DEVICED_DLOG
+#define FEATURE_DEVICED_DLOG
#endif
-#define _NOUT(prio, fmt, arg...) do { } while (0)
-
-#ifdef DEBUG
-# define _LOGD __LOGD
-# define _LOG __LOGD
-# define _PRTD __PRTD
-# define _PRT __PRTD
-# define _PRT_TRACE __PRT_TRACE
-# define _PRT_TRACE_ERR __PRT_TRACE_ERR
-# define _PRT_TRACE_EM __PRT_TRACE_EM
-#else
-# define _LOGD _NOUT
-# define _LOG __LOG
-# define _PRTD _NOUT
-# define _PRT __PRT
-# define _PRT_TRACE _NOUT
-# define _PRT_TRACE_ERR _NOUT
-# define _PRT_TRACE_EM _NOUT
-#endif
-
-#define PRT_INFO(fmt, arg...) _PRT(LOG_INFO, fmt, ##arg)
-#define PRT_ERR(fmt, arg...) _PRT(LOG_ERR, fmt, ##arg)
-#define PRT_DBG(fmt, arg...) _PRTD(LOG_DEBUG, fmt, ##arg)
-#define PRT_TRACE(fmt, arg...) _PRT_TRACE(LOG_DEBUG, fmt, ##arg)
-#define PRT_TRACE_ERR(fmt, arg...) _PRT_TRACE_ERR(LOG_ERR, fmt, ##arg)
-#define PRT_TRACE_EM(fmt, arg...) _PRT_TRACE_EM(LOG_DEBUG, fmt, ##arg)
-
-#if defined(SYSLOG_OUT)
-# define SYSLOG_INFO(fmt, arg...) _LOG(LOG_INFO, fmt, ##arg)
-# define SYSLOG_ERR(fmt, arg...) _LOG(LOG_ERR, fmt, ##arg)
-# define SYSLOG_DBG(fmt, arg...) _LOGD(LOG_DEBUG, fmt, ##arg)
-# define INFO SYSLOG_INFO
-# define ERR SYSLOG_ERR
-# define DBG SYSLOG_DBG
-#elif defined(ENABLE_DLOG_OUT)
-# define INFO SLOGI
-# define ERR SLOGE
-# define DBG SLOGD
+#ifdef FEATURE_DEVICED_DLOG
+#define LOG_TAG "DEVICED"
+#include <dlog.h>
+#define _D(fmt, arg...) \
+ do { SLOGD(fmt, ##arg); } while(0)
+#define _I(fmt, arg...) \
+ do { SLOGI(fmt, ##arg); } while(0)
+#define _W(fmt, arg...) \
+ do { SLOGW(fmt, ##arg); } while(0)
+#define _E(fmt, arg...) \
+ do { SLOGE(fmt, ##arg); } while(0)
+#define _SD(fmt, arg...) \
+ do { SECURE_SLOGD(fmt, ##arg); } while(0)
+#define _SI(fmt, arg...) \
+ do { SECURE_SLOGI(fmt, ##arg); } while(0)
+#define _SW(fmt, arg...) \
+ do { SECURE_SLOGW(fmt, ##arg); } while(0)
+#define _SE(fmt, arg...) \
+ do { SECURE_SLOGE(fmt, ##arg); } while(0)
#else
-# define INFO PRT_INFO
-# define ERR PRT_ERR
-# define DBG PRT_DBG
+#define _D(x, ...) do { } while (0)
+#define _I(x, ...) do { } while (0)
+#define _W(x, ...) do { } while (0)
+#define _E(x, ...) do { } while (0)
+#define _SD(fmt, args...) do { } while (0)
+#define _SI(fmt, args...) do { } while (0)
+#define _SW(fmt, args...) do { } while (0)
+#define _SE(fmt, args...) do { } while (0)
#endif
#endif
{
int val = -1, i = 0, pid;
- PRT_TRACE("check ta connection");
+ _D("check ta connection");
if (device_get_property(DEVICE_TYPE_EXTCON, PROP_EXTCON_TA_ONLINE, &val) == 0) {
if ( val==1 ) {
vconf_set_int(VCONFKEY_SYSMAN_CHARGER_STATUS,
i++;
sleep(1);
}
- PRT_TRACE("ta is connected");
+ _D("ta is connected");
}
else if ( val==0 )
vconf_set_int(VCONFKEY_SYSMAN_CHARGER_STATUS,
return -1;
const char *tzpath = str;
- PRT_TRACE("TZPATH = %s\n", tzpath);
+ _D("TZPATH = %s\n", tzpath);
/* unlink current link
* eg. rm /opt/etc/localtime */
} else {
ret = unlink(sympath);
if (ret < 0) {
- PRT_TRACE("unlink error : [%d]%s\n", ret,
+ _D("unlink error : [%d]%s\n", ret,
strerror(errno));
return -1;
} else
- PRT_TRACE("unlink success\n");
+ _D("unlink success\n");
}
* eg. ln -s /usr/share/zoneinfo/Asia/Seoul /opt/etc/localtime */
ret = symlink(tzpath, sympath);
if (ret < 0) {
- PRT_TRACE("symlink error : [%d]%s\n", ret, strerror(errno));
+ _D("symlink error : [%d]%s\n", ret, strerror(errno));
return -1;
} else
- PRT_TRACE("symlink success\n");
+ _D("symlink success\n");
tzset();
return 0;
tmp = (long int)atoi(str);
timet = (time_t) tmp;
- PRT_TRACE("ctime = %s", ctime(&timet));
+ _D("ctime = %s", ctime(&timet));
vconf_set_int(VCONFKEY_SYSTEM_TIMECHANGE, timet);
return 0;
if (argc < 1)
return -1;
if (vconf_get_int(VCONFKEY_PM_STATE, &ret) != 0)
- PRT_TRACE("Fail to get vconf value for pm state\n");
+ _D("Fail to get vconf value for pm state\n");
if (ret == 1)
pm_state = 0x1;
else if (ret == 2)
if (argc < 1)
return -1;
if (vconf_get_int(VCONFKEY_PM_STATE, &ret) != 0)
- PRT_TRACE("Fail to get vconf value for pm state\n");
+ _D("Fail to get vconf value for pm state\n");
if (ret == 1)
pm_state = 0x1;
else if (ret == 2)
struct itimerspec tmr;
if ((tfd = timerfd_create(CLOCK_REALTIME,TFD_NONBLOCK|TFD_CLOEXEC)) == -1) {
- PRT_TRACE_ERR("error timerfd_create() %d",errno);
+ _E("error timerfd_create() %d",errno);
tfdh = NULL;
return -1;
}
tfdh = ecore_main_fd_handler_add(tfd,ECORE_FD_READ,tfd_cb,NULL,NULL,NULL);
if (!tfdh) {
- PRT_TRACE_ERR("error ecore_main_fd_handler_add");
+ _E("error ecore_main_fd_handler_add");
return -1;
}
memset(&tmr, 0, sizeof(tmr));
tmr.it_value.tv_sec = default_time;
if (timerfd_settime(tfd,TFD_TIMER_ABSTIME|TFD_TIMER_CANCELON_SET,&tmr,NULL) < 0) {
- PRT_TRACE_ERR("error timerfd_settime() %d",errno);
+ _E("error timerfd_settime() %d",errno);
return -1;
}
return 0;
int ret = -1;
if (!ecore_main_fd_handler_active_get(fd_handler,ECORE_FD_READ)) {
- PRT_TRACE_ERR("error ecore_main_fd_handler_get()");
+ _E("error ecore_main_fd_handler_get()");
return -1;
}
if((tfd = ecore_main_fd_handler_fd_get(fd_handler)) == -1) {
- PRT_TRACE_ERR("error ecore_main_fd_handler_fd_get()");
+ _E("error ecore_main_fd_handler_fd_get()");
return -1;
}
if (ret < 0 && errno == ECANCELED) {
vconf_set_int(VCONFKEY_SYSMAN_STIME, VCONFKEY_SYSMAN_STIME_CHANGED);
timerfd_check_stop(tfd);
- PRT_TRACE("NOTIFICATION here");
+ _D("NOTIFICATION here");
timerfd_check_start();
} else {
- PRT_TRACE("unexpected read (err:%d)",errno);
+ _D("unexpected read (err:%d)",errno);
}
return 0;
}
ss_action_entry_add_internal(PREDEF_SET_TIMEZONE, set_timezone_action,
NULL, NULL);
if (timerfd_check_start() == -1) {
- PRT_TRACE_ERR("fail system time change detector init");
+ _E("fail system time change detector init");
return -1;
}
return 0;
{
int val = -1, i = 0, pid;
- PRT_TRACE("check usb connection");
+ _D("check usb connection");
if (device_get_property(DEVICE_TYPE_EXTCON, PROP_EXTCON_USB_ONLINE, &val) == 0) {
if (val==1) {
vconf_set_int(VCONFKEY_SYSMAN_USB_STATUS,
}
pid = ss_launch_if_noexist(USBCON_EXEC_PATH, NULL);
if (pid < 0) {
- PRT_TRACE_ERR("usb appl launching failed\n");
+ _E("usb appl launching failed\n");
return -1;
}
}
node->level = 0;
node->play = 0;
- PRT_TRACE_ERR("node handle : %d, level : %d, play : %d", node->handle, node->level, node->play);
+ _E("node handle : %d, level : %d, play : %d", node->handle, node->level, node->play);
}
#endif
static int haptic_play(int handle)
struct haptic_node *node;
int r;
- PRT_TRACE("handle : %d", handle);
+ _D("handle : %d", handle);
node = find_node(handle);
if (node == NULL) {
- PRT_TRACE_ERR("find_node(%d) fail", handle);
+ _E("find_node(%d) fail", handle);
return -1;
}
#ifndef MERGE_BTW_APPLICATIONS
#endif
r = device_set_property(DEVICE_TYPE_VIBRATOR, PROP_VIBRATOR_ENABLE, 1);
if (r < 0) {
- PRT_TRACE_ERR("set enable fail");
+ _E("set enable fail");
return -1;
}
struct haptic_node *node;
int r;
- PRT_TRACE("handle : %d", handle);
+ _D("handle : %d", handle);
node = find_node(handle);
if (node == NULL) {
- PRT_TRACE_ERR("find_node(%d) fail", handle);
+ _E("find_node(%d) fail", handle);
return 0;
}
r = device_set_property(DEVICE_TYPE_VIBRATOR, PROP_VIBRATOR_LEVEL, level);
if (r < 0) {
- PRT_TRACE_ERR("set level fail");
+ _E("set level fail");
return -1;
}
r = device_set_property(DEVICE_TYPE_VIBRATOR, PROP_VIBRATOR_ONESHOT, duration);
if (r < 0) {
- PRT_TRACE_ERR("set oneshot fail");
+ _E("set oneshot fail");
return -1;
}
int *play = (int*)user_data;
*play += node->play;
- PRT_TRACE_ERR("node handle : %d, level : %d, play : %d", node->handle, node->level, node->play);
+ _E("node handle : %d, level : %d, play : %d", node->handle, node->level, node->play);
}
static int haptic_stop(int handle)
int play = 0;
int r;
- PRT_TRACE("handle : %d", handle);
+ _D("handle : %d", handle);
node = find_node(handle);
if (node == NULL) {
- PRT_TRACE_ERR("find_node(%d) fail", handle);
+ _E("find_node(%d) fail", handle);
return -1;
}
node->play = 0;
g_list_foreach(haptic_head, check_play_state, &play);
- PRT_TRACE_ERR("play state : %d", play);
+ _E("play state : %d", play);
if (!play) {
- PRT_TRACE_ERR("not playing anymore, will be stop");
+ _E("not playing anymore, will be stop");
r = device_set_property(DEVICE_TYPE_VIBRATOR, PROP_VIBRATOR_ENABLE, 0);
if (r < 0) {
- PRT_TRACE_ERR("set enable fail");
+ _E("set enable fail");
return -1;
}
}
struct haptic_node *node = (struct haptic_node*)data;
int *sum = (int*)user_data;
- PRT_TRACE_ERR("node handle : %d, level : %d, play : %d", node->handle, node->level, node->play);
+ _E("node handle : %d, level : %d, play : %d", node->handle, node->level, node->play);
if (node->play == 1) {
- PRT_TRACE_ERR("node->play : %d, sum : %d", node->play, *sum);
+ _E("node->play : %d, sum : %d", node->play, *sum);
*sum += node->level;
}
}
int sum = 0;
int r;
- PRT_TRACE_ERR("handle : %d, level : %d", handle, level);
+ _E("handle : %d, level : %d", handle, level);
node = find_node(handle);
if (node == NULL) {
- PRT_TRACE_ERR("find_node(%d) fail", handle);
+ _E("find_node(%d) fail", handle);
return -1;
}
node->level = level;
#ifdef MERGE_BTW_APPLICATIONS
g_list_foreach(haptic_head, get_current_level, &sum);
- PRT_TRACE_ERR("current sum level : %d", sum);
+ _E("current sum level : %d", sum);
#else
sum = level;
if (!node->play) {
- PRT_TRACE_ERR("This handle is stoped by another handle");
+ _E("This handle is stoped by another handle");
return 0;
}
#endif
r = device_set_property(DEVICE_TYPE_VIBRATOR, PROP_VIBRATOR_LEVEL, sum);
if (r < 0) {
- PRT_TRACE_ERR("set level fail");
+ _E("set level fail");
return -1;
}
{
struct haptic_node *node;
- PRT_TRACE("handle : %d", handle);
+ _D("handle : %d", handle);
node = malloc(sizeof(struct haptic_node));
if (node == NULL) {
- PRT_TRACE_ERR("malloc fail");
+ _E("malloc fail");
return -1;
}
int play = 0;
int r;
- PRT_TRACE("handle : %d", handle);
+ _D("handle : %d", handle);
node = find_node(handle);
if (node == NULL) {
- PRT_TRACE_ERR("find_node(%d) fail", handle);
+ _E("find_node(%d) fail", handle);
return -1;
}
free(node);
g_list_foreach(haptic_head, check_play_state, &play);
- PRT_TRACE_ERR("play state : %d", play);
+ _E("play state : %d", play);
if (!play) {
- PRT_TRACE_ERR("not playing anymore, will be stop");
+ _E("not playing anymore, will be stop");
r = device_set_property(DEVICE_TYPE_VIBRATOR, PROP_VIBRATOR_ENABLE, 0);
if (r < 0) {
- PRT_TRACE_ERR("set enable fail");
+ _E("set enable fail");
return -1;
}
}
int mode;
int handle;
- PRT_TRACE_ERR("argc : %d", argc);
+ _E("argc : %d", argc);
for (i = 0; i < argc; ++i)
- PRT_TRACE_ERR("[%2d] %s", i, argv[i]);
+ _E("[%2d] %s", i, argv[i]);
if (argc <= 0 || argc > 5) {
- PRT_TRACE_ERR("Haptic predefine action failed");
+ _E("Haptic predefine action failed");
return -1;
}
pid = atoi(argv[0]);
mode = atoi(argv[1]);
handle = atoi(argv[2]);
- PRT_TRACE_ERR("pid : %d, mode : %d", pid, mode);
+ _E("pid : %d, mode : %d", pid, mode);
switch(mode) {
case OPEN:
notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
noti_err = notification_status_message_post(gettext(msg));
if (noti_err != NOTIFICATION_ERROR_NONE)
- PRT_TRACE_ERR("FAIL: notification_status_message_post(msg)");
+ _E("FAIL: notification_status_message_post(msg)");
}
static void pci_noti(pci_noti_type iPCI)
pci_noti(cb_type);
}
else {
- PRT_TRACE_ERR("FAIL param error");
+ _E("FAIL param error");
}
return 0;