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)
Wed, Oct 15, 8:32 AM
Unknown Object (File)
Sun, Oct 12, 12:43 PM
Unknown Object (File)
Fri, Oct 10, 5:15 PM
Unknown Object (File)
Fri, Oct 10, 5:15 PM
Unknown Object (File)
Fri, Oct 10, 5:15 PM
Unknown Object (File)
Fri, Oct 10, 5:15 PM
Unknown Object (File)
Fri, Oct 10, 11:58 AM
Unknown Object (File)
Thu, Oct 9, 5:22 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 Skipped
Unit
Tests Skipped
Build Status
Buildable 67042
Build 63925: arc lint + arc unit

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.