X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=support%2Fserial.c;h=5e3d732c005170bbcd4052841fad7dc3b27b342c;hb=c9fc371e31f577834582077ab8aee7682d1985bb;hp=94d7e0b19f5d72c19bb9aa3808b17e0d22f391a8;hpb=48992d4b3f8b568be17180372160d2f3e03b8ccb;p=mono.git diff --git a/support/serial.c b/support/serial.c index 94d7e0b19f5..5e3d732c005 100644 --- a/support/serial.c +++ b/support/serial.c @@ -34,7 +34,11 @@ /* sys/time.h (for timeval) is required when using osx 10.3 (but not 10.4) */ /* IOKit is a private framework in iOS, so exclude there */ -#if defined(__APPLE__) && !defined(HOST_IOS) +#if defined(__APPLE__) && !defined(HOST_IOS) && !defined(HOST_WATCHOS) && !defined(HOST_APPLETVOS) +#define HAVE_IOKIT 1 +#endif + +#if defined(HAVE_IOKIT) #include #include #include @@ -171,6 +175,11 @@ discard_buffer (int fd, gboolean input) 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) { @@ -384,7 +393,7 @@ set_attributes (int fd, int baud_rate, MonoParity parity, int dataBits, MonoStop if (cfsetospeed (&newtio, baud_rate) < 0 || cfsetispeed (&newtio, baud_rate) < 0) return FALSE; } else { -#if __linux__ || (defined(__APPLE__) && !defined(HOST_IOS)) +#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 @@ -417,7 +426,7 @@ set_attributes (int fd, int baud_rate, MonoParity parity, int dataBits, MonoStop { return FALSE; } -#elif defined(__APPLE__) && !defined(HOST_IOS) +#elif defined(HAVE_IOKIT) speed_t speed = baud_rate; if (ioctl(fd, IOSSIOSPEED, &speed) == -1) return FALSE;