Added comments and help commands to user apps

This commit is contained in:
iDunnoDev
2023-01-13 17:37:43 +00:00
committed by iDunnoDev
parent c23d669858
commit f74cebc12d
11 changed files with 197 additions and 55 deletions

5
proc.c
View File

@ -142,6 +142,7 @@ void userinit(void) {
safestrcpy(p->name, "initcode", sizeof(p->name));
p->cwd = namei("/");
// Set the user init console to the base console
p->consoleptr = getbaseconsoleptr();
safestrcpy(p->title, "Shell (Root)", sizeof(p->title));
@ -219,6 +220,7 @@ int fork(void) {
acquire(&ptable.lock);
np->state = RUNNABLE;
// Copy the console pointer to the child
np->consoleptr = curproc->consoleptr;
release(&ptable.lock);
@ -267,11 +269,14 @@ void exit(void) {
}
}
// Check if the assigned console is not the base console
if (curproc->consoleptr != getbaseconsoleptr())
{
// If so try to close the console, this will only happen if this process is the owner for the console
closeconsole();
}
// Update the current process title for its assigned console
if (curproc->consoleptr != 0)
{
setconsoleproctitle(curproc->consoleptr, curproc->parent->name);