Page MenuHomeFreeBSD

mixer(3): Implement mixer_get_path() function
ClosedPublic

Authored by christos on May 20 2024, 4:44 PM.
Tags
None
Referenced Files
F115163557: D45275.diff
Mon, Apr 21, 1:33 AM
Unknown Object (File)
Sat, Apr 12, 2:46 PM
Unknown Object (File)
Mar 16 2025, 8:22 AM
Unknown Object (File)
Feb 22 2025, 2:01 PM
Unknown Object (File)
Feb 2 2025, 8:19 AM
Unknown Object (File)
Jan 26 2025, 12:25 PM
Unknown Object (File)
Jan 26 2025, 4:33 AM
Unknown Object (File)
Jan 25 2025, 9:44 AM
Subscribers

Details

Summary

This is better than hardcoding device paths in mixer applications.

Sponsored by: The FreeBSD Foundation
MFC after: 1 day

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 57803
Build 54691: arc lint + arc unit

Event Timeline

lib/libmixer/mixer.c
503

With this check buffer size can still be insufficient to hold BASEPATH + unit + '\0'. We should return an error in that case. Maybe check after strlcpy() and sndprintf()?

lib/libmixer/mixer.c
503

It will be insufficient indeed. I added this to make sure it *at least* fits "/dev/mixer". We could bump this to something like BASEPATH + 3 (are we gonna have more than 3-digit units) +'\0'.

lib/libmixer/mixer.c
503

I think there's an upper limit to the possible number of pcm devices somewhere, but I'd suggest to check the return values of strlcpy() and snprintf() instead. That's what they are there for.

christos marked 2 inline comments as done.

Address Florian's comments.

Mention EXAMPLES section in mixer_get_nmixers().

This revision is now accepted and ready to land.May 22 2024, 12:54 PM