lio_listio Problem
Kevin Beard
beardk@gatwick.Geco-Prakla.slb.com
Wed Jul 26 00:55:00 GMT 2000
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;
>}
More information about the Libc-alpha
mailing list