Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why no dedicated __wasi_snapshot_preview1_fd_openat syscall? #454

Open
trcrsired opened this issue Dec 14, 2023 · 2 comments
Open

why no dedicated __wasi_snapshot_preview1_fd_openat syscall? #454

trcrsired opened this issue Dec 14, 2023 · 2 comments

Comments

@trcrsired
Copy link

trcrsired commented Dec 14, 2023

I just realized the open(2) is too complicated on wasm and even this syscall is too complicated
https://github.com/trcrsired/wasi-libc/blob/c8352f8c145fe1fc21db79893f45ed7aa4d9eef2/libc-bottom-half/sources/__wasilibc_real.c#L437

There are no reasons to be so complicated tbh. Why no just a dedicated __wasi_snapshot_preview1_fd_openat syscall?

@trcrsired
Copy link
Author

int __wasilibc_find_relpath(const char *path,

This is too complicated and not thread safe probably

@sbc100
Copy link
Member

sbc100 commented Dec 14, 2023

I just realized the open(2) is too complicated on wasm and even this syscall is too complicated https://github.com/trcrsired/wasi-libc/blob/c8352f8c145fe1fc21db79893f45ed7aa4d9eef2/libc-bottom-half/sources/__wasilibc_real.c#L437

There are no reasons to be so complicated tbh. Why no just a dedicated __wasi_snapshot_preview1_fd_openat syscall?

IIUC correctly __wasi_snapshot_preview1_path_open is effectively syscall_openat. Its first argument is a file descriptor which is non-optional. What preview1 does not have (by design) is syscall_open (without the fd argument).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants