From: Garrett C. <yan...@gm...> - 2011-03-15 12:15:41
|
On Tue, Mar 15, 2011 at 1:03 AM, Bian Naimeng <bi...@cn...> wrote: > There are 2 changes in this patch. > > 1. Initialize the aiocb struct before using it > 2. submit the aiocb with invalid aio_reqprio > > The aio_buf points to NULL is undefined, please refer to POSIX spec. > > NAME > aio_read - asynchronous read from a file > SYNOPSIS > #include <aio.h> > > int aio_read(struct aiocb *aiocbp); > DESCRIPTION > The aiocbp argument points to an aiocb structure. If the buffer > pointed to by aiocbp->aio_buf or the control block pointed to by aiocbp becomes > an illegal address prior to asynchronous I/O completion, then the behavior > is undefined. While I agree with what you're proposing overall, this doesn't work because... IEEE Std 1003.1-2001/Cor 2-2004, item XSH/TC2/D6/15 is applied, updating the [EINVAL] error, so that detection of an [EINVAL] error for an invalid value of aiocbp->aio_reqprio is only required if the Prioritized Input and Output option is supported. Try aio_offset, etc or some other error condition instead. Thanks, -Garrett |