mirror of
https://github.com/hermitcore/libhermit.git
synced 2025-03-30 00:00:15 +01:00
enable a check if the HermitCore app depends on a proxy
This commit is contained in:
parent
1e3a73ea44
commit
c3a4a6e2df
4 changed files with 25 additions and 14 deletions
|
@ -37,6 +37,7 @@
|
||||||
#include <hermit/logging.h>
|
#include <hermit/logging.h>
|
||||||
#include <asm/tss.h>
|
#include <asm/tss.h>
|
||||||
#include <asm/page.h>
|
#include <asm/page.h>
|
||||||
|
#include <asm/multiboot.h>
|
||||||
|
|
||||||
#define TLS_OFFSET 8
|
#define TLS_OFFSET 8
|
||||||
|
|
||||||
|
@ -96,6 +97,22 @@ static int thread_entry(void* arg, size_t ep)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int is_proxy(void)
|
||||||
|
{
|
||||||
|
if (is_uhyve())
|
||||||
|
return 0;
|
||||||
|
if (!is_single_kernel())
|
||||||
|
return 1;
|
||||||
|
if (mb_info && (mb_info->flags & MULTIBOOT_INFO_CMDLINE))
|
||||||
|
{
|
||||||
|
// search in the command line for cpu frequency
|
||||||
|
char* found = strstr((char*) (size_t)mb_info->cmdline, "-proxy");
|
||||||
|
if (!found)
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
size_t* get_current_stack(void)
|
size_t* get_current_stack(void)
|
||||||
{
|
{
|
||||||
task_t* curr_task = per_core(current_task);
|
task_t* curr_task = per_core(current_task);
|
||||||
|
|
|
@ -270,6 +270,10 @@ static inline void check_workqueues(void)
|
||||||
check_workqueues_in_irqhandler(-1);
|
check_workqueues_in_irqhandler(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @brief check if a proxy is available
|
||||||
|
*/
|
||||||
|
int is_proxy(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -404,7 +404,7 @@ static int initd(void* arg)
|
||||||
// initialize network
|
// initialize network
|
||||||
err = init_netifs();
|
err = init_netifs();
|
||||||
|
|
||||||
if (is_uhyve() || (err != 0))
|
if ((err != 0) || is_proxy())
|
||||||
{
|
{
|
||||||
char* dummy[] = {"app_name", NULL};
|
char* dummy[] = {"app_name", NULL};
|
||||||
|
|
||||||
|
@ -415,16 +415,6 @@ static int initd(void* arg)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (is_single_kernel()) {
|
|
||||||
char* dummy[] = {"app_name", NULL};
|
|
||||||
|
|
||||||
libc_start(1, dummy, NULL);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// initialize iRCCE
|
// initialize iRCCE
|
||||||
if (!is_single_kernel())
|
if (!is_single_kernel())
|
||||||
init_rcce();
|
init_rcce();
|
||||||
|
|
|
@ -126,7 +126,7 @@ static void exit_handler(int sig)
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char* cpufreq(void)
|
static char* get_append_string(void)
|
||||||
{
|
{
|
||||||
char line[2048];
|
char line[2048];
|
||||||
char* match;
|
char* match;
|
||||||
|
@ -148,7 +148,7 @@ static char* cpufreq(void)
|
||||||
;
|
;
|
||||||
*point = '\0';
|
*point = '\0';
|
||||||
|
|
||||||
snprintf(cmdline, MAX_PATH, "-freq%s", match);
|
snprintf(cmdline, MAX_PATH, "\"-freq%s -proxy\"", match);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
return cmdline;
|
return cmdline;
|
||||||
|
@ -314,7 +314,7 @@ static int qemu_init(char *path)
|
||||||
char port_str[MAX_PATH];
|
char port_str[MAX_PATH];
|
||||||
pid_t qemu_pid;
|
pid_t qemu_pid;
|
||||||
char* qemu_str = "qemu-system-x86_64";
|
char* qemu_str = "qemu-system-x86_64";
|
||||||
char* qemu_argv[] = {qemu_str, "-daemonize", "-display", "none", "-smp", "1", "-m", "2G", "-pidfile", pidname, "-net", "nic,model=rtl8139", "-net", hostfwd, "-chardev", chardev_file, "-device", "pci-serial,chardev=gnc0", "-kernel", loader_path, "-initrd", path, "-append", cpufreq(), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
|
char* qemu_argv[] = {qemu_str, "-daemonize", "-display", "none", "-smp", "1", "-m", "2G", "-pidfile", pidname, "-net", "nic,model=rtl8139", "-net", hostfwd, "-chardev", chardev_file, "-device", "pci-serial,chardev=gnc0", "-kernel", loader_path, "-initrd", path, "-append", get_append_string(), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
|
||||||
|
|
||||||
str = getenv("HERMIT_CPUS");
|
str = getenv("HERMIT_CPUS");
|
||||||
if (str)
|
if (str)
|
||||||
|
|
Loading…
Add table
Reference in a new issue