chore: rename to minimize diff

main
Sean McBride 4 years ago
parent 080c3d6656
commit 86fe1ceaa0

@ -396,55 +396,55 @@ sandbox_allocate(struct sandbox_request *sandbox_request)
assert(sandbox_request != NULL); assert(sandbox_request != NULL);
module_validate(sandbox_request->module); module_validate(sandbox_request->module);
struct sandbox *new_sandbox; struct sandbox *sandbox;
char * error_message = ""; char * error_message = "";
/* Allocate Sandbox control structures, buffers, and linear memory in a 4GB address space */ /* Allocate Sandbox control structures, buffers, and linear memory in a 4GB address space */
new_sandbox = sandbox_allocate_memory(sandbox_request->module); sandbox = sandbox_allocate_memory(sandbox_request->module);
if (!new_sandbox) { if (!sandbox) {
error_message = "failed to allocate sandbox heap and linear memory"; error_message = "failed to allocate sandbox heap and linear memory";
goto err_memory_allocation_failed; goto err_memory_allocation_failed;
} }
/* Set state to initializing */ /* Set state to initializing */
new_sandbox->state = SANDBOX_INITIALIZING; sandbox->state = SANDBOX_INITIALIZING;
/* Allocate the Stack */ /* Allocate the Stack */
if (sandbox_allocate_stack(new_sandbox) == -1) { if (sandbox_allocate_stack(sandbox) == -1) {
error_message = "failed to allocate sandbox heap and linear memory"; error_message = "failed to allocate sandbox heap and linear memory";
goto err_stack_allocation_failed; goto err_stack_allocation_failed;
} }
/* Copy the socket descriptor, address, and arguments of the client invocation */ /* Copy the socket descriptor, address, and arguments of the client invocation */
new_sandbox->absolute_deadline = sandbox_request->absolute_deadline; sandbox->absolute_deadline = sandbox_request->absolute_deadline;
new_sandbox->arguments = (void *)sandbox_request->arguments; sandbox->arguments = (void *)sandbox_request->arguments;
new_sandbox->client_socket_descriptor = sandbox_request->socket_descriptor; sandbox->client_socket_descriptor = sandbox_request->socket_descriptor;
new_sandbox->request_arrival_timestamp = sandbox_request->request_arrival_timestamp; sandbox->request_arrival_timestamp = sandbox_request->request_arrival_timestamp;
/* Initialize the sandbox's context, stack, and instruction pointer */ /* Initialize the sandbox's context, stack, and instruction pointer */
arch_context_init(&new_sandbox->ctxt, (reg_t)current_sandbox_main, arch_context_init(&sandbox->ctxt, (reg_t)current_sandbox_main,
(reg_t)(new_sandbox->stack_start + new_sandbox->stack_size)); (reg_t)(sandbox->stack_start + sandbox->stack_size));
/* TODO: What does it mean if there isn't a socket_address? Shouldn't this be a hard requirement? /* TODO: What does it mean if there isn't a socket_address? Shouldn't this be a hard requirement?
It seems that only the socket descriptor is used to send response */ It seems that only the socket descriptor is used to send response */
const struct sockaddr *socket_address = sandbox_request->socket_address; const struct sockaddr *socket_address = sandbox_request->socket_address;
if (socket_address) memcpy(&new_sandbox->client_address, socket_address, sizeof(struct sockaddr)); if (socket_address) memcpy(&sandbox->client_address, socket_address, sizeof(struct sockaddr));
/* Initialize file descriptors to -1 */ /* Initialize file descriptors to -1 */
for (int i = 0; i < SANDBOX_MAX_IO_HANDLE_COUNT; i++) new_sandbox->io_handles[i].file_descriptor = -1; for (int i = 0; i < SANDBOX_MAX_IO_HANDLE_COUNT; i++) sandbox->io_handles[i].file_descriptor = -1;
/* Initialize Parsec control structures (used by Completion Queue) */ /* Initialize Parsec control structures (used by Completion Queue) */
ps_list_init_d(new_sandbox); ps_list_init_d(sandbox);
free(sandbox_request); free(sandbox_request);
done: done:
return new_sandbox; return sandbox;
err_stack_allocation_failed: err_stack_allocation_failed:
sandbox_free(new_sandbox); sandbox_free(sandbox);
err_memory_allocation_failed: err_memory_allocation_failed:
err: err:
perror(error_message); perror(error_message);
new_sandbox = NULL; sandbox = NULL;
goto done; goto done;
} }

Loading…
Cancel
Save