1#!/bin/sh
2
3# Check how pread/pwrite and preadv/pwritev syscalls are traced.
4
5. "${srcdir=.}/init.sh"
6
7check_prog grep
8check_prog rm
9
10./uio ||
11	fail_ 'uio failed'
12
13args="-edesc ./uio"
14$STRACE $args > $LOG 2>&1 || {
15	cat $LOG
16	fail_ "$STRACE $args failed"
17}
18
19grep_log()
20{
21	local syscall="$1"; shift
22
23	LC_ALL=C grep -E -x "$syscall$*" $LOG > /dev/null || {
24		cat $LOG
25		fail_ "$STRACE $args failed to trace \"$syscall\" properly"
26	}
27}
28
29grep_log 'pread(64)?' '\(3, "\\0\\0\\0\\0", 4, 1004211379570065135\) += 4'
30grep_log 'preadv' '\(3, \[{"\\0\\0\\0\\0", 4}\], 1, 1004211379570065135\) += 4'
31grep_log 'pwrite(64)?' '\(3, "\\0\\0\\0\\0", 4, 1004211379570065135\) += 4'
32grep_log 'pwritev' '\(3, \[{"\\0\\0\\0\\0", 4}\], 1, 1004211379570065135\) += 4'
33
34exit 0
35