mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: "Arnd Bergmann" <arnd@arndb.de>,
	"Thomas Weißschuh" <thomas.weissschuh@linutronix.de>,
	"Eric Dumazet" <edumazet@google.com>,
	"Kuniyuki Iwashima" <kuniyu@google.com>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Willem de Bruijn" <willemb@google.com>,
	libc-alpha@sourceware.org, "Carlos O'Donell" <carlos@redhat.com>,
	"Adhemerval Zanella" <adhemerval.zanella@linaro.org>,
	"Rich Felker" <dalias@libc.org>
Cc: Netdev <netdev@vger.kernel.org>,
	linux-kernel@vger.kernel.org, linux-api@vger.kernel.org,
	klibc@zytor.com
Subject: Re: [klibc] [PATCH net-next] net: uapi: Provide an UAPI definition of 'struct sockaddr'
Date: Tue, 20 Jan 2026 10:50:18 -0800	[thread overview]
Message-ID: <0fc5b4ef-c468-416f-a065-f64989d75378@zytor.com> (raw)
In-Reply-To: <934ca004-0aef-49a4-a4f1-3d39a2e71864@app.fastmail.com>

On 2026-01-05 05:50, Arnd Bergmann wrote:
> 
> This looks like the right approach to me. I have previously
> tried to introduce a 'struct __kernel_sockaddr' structure and
> use that in uapi headers in place of the libc sockaddr, but
> that seemed worse in the end, and introduce the same problems
> as using the existing __kernel_sockaddr_storage.
> 

You say "the same problems". It's not clear to me what that means.

Based on my own libc experience, hacking both a minimal (klibc) and a
maximal (glibc) libc, there are a *lot* of advantages to having
__kernel_* definitions available, *regardless* of if they are exported
into the libc namespace at all.

Specifically:

1. When calling explicit kernel interfaces, like ioctl(), it is the
   kernel interfaces, not the libc interfaces, that needs to be
   used. However, the rest of the application may need to include the
   libc headers.

2. The libc *implementation* may need to have both the kernel and the
   libc interfaces available.

In the case of struct sockaddr et al, it probably matters less,
because it isn't practical for them to be different for other
reasons, but it has been a real problem for things like termios.

On the flipside, for things where the kernel interfaces are inherently
necessary, we really want the libc authors to be able to use the uapi
headers. However, they have to be concerned about things like
namespace restrictions.

So I have a very, very strong vote for using and even expanding the
use of __kernel_* in the uapi headers. In fact, it would even be nice
to have a variant of "make headers_install" that automatically
transmogrifies symbols; if it isn't doable with simple pattern
matching then perhaps using coccinelle.

Allowing the libc authors to modify those transmogrification rules
would definitely be better than having various kinds of header guards.

	-hpa

  reply	other threads:[~2026-01-20 18:50 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-05  8:25 Thomas Weißschuh
2026-01-05 13:50 ` Arnd Bergmann
2026-01-20 18:50   ` H. Peter Anvin [this message]
2026-01-20 22:31     ` [klibc] " Arnd Bergmann
2026-01-20 23:20       ` H. Peter Anvin
2026-01-30 11:02         ` Thomas Weißschuh
2026-01-05 17:57 ` Jakub Kicinski
2026-01-06 10:32   ` Thomas Weißschuh
2026-01-06 23:13     ` Jakub Kicinski
2026-01-09 12:56       ` Arnd Bergmann
2026-01-12 11:42         ` Florian Weimer
2026-01-12 11:55           ` Thomas Weißschuh
2026-01-12 13:25             ` Florian Weimer
2026-01-12 13:33               ` Thomas Weißschuh
2026-01-12 13:37                 ` Florian Weimer

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=0fc5b4ef-c468-416f-a065-f64989d75378@zytor.com \
    --to=hpa@zytor.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=arnd@arndb.de \
    --cc=carlos@redhat.com \
    --cc=dalias@libc.org \
    --cc=edumazet@google.com \
    --cc=klibc@zytor.com \
    --cc=kuniyu@google.com \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=thomas.weissschuh@linutronix.de \
    --cc=willemb@google.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®