media-func-ioctl.rst 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
  2. .. c:namespace:: MC
  3. .. _media-func-ioctl:
  4. *************
  5. media ioctl()
  6. *************
  7. Name
  8. ====
  9. media-ioctl - Control a media device
  10. Synopsis
  11. ========
  12. .. code-block:: c
  13. #include <sys/ioctl.h>
  14. ``int ioctl(int fd, int request, void *argp)``
  15. Arguments
  16. =========
  17. ``fd``
  18. File descriptor returned by :c:func:`open()`.
  19. ``request``
  20. Media ioctl request code as defined in the media.h header file, for
  21. example MEDIA_IOC_SETUP_LINK.
  22. ``argp``
  23. Pointer to a request-specific structure.
  24. Description
  25. ===========
  26. The :ref:`ioctl() <media-func-ioctl>` function manipulates media device
  27. parameters. The argument ``fd`` must be an open file descriptor.
  28. The ioctl ``request`` code specifies the media function to be called. It
  29. has encoded in it whether the argument is an input, output or read/write
  30. parameter, and the size of the argument ``argp`` in bytes.
  31. Macros and structures definitions specifying media ioctl requests and
  32. their parameters are located in the media.h header file. All media ioctl
  33. requests, their respective function and parameters are specified in
  34. :ref:`media-user-func`.
  35. Return Value
  36. ============
  37. On success 0 is returned, on error -1 and the ``errno`` variable is set
  38. appropriately. The generic error codes are described at the
  39. :ref:`Generic Error Codes <gen-errors>` chapter.
  40. Request-specific error codes are listed in the individual requests
  41. descriptions.
  42. When an ioctl that takes an output or read/write parameter fails, the
  43. parameter remains unmodified.