github-actions[bot] commented on Issue #1376:
Subscribe to Label Action
This issue or pull request has been labeled: "wasi", "wasmtime:c-api"
<details> <summary>Users Subscribed to "wasmtime:c-api"</summary>
- @peterhuene
</details>
To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.
peterhuene commented on Issue #1376:
Sigh. To get the shared (between the multiple WASI context builders) file handles working on Windows, we'd need to open with sharing options specifically on Windows.
I'm not really a big fan of this impl (i.e. having the multiple WASI instances). I may take another stab at this to fix #1220.
peterhuene edited a comment on Issue #1376:
Sigh. To get the shared stdio (between the multiple WASI context builders) file handles working on Windows, we'd need to open with sharing options.
I'm not really a big fan of this impl (i.e. having the multiple WASI instances). I may take another stab at this to fix #1220.
alexcrichton commented on Issue #1376:
I'm actually a little confused myself as to this error, what's the sycall that's failing due to sharing?
peterhuene commented on Issue #1376:
Right now I'm doing a
try_clone
on theFile
we open/create for the file path specified inwasi_config_std[in|out|err]_path
as well aswasi_config_preopen
since it needs to be shared between the two underlying context builders. By default, it's not being opened with Windows sharing flags, so the try_clone is failing when trying to use those functions.
peterhuene commented on Issue #1376:
I have a solution in mind that's going to change the WASI C API functions so that users can request a particular WASI "module" and it'll be represented as a
wasm_module_t
and thus can be instantiated normally, rather than this special instance type. That should allow people to use the snapshot of WASI they want, provided the engine supports it.The C# API would then change so that when you want to instantiate a module with WASI, you get an
Instance
like any other module andModule.Instantiate
will take an enumeration of modules to link against, one of which can be an instantiated WASI module.
peterhuene edited a comment on Issue #1376:
I have a solution in mind that's going to change the WASI C API functions so that users can request a particular WASI "module" and it'll be represented as a
wasm_module_t
and thus can be instantiated normally, rather than this specialwasi_instance_t
type. That should allow people to use the snapshot of WASI they want, provided the engine supports it.The C# API would then change so that when you want to instantiate a module with WASI, you get an
Instance
like any other module andModule.Instantiate
will take an enumeration of modules to link against, one of which can be an instantiated WASI module.
peterhuene edited a comment on Issue #1376:
I have a solution in mind that's going to change the WASI C API functions so that users can request a particular WASI "module" and it'll be represented as a
wasm_module_t
and thus can be instantiated normally, rather than this specialwasi_instance_t
type. That should allow people to use the snapshot of WASI they want, provided the engine supports it.The C# API would then change so that when you want to instantiate a module with WASI, you get an
Instance
like any other module andModule.Instantiate
will take an enumeration of instances to link against, one of which can be an instantiated WASI module.
peterhuene edited a comment on Issue #1376:
I have a solution in mind that's going to change the WASI C API functions so that users can request a particular WASI "module" and it'll be represented as a
wasm_module_t
and thus can be instantiated normally, rather than this specialwasi_instance_t
type. That should allow people to use the snapshot of WASI they want, provided the engine supports it.The C# API would then change so that when you want to instantiate a module with WASI, you get an
Instance
like any other module andModule.Instantiate
will take an enumeration of instances to link against, one of which can be an instantiated WASI module.This solution would forego this particular PR. I'm leaving this one open for now until I get that work finished.
peterhuene edited a comment on Issue #1376:
I have a solution in mind that's going to change the WASI C API functions so that users can request a particular WASI "module" and it'll be represented as a
wasm_module_t
and thus can be instantiated normally, rather than this specialwasi_instance_t
type. That should allow people to use the snapshot of WASI they want, provided the engine supports it.The C# API would then change so that when you want to instantiate a module with WASI, you get an
Instance
like any other module andModule.Instantiate
will take an enumeration of instances to link against, one of which can be an instantiated WASI module.That solution would forego this particular PR. I'm leaving this one open for now until I get that work finished.
alexcrichton commented on Issue #1376:
Hm ok I think I'm not familiar enough with windows sharing things to know what's going on. I would naively think that we should open files with sharing rights and/or this is a bug in libstd if
try_clone
never works.I'm slightly hesitant to get a
wasm_module_t
or awasm_instance_t
from wasi items since they're not actually compiled object code but rather more of a "everyone's gotta have aenum Instance
with one variant as jit code and one as wasi modules. I also see though how it'd be quite nice to not have to deal with wasi instances at all and you've only got normal instances/modules. In that sense I think it definitely seems worthwhile to explore! I'll wait until I have some code to peek at :)
peterhuene commented on Issue #1376:
We definitely can use the Windows stdlib extensions for opening with sharing to get this green, which is simple to do.
I'm just not a fan of this approach after (even) more consideration. This doesn't scale well as more and more snapshots get released and we have to support them, assuming we don't solve the problem with a single WASI instance that knows how to polyfill previous snapshots itself.
I'll take a stab at the alternative approach today and put it up for your review.
peterhuene edited a comment on Issue #1376:
We definitely can use the Windows stdlib extensions for opening with sharing to get this green, which is simple to do.
I'm just not a fan of this approach after (even) more consideration. This doesn't scale well as more and more snapshots get released and we have to support them, assuming we don't solve the problem with a single WASI instance that knows how to polyfill previous snapshots itself.
Regarding the enum problem, it should be at least limited to the C API to answer the "what kind of module is this?" question. At least it wouldn't complicate the Rust API unnecessarily.
I'll take a stab at the alternative approach today and put it up for your review.
peterhuene commented on Issue #1376:
I'm closing this in favor of the commit that adds support for WASI snapshot0 in #1411.
Last updated: Dec 23 2024 at 12:05 UTC