Date: Wed, 21 May 2025 19:14:48 +0000 From: "Poul-Henning Kamp" <phk@phk.freebsd.dk> To: Warner Losh <imp@bsdimp.com> Cc: Andriy Gapon <avg@freebsd.org>, freebsd-current@freebsd.org Subject: Re: Un-sucking EINVAL Message-ID: <202505211914.54LJEmmd004452@critter.freebsd.dk> In-Reply-To: <CANCZdfoY_2UyaRsVpjENvRy8aTDUAmQka75=JfDSNa=BVKb53g@mail.gmail.com> References: <aC0CgBBWrodf6pa8@ragweed.eden.le-fay.org> <202505210722.54L7MTqw025632@critter.freebsd.dk> <aC2Ap5ogfrlC-kHn@ragweed.eden.le-fay.org> <bc073de5-1c4a-41e8-b163-fcbfc4fb9c8f@FreeBSD.org> <CANCZdfoY_2UyaRsVpjENvRy8aTDUAmQka75=JfDSNa=BVKb53g@mail.gmail.com>
index | next in thread | previous in thread | raw e-mail
--------
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.
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202505211914.54LJEmmd004452>
