Mauro Carvalho Chehab | 059b1c5 | 2020-08-26 09:03:09 +0200 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later |
Mauro Carvalho Chehab | 937e680 | 2020-09-24 16:57:41 +0200 | [diff] [blame] | 2 | .. c:namespace:: MC |
Mauro Carvalho Chehab | 54f38fc | 2020-03-04 10:21:39 +0100 | [diff] [blame] | 3 | |
| 4 | .. _media-func-close: |
| 5 | |
| 6 | ************* |
| 7 | media close() |
| 8 | ************* |
| 9 | |
| 10 | Name |
| 11 | ==== |
| 12 | |
| 13 | media-close - Close a media device |
| 14 | |
Mauro Carvalho Chehab | 54f38fc | 2020-03-04 10:21:39 +0100 | [diff] [blame] | 15 | Synopsis |
| 16 | ======== |
| 17 | |
| 18 | .. code-block:: c |
| 19 | |
| 20 | #include <unistd.h> |
| 21 | |
Mauro Carvalho Chehab | 54f38fc | 2020-03-04 10:21:39 +0100 | [diff] [blame] | 22 | .. c:function:: int close( int fd ) |
Mauro Carvalho Chehab | 54f38fc | 2020-03-04 10:21:39 +0100 | [diff] [blame] | 23 | |
| 24 | Arguments |
| 25 | ========= |
| 26 | |
| 27 | ``fd`` |
Mauro Carvalho Chehab | 937e680 | 2020-09-24 16:57:41 +0200 | [diff] [blame] | 28 | File descriptor returned by :c:func:`open()`. |
Mauro Carvalho Chehab | 54f38fc | 2020-03-04 10:21:39 +0100 | [diff] [blame] | 29 | |
| 30 | Description |
| 31 | =========== |
| 32 | |
| 33 | Closes the media device. Resources associated with the file descriptor |
| 34 | are freed. The device configuration remain unchanged. |
| 35 | |
Mauro Carvalho Chehab | 54f38fc | 2020-03-04 10:21:39 +0100 | [diff] [blame] | 36 | Return Value |
| 37 | ============ |
| 38 | |
Mauro Carvalho Chehab | 937e680 | 2020-09-24 16:57:41 +0200 | [diff] [blame] | 39 | :c:func:`close()` returns 0 on success. On error, -1 is returned, and |
Mauro Carvalho Chehab | 54f38fc | 2020-03-04 10:21:39 +0100 | [diff] [blame] | 40 | ``errno`` is set appropriately. Possible error codes are: |
| 41 | |
| 42 | EBADF |
| 43 | ``fd`` is not a valid open file descriptor. |