"emulator log path" and "kernel log path" can be different.
So we divided up log path and dealed with log file instead of log path.
Change-Id: I23b28d6132790b4774291810e09f95cdb5f4a633
Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
return bin_path;
}
-// log path
-static const char *log_redirect_path;
+// emulator kernel log file
+static const char *kernel_log_redirect_file;
+
+const char *get_kernel_log_redirect_file(void)
+{
+ // TODO: kernel log path should be aquired from char device.
+ if (kernel_log_redirect_file) {
+ return kernel_log_redirect_file;
+ }
+
+ char *vms_path = get_variable("vms_path");
+ char *vm_name = get_variable("vm_name");
+ if (!vms_path || !vm_name) {
+ // we can not specify log path.
+ // emulator may not be launched from emulator-manager.
+ kernel_log_redirect_file = g_strdup("");
+ }
+ else {
+ kernel_log_redirect_file =
+ g_strdup_printf("%s/%s/logs/emulator.klog", vms_path, vm_name);
+ }
+
+ return kernel_log_redirect_file;
+}
+
+// emulator log file
+static const char *log_redirect_file;
#ifdef CONFIG_WIN32
-// for Windows version
+// for checking Windows version
extern OSVERSIONINFO osvi;
#endif
-const char *get_log_redirect_path(void)
+const char *get_log_redirect_file(void)
{
#ifdef SUPPORT_LEGACY_ARGS
if (log_path[0]) {
// should we compare stdout(fd/1) and stderr(fd/2) ??
#if defined(CONFIG_LINUX)
result = readlink("/proc/self/fd/1", log_filename, PATH_MAX);
+ if (result >= 0) {
+ log_filename[result] = '\0';
+ }
#elif defined(CONFIG_DARWIN)
result = fcntl(STDOUT_FILENO, F_GETPATH, log_filename);
#elif defined(CONFIG_WIN32)
}
# endif
#endif
+ if (log_redirect_file) {
+ g_free((void *)log_redirect_file);
+ }
+
if (result >= 0) {
- log_redirect_path = g_path_get_dirname(log_filename);
+ log_redirect_file = g_strdup(log_filename);
} else {
// fail safe
LOG_WARNING("Can not identify log redirection path, "
if (!vms_path || !vm_name) {
// we can not specify log path.
// emulator may not be launched from emulator-manager.
- log_redirect_path = "";
+ log_redirect_file = g_strdup("");
}
else {
- log_redirect_path = g_strdup_printf("%s/%s/logs",
- vms_path, vm_name);
+ log_redirect_file =
+ g_strdup_printf("%s/%s/logs/emulator.log", vms_path, vm_name);
}
}
- return log_redirect_path;
+ return log_redirect_file;
}
extern char log_path[];
#endif
-char const *get_bin_path(void);
-char const *get_log_redirect_path(void);
-
/* setter */
void set_emul_win_scale(double scale);
void set_emul_sdl_bpp(int bpp);
extern int initial_resolution_width;
extern int initial_resolution_height;
+char const *get_bin_path(void);
+char const *get_log_redirect_file(void);
+char const *get_kernel_log_redirect_file(void);
const char *get_drive_image_file(void);
const char *get_http_proxy_addr(void);
const char *get_vm_name(void);
/* collect log path information */
#define LOGPATH_TEXT "log_path="
- const char* log_path = get_log_redirect_path();
+ char* log_path = g_path_get_dirname(get_log_redirect_file());
int log_path_len = strlen(LOGPATH_TEXT) + strlen(log_path) + delimiter_len;
total_len += (log_path_len + 1);
detail_info->data = info_data;
detail_info->data_length = total_len;
+ g_free(log_path);
+
return detail_info;
}
QString(imagePathList[i]));
}
- insertTableRow(vmInfoTable, QString(DETAILED_INFO_LOG_PATH),
- QString(get_log_redirect_path()), QString(get_log_redirect_path()));
+ QString log_redirect_file(get_log_redirect_file());
+ insertTableRow(vmInfoTable, QString(DETAILED_INFO_LOG_FILE),
+ log_redirect_file, log_redirect_file);
+
+ QString kernel_log_redirect_file(get_kernel_log_redirect_file());
+ insertTableRow(vmInfoTable, QString(DETAILED_INFO_KERNEL_LOG_FILE),
+ kernel_log_redirect_file, kernel_log_redirect_file);
#if 0
insertTableRow(vmInfoTable, DETAILED_INFO_TELNET_PORT,
QTableWidgetItem *item = vmInfoTable->item(nRow, 0);
qDebug() << item->text() << "item was double clicked";
- if (item->text().compare(DETAILED_INFO_HDS_PATH, Qt::CaseInsensitive) == 0 ||
- item->text().compare(DETAILED_INFO_LOG_PATH, Qt::CaseInsensitive) == 0 ||
+ if (item->text().compare(DETAILED_INFO_HDS_PATH) == 0 ||
+ item->text().compare(DETAILED_INFO_LOG_FILE) == 0 ||
+ item->text().compare(DETAILED_INFO_KERNEL_LOG_FILE) == 0 ||
item->text().startsWith(DETAILED_INFO_IMAGE_PATH) == true) {
/* get path item */
item = vmInfoTable->item(nRow, nCol);
- if (item->text().compare(GENERIC_TEXT_NONE, Qt::CaseInsensitive) == 0 ||
+ if (item->text().compare(GENERIC_TEXT_NONE) == 0 ||
item->text().isEmpty() == true) {
/* ignore this event */
return;
#define DETAILED_INFO_CPU_VT "CPU Virtualization"
#define DETAILED_INFO_GPU_VT "GPU Virtualization"
#define DETAILED_INFO_IMAGE_PATH "Image Path"
-#define DETAILED_INFO_LOG_PATH "Log Path"
+#define DETAILED_INFO_LOG_FILE "Emulator Log File"
+#define DETAILED_INFO_KERNEL_LOG_FILE "Kernel Log File"
#define DETAILED_INFO_TELNET_PORT "Logging Telnet Port"
/* screen shot dialog */