|
|
1.1 root 1: /*
2: * Sequential I/O benchmark.
3: */
4:
5: #include <sys/types.h>
6: #include <sys/file.h>
7: #include <sys/stat.h>
8:
9: char *malloc();
10:
11: main(argc, argv)
12: char *argv[];
13: {
14: register int i, max;
15: char *buf;
16: struct stat sb;
17: int fd;
18:
19: if (argc < 2) {
20: printf("usage: %s file\n", argv[0]);
21: exit(1);
22: }
23: fd = open(argv[1], O_RDONLY);
24: if (fd < 0) {
25: perror(argv[1]);
26: exit(1);
27: }
28: fstat(fd, &sb);
29: buf = malloc(sb.st_blksize);
30: while (read(fd, buf, sb.st_blksize) == sb.st_blksize)
31: ;
32: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.