]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - doc/html/ref/net-common-tcpip-manpages-poll.html
Initial revision
[karo-tx-redboot.git] / doc / html / ref / net-common-tcpip-manpages-poll.html
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.               -->
9 <HTML
10 ><HEAD
11 ><TITLE
12 >poll</TITLE
13 ><meta name="MSSmartTagsPreventParsing" content="TRUE">
14 <META
15 NAME="GENERATOR"
16 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
17 "><LINK
18 REL="HOME"
19 TITLE="eCos Reference Manual"
20 HREF="ecos-ref.html"><LINK
21 REL="UP"
22 TITLE="TCP/IP Library Reference"
23 HREF="tcpip-library-reference.html"><LINK
24 REL="PREVIOUS"
25 TITLE="ioctl"
26 HREF="net-common-tcpip-manpages-ioctl.html"><LINK
27 REL="NEXT"
28 TITLE="select"
29 HREF="net-common-tcpip-manpages-select.html"></HEAD
30 ><BODY
31 CLASS="SECT1"
32 BGCOLOR="#FFFFFF"
33 TEXT="#000000"
34 LINK="#0000FF"
35 VLINK="#840084"
36 ALINK="#0000FF"
37 ><DIV
38 CLASS="NAVHEADER"
39 ><TABLE
40 SUMMARY="Header navigation table"
41 WIDTH="100%"
42 BORDER="0"
43 CELLPADDING="0"
44 CELLSPACING="0"
45 ><TR
46 ><TH
47 COLSPAN="3"
48 ALIGN="center"
49 >eCos Reference Manual</TH
50 ></TR
51 ><TR
52 ><TD
53 WIDTH="10%"
54 ALIGN="left"
55 VALIGN="bottom"
56 ><A
57 HREF="net-common-tcpip-manpages-ioctl.html"
58 ACCESSKEY="P"
59 >Prev</A
60 ></TD
61 ><TD
62 WIDTH="80%"
63 ALIGN="center"
64 VALIGN="bottom"
65 >Chapter 38. TCP/IP Library Reference</TD
66 ><TD
67 WIDTH="10%"
68 ALIGN="right"
69 VALIGN="bottom"
70 ><A
71 HREF="net-common-tcpip-manpages-select.html"
72 ACCESSKEY="N"
73 >Next</A
74 ></TD
75 ></TR
76 ></TABLE
77 ><HR
78 ALIGN="LEFT"
79 WIDTH="100%"></DIV
80 ><DIV
81 CLASS="SECT1"
82 ><H1
83 CLASS="SECT1"
84 ><A
85 NAME="NET-COMMON-TCPIP-MANPAGES-POLL">poll</H1
86 ><TABLE
87 BORDER="5"
88 BGCOLOR="#E0E0F0"
89 WIDTH="70%"
90 ><TR
91 ><TD
92 ><PRE
93 CLASS="SCREEN"
94 >POLL(2)                       System Calls Manual                      POLL(2)
95
96 NAME
97      poll - synchronous I/O multiplexing
98
99 SYNOPSIS
100      #include &lt;poll.h&#62;
101
102      int
103      poll(struct pollfd *fds, int nfds, int timeout);
104
105 DESCRIPTION
106      poll() provides a mechanism for reporting I/O conditions across a set of
107      file descriptors.
108
109      The arguments are as follows:
110
111      fds      Points to an array of pollfd structures, which are defined as:
112
113                     struct pollfd {
114                             int fd;
115                             short events;
116                             short revents;
117                     };
118
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.
122
123      nfds     The number of pollfd structures in the array.
124
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.
129
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:
133
134      POLLIN      Data is available on the file descriptor for reading.
135
136      POLLNORM    Same as POLLIN.
137
138      POLLPRI     Same as POLLIN.
139
140      POLLOUT     Data can be written to the file descriptor without blocking.
141
142      POLLERR     This flag is not used in this implementation and is provided
143                  only for source code compatibility.
144
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.
148
149      POLLNVAL    The corresponding file descriptor is invalid.
150
151      POLLRDNORM  Same as POLLIN.
152
153      POLLRDBAND  Same as POLLIN.
154
155      POLLWRNORM  Same as POLLOUT.
156
157      POLLWRBAND  Same as POLLOUT.
158
159      POLLMSG     This flag is not used in this implementation and is provided
160                  only for source code compatibility.
161
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.
165
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
168      for fds.
169
170 WARNINGS
171      The POLLHUP flag is only a close approximation and may not always be
172      accurate.
173
174 RETURN VALUES
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.
179
180 ERRORS
181      poll() will fail if:
182
183      [EINVAL]   nfds was either a negative number or greater than the number
184                 of available file descriptors.
185
186      [EINVAL]   An invalid flags was set in the events member of the pollfd
187                 structure.
188
189      [EINVAL]   The timeout passed to poll() was too large.
190
191      [EAGAIN]   Resource allocation failed inside of poll().  Subsequent calls
192                 to poll() may succeed.
193
194      [EINTR]    poll() caught a signal during the polling process.
195
196 SEE ALSO
197      poll(2), select(2), sysconf(3)
198
199 HISTORY
200      A poll() system call appeared in AT&amp;T System V UNIX.
201
202 BSD                            December 13, 1994                           BSD
203     </PRE
204 ></TD
205 ></TR
206 ></TABLE
207 ></DIV
208 ><DIV
209 CLASS="NAVFOOTER"
210 ><HR
211 ALIGN="LEFT"
212 WIDTH="100%"><TABLE
213 SUMMARY="Footer navigation table"
214 WIDTH="100%"
215 BORDER="0"
216 CELLPADDING="0"
217 CELLSPACING="0"
218 ><TR
219 ><TD
220 WIDTH="33%"
221 ALIGN="left"
222 VALIGN="top"
223 ><A
224 HREF="net-common-tcpip-manpages-ioctl.html"
225 ACCESSKEY="P"
226 >Prev</A
227 ></TD
228 ><TD
229 WIDTH="34%"
230 ALIGN="center"
231 VALIGN="top"
232 ><A
233 HREF="ecos-ref.html"
234 ACCESSKEY="H"
235 >Home</A
236 ></TD
237 ><TD
238 WIDTH="33%"
239 ALIGN="right"
240 VALIGN="top"
241 ><A
242 HREF="net-common-tcpip-manpages-select.html"
243 ACCESSKEY="N"
244 >Next</A
245 ></TD
246 ></TR
247 ><TR
248 ><TD
249 WIDTH="33%"
250 ALIGN="left"
251 VALIGN="top"
252 >ioctl</TD
253 ><TD
254 WIDTH="34%"
255 ALIGN="center"
256 VALIGN="top"
257 ><A
258 HREF="tcpip-library-reference.html"
259 ACCESSKEY="U"
260 >Up</A
261 ></TD
262 ><TD
263 WIDTH="33%"
264 ALIGN="right"
265 VALIGN="top"
266 >select</TD
267 ></TR
268 ></TABLE
269 ></DIV
270 ></BODY
271 ></HTML
272 >