1059b1c5bSMauro Carvalho Chehab.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 2f9b2e8aaSMauro Carvalho Chehab.. c:namespace:: DTV.ca 354f38fcaSMauro Carvalho Chehab 454f38fcaSMauro Carvalho Chehab.. _ca_fopen: 554f38fcaSMauro Carvalho Chehab 654f38fcaSMauro Carvalho Chehab==================== 754f38fcaSMauro Carvalho ChehabDigital TV CA open() 854f38fcaSMauro Carvalho Chehab==================== 954f38fcaSMauro Carvalho Chehab 1054f38fcaSMauro Carvalho ChehabName 1154f38fcaSMauro Carvalho Chehab---- 1254f38fcaSMauro Carvalho Chehab 1354f38fcaSMauro Carvalho ChehabDigital TV CA open() 1454f38fcaSMauro Carvalho Chehab 1554f38fcaSMauro Carvalho ChehabSynopsis 1654f38fcaSMauro Carvalho Chehab-------- 1754f38fcaSMauro Carvalho Chehab 1854f38fcaSMauro Carvalho Chehab.. c:function:: int open(const char *name, int flags) 1954f38fcaSMauro Carvalho Chehab 2054f38fcaSMauro Carvalho ChehabArguments 2154f38fcaSMauro Carvalho Chehab--------- 2254f38fcaSMauro Carvalho Chehab 2354f38fcaSMauro Carvalho Chehab``name`` 2454f38fcaSMauro Carvalho Chehab Name of specific Digital TV CA device. 2554f38fcaSMauro Carvalho Chehab 2654f38fcaSMauro Carvalho Chehab``flags`` 2754f38fcaSMauro Carvalho Chehab A bit-wise OR of the following flags: 2854f38fcaSMauro Carvalho Chehab 2954f38fcaSMauro Carvalho Chehab.. tabularcolumns:: |p{2.5cm}|p{15.0cm}| 3054f38fcaSMauro Carvalho Chehab 3154f38fcaSMauro Carvalho Chehab.. flat-table:: 3254f38fcaSMauro Carvalho Chehab :header-rows: 0 3354f38fcaSMauro Carvalho Chehab :stub-columns: 0 3454f38fcaSMauro Carvalho Chehab :widths: 1 16 3554f38fcaSMauro Carvalho Chehab 3654f38fcaSMauro Carvalho Chehab - - ``O_RDONLY`` 3754f38fcaSMauro Carvalho Chehab - read-only access 3854f38fcaSMauro Carvalho Chehab 3954f38fcaSMauro Carvalho Chehab - - ``O_RDWR`` 4054f38fcaSMauro Carvalho Chehab - read/write access 4154f38fcaSMauro Carvalho Chehab 4254f38fcaSMauro Carvalho Chehab - - ``O_NONBLOCK`` 4354f38fcaSMauro Carvalho Chehab - open in non-blocking mode 4454f38fcaSMauro Carvalho Chehab (blocking mode is the default) 4554f38fcaSMauro Carvalho Chehab 4654f38fcaSMauro Carvalho ChehabDescription 4754f38fcaSMauro Carvalho Chehab----------- 4854f38fcaSMauro Carvalho Chehab 4954f38fcaSMauro Carvalho ChehabThis system call opens a named ca device (e.g. ``/dev/dvb/adapter?/ca?``) 5054f38fcaSMauro Carvalho Chehabfor subsequent use. 5154f38fcaSMauro Carvalho Chehab 5254f38fcaSMauro Carvalho ChehabWhen an ``open()`` call has succeeded, the device will be ready for use. The 5354f38fcaSMauro Carvalho Chehabsignificance of blocking or non-blocking mode is described in the 5454f38fcaSMauro Carvalho Chehabdocumentation for functions where there is a difference. It does not 5554f38fcaSMauro Carvalho Chehabaffect the semantics of the ``open()`` call itself. A device opened in 5654f38fcaSMauro Carvalho Chehabblocking mode can later be put into non-blocking mode (and vice versa) 5754f38fcaSMauro Carvalho Chehabusing the ``F_SETFL`` command of the ``fcntl`` system call. This is a 5854f38fcaSMauro Carvalho Chehabstandard system call, documented in the Linux manual page for fcntl. 5954f38fcaSMauro Carvalho ChehabOnly one user can open the CA Device in ``O_RDWR`` mode. All other 6054f38fcaSMauro Carvalho Chehabattempts to open the device in this mode will fail, and an error code 6154f38fcaSMauro Carvalho Chehabwill be returned. 6254f38fcaSMauro Carvalho Chehab 6354f38fcaSMauro Carvalho ChehabReturn Value 6454f38fcaSMauro Carvalho Chehab------------ 6554f38fcaSMauro Carvalho Chehab 6654f38fcaSMauro Carvalho ChehabOn success 0 is returned. 6754f38fcaSMauro Carvalho Chehab 6854f38fcaSMauro Carvalho ChehabOn error -1 is returned, and the ``errno`` variable is set 6954f38fcaSMauro Carvalho Chehabappropriately. 7054f38fcaSMauro Carvalho Chehab 7154f38fcaSMauro Carvalho ChehabGeneric error codes are described at the 7254f38fcaSMauro Carvalho Chehab:ref:`Generic Error Codes <gen-errors>` chapter. 73