[PATCH 5/5] mtd-utils: add GNU_SOURCE define to c files

David Oberhollenzer david.oberhollenzer at sigma-star.at
Fri Nov 28 12:43:48 PST 2025


Hi,

your _GNU_SOURCE commit breaks the build (you removed limits.h
from libmtd_legacy.c). Besides that, I'm reluctant to remove
the global _GNU_SOURCE define, we might have a number of implicit
users across the source and the extensions we use are generally
useful.

While I think it's a valuable goal to be compatible with non-GNU
libc implementations like Musl, or klibc. Libraries like Musl
implement a good chunk anyway and for stuff that's really missing,
we have a libmissing.a.

Regarding the Linux header inclusions across the code, those
parts (e.g. rb-tree) have probably been lifted directly from
the Linux kernel tree. I don't think we should try to intentionally
try to diverge from the upstream version.

Also, what would we gain from portability here? Portability to
non-Linux based, non-GNU, Unix-like systems? What use would those
have for mtd-utils?


Anyway, I cherry-picked and applied the _POSIX_C_SOURCE patch to
mtd-utils.git master.

Thanks,

David




More information about the linux-mtd mailing list