occlum/test/spawn_and_wait4_raw/main.c
2019-02-16 16:23:30 +08:00

29 lines
682 B
C

#include "rusgx_stub.h"
static char success_str_buf[] = "A child process starts and exits!\n";
static unsigned long success_str_size = sizeof(success_str_buf);
static void print_ok(void) {
__rusgx_write(1, success_str_buf, success_str_size);
}
#define NUM_CHILDREN 10
void _start(void) {
for (int ci = 0; ci < NUM_CHILDREN; ci++) {
int ret = 0;
int pid = 0;
ret = __rusgx_spawn(&pid, "hello_world_raw/bin.encrypted", NULL, NULL);
if (ret < 0) { __rusgx_exit(0); }
int status;
ret = __rusgx_wait4(pid, &status, 0);
if (ret < 0) { __rusgx_exit(0); }
//print_ok();
}
__rusgx_exit(0);
}