lkml.org 
[lkml]   [2009]   [Jun]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: include/linux/aio_abi.h and IOCB_CMD_POLL
Date
Davide Libenzi <davidel@xmailserver.org> writes:

> On Thu, 4 Jun 2009, Goswin von Brederlow wrote:
>
>> Miklos Szeredi <miklos@szeredi.hu> writes:
>>
>> > On Thu, 04 Jun 2009, Goswin von Brederlow wrote:
>> >> 3) Are there any alternatives to libaio that don't use threads and
>> >> support polling?
>> >
>> > There are the poll, select and epoll interfaces that block, but are
>> > able to multiplex events from many file descriptors.
>>
>> Unfortunately libaio does not use an fd to pass events between user
>> and kernel space so one can't use poll, select or epoll to wait for
>> /dev/fuse or libaio to have some work pending. And none of them
>> replace libaio functionality in respect to read/write.
>
> You can use the eventfd bridge between epoll/poll/select and AIO, that is
> available by quite some time.
> This is an old example I made when the patch was posted:
>
> http://www.xmailserver.org/eventfd-aio-test.c
>
> This uses direct syscall interface, but you get the idea on how to do that
> with libaio (that I never used).

Thanks. That example explains it nicely. There really should be
comments in libaio.h and an /usr/share/doc/libaio/examples/.

In case you wonder the libaio just wraps the system calls and provides
helpers in libaio.h. Basically the first 200 lines of the example are
libaio.h. Not 1:1 but nearly. The only difference is that io_prep_* do
not take an eventfd argument but there is

static inline void io_set_eventfd(struct iocb *iocb, int eventfd)

instead.


Now I have 2 ways of doing this. Always with the choices. :)

MfG
Goswin


\
 
 \ /
  Last update: 2009-06-05 00:57    [W:0.033 / U:0.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site