free(data);
}
+int get_number_of_processors(void)
+{
+ int mib[2], sys_num = 0;
+ size_t len;
+
+ mib[0] = CTL_HW;
+ mib[1] = HW_AVAILCPU;
+
+ sysctl(mib, 2, &sys_num, &len, NULL, 0);
+ if (num_processor < 1) {
+ mib[1] = HW_NCPU;
+ sysctl(mib, 2, &sys_num, &len, NULL, 0);
+
+ if (sys_num < 1) {
+ sys_num = 1;
+ }
+ }
+ INFO("* Number of processors : %d\n", sys_num);
+
+ return sys_num;
+}
void print_system_info_os(void)
{
}
free(sys_info);
+#if 0
mib[0] = CTL_HW;
mib[1] = HW_NCPU;
len = sizeof(sys_num);
if (sysctl(mib, 2, &sys_num, &len, NULL, 0) >= 0) {
INFO("* Number of processors : %d\n", sys_num);
}
+#endif
+ get_number_of_processors();
mib[0] = CTL_HW;
mib[1] = HW_PHYSMEM;
-/*
+/*
* Emulator
*
* Copyright (C) 2012, 2013 Samsung Electronics Co., Ltd. All rights reserved.
*
- * Contact:
+ * Contact:
* SeokYeon Hwang <syeon.hwang@samsung.com>
* MunKyu Im <munkyu.im@samsung.com>
* GiWoong Kim <giwoong.kim@samsung.com>
g_strlcat(bin_path, "/", PATH_MAX);
}
+int get_number_of_processors(void)
+{
+ int num_processors = 0;
+
+ num_processors = sysconf(_SC_NPROCESSORS_ONLN);
+ if (num_processors < 1) {
+ num_processors = 1;
+ }
+ TRACE("Number of processors : %d\n", num_processors);
+
+ return num_processors;
+}
+
void print_system_info_os(void)
{
INFO("* Linux\n");
ERR("pac file is not wrong! It could be the wrong pac address or pac file format\n");
fclose(fp_pacfile);
}
- }
+ }
else {
ERR("fail to get pacfile fp\n");
return -1;
snprintf(buf_proxy, MAXLEN, "%s", buf);
}
pclose(output);
-
+
output = popen(gproxycmds[GNOME_PROXY_HTTP_PORT][gproxytool], "r");
if(fscanf(output, "%s", buf_port) <= 0) {
//for abnormal case: if can't find the key of http port, get from environment value.
}
if (ret > 0) {
process_string(buf);
- //priority : auto > manual > none
+ //priority : auto > manual > none
if (strcmp(buf, "auto") == 0) {
INFO("AUTO PROXY MODE\n");
get_auto_proxy(http_proxy, https_proxy, ftp_proxy, socks_proxy);
-/*
+/*
* Emulator
*
* Copyright (C) 2012, 2013 Samsung Electronics Co., Ltd. All rights reserved.
*
- * Contact:
+ * Contact:
* SeokYeon Hwang <syeon.hwang@samsung.com>
* MunKyu Im <munkyu.im@samsung.com>
* GiWoong Kim <giwoong.kim@samsung.com>
g_strlcat(bin_path, "\\", PATH_MAX);
}
+int get_number_of_processors(void)
+{
+ SYSTEM_INFO sysi;
+ int num_processors = 0;
+
+ GetSystemInfo(&sysi);
+ TRACE("Processor type: %d, Core number: %d\n",
+ sysi.dwProcessorType, sysi.dwNumberOfProcessors);
+
+ num_processors = sysi.dwNumberOfProcessors;
+ if (num_processors < 1) {
+ num_processors = 1;
+ }
+
+ return num_processors;
+}
+
void print_system_info_os(void)
{
INFO("* Windows\n");
SYSTEM_INFO sysi;
ZeroMemory(&sysi, sizeof(SYSTEM_INFO));
+#if 0
GetSystemInfo(&sysi);
INFO("* Processor type : %d, Number of processors : %d\n",
sysi.dwProcessorType, sysi.dwNumberOfProcessors);
+#endif
+ get_number_of_processors();
MEMORYSTATUSEX memInfo;
memInfo.dwLength = sizeof(MEMORYSTATUSEX);
ERR("pac file is not wrong! It could be the wrong pac address or pac file format\n");
fclose(fp_pacfile);
}
- }
+ }
else {
ERR("fail to get pacfile fp\n");
return -1;
lRet = RegQueryValueEx(hKey, "AutoConfigURL", 0, NULL, url, &dwLength);
if (lRet == ERROR_SUCCESS && dwLength != 0) {
get_auto_proxy(url, http_proxy, https_proxy, ftp_proxy, socks_proxy);
- RegCloseKey(hKey);
+ RegCloseKey(hKey);
return 0;
}
}
}
if (*(char*)proxyenable == 0) {
free(proxyenable);
- RegCloseKey(hKey);
+ RegCloseKey(hKey);
return 0;
}
if (lRet != ERROR_SUCCESS && dwLength == 0) {
ERR("Failed to query value from from %s\n",
"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings");
- RegCloseKey(hKey);
+ RegCloseKey(hKey);
return 0;
}
proxyserver = (BYTE*)malloc(dwLength);
if (proxyserver == NULL) {
ERR( "Failed to allocate a buffer\n");
- RegCloseKey(hKey);
+ RegCloseKey(hKey);
return 0;
}
RegCloseKey(hKey);
return 0;
}
-
+
if((char*)proxyserver != NULL) {
INFO("proxy value: %s\n", (char*)proxyserver);
real_proxy = malloc(MAXLEN);
-
+
for(p = strtok((char*)proxyserver, ";"); p; p = strtok(NULL, ";")){
if(strstr(p, HTTP_PROTOCOL)) {
remove_string(p, real_proxy, HTTP_PROTOCOL);
size_t write_data(void *, size_t, size_t, FILE *);
void remove_string(char *, char *, const char *);
+int get_number_of_processors(void);
+
#endif // __OS_UTIL_H__