diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-08-28 16:59:06 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-08-28 16:59:06 -0600 |
commit | 03bee97af3131ec0fa3d3d56be10296c197634bd (patch) | |
tree | b5021e99361f1f4b582e4db35b8911a701a9fe9c | |
parent | 25cc0eca88a732ee368f342af291df37f36016fe (diff) | |
download | nuttx-03bee97af3131ec0fa3d3d56be10296c197634bd.tar.gz nuttx-03bee97af3131ec0fa3d3d56be10296c197634bd.tar.bz2 nuttx-03bee97af3131ec0fa3d3d56be10296c197634bd.zip |
nuttx/drivers: Remove explicity references to errno. That is a problem from within the kernel for certain configurations
-rw-r--r-- | nuttx/drivers/can.c | 10 | ||||
-rw-r--r-- | nuttx/drivers/loop.c | 26 | ||||
-rw-r--r-- | nuttx/drivers/pipes/pipe.c | 2 | ||||
-rw-r--r-- | nuttx/drivers/pipes/pipe_common.c | 14 | ||||
-rw-r--r-- | nuttx/drivers/pwm.c | 6 | ||||
-rw-r--r-- | nuttx/drivers/rwbuffer.c | 2 | ||||
-rw-r--r-- | nuttx/drivers/timer.c | 4 | ||||
-rw-r--r-- | nuttx/drivers/watchdog.c | 4 |
8 files changed, 34 insertions, 34 deletions
diff --git a/nuttx/drivers/can.c b/nuttx/drivers/can.c index a0a3857d0..231b099f3 100644 --- a/nuttx/drivers/can.c +++ b/nuttx/drivers/can.c @@ -139,7 +139,7 @@ static int can_open(FAR struct file *filep) if (sem_wait(&dev->cd_closesem) != OK) { - ret = -errno; + ret = -get_errno(); } else { @@ -211,7 +211,7 @@ static int can_close(FAR struct file *filep) if (sem_wait(&dev->cd_closesem) != OK) { - ret = -errno; + ret = -get_errno(); } else { @@ -310,7 +310,7 @@ static ssize_t can_read(FAR struct file *filep, FAR char *buffer, size_t buflen) ret = sem_wait(&dev->cd_recv.rx_sem); if (ret < 0) { - ret = -errno; + ret = -get_errno(); goto return_with_irqdisabled; } } @@ -514,9 +514,9 @@ static ssize_t can_write(FAR struct file *filep, FAR const char *buffer, size_t ret = sem_wait(&fifo->tx_sem); dev->cd_ntxwaiters--; - if (ret < 0 && errno != EINTR) + if (ret < 0 && get_errno() != EINTR) { - ret = -errno; + ret = -get_errno(); goto return_with_irqdisabled; } } diff --git a/nuttx/drivers/loop.c b/nuttx/drivers/loop.c index 4744ae0dd..d520e7149 100644 --- a/nuttx/drivers/loop.c +++ b/nuttx/drivers/loop.c @@ -134,7 +134,7 @@ static void loop_semtake(FAR struct loop_struct_s *dev) * the wait was awakened by a signal. */ - ASSERT(errno == EINTR); + ASSERT(get_errno() == EINTR); } } @@ -234,7 +234,7 @@ static ssize_t loop_read(FAR struct inode *inode, unsigned char *buffer, ret = lseek(dev->fd, offset, SEEK_SET); if (ret == (off_t)-1) { - dbg("Seek failed for offset=%d: %d\n", (int)offset, errno); + dbg("Seek failed for offset=%d: %d\n", (int)offset, get_errno()); return -EIO; } @@ -243,10 +243,10 @@ static ssize_t loop_read(FAR struct inode *inode, unsigned char *buffer, do { nbytesread = read(dev->fd, buffer, nsectors * dev->sectsize); - if (nbytesread < 0 && errno != EINTR) + if (nbytesread < 0 && get_errno() != EINTR) { - dbg("Read failed: %d\n", errno); - return -errno; + dbg("Read failed: %d\n", get_errno()); + return -get_errno(); } } while (nbytesread < 0); @@ -281,7 +281,7 @@ static ssize_t loop_write(FAR struct inode *inode, const unsigned char *buffer, ret = lseek(dev->fd, offset, SEEK_SET); if (ret == (off_t)-1) { - dbg("Seek failed for offset=%d: %d\n", (int)offset, errno); + dbg("Seek failed for offset=%d: %d\n", (int)offset, get_errno()); } /* Then write the requested number of sectors to that position */ @@ -289,10 +289,10 @@ static ssize_t loop_write(FAR struct inode *inode, const unsigned char *buffer, do { nbyteswritten = write(dev->fd, buffer, nsectors * dev->sectsize); - if (nbyteswritten < 0 && errno != EINTR) + if (nbyteswritten < 0 && get_errno() != EINTR) { - dbg("Write failed: %d\n", errno); - return -errno; + dbg("Write failed: %d\n", get_errno()); + return -get_errno(); } } while (nbyteswritten < 0); @@ -367,8 +367,8 @@ int losetup(const char *devname, const char *filename, uint16_t sectsize, ret = stat(filename, &sb); if (ret < 0) { - dbg("Failed to stat %s: %d\n", filename, errno); - return -errno; + dbg("Failed to stat %s: %d\n", filename, get_errno()); + return -get_errno(); } /* Check if the file system is big enough for one block */ @@ -421,8 +421,8 @@ int losetup(const char *devname, const char *filename, uint16_t sectsize, dev->fd = open(filename, O_RDWR); if (dev->fd < 0) { - dbg("Failed to open %s: %d\n", filename, errno); - ret = -errno; + dbg("Failed to open %s: %d\n", filename, get_errno()); + ret = -get_errno(); goto errout_with_dev; } } diff --git a/nuttx/drivers/pipes/pipe.c b/nuttx/drivers/pipes/pipe.c index 826fa9ac7..264e5708e 100644 --- a/nuttx/drivers/pipes/pipe.c +++ b/nuttx/drivers/pipes/pipe.c @@ -279,7 +279,7 @@ errout_with_dev: errout_with_pipe: pipe_free(pipeno); errout: - errno = err; + set_errno(err); return ERROR; } diff --git a/nuttx/drivers/pipes/pipe_common.c b/nuttx/drivers/pipes/pipe_common.c index c5080d6e3..be285464d 100644 --- a/nuttx/drivers/pipes/pipe_common.c +++ b/nuttx/drivers/pipes/pipe_common.c @@ -106,7 +106,7 @@ static void pipecommon_semtake(sem_t *sem) * awakened by a signal. */ - ASSERT(errno == EINTR); + ASSERT(get_errno() == EINTR); } } @@ -203,9 +203,9 @@ int pipecommon_open(FAR struct file *filep) ret = sem_wait(&dev->d_bfsem); if (ret != OK) { - fdbg("sem_wait failed: %d\n", errno); - DEBUGASSERT(errno > 0); - return -errno; + fdbg("sem_wait failed: %d\n", get_errno()); + DEBUGASSERT(get_errno() > 0); + return -get_errno(); } /* If this the first reference on the device, then allocate the buffer */ @@ -265,9 +265,9 @@ int pipecommon_open(FAR struct file *filep) * a signal. */ - fdbg("sem_wait failed: %d\n", errno); - DEBUGASSERT(errno > 0); - ret = -errno; + fdbg("sem_wait failed: %d\n", get_errno()); + DEBUGASSERT(get_errno() > 0); + ret = -get_errno(); /* Immediately close the pipe that we just opened */ diff --git a/nuttx/drivers/pwm.c b/nuttx/drivers/pwm.c index d7c396098..e6d887260 100644 --- a/nuttx/drivers/pwm.c +++ b/nuttx/drivers/pwm.c @@ -157,7 +157,7 @@ static int pwm_open(FAR struct file *filep) ret = sem_wait(&upper->exclsem); if (ret < 0) { - ret = -errno; + ret = -get_errno(); goto errout; } @@ -226,7 +226,7 @@ static int pwm_close(FAR struct file *filep) ret = sem_wait(&upper->exclsem); if (ret < 0) { - ret = -errno; + ret = -get_errno(); goto errout; } @@ -348,7 +348,7 @@ static int pwm_start(FAR struct pwm_upperhalf_s *upper, unsigned int oflags) */ int tmp = sem_wait(&upper->waitsem); - DEBUGASSERT(tmp == OK || errno == EINTR); + DEBUGASSERT(tmp == OK || get_errno() == EINTR); } } else diff --git a/nuttx/drivers/rwbuffer.c b/nuttx/drivers/rwbuffer.c index 7cd72246a..f8c378565 100644 --- a/nuttx/drivers/rwbuffer.c +++ b/nuttx/drivers/rwbuffer.c @@ -100,7 +100,7 @@ static void rwb_semtake(sem_t *sem) * the wait was awakened by a signal. */ - ASSERT(errno == EINTR); + ASSERT(get_errno() == EINTR); } } diff --git a/nuttx/drivers/timer.c b/nuttx/drivers/timer.c index dde059ae0..0fb4c5f8e 100644 --- a/nuttx/drivers/timer.c +++ b/nuttx/drivers/timer.c @@ -148,7 +148,7 @@ static int timer_open(FAR struct file *filep) ret = 1; //sem_wait(&upper->exclsem); if (ret < 0) { - ret = -errno; + ret = -get_errno(); goto errout; } @@ -199,7 +199,7 @@ static int timer_close(FAR struct file *filep) ret = 1; //sem_wait(&upper->exclsem); if (ret < 0) { - ret = -errno; + ret = -get_errno(); goto errout; } diff --git a/nuttx/drivers/watchdog.c b/nuttx/drivers/watchdog.c index 31ae3685b..78fc58df3 100644 --- a/nuttx/drivers/watchdog.c +++ b/nuttx/drivers/watchdog.c @@ -147,7 +147,7 @@ static int wdog_open(FAR struct file *filep) ret = sem_wait(&upper->exclsem); if (ret < 0) { - ret = -errno; + ret = -get_errno(); goto errout; } @@ -198,7 +198,7 @@ static int wdog_close(FAR struct file *filep) ret = sem_wait(&upper->exclsem); if (ret < 0) { - ret = -errno; + ret = -get_errno(); goto errout; } |