I'm working in a Unix-Like Kernel called Minix 3.
I am having some trouble creating a function within the kernel that will allow me to output the number of processes being run. This is my code I have so far:
PUBLIC void numproc_dmp()
{
printf("Number of Processes Running");
echo ps -ax | wc -l
}
What this function is supposed to do is when F8 is pressed it will show the amount of processes running.
The command ps -ax | wc -l
works fine when entered into the CLI interface and shows the number of processes but I have no idea how to implement it into the function as it won't execute.
The error I receive is that "the identifier is not expected".
EDIT:
I am still struggling... After trying a new method i got rid of the errors but no output...
PUBLIC void numproc_dmp()
{
printf("Number of Processes Running");
popen("ps -ax | wc -l", "r");
printf("%s", popen("ps -ax | wc -l", "r"));
}