From 05e2747bf2abd9e6bb301fd2b6884946833b06ed Mon Sep 17 00:00:00 2001 From: Alexander Moch Date: Tue, 2 Dec 2025 20:14:09 +0000 Subject: [PATCH] Provide loff_t via on musl-based Linux systems Musl exposes loff_t only as a macro in when _GNU_SOURCE is defined. Including ensures the type is available, and a fallback typedef is provided when no macro is defined. This fixes build failures on musl systems. Reviewed-by: Brian Behlendorf Reviewed-by: Rob Norris Signed-off-by: Alexander Moch Closes #18002 --- lib/libspl/include/sys/types.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/libspl/include/sys/types.h b/lib/libspl/include/sys/types.h index 9af20d781..37cf1d241 100644 --- a/lib/libspl/include/sys/types.h +++ b/lib/libspl/include/sys/types.h @@ -54,4 +54,15 @@ typedef int projid_t; typedef off_t loff_t; #endif +/* + * On musl, loff_t is a macro within fcntl.h when _GNU_SOURCE is defined. + * If no macro is defined, a typedef fallback is provided. + */ +#if defined(__linux__) && !defined(__GLIBC__) +#include +#ifndef loff_t +typedef off_t loff_t; +#endif +#endif + #endif