From: Emil Velikov Date: Sun, 15 Sep 2024 10:03:00 +0000 (+0100) Subject: build: check properly for __stat64_time64 X-Git-Tag: v34~338 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7c810bc191f4a591cebbdaee1a9fb7a196da82a8;p=thirdparty%2Fkmod.git build: check properly for __stat64_time64 Having learned from prior LFS64 experience the glibc developers have implemented stat in (albeit varying but) neater way: - declaration with asm linkage to __stat64_time64 - or, `#define stat __stat64_time64` - or, `#define stat stat64; #define stat64 __stat64_time64` In all cases __stat64_time64 lacks an explicit declaration, unlike open64, stat64, fopen64 mentioned earlier. Since we lack declaration, we have no other option but to check if a program with reference to __stat64_time64 can link, so we use the check/has function. For more details glibc commit aa03f722f3 ("linux: Add {f}stat{at} y2038 support") added internal. Signed-off-by: Emil Velikov Link: https://github.com/kmod-project/kmod/pull/131 Signed-off-by: Lucas De Marchi --- diff --git a/configure.ac b/configure.ac index 373250eb..39e33690 100644 --- a/configure.ac +++ b/configure.ac @@ -40,7 +40,7 @@ AC_PROG_CC_C99 ##################################################################### AC_CHECK_FUNCS_ONCE(__xstat) -AC_CHECK_FUNCS_ONCE([open64 stat64 fopen64]) +AC_CHECK_FUNCS_ONCE([open64 stat64 fopen64 __stat64_time64]) AC_CHECK_FUNCS_ONCE([__secure_getenv secure_getenv]) CC_CHECK_FUNC_BUILTIN([__builtin_clz]) diff --git a/meson.build b/meson.build index e37218cf..e543de44 100644 --- a/meson.build +++ b/meson.build @@ -35,7 +35,7 @@ cdata.set10('_GNU_SOURCE', true) _funcs = [ '__xstat', - 'open64', 'stat64', 'fopen64', + 'open64', 'stat64', 'fopen64', '__stat64_time64', '__secure_getenv', 'secure_getenv', ] foreach func : _funcs diff --git a/testsuite/path.c b/testsuite/path.c index 8bd2d8c1..26e0f4bc 100644 --- a/testsuite/path.c +++ b/testsuite/path.c @@ -196,7 +196,7 @@ WRAP_2ARGS(FILE*, NULL, fopen64, const char*); WRAP_2ARGS(int, -1, stat64, struct stat64*); #endif -#if HAVE_DECL___GLIBC__ +#ifdef HAVE___STAT64_TIME64 extern int __stat64_time64 (const char *file, void *buf); WRAP_2ARGS(int, -1, __stat64_time64, void *); #endif