Page MenuHomeFreeBSD

Make /dev/sndstat writeable
ClosedPublic

Authored by hselasky on Feb 4 2016, 1:39 PM.
Tags
None
Referenced Files
F82178995: D5191.diff
Fri, Apr 26, 5:37 AM
Unknown Object (File)
Dec 20 2023, 12:51 AM
Unknown Object (File)
Nov 30 2023, 8:52 AM
Unknown Object (File)
Nov 13 2023, 11:43 AM
Unknown Object (File)
Oct 25 2023, 5:56 AM
Unknown Object (File)
Oct 4 2023, 6:51 PM
Unknown Object (File)
Sep 10 2023, 8:06 AM
Unknown Object (File)
Sep 6 2023, 4:15 PM
Subscribers

Details

Summary

To support userspace audio deamons like Virtual OSS, /dev/sndstat is made writeable to facilitate more smooth integration.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

hselasky retitled this revision from to Make /dev/sndstat writeable.
hselasky updated this object.
hselasky edited the test plan for this revision. (Show Details)
hselasky added a reviewer: mav.
hselasky set the repository for this revision to rS FreeBSD src repository - subversion.

I have no serious objections. The idea of writing this device info just in textual form looks somewhat simplistic to me, but I can live with that, if you think it is fine.

sys/dev/sound/pcm/sndstat.c
81 ↗(On Diff #13006)

Does this really help, or just obfuscate the code?

258 ↗(On Diff #13006)

What's the idea of these dummy acquire/release now?

388 ↗(On Diff #13006)

I worry that some software may incorrectly parse this.

sys/dev/sound/pcm/sndstat.c
81 ↗(On Diff #13006)

It is quite common to define macros when locking. I think it makes it more readable.

258 ↗(On Diff #13006)

It's kind of like Read/Copy/Update lock.

If you look where sndstat_acquire is used:

pcm_unregister():
...
        PCM_LOCK(d);
        d->flags |= SD_F_DYING;
        d->flags &= ~SD_F_REGISTERED;
        PCM_UNLOCK(d);
...
sndstat_release();

The dummy lock/unlock ensures that next time someone reads the sound status it sees that the device is gone. Or if it was currently iterating that it waits for that.

I'll look into it a bit and see if there are any races left.

388 ↗(On Diff #13006)

Yes, it's a risk. I checked some tools like pulseaudio() and they mostly look for pcm%d . I can check a bit more.

hselasky edited edge metadata.

Improve patch as per mav's suggestions.

Remove now superfluous sndstat_acquire() and sndstat_release() functions.

Re-add PCM_REGISTERED() check.

mav edited edge metadata.

I have no objections.

This revision is now accepted and ready to land.Feb 9 2016, 2:20 PM
This revision was automatically updated to reflect the committed changes.