* tests/uio.c: New file.
* tests/uio.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add uio.
(uio_CFLAGS): Define.
(TESTS): Add uio.test.
AM_CFLAGS = $(WARN_CFLAGS)
-check_PROGRAMS = net-accept-connect set_ptracer_any sigaction
+check_PROGRAMS = net-accept-connect set_ptracer_any sigaction uio
+
+uio_CFLAGS = $(AM_CFLAGS) -D_FILE_OFFSET_BITS=64
TESTS = \
ptrace_setoptions.test \
stat.test \
net.test \
net-fd.test \
+ uio.test \
detach-sleeping.test \
detach-stopped.test \
detach-running.test
--- /dev/null
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/uio.h>
+#include <assert.h>
+
+int
+main(void)
+{
+ const off_t offset = 0xdefaceddeadbeefLL;
+ int fd;
+ char buf[4];
+ struct iovec iov = { buf, sizeof buf };
+
+ assert((fd = open("/dev/zero", O_RDONLY)) >= 0);
+ assert(pread(fd, buf, sizeof buf, offset) == 4);
+ assert(preadv(fd, &iov, 1, offset) == 4);
+ assert(!close(fd));
+
+ assert((fd = open("/dev/null", O_WRONLY)) >= 0);
+ assert(pwrite(fd, buf, sizeof buf, offset) == 4);
+ assert(pwritev(fd, &iov, 1, offset) == 4);
+ assert(!close(fd));
+
+ return 0;
+}
--- /dev/null
+#!/bin/sh
+
+# Check how pread/pwrite and preadv/pwritev syscalls are traced.
+
+. "${srcdir=.}/init.sh"
+
+check_prog grep
+check_prog rm
+
+./uio ||
+ fail_ 'uio failed'
+
+args="-edesc ./uio"
+$STRACE $args > $LOG 2>&1 || {
+ cat $LOG
+ fail_ "$STRACE $args failed"
+}
+
+grep_log()
+{
+ local syscall="$1"; shift
+
+ LC_ALL=C grep -E -x "$syscall$*" $LOG > /dev/null || {
+ cat $LOG
+ fail_ "$STRACE $args failed to trace \"$syscall\" properly"
+ }
+}
+
+grep_log 'pread(64)?' '\(3, "\\0\\0\\0\\0", 4, 1004211379570065135\) += 4'
+grep_log 'preadv' '\(3, \[{"\\0\\0\\0\\0", 4}\], 1, 1004211379570065135\) += 4'
+grep_log 'pwrite(64)?' '\(3, "\\0\\0\\0\\0", 4, 1004211379570065135\) += 4'
+grep_log 'pwritev' '\(3, \[{"\\0\\0\\0\\0", 4}\], 1, 1004211379570065135\) += 4'
+
+exit 0