util-linux: fix 2.42 compile on Darwin
Patch submitted upstream: https://lore.kernel.org/util-linux/CAEUYr6ZjVX1bd-xcBGtFN_ZYwQnXDYsw7d1-7sTpF2BbgfrR+g@mail.gmail.com/T/
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
From 145b6a66dcc725de3c3161db62db7047eb407214 Mon Sep 17 00:00:00 2001
|
||||
From: Morgan Jones <me@numin.it>
|
||||
Date: Sun, 5 Apr 2026 18:03:54 -0700
|
||||
Subject: [PATCH] pidfd-utils: include correct struct statfs header for darwin
|
||||
|
||||
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.
|
||||
---
|
||||
include/statfs_magic.h | 16 ++++++++++++++++
|
||||
lib/pidfd-utils.c | 3 ---
|
||||
2 files changed, 16 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/include/statfs_magic.h b/include/statfs_magic.h
|
||||
index 6921abaa4..28977f392 100644
|
||||
--- a/include/statfs_magic.h
|
||||
+++ b/include/statfs_magic.h
|
||||
@@ -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.
|
||||
*/
|
||||
diff --git a/lib/pidfd-utils.c b/lib/pidfd-utils.c
|
||||
index a83735920..f7c649144 100644
|
||||
--- a/lib/pidfd-utils.c
|
||||
+++ b/lib/pidfd-utils.c
|
||||
@@ -5,9 +5,6 @@
|
||||
* Authors: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu> [2025]
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
-#include <sys/stat.h>
|
||||
-#include <sys/vfs.h>
|
||||
-#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
#include <err.h>
|
||||
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -55,6 +55,10 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
# which isn't valid on NixOS (and a compatibility link on most other modern
|
||||
# distros anyway).
|
||||
./rtcwake-search-PATH-for-shutdown.patch
|
||||
|
||||
# Fix compile of 2.42+ on Darwin.
|
||||
# https://lore.kernel.org/util-linux/CAEUYr6ZjVX1bd-xcBGtFN_ZYwQnXDYsw7d1-7sTpF2BbgfrR+g@mail.gmail.com/T/#u
|
||||
./include-correct-struct-statfs-header.patch
|
||||
];
|
||||
|
||||
# We separate some of the utilities into their own outputs. This
|
||||
|
||||
Reference in New Issue
Block a user