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

View File

@ -92,9 +92,10 @@ int sys_uptime(void)
return xticks;
}
// System call i used to debug and test the consoles, it returns useful information in relation to the current console/process
int sys_greeting(void)
{
cprintf("Hello again\n");
cprintf("Hello! here is the info you requested...\n");
cprintf("Using Console: %d\n", getcurrentconsoleindex());
cprintf("Current PID: %d\n", myproc()->pid);
cprintf("Current Parent PID: %d\n", myproc()->parent->pid);
@ -102,6 +103,7 @@ int sys_greeting(void)
return 0;
}
// System call to shutdown or restart the OS
int sys_shutdown(void)
{
int restart;
@ -125,6 +127,7 @@ int sys_shutdown(void)
return 0;
}
// System call for handling the new screen user app
int sys_screen(void)
{
struct proc *curproc = myproc();
@ -133,25 +136,34 @@ int sys_screen(void)
int bgcol;
char *title;
// Get the background color value
if (argint(1, &bgcol) < 0)
{
return -1;
}
// Get the title arg value
if (argstr(0, &title) < 0)
{
return -1;
}
// Try to setup an unused console from the pool
if ((consoleptr = newconsole(title, bgcol)) != 0)
{
// New console was successful, set the pointer and switch to it
curproc->consoleptr = consoleptr;
switchtoconsole(consoleptr);
result = 1;
}
else
{
cprintf("screen: failed to create a new console\n");
}
return result;
}
// System call to clear the screen
int sys_cls(void)
{
clearscreen(0);