|
|
@ -273,6 +273,52 @@ sandbox_initialize_io_handles_and_file_descriptors(struct sandbox *sandbox)
|
|
|
|
assert(f == 2);
|
|
|
|
assert(f == 2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char *
|
|
|
|
|
|
|
|
sandbox_state_stringify(sandbox_state_t state)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
switch (state) {
|
|
|
|
|
|
|
|
case SANDBOX_UNINITIALIZED:
|
|
|
|
|
|
|
|
return "Uninitialized";
|
|
|
|
|
|
|
|
case SANDBOX_ALLOCATED:
|
|
|
|
|
|
|
|
return "Allocated";
|
|
|
|
|
|
|
|
case SANDBOX_SET_AS_INITIALIZED:
|
|
|
|
|
|
|
|
return "Set As Initialized";
|
|
|
|
|
|
|
|
case SANDBOX_INITIALIZED:
|
|
|
|
|
|
|
|
return "Initialized";
|
|
|
|
|
|
|
|
case SANDBOX_SET_AS_RUNNABLE:
|
|
|
|
|
|
|
|
return "Set As Runnable";
|
|
|
|
|
|
|
|
case SANDBOX_RUNNABLE:
|
|
|
|
|
|
|
|
return "Runnable";
|
|
|
|
|
|
|
|
case SANDBOX_SET_AS_RUNNING:
|
|
|
|
|
|
|
|
return "Set As Running";
|
|
|
|
|
|
|
|
case SANDBOX_RUNNING:
|
|
|
|
|
|
|
|
return "Running";
|
|
|
|
|
|
|
|
case SANDBOX_SET_AS_PREEMPTED:
|
|
|
|
|
|
|
|
return "Set As Preempted";
|
|
|
|
|
|
|
|
case SANDBOX_PREEMPTED:
|
|
|
|
|
|
|
|
return "Preempted";
|
|
|
|
|
|
|
|
case SANDBOX_SET_AS_BLOCKED:
|
|
|
|
|
|
|
|
return "Set As Blocked";
|
|
|
|
|
|
|
|
case SANDBOX_BLOCKED:
|
|
|
|
|
|
|
|
return "Blocked";
|
|
|
|
|
|
|
|
case SANDBOX_SET_AS_RETURNED:
|
|
|
|
|
|
|
|
return "Set As Returned";
|
|
|
|
|
|
|
|
case SANDBOX_RETURNED:
|
|
|
|
|
|
|
|
return "Returned";
|
|
|
|
|
|
|
|
case SANDBOX_SET_AS_COMPLETE:
|
|
|
|
|
|
|
|
return "Set As Complete";
|
|
|
|
|
|
|
|
case SANDBOX_COMPLETE:
|
|
|
|
|
|
|
|
return "Complete";
|
|
|
|
|
|
|
|
case SANDBOX_SET_AS_ERROR:
|
|
|
|
|
|
|
|
return "Set As Error";
|
|
|
|
|
|
|
|
case SANDBOX_ERROR:
|
|
|
|
|
|
|
|
return "Error";
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
/* Crash, as this should be exclusive */
|
|
|
|
|
|
|
|
assert(0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Sandbox execution logic
|
|
|
|
* Sandbox execution logic
|
|
|
|
* Handles setup, request parsing, WebAssembly initialization, function execution, response building and sending, and
|
|
|
|
* Handles setup, request parsing, WebAssembly initialization, function execution, response building and sending, and
|
|
|
|