Function cloudabi::proc_exec [] [src]

pub unsafe fn proc_exec(fd_: fd, data_: &[u8], fds_: &[fd]) -> errno

Replaces the process by a new executable.

Process execution in CloudABI differs from POSIX in two ways: handling of arguments and inheritance of file descriptors.

CloudABI does not use string command line arguments. Instead, a buffer with binary data is copied into the address space of the new executable. The kernel does not enforce any specific structure to this data, although CloudABI's C library uses it to store a tree structure that is semantically identical to YAML.

Due to the strong focus on thread safety, file descriptors aren't inherited through close-on-exec flags. An explicit list of file descriptors that need to be retained needs to be provided. After execution, file descriptors are placed in the order in which they are stored in the array. This not only makes the execution process deterministic. It also prevents potential information disclosures about the layout of the original process.

Parameters

fd: A file descriptor of the new executable.

data: Binary argument data that is passed on to the new executable.

fds: The layout of the file descriptor table after execution.