Page MenuHomeFreeBSD

D53621.id165972.diff
No OneTemporary

D53621.id165972.diff

diff --git a/usr.sbin/virtual_oss/virtual_oss/main.c b/usr.sbin/virtual_oss/virtual_oss/main.c
--- a/usr.sbin/virtual_oss/virtual_oss/main.c
+++ b/usr.sbin/virtual_oss/virtual_oss/main.c
@@ -31,6 +31,7 @@
#include <sys/nv.h>
#include <sys/sndstat.h>
#include <sys/soundcard.h>
+#include <sys/sysctl.h>
#include <dlfcn.h>
#include <errno.h>
@@ -1617,6 +1618,7 @@
static int voss_dsp_perm = 0666;
static int voss_do_background;
+static int voss_baseclone = 0;
static const char *voss_pid_path;
uint32_t voss_dsp_rx_refresh;
@@ -1883,8 +1885,19 @@
* Detect /dev/dsp creation and try to disable system
* basename cloning automatically:
*/
- if (strcmp(ptr->oss_name, "dsp") == 0)
- system("sysctl hw.snd.basename_clone=0");
+ if (strcmp(ptr->oss_name, "dsp") == 0) {
+ size_t size;
+
+ x = 0;
+ size = sizeof(int);
+ if (sysctlbyname("hw.snd.basename_clone",
+ &voss_baseclone, &size, NULL, 0) < 0)
+ return ("Could not read hw.snd.basename_clone");
+ if (voss_baseclone &&
+ sysctlbyname("hw.snd.basename_clone", NULL, 0,
+ &x, size) < 0)
+ return ("Could not disable hw.snd.basename_clone");
+ }
/* create DSP character device */
pdev = cuse_dev_create(&vclient_oss_methods, ptr, NULL,
@@ -2619,5 +2632,10 @@
if (voss_ctl_device[0] != 0)
cuse_dev_destroy(pdev);
+ /* Restore hw.snd.basename_clone if it was unset by us. */
+ if (voss_baseclone && sysctlbyname("hw.snd.basename_clone", NULL, 0,
+ &voss_baseclone, sizeof(int)) < 0)
+ err(EX_SOFTWARE, "Could not enable hw.snd.basename_clone");
+
return (0);
}

File Metadata

Mime Type
text/plain
Expires
Wed, Jul 22, 10:45 PM (8 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35384648
Default Alt Text
D53621.id165972.diff (1 KB)

Event Timeline