I was hoping you could help me get started w/ KAIO. I wrote a small test
program and got errno 38 "Function not implemented" calling aio_read.
Environment:
Fresh mandrake installation.
I applied the 2.2.13 patch against my 2.2.14-15 kernel (mandrake
distribution), selected asynch I/O in confg, rebuilt kernel and
rebooted (I've build custom kernels before).
Build the library
Program:
#include <linux/aio.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <fcntl.h>
int main(int argc, char *argv[])
{
aiocb_t cb;
struct stat st;
int rc;
int fd;
char *b;
memset( &cb, 0, sizeof(cb) );
stat("/tmp/bigfile", &st);
b = (char *)malloc(st.st_size+1);
b[st.st_size] = 0;
fd = open("/tmp/bigfile",O_RDWR );
cb.aio_fildes = fd;
cb.aio_nbytes = st.st_size;
cb.aio_buf = b;
rc = aio_read(&cb);
printf("read rc = %i errno = %i\n",rc,errno);
if (rc==-1) {
perror("aio_read failed");
return 1;
}
while(1) {
rc = aio_error(&cb);
printf("error rc = %i\n",rc);
if (rc == EINPROGRESS) {
sleep(1);
} else {
break;
}
}
puts(b);
close(fd);
return 0;
}
Build Command
cc test1.c -ldba
The output is:
read rc = -1 errno = 38
aio_read failed: Function not implemented
Thanx,
Neal Katz
|