From 9f998c7d60a7472c0d5b504810e287c3a5fb8147 Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 18 Nov 2008 23:00:29 +0000 Subject: [PATCH] Add poll() and select() git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1282 42af7a65-404d-4744-a932-0658087f49c3 --- Documentation/NuttxUserGuide.html | 125 +++++++++++++++++++++++++++--- 1 file changed, 115 insertions(+), 10 deletions(-) diff --git a/Documentation/NuttxUserGuide.html b/Documentation/NuttxUserGuide.html index 7d37b73ef1..99ff9563fe 100644 --- a/Documentation/NuttxUserGuide.html +++ b/Documentation/NuttxUserGuide.html @@ -13,7 +13,7 @@

NuttX Operating System

User's Manual

by

Gregory Nutt

-

Last Updated: September 10, 2008

+

Last Updated: November 18, 2008

@@ -5998,14 +5998,23 @@ interface of the same name.

2.11.2 Driver Operations

- + + +

2.11.2.1 fcntl.h

+ - - +

2.11.2.2 unistd.h

+ - - +

2.11.2.3 sys/ioctl.h

+ - + +

2.11.2.4 poll.h

+ +
2.11.2.4.1 poll
+

+ Function Prototype: +

+
+  #include <poll.h>
+  int     poll(struct pollfd *fds, nfds_t nfds, int timeout);
+
+

+ Description: + poll() waits for one of a set of file descriptors to become ready to + perform I/O. If none of the events requested (and no error) has + occurred for any of the file descriptors, then poll() blocks until + one of the events occurs. +

+

+ Input Parameters: +

+ +

+ Returned Values: +

+

+ On success, the number of structures that have nonzero revents fields. + 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: +

+ + +

2.11.2.5 sys/select.h

+ +
2.11.2.5.1 select
+

+ Function Prototype: +

+
+  #include <sys/select.h>
+  int     select(int nfds, FAR fd_set *readfds, FAR fd_set *writefds,
+                 FAR fd_set *exceptfds, FAR struct timeval *timeout);
+
+

+ Description: + select() allows a program to monitor multiple file descriptors, waiting + until one or more of the file descriptors become "ready" for some class + of I/O operation (e.g., input possible). A file descriptor is + considered ready if it is possible to perform the corresponding I/O + operation (e.g., read(2)) without blocking. +

+

+ NOTE: poll() is the fundamental API for performing such monitoring + operation under NuttX. select() is provided for compatibility and + is simply a layer of added logic on top of poll(). As such, select() + is more wasteful of resources and poll() is the recommended API to be + used. +

+

+ Input Parameters: +

+ +

+ Returned Values: +

+

2.11.3 Directory Operations

@@ -7292,6 +7390,7 @@ notify a task when a message is available on a queue.
  • exit
  • FAT File System Support
  • fclose
  • +
  • fcntl.h
  • fdopen
  • feof
  • ferror
  • @@ -7309,7 +7408,7 @@ notify a task when a message is available on a queue.
  • fread
  • fseek
  • fsetpos
  • -
  • fstat(
  • +
  • fstat
  • ftell
  • fwrite
  • getcwd
  • @@ -7343,9 +7442,11 @@ notify a task when a message is available on a queue.
  • open
  • opendir
  • OS Interfaces
  • +
  • pipe
  • -
  • pipe
  • +
  • poll
  • +
  • poll.h
  • printf
  • Pthread Interfaces
  • pthread_attr_destroy
  • @@ -7416,9 +7517,9 @@ notify a task when a message is available on a queue.
  • ROM disk driver
  • ROMFS
  • sched_getparam
  • +
  • sched_get_priority_max
  • -
  • sched_get_priority_max
  • sched_get_priority_min
  • sched_get_rr_interval
  • sched_lockcount
  • @@ -7427,6 +7528,7 @@ notify a task when a message is available on a queue.
  • sched_setscheduler
  • sched_unlock
  • sched_yield
  • +
  • select
  • Counting Semaphore Interfaces
  • sem_close
  • sem_destroy
  • @@ -7460,6 +7562,8 @@ notify a task when a message is available on a queue.
  • Standard I/O
  • stat
  • statfs
  • +
  • sys/select.h
  • +
  • sys/ioctl.h
  • task_activate
  • Task Control Interfaces
  • task_create
  • @@ -7476,6 +7580,7 @@ notify a task when a message is available on a queue.
  • Timers
  • timer_settime
  • ungetc
  • +
  • unistd.h
  • unlink
  • vfprintf
  • vprintf