Commit | Line | Data |
---|---|---|
5377d91f MH |
1 | .. -*- coding: utf-8; mode: rst -*- |
2 | ||
3 | .. _media-func-open: | |
4 | ||
5 | ************ | |
6 | media open() | |
7 | ************ | |
8 | ||
15e7d615 | 9 | Name |
586027ce | 10 | ==== |
5377d91f | 11 | |
586027ce | 12 | media-open - Open a media device |
5377d91f | 13 | |
15e7d615 MCC |
14 | |
15 | Synopsis | |
5377d91f MH |
16 | ======== |
17 | ||
18 | .. code-block:: c | |
19 | ||
20 | #include <fcntl.h> | |
21 | ||
22 | ||
b7e67f6c | 23 | .. cpp:function:: int open( const char *device_name, int flags ) |
5377d91f | 24 | |
586027ce | 25 | |
15e7d615 | 26 | Arguments |
5377d91f MH |
27 | ========= |
28 | ||
29 | ``device_name`` | |
30 | Device to be opened. | |
31 | ||
32 | ``flags`` | |
33 | Open flags. Access mode must be either ``O_RDONLY`` or ``O_RDWR``. | |
34 | Other flags have no effect. | |
35 | ||
36 | ||
15e7d615 | 37 | Description |
5377d91f MH |
38 | =========== |
39 | ||
8c1cc62a | 40 | To open a media device applications call :ref:`open() <media-func-open>` with the |
5377d91f MH |
41 | desired device name. The function has no side effects; the device |
42 | configuration remain unchanged. | |
43 | ||
44 | When the device is opened in read-only mode, attempts to modify its | |
45 | configuration will result in an error, and ``errno`` will be set to | |
46 | EBADF. | |
47 | ||
48 | ||
15e7d615 | 49 | Return Value |
5377d91f MH |
50 | ============ |
51 | ||
760c7010 | 52 | :ref:`open() <func-open>` returns the new file descriptor on success. On error, |
5377d91f MH |
53 | -1 is returned, and ``errno`` is set appropriately. Possible error codes |
54 | are: | |
55 | ||
56 | EACCES | |
57 | The requested access to the file is not allowed. | |
58 | ||
59 | EMFILE | |
60 | The process already has the maximum number of files open. | |
61 | ||
62 | ENFILE | |
63 | The system limit on the total number of open files has been reached. | |
64 | ||
65 | ENOMEM | |
66 | Insufficient kernel memory was available. | |
67 | ||
68 | ENXIO | |
69 | No device corresponding to this device special file exists. |