Skip to content

Conversation

catamorphism
Copy link
Collaborator

At this point, there should be no further uses of the preview1 component adapter for clocks and filesystems methods when __wasilibc_use_wasip2 is defined.

Also added a DEBUG option to the Makefile that enables -O0/g when DEBUG=true is passed in.

@catamorphism
Copy link
Collaborator Author

Note: there's no automated way (that I know of) to check that there are no uses of the preview1 filesystems methods when __wasilibc_use_wasip2 is defined, so I checked by searching for each of the method names and verifying that it was enclosed in an appropriate #ifdef. It's possible I could have missed something.

@catamorphism catamorphism marked this pull request as ready for review August 5, 2025 21:35
@pchickey pchickey self-requested a review August 11, 2025 17:32
Copy link
Collaborator

@pchickey pchickey left a comment

Choose a reason for hiding this comment

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

So far reviewed clocks, this one will take time to go through piece by piece

catamorphism and others added 5 commits August 15, 2025 13:08
At this point, there should be no further uses of the preview1
component adapter for clocks and filesystems methods when __wasilibc_use_wasip2
is defined.

Also added a DEBUG option to the Makefile that enables -O0/g
when DEBUG=true is passed in.
Copy link
Collaborator

@pchickey pchickey left a comment

Choose a reason for hiding this comment

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

Today I made it up to the end of the libc itself, and I skimmed the tests. I'll give the tests another read-through later.

It appears __wasilibc_fd_renumber isnt ported in this PR - that should be possible to implement just by manipulating libc's own descriptor table

}
case FIONBIO: {
#ifdef __wasilibc_use_wasip2
// wasip2 doesn't support setting the non-blocking flag
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thats correct, and for files this doesn't matter, but if this was a socket, I think we'd want to emulate setting the nonblocking flag by switching the implementations of send/recv from blocking to nonblocking stream read/writes. But just googling around it seems like this particular ioctl has a checkered past so maybe it doesn't matter if we just say ENOTSUP? Genuinely not sure what the right thing is to do here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thats correct, and for files this doesn't matter, but if this was a socket, I think we'd want to emulate setting the nonblocking flag by switching the implementations of send/recv from blocking to nonblocking stream read/writes.

I'm hesitant to do that in this PR because I don't know how to test the sockets code (it sounds like testing was done manually in the past?) and it seems like a non-trivial change.

Copy link
Collaborator

Choose a reason for hiding this comment

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

OK, lets set this aside and wait for @wingo to provide some way of testing sockets for p3 that we can backport to p2.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Created #621

@catamorphism
Copy link
Collaborator Author

It appears __wasilibc_fd_renumber isnt ported in this PR - that should be possible to implement just by manipulating libc's own descriptor table

Done -- I had made that change as part of #613 , but now I've pulled it into this PR.

Copy link
Collaborator

@pchickey pchickey left a comment

Choose a reason for hiding this comment

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

Thanks for taking care of all of the feedback, this looks good to go

@catamorphism catamorphism merged commit b33c5fc into WebAssembly:main Sep 5, 2025
31 of 32 checks passed
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.

2 participants