0001 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
0002 .. c:namespace:: DTV.ca
0003
0004 .. _ca_fopen:
0005
0006 ====================
0007 Digital TV CA open()
0008 ====================
0009
0010 Name
0011 ----
0012
0013 Digital TV CA open()
0014
0015 Synopsis
0016 --------
0017
0018 .. c:function:: int open(const char *name, int flags)
0019
0020 Arguments
0021 ---------
0022
0023 ``name``
0024 Name of specific Digital TV CA device.
0025
0026 ``flags``
0027 A bit-wise OR of the following flags:
0028
0029 .. tabularcolumns:: |p{2.5cm}|p{15.0cm}|
0030
0031 .. flat-table::
0032 :header-rows: 0
0033 :stub-columns: 0
0034 :widths: 1 16
0035
0036 - - ``O_RDONLY``
0037 - read-only access
0038
0039 - - ``O_RDWR``
0040 - read/write access
0041
0042 - - ``O_NONBLOCK``
0043 - open in non-blocking mode
0044 (blocking mode is the default)
0045
0046 Description
0047 -----------
0048
0049 This system call opens a named ca device (e.g. ``/dev/dvb/adapter?/ca?``)
0050 for subsequent use.
0051
0052 When an ``open()`` call has succeeded, the device will be ready for use. The
0053 significance of blocking or non-blocking mode is described in the
0054 documentation for functions where there is a difference. It does not
0055 affect the semantics of the ``open()`` call itself. A device opened in
0056 blocking mode can later be put into non-blocking mode (and vice versa)
0057 using the ``F_SETFL`` command of the ``fcntl`` system call. This is a
0058 standard system call, documented in the Linux manual page for fcntl.
0059 Only one user can open the CA Device in ``O_RDWR`` mode. All other
0060 attempts to open the device in this mode will fail, and an error code
0061 will be returned.
0062
0063 Return Value
0064 ------------
0065
0066 On success 0 is returned.
0067
0068 On error -1 is returned, and the ``errno`` variable is set
0069 appropriately.
0070
0071 Generic error codes are described at the
0072 :ref:`Generic Error Codes <gen-errors>` chapter.