summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-09-26 08:25:00 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-09-26 08:25:00 -0600
commitf79721253eb1a0a043b8c59f9abba1e6e590ed3d (patch)
tree9852779f92f184e4d3a583e23ff0442ef0bf2561
parentfcb7bb2b984bc528191b39fb6a436e0af63e7170 (diff)
downloadnuttx-f79721253eb1a0a043b8c59f9abba1e6e590ed3d.tar.gz
nuttx-f79721253eb1a0a043b8c59f9abba1e6e590ed3d.tar.bz2
nuttx-f79721253eb1a0a043b8c59f9abba1e6e590ed3d.zip
A little more clean-up of poll() error handling
-rw-r--r--nuttx/arch/x86/src/i486/i486_utils.S26
-rw-r--r--nuttx/fs/fs_poll.c12
2 files changed, 19 insertions, 19 deletions
diff --git a/nuttx/arch/x86/src/i486/i486_utils.S b/nuttx/arch/x86/src/i486/i486_utils.S
index f40528922..bcde27533 100644
--- a/nuttx/arch/x86/src/i486/i486_utils.S
+++ b/nuttx/arch/x86/src/i486/i486_utils.S
@@ -69,18 +69,18 @@
.type gdt_flush, @function
gdt_flush:
- movl %eax, 4(%esp) /* Get the pointer to the GDT, passed as a parameter */
- lgdt (%eax) /* Load the new GDT pointer */
+ movl %eax, 4(%esp) /* Get the pointer to the GDT, passed as a parameter */
+ lgdt (%eax) /* Load the new GDT pointer */
- mov $KSEG, %ax /* KSEG is the offset in the GDT to our data segment */
- mov %ax, %ds /* Load all data segment selectors */
- mov %ax, %es
- mov %ax, %fs
- mov %ax, %gs
- mov %ax, %ss
- jmp $0x08, $.Lgflush /* 0x08 is the offset to our code segment: Far jump! */
+ mov $KSEG, %ax /* KSEG is the offset in the GDT to our data segment */
+ mov %ax, %ds /* Load all data segment selectors */
+ mov %ax, %es
+ mov %ax, %fs
+ mov %ax, %gs
+ mov %ax, %ss
+ jmp $0x08, $.Lgflush /* 0x08 is the offset to our code segment: Far jump! */
.Lgflush:
- ret
+ ret
.size gdt_flush, . - gdt_flush
/****************************************************************************
@@ -89,8 +89,8 @@ gdt_flush:
.type idt_flush, @function
idt_flush:
- movl %eax, 4(%esp) /* Get the pointer to the IDT, passed as a parameter */
- lidt (%eax) /* Load the IDT pointer */
- ret
+ movl %eax, 4(%esp) /* Get the pointer to the IDT, passed as a parameter */
+ lidt (%eax) /* Load the IDT pointer */
+ ret
.size idt_flush, . - idt_flush
.end
diff --git a/nuttx/fs/fs_poll.c b/nuttx/fs/fs_poll.c
index 8ae0c8909..6396cdf8e 100644
--- a/nuttx/fs/fs_poll.c
+++ b/nuttx/fs/fs_poll.c
@@ -267,9 +267,9 @@ static inline int poll_teardown(FAR struct pollfd *fds, nfds_t nfds, int *count)
* A value of 0 indicates that the call timed out and no file descriptors
* were ready. On error, -1 is returned, and errno is set appropriately:
*
- * EBADF - An invalid file descriptor was given in one of the sets.
+ * EBADF - An invalid file descriptor was given in one of the sets.
* EFAULT - The fds address is invalid
- * EINTR - A signal occurred before any requested event.
+ * EINTR - A signal occurred before any requested event.
* EINVAL - The nfds value exceeds a system limit.
* ENOMEM - There was no space to allocate internal data structures.
* ENOSYS - One or more of the drivers supporting the file descriptor
@@ -292,8 +292,6 @@ int poll(FAR struct pollfd *fds, nfds_t nfds, int timeout)
if (timeout == 0)
{
/* Poll returns immediately whether we have a poll event or not. */
-
- ret = sem_trywait(&sem);
}
else if (timeout > 0)
{
@@ -326,7 +324,7 @@ int poll(FAR struct pollfd *fds, nfds_t nfds, int timeout)
abstime.tv_nsec -= NSEC_PER_SEC;
}
- ret = sem_timedwait(&sem, &abstime);
+ (void)sem_timedwait(&sem, &abstime);
irqrestore(flags);
}
else
@@ -336,7 +334,9 @@ int poll(FAR struct pollfd *fds, nfds_t nfds, int timeout)
poll_semtake(&sem);
}
- /* Teardown the poll operation and get the count of events */
+ /* Teardown the poll operation and get the count of events. Zero will be
+ * returned in the case of a timeout.
+ */
ret = poll_teardown(fds, nfds, &count);
}