All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Hillier, Gernot" <gernot.hillier@siemens.com>
To: linux-kernel@vger.kernel.org
Subject: current status of Async I/O (io_submit & friends) on pipes
Date: Wed, 07 Nov 2007 16:34:22 +0100	[thread overview]
Message-ID: <4731DAFE.3080509@siemens.com> (raw)

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


                 reply	other threads:[~2007-11-07 16:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=4731DAFE.3080509@siemens.com \
    --to=gernot.hillier@siemens.com \
    --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 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.