Index: examples/io/filereader.c
===================================================================
--- examples/io/filereader.c	(revision 7458feadb44de27beceff6de3b9e9b0c2e2be6b1)
+++ examples/io/filereader.c	(revision 5b15c4f539c20ce0c574c879bdfcfb6389619780)
@@ -1,2 +1,10 @@
+/*
+This is a file reading example that users io_uring in non-blocking mode.
+It demonstrates the bare minimum needed to use io_uring.
+It also optionally pre-registers the file descriptors (and a pipe, just to show it works).
+It uses liburing for simplicity.
+*/
+
+
 #include <errno.h>
 #include <fcntl.h>
@@ -9,14 +17,13 @@
 
 int main(int argc, char * argv[]) {
-	if ( argc != 3 ) {
-		printf( "usage\n" );
-		exit( EXIT_FAILURE );
-	}
-
-	if(argc != 3) {
-            printf("usage:   %s FILE TIMES - read FILE from disk TIMES times\n", argv[0]);
+	if(argc != 3 && argc != 4) {
+            printf("usage:   %s FILE TIMES [fixed] - read FILE from disk TIMES times\n", argv[0]);
             return EXIT_FAILURE;
       }
 
+	bool fixed = false;
+	if(argc == 4) {
+		fixed = 0 == strcmp(argv[3], "fixed");
+	}
 
       int times = atoi( argv[2] );
@@ -32,4 +39,6 @@
       }
 
+	int rfd = fd;
+
 	/* prep the array */
       char data[100];
@@ -40,4 +49,24 @@
       io_uring_queue_init(256, &ring, 0);
 
+	int pipefds[2];
+	if(fixed) {
+		int ret = pipe(pipefds);
+		if( ret < 0 ) {
+			printf("Pipe Error : %s\n", strerror( errno ));
+			return EXIT_FAILURE;
+		}
+		rfd = 0;
+		int fds[] = {
+			fd, pipefds[0], pipefds[1]
+		};
+		int cnt = sizeof(fds) / sizeof(fds[0]);
+		printf("Registering %d files as fixed\n", cnt);
+		ret = io_uring_register_files(&ring, fds, cnt);
+		if( ret < 0 ) {
+			printf("Register Error : %s\n", strerror( -ret ));
+			return EXIT_FAILURE;
+		}
+	}
+
       /* declare required structs */
 	printf("Reading %s(%d) %d times\n", argv[1], fd, times);
@@ -46,5 +75,8 @@
 		/* get an sqe and fill in a READV operation */
 	      struct io_uring_sqe * sqe = io_uring_get_sqe(&ring);
-		io_uring_prep_readv(sqe, fd, &iov, 1, 0);
+		io_uring_prep_readv(sqe, rfd, &iov, 1, 0);
+		if(fixed) {
+			sqe->flags = IOSQE_FIXED_FILE;
+		}
 
 		/* tell the kernel we have an sqe ready for consumption */
@@ -83,3 +115,8 @@
 
       close(fd);
+
+	if(fixed) {
+		close(pipefds[0]);
+		close(pipefds[1]);
+	}
 }
