https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=289441

--- Comment #1 from Damjan Jovanovic <[email protected]> ---
I think it's because:

In /usr/src/sys/dev/sound/pcm/dsp.c dsp_open() calls dsp_chn_alloc(), which
sets CHN_F_NBIO if O_NONBLOCK was set, then later calls chn_reset():

---snip---
        (*ch)->flags |= CHN_F_BUSY;
        if (flags & O_NONBLOCK)
                (*ch)->flags |= CHN_F_NBIO;
        if (flags & O_EXCL)
                (*ch)->flags |= CHN_F_EXCLUSIVE;
        (*ch)->pid = pid;
        strlcpy((*ch)->comm, (comm != NULL) ? comm : CHN_COMM_UNKNOWN,
            sizeof((*ch)->comm));

        if ((err = chn_reset(*ch, (*ch)->format, (*ch)->speed)) != 0)
                return (err);
---snip---

but chn_reset() in /usr/src/sys/dev/sound/pcm/channel.c clears all "flags"
except CHN_F_RESET, then selectively sets CHN_F_BITPERFECT:

---snip---
        c->flags &= CHN_F_RESET;
        c->interrupts = 0;
        c->timeout = 1;
        c->xruns = 0;

        c->flags |= (pcm_getflags(c->dev) & SD_F_BITPERFECT) ?
            CHN_F_BITPERFECT : 0;
---snip---

CHN_F_RESET is defined in channel.h (same directory) as:

---snip---
#define CHN_F_RESET             (CHN_F_BUSY | CHN_F_DEAD |              \
                                 CHN_F_VIRTUAL | CHN_F_HAS_VCHAN |      \
                                 CHN_F_VCHAN_DYNAMIC |                  \
                                 CHN_F_PASSTHROUGH | CHN_F_EXCLUSIVE)
---snip---

These flags lack CHK_F_NBIO, and would definitely clear it in chn_reset().

Maybe this is where the CHN_F_NBIO flag gets lost on open()?

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to