xref: /freebsd/contrib/pjdfstest/tests/open/20.t (revision a0ee8cc636cd5c2374ec44ca71226564ea0bca95)
1#!/bin/sh
2# $FreeBSD: head/tools/regression/pjdfstest/tests/open/20.t 211352 2010-08-15 21:24:17Z pjd $
3
4desc="open returns ETXTBSY when the file is a pure procedure (shared text) file that is being executed and the open() system call requests write access"
5
6dir=`dirname $0`
7. ${dir}/../misc.sh
8
9[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit
10
11echo "1..4"
12
13n0=`namegen`
14
15cp -pf `which sleep` ${n0}
16./${n0} 3 &
17while ! pkill -0 -f ./${n0}; do
18	sleep 0.1
19done
20expect ETXTBSY open ${n0} O_WRONLY
21expect ETXTBSY open ${n0} O_RDWR
22expect ETXTBSY open ${n0} O_RDONLY,O_TRUNC
23pkill -9 -f ./${n0}
24expect 0 unlink ${n0}
25