void exception_handler(int exception_num) { if (exception_num < 32) { printfcolor(ERROR_COLOR, "%s exception!\n", exception_messages[exception_num]); } Task_t * exceptionProducer = (Task_t *) get_current_task(); char * exceptionProducerName = exceptionProducer->name; printf("Exception producer %s\n", exceptionProducer->name); if (nestexc > MAX_NESTED_EXCEPTIONS) { kprintf("PANIC"); printfcolor(ERROR_COLOR, "PANIC: Exception could not be solved!\n\tSystem failure, please reboot.\n"); _debug(); } nestexc++; // EOI(); if (terminate_task(exceptionProducer->pid) == EXIT_SUCCESS) { nestexc--; yield(); // printfcolor(COMMAND_COLOR, "Failure tolerant module: Process \"%s\" has been killed.\n", exceptionProducerName); }else{ kprintf("PANIC 2"); printfcolor(ERROR_COLOR, "PANIC 2: Exception could not be solved!\n\tSystem failure, please reboot.\n"); // _debug(); } }
int help(int argc, char *argv){ int i; printfcolor(MARINE_COLOR,"********************************************************************************\n"); printfcolor(COMMAND_COLOR,"Available commands: \n\n"); int len = 0; for (i = 0; i < NUM_COMMANDS; i++){ len = strlen(commands[i].name)/4; printfcolor(ERROR_COLOR,"%s", commands[i].name); if(len < 1) printfcolor(MARINE_COLOR,"\t\t\t"); else if(len < 2) printfcolor(MARINE_COLOR,"\t\t"); else if(len < 3) printfcolor(MARINE_COLOR,"\t"); printfcolor(MARINE_COLOR," => \t"); printfcolor(COMMAND_COLOR,"%s\n", commands[i].description); } printfcolor(MARINE_COLOR,"\n********************************************************************************\n"); return EXIT_SUCCESS; }
int pkill(int argc, char *argv){ atomize(); int pid = atoi(argv); if(terminate_task(pid) == EXIT_SUCCESS) { printfcolor(COMMAND_COLOR, "PID: %d has been successfully killed.\n", pid); } else { printfcolor(ERROR_COLOR, "PID: %d could not be killed.\n", pid); } unatomize(); return EXIT_SUCCESS; }
void Affiche_Alien_1(BYTE color) { BYTE prevColor = getColor(); setColor(color); printfcolor(" .-''''-."); printfcolor(" / \\"); printfcolor(" /_ _\\"); printfcolor(" // \\ / \\\\"); printfcolor(" |\\__\\ /__/|"); printfcolor(" \\ || /"); printfcolor(" \\ /"); printfcolor(" \\ __ /"); printfcolor(" '.__.'"); printfcolor(" | |"); setColor(prevColor); }
int run_command(command_t * command){ int i; if(streq(command->name, "")) return 0; int len = strlen(command->name); bool isBackground = (command->name[len-1] == '&')? true:false; if(isBackground) { command->name[len-1] = '\0'; } for (i = 0; i < NUM_COMMANDS; i++) { if (streq(command->name, commands[i].name)) { StartNewTask(commands[i].name, commands[i].task_function, command->args, isBackground); return 1; } } printfcolor(ERROR_COLOR ,"%s: command not found\n", command->name); clearCommand(command); return 1; }
int mouse(int argc, char *argv){ printfcolor(MARINE_COLOR,"********************************************************************************\n"); printfcolor(COMMAND_COLOR,"Mouse usage: \n\n"); printfcolor(ERROR_COLOR,"%s", commands[0].name); printfcolor(ERROR_COLOR,"Left Click"); printfcolor(MARINE_COLOR,"\t\t => \t"); printfcolor(COMMAND_COLOR,"Increments the timer tick frecuency\n"); printfcolor(ERROR_COLOR,"Right Click"); printfcolor(MARINE_COLOR,"\t\t => \t"); printfcolor(COMMAND_COLOR,"Decrements the timer tick frecuency\n"); printfcolor(MARINE_COLOR,"\n********************************************************************************\n"); return EXIT_SUCCESS; }
int top(int argc, char *argv){ Task_t* processes = get_processes(); int i; printfcolor(MARINE_COLOR,"********************************************************************************\n"); printfcolor(COMMAND_COLOR, "PID\t\t\tName\t\t\t\tStatus\t\t\tPriority\n\n"); for(i = 0; i<MAX_PROCESSES; i++) { if(processes[i].state != TaskEmpty) { printfcolor(((processes[i].state == TaskReady)?COMMAND_COLOR: (processes[i].state == TaskTerminated)?ERROR_COLOR:MARINE_COLOR), "%d\t\t\t%s\t\t\t\t%s\t\t\t%d\n", processes[i].pid, processes[i].name, ((processes[i].state == TaskReady)?"Ready": (processes[i].state == TaskTerminated)?"Terminated":"Suspended"), processes[i].priority); } } printfcolor(MARINE_COLOR,"\n********************************************************************************\n"); return EXIT_SUCCESS; }
void copyright() { BYTE prevColor = getColor(); setColor(ROUGE); printfcolor("Ceci est un os GPL v.2"); setColor(prevColor); }
int shortcuts(int argc, char *argv){ printfcolor(MARINE_COLOR,"********************************************************************************\n"); printfcolor(COMMAND_COLOR,"Keyboard shortcuts: \n\n"); printfcolor(ERROR_COLOR,"F1"); printfcolor(MARINE_COLOR,"\t\t\t\t => \t"); printfcolor(COMMAND_COLOR,"Goes to TTY #1\n"); printfcolor(ERROR_COLOR,"F2"); printfcolor(MARINE_COLOR,"\t\t\t\t => \t"); printfcolor(COMMAND_COLOR,"Goes to TTY #2\n"); printfcolor(ERROR_COLOR,"F3"); printfcolor(MARINE_COLOR,"\t\t\t\t => \t"); printfcolor(COMMAND_COLOR,"Goes to TTY #3\n"); printfcolor(ERROR_COLOR,"F4"); printfcolor(MARINE_COLOR,"\t\t\t\t => \t"); printfcolor(COMMAND_COLOR,"Goes to TTY #4\n"); printfcolor(ERROR_COLOR,"text + TAB"); printfcolor(MARINE_COLOR,"\t\t => \t"); printfcolor(COMMAND_COLOR,"Autocomplete command\n"); printfcolor(ERROR_COLOR,"CTRL + SHIFT"); printfcolor(MARINE_COLOR,"\t => \t"); printfcolor(COMMAND_COLOR,"Change keyboard language (ES | EN)\n"); printfcolor(MARINE_COLOR,"\n********************************************************************************\n"); return EXIT_SUCCESS; }
int echo(int argc, char *argv){ printfcolor(COMMAND_COLOR, "%s\n", argv); return EXIT_SUCCESS; }