From nobody Wed May 21 19:14:48 2025 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4b2h243DSHz5wNTm for ; Wed, 21 May 2025 19:14:52 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4b2h2407mRz3Qvt; Wed, 21 May 2025 19:14:51 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Authentication-Results: mx1.freebsd.org; none Received: from critter.freebsd.dk (unknown [192.168.55.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by phk.freebsd.dk (Postfix) with ESMTPS id 5EDA0B0A1A; Wed, 21 May 2025 19:14:49 +0000 (UTC) Received: (from phk@localhost) by critter.freebsd.dk (8.18.1/8.16.1/Submit) id 54LJEmmd004452; Wed, 21 May 2025 19:14:48 GMT (envelope-from phk) Message-Id: <202505211914.54LJEmmd004452@critter.freebsd.dk> To: Warner Losh cc: Andriy Gapon , freebsd-current@freebsd.org Subject: Re: Un-sucking EINVAL In-reply-to: From: "Poul-Henning Kamp" References: <202505210722.54L7MTqw025632@critter.freebsd.dk> List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4450.1747854888.1@critter.freebsd.dk> Date: Wed, 21 May 2025 19:14:48 +0000 X-Rspamd-Queue-Id: 4b2h2407mRz3Qvt X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:1835, ipnet:130.225.0.0/16, country:EU] X-Spamd-Bar: ---- -------- 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.