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

#define BSIZE 1024

main(int argc, char *argv[])
{
	aio_result_t res;
	char buf[BSIZE];
	int fd;

	if ((fd = open(argv[1], O_RDONLY))==1) {
		perror ("open");
		exit(-1);
		}
		aioread(fd, buf, BSIZE, 0L, SEEK_SET, &res);
	//	printf("\n second aioread\n");
	//	aioread(fd, buf, BSIZE, 0L, SEEK_SET, &res);
		aiowait(0);
		if (res.aio_return == BSIZE) {
		printf("aio succeeded \n");
		close(fd);
		exit(0);
		}
		perror ("aio");
}
