1*4882a593Smuzhiyun.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 2*4882a593Smuzhiyun.. c:namespace:: DTV.ca 3*4882a593Smuzhiyun 4*4882a593Smuzhiyun.. _ca_fopen: 5*4882a593Smuzhiyun 6*4882a593Smuzhiyun==================== 7*4882a593SmuzhiyunDigital TV CA open() 8*4882a593Smuzhiyun==================== 9*4882a593Smuzhiyun 10*4882a593SmuzhiyunName 11*4882a593Smuzhiyun---- 12*4882a593Smuzhiyun 13*4882a593SmuzhiyunDigital TV CA open() 14*4882a593Smuzhiyun 15*4882a593SmuzhiyunSynopsis 16*4882a593Smuzhiyun-------- 17*4882a593Smuzhiyun 18*4882a593Smuzhiyun.. c:function:: int open(const char *name, int flags) 19*4882a593Smuzhiyun 20*4882a593SmuzhiyunArguments 21*4882a593Smuzhiyun--------- 22*4882a593Smuzhiyun 23*4882a593Smuzhiyun``name`` 24*4882a593Smuzhiyun Name of specific Digital TV CA device. 25*4882a593Smuzhiyun 26*4882a593Smuzhiyun``flags`` 27*4882a593Smuzhiyun A bit-wise OR of the following flags: 28*4882a593Smuzhiyun 29*4882a593Smuzhiyun.. tabularcolumns:: |p{2.5cm}|p{15.0cm}| 30*4882a593Smuzhiyun 31*4882a593Smuzhiyun.. flat-table:: 32*4882a593Smuzhiyun :header-rows: 0 33*4882a593Smuzhiyun :stub-columns: 0 34*4882a593Smuzhiyun :widths: 1 16 35*4882a593Smuzhiyun 36*4882a593Smuzhiyun - - ``O_RDONLY`` 37*4882a593Smuzhiyun - read-only access 38*4882a593Smuzhiyun 39*4882a593Smuzhiyun - - ``O_RDWR`` 40*4882a593Smuzhiyun - read/write access 41*4882a593Smuzhiyun 42*4882a593Smuzhiyun - - ``O_NONBLOCK`` 43*4882a593Smuzhiyun - open in non-blocking mode 44*4882a593Smuzhiyun (blocking mode is the default) 45*4882a593Smuzhiyun 46*4882a593SmuzhiyunDescription 47*4882a593Smuzhiyun----------- 48*4882a593Smuzhiyun 49*4882a593SmuzhiyunThis system call opens a named ca device (e.g. ``/dev/dvb/adapter?/ca?``) 50*4882a593Smuzhiyunfor subsequent use. 51*4882a593Smuzhiyun 52*4882a593SmuzhiyunWhen an ``open()`` call has succeeded, the device will be ready for use. The 53*4882a593Smuzhiyunsignificance of blocking or non-blocking mode is described in the 54*4882a593Smuzhiyundocumentation for functions where there is a difference. It does not 55*4882a593Smuzhiyunaffect the semantics of the ``open()`` call itself. A device opened in 56*4882a593Smuzhiyunblocking mode can later be put into non-blocking mode (and vice versa) 57*4882a593Smuzhiyunusing the ``F_SETFL`` command of the ``fcntl`` system call. This is a 58*4882a593Smuzhiyunstandard system call, documented in the Linux manual page for fcntl. 59*4882a593SmuzhiyunOnly one user can open the CA Device in ``O_RDWR`` mode. All other 60*4882a593Smuzhiyunattempts to open the device in this mode will fail, and an error code 61*4882a593Smuzhiyunwill be returned. 62*4882a593Smuzhiyun 63*4882a593SmuzhiyunReturn Value 64*4882a593Smuzhiyun------------ 65*4882a593Smuzhiyun 66*4882a593SmuzhiyunOn success 0 is returned. 67*4882a593Smuzhiyun 68*4882a593SmuzhiyunOn error -1 is returned, and the ``errno`` variable is set 69*4882a593Smuzhiyunappropriately. 70*4882a593Smuzhiyun 71*4882a593SmuzhiyunGeneric error codes are described at the 72*4882a593Smuzhiyun:ref:`Generic Error Codes <gen-errors>` chapter. 73