cec-func-poll.rst 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. .. -*- coding: utf-8; mode: rst -*-
  2. .. _cec-func-poll:
  3. **********
  4. cec poll()
  5. **********
  6. Name
  7. ====
  8. cec-poll - Wait for some event on a file descriptor
  9. Synopsis
  10. ========
  11. .. code-block:: c
  12. #include <sys/poll.h>
  13. .. c:function:: int poll( struct pollfd *ufds, unsigned int nfds, int timeout )
  14. :name: cec-poll
  15. Arguments
  16. =========
  17. ``ufds``
  18. List of FD events to be watched
  19. ``nfds``
  20. Number of FD efents at the \*ufds array
  21. ``timeout``
  22. Timeout to wait for events
  23. Description
  24. ===========
  25. With the :c:func:`poll()` function applications can wait for CEC
  26. events.
  27. On success :c:func:`poll()` returns the number of file descriptors
  28. that have been selected (that is, file descriptors for which the
  29. ``revents`` field of the respective struct :c:type:`pollfd`
  30. is non-zero). CEC devices set the ``POLLIN`` and ``POLLRDNORM`` flags in
  31. the ``revents`` field if there are messages in the receive queue. If the
  32. transmit queue has room for new messages, the ``POLLOUT`` and
  33. ``POLLWRNORM`` flags are set. If there are events in the event queue,
  34. then the ``POLLPRI`` flag is set. When the function timed out it returns
  35. a value of zero, on failure it returns -1 and the ``errno`` variable is
  36. set appropriately.
  37. For more details see the :c:func:`poll()` manual page.
  38. Return Value
  39. ============
  40. On success, :c:func:`poll()` returns the number structures which have
  41. non-zero ``revents`` fields, or zero if the call timed out. On error -1
  42. is returned, and the ``errno`` variable is set appropriately:
  43. ``EBADF``
  44. One or more of the ``ufds`` members specify an invalid file
  45. descriptor.
  46. ``EFAULT``
  47. ``ufds`` references an inaccessible memory area.
  48. ``EINTR``
  49. The call was interrupted by a signal.
  50. ``EINVAL``
  51. The ``nfds`` argument is greater than ``OPEN_MAX``.