diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-10-05 06:53:56 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-10-05 06:53:56 -0600 |
commit | f5806709544bedc0821f8c5c8c60cfc61e256f07 (patch) | |
tree | 1ec05eb6d567ad5b3a91bd0f8a26fd994318e7c9 | |
parent | 8b23716e9ace244a83f636cbafe6a51ed054af15 (diff) | |
download | nuttx-f5806709544bedc0821f8c5c8c60cfc61e256f07.tar.gz nuttx-f5806709544bedc0821f8c5c8c60cfc61e256f07.tar.bz2 nuttx-f5806709544bedc0821f8c5c8c60cfc61e256f07.zip |
Move AIO signal logic to a common location in aio_signal.c. Also fix several typos
-rw-r--r-- | nuttx/include/aio.h | 4 | ||||
-rw-r--r-- | nuttx/include/signal.h | 1 | ||||
-rw-r--r-- | nuttx/libc/aio/Make.defs | 1 | ||||
-rw-r--r-- | nuttx/libc/aio/aio.h | 18 | ||||
-rw-r--r-- | nuttx/libc/aio/aio_read.c | 16 | ||||
-rw-r--r-- | nuttx/libc/aio/aio_write.c | 16 |
6 files changed, 28 insertions, 28 deletions
diff --git a/nuttx/include/aio.h b/nuttx/include/aio.h index 61965789e..0e0d18994 100644 --- a/nuttx/include/aio.h +++ b/nuttx/include/aio.h @@ -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 */ diff --git a/nuttx/include/signal.h b/nuttx/include/signal.h index 5d3c4654b..2589881dc 100644 --- a/nuttx/include/signal.h +++ b/nuttx/include/signal.h @@ -108,7 +108,6 @@ # define SIGPOLL CONFIG_SIG_POLL # endif #endif -#endif /* The following are non-standard signal definitions */ diff --git a/nuttx/libc/aio/Make.defs b/nuttx/libc/aio/Make.defs index 667490d1f..2ec441a3a 100644 --- a/nuttx/libc/aio/Make.defs +++ b/nuttx/libc/aio/Make.defs @@ -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 diff --git a/nuttx/libc/aio/aio.h b/nuttx/libc/aio/aio.h index 9a103a420..7b6e800d6 100644 --- a/nuttx/libc/aio/aio.h +++ b/nuttx/libc/aio/aio.h @@ -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 */ diff --git a/nuttx/libc/aio/aio_read.c b/nuttx/libc/aio/aio_read.c index b1c4637ff..366b7cb05 100644 --- a/nuttx/libc/aio/aio_read.c +++ b/nuttx/libc/aio/aio_read.c @@ -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; diff --git a/nuttx/libc/aio/aio_write.c b/nuttx/libc/aio/aio_write.c index 5576bec74..84372c27d 100644 --- a/nuttx/libc/aio/aio_write.c +++ b/nuttx/libc/aio/aio_write.c @@ -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; |