forked from Imagelibrary/rtems
posix: Fixed header comment of aio_read.c
Corrected the header comment of aio_read.c Fixes #5015
This commit is contained in:
committed by
Gedare Bloom
parent
80c94eeff4
commit
3225f69db6
@@ -2,10 +2,9 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @ingroup POSIXAPI
|
||||
*
|
||||
*
|
||||
* @brief Asynchronously reads Data from a File
|
||||
* @ingroup POSIX_AIO
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -46,45 +45,44 @@
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
|
||||
/*
|
||||
* aio_read
|
||||
*
|
||||
* Asynchronous write to a file
|
||||
*
|
||||
* Input parameters:
|
||||
* aiocbp - asynchronous I/O control block
|
||||
*
|
||||
* Output parameters:
|
||||
* -1 - request could not pe enqueued
|
||||
* - FD not opened for write
|
||||
* - invalid aio_reqprio or aio_offset or
|
||||
* aio_nbytes
|
||||
* - not enough memory
|
||||
* 0 - otherwise
|
||||
*/
|
||||
|
||||
int
|
||||
aio_read (struct aiocb *aiocbp)
|
||||
/**
|
||||
* @brief Asynchronous read from a file
|
||||
*
|
||||
* 6.7.2 Asynchronous Read, P1003.1b-1993, p. 154
|
||||
*
|
||||
* @param[in] aiocbp is a pointer to the asynchronous I/O control block
|
||||
*
|
||||
* @retval 0 The request has been successfuly enqueued.
|
||||
* @retval -1 The request has not been enqueued. The possible errors are:
|
||||
* - FD not opened for read
|
||||
* - invalid aio_reqprio or aio_offset or aio_nbytes
|
||||
* - not enough memory
|
||||
* - the starting position of the file is past the maximum offset
|
||||
* for this file.
|
||||
*
|
||||
*/
|
||||
int aio_read(struct aiocb *aiocbp)
|
||||
{
|
||||
rtems_aio_request *req;
|
||||
int mode;
|
||||
|
||||
mode = fcntl (aiocbp->aio_fildes, F_GETFL);
|
||||
if (!(((mode & O_ACCMODE) == O_RDONLY) || ((mode & O_ACCMODE) == O_RDWR)))
|
||||
rtems_aio_set_errno_return_minus_one (EBADF, aiocbp);
|
||||
mode = fcntl(aiocbp->aio_fildes, F_GETFL);
|
||||
if ( !((( mode&O_ACCMODE ) == O_RDONLY ) || (( mode&O_ACCMODE ) == O_RDWR )))
|
||||
rtems_aio_set_errno_return_minus_one(EBADF, aiocbp);
|
||||
|
||||
if (aiocbp->aio_reqprio < 0 || aiocbp->aio_reqprio > AIO_PRIO_DELTA_MAX)
|
||||
rtems_aio_set_errno_return_minus_one (EINVAL, aiocbp);
|
||||
if ( aiocbp->aio_reqprio < 0 || aiocbp->aio_reqprio > AIO_PRIO_DELTA_MAX )
|
||||
rtems_aio_set_errno_return_minus_one(EINVAL, aiocbp);
|
||||
|
||||
if (aiocbp->aio_offset < 0)
|
||||
rtems_aio_set_errno_return_minus_one (EINVAL, aiocbp);
|
||||
if ( aiocbp->aio_offset < 0 )
|
||||
rtems_aio_set_errno_return_minus_one(EINVAL, aiocbp);
|
||||
|
||||
req = malloc (sizeof (rtems_aio_request));
|
||||
if (req == NULL)
|
||||
rtems_aio_set_errno_return_minus_one (EAGAIN, aiocbp);
|
||||
req = malloc(sizeof(rtems_aio_request));
|
||||
if ( req == NULL )
|
||||
rtems_aio_set_errno_return_minus_one(EAGAIN, aiocbp);
|
||||
|
||||
req->aiocbp = aiocbp;
|
||||
req->aiocbp->aio_lio_opcode = LIO_READ;
|
||||
|
||||
return rtems_aio_enqueue (req);
|
||||
return rtems_aio_enqueue(req);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user