X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FKernel%2Fsystem.c;h=748c744f0c0abf0a2e3330fb1d823b7df4b664fe;hb=3c283c4831c40c14d308a54cefb997832a860bca;hp=db7da340ed79265e63bb29ffe67d336fcb3ab5b0;hpb=cb414d6f5f9730d64b4914e45c14d9c16aea0b6c;p=tpg%2Facess2.git diff --git a/KernelLand/Kernel/system.c b/KernelLand/Kernel/system.c index db7da340..748c744f 100644 --- a/KernelLand/Kernel/system.c +++ b/KernelLand/Kernel/system.c @@ -4,7 +4,7 @@ * system.c * - Architecture Independent System Init */ -#define DEBUG 0 +#define DEBUG 1 #include #include @@ -48,13 +48,25 @@ void System_Init(char *CommandLine) if(Proc_Clone(CLONE_VM|CLONE_NOUSER) == 0) { const char *args[] = {gsInitBinary, 0}; + VFS_Open("/Devices/pts/vt0", VFS_OPENFLAG_READ|VFS_OPENFLAG_USER); // 0: stdin + VFS_Open("/Devices/pts/vt0", VFS_OPENFLAG_WRITE|VFS_OPENFLAG_USER); // 1: stdout + VFS_DuplicateFD(1, 2); // 2: stderr Proc_Execve(gsInitBinary, args, &args[1], 0); Log_KernelPanic("System", "Unable to spawn init '%s'", gsInitBinary); } // Set the debug to be echoed to the terminal Log_Log("Config", "Kernel now echoes to VT7 (Ctrl-Alt-F8)"); - Debug_SetKTerminal("/Devices/VTerm/7"); + Debug_SetKTerminal("/Devices/pts/vt7"); + + // Run a thread to reap unowned threads + for( ;; ) + { + int status; + // TODO: Inform init when a thread dies + int tid = Threads_WaitTID(-1, &status); + Log_Debug("Thread0", "Thread %i exited with status %i", tid, status); + } } /** @@ -75,7 +87,10 @@ void System_ParseCommandLine(char *ArgString) // Eat Whitespace while(*str == ' ') str++; // Check for the end of the string - if(*str == '\0') { argc--; break;} + if(*str == '\0') { + argc--; + break; + } argv[argc] = str; if(*str == '"') { while(*str && !(*str == '"' && str[-1] != '\\')) @@ -162,7 +177,7 @@ void System_ParseVFS(char *Arg) // - Symbolic Link = if(value[0] == '/') { - Log_Log("Config", "Symbolic link '%s' pointing to '%s'", Arg, value); +// Log_Log("Config", "Symbolic link '%s' pointing to '%s'", Arg, value); VFS_Symlink(Arg, value); } // - Mount =: @@ -177,13 +192,13 @@ void System_ParseVFS(char *Arg) } // Create Mountpoint if( (fd = VFS_Open(Arg, 0)) == -1 ) { - Log_Log("Config", "Creating directory '%s'", Arg, value); +// Log_Log("Config", "Creating directory '%s'", Arg, value); VFS_MkDir( Arg ); } else { VFS_Close(fd); } // Mount - Log_Log("Config", "Mounting '%s' to '%s' ('%s')", dev, Arg, value); +// Log_Log("Config", "Mounting '%s' to '%s' ('%s')", dev, Arg, value); VFS_Mount(dev, Arg, value, ""); } }