Page MenuHomeFreeBSD

sound: Honor CHN_F_NBIO
ClosedPublic

Authored by christos on Sep 11 2025, 7:07 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jan 17, 9:05 AM
Unknown Object (File)
Dec 25 2025, 4:24 AM
Unknown Object (File)
Dec 22 2025, 9:21 PM
Unknown Object (File)
Dec 22 2025, 5:04 PM
Unknown Object (File)
Dec 19 2025, 12:01 PM
Unknown Object (File)
Dec 18 2025, 7:51 PM
Unknown Object (File)
Dec 17 2025, 4:21 PM
Unknown Object (File)
Dec 16 2025, 6:42 PM

Details

Summary

If the device is opened with O_NONBLOCK, even though we check for it in
order to set CHN_F_NBIO, the subsequent chn_reset() calls will clear all
flags, except those set in CHN_F_RESET, which does not include
CHN_F_NBIO.

Add CHN_F_NBIO to CHN_F_RESET. Additionally, because primary channels
can be reused, make sure we do not unintentionally keep CHN_F_NBIO set
if the channel is re-opened, but without O_NONBLOCK.

PR: 289441
MFC after: 2 days

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Do we need to clear CHN_F_NBIO in dsp_close() too?

Do we need to clear CHN_F_NBIO in dsp_close() too?

So what the patch does should be enough since we always clear the flag on open(). Alternatively we could clear it only in dsp_close() only since all channels go through dsp_close(). I think the latter might be cleaner because we already clear flags there.

I agree, clearing CHN_F_NBIO in dsp_close() would be better. When debugging, if a closed channel has CHN_F_NBIO set, which then mysteriously disappears when it's re-opened, it could be confusing.

On https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=289441 I've attached a patch that clears CHN_F_NBIO in dsp_close() instead (I don't seem to have permission to attach it to this revision directly).

This revision is now accepted and ready to land.Sep 15 2025, 1:08 PM
This revision was automatically updated to reflect the committed changes.