Move AIO signal logic to a common location in aio_signal.c. Also fix several typos
This commit is contained in:
parent
31cdcde73a
commit
c274acc48f
@ -137,7 +137,9 @@ struct aiocb
|
|||||||
int aio_reqprio; /* Request priority offset */
|
int aio_reqprio; /* Request priority offset */
|
||||||
int aio_lio_opcode; /* Operation to be performed */
|
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 */
|
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 */
|
pid_t aio_pid; /* ID of client to be notify at completion */
|
||||||
|
@ -108,7 +108,6 @@
|
|||||||
# define SIGPOLL CONFIG_SIG_POLL
|
# define SIGPOLL CONFIG_SIG_POLL
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
/* The following are non-standard signal definitions */
|
/* The following are non-standard signal definitions */
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ ifeq ($(CONFIG_LIBC_AIO),y)
|
|||||||
# Add the asynchronous I/O C files to the build
|
# 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_read.c aio_write.c aio_return.c aio_error.c
|
||||||
|
CSRCS += aio_signal.c
|
||||||
|
|
||||||
ifneq ($(CONFIG_PTHREAD_DISABLE),y)
|
ifneq ($(CONFIG_PTHREAD_DISABLE),y)
|
||||||
CSRCS += lio_listio.c
|
CSRCS += lio_listio.c
|
||||||
|
@ -77,4 +77,22 @@ extern "C"
|
|||||||
* Public Function Prototypes
|
* 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 */
|
#endif /* __LIBC_AIO_AIO_H */
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <signal.h>
|
#include <sched.h>
|
||||||
#include <aio.h>
|
#include <aio.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@ -120,17 +120,7 @@ static void aio_read_worker(FAR void *arg)
|
|||||||
|
|
||||||
/* Signal the client */
|
/* Signal the client */
|
||||||
|
|
||||||
if (aiocbp->aio_sigevent.sigev_notify == SIGEV_SIGNAL)
|
(void)aio_signal(aiocbp);
|
||||||
{
|
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -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;
|
int ret;
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <signal.h>
|
#include <sched.h>
|
||||||
#include <aio.h>
|
#include <aio.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@ -151,17 +151,7 @@ static void aio_write_worker(FAR void *arg)
|
|||||||
|
|
||||||
/* Signal the client */
|
/* Signal the client */
|
||||||
|
|
||||||
if (aiocbp->aio_sigevent.sigev_notify == SIGEV_SIGNAL)
|
(void)aio_signal(aiocbp);
|
||||||
{
|
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -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;
|
int ret;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user