]> git.ipfire.org Git - thirdparty/libvirt.git/commit
meson: tests: virmockstathelpers: replace check for _FILE_OFFSET_BITS
authorPavel Hrdina <phrdina@redhat.com>
Fri, 24 Jul 2020 12:02:39 +0000 (14:02 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Mon, 3 Aug 2020 07:26:36 +0000 (09:26 +0200)
commit1ba97d7f6bb21416cfd2ac6387e449dd3f3031c3
treead4223884fbc0f0a0db5641f870480fadf1805d0
parent2298b42878ac7ead8fb2c2704331b1f471656049
meson: tests: virmockstathelpers: replace check for _FILE_OFFSET_BITS

Meson always defines _FILE_OFFSET_BITS=64 which effectively makes
mocking of non 64-bit stat functions dead code.

On linux it was not an issue because we use the 64-bit versions but
on FreeBSD there are not 64-bit versions, there is only stat & lstat.

We cannot simply drop the check as that would resolve to compilation
error on 64-bit linux:

{standard input}: Assembler messages:
{standard input}:11468: Error: symbol `__xstat64' is already defined
{standard input}:11679: Error: symbol `__xstat64.cold' is already defined
{standard input}:12034: Error: symbol `__lxstat64' is already defined
{standard input}:12245: Error: symbol `__lxstat64.cold' is already defined

So we have to replace the _FILE_OFFSET_BITS with a check if the
corresponding 64-bit version of the stat function exists.

Replicate the meson behavior by always defining _FILE_OFFSET_BITS
instead of using AC_SYS_LARGEFILE otherwise this change would break
our tests.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
configure.ac
tests/virmockstathelpers.c