asterinas/regression/apps/execve/execve.c

15 lines
475 B
C
Raw Normal View History

2022-10-26 09:47:38 +00:00
#include <stdio.h>
#include <unistd.h>
int main() {
2022-11-09 07:14:12 +00:00
char* argv[] = { "argv1", "argv2", NULL };
char* envp[] = { "home=/", "version=1.1", NULL };
2023-03-07 09:13:35 +00:00
// The hello will be put at /execve/hello in InitRamfs
printf("Execve a new file /execve/hello:\n");
// flush the stdout content to ensure the content print to console
2022-10-26 09:47:38 +00:00
fflush(stdout);
2023-07-05 06:08:58 +00:00
execve("/regression/execve/hello", argv, envp);
2022-10-26 09:47:38 +00:00
printf("Should not print\n");
fflush(stdout);
2022-10-26 09:47:38 +00:00
return 0;
}