Back to home page

OSCL-LXR

 
 

    


0001 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
0002 .. c:namespace:: CEC
0003 
0004 .. _cec-func-poll:
0005 
0006 **********
0007 cec poll()
0008 **********
0009 
0010 Name
0011 ====
0012 
0013 cec-poll - Wait for some event on a file descriptor
0014 
0015 Synopsis
0016 ========
0017 
0018 .. code-block:: c
0019 
0020     #include <sys/poll.h>
0021 
0022 .. c:function:: int poll( struct pollfd *ufds, unsigned int nfds, int timeout )
0023 
0024 Arguments
0025 =========
0026 
0027 ``ufds``
0028    List of FD events to be watched
0029 
0030 ``nfds``
0031    Number of FD events at the \*ufds array
0032 
0033 ``timeout``
0034    Timeout to wait for events
0035 
0036 Description
0037 ===========
0038 
0039 With the :c:func:`poll()` function applications can wait for CEC
0040 events.
0041 
0042 On success :c:func:`poll()` returns the number of file descriptors
0043 that have been selected (that is, file descriptors for which the
0044 ``revents`` field of the respective struct :c:type:`pollfd`
0045 is non-zero). CEC devices set the ``POLLIN`` and ``POLLRDNORM`` flags in
0046 the ``revents`` field if there are messages in the receive queue. If the
0047 transmit queue has room for new messages, the ``POLLOUT`` and
0048 ``POLLWRNORM`` flags are set. If there are events in the event queue,
0049 then the ``POLLPRI`` flag is set. When the function times out it returns
0050 a value of zero, on failure it returns -1 and the ``errno`` variable is
0051 set appropriately.
0052 
0053 For more details see the :c:func:`poll()` manual page.
0054 
0055 Return Value
0056 ============
0057 
0058 On success, :c:func:`poll()` returns the number structures which have
0059 non-zero ``revents`` fields, or zero if the call timed out. On error -1
0060 is returned, and the ``errno`` variable is set appropriately:
0061 
0062 ``EBADF``
0063     One or more of the ``ufds`` members specify an invalid file
0064     descriptor.
0065 
0066 ``EFAULT``
0067     ``ufds`` references an inaccessible memory area.
0068 
0069 ``EINTR``
0070     The call was interrupted by a signal.
0071 
0072 ``EINVAL``
0073     The ``nfds`` value exceeds the ``RLIMIT_NOFILE`` value. Use
0074     ``getrlimit()`` to obtain this value.