Changeset 676 for trunk/user/ksh
- Timestamp:
- Nov 20, 2020, 12:11:35 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/user/ksh/ksh.c
r659 r676 58 58 59 59 #define DEBUG_MAIN 0 60 #define DEBUG_INTER 061 60 #define DEBUG_EXECUTE 0 62 61 #define DEBUG_CMD_CAT 0 … … 105 104 pthread_t trdid; // interactive thread identifier 106 105 106 char cmd[CMD_MAX_SIZE]; // buffer for one command 107 108 char elf_path[PATH_MAX_SIZE]; // pathname for cmd_load command 109 107 110 char pathname[PATH_MAX_SIZE]; // pathname for a file 108 111 109 char pathnew[PATH_MAX_SIZE]; // used by the rename command112 char pathnew[PATH_MAX_SIZE]; // used by the cmd_rename command 110 113 111 char string[ 128]; // used by snprintf() for debug114 char string[256]; // used by snprintf() for debug 112 115 113 116 ////////////////////////////////////////////////////////////////////////////////////////// … … 124 127 125 128 #if DEBUG_CMD_CAT 126 snprintf( string , 128 , "[ksh] %s enters" , __FUNCTION__); 127 display_string( string ); 129 printf("\n[ksh] %s enters" , __FUNCTION__); 128 130 #endif 129 131 … … 139 141 140 142 #if DEBUG_CMD_CAT 141 snprintf( string , 128 , "[ksh] %s : after strcpy" , __FUNCTION__ ); 142 display_string( string ); 143 printf("\n[ksh] %s : after strcpy" , __FUNCTION__ ); 143 144 #endif 144 145 … … 154 155 155 156 #if DEBUG_CMD_CAT 156 snprintf( string , 128 , "[ksh] %s : file %s open", __FUNCTION__, pathname ); 157 display_string( string ); 157 printf("\n[ksh] %s : file %s open", __FUNCTION__, pathname ); 158 158 #endif 159 159 … … 181 181 182 182 #if DEBUG_CMD_CAT 183 snprintf( string , 128 , "[ksh] %s : size = %d", 184 __FUNCTION__, size ); 185 display_string( string ); 183 printf("\n[ksh] %s : size = %d", __FUNCTION__, size ); 186 184 #endif 187 185 … … 208 206 209 207 #if DEBUG_CMD_CAT 210 snprintf( string , 128 , "[ksh] %s : mapped file %d to buffer %x", 211 __FUNCTION__, fd , buf ); 212 display_string( string ); 208 printf("\n[ksh] %s : mapped file %d to buffer %x", __FUNCTION__, fd , buf ); 213 209 #endif 214 210 … … 223 219 224 220 #if DEBUG_CMD_CAT 225 snprintf( string , 128 , "[ksh] %s : unmapped file %d from buffer %x", 226 __FUNCTION__, fd , buf ); 227 display_string( string ); 221 printf("\n[ksh] %s : unmapped file %d from buffer %x", __FUNCTION__, fd , buf ); 228 222 #endif 229 223 … … 273 267 274 268 #if DEBUG_CMD_CP 275 snprintf( string , 128 , "[ksh] enter %s" , __FUNCTION__); 276 display_string( string ); 269 printf("\n[ksh] enter %s" , __FUNCTION__); 277 270 #endif 278 271 … … 297 290 298 291 #if DEBUG_CMD_CP 299 snprintf( string , 128 , "[ksh] %s : file %s open", __FUNCTION__, argv[1] ); 300 display_string( string ); 292 printf("\n[ksh] %s : file %s open", __FUNCTION__, argv[1] ); 301 293 #endif 302 294 … … 310 302 311 303 #if DEBUG_CMD_CP 312 snprintf( string , 128 , "[ksh] %s : got stats for %s", __FUNCTION__, argv[1] ); 313 display_string( string ); 304 printf("\n[ksh] %s : got stats for %s", __FUNCTION__, argv[1] ); 314 305 #endif 315 306 … … 335 326 336 327 #if DEBUG_CMD_CP 337 snprintf( string , 128 , "[ksh] %s : file %s open", __FUNCTION__, argv[2] ); 338 display_string( string ); 328 printf("\n[ksh] %s : file %s open", __FUNCTION__, argv[2] ); 339 329 #endif 340 330 … … 346 336 347 337 #if DEBUG_CMD_CP 348 snprintf( string , 128 , "[ksh] %s : got stats for %s", __FUNCTION__, argv[2] ); 349 display_string( string ); 338 printf("\n[ksh] %s : got stats for %s", __FUNCTION__, argv[2] ); 350 339 #endif 351 340 … … 370 359 371 360 #if DEBUG_CMD_CP 372 snprintf( string , 128 , "[ksh] %s : read %d bytes from %s", __FUNCTION__, len, argv[1] ); 373 display_string( string ); 361 printf("\n[ksh] %s : read %d bytes from %s", __FUNCTION__, len, argv[1] ); 374 362 #endif 375 363 … … 382 370 383 371 #if DEBUG_CMD_CP 384 snprintf( string , 128 , "[ksh] %s : write %d bytes to %s", __FUNCTION__, len, argv[2] ); 385 display_string( string ); 372 printf("\n[ksh] %s : write %d bytes to %s", __FUNCTION__, len, argv[2] ); 386 373 #endif 387 374 … … 416 403 " display fat min nslots\n" 417 404 " display fat cxy 0\n" 418 " display socket pid fdid\n" ); 405 " display socket pid fdid\n" 406 " display fd pid\n" 407 " display fbf pid\n" ); 419 408 } 420 409 //////////////////////////////////// … … 578 567 } 579 568 } 580 ///////////////////////////////////////// //569 ///////////////////////////////////////// 581 570 else if( strcmp( argv[1] , "fat" ) == 0 ) 582 571 { … … 596 585 } 597 586 } 598 /////////////////////////////////////////// 587 //////////////////////////////////////////// 599 588 else if( strcmp( argv[1] , "socket" ) == 0 ) 600 589 { … … 614 603 } 615 604 } 605 //////////////////////////////////////// 606 else if( strcmp( argv[1] , "fd" ) == 0 ) 607 { 608 if( argc != 3 ) 609 { 610 printf(" usage: display fd pid\n"); 611 } 612 else 613 { 614 unsigned int pid = atoi(argv[2]); 615 616 if( display_fd_array( pid ) ) 617 { 618 printf(" error: cannot found process %x\n", pid ); 619 } 620 } 621 } 622 //////////////////////////////////////// 623 else if( strcmp( argv[1] , "fbf" ) == 0 ) 624 { 625 if( argc != 3 ) 626 { 627 printf(" usage: display fbf pid\n" 628 " display fbf 0 (all processes)"); 629 } 630 else 631 { 632 unsigned int pid = atoi(argv[2]); 633 634 if( display_fbf_windows( pid ) ) 635 { 636 printf(" error: cannot found process %x\n", pid ); 637 } 638 } 639 } 616 640 //// 617 641 else … … 632 656 if (argc != 2) 633 657 { 634 printf(" usage: %s pid\n", argv[0]);658 printf(" usage: fg pid\n"); 635 659 } 636 660 else … … 658 682 unsigned int i; 659 683 660 if (argc != 1)661 { 662 printf(" usage: %s\n", argv[0]);684 if( (argc != 1) || (argv[0] == NULL) ) 685 { 686 printf(" usage: help\n"); 663 687 } 664 688 else … … 676 700 } // end cmd_help() 677 701 702 ///////////////////////////////////////////////// 703 static void cmd_history( int argc , char **argv ) 704 { 705 unsigned int i; 706 707 if( (argc != 1) || (argv[0] == NULL) ) 708 { 709 printf(" usage: history\n"); 710 } 711 else 712 { 713 printf("--- registered commands ---\n"); 714 for (i = 0; i < LOG_DEPTH; i++) 715 { 716 printf(" - %d\t: %s\n", i, &log_entries[i].buf); 717 } 718 } 719 720 // release semaphore to get next command 721 sem_post( &semaphore ); 722 723 } // end cmd_history() 724 678 725 ////////////////////////////////////////////// 679 726 static void cmd_kill( int argc , char **argv ) … … 683 730 if (argc != 2) 684 731 { 685 printf(" usage: %spid\n", argv[0]);732 printf(" usage: kill pid\n", argv[0]); 686 733 } 687 734 else … … 710 757 int ret_fork; // return value from fork 711 758 int ret_exec; // return value from exec 712 unsigned int ksh_pid; // KSH process PID759 unsigned int cmd_ok; // command arguments acceptable 713 760 unsigned int background; // background execution if non zero 714 unsigned int placement; // placement specified if non zero 715 unsigned int cxy; // target cluster if placement specified 761 unsigned int place; // user placement if non zero 762 char * arg[5]; // array of pointers on main thread arguments 763 unsigned int args_nr; // number of aruments in this array 764 765 char undef[] = { "undefined" }; 766 767 // arguments analysis of argv[] array that contains at most 8 strings: 768 // - the two first arguments ("cmd_type" & "elf_path") are mandatory 769 // - the six next ("-pcxy","arg0","arg1","arg2","arg3","&") are optional 770 771 // analyse the optional arguments 772 if( argc == 2 ) // no optional arguments 773 { 774 cmd_ok = 1; 775 background = 0; 776 place = 0; 777 arg[0] = undef; 778 arg[1] = undef; 779 arg[2] = undef; 780 arg[3] = undef; 781 args_nr = 0; 782 } 783 else if( ((argc >= 4) && (argc <= 8)) && 784 (argv[2][0] == '-') && (argv[2][1] == 'p') && 785 (strcmp(argv[argc-1] , "&" ) == 0) ) // background, place, 0 to 4 args 786 { 787 cmd_ok = 1; 788 background = 1; 789 place = 0xFF000000 | atoi( argv[2] + 2 ); 790 arg[0] = (argc > 4) ? argv[3] : undef; 791 arg[1] = (argc > 5) ? argv[4] : undef; 792 arg[2] = (argc > 6) ? argv[5] : undef; 793 arg[3] = (argc > 7) ? argv[6] : undef; 794 args_nr = argc - 4; 795 } 796 else if( ((argc >= 3) && (argc <= 7)) && 797 (argv[2][0] == '-') && (argv[2][1] == 'p') && 798 (strcmp(argv[argc-1] , "&" ) != 0) ) // place, no background, 0 to 4 args 799 { 800 cmd_ok = 1; 801 background = 0; 802 place = 0xFF000000 | atoi( argv[2] + 2 ); 803 arg[0] = (argc > 3) ? argv[3] : undef; 804 arg[1] = (argc > 4) ? argv[4] : undef; 805 arg[2] = (argc > 5) ? argv[5] : undef; 806 arg[3] = (argc > 6) ? argv[6] : undef; 807 args_nr = argc - 3; 808 } 809 else if( ((argc >=3) && (argc <= 7)) && 810 ((argv[2][0] != '-') || (argv[2][1] != 'p')) && 811 (strcmp(argv[argc-1] , "&" ) == 0) ) // no place, background, 0 to 4 args 812 { 813 cmd_ok = 1; 814 background = 1; 815 place = 0; 816 arg[0] = (argc > 3) ? argv[2] : undef; 817 arg[1] = (argc > 4) ? argv[3] : undef; 818 arg[2] = (argc > 5) ? argv[4] : undef; 819 arg[3] = (argc > 6) ? argv[5] : undef; 820 args_nr = argc - 3; 821 } 822 else if( (argc >= 3) && (argc <= 6 ) ) // no place, no background, 0 to 4 args 823 { 824 cmd_ok = 1; 825 background = 0; 826 place = 0; 827 arg[0] = (argc > 2) ? argv[2] : undef; 828 arg[1] = (argc > 3) ? argv[3] : undef; 829 arg[2] = (argc > 4) ? argv[4] : undef; 830 arg[3] = (argc > 5) ? argv[5] : undef; 831 args_nr = argc - 2; 832 } 833 else // illegal optional arguments 834 { 835 cmd_ok = 0; 836 background = 0; 837 place = 0; 838 arg[0] = undef; 839 arg[1] = undef; 840 arg[2] = undef; 841 arg[3] = undef; 842 args_nr = 0; 843 } 844 845 // check syntax errors 846 if( cmd_ok == 0 ) 847 { 848 printf(" usage: load elf_path [-pcxy] [arg0] [arg1] [arg2] [arg3] [&]\n"); 849 850 // release semaphore to get next command 851 sem_post( &semaphore ); 852 853 return; 854 } 855 856 // get elf_path 857 strcpy( elf_path , argv[1] ); 716 858 717 859 #if DEBUG_CMD_LOAD 718 snprintf( string , 128 , "[ksh] enter %s" , __FUNCTION__); 719 display_string( string ); 720 #endif 721 722 if( (argc < 2) || (argc > 4) ) 723 { 724 printf(" usage: %s pathname [cxy] [&]\n", argv[0] ); 725 } 726 else 727 { 728 strcpy( pathname , argv[1] ); 729 730 if( argc == 2 ) 731 { 732 background = 0; 733 placement = 0; 734 cxy = 0; 735 } 736 else if( argc == 3 ) 737 { 738 if( (argv[2][0] == '&') && (argv[2][1] == 0) ) 739 { 740 background = 1; 741 placement = 0; 742 cxy = 0; 743 } 744 else 745 { 746 background = 0; 747 placement = 1; 748 cxy = atoi( argv[2] ); 749 } 750 } 751 else // argc == 4 752 { 753 background = ( (argv[3][0] == '&') && (argv[3][1] == 0) ); 754 placement = 1; 755 cxy = atoi( argv[2] ); 756 } 757 758 // get KSH process PID 759 ksh_pid = getpid(); 860 printf("\n[ksh] %s : path <%s> / place %x / args_nr %d / bg %d\n" 861 " arg0 %s / arg1 %s / arg2 %s / arg3 %s\n", 862 __FUNCTION__, elf_path , place , args_nr , background , arg[0] , arg[1] , arg[2] , arg[3] ); 863 #endif 864 865 // set NULL pointers in args[] array 866 if ( arg[0] == undef ) arg[0] = NULL; 867 else if( arg[1] == undef ) arg[1] = NULL; 868 else if( arg[2] == undef ) arg[2] = NULL; 869 else if( arg[3] == undef ) arg[3] = NULL; 870 else arg[4] = NULL; 871 872 // set target cluster if required 873 if( place ) place_fork( place & 0xFFFF ); 874 875 // KSH process fork CHILD process 876 ret_fork = fork(); 877 878 if ( ret_fork < 0 ) // it is a failure reported to KSH 879 { 880 printf(" error: ksh process unable to fork\n"); 881 } 882 else if (ret_fork == 0) // it is the CHILD process 883 { 760 884 761 885 #if DEBUG_CMD_LOAD 762 snprintf( string , 128 , "[ksh] %s : <%s> / bg %d / place %d / cxy %x", 763 __FUNCTION__, argv[1], background, placement, cxy ); 764 display_string( string ); 765 #endif 766 767 // set target cluster if required 768 if( placement ) place_fork( cxy ); 769 770 // KSH process fork CHILD process 771 ret_fork = fork(); 772 773 if ( ret_fork < 0 ) // it is a failure reported to KSH 774 { 775 printf(" error: ksh process unable to fork\n"); 776 } 777 else if (ret_fork == 0) // it is the CHILD process 778 { 886 printf("\n[ksh] %s : child (pid %x) after fork, before exec\n", 887 __FUNCTION__ , getpid() ); 888 #endif 889 890 // CHILD process exec NEW process 891 ret_exec = execve( elf_path , arg , NULL ); 779 892 780 893 #if DEBUG_CMD_LOAD 781 snprintf( string , 128 , "[ksh] %s : child (%x) after fork, before exec", 782 __FUNCTION__ , getpid() ); 783 display_string( string ); 784 #endif 785 786 // CHILD process exec NEW process 787 ret_exec = execve( pathname , NULL , NULL ); 894 printf("\n[ksh] %s : child (pid %x) after exec / ret_exec %x\n", 895 __FUNCTION__, getpid(), ret_exec ); 896 #endif 897 898 // this is only executed in case of exec failure 899 if( ret_exec ) 900 { 901 printf(" error: child process unable to exec <%s>\n", pathname ); 902 exit( 0 ); 903 } 904 } 905 else // it is the KSH process : ret_fork is the new process PID 906 { 788 907 789 908 #if DEBUG_CMD_LOAD 790 snprintf( string , 128 , "[ksh] %s : child (%x) after exec / ret_exec %x", 791 __FUNCTION__ , getpid(), ret_exec ); 792 display_string( string ); 793 #endif 794 795 // this is only executed in case of exec failure 796 if( ret_exec ) 797 { 798 printf(" error: child process unable to exec <%s>\n", pathname ); 799 exit( 0 ); 800 } 801 } 802 else // it is the KSH process : ret_fork is the new process PID 803 { 804 805 #if DEBUG_CMD_LOAD 806 snprintf( string , 128 , "[ksh] %s : ksh (%x) after fork / ret_fork %x", 807 __FUNCTION__, getpid(), ret_fork ); 808 display_string( string ); 809 #endif 810 // when the new process is launched in background, the KSH process 811 // takes the TXT ownership, and release the semaphore to get the next command. 812 // Otherwise, the child process keep the TXT ownership, and the semaphore will 813 // be released by the KSH main thread when the child process exit 814 815 if( background ) // KSH must keep TXT ownership 816 { 817 // get back the TXT ownership 818 fg( ksh_pid ); 819 820 // release semaphore to get next command 821 sem_post( &semaphore ); 822 } 909 printf("\n[ksh] %s : ksh (pid %x) after fork / ret_fork %x\n", 910 __FUNCTION__, getpid(), ret_fork ); 911 #endif 912 // when the new process is launched in background, the KSH process 913 // takes the TXT ownership, and releases the semaphore to get the next command. 914 // Otherwise, the child process keep the TXT ownership, and the semaphore will 915 // be released by the KSH main thread when the child process exit 916 917 if( background ) // KSH must keep TXT ownership 918 { 919 // KSH get back the TXT ownership 920 fg( getpid() ); 921 922 // release semaphore to get next command 923 sem_post( &semaphore ); 823 924 } 824 925 } 825 926 } // end cmd_load 826 827 /////////////////////////////////////////////828 static void cmd_log( int argc , char **argv )829 {830 unsigned int i;831 832 if (argc != 1)833 {834 printf(" usage: %s\n", argv[0], argc );835 }836 else837 {838 printf("--- registered commands ---\n");839 for (i = 0; i < LOG_DEPTH; i++)840 {841 printf(" - %d\t: %s\n", i, &log_entries[i].buf);842 }843 }844 845 // release semaphore to get next command846 sem_post( &semaphore );847 848 } // end cmd_log()849 850 927 851 928 //////////////////////////////////////////// … … 856 933 857 934 #if DEBUG_CMD_LS 858 snprintf( string , 128 , "[ksh] enter %s" , __FUNCTION__); 859 display_string( string ); 935 printf("\n[ksh] enter %s" , __FUNCTION__); 860 936 #endif 861 937 … … 876 952 877 953 #if DEBUG_CMD_LS 878 snprintf( string , 128 , "[ksh] %s : directory <%s> open / DIR %x", 879 __FUNCTION__, pathname , dir ); 880 display_string( string ); 954 printf("\n[ksh] %s : directory <%s> open / DIR %x", __FUNCTION__, pathname , dir ); 881 955 #endif 882 956 … … 899 973 900 974 #if DEBUG_CMD_LS 901 snprintf( string , 128 , "[ksh] %s : directory <%s> closed", 902 __FUNCTION__, pathname ); 903 display_string( string ); 975 printf("\n[ksh] %s : directory <%s> closed", __FUNCTION__, pathname ); 904 976 #endif 905 977 … … 964 1036 965 1037 #if DEBUG_CMD_PS 966 snprintf( string , 128 , "[ksh] enter %s" , __FUNCTION__); 967 display_string( string ); 968 #endif 969 970 if (argc != 1) 971 { 972 printf(" usage: %s\n", argv[0]); 1038 printf("\n[ksh] enter %s" , __FUNCTION__); 1039 #endif 1040 1041 if( (argc != 1) || (argv[0] == NULL) ) 1042 { 1043 printf(" usage: ps\n"); 973 1044 } 974 1045 else … … 987 1058 988 1059 #if DEBUG_CMD_PS 989 snprintf( string , 128 , "\n[ksh] %s : call display_cluster_process()", __FUNCTION__ ); 990 display_string( string ); 1060 printf("\n[ksh] %s : call display_cluster_process()", __FUNCTION__ ); 991 1061 #endif 992 1062 … … 1005 1075 static void cmd_pwd( int argc , char **argv ) 1006 1076 { 1007 if (argc != 1)1008 { 1009 printf(" usage: %s\n", argv[0]);1077 if( (argc != 1) || (argv[0] == NULL) ) 1078 { 1079 printf(" usage: pwd\n"); 1010 1080 } 1011 1081 else … … 1031 1101 if (argc != 2) 1032 1102 { 1033 printf(" usage: %s pathname\n", argv[0]);1103 printf(" usage: rm pathname\n"); 1034 1104 } 1035 1105 else … … 1056 1126 if (argc != 2) 1057 1127 { 1058 printf(" usage: %s pathname\n", argv[0]);1128 printf(" usage: stat pathname\n"); 1059 1129 } 1060 1130 else … … 1084 1154 static void cmd_rmdir( int argc , char **argv ) 1085 1155 { 1086 // same as cmd_rm() 1087 cmd_rm (argc , argv ); 1088 } 1156 if (argc != 2) 1157 { 1158 printf(" usage: rmdir pathname\n"); 1159 } 1160 else 1161 { 1162 strcpy( pathname , argv[1] ); 1163 1164 if ( unlink( pathname ) ) 1165 { 1166 printf(" error: unable to remove <%s>\n", pathname ); 1167 } 1168 } 1169 1170 // release semaphore to get next command 1171 sem_post( &semaphore ); 1172 1173 } // end cmd_rmdir() 1089 1174 1090 1175 /////////////////////////////////////////////// … … 1153 1238 { "load", "load an user application", cmd_load }, 1154 1239 { "help", "list available commands", cmd_help }, 1240 { "history", "list registered commands", cmd_history }, 1155 1241 { "kill", "kill a process (all threads)", cmd_kill }, 1156 { "log", "list registered commands", cmd_log },1157 1242 { "ls", "list directory entries", cmd_ls }, 1158 1243 { "mkdir", "create a new directory", cmd_mkdir }, … … 1179 1264 1180 1265 #if DEBUG_EXECUTE 1181 snprintf( string , 128 , "[ksh] enter %s for command <%s>" , __FUNCTION__ , buf ); 1182 display_string( string ); 1183 #endif 1184 1185 // build argc/argv 1266 printf("\n[ksh] enter %s for command <%s>" , __FUNCTION__ , buf ); 1267 #endif 1268 1269 // build argc/argv : 1270 // arg[0] is the command type 1271 // - other arg[i] are the command arguments 1272 1186 1273 for (i = 0; i < len; i++) 1187 1274 { … … 1209 1296 1210 1297 #if DEBUG_EXECUTE 1211 snprintf( string , 128 , "\n[ksh] in %s : argc = %d / arg0 = %s / arg1 = %s", 1212 __FUNCTION__ , argc , argv[0], argv[1] ); 1298 printf("\n[ksh] in %s : argc = %d / type = %s", __FUNCTION__ , argc , argv[0] ); 1213 1299 #endif 1214 1300 … … 1245 1331 unsigned int state; // escape sequence state 1246 1332 1247 char cmd[CMD_MAX_SIZE]; // buffer for one command1248 1333 1249 1334 /* direct command to help debug 1250 1335 1251 int pid = getpid(); 1252 1253 if( pid == 3 ) 1336 if( getpid() == 2 ) 1254 1337 { 1255 1338 if( sem_wait( &semaphore ) ) … … 1260 1343 else 1261 1344 { 1262 strcpy( cmd , "load bin/user/ tcp_server.elf" );1345 strcpy( cmd , "load bin/user/chat.elf 0" ); 1263 1346 printf("[ksh] %s\n", cmd ); 1264 1347 execute( cmd ); 1265 1348 } 1266 1349 } 1267 else if( getpid() == 4 ) 1350 1351 else if( getpid() == 3 ) 1268 1352 { 1269 1353 if( sem_wait( &semaphore ) ) … … 1274 1358 else 1275 1359 { 1276 strcpy( cmd , "load bin/user/ tcp_client.elf" );1360 strcpy( cmd , "load bin/user/chat.elf 1" ); 1277 1361 printf("[ksh] %s\n", cmd ); 1278 1362 execute( cmd ); … … 1281 1365 1282 1366 */ 1283 1284 1367 1285 1368 enum fsm_states … … 1318 1401 state = NORMAL; 1319 1402 end_command = 0; 1320 1321 #if DEBUG_INTER1322 snprintf( string , 128 , "[ksh] %s : request a new command", __FUNCTION__ );1323 display_string( string );1324 #endif1325 1403 1326 1404 // internal loop on characters in one command … … 1349 1427 cmd[count] = 0; 1350 1428 count++; 1351 #if DEBUG_INTER 1352 snprintf( string , 128 , "[ksh] %s : get command <%s>", __FUNCTION__, cmd ); 1353 display_string( string ); 1354 #endif 1429 1355 1430 // register command in log_entries[] array 1356 1431 strncpy( log_entries[ptw].buf , cmd , count ); … … 1359 1434 ptr = ptw; 1360 1435 1361 #if DEBUG_INTER1362 snprintf( string , 128 , "[ksh] %s : execute <%s>", __FUNCTION__, cmd );1363 display_string( string );1364 #endif1365 1436 // echo character 1366 1437 putchar( c ); … … 1479 1550 } // end internal while loop on characters 1480 1551 1481 #if DEBUG_INTER1482 snprintf( string , 128 , "\n[ksh] %s : complete <%s> command", __FUNCTION__, cmd );1483 display_string( string );1484 #endif1485 1486 1552 // block interactive thread if KSH loose TXT ownership 1487 1553 if ( sem_wait( &semaphore ) ) … … 1518 1584 1519 1585 #if DEBUG_MAIN 1520 snprintf( string , 128 , "\n[ksh] main thread started on core[%x,%d]", cxy , lid ); 1521 display_string( string ); 1586 printf("\n[ksh] main started on core[%x,%d]", cxy , lid ); 1522 1587 #endif 1523 1588 … … 1530 1595 1531 1596 #if DEBUG_MAIN 1532 snprintf( string , 128 , "\n[ksh] main initialized semaphore" ); 1533 display_string( string ); 1597 printf("\n[ksh] main initialized semaphore" ); 1534 1598 #endif 1535 1599 … … 1544 1608 NULL ); 1545 1609 #if DEBUG_MAIN 1546 snprintf( string , 128 , "\n[ksh] main thread launched interactive thread %x", trdid ); 1547 display_string( string ); 1610 printf("\n[ksh] main thread launched interactive thread %x", trdid ); 1548 1611 #endif 1549 1612
Note: See TracChangeset
for help on using the changeset viewer.