From 257be19c47e62cd0553e740599802cec9182b37c Mon Sep 17 00:00:00 2001 From: Takashi Sakamoto Date: Sun, 27 Jan 2019 17:36:22 +0900 Subject: [PATCH] axfer: allow to be compiled with glibc-2.11 or former The program, axfer, was developed in userspace with glibc-2.28. This userspace is mostly compliant to POSIX:2008 and some additional macros for poll event are officially available. The glibc supports them as a default since its v2.12 release. It will be failed to be compiled with old glibc or the other libraries for C standard APIs. One of the purpose of axfer is an better alternative of aplay. In a point of the purpose, it's preferable to be compiled with the old libraries. This commit adds conditional macros to be compiled with libraries for old compliance level of POSIX. Reported-by: Jay Foster Fixes: fce16d9279b6 ('axfer: add an implementation of waiter for select(2)') Signed-off-by: Takashi Sakamoto Signed-off-by: Takashi Iwai --- axfer/waiter-select.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/axfer/waiter-select.c b/axfer/waiter-select.c index a35ea85..a2776e5 100644 --- a/axfer/waiter-select.c +++ b/axfer/waiter-select.c @@ -15,10 +15,19 @@ #include // Except for POLLERR. -#define POLLIN_SET (POLLRDNORM | POLLRDBAND | POLLIN | POLLHUP) -#define POLLOUT_SET (POLLWRBAND | POLLWRNORM | POLLOUT) +#ifdef POLLRDNORM +// This program is for userspace compliant to POSIX 2008 (IEEE 1003.1:2008). +// This is the default compliance level since glibc-2.12 or later. +# define POLLIN_SET (POLLRDNORM | POLLRDBAND | POLLIN | POLLHUP) +# define POLLOUT_SET (POLLWRBAND | POLLWRNORM | POLLOUT) +#else +// However it's allowed to be for old compliance levels. +# define POLLIN_SET (POLLIN | POLLHUP) +# define POLLOUT_SET (POLLOUT) +#endif #define POLLEX_SET (POLLPRI) + struct select_state { fd_set rfds_rd; fd_set rfds_wr; -- 2.47.1