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 4f18ff2e29, but for sys/stat.h.
This commit is contained in:
Yu Watanabe
2025-07-07 11:40:42 +09:00
parent 0ae2ac9759
commit 83a047fe23
5 changed files with 5 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <sys/stat.h>
#include <unistd.h>
#include "alloc-util.h"

View File

@@ -1,6 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <getopt.h>
#include <sys/stat.h>
#include "sd-varlink.h"

View File

@@ -2,6 +2,7 @@
#pragma once
#include <fcntl.h>
#include <sys/stat.h>
#include "compress.h"
#include "forward.h"

View File

@@ -2,6 +2,7 @@
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include "alloc-util.h"
#include "bitfield.h"

View 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"