Uh oh!
There was an error while loading. Please reload this page.
std.posix: Added 'error.ProcessNotFound' where necessary - #23268
Conversation
alexrp
commented
Mar 16, 2025
I'm not really clear on the conditions under which we get |
rootbeer
commented
Mar 17, 2025
(Let me preface this comment by saying, do whatever Alex says, and feel free to ignore me.) I think this PR correctly maps the errno code on read/write when operating on a Also since POSIX defines From what I can tell (in the Doing this mapping at I think Zig's posix layer can get away with specializing some errno from some syscalls. But I think it'll be hard to do that correctly from syscalls like My suggestion on this PR is that the |
chrboesch
commented
Mar 20, 2025
I generally agree with that. As suggested, "process not found" could of course return "file not found." I'm completely unenthusiastic about this and just want to avoid further confusion, because at that point, you're working with "processes" and not with files. Not from a technical point of view (everything is a file), but from a logical point of view. Personally, I'd stick with "process," because when you're working with it, you think of PID as a process and not a file. |
rootbeer
commented
Mar 21, 2025
(Again, I'm not a Zig team member, so my opinions may be ignored and I may be off-base.) The problem I'm trying to convince you about is that the Zig's My comments here are all about the pre-existing mappings of (**) The |
I was under the impression that |
Yes, and that hasn't changed. The error message returned by the Linux kernel varies depending on the combination of how a PID is accessed or can no longer be accessed because it no longer exists. We can now catch both possible error types and return them as 'process not found' in Zig, which logically is always the case. Or we can ignore the fact that it's accessing a process and simply write "file not found." I'm still in favor of option 1 and find option 2 clumsy because it's extremely confusing (as Linux often is, unfortunately). We have the option of outputting explanatory error messages, so why not use them? Addendum: The Linux manual pages also say, "The proc filesystem is a pseudo-filesystem...", so I find the error message "procress not found" much more meaningful than "file not found". |
KilianHanich
commented
Mar 25, 2025
I actually have a question: What a specific situation/example where |
…tencies. After extensive testing, the error messages for processes that are already open but no longer available for reading/writing have been adjusted to 'ProcessNotFound' if the error code ESRCH is thrown by the Linux kernel. Incorrect ENOENT error codes that also returned 'ProcessNotFound' have been removed.
chrboesch
commented
Mar 26, 2025
To be honest, I don't remember. I had a test setup consisting of a C program and a Zig program, and I was getting corresponding error codes. Now I tried to recreate it, but to no avail. So I tested everything again from the beginning and only got ESRCH. I've now adjusted this PR accordingly. |
Uh oh!
There was an error while loading. Please reload this page.
rootbeer
commented
Mar 28, 2025
LGTM! |
commit 92d1276 has a typo in its commit message @chrboesch |
chrboesch
commented
Apr 3, 2025
Strange, F and P aren't even next to each other on the keyboard... |
chrboesch
commented
Apr 12, 2025
@alexrp Is something missing? |
andrewrk
commented
Apr 14, 2025
I'm confused. Was ENOENT observed before, or not? Is it now mapped to error.Unexpected after this patch? |
chrboesch
commented
Apr 14, 2025
In my first test scenario a few months ago, I was certain that EOENT was occurring. I can't actually reproduce that in the current, somewhat more comprehensive scenario, so it was removed. I've now run several tests in all directions, and all errors that occur are correctly returned. Sorry for confusing, but these tests are unfortunately not automatable. |
If you attempt to
read(or other operations) from a process previously opened viaopenat, but it has since terminated, the Linux kernel throws the errorESRCH - No such process. This is now represented byerror.ProcessNotFound.fixes#19875