Find a file
Christos Margiolis 5d980fadf7 sound: Handle unavailable devices in various OSS IOCTLs
mixer(8)'s -a option is used to print information about all mixer
devices in the system. To do this, it loops from 0 to
mixer_get_nmixers(), and tries to open "/dev/mixer%d". However, this
approach doesn't work when there are disabled/unregistered mixers in the
system, or when an audio device simply doesn't have a mixer.

mixer_get_nmixers() calls SNDCTL_SYSINFO and returns
oss_sysinfo->nummixers, whose value is the number of currently _enabled_
mixers only. Taking the bug report mentioned below (277615) as an
example, suppose a system with 8 mixer devices total, but 3 of them are
either disabled or non-existent, which means they will not show up under
/dev, meaning we have 5 enabled mixer devices, which is also what the
value of oss_sysinfo->nummixers will be. What mixer(8) will do is loop
from 0 to 5 (instead of 8), and start calling mixer_open() on
/dev/mixer0, up to /dev/mixer4, and as is expected, the first call will
fail right away, hence the error shown in the bug report.

To fix this, modify oss_sysinfo->nummixers to hold the value of the
maximum unit in the system, which, although not necessarily "correct",
is more intuitive for applications that will want to use this value to
loop through all mixer devices.

Additionally, notify applications that a device is
unavailable/unregistered instead of skipping it. The current
implementations of SNDCTL_AUDIOINFO, SNDCTL_MIXERINFO and
SNDCTL_CARDINFO break applications that expect to get information about
a device that is skipped. Related discussion can be found here:
https://reviews.freebsd.org/D45135#1029526

It has to be noted, that other applications, apart from mixer(8), suffer
from this.

PR:		277615
Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D45256
2024-05-23 02:57:17 +02:00
.cirrus-ci
.github Vendor import of libfido2 1.14.0 2024-05-03 20:05:23 -04:00
bin man filesystems: fix xrefs after move to section 4 2024-05-16 10:25:29 -06:00
cddl libzpool: Disable -Wpointer-to-int-cast warnings for GCC 2024-05-07 13:54:00 -07:00
contrib libdiff: Detect and recover from file truncation. 2024-05-20 15:26:33 +02:00
crypto heimdal: Fix compiling hdb ldap as a module 2024-04-23 22:54:20 -07:00
etc libdiff: Add a test for the truncation issue. 2024-05-20 15:26:42 +02:00
gnu misc: Remove ancient SCCS tags. 2023-11-26 22:23:27 -07:00
include ssp: appease -Wgnu-statement-expression-from-macro-expansion 2024-05-14 18:22:18 -05:00
kerberos5 kerberos5: Mitigate the possibility of using an old libcrypto 2024-01-18 07:12:14 -08:00
lib sound: Handle unavailable devices in various OSS IOCTLs 2024-05-23 02:57:17 +02:00
libexec rc.d: add a service jails config to all base system services 2024-05-22 15:41:49 +02:00
release release: make dependencies, not recursive make 2024-05-09 00:52:25 -07:00
rescue Remove gbde from rescue 2024-05-07 07:23:38 +00:00
sbin ifconfig: Redo fix vlan/vlanproto reconfiguration 2024-05-22 00:35:01 +08:00
secure openssl: don't export nonexistant symbols 2024-04-22 21:28:51 +01:00
share Fix typo 2024-05-22 15:10:09 -06:00
stand arm64: Allow userspace to be built with PAC and BTI 2024-05-22 17:02:26 +00:00
sys sound: Handle unavailable devices in various OSS IOCTLs 2024-05-23 02:57:17 +02:00
targets Remove gbde from the "userland" pseudo-target 2024-05-07 07:35:14 +00:00
tests if_vlan: handle VID conflicts 2024-05-22 09:08:02 +02:00
tools autofs: Fix cross-threading on file to delete 2024-05-22 15:10:08 -06:00
usr.bin usr.bin/top: fix displaying load average for loads of at least 100 2024-05-22 16:47:46 +02:00
usr.sbin zzz: Fix output formatting when suspend state not supported 2024-05-22 14:21:18 -06:00
.arcconfig arcanist: use FreeBSD/git project repository instead of FreeBSD/svn 2022-08-23 14:16:41 +00:00
.arclint
.cirrus.yml Vendor import of libcbor 0.11.0 2024-05-03 18:27:44 -04:00
.clang-format clang-format: Minor tweaks 2024-04-30 17:33:43 -04:00
.git-blame-ignore-revs Add another commit to .git-blame-ignore-revs 2024-03-15 23:11:52 +00:00
.gitattributes Vendor import of libfido2 1.14.0 2024-05-03 20:05:23 -04:00
.gitignore Vendor import of libfido2 1.14.0 2024-05-03 20:05:23 -04:00
.mailmap mailmap: Translate olce's personal address to olce@FreeBSD.org 2024-01-04 15:59:01 +01:00
CONTRIBUTING.md CONTRIBUTING.md/style: spring cleaning 2024-05-10 15:07:03 -06:00
COPYRIGHT copyright: Bump the copyright date. 2023-12-31 23:15:43 -07:00
LOCKS Update LOCKS for Git 2023-12-26 10:28:25 -07:00
MAINTAINERS MAINTAINERS: change linuxkpi review Phabricator group. 2024-01-16 19:23:39 +00:00
Makefile contrib/bsddialog: Import version 1.0.2 2024-05-16 15:24:49 +02:00
Makefile.inc1 Improve broken-on-gcc checks 2024-05-17 21:50:57 +01:00
Makefile.libcompat build{libcompat}: Pass UNIVERSE_TOOLCHAIN_PATH to the _lc_build-tools submake 2023-08-21 21:00:45 -07:00
Makefile.sys.inc Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
ObsoleteFiles.inc man filesystems: ObsoleteFiles after move to sec 4 2024-05-16 10:25:13 -06:00
README.md contrib/bsddialog: Import version 1.0.2 2024-05-16 15:24:49 +02:00
RELNOTES RELNOTES: document MAC/do 2024-05-22 14:05:57 +02:00
UPDATING package: move OpenBSM auditing into its own package 2024-04-28 22:33:06 -06:00

