18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 28c2ecf20Sopenharmony_ci.. c:namespace:: DTV.ca 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci.. _ca_fopen: 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci==================== 78c2ecf20Sopenharmony_ciDigital TV CA open() 88c2ecf20Sopenharmony_ci==================== 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ciName 118c2ecf20Sopenharmony_ci---- 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ciDigital TV CA open() 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ciSynopsis 168c2ecf20Sopenharmony_ci-------- 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci.. c:function:: int open(const char *name, int flags) 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ciArguments 218c2ecf20Sopenharmony_ci--------- 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci``name`` 248c2ecf20Sopenharmony_ci Name of specific Digital TV CA device. 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci``flags`` 278c2ecf20Sopenharmony_ci A bit-wise OR of the following flags: 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{2.5cm}|p{15.0cm}| 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci.. flat-table:: 328c2ecf20Sopenharmony_ci :header-rows: 0 338c2ecf20Sopenharmony_ci :stub-columns: 0 348c2ecf20Sopenharmony_ci :widths: 1 16 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci - - ``O_RDONLY`` 378c2ecf20Sopenharmony_ci - read-only access 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci - - ``O_RDWR`` 408c2ecf20Sopenharmony_ci - read/write access 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci - - ``O_NONBLOCK`` 438c2ecf20Sopenharmony_ci - open in non-blocking mode 448c2ecf20Sopenharmony_ci (blocking mode is the default) 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ciDescription 478c2ecf20Sopenharmony_ci----------- 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ciThis system call opens a named ca device (e.g. ``/dev/dvb/adapter?/ca?``) 508c2ecf20Sopenharmony_cifor subsequent use. 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ciWhen an ``open()`` call has succeeded, the device will be ready for use. The 538c2ecf20Sopenharmony_cisignificance of blocking or non-blocking mode is described in the 548c2ecf20Sopenharmony_cidocumentation for functions where there is a difference. It does not 558c2ecf20Sopenharmony_ciaffect the semantics of the ``open()`` call itself. A device opened in 568c2ecf20Sopenharmony_ciblocking mode can later be put into non-blocking mode (and vice versa) 578c2ecf20Sopenharmony_ciusing the ``F_SETFL`` command of the ``fcntl`` system call. This is a 588c2ecf20Sopenharmony_cistandard system call, documented in the Linux manual page for fcntl. 598c2ecf20Sopenharmony_ciOnly one user can open the CA Device in ``O_RDWR`` mode. All other 608c2ecf20Sopenharmony_ciattempts to open the device in this mode will fail, and an error code 618c2ecf20Sopenharmony_ciwill be returned. 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ciReturn Value 648c2ecf20Sopenharmony_ci------------ 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ciOn success 0 is returned. 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ciOn error -1 is returned, and the ``errno`` variable is set 698c2ecf20Sopenharmony_ciappropriately. 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_ciGeneric error codes are described at the 728c2ecf20Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter. 73