Added comments and help commands to user apps
This commit is contained in:
5
proc.c
5
proc.c
@ -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);
|
||||
|
Reference in New Issue
Block a user