Re: [RFC] tools/nolibc: replace duplicated -ENOSYS return with single -ENOSYS return

From: Willy Tarreau
Date: Tue Aug 29 2023 - 02:30:37 EST


Hi all,

On Sun, Aug 27, 2023 at 11:17:19AM +0200, Thomas Weißschuh wrote:
> To be honest I don't see a problem with the current aproach.
> It is very obvious what is going on, the same pattern is used by other
> projects and the "overhead" is very small.
>
>
> It seems the macros will only work for simple cases which only test the
> availability of a single syscall number.
>
> Of these we currently only have:
> gettimeofday(), lseek(), statx(), wait4()
>
> So in it's current form we save 4 * 4 = 16 lines of code.
> The proposed solution introduces 14 + 2 (empty) = 16 lines of new code,
> and a bunch of mental overhead.
>
> In case multiple underlying syscalls can be used these take different
> arguments which a simple macro won't be able to encode sanely.

I totally agree, I would prefer all this to be manageable by humans with
no preprocessor brain implant as much as possible as well.

Thanks,
Willy