OSDN Git Service

axfer: allow to be compiled with glibc-2.11 or former
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Sun, 27 Jan 2019 08:36:22 +0000 (17:36 +0900)
committerTakashi Iwai <tiwai@suse.de>
Tue, 29 Jan 2019 15:45:51 +0000 (16:45 +0100)
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>
axfer/waiter-select.c

index a35ea85..a2776e5 100644 (file)
 #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;