Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

7217 lines (6815 sloc) 235.682 kB
_usertests: file format elf32-i386
Disassembly of section .text:
00000000 <opentest>:
// simple file system tests
void
opentest(void)
{
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 ec 18 sub $0x18,%esp
int fd;
printf(stdout, "open test\n");
6: a1 08 44 00 00 mov 0x4408,%eax
b: c7 44 24 04 90 31 00 movl $0x3190,0x4(%esp)
12: 00
13: 89 04 24 mov %eax,(%esp)
16: e8 55 2e 00 00 call 2e70 <printf>
fd = open("echo", 0);
1b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
22: 00
23: c7 04 24 9b 31 00 00 movl $0x319b,(%esp)
2a: e8 35 2d 00 00 call 2d64 <open>
if(fd < 0){
2f: 85 c0 test %eax,%eax
31: 78 37 js 6a <opentest+0x6a>
printf(stdout, "open echo failed!\n");
exit();
}
close(fd);
33: 89 04 24 mov %eax,(%esp)
36: e8 11 2d 00 00 call 2d4c <close>
fd = open("doesnotexist", 0);
3b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
42: 00
43: c7 04 24 b3 31 00 00 movl $0x31b3,(%esp)
4a: e8 15 2d 00 00 call 2d64 <open>
if(fd >= 0){
4f: 85 c0 test %eax,%eax
51: 79 31 jns 84 <opentest+0x84>
printf(stdout, "open doesnotexist succeeded!\n");
exit();
}
printf(stdout, "open test ok\n");
53: a1 08 44 00 00 mov 0x4408,%eax
58: c7 44 24 04 de 31 00 movl $0x31de,0x4(%esp)
5f: 00
60: 89 04 24 mov %eax,(%esp)
63: e8 08 2e 00 00 call 2e70 <printf>
}
68: c9 leave
69: c3 ret
int fd;
printf(stdout, "open test\n");
fd = open("echo", 0);
if(fd < 0){
printf(stdout, "open echo failed!\n");
6a: a1 08 44 00 00 mov 0x4408,%eax
6f: c7 44 24 04 a0 31 00 movl $0x31a0,0x4(%esp)
76: 00
77: 89 04 24 mov %eax,(%esp)
7a: e8 f1 2d 00 00 call 2e70 <printf>
exit();
7f: e8 a0 2c 00 00 call 2d24 <exit>
}
close(fd);
fd = open("doesnotexist", 0);
if(fd >= 0){
printf(stdout, "open doesnotexist succeeded!\n");
84: a1 08 44 00 00 mov 0x4408,%eax
89: c7 44 24 04 c0 31 00 movl $0x31c0,0x4(%esp)
90: 00
91: 89 04 24 mov %eax,(%esp)
94: e8 d7 2d 00 00 call 2e70 <printf>
exit();
99: e8 86 2c 00 00 call 2d24 <exit>
9e: 66 90 xchg %ax,%ax
000000a0 <writetest>:
printf(stdout, "open test ok\n");
}
void
writetest(void)
{
a0: 55 push %ebp
a1: 89 e5 mov %esp,%ebp
a3: 56 push %esi
a4: 53 push %ebx
a5: 83 ec 10 sub $0x10,%esp
int fd;
int i;
printf(stdout, "small file test\n");
a8: a1 08 44 00 00 mov 0x4408,%eax
ad: c7 44 24 04 ec 31 00 movl $0x31ec,0x4(%esp)
b4: 00
b5: 89 04 24 mov %eax,(%esp)
b8: e8 b3 2d 00 00 call 2e70 <printf>
fd = open("small", O_CREATE|O_RDWR);
bd: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
c4: 00
c5: c7 04 24 fd 31 00 00 movl $0x31fd,(%esp)
cc: e8 93 2c 00 00 call 2d64 <open>
if(fd >= 0){
d1: 85 c0 test %eax,%eax
{
int fd;
int i;
printf(stdout, "small file test\n");
fd = open("small", O_CREATE|O_RDWR);
d3: 89 c6 mov %eax,%esi
if(fd >= 0){
d5: 0f 88 b1 01 00 00 js 28c <writetest+0x1ec>
printf(stdout, "creat small succeeded; ok\n");
db: a1 08 44 00 00 mov 0x4408,%eax
} else {
printf(stdout, "error: creat small failed!\n");
exit();
}
for(i = 0; i < 100; i++) {
e0: 31 db xor %ebx,%ebx
int i;
printf(stdout, "small file test\n");
fd = open("small", O_CREATE|O_RDWR);
if(fd >= 0){
printf(stdout, "creat small succeeded; ok\n");
e2: c7 44 24 04 03 32 00 movl $0x3203,0x4(%esp)
e9: 00
ea: 89 04 24 mov %eax,(%esp)
ed: e8 7e 2d 00 00 call 2e70 <printf>
f2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
} else {
printf(stdout, "error: creat small failed!\n");
exit();
}
for(i = 0; i < 100; i++) {
if(write(fd, "aaaaaaaaaa", 10) != 10) {
f8: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
ff: 00
100: c7 44 24 04 3a 32 00 movl $0x323a,0x4(%esp)
107: 00
108: 89 34 24 mov %esi,(%esp)
10b: e8 34 2c 00 00 call 2d44 <write>
110: 83 f8 0a cmp $0xa,%eax
113: 0f 85 e9 00 00 00 jne 202 <writetest+0x162>
printf(stdout, "error: write aa %d new file failed\n", i);
exit();
}
if(write(fd, "bbbbbbbbbb", 10) != 10) {
119: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
120: 00
121: c7 44 24 04 45 32 00 movl $0x3245,0x4(%esp)
128: 00
129: 89 34 24 mov %esi,(%esp)
12c: e8 13 2c 00 00 call 2d44 <write>
131: 83 f8 0a cmp $0xa,%eax
134: 0f 85 e6 00 00 00 jne 220 <writetest+0x180>
printf(stdout, "creat small succeeded; ok\n");
} else {
printf(stdout, "error: creat small failed!\n");
exit();
}
for(i = 0; i < 100; i++) {
13a: 83 c3 01 add $0x1,%ebx
13d: 83 fb 64 cmp $0x64,%ebx
140: 75 b6 jne f8 <writetest+0x58>
if(write(fd, "bbbbbbbbbb", 10) != 10) {
printf(stdout, "error: write bb %d new file failed\n", i);
exit();
}
}
printf(stdout, "writes ok\n");
142: a1 08 44 00 00 mov 0x4408,%eax
147: c7 44 24 04 50 32 00 movl $0x3250,0x4(%esp)
14e: 00
14f: 89 04 24 mov %eax,(%esp)
152: e8 19 2d 00 00 call 2e70 <printf>
close(fd);
157: 89 34 24 mov %esi,(%esp)
15a: e8 ed 2b 00 00 call 2d4c <close>
fd = open("small", O_RDONLY);
15f: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
166: 00
167: c7 04 24 fd 31 00 00 movl $0x31fd,(%esp)
16e: e8 f1 2b 00 00 call 2d64 <open>
if(fd >= 0){
173: 85 c0 test %eax,%eax
exit();
}
}
printf(stdout, "writes ok\n");
close(fd);
fd = open("small", O_RDONLY);
175: 89 c3 mov %eax,%ebx
if(fd >= 0){
177: 0f 88 c1 00 00 00 js 23e <writetest+0x19e>
printf(stdout, "open small succeeded ok\n");
17d: a1 08 44 00 00 mov 0x4408,%eax
182: c7 44 24 04 5b 32 00 movl $0x325b,0x4(%esp)
189: 00
18a: 89 04 24 mov %eax,(%esp)
18d: e8 de 2c 00 00 call 2e70 <printf>
} else {
printf(stdout, "error: open small failed!\n");
exit();
}
i = read(fd, buf, 2000);
192: c7 44 24 08 d0 07 00 movl $0x7d0,0x8(%esp)
199: 00
19a: c7 44 24 04 40 44 00 movl $0x4440,0x4(%esp)
1a1: 00
1a2: 89 1c 24 mov %ebx,(%esp)
1a5: e8 92 2b 00 00 call 2d3c <read>
if(i == 2000) {
1aa: 3d d0 07 00 00 cmp $0x7d0,%eax
1af: 0f 85 a3 00 00 00 jne 258 <writetest+0x1b8>
printf(stdout, "read succeeded ok\n");
1b5: a1 08 44 00 00 mov 0x4408,%eax
1ba: c7 44 24 04 8f 32 00 movl $0x328f,0x4(%esp)
1c1: 00
1c2: 89 04 24 mov %eax,(%esp)
1c5: e8 a6 2c 00 00 call 2e70 <printf>
} else {
printf(stdout, "read failed\n");
exit();
}
close(fd);
1ca: 89 1c 24 mov %ebx,(%esp)
1cd: e8 7a 2b 00 00 call 2d4c <close>
if(unlink("small") < 0) {
1d2: c7 04 24 fd 31 00 00 movl $0x31fd,(%esp)
1d9: e8 96 2b 00 00 call 2d74 <unlink>
1de: 85 c0 test %eax,%eax
1e0: 0f 88 8c 00 00 00 js 272 <writetest+0x1d2>
printf(stdout, "unlink small failed\n");
exit();
}
printf(stdout, "small file test ok\n");
1e6: a1 08 44 00 00 mov 0x4408,%eax
1eb: c7 44 24 04 b7 32 00 movl $0x32b7,0x4(%esp)
1f2: 00
1f3: 89 04 24 mov %eax,(%esp)
1f6: e8 75 2c 00 00 call 2e70 <printf>
}
1fb: 83 c4 10 add $0x10,%esp
1fe: 5b pop %ebx
1ff: 5e pop %esi
200: 5d pop %ebp
201: c3 ret
printf(stdout, "error: creat small failed!\n");
exit();
}
for(i = 0; i < 100; i++) {
if(write(fd, "aaaaaaaaaa", 10) != 10) {
printf(stdout, "error: write aa %d new file failed\n", i);
202: a1 08 44 00 00 mov 0x4408,%eax
207: 89 5c 24 08 mov %ebx,0x8(%esp)
20b: c7 44 24 04 78 3e 00 movl $0x3e78,0x4(%esp)
212: 00
213: 89 04 24 mov %eax,(%esp)
216: e8 55 2c 00 00 call 2e70 <printf>
exit();
21b: e8 04 2b 00 00 call 2d24 <exit>
}
if(write(fd, "bbbbbbbbbb", 10) != 10) {
printf(stdout, "error: write bb %d new file failed\n", i);
220: a1 08 44 00 00 mov 0x4408,%eax
225: 89 5c 24 08 mov %ebx,0x8(%esp)
229: c7 44 24 04 9c 3e 00 movl $0x3e9c,0x4(%esp)
230: 00
231: 89 04 24 mov %eax,(%esp)
234: e8 37 2c 00 00 call 2e70 <printf>
exit();
239: e8 e6 2a 00 00 call 2d24 <exit>
close(fd);
fd = open("small", O_RDONLY);
if(fd >= 0){
printf(stdout, "open small succeeded ok\n");
} else {
printf(stdout, "error: open small failed!\n");
23e: a1 08 44 00 00 mov 0x4408,%eax
243: c7 44 24 04 74 32 00 movl $0x3274,0x4(%esp)
24a: 00
24b: 89 04 24 mov %eax,(%esp)
24e: e8 1d 2c 00 00 call 2e70 <printf>
exit();
253: e8 cc 2a 00 00 call 2d24 <exit>
}
i = read(fd, buf, 2000);
if(i == 2000) {
printf(stdout, "read succeeded ok\n");
} else {
printf(stdout, "read failed\n");
258: a1 08 44 00 00 mov 0x4408,%eax
25d: c7 44 24 04 b5 35 00 movl $0x35b5,0x4(%esp)
264: 00
265: 89 04 24 mov %eax,(%esp)
268: e8 03 2c 00 00 call 2e70 <printf>
exit();
26d: e8 b2 2a 00 00 call 2d24 <exit>
}
close(fd);
if(unlink("small") < 0) {
printf(stdout, "unlink small failed\n");
272: a1 08 44 00 00 mov 0x4408,%eax
277: c7 44 24 04 a2 32 00 movl $0x32a2,0x4(%esp)
27e: 00
27f: 89 04 24 mov %eax,(%esp)
282: e8 e9 2b 00 00 call 2e70 <printf>
exit();
287: e8 98 2a 00 00 call 2d24 <exit>
printf(stdout, "small file test\n");
fd = open("small", O_CREATE|O_RDWR);
if(fd >= 0){
printf(stdout, "creat small succeeded; ok\n");
} else {
printf(stdout, "error: creat small failed!\n");
28c: a1 08 44 00 00 mov 0x4408,%eax
291: c7 44 24 04 1e 32 00 movl $0x321e,0x4(%esp)
298: 00
299: 89 04 24 mov %eax,(%esp)
29c: e8 cf 2b 00 00 call 2e70 <printf>
exit();
2a1: e8 7e 2a 00 00 call 2d24 <exit>
2a6: 8d 76 00 lea 0x0(%esi),%esi
2a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000002b0 <writetest1>:
printf(stdout, "small file test ok\n");
}
void
writetest1(void)
{
2b0: 55 push %ebp
2b1: 89 e5 mov %esp,%ebp
2b3: 56 push %esi
2b4: 53 push %ebx
2b5: 83 ec 10 sub $0x10,%esp
int i, fd, n;
printf(stdout, "big files test\n");
2b8: a1 08 44 00 00 mov 0x4408,%eax
2bd: c7 44 24 04 cb 32 00 movl $0x32cb,0x4(%esp)
2c4: 00
2c5: 89 04 24 mov %eax,(%esp)
2c8: e8 a3 2b 00 00 call 2e70 <printf>
fd = open("big", O_CREATE|O_RDWR);
2cd: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
2d4: 00
2d5: c7 04 24 45 33 00 00 movl $0x3345,(%esp)
2dc: e8 83 2a 00 00 call 2d64 <open>
if(fd < 0){
2e1: 85 c0 test %eax,%eax
{
int i, fd, n;
printf(stdout, "big files test\n");
fd = open("big", O_CREATE|O_RDWR);
2e3: 89 c6 mov %eax,%esi
if(fd < 0){
2e5: 0f 88 7a 01 00 00 js 465 <writetest1+0x1b5>
2eb: 31 db xor %ebx,%ebx
2ed: 8d 76 00 lea 0x0(%esi),%esi
printf(stdout, "error: creat big failed!\n");
exit();
}
for(i = 0; i < MAXFILE; i++) {
((int*) buf)[0] = i;
2f0: 89 1d 40 44 00 00 mov %ebx,0x4440
if(write(fd, buf, 512) != 512) {
2f6: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
2fd: 00
2fe: c7 44 24 04 40 44 00 movl $0x4440,0x4(%esp)
305: 00
306: 89 34 24 mov %esi,(%esp)
309: e8 36 2a 00 00 call 2d44 <write>
30e: 3d 00 02 00 00 cmp $0x200,%eax
313: 0f 85 b2 00 00 00 jne 3cb <writetest1+0x11b>
if(fd < 0){
printf(stdout, "error: creat big failed!\n");
exit();
}
for(i = 0; i < MAXFILE; i++) {
319: 83 c3 01 add $0x1,%ebx
31c: 81 fb 8c 00 00 00 cmp $0x8c,%ebx
322: 75 cc jne 2f0 <writetest1+0x40>
printf(stdout, "error: write big file failed\n", i);
exit();
}
}
close(fd);
324: 89 34 24 mov %esi,(%esp)
327: e8 20 2a 00 00 call 2d4c <close>
fd = open("big", O_RDONLY);
32c: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
333: 00
334: c7 04 24 45 33 00 00 movl $0x3345,(%esp)
33b: e8 24 2a 00 00 call 2d64 <open>
if(fd < 0){
340: 85 c0 test %eax,%eax
}
}
close(fd);
fd = open("big", O_RDONLY);
342: 89 c6 mov %eax,%esi
if(fd < 0){
344: 0f 88 01 01 00 00 js 44b <writetest1+0x19b>
34a: 30 db xor %bl,%bl
34c: eb 1d jmp 36b <writetest1+0xbb>
34e: 66 90 xchg %ax,%ax
if(n == MAXFILE - 1) {
printf(stdout, "read only %d blocks from big", n);
exit();
}
break;
} else if(i != 512) {
350: 3d 00 02 00 00 cmp $0x200,%eax
355: 0f 85 b0 00 00 00 jne 40b <writetest1+0x15b>
printf(stdout, "read failed %d\n", i);
exit();
}
if(((int*)buf)[0] != n) {
35b: a1 40 44 00 00 mov 0x4440,%eax
360: 39 d8 cmp %ebx,%eax
362: 0f 85 81 00 00 00 jne 3e9 <writetest1+0x139>
printf(stdout, "read content of block %d is %d\n",
n, ((int*)buf)[0]);
exit();
}
n++;
368: 83 c3 01 add $0x1,%ebx
exit();
}
n = 0;
for(;;) {
i = read(fd, buf, 512);
36b: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
372: 00
373: c7 44 24 04 40 44 00 movl $0x4440,0x4(%esp)
37a: 00
37b: 89 34 24 mov %esi,(%esp)
37e: e8 b9 29 00 00 call 2d3c <read>
if(i == 0) {
383: 85 c0 test %eax,%eax
385: 75 c9 jne 350 <writetest1+0xa0>
if(n == MAXFILE - 1) {
387: 81 fb 8b 00 00 00 cmp $0x8b,%ebx
38d: 0f 84 96 00 00 00 je 429 <writetest1+0x179>
n, ((int*)buf)[0]);
exit();
}
n++;
}
close(fd);
393: 89 34 24 mov %esi,(%esp)
396: e8 b1 29 00 00 call 2d4c <close>
if(unlink("big") < 0) {
39b: c7 04 24 45 33 00 00 movl $0x3345,(%esp)
3a2: e8 cd 29 00 00 call 2d74 <unlink>
3a7: 85 c0 test %eax,%eax
3a9: 0f 88 d0 00 00 00 js 47f <writetest1+0x1cf>
printf(stdout, "unlink big failed\n");
exit();
}
printf(stdout, "big files ok\n");
3af: a1 08 44 00 00 mov 0x4408,%eax
3b4: c7 44 24 04 6c 33 00 movl $0x336c,0x4(%esp)
3bb: 00
3bc: 89 04 24 mov %eax,(%esp)
3bf: e8 ac 2a 00 00 call 2e70 <printf>
}
3c4: 83 c4 10 add $0x10,%esp
3c7: 5b pop %ebx
3c8: 5e pop %esi
3c9: 5d pop %ebp
3ca: c3 ret
}
for(i = 0; i < MAXFILE; i++) {
((int*) buf)[0] = i;
if(write(fd, buf, 512) != 512) {
printf(stdout, "error: write big file failed\n", i);
3cb: a1 08 44 00 00 mov 0x4408,%eax
3d0: 89 5c 24 08 mov %ebx,0x8(%esp)
3d4: c7 44 24 04 f5 32 00 movl $0x32f5,0x4(%esp)
3db: 00
3dc: 89 04 24 mov %eax,(%esp)
3df: e8 8c 2a 00 00 call 2e70 <printf>
exit();
3e4: e8 3b 29 00 00 call 2d24 <exit>
} else if(i != 512) {
printf(stdout, "read failed %d\n", i);
exit();
}
if(((int*)buf)[0] != n) {
printf(stdout, "read content of block %d is %d\n",
3e9: 89 44 24 0c mov %eax,0xc(%esp)
3ed: a1 08 44 00 00 mov 0x4408,%eax
3f2: 89 5c 24 08 mov %ebx,0x8(%esp)
3f6: c7 44 24 04 c0 3e 00 movl $0x3ec0,0x4(%esp)
3fd: 00
3fe: 89 04 24 mov %eax,(%esp)
401: e8 6a 2a 00 00 call 2e70 <printf>
n, ((int*)buf)[0]);
exit();
406: e8 19 29 00 00 call 2d24 <exit>
printf(stdout, "read only %d blocks from big", n);
exit();
}
break;
} else if(i != 512) {
printf(stdout, "read failed %d\n", i);
40b: 89 44 24 08 mov %eax,0x8(%esp)
40f: a1 08 44 00 00 mov 0x4408,%eax
414: c7 44 24 04 49 33 00 movl $0x3349,0x4(%esp)
41b: 00
41c: 89 04 24 mov %eax,(%esp)
41f: e8 4c 2a 00 00 call 2e70 <printf>
exit();
424: e8 fb 28 00 00 call 2d24 <exit>
n = 0;
for(;;) {
i = read(fd, buf, 512);
if(i == 0) {
if(n == MAXFILE - 1) {
printf(stdout, "read only %d blocks from big", n);
429: a1 08 44 00 00 mov 0x4408,%eax
42e: c7 44 24 08 8b 00 00 movl $0x8b,0x8(%esp)
435: 00
436: c7 44 24 04 2c 33 00 movl $0x332c,0x4(%esp)
43d: 00
43e: 89 04 24 mov %eax,(%esp)
441: e8 2a 2a 00 00 call 2e70 <printf>
exit();
446: e8 d9 28 00 00 call 2d24 <exit>
close(fd);
fd = open("big", O_RDONLY);
if(fd < 0){
printf(stdout, "error: open big failed!\n");
44b: a1 08 44 00 00 mov 0x4408,%eax
450: c7 44 24 04 13 33 00 movl $0x3313,0x4(%esp)
457: 00
458: 89 04 24 mov %eax,(%esp)
45b: e8 10 2a 00 00 call 2e70 <printf>
exit();
460: e8 bf 28 00 00 call 2d24 <exit>
printf(stdout, "big files test\n");
fd = open("big", O_CREATE|O_RDWR);
if(fd < 0){
printf(stdout, "error: creat big failed!\n");
465: a1 08 44 00 00 mov 0x4408,%eax
46a: c7 44 24 04 db 32 00 movl $0x32db,0x4(%esp)
471: 00
472: 89 04 24 mov %eax,(%esp)
475: e8 f6 29 00 00 call 2e70 <printf>
exit();
47a: e8 a5 28 00 00 call 2d24 <exit>
}
n++;
}
close(fd);
if(unlink("big") < 0) {
printf(stdout, "unlink big failed\n");
47f: a1 08 44 00 00 mov 0x4408,%eax
484: c7 44 24 04 59 33 00 movl $0x3359,0x4(%esp)
48b: 00
48c: 89 04 24 mov %eax,(%esp)
48f: e8 dc 29 00 00 call 2e70 <printf>
exit();
494: e8 8b 28 00 00 call 2d24 <exit>
499: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
000004a0 <createtest>:
printf(stdout, "big files ok\n");
}
void
createtest(void)
{
4a0: 55 push %ebp
4a1: 89 e5 mov %esp,%ebp
4a3: 53 push %ebx
int i, fd;
printf(stdout, "many creates, followed by unlink test\n");
name[0] = 'a';
name[2] = '\0';
4a4: bb 30 00 00 00 mov $0x30,%ebx
printf(stdout, "big files ok\n");
}
void
createtest(void)
{
4a9: 83 ec 14 sub $0x14,%esp
int i, fd;
printf(stdout, "many creates, followed by unlink test\n");
4ac: a1 08 44 00 00 mov 0x4408,%eax
4b1: c7 44 24 04 e0 3e 00 movl $0x3ee0,0x4(%esp)
4b8: 00
4b9: 89 04 24 mov %eax,(%esp)
4bc: e8 af 29 00 00 call 2e70 <printf>
name[0] = 'a';
4c1: c6 05 40 4c 00 00 61 movb $0x61,0x4c40
name[2] = '\0';
4c8: c6 05 42 4c 00 00 00 movb $0x0,0x4c42
4cf: 90 nop
for(i = 0; i < 52; i++) {
name[1] = '0' + i;
4d0: 88 1d 41 4c 00 00 mov %bl,0x4c41
fd = open(name, O_CREATE|O_RDWR);
close(fd);
4d6: 83 c3 01 add $0x1,%ebx
name[0] = 'a';
name[2] = '\0';
for(i = 0; i < 52; i++) {
name[1] = '0' + i;
fd = open(name, O_CREATE|O_RDWR);
4d9: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
4e0: 00
4e1: c7 04 24 40 4c 00 00 movl $0x4c40,(%esp)
4e8: e8 77 28 00 00 call 2d64 <open>
close(fd);
4ed: 89 04 24 mov %eax,(%esp)
4f0: e8 57 28 00 00 call 2d4c <close>
printf(stdout, "many creates, followed by unlink test\n");
name[0] = 'a';
name[2] = '\0';
for(i = 0; i < 52; i++) {
4f5: 80 fb 64 cmp $0x64,%bl
4f8: 75 d6 jne 4d0 <createtest+0x30>
name[1] = '0' + i;
fd = open(name, O_CREATE|O_RDWR);
close(fd);
}
name[0] = 'a';
4fa: c6 05 40 4c 00 00 61 movb $0x61,0x4c40
name[2] = '\0';
501: bb 30 00 00 00 mov $0x30,%ebx
506: c6 05 42 4c 00 00 00 movb $0x0,0x4c42
50d: 8d 76 00 lea 0x0(%esi),%esi
for(i = 0; i < 52; i++) {
name[1] = '0' + i;
510: 88 1d 41 4c 00 00 mov %bl,0x4c41
unlink(name);
516: 83 c3 01 add $0x1,%ebx
519: c7 04 24 40 4c 00 00 movl $0x4c40,(%esp)
520: e8 4f 28 00 00 call 2d74 <unlink>
fd = open(name, O_CREATE|O_RDWR);
close(fd);
}
name[0] = 'a';
name[2] = '\0';
for(i = 0; i < 52; i++) {
525: 80 fb 64 cmp $0x64,%bl
528: 75 e6 jne 510 <createtest+0x70>
name[1] = '0' + i;
unlink(name);
}
printf(stdout, "many creates, followed by unlink; ok\n");
52a: a1 08 44 00 00 mov 0x4408,%eax
52f: c7 44 24 04 08 3f 00 movl $0x3f08,0x4(%esp)
536: 00
537: 89 04 24 mov %eax,(%esp)
53a: e8 31 29 00 00 call 2e70 <printf>
}
53f: 83 c4 14 add $0x14,%esp
542: 5b pop %ebx
543: 5d pop %ebp
544: c3 ret
545: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
549: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000550 <dirtest>:
void dirtest(void)
{
550: 55 push %ebp
551: 89 e5 mov %esp,%ebp
553: 83 ec 18 sub $0x18,%esp
printf(stdout, "mkdir test\n");
556: a1 08 44 00 00 mov 0x4408,%eax
55b: c7 44 24 04 7a 33 00 movl $0x337a,0x4(%esp)
562: 00
563: 89 04 24 mov %eax,(%esp)
566: e8 05 29 00 00 call 2e70 <printf>
if(mkdir("dir0") < 0) {
56b: c7 04 24 86 33 00 00 movl $0x3386,(%esp)
572: e8 15 28 00 00 call 2d8c <mkdir>
577: 85 c0 test %eax,%eax
579: 78 4b js 5c6 <dirtest+0x76>
printf(stdout, "mkdir failed\n");
exit();
}
if(chdir("dir0") < 0) {
57b: c7 04 24 86 33 00 00 movl $0x3386,(%esp)
582: e8 0d 28 00 00 call 2d94 <chdir>
587: 85 c0 test %eax,%eax
589: 0f 88 85 00 00 00 js 614 <dirtest+0xc4>
printf(stdout, "chdir dir0 failed\n");
exit();
}
if(chdir("..") < 0) {
58f: c7 04 24 01 39 00 00 movl $0x3901,(%esp)
596: e8 f9 27 00 00 call 2d94 <chdir>
59b: 85 c0 test %eax,%eax
59d: 78 5b js 5fa <dirtest+0xaa>
printf(stdout, "chdir .. failed\n");
exit();
}
if(unlink("dir0") < 0) {
59f: c7 04 24 86 33 00 00 movl $0x3386,(%esp)
5a6: e8 c9 27 00 00 call 2d74 <unlink>
5ab: 85 c0 test %eax,%eax
5ad: 78 31 js 5e0 <dirtest+0x90>
printf(stdout, "unlink dir0 failed\n");
exit();
}
printf(stdout, "mkdir test\n");
5af: a1 08 44 00 00 mov 0x4408,%eax
5b4: c7 44 24 04 7a 33 00 movl $0x337a,0x4(%esp)
5bb: 00
5bc: 89 04 24 mov %eax,(%esp)
5bf: e8 ac 28 00 00 call 2e70 <printf>
}
5c4: c9 leave
5c5: c3 ret
void dirtest(void)
{
printf(stdout, "mkdir test\n");
if(mkdir("dir0") < 0) {
printf(stdout, "mkdir failed\n");
5c6: a1 08 44 00 00 mov 0x4408,%eax
5cb: c7 44 24 04 8b 33 00 movl $0x338b,0x4(%esp)
5d2: 00
5d3: 89 04 24 mov %eax,(%esp)
5d6: e8 95 28 00 00 call 2e70 <printf>
exit();
5db: e8 44 27 00 00 call 2d24 <exit>
printf(stdout, "chdir .. failed\n");
exit();
}
if(unlink("dir0") < 0) {
printf(stdout, "unlink dir0 failed\n");
5e0: a1 08 44 00 00 mov 0x4408,%eax
5e5: c7 44 24 04 bd 33 00 movl $0x33bd,0x4(%esp)
5ec: 00
5ed: 89 04 24 mov %eax,(%esp)
5f0: e8 7b 28 00 00 call 2e70 <printf>
exit();
5f5: e8 2a 27 00 00 call 2d24 <exit>
printf(stdout, "chdir dir0 failed\n");
exit();
}
if(chdir("..") < 0) {
printf(stdout, "chdir .. failed\n");
5fa: a1 08 44 00 00 mov 0x4408,%eax
5ff: c7 44 24 04 ac 33 00 movl $0x33ac,0x4(%esp)
606: 00
607: 89 04 24 mov %eax,(%esp)
60a: e8 61 28 00 00 call 2e70 <printf>
exit();
60f: e8 10 27 00 00 call 2d24 <exit>
printf(stdout, "mkdir failed\n");
exit();
}
if(chdir("dir0") < 0) {
printf(stdout, "chdir dir0 failed\n");
614: a1 08 44 00 00 mov 0x4408,%eax
619: c7 44 24 04 99 33 00 movl $0x3399,0x4(%esp)
620: 00
621: 89 04 24 mov %eax,(%esp)
624: e8 47 28 00 00 call 2e70 <printf>
exit();
629: e8 f6 26 00 00 call 2d24 <exit>
62e: 66 90 xchg %ax,%ax
00000630 <exectest>:
printf(stdout, "mkdir test\n");
}
void
exectest(void)
{
630: 55 push %ebp
631: 89 e5 mov %esp,%ebp
633: 83 ec 18 sub $0x18,%esp
printf(stdout, "exec test\n");
636: a1 08 44 00 00 mov 0x4408,%eax
63b: c7 44 24 04 d1 33 00 movl $0x33d1,0x4(%esp)
642: 00
643: 89 04 24 mov %eax,(%esp)
646: e8 25 28 00 00 call 2e70 <printf>
if(exec("echo", echo_args) < 0) {
64b: c7 44 24 04 e8 43 00 movl $0x43e8,0x4(%esp)
652: 00
653: c7 04 24 9b 31 00 00 movl $0x319b,(%esp)
65a: e8 fd 26 00 00 call 2d5c <exec>
65f: 85 c0 test %eax,%eax
661: 78 02 js 665 <exectest+0x35>
printf(stdout, "exec echo failed\n");
exit();
}
}
663: c9 leave
664: c3 ret
void
exectest(void)
{
printf(stdout, "exec test\n");
if(exec("echo", echo_args) < 0) {
printf(stdout, "exec echo failed\n");
665: a1 08 44 00 00 mov 0x4408,%eax
66a: c7 44 24 04 dc 33 00 movl $0x33dc,0x4(%esp)
671: 00
672: 89 04 24 mov %eax,(%esp)
675: e8 f6 27 00 00 call 2e70 <printf>
exit();
67a: e8 a5 26 00 00 call 2d24 <exit>
67f: 90 nop
00000680 <pipe1>:
// simple fork and pipe read/write
void
pipe1(void)
{
680: 55 push %ebp
681: 89 e5 mov %esp,%ebp
683: 57 push %edi
684: 56 push %esi
685: 53 push %ebx
686: 83 ec 2c sub $0x2c,%esp
int fds[2], pid;
int seq, i, n, cc, total;
if(pipe(fds) != 0){
689: 8d 45 e0 lea -0x20(%ebp),%eax
68c: 89 04 24 mov %eax,(%esp)
68f: e8 a0 26 00 00 call 2d34 <pipe>
694: 85 c0 test %eax,%eax
696: 0f 85 4e 01 00 00 jne 7ea <pipe1+0x16a>
printf(1, "pipe() failed\n");
exit();
}
pid = fork();
69c: e8 7b 26 00 00 call 2d1c <fork>
seq = 0;
if(pid == 0){
6a1: 83 f8 00 cmp $0x0,%eax
6a4: 0f 84 80 00 00 00 je 72a <pipe1+0xaa>
printf(1, "pipe1 oops 1\n");
exit();
}
}
exit();
} else if(pid > 0){
6aa: 0f 8e 53 01 00 00 jle 803 <pipe1+0x183>
close(fds[1]);
6b0: 8b 45 e4 mov -0x1c(%ebp),%eax
total = 0;
6b3: 31 ff xor %edi,%edi
cc = 1;
6b5: be 01 00 00 00 mov $0x1,%esi
if(pipe(fds) != 0){
printf(1, "pipe() failed\n");
exit();
}
pid = fork();
seq = 0;
6ba: 31 db xor %ebx,%ebx
exit();
}
}
exit();
} else if(pid > 0){
close(fds[1]);
6bc: 89 04 24 mov %eax,(%esp)
6bf: e8 88 26 00 00 call 2d4c <close>
total = 0;
cc = 1;
while((n = read(fds[0], buf, cc)) > 0){
6c4: 8b 45 e0 mov -0x20(%ebp),%eax
6c7: 89 74 24 08 mov %esi,0x8(%esp)
6cb: c7 44 24 04 40 44 00 movl $0x4440,0x4(%esp)
6d2: 00
6d3: 89 04 24 mov %eax,(%esp)
6d6: e8 61 26 00 00 call 2d3c <read>
6db: 85 c0 test %eax,%eax
6dd: 0f 8e a5 00 00 00 jle 788 <pipe1+0x108>
6e3: 31 d2 xor %edx,%edx
6e5: 8d 76 00 lea 0x0(%esi),%esi
for(i = 0; i < n; i++){
if((buf[i] & 0xff) != (seq++ & 0xff)){
6e8: 38 9a 40 44 00 00 cmp %bl,0x4440(%edx)
6ee: 75 1e jne 70e <pipe1+0x8e>
} else if(pid > 0){
close(fds[1]);
total = 0;
cc = 1;
while((n = read(fds[0], buf, cc)) > 0){
for(i = 0; i < n; i++){
6f0: 83 c2 01 add $0x1,%edx
if((buf[i] & 0xff) != (seq++ & 0xff)){
6f3: 83 c3 01 add $0x1,%ebx
} else if(pid > 0){
close(fds[1]);
total = 0;
cc = 1;
while((n = read(fds[0], buf, cc)) > 0){
for(i = 0; i < n; i++){
6f6: 39 d0 cmp %edx,%eax
6f8: 7f ee jg 6e8 <pipe1+0x68>
printf(1, "pipe1 oops 2\n");
return;
}
}
total += n;
cc = cc * 2;
6fa: 01 f6 add %esi,%esi
if((buf[i] & 0xff) != (seq++ & 0xff)){
printf(1, "pipe1 oops 2\n");
return;
}
}
total += n;
6fc: 01 c7 add %eax,%edi
cc = cc * 2;
if(cc > sizeof(buf))
cc = sizeof(buf);
6fe: 81 fe 01 08 00 00 cmp $0x801,%esi
704: b8 00 08 00 00 mov $0x800,%eax
709: 0f 43 f0 cmovae %eax,%esi
70c: eb b6 jmp 6c4 <pipe1+0x44>
total = 0;
cc = 1;
while((n = read(fds[0], buf, cc)) > 0){
for(i = 0; i < n; i++){
if((buf[i] & 0xff) != (seq++ & 0xff)){
printf(1, "pipe1 oops 2\n");
70e: c7 44 24 04 0b 34 00 movl $0x340b,0x4(%esp)
715: 00
716: c7 04 24 01 00 00 00 movl $0x1,(%esp)
71d: e8 4e 27 00 00 call 2e70 <printf>
} else {
printf(1, "fork() failed\n");
exit();
}
printf(1, "pipe1 ok\n");
}
722: 83 c4 2c add $0x2c,%esp
725: 5b pop %ebx
726: 5e pop %esi
727: 5f pop %edi
728: 5d pop %ebp
729: c3 ret
exit();
}
pid = fork();
seq = 0;
if(pid == 0){
close(fds[0]);
72a: 8b 45 e0 mov -0x20(%ebp),%eax
if(pipe(fds) != 0){
printf(1, "pipe() failed\n");
exit();
}
pid = fork();
seq = 0;
72d: 31 db xor %ebx,%ebx
if(pid == 0){
close(fds[0]);
72f: 89 04 24 mov %eax,(%esp)
732: e8 15 26 00 00 call 2d4c <close>
// simple fork and pipe read/write
void
pipe1(void)
{
737: 31 c0 xor %eax,%eax
739: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
}
// simple fork and pipe read/write
void
pipe1(void)
740: 8d 14 18 lea (%eax,%ebx,1),%edx
743: 88 90 40 44 00 00 mov %dl,0x4440(%eax)
pid = fork();
seq = 0;
if(pid == 0){
close(fds[0]);
for(n = 0; n < 5; n++){
for(i = 0; i < 1033; i++)
749: 83 c0 01 add $0x1,%eax
74c: 3d 09 04 00 00 cmp $0x409,%eax
751: 75 ed jne 740 <pipe1+0xc0>
buf[i] = seq++;
if(write(fds[1], buf, 1033) != 1033){
753: 8b 45 e4 mov -0x1c(%ebp),%eax
pid = fork();
seq = 0;
if(pid == 0){
close(fds[0]);
for(n = 0; n < 5; n++){
for(i = 0; i < 1033; i++)
756: 81 c3 09 04 00 00 add $0x409,%ebx
buf[i] = seq++;
if(write(fds[1], buf, 1033) != 1033){
75c: c7 44 24 08 09 04 00 movl $0x409,0x8(%esp)
763: 00
764: c7 44 24 04 40 44 00 movl $0x4440,0x4(%esp)
76b: 00
76c: 89 04 24 mov %eax,(%esp)
76f: e8 d0 25 00 00 call 2d44 <write>
774: 3d 09 04 00 00 cmp $0x409,%eax
779: 75 56 jne 7d1 <pipe1+0x151>
}
pid = fork();
seq = 0;
if(pid == 0){
close(fds[0]);
for(n = 0; n < 5; n++){
77b: 81 fb 2d 14 00 00 cmp $0x142d,%ebx
781: 75 b4 jne 737 <pipe1+0xb7>
printf(1, "pipe1 oops 3 total %d\n", total);
close(fds[0]);
wait();
} else {
printf(1, "fork() failed\n");
exit();
783: e8 9c 25 00 00 call 2d24 <exit>
total += n;
cc = cc * 2;
if(cc > sizeof(buf))
cc = sizeof(buf);
}
if(total != 5 * 1033)
788: 81 ff 2d 14 00 00 cmp $0x142d,%edi
78e: 74 18 je 7a8 <pipe1+0x128>
printf(1, "pipe1 oops 3 total %d\n", total);
790: 89 7c 24 08 mov %edi,0x8(%esp)
794: c7 44 24 04 19 34 00 movl $0x3419,0x4(%esp)
79b: 00
79c: c7 04 24 01 00 00 00 movl $0x1,(%esp)
7a3: e8 c8 26 00 00 call 2e70 <printf>
close(fds[0]);
7a8: 8b 45 e0 mov -0x20(%ebp),%eax
7ab: 89 04 24 mov %eax,(%esp)
7ae: e8 99 25 00 00 call 2d4c <close>
wait();
7b3: e8 74 25 00 00 call 2d2c <wait>
} else {
printf(1, "fork() failed\n");
exit();
}
printf(1, "pipe1 ok\n");
7b8: c7 44 24 04 30 34 00 movl $0x3430,0x4(%esp)
7bf: 00
7c0: c7 04 24 01 00 00 00 movl $0x1,(%esp)
7c7: e8 a4 26 00 00 call 2e70 <printf>
7cc: e9 51 ff ff ff jmp 722 <pipe1+0xa2>
close(fds[0]);
for(n = 0; n < 5; n++){
for(i = 0; i < 1033; i++)
buf[i] = seq++;
if(write(fds[1], buf, 1033) != 1033){
printf(1, "pipe1 oops 1\n");
7d1: c7 44 24 04 fd 33 00 movl $0x33fd,0x4(%esp)
7d8: 00
7d9: c7 04 24 01 00 00 00 movl $0x1,(%esp)
7e0: e8 8b 26 00 00 call 2e70 <printf>
exit();
7e5: e8 3a 25 00 00 call 2d24 <exit>
{
int fds[2], pid;
int seq, i, n, cc, total;
if(pipe(fds) != 0){
printf(1, "pipe() failed\n");
7ea: c7 44 24 04 ee 33 00 movl $0x33ee,0x4(%esp)
7f1: 00
7f2: c7 04 24 01 00 00 00 movl $0x1,(%esp)
7f9: e8 72 26 00 00 call 2e70 <printf>
exit();
7fe: e8 21 25 00 00 call 2d24 <exit>
if(total != 5 * 1033)
printf(1, "pipe1 oops 3 total %d\n", total);
close(fds[0]);
wait();
} else {
printf(1, "fork() failed\n");
803: c7 44 24 04 3a 34 00 movl $0x343a,0x4(%esp)
80a: 00
80b: c7 04 24 01 00 00 00 movl $0x1,(%esp)
812: e8 59 26 00 00 call 2e70 <printf>
817: e9 67 ff ff ff jmp 783 <pipe1+0x103>
81c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000820 <preempt>:
}
// meant to be run w/ at most two CPUs
void
preempt(void)
{
820: 55 push %ebp
821: 89 e5 mov %esp,%ebp
823: 57 push %edi
824: 56 push %esi
825: 53 push %ebx
826: 83 ec 2c sub $0x2c,%esp
int pid1, pid2, pid3;
int pfds[2];
printf(1, "preempt: ");
829: c7 44 24 04 49 34 00 movl $0x3449,0x4(%esp)
830: 00
831: c7 04 24 01 00 00 00 movl $0x1,(%esp)
838: e8 33 26 00 00 call 2e70 <printf>
pid1 = fork();
83d: e8 da 24 00 00 call 2d1c <fork>
if(pid1 == 0)
842: 85 c0 test %eax,%eax
{
int pid1, pid2, pid3;
int pfds[2];
printf(1, "preempt: ");
pid1 = fork();
844: 89 c7 mov %eax,%edi
if(pid1 == 0)
846: 75 02 jne 84a <preempt+0x2a>
848: eb fe jmp 848 <preempt+0x28>
84a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
for(;;)
;
pid2 = fork();
850: e8 c7 24 00 00 call 2d1c <fork>
if(pid2 == 0)
855: 85 c0 test %eax,%eax
pid1 = fork();
if(pid1 == 0)
for(;;)
;
pid2 = fork();
857: 89 c6 mov %eax,%esi
if(pid2 == 0)
859: 75 02 jne 85d <preempt+0x3d>
85b: eb fe jmp 85b <preempt+0x3b>
for(;;)
;
pipe(pfds);
85d: 8d 45 e0 lea -0x20(%ebp),%eax
860: 89 04 24 mov %eax,(%esp)
863: e8 cc 24 00 00 call 2d34 <pipe>
pid3 = fork();
868: e8 af 24 00 00 call 2d1c <fork>
if(pid3 == 0){
86d: 85 c0 test %eax,%eax
if(pid2 == 0)
for(;;)
;
pipe(pfds);
pid3 = fork();
86f: 89 c3 mov %eax,%ebx
if(pid3 == 0){
871: 75 4c jne 8bf <preempt+0x9f>
close(pfds[0]);
873: 8b 45 e0 mov -0x20(%ebp),%eax
876: 89 04 24 mov %eax,(%esp)
879: e8 ce 24 00 00 call 2d4c <close>
if(write(pfds[1], "x", 1) != 1)
87e: 8b 45 e4 mov -0x1c(%ebp),%eax
881: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
888: 00
889: c7 44 24 04 e5 39 00 movl $0x39e5,0x4(%esp)
890: 00
891: 89 04 24 mov %eax,(%esp)
894: e8 ab 24 00 00 call 2d44 <write>
899: 83 e8 01 sub $0x1,%eax
89c: 74 14 je 8b2 <preempt+0x92>
printf(1, "preempt write error");
89e: c7 44 24 04 53 34 00 movl $0x3453,0x4(%esp)
8a5: 00
8a6: c7 04 24 01 00 00 00 movl $0x1,(%esp)
8ad: e8 be 25 00 00 call 2e70 <printf>
close(pfds[1]);
8b2: 8b 45 e4 mov -0x1c(%ebp),%eax
8b5: 89 04 24 mov %eax,(%esp)
8b8: e8 8f 24 00 00 call 2d4c <close>
8bd: eb fe jmp 8bd <preempt+0x9d>
for(;;)
;
}
close(pfds[1]);
8bf: 8b 45 e4 mov -0x1c(%ebp),%eax
8c2: 89 04 24 mov %eax,(%esp)
8c5: e8 82 24 00 00 call 2d4c <close>
if(read(pfds[0], buf, sizeof(buf)) != 1){
8ca: 8b 45 e0 mov -0x20(%ebp),%eax
8cd: c7 44 24 08 00 08 00 movl $0x800,0x8(%esp)
8d4: 00
8d5: c7 44 24 04 40 44 00 movl $0x4440,0x4(%esp)
8dc: 00
8dd: 89 04 24 mov %eax,(%esp)
8e0: e8 57 24 00 00 call 2d3c <read>
8e5: 83 e8 01 sub $0x1,%eax
8e8: 74 1c je 906 <preempt+0xe6>
printf(1, "preempt read error");
8ea: c7 44 24 04 67 34 00 movl $0x3467,0x4(%esp)
8f1: 00
8f2: c7 04 24 01 00 00 00 movl $0x1,(%esp)
8f9: e8 72 25 00 00 call 2e70 <printf>
printf(1, "wait... ");
wait();
wait();
wait();
printf(1, "preempt ok\n");
}
8fe: 83 c4 2c add $0x2c,%esp
901: 5b pop %ebx
902: 5e pop %esi
903: 5f pop %edi
904: 5d pop %ebp
905: c3 ret
close(pfds[1]);
if(read(pfds[0], buf, sizeof(buf)) != 1){
printf(1, "preempt read error");
return;
}
close(pfds[0]);
906: 8b 45 e0 mov -0x20(%ebp),%eax
909: 89 04 24 mov %eax,(%esp)
90c: e8 3b 24 00 00 call 2d4c <close>
printf(1, "kill... ");
911: c7 44 24 04 7a 34 00 movl $0x347a,0x4(%esp)
918: 00
919: c7 04 24 01 00 00 00 movl $0x1,(%esp)
920: e8 4b 25 00 00 call 2e70 <printf>
kill(pid1);
925: 89 3c 24 mov %edi,(%esp)
928: e8 27 24 00 00 call 2d54 <kill>
kill(pid2);
92d: 89 34 24 mov %esi,(%esp)
930: e8 1f 24 00 00 call 2d54 <kill>
kill(pid3);
935: 89 1c 24 mov %ebx,(%esp)
938: e8 17 24 00 00 call 2d54 <kill>
printf(1, "wait... ");
93d: c7 44 24 04 83 34 00 movl $0x3483,0x4(%esp)
944: 00
945: c7 04 24 01 00 00 00 movl $0x1,(%esp)
94c: e8 1f 25 00 00 call 2e70 <printf>
wait();
951: e8 d6 23 00 00 call 2d2c <wait>
wait();
956: e8 d1 23 00 00 call 2d2c <wait>
95b: 90 nop
95c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
wait();
960: e8 c7 23 00 00 call 2d2c <wait>
printf(1, "preempt ok\n");
965: c7 44 24 04 8c 34 00 movl $0x348c,0x4(%esp)
96c: 00
96d: c7 04 24 01 00 00 00 movl $0x1,(%esp)
974: e8 f7 24 00 00 call 2e70 <printf>
979: eb 83 jmp 8fe <preempt+0xde>
97b: 90 nop
97c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000980 <exitwait>:
}
// try to find any races between exit and wait
void
exitwait(void)
{
980: 55 push %ebp
981: 89 e5 mov %esp,%ebp
983: 56 push %esi
984: be 64 00 00 00 mov $0x64,%esi
989: 53 push %ebx
98a: 83 ec 10 sub $0x10,%esp
98d: eb 13 jmp 9a2 <exitwait+0x22>
98f: 90 nop
pid = fork();
if(pid < 0){
printf(1, "fork failed\n");
return;
}
if(pid){
990: 74 79 je a0b <exitwait+0x8b>
if(wait() != pid){
992: e8 95 23 00 00 call 2d2c <wait>
997: 39 d8 cmp %ebx,%eax
999: 75 35 jne 9d0 <exitwait+0x50>
void
exitwait(void)
{
int i, pid;
for(i = 0; i < 100; i++){
99b: 83 ee 01 sub $0x1,%esi
99e: 66 90 xchg %ax,%ax
9a0: 74 4e je 9f0 <exitwait+0x70>
pid = fork();
9a2: e8 75 23 00 00 call 2d1c <fork>
if(pid < 0){
9a7: 83 f8 00 cmp $0x0,%eax
exitwait(void)
{
int i, pid;
for(i = 0; i < 100; i++){
pid = fork();
9aa: 89 c3 mov %eax,%ebx
if(pid < 0){
9ac: 7d e2 jge 990 <exitwait+0x10>
printf(1, "fork failed\n");
9ae: c7 44 24 04 98 34 00 movl $0x3498,0x4(%esp)
9b5: 00
9b6: c7 04 24 01 00 00 00 movl $0x1,(%esp)
9bd: e8 ae 24 00 00 call 2e70 <printf>
} else {
exit();
}
}
printf(1, "exitwait ok\n");
}
9c2: 83 c4 10 add $0x10,%esp
9c5: 5b pop %ebx
9c6: 5e pop %esi
9c7: 5d pop %ebp
9c8: c3 ret
9c9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
printf(1, "fork failed\n");
return;
}
if(pid){
if(wait() != pid){
printf(1, "wait wrong pid\n");
9d0: c7 44 24 04 a5 34 00 movl $0x34a5,0x4(%esp)
9d7: 00
9d8: c7 04 24 01 00 00 00 movl $0x1,(%esp)
9df: e8 8c 24 00 00 call 2e70 <printf>
} else {
exit();
}
}
printf(1, "exitwait ok\n");
}
9e4: 83 c4 10 add $0x10,%esp
9e7: 5b pop %ebx
9e8: 5e pop %esi
9e9: 5d pop %ebp
9ea: c3 ret
9eb: 90 nop
9ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
}
} else {
exit();
}
}
printf(1, "exitwait ok\n");
9f0: c7 44 24 04 b5 34 00 movl $0x34b5,0x4(%esp)
9f7: 00
9f8: c7 04 24 01 00 00 00 movl $0x1,(%esp)
9ff: e8 6c 24 00 00 call 2e70 <printf>
}
a04: 83 c4 10 add $0x10,%esp
a07: 5b pop %ebx
a08: 5e pop %esi
a09: 5d pop %ebp
a0a: c3 ret
if(wait() != pid){
printf(1, "wait wrong pid\n");
return;
}
} else {
exit();
a0b: e8 14 23 00 00 call 2d24 <exit>
00000a10 <mem>:
printf(1, "exitwait ok\n");
}
void
mem(void)
{
a10: 55 push %ebp
a11: 89 e5 mov %esp,%ebp
a13: 56 push %esi
a14: 53 push %ebx
a15: 83 ec 10 sub $0x10,%esp
void *m1, *m2;
int pid;
if((pid = fork()) == 0){
a18: e8 ff 22 00 00 call 2d1c <fork>
a1d: 85 c0 test %eax,%eax
a1f: 75 6f jne a90 <mem+0x80>
a21: 31 db xor %ebx,%ebx
a23: eb 07 jmp a2c <mem+0x1c>
a25: 8d 76 00 lea 0x0(%esi),%esi
m1 = 0;
while((m2 = malloc(10001)) != 0) {
*(char**) m2 = m1;
a28: 89 18 mov %ebx,(%eax)
a2a: 89 c3 mov %eax,%ebx
void *m1, *m2;
int pid;
if((pid = fork()) == 0){
m1 = 0;
while((m2 = malloc(10001)) != 0) {
a2c: c7 04 24 11 27 00 00 movl $0x2711,(%esp)
a33: e8 58 26 00 00 call 3090 <malloc>
a38: 85 c0 test %eax,%eax
a3a: 75 ec jne a28 <mem+0x18>
*(char**) m2 = m1;
m1 = m2;
}
while(m1) {
a3c: 85 db test %ebx,%ebx
a3e: 75 0a jne a4a <mem+0x3a>
a40: eb 16 jmp a58 <mem+0x48>
a42: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
m2 = *(char**)m1;
free(m1);
m1 = m2;
a48: 89 f3 mov %esi,%ebx
while((m2 = malloc(10001)) != 0) {
*(char**) m2 = m1;
m1 = m2;
}
while(m1) {
m2 = *(char**)m1;
a4a: 8b 33 mov (%ebx),%esi
free(m1);
a4c: 89 1c 24 mov %ebx,(%esp)
a4f: e8 ac 25 00 00 call 3000 <free>
m1 = 0;
while((m2 = malloc(10001)) != 0) {
*(char**) m2 = m1;
m1 = m2;
}
while(m1) {
a54: 85 f6 test %esi,%esi
a56: 75 f0 jne a48 <mem+0x38>
m2 = *(char**)m1;
free(m1);
m1 = m2;
}
m1 = malloc(1024*20);
a58: c7 04 24 00 50 00 00 movl $0x5000,(%esp)
a5f: e8 2c 26 00 00 call 3090 <malloc>
if(m1 == 0) {
a64: 85 c0 test %eax,%eax
a66: 74 38 je aa0 <mem+0x90>
printf(1, "couldn't allocate mem?!!\n");
exit();
}
free(m1);
a68: 89 04 24 mov %eax,(%esp)
a6b: e8 90 25 00 00 call 3000 <free>
printf(1, "mem ok\n");
a70: c7 44 24 04 dc 34 00 movl $0x34dc,0x4(%esp)
a77: 00
a78: c7 04 24 01 00 00 00 movl $0x1,(%esp)
a7f: e8 ec 23 00 00 call 2e70 <printf>
exit();
a84: e8 9b 22 00 00 call 2d24 <exit>
a89: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
} else {
wait();
}
}
a90: 83 c4 10 add $0x10,%esp
a93: 5b pop %ebx
a94: 5e pop %esi
a95: 5d pop %ebp
}
free(m1);
printf(1, "mem ok\n");
exit();
} else {
wait();
a96: e9 91 22 00 00 jmp 2d2c <wait>
a9b: 90 nop
a9c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
free(m1);
m1 = m2;
}
m1 = malloc(1024*20);
if(m1 == 0) {
printf(1, "couldn't allocate mem?!!\n");
aa0: c7 44 24 04 c2 34 00 movl $0x34c2,0x4(%esp)
aa7: 00
aa8: c7 04 24 01 00 00 00 movl $0x1,(%esp)
aaf: e8 bc 23 00 00 call 2e70 <printf>
exit();
ab4: e8 6b 22 00 00 call 2d24 <exit>
ab9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000ac0 <sharedfd>:
// two processes write to the same file descriptor
// is the offset shared? does inode locking work?
void
sharedfd(void)
{
ac0: 55 push %ebp
ac1: 89 e5 mov %esp,%ebp
ac3: 57 push %edi
ac4: 56 push %esi
ac5: 53 push %ebx
ac6: 83 ec 3c sub $0x3c,%esp
int fd, pid, i, n, nc, np;
char buf[10];
unlink("sharedfd");
ac9: c7 04 24 e4 34 00 00 movl $0x34e4,(%esp)
ad0: e8 9f 22 00 00 call 2d74 <unlink>
fd = open("sharedfd", O_CREATE|O_RDWR);
ad5: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
adc: 00
add: c7 04 24 e4 34 00 00 movl $0x34e4,(%esp)
ae4: e8 7b 22 00 00 call 2d64 <open>
if(fd < 0){
ae9: 85 c0 test %eax,%eax
{
int fd, pid, i, n, nc, np;
char buf[10];
unlink("sharedfd");
fd = open("sharedfd", O_CREATE|O_RDWR);
aeb: 89 c7 mov %eax,%edi
if(fd < 0){
aed: 0f 88 4d 01 00 00 js c40 <sharedfd+0x180>
printf(1, "fstests: cannot open sharedfd for writing");
return;
}
pid = fork();
af3: e8 24 22 00 00 call 2d1c <fork>
memset(buf, pid==0?'c':'p', sizeof(buf));
af8: 8d 75 de lea -0x22(%ebp),%esi
afb: bb e8 03 00 00 mov $0x3e8,%ebx
b00: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
b07: 00
b08: 89 34 24 mov %esi,(%esp)
b0b: 83 f8 01 cmp $0x1,%eax
fd = open("sharedfd", O_CREATE|O_RDWR);
if(fd < 0){
printf(1, "fstests: cannot open sharedfd for writing");
return;
}
pid = fork();
b0e: 89 45 d4 mov %eax,-0x2c(%ebp)
memset(buf, pid==0?'c':'p', sizeof(buf));
b11: 19 c0 sbb %eax,%eax
b13: 83 e0 f3 and $0xfffffff3,%eax
b16: 83 c0 70 add $0x70,%eax
b19: 89 44 24 04 mov %eax,0x4(%esp)
b1d: e8 5e 20 00 00 call 2b80 <memset>
b22: eb 09 jmp b2d <sharedfd+0x6d>
b24: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
for(i = 0; i < 1000; i++){
b28: 83 eb 01 sub $0x1,%ebx
b2b: 74 2d je b5a <sharedfd+0x9a>
if(write(fd, buf, sizeof(buf)) != sizeof(buf)){
b2d: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
b34: 00
b35: 89 74 24 04 mov %esi,0x4(%esp)
b39: 89 3c 24 mov %edi,(%esp)
b3c: e8 03 22 00 00 call 2d44 <write>
b41: 83 f8 0a cmp $0xa,%eax
b44: 74 e2 je b28 <sharedfd+0x68>
printf(1, "fstests: write sharedfd failed\n");
b46: c7 44 24 04 5c 3f 00 movl $0x3f5c,0x4(%esp)
b4d: 00
b4e: c7 04 24 01 00 00 00 movl $0x1,(%esp)
b55: e8 16 23 00 00 call 2e70 <printf>
break;
}
}
if(pid == 0)
b5a: 8b 45 d4 mov -0x2c(%ebp),%eax
b5d: 85 c0 test %eax,%eax
b5f: 0f 84 0d 01 00 00 je c72 <sharedfd+0x1b2>
exit();
else
wait();
b65: e8 c2 21 00 00 call 2d2c <wait>
close(fd);
fd = open("sharedfd", 0);
if(fd < 0){
b6a: 31 db xor %ebx,%ebx
}
if(pid == 0)
exit();
else
wait();
close(fd);
b6c: 89 3c 24 mov %edi,(%esp)
fd = open("sharedfd", 0);
if(fd < 0){
b6f: 31 ff xor %edi,%edi
}
if(pid == 0)
exit();
else
wait();
close(fd);
b71: e8 d6 21 00 00 call 2d4c <close>
fd = open("sharedfd", 0);
b76: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
b7d: 00
b7e: c7 04 24 e4 34 00 00 movl $0x34e4,(%esp)
b85: e8 da 21 00 00 call 2d64 <open>
if(fd < 0){
b8a: 85 c0 test %eax,%eax
if(pid == 0)
exit();
else
wait();
close(fd);
fd = open("sharedfd", 0);
b8c: 89 45 d4 mov %eax,-0x2c(%ebp)
if(fd < 0){
b8f: 0f 88 c7 00 00 00 js c5c <sharedfd+0x19c>
b95: 8d 76 00 lea 0x0(%esi),%esi
printf(1, "fstests: cannot open sharedfd for reading\n");
return;
}
nc = np = 0;
while((n = read(fd, buf, sizeof(buf))) > 0){
b98: 8b 45 d4 mov -0x2c(%ebp),%eax
b9b: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
ba2: 00
ba3: 89 74 24 04 mov %esi,0x4(%esp)
ba7: 89 04 24 mov %eax,(%esp)
baa: e8 8d 21 00 00 call 2d3c <read>
baf: 85 c0 test %eax,%eax
bb1: 7e 26 jle bd9 <sharedfd+0x119>
bb3: 31 c0 xor %eax,%eax
bb5: eb 14 jmp bcb <sharedfd+0x10b>
bb7: 90 nop
for(i = 0; i < sizeof(buf); i++){
if(buf[i] == 'c')
nc++;
if(buf[i] == 'p')
np++;
bb8: 80 fa 70 cmp $0x70,%dl
bbb: 0f 94 c2 sete %dl
bbe: 0f b6 d2 movzbl %dl,%edx
bc1: 01 d3 add %edx,%ebx
printf(1, "fstests: cannot open sharedfd for reading\n");
return;
}
nc = np = 0;
while((n = read(fd, buf, sizeof(buf))) > 0){
for(i = 0; i < sizeof(buf); i++){
bc3: 83 c0 01 add $0x1,%eax
bc6: 83 f8 0a cmp $0xa,%eax
bc9: 74 cd je b98 <sharedfd+0xd8>
if(buf[i] == 'c')
bcb: 0f b6 14 06 movzbl (%esi,%eax,1),%edx
bcf: 80 fa 63 cmp $0x63,%dl
bd2: 75 e4 jne bb8 <sharedfd+0xf8>
nc++;
bd4: 83 c7 01 add $0x1,%edi
bd7: eb ea jmp bc3 <sharedfd+0x103>
if(buf[i] == 'p')
np++;
}
}
close(fd);
bd9: 8b 45 d4 mov -0x2c(%ebp),%eax
bdc: 89 04 24 mov %eax,(%esp)
bdf: e8 68 21 00 00 call 2d4c <close>
unlink("sharedfd");
be4: c7 04 24 e4 34 00 00 movl $0x34e4,(%esp)
beb: e8 84 21 00 00 call 2d74 <unlink>
if(nc == 10000 && np == 10000)
bf0: 81 fb 10 27 00 00 cmp $0x2710,%ebx
bf6: 74 24 je c1c <sharedfd+0x15c>
printf(1, "sharedfd ok\n");
else
printf(1, "sharedfd oops %d %d\n", nc, np);
bf8: 89 5c 24 0c mov %ebx,0xc(%esp)
bfc: 89 7c 24 08 mov %edi,0x8(%esp)
c00: c7 44 24 04 fa 34 00 movl $0x34fa,0x4(%esp)
c07: 00
c08: c7 04 24 01 00 00 00 movl $0x1,(%esp)
c0f: e8 5c 22 00 00 call 2e70 <printf>
}
c14: 83 c4 3c add $0x3c,%esp
c17: 5b pop %ebx
c18: 5e pop %esi
c19: 5f pop %edi
c1a: 5d pop %ebp
c1b: c3 ret
np++;
}
}
close(fd);
unlink("sharedfd");
if(nc == 10000 && np == 10000)
c1c: 81 ff 10 27 00 00 cmp $0x2710,%edi
c22: 75 d4 jne bf8 <sharedfd+0x138>
printf(1, "sharedfd ok\n");
c24: c7 44 24 04 ed 34 00 movl $0x34ed,0x4(%esp)
c2b: 00
c2c: c7 04 24 01 00 00 00 movl $0x1,(%esp)
c33: e8 38 22 00 00 call 2e70 <printf>
else
printf(1, "sharedfd oops %d %d\n", nc, np);
}
c38: 83 c4 3c add $0x3c,%esp
c3b: 5b pop %ebx
c3c: 5e pop %esi
c3d: 5f pop %edi
c3e: 5d pop %ebp
c3f: c3 ret
char buf[10];
unlink("sharedfd");
fd = open("sharedfd", O_CREATE|O_RDWR);
if(fd < 0){
printf(1, "fstests: cannot open sharedfd for writing");
c40: c7 44 24 04 30 3f 00 movl $0x3f30,0x4(%esp)
c47: 00
c48: c7 04 24 01 00 00 00 movl $0x1,(%esp)
c4f: e8 1c 22 00 00 call 2e70 <printf>
unlink("sharedfd");
if(nc == 10000 && np == 10000)
printf(1, "sharedfd ok\n");
else
printf(1, "sharedfd oops %d %d\n", nc, np);
}
c54: 83 c4 3c add $0x3c,%esp
c57: 5b pop %ebx
c58: 5e pop %esi
c59: 5f pop %edi
c5a: 5d pop %ebp
c5b: c3 ret
else
wait();
close(fd);
fd = open("sharedfd", 0);
if(fd < 0){
printf(1, "fstests: cannot open sharedfd for reading\n");
c5c: c7 44 24 04 7c 3f 00 movl $0x3f7c,0x4(%esp)
c63: 00
c64: c7 04 24 01 00 00 00 movl $0x1,(%esp)
c6b: e8 00 22 00 00 call 2e70 <printf>
return;
c70: eb a2 jmp c14 <sharedfd+0x154>
printf(1, "fstests: write sharedfd failed\n");
break;
}
}
if(pid == 0)
exit();
c72: e8 ad 20 00 00 call 2d24 <exit>
c77: 89 f6 mov %esi,%esi
c79: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000c80 <twofiles>:
// two processes write two different files at the same
// time, to test block allocation.
void
twofiles(void)
{
c80: 55 push %ebp
c81: 89 e5 mov %esp,%ebp
c83: 57 push %edi
c84: 56 push %esi
c85: 53 push %ebx
c86: 83 ec 2c sub $0x2c,%esp
int fd, pid, i, j, n, total;
char *fname;
printf(1, "twofiles test\n");
c89: c7 44 24 04 0f 35 00 movl $0x350f,0x4(%esp)
c90: 00
c91: c7 04 24 01 00 00 00 movl $0x1,(%esp)
c98: e8 d3 21 00 00 call 2e70 <printf>
unlink("f1");
c9d: c7 04 24 5f 36 00 00 movl $0x365f,(%esp)
ca4: e8 cb 20 00 00 call 2d74 <unlink>
unlink("f2");
ca9: c7 04 24 63 36 00 00 movl $0x3663,(%esp)
cb0: e8 bf 20 00 00 call 2d74 <unlink>
pid = fork();
cb5: e8 62 20 00 00 call 2d1c <fork>
if(pid < 0){
cba: 83 f8 00 cmp $0x0,%eax
printf(1, "twofiles test\n");
unlink("f1");
unlink("f2");
pid = fork();
cbd: 89 c7 mov %eax,%edi
if(pid < 0){
cbf: 0f 8c 70 01 00 00 jl e35 <twofiles+0x1b5>
printf(1, "fork failed\n");
return;
}
fname = pid ? "f1" : "f2";
cc5: ba 63 36 00 00 mov $0x3663,%edx
cca: b8 5f 36 00 00 mov $0x365f,%eax
ccf: 0f 44 c2 cmove %edx,%eax
fd = open(fname, O_CREATE | O_RDWR);
cd2: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
cd9: 00
cda: 89 04 24 mov %eax,(%esp)
cdd: e8 82 20 00 00 call 2d64 <open>
if(fd < 0){
ce2: 85 c0 test %eax,%eax
printf(1, "fork failed\n");
return;
}
fname = pid ? "f1" : "f2";
fd = open(fname, O_CREATE | O_RDWR);
ce4: 89 c6 mov %eax,%esi
if(fd < 0){
ce6: 0f 88 99 01 00 00 js e85 <twofiles+0x205>
printf(1, "create failed\n");
exit();
}
memset(buf, pid?'p':'c', 512);
cec: 83 ff 01 cmp $0x1,%edi
cef: bb 0c 00 00 00 mov $0xc,%ebx
cf4: 19 c0 sbb %eax,%eax
cf6: 83 e0 f3 and $0xfffffff3,%eax
cf9: 83 c0 70 add $0x70,%eax
cfc: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
d03: 00
d04: 89 44 24 04 mov %eax,0x4(%esp)
d08: c7 04 24 40 44 00 00 movl $0x4440,(%esp)
d0f: e8 6c 1e 00 00 call 2b80 <memset>
d14: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
for(i = 0; i < 12; i++){
if((n = write(fd, buf, 500)) != 500){
d18: c7 44 24 08 f4 01 00 movl $0x1f4,0x8(%esp)
d1f: 00
d20: c7 44 24 04 40 44 00 movl $0x4440,0x4(%esp)
d27: 00
d28: 89 34 24 mov %esi,(%esp)
d2b: e8 14 20 00 00 call 2d44 <write>
d30: 3d f4 01 00 00 cmp $0x1f4,%eax
d35: 0f 85 2d 01 00 00 jne e68 <twofiles+0x1e8>
printf(1, "create failed\n");
exit();
}
memset(buf, pid?'p':'c', 512);
for(i = 0; i < 12; i++){
d3b: 83 eb 01 sub $0x1,%ebx
d3e: 75 d8 jne d18 <twofiles+0x98>
if((n = write(fd, buf, 500)) != 500){
printf(1, "write failed %d\n", n);
exit();
}
}
close(fd);
d40: 89 34 24 mov %esi,(%esp)
d43: e8 04 20 00 00 call 2d4c <close>
if(pid)
d48: 85 ff test %edi,%edi
d4a: 0f 84 e0 00 00 00 je e30 <twofiles+0x1b0>
wait();
d50: e8 d7 1f 00 00 call 2d2c <wait>
else
exit();
for(i = 0; i < 2; i++){
d55: 31 db xor %ebx,%ebx
fd = open(i?"f1":"f2", 0);
d57: b8 63 36 00 00 mov $0x3663,%eax
d5c: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
d63: 00
total = 0;
d64: 31 f6 xor %esi,%esi
wait();
else
exit();
for(i = 0; i < 2; i++){
fd = open(i?"f1":"f2", 0);
d66: 89 04 24 mov %eax,(%esp)
d69: e8 f6 1f 00 00 call 2d64 <open>
d6e: 89 45 e4 mov %eax,-0x1c(%ebp)
d71: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
total = 0;
while((n = read(fd, buf, sizeof(buf))) > 0){
d78: 8b 45 e4 mov -0x1c(%ebp),%eax
d7b: c7 44 24 08 00 08 00 movl $0x800,0x8(%esp)
d82: 00
d83: c7 44 24 04 40 44 00 movl $0x4440,0x4(%esp)
d8a: 00
d8b: 89 04 24 mov %eax,(%esp)
d8e: e8 a9 1f 00 00 call 2d3c <read>
d93: 85 c0 test %eax,%eax
d95: 7e 2a jle dc1 <twofiles+0x141>
d97: 31 c9 xor %ecx,%ecx
d99: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
for(j = 0; j < n; j++){
if(buf[j] != (i?'p':'c')){
da0: 83 fb 01 cmp $0x1,%ebx
da3: 0f be b9 40 44 00 00 movsbl 0x4440(%ecx),%edi
daa: 19 d2 sbb %edx,%edx
dac: 83 e2 f3 and $0xfffffff3,%edx
daf: 83 c2 70 add $0x70,%edx
db2: 39 d7 cmp %edx,%edi
db4: 75 66 jne e1c <twofiles+0x19c>
for(i = 0; i < 2; i++){
fd = open(i?"f1":"f2", 0);
total = 0;
while((n = read(fd, buf, sizeof(buf))) > 0){
for(j = 0; j < n; j++){
db6: 83 c1 01 add $0x1,%ecx
db9: 39 c8 cmp %ecx,%eax
dbb: 7f e3 jg da0 <twofiles+0x120>
if(buf[j] != (i?'p':'c')){
printf(1, "wrong char\n");
exit();
}
}
total += n;
dbd: 01 c6 add %eax,%esi
dbf: eb b7 jmp d78 <twofiles+0xf8>
}
close(fd);
dc1: 8b 45 e4 mov -0x1c(%ebp),%eax
dc4: 89 04 24 mov %eax,(%esp)
dc7: e8 80 1f 00 00 call 2d4c <close>
if(total != 12*500){
dcc: 81 fe 70 17 00 00 cmp $0x1770,%esi
dd2: 75 77 jne e4b <twofiles+0x1cb>
if(pid)
wait();
else
exit();
for(i = 0; i < 2; i++){
dd4: 83 fb 01 cmp $0x1,%ebx
dd7: 75 34 jne e0d <twofiles+0x18d>
printf(1, "wrong length %d\n", total);
exit();
}
}
unlink("f1");
dd9: c7 04 24 5f 36 00 00 movl $0x365f,(%esp)
de0: e8 8f 1f 00 00 call 2d74 <unlink>
unlink("f2");
de5: c7 04 24 63 36 00 00 movl $0x3663,(%esp)
dec: e8 83 1f 00 00 call 2d74 <unlink>
printf(1, "twofiles ok\n");
df1: c7 44 24 04 4c 35 00 movl $0x354c,0x4(%esp)
df8: 00
df9: c7 04 24 01 00 00 00 movl $0x1,(%esp)
e00: e8 6b 20 00 00 call 2e70 <printf>
}
e05: 83 c4 2c add $0x2c,%esp
e08: 5b pop %ebx
e09: 5e pop %esi
e0a: 5f pop %edi
e0b: 5d pop %ebp
e0c: c3 ret
if(pid)
wait();
else
exit();
for(i = 0; i < 2; i++){
e0d: bb 01 00 00 00 mov $0x1,%ebx
e12: b8 5f 36 00 00 mov $0x365f,%eax
e17: e9 40 ff ff ff jmp d5c <twofiles+0xdc>
fd = open(i?"f1":"f2", 0);
total = 0;
while((n = read(fd, buf, sizeof(buf))) > 0){
for(j = 0; j < n; j++){
if(buf[j] != (i?'p':'c')){
printf(1, "wrong char\n");
e1c: c7 44 24 04 2f 35 00 movl $0x352f,0x4(%esp)
e23: 00
e24: c7 04 24 01 00 00 00 movl $0x1,(%esp)
e2b: e8 40 20 00 00 call 2e70 <printf>
exit();
e30: e8 ef 1e 00 00 call 2d24 <exit>
unlink("f1");
unlink("f2");
pid = fork();
if(pid < 0){
printf(1, "fork failed\n");
e35: c7 44 24 04 98 34 00 movl $0x3498,0x4(%esp)
e3c: 00
e3d: c7 04 24 01 00 00 00 movl $0x1,(%esp)
e44: e8 27 20 00 00 call 2e70 <printf>
return;
e49: eb ba jmp e05 <twofiles+0x185>
}
total += n;
}
close(fd);
if(total != 12*500){
printf(1, "wrong length %d\n", total);
e4b: 89 74 24 08 mov %esi,0x8(%esp)
e4f: c7 44 24 04 3b 35 00 movl $0x353b,0x4(%esp)
e56: 00
e57: c7 04 24 01 00 00 00 movl $0x1,(%esp)
e5e: e8 0d 20 00 00 call 2e70 <printf>
exit();
e63: e8 bc 1e 00 00 call 2d24 <exit>
}
memset(buf, pid?'p':'c', 512);
for(i = 0; i < 12; i++){
if((n = write(fd, buf, 500)) != 500){
printf(1, "write failed %d\n", n);
e68: 89 44 24 08 mov %eax,0x8(%esp)
e6c: c7 44 24 04 1e 35 00 movl $0x351e,0x4(%esp)
e73: 00
e74: c7 04 24 01 00 00 00 movl $0x1,(%esp)
e7b: e8 f0 1f 00 00 call 2e70 <printf>
exit();
e80: e8 9f 1e 00 00 call 2d24 <exit>
}
fname = pid ? "f1" : "f2";
fd = open(fname, O_CREATE | O_RDWR);
if(fd < 0){
printf(1, "create failed\n");
e85: c7 44 24 04 93 37 00 movl $0x3793,0x4(%esp)
e8c: 00
e8d: c7 04 24 01 00 00 00 movl $0x1,(%esp)
e94: e8 d7 1f 00 00 call 2e70 <printf>
exit();
e99: e8 86 1e 00 00 call 2d24 <exit>
e9e: 66 90 xchg %ax,%ax
00000ea0 <createdelete>:
}
// two processes create and delete different files in same directory
void
createdelete(void)
{
ea0: 55 push %ebp
ea1: 89 e5 mov %esp,%ebp
ea3: 57 push %edi
ea4: 56 push %esi
ea5: 53 push %ebx
ea6: 83 ec 4c sub $0x4c,%esp
enum { N = 20 };
int pid, i, fd;
char name[32];
printf(1, "createdelete test\n");
ea9: c7 44 24 04 59 35 00 movl $0x3559,0x4(%esp)
eb0: 00
eb1: c7 04 24 01 00 00 00 movl $0x1,(%esp)
eb8: e8 b3 1f 00 00 call 2e70 <printf>
pid = fork();
ebd: e8 5a 1e 00 00 call 2d1c <fork>
if(pid < 0){
ec2: 85 c0 test %eax,%eax
enum { N = 20 };
int pid, i, fd;
char name[32];
printf(1, "createdelete test\n");
pid = fork();
ec4: 89 45 c4 mov %eax,-0x3c(%ebp)
if(pid < 0){
ec7: 0f 88 12 02 00 00 js 10df <createdelete+0x23f>
printf(1, "fork failed\n");
exit();
}
name[0] = pid ? 'p' : 'c';
ecd: 83 7d c4 01 cmpl $0x1,-0x3c(%ebp)
name[2] = '\0';
ed1: bf 01 00 00 00 mov $0x1,%edi
ed6: c6 45 ca 00 movb $0x0,-0x36(%ebp)
eda: 8d 75 c8 lea -0x38(%ebp),%esi
if(pid < 0){
printf(1, "fork failed\n");
exit();
}
name[0] = pid ? 'p' : 'c';
edd: 19 c0 sbb %eax,%eax
name[2] = '\0';
edf: 31 db xor %ebx,%ebx
if(pid < 0){
printf(1, "fork failed\n");
exit();
}
name[0] = pid ? 'p' : 'c';
ee1: 83 e0 f3 and $0xfffffff3,%eax
ee4: 83 c0 70 add $0x70,%eax
ee7: 88 45 c8 mov %al,-0x38(%ebp)
eea: eb 0f jmp efb <createdelete+0x5b>
eec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
name[2] = '\0';
for(i = 0; i < N; i++){
ef0: 83 ff 13 cmp $0x13,%edi
ef3: 7f 6b jg f60 <createdelete+0xc0>
printf(1, "fork failed\n");
exit();
}
name[0] = pid ? 'p' : 'c';
name[2] = '\0';
ef5: 83 c3 01 add $0x1,%ebx
ef8: 83 c7 01 add $0x1,%edi
printf(1, "twofiles ok\n");
}
// two processes create and delete different files in same directory
void
createdelete(void)
efb: 8d 43 30 lea 0x30(%ebx),%eax
efe: 88 45 c9 mov %al,-0x37(%ebp)
name[0] = pid ? 'p' : 'c';
name[2] = '\0';
for(i = 0; i < N; i++){
name[1] = '0' + i;
fd = open(name, O_CREATE | O_RDWR);
f01: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
f08: 00
f09: 89 34 24 mov %esi,(%esp)
f0c: e8 53 1e 00 00 call 2d64 <open>
if(fd < 0){
f11: 85 c0 test %eax,%eax
f13: 0f 88 3e 01 00 00 js 1057 <createdelete+0x1b7>
printf(1, "create failed\n");
exit();
}
close(fd);
f19: 89 04 24 mov %eax,(%esp)
f1c: e8 2b 1e 00 00 call 2d4c <close>
if(i > 0 && (i % 2 ) == 0){
f21: 85 db test %ebx,%ebx
f23: 74 d0 je ef5 <createdelete+0x55>
f25: f6 c3 01 test $0x1,%bl
f28: 75 c6 jne ef0 <createdelete+0x50>
name[1] = '0' + (i / 2);
f2a: 89 d8 mov %ebx,%eax
f2c: d1 f8 sar %eax
f2e: 83 c0 30 add $0x30,%eax
f31: 88 45 c9 mov %al,-0x37(%ebp)
if(unlink(name) < 0){
f34: 89 34 24 mov %esi,(%esp)
f37: e8 38 1e 00 00 call 2d74 <unlink>
f3c: 85 c0 test %eax,%eax
f3e: 79 b0 jns ef0 <createdelete+0x50>
printf(1, "unlink failed\n");
f40: c7 44 24 04 6c 35 00 movl $0x356c,0x4(%esp)
f47: 00
f48: c7 04 24 01 00 00 00 movl $0x1,(%esp)
f4f: e8 1c 1f 00 00 call 2e70 <printf>
exit();
f54: e8 cb 1d 00 00 call 2d24 <exit>
f59: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
}
}
}
if(pid==0)
f60: 8b 55 c4 mov -0x3c(%ebp),%edx
f63: 85 d2 test %edx,%edx
f65: 0f 84 6f 01 00 00 je 10da <createdelete+0x23a>
exit();
else
wait();
f6b: e8 bc 1d 00 00 call 2d2c <wait>
for(i = 0; i < N; i++){
f70: 31 db xor %ebx,%ebx
f72: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
printf(1, "twofiles ok\n");
}
// two processes create and delete different files in same directory
void
createdelete(void)
f78: 8d 7b 30 lea 0x30(%ebx),%edi
else
wait();
for(i = 0; i < N; i++){
name[0] = 'p';
name[1] = '0' + i;
f7b: 89 f8 mov %edi,%eax
exit();
else
wait();
for(i = 0; i < N; i++){
name[0] = 'p';
f7d: c6 45 c8 70 movb $0x70,-0x38(%ebp)
name[1] = '0' + i;
f81: 88 45 c9 mov %al,-0x37(%ebp)
fd = open(name, 0);
f84: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
f8b: 00
f8c: 89 34 24 mov %esi,(%esp)
f8f: e8 d0 1d 00 00 call 2d64 <open>
if((i == 0 || i >= N/2) && fd < 0){
f94: 83 fb 09 cmp $0x9,%ebx
f97: 0f 9f c1 setg %cl
f9a: 85 db test %ebx,%ebx
f9c: 0f 94 c2 sete %dl
f9f: 08 d1 or %dl,%cl
fa1: 88 4d c3 mov %cl,-0x3d(%ebp)
fa4: 74 08 je fae <createdelete+0x10e>
fa6: 85 c0 test %eax,%eax
fa8: 0f 88 14 01 00 00 js 10c2 <createdelete+0x222>
printf(1, "oops createdelete %s didn't exist\n", name);
exit();
} else if((i >= 1 && i < N/2) && fd >= 0){
fae: 8d 53 ff lea -0x1(%ebx),%edx
fb1: 83 fa 08 cmp $0x8,%edx
fb4: 89 c2 mov %eax,%edx
fb6: f7 d2 not %edx
fb8: 0f 96 45 c4 setbe -0x3c(%ebp)
fbc: c1 ea 1f shr $0x1f,%edx
fbf: 80 7d c4 00 cmpb $0x0,-0x3c(%ebp)
fc3: 0f 85 b7 00 00 00 jne 1080 <createdelete+0x1e0>
printf(1, "oops createdelete %s did exist\n", name);
exit();
}
if(fd >= 0)
fc9: 84 d2 test %dl,%dl
fcb: 74 08 je fd5 <createdelete+0x135>
close(fd);
fcd: 89 04 24 mov %eax,(%esp)
fd0: e8 77 1d 00 00 call 2d4c <close>
name[0] = 'c';
name[1] = '0' + i;
fd5: 89 f8 mov %edi,%eax
exit();
}
if(fd >= 0)
close(fd);
name[0] = 'c';
fd7: c6 45 c8 63 movb $0x63,-0x38(%ebp)
name[1] = '0' + i;
fdb: 88 45 c9 mov %al,-0x37(%ebp)
fd = open(name, 0);
fde: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
fe5: 00
fe6: 89 34 24 mov %esi,(%esp)
fe9: e8 76 1d 00 00 call 2d64 <open>
if((i == 0 || i >= N/2) && fd < 0){
fee: 80 7d c3 00 cmpb $0x0,-0x3d(%ebp)
ff2: 74 08 je ffc <createdelete+0x15c>
ff4: 85 c0 test %eax,%eax
ff6: 0f 88 a9 00 00 00 js 10a5 <createdelete+0x205>
printf(1, "oops createdelete %s didn't exist\n", name);
exit();
} else if((i >= 1 && i < N/2) && fd >= 0){
ffc: 85 c0 test %eax,%eax
ffe: 66 90 xchg %ax,%ax
1000: 79 6e jns 1070 <createdelete+0x1d0>
if(pid==0)
exit();
else
wait();
for(i = 0; i < N; i++){
1002: 83 c3 01 add $0x1,%ebx
1005: 83 fb 14 cmp $0x14,%ebx
1008: 0f 85 6a ff ff ff jne f78 <createdelete+0xd8>
100e: bb 30 00 00 00 mov $0x30,%ebx
1013: 90 nop
1014: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
close(fd);
}
for(i = 0; i < N; i++){
name[0] = 'p';
name[1] = '0' + i;
1018: 88 5d c9 mov %bl,-0x37(%ebp)
unlink(name);
name[0] = 'c';
unlink(name);
101b: 83 c3 01 add $0x1,%ebx
if(fd >= 0)
close(fd);
}
for(i = 0; i < N; i++){
name[0] = 'p';
101e: c6 45 c8 70 movb $0x70,-0x38(%ebp)
name[1] = '0' + i;
unlink(name);
1022: 89 34 24 mov %esi,(%esp)
1025: e8 4a 1d 00 00 call 2d74 <unlink>
name[0] = 'c';
102a: c6 45 c8 63 movb $0x63,-0x38(%ebp)
unlink(name);
102e: 89 34 24 mov %esi,(%esp)
1031: e8 3e 1d 00 00 call 2d74 <unlink>
}
if(fd >= 0)
close(fd);
}
for(i = 0; i < N; i++){
1036: 80 fb 44 cmp $0x44,%bl
1039: 75 dd jne 1018 <createdelete+0x178>
unlink(name);
name[0] = 'c';
unlink(name);
}
printf(1, "createdelete ok\n");
103b: c7 44 24 04 7b 35 00 movl $0x357b,0x4(%esp)
1042: 00
1043: c7 04 24 01 00 00 00 movl $0x1,(%esp)
104a: e8 21 1e 00 00 call 2e70 <printf>
}
104f: 83 c4 4c add $0x4c,%esp
1052: 5b pop %ebx
1053: 5e pop %esi
1054: 5f pop %edi
1055: 5d pop %ebp
1056: c3 ret
name[2] = '\0';
for(i = 0; i < N; i++){
name[1] = '0' + i;
fd = open(name, O_CREATE | O_RDWR);
if(fd < 0){
printf(1, "create failed\n");
1057: c7 44 24 04 93 37 00 movl $0x3793,0x4(%esp)
105e: 00
105f: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1066: e8 05 1e 00 00 call 2e70 <printf>
exit();
106b: e8 b4 1c 00 00 call 2d24 <exit>
name[1] = '0' + i;
fd = open(name, 0);
if((i == 0 || i >= N/2) && fd < 0){
printf(1, "oops createdelete %s didn't exist\n", name);
exit();
} else if((i >= 1 && i < N/2) && fd >= 0){
1070: 80 7d c4 00 cmpb $0x0,-0x3c(%ebp)
1074: 75 12 jne 1088 <createdelete+0x1e8>
printf(1, "oops createdelete %s did exist\n", name);
exit();
}
if(fd >= 0)
close(fd);
1076: 89 04 24 mov %eax,(%esp)
1079: e8 ce 1c 00 00 call 2d4c <close>
107e: eb 82 jmp 1002 <createdelete+0x162>
name[1] = '0' + i;
fd = open(name, 0);
if((i == 0 || i >= N/2) && fd < 0){
printf(1, "oops createdelete %s didn't exist\n", name);
exit();
} else if((i >= 1 && i < N/2) && fd >= 0){
1080: 84 d2 test %dl,%dl
1082: 0f 84 4d ff ff ff je fd5 <createdelete+0x135>
fd = open(name, 0);
if((i == 0 || i >= N/2) && fd < 0){
printf(1, "oops createdelete %s didn't exist\n", name);
exit();
} else if((i >= 1 && i < N/2) && fd >= 0){
printf(1, "oops createdelete %s did exist\n", name);
1088: 89 74 24 08 mov %esi,0x8(%esp)
108c: c7 44 24 04 cc 3f 00 movl $0x3fcc,0x4(%esp)
1093: 00
1094: c7 04 24 01 00 00 00 movl $0x1,(%esp)
109b: e8 d0 1d 00 00 call 2e70 <printf>
exit();
10a0: e8 7f 1c 00 00 call 2d24 <exit>
name[0] = 'c';
name[1] = '0' + i;
fd = open(name, 0);
if((i == 0 || i >= N/2) && fd < 0){
printf(1, "oops createdelete %s didn't exist\n", name);
10a5: 89 74 24 08 mov %esi,0x8(%esp)
10a9: c7 44 24 04 a8 3f 00 movl $0x3fa8,0x4(%esp)
10b0: 00
10b1: c7 04 24 01 00 00 00 movl $0x1,(%esp)
10b8: e8 b3 1d 00 00 call 2e70 <printf>
exit();
10bd: e8 62 1c 00 00 call 2d24 <exit>
for(i = 0; i < N; i++){
name[0] = 'p';
name[1] = '0' + i;
fd = open(name, 0);
if((i == 0 || i >= N/2) && fd < 0){
printf(1, "oops createdelete %s didn't exist\n", name);
10c2: 89 74 24 08 mov %esi,0x8(%esp)
10c6: c7 44 24 04 a8 3f 00 movl $0x3fa8,0x4(%esp)
10cd: 00
10ce: c7 04 24 01 00 00 00 movl $0x1,(%esp)
10d5: e8 96 1d 00 00 call 2e70 <printf>
exit();
10da: e8 45 1c 00 00 call 2d24 <exit>
char name[32];
printf(1, "createdelete test\n");
pid = fork();
if(pid < 0){
printf(1, "fork failed\n");
10df: c7 44 24 04 98 34 00 movl $0x3498,0x4(%esp)
10e6: 00
10e7: c7 04 24 01 00 00 00 movl $0x1,(%esp)
10ee: e8 7d 1d 00 00 call 2e70 <printf>
exit();
10f3: e8 2c 1c 00 00 call 2d24 <exit>
10f8: 90 nop
10f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00001100 <unlinkread>:
}
// can I unlink a file and still read it?
void
unlinkread(void)
{
1100: 55 push %ebp
1101: 89 e5 mov %esp,%ebp
1103: 56 push %esi
1104: 53 push %ebx
1105: 83 ec 10 sub $0x10,%esp
int fd, fd1;
printf(1, "unlinkread test\n");
1108: c7 44 24 04 8c 35 00 movl $0x358c,0x4(%esp)
110f: 00
1110: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1117: e8 54 1d 00 00 call 2e70 <printf>
fd = open("unlinkread", O_CREATE | O_RDWR);
111c: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
1123: 00
1124: c7 04 24 9d 35 00 00 movl $0x359d,(%esp)
112b: e8 34 1c 00 00 call 2d64 <open>
if(fd < 0){
1130: 85 c0 test %eax,%eax
unlinkread(void)
{
int fd, fd1;
printf(1, "unlinkread test\n");
fd = open("unlinkread", O_CREATE | O_RDWR);
1132: 89 c3 mov %eax,%ebx
if(fd < 0){
1134: 0f 88 fe 00 00 00 js 1238 <unlinkread+0x138>
printf(1, "create unlinkread failed\n");
exit();
}
write(fd, "hello", 5);
113a: c7 44 24 08 05 00 00 movl $0x5,0x8(%esp)
1141: 00
1142: c7 44 24 04 c2 35 00 movl $0x35c2,0x4(%esp)
1149: 00
114a: 89 04 24 mov %eax,(%esp)
114d: e8 f2 1b 00 00 call 2d44 <write>
close(fd);
1152: 89 1c 24 mov %ebx,(%esp)
1155: e8 f2 1b 00 00 call 2d4c <close>
fd = open("unlinkread", O_RDWR);
115a: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp)
1161: 00
1162: c7 04 24 9d 35 00 00 movl $0x359d,(%esp)
1169: e8 f6 1b 00 00 call 2d64 <open>
if(fd < 0){
116e: 85 c0 test %eax,%eax
exit();
}
write(fd, "hello", 5);
close(fd);
fd = open("unlinkread", O_RDWR);
1170: 89 c3 mov %eax,%ebx
if(fd < 0){
1172: 0f 88 3d 01 00 00 js 12b5 <unlinkread+0x1b5>
printf(1, "open unlinkread failed\n");
exit();
}
if(unlink("unlinkread") != 0){
1178: c7 04 24 9d 35 00 00 movl $0x359d,(%esp)
117f: e8 f0 1b 00 00 call 2d74 <unlink>
1184: 85 c0 test %eax,%eax
1186: 0f 85 10 01 00 00 jne 129c <unlinkread+0x19c>
printf(1, "unlink unlinkread failed\n");
exit();
}
fd1 = open("unlinkread", O_CREATE | O_RDWR);
118c: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
1193: 00
1194: c7 04 24 9d 35 00 00 movl $0x359d,(%esp)
119b: e8 c4 1b 00 00 call 2d64 <open>
write(fd1, "yyy", 3);
11a0: c7 44 24 08 03 00 00 movl $0x3,0x8(%esp)
11a7: 00
11a8: c7 44 24 04 fa 35 00 movl $0x35fa,0x4(%esp)
11af: 00
if(unlink("unlinkread") != 0){
printf(1, "unlink unlinkread failed\n");
exit();
}
fd1 = open("unlinkread", O_CREATE | O_RDWR);
11b0: 89 c6 mov %eax,%esi
write(fd1, "yyy", 3);
11b2: 89 04 24 mov %eax,(%esp)
11b5: e8 8a 1b 00 00 call 2d44 <write>
close(fd1);
11ba: 89 34 24 mov %esi,(%esp)
11bd: e8 8a 1b 00 00 call 2d4c <close>
if(read(fd, buf, sizeof(buf)) != 5){
11c2: c7 44 24 08 00 08 00 movl $0x800,0x8(%esp)
11c9: 00
11ca: c7 44 24 04 40 44 00 movl $0x4440,0x4(%esp)
11d1: 00
11d2: 89 1c 24 mov %ebx,(%esp)
11d5: e8 62 1b 00 00 call 2d3c <read>
11da: 83 f8 05 cmp $0x5,%eax
11dd: 0f 85 a0 00 00 00 jne 1283 <unlinkread+0x183>
printf(1, "unlinkread read failed");
exit();
}
if(buf[0] != 'h'){
11e3: 80 3d 40 44 00 00 68 cmpb $0x68,0x4440
11ea: 75 7e jne 126a <unlinkread+0x16a>
printf(1, "unlinkread wrong data\n");
exit();
}
if(write(fd, buf, 10) != 10){
11ec: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
11f3: 00
11f4: c7 44 24 04 40 44 00 movl $0x4440,0x4(%esp)
11fb: 00
11fc: 89 1c 24 mov %ebx,(%esp)
11ff: e8 40 1b 00 00 call 2d44 <write>
1204: 83 f8 0a cmp $0xa,%eax
1207: 75 48 jne 1251 <unlinkread+0x151>
printf(1, "unlinkread write failed\n");
exit();
}
close(fd);
1209: 89 1c 24 mov %ebx,(%esp)
120c: e8 3b 1b 00 00 call 2d4c <close>
unlink("unlinkread");
1211: c7 04 24 9d 35 00 00 movl $0x359d,(%esp)
1218: e8 57 1b 00 00 call 2d74 <unlink>
printf(1, "unlinkread ok\n");
121d: c7 44 24 04 45 36 00 movl $0x3645,0x4(%esp)
1224: 00
1225: c7 04 24 01 00 00 00 movl $0x1,(%esp)
122c: e8 3f 1c 00 00 call 2e70 <printf>
}
1231: 83 c4 10 add $0x10,%esp
1234: 5b pop %ebx
1235: 5e pop %esi
1236: 5d pop %ebp
1237: c3 ret
int fd, fd1;
printf(1, "unlinkread test\n");
fd = open("unlinkread", O_CREATE | O_RDWR);
if(fd < 0){
printf(1, "create unlinkread failed\n");
1238: c7 44 24 04 a8 35 00 movl $0x35a8,0x4(%esp)
123f: 00
1240: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1247: e8 24 1c 00 00 call 2e70 <printf>
exit();
124c: e8 d3 1a 00 00 call 2d24 <exit>
if(buf[0] != 'h'){
printf(1, "unlinkread wrong data\n");
exit();
}
if(write(fd, buf, 10) != 10){
printf(1, "unlinkread write failed\n");
1251: c7 44 24 04 2c 36 00 movl $0x362c,0x4(%esp)
1258: 00
1259: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1260: e8 0b 1c 00 00 call 2e70 <printf>
exit();
1265: e8 ba 1a 00 00 call 2d24 <exit>
if(read(fd, buf, sizeof(buf)) != 5){
printf(1, "unlinkread read failed");
exit();
}
if(buf[0] != 'h'){
printf(1, "unlinkread wrong data\n");
126a: c7 44 24 04 15 36 00 movl $0x3615,0x4(%esp)
1271: 00
1272: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1279: e8 f2 1b 00 00 call 2e70 <printf>
exit();
127e: e8 a1 1a 00 00 call 2d24 <exit>
fd1 = open("unlinkread", O_CREATE | O_RDWR);
write(fd1, "yyy", 3);
close(fd1);
if(read(fd, buf, sizeof(buf)) != 5){
printf(1, "unlinkread read failed");
1283: c7 44 24 04 fe 35 00 movl $0x35fe,0x4(%esp)
128a: 00
128b: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1292: e8 d9 1b 00 00 call 2e70 <printf>
exit();
1297: e8 88 1a 00 00 call 2d24 <exit>
if(fd < 0){
printf(1, "open unlinkread failed\n");
exit();
}
if(unlink("unlinkread") != 0){
printf(1, "unlink unlinkread failed\n");
129c: c7 44 24 04 e0 35 00 movl $0x35e0,0x4(%esp)
12a3: 00
12a4: c7 04 24 01 00 00 00 movl $0x1,(%esp)
12ab: e8 c0 1b 00 00 call 2e70 <printf>
exit();
12b0: e8 6f 1a 00 00 call 2d24 <exit>
write(fd, "hello", 5);
close(fd);
fd = open("unlinkread", O_RDWR);
if(fd < 0){
printf(1, "open unlinkread failed\n");
12b5: c7 44 24 04 c8 35 00 movl $0x35c8,0x4(%esp)
12bc: 00
12bd: c7 04 24 01 00 00 00 movl $0x1,(%esp)
12c4: e8 a7 1b 00 00 call 2e70 <printf>
exit();
12c9: e8 56 1a 00 00 call 2d24 <exit>
12ce: 66 90 xchg %ax,%ax
000012d0 <linktest>:
printf(1, "unlinkread ok\n");
}
void
linktest(void)
{
12d0: 55 push %ebp
12d1: 89 e5 mov %esp,%ebp
12d3: 53 push %ebx
12d4: 83 ec 14 sub $0x14,%esp
int fd;
printf(1, "linktest\n");
12d7: c7 44 24 04 54 36 00 movl $0x3654,0x4(%esp)
12de: 00
12df: c7 04 24 01 00 00 00 movl $0x1,(%esp)
12e6: e8 85 1b 00 00 call 2e70 <printf>
unlink("lf1");
12eb: c7 04 24 5e 36 00 00 movl $0x365e,(%esp)
12f2: e8 7d 1a 00 00 call 2d74 <unlink>
unlink("lf2");
12f7: c7 04 24 62 36 00 00 movl $0x3662,(%esp)
12fe: e8 71 1a 00 00 call 2d74 <unlink>
fd = open("lf1", O_CREATE|O_RDWR);
1303: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
130a: 00
130b: c7 04 24 5e 36 00 00 movl $0x365e,(%esp)
1312: e8 4d 1a 00 00 call 2d64 <open>
if(fd < 0){
1317: 85 c0 test %eax,%eax
printf(1, "linktest\n");
unlink("lf1");
unlink("lf2");
fd = open("lf1", O_CREATE|O_RDWR);
1319: 89 c3 mov %eax,%ebx
if(fd < 0){
131b: 0f 88 26 01 00 00 js 1447 <linktest+0x177>
printf(1, "create lf1 failed\n");
exit();
}
if(write(fd, "hello", 5) != 5){
1321: c7 44 24 08 05 00 00 movl $0x5,0x8(%esp)
1328: 00
1329: c7 44 24 04 c2 35 00 movl $0x35c2,0x4(%esp)
1330: 00
1331: 89 04 24 mov %eax,(%esp)
1334: e8 0b 1a 00 00 call 2d44 <write>
1339: 83 f8 05 cmp $0x5,%eax
133c: 0f 85 cd 01 00 00 jne 150f <linktest+0x23f>
printf(1, "write lf1 failed\n");
exit();
}
close(fd);
1342: 89 1c 24 mov %ebx,(%esp)
1345: e8 02 1a 00 00 call 2d4c <close>
if(link("lf1", "lf2") < 0){
134a: c7 44 24 04 62 36 00 movl $0x3662,0x4(%esp)
1351: 00
1352: c7 04 24 5e 36 00 00 movl $0x365e,(%esp)
1359: e8 26 1a 00 00 call 2d84 <link>
135e: 85 c0 test %eax,%eax
1360: 0f 88 90 01 00 00 js 14f6 <linktest+0x226>
printf(1, "link lf1 lf2 failed\n");
exit();
}
unlink("lf1");
1366: c7 04 24 5e 36 00 00 movl $0x365e,(%esp)
136d: e8 02 1a 00 00 call 2d74 <unlink>
if(open("lf1", 0) >= 0){
1372: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
1379: 00
137a: c7 04 24 5e 36 00 00 movl $0x365e,(%esp)
1381: e8 de 19 00 00 call 2d64 <open>
1386: 85 c0 test %eax,%eax
1388: 0f 89 4f 01 00 00 jns 14dd <linktest+0x20d>
printf(1, "unlinked lf1 but it is still there!\n");
exit();
}
fd = open("lf2", 0);
138e: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
1395: 00
1396: c7 04 24 62 36 00 00 movl $0x3662,(%esp)
139d: e8 c2 19 00 00 call 2d64 <open>
if(fd < 0){
13a2: 85 c0 test %eax,%eax
if(open("lf1", 0) >= 0){
printf(1, "unlinked lf1 but it is still there!\n");
exit();
}
fd = open("lf2", 0);
13a4: 89 c3 mov %eax,%ebx
if(fd < 0){
13a6: 0f 88 18 01 00 00 js 14c4 <linktest+0x1f4>
printf(1, "open lf2 failed\n");
exit();
}
if(read(fd, buf, sizeof(buf)) != 5){
13ac: c7 44 24 08 00 08 00 movl $0x800,0x8(%esp)
13b3: 00
13b4: c7 44 24 04 40 44 00 movl $0x4440,0x4(%esp)
13bb: 00
13bc: 89 04 24 mov %eax,(%esp)
13bf: e8 78 19 00 00 call 2d3c <read>
13c4: 83 f8 05 cmp $0x5,%eax
13c7: 0f 85 de 00 00 00 jne 14ab <linktest+0x1db>
printf(1, "read lf2 failed\n");
exit();
}
close(fd);
13cd: 89 1c 24 mov %ebx,(%esp)
13d0: e8 77 19 00 00 call 2d4c <close>
if(link("lf2", "lf2") >= 0){
13d5: c7 44 24 04 62 36 00 movl $0x3662,0x4(%esp)
13dc: 00
13dd: c7 04 24 62 36 00 00 movl $0x3662,(%esp)
13e4: e8 9b 19 00 00 call 2d84 <link>
13e9: 85 c0 test %eax,%eax
13eb: 0f 89 a1 00 00 00 jns 1492 <linktest+0x1c2>
printf(1, "link lf2 lf2 succeeded! oops\n");
exit();
}
unlink("lf2");
13f1: c7 04 24 62 36 00 00 movl $0x3662,(%esp)
13f8: e8 77 19 00 00 call 2d74 <unlink>
if(link("lf2", "lf1") >= 0){
13fd: c7 44 24 04 5e 36 00 movl $0x365e,0x4(%esp)
1404: 00
1405: c7 04 24 62 36 00 00 movl $0x3662,(%esp)
140c: e8 73 19 00 00 call 2d84 <link>
1411: 85 c0 test %eax,%eax
1413: 79 64 jns 1479 <linktest+0x1a9>
printf(1, "link non-existant succeeded! oops\n");
exit();
}
if(link(".", "lf1") >= 0){
1415: c7 44 24 04 5e 36 00 movl $0x365e,0x4(%esp)
141c: 00
141d: c7 04 24 02 39 00 00 movl $0x3902,(%esp)
1424: e8 5b 19 00 00 call 2d84 <link>
1429: 85 c0 test %eax,%eax
142b: 79 33 jns 1460 <linktest+0x190>
printf(1, "link . lf1 succeeded! oops\n");
exit();
}
printf(1, "linktest ok\n");
142d: c7 44 24 04 fc 36 00 movl $0x36fc,0x4(%esp)
1434: 00
1435: c7 04 24 01 00 00 00 movl $0x1,(%esp)
143c: e8 2f 1a 00 00 call 2e70 <printf>
}
1441: 83 c4 14 add $0x14,%esp
1444: 5b pop %ebx
1445: 5d pop %ebp
1446: c3 ret
unlink("lf1");
unlink("lf2");
fd = open("lf1", O_CREATE|O_RDWR);
if(fd < 0){
printf(1, "create lf1 failed\n");
1447: c7 44 24 04 66 36 00 movl $0x3666,0x4(%esp)
144e: 00
144f: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1456: e8 15 1a 00 00 call 2e70 <printf>
exit();
145b: e8 c4 18 00 00 call 2d24 <exit>
printf(1, "link non-existant succeeded! oops\n");
exit();
}
if(link(".", "lf1") >= 0){
printf(1, "link . lf1 succeeded! oops\n");
1460: c7 44 24 04 e0 36 00 movl $0x36e0,0x4(%esp)
1467: 00
1468: c7 04 24 01 00 00 00 movl $0x1,(%esp)
146f: e8 fc 19 00 00 call 2e70 <printf>
exit();
1474: e8 ab 18 00 00 call 2d24 <exit>
exit();
}
unlink("lf2");
if(link("lf2", "lf1") >= 0){
printf(1, "link non-existant succeeded! oops\n");
1479: c7 44 24 04 14 40 00 movl $0x4014,0x4(%esp)
1480: 00
1481: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1488: e8 e3 19 00 00 call 2e70 <printf>
exit();
148d: e8 92 18 00 00 call 2d24 <exit>
exit();
}
close(fd);
if(link("lf2", "lf2") >= 0){
printf(1, "link lf2 lf2 succeeded! oops\n");
1492: c7 44 24 04 c2 36 00 movl $0x36c2,0x4(%esp)
1499: 00
149a: c7 04 24 01 00 00 00 movl $0x1,(%esp)
14a1: e8 ca 19 00 00 call 2e70 <printf>
exit();
14a6: e8 79 18 00 00 call 2d24 <exit>
if(fd < 0){
printf(1, "open lf2 failed\n");
exit();
}
if(read(fd, buf, sizeof(buf)) != 5){
printf(1, "read lf2 failed\n");
14ab: c7 44 24 04 b1 36 00 movl $0x36b1,0x4(%esp)
14b2: 00
14b3: c7 04 24 01 00 00 00 movl $0x1,(%esp)
14ba: e8 b1 19 00 00 call 2e70 <printf>
exit();
14bf: e8 60 18 00 00 call 2d24 <exit>
exit();
}
fd = open("lf2", 0);
if(fd < 0){
printf(1, "open lf2 failed\n");
14c4: c7 44 24 04 a0 36 00 movl $0x36a0,0x4(%esp)
14cb: 00
14cc: c7 04 24 01 00 00 00 movl $0x1,(%esp)
14d3: e8 98 19 00 00 call 2e70 <printf>
exit();
14d8: e8 47 18 00 00 call 2d24 <exit>
exit();
}
unlink("lf1");
if(open("lf1", 0) >= 0){
printf(1, "unlinked lf1 but it is still there!\n");
14dd: c7 44 24 04 ec 3f 00 movl $0x3fec,0x4(%esp)
14e4: 00
14e5: c7 04 24 01 00 00 00 movl $0x1,(%esp)
14ec: e8 7f 19 00 00 call 2e70 <printf>
exit();
14f1: e8 2e 18 00 00 call 2d24 <exit>
exit();
}
close(fd);
if(link("lf1", "lf2") < 0){
printf(1, "link lf1 lf2 failed\n");
14f6: c7 44 24 04 8b 36 00 movl $0x368b,0x4(%esp)
14fd: 00
14fe: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1505: e8 66 19 00 00 call 2e70 <printf>
exit();
150a: e8 15 18 00 00 call 2d24 <exit>
if(fd < 0){
printf(1, "create lf1 failed\n");
exit();
}
if(write(fd, "hello", 5) != 5){
printf(1, "write lf1 failed\n");
150f: c7 44 24 04 79 36 00 movl $0x3679,0x4(%esp)
1516: 00
1517: c7 04 24 01 00 00 00 movl $0x1,(%esp)
151e: e8 4d 19 00 00 call 2e70 <printf>
exit();
1523: e8 fc 17 00 00 call 2d24 <exit>
1528: 90 nop
1529: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00001530 <concreate>:
}
// test concurrent create and unlink of the same file
void
concreate(void)
{
1530: 55 push %ebp
1531: 89 e5 mov %esp,%ebp
1533: 57 push %edi
1534: 56 push %esi
1535: 53 push %ebx
} de;
printf(1, "concreate test\n");
file[0] = 'C';
file[2] = '\0';
for(i = 0; i < 40; i++){
1536: 31 db xor %ebx,%ebx
}
// test concurrent create and unlink of the same file
void
concreate(void)
{
1538: 83 ec 6c sub $0x6c,%esp
struct {
ushort inum;
char name[14];
} de;
printf(1, "concreate test\n");
153b: c7 44 24 04 09 37 00 movl $0x3709,0x4(%esp)
1542: 00
1543: 8d 7d e5 lea -0x1b(%ebp),%edi
1546: c7 04 24 01 00 00 00 movl $0x1,(%esp)
154d: e8 1e 19 00 00 call 2e70 <printf>
file[0] = 'C';
1552: c6 45 e5 43 movb $0x43,-0x1b(%ebp)
file[2] = '\0';
1556: c6 45 e7 00 movb $0x0,-0x19(%ebp)
155a: eb 4f jmp 15ab <concreate+0x7b>
155c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
for(i = 0; i < 40; i++){
file[1] = '0' + i;
unlink(file);
pid = fork();
if(pid && (i % 3) == 1){
1560: b8 56 55 55 55 mov $0x55555556,%eax
1565: f7 eb imul %ebx
1567: 89 d8 mov %ebx,%eax
1569: c1 f8 1f sar $0x1f,%eax
156c: 29 c2 sub %eax,%edx
156e: 8d 04 52 lea (%edx,%edx,2),%eax
1571: 89 da mov %ebx,%edx
1573: 29 c2 sub %eax,%edx
1575: 83 fa 01 cmp $0x1,%edx
1578: 74 7e je 15f8 <concreate+0xc8>
link("C0", file);
} else if(pid == 0 && (i % 5) == 1){
link("C0", file);
} else {
fd = open(file, O_CREATE | O_RDWR);
157a: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
1581: 00
1582: 89 3c 24 mov %edi,(%esp)
1585: e8 da 17 00 00 call 2d64 <open>
if(fd < 0){
158a: 85 c0 test %eax,%eax
158c: 0f 88 db 01 00 00 js 176d <concreate+0x23d>
printf(1, "concreate create %s failed\n", file);
exit();
}
close(fd);
1592: 89 04 24 mov %eax,(%esp)
1595: e8 b2 17 00 00 call 2d4c <close>
}
if(pid == 0)
159a: 85 f6 test %esi,%esi
159c: 74 52 je 15f0 <concreate+0xc0>
} de;
printf(1, "concreate test\n");
file[0] = 'C';
file[2] = '\0';
for(i = 0; i < 40; i++){
159e: 83 c3 01 add $0x1,%ebx
close(fd);
}
if(pid == 0)
exit();
else
wait();
15a1: e8 86 17 00 00 call 2d2c <wait>
} de;
printf(1, "concreate test\n");
file[0] = 'C';
file[2] = '\0';
for(i = 0; i < 40; i++){
15a6: 83 fb 28 cmp $0x28,%ebx
15a9: 74 6d je 1618 <concreate+0xe8>
printf(1, "linktest ok\n");
}
// test concurrent create and unlink of the same file
void
concreate(void)
15ab: 8d 43 30 lea 0x30(%ebx),%eax
15ae: 88 45 e6 mov %al,-0x1a(%ebp)
printf(1, "concreate test\n");
file[0] = 'C';
file[2] = '\0';
for(i = 0; i < 40; i++){
file[1] = '0' + i;
unlink(file);
15b1: 89 3c 24 mov %edi,(%esp)
15b4: e8 bb 17 00 00 call 2d74 <unlink>
pid = fork();
15b9: e8 5e 17 00 00 call 2d1c <fork>
if(pid && (i % 3) == 1){
15be: 85 c0 test %eax,%eax
file[0] = 'C';
file[2] = '\0';
for(i = 0; i < 40; i++){
file[1] = '0' + i;
unlink(file);
pid = fork();
15c0: 89 c6 mov %eax,%esi
if(pid && (i % 3) == 1){
15c2: 75 9c jne 1560 <concreate+0x30>
link("C0", file);
} else if(pid == 0 && (i % 5) == 1){
15c4: b8 67 66 66 66 mov $0x66666667,%eax
15c9: f7 eb imul %ebx
15cb: 89 d8 mov %ebx,%eax
15cd: c1 f8 1f sar $0x1f,%eax
15d0: d1 fa sar %edx
15d2: 29 c2 sub %eax,%edx
15d4: 8d 04 92 lea (%edx,%edx,4),%eax
15d7: 89 da mov %ebx,%edx
15d9: 29 c2 sub %eax,%edx
15db: 83 fa 01 cmp $0x1,%edx
15de: 75 9a jne 157a <concreate+0x4a>
link("C0", file);
15e0: 89 7c 24 04 mov %edi,0x4(%esp)
15e4: c7 04 24 19 37 00 00 movl $0x3719,(%esp)
15eb: e8 94 17 00 00 call 2d84 <link>
continue;
if(de.name[0] == 'C' && de.name[2] == '\0'){
i = de.name[1] - '0';
if(i < 0 || i >= sizeof(fa)){
printf(1, "concreate weird file %s\n", de.name);
exit();
15f0: e8 2f 17 00 00 call 2d24 <exit>
15f5: 8d 76 00 lea 0x0(%esi),%esi
} de;
printf(1, "concreate test\n");
file[0] = 'C';
file[2] = '\0';
for(i = 0; i < 40; i++){
15f8: 83 c3 01 add $0x1,%ebx
file[1] = '0' + i;
unlink(file);
pid = fork();
if(pid && (i % 3) == 1){
link("C0", file);
15fb: 89 7c 24 04 mov %edi,0x4(%esp)
15ff: c7 04 24 19 37 00 00 movl $0x3719,(%esp)
1606: e8 79 17 00 00 call 2d84 <link>
close(fd);
}
if(pid == 0)
exit();
else
wait();
160b: e8 1c 17 00 00 call 2d2c <wait>
} de;
printf(1, "concreate test\n");
file[0] = 'C';
file[2] = '\0';
for(i = 0; i < 40; i++){
1610: 83 fb 28 cmp $0x28,%ebx
1613: 75 96 jne 15ab <concreate+0x7b>
1615: 8d 76 00 lea 0x0(%esi),%esi
exit();
else
wait();
}
memset(fa, 0, sizeof(fa));
1618: 8d 45 ac lea -0x54(%ebp),%eax
161b: c7 44 24 08 28 00 00 movl $0x28,0x8(%esp)
1622: 00
1623: 8d 75 d4 lea -0x2c(%ebp),%esi
1626: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
162d: 00
162e: 89 04 24 mov %eax,(%esp)
1631: e8 4a 15 00 00 call 2b80 <memset>
fd = open(".", 0);
1636: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
163d: 00
163e: c7 04 24 02 39 00 00 movl $0x3902,(%esp)
1645: e8 1a 17 00 00 call 2d64 <open>
n = 0;
164a: c7 45 a4 00 00 00 00 movl $0x0,-0x5c(%ebp)
else
wait();
}
memset(fa, 0, sizeof(fa));
fd = open(".", 0);
1651: 89 c3 mov %eax,%ebx
1653: 90 nop
1654: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
n = 0;
while(read(fd, &de, sizeof(de)) > 0){
1658: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
165f: 00
1660: 89 74 24 04 mov %esi,0x4(%esp)
1664: 89 1c 24 mov %ebx,(%esp)
1667: e8 d0 16 00 00 call 2d3c <read>
166c: 85 c0 test %eax,%eax
166e: 7e 40 jle 16b0 <concreate+0x180>
if(de.inum == 0)
1670: 66 83 7d d4 00 cmpw $0x0,-0x2c(%ebp)
1675: 74 e1 je 1658 <concreate+0x128>
continue;
if(de.name[0] == 'C' && de.name[2] == '\0'){
1677: 80 7d d6 43 cmpb $0x43,-0x2a(%ebp)
167b: 75 db jne 1658 <concreate+0x128>
167d: 80 7d d8 00 cmpb $0x0,-0x28(%ebp)
1681: 75 d5 jne 1658 <concreate+0x128>
i = de.name[1] - '0';
1683: 0f be 45 d7 movsbl -0x29(%ebp),%eax
1687: 83 e8 30 sub $0x30,%eax
if(i < 0 || i >= sizeof(fa)){
168a: 83 f8 27 cmp $0x27,%eax
168d: 0f 87 f7 00 00 00 ja 178a <concreate+0x25a>
printf(1, "concreate weird file %s\n", de.name);
exit();
}
if(fa[i]){
1693: 80 7c 05 ac 00 cmpb $0x0,-0x54(%ebp,%eax,1)
1698: 0f 85 25 01 00 00 jne 17c3 <concreate+0x293>
printf(1, "concreate duplicate file %s\n", de.name);
exit();
}
fa[i] = 1;
169e: c6 44 05 ac 01 movb $0x1,-0x54(%ebp,%eax,1)
n++;
16a3: 83 45 a4 01 addl $0x1,-0x5c(%ebp)
16a7: eb af jmp 1658 <concreate+0x128>
16a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
}
}
close(fd);
16b0: 89 1c 24 mov %ebx,(%esp)
16b3: e8 94 16 00 00 call 2d4c <close>