105 lines · plain
1.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later2.. c:namespace:: DTV.fe3 4.. _frontend_f_open:5 6***************************7Digital TV frontend open()8***************************9 10Name11====12 13fe-open - Open a frontend device14 15Synopsis16========17 18.. code-block:: c19 20 #include <fcntl.h>21 22.. c:function:: int open( const char *device_name, int flags )23 24Arguments25=========26 27``device_name``28 Device to be opened.29 30``flags``31 Open flags. Access can either be ``O_RDWR`` or ``O_RDONLY``.32 33 Multiple opens are allowed with ``O_RDONLY``. In this mode, only34 query and read ioctls are allowed.35 36 Only one open is allowed in ``O_RDWR``. In this mode, all ioctls are37 allowed.38 39 When the ``O_NONBLOCK`` flag is given, the system calls may return40 ``EAGAIN`` error code when no data is available or when the device41 driver is temporarily busy.42 43 Other flags have no effect.44 45Description46===========47 48This system call opens a named frontend device49(``/dev/dvb/adapter?/frontend?``) for subsequent use. Usually the first50thing to do after a successful open is to find out the frontend type51with :ref:`FE_GET_INFO`.52 53The device can be opened in read-only mode, which only allows monitoring54of device status and statistics, or read/write mode, which allows any55kind of use (e.g. performing tuning operations.)56 57In a system with multiple front-ends, it is usually the case that58multiple devices cannot be open in read/write mode simultaneously. As59long as a front-end device is opened in read/write mode, other open()60calls in read/write mode will either fail or block, depending on whether61non-blocking or blocking mode was specified. A front-end device opened62in blocking mode can later be put into non-blocking mode (and vice63versa) using the F_SETFL command of the fcntl system call. This is a64standard system call, documented in the Linux manual page for fcntl.65When an open() call has succeeded, the device will be ready for use in66the specified mode. This implies that the corresponding hardware is67powered up, and that other front-ends may have been powered down to make68that possible.69 70Return Value71============72 73On success :c:func:`open()` returns the new file descriptor.74On error, -1 is returned, and the ``errno`` variable is set appropriately.75 76Possible error codes are:77 78On success 0 is returned, and :c:type:`ca_slot_info` is filled.79 80On error -1 is returned, and the ``errno`` variable is set81appropriately.82 83.. tabularcolumns:: |p{2.5cm}|p{15.0cm}|84 85.. flat-table::86 :header-rows: 087 :stub-columns: 088 :widths: 1 1689 90 - - ``EPERM``91 - The caller has no permission to access the device.92 93 - - ``EBUSY``94 - The device driver is already in use.95 96 - - ``EMFILE``97 - The process already has the maximum number of files open.98 99 - - ``ENFILE``100 - The limit on the total number of files open on the system has been101 reached.102 103The generic error codes are described at the104:ref:`Generic Error Codes <gen-errors>` chapter.105