Commit Diff


commit - 12d24edabcafcd71848612b2bc09a5ceeff5ef36
commit + e3693ed949ccfcad6170d85b2db9e86499e1fc52
blob - bf96e297be5f68bf342f346359d4255291accf9f
blob + 8319888390074988e37923f81927ba6444f75144
--- bufio.c
+++ bufio.c
@@ -27,7 +27,6 @@
 
 #include <assert.h>
 #include <errno.h>
-#include <poll.h>
 #include <stdarg.h>
 #include <stdint.h>
 #include <stdio.h>
@@ -37,6 +36,7 @@
 #include <unistd.h>
 
 #include "bufio.h"
+#include "ev.h"		/* for EV_* flags */
 
 int
 buf_init(struct buf *buf)
@@ -170,17 +170,17 @@ bufio_starttls(struct bufio *bio, const char *host, in
 	return (0);
 }
 
-short
-bufio_pollev(struct bufio *bio)
+int
+bufio_ev(struct bufio *bio)
 {
 	short		 ev;
 
 	if (bio->pflags)
 		return (bio->pflags);
 
-	ev = POLLIN;
+	ev = EV_READ;
 	if (bio->wbuf.len != 0)
-		ev |= POLLOUT;
+		ev |= EV_WRITE;
 
 	return (ev);
 }
@@ -203,7 +203,7 @@ bufio_read(struct bufio *bio)
 		switch (r) {
 		case TLS_WANT_POLLIN:
 		case TLS_WANT_POLLOUT:
-			bio->pflags = POLLIN | POLLOUT;
+			bio->pflags = EV_READ | EV_WRITE;
 			errno = EAGAIN;
 			return (-1);
 		case -1:
@@ -232,7 +232,7 @@ bufio_write(struct bufio *bio)
 		switch (w = tls_write(bio->ctx, wbuf->buf, wbuf->len)) {
 		case TLS_WANT_POLLIN:
 		case TLS_WANT_POLLOUT:
-			bio->pflags = POLLIN | POLLOUT;
+			bio->pflags = EV_WRITE | EV_READ;
 			errno = EAGAIN;
 			return (-1);
 		case -1: