]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
To support userspace audio daemons like Virtual OSS, /dev/sndstat is
authorHans Petter Selasky <hselasky@FreeBSD.org>
Tue, 9 Feb 2016 17:09:14 +0000 (17:09 +0000)
committerHans Petter Selasky <hselasky@FreeBSD.org>
Tue, 9 Feb 2016 17:09:14 +0000 (17:09 +0000)
commit8461d581cf1591a56afcd3b36a952066065177bb
treeec2214ed481c12474964e82661ccf4447aabd5f8
parent2668945977725526727c9f3f708dc4d887e0e7a9
To support userspace audio daemons like Virtual OSS, /dev/sndstat is
made writeable by the root user. Userspace audio daemons can add or
update an entry in /dev/sndstat by doing a single system write call to
any /dev/sndstat file descriptor handle. When the audio daemon closes the
file handle or is killed the entry disappears.

While at it, cleanup the sound status code a bit:
- keep the device list sorted to avoid sorting the list every time a
  /dev/sndstat read request is made.
- factor out locking into a pair of locking macros.
- use the sound status lock to protect all per file handle states,
  when generating the output for /dev/sndstat and when removing or
  adding sound status devices. This way sndstat_acquire() and
  sndstat_release() become superfluous and can be removed.

Reviewed by: mav @
Differential Revision: https://reviews.freebsd.org/D5191
sys/dev/sound/pcm/sndstat.c
sys/dev/sound/pcm/sound.c
sys/dev/sound/pcm/sound.h