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

Give FileDescription::{read, write} access to the InterpCx #3572

Closed
RalfJung opened this issue May 5, 2024 · 1 comment · Fixed by #3603
Closed

Give FileDescription::{read, write} access to the InterpCx #3572

RalfJung opened this issue May 5, 2024 · 1 comment · Fixed by #3603
Labels
A-files Area: related to files, paths, sockets, file descriptors, or handles A-shims Area: This affects the external function shims C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement E-good-first-issue A good way to start contributing, mentoring is available

Comments

@RalfJung
Copy link
Member

RalfJung commented May 5, 2024

The read and write methods of FileDescriptor should have access to ecx: &mut InterpCx<'mir, 'tcx, MiriMachine<'mir, 'tcx>>. This will be needed in the future to support blocking on these operations.

This is a prerequisite for

To make that work out in terms of borrowing, I think what we will have to do is clone the Rc in the read/write functions in unix/fd.rs, so that we have a fully owned FileDescriptor next to a uniquely borrowed InterpCx.

Cc @tiif @Luv-Ray
(AFAIK @tiif is still in the design stage so this is not a blocker yet)

@RalfJung RalfJung added C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement A-shims Area: This affects the external function shims E-good-first-issue A good way to start contributing, mentoring is available A-files Area: related to files, paths, sockets, file descriptors, or handles labels May 5, 2024
@RalfJung
Copy link
Member Author

RalfJung commented May 5, 2024

Thinking about it, supporting blocking will need further changes -- it's more tricky than I thought. After all, we need to arrange for the waking thread to be able to fill the buffer and set the return value before waking up the blocked thread.

But giving mutable access to the interpreter is probably still a good first step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-files Area: related to files, paths, sockets, file descriptors, or handles A-shims Area: This affects the external function shims C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement E-good-first-issue A good way to start contributing, mentoring is available
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant