E.g. on NetBSD TIOCINQ is not available, but FIONREAD seems to
do pretty much the same thing.
#include "libudev.h"
#include "linux/serial.h"
#include "linux_termios.h"
+
+/* TCGETX/TCSETX is not available everywhere. */
#if defined(TCGETX) && defined(TCSETX) && defined(HAVE_TERMIOX)
#define USE_TERMIOX
#endif
#endif
+/* TIOCINQ/TIOCOUTQ is not available everywhere. */
+#if !defined(TIOCINQ) && defined(FIONREAD)
+#define TIOCINQ FIONREAD
+#endif
+#if !defined(TIOCOUTQ) && defined(FIONWRITE)
+#define TIOCOUTQ FIONWRITE
+#endif
+
#ifndef _WIN32
#include "linux_termios.h"
#endif