PATCH: aio_read() POSIX compliance

Roland McGrath roland@frob.com
Thu Jun 13 16:06:00 GMT 2002


> 1. Right now, glibc segfaults if passed a null pointer for aiocbp (see below
> for code listing for test0013.c):

That is the appropriate behavior.  Passing a null pointer to this function
has undefined behavior.  EBADF is only an approriate error code when the
problem is with the file descriptor value, not when it's impossible to
access the location that should hold that value.

> 4. Right now, aio_read() does not synchronously detect an invalid value for
> aiocbp->aio_nbytes.  For example, if it is passed a negative value,
> aiocbp->aio_read() returns 0 (see below for code listing for test0017.c).

aio_nbytes is an unsigned value (size_t).  

> 5. Right now, aio_read() does not synchronously detect an invalid value for
> aiocpb->aio_offset.  For example, if it is passed a negative value,
> aio_read() returns 0 (see below for code listing for test0018.c).

True, but since the other kinds of invalid values (off the end of the file)
cannot be detected synchronously, this doesn't change all such cases.

At any rate, detecting these conditions only asynchronously is entirely
within what the standard allows.



More information about the Libc-alpha mailing list