tools/nolibc: check for S_I* macros before defining them
authorWilly Tarreau <w@1wt.eu>
Sat, 4 Mar 2023 14:28:42 +0000 (15:28 +0100)
committerPaul E. McKenney <paulmck@kernel.org>
Mon, 20 Mar 2023 15:45:22 +0000 (08:45 -0700)
commit1c3a4c10cc3b89d9cfb1efa2e251c29da1941ee7
tree5eb5a3e581dfcf161e9900fbd840ee580af3f36a
parent3e2d337b94688b159e2f014248eb9cb6e0d494b5
tools/nolibc: check for S_I* macros before defining them

Defining S_I* flags in types.h can cause some build failures if
linux/stat.h is included prior to it. But if not defined, some toolchains
that include some glibc parts will in turn fail because linux/stat.h
already takes care of avoiding these definitions when glibc is present.

Let's preserve the macros here but first include linux/stat.h and check
for their definition before doing so. We also define the previously
missing permission macros so that we don't get a different behavior
depending on the first include found.

Cc: Feiyang Chen <chenfeiyang@loongson.cn>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
tools/include/nolibc/types.h