Skip to contentSkip to conversation

aio_read/8-1.c fails

LTP Kang Kai 2 participants 4 messages Mar 8, 2012 – Mar 9, 2012 1 message not in the archive

lore
Share & tools
lore

Kang Kai

author
#0 lore raw

Hi All,

aio_read/8-1.c "fills in an aiocb with a NULL aio_buf" and then expect that the operation is not succesfully queued.
It fails that aio_read() always return 0. And I checked the posix spec and didn't find that an aiocb with NULL aio_buf will cause enqueue fails. So is this case valid?

Thanks,
Kai

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

author
#1 lore raw
Quoted 7 lines · Kang Kai

Hi All,

aio_read/8-1.c "fills in an aiocb with a NULL aio_buf" and then expect that the operation is not succesfully queued.
It fails that aio_read() always return 0. And I checked the posix spec and didn't find that an aiocb with NULL aio_buf will cause enqueue fails. So is this case valid?

So does the case aio_write/6-1.c.

Quoted 4 lines

Thanks,
Kai

Quoted 9 lines

------------------------------------------------------------------------------
Virtualization& Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#2 lore raw
In reply to Kang Kai

Hi!

Quoted 5 lines

aio_read/8-1.c "fills in an aiocb with a NULL aio_buf" and then expect that the operation is not succesfully queued.
It fails that aio_read() always return 0. And I checked the posix spec and didn't find that an aiocb with NULL aio_buf will cause enqueue fails. So is this case valid?

The testcase passes here. However looking at the sources it tries to read zero bytes to NULL buffer, which is wrong as the behavior in such case is undefied by POSIX. I guess this is just another case where the testcase was coded with "It works so it must be right" attitude.

And out of curiosity, which libc library makes the testcase fail?

Signature · 12 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

Hi!

Quoted 15 lines
Quoted 6 lines

The testcase passes here. However looking at the sources it tries to read zero bytes to NULL buffer, which is wrong as the behavior in such case is undefied by POSIX. I guess this is just another case where the testcase was coded with "It works so it must be right" attitude.

And out of curiosity, which libc library makes the testcase fail?

Yes, aio_read() return 0, and the case fails.

In posix spec Line 19887:
RETURN VALUE
The aio_read( ) function shall return the value zero if the I/O operation is successfully queued;
otherwise, the function shall return the value ???1 and set errno to indicate the error.

Quoted 3 lines

So when the I/O operation enqueued, aio_read() return 0, then that the I/O operation will be processing.
I still doubt the case is invalid.

Well, the POSIX explicitly says that if the pointer to the buffer becames illegal prior the I/O completion the behavior is undefined. So strictly speaking when you pass NULL buffer to aio_read() the behavior is undefined to begin with. At least that is how I understand the standard.

Signature · 12 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list