]> granicus.if.org Git - strace/commitdiff
tests/mmsg.c: fix build on rhel6/ppc
authorDmitry V. Levin <ldv@altlinux.org>
Tue, 12 Jan 2016 04:37:06 +0000 (04:37 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 12 Jan 2016 05:06:10 +0000 (05:06 +0000)
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.

configure.ac
tests/mmsg.c

index 82573e58ff0ef3261857c0aff6e7a8aa57bbfc66..21b83372dbf3264cde3a81f714727aa41338513a 100644 (file)
@@ -295,6 +295,7 @@ AC_CHECK_FUNCS(m4_normalize([
        preadv
        process_vm_readv
        pwritev
+       recvmmsg
        sendmmsg
        sigaction
        signalfd
index 630ad1ddc34491fdfe6ff4f53cbbc3fa671cca39..0c9c7115864efbd9b73fb5273a9998d9d4a0e7fd 100644 (file)
@@ -29,7 +29,8 @@
 #include "tests.h"
 # include <sys/syscall.h>
 
-#if defined __NR_sendmmsg || defined HAVE_SENDMMSG
+#if (defined __NR_sendmmsg || defined HAVE_SENDMMSG) \
+ && (defined __NR_recvmmsg || defined HAVE_RECVMMSG)
 
 # include <assert.h>
 # include <errno.h>
@@ -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