#endif
/* sys/time.h (for timeval) is required when using osx 10.3 (but not 10.4) */
-#ifdef __APPLE__
+/* IOKit is a private framework in iOS, so exclude there */
+#if defined(__APPLE__) && !defined(HOST_IOS) && !defined(HOST_WATCHOS) && !defined(HOST_APPLETVOS)
+#define HAVE_IOKIT 1
+#endif
+
+#if defined(HAVE_IOKIT)
#include <sys/time.h>
#include <IOKit/IOKitLib.h>
#include <IOKit/serial/IOSerialKeys.h>
gint32
get_bytes_in_buffer (int fd, gboolean input)
{
+#if defined(__HAIKU__)
+ /* FIXME: Haiku doesn't support TIOCOUTQ nor FIONREAD on fds */
+ return -1;
+#define TIOCOUTQ 0
+#endif
gint32 retval;
if (ioctl (fd, input ? FIONREAD : TIOCOUTQ, &retval) == -1) {
if (cfsetospeed (&newtio, baud_rate) < 0 || cfsetispeed (&newtio, baud_rate) < 0)
return FALSE;
} else {
-#if __linux__ || __APPLE__
+#if __linux__ || defined(HAVE_IOKIT)
/* On Linux to set a custom baud rate, we must set the
* "standard" baud_rate to 38400. On Apple we set it purely
{
return FALSE;
}
-#elif __APPLE__
+#elif defined(HAVE_IOKIT)
speed_t speed = baud_rate;
if (ioctl(fd, IOSSIOSPEED, &speed) == -1)
return FALSE;