Back to home page

OSCL-LXR

 
 

    


0001 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
0002 .. c:namespace:: MC
0003 
0004 .. _media-func-open:
0005 
0006 ************
0007 media open()
0008 ************
0009 
0010 Name
0011 ====
0012 
0013 media-open - Open a media device
0014 
0015 Synopsis
0016 ========
0017 
0018 .. code-block:: c
0019 
0020     #include <fcntl.h>
0021 
0022 .. c:function:: int open( const char *device_name, int flags )
0023 
0024 Arguments
0025 =========
0026 
0027 ``device_name``
0028     Device to be opened.
0029 
0030 ``flags``
0031     Open flags. Access mode must be either ``O_RDONLY`` or ``O_RDWR``.
0032     Other flags have no effect.
0033 
0034 Description
0035 ===========
0036 
0037 To open a media device applications call :c:func:`open()` with the
0038 desired device name. The function has no side effects; the device
0039 configuration remain unchanged.
0040 
0041 When the device is opened in read-only mode, attempts to modify its
0042 configuration will result in an error, and ``errno`` will be set to
0043 EBADF.
0044 
0045 Return Value
0046 ============
0047 
0048 :c:func:`open()` returns the new file descriptor on success. On error,
0049 -1 is returned, and ``errno`` is set appropriately. Possible error codes
0050 are:
0051 
0052 EACCES
0053     The requested access to the file is not allowed.
0054 
0055 EMFILE
0056     The process already has the maximum number of files open.
0057 
0058 ENFILE
0059     The system limit on the total number of open files has been reached.
0060 
0061 ENOMEM
0062     Insufficient kernel memory was available.
0063 
0064 ENXIO
0065     No device corresponding to this device special file exists.