Re: Un-sucking EINVAL
- Reply: Robert Clausecker : "Re: Un-sucking EINVAL"
- In reply to: Warner Losh : "Re: Un-sucking EINVAL"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 21 May 2025 19:14:48 UTC
--------
Warner Losh writes:
> In short, I'd love to widen the interface, but there's a number of practical
> issues in the way.
Not really ?
Our kernel is not I18N'ed and we have no plans to do so.
That means that there is absolutely no point in taking a big detour over
enumerating all possible messages into some "int assistant_to_errno",
we can and should simply pass the informative text-string straigt through.
There is also no need to make the text-string more than a const char *.
The proper detailed explanation is in the manual page, the string
just needs to say enough that people know where to look.
Here is the simplest implementation:
1. We add two pointers to kernel threads.
2. When an error occurs, those pointers are set to a pointer to the
kld (or NULL) and to the const char *string.
3. Userland explicitly requests the information (a syscall or per-thread
sysctl), the kernel validates that the kld is still present before
copyout'ing the const char *.
4. Kernel code adds calls like:
errmsg("Grammeter must be connected first")
before return (EINVAL)
Done.
--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk@FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.