Skip to content

Implement fd_datasync, fd_sync, and fd_renumber WASI functions #401

Merged
ksh8281 merged 4 commits intoSamsung:mainfrom
M-SE0K:feature/WASI
Apr 13, 2026
Merged

Implement fd_datasync, fd_sync, and fd_renumber WASI functions #401
ksh8281 merged 4 commits intoSamsung:mainfrom
M-SE0K:feature/WASI

Conversation

@M-SE0K
Copy link
Copy Markdown
Contributor

@M-SE0K M-SE0K commented Apr 8, 2026

  • fd_datasync: Flush file data to disk (excluding metadata)
  • fd_sync: Flush file data and metadata to disk
  • fd_renumber | dup2 (atomic) | Atomically reassign a fd to a new number

@M-SE0K M-SE0K closed this Apr 8, 2026
@M-SE0K M-SE0K reopened this Apr 8, 2026
@@ -0,0 +1,81 @@
(module
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome to the project!

By the way, could you let me know where these test codes came from?
Did you create them yourself?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I implemented this by referencing the existing tests in src/test/wasi/. To determine the correct rights values and expected error cases, I consulted wasi_types.h, uvwasi.h, and uvwasi.c within third_party

Could you please review this and let me know if I got these details right?

Copy link
Copy Markdown
Collaborator

@clover2123 clover2123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@clover2123
Copy link
Copy Markdown
Collaborator

Rebase this patch after #403 landed

M-SE0K added 3 commits April 11, 2026 17:46
Signed-off-by: M-SE0K <seg082911@gmail.com>
Signed-off-by: M-SE0K <seg082911@gmail.com>
Signed-off-by: M-SE0K <seg082911@gmail.com>
@M-SE0K
Copy link
Copy Markdown
Contributor Author

M-SE0K commented Apr 11, 2026

Done! I've rebased the branch.

Copy link
Copy Markdown
Collaborator

@zherczeg zherczeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with minor changes

Comment thread src/wasi/WASI.cpp

result[0] = Value(uvwasi_fd_sync(WASI::g_uvwasi, fd));
}
void WASI::fd_renumber(ExecutionState& state, Value* argv, Value* result, Instance* instance)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add newlines between the functions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I've added the newlines between functions and updated the commit. Thanks for the review!

Signed-off-by: M-SE0K <seg082911@gmail.com>
@M-SE0K M-SE0K force-pushed the feature/WASI branch 2 times, most recently from 0572f41 to 8d90b7b Compare April 11, 2026 16:33
@ksh8281 ksh8281 merged commit 0902802 into Samsung:main Apr 13, 2026
178 checks passed
@M-SE0K M-SE0K deleted the feature/WASI branch April 13, 2026 14:22
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

Successfully merging this pull request may close these issues.

4 participants