A little more clean-up of poll() error handling

This commit is contained in:
Gregory Nutt
2014-09-26 08:25:00 -06:00
parent a05107e7fe
commit 79eeb9f1b5
2 changed files with 19 additions and 19 deletions
+13 -13
View File
@@ -69,18 +69,18 @@
.type gdt_flush, @function .type gdt_flush, @function
gdt_flush: gdt_flush:
movl %eax, 4(%esp) /* Get the pointer to the GDT, passed as a parameter */ movl %eax, 4(%esp) /* Get the pointer to the GDT, passed as a parameter */
lgdt (%eax) /* Load the new GDT pointer */ lgdt (%eax) /* Load the new GDT pointer */
mov $KSEG, %ax /* KSEG is the offset in the GDT to our data segment */ mov $KSEG, %ax /* KSEG is the offset in the GDT to our data segment */
mov %ax, %ds /* Load all data segment selectors */ mov %ax, %ds /* Load all data segment selectors */
mov %ax, %es mov %ax, %es
mov %ax, %fs mov %ax, %fs
mov %ax, %gs mov %ax, %gs
mov %ax, %ss mov %ax, %ss
jmp $0x08, $.Lgflush /* 0x08 is the offset to our code segment: Far jump! */ jmp $0x08, $.Lgflush /* 0x08 is the offset to our code segment: Far jump! */
.Lgflush: .Lgflush:
ret ret
.size gdt_flush, . - gdt_flush .size gdt_flush, . - gdt_flush
/**************************************************************************** /****************************************************************************
@@ -89,8 +89,8 @@ gdt_flush:
.type idt_flush, @function .type idt_flush, @function
idt_flush: idt_flush:
movl %eax, 4(%esp) /* Get the pointer to the IDT, passed as a parameter */ movl %eax, 4(%esp) /* Get the pointer to the IDT, passed as a parameter */
lidt (%eax) /* Load the IDT pointer */ lidt (%eax) /* Load the IDT pointer */
ret ret
.size idt_flush, . - idt_flush .size idt_flush, . - idt_flush
.end .end
+6 -6
View File
@@ -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 * 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: * 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 * 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. * EINVAL - The nfds value exceeds a system limit.
* ENOMEM - There was no space to allocate internal data structures. * ENOMEM - There was no space to allocate internal data structures.
* ENOSYS - One or more of the drivers supporting the file descriptor * 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) if (timeout == 0)
{ {
/* Poll returns immediately whether we have a poll event or not. */ /* Poll returns immediately whether we have a poll event or not. */
ret = sem_trywait(&sem);
} }
else if (timeout > 0) 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; abstime.tv_nsec -= NSEC_PER_SEC;
} }
ret = sem_timedwait(&sem, &abstime); (void)sem_timedwait(&sem, &abstime);
irqrestore(flags); irqrestore(flags);
} }
else else
@@ -336,7 +334,9 @@ int poll(FAR struct pollfd *fds, nfds_t nfds, int timeout)
poll_semtake(&sem); 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); ret = poll_teardown(fds, nfds, &count);
} }