public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* current status of Async I/O (io_submit & friends) on pipes
@ 2007-11-07 15:34 Hillier, Gernot
  0 siblings, 0 replies; only message in thread
From: Hillier, Gernot @ 2007-11-07 15:34 UTC (permalink / raw)
  To: linux-kernel

Hi!

Is the content of http://lse.sourceforge.net/io/aio.html still correct
regarding support of pipes? Is there any up-to-date & authoritative
interface description of io_submit & friends available?

This page tells me I'd receive EINVAL or the like when using async I/O
on a pipe; however what I actually see on e.g. 2.6.23.1 is no error
return, but an indefinite blocking in the io_submit syscall when the
pipe is empty.

Is this expected behaviour?

Please put me on CC for any answer.

Here's a short snippet showing the behaviour. (link it against libaio -
yes, I checked that libaio does nothing else than wrapping the syscalls).

------ SNIP -----

#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <libaio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

int main() {
        int filedes[2];
        char buf;
        io_context_t *ctx;
        struct iocb * cb;

        ctx=(io_context_t *)malloc(sizeof(io_context_t));
        memset(ctx,0,sizeof(io_context_t));
        cb=(struct iocb *)malloc(1*sizeof(struct iocb));
        memset(cb,0,1*sizeof(struct iocb));

        pipe(filedes);

        cb[0].aio_lio_opcode=IO_CMD_PREAD;
        cb[0].aio_fildes=filedes[0];
        cb[0].u.c.buf=&buf;
        cb[0].u.c.nbytes=1;

        printf("before read\n");
	/* program will block here */
        printf("io_submit %i\n",io_submit(*ctx,1,&cb));
        printf("read completed\n");
}

-- 
Gernot Hillier

Siemens AG, CT SE 2
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-11-07 16:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-07 15:34 current status of Async I/O (io_submit & friends) on pipes Hillier, Gernot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox