This source file includes following definitions.
- main
1
2
3
4
5
6
7
8
9
10 #include "types.h"
11 #include "stat.h"
12 #include "user.h"
13 #include "fs.h"
14 #include "fcntl.h"
15
16 int
17 main(int argc, char *argv[])
18 {
19 int fd, i;
20 char path[] = "stressfs0";
21 char data[512];
22
23 printf(1, "stressfs starting\n");
24 memset(data, 'a', sizeof(data));
25
26 for(i = 0; i < 4; i++)
27 if(fork() > 0)
28 break;
29
30 printf(1, "write %d\n", i);
31
32 path[8] += i;
33 fd = open(path, O_CREATE | O_RDWR);
34 for(i = 0; i < 20; i++)
35
36 write(fd, data, sizeof(data));
37 close(fd);
38
39 printf(1, "read\n");
40
41 fd = open(path, O_RDONLY);
42 for (i = 0; i < 20; i++)
43 read(fd, data, sizeof(data));
44 close(fd);
45
46 wait();
47
48 exit();
49 }