1 <!-- Copyright (C) 2003 Red Hat, Inc. -->
2 <!-- This material may be distributed only subject to the terms -->
3 <!-- and conditions set forth in the Open Publication License, v1.0 -->
4 <!-- or later (the latest version is presently available at -->
5 <!-- http://www.opencontent.org/openpub/). -->
6 <!-- Distribution of the work or derivative of the work in any -->
7 <!-- standard (paper) book form is prohibited unless prior -->
8 <!-- permission is obtained from the copyright holder. -->
13 ><meta name="MSSmartTagsPreventParsing" content="TRUE">
16 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
19 TITLE="eCos Reference Manual"
20 HREF="ecos-ref.html"><LINK
22 TITLE="TCP/IP Library Reference"
23 HREF="tcpip-library-reference.html"><LINK
26 HREF="net-common-tcpip-manpages-ioctl.html"><LINK
29 HREF="net-common-tcpip-manpages-select.html"></HEAD
40 SUMMARY="Header navigation table"
49 >eCos Reference Manual</TH
57 HREF="net-common-tcpip-manpages-ioctl.html"
65 >Chapter 38. TCP/IP Library Reference</TD
71 HREF="net-common-tcpip-manpages-select.html"
85 NAME="NET-COMMON-TCPIP-MANPAGES-POLL">poll</H1
94 >POLL(2) System Calls Manual POLL(2)
97 poll - synchronous I/O multiplexing
100 #include <poll.h>
103 poll(struct pollfd *fds, int nfds, int timeout);
106 poll() provides a mechanism for reporting I/O conditions across a set of
109 The arguments are as follows:
111 fds Points to an array of pollfd structures, which are defined as:
119 The fd member is an open file descriptor. The events and
120 revents members are bitmasks of conditions to monitor and condi-
121 tions found, respectively.
123 nfds The number of pollfd structures in the array.
125 timeout Maximum interval to wait for the poll to complete, in millisec-
126 onds. If this value is 0, then poll() will return immediately.
127 If this value is INFTIM (-1), poll() will block indefinitely
128 until a condition is found.
130 The calling process sets the events bitmask and poll() sets the revents
131 bitmask. Each call to poll() resets the revents bitmask for accuracy.
132 The condition flags in the bitmasks are defined as:
134 POLLIN Data is available on the file descriptor for reading.
136 POLLNORM Same as POLLIN.
138 POLLPRI Same as POLLIN.
140 POLLOUT Data can be written to the file descriptor without blocking.
142 POLLERR This flag is not used in this implementation and is provided
143 only for source code compatibility.
145 POLLHUP The file descriptor was valid before the polling process and
146 invalid after. Presumably, this means that the file descrip-
147 tor was closed sometime during the poll.
149 POLLNVAL The corresponding file descriptor is invalid.
151 POLLRDNORM Same as POLLIN.
153 POLLRDBAND Same as POLLIN.
155 POLLWRNORM Same as POLLOUT.
157 POLLWRBAND Same as POLLOUT.
159 POLLMSG This flag is not used in this implementation and is provided
160 only for source code compatibility.
162 All flags except POLLIN, POLLOUT, and their synonyms are for use only in
163 the revents member of the pollfd structure. An attempt to set any of
164 these flags in the events member will generate an error condition.
166 In addition to I/O multiplexing, poll() can be used to generate simple
167 timeouts. This functionality may be achieved by passing a null pointer
171 The POLLHUP flag is only a close approximation and may not always be
175 Upon error, poll() returns a -1 and sets the global variable errno to
176 indicate the error. If the timeout interval was reached before any
177 events occurred, a 0 is returned. Otherwise, poll() returns the number
178 of file descriptors for which revents is non-zero.
183 [EINVAL] nfds was either a negative number or greater than the number
184 of available file descriptors.
186 [EINVAL] An invalid flags was set in the events member of the pollfd
189 [EINVAL] The timeout passed to poll() was too large.
191 [EAGAIN] Resource allocation failed inside of poll(). Subsequent calls
192 to poll() may succeed.
194 [EINTR] poll() caught a signal during the polling process.
197 poll(2), select(2), sysconf(3)
200 A poll() system call appeared in AT&T System V UNIX.
202 BSD December 13, 1994 BSD
213 SUMMARY="Footer navigation table"
224 HREF="net-common-tcpip-manpages-ioctl.html"
242 HREF="net-common-tcpip-manpages-select.html"
258 HREF="tcpip-library-reference.html"