1.. Permission is granted to copy, distribute and/or modify this 2.. document under the terms of the GNU Free Documentation License, 3.. Version 1.1 or any later version published by the Free Software 4.. Foundation, with no Invariant Sections, no Front-Cover Texts 5.. and no Back-Cover Texts. A copy of the license is included at 6.. Documentation/userspace-api/media/fdl-appendix.rst. 7.. 8.. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections 9 10.. _ca_fopen: 11 12==================== 13Digital TV CA open() 14==================== 15 16Name 17---- 18 19Digital TV CA open() 20 21 22Synopsis 23-------- 24 25.. c:function:: int open(const char *name, int flags) 26 :name: dvb-ca-open 27 28 29Arguments 30--------- 31 32``name`` 33 Name of specific Digital TV CA device. 34 35``flags`` 36 A bit-wise OR of the following flags: 37 38.. tabularcolumns:: |p{2.5cm}|p{15.0cm}| 39 40.. flat-table:: 41 :header-rows: 0 42 :stub-columns: 0 43 :widths: 1 16 44 45 - - ``O_RDONLY`` 46 - read-only access 47 48 - - ``O_RDWR`` 49 - read/write access 50 51 - - ``O_NONBLOCK`` 52 - open in non-blocking mode 53 (blocking mode is the default) 54 55 56Description 57----------- 58 59This system call opens a named ca device (e.g. ``/dev/dvb/adapter?/ca?``) 60for subsequent use. 61 62When an ``open()`` call has succeeded, the device will be ready for use. The 63significance of blocking or non-blocking mode is described in the 64documentation for functions where there is a difference. It does not 65affect the semantics of the ``open()`` call itself. A device opened in 66blocking mode can later be put into non-blocking mode (and vice versa) 67using the ``F_SETFL`` command of the ``fcntl`` system call. This is a 68standard system call, documented in the Linux manual page for fcntl. 69Only one user can open the CA Device in ``O_RDWR`` mode. All other 70attempts to open the device in this mode will fail, and an error code 71will be returned. 72 73 74Return Value 75------------ 76 77 78On success 0 is returned. 79 80On error -1 is returned, and the ``errno`` variable is set 81appropriately. 82 83Generic error codes are described at the 84:ref:`Generic Error Codes <gen-errors>` chapter. 85