This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]