* Contact:
* SeokYeon Hwang <syeon.hwang@samsung.com>
* MunKyu Im <munkyu.im@samsung.com>
+ * Sangho Park <sangho.p@samsung.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
*/
#include <sys/sysctl.h>
+#include <sys/utsname.h>
#include "png.h"
void print_system_info_os(void)
{
+ struct utsname utsname;
+
LOG_INFO("* Mac\n");
LOG_INFO("* LibPNG Version : %s\n", PNG_LIBPNG_VER_STRING);
/* uname */
LOG_INFO("* Host machine uname :\n");
- char const *const uname_cmd = "uname -a";
- if(system(uname_cmd) < 0) {
- LOG_INFO("system function command '%s' \
- returns error !", uname_cmd);
+ if (uname(&utsname) == 0) {
+ LOG_INFO("* Host machine uname : %s %s %s %s %s\n",
+ utsname.sysname, utsname.nodename,
+ utsname.release, utsname.version,
+ utsname.machine);
}
/* hw information */
if (sysctl(mib, 2, &sys_num, &len, NULL, 0) >= 0) {
LOG_INFO("* Total memory : %llu bytes\n", sys_num);
}
-
- /* java version */
- LOG_INFO("* Java version :\n");
- char const *const lspci_cmd = "java -version";
-
- fflush(stdout);
- if(system(lspci_cmd) < 0) {
- LOG_INFO("system function command '%s' \
- returns error !", lspci_cmd);
- }
}
bool make_sdcard_lock_os(char *sdcard)
* Contact:
* SeokYeon Hwang <syeon.hwang@samsung.com>
* MunKyu Im <munkyu.im@samsung.com>
+ * Sangho Park <sangho.p@samsung.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
#include <linux/version.h>
#include <sys/utsname.h>
#include <sys/sysinfo.h>
+#include <errno.h>
#include "png.h"
#include "osutil.h"
#include "emul_state.h"
+#include "qemu/osdep.h"
#ifndef CONFIG_LINUX
#error
if (num_processors < 1) {
num_processors = 1;
}
- LOG_TRACE("Number of processors : %d\n", num_processors);
+ LOG_INFO("Number of processors : %d\n", num_processors);
return num_processors;
}
+static void _system(const char *buf)
+{
+ if (system(buf) < 0) {
+ LOG_INFO("system function command '%s' \
+ returns error !", buf);
+ }
+}
+
+static void get_lsb(void)
+{
+ int fd;
+
+ /*
+ * lsb_release(1) is defined at LSB spec
+ * while the spec does not define /etc/lsb-release.
+ * At first, try to read from /etc/lsb-release in order to avoid system(3).
+ * If open(2) to the file is failed, try to system(lsb_release).
+ */
+ LOG_INFO("* Linux distribution infomation :\n");
+ fd = qemu_open("/etc/lsb-release", O_RDONLY);
+ if (fd >= 0) {
+ char buf[4096];
+ int ret;
+ do {
+ ret = read(fd, buf, sizeof(buf));
+ if (ret > 0)
+ LOG_INFO("%.*s\n", ret, buf);
+ } while (ret == sizeof(buf));
+ if (ret < 0) {
+ LOG_INFO("Failed to read file for lsb: %s\n", strerror(errno));
+ }
+ qemu_close(fd);
+ } else {
+ _system("lsb_release -d -r -c");
+ }
+}
+
void print_system_info_os(void)
{
LOG_INFO("* Linux\n");
(LINUX_VERSION_CODE >> 8) & 0xff,
LINUX_VERSION_CODE & 0xff);
- /* depends on launching */
+ /* depends on launching */
struct utsname host_uname_buf;
if (uname(&host_uname_buf) == 0) {
LOG_INFO("* Host machine uname : %s %s %s %s %s\n",
host_uname_buf.machine);
}
+ /* get linux distribution information */
+ get_lsb();
+
+ get_number_of_processors();
+
struct sysinfo sys_info;
if (sysinfo(&sys_info) == 0) {
LOG_INFO("* Total Ram : %llu kB, Free: %llu kB\n",
sys_info.freeram * (unsigned long long)sys_info.mem_unit / 1024);
}
- /* get linux distribution information */
- LOG_INFO("* Linux distribution infomation :\n");
- char const *const lsb_release_cmd = "lsb_release -d -r -c";
- gchar *buffer = NULL;
- gint buffer_size = strlen(lsb_release_cmd) + 1;
-
- buffer = g_malloc(buffer_size);
-
- g_snprintf(buffer, buffer_size, "%s", lsb_release_cmd);
-
- if (system(buffer) < 0) {
- LOG_INFO("system function command '%s' \
- returns error !", buffer);
- }
- g_free(buffer);
-
/* pci device description */
LOG_INFO("* Host PCI devices :\n");
- char const *const lspci_cmd = "lspci";
- buffer_size = strlen(lspci_cmd) + 1;
-
- buffer = g_malloc(buffer_size);
-
- g_snprintf(buffer, buffer_size, "%s", lspci_cmd);
-
- fflush(stdout);
- if (system(buffer) < 0) {
- LOG_INFO("system function command '%s' \
- returns error !", buffer);
- }
- g_free(buffer);
+ _system("lspci");
}
bool make_sdcard_lock_os(char *sdcard)