]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
include/statfs_magic.h: add portable struct statfs headers for Darwin
authorMorgan Jones <me@numin.it>
Mon, 6 Apr 2026 01:03:54 +0000 (18:03 -0700)
committerKarel Zak <kzak@redhat.com>
Tue, 7 Apr 2026 12:43:01 +0000 (14:43 +0200)
Fixes the build on Darwin since struct statfs is in sys/mount.h
and sys/vfs.h doesn't even exist. Just conditionally include all the
headers.

[kzak@redhat.com: - removed lib/pidfd-utils.c change]

Signed-off-by: Karel Zak <kzak@redhat.com>
include/statfs_magic.h

index 6921abaa4dcefd9dbcb26533ab797f8da0b7b043..28977f39293d68b24aa7485fa845fa7339d0cebd 100644 (file)
@@ -5,10 +5,26 @@
 #ifndef UTIL_LINUX_STATFS_MAGIC_H
 #define UTIL_LINUX_STATFS_MAGIC_H
 
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
 #ifdef HAVE_SYS_STATFS_H
 # include <sys/statfs.h>
 #endif
 
+#ifdef HAVE_SYS_VFS_H
+# include <sys/vfs.h>
+#endif
+
+#ifdef HAVE_SYS_MOUNT_H
+# include <sys/mount.h>
+#endif
+
 /*
  * If possible then don't depend on internal libc __SWORD_TYPE type.
  */