Changeset 635 for trunk/user/ksh/ksh.c
- Timestamp:
- Jun 26, 2019, 11:42:37 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/user/ksh/ksh.c
r633 r635 108 108 char pathnew[PATH_MAX_SIZE]; // used by the rename command 109 109 110 char string[128]; // used by snprintf() for debug 111 110 112 ////////////////////////////////////////////////////////////////////////////////////////// 111 113 // Shell Commands … … 121 123 122 124 #if DEBUG_CMD_CAT 123 char string[64]; 125 snprintf( string , 128 , "[ksh] enter %s" , __FUNCTION__); 126 display_string( string ); 124 127 #endif 125 128 … … 133 136 134 137 strcpy( pathname , argv[1] ); 138 139 #if DEBUG_CMD_CAT 140 snprintf( string , 128 , "[ksh] in %s : after strcpy" , __FUNCTION__ ); 141 display_string( string ); 142 #endif 135 143 136 144 // open the file … … 145 153 146 154 #if DEBUG_CMD_CAT 147 snprintf( string , 64, "[ksh] %s : file %s open", __FUNCTION__, pathname );155 snprintf( string , 128 , "[ksh] %s : file %s open", __FUNCTION__, pathname ); 148 156 display_string( string ); 149 157 #endif … … 172 180 173 181 #if DEBUG_CMD_CAT 174 snprintf( string , 64, "[ksh] %s : size = %d", __FUNCTION__, size );182 snprintf( string , 128 , "[ksh] %s : size = %d", __FUNCTION__, size ); 175 183 display_string( string ); 176 184 #endif … … 198 206 199 207 #if DEBUG_CMD_CAT 200 snprintf( string , 64, "[ksh] %s : maped file %d to buffer %x", __FUNCTION__, fd , buf );208 snprintf( string , 128 , "[ksh] %s : maped file %d to buffer %x", __FUNCTION__, fd , buf ); 201 209 display_string( string ); 202 210 #endif … … 212 220 213 221 #if DEBUG_CMD_CAT 214 snprintf( string , 64, "[ksh] %s : unmaped file %d from buffer %x", __FUNCTION__, fd , buf );222 snprintf( string , 128 , "[ksh] %s : unmaped file %d from buffer %x", __FUNCTION__, fd , buf ); 215 223 display_string( string ); 216 224 #endif … … 261 269 262 270 #if DEBUG_CMD_CP 263 char string[64]; 271 snprintf( string , 128 , "[ksh] enter %s" , __FUNCTION__); 272 display_string( string ); 264 273 #endif 265 274 … … 284 293 285 294 #if DEBUG_CMD_CP 286 snprintf( string , 64, "[ksh] %s : file %s open", __FUNCTION__, argv[1] );295 snprintf( string , 128 , "[ksh] %s : file %s open", __FUNCTION__, argv[1] ); 287 296 display_string( string ); 288 297 #endif … … 297 306 298 307 #if DEBUG_CMD_CP 299 snprintf( string , 64, "[ksh] %s : got stats for %s", __FUNCTION__, argv[1] );308 snprintf( string , 128 , "[ksh] %s : got stats for %s", __FUNCTION__, argv[1] ); 300 309 display_string( string ); 301 310 #endif … … 322 331 323 332 #if DEBUG_CMD_CP 324 snprintf( string , 64, "[ksh] %s : file %s open", __FUNCTION__, argv[2] );333 snprintf( string , 128 , "[ksh] %s : file %s open", __FUNCTION__, argv[2] ); 325 334 display_string( string ); 326 335 #endif … … 333 342 334 343 #if DEBUG_CMD_CP 335 snprintf( string , 64, "[ksh] %s : got stats for %s", __FUNCTION__, argv[2] );344 snprintf( string , 128 , "[ksh] %s : got stats for %s", __FUNCTION__, argv[2] ); 336 345 display_string( string ); 337 346 #endif … … 357 366 358 367 #if DEBUG_CMD_CP 359 snprintf( string , 64, "[ksh] %s : read %d bytes from %s", __FUNCTION__, len, argv[1] );368 snprintf( string , 128 , "[ksh] %s : read %d bytes from %s", __FUNCTION__, len, argv[1] ); 360 369 display_string( string ); 361 370 #endif … … 369 378 370 379 #if DEBUG_CMD_CP 371 snprintf( string , 64, "[ksh] %s : write %d bytes to %s", __FUNCTION__, len, argv[2] );380 snprintf( string , 128 , "[ksh] %s : write %d bytes to %s", __FUNCTION__, len, argv[2] ); 372 381 display_string( string ); 373 382 #endif … … 682 691 683 692 #if DEBUG_CMD_LOAD 684 char string[64]; 693 snprintf( string , 128 , "[ksh] enter %s" , __FUNCTION__); 694 display_string( string ); 685 695 #endif 686 696 … … 725 735 726 736 #if DEBUG_CMD_LOAD 727 snprintf( string , 64 , "[ksh] %s : ksh_pid %x / path %s / bg %d / place %d (%x)\n",728 __FUNCTION__, ksh_pid,argv[1], background, placement, cxy );737 snprintf( string , 128 , "[ksh] %s : <%s> / bg %d / place %d / cxy %x", 738 __FUNCTION__, argv[1], background, placement, cxy ); 729 739 display_string( string ); 730 740 #endif … … 744 754 745 755 #if DEBUG_CMD_LOAD 746 snprintf( string , 64 , "[ksh] %s : child_pid %x after fork, before exec\n",756 snprintf( string , 128 , "[ksh] %s : child (%x) after fork, before exec", 747 757 __FUNCTION__ , getpid() ); 748 758 display_string( string ); … … 753 763 754 764 #if DEBUG_CMD_LOAD 755 snprintf( string , 64 , "[ksh] %s : child_pid %x after exec / ret_exec %x\n",765 snprintf( string , 128 , "[ksh] %s : child (%x) after exec / ret_exec %x", 756 766 __FUNCTION__ , getpid(), ret_exec ); 757 767 display_string( string ); … … 769 779 770 780 #if DEBUG_CMD_LOAD 771 snprintf( string , 64 , "[ksh] %s : ksh_pid %x after fork / ret_fork %x\n",781 snprintf( string , 128 , "[ksh] %s : ksh (%x) after fork / ret_fork %x", 772 782 __FUNCTION__, getpid(), ret_fork ); 773 783 display_string( string ); … … 821 831 822 832 #if DEBUG_CMD_LS 823 char string[64]; 833 snprintf( string , 128 , "[ksh] enter %s" , __FUNCTION__); 834 display_string( string ); 824 835 #endif 825 836 … … 840 851 841 852 #if DEBUG_CMD_LS 842 snprintf( string , 64, "[ksh] %s : directory <%s> open / DIR %x\n",853 snprintf( string , 128 , "[ksh] %s : directory <%s> open / DIR %x\n", 843 854 __FUNCTION__, pathname , dir ); 844 855 display_string( string ); … … 863 874 864 875 #if DEBUG_CMD_LS 865 snprintf( string , 64, "[ksh] %s : directory <%s> closed\n",876 snprintf( string , 128 , "[ksh] %s : directory <%s> closed\n", 866 877 __FUNCTION__, pathname ); 867 878 display_string( string ); … … 929 940 930 941 #if DEBUG_CMD_PS 931 char string[64]; 942 snprintf( string , 128 , "[ksh] enter %s" , __FUNCTION__); 943 display_string( string ); 932 944 #endif 933 945 … … 948 960 949 961 #if DEBUG_CMD_PS 950 snprintf( string , 64, "\n[ksh] %s : call display_cluster_process()", __FUNCTION__ );962 snprintf( string , 128 , "\n[ksh] %s : call display_cluster_process()", __FUNCTION__ ); 951 963 display_string( string ); 952 964 #endif … … 1106 1118 1107 1119 #if DEBUG_EXECUTE 1108 printf("\n[ksh] %s : command <%s>\n", 1109 __FUNCTION__ , buf);1120 snprintf( string , 128 , "[ksh] enter %s for command <%s>" , __FUNCTION__ , buf ); 1121 display_string( string ); 1110 1122 #endif 1111 1123 … … 1136 1148 1137 1149 #if DEBUG_EXECUTE 1138 printf("\n[ksh] %s : argc %d / arg0 %s / arg1%s\n",1150 snprintf( string , 128 , "\n[ksh] in %s : argc = %d / arg0 = %s / arg1 = %s\n", 1139 1151 __FUNCTION__ , argc , argv[0], argv[1] ); 1140 1152 #endif … … 1174 1186 char cmd[CMD_MAX_SIZE]; // buffer for one command 1175 1187 1176 #if DEBUG_INTER 1177 char string[128]; 1178 #endif 1179 1180 1181 // 1. first direct command 1188 /* 1. first direct command 1182 1189 if( sem_wait( &semaphore ) ) 1183 1190 { … … 1187 1194 else 1188 1195 { 1189 printf("\n[ksh] load bin/user/ fft.elf\n");1196 printf("\n[ksh] load bin/user/sort.elf\n"); 1190 1197 } 1191 1198 1192 strcpy( cmd , "load bin/user/ fft.elf" );1199 strcpy( cmd , "load bin/user/sort.elf" ); 1193 1200 execute( cmd ); 1194 //1201 */ 1195 1202 1196 1203 … … 1204 1211 else 1205 1212 { 1206 printf("\n[ksh] rm home/fft_1_2_1_4096\n");1213 printf("\n[ksh] load bin/user/fft.elf\n"); 1207 1214 } 1208 1215 1209 strcpy( cmd , " rm home/fft_1_2_1_4096" );1216 strcpy( cmd , "load bin/user/fft.elf" ); 1210 1217 execute( cmd ); 1211 1218 */ … … 1252 1259 #if DEBUG_INTER 1253 1260 unsigned int pid = getpid(); 1254 snprintf( string , 128 , " \n[ksh] %s : request a new command", __FUNCTION__ );1261 snprintf( string , 128 , "[ksh] %s : request a new command", __FUNCTION__ ); 1255 1262 display_string( string ); 1256 1263 #endif … … 1282 1289 count++; 1283 1290 #if DEBUG_INTER 1284 snprintf( string , 128 , "[ksh] %s : get command <%s> / &log = %x / ptw = %d / &ptw = %x", 1285 __FUNCTION__, cmd , log_entries[ptw].buf , ptw , &ptw ); 1291 snprintf( string , 128 , "[ksh] %s : get command <%s>", __FUNCTION__, cmd ); 1286 1292 display_string( string ); 1287 1293 display_vmm( 0 , 2 ); … … 1452 1458 1453 1459 #if DEBUG_MAIN 1454 printf("\n[ksh] main thread started on core[%x,%d]\n", cxy , lid ); 1460 snprintf( string , 128 , "\n[ksh] main thread started on core[%x,%d]\n", cxy , lid ); 1461 display_string( string ); 1455 1462 #endif 1456 1463 … … 1463 1470 1464 1471 #if DEBUG_MAIN 1465 printf("\n[ksh] main initialized semaphore\n" ); 1472 snprintf( string , 128 , "\n[ksh] main initialized semaphore\n" ); 1473 display_string( string ); 1466 1474 #endif 1467 1475 … … 1476 1484 NULL ); 1477 1485 #if DEBUG_MAIN 1478 printf("\n[ksh] main thread launched interactive thread %x\n", trdid ); 1486 snprintf( string , 128 , "\n[ksh] main thread launched interactive thread %x\n", trdid ); 1487 display_string( string ); 1479 1488 #endif 1480 1489
Note: See TracChangeset
for help on using the changeset viewer.