diff options
Diffstat (limited to 'nptl')
-rw-r--r-- | nptl/tst-cancel4.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/nptl/tst-cancel4.c b/nptl/tst-cancel4.c index 1478174028..f3c4b0c2be 100644 --- a/nptl/tst-cancel4.c +++ b/nptl/tst-cancel4.c @@ -1554,6 +1554,50 @@ tf_pwrite (void *arg) exit (1); } +static void * +tf_preadv (void *arg) +{ + int fd; + int r; + + if (arg == NULL) + /* XXX If somebody can provide a portable test case in which preadv + blocks we can enable this test to run in both rounds. */ + abort (); + + char fname[] = "/tmp/tst-cancel4-fd-XXXXXX"; + tempfd = fd = mkstemp (fname); + if (fd == -1) + printf ("%s: mkstemp failed\n", __FUNCTION__); + unlink (fname); + + 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: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + ssize_t s; + pthread_cleanup_push (cl, NULL); + + char buf[100]; + struct iovec iov[1] = { [0] = { .iov_base = buf, .iov_len = sizeof (buf) } }; + s = preadv (fd, iov, 1, 0); + + pthread_cleanup_pop (0); + + printf ("%s: preadv returns with %zd\n", __FUNCTION__, s); + + exit (1); +} static void * tf_fsync (void *arg) @@ -2140,6 +2184,7 @@ static struct ADD_TEST (recv, 2, 0), ADD_TEST (recvfrom, 2, 0), ADD_TEST (recvmsg, 2, 0), + ADD_TEST (preadv, 2, 1), ADD_TEST (open, 2, 1), ADD_TEST (close, 2, 1), ADD_TEST (pread, 2, 1), |