From: Dmitry V. Levin Date: Tue, 12 Jan 2016 04:37:06 +0000 (+0000) Subject: tests/mmsg.c: fix build on rhel6/ppc X-Git-Tag: v4.12~649 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=eb4649a0dc0bfaa0df336de5dc95b41612e0b42d;p=strace tests/mmsg.c: fix build on rhel6/ppc There are weird platforms that define __NR_sendmmsg but at the same time do not define __NR_recvmmsg. Add a workaround for them. * configure.ac (AC_CHECK_FUNCS): Add recvmmsg. * tests/mmsg.c: Check for __NR_recvmmsg || HAVE_RECVMMSG. --- diff --git a/configure.ac b/configure.ac index 82573e58..21b83372 100644 --- a/configure.ac +++ b/configure.ac @@ -295,6 +295,7 @@ AC_CHECK_FUNCS(m4_normalize([ preadv process_vm_readv pwritev + recvmmsg sendmmsg sigaction signalfd diff --git a/tests/mmsg.c b/tests/mmsg.c index 630ad1dd..0c9c7115 100644 --- a/tests/mmsg.c +++ b/tests/mmsg.c @@ -29,7 +29,8 @@ #include "tests.h" # include -#if defined __NR_sendmmsg || defined HAVE_SENDMMSG +#if (defined __NR_sendmmsg || defined HAVE_SENDMMSG) \ + && (defined __NR_recvmmsg || defined HAVE_RECVMMSG) # include # include @@ -64,13 +65,13 @@ recv_mmsg(int fd, struct mmsghdr *vec, unsigned int vlen, unsigned int flags, struct timespec *timeout) { int rc; -#ifdef __NR_sendmmsg +#ifdef __NR_recvmmsg rc = syscall(__NR_recvmmsg, (long) fd, vec, (unsigned long) vlen, (unsigned long) flags, timeout); if (rc >= 0 || ENOSYS != errno) return rc; #endif -#ifdef HAVE_SENDMMSG +#ifdef HAVE_RECVMMSG rc = recvmmsg(fd, vec, vlen, flags, timeout); #endif return rc; @@ -140,6 +141,6 @@ main(void) #else -SKIP_MAIN_UNDEFINED("__NR_sendmmsg || HAVE_SENDMMSG") +SKIP_MAIN_UNDEFINED("(__NR_sendmmsg || HAVE_SENDMMSG) && (__NR_recvmmsg || HAVE_RECVMMSG)") #endif