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.
This commit is contained in:
Alexandre Ratchov 2016-11-04 19:12:07 +01:00
parent 3896b504e3
commit 0eaaa8eb20
1 changed files with 7 additions and 1 deletions

View File

@ -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;
}