From 6c8716e9dabb5aece68eec87bbf4e322ff92e6a2 Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Sun, 1 Dec 2013 18:04:24 +0100 Subject: [PATCH] TIOCINQ/TIOCOUTQ is not available everywhere. E.g. on NetBSD TIOCINQ is not available, but FIONREAD seems to do pretty much the same thing. --- serialport.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/serialport.c b/serialport.c index bbb53bd..0276567 100644 --- a/serialport.c +++ b/serialport.c @@ -50,11 +50,21 @@ #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