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 <jay@systech.com>
Fixes: fce16d9279 ('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>
This commit is contained in:
Takashi Sakamoto 2019-01-27 17:36:22 +09:00 committed by Takashi Iwai
parent 2ba2066008
commit 257be19c47

View file

@ -15,10 +15,19 @@
#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;