From: Philippe Waroquiers Date: Sat, 17 Aug 2019 16:27:22 +0000 (+0200) Subject: Fix compilation problem when __NR_preadv2 __NR_pwritev2 are undefined X-Git-Tag: VALGRIND_3_16_0~233 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4b39d3343762c53419cf16118c74e0004f900e32;p=thirdparty%2Fvalgrind.git Fix compilation problem when __NR_preadv2 __NR_pwritev2 are undefined check_preadv2_pwritev2.c: In function ‘main’: check_preadv2_pwritev2.c:12:12: error: ‘__NR_preadv2’ undeclared (first use in this function) syscall(__NR_preadv2, 0, NULL, 0, 0, 0); ^ check_preadv2_pwritev2.c:12:12: note: each undeclared identifier is reported only once for each function it appears in check_preadv2_pwritev2.c:15:12: error: ‘__NR_pwritev2’ undeclared (first use in this function) syscall(__NR_pwritev2, 0, NULL, 0, 0, 0); --- diff --git a/memcheck/tests/linux/check_preadv2_pwritev2.c b/memcheck/tests/linux/check_preadv2_pwritev2.c index 5333679e9d..a91caa6426 100644 --- a/memcheck/tests/linux/check_preadv2_pwritev2.c +++ b/memcheck/tests/linux/check_preadv2_pwritev2.c @@ -5,15 +5,23 @@ int main(int argc, char **argv) { - errno = 0; int has_preadv2 = 0; int has_pwritev2 = 0; - +#if defined(__NR_preadv2) + errno = 0; syscall(__NR_preadv2, 0, NULL, 0, 0, 0); has_preadv2 = errno != ENOSYS; +#else + has_preadv2 = 0; +#endif +#if defined(__NR_pwritev2) + errno = 0; syscall(__NR_pwritev2, 0, NULL, 0, 0, 0); has_pwritev2 = errno != ENOSYS; +#else + has_pwritev2 = 0; +#endif return !(has_preadv2 && has_pwritev2); }