From: Karthik Sarangan <karthiks@cdac.in>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: AIO!!
Date: Mon, 10 Oct 2005 19:09:08 +0530 [thread overview]
Message-ID: <434A6EFC.4010100@cdac.in> (raw)
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.
next reply other threads:[~2005-10-10 13:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-10 13:39 Karthik Sarangan [this message]
2005-10-10 16:08 ` AIO!! Benjamin LaHaise
2005-10-11 5:04 ` AIO!! Karthik Sarangan
2005-10-11 9:25 ` AIO!! Denis Vlasenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=434A6EFC.4010100@cdac.in \
--to=karthiks@cdac.in \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox