Add more `ErrorKind`s
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
- A somewhat related tracking issue #86442
Misc UNIX
Originally posted by zackw in https://github.com/rust-lang/rust/issues/79965#issuecomment-810468334
I am surprised to see EMFILE, ENFILE, ENOMEM, ENOEXEC, EIO, ENOTTY, ENXIO, ENODEV, EOPNOTSUPP, ESRCH, ECHILD, and EINPROGRESS dismissed as unlikely to occur, or only relevant to people doing highly Unix-specific tasks. They can all happen at least as easily as some of the other situations for which codes are being added. I'd recommend all of these be added, with the following friendly names and descriptions. Some of them should be lumped together, however.
EIO:PhysicalIOError, "Data could not be input or output due to a hardware failure, such as a bad disk sector."ESRCHandECHILD:ProcessNotFound(or lump with the existingNotFound). "A process was not found" seems too vague and short, but the existing description forNotFoundis also vague and short, so 🤷♂️EINPROGRESS:InProgress. "An operation has begun, and will complete later. It is not yet known whether it will succeed."EMFILEandENFILE:TooManyOpenFiles. "The process cannot open any more files without closing some first, or the system as a whole cannot handle any more simultaneously open files."ENOMEM:NotEnoughMemory. "The system does not have enough free memory to satisfy an allocation request. This can happen either because all of RAM is already allocated, or because the request was for more memory than the computer has."ENOEXEC:InvalidExecutable. "A machine-language program is either corrupt or cannot be executed on this CPU (e.g. it is machine code for some other type of CPU)."ENOTTY,ENXIO,ENODEV,EOPNOTSUPP:NotOperable, "This operation cannot be applied to this type of file or device. For example, changing terminal settings on something other than a terminal device."
EMFILE specifically
Was requested at least a couple of times
- https://github.com/rust-lang/rust/issues/86442#issuecomment-1584846511
- https://github.com/rust-lang/rust/issues/86442#issuecomment-2163167135
(I was not even looking for those, just noticed the reoccurring request while gathering info for the few previous issues I've opened.)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the existing ErrorKind definitions and the Unix errno handling, then read tracking issue #86442 and the linked historical discussion for prior context. Done means the requested errno cases have agreed names, groupings, and descriptions and are represented consistently in the relevant Rust error APIs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- operating-systems
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100