1 .. This file is dual-licensed: you can use it either under the terms
2 .. of the GPL 2.0 or the GFDL 1.1+ license, at your option. Note that this
3 .. dual licensing only applies to this file, and not this project as a
6 .. a) This file is free software; you can redistribute it and/or
7 .. modify it under the terms of the GNU General Public License as
8 .. published by the Free Software Foundation version 2 of
11 .. This file is distributed in the hope that it will be useful,
12 .. but WITHOUT ANY WARRANTY; without even the implied warranty of
13 .. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 .. GNU General Public License for more details.
18 .. b) Permission is granted to copy, distribute and/or modify this
19 .. document under the terms of the GNU Free Documentation License,
20 .. Version 1.1 or any later version published by the Free Software
21 .. Foundation, with no Invariant Sections, no Front-Cover Texts
22 .. and no Back-Cover Texts. A copy of the license is included at
23 .. Documentation/userspace-api/media/fdl-appendix.rst.
25 .. TODO: replace it to GPL-2.0 OR GFDL-1.1-or-later WITH no-invariant-sections
27 .. _request-func-poll:
36 request-poll - Wait for some event on a file descriptor
47 .. c:function:: int poll( struct pollfd *ufds, unsigned int nfds, int timeout )
54 List of file descriptor events to be watched
57 Number of file descriptor events at the \*ufds array
60 Timeout to wait for events
66 With the :c:func:`poll() <request-func-poll>` function applications can wait
67 for a request to complete.
69 On success :c:func:`poll() <request-func-poll>` returns the number of file
70 descriptors that have been selected (that is, file descriptors for which the
71 ``revents`` field of the respective struct :c:type:`pollfd`
72 is non-zero). Request file descriptor set the ``POLLPRI`` flag in ``revents``
73 when the request was completed. When the function times out it returns
74 a value of zero, on failure it returns -1 and the ``errno`` variable is
77 Attempting to poll for a request that is not yet queued will
78 set the ``POLLERR`` flag in ``revents``.
84 On success, :c:func:`poll() <request-func-poll>` returns the number of
85 structures which have non-zero ``revents`` fields, or zero if the call
86 timed out. On error -1 is returned, and the ``errno`` variable is set
90 One or more of the ``ufds`` members specify an invalid file
94 ``ufds`` references an inaccessible memory area.
97 The call was interrupted by a signal.
100 The ``nfds`` value exceeds the ``RLIMIT_NOFILE`` value. Use
101 ``getrlimit()`` to obtain this value.