[PATCH 1/1] s390: add missing limits.h header inclusion

Julien Olivain ju.o at free.fr
Fri Jul 19 10:47:44 PDT 2024


Commit b84fcdd48c [1] introduced a usage of PATH_MAX in file
"kexec-s390.c". This constant is defined in the <limits.h> header.
See [2].

With some libc, such as musl, kexec-tools fails to build with output:

    kexec/arch/s390/kexec-s390.c: In function 'remove_offline_memory':
    kexec/arch/s390/kexec-s390.c:120:19: error: 'PATH_MAX' undeclared (first use in this function)
      120 |         char path[PATH_MAX];
          |                   ^~~~~~~~

The issue can be reproduced, for example, with Buildroot Linux, using
a s390 gcc toolchain with the musl libc and the following commands:

    git clone -b 2024.05.1 --depth 1 https://gitlab.com/buildroot.org/buildroot.git
    cd buildroot
    cat > .config <<EOF
    BR2_s390x=y
    BR2_TOOLCHAIN_BUILDROOT_MUSL=y
    BR2_PACKAGE_KEXEC=y
    EOF
    make olddefconfig
    make

Note: in this test, kexec-tools v2.0.28 is used.

This commit fixes the issue by adding the missing header inclusion.

[1] https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=b84fcdd48cbe70e54e66f2cf1b251e0db58f04f4
[2] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html

Signed-off-by: Julien Olivain <ju.o at free.fr>
---
 kexec/arch/s390/kexec-s390.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kexec/arch/s390/kexec-s390.c b/kexec/arch/s390/kexec-s390.c
index f4dd7dc..ad3eb93 100644
--- a/kexec/arch/s390/kexec-s390.c
+++ b/kexec/arch/s390/kexec-s390.c
@@ -13,6 +13,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
+#include <limits.h>
 #include <stdint.h>
 #include <string.h>
 #include <getopt.h>
-- 
2.45.2




More information about the kexec mailing list