4 # Copyright (c) 2013 EMC Corp.
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions
10 # 1. Redistributions of source code must retain the above copyright
11 # notice, this list of conditions and the following disclaimer.
12 # 2. Redistributions in binary form must reproduce the above copyright
13 # notice, this list of conditions and the following disclaimer in the
14 # documentation and/or other materials provided with the distribution.
16 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 # tmpfs(5) name lookup problem seen:
32 # tmpfs10: unlink(p01193.14729) at loop #2: No such file or directory
33 # unlink(p01193.14729) succeeded at call #2.
34 # tmpfs10: unlink(p01186.14409) at loop #2: No such file or directory
35 # unlink(p01186.14409) succeeded at call #2.
41 [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
47 sed '1,/^EOF/d' < $odir/$0 > tmpfs10.c
48 mycc -o tmpfs10 -Wall -Wextra -O2 -g tmpfs10.c || exit 1
52 mount | grep -q "on $mntpoint " && umount $mntpoint
53 mount -t tmpfs tmpfs $mntpoint
56 { find $mntpoint ! -type d | xargs ls -il; echo FAIL; }
67 #include <sys/param.h>
83 char file[128], dir[128];
87 sprintf(dir,"%s.%05d", getprogname(), pid);
88 if (mkdir(dir, 0770) < 0)
89 err(1, "mkdir(%s), %s:%d", dir, __FILE__, __LINE__);
92 err(1, "chdir(%s), %s:%d", dir, __FILE__, __LINE__);
94 for (j = 0; j < SIZE; j++) {
95 sprintf(file,"p%05d.%05d", pid, j);
96 if (symlink("/tmp/not/there", file) == -1) {
98 warn("symlink(%s). %s.%d", file, __FILE__, __LINE__);
104 for (i = --j; i >= 0; i--) {
105 sprintf(file,"p%05d.%05d", pid, i);
106 if (unlink(file) == -1) {
107 warn("unlink(%s) at loop #%d", file, loop);
109 for (k = 0; k < 10; k++) {
111 if (unlink(file) == 0) {
113 "unlink(%s) succeeded at call #%d.\n",
122 if (rmdir(dir) == -1)
123 warn("rmdir(%s), %s:%d", dir, __FILE__, __LINE__);
130 sleep(arc4random() % 3 + 1);
144 for (i = 0; i < PARALLEL; i++)
149 for (i = 0; i < PARALLEL; i++) {
151 e += WEXITSTATUS(status);