[media] doc-rst: linux_tv CEC part, DocBook to reST migration
[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 *man cec-poll(2)*
10
11 Wait for some event on a file descriptor
12
13
14 Synopsis
15 ========
16
17 .. code-block:: c
18
19     #include <sys/poll.h>
20
21
22 .. c:function:: int poll( struct pollfd *ufds, unsigned int nfds, int timeout )
23
24 Description
25 ===========
26
27 Note: this documents the proposed CEC API. This API is not yet finalized
28 and is currently only available as a staging kernel module.
29
30 With the :c:func:`poll()` function applications can wait for CEC
31 events.
32
33 On success :c:func:`poll()` returns the number of file descriptors
34 that have been selected (that is, file descriptors for which the
35 ``revents`` field of the respective :c:type:`struct pollfd` structure
36 is non-zero). CEC devices set the ``POLLIN`` and ``POLLRDNORM`` flags in
37 the ``revents`` field if there are messages in the receive queue. If the
38 transmit queue has room for new messages, the ``POLLOUT`` and
39 ``POLLWRNORM`` flags are set. If there are events in the event queue,
40 then the ``POLLPRI`` flag is set. When the function timed out it returns
41 a value of zero, on failure it returns -1 and the ``errno`` variable is
42 set appropriately.
43
44 For more details see the :c:func:`poll()` manual page.
45
46
47 Return Value
48 ============
49
50 On success, :c:func:`poll()` returns the number structures which have
51 non-zero ``revents`` fields, or zero if the call timed out. On error -1
52 is returned, and the ``errno`` variable is set appropriately:
53
54 EBADF
55     One or more of the ``ufds`` members specify an invalid file
56     descriptor.
57
58 EFAULT
59     ``ufds`` references an inaccessible memory area.
60
61 EINTR
62     The call was interrupted by a signal.
63
64 EINVAL
65     The ``nfds`` argument is greater than ``OPEN_MAX``.
66
67
68 .. ------------------------------------------------------------------------------
69 .. This file was automatically converted from DocBook-XML with the dbxml
70 .. library (https://github.com/return42/sphkerneldoc). The origin XML comes
71 .. from the linux kernel, refer to:
72 ..
73 .. * https://github.com/torvalds/linux/tree/master/Documentation/DocBook
74 .. ------------------------------------------------------------------------------