1.. Permission is granted to copy, distribute and/or modify this 2.. document under the terms of the GNU Free Documentation License, 3.. Version 1.1 or any later version published by the Free Software 4.. Foundation, with no Invariant Sections, no Front-Cover Texts 5.. and no Back-Cover Texts. A copy of the license is included at 6.. Documentation/userspace-api/media/fdl-appendix.rst. 7.. 8.. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections 9 10.. _app-pri: 11 12******************** 13Application Priority 14******************** 15 16When multiple applications share a device it may be desirable to assign 17them different priorities. Contrary to the traditional "rm -rf /" school 18of thought, a video recording application could for example block other 19applications from changing video controls or switching the current TV 20channel. Another objective is to permit low priority applications 21working in background, which can be preempted by user controlled 22applications and automatically regain control of the device at a later 23time. 24 25Since these features cannot be implemented entirely in user space V4L2 26defines the :ref:`VIDIOC_G_PRIORITY <VIDIOC_G_PRIORITY>` and 27:ref:`VIDIOC_S_PRIORITY <VIDIOC_G_PRIORITY>` ioctls to request and 28query the access priority associate with a file descriptor. Opening a 29device assigns a medium priority, compatible with earlier versions of 30V4L2 and drivers not supporting these ioctls. Applications requiring a 31different priority will usually call :ref:`VIDIOC_S_PRIORITY 32<VIDIOC_G_PRIORITY>` after verifying the device with the 33:ref:`VIDIOC_QUERYCAP` ioctl. 34 35Ioctls changing driver properties, such as 36:ref:`VIDIOC_S_INPUT <VIDIOC_G_INPUT>`, return an ``EBUSY`` error code 37after another application obtained higher priority. 38