From: Uwe Hermann Date: Sun, 1 Dec 2013 17:04:24 +0000 (+0100) Subject: TIOCINQ/TIOCOUTQ is not available everywhere. X-Git-Tag: libserialport-0.1.0~30 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=6c8716e9dabb5aece68eec87bbf4e322ff92e6a2;p=libserialport.git TIOCINQ/TIOCOUTQ is not available everywhere. E.g. on NetBSD TIOCINQ is not available, but FIONREAD seems to do pretty much the same thing. --- 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