cec-func-poll.rst 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. .. note::
  26. This documents the proposed CEC API. This API is not yet finalized
  27. and is currently only available as a staging kernel module.
  28. With the :c:func:`poll()` function applications can wait for CEC
  29. events.
  30. On success :c:func:`poll()` returns the number of file descriptors
  31. that have been selected (that is, file descriptors for which the
  32. ``revents`` field of the respective struct :c:type:`pollfd`
  33. is non-zero). CEC devices set the ``POLLIN`` and ``POLLRDNORM`` flags in
  34. the ``revents`` field if there are messages in the receive queue. If the
  35. transmit queue has room for new messages, the ``POLLOUT`` and
  36. ``POLLWRNORM`` flags are set. If there are events in the event queue,
  37. then the ``POLLPRI`` flag is set. When the function timed out it returns
  38. a value of zero, on failure it returns -1 and the ``errno`` variable is
  39. set appropriately.
  40. For more details see the :c:func:`poll()` manual page.
  41. Return Value
  42. ============
  43. On success, :c:func:`poll()` returns the number structures which have
  44. non-zero ``revents`` fields, or zero if the call timed out. On error -1
  45. is returned, and the ``errno`` variable is set appropriately:
  46. ``EBADF``
  47. One or more of the ``ufds`` members specify an invalid file
  48. descriptor.
  49. ``EFAULT``
  50. ``ufds`` references an inaccessible memory area.
  51. ``EINTR``
  52. The call was interrupted by a signal.
  53. ``EINVAL``
  54. The ``nfds`` argument is greater than ``OPEN_MAX``.