1210967Spjd#!/bin/sh
2210967Spjd# $FreeBSD: releng/10.2/tools/regression/pjdfstest/tests/mknod/00.t 210967 2010-08-06 20:51:39Z pjd $
3210967Spjd
4210967Spjddesc="mknod creates fifo files"
5210967Spjd
6210967Spjddir=`dirname $0`
7210967Spjd. ${dir}/../misc.sh
8210967Spjd
9210967Spjdecho "1..36"
10210967Spjd
11210967Spjdn0=`namegen`
12210967Spjdn1=`namegen`
13210967Spjd
14210967Spjdexpect 0 mkdir ${n1} 0755
15210967Spjdcdir=`pwd`
16210967Spjdcd ${n1}
17210967Spjd
18210967Spjd# POSIX: The file permission bits of the new FIFO shall be initialized from
19210967Spjd# mode. The file permission bits of the mode argument shall be modified by the
20210967Spjd# process' file creation mask.
21210967Spjdexpect 0 mknod ${n0} f 0755 0 0
22210967Spjdexpect fifo,0755 lstat ${n0} type,mode
23210967Spjdexpect 0 unlink ${n0}
24210967Spjdexpect 0 mknod ${n0} f 0151 0 0
25210967Spjdexpect fifo,0151 lstat ${n0} type,mode
26210967Spjdexpect 0 unlink ${n0}
27210967Spjdexpect 0 -U 077 mknod ${n0} f 0151 0 0
28210967Spjdexpect fifo,0100 lstat ${n0} type,mode
29210967Spjdexpect 0 unlink ${n0}
30210967Spjdexpect 0 -U 070 mknod ${n0} f 0345 0 0
31210967Spjdexpect fifo,0305 lstat ${n0} type,mode
32210967Spjdexpect 0 unlink ${n0}
33210967Spjdexpect 0 -U 0501 mknod ${n0} f 0345 0 0
34210967Spjdexpect fifo,0244 lstat ${n0} type,mode
35210967Spjdexpect 0 unlink ${n0}
36210967Spjd
37210967Spjd# POSIX: The FIFO's user ID shall be set to the process' effective user ID.
38210967Spjd# The FIFO's group ID shall be set to the group ID of the parent directory or to
39210967Spjd# the effective group ID of the process.
40210967Spjdexpect 0 chown . 65535 65535
41210967Spjdexpect 0 -u 65535 -g 65535 mknod ${n0} f 0755 0 0
42210967Spjdexpect 65535,65535 lstat ${n0} uid,gid
43210967Spjdexpect 0 unlink ${n0}
44210967Spjdexpect 0 -u 65535 -g 65534 mknod ${n0} f 0755 0 0
45210967Spjdexpect "65535,6553[45]" lstat ${n0} uid,gid
46210967Spjdexpect 0 unlink ${n0}
47210967Spjdexpect 0 chmod . 0777
48210967Spjdexpect 0 -u 65534 -g 65533 mknod ${n0} f 0755 0 0
49210967Spjdexpect "65534,6553[35]" lstat ${n0} uid,gid
50210967Spjdexpect 0 unlink ${n0}
51210967Spjd
52210967Spjd# POSIX: Upon successful completion, mkfifo() shall mark for update the
53210967Spjd# st_atime, st_ctime, and st_mtime fields of the file. Also, the st_ctime and
54210967Spjd# st_mtime fields of the directory that contains the new entry shall be marked
55210967Spjd# for update.
56210967Spjdexpect 0 chown . 0 0
57210967Spjdtime=`${fstest} stat . ctime`
58210967Spjdsleep 1
59210967Spjdexpect 0 mknod ${n0} f 0755 0 0
60210967Spjdatime=`${fstest} stat ${n0} atime`
61210967Spjdtest_check $time -lt $atime
62210967Spjdmtime=`${fstest} stat ${n0} mtime`
63210967Spjdtest_check $time -lt $mtime
64210967Spjdctime=`${fstest} stat ${n0} ctime`
65210967Spjdtest_check $time -lt $ctime
66210967Spjdmtime=`${fstest} stat . mtime`
67210967Spjdtest_check $time -lt $mtime
68210967Spjdctime=`${fstest} stat . ctime`
69210967Spjdtest_check $time -lt $ctime
70210967Spjdexpect 0 unlink ${n0}
71210967Spjd
72210967Spjdcd ${cdir}
73210967Spjdexpect 0 rmdir ${n1}
74