Add comments around wasm_runtime_set_wasi_args (#1692)

This commit is contained in:
YAMAMOTO Takashi
2022-11-09 18:18:22 +09:00
committed by GitHub
parent 30ee992762
commit ff4ee4a95f
2 changed files with 37 additions and 1 deletions

View File

@ -2509,7 +2509,11 @@ wasm_runtime_init_wasi(WASMModuleInstanceCommon *module_inst,
}
addr_pool_inited = true;
/* Prepopulate curfds with stdin, stdout, and stderr file descriptors. */
/* Prepopulate curfds with stdin, stdout, and stderr file descriptors.
*
* If -1 is given, use STDIN_FILENO (0), STDOUT_FILENO (1),
* STDERR_FILENO (2) respectively.
*/
if (!fd_table_insert_existing(curfds, 0, (stdinfd != -1) ? stdinfd : 0)
|| !fd_table_insert_existing(curfds, 1, (stdoutfd != -1) ? stdoutfd : 1)
|| !fd_table_insert_existing(curfds, 2,