Move AIO signal logic to a common location in aio_signal.c. Also fix several typos

This commit is contained in:
Gregory Nutt 2014-10-05 06:53:56 -06:00
parent 31cdcde73a
commit c274acc48f
6 changed files with 28 additions and 28 deletions

View File

@ -137,7 +137,9 @@ struct aiocb
int aio_reqprio; /* Request priority offset */
int aio_lio_opcode; /* Operation to be performed */
/* Non-standard, implementation-dependent data */
/* Non-standard, implementation-dependent data. For portability reasons,
* application code should never reference these elements.
*/
struct work_s aio_work; /* Used to defer I/O to the work thread */
pid_t aio_pid; /* ID of client to be notify at completion */

View File

@ -108,7 +108,6 @@
# define SIGPOLL CONFIG_SIG_POLL
# endif
#endif
#endif
/* The following are non-standard signal definitions */

View File

@ -38,6 +38,7 @@ ifeq ($(CONFIG_LIBC_AIO),y)
# Add the asynchronous I/O C files to the build
CSRCS += aio_read.c aio_write.c aio_return.c aio_error.c
CSRCS += aio_signal.c
ifneq ($(CONFIG_PTHREAD_DISABLE),y)
CSRCS += lio_listio.c

View File

@ -77,4 +77,22 @@ extern "C"
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: aio_signal
*
* Description:
* Signal the client that an I/O has completed.
*
* Input Parameters:
* aiocbp - Pointer to the asynchronous I/O state structure that includes
* information about how to signal the client
*
* Returned Value:
* Zero (OK) if the client was successfully signalled. Otherwise, a
* negated errno value is returned.
*
****************************************************************************/
int aio_signal(FAR struct aiocb *aiocbp);
#endif /* __LIBC_AIO_AIO_H */

View File

@ -40,7 +40,7 @@
#include <nuttx/config.h>
#include <unistd.h>
#include <signal.h>
#include <sched.h>
#include <aio.h>
#include <assert.h>
#include <errno.h>
@ -120,17 +120,7 @@ static void aio_read_worker(FAR void *arg)
/* Signal the client */
if (aiocbp->aio_sigevent.sigev_notify == SIGEV_SIGNAL)
{
int ret;
#ifdef CONFIG_CAN_PASS_STRUCTS
ret = sigqueue(aiocbp->aio_pid, aiocbp->aio_sigevent.sigev_signo,
aiocbp->aio_sigevent.sigev_value);
#else
ret = sigqueue(aiocbp->aio_pid, aiocbp->aio_sigevent.sigev_sign,
aiocbp->aio_sigevent.sigev_value.sival_ptr);
#endif
}
(void)aio_signal(aiocbp);
}
/****************************************************************************
@ -253,7 +243,7 @@ static void aio_read_worker(FAR void *arg)
*
****************************************************************************/
int aio_read(FAR struct aiocb *aiocbp);
int aio_read(FAR struct aiocb *aiocbp)
{
int ret;

View File

@ -40,7 +40,7 @@
#include <nuttx/config.h>
#include <unistd.h>
#include <signal.h>
#include <sched.h>
#include <aio.h>
#include <assert.h>
#include <errno.h>
@ -151,17 +151,7 @@ static void aio_write_worker(FAR void *arg)
/* Signal the client */
if (aiocbp->aio_sigevent.sigev_notify == SIGEV_SIGNAL)
{
int ret;
#ifdef CONFIG_CAN_PASS_STRUCTS
ret = sigqueue(aiocbp->aio_pid, aiocbp->aio_sigevent.sigev_signo,
aiocbp->aio_sigevent.sigev_value);
#else
ret = sigqueue(aiocbp->aio_pid, aiocbp->aio_sigevent.sigev_sign,
aiocbp->aio_sigevent.sigev_value.sival_ptr);
#endif
}
(void)aio_signal(aiocbp);
}
/****************************************************************************
@ -286,7 +276,7 @@ static void aio_write_worker(FAR void *arg)
*
****************************************************************************/
int aio_write(FAR struct aiocb *aiocbp);
int aio_write(FAR struct aiocb *aiocbp)
{
int ret;