mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Petr Vorel <petr.vorel@gmail.com>
To: musl@lists.openwall.com, Rich Felker <dalias@aerifal.cx>,
	Szabolcs Nagy <nsz@port70.net>
Subject: Re: [RFC] fanotify_event_info_fid incompatibility
Date: Tue, 12 Nov 2019 21:58:31 +0100	[thread overview]
Message-ID: <20191112205831.GA27331@x230> (raw)
In-Reply-To: <20191112204619.GI25646@port70.net>

Hi,

> * Petr Vorel <petr.vorel@gmail.com> [2019-11-12 21:05:20 +0100]:
> > musl defines struct fanotify_event_info_fid member fsid as fsid_t. This
> > conflicts with version from Linux kernel, which defines it as __kernel_fsid_t
> > (musl's fsid_t has int __val[2], kernel's __kernel_fsid_t has int val[2]).

> > I see commit 32b82cf5 ("fix the fsid_t structure to match name of __val"),
> > which looks correct to me.

> > I also think it's wrong, that other libc (at least glibc, uclibc-ng, bionic)
> > don't define fanotify_event_info_fid and other structs thus users are forced to
> > use definition from <linux/fanotify.h>. But can be something done with this
> > incompatibility?

> yeah, glibc sys/fanotify.h just includes linux/fanotify.h
> which uses linux types instead of libc ones, this is a
> common pattern and there is no clean solution if users
> rely on that

> in such cases i try to keep updating sys/foo.h following
> linux/foo.h changes, but in musl i try to use libc types
> (e.g. if a field is __u64 then passing a pointer to it as
> uint64_t* may not be valid so the glibc way is quite
> problematic)

Although I understand a reasons for using fsid_t instead of __kernel_fsid_t (and
generally the approach of updating sys/foo.h), I still think that trying to
define a kernel structure in libc but using different members isn't really user
friendly :(.

> glibc fsid_t uses __val but the __kernel_fsid_t has val,
> musl could use a different type instead of fsid_t for
> fanotify that has __val, but it's a bit ugly, is there a
> reason to access fsid_t.val?

LTP fanotify tests access it. Understand, that LTP is not typical user-space
application (+ we can handle it either with autotools detection or just use
<linux/fanotify.h> instead of <sys/fanotify.h>).

Kind regards,
Petr

[1] https://github.com/linux-test-project/ltp/tree/master/testcases/kernel/syscalls/fanotify


  reply	other threads:[~2019-11-12 20:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-12 20:05 Petr Vorel
2019-11-12 20:30 ` Petr Vorel
2019-11-12 20:46 ` Szabolcs Nagy
2019-11-12 20:58   ` Petr Vorel [this message]
2019-11-12 21:29     ` Szabolcs Nagy
2019-11-12 22:01       ` Petr Vorel

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=20191112205831.GA27331@x230 \
    --to=petr.vorel@gmail.com \
    --cc=dalias@aerifal.cx \
    --cc=musl@lists.openwall.com \
    --cc=nsz@port70.net \
    /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).