1#!/bin/sh 2# $FreeBSD: src/tools/regression/fstest/tests/mkfifo/00.t,v 1.2 2007/01/25 20:50:02 pjd Exp $ 3 4desc="mkfifo creates fifo files" 5 6n0=`namegen` 7n1=`namegen` 8 9expect 0 mkdir ${n1} 0755 10cdir=`pwd` 11cd ${n1} 12 13# POSIX: The file permission bits of the new FIFO shall be initialized from 14# mode. The file permission bits of the mode argument shall be modified by the 15# process' file creation mask. 16expect 0 mkfifo ${n0} 0755 17expect fifo,0755 lstat ${n0} type,mode 18expect 0 unlink ${n0} 19expect 0 mkfifo ${n0} 0151 20expect fifo,0151 lstat ${n0} type,mode 21expect 0 unlink ${n0} 22expect 0 -U 077 mkfifo ${n0} 0151 23expect fifo,0100 lstat ${n0} type,mode 24expect 0 unlink ${n0} 25expect 0 -U 070 mkfifo ${n0} 0345 26expect fifo,0305 lstat ${n0} type,mode 27expect 0 unlink ${n0} 28expect 0 -U 0501 mkfifo ${n0} 0345 29expect fifo,0244 lstat ${n0} type,mode 30expect 0 unlink ${n0} 31 32# POSIX: The FIFO's user ID shall be set to the process' effective user ID. 33# The FIFO's group ID shall be set to the group ID of the parent directory or to 34# the effective group ID of the process. 35expect 0 chown . 65535 65535 36expect 0 -u 65535 -g 65535 mkfifo ${n0} 0755 37expect 65535,65535 lstat ${n0} uid,gid 38expect 0 unlink ${n0} 39expect 0 -u 65535 -g 65534 mkfifo ${n0} 0755 40expect "65535,6553[45]" lstat ${n0} uid,gid 41expect 0 unlink ${n0} 42expect 0 chmod . 0777 43expect 0 -u 65534 -g 65533 mkfifo ${n0} 0755 44expect "65534,6553[35]" lstat ${n0} uid,gid 45expect 0 unlink ${n0} 46 47# POSIX: Upon successful completion, mkfifo() shall mark for update the 48# st_atime, st_ctime, and st_mtime fields of the file. Also, the st_ctime and 49# st_mtime fields of the directory that contains the new entry shall be marked 50# for update. 51expect 0 chown . 0 0 52time=`${FSTEST} stat . ctime` 53sleep 1 54expect 0 mkfifo ${n0} 0755 55atime=`${FSTEST} stat ${n0} atime` 56test_check $time -lt $atime 57mtime=`${FSTEST} stat ${n0} mtime` 58test_check $time -lt $mtime 59ctime=`${FSTEST} stat ${n0} ctime` 60test_check $time -lt $ctime 61mtime=`${FSTEST} stat . mtime` 62test_check $time -lt $mtime 63ctime=`${FSTEST} stat . ctime` 64test_check $time -lt $ctime 65expect 0 unlink ${n0} 66 67cd ${cdir} 68expect 0 rmdir ${n1} 69