From 346792a1c9b50fd53cf8423a5ba0a879c61f4820 Mon Sep 17 00:00:00 2001 From: Alexandre Ratchov Date: Sat, 27 Oct 2012 12:08:26 +0000 Subject: make midi code use non-blocking i/o as does audio code, in order to make both look similar --- lib/libsndio/mio_aucat.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'lib/libsndio/mio_aucat.c') diff --git a/lib/libsndio/mio_aucat.c b/lib/libsndio/mio_aucat.c index 15b073c0491..6f5caa8fbba 100644 --- a/lib/libsndio/mio_aucat.c +++ b/lib/libsndio/mio_aucat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mio_aucat.c,v 1.7 2012/04/11 06:05:43 ratchov Exp $ */ +/* $OpenBSD: mio_aucat.c,v 1.8 2012/10/27 12:08:25 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov * @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -40,6 +41,7 @@ struct mio_aucat_hdl { static void mio_aucat_close(struct mio_hdl *); static size_t mio_aucat_read(struct mio_hdl *, void *, size_t); static size_t mio_aucat_write(struct mio_hdl *, const void *, size_t); +static int mio_aucat_nfds(struct mio_hdl *); static int mio_aucat_pollfd(struct mio_hdl *, struct pollfd *, int); static int mio_aucat_revents(struct mio_hdl *, struct pollfd *); @@ -47,8 +49,9 @@ static struct mio_ops mio_aucat_ops = { mio_aucat_close, mio_aucat_write, mio_aucat_read, + mio_aucat_nfds, mio_aucat_pollfd, - mio_aucat_revents, + mio_aucat_revents }; struct mio_hdl * @@ -63,7 +66,7 @@ mio_aucat_open(const char *str, unsigned int mode, if (!aucat_open(&hdl->aucat, str, mode, type)) goto bad; mio_create(&hdl->mio, &mio_aucat_ops, mode, nbio); - if (!aucat_setfl(&hdl->aucat, nbio, &hdl->mio.eof)) + if (!aucat_setfl(&hdl->aucat, 1, &hdl->mio.eof)) goto bad; return (struct mio_hdl *)hdl; bad: @@ -102,6 +105,12 @@ mio_aucat_write(struct mio_hdl *sh, const void *buf, size_t len) return aucat_wdata(&hdl->aucat, buf, len, 1, &hdl->mio.eof); } +static int +mio_aucat_nfds(struct mio_hdl *sh) +{ + return 1; +} + static int mio_aucat_pollfd(struct mio_hdl *sh, struct pollfd *pfd, int events) { -- cgit v1.2.3