This is the mail archive of the libc-alpha@sourceware.org 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]

[RFC] [PATCH] Make lio_listio set errno to EIO on requests with invalid aio_lio_opcode


Hi,

According to the POSIX standards, only supported opcodes with lio_listio() are LIO_READ, LIO_WRITE and LIO_NOP. Currently lio_listio doesn't check for non-supported/invalid opcodes.

The following patch adds the check and sets the errno to EIO.

Please review.

Thanks.

Suzuki K P
Linux Technology Centre,
IBM Software Labs.



* sysdeps/pthread/lio_listio.c : Set errno to EIO on non-supported aio_lio_opcodes in lio_listio().


--- libc/sysdeps/pthread/lio_listio.c 2006-01-06 09:40:03.000000000 +0530
+++ libc-mod/sysdeps/pthread/lio_listio.c 2006-02-10 14:32:38.000000000 +0530
@@ -82,10 +82,18 @@ lio_listio_internal (int mode, struct ai
{
if (NO_INDIVIDUAL_EVENT_P (mode))
list[cnt]->aio_sigevent.sigev_notify = SIGEV_NONE;
-
- requests[cnt] = __aio_enqueue_request ((aiocb_union *) list[cnt],
- (list[cnt]->aio_lio_opcode
- | LIO_OPCODE_BASE));
+
+ if (list[cnt]->aio_lio_opcode != LIO_READ
+ && list[cnt]->aio_lio_opcode != LIO_WRITE)
+ {
+ /* Only LIO_{READ,WRITE,NOP} are supported. */
+ requests[cnt] = NULL;
+ __set_errno (EIO);
+ }
+ else
+ requests[cnt] = __aio_enqueue_request ((aiocb_union *) list[cnt],
+ (list[cnt]->aio_lio_opcode
+ | LIO_OPCODE_BASE));


 	if (requests[cnt] != NULL)
 	  /* Successfully enqueued.  */


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