mirror of
https://github.com/hermitcore/libhermit.git
synced 2025-03-09 00:00:03 +01:00
add the possibilty to set the isle number
The environment variable "HERMIT_ISLE" is used to set the default isle. Now, an application starts on isle 1 as follow: HERMIT_ISLE=1 ./exec_name
This commit is contained in:
parent
3d22f40e41
commit
95f0a2546b
1 changed files with 21 additions and 1 deletions
|
@ -47,12 +47,30 @@
|
|||
#define __HERMIT_read 4
|
||||
#define __HERMIT_lseek 5
|
||||
|
||||
static char saddr[16] = "192.168.28.2";
|
||||
static char saddr[16];
|
||||
static int sobufsize = 131072;
|
||||
static unsigned int isle_nr = 0;
|
||||
|
||||
extern char hermit_app[];
|
||||
extern unsigned app_size;
|
||||
|
||||
int init_enviroment(void)
|
||||
{
|
||||
char* str;
|
||||
|
||||
str = getenv("HERMIT_ISLE");
|
||||
if (str)
|
||||
{
|
||||
isle_nr = atoi(str);
|
||||
if ((isle_nr < 0) || (isle_nr > 254))
|
||||
isle_nr = 0;
|
||||
}
|
||||
|
||||
snprintf(saddr, 15, "192.168.28.%u", isle_nr+2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* in principle, HermitCore forwards basic system calls to
|
||||
* this proxy, which mapped these call to Linux system calls.
|
||||
|
@ -246,6 +264,8 @@ int main(int argc, char **argv)
|
|||
int32_t magic = HERMIT_MAGIC;
|
||||
struct sockaddr_in serv_name;
|
||||
|
||||
init_enviroment();
|
||||
|
||||
/* create a socket */
|
||||
s = socket(PF_INET, SOCK_STREAM, 0);
|
||||
if (s < 0)
|
||||
|
|
Loading…
Add table
Reference in a new issue