-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
std.posix: added missing posix error ENXIO #25535
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
base: master
Are you sure you want to change the base?
Conversation
But the error doesn't just mean "no device," it also means "address not found." So omitting that would be misleading. And as I already wrote to Alex, this is defined in POSIX. This leads to the question, should we adapt the others as well? |
I don't have strong opinion on the naming, but, whatever name is chosen, it should be consistent. Note also that the Zig error name is used for more than just POSIX errors (and also more than just POSIX The path of least resistance is probably sticking with |
Please wait to make conflicts with my active branch easier |
That doesn't make sense to me, because then we could just write "an error occurred" without any indication of where to look for it. And for precisely this reason (at least, that's how I see it, correct me if I'm wrong), you can create meaningful errors in Zig. And if the error message says "no device" but the address isn't actually found, that means the developer (or user) has to do an extra search. And to address your example: .NO_MEDIA_IN_DEVICE => return error.NoDevice,
.PIPE_NOT_AVAILABLE => return error.NoDevice, I find the error naming very unfortunate. "No media in device" and "pipe unavailable" are two completely different things. Incidentally, this is also the reason why Windows has very explicit error messages in its API. As a developer/user, however, you only see "no device" and can then figure out whether the device is defective, not connected, or simply no CD (or whatever) is inserted. We should break this down and not make it harder for everyone to clearly identify an error. Therefore, you should carefully consider where consolidating error messages makes sense and where it doesn't. In this case, however, I think it would be helpful to name the error as it is now, since it's a new addition for an error that hasn't been specifically caught yet. |
Per POSIX, ENXIO (“No such device or address”) may occur with read(), write(), open()/openat(), send(), and sendto() (e.g., device removed or request outside device capabilities).
read() and sendto() (and some dependencies) were missing this mapping; this PR adds it.
fixes #23383