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);
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);
}