From 83a047fe23238bebc91659394949c6046f66a78f Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Mon, 7 Jul 2025 11:40:42 +0900 Subject: [PATCH] tree-wide: include sys/stat.h where necessary These source files uses symbols provided by sys/stat.h, e.g. struct stat, S_IFREG, S_IFBLK, and so on. Let's explicitly include sys/stat.h where necessary. Glibc's fcntl.h includes bits/stat.h, which provides these symbols, so these symbols can be used without explicitly including sys/stat.h. But, based on the discussion in #37922, we should explicitly include relevant headers, and should not rely on the indirect inclusion. Similar to 4f18ff2e29b8054f30b084abcabf5f689f4b340b, but for sys/stat.h. --- src/basic/env-file.c | 1 + src/bootctl/bootctl.c | 1 + src/libsystemd/sd-journal/journal-file.h | 1 + src/libsystemd/sd-journal/mmap-cache.c | 1 + src/run/run.c | 1 + 5 files changed, 5 insertions(+) diff --git a/src/basic/env-file.c b/src/basic/env-file.c index f9d63aefed0..968cd756bdc 100644 --- a/src/basic/env-file.c +++ b/src/basic/env-file.c @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ +#include #include #include "alloc-util.h" diff --git a/src/bootctl/bootctl.c b/src/bootctl/bootctl.c index 36744bece1d..0bd7aa2e41c 100644 --- a/src/bootctl/bootctl.c +++ b/src/bootctl/bootctl.c @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #include +#include #include "sd-varlink.h" diff --git a/src/libsystemd/sd-journal/journal-file.h b/src/libsystemd/sd-journal/journal-file.h index 68317f13086..1fcfafbb16e 100644 --- a/src/libsystemd/sd-journal/journal-file.h +++ b/src/libsystemd/sd-journal/journal-file.h @@ -2,6 +2,7 @@ #pragma once #include +#include #include "compress.h" #include "forward.h" diff --git a/src/libsystemd/sd-journal/mmap-cache.c b/src/libsystemd/sd-journal/mmap-cache.c index 2c2f6c677d3..f49ca12ba4e 100644 --- a/src/libsystemd/sd-journal/mmap-cache.c +++ b/src/libsystemd/sd-journal/mmap-cache.c @@ -2,6 +2,7 @@ #include #include +#include #include "alloc-util.h" #include "bitfield.h" diff --git a/src/run/run.c b/src/run/run.c index 484a7d3a6f6..b87de821374 100644 --- a/src/run/run.c +++ b/src/run/run.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include "sd-bus.h" -- 2.47.3