Async IO in Linux...

Async IO in Linux...

Post by Kevin Bear » Wed, 26 Jul 2000 04:00:00



Just wondering if anyone knows why this code SIGSEGV's under Linux
It compiles under both Solaris2.6 and Linux (Redhat 6.2 kernel? 2.2.14-5)
but only gets errors on Linux.
 I understand that Linux complies with POSIX4 (POSIX1b):
main()
{
?? for(counter=0; counter<NUM_OF_AIOCBS; counter++)
?? {
????? out_data[counter] = (char*)malloc(sizeof(char)+2);
????? sprintf(out_data[counter], "%1.1d\n", counter);
????? printf("%s", out_data[counter]);
?? }
?? for(counter=0; counter<NUM_OF_AIOCBS; counter++)
?? {
????? async_ctrl_blk[counter] = (aiocb*)malloc(sizeof(aiocb_t));
????? async_ctrl_blk[counter]->aio_fildes = open(FILENAME,O_RDWR | O_APPEND
| O_CREAT, 0666);
????? async_ctrl_blk[counter]->aio_offset = 0;
????? async_ctrl_blk[counter]->aio_lio_opcode = LIO_WRITE;
????? async_ctrl_blk[counter]->aio_buf = out_data[counter];
????? async_ctrl_blk[counter]->aio_nbytes = sizeof(char)+2;
?? }
?? if (lio_listio(LIO_NOWAIT, async_ctrl_blk, NUM_OF_AIOCBS, NULL) < 0 )
????? perror("lio_listio");
?? aio_suspend(async_ctrl_blk,NUM_OF_AIOCBS,NULL);
Quote:}

 
 
 

Async IO in Linux...

Post by Andreas Jaege » Wed, 26 Jul 2000 04:00:00


Quote:>>>>> Kevin Beard writes:

 > Just wondering if anyone knows why this code SIGSEGV's under Linux
 > It compiles under both Solaris2.6 and Linux (Redhat 6.2 kernel? 2.2.14-5)
 > but only gets errors on Linux.

Could you please send a complete program?  Which glibc version are you
running (run /lib/libc.so.6 to get it)?  The AIO in glibc 2.1.1 is
broken.

Andreas
--
 Andreas Jaeger



 
 
 

Async IO in Linux...

Post by Andreas Jaege » Wed, 26 Jul 2000 04:00:00


Quote:>>>>> Kevin Beard writes:

 > The glibc version is 2.1.3.? Here's there complete program as an attachment.
 > Ignore the AIX stuff in it.

I've forwarded the program with a comment to the other glibc
developers and CC'ed you.  This looks like a bug in glibc, the sig
argument is NULL in your case and therefore glibc segfaults.  As a
quick hack, add a proper sig argument to lio_listio.

Andreas
--
 Andreas Jaeger


 
 
 

Async IO in Linux...

Post by lei_m.. » Sat, 29 Jul 2000 04:00:00


Although I use KAIO(SGI implementation of posix AIO on linux), I got the
same SIGSEGV(11) from using lio_listio with NULL segevent pointer.
However, even after I used following two lines to give a real segvent
pointer, the program still got SIGSEGV.

    aiocb_t *myaiocb[max_num_aios];
    for (k = 0; k < max_num_aios; k++)
    {
        myaiocb[k] = (aiocb_t* const)malloc(sizeof(aiocb_t));
        ...
    }
    struct sigevent dummy;
    dummy.sigev_notify=SIGEV_NONE;
    if (lio_listio(LIO_WAIT, myaiocb, max_num_aios, &dummy) < 0)

any suggestion?
Ming Lei



> >>>>> Kevin Beard writes:

>  > The glibc version is 2.1.3.  Here's there complete program as an
attachment.
>  > Ignore the AIX stuff in it.

> I've forwarded the program with a comment to the other glibc
> developers and CC'ed you.  This looks like a bug in glibc, the sig
> argument is NULL in your case and therefore glibc segfaults.  As a
> quick hack, add a proper sig argument to lio_listio.

> Andreas
> --
>  Andreas Jaeger



Sent via Deja.com http://www.deja.com/
Before you buy.
 
 
 

1. Async IO calls - Linux implementations?

I am attempting to port an application that uses asynchronous disk I/O
calls. It is currently implemented on Solaris and other platforms where
aioread/aiowrite/aiocancel/aiowait (solaris) and lio_listio() functions
are implmented.

Are there any implementations of async I/O for Linux 2.x?

Thanks!

Robert

2. ISDN modem & line

3. Linux and async IO?

4. fat32 and linux

5. Async IO in Linux...

6. BUG: x86 blows the partition tables away.

7. Async IO in Linux and SGI's KAIO

8. [alpha] pci.h patch

9. Async IO in Linux?

10. More Oracle Async IO

11. async-io API registration for 2.5.29

12. Tuning Async IO