Skip to contentSkip to conversation

POSIX "aio_read/8-1" and "aio_write/6-1" failed.

LTP Mitani 2 participants 2 messages Dec 7, 2010 – Dec 8, 2010

lore
Share & tools
lore

Mitani

author
#0 lore raw

Hi,

"aio_read/8-1" and "aio_write/6-1" tests failed in my environments (RHEL5.5-x86, RHEL4.8-x86_64/ia64):
------------<RHEL5.5 - x86> conformance/interfaces/aio_read/8-1: execution: FAILED: Output:
aio_read/8-1.c aio_read() should fail!
[...]
conformance/interfaces/aio_write/6-1: execution: FAILED: Output:
aio_write/6-1.c aio_write should fail!
------------

I tried "aio_read/8-1" manually:
------------
[root@RHEL55-LTP-x86 aio_read]# ./8-1.run-test
aio_return: 0
aio_read(errno): 0
aio_read(strerror): Success
aio_read/8-1.c aio_read() should fail!
------------

This test expects that "aio_read()" with "aio_buf = NULL" fails:
------------<aio_read/8-1.c>

 *      - fill in an aiocb with a NULL aio_buf
 *      - call aio_read
 *      - check aio_read return value
 */
[...]
int main()
{
        struct aiocb aiocb;

        if (sysconf(_SC_ASYNCHRONOUS_IO) != 200112L)
                return PTS_UNSUPPORTED;

        /* submit a request with a NULL buffer */
        aiocb.aio_fildes = 0;
        aiocb.aio_buf = NULL;
        aiocb.aio_nbytes = 0;
        aiocb.aio_offset = 0;

        if (aio_read(&aiocb) != -1)
        {
                printf(TNAME " aio_read() should fail!\n");
                exit(PTS_FAIL);
        }

------------

But "aio_read()" succeeded.

The manual says:
------------
[root@RHEL55-LTP-x86 aio_read]# man aio_read
AIO_READ(3) Linux Programmer's Manual
AIO_READ(3)

NAME
aio_read - asynchronous read

SYNOPSIS

       #include <aio.h>

       int aio_read(struct aiocb *aiocbp);

[...]
RETURN VALUE
On success, 0 is returned. On error the request is not enqueued,
-1 is
returned, and errno is set appropriately. If an error is first
detected
later, it will be reported via aio_return(3) (returns status -1)
and
aio_error(3) (error status whatever one would have gotten in errno,
such
as EBADF).

ERRORS
EAGAIN Out of resources.

EBADF aio_fildes is not a valid file descriptor open for reading.

EINVAL One or more of aio_offset, aio_reqprio, aio_nbytes are
invalid.

ENOSYS This function is not supported.

EOVERFLOW
The file is a regular file, we start reading before
end-of-file and
want at least one byte, but the starting position is past the
maxi-
mum offset for this file.

NOTES
It is a good idea to zero out the control block before use. This
control
block must not be changed while the read operation is in progress.
The
buffer area being read into must not be accessed during the
operation or
undefined results may occur. The memory areas involved must remain
valid.
------------

Manual says that "aio_read()" fails when aio_offset, aio_reqprio, aio_nbytes, aio_fildes are invalid.
But the manual doesn't say about "aio_buf".

"aio_write/6-1"is same situation as "aio_read/8-1".

What meaning do these tests have?
Does "aio_read()" fail in the systems except Linux? If so, may I judge the possibility of this tests by judging the environment is Linux or not?

Please give me some opinion.

Regards--

-Tomonori Mitani

------------------------------------------------------------------------------
What happens now with your Lotus Notes apps - do you make another costly upgrade, or settle for being marooned without product support? Time to move off Lotus Notes and onto the cloud with Force.com, apps are easier to build, use, and manage than apps on traditional platforms. Sign up for the Lotus Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#1 lore raw
Quoted 119 lines · ext Mitani

Hi,

"aio_read/8-1" and "aio_write/6-1" tests failed in my environments (RHEL5.5-x86, RHEL4.8-x86_64/ia64):
------------<RHEL5.5 - x86> conformance/interfaces/aio_read/8-1: execution: FAILED: Output:
aio_read/8-1.c aio_read() should fail!
[...]
conformance/interfaces/aio_write/6-1: execution: FAILED: Output:
aio_write/6-1.c aio_write should fail!
------------

I tried "aio_read/8-1" manually:
------------
[root@RHEL55-LTP-x86 aio_read]# ./8-1.run-test
aio_return: 0
aio_read(errno): 0
aio_read(strerror): Success
aio_read/8-1.c aio_read() should fail!
------------

This test expects that "aio_read()" with "aio_buf = NULL" fails:
------------<aio_read/8-1.c>

 *      - fill in an aiocb with a NULL aio_buf
 *      - call aio_read
 *      - check aio_read return value
 */
[...]
int main()
{
        struct aiocb aiocb;

        if (sysconf(_SC_ASYNCHRONOUS_IO) != 200112L)
                return PTS_UNSUPPORTED;

        /* submit a request with a NULL buffer */
        aiocb.aio_fildes = 0;
        aiocb.aio_buf = NULL;
        aiocb.aio_nbytes = 0;
        aiocb.aio_offset = 0;

        if (aio_read(&aiocb) != -1)
        {
                printf(TNAME " aio_read() should fail!\n");
                exit(PTS_FAIL);
        }

------------

But "aio_read()" succeeded.

The manual says:
------------
[root@RHEL55-LTP-x86 aio_read]# man aio_read
AIO_READ(3) Linux Programmer's Manual
AIO_READ(3)

NAME
aio_read - asynchronous read

SYNOPSIS

       #include <aio.h>

       int aio_read(struct aiocb *aiocbp);

[...]
RETURN VALUE
On success, 0 is returned. On error the request is not enqueued,
-1 is
returned, and errno is set appropriately. If an error is first
detected
later, it will be reported via aio_return(3) (returns status -1)
and
aio_error(3) (error status whatever one would have gotten in errno,
such
as EBADF).

ERRORS
EAGAIN Out of resources.

EBADF aio_fildes is not a valid file descriptor open for reading.

EINVAL One or more of aio_offset, aio_reqprio, aio_nbytes are
invalid.

ENOSYS This function is not supported.

EOVERFLOW
The file is a regular file, we start reading before
end-of-file and
want at least one byte, but the starting position is past the
maxi-
mum offset for this file.

NOTES
It is a good idea to zero out the control block before use. This
control
block must not be changed while the read operation is in progress.
The
buffer area being read into must not be accessed during the
operation or
undefined results may occur. The memory areas involved must remain
valid.
------------

Manual says that "aio_read()" fails when aio_offset, aio_reqprio, aio_nbytes, aio_fildes are invalid.
But the manual doesn't say about "aio_buf".

"aio_write/6-1"is same situation as "aio_read/8-1".

What meaning do these tests have?
Does "aio_read()" fail in the systems except Linux? If so, may I judge the possibility of this tests by judging the environment is Linux or not?

Quoted 7 lines

Please give me some opinion.

Regards--

-Tomonori Mitani

Hi,

aio_read and aio_write are implemented in glibc, in sysdeps/pthread/aio_read.c:

#include <aio.h>

#include <aio_misc.h>

int
aio_read (aiocbp)

     struct aiocb *aiocbp;
{
  return (__aio_enqueue_request ((aiocb_union *) aiocbp, LIO_READ) == NULL
          ? -1 : 0);
}

...

and the specific function dealing with aio_read and aio_write __aio_enqueue_request() in sysdeps/pthread/aio_misc.c.

http://www.kernel.org/doc/man-pages/online/pages/man7/aio.7.html :

VERSIONS top

The POSIX AIO interfaces are provided by glibc since version 2.1.

Noticed the same aio_read/aio_write behavior in ARMv7 devices, depending on glibc version of course.

br,
Hannu

Signature · 13 lines
Hannu Heikkinen
http://www.nixu.com

------------------------------------------------------------------------------
What happens now with your Lotus Notes apps - do you make another costly 
upgrade, or settle for being marooned without product support? Time to move
off Lotus Notes and onto the cloud with Force.com, apps are easier to build,
use, and manage than apps on traditional platforms. Sign up for the Lotus 
Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list