diff --git a/config b/config index 386969168..fb08299c4 100644 --- a/config +++ b/config @@ -189,7 +189,7 @@ NGX_WASM_SRCS="\ $ngx_addon_dir/src/wasm/wrt/ngx_wrt_utils.c \ $ngx_addon_dir/src/wasm/vm/ngx_wavm.c \ $ngx_addon_dir/src/wasm/vm/ngx_wavm_host.c \ - $ngx_addon_dir/src/wasm/wasi/ngx_wasi_host.c" + $ngx_addon_dir/src/wasm/wasi/ngx_wasi_preview1_host.c" NGX_WASM_CORE_SRCS="\ $ngx_addon_dir/src/wasm/ngx_wasm_core_module.c \ diff --git a/src/wasm/wasi/ngx_wasi.h b/src/wasm/wasi/ngx_wasi.h index 7c83c38ed..18914bdb9 100644 --- a/src/wasm/wasi/ngx_wasi.h +++ b/src/wasm/wasi/ngx_wasi.h @@ -15,7 +15,7 @@ #define WASI_ERRNO_NOTSUP 58 -extern ngx_wavm_host_def_t ngx_wasi_host; +extern ngx_wavm_host_def_t ngx_wasip1_host; #endif /* _NGX_WASI_H_INCLUDED_ */ diff --git a/src/wasm/wasi/ngx_wasi_host.c b/src/wasm/wasi/ngx_wasi_preview1_host.c similarity index 99% rename from src/wasm/wasi/ngx_wasi_host.c rename to src/wasm/wasi/ngx_wasi_preview1_host.c index 57874b72b..ad0d799a2 100644 --- a/src/wasm/wasi/ngx_wasi_host.c +++ b/src/wasm/wasi/ngx_wasi_preview1_host.c @@ -400,7 +400,7 @@ static ngx_wavm_host_func_def_t ngx_wasi_hfuncs[] = { }; -ngx_wavm_host_def_t ngx_wasi_host = { - ngx_string("ngx_wasi"), +ngx_wavm_host_def_t ngx_wasip1_host = { + ngx_string("ngx_wasi_preview1"), ngx_wasi_hfuncs, }; diff --git a/src/wasm/wrt/ngx_wrt_v8.c b/src/wasm/wrt/ngx_wrt_v8.c index b39aa6d07..b544ef5df 100644 --- a/src/wasm/wrt/ngx_wrt_v8.c +++ b/src/wasm/wrt/ngx_wrt_v8.c @@ -333,7 +333,7 @@ ngx_v8_link_module(ngx_wrt_module_t *module, ngx_array_t *hfuncs, name.data = (u_char *) importname->data; hfunc = ngx_wavm_host_hfunc_create(module->engine->pool, - &ngx_wasi_host, &name); + &ngx_wasip1_host, &name); if (hfunc) { dd(" -> wasi resolved: \"%.*s\"", diff --git a/src/wasm/wrt/ngx_wrt_wasmer.c b/src/wasm/wrt/ngx_wrt_wasmer.c index b71bc900c..ecfe2baa4 100644 --- a/src/wasm/wrt/ngx_wrt_wasmer.c +++ b/src/wasm/wrt/ngx_wrt_wasmer.c @@ -341,7 +341,7 @@ ngx_wasmer_link_module(ngx_wrt_module_t *module, ngx_array_t *hfuncs, name.data = (u_char *) importname->data; hfunc = ngx_wavm_host_hfunc_create(module->engine->pool, - &ngx_wasi_host, &name); + &ngx_wasip1_host, &name); if (hfunc) { dd(" -> wasi resolved by host function: \"%.*s\"", diff --git a/src/wasm/wrt/ngx_wrt_wasmtime.c b/src/wasm/wrt/ngx_wrt_wasmtime.c index 651a63686..2bb2df993 100644 --- a/src/wasm/wrt/ngx_wrt_wasmtime.c +++ b/src/wasm/wrt/ngx_wrt_wasmtime.c @@ -280,17 +280,17 @@ ngx_wasmtime_init_engine(ngx_wrt_engine_t *engine, wasm_config_t *config, nwasi = 0; - for (i = 0; ngx_wasi_host.funcs[i].ptr; i++) { + for (i = 0; ngx_wasip1_host.funcs[i].ptr; i++) { nwasi++; } engine->pool = pool; engine->wasi_hfuncs = ngx_pcalloc(pool, sizeof(ngx_wavm_hfunc_t *) * nwasi); - for (i = 0; ngx_wasi_host.funcs[i].ptr; i++) { - def = &ngx_wasi_host.funcs[i]; + for (i = 0; ngx_wasip1_host.funcs[i].ptr; i++) { + def = &ngx_wasip1_host.funcs[i]; - hfunc = ngx_wavm_host_hfunc_create(pool, &ngx_wasi_host, &def->name); + hfunc = ngx_wavm_host_hfunc_create(pool, &ngx_wasip1_host, &def->name); err->res = wasmtime_linker_define_func(engine->linker, wasi_module, @@ -316,7 +316,7 @@ ngx_wasmtime_destroy_engine(ngx_wrt_engine_t *engine) { size_t i; - for (i = 0; ngx_wasi_host.funcs[i].ptr; i++) { + for (i = 0; ngx_wasip1_host.funcs[i].ptr; i++) { wasm_functype_delete(engine->wasi_hfuncs[i]->functype); }