mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
virmockstathelpers: Load aliases for 64-bit time
On 32-bit arches, it's possible not only to request -D_FILE_OFFSET_BITS=64 (which is always done with meson) but also -D_TIME_BITS=64. With glibc, both of these affect what variant of stat() or lstat() is called. With 64 bit time it's: __stat64_time64() or __lstat64_time64(), respectively. Fortunately, no other variant (__xstat(), __xstat64()) has _time64 alternative and thus does not need similar treatment. Similarly, musl is not affected by this. Resolves: https://gitlab.com/libvirt/libvirt/-/issues/404 Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
6f80761c08
commit
b09441b1c5
@ -54,6 +54,10 @@
|
||||
* Unfortunately, because we are trying to mock replace the C library,
|
||||
* we need to know about this internal impl detail.
|
||||
*
|
||||
* Furthermore, support for 64-bit time can be enabled, which on 32-bit
|
||||
* systems with glibc overwrites stat64() to __stat64_time64() and lstat64()
|
||||
* to __lstat64_time64().
|
||||
*
|
||||
* On macOS stat() and lstat() are resolved to _stat$INODE64 and
|
||||
* _lstat$INODE64, respectively. stat(2) man page also declares that
|
||||
* stat64(), lstat64() and fstat64() are deprecated, and when
|
||||
@ -168,7 +172,11 @@ static void virMockStatInit(void)
|
||||
fdebug("real stat %p\n", real_stat);
|
||||
#endif
|
||||
#ifdef MOCK_STAT64
|
||||
# if defined(__GLIBC__) && defined(_TIME_BITS) && _TIME_BITS == 64
|
||||
VIR_MOCK_REAL_INIT_ALIASED(stat64, "__stat64_time64");
|
||||
# else
|
||||
VIR_MOCK_REAL_INIT(stat64);
|
||||
# endif
|
||||
fdebug("real stat64 %p\n", real_stat64);
|
||||
#endif
|
||||
#ifdef MOCK___XSTAT
|
||||
@ -188,7 +196,11 @@ static void virMockStatInit(void)
|
||||
fdebug("real lstat %p\n", real_lstat);
|
||||
#endif
|
||||
#ifdef MOCK_LSTAT64
|
||||
# if defined(__GLIBC__) && defined(_TIME_BITS) && _TIME_BITS == 64
|
||||
VIR_MOCK_REAL_INIT_ALIASED(lstat64, "__lstat64_time64");
|
||||
# else
|
||||
VIR_MOCK_REAL_INIT(lstat64);
|
||||
# endif
|
||||
fdebug("real lstat64 %p\n", real_lstat64);
|
||||
#endif
|
||||
#ifdef MOCK___LXSTAT
|
||||
|
Loading…
Reference in New Issue
Block a user