mailing list of musl libc
 help / color / mirror / code / Atom feed
From: enh <enh@google.com>
To: musl@lists.openwall.com
Cc: Rich Felker <dalias@libc.org>
Subject: Re: [musl] Prototypes without implementations
Date: Wed, 30 Oct 2024 08:37:30 -0400	[thread overview]
Message-ID: <CAJgzZoqBkZdxvRSskGZCm7-Q+-ja32LB0+FJZgtFknOCRb1LYA@mail.gmail.com> (raw)
In-Reply-To: <87ldy67xdg.fsf@alyssa.is>

[-- Attachment #1: Type: text/plain, Size: 3305 bytes --]

fwiw, this came up for Android recently... we'd never had the header before
but the
https://blog.chromium.org/2024/06/building-faster-smarter-chromebook.html
work meant we needed new x86-only stuff for the first time in a decade.

we basically went with this:

#if defined(__NR_iopl)
static __inline int ioperm(unsigned long __from, unsigned long __n, int
__enabled) {
  return syscall(__NR_ioperm, __from, __n, __enabled);
}
#endif

(which answers the "some architectures" part, even though for Android
that's only x86/x86-64.)

here's my commit message with more rationale for why i made them static
inlines:

"""
Add <sys/io.h>.

This is unusual in being inline-only, but these are (a) trivial functions,
(b) ancient functions, and (c) unusable by apps. Plus they're arriving just
too late for API 35, which definitely influenced by "this is silly"
decision! They're also x86/x86-64 only, though that's a neutral argument
because it would mean almost no-one will be affected no matter what choice
we make here.

There is an argument for going the usual "callers should just have their
own header-only implementation that they `-include` on the compiler command
line" route, but the x86/x86-64 I/O port stuff isn't going away just yet,
and LTP was also already working around the absence of these.
"""

https://android-review.googlesource.com/c/platform/bionic/+/3135242

On Wed, Oct 30, 2024 at 5:29 AM Alyssa Ross <hi@alyssa.is> wrote:

> Rich Felker <dalias@libc.org> writes:
>
> > Can we use the remainder of this thread for figuring out the real
> > status of this (what's with non-x86 archs that have the syscalls? are
> > they used? what about archs that don't use them? do they have you mmap
> > a device instead?) and whether there's some action that should be
> > taken, rather than rehashing broad philosophy? :)
>
> On all the other architectures where musl has SYS_ioperm defined, it's
> mapped to sys_ni_syscall (ENOSYS), and has been at least since git was
> introduced.
>
> Glibc provides a fallback that uses /dev/mem on alpha, but no other
> architecture.  In the past, it also provided an implementation for arm,
> which was removed in the following commit:
>
>         commit 6b33f373c7b9199e00ba5fbafd94ac9bfb4337b1
>         Author: Florian Weimer <fweimer@redhat.com>
>         Date:   Wed May 29 16:53:09 2019 +0200
>
>             arm: Remove ioperm/iopl/inb/inw/inl/outb/outw/outl support
>
>             Linux only supports the required ISA sysctls on StrongARM
> devices,
>             which are armv4 and no longer tested during glibc development
>             and probably bit-rotted by this point.  (No reported test
> results,
>             and the last discussion of armv4 support was in the glibc 2.19
>             release notes.)
>
> The functions remain on arm, but they are just ENOSYS stubs.
>
> Does any of that make it any clearer what should be done in musl to
> solve the prototypes without implementations problem?
>
> I guess it does make sense for musl to define __SYS_ioperm on
> microblaze, mips, powerpc and powerpc64 — it's in the kernel syscall
> table for those architectures, even though as far as I can tell it has
> never done anything other than return ENOSYS.
>

[-- Attachment #2: Type: text/html, Size: 4281 bytes --]

  reply	other threads:[~2024-10-30 12:38 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 [this message]
2024-10-26 23:35             ` Re[2]: " Laurent Bercot
2024-10-27 22:43             ` Yao Zi
2024-10-26 10:10       ` Robert Clausecker

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=CAJgzZoqBkZdxvRSskGZCm7-Q+-ja32LB0+FJZgtFknOCRb1LYA@mail.gmail.com \
    --to=enh@google.com \
    --cc=dalias@libc.org \
    --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).