From c5daeee2949d10372f94dd6f85aa61f337986cfd Mon Sep 17 00:00:00 2001 From: Alexandre Ratchov Date: Fri, 4 Nov 2016 19:12:07 +0100 Subject: [PATCH] On OSS/FreeBSD, set poll(2) threshold to 1 byte, so that it returs POLLIN/POLLOUT whenever read/write can be called without blocking. By default OSS use 1 block of threshold. --- libsndio/sio_oss.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libsndio/sio_oss.c b/libsndio/sio_oss.c index 85045a9..75b5124 100644 --- a/libsndio/sio_oss.c +++ b/libsndio/sio_oss.c @@ -232,7 +232,7 @@ sio_oss_getfd(const char *str, unsigned int mode, int nbio) const char *p; char path[DEVPATH_MAX]; unsigned int devnum; - int fd, flags; + int fd, flags, val; p = _sndio_parsetype(str, "rsnd"); if (p == NULL) { @@ -263,6 +263,12 @@ sio_oss_getfd(const char *str, unsigned int mode, int nbio) DPERROR(path); return -1; } + val = 1; + if (ioctl(fd, SNDCTL_DSP_LOW_WATER, &val) < 0) { + DPERROR("sio_oss_start: LOW_WATER"); + close(fd); + return -1; + } return fd; }