]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: include sys/stat.h where necessary
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 7 Jul 2025 02:40:42 +0000 (11:40 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 7 Jul 2025 03:44:10 +0000 (12:44 +0900)
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
src/bootctl/bootctl.c
src/libsystemd/sd-journal/journal-file.h
src/libsystemd/sd-journal/mmap-cache.c
src/run/run.c

index f9d63aefed0a024176c3243349ec0742d54a9918..968cd756bdce8e8022743d70f70b930fb142e041 100644 (file)
@@ -1,5 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include <sys/stat.h>
 #include <unistd.h>
 
 #include "alloc-util.h"
index 36744bece1d25e5c9225da71b5be451ff1301480..0bd7aa2e41cc376f2468910cbad494d39a6c0210 100644 (file)
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include <getopt.h>
+#include <sys/stat.h>
 
 #include "sd-varlink.h"
 
index 68317f1308607c36642e8a8b02de505672751b61..1fcfafbb16e28a33325ed7012aa86d71f988751b 100644 (file)
@@ -2,6 +2,7 @@
 #pragma once
 
 #include <fcntl.h>
+#include <sys/stat.h>
 
 #include "compress.h"
 #include "forward.h"
index 2c2f6c677d35763c381b443c6ef7d29b302be82e..f49ca12ba4ec5f64647a540910368625a1890d6a 100644 (file)
@@ -2,6 +2,7 @@
 
 #include <stdlib.h>
 #include <sys/mman.h>
+#include <sys/stat.h>
 
 #include "alloc-util.h"
 #include "bitfield.h"
index 484a7d3a6f6a69cdb26bb55eee339f11e06bae65..b87de821374ade9966139948375c743f70059a8a 100644 (file)
@@ -5,6 +5,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/resource.h>
+#include <sys/stat.h>
 #include <unistd.h>
 
 #include "sd-bus.h"