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

std.posix: Added error message 'ProcessNotFound' for reading and writing in a Linux process #21430

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

chrboesch
Copy link
Sponsor Contributor

This error occurs if the process to be read from or written to no longer exists.

Fixes #19875

@chrboesch
Copy link
Sponsor Contributor Author

I can't complete this PR due to the complexity of the dependencies. Since I can't test on MacOS or Windows and the error message only says "test-fmt transitive error", I don't know how to fix this.

@alexrp
Copy link
Contributor

alexrp commented Sep 16, 2024

It means you have code formatting violations; run zig build fmt.

@@ -798,6 +798,10 @@ pub const ReadError = error{
/// In WASI, this error occurs when the file descriptor does
/// not hold the required rights to read from it.
AccessDenied,

// This error occurs in Linux if the process to be read from
Copy link
Sponsor Contributor

Choose a reason for hiding this comment

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

These should be doc comments (/// instead of //)

Copy link
Sponsor Contributor

@linusg linusg left a comment

Choose a reason for hiding this comment

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

This handles ENOENT aka errno 2 aka error.FileNotFound, the linked issue is about ESRCH (errno 3).

@chrboesch
Copy link
Sponsor Contributor Author

Because Linux returns the ENOENT error for a process (aka file) that no longer exists when trying to read or write to it.
The ESRCH error occurs when you try to kill a process or process group that no longer exists.

@linusg
Copy link
Sponsor Contributor

linusg commented Sep 18, 2024

Then it would be good to note that in the original issue so the author knows they're mistaken or can clarify the situation in which ESRCH gets returned :)

@chrboesch
Copy link
Sponsor Contributor Author

#19875 (comment)

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.

ESRCH is not handled by file io operations
4 participants