* posix/src/aio_misc.c: New.
	* posix/src/aio_error.c, posix/src/aio_read.c,
	* posix/src/aio_return.c, posix/src/aio_write.c:
	New implementation.
This commit is contained in:
Ralf Corsepius
2010-08-16 05:46:09 +00:00
parent a45d062026
commit d8a7e18024
6 changed files with 671 additions and 55 deletions
+7
View File
@@ -1,3 +1,10 @@
2010-08-16 Alin Rus <alin.codejunkie@gmail.com>
* posix/src/aio_misc.c: New.
* posix/src/aio_error.c, posix/src/aio_read.c,
* posix/src/aio_return.c, posix/src/aio_write.c:
New implementation.
2010-08-16 Ralf Corsépius <ralf.corsepius@rtems.org>
* posix/Makefile.am: Add include/rtems/posix/aio_misc.h.
+22 -13
View File
@@ -1,14 +1,11 @@
/*
* 6.7.5 Retrieve Error of Asynchronous I/O Operation, P1003.1b-1993, p. 161
* Copyright 2010, Alin Rus <alin.codejunkie@gmail.com>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* COPYRIGHT (c) 1989-2007.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
* $Id$
*/
#if HAVE_CONFIG_H
@@ -21,9 +18,21 @@
#include <rtems/system.h>
#include <rtems/seterr.h>
int aio_error(
const struct aiocb *aiocbp __attribute__((unused))
)
/*
* aio_error
*
* Retrieve errors status for an asynchronous I/O operation
*
* Input parameters:
* aiocbp - asynchronous I/O control block
*
* Output parameters:
* aiocbp->error_code
*/
int
aio_error (const struct aiocb *aiocbp)
{
rtems_set_errno_and_return_minus_one( ENOSYS );
return aiocbp->error_code;
}
File diff suppressed because it is too large Load Diff
+50 -14
View File
@@ -1,29 +1,65 @@
/*
* 6.7.2 Asynchronous Read, P1003.1b-1993, p. 154
* Copyright 2010, Alin Rus <alin.codejunkie@gmail.com>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* COPYRIGHT (c) 1989-2007.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
* $Id$
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
#include <aio.h>
#include <errno.h>
#include <fcntl.h>
#include <rtems/posix/aio_misc.h>
#include <rtems/system.h>
#include <rtems/seterr.h>
#include <stdlib.h>
int aio_read(
struct aiocb *aiocbp __attribute__((unused))
)
/*
* 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)
{
rtems_set_errno_and_return_minus_one( ENOSYS );
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);
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 || aiocbp->aio_nbytes < 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->aiocbp = aiocbp;
req->aiocbp->aio_lio_opcode = LIO_READ;
return rtems_aio_enqueue (req);
}
+21 -14
View File
@@ -1,15 +1,11 @@
/*
* 6.7.6 Retrieve Return Status of Asynchronous I/O Operation,
* P1003.1b-1993, p. 162
* Copyright 2010, Alin Rus <alin.codejunkie@gmail.com>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* COPYRIGHT (c) 1989-2007.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
* $Id$
*/
#if HAVE_CONFIG_H
@@ -22,9 +18,20 @@
#include <rtems/system.h>
#include <rtems/seterr.h>
ssize_t aio_return(
const struct aiocb *aiocbp __attribute__((unused))
)
/*
* aio_return
*
* Retrieve return status of an asynchronous I/O operation
*
* Input parameters:
* aiocbp - asynchronous I/O control block
*
* Output parameters:
* aiocbp->return_value
*/
ssize_t
aio_return (const struct aiocb *aiocbp)
{
rtems_set_errno_and_return_minus_one( ENOSYS );
return aiocbp->return_value;
}
+50 -14
View File
@@ -1,29 +1,65 @@
/*
* 6.7.3 Asynchronous Write, P1003.1b-1993, p. 155
* Copyright 2010, Alin Rus <alin.codejunkie@gmail.com>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* COPYRIGHT (c) 1989-2007.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
* $Id$
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
#include <aio.h>
#include <errno.h>
#include <fcntl.h>
#include <rtems/posix/aio_misc.h>
#include <rtems/system.h>
#include <rtems/seterr.h>
#include <stdlib.h>
int aio_write(
struct aiocb *aiocbp __attribute__((unused))
)
/*
* aio_write
*
* 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_write (struct aiocb *aiocbp)
{
rtems_set_errno_and_return_minus_one( ENOSYS );
rtems_aio_request *req;
int mode;
mode = fcntl (aiocbp->aio_fildes, F_GETFL);
if (!(((mode & O_ACCMODE) == O_WRONLY) || ((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_offset < 0 || aiocbp->aio_nbytes < 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->aiocbp = aiocbp;
req->aiocbp->aio_lio_opcode = LIO_WRITE;
return rtems_aio_enqueue (req);
}