#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <fcntl.h>
#include <aio.h>

#define BSIZE 10

main(int argc, char *argv[])
{
	ssize_t size;
	off_t   offset1 = 0, offset2 = 400000;
	char buf[BSIZE];
	int fd, i;

	if ((fd = open(argv[1], O_RDONLY))==1) {
		perror ("open");
		exit(-1);
	}
	
	for (i=0; i<300; i++){
	  offset1 += 1000;
	  offset2 -= 1000;
	  size = pread(fd, buf, BSIZE, offset1);
	  if (size != BSIZE){
	    perror ("read error");
	    close(fd);
	    exit(-1);
	  }
	  size = pread(fd, buf, BSIZE, offset2);
	  if (size != BSIZE){
	    perror ("read error");
	    close(fd);
	    exit(-1);
	  }
	}

	close(fd);
	exit(0);
}
