2020-03-30 00:40:59 +02:00
|
|
|
#include <unistd.h>
|
|
|
|
#include <stdio.h>
|
2020-04-19 14:16:29 +02:00
|
|
|
#include <sys/wait.h>
|
2020-03-30 00:40:59 +02:00
|
|
|
#include "builtin.h"
|
2020-02-05 21:09:39 +01:00
|
|
|
|
|
|
|
int builtin_proc(void)
|
|
|
|
{
|
2020-03-30 00:40:59 +02:00
|
|
|
char *argv[2] = {"test", NULL};
|
2020-03-20 22:47:05 +01:00
|
|
|
pid_t child;
|
|
|
|
int wstatus;
|
2020-02-05 21:09:39 +01:00
|
|
|
|
2020-03-30 00:40:59 +02:00
|
|
|
//puts("proc test entry :)\n");
|
|
|
|
//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-30 00:40:59 +02:00
|
|
|
child = fexecve("/mnt/casio/VHEX/test.elf", argv, NULL);
|
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-30 00:40:59 +02:00
|
|
|
waitpid(child, &wstatus, 0);
|
2020-03-23 15:58:48 +01:00
|
|
|
printf("+++ exited with %d +++\n", WEXITSTATUS(wstatus));
|
|
|
|
return (0);
|
2020-02-05 21:09:39 +01:00
|
|
|
}
|