diff options
author | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2011-05-09 17:34:15 +0000 |
---|---|---|
committer | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2011-05-09 17:34:15 +0000 |
commit | d1bc5687d429a03f33c95e5e5b6008d577a4a0e4 (patch) | |
tree | 74cfd378f8514efc6cc2e14714b091b92961643e /lib/libsndio | |
parent | c6d7cee1db8f0fc53eac8038c6d9fda4fd200a4f (diff) |
in sio_psleep(), use an array of SIO_MAXNFDS pollfd strucures rather
than a single one. No behaviour change
Diffstat (limited to 'lib/libsndio')
-rw-r--r-- | lib/libsndio/sio.c | 12 | ||||
-rw-r--r-- | lib/libsndio/sio_priv.h | 4 |
2 files changed, 10 insertions, 6 deletions
diff --git a/lib/libsndio/sio.c b/lib/libsndio/sio.c index af15bdac0a8..1b1376c7d4f 100644 --- a/lib/libsndio/sio.c +++ b/lib/libsndio/sio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sio.c,v 1.5 2011/05/06 10:25:17 ratchov Exp $ */ +/* $OpenBSD: sio.c,v 1.6 2011/05/09 17:34:14 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> * @@ -216,19 +216,21 @@ sio_getcap(struct sio_hdl *hdl, struct sio_cap *cap) static int sio_psleep(struct sio_hdl *hdl, int event) { - struct pollfd pfd; + struct pollfd pfd[SIO_MAXNFDS]; int revents; + nfds_t nfds; + nfds = sio_nfds(hdl); for (;;) { - sio_pollfd(hdl, &pfd, event); - while (poll(&pfd, 1, -1) < 0) { + sio_pollfd(hdl, pfd, event); + while (poll(pfd, nfds, -1) < 0) { if (errno == EINTR) continue; DPERROR("sio_psleep: poll"); hdl->eof = 1; return 0; } - revents = sio_revents(hdl, &pfd); + revents = sio_revents(hdl, pfd); if (revents & POLLHUP) { DPRINTF("sio_psleep: hang-up\n"); return 0; diff --git a/lib/libsndio/sio_priv.h b/lib/libsndio/sio_priv.h index 1d7ed73e7b1..385a3a17b27 100644 --- a/lib/libsndio/sio_priv.h +++ b/lib/libsndio/sio_priv.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sio_priv.h,v 1.2 2011/04/16 10:52:22 ratchov Exp $ */ +/* $OpenBSD: sio_priv.h,v 1.3 2011/05/09 17:34:14 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> * @@ -20,6 +20,8 @@ #include <sys/param.h> #include "sndio.h" +#define SIO_MAXNFDS 4 + /* * private ``handle'' structure */ |