4 # Copyright (c) 2008 Peter Holm <pho@FreeBSD.org>
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
31 # Stopped at devfs_open+0x23f: pushl 0x14(%ebx)
33 # Tracing pid 46017 tid 100350 td 0xc4c08510
34 # devfs_open(e6d06a10) at devfs_open+0x23f
35 # VOP_OPEN_APV(c09edda0,e6d06a10) at VOP_OPEN_APV+0x9b
36 # vn_open_cred(e6d06b78,e6d06c78,0,c4883900,3,...) at vn_open_cred+0x41e
37 # vn_open(e6d06b78,e6d06c78,0,3) at vn_open+0x1e
38 # kern_open(c4c08510,8048887,0,1,0,...) at kern_open+0xb7
39 # open(c4c08510,e6d06d00) at open+0x18
40 # syscall(e6d06d38) at syscall+0x252
42 # Test scenario by kib@freebsd.org
48 sed '1,/^EOF/d' < $odir/$0 > $dir/devfs2.c
49 cc -o devfs2 -Wall devfs2.c -lthr
74 for (i = 0; i < 1024; i++) {
75 if ((fd = open("/dev/zero", O_RDONLY)) == -1)
76 perror("open /dev/zero");
86 for (i = 0; i < 1024; i++)
98 if ((r = pthread_create(&threads[0], NULL, thr1, 0)) != 0)
99 err(1, "pthread_create(): %s\n", strerror(r));
100 if ((r = pthread_create(&threads[1], NULL, thr2, 0)) != 0)
101 err(1, "pthread_create(): %s\n", strerror(r));
103 for (i = 0; i < 2; i++)
104 if (pthread_join(threads[i], NULL) != 0)
105 err(1, "pthread_join(%d)", i);