|
Message-ID: <Zxy__18VjfFBHncG@fuz.su> Date: Sat, 26 Oct 2024 12:10:07 +0200 From: Robert Clausecker <fuz@....su> To: musl@...ts.openwall.com Subject: Re: Prototypes without implementations 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
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.