diff options
author | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2024-07-23 08:36:52 +0000 |
---|---|---|
committer | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2024-07-23 08:36:52 +0000 |
commit | 64773c6486a50f812fcf86223fed3cf5070a1e4f (patch) | |
tree | 1f6d8959f09264a33c4f0afaea0ebe285b95b670 /lib/libsndio | |
parent | 19fb8b273f7235758c33de112b1bfbd866528a84 (diff) |
libsndio: Don't use poll(2) for output on the control device.
The AUDIO_MIXER_WRITE ioctl always succeeds without blocking, so no
need to use poll(2) for output. The audio(4) control device driver
doesn't implement the corresponding struct filterops anyway.
Fixes delayed level settings.
Diffstat (limited to 'lib/libsndio')
-rw-r--r-- | lib/libsndio/sioctl_sun.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/libsndio/sioctl_sun.c b/lib/libsndio/sioctl_sun.c index 64129ac2a43..886c8207efa 100644 --- a/lib/libsndio/sioctl_sun.c +++ b/lib/libsndio/sioctl_sun.c @@ -472,9 +472,18 @@ sioctl_sun_pollfd(struct sioctl_hdl *addr, struct pollfd *pfd, int events) { struct sioctl_sun_hdl *hdl = (struct sioctl_sun_hdl *)addr; + hdl->events = events; + + /* + * The audio(4) driver doesn't support POLLOUT, so if it is + * requested, don't set the struct pollfd. The AUDIO_MIXER_WRITE + * ioctl never blocks, so just return POLLOUT in sioctl_sun_revents(). + */ + if (events & POLLOUT) + return 0; + pfd->fd = hdl->fd; pfd->events = POLLIN; - hdl->events = events; return 1; } @@ -485,6 +494,9 @@ sioctl_sun_revents(struct sioctl_hdl *arg, struct pollfd *pfd) struct volume *vol; int idx, n; + if (hdl->events & POLLOUT) + return POLLOUT; + if (pfd->revents & POLLIN) { while (1) { n = read(hdl->fd, &idx, sizeof(int)); @@ -514,5 +526,5 @@ sioctl_sun_revents(struct sioctl_hdl *arg, struct pollfd *pfd) return POLLHUP; } } - return hdl->events & POLLOUT; + return 0; } |