]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
build: check properly for __stat64_time64
authorEmil Velikov <emil.l.velikov@gmail.com>
Sun, 15 Sep 2024 10:03:00 +0000 (11:03 +0100)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Tue, 17 Sep 2024 03:01:34 +0000 (22:01 -0500)
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 <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/131
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
configure.ac
meson.build
testsuite/path.c

index 373250eb18eded5ee0dd50ad0c7cf344cf4e4623..39e336900bece76f7234804b7c3fd5935a4f776b 100644 (file)
@@ -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])
index e37218cfa0adf325490276642de25862dfd291e4..e543de4492eee0a9c6ceb278334c6c36c6ea3da8 100644 (file)
@@ -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
index 8bd2d8c1aacd023c89a30f44359607eb5fb0d5bf..26e0f4bcef0109a69177e15670c6ee1b94535d7e 100644 (file)
@@ -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