Changes in kernel/generic/src/console/cmd.c [40fb017:96b02eb9] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/console/cmd.c
r40fb017 r96b02eb9 78 78 static cmd_info_t help_info = { 79 79 .name = "help", 80 .description = "List supported commands.",80 .description = "List of supported commands.", 81 81 .func = cmd_help, 82 82 .argc = 0 83 83 }; 84 84 85 /* Data and methods for 'reboot' command. */86 85 static int cmd_reboot(cmd_arg_t *argv); 87 86 static cmd_info_t reboot_info = { 88 87 .name = "reboot", 89 .description = "Reboot system.",88 .description = "Reboot.", 90 89 .func = cmd_reboot, 91 90 .argc = 0 92 91 }; 93 92 94 /* Data and methods for 'uptime' command. */95 93 static int cmd_uptime(cmd_arg_t *argv); 96 94 static cmd_info_t uptime_info = { 97 95 .name = "uptime", 98 .description = " Show system uptime.",96 .description = "Print uptime information.", 99 97 .func = cmd_uptime, 100 98 .argc = 0 101 99 }; 102 100 103 /* Data and methods for 'continue' command. */104 101 static int cmd_continue(cmd_arg_t *argv); 105 102 static cmd_info_t continue_info = { … … 111 108 112 109 #ifdef CONFIG_TEST 113 114 /* Data and methods for 'test' command. */115 110 static char test_buf[MAX_CMDLINE + 1]; 116 111 static int cmd_test(cmd_arg_t *argv); … … 124 119 static cmd_info_t test_info = { 125 120 .name = "test", 126 .description = " <test> Listkernel tests or run a test.",121 .description = "Print list of kernel tests or run a test.", 127 122 .func = cmd_test, 128 123 .argc = 1, … … 130 125 }; 131 126 132 /* Data and methods for 'bench' command. */133 127 static int cmd_bench(cmd_arg_t *argv); 134 128 static cmd_arg_t bench_argv[] = { … … 144 138 static cmd_info_t bench_info = { 145 139 .name = "bench", 146 .description = " <test> <count>Run kernel test as benchmark.",140 .description = "Run kernel test as benchmark.", 147 141 .func = cmd_bench, 148 142 .argc = 2, 149 143 .argv = bench_argv 150 144 }; 151 152 #endif /* CONFIG_TEST */ 145 #endif 153 146 154 147 /* Data and methods for 'description' command. */ 155 148 static int cmd_desc(cmd_arg_t *argv); 156 149 static void desc_help(void); 157 static char desc_buf[MAX_CMDLINE +1];150 static char desc_buf[MAX_CMDLINE+1]; 158 151 static cmd_arg_t desc_argv = { 159 152 .type = ARG_TYPE_STRING, … … 163 156 static cmd_info_t desc_info = { 164 157 .name = "describe", 165 .description = " <command>Describe specified command.",158 .description = "Describe specified command.", 166 159 .help = desc_help, 167 160 .func = cmd_desc, … … 172 165 /* Data and methods for 'symaddr' command. */ 173 166 static int cmd_symaddr(cmd_arg_t *argv); 174 static char symaddr_buf[MAX_CMDLINE +1];167 static char symaddr_buf[MAX_CMDLINE+1]; 175 168 static cmd_arg_t symaddr_argv = { 176 169 .type = ARG_TYPE_STRING, … … 180 173 static cmd_info_t symaddr_info = { 181 174 .name = "symaddr", 182 .description = " <symbol>Return symbol address.",175 .description = "Return symbol address.", 183 176 .func = cmd_symaddr, 184 177 .argc = 1, … … 186 179 }; 187 180 188 /* Data and methods for 'set4' command. */ 189 static char set_buf[MAX_CMDLINE + 1]; 181 static char set_buf[MAX_CMDLINE+1]; 190 182 static int cmd_set4(cmd_arg_t *argv); 191 183 static cmd_arg_t set4_argv[] = { … … 201 193 static cmd_info_t set4_info = { 202 194 .name = "set4", 203 .description = " <addr> <value> Set 4B memory location to a value.",195 .description = "set <dest_addr> <value> - 4byte version", 204 196 .func = cmd_set4, 205 197 .argc = 2, … … 221 213 static cmd_info_t call0_info = { 222 214 .name = "call0", 223 .description = " <function> Call function().",215 .description = "call0 <function> -> call function().", 224 216 .func = cmd_call0, 225 217 .argc = 1, … … 236 228 static cmd_info_t mcall0_info = { 237 229 .name = "mcall0", 238 .description = " <function> Call function() on each CPU.",230 .description = "mcall0 <function> -> call function() on each CPU.", 239 231 .func = cmd_mcall0, 240 232 .argc = 1, … … 258 250 static cmd_info_t call1_info = { 259 251 .name = "call1", 260 .description = " <function> <arg1> Call function(arg1).",252 .description = "call1 <function> <arg1> -> call function(arg1).", 261 253 .func = cmd_call1, 262 254 .argc = 2, … … 285 277 static cmd_info_t call2_info = { 286 278 .name = "call2", 287 .description = " <function> <arg1> <arg2> Call function(arg1,arg2).",279 .description = "call2 <function> <arg1> <arg2> -> call function(arg1,arg2).", 288 280 .func = cmd_call2, 289 281 .argc = 3, … … 318 310 static cmd_info_t call3_info = { 319 311 .name = "call3", 320 .description = " <function> <arg1> <arg2> <arg3> Call function(arg1, arg2,arg3).",312 .description = "call3 <function> <arg1> <arg2> <arg3> -> call function(arg1,arg2,arg3).", 321 313 .func = cmd_call3, 322 314 .argc = 4, … … 348 340 cmd_info_t tlb_info = { 349 341 .name = "tlb", 350 .description = "Print TLB of the current CPU.",342 .description = "Print TLB of current processor.", 351 343 .help = NULL, 352 344 .func = cmd_tlb, … … 385 377 }; 386 378 387 #ifdef CONFIG_UDEBUG388 389 /* Data and methods for 'btrace' command */390 static int cmd_btrace(cmd_arg_t *argv);391 static cmd_arg_t btrace_argv = {392 .type = ARG_TYPE_INT,393 };394 static cmd_info_t btrace_info = {395 .name = "btrace",396 .description = "<threadid> Show thread stack trace.",397 .func = cmd_btrace,398 .argc = 1,399 .argv = &btrace_argv400 };401 402 #endif /* CONFIG_UDEBUG */403 379 404 380 static int cmd_sched(cmd_arg_t *argv); 405 381 static cmd_info_t sched_info = { 406 382 .name = "scheduler", 407 .description = " Showscheduler information.",383 .description = "List all scheduler information.", 408 384 .func = cmd_sched, 409 385 .argc = 0 … … 430 406 static cmd_info_t zones_info = { 431 407 .name = "zones", 432 .description = "List memory zones.",408 .description = "List of memory zones.", 433 409 .func = cmd_zones, 434 410 .argc = 0 411 }; 412 413 /* Data and methods for 'ipc' command */ 414 static int cmd_ipc(cmd_arg_t *argv); 415 static cmd_arg_t ipc_argv = { 416 .type = ARG_TYPE_INT, 417 }; 418 static cmd_info_t ipc_info = { 419 .name = "ipc", 420 .description = "ipc <taskid> Show IPC information of given task.", 421 .func = cmd_ipc, 422 .argc = 1, 423 .argv = &ipc_argv 424 }; 425 426 /* Data and methods for 'kill' command */ 427 static int cmd_kill(cmd_arg_t *argv); 428 static cmd_arg_t kill_argv = { 429 .type = ARG_TYPE_INT, 430 }; 431 static cmd_info_t kill_info = { 432 .name = "kill", 433 .description = "kill <taskid> Kill a task.", 434 .func = cmd_kill, 435 .argc = 1, 436 .argv = &kill_argv 435 437 }; 436 438 … … 443 445 static cmd_info_t zone_info = { 444 446 .name = "zone", 445 .description = " <zone>Show memory zone structure.",447 .description = "Show memory zone structure.", 446 448 .func = cmd_zone, 447 449 .argc = 1, 448 450 .argv = &zone_argv 449 };450 451 /* Data and methods for 'ipc' command */452 static int cmd_ipc(cmd_arg_t *argv);453 static cmd_arg_t ipc_argv = {454 .type = ARG_TYPE_INT,455 };456 static cmd_info_t ipc_info = {457 .name = "ipc",458 .description = "<taskid> Show IPC information of a task.",459 .func = cmd_ipc,460 .argc = 1,461 .argv = &ipc_argv462 };463 464 /* Data and methods for 'kill' command */465 static int cmd_kill(cmd_arg_t *argv);466 static cmd_arg_t kill_argv = {467 .type = ARG_TYPE_INT,468 };469 static cmd_info_t kill_info = {470 .name = "kill",471 .description = "<taskid> Kill a task.",472 .func = cmd_kill,473 .argc = 1,474 .argv = &kill_argv475 451 }; 476 452 … … 506 482 &cpus_info, 507 483 &desc_info, 484 &reboot_info, 485 &uptime_info, 508 486 &halt_info, 509 487 &help_info, 510 488 &ipc_info, 511 489 &kill_info, 512 &physmem_info,513 &reboot_info,514 &sched_info,515 490 &set4_info, 516 491 &slabs_info, 492 &sysinfo_info, 517 493 &symaddr_info, 518 &sysinfo_info, 494 &sched_info, 495 &threads_info, 519 496 &tasks_info, 520 & threads_info,497 &physmem_info, 521 498 &tlb_info, 522 &uptime_info,523 499 &version_info, 524 500 &zones_info, … … 528 504 &bench_info, 529 505 #endif 530 #ifdef CONFIG_UDEBUG531 &btrace_info,532 #endif533 506 NULL 534 507 }; … … 553 526 for (i = 0; basic_commands[i]; i++) { 554 527 cmd_initialize(basic_commands[i]); 555 } 556 557 for (i = 0; basic_commands[i]; i++) { 558 if (!cmd_register(basic_commands[i])) { 559 printf("Cannot register command %s\n", 560 basic_commands[i]->name); 561 } 562 } 563 } 528 if (!cmd_register(basic_commands[i])) 529 printf("Cannot register command %s\n", basic_commands[i]->name); 530 } 531 } 532 564 533 565 534 /** List supported commands. … … 605 574 } 606 575 576 607 577 /** Reboot the system. 608 578 * … … 618 588 return 1; 619 589 } 590 620 591 621 592 /** Print system uptime information. … … 853 824 } 854 825 826 855 827 /** Print detailed description of 'describe' command. */ 856 828 void desc_help(void) … … 939 911 * @return Always 1 940 912 */ 941 int cmd_slabs(cmd_arg_t * argv)913 int cmd_slabs(cmd_arg_t * argv) 942 914 { 943 915 slab_print_list(); … … 951 923 * @return Always 1 952 924 */ 953 int cmd_sysinfo(cmd_arg_t * argv)925 int cmd_sysinfo(cmd_arg_t * argv) 954 926 { 955 927 sysinfo_dump(NULL); … … 957 929 } 958 930 959 /** Command for listing thread information 931 932 /** Command for listings Thread information 960 933 * 961 934 * @param argv Ignored … … 975 948 } 976 949 977 /** Command for listing task information950 /** Command for listings Task information 978 951 * 979 952 * @param argv Ignored … … 993 966 } 994 967 995 #ifdef CONFIG_UDEBUG 996 997 /** Command for printing thread stack trace 968 /** Command for listings Thread information 969 * 970 * @param argv Ignores 971 * 972 * @return Always 1 973 */ 974 int cmd_sched(cmd_arg_t * argv) 975 { 976 sched_print_list(); 977 return 1; 978 } 979 980 /** Command for listing memory zones 981 * 982 * @param argv Ignored 983 * 984 * return Always 1 985 */ 986 int cmd_zones(cmd_arg_t * argv) 987 { 988 zones_print_list(); 989 return 1; 990 } 991 992 /** Command for memory zone details 998 993 * 999 994 * @param argv Integer argument from cmdline expected 1000 995 * 1001 996 * return Always 1 1002 * 1003 */ 1004 int cmd_btrace(cmd_arg_t *argv) 1005 { 1006 thread_stack_trace(argv[0].intval); 1007 return 1; 1008 } 1009 1010 #endif /* CONFIG_UDEBUG */ 1011 1012 /** Command for printing scheduler information 1013 * 1014 * @param argv Ignores 1015 * 1016 * @return Always 1 1017 */ 1018 int cmd_sched(cmd_arg_t *argv) 1019 { 1020 sched_print_list(); 1021 return 1; 1022 } 1023 1024 /** Command for listing memory zones 1025 * 1026 * @param argv Ignored 997 */ 998 int cmd_zone(cmd_arg_t * argv) 999 { 1000 zone_print_one(argv[0].intval); 1001 return 1; 1002 } 1003 1004 /** Command for printing task ipc details 1005 * 1006 * @param argv Integer argument from cmdline expected 1027 1007 * 1028 1008 * return Always 1 1029 1009 */ 1030 int cmd_ zones(cmd_arg_t *argv)1031 { 1032 zones_print_list();1033 return 1; 1034 } 1035 1036 /** Command for memory zone details1010 int cmd_ipc(cmd_arg_t * argv) 1011 { 1012 ipc_print_task(argv[0].intval); 1013 return 1; 1014 } 1015 1016 /** Command for killing a task 1037 1017 * 1038 1018 * @param argv Integer argument from cmdline expected 1039 1019 * 1040 * return Always 11041 */1042 int cmd_zone(cmd_arg_t *argv)1043 {1044 zone_print_one(argv[0].intval);1045 return 1;1046 }1047 1048 /** Command for printing task IPC details1049 *1050 * @param argv Integer argument from cmdline expected1051 *1052 * return Always 11053 */1054 int cmd_ipc(cmd_arg_t *argv)1055 {1056 ipc_print_task(argv[0].intval);1057 return 1;1058 }1059 1060 /** Command for killing a task1061 *1062 * @param argv Integer argument from cmdline expected1063 *1064 1020 * return 0 on failure, 1 on success. 1065 1021 */ 1066 int cmd_kill(cmd_arg_t * argv)1022 int cmd_kill(cmd_arg_t * argv) 1067 1023 { 1068 1024 if (task_kill(argv[0].intval) != EOK)
Note:
See TracChangeset
for help on using the changeset viewer.