media-func-open.rst 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
  2. .. c:namespace:: MC
  3. .. _media-func-open:
  4. ************
  5. media open()
  6. ************
  7. Name
  8. ====
  9. media-open - Open a media device
  10. Synopsis
  11. ========
  12. .. code-block:: c
  13. #include <fcntl.h>
  14. .. c:function:: int open( const char *device_name, int flags )
  15. Arguments
  16. =========
  17. ``device_name``
  18. Device to be opened.
  19. ``flags``
  20. Open flags. Access mode must be either ``O_RDONLY`` or ``O_RDWR``.
  21. Other flags have no effect.
  22. Description
  23. ===========
  24. To open a media device applications call :c:func:`open()` with the
  25. desired device name. The function has no side effects; the device
  26. configuration remain unchanged.
  27. When the device is opened in read-only mode, attempts to modify its
  28. configuration will result in an error, and ``errno`` will be set to
  29. EBADF.
  30. Return Value
  31. ============
  32. :c:func:`open()` returns the new file descriptor on success. On error,
  33. -1 is returned, and ``errno`` is set appropriately. Possible error codes
  34. are:
  35. EACCES
  36. The requested access to the file is not allowed.
  37. EMFILE
  38. The process already has the maximum number of files open.
  39. ENFILE
  40. The system limit on the total number of open files has been reached.
  41. ENOMEM
  42. Insufficient kernel memory was available.
  43. ENXIO
  44. No device corresponding to this device special file exists.