This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: lio_listio Problem
- To: "Ulrich Drepper" <drepper at cygnus dot com>, "Andreas Jaeger" <aj at suse dot de>
- Subject: Re: lio_listio Problem
- From: "Kevin Beard" <beardk at gatwick dot Geco-Prakla dot slb dot com>
- Date: Wed, 26 Jul 2000 08:55:03 +0100
- Cc: "libc-alpha Mailinglist" <libc-alpha at sourceware dot cygnus dot com>
Thanks for looking at this guys, but now I'm a little bit confused.
Ulrich, what do you mean when you say you've fixed it in the CVS archive.
Do I need to download a new version of a library from Redhat's server? I'm
a bit new to all this so please forgive my lack of knowledge :-)
-----Original Message-----
From: Ulrich Drepper <drepper@redhat.com>
To: Andreas Jaeger <aj@suse.de>
Cc: libc-alpha Mailinglist <libc-alpha@sourceware.cygnus.com>; Kevin Beard
<beardk@gatwick.Geco-Prakla.slb.com>
Date: Wednesday, July 26, 2000 6:56 AM
Subject: Re: lio_listio Problem
>Andreas Jaeger <aj@suse.de> writes:
>
>> Kevin send me the appended test program (which I slightly modified).
>
>The test program still contained a few bugs. I append below the
>corrected version. But I was able to reproduce the problem and fixed
>it in the CVS archive. Give it a try.
>
>--
>---------------. ,-. 1325 Chesapeake Terrace
>Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA
>Red Hat `--' drepper at redhat.com `------------------------
>
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>#include <unistd.h>
>#include <fcntl.h>
>#include <sys/types.h>
>#include <sys/stat.h>
>#include <signal.h>
>#include <stdio.h>
>#include <errno.h>
>#include <sys/utsname.h>
>#include <stdlib.h>
>#include <string.h>
>
>#include <aio.h>
>
>
>#define FILENAME "async.log"
>#define ACCESS_MODE "O_RDWR | O_CREAT"
>#define NUM_OF_AIOCBS 2
>
>#define SIG_LISTIO_DONE (SIGRTMAX-9)
>
>
>/*aiocb_t async0, async1;*/
>struct aiocb *async_ctrl_blk[NUM_OF_AIOCBS];
>char *out_data[NUM_OF_AIOCBS];
>int counter;
>int buf_switch = 0;
>
>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] = (struct aiocb*)malloc(sizeof(struct
aiocb));
> 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);
>
> return 0;
>}