X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FApplications%2Finit_src%2Fmain.c;h=c1423315ae506a4813d9ef711696baa6b0b2ab38;hb=47e9dfd89189fc6b150bd6b20229cb047c7e0858;hp=3473eb51dad431afbc258f3e1d083b252554172c;hpb=04b368645c34cc3853fc13f93e33ac7878be8479;p=tpg%2Facess2.git diff --git a/Usermode/Applications/init_src/main.c b/Usermode/Applications/init_src/main.c index 3473eb51..c1423315 100644 --- a/Usermode/Applications/init_src/main.c +++ b/Usermode/Applications/init_src/main.c @@ -5,7 +5,7 @@ // === CONSTANTS === #define NULL ((void*)0) -#define NUM_TERMS 4 +#define NUM_TERMS 1 #define DEFAULT_TERMINAL "/Devices/VTerm/0" #define DEFAULT_SHELL "/Acess/SBin/login" @@ -17,24 +17,28 @@ int main(int argc, char *argv[]) { int tid; - // int i; - char termpath[sizeof(DEFAULT_TERMINAL)+1] = DEFAULT_TERMINAL; + int i; + char termpath[sizeof(DEFAULT_TERMINAL)] = DEFAULT_TERMINAL; + char *child_argv[2] = {DEFAULT_SHELL, 0}; - //for( i = 0; i < NUM_TERMS; i++ ) - //{ - //termpath[ sizeof(DEFAULT_TERMINAL)-1 ] = '0' + i; - open(termpath, OPENFLAG_READ); // Stdin - open(termpath, OPENFLAG_WRITE); // Stdout - open(termpath, OPENFLAG_WRITE); // Stderr - + for( i = 0; i < NUM_TERMS; i++ ) + { tid = clone(CLONE_VM, 0); if(tid == 0) { - execve(DEFAULT_SHELL, NULL, NULL); - for(;;) __asm__ __volatile__("hlt"); + termpath[sizeof(DEFAULT_TERMINAL)-2] = '0' + i; + + //__asm__ __volatile__ ("int $0xAC" :: "a" (256), "b" ("%s"), "c" (termpath)); + + open(termpath, OPENFLAG_READ); // Stdin + open(termpath, OPENFLAG_WRITE); // Stdout + open(termpath, OPENFLAG_WRITE); // Stderr + execve(DEFAULT_SHELL, child_argv, NULL); + for(;;) sleep(); } - //} + } + // TODO: Implement message watching for(;;) sleep(); return 42;