Merge remote-tracking branches 'regulator/fix/email' and 'regulator/fix/qcom-smd...
[cascardo/linux.git] / Documentation / media / uapi / cec / cec-func-poll.rst
1 .. -*- coding: utf-8; mode: rst -*-
2
3 .. _cec-func-poll:
4
5 **********
6 cec poll()
7 **********
8
9 Name
10 ====
11
12 cec-poll - Wait for some event on a file descriptor
13
14
15 Synopsis
16 ========
17
18 .. code-block:: c
19
20     #include <sys/poll.h>
21
22
23 .. cpp:function:: int poll( struct pollfd *ufds, unsigned int nfds, int timeout )
24
25 Arguments
26 =========
27
28
29 Description
30 ===========
31
32 .. note:: This documents the proposed CEC API. This API is not yet finalized
33    and is currently only available as a staging kernel module.
34
35 With the :c:func:`poll()` function applications can wait for CEC
36 events.
37
38 On success :c:func:`poll()` returns the number of file descriptors
39 that have been selected (that is, file descriptors for which the
40 ``revents`` field of the respective :c:type:`struct pollfd` structure
41 is non-zero). CEC devices set the ``POLLIN`` and ``POLLRDNORM`` flags in
42 the ``revents`` field if there are messages in the receive queue. If the
43 transmit queue has room for new messages, the ``POLLOUT`` and
44 ``POLLWRNORM`` flags are set. If there are events in the event queue,
45 then the ``POLLPRI`` flag is set. When the function timed out it returns
46 a value of zero, on failure it returns -1 and the ``errno`` variable is
47 set appropriately.
48
49 For more details see the :c:func:`poll()` manual page.
50
51
52 Return Value
53 ============
54
55 On success, :c:func:`poll()` returns the number structures which have
56 non-zero ``revents`` fields, or zero if the call timed out. On error -1
57 is returned, and the ``errno`` variable is set appropriately:
58
59 ``EBADF``
60     One or more of the ``ufds`` members specify an invalid file
61     descriptor.
62
63 ``EFAULT``
64     ``ufds`` references an inaccessible memory area.
65
66 ``EINTR``
67     The call was interrupted by a signal.
68
69 ``EINVAL``
70     The ``nfds`` argument is greater than ``OPEN_MAX``.