#include #include #include struct aiocb buf; int done = 0; main() { void handler(); char b[100]; int rv; system("stty -echo -icanon "); // system("stty -echo -icanon -isig"); buf.aio_fildes = 0; buf.aio_offset = 0; buf.aio_buf = b; buf.aio_nbytes = 100; // buf.aio_regprio = 0; /* ignored */ // buf.aio_opcode = 0; /* ignored */ buf.aio_sigevent.sigev_signo = SIGIO; buf.aio_sigevent.sigev_notify = SIGEV_SIGNAL; signal(SIGIO, handler); rv = aio_read( &buf) ; if ( rv == -1 ){ perror("aio_read"); exit(1); } while( !done ){ sleep(1); printf("hello\n"); } system("stty echo icanon isig"); } void handler() { int rv; int i; char *cp = (char *) buf.aio_buf; printf("Got SIGIO\n"); rv = aio_error(&buf); printf(" error said: %d\n", rv); rv = aio_return(&buf); printf(" return said: %d\n", rv); for(i=0;i