#include #include #include #include #include #include #include int main() { int fd = open("win2k.iso", O_RDONLY); if (fd == -1) { printf("Failed to open file: %s\n", strerror(errno)); return 0; } for (int i = 0; i < 100000000; ++i) { #if 1 int pos = lseek(fd, 0, SEEK_CUR); if (pos == -1) { printf("Failed to seek (pos): %s\n", strerror(errno)); return 0; } int length = lseek(fd, 0, SEEK_END); if (length == -1) { printf("Failed to seek (length): %s\n", strerror(errno)); return 0; } if (lseek(fd, pos, SEEK_SET) == -1) { printf("Failed to seek (return): %s\n", strerror(errno)); return 0; } #else struct stat buf; if (fstat(fd, &buf) == -1) { printf("Failed to stat: %s\n", strerror(errno)); return 0; } #endif } };