HomeFreeBSD

virtual_oss(8): Improve hw.snd.basename_clone handling

Description

virtual_oss(8): Improve hw.snd.basename_clone handling

If we request a /dev/dsp virtual_oss(8) device, we have to replace the
sound(4) one by first disabling hw.snd.basename_clone. This sysctl tells
sound(4) to not create the /dev/dsp alias for the default device. There
are currently two issues with the way this is handled by virtual_oss(8),
however:

  1. It uses system(3) instead of sysctlbyname(3).
  2. It does not restore hw.snd.basename_clone to its original value, so if prior to virtual_oss(8) running, hw.snd.basename_clone was enabled (which is the case by default), and it is closed at some point, hw.snd.basename_clone stays disabled, which is annoying, because users have to manually restore it, otherwise applications that open the default device (i.e., most) will not work.

Fix both issues.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D53621

Details

Provenance
christosAuthored on Tue, Nov 11, 12:07 PM
Reviewer
markj
Differential Revision
D53621: virtual_oss(8): Improve hw.snd.basename_clone handling
Parents
rG7bedc4634d89: virtual_oss(8): Use kldload(2) instead of system(3)
Branches
Unknown
Tags
Unknown