From: Robert Clausecker <fuz@fuz.su>
To: musl@lists.openwall.com
Subject: Re: [musl] Prototypes without implementations
Date: Sat, 26 Oct 2024 12:10:07 +0200 [thread overview]
Message-ID: <Zxy__18VjfFBHncG@fuz.su> (raw)
In-Reply-To: <emc51f6a2f-139b-4697-abbd-aee651abe1d9@84cd4237.com>
Am Sat, Oct 26, 2024 at 01:21:23AM +0000 schrieb Laurent Bercot:
> > I think ENOSYS is probably the way to go, especially since (via the
> > kernel) that's already happening on some architectures.
>
> Note that providing ENOSYS implementations makes cross-compiling harder.
>
> When the libc provides no implementation, a sysdep test can compile
> and link a program using the API, and conclude that the functionality
> doesn't exist when the link fails. This works when cross-compiling.
>
> When the libc provides an ENOSYS implementation, the link will succeed,
> and a sysdep test needs to *run* a program to check that the
> functionality works correctly. This is not possible when cross-compiling.
>
> I'd rather have libcs omit stub implementations entirely, so that
> applications can test for functionality without having to run anything.
> Stub implementations make tests and integration of replacement
> implementations more difficult. (And not even only for cross builds.
> Looking at you, musl's utmp functions.)
This entire debate happened multiple times with commercial UNIX vendors
some thirty years ago, who would declare all sorts of functions in their
headers and define all sort of syscalls in their libc, only to then not
actually implement them (they would return ENOSYS or ENOTSUPP) or only
implement them if you bought some extra option.
This was almost universally agreed to be a great annoyance to authors of
portable software and the consensus was to avoid this stuff as much as
possible. They changed things so that e.g. if you didn't buy the inet
package, you just wouldn't have the header files for inet stuff installed,
making it so that software could very easily detect if the feature was
available or not at build time.
Please don't bring back the mistakes of the past. If a function is not
present, don't declare it. Failing that, don't define it. But do not
define it and then just have it fail at runtime. That's a really bad
move.
Yours,
Robert Clausecker
--
() ascii ribbon campaign - for an encoding-agnostic world
/\ - against html email - against proprietary attachments
prev parent reply other threads:[~2024-10-26 10:10 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-25 20:01 Alyssa Ross
2024-10-25 20:10 ` Rich Felker
2024-10-25 21:38 ` Alyssa Ross
2024-10-26 1:21 ` Re[2]: " Laurent Bercot
2024-10-26 1:57 ` Thorsten Glaser
2024-10-26 2:11 ` Rich Felker
2024-10-26 8:26 ` Markus Wichmann
2024-10-26 10:28 ` Re[2]: " Laurent Bercot
2024-10-26 13:22 ` Markus Wichmann
2024-10-26 22:08 ` Thorsten Glaser
2024-10-26 23:03 ` Rich Felker
2024-10-30 9:28 ` Alyssa Ross
2024-10-30 12:37 ` enh
2024-10-26 23:35 ` Re[2]: " Laurent Bercot
2024-10-27 22:43 ` Yao Zi
2024-10-26 10:10 ` Robert Clausecker [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zxy__18VjfFBHncG@fuz.su \
--to=fuz@fuz.su \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).