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 <jay@systech.com>
Fixes:
fce16d9279b6 ('axfer: add an implementation of waiter for select(2)')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
#include <sys/select.h>
// 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;