Re: [PATCH] tools/nolibc: remove LINUX_REBOOT_ constants

From: Willy Tarreau
Date: Tue May 02 2023 - 02:32:25 EST


Hi Thomas,

On Fri, Apr 28, 2023 at 05:52:11PM +0200, Thomas Weißschuh wrote:
> The same constants and some more have been exposed to userspace via
> linux/reboot.h for a long time.
>
> To avoid conflicts and trim down nolibc a bit drop the custom
> definitions.

For me it breaks the build when including nolibc directly, so most
likely we need to include certain files:

In file included from /g/public/linux/master/tools/include/nolibc/nolibc.h:99,
from <command-line>:
/g/public/linux/master/tools/include/nolibc/sys.h: In function 'reboot':
/g/public/linux/master/tools/include/nolibc/sys.h:972:30: error: 'LINUX_REBOOT_MAGIC1' undeclared (first use in this function)
972 | int ret = sys_reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, cmd, 0);
| ^~~~~~~~~~~~~~~~~~~
/g/public/linux/master/tools/include/nolibc/sys.h:972:30: note: each undeclared identifier is reported only once for each function it appears in

I suspect it might be like the S_* macros for stat() that we had to
guard against. What build conflict did you meet ? I would like as well
to redefine the least possible and if we can make sure to fix the
conflict efficiently without breaking code, that would be better.

Thanks,
Willy