request-func-ioctl.rst 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. .. SPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-no-invariants-or-later
  2. .. c:namespace:: MC
  3. .. _request-func-ioctl:
  4. ***************
  5. request ioctl()
  6. ***************
  7. Name
  8. ====
  9. request-ioctl - Control a request file descriptor
  10. Synopsis
  11. ========
  12. .. code-block:: c
  13. #include <sys/ioctl.h>
  14. ``int ioctl(int fd, int cmd, void *argp)``
  15. Arguments
  16. =========
  17. ``fd``
  18. File descriptor returned by :ref:`MEDIA_IOC_REQUEST_ALLOC`.
  19. ``cmd``
  20. The request ioctl command code as defined in the media.h header file, for
  21. example :ref:`MEDIA_REQUEST_IOC_QUEUE`.
  22. ``argp``
  23. Pointer to a request-specific structure.
  24. Description
  25. ===========
  26. The :ref:`ioctl() <request-func-ioctl>` function manipulates request
  27. parameters. The argument ``fd`` must be an open file descriptor.
  28. The ioctl ``cmd`` code specifies the request 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 request ioctl commands and
  32. their parameters are located in the media.h header file. All request ioctl
  33. commands, 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. Command-specific error codes are listed in the individual command
  41. descriptions.
  42. When an ioctl that takes an output or read/write parameter fails, the
  43. parameter remains unmodified.