1#!/bin/sh 2 3# Check how ftruncate, lseek and stat family syscalls are traced. 4 5. "${srcdir=.}/init.sh" 6 7check_prog dd 8check_prog find 9 10EXPECTED="$LOG.expected" 11size=46118400000 12sample=stat_sample 13 14rm -f $sample 15umask 022 16 17run_prog_skip_if_failed \ 18 dd seek=$size bs=1 count=0 if=/dev/null of=$sample 19run_strace -edesc $args 20 21r_ftruncate="ftruncate(64)?\\(1, $size\\) += 0" 22r_lseek="lseek\\(1, $size, SEEK_CUR\\) += $size" 23r_llseek="_llseek\\(1, $size, \\[$size\\], SEEK_CUR\\) += 0" 24 25cat > "$EXPECTED" << __EOF__ 26$r_ftruncate 27$r_lseek|$r_llseek 28__EOF__ 29 30match_grep "$LOG" "$EXPECTED" 31 32run_prog_skip_if_failed \ 33 find -L $sample -quit 34run_strace -efile $args 35 36stat="\\{st_mode=S_IFREG\\|0644, st_size=$size, \\.\\.\\.\\}" 37r_stat="stat(64)?\\(\"$sample\", $stat\\) += 0" 38r_fstatat="(new)?fstatat(64)?\\(AT_FDCWD, \"$sample\", $stat, 0\\) += 0" 39 40cat > "$EXPECTED" << __EOF__ 41$r_stat|$r_fstatat 42__EOF__ 43 44match_grep "$LOG" "$EXPECTED" 45 46run_prog_skip_if_failed \ 47 find $sample -quit 48run_strace -efile $args 49 50r_lstat="lstat(64)?\\(\"$sample\", $stat\\) += 0" 51r_lfstatat="(new)?fstatat(64)?\\(AT_FDCWD, \"$sample\", $stat, AT_SYMLINK_NOFOLLOW\\) += 0" 52 53cat > "$EXPECTED" << __EOF__ 54$r_lstat|$r_lfstatat 55__EOF__ 56 57match_grep "$LOG" "$EXPECTED" 58 59rm -f "$EXPECTED" $sample 60 61exit 0 62