This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: PATCH: aio_read() POSIX compliance
- From: Roland McGrath <roland at frob dot com>
- To: Amos Waterland <apw at us dot ibm dot com>
- Cc: libc-alpha at sources dot redhat dot com
- Date: Thu, 13 Jun 2002 19:06:13 -0400 (EDT)
- Subject: Re: PATCH: aio_read() POSIX compliance
> 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.