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

Close host files when the last FD referencing them is closed #5323

Merged
merged 5 commits into from
Jan 10, 2025

Conversation

Arshia001
Copy link
Member

No description provided.

lib/wasix/src/fs/mod.rs Show resolved Hide resolved
lib/wasix/src/fs/mod.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@theduke theduke left a comment

Choose a reason for hiding this comment

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

I'm quite against abusing the notion of unsafe here to emulate some notion of scoping.

Why don't we do things properly by providing a way to get a borrow to the inner content, while making the public fields private to prevent misuse?

Yes, the file system is not in a great state, but adding a huge hack on top of other hacks is bound to lead to more issues in the future.

@Arshia001
Copy link
Member Author

Why don't we do things properly by providing a way to get a borrow to the inner content, while making the public fields private to prevent misuse?

Mostly because it'll have rippling effects across the code. The FS code is not very well encapsulated, and adding proper encapsulation requires non-trivial amounts of refactoring. I'm not a huge fan of this either, but I'm trying to minimise the amount of time we spend refactoring code we know has to go as soon as possible.

I'll try to see if we can't make a small refactor.

@Arshia001 Arshia001 merged commit 7f23611 into main Jan 10, 2025
70 of 72 checks passed
@Arshia001 Arshia001 deleted the fix/close-host-files-properly branch January 10, 2025 15:28
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