@@ -1393,6 +1393,89 @@ tf_recvmsg (void *arg)
static void *
+tf_recvmmsg (void *arg)
+{
+ struct sockaddr_un sun;
+
+ tempfd = socket (AF_UNIX, SOCK_DGRAM, 0);
+ if (tempfd == -1)
+ {
+ printf ("%s: first socket call failed\n", __FUNCTION__);
+ exit (1);
+ }
+
+ int tries = 0;
+ do
+ {
+ if (++tries > 10)
+ {
+ printf ("%s: too many unsuccessful bind calls\n", __FUNCTION__);
+ }
+
+ strcpy (sun.sun_path, "/tmp/tst-cancel4-socket-5-XXXXXX");
+ if (mktemp (sun.sun_path) == NULL)
+ {
+ printf ("%s: cannot generate temp file name\n", __FUNCTION__);
+ exit (1);
+ }
+
+ sun.sun_family = AF_UNIX;
+ }
+ while (bind (tempfd, (struct sockaddr *) &sun,
+ offsetof (struct sockaddr_un, sun_path)
+ + strlen (sun.sun_path) + 1) != 0);
+
+ tempfname = strdup (sun.sun_path);
+
+ tempfd2 = socket (AF_UNIX, SOCK_DGRAM, 0);
+ if (tempfd2 == -1)
+ {
+ printf ("%s: second socket call failed\n", __FUNCTION__);
+ exit (1);
+ }
+
+ int r = pthread_barrier_wait (&b2);
+ if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+ {
+ printf ("%s: barrier_wait failed\n", __FUNCTION__);
+ exit (1);
+ }
+
+ if (arg != NULL)
+ {
+ r = pthread_barrier_wait (&b2);
+ if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+ {
+ printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__);
+ exit (1);
+ }
+ }
+
+ pthread_cleanup_push (cl, NULL);
+
+ char mem[70];
+ struct iovec iov[1];
+ iov[0].iov_base = mem;
+ iov[0].iov_len = arg == NULL ? sizeof (mem) : 0;
+
+ struct mmsghdr mm;
+ mm.msg_hdr.msg_name = &sun;
+ mm.msg_hdr.msg_namelen = sizeof (sun);
+ mm.msg_hdr.msg_iov = iov;
+ mm.msg_hdr.msg_iovlen = 1;
+ mm.msg_hdr.msg_control = NULL;
+ mm.msg_hdr.msg_controllen = 0;
+
+ recvmmsg (tempfd2, &mm, 1, 0, NULL);
+
+ pthread_cleanup_pop (0);
+
+ printf ("%s: recvmmsg returned\n", __FUNCTION__);
+
+ exit (1);
+}
+
+static void *
tf_open (void *arg)
{
if (arg == NULL)
@@ -1937,6 +2020,92 @@ tf_sendmsg (void *arg)
static void *
+tf_sendmmsg (void *arg)
+{
+ if (arg == NULL)
+ // XXX If somebody can provide a portable test case in which sendmmsg()
+ // blocks we can enable this test to run in both rounds.
+ abort ();
+
+ struct sockaddr_un sun;
+
+ tempfd = socket (AF_UNIX, SOCK_DGRAM, 0);
+ if (tempfd == -1)
+ {
+ printf ("%s: first socket call failed\n", __FUNCTION__);
+ exit (1);
+ }
+
+ int tries = 0;
+ do
+ {
+ if (++tries > 10)
+ {
+ printf ("%s: too many unsuccessful bind calls\n", __FUNCTION__);
+ }
+
+ strcpy (sun.sun_path, "/tmp/tst-cancel4-socket-7-XXXXXX");
+ if (mktemp (sun.sun_path) == NULL)
+ {
+ printf ("%s: cannot generate temp file name\n", __FUNCTION__);
+ exit (1);
+ }
+
+ sun.sun_family = AF_UNIX;
+ }
+ while (bind (tempfd, (struct sockaddr *) &sun,
+ offsetof (struct sockaddr_un, sun_path)
+ + strlen (sun.sun_path) + 1) != 0);
+ tempfname = strdup (sun.sun_path);
+
+ tempfd2 = socket (AF_UNIX, SOCK_DGRAM, 0);
+ if (tempfd2 == -1)
+ {
+ printf ("%s: second socket call failed\n", __FUNCTION__);
+ exit (1);
+ }
+
+ int r = pthread_barrier_wait (&b2);
+ if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+ {
+ printf ("%s: barrier_wait failed\n", __FUNCTION__);
+ exit (1);
+ }
+
+ r = pthread_barrier_wait (&b2);
+ if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
+ {
+ printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__);
+ exit (1);
+ }
+
+ pthread_cleanup_push (cl, NULL);
+
+ char mem[1];
+ struct iovec iov[1];
+ iov[0].iov_base = mem;
+ iov[0].iov_len = 1;
+
+ struct mmsghdr mm;
+ mm.msg_hdr.msg_name = &sun;
+ mm.msg_hdr.msg_namelen = (offsetof (struct sockaddr_un, sun_path)
+ + strlen (sun.sun_path) + 1);
+ mm.msg_hdr.msg_iov = iov;
+ mm.msg_hdr.msg_iovlen = 1;
+ mm.msg_hdr.msg_control = NULL;
+ mm.msg_hdr.msg_controllen = 0;
+
+ sendmmsg (tempfd2, &mm, 1, 0);
+
+ pthread_cleanup_pop (0);
+
+ printf ("%s: sendmmsg returned\n", __FUNCTION__);
+
+ exit (1);
+}
+
+
+static void *
tf_creat (void *arg)
{
if (arg == NULL)
@@ -2230,6 +2399,7 @@ static struct
ADD_TEST (recv, 2, 0),
ADD_TEST (recvfrom, 2, 0),
ADD_TEST (recvmsg, 2, 0),
+ ADD_TEST (recvmmsg, 2, 0),
ADD_TEST (preadv, 2, 1),
ADD_TEST (pwritev, 2, 1),
ADD_TEST (open, 2, 1),
@@ -2241,6 +2411,7 @@ static struct
ADD_TEST (msync, 2, 1),
ADD_TEST (sendto, 2, 1),
ADD_TEST (sendmsg, 2, 1),
+ ADD_TEST (sendmmsg, 2, 1),
ADD_TEST (creat, 2, 1),
ADD_TEST (connect, 2, 1),
ADD_TEST (tcdrain, 2, 1),