FreeBSD Source:

This is the top level of the FreeBSD source directory.

FreeBSD is an operating system used to power modern servers, desktops, and embedded platforms. A large community has continually developed it for more than thirty years. Its advanced networking, security, and storage features have made FreeBSD the platform of choice for many of the busiest web sites and most pervasive embedded networking and storage devices.

For copyright information, please see the file COPYRIGHT in this directory. Additional copyright information also exists for some sources in this tree - please see the specific source directories for more information.

The Makefile in this directory supports a number of targets for building components (or all) of the FreeBSD source tree. See build(7), config(8), FreeBSD handbook on building userland, and Handbook for kernels for more information, including setting make(1) variables.

For information on the CPU architectures and platforms supported by FreeBSD, see the FreeBSD website's Platforms page.

For official FreeBSD bootable images, see the release page.

Source Roadmap:

Directory Description
bin System/user commands.
cddl Various commands and libraries under the Common Development and Distribution License.
contrib Packages contributed by 3rd parties.
crypto Cryptography stuff (see crypto/README).
etc Template files for /etc.
gnu Commands and libraries under the GNU General Public License (GPL) or Lesser General Public License (LGPL). Please see gnu/COPYING and gnu/COPYING.LIB for more information.
include System include files.
kerberos5 Kerberos5 (Heimdal) package.
lib System libraries.
libexec System daemons.
release Release building Makefile & associated tools.
rescue Build system for statically linked /rescue utilities.
sbin System commands.
secure Cryptographic libraries and commands.
share Shared resources.
stand Boot loader sources.
sys Kernel sources (see sys/README.md).
targets Support for experimental DIRDEPS_BUILD
tests Regression tests which can be run by Kyua. See tests/README for additional information.
tools Utilities for regression testing and miscellaneous tasks.
usr.bin User commands.
usr.sbin System administration commands.

For information on synchronizing your source tree with one or more of the FreeBSD Project's development branches, please see FreeBSD Handbook.