diff options
Diffstat (limited to 'nuttx')
-rw-r--r-- | nuttx/libc/aio/aio_cancel.c | 9 | ||||
-rw-r--r-- | nuttx/libc/aio/aio_error.c | 2 | ||||
-rw-r--r-- | nuttx/libc/aio/aio_fsync.c | 10 | ||||
-rw-r--r-- | nuttx/libc/aio/aio_read.c | 14 | ||||
-rw-r--r-- | nuttx/libc/aio/aio_return.c | 4 | ||||
-rw-r--r-- | nuttx/libc/aio/aio_signal.c | 5 | ||||
-rw-r--r-- | nuttx/libc/aio/aio_suspend.c | 5 | ||||
-rw-r--r-- | nuttx/libc/aio/aio_write.c | 24 |
8 files changed, 42 insertions, 31 deletions
diff --git a/nuttx/libc/aio/aio_cancel.c b/nuttx/libc/aio/aio_cancel.c index 41c2811ab..4e67354c8 100644 --- a/nuttx/libc/aio/aio_cancel.c +++ b/nuttx/libc/aio/aio_cancel.c @@ -40,12 +40,15 @@ #include <nuttx/config.h> #include <aio.h> +#include <sched.h> #include <assert.h> #include <errno.h> #include <nuttx/wqueue.h> -#ifndef CONFIG_LIBC_AIO +#include "aio/aio.h" + +#ifdef CONFIG_LIBC_AIO /**************************************************************************** * Pre-processor Definitions @@ -138,7 +141,7 @@ int aio_cancel(int fildes, FAR struct aiocb *aiocbp) /* Check if the I/O has completed */ - if (aiocbp == -EINPROGRESS) + if (aiocbp->aio_result == -EINPROGRESS) { /* No ... attempt to cancel the I/O. There are two possibilities: (1) * the work has already been started and is no longer queued, or (2) @@ -154,7 +157,7 @@ int aio_cancel(int fildes, FAR struct aiocb *aiocbp) { /* The I/O has already completed */ - ret = AIO_ALLDONE + ret = AIO_ALLDONE; } sched_unlock(); diff --git a/nuttx/libc/aio/aio_error.c b/nuttx/libc/aio/aio_error.c index 70dd024b9..abdffbde7 100644 --- a/nuttx/libc/aio/aio_error.c +++ b/nuttx/libc/aio/aio_error.c @@ -43,7 +43,7 @@ #include <assert.h> #include <errno.h> -#ifndef CONFIG_LIBC_AIO +#ifdef CONFIG_LIBC_AIO /**************************************************************************** * Pre-processor Definitions diff --git a/nuttx/libc/aio/aio_fsync.c b/nuttx/libc/aio/aio_fsync.c index 8595f71b8..8c68618b3 100644 --- a/nuttx/libc/aio/aio_fsync.c +++ b/nuttx/libc/aio/aio_fsync.c @@ -49,7 +49,7 @@ #include "lib_internal.h" #include "aio/aio.h" -#ifndef CONFIG_LIBC_AIO +#ifdef CONFIG_LIBC_AIO /**************************************************************************** * Pre-processor Definitions @@ -91,7 +91,7 @@ static void aio_fsync_worker(FAR void *arg) { FAR struct aiocb *aiocbp = (FAR struct aiocb *)arg; - DEBASSERT(arg); + DEBUGASSERT(arg); int ret; /* Perform the fsync using aio_fildes */ @@ -102,11 +102,11 @@ static void aio_fsync_worker(FAR void *arg) int errcode = get_errno(); fdbg("ERROR: fsync failed: %d\n", errode); DEBUGASSERT(errcode > 0); - aicbp->result = -errcode; + aiocbp->aio_result = -errcode; } else { - aicbp->result = OK; + aiocbp->aio_result = OK; } /* Signal the client */ @@ -217,7 +217,7 @@ int aio_fsync(int op, FAR struct aiocb *aiocbp) ret = work_queue(AIO_QUEUE, &aiocbp->aio_work, aio_fsync_worker, aiocbp, 0); if (ret < 0) { - aio->aio_result = ret; + aiocbp->aio_result = ret; set_errno(ret); return ERROR; } diff --git a/nuttx/libc/aio/aio_read.c b/nuttx/libc/aio/aio_read.c index e356305ec..26a8f816b 100644 --- a/nuttx/libc/aio/aio_read.c +++ b/nuttx/libc/aio/aio_read.c @@ -50,7 +50,7 @@ #include "lib_internal.h" #include "aio/aio.h" -#ifndef CONFIG_LIBC_AIO +#ifdef CONFIG_LIBC_AIO /**************************************************************************** * Pre-processor Definitions @@ -92,7 +92,7 @@ static void aio_read_worker(FAR void *arg) { FAR struct aiocb *aiocbp = (FAR struct aiocb *)arg; - DEBASSERT(arg); + DEBUGASSERT(arg); ssize_t nread; /* Perform the read using: @@ -103,8 +103,8 @@ static void aio_read_worker(FAR void *arg) * aio_offset - File offset */ - nread = pread(aiocbp->aio_fildes, aiocbp->aio_buf, aiocbp->aio_nbytes, - aiocbp->aio_offset); + nread = pread(aiocbp->aio_fildes, (FAR void *)aiocbp->aio_buf, + aiocbp->aio_nbytes, aiocbp->aio_offset); /* Set the result of the read */ @@ -113,11 +113,11 @@ static void aio_read_worker(FAR void *arg) int errcode = get_errno(); fdbg("ERROR: pread failed: %d\n", errode); DEBUGASSERT(errcode > 0); - aicbp->result = -errcode; + aiocbp->aio_result = -errcode; } else { - aicbp->result = nread; + aiocbp->aio_result = nread; } /* Signal the client */ @@ -265,7 +265,7 @@ int aio_read(FAR struct aiocb *aiocbp) ret = work_queue(AIO_QUEUE, &aiocbp->aio_work, aio_read_worker, aiocbp, 0); if (ret < 0) { - aio->aio_result = ret; + aiocbp->aio_result = ret; set_errno(ret); return ERROR; } diff --git a/nuttx/libc/aio/aio_return.c b/nuttx/libc/aio/aio_return.c index 3aab715fc..c33a07e53 100644 --- a/nuttx/libc/aio/aio_return.c +++ b/nuttx/libc/aio/aio_return.c @@ -43,7 +43,7 @@ #include <assert.h> #include <errno.h> -#ifndef CONFIG_LIBC_AIO +#ifdef CONFIG_LIBC_AIO /**************************************************************************** * Pre-processor Definitions @@ -109,7 +109,7 @@ ssize_t aio_return(FAR struct aiocb *aiocbp) if (aiocbp->aio_result < 0) { set_errno((int)-aiocbp->aio_result); - return (ssize_t)ERROR + return (ssize_t)ERROR; } return aiocbp->aio_result; diff --git a/nuttx/libc/aio/aio_signal.c b/nuttx/libc/aio/aio_signal.c index 75c1a3dd7..64dd7f75f 100644 --- a/nuttx/libc/aio/aio_signal.c +++ b/nuttx/libc/aio/aio_signal.c @@ -39,13 +39,16 @@ #include <nuttx/config.h> +#include <sched.h> #include <signal.h> #include <aio.h> #include <assert.h> +#include <errno.h> +#include <debug.h> #include "aio/aio.h" -#ifndef CONFIG_LIBC_AIO +#ifdef CONFIG_LIBC_AIO /**************************************************************************** * Pre-processor Definitions diff --git a/nuttx/libc/aio/aio_suspend.c b/nuttx/libc/aio/aio_suspend.c index 51fdf7e4a..8e7083338 100644 --- a/nuttx/libc/aio/aio_suspend.c +++ b/nuttx/libc/aio/aio_suspend.c @@ -39,12 +39,13 @@ #include <nuttx/config.h> +#include <sched.h> #include <signal.h> #include <aio.h> #include <assert.h> #include <errno.h> -#ifndef CONFIG_LIBC_AIO +#ifdef CONFIG_LIBC_AIO /**************************************************************************** * Pre-processor Definitions @@ -160,7 +161,7 @@ int aio_suspend(FAR const struct aiocb *const list[], int nent, sigemptyset(&set); sigaddset(&set, SIGPOLL); - ret = sigtimedwait(&set, NULL, &timeout) + ret = sigtimedwait(&set, NULL, timeout); sched_unlock(); return ret >= 0 ? OK : ERROR; } diff --git a/nuttx/libc/aio/aio_write.c b/nuttx/libc/aio/aio_write.c index 87ea00373..c46ddc9ae 100644 --- a/nuttx/libc/aio/aio_write.c +++ b/nuttx/libc/aio/aio_write.c @@ -40,6 +40,7 @@ #include <nuttx/config.h> #include <unistd.h> +#include <fcntl.h> #include <sched.h> #include <aio.h> #include <assert.h> @@ -50,7 +51,7 @@ #include "lib_internal.h" #include "aio/aio.h" -#ifndef CONFIG_LIBC_AIO +#ifdef CONFIG_LIBC_AIO /**************************************************************************** * Pre-processor Definitions @@ -92,7 +93,7 @@ static void aio_write_worker(FAR void *arg) { FAR struct aiocb *aiocbp = (FAR struct aiocb *)arg; - DEBASSERT(arg); + DEBUGASSERT(arg); ssize_t nwritten; int oflags; @@ -104,12 +105,12 @@ static void aio_write_worker(FAR void *arg) * were a system call, then only one would be required. */ - oflags = fcntl((aiocbp->aio_fildes, F_GETFL, ...) + oflags = fcntl(aiocbp->aio_fildes, F_GETFL); if (oflags < 0) { int errcode = get_errno(); fdbg("ERROR: fcntl failed: %d\n", errode); - aicbp->result = -errcode; + aiocbp->aio_result = -errcode; } else { @@ -127,13 +128,16 @@ static void aio_write_worker(FAR void *arg) { /* Append to the current file position */ - nwritten = write(aiocbp->aio_fildes, aiocbp->aio_buf, + nwritten = write(aiocbp->aio_fildes, + (FAR const void *)aiocbp->aio_buf, aiocbp->aio_nbytes); } else { - nwritten = pwrite(aiocbp->aio_fildes, aiocbp->aio_buf, - aiocbp->aio_nbytes, aiocbp->aio_offset); + nwritten = pwrite(aiocbp->aio_fildes, + (FAR const void *)aiocbp->aio_buf, + aiocbp->aio_nbytes, + aiocbp->aio_offset); } /* Set the result of the write */ @@ -143,11 +147,11 @@ static void aio_write_worker(FAR void *arg) int errcode = get_errno(); fdbg("ERROR: write/pwrite failed: %d\n", errode); DEBUGASSERT(errcode > 0); - aicbp->result = -errcode; + aiocbp->aio_result = -errcode; } else { - aicbp->result = nwritten; + aiocbp->aio_result = nwritten; } } @@ -298,7 +302,7 @@ int aio_write(FAR struct aiocb *aiocbp) ret = work_queue(AIO_QUEUE, &aiocbp->aio_work, aio_write_worker, aiocbp, 0); if (ret < 0) { - aio->aio_result = ret; + aiocbp->aio_result = ret; set_errno(ret); return ERROR; } |