From: Willy Tarreau <w@1wt.eu>
To: "Thomas Weißschuh" <linux@weissschuh.net>
Cc: "Thomas Weißschuh" <thomas.weissschuh@linutronix.de>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/4] tools/nolibc: move FD_* definitions to sys/select.h
Date: Sun, 29 Jun 2025 11:25:52 +0200 [thread overview]
Message-ID: <20250629092552.GA30947@1wt.eu> (raw)
In-Reply-To: <d8d9ab91-0617-468e-a82d-9f271c5e6a7f@t-8ch.de>
On Sun, Jun 29, 2025 at 10:53:34AM +0200, Thomas Weißschuh wrote:
> On 2025-06-29 10:46:28+0200, Willy Tarreau wrote:
> > On Mon, Jun 23, 2025 at 04:56:18AM +0200, Willy Tarreau wrote:
> > > On Sun, Jun 22, 2025 at 09:58:52PM +0200, Thomas Weißschuh wrote:
> > > > On 2025-06-22 09:19:58+0200, Willy Tarreau wrote:
> > > > > Hi Thomas,
> > > > >
> > > > > On Sat, Jun 21, 2025 at 10:21:47AM +0200, Thomas Weißschuh wrote:
> > > > > > On 2025-06-20 12:02:50+0200, Willy Tarreau wrote:
> > > > > > > Modern programs tend to include sys/select.h to get FD_SET() and
> > > > > > > FD_CLR() definitions as well as struct fd_set, but in our case it
> > > > > > > didn't exist. Let's move these definitions from types.h to sys/select.h
> > > > > > > to help port existing programs.
> > > > > > >
> > > > > > > Signed-off-by: Willy Tarreau <w@1wt.eu>
> > > > > >
> > > > > > <snip>
> > > > > >
> > > > > > > diff --git a/tools/include/nolibc/types.h b/tools/include/nolibc/types.h
> > > > > > > index 16c6e9ec9451f..0b51ede4e0a9c 100644
> > > > > > > --- a/tools/include/nolibc/types.h
> > > > > > > +++ b/tools/include/nolibc/types.h
> > > > > > > @@ -10,6 +10,7 @@
> > > > > > > #ifndef _NOLIBC_TYPES_H
> > > > > > > #define _NOLIBC_TYPES_H
> > > > > > >
> > > > > > > +#include "sys/select.h"
> > > > > >
> > > > > > Is this really necessary?
> > > > >
> > > > > Not sure what you mean. Do you mean that you would have preferred it
> > > > > to be included from nolibc.h instead (which I'm equally fine with) or
> > > > > that you'd prefer to have an empty sys/select.h ?
> > > >
> > > > The former.
> > >
> > > OK thanks, you're right, that's more consistent with the rest,
> > > I'll do that and push it.
> >
> > Trying it has reopened the circular dependencies can of worms :-(
> > It's the same problem as usual that we've worked around till now
> > by placing some types in types.h, except that this time fd_set is
> > defined based on the macros FD_* that I moved to sys/select.h.
>
> Can't fd_set also move to sys/select.h? This is how I read fd_set(3).
That was what I did and precisely what was causing the problem. We
have sys.h defining select() with fd_set in it with sys/select not yet
being included. I moved sys.h after all sys/* and it broke something
else instead.
> Even if it is not standards compliant, for nolibc it won't matter as in
> the end everything is available anyaways.
Yeah I totally agree with you on that!
> > I'm giving up on this one for now as I don't want us to revisit
> > that painful dependencies sequence. In theory it should be as simple
> > as guarding types and function definitions independently, but in
> > reality it's never as rocket science as it can also pop up in macros
> > and rare typedefs.
>
> Also the headers are always included in the order written down in
> nolibc.h, so sys/select could be above types.h there.
In an ideal world we'd have all sys/* *before* anything else. But I
do remember that we faced a few issues doing this. This can be refined
though. I'm just careful because we have not been annoyed in a while,
so I suspect we're close to something good and it's easy to cause more
breakage than fixes by touching all of this.
> > Instead I'll just provide a stub for sys/select.h just like for
> > inttypes so that user code compiles without changing existing files.
>
> That works for me, too.
That's what I did in the end. We're just addressing annoying build
issues and not providing new stuff that deserves a full reorganization!
Cheers,
Willy
next prev parent reply other threads:[~2025-06-29 9:25 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-20 10:02 [PATCH 0/4] tools/nolibc: assorted fixes and small updates Willy Tarreau
2025-06-20 10:02 ` [PATCH 1/4] tools/nolibc: fix misleading help message regarding installation path Willy Tarreau
2025-06-20 10:02 ` [PATCH 2/4] tools/nolibc: add the more portable inttypes.h Willy Tarreau
2025-06-20 10:02 ` [PATCH 3/4] tools/nolibc: move FD_* definitions to sys/select.h Willy Tarreau
2025-06-21 8:21 ` Thomas Weißschuh
2025-06-22 7:19 ` Willy Tarreau
2025-06-22 19:58 ` Thomas Weißschuh
2025-06-23 2:56 ` Willy Tarreau
2025-06-29 8:46 ` Willy Tarreau
2025-06-29 8:53 ` Thomas Weißschuh
2025-06-29 9:25 ` Willy Tarreau [this message]
2025-06-29 9:37 ` Thomas Weißschuh
2025-06-29 9:40 ` Willy Tarreau
2025-06-29 15:10 ` Willy Tarreau
2025-06-29 15:54 ` Thomas Weißschuh
2025-06-29 16:08 ` Willy Tarreau
2025-06-29 16:14 ` Thomas Weißschuh
2025-06-29 16:19 ` Willy Tarreau
2025-06-29 16:27 ` Thomas Weißschuh
2025-06-29 17:56 ` Willy Tarreau
2025-06-20 10:02 ` [PATCH 4/4] tools/nolibc: add missing memchr() to string.h Willy Tarreau
2025-06-21 8:27 ` Thomas Weißschuh
2025-06-21 8:42 ` Willy Tarreau
2025-06-22 19:56 ` Thomas Weißschuh
2025-06-23 3:01 ` Willy Tarreau
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=20250629092552.GA30947@1wt.eu \
--to=w@1wt.eu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@weissschuh.net \
--cc=thomas.weissschuh@linutronix.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.