6 int main(int argc, char **argv)
15 fprintf(stdout, "usage: %s file\n", argv[0]);
19 fd = open(fname, O_RDWR | O_CREAT, 0666);
21 fprintf(stderr, "open %s failed:%d\n", fname, errno);
25 off = 1021 * 1024 * 1024;
26 if (ftruncate(fd, off) < 0) {
27 fprintf(stderr, "ftruncate %ld failed:%d\n", off, errno);
33 off = lseek(fd, off, SEEK_SET);
34 if (off == (off_t)-1) {
35 fprintf(stderr, "lseek %ld failed:%d\n", off, errno);
40 rc = read(fd, buf, 4);
42 fprintf(stderr, "read 4 bytes failed:%d\n", errno);
45 fprintf(stderr, "read returns %d, not 4 bytes\n", rc);