From bf52b10ac85bd0378ab48a5e5b34c2d73e017449 Mon Sep 17 00:00:00 2001 From: Baptiste Wicht Date: Mon, 27 Jan 2014 23:01:02 +0100 Subject: [PATCH] Allow to launch several programs in parallel --- kernel/src/shell.cpp | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/kernel/src/shell.cpp b/kernel/src/shell.cpp index f4164a87..babe7629 100644 --- a/kernel/src/shell.cpp +++ b/kernel/src/shell.cpp @@ -865,22 +865,8 @@ bool create_paging(char* buffer, scheduler::process_t& process){ return true; } -void exec_command(const std::vector& params){ - if(params.size() < 2){ - k_print_line("exec: Need the name of the executable to read"); - - return; - } - - if(!disks::mounted_partition() || !disks::mounted_disk()){ - k_print_line("Nothing is mounted"); - - return; - } - - scheduler::init(); - - auto content = read_elf_file(params[1], "exec"); +void queue_process(const std::string& file){ + auto content = read_elf_file(file, "exec"); if(!content){ return; @@ -904,6 +890,26 @@ void exec_command(const std::vector& params){ process.regs.rflags = 0x200; scheduler::queue_process(std::move(process)); +} + +void exec_command(const std::vector& params){ + if(params.size() < 2){ + k_print_line("exec: Need the name of the executable to read"); + + return; + } + + if(!disks::mounted_partition() || !disks::mounted_disk()){ + k_print_line("Nothing is mounted"); + + return; + } + + scheduler::init(); + + for(size_t i = 1; i < params.size(); ++i){ + queue_process(params[i]); + } scheduler::start(); }