All of lore.kernel.org
 help / color / mirror / Atom feed
* AIO!!
@ 2005-10-10 13:39 Karthik Sarangan
  2005-10-10 16:08 ` AIO!! Benjamin LaHaise
  0 siblings, 1 reply; 4+ messages in thread
From: Karthik Sarangan @ 2005-10-10 13:39 UTC (permalink / raw)
  To: Linux Kernel Mailing List

I wrote a small program to do Async IO from a raw disk
open has no problems.
My program gets stuck up at aio_read(paio);
!!WHY!!

-----------------------------------------------
#define _GNU_SOURCE
#include <aio.h>
#include <unistd.h>
#include <fcntl.h>

#define AIOLEN (256 * 1024)

int main(void)
{
   /* Allocate resources /
   struct aiocb *paio = (struct aiocb *) malloc(sizeof(struct aiocb));
   paio->aio_buf = malloc(AIOLEN);
   paio->aio_fildes = open("/dev/raw/raw1", O_DIRECT | O_RDWR);

   paio->aio_nbytes = AIOLEN;
   paio->aio_reqprio = 0; paio->aio_sigevent.sigev_notify = SIGEV_NONE;

   aio_read(paio);

   /* My program gets stuck here in this loop.  !!WHY!!  */
   while(aio_error(paio))
   {
     sched_yield();
   }

   aio_return(paio);

   /* Return all resources to Linux */
   close(paio->aio_fildes);
   free(paio->aio_buf);
   free(paio);

   return 0;
}
-----------------------------------------------

I also have tried inserting an 'aio_fsync' between 'aio_read' and the 
'while' loop ... to no avail.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-10-11  9:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-10 13:39 AIO!! Karthik Sarangan
2005-10-10 16:08 ` AIO!! Benjamin LaHaise
2005-10-11  5:04   ` AIO!! Karthik Sarangan
2005-10-11  9:25     ` AIO!! Denis Vlasenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.