2016-07-08 20:55:42 +02:00
.. -*- coding: utf-8; mode: rst -*-
.. _cec-func-poll:
***** *****
cec poll()
***** *****
2016-07-08 20:55:43 +02:00
Name
====
2016-07-08 20:55:42 +02:00
2016-07-08 20:55:43 +02:00
cec-poll - Wait for some event on a file descriptor
2016-07-08 20:55:42 +02:00
Synopsis
========
.. code-block :: c
#include <sys/poll.h>
2016-08-19 12:00:43 -03:00
.. c:function :: int poll( struct pollfd *ufds, unsigned int nfds, int timeout )
2016-07-08 20:55:43 +02:00
Arguments
=========
2016-07-08 20:55:42 +02:00
Description
===========
2016-08-15 17:49:50 -03:00
.. note ::
This documents the proposed CEC API. This API is not yet finalized
2016-07-10 11:57:43 -03:00
and is currently only available as a staging kernel module.
2016-07-08 20:55:42 +02:00
With the :c:func: `poll()` function applications can wait for CEC
events.
On success :c:func: `poll()` returns the number of file descriptors
that have been selected (that is, file descriptors for which the
`` revents `` field of the respective :c:type: `struct pollfd` structure
is non-zero). CEC devices set the `` POLLIN `` and `` POLLRDNORM `` flags in
the `` revents `` field if there are messages in the receive queue. If the
transmit queue has room for new messages, the `` POLLOUT `` and
`` POLLWRNORM `` flags are set. If there are events in the event queue,
then the `` POLLPRI `` flag is set. When the function timed out it returns
a value of zero, on failure it returns -1 and the `` errno `` variable is
set appropriately.
For more details see the :c:func: `poll()` manual page.
Return Value
============
On success, :c:func: `poll()` returns the number structures which have
non-zero `` revents `` fields, or zero if the call timed out. On error -1
is returned, and the `` errno `` variable is set appropriately:
2016-07-08 17:59:27 -03:00
`` EBADF ``
2016-07-08 20:55:42 +02:00
One or more of the `` ufds `` members specify an invalid file
descriptor.
2016-07-08 17:59:27 -03:00
`` EFAULT ``
2016-07-08 20:55:42 +02:00
`` ufds `` references an inaccessible memory area.
2016-07-08 17:59:27 -03:00
`` EINTR ``
2016-07-08 20:55:42 +02:00
The call was interrupted by a signal.
2016-07-08 17:59:27 -03:00
`` EINVAL ``
2016-07-08 20:55:42 +02:00
The `` nfds `` argument is greater than `` OPEN_MAX `` .