From 0e023ff2146d086d10c63b8e19bd263ce40d05fe Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Mon, 14 Jan 2013 00:59:54 +0100 Subject: Pass pfinet errors to io_select callers This will be needed to properly support poll in glibc. * pfinet/glue-include/linux/poll.h (POLLERR): Define to 0x1000. * pfinet/io-ops.c (S_io_select): Look for POLLERR condition. On such condition, return EIO. --- pfinet/glue-include/linux/poll.h | 2 +- pfinet/io-ops.c | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'pfinet') diff --git a/pfinet/glue-include/linux/poll.h b/pfinet/glue-include/linux/poll.h index b21c3c71..c785ea74 100644 --- a/pfinet/glue-include/linux/poll.h +++ b/pfinet/glue-include/linux/poll.h @@ -9,7 +9,7 @@ #define POLLWRNORM SELECT_WRITE #define POLLWRBAND SELECT_WRITE #define POLLPRI SELECT_URG -#define POLLERR SELECT_READ | SELECT_WRITE +#define POLLERR 0x1000 #define POLLHUP SELECT_READ typedef struct poll_table_struct { } poll_table; diff --git a/pfinet/io-ops.c b/pfinet/io-ops.c index 0236c594..5f3b1e90 100644 --- a/pfinet/io-ops.c +++ b/pfinet/io-ops.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include "io_S.h" @@ -256,8 +257,9 @@ S_io_select (struct sock_user *user, mach_msg_type_name_t reply_type, int *select_type) { - const int want = *select_type; + const int want = *select_type | POLLERR; int avail; + int ret = 0; if (!user) return EOPNOTSUPP; @@ -293,12 +295,15 @@ S_io_select (struct sock_user *user, while ((avail & want) == 0); } - /* We got something. */ - *select_type = avail; + if (avail & POLLERR) + ret = EIO; + else + /* We got something. */ + *select_type = avail; pthread_mutex_unlock (&global_lock); - return 0; + return ret; } error_t -- cgit v1.2.3