banan-os/userspace/tests/test-fork/main.cpp

23 lines
355 B
C++
Raw Permalink Normal View History

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
2023-05-28 18:08:26 +03:00
#include <unistd.h>
#define ERROR(msg) { perror(msg); return 1; }
#define BUF_SIZE 1024
int main()
{
printf("userspace\n");
2023-05-31 20:57:33 +03:00
if (fork() == 0)
{
2023-05-31 22:36:26 +03:00
execl("/usr/bin/cat", "/usr/bin/cat", "/usr/include/kernel/kprint.h", NULL);
2023-05-31 20:57:33 +03:00
ERROR("execl");
2023-05-28 18:08:26 +03:00
return 0;
}
2023-05-31 20:57:33 +03:00
printf("parent\n");
return 0;
}