mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Yuriy Chernyshov <>
Subject: [musl] Various conflicts with linux system headers (ioctl.h)
Date: Tue, 6 Dec 2022 11:36:24 +0100	[thread overview]
Message-ID: <> (raw)

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


I am trying to build DBMS software (ydb from with musl-libc.
So far, I have run into certain problems.

As YDB uses ioctl.h, it has to include both ioctl.h and certain headers
from linux/ itself. This gives me a bunch of conflicts around _IOC macros
family being defined by both:

The error looks as follows:

contrib/libs/musl/arch/generic/bits/ioctl.h:7:9: error: '_IOW' macro
> redefined [-Werror,-Wmacro-redefined]
> #define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c))
>         ^
> contrib/libs/linux-headers/asm-generic/ioctl.h:90:9: note: previous
> definition is here
> #define _IOW(type,nr,size)
>  _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))

The following workaround helps, but looks quite ugly:

--- arch/generic/bits/ioctl.h (b4624b83eafbdd5f2e2c37374d62426c27687f35)
> +++ arch/generic/bits/ioctl.h (d545cbc1ae3f5c9132eb26b176bef3638c9d8063)
> @@ -1,3 +1,9 @@
> +#undef _IO
> +#undef _IOC
> +#undef _IOR
> +#undef _IOW
> +#undef _IOWR
> +
>  #define _IOC(a,b,c,d) ( ((a)<<30) | ((b)<<8) | (c) | ((d)<<16) )
>  #define _IOC_NONE  0U
>  #define _IOC_WRITE 1U

Is it possible to get official solution for the macro conflict?

NB: we have to use linux/fs.h in order to get BLKGETSIZE64 constant defined
which is missing in sys/ioctl.h.

Another conflict is in NGROUPS_MAX value: musl sets it to 32, while Linux
itself (starting from 2.6.4, which is below the minimal version recommended
by musl) sets it to 65536.

It would be nice to have this value increased in musl itself.


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

             reply	other threads:[~2022-12-06 14:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-06 10:36 Yuriy Chernyshov [this message]
2022-12-11  5:53 ` Rich Felker
2022-12-11 11:07   ` Szabolcs Nagy
2022-12-11 12:26     ` Yuriy Chernyshov
2022-12-11 12:13   ` Yuriy Chernyshov

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \

* 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

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).