Commit 65ec4aa826f3631b9eb7938c7ed64d3306cfaa52
1 parent
564da033
[+] anbexec has --ptahs option in command line to show all anubis directories an…
…d config files used during start. This help debug sometime
Showing
1 changed file
with
11 additions
and
5 deletions
Show diff stats
anubis_dev/vm/src/anbexec.cpp
@@ -102,7 +102,7 @@ U32 get_file_size(FILE *fp) | @@ -102,7 +102,7 @@ U32 get_file_size(FILE *fp) | ||
102 | U32 must_restart_flag = 0; | 102 | U32 must_restart_flag = 0; |
103 | 103 | ||
104 | U32 max_steps = 500; | 104 | U32 max_steps = 500; |
105 | - | 105 | +U32 show_paths = 0; |
106 | U32 plineno = 1; | 106 | U32 plineno = 1; |
107 | 107 | ||
108 | FILE *nsc_file = NULL; | 108 | FILE *nsc_file = NULL; |
@@ -265,6 +265,7 @@ void syntax(void) | @@ -265,6 +265,7 @@ void syntax(void) | ||
265 | " which is not executed.\n" | 265 | " which is not executed.\n" |
266 | " --cdir:path sets the path of the 'anubis' directory.\n" | 266 | " --cdir:path sets the path of the 'anubis' directory.\n" |
267 | " --pdir:path sets the path of the 'my_anubis' directory.\n" | 267 | " --pdir:path sets the path of the 'my_anubis' directory.\n" |
268 | + " --paths when starting show the paths of Anubis directories and configuration file.\n" | ||
268 | " --credit:n where 'n' is an integer, sets the maximum number\n" | 269 | " --credit:n where 'n' is an integer, sets the maximum number\n" |
269 | " of instructions that can be executed by a process\n" | 270 | " of instructions that can be executed by a process\n" |
270 | " in a single slice of time\n" | 271 | " in a single slice of time\n" |
@@ -1087,7 +1088,7 @@ void schedul(void) | @@ -1087,7 +1088,7 @@ void schedul(void) | ||
1087 | if(select(FD_SETSIZE,&rfds,NULL,NULL,alarm_set ? (&time_to_wait) : NULL) < 0) | 1088 | if(select(FD_SETSIZE,&rfds,NULL,NULL,alarm_set ? (&time_to_wait) : NULL) < 0) |
1088 | { | 1089 | { |
1089 | //LOGERROR("CRITICAL ERROR: Main VM select() failed with error [%d].\n", LAST_SOCKET_ERROR); | 1090 | //LOGERROR("CRITICAL ERROR: Main VM select() failed with error [%d].\n", LAST_SOCKET_ERROR); |
1090 | - usleep(1000); // this will ensure that we won't take all the CPU time if a socket is | 1091 | + usleep(1000); // (microseconds) this will ensure that we won't take all the CPU time if a socket is |
1091 | // invalid (bug encountered on 2007-08-15 by CR) | 1092 | // invalid (bug encountered on 2007-08-15 by CR) |
1092 | } | 1093 | } |
1093 | //#else | 1094 | //#else |
@@ -1114,7 +1115,7 @@ void schedul(void) | @@ -1114,7 +1115,7 @@ void schedul(void) | ||
1114 | } | 1115 | } |
1115 | } /* all machines waiting */ | 1116 | } /* all machines waiting */ |
1116 | } /* at least one machine running */ | 1117 | } /* at least one machine running */ |
1117 | - } /* while(1) */ | 1118 | + } /* while(!quitingVM) */ |
1118 | } /* schedul() */ | 1119 | } /* schedul() */ |
1119 | 1120 | ||
1120 | 1121 | ||
@@ -1356,7 +1357,10 @@ String anubisConfPath; | @@ -1356,7 +1357,10 @@ String anubisConfPath; | ||
1356 | void set_anubis_conf_path() | 1357 | void set_anubis_conf_path() |
1357 | { | 1358 | { |
1358 | anubisConfPath = anubisUserDirectory + "/"<< maj_version << "." << min_version<<"/anubis.conf"; | 1359 | anubisConfPath = anubisUserDirectory + "/"<< maj_version << "." << min_version<<"/anubis.conf"; |
1360 | + if (show_paths) | ||
1361 | + { | ||
1359 | LOGINFO("anubisConfPath = %s\n",anubisConfPath.Cstr()); | 1362 | LOGINFO("anubisConfPath = %s\n",anubisConfPath.Cstr()); |
1363 | + } | ||
1360 | } | 1364 | } |
1361 | 1365 | ||
1362 | /* 'main' function, executing a module */ | 1366 | /* 'main' function, executing a module */ |
@@ -1465,6 +1469,7 @@ int main(int argc, char **argv) | @@ -1465,6 +1469,7 @@ int main(int argc, char **argv) | ||
1465 | else if (!strcmp(argv[i],"--info")) show_info = 1; | 1469 | else if (!strcmp(argv[i],"--info")) show_info = 1; |
1466 | else if (!strncmp(argv[i],"--pdir:",7)) my_anubis_directory = argv[i]+7; | 1470 | else if (!strncmp(argv[i],"--pdir:",7)) my_anubis_directory = argv[i]+7; |
1467 | else if (!strncmp(argv[i],"--cdir:",7)) anubis_directory = argv[i]+7; | 1471 | else if (!strncmp(argv[i],"--cdir:",7)) anubis_directory = argv[i]+7; |
1472 | + else if (!strcmp(argv[i],"--paths")) show_paths = 1; | ||
1468 | else if (!strncmp(argv[i],"--credit:",9)) max_steps = sup(10,atoi(argv[i]+9)); | 1473 | else if (!strncmp(argv[i],"--credit:",9)) max_steps = sup(10,atoi(argv[i]+9)); |
1469 | else if (!strncmp(argv[i],"--MB:",5)) max_memory = (atoi(argv[i]+5))<<20; | 1474 | else if (!strncmp(argv[i],"--MB:",5)) max_memory = (atoi(argv[i]+5))<<20; |
1470 | else if (!strncmp(argv[i],"--main_seg_size:",16)) TheAnubisAllocator->SetMemorySegSize(atoi(argv[i]+16)); | 1475 | else if (!strncmp(argv[i],"--main_seg_size:",16)) TheAnubisAllocator->SetMemorySegSize(atoi(argv[i]+16)); |
@@ -1566,10 +1571,11 @@ int main(int argc, char **argv) | @@ -1566,10 +1571,11 @@ int main(int argc, char **argv) | ||
1566 | } | 1571 | } |
1567 | #endif | 1572 | #endif |
1568 | 1573 | ||
1569 | - | 1574 | + if (show_paths) |
1575 | + { | ||
1570 | LOGINFO("my_anubis_directory = %s\n",my_anubis_directory.Cstr()); | 1576 | LOGINFO("my_anubis_directory = %s\n",my_anubis_directory.Cstr()); |
1571 | LOGINFO("anubis_directory = %s\n",anubis_directory.Cstr()); | 1577 | LOGINFO("anubis_directory = %s\n",anubis_directory.Cstr()); |
1572 | - | 1578 | + } |
1573 | LoadConfigurationFile(&config); | 1579 | LoadConfigurationFile(&config); |
1574 | 1580 | ||
1575 | srand(time(0)); | 1581 | srand(time(0)); |