2020-02-05 21:09:39 +01:00
|
|
|
#include <lib/unistd.h>
|
|
|
|
#include <lib/display.h>
|
|
|
|
#include <builtin.h>
|
|
|
|
|
|
|
|
int builtin_proc(void)
|
|
|
|
{
|
2020-03-15 00:56:31 +01:00
|
|
|
// pid_t child;
|
2020-02-05 21:09:39 +01:00
|
|
|
|
|
|
|
// Debug
|
2020-03-15 00:56:31 +01:00
|
|
|
// dclear();
|
|
|
|
// dprint(0, 0, "Proc builtin !");
|
|
|
|
// dupdate();
|
2020-02-05 21:09:39 +01:00
|
|
|
for (int i = 0 ; i < 3000000 ; i++);
|
|
|
|
|
|
|
|
// Try to create first child
|
|
|
|
/*child = fork();
|
|
|
|
if (child == -1)
|
|
|
|
{
|
|
|
|
dprint(0, 1, "fork() fail !");
|
|
|
|
dupdate();
|
|
|
|
for (int i = 0 ; i < 3000000 ; i++);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check parent
|
|
|
|
if (child_pid != 0)
|
|
|
|
{
|
|
|
|
int counter = 0;
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
dprint(0, 1, "parent: %d", counter++);
|
|
|
|
for (int i = 0 ; i < 3000000 ; i++);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
int counter = 0;
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
dprint(0, 2, "child: %d", counter++);
|
|
|
|
for (int i = 0 ; i < 9000000 ; i++);
|
|
|
|
}
|
|
|
|
}*/
|
|
|
|
return (0);
|
|
|
|
}
|