The /dev/audioctlN files, when used in O_WRONLY mode offer the same
functionality as /dev/mixerN.

Ports don't use /dev/mixerN anymore, by switching mixerctl(4) to
/dev/audioctlN too, we remove the last /dev/mixerN user.

OK?

Index: mixerctl.1
===================================================================
RCS file: /cvs/src/usr.bin/mixerctl/mixerctl.1,v
retrieving revision 1.35
diff -u -p -r1.35 mixerctl.1
--- mixerctl.1  30 Jul 2018 17:24:25 -0000      1.35
+++ mixerctl.1  2 Apr 2020 20:22:34 -0000
@@ -68,7 +68,7 @@ This is the default, if no parameters ar
 .It Fl f Ar file
 Specify an alternative audio mixing device.
 The default is
-.Pa /dev/mixer0 .
+.Pa /dev/audioctl0 .
 .It Fl n
 Suppress printing of the variable name.
 .It Fl q
@@ -153,7 +153,7 @@ The audio mixer device to use.
 .El
 .Sh FILES
 .Bl -tag -width "/etc/mixerctl.confXXX" -compact
-.It Pa /dev/mixer0
+.It Pa /dev/audioctl0
 Default mixer audio device.
 .It Pa /etc/mixerctl.conf
 .Nm
Index: mixerctl.c
===================================================================
RCS file: /cvs/src/usr.bin/mixerctl/mixerctl.c,v
retrieving revision 1.32
diff -u -p -r1.32 mixerctl.c
--- mixerctl.c  28 Jun 2019 13:35:02 -0000      1.32
+++ mixerctl.c  2 Apr 2020 20:22:34 -0000
@@ -249,7 +249,7 @@ main(int argc, char **argv)
        int ndev;
 
        if ((file = getenv("MIXERDEVICE")) == 0 || *file == '\0')
-               file = "/dev/mixer";
+               file = "/dev/audioctl0";
 
        while ((ch = getopt(argc, argv, "af:nqtvw")) != -1) {
                switch (ch) {
@@ -284,15 +284,12 @@ main(int argc, char **argv)
        if (argc == 0 && tflag == 0)
                aflag = 1;
 
-       if (unveil(file, "rw") == -1)
+       if (unveil(file, "w") == -1)
                err(1, "unveil");
 
-       if ((fd = open(file, O_RDWR)) == -1) {
+       if ((fd = open(file, O_WRONLY)) == -1) {
                if (unveil(file, "r") == -1)
                        err(1, "unveil");
-
-               if ((fd = open(file, O_RDONLY)) == -1)
-                       err(1, "%s", file);
        }
 
        if (unveil(NULL, NULL) == -1)

Reply via email to