2020-02-05 21:09:39 +01:00
|
|
|
#include <lib/unistd.h>
|
|
|
|
#include <lib/display.h>
|
2020-03-20 22:47:05 +01:00
|
|
|
#include <lib/stdio.h>
|
2020-02-05 21:09:39 +01:00
|
|
|
#include <builtin.h>
|
|
|
|
|
|
|
|
int builtin_proc(void)
|
|
|
|
{
|
2020-03-20 22:47:05 +01:00
|
|
|
pid_t child;
|
|
|
|
int wstatus;
|
2020-02-05 21:09:39 +01:00
|
|
|
|
2020-03-20 22:47:05 +01:00
|
|
|
puts("proc test entry :)\n");
|
2020-03-23 15:58:48 +01:00
|
|
|
printf(" PPID PID PGID\n");
|
|
|
|
printf("%-6d%-6d%-6d\n", getppid(), getpid(), getpgid());
|
2020-02-05 21:09:39 +01:00
|
|
|
|
|
|
|
// Try to create first child
|
2020-03-23 15:58:48 +01:00
|
|
|
child = fexecve("/mnt/casio/VHEX/test.elf");
|
2020-02-05 21:09:39 +01:00
|
|
|
if (child == -1)
|
|
|
|
{
|
2020-03-23 15:58:48 +01:00
|
|
|
printf("fexecve fail :(\n");
|
2020-02-05 21:09:39 +01:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2020-03-20 22:47:05 +01:00
|
|
|
// Wait child death
|
2020-03-23 15:58:48 +01:00
|
|
|
waitpid(-1, &wstatus, 0);
|
|
|
|
printf("+++ exited with %d +++\n", WEXITSTATUS(wstatus));
|
|
|
|
return (0);
|
2020-02-05 21:09:39 +01:00
|
|
|
}
|