Sam Good wrote: > From sndio design, it looks like non-blocking (like in sio_write) can be > done with poll. sio_pollfd can be used to obtain the pollfd struct which > contains the file descriptor fd. The fd descriptor seems to be equivalent > to the unix stream for the sound playing device. > > Would it be possible to use the file descriptor fd with kqueue instead of > poll? > > > (I wanted to adapt an application that uses kqueue for internet/TCP server > listening, and be able to add an audio playing capability; I wanted to try > to use kqueue for both. I also wanted to learn more about using kqueue) > > I wrote a basic program that gets the sndio playing device file descriptor > fd from sio_pollfd, and then adds that fd to the kevent with filter > EVFILT_WRITE. Then loop with kevent appears to return that the fd is ready > for WRITE, and the kevent return data shows '4096' (available space in > buffer for write) but sio_write returns with value 0, indicating that no > bytes could be written into the output buffer. > > > Is there something different about the file descriptor for the sndio > output device, that kqueue/kevent can't be used? > > thanks.
Did you start the device before writing to it ? (read sio_start(3))